Fix type lints in editor
This commit is contained in:
parent
7ffedccf2e
commit
e087b87c19
19 changed files with 75 additions and 77 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { CSSProperties, useContext } from 'react';
|
import React, { CSSProperties, useContext } from 'react';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
|
|
||||||
import { Dropdown } from 'primereact/dropdown';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
import { Slider } from 'primereact/slider';
|
import { Slider } from 'primereact/slider';
|
||||||
|
|
@ -9,7 +9,7 @@ import { Checkbox } from 'primereact/checkbox';
|
||||||
import { InputNumber } from 'primereact/inputnumber';
|
import { InputNumber } from 'primereact/inputnumber';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import { Fieldset } from 'primereact/fieldset';
|
import { Fieldset } from 'primereact/fieldset';
|
||||||
import { Parameter } from '../state/customizer-types';
|
import { Parameter } from '../state/customizer-types.ts';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
|
|
||||||
export default function CustomizerPanel({className, style}: {className?: string, style?: CSSProperties}) {
|
export default function CustomizerPanel({className, style}: {className?: string, style?: CSSProperties}) {
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
import React, { CSSProperties, useContext, useRef, useState } from 'react';
|
import React, { CSSProperties, useContext, useRef, useState } from 'react';
|
||||||
import Editor, { loader, Monaco } from '@monaco-editor/react';
|
import Editor, { loader, Monaco } from '@monaco-editor/react';
|
||||||
import openscadEditorOptions from '../language/openscad-editor-options';
|
import openscadEditorOptions from '../language/openscad-editor-options.ts';
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||||
import { InputTextarea } from 'primereact/inputtextarea';
|
import { InputTextarea } from 'primereact/inputtextarea';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { MenuItem } from 'primereact/menuitem';
|
import { MenuItem } from 'primereact/menuitem';
|
||||||
import { Menu } from 'primereact/menu';
|
import { Menu } from 'primereact/menu';
|
||||||
import { buildUrlForStateParams } from '../state/fragment-state';
|
import { buildUrlForStateParams } from '../state/fragment-state.ts';
|
||||||
import { getBlankProjectState, defaultSourcePath } from '../state/initial-state';
|
import { getBlankProjectState, defaultSourcePath } from '../state/initial-state.ts';
|
||||||
import { ModelContext, FSContext } from './contexts';
|
import { ModelContext, FSContext } from './contexts.ts';
|
||||||
import FilePicker, { } from './FilePicker';
|
import FilePicker, { } from './FilePicker.tsx';
|
||||||
|
|
||||||
// const isMonacoSupported = false;
|
// const isMonacoSupported = false;
|
||||||
const isMonacoSupported = (() => {
|
const isMonacoSupported = (() => {
|
||||||
|
|
@ -89,7 +89,7 @@ export default function EditorPanel({className, style}: {className?: string, sty
|
||||||
{
|
{
|
||||||
label: "New project",
|
label: "New project",
|
||||||
icon: 'pi pi-plus-circle',
|
icon: 'pi pi-plus-circle',
|
||||||
command: async () => window.open(buildUrlForStateParams(await getBlankProjectState()), '_blank'),
|
command: () => window.open(buildUrlForStateParams(getBlankProjectState()), '_blank'),
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useContext, useState } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
|
|
||||||
import { SplitButton } from 'primereact/splitbutton';
|
import { SplitButton } from 'primereact/splitbutton';
|
||||||
import { MenuItem } from 'primereact/menuitem';
|
import { MenuItem } from 'primereact/menuitem';
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { CSSProperties, useContext } from 'react';
|
import React, { CSSProperties, useContext } from 'react';
|
||||||
import { TreeSelect } from 'primereact/treeselect';
|
import { TreeSelect } from 'primereact/treeselect';
|
||||||
import { TreeNode } from 'primereact/treenode';
|
import { TreeNode } from 'primereact/treenode';
|
||||||
import { ModelContext, FSContext } from './contexts';
|
import { ModelContext, FSContext } from './contexts.ts';
|
||||||
import { getParentDir, join } from '../fs/filesystem';
|
import { getParentDir, join } from '../fs/filesystem.ts';
|
||||||
import { defaultSourcePath } from '../state/initial-state';
|
import { defaultSourcePath } from '../state/initial-state.ts';
|
||||||
import { zipArchives } from '../fs/zip-archives';
|
import { zipArchives } from '../fs/zip-archives.ts';
|
||||||
|
|
||||||
const biasedCompare = (a: string, b: string) =>
|
const biasedCompare = (a: string, b: string) =>
|
||||||
a === 'openscad' ? -1 : b === 'openscad' ? 1 : a.localeCompare(b);
|
a === 'openscad' ? -1 : b === 'openscad' ? 1 : a.localeCompare(b);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { CSSProperties, useContext, useRef } from 'react';
|
import React, { CSSProperties, useContext, useRef } from 'react';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { ProgressBar } from 'primereact/progressbar';
|
import { ProgressBar } from 'primereact/progressbar';
|
||||||
import { Badge } from 'primereact/badge';
|
import { Badge } from 'primereact/badge';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import HelpMenu from './HelpMenu';
|
import HelpMenu from './HelpMenu.tsx';
|
||||||
import ExportButton from './ExportButton';
|
import ExportButton from './ExportButton.tsx';
|
||||||
import SettingsMenu from './SettingsMenu';
|
import SettingsMenu from './SettingsMenu.tsx';
|
||||||
import MultimaterialColorsDialog from './MultimaterialColorsDialog';
|
import MultimaterialColorsDialog from './MultimaterialColorsDialog.tsx';
|
||||||
|
|
||||||
|
|
||||||
export default function Footer({style}: {style?: CSSProperties}) {
|
export default function Footer({style}: {style?: CSSProperties}) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import React, { useContext, useState } from 'react';
|
||||||
import { ColorPicker } from 'primereact/colorpicker';
|
import { ColorPicker } from 'primereact/colorpicker';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
|
||||||
export default function MultimaterialColorsDialog() {
|
export default function MultimaterialColorsDialog() {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { SingleLayoutComponentId } from '../state/app-state'
|
import { SingleLayoutComponentId } from '../state/app-state.ts'
|
||||||
import { TabMenu } from 'primereact/tabmenu';
|
import { TabMenu } from 'primereact/tabmenu';
|
||||||
import { ToggleButton } from 'primereact/togglebutton';
|
import { ToggleButton } from 'primereact/togglebutton';
|
||||||
import { ModelContext, FSContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
|
|
||||||
export default function PanelSwitcher() {
|
export default function PanelSwitcher() {
|
||||||
const model = useContext(ModelContext);
|
const model = useContext(ModelContext);
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { CSSProperties, useContext, useRef } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { MenuItem } from 'primereact/menuitem';
|
import { MenuItem } from 'primereact/menuitem';
|
||||||
import { Menu } from 'primereact/menu';
|
import { Menu } from 'primereact/menu';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
import { isInStandaloneMode } from '../utils';
|
import { isInStandaloneMode } from '../utils.ts';
|
||||||
import { confirmDialog } from 'primereact/confirmdialog';
|
import { confirmDialog } from 'primereact/confirmdialog';
|
||||||
|
|
||||||
export default function SettingsMenu({className, style}: {className?: string, style?: CSSProperties}) {
|
export default function SettingsMenu({className, style}: {className?: string, style?: CSSProperties}) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { CSSProperties, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
import { CSSProperties, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||||
import { ModelContext } from './contexts';
|
import { ModelContext } from './contexts.ts';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { blurHashToImage, imageToBlurhash, imageToThumbhash, thumbHashToImage } from '../io/image_hashes';
|
import { blurHashToImage, imageToBlurhash, imageToThumbhash, thumbHashToImage } from '../io/image_hashes.ts';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace JSX {
|
namespace JSX {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Model } from "../state/model";
|
import { Model } from "../state/model.ts";
|
||||||
|
|
||||||
export const FSContext = React.createContext<FS | undefined>(undefined);
|
export const FSContext = React.createContext<FS | undefined>(undefined);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import {App} from './components/App';
|
import {App} from './components/App.tsx';
|
||||||
import { createEditorFS } from './fs/filesystem';
|
import { createEditorFS } from './fs/filesystem.ts';
|
||||||
import { registerOpenSCADLanguage } from './language/openscad-register-language';
|
import { registerOpenSCADLanguage } from './language/openscad-register-language.ts';
|
||||||
import { zipArchives } from './fs/zip-archives';
|
import { zipArchives } from './fs/zip-archives.ts';
|
||||||
import {readStateFromFragment} from './state/fragment-state'
|
import {readStateFromFragment} from './state/fragment-state.ts'
|
||||||
import { createInitialState } from './state/initial-state';
|
import { createInitialState } from './state/initial-state.ts';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
import { isInStandaloneMode, registerCustomAppHeightCSSProperty } from './utils';
|
import { isInStandaloneMode, registerCustomAppHeightCSSProperty } from './utils.ts';
|
||||||
import { State, StatePersister } from './state/app-state';
|
import { State, StatePersister } from './state/app-state.ts';
|
||||||
import { writeStateInFragment } from "./state/fragment-state";
|
import { writeStateInFragment } from "./state/fragment-state.ts";
|
||||||
|
|
||||||
import "primereact/resources/themes/lara-light-indigo/theme.css";
|
import "primereact/resources/themes/lara-light-indigo/theme.css";
|
||||||
import "primereact/resources/primereact.min.css";
|
import "primereact/resources/primereact.min.css";
|
||||||
|
|
@ -89,7 +89,7 @@ window.addEventListener('load', async () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState = await createInitialState(persistedState);
|
const initialState = createInitialState(persistedState);
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(
|
||||||
document.getElementById('root') as HTMLElement
|
document.getElementById('root') as HTMLElement
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||||
import { ProcessStreams, spawnOpenSCAD } from "./openscad-runner";
|
import { ProcessStreams, spawnOpenSCAD } from "./openscad-runner.ts";
|
||||||
import { processMergedOutputs } from "./output-parser";
|
import { processMergedOutputs } from "./output-parser.ts";
|
||||||
import { AbortablePromise, turnIntoDelayableExecution } from '../utils';
|
import { AbortablePromise, turnIntoDelayableExecution } from '../utils.ts';
|
||||||
import { Source } from '../state/app-state';
|
import { Source } from '../state/app-state.ts';
|
||||||
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D, VALID_RENDER_FORMATS } from '../state/formats';
|
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D } from '../state/formats.ts';
|
||||||
import { ParameterSet } from '../state/customizer-types';
|
import { ParameterSet } from '../state/customizer-types.ts';
|
||||||
|
|
||||||
const syntaxDelay = 300;
|
const syntaxDelay = 300;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ export type RenderArgs = {
|
||||||
extraArgs?: string[],
|
extraArgs?: string[],
|
||||||
isPreview: boolean,
|
isPreview: boolean,
|
||||||
mountArchives: boolean,
|
mountArchives: boolean,
|
||||||
renderFormat: keyof typeof VALID_EXPORT_FORMATS_2D | keyof typeof VALID_EXPORT_FORMATS_3D | keyof typeof VALID_RENDER_FORMATS,
|
renderFormat: keyof typeof VALID_EXPORT_FORMATS_2D | keyof typeof VALID_EXPORT_FORMATS_3D,
|
||||||
streamsCallback: (ps: ProcessStreams) => void,
|
streamsCallback: (ps: ProcessStreams) => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { MergedOutputs } from "./openscad-worker";
|
import { MergedOutputs } from "./openscad-worker.ts";
|
||||||
import { AbortablePromise } from "../utils";
|
import { AbortablePromise } from "../utils.ts";
|
||||||
import { Source } from "../state/app-state";
|
import { Source } from "../state/app-state.ts";
|
||||||
|
|
||||||
export type OpenSCADInvocation = {
|
export type OpenSCADInvocation = {
|
||||||
mountArchives: boolean,
|
mountArchives: boolean,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||||
import { ParameterSet } from './customizer-types';
|
import { ParameterSet } from './customizer-types.ts';
|
||||||
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D, VALID_RENDER_FORMATS } from './formats';
|
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D } from './formats.ts';
|
||||||
|
|
||||||
export type MultiLayoutComponentId = 'editor' | 'viewer' | 'customizer';
|
export type MultiLayoutComponentId = 'editor' | 'viewer' | 'customizer';
|
||||||
export type SingleLayoutComponentId = MultiLayoutComponentId;
|
export type SingleLayoutComponentId = MultiLayoutComponentId;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { State } from "./app-state";
|
import { State } from "./app-state.ts";
|
||||||
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D, VALID_RENDER_FORMATS } from './formats';
|
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D } from './formats.ts';
|
||||||
import { validateArray, validateBoolean, validateString, validateStringEnum } from "../utils";
|
import { validateArray, validateBoolean, validateString, validateStringEnum } from "../utils.ts";
|
||||||
import { createInitialState, defaultModelColor, defaultSourcePath } from "./initial-state";
|
import { createInitialState, defaultModelColor, defaultSourcePath } from "./initial-state.ts";
|
||||||
|
|
||||||
export function buildUrlForStateParams(state: State) {//partialState: {params: State['params'], view: State['view']}) {
|
export function buildUrlForStateParams(state: State) {//partialState: {params: State['params'], view: State['view']}) {
|
||||||
return `${location.protocol}//${location.host}${location.pathname}#${encodeStateParamsAsFragment(state)}`;
|
return `${location.protocol}//${location.host}${location.pathname}#${encodeStateParamsAsFragment(state)}`;
|
||||||
|
|
@ -17,7 +17,6 @@ async function compressString(input: string): Promise<string> {
|
||||||
controller.enqueue(new TextEncoder().encode(input));
|
controller.enqueue(new TextEncoder().encode(input));
|
||||||
controller.close();
|
controller.close();
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
|
||||||
}).pipeThrough(new CompressionStream('gzip'))).arrayBuffer())));
|
}).pipeThrough(new CompressionStream('gzip'))).arrayBuffer())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,7 +26,6 @@ async function decompressString(compressedInput: string): Promise<string> {
|
||||||
controller.enqueue(Uint8Array.from(atob(compressedInput), c => c.charCodeAt(0)));
|
controller.enqueue(Uint8Array.from(atob(compressedInput), c => c.charCodeAt(0)));
|
||||||
controller.close();
|
controller.close();
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
|
||||||
}).pipeThrough(new DecompressionStream('gzip'))).arrayBuffer());
|
}).pipeThrough(new DecompressionStream('gzip'))).arrayBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import defaultScad from './default-scad';
|
import defaultScad from './default-scad.ts';
|
||||||
import { State } from './app-state';
|
import { State } from './app-state.ts';
|
||||||
import { fetchSource } from '../utils';
|
|
||||||
|
|
||||||
export const defaultSourcePath = '/playground.scad';
|
export const defaultSourcePath = '/playground.scad';
|
||||||
export const defaultModelColor = '#f9d72c';
|
export const defaultModelColor = '#f9d72c';
|
||||||
const defaultBlurhash = "|KSPX^%3~qtjMx$lR*x]t7n,R%xuxbM{WBt7ayfk_3bY9FnAt8XOxanjNF%fxbMyIn%3t7NFoLaeoeV[WBo{xar^IoS1xbxcR*S0xbofRjV[j[kCNGofxaWBNHW-xasDR*WTkBxuWBM{s:t7bYahRjfkozWUadofbIW:jZ";
|
const defaultBlurhash = "|KSPX^%3~qtjMx$lR*x]t7n,R%xuxbM{WBt7ayfk_3bY9FnAt8XOxanjNF%fxbMyIn%3t7NFoLaeoeV[WBo{xar^IoS1xbxcR*S0xbofRjV[j[kCNGofxaWBNHW-xasDR*WTkBxuWBM{s:t7bYahRjfkozWUadofbIW:jZ";
|
||||||
|
|
||||||
export async function createInitialState(state: State | null, source?: {content?: string, path?: string, url?: string, blurhash?: string}): Promise<State> {
|
export function createInitialState(state: State | null, source?: {content?: string, path?: string, url?: string, blurhash?: string}): State {
|
||||||
|
|
||||||
type Mode = State['view']['layout']['mode'];
|
type Mode = State['view']['layout']['mode'];
|
||||||
|
|
||||||
const mode: Mode = window.matchMedia("(min-width: 768px)").matches
|
const mode: Mode = window.matchMedia("(min-width: 768px)").matches
|
||||||
? 'multi' : 'single';
|
? 'multi' : 'single';
|
||||||
|
|
||||||
|
|
@ -87,8 +87,8 @@ export async function createInitialState(state: State | null, source?: {content?
|
||||||
return initialState;
|
return initialState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getBlankProjectState() {
|
export function getBlankProjectState() {
|
||||||
return await createInitialState(null, {
|
return createInitialState(null, {
|
||||||
path: defaultSourcePath,
|
path: defaultSourcePath,
|
||||||
content: defaultScad,
|
content: defaultScad,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { checkSyntax, render, RenderArgs, RenderOutput } from "../runner/actions";
|
import { checkSyntax, render, RenderArgs, RenderOutput } from "../runner/actions.ts";
|
||||||
import { MultiLayoutComponentId, SingleLayoutComponentId, Source, State, StatePersister } from "./app-state";
|
import { MultiLayoutComponentId, SingleLayoutComponentId, State, StatePersister } from "./app-state.ts";
|
||||||
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D, VALID_RENDER_FORMATS } from './formats';
|
import { VALID_EXPORT_FORMATS_2D, VALID_EXPORT_FORMATS_3D } from './formats.ts';
|
||||||
import { bubbleUpDeepMutations } from "./deep-mutate";
|
import { bubbleUpDeepMutations } from "./deep-mutate.ts";
|
||||||
import { downloadUrl, fetchSource, formatBytes, formatMillis, readFileAsDataURL } from '../utils'
|
import { downloadUrl, fetchSource, formatBytes, formatMillis, readFileAsDataURL } from '../utils.ts'
|
||||||
|
|
||||||
import JSZip from 'jszip';
|
import JSZip from 'jszip';
|
||||||
import { ProcessStreams } from "../runner/openscad-runner";
|
import { ProcessStreams } from "../runner/openscad-runner.ts";
|
||||||
import { is2DFormatExtension } from "./formats";
|
import { is2DFormatExtension } from "./formats.ts";
|
||||||
import { parseOff } from "../io/import_off";
|
import { parseOff } from "../io/import_off.ts";
|
||||||
import { exportGlb } from "../io/export_glb";
|
import { exportGlb } from "../io/export_glb.ts";
|
||||||
import { export3MF } from "../io/export_3mf";
|
import { export3MF } from "../io/export_3mf.ts";
|
||||||
import chroma from "chroma-js";
|
import chroma from "chroma-js";
|
||||||
|
|
||||||
const githubRx = /^https:\/\/github.com\/([^/]+)\/([^/]+)\/blob\/(.+)$/;
|
const githubRx = /^https:\/\/github.com\/([^/]+)\/([^/]+)\/blob\/(.+)$/;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||||
|
|
||||||
import { Source } from "./state/app-state";
|
import { Source } from "./state/app-state.ts";
|
||||||
|
|
||||||
export function mapObject(o: any, f: (key: string, value: any) => any, ifPred: (key: string) => boolean) {
|
export function mapObject(o: any, f: (key: string, value: any) => any, ifPred: (key: string) => boolean) {
|
||||||
const ret = [];
|
const ret = [];
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"DOM",
|
||||||
"dom.iterable",
|
"DOM.Iterable",
|
||||||
"ES2022",
|
"ES2022",
|
||||||
"WebWorker"
|
"WebWorker"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue