Move contexts to own file not included by worker
This commit is contained in:
parent
4c40dc5321
commit
f9bcfd6740
8 changed files with 14 additions and 14 deletions
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
import React, { CSSProperties, forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
||||
import {MultiLayoutComponentId, SingleLayoutComponentId, State} from '../state/app-state'
|
||||
import { Model, ModelContext } from '../state/model';
|
||||
import { Model } from '../state/model';
|
||||
import { TabMenu } from 'primereact/tabmenu';
|
||||
import { ToggleButton } from 'primereact/togglebutton';
|
||||
import EditorPanel from './EditorPanel';
|
||||
import ViewerPanel from './ViewerPanel';
|
||||
import Footer from './Footer';
|
||||
import { FSContext } from '../fs/filesystem';
|
||||
import { ModelContext, FSContext } from './contexts';
|
||||
|
||||
// import "primereact/resources/themes/lara-light-indigo/theme.css";
|
||||
// import "primereact/resources/primereact.min.css";
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
import React, { CSSProperties, useContext, useRef, useState } from 'react';
|
||||
import Editor, { loader, Monaco } from '@monaco-editor/react';
|
||||
import openscadEditorOptions from '../language/openscad-editor-options';
|
||||
import { ModelContext } from '../state/model';
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { Button } from 'primereact/button';
|
||||
import { MenuItem } from 'primereact/menuitem';
|
||||
import { TreeSelect } from 'primereact/treeselect';
|
||||
import TreeNode from 'primereact/treenode';
|
||||
import { Menu } from 'primereact/menu';
|
||||
import { FSContext, getParentDir } from '../fs/filesystem';
|
||||
import { getParentDir } from '../fs/filesystem';
|
||||
import { buildUrlForStateParams } from '../state/fragment-state';
|
||||
import { blankProjectState } from '../state/initial-state';
|
||||
import { ModelContext, FSContext } from './contexts';
|
||||
|
||||
// import "primereact/resources/themes/lara-light-indigo/theme.css";
|
||||
// import "primereact/resources/primereact.min.css";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import { CSSProperties, useContext, useRef } from 'react';
|
||||
import { State } from '../state/app-state'
|
||||
import { ModelContext } from '../state/model';
|
||||
import { ModelContext } from './contexts';
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { Button } from 'primereact/button';
|
||||
import { ProgressBar } from 'primereact/progressbar';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
import React, { CSSProperties, forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
||||
import { ModelContext } from '../state/model';
|
||||
import { ModelContext } from './contexts';
|
||||
import { StlViewer} from "react-stl-viewer";
|
||||
|
||||
export default function ViewerPanel({className, style}: {className?: string, style?: CSSProperties}) {
|
||||
|
|
|
|||
7
src/components/contexts.ts
Normal file
7
src/components/contexts.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import React from "react";
|
||||
import { Model } from "../state/model";
|
||||
|
||||
export const FSContext = React.createContext<FS | undefined>(undefined);
|
||||
|
||||
export const ModelContext = React.createContext<Model | null>(null);
|
||||
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
import React from "react";
|
||||
import { zipArchives } from "./zip-archives";
|
||||
|
||||
declare var BrowserFS: BrowserFSInterface
|
||||
|
||||
export const FSContext = React.createContext<FS | undefined>(undefined);
|
||||
|
||||
export type FSMounts = {
|
||||
[n: string]: {fs: string, options: {zipData: Buffer}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ addEventListener('message', async (e) => {
|
|||
}, instance.ERRNO_CODES ?? {});
|
||||
instance.FS.mount(BFS, {root: '/home'}, '/home');
|
||||
|
||||
await symlinkLibraries(allArchiveNames, instance.FS, '/home/libraries', '/home');
|
||||
// await symlinkLibraries(allArchiveNames, instance.FS, '/home/libraries', '/home');
|
||||
|
||||
instance.FS.chdir('/home');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
import React from "react"
|
||||
import { checkSyntax, render, RenderArgs, RenderOutput } from "../runner/actions";
|
||||
import { MultiLayoutComponentId, SingleLayoutComponentId, State } from "./app-state";
|
||||
import { bubbleUpDeepMutations } from "./deep-mutate";
|
||||
|
|
@ -163,6 +162,3 @@ export class Model {
|
|||
}})
|
||||
}
|
||||
}
|
||||
|
||||
export const ModelContext = React.createContext<Model | null>(null);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue