From cfee2b68da67244eb50841a5a64e2dcd0a92ec19 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Mon, 16 Jun 2025 23:43:56 +0200 Subject: [PATCH] Migrate Writable to StateStore --- .../apps/components/buttons/AppButton.svelte | 4 +- .../apps/components/buttons/AppForm.svelte | 4 +- .../components/buttons/AppFormButton.svelte | 4 +- .../components/buttons/AppSchemaForm.svelte | 6 +- .../display/AppAccordionList.svelte | 8 +- .../apps/components/display/AppAlert.svelte | 4 +- .../components/display/AppBarChart.svelte | 4 +- .../components/display/AppCarouselList.svelte | 8 +- .../apps/components/display/AppChartJs.svelte | 4 +- .../components/display/AppChartJsV2.svelte | 8 +- .../display/AppDisplayComponent.svelte | 8 +- .../display/AppDisplayComponentByJobId.svelte | 8 +- .../components/display/AppDownload.svelte | 4 +- .../apps/components/display/AppHtml.svelte | 4 +- .../apps/components/display/AppIcon.svelte | 4 +- .../apps/components/display/AppImage.svelte | 4 +- .../display/AppJobIdFlowStatus.svelte | 8 +- .../display/AppJobIdLogComponent.svelte | 4 +- .../apps/components/display/AppMap.svelte | 8 +- .../components/display/AppMarkdown.svelte | 8 +- .../apps/components/display/AppMenu.svelte | 4 +- .../apps/components/display/AppNavbar.svelte | 12 +- .../apps/components/display/AppPdf.svelte | 4 +- .../components/display/AppPieChart.svelte | 4 +- .../components/display/AppRecomputeAll.svelte | 4 +- .../components/display/AppScatterChart.svelte | 4 +- .../components/display/AppStatCard.svelte | 4 +- .../apps/components/display/AppText.svelte | 12 +- .../components/display/AppTimeseries.svelte | 4 +- .../display/charts/AppAgCharts.svelte | 4 +- .../display/dbtable/AppDbExplorer.svelte | 18 +- .../table/AppAggridExplorerTable.svelte | 4 +- .../table/AppAggridInfiniteTable.svelte | 4 +- .../display/table/AppAggridTable.svelte | 4 +- .../components/display/table/AppTable.svelte | 4 +- .../display/table/SyncColumnDefs.svelte | 4 +- .../helpers/RunnableComponent.svelte | 6 +- .../apps/components/inputs/AppCheckbox.svelte | 4 +- .../components/inputs/AppDateInput.svelte | 4 +- .../components/inputs/AppDateSelect.svelte | 4 +- .../inputs/AppDateSliderInput.svelte | 4 +- .../components/inputs/AppDateTimeInput.svelte | 4 +- .../components/inputs/AppFileInput.svelte | 4 +- .../components/inputs/AppMultiSelect.svelte | 2 + .../components/inputs/AppMultiSelectV2.svelte | 4 +- .../components/inputs/AppNumberInput.svelte | 4 +- .../components/inputs/AppRangeInput.svelte | 4 +- .../components/inputs/AppS3FileInput.svelte | 9 +- .../apps/components/inputs/AppSelect.svelte | 4 +- .../components/inputs/AppSelectStep.svelte | 4 +- .../components/inputs/AppSelectTab.svelte | 4 +- .../components/inputs/AppSliderInputs.svelte | 4 +- .../components/inputs/AppTextInput.svelte | 12 +- .../components/inputs/AppTimeInput.svelte | 4 +- .../components/inputs/AppUserResource.svelte | 4 +- .../inputs/currency/AppCurrencyInput.svelte | 4 +- .../layout/AppConditionalWrapper.svelte | 8 +- .../components/layout/AppContainer.svelte | 8 +- .../components/layout/AppDecisionTree.svelte | 10 +- .../apps/components/layout/AppDivider.svelte | 4 +- .../apps/components/layout/AppDrawer.svelte | 8 +- .../apps/components/layout/AppList.svelte | 8 +- .../apps/components/layout/AppModal.svelte | 11 +- .../components/layout/AppSplitpanes.svelte | 6 +- .../apps/components/layout/AppStepper.svelte | 10 +- .../apps/components/layout/AppTabs.svelte | 10 +- .../components/apps/editor/AppEditor.svelte | 73 ++++---- .../apps/editor/AppEditorHeader.svelte | 78 ++++----- .../apps/editor/AppEditorTutorial.svelte | 2 +- .../components/apps/editor/AppInputs.svelte | 6 +- .../components/apps/editor/AppPreview.svelte | 162 ++++++++++-------- .../components/apps/editor/GridEditor.svelte | 56 +++--- .../components/apps/editor/GridViewer.svelte | 4 +- .../apps/editor/RecomputeAllComponents.svelte | 2 +- .../apps/editor/SettingsPanel.svelte | 75 ++++---- .../apps/editor/SubGridEditor.svelte | 68 ++++---- .../components/apps/editor/appUtilsInfer.ts | 6 +- .../apps/editor/component/Component.svelte | 2 +- .../editor/component/ComponentRendered.svelte | 9 +- .../editor/component/ComponentWrapper.svelte | 4 +- .../component/componentCallbacks.svelte.ts | 22 +-- .../componentsPanel/ComponentList.svelte | 32 ++-- .../componentsPanel/CssHelperPanel.svelte | 6 +- .../editor/componentsPanel/CssSettings.svelte | 14 +- .../editor/componentsPanel/GroupList.svelte | 4 +- .../componentsPanel/QuickStyleMenu.svelte | 8 +- .../editor/componentsPanel/ThemeList.svelte | 7 +- .../editor/componentsPanel/ThemeRow.svelte | 17 +- .../editor/contextPanel/ContextPanel.svelte | 2 +- .../editor/contextPanel/DebugPanel.svelte | 20 +-- .../editor/contextPanel/LazyModePanel.svelte | 20 +-- .../editor/contextPanel/SubGridOutput.svelte | 2 +- .../components/BackgroundScriptsOutput.svelte | 2 +- .../contextPanel/components/IdEditor.svelte | 2 +- .../components/OutputHeader.svelte | 26 +-- .../InlineScriptEditor.svelte | 8 +- .../InlineScriptEditorPanel.svelte | 6 +- .../InlineScriptHiddenRunnable.svelte | 2 +- .../InlineScriptsPanel.svelte | 32 ++-- .../InlineScriptsPanelList.svelte | 28 +-- .../settingsPanel/AlignmentEditor.svelte | 4 +- .../settingsPanel/CSSMigrationModal.svelte | 24 +-- .../ComponentInputTypeEditor.svelte | 2 +- .../settingsPanel/ComponentPanel.svelte | 8 +- .../settingsPanel/ContextVariables.svelte | 4 +- .../settingsPanel/DeleteComponent.svelte | 8 +- .../editor/settingsPanel/GridCondition.svelte | 28 +-- .../apps/editor/settingsPanel/GridPane.svelte | 16 +- .../apps/editor/settingsPanel/GridTab.svelte | 24 +-- .../settingsPanel/InputsSpecEditor.svelte | 2 +- .../editor/settingsPanel/MenuItems.svelte | 4 +- .../settingsPanel/SelectedRunnable.svelte | 6 +- .../editor/settingsPanel/StylePanel.svelte | 46 ++--- .../editor/settingsPanel/TableActions.svelte | 4 +- .../decisionTree/DecisionTreePreview.svelte | 18 +- .../inputEditor/ConnectedInputEditor.svelte | 4 +- .../inputEditor/RunnableInputEditor.svelte | 2 +- .../inputEditor/TabSelectInput.svelte | 2 +- .../script/shared/ScriptTriggers.svelte | 4 +- .../components/apps/svelte-grid/Grid.svelte | 12 +- .../apps/svelte-grid/MoveResize.svelte | 4 +- frontend/src/lib/components/apps/types.ts | 17 +- .../raw_apps/RawAppInlineScriptEditor.svelte | 4 +- .../tutorials/app/AppTutorial.svelte | 14 +- .../tutorials/app/ConnectionTutorial.svelte | 6 +- .../components/wizards/AgChartWizard.svelte | 4 +- 126 files changed, 754 insertions(+), 708 deletions(-) diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte index 8ec9475f30..f02290726e 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte @@ -175,7 +175,7 @@ } let loading = $state(false) - let css = $state(initCss($app.css?.buttoncomponent, customCss)) + let css = $state(initCss(app.val.css?.buttoncomponent, customCss)) $effect(() => { errorHandledByComponent = resolvedConfig?.onError?.selected !== 'errorOverlay' }) @@ -210,7 +210,7 @@ {extraKey} {key} bind:css={css[key]} - componentStyle={$app.css?.buttoncomponent} + componentStyle={app.val.css?.buttoncomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/buttons/AppForm.svelte b/frontend/src/lib/components/apps/components/buttons/AppForm.svelte index 3df674e5b0..52cbf7f360 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppForm.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppForm.svelte @@ -71,7 +71,7 @@ let runnableComponent: RunnableComponent | undefined = $state() let loading = $state(false) - let css = $state(initCss($app.css?.formcomponent, customCss)) + let css = $state(initCss(app.val.css?.formcomponent, customCss)) let wrapper: RunnableWrapper | undefined = $state() $effect(() => { @@ -98,7 +98,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.formcomponent} + componentStyle={app.val.css?.formcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/buttons/AppFormButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppFormButton.svelte index 4aa606da82..69ed125320 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppFormButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppFormButton.svelte @@ -70,7 +70,7 @@ let errors: Record = {} - let css = $state(initCss($app?.css?.formbuttoncomponent, customCss)) + let css = $state(initCss(app.val?.css?.formbuttoncomponent, customCss)) let runnableWrapper: RunnableWrapper | undefined = $state() let loading = $state(false) let modal: AlwaysMountedModal | undefined = $state() @@ -93,7 +93,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.formbuttoncomponent} + componentStyle={app.val.css?.formbuttoncomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/buttons/AppSchemaForm.svelte b/frontend/src/lib/components/apps/components/buttons/AppSchemaForm.svelte index f4a585dd70..013c7bd01f 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppSchemaForm.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppSchemaForm.svelte @@ -101,7 +101,7 @@ } } - let css = $state(initCss($app.css?.schemaformcomponent, customCss)) + let css = $state(initCss(app.val.css?.schemaformcomponent, customCss)) const resolvedConfig = $state( initConfig(components['schemaformcomponent'].initialData.configuration, configuration) @@ -159,7 +159,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.schemaformcomponent} + componentStyle={app.val.css?.schemaformcomponent} /> {/each} @@ -172,7 +172,7 @@
- !$connectingInput.opened && selectId(e as PointerEvent, id, selectedComponent, $app) + !$connectingInput.opened && selectId(e as PointerEvent, id, selectedComponent, app.val) )} > {/each} @@ -108,7 +108,7 @@ > {#if everRender}
- {#if $app.subgrids?.[`${id}-0`]} + {#if app.val.subgrids?.[`${id}-0`]} {#if Array.isArray(result) && result.length > 0} {#each result ?? [] as value, index}
@@ -181,7 +181,7 @@ {/if} {/if}
- {:else if $app.subgrids} + {:else if app.val.subgrids} diff --git a/frontend/src/lib/components/apps/components/display/AppAlert.svelte b/frontend/src/lib/components/apps/components/display/AppAlert.svelte index 24dfa9ea51..b8fa6ecef6 100644 --- a/frontend/src/lib/components/apps/components/display/AppAlert.svelte +++ b/frontend/src/lib/components/apps/components/display/AppAlert.svelte @@ -27,7 +27,7 @@ initOutput($worldStore, id, {}) - let css = initCss($app.css?.alertcomponent, customCss) + let css = initCss(app.val.css?.alertcomponent, customCss) {#each Object.keys(components['alertcomponent'].initialData.configuration) as key (key)} @@ -45,7 +45,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.alertcomponent} + componentStyle={app.val.css?.alertcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppBarChart.svelte b/frontend/src/lib/components/apps/components/display/AppBarChart.svelte index 621be96ef3..3be882449d 100644 --- a/frontend/src/lib/components/apps/components/display/AppBarChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppBarChart.svelte @@ -107,7 +107,7 @@ } } - let css = initCss($app.css?.barchartcomponent, customCss) + let css = initCss(app.val.css?.barchartcomponent, customCss) {#each Object.keys(components['barchartcomponent'].initialData.configuration) as key (key)} @@ -125,7 +125,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.barchartcomponent} + componentStyle={app.val.css?.barchartcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte b/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte index 14c7aee81d..4fc0d87c4f 100644 --- a/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte +++ b/frontend/src/lib/components/apps/components/display/AppCarouselList.svelte @@ -61,7 +61,7 @@ } } - let css = $state(initCss($app.css?.carousellistcomponent, customCss)) + let css = $state(initCss(app.val.css?.carousellistcomponent, customCss)) let result: any[] | undefined = $state(undefined) let inputs = $state({}) @@ -93,7 +93,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.carousellistcomponent} + componentStyle={app.val.css?.carousellistcomponent} /> {/each} @@ -110,7 +110,7 @@ > {#if everRender}
- {#if $app.subgrids?.[`${id}-0`]} + {#if app.val.subgrids?.[`${id}-0`]} {#if Array.isArray(result) && result.length > 0} {#key result} - {:else if $app.subgrids} + {:else if app.val.subgrids} diff --git a/frontend/src/lib/components/apps/components/display/AppChartJs.svelte b/frontend/src/lib/components/apps/components/display/AppChartJs.svelte index 4b88b5840a..c61d493545 100644 --- a/frontend/src/lib/components/apps/components/display/AppChartJs.svelte +++ b/frontend/src/lib/components/apps/components/display/AppChartJs.svelte @@ -41,7 +41,7 @@ ...(resolvedConfig.options ?? {}) } as ChartOptions - let css = initCss($app.css?.chartjscomponent, customCss) + let css = initCss(app.val.css?.chartjscomponent, customCss) {#each Object.keys(components['chartjscomponent'].initialData.configuration) as key (key)} @@ -59,7 +59,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.chartjscomponent} + componentStyle={app.val.css?.chartjscomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppChartJsV2.svelte b/frontend/src/lib/components/apps/components/display/AppChartJsV2.svelte index a1467794bc..9d1323ef8d 100644 --- a/frontend/src/lib/components/apps/components/display/AppChartJsV2.svelte +++ b/frontend/src/lib/components/apps/components/display/AppChartJsV2.svelte @@ -80,7 +80,7 @@ grid: { color: $darkMode ? '#555' : '#ddd' } } } - } + } : {}) }) as ChartOptions @@ -92,10 +92,10 @@ label: d.name, data: Array.isArray(resolvedDatasetsValues[index]) ? resolvedDatasetsValues[index] : [] })) - } + } : result - let css = initCss($app.css?.chartjscomponent, customCss) + let css = initCss(app.val.css?.chartjscomponent, customCss) {#if datasets} @@ -137,7 +137,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.chartjscomponent} + componentStyle={app.val.css?.chartjscomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte b/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte index e334e2ab2d..f5740ebb9a 100644 --- a/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte +++ b/frontend/src/lib/components/apps/components/display/AppDisplayComponent.svelte @@ -56,7 +56,7 @@ loading: false }) - let css = $state(initCss($app.css?.displaycomponent, customCss)) + let css = $state(initCss(app.val.css?.displaycomponent, customCss)) {#each Object.keys(components['displaycomponent'].initialData.configuration) as key (key)} @@ -74,7 +74,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.displaycomponent} + componentStyle={app.val.css?.displaycomponent} /> {/each} @@ -92,13 +92,13 @@
diff --git a/frontend/src/lib/components/apps/components/display/AppDisplayComponentByJobId.svelte b/frontend/src/lib/components/apps/components/display/AppDisplayComponentByJobId.svelte index 3cb0db01a3..a47d8e6b18 100644 --- a/frontend/src/lib/components/apps/components/display/AppDisplayComponentByJobId.svelte +++ b/frontend/src/lib/components/apps/components/display/AppDisplayComponentByJobId.svelte @@ -40,7 +40,7 @@ initializing = false - let css = initCss($app.css?.jobiddisplaycomponent, customCss) + let css = initCss(app.val.css?.jobiddisplaycomponent, customCss) let testJobLoader: TestJobLoader | undefined = undefined let testIsLoading: boolean = false @@ -69,7 +69,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.jobiddisplaycomponent} + componentStyle={app.val.css?.jobiddisplaycomponent} /> {/each} @@ -101,13 +101,13 @@
diff --git a/frontend/src/lib/components/apps/components/display/AppDownload.svelte b/frontend/src/lib/components/apps/components/display/AppDownload.svelte index 7f6f2b100f..5830d72c2b 100644 --- a/frontend/src/lib/components/apps/components/display/AppDownload.svelte +++ b/frontend/src/lib/components/apps/components/display/AppDownload.svelte @@ -61,7 +61,7 @@ } } - let css = initCss($app.css?.downloadcomponent, customCss) + let css = initCss(app.val.css?.downloadcomponent, customCss) @@ -81,7 +81,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.downloadcomponent} + componentStyle={app.val.css?.downloadcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppHtml.svelte b/frontend/src/lib/components/apps/components/display/AppHtml.svelte index faec01e1a2..861de93823 100644 --- a/frontend/src/lib/components/apps/components/display/AppHtml.svelte +++ b/frontend/src/lib/components/apps/components/display/AppHtml.svelte @@ -22,7 +22,7 @@ let result: string | undefined = undefined - let css = initCss($app.css?.htmlcomponent, customCss) + let css = initCss(app.val.css?.htmlcomponent, customCss) {#each Object.keys(css ?? {}) as key (key)} @@ -31,7 +31,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.htmlcomponent} + componentStyle={app.val.css?.htmlcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppIcon.svelte b/frontend/src/lib/components/apps/components/display/AppIcon.svelte index 49cb2a1eb7..358ab0e606 100644 --- a/frontend/src/lib/components/apps/components/display/AppIcon.svelte +++ b/frontend/src/lib/components/apps/components/display/AppIcon.svelte @@ -37,7 +37,7 @@ } } - let css = initCss($app.css?.iconcomponent, customCss) + let css = initCss(app.val.css?.iconcomponent, customCss) {#each Object.keys(components['iconcomponent'].initialData.configuration) as key (key)} @@ -55,7 +55,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.iconcomponent} + componentStyle={app.val.css?.iconcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppImage.svelte b/frontend/src/lib/components/apps/components/display/AppImage.svelte index 1ac67dd8e6..34ff5f18d5 100644 --- a/frontend/src/lib/components/apps/components/display/AppImage.svelte +++ b/frontend/src/lib/components/apps/components/display/AppImage.svelte @@ -42,7 +42,7 @@ //used so that we can count number of outputs setup for first refresh initOutput($worldStore, id, {}) - let css = initCss($app.css?.imagecomponent, customCss) + let css = initCss(app.val.css?.imagecomponent, customCss) let imageUrl: string | undefined = undefined @@ -111,7 +111,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.imagecomponent} + componentStyle={app.val.css?.imagecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppJobIdFlowStatus.svelte b/frontend/src/lib/components/apps/components/display/AppJobIdFlowStatus.svelte index c4ad5dacaa..9f877dfda4 100644 --- a/frontend/src/lib/components/apps/components/display/AppJobIdFlowStatus.svelte +++ b/frontend/src/lib/components/apps/components/display/AppJobIdFlowStatus.svelte @@ -31,7 +31,7 @@ initializing = false - let css = initCss($app.css?.jobidflowstatuscomponent, customCss) + let css = initCss(app.val.css?.jobidflowstatuscomponent, customCss) $: jobId = resolvedConfig.jobId @@ -51,7 +51,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.jobidflowstatuscomponent} + componentStyle={app.val.css?.jobidflowstatuscomponent} /> {/each} @@ -70,12 +70,12 @@
diff --git a/frontend/src/lib/components/apps/components/display/AppJobIdLogComponent.svelte b/frontend/src/lib/components/apps/components/display/AppJobIdLogComponent.svelte index 9287bc09e0..5d054a6003 100644 --- a/frontend/src/lib/components/apps/components/display/AppJobIdLogComponent.svelte +++ b/frontend/src/lib/components/apps/components/display/AppJobIdLogComponent.svelte @@ -33,7 +33,7 @@ initializing = false - let css = initCss($app.css?.jobidlogcomponent, customCss) + let css = initCss(app.val.css?.jobidlogcomponent, customCss) let testJobLoader: TestJobLoader | undefined = undefined let testIsLoading: boolean = false @@ -60,7 +60,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.jobidlogcomponent} + componentStyle={app.val.css?.jobidlogcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppMap.svelte b/frontend/src/lib/components/apps/components/display/AppMap.svelte index 5decac3bad..d1c40c5ec6 100644 --- a/frontend/src/lib/components/apps/components/display/AppMap.svelte +++ b/frontend/src/lib/components/apps/components/display/AppMap.svelte @@ -185,7 +185,7 @@ $: map && resolvedConfig && updateInteractions(map) - let css = initCss($app.css?.mapcomponent, customCss) + let css = initCss(app.val.css?.mapcomponent, customCss) function updateRegionOutput() { if (map && !resolvedConfig.lock) { @@ -202,7 +202,7 @@ } async function handleSyncRegion() { - const gridItem = findGridItem($app, id) + const gridItem = findGridItem(app.val, id) if (!map || !gridItem) { return } @@ -226,7 +226,7 @@ //@ts-ignore gridItem.data.configuration.latitude.value = center[1] - $app = $app + app.val = app.val } } @@ -250,7 +250,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.mapcomponent} + componentStyle={app.val.css?.mapcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppMarkdown.svelte b/frontend/src/lib/components/apps/components/display/AppMarkdown.svelte index 7ff2d6ae72..37f04566eb 100644 --- a/frontend/src/lib/components/apps/components/display/AppMarkdown.svelte +++ b/frontend/src/lib/components/apps/components/display/AppMarkdown.svelte @@ -39,7 +39,7 @@ let result: string | undefined = undefined - let css = initCss($app.css?.mardowncomponent, customCss) + let css = initCss(app.val.css?.mardowncomponent, customCss) const proseMapping = { sm: 'prose-sm', @@ -65,7 +65,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.mardowncomponent} + componentStyle={app.val.css?.mardowncomponent} /> {/each} @@ -150,8 +150,8 @@ .wm-markdown h4:last-child { margin-bottom: 0; } - .wm-markdown code:not([class~="not-prose"]):not(.not-prose *)::before, - .wm-markdown code:not([class~="not-prose"]):not(.not-prose *)::after { + .wm-markdown code:not([class~='not-prose']):not(.not-prose *)::before, + .wm-markdown code:not([class~='not-prose']):not(.not-prose *)::after { content: none !important; } .wm-markdown.prose code::before, diff --git a/frontend/src/lib/components/apps/components/display/AppMenu.svelte b/frontend/src/lib/components/apps/components/display/AppMenu.svelte index 17a2546f02..c5f125c83a 100644 --- a/frontend/src/lib/components/apps/components/display/AppMenu.svelte +++ b/frontend/src/lib/components/apps/components/display/AppMenu.svelte @@ -53,7 +53,7 @@ initConfig(components['menucomponent'].initialData.configuration, configuration) ) - let css = $state(initCss($app.css?.menucomponent, customCss)) + let css = $state(initCss(app.val.css?.menucomponent, customCss)) let beforeIconComponent: any = $state() let afterIconComponent: any = $state() @@ -106,7 +106,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.menucomponent} + componentStyle={app.val.css?.menucomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppNavbar.svelte b/frontend/src/lib/components/apps/components/display/AppNavbar.svelte index 78bc108cd6..41b1d7366a 100644 --- a/frontend/src/lib/components/apps/components/display/AppNavbar.svelte +++ b/frontend/src/lib/components/apps/components/display/AppNavbar.svelte @@ -30,7 +30,7 @@ } }) - let css = initCss($app.css?.navbarcomponent, customCss) + let css = initCss(app.val.css?.navbarcomponent, customCss) {#each Object.keys(components['navbarcomponent'].initialData.configuration) as key (key)} @@ -48,7 +48,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.navbarcomponent} + componentStyle={app.val.css?.navbarcomponent} /> {/each} @@ -67,10 +67,10 @@ src={resolvedConfig.logo?.configuration?.yes?.sourceKind == 'png encoded as base64' ? 'data:image/png;base64,' + resolvedConfig.logo?.configuration?.yes?.source : resolvedConfig.logo?.configuration?.yes?.sourceKind == 'jpeg encoded as base64' - ? 'data:image/jpeg;base64,' + resolvedConfig.logo?.configuration?.yes?.source - : resolvedConfig.logo?.configuration?.yes?.sourceKind == 'svg encoded as base64' - ? 'data:image/svg+xml;base64,' + resolvedConfig.logo?.configuration?.yes?.source - : resolvedConfig.logo?.configuration?.yes?.source} + ? 'data:image/jpeg;base64,' + resolvedConfig.logo?.configuration?.yes?.source + : resolvedConfig.logo?.configuration?.yes?.sourceKind == 'svg encoded as base64' + ? 'data:image/svg+xml;base64,' + resolvedConfig.logo?.configuration?.yes?.source + : resolvedConfig.logo?.configuration?.yes?.source} alt={resolvedConfig.logo?.configuration?.yes?.altText} style={css?.image?.style ?? ''} class={twMerge(`w-auto h-8`, css?.image?.class, 'wm-image')} diff --git a/frontend/src/lib/components/apps/components/display/AppPdf.svelte b/frontend/src/lib/components/apps/components/display/AppPdf.svelte index 1bdf303207..be4a484ef1 100644 --- a/frontend/src/lib/components/apps/components/display/AppPdf.svelte +++ b/frontend/src/lib/components/apps/components/display/AppPdf.svelte @@ -22,7 +22,7 @@ let source: string | ArrayBuffer | undefined = undefined let zoom: number | undefined = undefined - let css = initCss($app.css?.pdfcomponent, customCss) + let css = initCss(app.val.css?.pdfcomponent, customCss) @@ -34,7 +34,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.pdfcomponent} + componentStyle={app.val.css?.pdfcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppPieChart.svelte b/frontend/src/lib/components/apps/components/display/AppPieChart.svelte index 808bca072b..f751ecd624 100644 --- a/frontend/src/lib/components/apps/components/display/AppPieChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppPieChart.svelte @@ -74,7 +74,7 @@ ] } - let css = initCss($app.css?.piechartcomponent, customCss) + let css = initCss(app.val.css?.piechartcomponent, customCss) {#each Object.keys(css ?? {}) as key (key)} @@ -83,7 +83,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.piechartcomponent} + componentStyle={app.val.css?.piechartcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte b/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte index e356525cc9..6495f19644 100644 --- a/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte +++ b/frontend/src/lib/components/apps/components/display/AppRecomputeAll.svelte @@ -35,7 +35,7 @@ initializing = false - let css = initCss($app.css?.recomputeallcomponent, customCss) + let css = initCss(app.val.css?.recomputeallcomponent, customCss) $: resolvedConfig.defaultRefreshInterval && handleRefreshInterval() @@ -68,7 +68,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.recomputeallcomponent} + componentStyle={app.val.css?.recomputeallcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte b/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte index 653adb1233..6d634c5ffd 100644 --- a/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte +++ b/frontend/src/lib/components/apps/components/display/AppScatterChart.svelte @@ -80,7 +80,7 @@ datasets: result ?? [] } as ChartData<'scatter', (number | Point)[], unknown> - let css = initCss($app.css?.scatterchartcomponent, customCss) + let css = initCss(app.val.css?.scatterchartcomponent, customCss) {#each Object.keys(css ?? {}) as key (key)} @@ -89,7 +89,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.scatterchartcomponent} + componentStyle={app.val.css?.scatterchartcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppStatCard.svelte b/frontend/src/lib/components/apps/components/display/AppStatCard.svelte index 01d0be4ae1..7476f094e9 100644 --- a/frontend/src/lib/components/apps/components/display/AppStatCard.svelte +++ b/frontend/src/lib/components/apps/components/display/AppStatCard.svelte @@ -26,7 +26,7 @@ initOutput($worldStore, id, {}) - let css = initCss($app.css?.statcomponent, customCss) + let css = initCss(app.val.css?.statcomponent, customCss) let iconComponent: any @@ -62,7 +62,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.imagecomponent} + componentStyle={app.val.css?.imagecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/AppText.svelte b/frontend/src/lib/components/apps/components/display/AppText.svelte index aa140273f7..0dd5444451 100644 --- a/frontend/src/lib/components/apps/components/display/AppText.svelte +++ b/frontend/src/lib/components/apps/components/display/AppText.svelte @@ -39,7 +39,7 @@ const { app, worldStore, mode, componentControl } = getContext('AppViewerContext') - let css = initCss($app.css?.textcomponent, customCss) + let css = initCss(app.val.css?.textcomponent, customCss) let result: string | undefined = undefined @@ -157,7 +157,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.textcomponent} + componentStyle={app.val.css?.textcomponent} /> {/each} @@ -187,8 +187,8 @@ horizontalAlignment === 'center' ? 'text-center' : horizontalAlignment === 'right' - ? 'text-right' - : 'text-left' + ? 'text-right' + : 'text-left' )} on:pointerdown|stopPropagation style={css?.text?.style} @@ -232,8 +232,8 @@ horizontalAlignment === 'center' ? 'text-center' : horizontalAlignment === 'right' - ? 'text-right' - : 'text-left' + ? 'text-right' + : 'text-left' )} style={css?.text?.style} > diff --git a/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte b/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte index d0389eab0f..fcf1b6bc64 100644 --- a/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte +++ b/frontend/src/lib/components/apps/components/display/AppTimeseries.svelte @@ -94,7 +94,7 @@ datasets: result ?? [] } as ChartData<'scatter', (number | Point)[], unknown> - let css = initCss($app.css?.timeseriescomponent, customCss) + let css = initCss(app.val.css?.timeseriescomponent, customCss) {#each Object.keys(css ?? {}) as key (key)} @@ -103,7 +103,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.timeseriescomponent} + componentStyle={app.val.css?.timeseriescomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/charts/AppAgCharts.svelte b/frontend/src/lib/components/apps/components/display/charts/AppAgCharts.svelte index fe6251a63f..d348bfabaa 100644 --- a/frontend/src/lib/components/apps/components/display/charts/AppAgCharts.svelte +++ b/frontend/src/lib/components/apps/components/display/charts/AppAgCharts.svelte @@ -56,7 +56,7 @@ configuration ) - let css = initCss($app.css?.agchartscomponent, customCss) + let css = initCss(app.val.css?.agchartscomponent, customCss) let chartInstance: AgChartInstance | undefined = undefined function getChartStyleByTheme() { @@ -373,7 +373,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.chartjscomponent} + componentStyle={app.val.css?.chartjscomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/dbtable/AppDbExplorer.svelte b/frontend/src/lib/components/apps/components/display/dbtable/AppDbExplorer.svelte index 4b4f6f5318..47f1a1ce06 100644 --- a/frontend/src/lib/components/apps/components/display/dbtable/AppDbExplorer.svelte +++ b/frontend/src/lib/components/apps/components/display/dbtable/AppDbExplorer.svelte @@ -66,7 +66,7 @@ } function clearColumnDefs() { - const gridItem = findGridItem($app, id) + const gridItem = findGridItem(app.val, id) if (!gridItem) { return @@ -75,7 +75,7 @@ // @ts-ignore gridItem.data.configuration.columnDefs = { value: [], type: 'static', loading: false } - $app = $app + app.val = app.val } const resolvedConfig = initConfig( @@ -210,7 +210,7 @@ if (lastResource === resource) return lastResource = resource - const gridItem = findGridItem($app, id) + const gridItem = findGridItem(app.val, id) if (!gridItem) { return @@ -228,7 +228,7 @@ ) if (!resolvedConfig.type?.configuration?.[resolvedConfig.type.selected]?.resource) { - $app = $app + app.val = app.val return } @@ -261,7 +261,7 @@ } ) - $app = $app + app.val = app.val } catch (e) {} } @@ -365,7 +365,7 @@ lastTable = table - const gridItem = findGridItem($app, id) + const gridItem = findGridItem(app.val, id) if (!gridItem) return let columnDefs = gridItem.data.configuration.columnDefs as StaticInput @@ -375,7 +375,7 @@ //@ts-ignore gridItem.data.configuration.columnDefs.loading = true gridItem.data = gridItem.data - $app = $app + app.val = app.val let tableMetadata = await loadTableMetaData( resolvedConfig.type.configuration[selected].resource, @@ -400,7 +400,7 @@ gridItem.data.configuration.columnDefs.loading = false gridItem.data = gridItem.data - $app = $app + app.val = app.val return } @@ -453,7 +453,7 @@ gridItem.data.configuration.columnDefs = { value: ncols, type: 'static', loading: false } gridItem.data = gridItem.data - $app = $app + app.val = app.val let oldS = $selectedComponent $selectedComponent = [] await tick() diff --git a/frontend/src/lib/components/apps/components/display/table/AppAggridExplorerTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppAggridExplorerTable.svelte index b4c4b81ab5..b162165e4d 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppAggridExplorerTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppAggridExplorerTable.svelte @@ -43,7 +43,7 @@ const contextPanel = getContext('ContextPanel') const { app, selectedComponent, componentControl, darkMode, mode } = context - let css = initCss($app.css?.aggridcomponent, customCss) + let css = initCss(app.val.css?.aggridcomponent, customCss) let selectedRowIndex = -1 @@ -443,7 +443,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.tablecomponent} + componentStyle={app.val.css?.tablecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/table/AppAggridInfiniteTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppAggridInfiniteTable.svelte index b47fcb6a23..65e7e5b31f 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppAggridInfiniteTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppAggridInfiniteTable.svelte @@ -40,7 +40,7 @@ const context = getContext('AppViewerContext') const { app, worldStore } = context - let css = initCss($app.css?.aggridcomponent, customCss) + let css = initCss(app.val.css?.aggridcomponent, customCss) let result: any[] | undefined = undefined let loading: boolean = false @@ -166,7 +166,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.tablecomponent} + componentStyle={app.val.css?.tablecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/table/AppAggridTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppAggridTable.svelte index 8f0b760830..6480f7a68e 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppAggridTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppAggridTable.svelte @@ -68,7 +68,7 @@ comfortable: 50 } - let css = initCss($app.css?.aggridcomponent, customCss) + let css = initCss(app.val.css?.aggridcomponent, customCss) let result: any[] | undefined = undefined @@ -559,7 +559,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.tablecomponent} + componentStyle={app.val.css?.tablecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte index af02b3549c..01d8e078b1 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte @@ -240,7 +240,7 @@ $: filteredResult != undefined && rerender() - let css = initCss($app.css?.tablecomponent, customCss) + let css = initCss(app.val.css?.tablecomponent, customCss) $componentControl[id] = { right: (skipActions: boolean | undefined) => { @@ -347,7 +347,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.tablecomponent} + componentStyle={app.val.css?.tablecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/display/table/SyncColumnDefs.svelte b/frontend/src/lib/components/apps/components/display/table/SyncColumnDefs.svelte index 2665ac8d4f..faebc28f74 100644 --- a/frontend/src/lib/components/apps/components/display/table/SyncColumnDefs.svelte +++ b/frontend/src/lib/components/apps/components/display/table/SyncColumnDefs.svelte @@ -16,7 +16,7 @@ const { app, mode, selectedComponent } = getContext('AppViewerContext') async function syncColumns() { - let gridItem = findGridItem($app, id) + let gridItem = findGridItem(app.val, id) if (gridItem && result) { const keys = Object.keys(result[0] ?? {}) ?? [] @@ -42,7 +42,7 @@ } async function setEmptyColumns() { - let gridItem = findGridItem($app, id) + let gridItem = findGridItem(app.val, id) if (gridItem && gridItem.data.configuration.columnDefs.type === 'static') { gridItem.data.configuration.columnDefs.value = [] await updateConfiguration() diff --git a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte index df59b1a422..1476538c16 100644 --- a/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte +++ b/frontend/src/lib/components/apps/components/helpers/RunnableComponent.svelte @@ -369,7 +369,7 @@ const uuid = await executeRunnable( runnable, workspace, - $app.version, + app.val.version, $userStore?.username, $appPath, id, @@ -436,7 +436,7 @@ } } - const oneOfRunnableInputs = isEditor ? collectOneOfFields(fields, $app) : {} + const oneOfRunnableInputs = isEditor ? collectOneOfFields(fields, app.val) : {} const requestBody: ExecuteComponentData['requestBody'] = { args: nonStaticRunnableInputs, @@ -608,7 +608,7 @@ function handleInputClick(e: CustomEvent) { const event = e as unknown as PointerEvent - !$connectingInput.opened && selectId(event, id, selectedComponent, $app) + !$connectingInput.opened && selectId(event, id, selectedComponent, app.val) } let cancellableRun: ((inlineScript?: InlineScript) => CancelablePromise) | undefined = diff --git a/frontend/src/lib/components/apps/components/inputs/AppCheckbox.svelte b/frontend/src/lib/components/apps/components/inputs/AppCheckbox.svelte index 91a94db8ce..94541aa15b 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppCheckbox.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppCheckbox.svelte @@ -93,7 +93,7 @@ $: resolvedConfig.defaultValue != undefined && handleDefault() - let css = initCss($app.css?.checkboxcomponent, customCss) + let css = initCss(app.val.css?.checkboxcomponent, customCss) {#each Object.keys(components['checkboxcomponent'].initialData.configuration) as key (key)} @@ -112,7 +112,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.checkboxcomponent} + componentStyle={app.val.css?.checkboxcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte index 697c0d040e..d79a0f19d8 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppDateInput.svelte @@ -77,7 +77,7 @@ function handleDefault(defaultValue: string | undefined) { value = defaultValue } - let css = initCss($app.css?.dateinputcomponent, customCss) + let css = initCss(app.val.css?.dateinputcomponent, customCss) {#each Object.keys(components['dateinputcomponent'].initialData.configuration) as key (key)} @@ -95,7 +95,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.dateinputcomponent} + componentStyle={app.val.css?.dateinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppDateSelect.svelte b/frontend/src/lib/components/apps/components/inputs/AppDateSelect.svelte index bd454eb780..e9e6c341ea 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppDateSelect.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppDateSelect.svelte @@ -82,7 +82,7 @@ } } - let css = initCss($app.css?.dateinputcomponent, customCss) + let css = initCss(app.val.css?.dateinputcomponent, customCss) let selectedDay: string | undefined = undefined let selectedMonth: string | undefined = undefined @@ -209,7 +209,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.dateselectcomponent} + componentStyle={app.val.css?.dateselectcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppDateSliderInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppDateSliderInput.svelte index 4e998ed739..f3fa87c820 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppDateSliderInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppDateSliderInput.svelte @@ -92,7 +92,7 @@ } } - let css = initCss($app.css?.dateslidercomponent, customCss) + let css = initCss(app.val.css?.dateslidercomponent, customCss) let lastStyle: string | undefined = undefined $: if (css && slider && lastStyle !== css?.handle?.style) { @@ -143,7 +143,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.dateslidercomponent} + componentStyle={app.val.css?.dateslidercomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppDateTimeInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppDateTimeInput.svelte index 5c8f3f77b3..8557b2754f 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppDateTimeInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppDateTimeInput.svelte @@ -138,7 +138,7 @@ value = defaultValue } - let css = initCss($app.css?.datetimeinputcomponent, customCss) + let css = initCss(app.val.css?.datetimeinputcomponent, customCss) {#each Object.keys(components['datetimeinputcomponent'].initialData.configuration) as key (key)} @@ -156,7 +156,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.datetimeinputcomponent} + componentStyle={app.val.css?.datetimeinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte index fa8e956709..f7b4afbea9 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppFileInput.svelte @@ -41,7 +41,7 @@ onFileChange?.forEach((id) => $runnableComponents?.[id]?.cb?.forEach((cb) => cb?.())) } - let css = initCss($app.css?.fileinputcomponent, customCss) + let css = initCss(app.val.css?.fileinputcomponent, customCss) let fileInput: FileInput | undefined = undefined @@ -70,7 +70,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.fileinputcomponent} + componentStyle={app.val.css?.fileinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppMultiSelect.svelte b/frontend/src/lib/components/apps/components/inputs/AppMultiSelect.svelte index d586fd85f3..dfcce7ff09 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppMultiSelect.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppMultiSelect.svelte @@ -7,7 +7,9 @@ import MultiSelect from 'svelte-multiselect' export let id: string + // svelte-ignore export_let_unused export let configuration: RichConfigurations + // svelte-ignore export_let_unused export let customCss: ComponentCustomCSS<'multiselectcomponent'> | undefined = undefined export let render: boolean export let verticalAlignment: 'top' | 'center' | 'bottom' | undefined = undefined diff --git a/frontend/src/lib/components/apps/components/inputs/AppMultiSelectV2.svelte b/frontend/src/lib/components/apps/components/inputs/AppMultiSelectV2.svelte index 642b109464..0849654c02 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppMultiSelectV2.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppMultiSelectV2.svelte @@ -134,7 +134,7 @@ } } - let css = initCss($app.css?.multiselectcomponent, customCss) + let css = initCss(app.val.css?.multiselectcomponent, customCss) function setOuterDivStyle(outerDiv: HTMLDivElement, portalRef: HTMLDivElement, style: string) { outerDiv.setAttribute('style', style) @@ -185,7 +185,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.multiselectcomponent} + componentStyle={app.val.css?.multiselectcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte index 0022fa0885..da65dbc97c 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppNumberInput.svelte @@ -80,7 +80,7 @@ value = defaultValue } - let css = initCss($app.css?.numberinputcomponent, customCss) + let css = initCss(app.val.css?.numberinputcomponent, customCss) {#each Object.keys(components['numberinputcomponent'].initialData.configuration) as key (key)} @@ -98,7 +98,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.numberinputcomponent} + componentStyle={app.val.css?.numberinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte index 9177b9ae8b..756c22976d 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppRangeInput.svelte @@ -64,7 +64,7 @@ } } - let css = initCss($app.css?.rangecomponent, customCss) + let css = initCss(app.val.css?.rangecomponent, customCss) let lastStyle: string | undefined = undefined $: if (css && slider && lastStyle !== css?.handles?.style) { @@ -95,7 +95,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.rangecomponent} + componentStyle={app.val.css?.rangecomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppS3FileInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppS3FileInput.svelte index efd46a1126..1196e50da3 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppS3FileInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppS3FileInput.svelte @@ -47,7 +47,7 @@ $: resolvedConfigS3 = resolvedConfig.type.configuration.s3 - let css = initCss($app.css?.fileinputcomponent, customCss) + let css = initCss(app.val.css?.fileinputcomponent, customCss) /* {#if resolvedConfig.displayDirectLink && fileUpload.progress === 100} @@ -77,7 +77,10 @@ if (!isEditor) { return undefined } - const policy = computeS3FileInputPolicy((configuration as any)?.type?.configuration?.s3, $app) + const policy = computeS3FileInputPolicy( + (configuration as any)?.type?.configuration?.s3, + app.val + ) return policy } @@ -90,7 +93,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.fileinputcomponent} + componentStyle={app.val.css?.fileinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppSelect.svelte b/frontend/src/lib/components/apps/components/inputs/AppSelect.svelte index 5c9fff9c35..3ebbaee460 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppSelect.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppSelect.svelte @@ -189,7 +189,7 @@ setContextValue(undefined) } - let css = $state(initCss($app.css?.selectcomponent, customCss)) + let css = $state(initCss(app.val.css?.selectcomponent, customCss)) let previsousFilter = '' @@ -246,7 +246,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.selectcomponent} + componentStyle={app.val.css?.selectcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppSelectStep.svelte b/frontend/src/lib/components/apps/components/inputs/AppSelectStep.svelte index b6fb3a6e3c..30ef49d445 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppSelectStep.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppSelectStep.svelte @@ -80,7 +80,7 @@ return typeof item == 'string' ? item : item.label } - let css = initCss($app.css?.selectstepcomponent, customCss) + let css = initCss(app.val.css?.selectstepcomponent, customCss) $: selected && handleSelection(selected) @@ -99,7 +99,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.selectstepcomponent} + componentStyle={app.val.css?.selectstepcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppSelectTab.svelte b/frontend/src/lib/components/apps/components/inputs/AppSelectTab.svelte index 39069b2fb5..21b120678b 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppSelectTab.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppSelectTab.svelte @@ -83,7 +83,7 @@ } } - let css = $state(initCss($app.css?.selecttabcomponent, customCss)) + let css = $state(initCss(app.val.css?.selecttabcomponent, customCss)) $effect.pre(() => { selected === '' && resolvedConfig.defaultValue && untrack(() => setDefaultValue()) }) @@ -107,7 +107,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.selecttabcomponent} + componentStyle={app.val.css?.selecttabcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte b/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte index 7d4adaa877..4de9329217 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppSliderInputs.svelte @@ -73,7 +73,7 @@ } } - let css = initCss($app.css?.slidercomponent, customCss) + let css = initCss(app.val.css?.slidercomponent, customCss) let lastStyle: string | undefined = undefined $: if (css && slider && lastStyle !== css?.handle?.style) { @@ -121,7 +121,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.slidercomponent} + componentStyle={app.val.css?.slidercomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppTextInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppTextInput.svelte index 9eba5c8323..5f67438c55 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppTextInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppTextInput.svelte @@ -96,7 +96,7 @@ value = defaultValue } - let css = initCss($app.css?.[appCssKey], customCss) + let css = initCss(app.val.css?.[appCssKey], customCss) $: classInput = twMerge( 'windmillapp w-full py-1.5 px-2 text-sm', @@ -152,7 +152,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.textinputcomponent} + componentStyle={app.val.css?.textinputcomponent} /> {/each} @@ -170,7 +170,7 @@ )} style="resize:none; {css?.input?.style ?? ''}" on:pointerdown|stopPropagation={(e) => - !$connectingInput.opened && selectId(e, id, selectedComponent, $app)} + !$connectingInput.opened && selectId(e, id, selectedComponent, app.val)} on:keydown|stopPropagation bind:value placeholder={resolvedConfig.placeholder} @@ -196,7 +196,7 @@ )} style={css?.input?.style ?? ''} on:pointerdown|stopPropagation={(e) => - !$connectingInput.opened && selectId(e, id, selectedComponent, $app)} + !$connectingInput.opened && selectId(e, id, selectedComponent, app.val)} on:keydown|stopPropagation type="password" autocomplete="new-password" @@ -213,7 +213,7 @@ )} style={css?.input?.style ?? ''} on:pointerdown|stopPropagation={(e) => - !$connectingInput.opened && selectId(e, id, selectedComponent, $app)} + !$connectingInput.opened && selectId(e, id, selectedComponent, app.val)} on:keydown|stopPropagation type="text" bind:value @@ -229,7 +229,7 @@ )} style={css?.input?.style ?? ''} on:pointerdown|stopPropagation={(e) => - !$connectingInput.opened && selectId(e, id, selectedComponent, $app)} + !$connectingInput.opened && selectId(e, id, selectedComponent, app.val)} on:keydown|stopPropagation type="email" bind:value diff --git a/frontend/src/lib/components/apps/components/inputs/AppTimeInput.svelte b/frontend/src/lib/components/apps/components/inputs/AppTimeInput.svelte index cfee4a193c..66a099dc4f 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppTimeInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppTimeInput.svelte @@ -91,7 +91,7 @@ function handleDefault(defaultValue: string | undefined) { value = defaultValue } - let css = initCss($app.css?.timeinputcomponent, customCss) + let css = initCss(app.val.css?.timeinputcomponent, customCss) {#each Object.keys(components['timeinputcomponent'].initialData.configuration) as key (key)} @@ -109,7 +109,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.timeinputcomponent} + componentStyle={app.val.css?.timeinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/AppUserResource.svelte b/frontend/src/lib/components/apps/components/inputs/AppUserResource.svelte index 93a54b7f4f..d9e1383e81 100644 --- a/frontend/src/lib/components/apps/components/inputs/AppUserResource.svelte +++ b/frontend/src/lib/components/apps/components/inputs/AppUserResource.svelte @@ -37,7 +37,7 @@ result: undefined as string | undefined }) - let css = initCss($app.css?.['userresourcecomponent'], customCss) + let css = initCss(app.val.css?.['userresourcecomponent'], customCss) $: classInput = twMerge( 'windmillapp w-full px-2', @@ -94,7 +94,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.textinputcomponent} + componentStyle={app.val.css?.textinputcomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte b/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte index 4448cfa4d3..8eac1bf54d 100644 --- a/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte +++ b/frontend/src/lib/components/apps/components/inputs/currency/AppCurrencyInput.svelte @@ -76,7 +76,7 @@ $: value != undefined && handleInput() - let css = initCss($app.css?.currencycomponent, customCss) + let css = initCss(app.val.css?.currencycomponent, customCss) {#each Object.keys(components['currencycomponent'].initialData.configuration) as key (key)} @@ -94,7 +94,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.currencycomponent} + componentStyle={app.val.css?.currencycomponent} /> {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte b/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte index d3618b6bed..a8b1181176 100644 --- a/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppConditionalWrapper.svelte @@ -54,7 +54,7 @@ } } - let css = $state(initCss($app.css?.conditionalwrapper, customCss)) + let css = $state(initCss(app.val.css?.conditionalwrapper, customCss)) let resolvedConditions: boolean[] = $state(conditions.map((_x) => false)) let selectedConditionIndex = $state(0) @@ -109,7 +109,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.conditionalwrapper} + componentStyle={app.val.css?.conditionalwrapper} /> {/each} @@ -117,7 +117,7 @@ {#if everRender}
- {#if $app.subgrids} + {#if app.val.subgrids} {#each resolvedConditions ?? [] as _res, i} -{:else if $app.subgrids} +{:else if app.val.subgrids} {#each resolvedConditions ?? [] as _res, i} {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppContainer.svelte b/frontend/src/lib/components/apps/components/layout/AppContainer.svelte index cc553e4df3..310e05ba5e 100644 --- a/frontend/src/lib/components/apps/components/layout/AppContainer.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppContainer.svelte @@ -66,7 +66,7 @@ } }) - let css = $state(initCss($app.css?.containercomponent, customCss)) + let css = $state(initCss(app.val.css?.containercomponent, customCss)) @@ -77,7 +77,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.containercomponent} + componentStyle={app.val.css?.containercomponent} /> {/each} @@ -89,7 +89,7 @@ {#if everRender}
- {#if $app.subgrids?.[`${id}-0`]} + {#if app.val.subgrids?.[`${id}-0`]} {/if}
-{:else if $app.subgrids?.[`${id}-0`]} +{:else if app.val.subgrids?.[`${id}-0`]} diff --git a/frontend/src/lib/components/apps/components/layout/AppDecisionTree.svelte b/frontend/src/lib/components/apps/components/layout/AppDecisionTree.svelte index c29bb46825..f914500ab0 100644 --- a/frontend/src/lib/components/apps/components/layout/AppDecisionTree.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppDecisionTree.svelte @@ -53,12 +53,12 @@ debuggingComponents } = getContext('AppViewerContext') - let css = $state(initCss($app.css?.conditionalwrapper, customCss)) + let css = $state(initCss(app.val.css?.conditionalwrapper, customCss)) let selectedConditionIndex = 0 let currentNodeId = $state(getFirstNode(nodes)?.id ?? '') let outputs = initOutput($worldStore, id, { - currentNodeId, + currentNodeId: untrack(() => currentNodeId), currentNodeIndex: selectedConditionIndex }) @@ -195,7 +195,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.conditionalwrapper} + componentStyle={app.val.css?.conditionalwrapper} /> {/each} @@ -204,7 +204,7 @@ {#if everRender}
- {#if $app.subgrids} + {#if app.val.subgrids} {#each Object.values(nodes) ?? [] as node, i}
{/if} -{:else if $app.subgrids} +{:else if app.val.subgrids} {#each Object.values(nodes) ?? [] as _node, i} {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppDivider.svelte b/frontend/src/lib/components/apps/components/layout/AppDivider.svelte index ac218f3086..fdaaf8fdb8 100644 --- a/frontend/src/lib/components/apps/components/layout/AppDivider.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppDivider.svelte @@ -29,7 +29,7 @@ let size = 2 let color = '#00000060' - let css = initCss($app.css?.[position + 'dividercomponent'], customCss) + let css = initCss(app.val.css?.[position + 'dividercomponent'], customCss) //used so that we can count number of outputs setup for first refresh initOutput($worldStore, id, {}) @@ -57,7 +57,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.[position + 'dividercomponent']} + componentStyle={app.val.css?.[position + 'dividercomponent']} /> {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte b/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte index 679bb928c8..45c2d722b6 100644 --- a/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte @@ -76,7 +76,7 @@ } } - let css = $state(initCss($app.css?.drawercomponent, customCss)) + let css = $state(initCss(app.val.css?.drawercomponent, customCss)) {#each Object.keys(components['drawercomponent'].initialData.configuration) as key (key)} @@ -94,7 +94,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.drawercomponent} + componentStyle={app.val.css?.drawercomponent} /> {/each} @@ -178,7 +178,7 @@ } }} > - {#if $app.subgrids?.[`${id}-0`]} + {#if app.val.subgrids?.[`${id}-0`]} -{:else if $app.subgrids?.[`${id}-0`]} +{:else if app.val.subgrids?.[`${id}-0`]} {/if} diff --git a/frontend/src/lib/components/apps/components/layout/AppList.svelte b/frontend/src/lib/components/apps/components/layout/AppList.svelte index ef2b906178..ec9d21511a 100644 --- a/frontend/src/lib/components/apps/components/layout/AppList.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppList.svelte @@ -60,7 +60,7 @@ } } - let css = $state(initCss($app.css?.listcomponent, customCss)) + let css = $state(initCss(app.val.css?.listcomponent, customCss)) let result: any[] | undefined = $state(undefined) let isCard = $derived(resolvedConfig.width?.selected == 'card') @@ -138,7 +138,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.listcomponent} + componentStyle={app.val.css?.listcomponent} /> {/each} @@ -169,7 +169,7 @@ ? 'divide-y flex-col' : 'flex-col'}" > - {#if $app.subgrids?.[`${id}-0`] && Array.isArray(result) && result.length > 0} + {#if app.val.subgrids?.[`${id}-0`] && Array.isArray(result) && result.length > 0} {#each result ?? [] as value, index (index)} {@const inRange = index <= pagination.maxIndex && index >= pagination.indexOffset}
{/if}
- {:else if $app.subgrids} + {:else if app.val.subgrids} diff --git a/frontend/src/lib/components/apps/components/layout/AppModal.svelte b/frontend/src/lib/components/apps/components/layout/AppModal.svelte index 1c50c0a017..442849a762 100644 --- a/frontend/src/lib/components/apps/components/layout/AppModal.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppModal.svelte @@ -65,7 +65,7 @@ open: false }) - let css = $state(initCss($app.css?.modalcomponent, customCss)) + let css = $state(initCss(app.val.css?.modalcomponent, customCss)) let disposable: Disposable | undefined = $state(undefined) let resolvedConfig = $state( @@ -103,7 +103,8 @@ let containerHeight = $derived( Math.min( // 8px * 2 of padding - maxHeight($app.subgrids?.[`${id}-0`] ?? [], 0, $breakpoint) * (ROW_HEIGHT + ROW_GAP_Y) + 16, + maxHeight(app.val.subgrids?.[`${id}-0`] ?? [], 0, $breakpoint) * (ROW_HEIGHT + ROW_GAP_Y) + + 16, // 32px (2rem) of top and bottom margin wrapperHeight - headerHeight - 64 ) @@ -131,7 +132,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.modalcomponent} + componentStyle={app.val.css?.modalcomponent} /> {/each} @@ -237,7 +238,7 @@ } }} > - {#if $app.subgrids?.[`${id}-0`]} + {#if app.val.subgrids?.[`${id}-0`]} -{:else if $app.subgrids?.[`${id}-0`]} +{:else if app.val.subgrids?.[`${id}-0`]} {/if} diff --git a/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte b/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte index 4424280ced..7ce6af3d78 100644 --- a/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte @@ -51,7 +51,7 @@ } } - let css = $state(initCss($app.css?.containercomponent, customCss)) + let css = $state(initCss(app.val.css?.containercomponent, customCss)) $componentControl[id] = { left: () => { @@ -93,7 +93,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.[ + componentStyle={app.val.css?.[ horizontal ? 'horizontalsplitpanescomponent' : 'verticalsplitpanescomponent' ]} /> @@ -117,7 +117,7 @@ } })} > - {#if $app.subgrids?.[`${id}-${index}`]} + {#if app.val.subgrids?.[`${id}-${index}`]} selected)) ?? -1) let maxReachedIndex = $state(-1) let statusByStep = $state([] as Array<'success' | 'error' | 'pending'>) let debugMode: boolean = false @@ -152,7 +152,7 @@ $effect.pre(() => { selected != undefined && untrack(() => handleTabSelection()) }) - let css = $state(initCss($app.css?.steppercomponent, customCss)) + let css = $state(initCss(app.val.css?.steppercomponent, customCss)) let lastStep = $derived(selectedIndex === tabs.length - 1) let directionClicked: 'left' | 'right' | undefined = $state(undefined) @@ -164,7 +164,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.steppercomponent} + componentStyle={app.val.css?.steppercomponent} /> {/each} @@ -205,7 +205,7 @@ {/if}
- {#if $app.subgrids} + {#if app.val.subgrids} {#each tabs ?? [] as _res, i} {/if}
- {:else if $app.subgrids} + {:else if app.val.subgrids} {#each tabs ?? [] as _res, i} {/each} diff --git a/frontend/src/lib/components/apps/components/layout/AppTabs.svelte b/frontend/src/lib/components/apps/components/layout/AppTabs.svelte index e9d028a5ed..e91abf387a 100644 --- a/frontend/src/lib/components/apps/components/layout/AppTabs.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppTabs.svelte @@ -62,8 +62,8 @@ } = getContext('AppViewerContext') let selected: string = $state(tabs[0]) - let selectedIndex = $state(tabs?.indexOf(selected) ?? -1) - let css = $state(initCss($app.css?.tabscomponent, customCss)) + let selectedIndex = $state(tabs?.indexOf(untrack(() => selected)) ?? -1) + let css = $state(initCss(app.val.css?.tabscomponent, customCss)) let tabHeight: number = $state(0) @@ -154,7 +154,7 @@ {customCss} {key} bind:css={css[key]} - componentStyle={$app.css?.tabscomponent} + componentStyle={app.val.css?.tabscomponent} /> {/each} @@ -278,7 +278,7 @@
{:else}
- {#if $app.subgrids} + {#if app.val.subgrids} {#each tabs ?? [] as _res, i} {/if}
-{:else if $app.subgrids} +{:else if app.val.subgrids} {#each tabs ?? [] as _res, i} {/each} diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index d7555b8460..7217d4b4c3 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -26,7 +26,13 @@ import TabContent from '$lib/components/common/tabs/TabContent.svelte' import Tabs from '$lib/components/common/tabs/TabsV2.svelte' import { userStore, workspaceStore } from '$lib/stores' - import { classNames, encodeState, getModifierKey, sendUserToast } from '$lib/utils' + import { + classNames, + encodeState, + getModifierKey, + sendUserToast, + type StateStore + } from '$lib/utils' import AppPreview from './AppPreview.svelte' import ComponentList from './componentsPanel/ComponentList.svelte' import ContextPanel from './contextPanel/ContextPanel.svelte' @@ -101,7 +107,7 @@ migrateApp(app) const stateApp = $state(app) - const appStore = writable(stateApp) + const appStore: StateStore = $state({ val: stateApp }) const selectedComponent = writable(undefined) // $: selectedComponent.subscribe((s) => { @@ -243,7 +249,7 @@ timeout && clearTimeout(timeout) timeout = setTimeout(() => { try { - localStorage.setItem(path != '' ? `app-${path}` : 'app', encodeState($appStore)) + localStorage.setItem(path != '' ? `app-${path}` : 'app', encodeState(appStore.val)) } catch (err) { console.error('Error storing frontend draft in localStorage', err) } @@ -263,7 +269,7 @@ selectedTab = 'settings' if (befSelected) { if (!['ctx', 'state'].includes(befSelected) && !befSelected?.startsWith(BG_PREFIX)) { - let item = findGridItem($appStore, befSelected) + let item = findGridItem(appStore.val, befSelected) if ( item?.data.type === 'containercomponent' || item?.data.type === 'listcomponent' || @@ -289,7 +295,7 @@ ($worldStore.outputsById?.[befSelected]?.selectedTabIndex?.peak() as number) ?? 0 } } else { - let subgrid = findGridItemParentGrid($appStore, befSelected) + let subgrid = findGridItemParentGrid(appStore.val, befSelected) if (subgrid) { try { $focusedGrid = { @@ -398,22 +404,25 @@ let css: string | undefined = $state(undefined) let lastTheme: string | undefined = undefined - appStore.subscribe(async (currentAppStore) => { - if (!currentAppStore.theme) { - return - } - - if (JSON.stringify(currentAppStore.theme) != lastTheme) { - if (currentAppStore.theme.type === 'inlined') { - css = currentAppStore.theme.css - } else if (currentAppStore.theme.type === 'path' && currentAppStore.theme?.path) { - let loadedCss = await getTheme($workspaceStore!, currentAppStore.theme.path) - if (loadedCss) { - css = loadedCss.value - } + $effect(() => { + ;[appStore.val] + untrack(async () => { + if (!appStore.val.theme) { + return } - lastTheme = JSON.stringify(currentAppStore.theme) - } + + if (JSON.stringify(appStore.val.theme) != lastTheme) { + if (appStore.val.theme.type === 'inlined') { + css = appStore.val.theme.css + } else if (appStore.val.theme.type === 'path' && appStore.val.theme?.path) { + let loadedCss = await getTheme($workspaceStore!, appStore.val.theme.path) + if (loadedCss) { + css = loadedCss.value + } + } + lastTheme = JSON.stringify(appStore.val.theme) + } + }) }) function addOrRemoveCss(isPremium: boolean, isPreview: boolean = false) { @@ -771,15 +780,15 @@ path && untrack(() => onPathChange()) }) $effect(() => { - $appStore && untrack(() => saveFrontendDraft()) + appStore.val && untrack(() => saveFrontendDraft()) }) $effect(() => { context.mode = $mode == 'dnd' ? 'editor' : 'viewer' }) let width = $derived( - $breakpoint === 'sm' && $appStore?.mobileViewOnSmallerScreens !== false + $breakpoint === 'sm' && appStore.val?.mobileViewOnSmallerScreens !== false ? 'min-w-[400px] max-w-[656px]' - : `min-w-[710px] ${$appStore.fullscreen ? 'w-full' : 'max-w-7xl'}` + : `min-w-[710px] ${appStore.val.fullscreen ? 'w-full' : 'max-w-7xl'}` ) $effect(() => { if ($selectedComponent?.[0] != befSelected) { @@ -858,7 +867,7 @@ {#if !$userStore?.operator} - {#if $appStore} + {#if appStore.val} {#if leftPanelSize === 0} @@ -1097,7 +1106,7 @@ )} style={$componentActive ? `top: -${$yTop}px;` : ''} > - {#if $appStore.grid} + {#if appStore.val.grid} {#if !$connectingInput?.opened} {/if} @@ -1114,7 +1123,7 @@
{/if} - {#if !$appStore?.mobileViewOnSmallerScreens && $breakpoint === 'sm'} + {#if !appStore.val?.mobileViewOnSmallerScreens && $breakpoint === 'sm'}
@@ -1131,7 +1140,7 @@ variant="border" size="xs" on:click={() => { - $appStore.mobileViewOnSmallerScreens = true + appStore.val.mobileViewOnSmallerScreens = true }} startIcon={{ icon: Smartphone diff --git a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte index 42d6f7a0f3..41ff03d8c4 100644 --- a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte @@ -187,7 +187,7 @@ } async function computeTriggerables() { - const items = allItems($app.grid, $app.subgrids) + const items = allItems(app.val.grid, app.val.subgrids) console.debug('items', items) @@ -277,7 +277,7 @@ return processed as Promise<[string, TriggerableV2] | undefined>[] }) .concat( - Object.values($app.hiddenInlineScripts ?? {}).map(async (v, i) => { + Object.values(app.val.hiddenInlineScripts ?? {}).map(async (v, i) => { return await processRunnable(BG_PREFIX + i, v, v.fields) }) as Promise<[string, TriggerableV2] | undefined>[] ) @@ -294,7 +294,7 @@ .map((x) => { const c = x.data as AppComponent const config = c.configuration as any - return computeS3FileInputPolicy(config?.type?.configuration?.s3, $app) + return computeS3FileInputPolicy(config?.type?.configuration?.s3, app.val) }) .filter(Boolean) as { allowed_resources: string[] @@ -345,7 +345,7 @@ fields: Record ): Promise<[string, TriggerableV2] | undefined> { const staticInputs = collectStaticFields(fields) - const oneOfInputs = collectOneOfFields(fields, $app) + const oneOfInputs = collectOneOfFields(fields, app.val) const allowUserResources: string[] = Object.entries(fields) .map(([k, v]) => { return v['allowUserResources'] ? k : undefined @@ -382,7 +382,7 @@ await AppService.createApp({ workspace: $workspaceStore!, requestBody: { - value: $app, + value: app.val, path, summary: $summary, policy, @@ -392,7 +392,7 @@ }) savedApp = { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: path, policy: policy, custom_path: customPath @@ -425,12 +425,12 @@ if ( deployedValue && savedApp && - $app && + app.val && orderedJsonStringify(deployedValue) === orderedJsonStringify( replaceFalseWithUndefined({ summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp.draft?.path || savedApp.path, policy, custom_path: customPath @@ -475,7 +475,7 @@ workspace: $workspaceStore!, path: $appPath!, requestBody: { - value: $app!, + value: app.val!, summary: $summary, policy, path: npath, @@ -488,7 +488,7 @@ }) savedApp = { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: npath, policy, custom_path: customPath @@ -548,7 +548,7 @@ await AppService.createApp({ workspace: $workspaceStore!, requestBody: { - value: $app, + value: app.val, path: newEditedPath, summary: $summary, policy, @@ -562,7 +562,7 @@ path: newEditedPath, typ: 'app', value: { - value: $app, + value: app.val, path: newEditedPath, summary: $summary, policy, @@ -572,13 +572,13 @@ }) savedApp = { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: newEditedPath, policy, draft_only: true, draft: { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: newEditedPath, policy, custom_path: customPath @@ -606,7 +606,7 @@ const draftOrDeployed = cleanValueProperties(savedApp.draft || savedApp) const current = cleanValueProperties({ summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp.draft?.path || savedApp.path, policy }) @@ -633,7 +633,7 @@ await AppService.createApp({ workspace: $workspaceStore!, requestBody: { - value: $app!, + value: app.val!, summary: $summary, policy, path: newEditedPath || path, @@ -648,7 +648,7 @@ path: savedApp.draft_only ? newEditedPath || path : path, typ: 'app', value: { - value: $app!, + value: app.val!, summary: $summary, policy, path: newEditedPath || path @@ -660,7 +660,7 @@ ...(savedApp?.draft_only ? { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: savedApp.draft_only ? newEditedPath || path : path, policy, draft_only: true, @@ -669,7 +669,7 @@ : savedApp), draft: { summary: $summary, - value: structuredClone($state.snapshot($app)), + value: structuredClone($state.snapshot(app.val)), path: newEditedPath || path, policy, custom_path: customPath @@ -728,16 +728,16 @@ if (event.ctrlKey || event.metaKey) { const napp = redo(history) for (const key in napp) { - $app[key] = napp[key] + app.val[key] = napp[key] } event.preventDefault() } break case 'z': if (event.ctrlKey || event.metaKey) { - const napp = undo(history, $app) + const napp = undo(history, app.val) for (const key in napp) { - $app[key] = napp[key] + app.val[key] = napp[key] } event.preventDefault() } @@ -786,14 +786,14 @@ displayName: 'Export', icon: FileJson, action: () => { - appExport?.open($app) + appExport?.open(app.val) } }, // { // displayName: 'Publish to Hub', // icon: faGlobe, // action: () => { - // const url = appToHubUrl(toStatic($app, $staticExporter, $summary, $hubBaseUrlStore)) + // const url = appToHubUrl(toStatic(app.val, $staticExporter, $summary, $hubBaseUrlStore)) // window.open(url.toString(), '_blank') // } // }, @@ -801,7 +801,7 @@ displayName: 'Hub compatible JSON', icon: FileUp, action: () => { - appExport?.open(toStatic($app, $staticExporter, $summary).app) + appExport?.open(toStatic(app.val, $staticExporter, $summary).app) } }, { @@ -837,7 +837,7 @@ draft: savedApp.draft, current: { summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp.draft?.path || savedApp.path, policy, custom_path: customPath @@ -890,7 +890,7 @@ } let priorDarkMode = document.documentElement.classList.contains('dark') - setTheme($app?.darkMode) + setTheme(app.val?.darkMode) let customPath = $state(savedApp?.custom_path) let dirtyCustomPath = $state(false) @@ -956,7 +956,7 @@ savedValue: savedApp, modifiedValue: { summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp?.draft?.path || savedApp?.path, policy, custom_path: customPath @@ -972,7 +972,7 @@ bind:deployedValue currentValue={{ summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp?.draft?.path || savedApp?.path, policy, custom_path: customPath @@ -1128,7 +1128,7 @@ draft: savedApp.draft, current: { summary: $summary, - value: $app, + value: app.val, path: newEditedPath || savedApp.draft?.path || savedApp.path, policy, custom_path: customPath @@ -1318,25 +1318,25 @@ undoProps={{ disabled: $history?.index === 0 }} redoProps={{ disabled: $history && $history?.index === $history.history.length - 1 }} on:undo={() => { - const napp = undo(history, $app) + const napp = undo(history, app.val) for (const key in napp) { - $app[key] = napp[key] + app.val[key] = napp[key] } }} on:redo={() => { const napp = redo(history) for (const key in napp) { - $app[key] = napp[key] + app.val[key] = napp[key] } }} /> - {#if $app} + {#if app.val} { - $app.fullscreen = detail === 'true' + app.val.fullscreen = detail === 'true' }} > {#snippet children({ item })} @@ -1357,14 +1357,14 @@ {/snippet} {/if} - {#if $app} + {#if app.val} { const theme = detail === 'dark' ? true : detail === 'sun' ? false : undefined setTheme(theme) }} - selected={$app.darkMode === undefined ? 'auto' : $app.darkMode ? 'dark' : 'sun'} + selected={app.val.darkMode === undefined ? 'auto' : app.val.darkMode ? 'dark' : 'sun'} > {#snippet children({ item })} {/if} diff --git a/frontend/src/lib/components/apps/editor/AppEditorTutorial.svelte b/frontend/src/lib/components/apps/editor/AppEditorTutorial.svelte index aadd8cf589..414c599260 100644 --- a/frontend/src/lib/components/apps/editor/AppEditorTutorial.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditorTutorial.svelte @@ -23,7 +23,7 @@ const forkedFromTemplate = urlParams.get('template') if ( - !isAppTainted($app) && + !isAppTainted(app.val) && !$ignoredTutorials.includes(7) && $tutorialsToDo.includes(7) && !forkedFromTheHub && diff --git a/frontend/src/lib/components/apps/editor/AppInputs.svelte b/frontend/src/lib/components/apps/editor/AppInputs.svelte index ed9591903c..ba13a04936 100644 --- a/frontend/src/lib/components/apps/editor/AppInputs.svelte +++ b/frontend/src/lib/components/apps/editor/AppInputs.svelte @@ -19,7 +19,7 @@
- {#each allItems($app.grid, $app.subgrids) as gridItem (gridItem.data.id)} + {#each allItems(app.val.grid, app.val.subgrids) as gridItem (gridItem.data.id)} {#if gridItem?.data?.type === 'tablecomponent'}
@@ -52,10 +52,10 @@ {/each}
-{#if $app?.hiddenInlineScripts?.length > 0} +{#if app.val?.hiddenInlineScripts?.length > 0}
Background runnable inputs
- {#each $app?.hiddenInlineScripts ?? [] as script, index (script.name)} + {#each app.val?.hiddenInlineScripts ?? [] as script, index (script.name)}
{script.name}
diff --git a/frontend/src/lib/components/apps/editor/AppPreview.svelte b/frontend/src/lib/components/apps/editor/AppPreview.svelte index 1438f0712c..556e516ed8 100644 --- a/frontend/src/lib/components/apps/editor/AppPreview.svelte +++ b/frontend/src/lib/components/apps/editor/AppPreview.svelte @@ -1,4 +1,6 @@ - - + - +
- {#if $appStore.grid} + {#if appStore.val.grid}
- - -
($selectedComponent = [dataItem.id])} - > - -
+ + {#snippet children({ dataItem })} + +
($selectedComponent = [dataItem.id])} + > + +
+ {/snippet}
{#if isLocked} - - + +
(isLocked = false)} + onclick={() => (isLocked = false)} class="absolute inset-0 center-center bg-black/20 z-50 backdrop-blur-[1px] cursor-pointer" > {/if} - {#if $app?.theme?.type !== 'path' || $app.theme.path !== row.path} + {#if app.val?.theme?.type !== 'path' || app.val.theme.path !== row.path} diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte index 3fb6cbda33..51aa0ec8ec 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte @@ -95,7 +95,7 @@
Components - {#each $app.grid as gridItem, index (gridItem.id)} + {#each app.val.grid as gridItem, index (gridItem.id)} {/each}
diff --git a/frontend/src/lib/components/apps/editor/contextPanel/DebugPanel.svelte b/frontend/src/lib/components/apps/editor/contextPanel/DebugPanel.svelte index c0094fba48..adf89284db 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/DebugPanel.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/DebugPanel.svelte @@ -12,15 +12,15 @@ const { app, initialized } = getContext('AppViewerContext') - $: unintitializedComponents = allItems($app.grid, $app.subgrids) + $: unintitializedComponents = allItems(app.val.grid, app.val.subgrids) .map((x) => x.id) .filter((x) => !$initialized.initializedComponents?.includes(x)) .sort() - $: subgridsErrors = Object.keys($app.subgrids ?? {}) + $: subgridsErrors = Object.keys(app.val.subgrids ?? {}) .map((x) => { const parentId = x.split('-')[0] - const parent = findGridItem($app, parentId) + const parent = findGridItem(app.val, parentId) const subgrid = x.replace(`${parentId}-`, '') if (subgrid == '-1') { return { @@ -79,7 +79,7 @@ {#each unintitializedComponents as c} - {@const item = findGridItem($app, c)} + {@const item = findGridItem(app.val, c)} {#if !item}
Item {c} not found
{:else} @@ -107,9 +107,9 @@ }} size="xs2" on:click={() => { - let parent = findGridItemParentGrid($app, c) - deleteGridItem($app, item.data, parent) - $app = $app + let parent = findGridItemParentGrid(app.val, c) + deleteGridItem(app.val, item.data, parent) + app.val = app.val }} > Remove @@ -163,9 +163,9 @@ }} size="xs2" on:click={() => { - if ($app.subgrids && s) { - delete $app.subgrids[s.subGridId] - $app = $app + if (app.val.subgrids && s) { + delete app.val.subgrids[s.subGridId] + app.val = app.val } }} > diff --git a/frontend/src/lib/components/apps/editor/contextPanel/LazyModePanel.svelte b/frontend/src/lib/components/apps/editor/contextPanel/LazyModePanel.svelte index 534be983ac..e29dd8570d 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/LazyModePanel.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/LazyModePanel.svelte @@ -9,10 +9,10 @@ import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte' const { app } = getContext('AppViewerContext') - let code = $state(JSON.stringify($app.lazyInitRequire)) + let code = $state(JSON.stringify(app.val.lazyInitRequire)) let selectedRendering = $state( - $app.eagerRendering ? 'eager' : $app.lazyInitRequire ? 'lazy' : 'semi-lazy' + app.val.eagerRendering ? 'eager' : app.val.lazyInitRequire ? 'lazy' : 'semi-lazy' ) @@ -32,15 +32,15 @@ bind:selected={selectedRendering} on:selected={(e) => { if (e.detail == 'eager') { - $app.eagerRendering = true - $app.lazyInitRequire = undefined + app.val.eagerRendering = true + app.val.lazyInitRequire = undefined } else if (e.detail == 'semi-lazy') { - $app.eagerRendering = undefined - $app.lazyInitRequire = undefined + app.val.eagerRendering = undefined + app.val.lazyInitRequire = undefined } else { - $app.eagerRendering = undefined - $app.lazyInitRequire = [] - code = JSON.stringify($app.lazyInitRequire) + app.val.eagerRendering = undefined + app.val.lazyInitRequire = [] + code = JSON.stringify(app.val.lazyInitRequire) } }} > @@ -65,7 +65,7 @@ {:else if selectedRendering == 'lazy'}
- + {'e.g: ["a", "b"]'}, no need to put background runnables ids diff --git a/frontend/src/lib/components/apps/editor/contextPanel/SubGridOutput.svelte b/frontend/src/lib/components/apps/editor/contextPanel/SubGridOutput.svelte index 1c025bdaaa..86ec3428eb 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/SubGridOutput.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/SubGridOutput.svelte @@ -22,7 +22,7 @@ $: subgridItems = subGrids.map((k) => ({ k, - items: $app.subgrids?.[k] ?? [] + items: app.val.subgrids?.[k] ?? [] })) $: if (outputs?.selectedTabIndex) { diff --git a/frontend/src/lib/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte b/frontend/src/lib/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte index ceb562384b..75c64193d3 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte @@ -7,7 +7,7 @@ const { app } = getContext('AppViewerContext') -{#each $app.hiddenInlineScripts ?? [] as action, index} +{#each app.val.hiddenInlineScripts ?? [] as action, index} {#if !action.hidden} {/if} diff --git a/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte b/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte index 88882ced5b..302ad36bdb 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte @@ -12,7 +12,7 @@ const dispatch = createEventDispatcher() - $: reservedIds = allItems($app.grid, $app.subgrids).map((item) => item.id) + $: reservedIds = allItems(app.val.grid, app.val.subgrids).map((item) => item.id) ('AppViewerContext') - $: subids = $search != '' ? allsubIds($app, id) : [] + $: subids = $search != '' ? allsubIds(app.val, id) : [] $: inSearch = $search != '' && ($hasResult[id] || @@ -55,7 +55,7 @@ } function renameId(newId: string): void { - const item = findGridItem($app, id) + const item = findGridItem(app.val, id) if (!item) { return @@ -63,23 +63,23 @@ item.data.id = newId item.id = newId - const oldSubgrids = Object.keys($app.subgrids ?? {}).filter((subgrid) => + const oldSubgrids = Object.keys(app.val.subgrids ?? {}).filter((subgrid) => subgrid.startsWith(id + '-') ) oldSubgrids.forEach((subgrid) => { - if ($app.subgrids) { - $app.subgrids[subgrid.replace(id, newId)] = $app.subgrids[subgrid] - delete $app.subgrids[subgrid] + if (app.val.subgrids) { + app.val.subgrids[subgrid.replace(id, newId)] = app.val.subgrids[subgrid] + delete app.val.subgrids[subgrid] } }) function propagateRename(from: string, to: string) { - allItems($app.grid, $app.subgrids).forEach((item) => { + allItems(app.val.grid, app.val.subgrids).forEach((item) => { renameComponent(from, to, item.data) }) - $app.hiddenInlineScripts?.forEach((x) => { + app.val.hiddenInlineScripts?.forEach((x) => { processRunnable(from, to, x) }) } @@ -114,7 +114,7 @@ } } - $app = $app + app.val = app.val $selectedComponent = [newId] delete $worldStore.outputsById[id] @@ -221,8 +221,8 @@ $selectedComponent?.includes(id) ? openBackground[color] : $connectingInput.hoveredComponent === id - ? 'bg-[#fab157]' - : 'bg-surface-secondary', + ? 'bg-[#fab157]' + : 'bg-surface-secondary', first ? 'border-t' : '', nested ? 'border-l' : '', 'transition-all' @@ -271,8 +271,8 @@ docLink={id === 'state' ? 'https://www.windmill.dev/docs/apps/outputs#state' : id === 'ctx' - ? 'https://www.windmill.dev/docs/apps/outputs#app-context' - : ''} + ? 'https://www.windmill.dev/docs/apps/outputs#app-context' + : ''} size="xs2" /> {/if} diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte index 703aea891f..c65b9dff6c 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte @@ -196,7 +196,7 @@ $stateId++ } } - $app = $app + app.val = app.val } } @@ -271,7 +271,7 @@ placeholder="Inline script name" class="!text-xs !rounded-sm !shadow-none" onkeyup={() => { - $app = $app + app.val = app.val if (stateId) { $stateId++ } @@ -385,7 +385,7 @@ loadSchemaAndInputsByName() } } - $app = $app + app.val = app.val }} args={Object.entries(fields).reduce((acc, [key, obj]) => { acc[key] = obj.type === 'static' ? obj.value : undefined @@ -413,7 +413,7 @@ }} on:change={async (e) => { inferSuggestions(e.detail.code) - $app = $app + app.val = app.val }} /> {/if} diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte index 0fa3cb864e..bcc7cffd17 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte @@ -19,7 +19,7 @@ function clear() { if (componentInput && componentInput.type == 'runnable') { componentInput = clearResultAppInput(componentInput) - $app = $app + app.val = app.val } } @@ -76,7 +76,7 @@ /> {:else} { @@ -88,7 +88,7 @@ componentInput.runnable.inlineScript = e.detail componentInput.autoRefresh = true componentInput.recomputeOnInputChanged = true - $app = $app + app.val = app.val } }} /> diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptHiddenRunnable.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptHiddenRunnable.svelte index aca0f9c043..eea82207d7 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptHiddenRunnable.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptHiddenRunnable.svelte @@ -69,7 +69,7 @@ /> {:else} onPick(e.detail)} on:delete showScriptPicker diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte index 87f60209f1..814c080ed6 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte @@ -18,11 +18,11 @@ function deleteBackgroundScript(index: number) { // remove the script from the array at the index - if ($app.hiddenInlineScripts.length - 1 == index) { - $app.hiddenInlineScripts.splice(index, 1) - $app.hiddenInlineScripts = [...$app.hiddenInlineScripts] + if (app.val.hiddenInlineScripts.length - 1 == index) { + app.val.hiddenInlineScripts.splice(index, 1) + app.val.hiddenInlineScripts = [...app.val.hiddenInlineScripts] } else { - $app.hiddenInlineScripts[index] = { + app.val.hiddenInlineScripts[index] = { hidden: true, inlineScript: undefined, name: `Background Runnable ${index}`, @@ -30,7 +30,7 @@ type: 'runnableByName', recomputeIds: undefined } - $app.hiddenInlineScripts = $app.hiddenInlineScripts + app.val.hiddenInlineScripts = app.val.hiddenInlineScripts } $selectedComponentInEditor = undefined @@ -42,10 +42,10 @@ $: gridItem = $selectedComponentInEditor && !$selectedComponentInEditor.startsWith(BG_PREFIX) - ? findGridItem($app, $selectedComponentInEditor?.split('_')?.[0]) + ? findGridItem(app.val, $selectedComponentInEditor?.split('_')?.[0]) : undefined - $: hiddenInlineScript = $app?.hiddenInlineScripts?.findIndex((k_, index) => { + $: hiddenInlineScript = app.val?.hiddenInlineScripts?.findIndex((k_, index) => { const [prefix, id] = $selectedComponentInEditor?.split('_') || [] if (prefix !== 'bg') return false @@ -53,7 +53,7 @@ return Number(id) === index }) - $: unusedInlineScript = $app?.unusedInlineScripts?.findIndex( + $: unusedInlineScript = app.val?.unusedInlineScripts?.findIndex( (k_, index) => `unused-${index}` === $selectedComponentInEditor ) @@ -86,24 +86,24 @@ bind:gridItem /> {/key} - {:else if unusedInlineScript > -1 && $app.unusedInlineScripts?.[unusedInlineScript]} + {:else if unusedInlineScript > -1 && app.val.unusedInlineScripts?.[unusedInlineScript]} {#key unusedInlineScript} sendUserToast('Cannot save to workspace unused scripts', true)} id={`unused-${unusedInlineScript}`} - bind:name={$app.unusedInlineScripts[unusedInlineScript].name} - bind:inlineScript={$app.unusedInlineScripts[unusedInlineScript].inlineScript} + bind:name={app.val.unusedInlineScripts[unusedInlineScript].name} + bind:inlineScript={app.val.unusedInlineScripts[unusedInlineScript].inlineScript} on:delete={() => { // remove the script from the array at the index - $app.unusedInlineScripts.splice(unusedInlineScript, 1) - $app.unusedInlineScripts = [...$app.unusedInlineScripts] + app.val.unusedInlineScripts.splice(unusedInlineScript, 1) + app.val.unusedInlineScripts = [...app.val.unusedInlineScripts] }} /> {/key} {:else if hiddenInlineScript > -1} {#key hiddenInlineScript} - {#if $app.hiddenInlineScripts?.[hiddenInlineScript]} + {#if app.val.hiddenInlineScripts?.[hiddenInlineScript]} { createScriptFromInlineScript( @@ -112,12 +112,12 @@ $workspaceStore ?? '', $appPath ) - $app = $app + app.val = app.val }} transformer={$selectedComponentInEditor?.endsWith('_transformer')} on:delete={() => deleteBackgroundScript(hiddenInlineScript)} id={BG_PREFIX + hiddenInlineScript} - bind:runnable={$app.hiddenInlineScripts[hiddenInlineScript]} + bind:runnable={app.val.hiddenInlineScripts[hiddenInlineScript]} />{/if}{/key} {:else}
diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte index 195558b9db..ce5ef42289 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte @@ -26,7 +26,7 @@ } } - $: runnables = getAppScripts($app.grid, $app.subgrids) + $: runnables = getAppScripts(app.val.grid, app.val.subgrids) // When selected component changes, update selectedScriptComponentId $: selectedComponent && handleSelectedComponent($selectedComponent) @@ -45,10 +45,10 @@ appTutorials?.runTutorialById('backgroundrunnables', { skipStepsCount: 2 }) } - for (const [index, script] of $app.hiddenInlineScripts.entries()) { + for (const [index, script] of app.val.hiddenInlineScripts.entries()) { if (script.hidden) { delete script.hidden - $app.hiddenInlineScripts = $app.hiddenInlineScripts + app.val.hiddenInlineScripts = app.val.hiddenInlineScripts selectScript(BG_PREFIX + index) return } @@ -56,18 +56,18 @@ let index = 0 let newScriptPath = `Background Runnable ${index}` - const names = getAllScriptNames($app) + const names = getAllScriptNames(app.val) // Find a name that is not used by any other inline script while (names.includes(newScriptPath)) { newScriptPath = `Background Runnable ${++index}` } - if (!$app.hiddenInlineScripts) { - $app.hiddenInlineScripts = [] + if (!app.val.hiddenInlineScripts) { + app.val.hiddenInlineScripts = [] } - $app.hiddenInlineScripts.push({ + app.val.hiddenInlineScripts.push({ name: newScriptPath, inlineScript: undefined, autoRefresh: true, @@ -75,8 +75,8 @@ fields: {}, recomputeIds: undefined }) - $app.hiddenInlineScripts = $app.hiddenInlineScripts - selectScript(`${BG_PREFIX}${$app.hiddenInlineScripts.length - 1}`) + app.val.hiddenInlineScripts = app.val.hiddenInlineScripts + selectScript(`${BG_PREFIX}${app.val.hiddenInlineScripts.length - 1}`) } let appTutorials: AppTutorials | undefined = undefined @@ -161,9 +161,9 @@ {/if} {/each} - {#if $app.unusedInlineScripts?.length > 0} + {#if app.val.unusedInlineScripts?.length > 0}
- {#each $app.unusedInlineScripts as unusedInlineScript, index (index)} + {#each app.val.unusedInlineScripts as unusedInlineScript, index (index)} {@const id = `unused-${index}`}
@@ -210,8 +210,8 @@
- {#if $app.hiddenInlineScripts?.length > 0} - {#each $app.hiddenInlineScripts as { name, hidden, transformer }, index (index)} + {#if app.val.hiddenInlineScripts?.length > 0} + {#each app.val.hiddenInlineScripts as { name, hidden, transformer }, index (index)} {#if !hidden} {@const id = BG_PREFIX + index}
{/if} - {#if component?.type && $app.css} + {#if component?.type && app.val.css} {#each Object.keys(component.customCss ?? {}) as cssKey} {#if component.customCss?.[cssKey].style != undefined && component.customCss[cssKey].style !== ''}
@@ -215,15 +215,15 @@ {/each} {/if} - {#if hasStyles(component?.type ? $app.css?.[component?.type] : undefined)} + {#if hasStyles(component?.type ? app.val.css?.[component?.type] : undefined)}
Global: {component?.type ? ccomponents[component.type]?.name : ''}
{/if} - {#if component?.type && $app.css} - {#each Object.keys($app.css[component?.type] ?? {}) as cssKey} - {#if type && $app.css?.[type]?.[cssKey].style != undefined && $app.css[type]?.[cssKey].style !== ''} + {#if component?.type && app.val.css} + {#each Object.keys(app.val.css[component?.type] ?? {}) as cssKey} + {#if type && app.val.css?.[type]?.[cssKey].style != undefined && app.val.css[type]?.[cssKey].style !== ''}
@@ -236,9 +236,9 @@ color="dark" size="xs" on:click={() => { - if (type && $app.css?.[type]) { - setOrUpdateMigration(cssKey, $app.css[type][cssKey].style) - $app.css[type][cssKey].style = '' + if (type && app.val.css?.[type]) { + setOrUpdateMigration(cssKey, app.val.css[type][cssKey].style) + app.val.css[type][cssKey].style = '' } }} endIcon={{ icon: MoveRight }} @@ -247,14 +247,14 @@
- +
Preview
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte index 0146164060..19d22a67e0 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte @@ -46,7 +46,7 @@ ] } evalV2editor?.setCode(expr) - $app = $app + app.val = app.val } let clientWidth: number = $state(0) diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte index ec5a794bb5..b0647766d5 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/ComponentPanel.svelte @@ -75,7 +75,7 @@ const { history, movingcomponents } = getContext('AppEditorContext') function removeGridElement() { - push(history, $app) + push(history, app.val) const id = componentSettings?.item?.id const onDeleteComponentControl = id ? $componentControl[id]?.onDelete : undefined @@ -99,7 +99,7 @@ $selectedComponent = undefined $focusedGrid = undefined if (componentSettings?.item && !noGrid) { - let ids = deleteGridItem($app, componentSettings?.item.data, componentSettings?.parent) + let ids = deleteGridItem(app.val, componentSettings?.item.data, componentSettings?.parent) for (const key of ids) { delete $runnableComponents[key] } @@ -108,7 +108,7 @@ if (componentSettings?.item?.data?.id) { delete $runnableComponents[componentSettings?.item?.data?.id] } - $app = $app + app.val = app.val $runnableComponents = $runnableComponents onDelete?.() @@ -184,7 +184,7 @@ -{#if componentSettings?.item?.id && isTableAction(componentSettings?.item?.id, $app)} +{#if componentSettings?.item?.id && isTableAction(componentSettings?.item?.id, app.val)}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/ContextVariables.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/ContextVariables.svelte index 895f41fc0a..cd31814707 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/ContextVariables.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/ContextVariables.svelte @@ -47,7 +47,7 @@ function addGridItemContext(parentId: string) { if (!parentId) return - const gridItem = findGridItem($app, parentId) + const gridItem = findGridItem(app.val, parentId) addParentContextVariable(gridItem) } @@ -62,7 +62,7 @@ function findParentsContextVariables(id: string): void { if (!id) return - const allParents = dfs($app.grid, id, $app.subgrids ?? {}) + const allParents = dfs(app.val.grid, id, app.val.subgrids ?? {}) if (!allParents) return diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/DeleteComponent.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/DeleteComponent.svelte index db0245cefb..ea35555785 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/DeleteComponent.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/DeleteComponent.svelte @@ -21,8 +21,8 @@ export function removeGridElement() { const id = $selectedComponent?.[0] - const componentSetting = findComponentSettings($app, id) - push(history, $app) + const componentSetting = findComponentSettings(app.val, id) + push(history, app.val) const onDeleteComponentControl = id ? $componentControl[id]?.onDelete : undefined if (onDeleteComponentControl) { @@ -44,7 +44,7 @@ $selectedComponent = undefined $focusedGrid = undefined if (componentSetting?.item && !noGrid) { - let ids = deleteGridItem($app, componentSetting?.item.data, componentSetting?.parent) + let ids = deleteGridItem(app.val, componentSetting?.item.data, componentSetting?.parent) for (const key of ids) { delete $runnableComponents[key] } @@ -53,7 +53,7 @@ if (componentSetting?.item?.data?.id) { delete $runnableComponents[componentSetting?.item?.data?.id] } - $app = $app + app.val = app.val $runnableComponents = $runnableComponents onDelete?.() diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/GridCondition.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/GridCondition.svelte index 9c1ef855d6..520cff26c0 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/GridCondition.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/GridCondition.svelte @@ -49,7 +49,7 @@ const newSubgrids = {} for (let i = 0; i < items.length; i++) { newSubgrids[`${component.id}-${i}`] = - $app!.subgrids![`${component.id}-${items[i].originalIndex}`] ?? [] + app.val!.subgrids![`${component.id}-${items[i].originalIndex}`] ?? [] } // update originalIndex @@ -57,11 +57,11 @@ item.originalIndex = i }) - $app!.subgrids = { - ...$app!.subgrids, + app.val!.subgrids = { + ...app.val!.subgrids, ...newSubgrids } - $app = $app + app.val = app.val tick().then(() => { const targetIndex = items.findIndex((i) => i.id === e.detail.info.id) @@ -72,8 +72,8 @@ function deleteSubgrid(index: number) { let subgrid = `${component.id}-${index}` - for (const item of $app!.subgrids![subgrid]) { - const components = deleteGridItem($app, item.data, subgrid) + for (const item of app.val!.subgrids![subgrid]) { + const components = deleteGridItem(app.val, item.data, subgrid) for (const key in components) { delete $runnableComponents[key] } @@ -81,7 +81,7 @@ $runnableComponents = $runnableComponents for (let i = index; i < items.length; i++) { - $app!.subgrids![`${component.id}-${i}`] = $app!.subgrids![`${component.id}-${i + 1}`] + app.val!.subgrids![`${component.id}-${i}`] = app.val!.subgrids![`${component.id}-${i + 1}`] } // Remove the corresponding item from the items array @@ -94,21 +94,21 @@ }) items = nitems - delete $app!.subgrids![`${component.id}-${items.length + 1}`] - $app = $app + delete app.val!.subgrids![`${component.id}-${items.length + 1}`] + app.val = app.val } function addCondition(): void { const numberOfConditions = conditions.length - if (!$app.subgrids) { - $app.subgrids = {} + if (!app.val.subgrids) { + app.val.subgrids = {} } - $app.subgrids[`${component.id}-${numberOfConditions}`] = - $app.subgrids[`${component.id}-${numberOfConditions - 1}`] + app.val.subgrids[`${component.id}-${numberOfConditions}`] = + app.val.subgrids[`${component.id}-${numberOfConditions - 1}`] - $app.subgrids[`${component.id}-${numberOfConditions - 1}`] = [] + app.val.subgrids[`${component.id}-${numberOfConditions - 1}`] = [] const newCondition: AppInputSpec<'boolean', boolean> = { type: 'evalv2', diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/GridPane.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/GridPane.svelte index 6ba0dafe38..25f7f44359 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/GridPane.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/GridPane.svelte @@ -14,10 +14,10 @@ function addTab() { const numberOfPanes = panes.length - if (!$app.subgrids) { - $app.subgrids = {} + if (!app.val.subgrids) { + app.val.subgrids = {} } - $app.subgrids[`${component.id}-${numberOfPanes}`] = [] + app.val.subgrids[`${component.id}-${numberOfPanes}`] = [] component.numberOfSubgrids = panes.length + 1 panes = Array(panes.length + 1) @@ -27,22 +27,22 @@ function deleteSubgrid(index: number) { let subgrid = `${component.id}-${index}` - for (const item of $app!.subgrids![subgrid]) { - const components = deleteGridItem($app, item.data, subgrid) + for (const item of app.val!.subgrids![subgrid]) { + const components = deleteGridItem(app.val, item.data, subgrid) for (const key in components) { delete $runnableComponents[key] } } $runnableComponents = $runnableComponents for (let i = index; i < panes.length - 1; i++) { - $app!.subgrids![`${component.id}-${i}`] = $app!.subgrids![`${component.id}-${i + 1}`] + app.val!.subgrids![`${component.id}-${i}`] = app.val!.subgrids![`${component.id}-${i + 1}`] } panes.splice(index, 1) - delete $app!.subgrids![`${component.id}-${panes.length}`] + delete app.val!.subgrids![`${component.id}-${panes.length}`] panes = panes component.numberOfSubgrids = panes.length - $app = $app + app.val = app.val } diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/GridTab.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/GridTab.svelte index 992cc13f99..bc867ca065 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/GridTab.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/GridTab.svelte @@ -61,11 +61,11 @@ function addTab() { const numberOfTabs = items.length - if (!$app.subgrids) { - $app.subgrids = {} + if (!app.val.subgrids) { + app.val.subgrids = {} } - $app.subgrids[`${component.id}-${numberOfTabs}`] = [] + app.val.subgrids[`${component.id}-${numberOfTabs}`] = [] items = [ ...items, { @@ -81,8 +81,8 @@ function deleteSubgrid(index: number) { let subgrid = `${component.id}-${index}` - for (const item of $app!.subgrids![subgrid]) { - const components = deleteGridItem($app, item.data, subgrid) + for (const item of app.val!.subgrids![subgrid]) { + const components = deleteGridItem(app.val, item.data, subgrid) for (const key in components) { delete $runnableComponents[key] } @@ -90,7 +90,7 @@ $runnableComponents = $runnableComponents for (let i = index; i < items.length - 1; i++) { - $app!.subgrids![`${component.id}-${i}`] = $app!.subgrids![`${component.id}-${i + 1}`] + app.val!.subgrids![`${component.id}-${i}`] = app.val!.subgrids![`${component.id}-${i + 1}`] } // Remove the corresponding item from the items array @@ -106,8 +106,8 @@ }) items = items - delete $app!.subgrids![`${component.id}-${items.length}`] - $app = $app + delete app.val!.subgrids![`${component.id}-${items.length}`] + app.val = app.val } function handleConsider(e: CustomEvent): void { @@ -132,7 +132,7 @@ const newSubgrids = {} for (let i = 0; i < items.length; i++) { newSubgrids[`${component.id}-${i}`] = - $app!.subgrids![`${component.id}-${items[i].originalIndex}`] ?? [] + app.val!.subgrids![`${component.id}-${items[i].originalIndex}`] ?? [] } const newDisabledTabs: RichConfiguration[] = [] @@ -146,11 +146,11 @@ item.originalIndex = i }) - $app!.subgrids = { - ...$app!.subgrids, + app.val!.subgrids = { + ...app.val!.subgrids, ...newSubgrids } - $app = $app + app.val = app.val tick().then(() => { const targetIndex = items.findIndex((i) => i.id === e.detail.info.id) diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte index e87761c27f..87add39e4b 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte @@ -130,7 +130,7 @@ ] } evalV2editor?.setCode(expr) - $app = $app + app.val = app.val } function closeConnection() { diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/MenuItems.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/MenuItems.svelte index 584cc5d2aa..7b7d4dfbaf 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/MenuItems.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/MenuItems.svelte @@ -24,7 +24,7 @@ recomputeIds: [] } components = [...components, newComponent] - $app = $app + app.val = app.val } function deleteComponent(cid: string) { @@ -33,7 +33,7 @@ delete $errorByComponent[cid] $selectedComponent = [id] - $app = $app + app.val = app.val } diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/SelectedRunnable.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/SelectedRunnable.svelte index 94c0af27cf..406e6d9f52 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/SelectedRunnable.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/SelectedRunnable.svelte @@ -18,11 +18,11 @@ function detach() { if (appInput.runnable?.type === 'runnableByName' && appInput.runnable.inlineScript) { - $app.unusedInlineScripts.push({ + app.val.unusedInlineScripts.push({ name: appInput.runnable.name, inlineScript: appInput.runnable.inlineScript }) - $app = $app + app.val = app.val appInput = clearResultAppInput(appInput) } } @@ -56,7 +56,7 @@ color: 'light', callback: detach } - ] as const) + ] as const) : []), { label: 'Clear', diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte index 1e89ab908a..14fa9339db 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte @@ -22,7 +22,7 @@ let component: AppComponent | undefined $: { - const newComponent = findComponentSettings($app, $selectedComponent?.[0])?.item?.data + const newComponent = findComponentSettings(app.val, $selectedComponent?.[0])?.item?.data if (component != newComponent) { component = newComponent } @@ -35,8 +35,8 @@ let migrationModal: CssMigrationModal | undefined = undefined $: customCssByComponentType = - component?.type && $app.css - ? Object.entries($app.css[component.type] || {}).map(([id, v]) => ({ + component?.type && app.val.css + ? Object.entries(app.val.css[component.type] || {}).map(([id, v]) => ({ id, forceStyle: v?.style != undefined, forceClass: v?.['class'] != undefined @@ -51,18 +51,18 @@ if (!type) return - if (hasStyleValue($app.css?.[type]?.[name])) { + if (hasStyleValue(app.val.css?.[type]?.[name])) { overrideGlobalCSS = () => { - $app.css![type]![name] = JSON.parse(JSON.stringify(value)) - app.set($app) + app.val.css![type]![name] = JSON.parse(JSON.stringify(value)) + app.val = app.val } } else { - if (!$app.css![type]) { + if (!app.val.css![type]) { initGlobalCss() } - $app.css![type]![name] = JSON.parse(JSON.stringify(value)) - app.set($app) + app.val.css![type]![name] = JSON.parse(JSON.stringify(value)) + app.val = app.val sendUserToast('Global CSS copied') } } @@ -75,11 +75,11 @@ if (hasStyleValue(value)) { overrideLocalCSS = () => { component!.customCss![id] = JSON.parse(JSON.stringify(value)) - app.set($app) + app.val = app.val } } else { component!.customCss![id] = JSON.parse(JSON.stringify(value)) - app.set($app) + app.val = app.val sendUserToast('Local CSS copied') } } @@ -88,21 +88,21 @@ function initGlobalCss() { // If the global css is not initialised, we initialise it. // Should only happen once per app - if (!$app.css) { - $app.css = {} + if (!app.val.css) { + app.val.css = {} } // If the global css for this component type is not initialised, we initialise it. // Should only happen once per component type if ( - $app.css && + app.val.css && component && - !$app.css[component.type]?.style && + !app.val.css[component.type]?.style && components[component.type] && - $app.css[component.type] === undefined + app.val.css[component.type] === undefined ) { - $app.css[component.type] = JSON.parse(JSON.stringify(components[component.type].customCss)) - app.set($app) + app.val.css[component.type] = JSON.parse(JSON.stringify(components[component.type].customCss)) + app.val = app.val } } @@ -196,13 +196,13 @@ wmClass={getSelector(name)} componentType={component.type} bind:value={component.customCss[name]} - on:change={() => app.set($app)} + on:change={() => (app.val = app.val)} shouldDisplayRight={hasStyleValue(component.customCss[name])} on:right={() => { copyLocalToGlobal(name, component?.customCss?.[name]) tab = 'global' }} - overridding={hasStyleValue($app.css?.[component.type]?.[name]) && + overridding={hasStyleValue(app.val.css?.[component.type]?.[name]) && hasStyleValue(component.customCss[name])} />
@@ -214,16 +214,16 @@ {#if type} {#each customCssByComponentType ?? [] as { id, forceStyle, forceClass }}
- {#if $app.css && type && $app.css[type] && component?.customCss} + {#if app.val.css && type && app.val.css[type] && component?.customCss} { copyGlobalToLocal( id, - component?.type ? $app?.css?.[component?.type]?.[id] : undefined + component?.type ? app.val?.css?.[component?.type]?.[id] : undefined ) tab = 'local' }} diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte index 07ccf996e5..22cc841fb7 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte @@ -69,7 +69,7 @@ ] components = [...components, newComponent] - $app = $app + app.val = app.val } function deleteComponent(cid: string, index: number) { @@ -80,7 +80,7 @@ delete $errorByComponent[cid] $selectedComponent = [id] - $app = $app + app.val = app.val // Remove the corresponding item from the items array items = items.filter((item) => item.originalIndex !== index) } diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/decisionTree/DecisionTreePreview.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/decisionTree/DecisionTreePreview.svelte index a9fc5bfbdf..0614c56464 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/decisionTree/DecisionTreePreview.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/decisionTree/DecisionTreePreview.svelte @@ -57,10 +57,10 @@ function addSubGrid() { const numberOfPanes = nodes.length - if (!$app.subgrids) { - $app.subgrids = {} + if (!app.val.subgrids) { + app.val.subgrids = {} } - $app.subgrids[`${component.id}-${numberOfPanes}`] = [] + app.val.subgrids[`${component.id}-${numberOfPanes}`] = [] component.numberOfSubgrids = nodes.length + 1 } @@ -68,26 +68,26 @@ function deleteSubgrid(index: number) { let subgrid = `${component.id}-${index}` - if (!$app.subgrids![subgrid]) { + if (!app.val.subgrids![subgrid]) { return } - for (const item of $app!.subgrids![subgrid]) { - const components = deleteGridItem($app, item.data, subgrid) + for (const item of app.val!.subgrids![subgrid]) { + const components = deleteGridItem(app.val, item.data, subgrid) for (const key in components) { delete $runnableComponents[key] } } $runnableComponents = $runnableComponents for (let i = index; i < nodes.length - 1; i++) { - $app!.subgrids![`${component.id}-${i}`] = $app!.subgrids![`${component.id}-${i + 1}`] + app.val!.subgrids![`${component.id}-${i}`] = app.val!.subgrids![`${component.id}-${i + 1}`] } nodes.splice(index, 1) - delete $app!.subgrids![`${component.id}-${nodes.length}`] + delete app.val!.subgrids![`${component.id}-${nodes.length}`] nodes = nodes component.numberOfSubgrids = nodes.length - $app = $app + app.val = app.val } function nodeCallbackHandler( diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte index 720adcb956..edba975993 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte @@ -11,7 +11,7 @@ function applyConnection(connection: InputConnection) { componentInput.connection = connection - $app = $app + app.val = app.val } @@ -33,7 +33,7 @@ if (componentInput.type === 'connected') { componentInput.connection = undefined } - $app = $app + app.val = app.val }} > Disconnect diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte index 8028ea9657..1848e421bc 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte @@ -34,7 +34,7 @@ {:else if appInput !== undefined} ('AppViewerContext') - const tabComponents = allItems($app.grid, $app.subgrids).filter( + const tabComponents = allItems(app.val.grid, app.val.subgrids).filter( (component) => component.data.type === 'tabscomponent' || component.data.type === 'conditionalwrapper' || diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte index fca98ca402..60104b5a90 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/script/shared/ScriptTriggers.svelte @@ -21,7 +21,7 @@ let onSuccessEvents: string[] = [] - $: computeOnSuccessEvents($app, id) + $: computeOnSuccessEvents(app.val, id) function computeOnSuccessEvents(app: App, _id: string) { const nr: string[] = [] @@ -85,7 +85,7 @@ inlineScript.refreshOn = [...inlineScript.refreshOn, refresh] } inlineScript = inlineScript - $app = $app + app.val = app.val } diff --git a/frontend/src/lib/components/apps/svelte-grid/Grid.svelte b/frontend/src/lib/components/apps/svelte-grid/Grid.svelte index f5898061d5..2d751f82da 100644 --- a/frontend/src/lib/components/apps/svelte-grid/Grid.svelte +++ b/frontend/src/lib/components/apps/svelte-grid/Grid.svelte @@ -78,7 +78,7 @@ const cols = columnConfiguration let getComputedCols: 3 | 12 | undefined = $state( - $app.mobileViewOnSmallerScreens == false ? WIDE_GRID_COLUMNS : undefined + app.val.mobileViewOnSmallerScreens == false ? WIDE_GRID_COLUMNS : undefined ) let container = $state() @@ -109,7 +109,7 @@ return } - if ($app.mobileViewOnSmallerScreens != false || !getComputedCols) { + if (app.val.mobileViewOnSmallerScreens != false || !getComputedCols) { getComputedCols = getColumn(parentWidth ?? width, cols) } xPerPx = width / getComputedCols! @@ -340,15 +340,15 @@ const div = document.getElementById(`component-${$overlappedStore}`) const type = div?.getAttribute('data-componenttype') - if (!$app.subgrids) { + if (!app.val.subgrids) { return } const index = type ? subGridIndexKey(type, $overlappedStore, $worldStore) : 0 - nitems = $app.subgrids[`${$overlappedStore}-${index}`] ?? [] + nitems = app.val.subgrids[`${$overlappedStore}-${index}`] ?? [] } else { - nitems = $app.grid ?? [] + nitems = app.val.grid ?? [] } if (!draggedItem) { @@ -379,7 +379,7 @@ export function handleInitMove(id: string) { $componentDraggedIdStore = id - $componentDraggedParentIdStore = findGridItemParentGrid($app, id)?.split('-')[0] ?? undefined + $componentDraggedParentIdStore = findGridItemParentGrid(app.val, id)?.split('-')[0] ?? undefined Object.entries(moveResizes).forEach(([id, moveResize]) => { if (selectedIds?.includes(id)) { diff --git a/frontend/src/lib/components/apps/svelte-grid/MoveResize.svelte b/frontend/src/lib/components/apps/svelte-grid/MoveResize.svelte index 902d87dbec..905299e9d2 100644 --- a/frontend/src/lib/components/apps/svelte-grid/MoveResize.svelte +++ b/frontend/src/lib/components/apps/svelte-grid/MoveResize.svelte @@ -416,7 +416,7 @@ return } - const parent = findGridItemParentGrid($app, id) + const parent = findGridItemParentGrid(app.val, id) if (overlapped && (overlapped === parent || parent?.startsWith(overlapped))) { return @@ -501,7 +501,7 @@ return true } - const parent = findGridItemParentGrid($app, id) + const parent = findGridItemParentGrid(app.val, id) if (parent === undefined) { return overlapped === undefined diff --git a/frontend/src/lib/components/apps/types.ts b/frontend/src/lib/components/apps/types.ts index b000fc2326..e02c36625d 100644 --- a/frontend/src/lib/components/apps/types.ts +++ b/frontend/src/lib/components/apps/types.ts @@ -23,10 +23,11 @@ import type { TemplateV2AppInput, UploadAppInput, UploadS3AppInput, - UserAppInput, + UserAppInput } from './inputType' import type { World } from './rx' import type { FilledItem } from './svelte-grid/types' +import type { StateStore } from '$lib/utils' export type HorizontalAlignment = 'left' | 'center' | 'right' export type VerticalAlignment = 'top' | 'center' | 'bottom' @@ -141,13 +142,13 @@ export type HiddenRunnable = { export type AppTheme = | { - type: 'path' - path: string - } + type: 'path' + path: string + } | { - type: 'inlined' - css: string - } + type: 'inlined' + css: string + } export type App = { grid: GridItem[] @@ -209,7 +210,7 @@ export type JobById = { export type AppViewerContext = { worldStore: Writable - app: Writable + app: StateStore summary: Writable initialized: Writable<{ initializedComponents: string[] diff --git a/frontend/src/lib/components/raw_apps/RawAppInlineScriptEditor.svelte b/frontend/src/lib/components/raw_apps/RawAppInlineScriptEditor.svelte index 448406c008..c236b761cd 100644 --- a/frontend/src/lib/components/raw_apps/RawAppInlineScriptEditor.svelte +++ b/frontend/src/lib/components/raw_apps/RawAppInlineScriptEditor.svelte @@ -100,7 +100,7 @@ placeholder="Inline script name" class="!text-xs !rounded-sm !shadow-none" on:keyup={() => { - // $app = $app + // app.val = app.val // if (stateId) { // $stateId++ // } @@ -197,7 +197,7 @@ syncFields() } } - // $app = $app + // app.val = app.val }} args={Object.entries(fields ?? {}).reduce((acc, [key, obj]) => { acc[key] = obj.type === 'static' ? obj.value : undefined diff --git a/frontend/src/lib/components/tutorials/app/AppTutorial.svelte b/frontend/src/lib/components/tutorials/app/AppTutorial.svelte index c3c2d8ae40..f4c2e35d90 100644 --- a/frontend/src/lib/components/tutorials/app/AppTutorial.svelte +++ b/frontend/src/lib/components/tutorials/app/AppTutorial.svelte @@ -28,16 +28,16 @@ } function addComponent(appComponentType: TypedComponent['type']): void { - push(history, $app) + push(history, app.val) const id = insertNewGridItem( - $app, + app.val, appComponentFromType(appComponentType) as (id: string) => AppComponent, $focusedGrid ) $selectedComponent = [id] - $app = $app + app.val = app.val } @@ -47,7 +47,7 @@ {name} on:error on:skipAll - tainted={isAppTainted($app)} + tainted={isAppTainted(app.val)} getSteps={(driver) => { const steps = [ { @@ -186,7 +186,7 @@ setTimeout(() => { if ($selectedComponent?.[0]) { updateInlineRunnableCode( - $app, + app.val, $selectedComponent[0], `export async function main(x: string) { return x?.toLocaleUpperCase(); @@ -265,9 +265,9 @@ description: 'We can now type in the text input and see the result in the display component', onNextClick: () => { - connectInlineRunnableInputToComponentOutput($app, 'e', 'x', 'd', 'result', 'integer') + connectInlineRunnableInputToComponentOutput(app.val, 'e', 'x', 'd', 'result', 'integer') - $app = $app + app.val = app.val updateProgress(7) diff --git a/frontend/src/lib/components/tutorials/app/ConnectionTutorial.svelte b/frontend/src/lib/components/tutorials/app/ConnectionTutorial.svelte index 019e2b5335..8fb09d749b 100644 --- a/frontend/src/lib/components/tutorials/app/ConnectionTutorial.svelte +++ b/frontend/src/lib/components/tutorials/app/ConnectionTutorial.svelte @@ -21,16 +21,16 @@ } function addComponent(): void { - push(history, $app) + push(history, app.val) const id = insertNewGridItem( - $app, + app.val, appComponentFromType('textcomponent') as (id: string) => AppComponent, $focusedGrid ) $selectedComponent = [id] - $app = $app + app.val = app.val } diff --git a/frontend/src/lib/components/wizards/AgChartWizard.svelte b/frontend/src/lib/components/wizards/AgChartWizard.svelte index d0fcdb9d0c..dfec7b1758 100644 --- a/frontend/src/lib/components/wizards/AgChartWizard.svelte +++ b/frontend/src/lib/components/wizards/AgChartWizard.svelte @@ -18,8 +18,8 @@ let component: GridItem | undefined = undefined - $: if (component === undefined && $selectedComponent && $app) { - component = findGridItem($app, $selectedComponent[0]) + $: if (component === undefined && $selectedComponent && app.val) { + component = findGridItem(app.val, $selectedComponent[0]) } $: isEE = component?.data.type === 'agchartscomponentee'