windmill-components 1.75.0 → 1.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/components/ArgInput.svelte +4 -14
  2. package/components/DisplayResult.svelte +1 -1
  3. package/components/Dropdown.svelte +14 -4
  4. package/components/FlowGraphViewer.svelte +1 -1
  5. package/components/FolderUsageInfo.svelte +16 -6
  6. package/components/FolderUsageInfo.svelte.d.ts +2 -0
  7. package/components/LightweightArgInput.svelte +315 -0
  8. package/components/LightweightArgInput.svelte.d.ts +47 -0
  9. package/components/LightweightSchemaForm.svelte +31 -0
  10. package/components/LightweightSchemaForm.svelte.d.ts +18 -0
  11. package/components/ModulePreview.svelte +1 -0
  12. package/components/Multiselect.svelte.d.ts +2 -2
  13. package/components/PageHeader.svelte +1 -1
  14. package/components/Path.svelte +26 -3
  15. package/components/Range.svelte.d.ts +2 -2
  16. package/components/ScriptBuilder.svelte +122 -122
  17. package/components/SettingSection.svelte +44 -0
  18. package/components/SettingSection.svelte.d.ts +21 -0
  19. package/components/SimpleEditor.svelte +1 -1
  20. package/components/SimpleEditor.svelte.d.ts +2 -0
  21. package/components/TemplateEditor.svelte +3 -0
  22. package/components/TemplateEditor.svelte.d.ts +0 -204
  23. package/components/Tooltip.svelte +3 -1
  24. package/components/VariableEditor.svelte +2 -1
  25. package/components/WhitelistIp.svelte +1 -3
  26. package/components/apps/components/buttons/AppButton.svelte +16 -8
  27. package/components/apps/components/buttons/AppButton.svelte.d.ts +1 -2
  28. package/components/apps/components/buttons/AppForm.svelte +3 -7
  29. package/components/apps/components/buttons/AppFormButton.svelte +3 -7
  30. package/components/apps/components/display/AppBarChart.svelte +7 -3
  31. package/components/apps/components/display/AppBarChart.svelte.d.ts +0 -2
  32. package/components/apps/components/display/AppDisplayComponent.svelte +7 -3
  33. package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +0 -2
  34. package/components/apps/components/display/AppHtml.svelte +7 -11
  35. package/components/apps/components/display/AppHtml.svelte.d.ts +0 -2
  36. package/components/apps/components/display/AppIcon.svelte +0 -1
  37. package/components/apps/components/display/AppIcon.svelte.d.ts +0 -2
  38. package/components/apps/components/display/AppImage.svelte +0 -1
  39. package/components/apps/components/display/AppImage.svelte.d.ts +0 -2
  40. package/components/apps/components/display/AppMap.svelte +10 -3
  41. package/components/apps/components/display/AppMap.svelte.d.ts +0 -2
  42. package/components/apps/components/display/AppPdf.svelte +8 -3
  43. package/components/apps/components/display/AppPdf.svelte.d.ts +0 -2
  44. package/components/apps/components/display/AppPieChart.svelte +7 -3
  45. package/components/apps/components/display/AppPieChart.svelte.d.ts +0 -2
  46. package/components/apps/components/display/AppScatterChart.svelte +7 -3
  47. package/components/apps/components/display/AppScatterChart.svelte.d.ts +0 -2
  48. package/components/apps/components/display/AppText.svelte +41 -17
  49. package/components/apps/components/display/AppText.svelte.d.ts +0 -2
  50. package/components/apps/components/display/AppTimeseries.svelte +7 -3
  51. package/components/apps/components/display/AppTimeseries.svelte.d.ts +0 -2
  52. package/components/apps/components/display/PlotlyHtml.svelte +9 -4
  53. package/components/apps/components/display/PlotlyHtml.svelte.d.ts +0 -2
  54. package/components/apps/components/display/VegaLiteHtml.svelte +8 -3
  55. package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +0 -2
  56. package/components/apps/components/display/table/AppAggridTable.svelte +13 -5
  57. package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +0 -2
  58. package/components/apps/components/display/table/AppTable.svelte +19 -13
  59. package/components/apps/components/display/table/AppTable.svelte.d.ts +0 -2
  60. package/components/apps/components/helpers/HiddenComponent.svelte +11 -2
  61. package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +1 -2
  62. package/components/apps/components/helpers/InputValue.svelte +26 -43
  63. package/components/apps/components/helpers/InputValue.svelte.d.ts +4 -3
  64. package/components/apps/components/helpers/NonRunnableComponent.svelte +2 -2
  65. package/components/apps/components/helpers/RefreshButton.svelte +2 -3
  66. package/components/apps/components/helpers/ResizeWrapper.svelte +3 -4
  67. package/components/apps/components/helpers/RunnableComponent.svelte +63 -51
  68. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +2 -1
  69. package/components/apps/components/helpers/RunnableWrapper.svelte +2 -2
  70. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -1
  71. package/components/apps/components/helpers/eval.d.ts +5 -0
  72. package/components/apps/components/helpers/eval.js +57 -0
  73. package/components/apps/components/inputs/AppCheckbox.svelte +4 -2
  74. package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +0 -2
  75. package/components/apps/components/inputs/AppDateInput.svelte +4 -2
  76. package/components/apps/components/inputs/AppDateInput.svelte.d.ts +0 -2
  77. package/components/apps/components/inputs/AppFileInput.svelte +4 -2
  78. package/components/apps/components/inputs/AppFileInput.svelte.d.ts +0 -2
  79. package/components/apps/components/inputs/AppMultiSelect.svelte +4 -2
  80. package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
  81. package/components/apps/components/inputs/AppNumberInput.svelte +4 -2
  82. package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +0 -2
  83. package/components/apps/components/inputs/AppRangeInput.svelte +5 -2
  84. package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +0 -2
  85. package/components/apps/components/inputs/AppSelect.svelte +4 -2
  86. package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
  87. package/components/apps/components/inputs/AppSliderInputs.svelte +4 -2
  88. package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +0 -2
  89. package/components/apps/components/inputs/AppTextInput.svelte +5 -3
  90. package/components/apps/components/inputs/AppTextInput.svelte.d.ts +0 -2
  91. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +5 -2
  92. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +0 -2
  93. package/components/apps/components/layout/AppContainer.svelte +1 -7
  94. package/components/apps/components/layout/AppContainer.svelte.d.ts +0 -2
  95. package/components/apps/components/layout/AppDrawer.svelte +0 -3
  96. package/components/apps/components/layout/AppSplitpanes.svelte +1 -6
  97. package/components/apps/components/layout/AppTabs.svelte +62 -34
  98. package/components/apps/components/layout/AppTabs.svelte.d.ts +1 -2
  99. package/components/apps/editor/AppComponentInput.svelte +2 -1
  100. package/components/apps/editor/AppEditor.svelte +145 -143
  101. package/components/apps/editor/AppEditorHeader.svelte +43 -35
  102. package/components/apps/editor/AppPreview.svelte +68 -15
  103. package/components/apps/editor/ComponentHeader.svelte +3 -1
  104. package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
  105. package/components/apps/editor/GridEditor.svelte +58 -77
  106. package/components/apps/editor/GridPanel.svelte +3 -1
  107. package/components/apps/editor/GridViewer.svelte +91 -0
  108. package/components/apps/editor/GridViewer.svelte.d.ts +32 -0
  109. package/components/apps/editor/RecomputeAllComponents.svelte +7 -1
  110. package/components/apps/editor/SettingsPanel.svelte +23 -10
  111. package/components/apps/editor/SubGridEditor.svelte +95 -68
  112. package/components/apps/editor/SubGridEditor.svelte.d.ts +3 -4
  113. package/components/apps/editor/appUtils.d.ts +13 -3
  114. package/components/apps/editor/appUtils.js +106 -37
  115. package/components/apps/editor/component/Component.svelte +6 -52
  116. package/components/apps/editor/component/ComponentNavigation.svelte +101 -51
  117. package/components/apps/editor/component/components.d.ts +3 -3
  118. package/components/apps/editor/component/components.js +59 -115
  119. package/components/apps/editor/componentsPanel/ComponentList.svelte +5 -4
  120. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +2 -1
  121. package/components/apps/editor/componentsPanel/componentStaticValues.js +1 -0
  122. package/components/apps/editor/contextPanel/ComponentOutput.svelte +67 -0
  123. package/components/apps/editor/contextPanel/ComponentOutput.svelte.d.ts +21 -0
  124. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +15 -10
  125. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte.d.ts +0 -1
  126. package/components/apps/editor/contextPanel/ContextPanel.svelte +73 -136
  127. package/components/apps/editor/contextPanel/SubGridOutput.svelte +66 -0
  128. package/components/apps/editor/contextPanel/SubGridOutput.svelte.d.ts +19 -0
  129. package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +41 -0
  130. package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte.d.ts +18 -0
  131. package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +9 -0
  132. package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte.d.ts +16 -0
  133. package/components/apps/editor/contextPanel/components/MinMaxButton.svelte +25 -0
  134. package/components/apps/editor/contextPanel/components/MinMaxButton.svelte.d.ts +16 -0
  135. package/components/apps/editor/contextPanel/components/OutputHeader.svelte +99 -0
  136. package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +24 -0
  137. package/components/apps/editor/contextPanel/components/TableActionOutput.svelte +17 -0
  138. package/components/apps/editor/contextPanel/components/TableActionOutput.svelte.d.ts +17 -0
  139. package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte +13 -0
  140. package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte.d.ts +17 -0
  141. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +55 -23
  142. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +74 -44
  143. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +1 -1
  144. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +5 -9
  145. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +2 -2
  146. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +43 -37
  147. package/components/apps/editor/settingsPanel/GridPane.svelte +1 -3
  148. package/components/apps/editor/settingsPanel/GridTab.svelte +5 -15
  149. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -16
  150. package/components/apps/editor/settingsPanel/Recompute.svelte +1 -0
  151. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +6 -0
  152. package/components/apps/editor/settingsPanel/TableActions.svelte +4 -6
  153. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +2 -8
  154. package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +2 -2
  155. package/components/apps/editor/settingsPanel/inputEditor/IconSelectInput.svelte +58 -46
  156. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +1 -1
  157. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +2 -0
  158. package/components/apps/gridUtils.d.ts +1 -3
  159. package/components/apps/gridUtils.js +1 -15
  160. package/components/apps/rx.d.ts +7 -5
  161. package/components/apps/rx.js +37 -19
  162. package/components/apps/svelte-grid/Grid.svelte +167 -0
  163. package/components/apps/svelte-grid/Grid.svelte.d.ts +45 -0
  164. package/components/apps/svelte-grid/LICENSE +23 -0
  165. package/components/apps/svelte-grid/MoveResize.svelte +328 -0
  166. package/components/apps/svelte-grid/MoveResize.svelte.d.ts +46 -0
  167. package/components/apps/svelte-grid/types.d.ts +21 -0
  168. package/components/apps/svelte-grid/utils/container.d.ts +1 -0
  169. package/components/apps/svelte-grid/utils/container.js +4 -0
  170. package/components/apps/svelte-grid/utils/helper.d.ts +10 -0
  171. package/components/apps/svelte-grid/utils/helper.js +36 -0
  172. package/components/apps/svelte-grid/utils/item.d.ts +14 -0
  173. package/components/apps/svelte-grid/utils/item.js +192 -0
  174. package/components/apps/svelte-grid/utils/matrix.d.ts +6 -0
  175. package/components/apps/svelte-grid/utils/matrix.js +53 -0
  176. package/components/apps/svelte-grid/utils/other.d.ts +3 -0
  177. package/components/apps/svelte-grid/utils/other.js +30 -0
  178. package/components/apps/types.d.ts +19 -14
  179. package/components/apps/utils.d.ts +1 -1
  180. package/components/apps/utils.js +15 -9
  181. package/components/common/CloseButton.svelte +18 -0
  182. package/components/common/CloseButton.svelte.d.ts +27 -0
  183. package/components/common/badge/Badge.svelte +6 -1
  184. package/components/common/badge/Badge.svelte.d.ts +1 -0
  185. package/components/common/button/Button.svelte.d.ts +1 -1
  186. package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
  187. package/components/common/drawer/DrawerContent.svelte +2 -6
  188. package/components/common/languageIcons/JavaScript.svelte +11 -0
  189. package/components/common/languageIcons/JavaScript.svelte.d.ts +25 -0
  190. package/components/common/languageIcons/LanguageIcon.svelte +3 -1
  191. package/components/common/languageIcons/LanguageIcon.svelte.d.ts +1 -1
  192. package/components/common/menu/Menu.svelte +1 -1
  193. package/components/common/menu/Menu.svelte.d.ts +1 -1
  194. package/components/common/popup/Popup.svelte +2 -1
  195. package/components/common/popup/Popup.svelte.d.ts +9 -0
  196. package/components/common/table/AppRow.svelte +1 -4
  197. package/components/common/table/FlowRow.svelte +1 -4
  198. package/components/common/table/ScriptRow.svelte +1 -4
  199. package/components/common/tabs/Tab.svelte +1 -0
  200. package/components/common/tabs/Tab.svelte.d.ts +2 -0
  201. package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -1
  202. package/components/graph/FlowGraph.svelte +1 -1
  203. package/components/propertyPicker/ObjectViewer.svelte +1 -1
  204. package/components/propertyPicker/PropPicker.svelte +4 -1
  205. package/components/sidebar/SidebarContent.svelte +2 -2
  206. package/consts.js +1 -1
  207. package/history.js +8 -1
  208. package/package.json +24 -28
  209. package/utils.js +0 -1
  210. package/components/apps/editor/AppComponentInputs.svelte +0 -13
  211. package/components/apps/editor/AppComponentInputs.svelte.d.ts +0 -20
  212. package/components/apps/editor/settingsPanel/MoveToOtherGrid.svelte +0 -92
  213. package/components/apps/editor/settingsPanel/MoveToOtherGrid.svelte.d.ts +0 -18
  214. package/components/graph/svelvet/d3/controllers/README.md +0 -3
  215. package/components/graph/svelvet/d3/controllers/d3Old.d.ts +0 -1
  216. package/components/graph/svelvet/d3/controllers/d3Old.js +0 -43
  217. package/components/graph/svelvet/docs/CHANGELOG.md +0 -145
  218. package/components/graph/svelvet/docs/DESIGN_PATTERNS.md +0 -44
  219. package/components/graph/svelvet/docs/DOCUMENTATION.md +0 -5
  220. package/components/graph/svelvet/docs/README.md +0 -34
  221. package/components/graph/svelvet/docs/TODO.md +0 -14
  222. package/components/graph/svelvet/docs/Tutorials.md +0 -25
  223. package/components/graph/svelvet/docs/images/css-background-after.png +0 -0
  224. package/components/graph/svelvet/docs/images/css-background-before.png +0 -0
  225. package/components/graph/svelvet/docs/images/custom-edges-after.png +0 -0
  226. package/components/graph/svelvet/docs/images/custom-edges-before.png +0 -0
  227. package/components/graph/svelvet/docs/images/custom-nodes-after.png +0 -0
  228. package/components/graph/svelvet/docs/images/custom-nodes-before.png +0 -0
  229. package/components/graph/svelvet/docs/images/custom-svelte-components-after.png +0 -0
  230. package/components/graph/svelvet/docs/images/custom-svelte-components-before.png +0 -0
  231. package/components/graph/svelvet/docs/images/html-docs-after.png +0 -0
  232. package/components/graph/svelvet/docs/images/html-docs-before.png +0 -0
  233. package/components/graph/svelvet/docs/images/minimap-after.png +0 -0
  234. package/components/graph/svelvet/docs/images/minimap-before.png +0 -0
  235. package/components/graph/svelvet/docs/images/node-classes-after.png +0 -0
  236. package/components/graph/svelvet/docs/images/node-classes-before.png +0 -0
  237. package/components/graph/svelvet/docs/images/node-create-after.png +0 -0
  238. package/components/graph/svelvet/docs/images/node-create-before.png +0 -0
@@ -11,7 +11,6 @@ declare const __propDef: {
11
11
  initializing?: boolean | undefined;
12
12
  customCss?: ComponentCustomCSS<'text'> | undefined;
13
13
  render: boolean;
14
- staticOutputs?: string[] | undefined;
15
14
  };
16
15
  events: {
17
16
  [evt: string]: CustomEvent<any>;
@@ -22,6 +21,5 @@ export type AppTextProps = typeof __propDef.props;
22
21
  export type AppTextEvents = typeof __propDef.events;
23
22
  export type AppTextSlots = typeof __propDef.slots;
24
23
  export default class AppText extends SvelteComponentTyped<AppTextProps, AppTextEvents, AppTextSlots> {
25
- get staticOutputs(): string[];
26
24
  }
27
25
  export {};
@@ -6,14 +6,18 @@ import { Scatter } from 'svelte-chartjs';
6
6
  import InputValue from '../helpers/InputValue.svelte';
7
7
  import { getContext } from 'svelte';
8
8
  import { concatCustomCss } from '../../utils';
9
+ import { initOutput } from '../../editor/appUtils';
9
10
  export let id;
10
11
  export let componentInput;
11
12
  export let configuration;
12
13
  export let initializing = undefined;
13
14
  export let customCss = undefined;
14
15
  export let render;
15
- export const staticOutputs = ['loading', 'result'];
16
- const { app } = getContext('AppViewerContext');
16
+ const { app, worldStore } = getContext('AppViewerContext');
17
+ initOutput($worldStore, id, {
18
+ result: undefined,
19
+ loading: false
20
+ });
17
21
  let logarithmicScale = false;
18
22
  let zoomable = false;
19
23
  let pannable = false;
@@ -57,7 +61,7 @@ $: css = concatCustomCss($app.css?.timeseriescomponent, customCss);
57
61
  <InputValue {id} input={configuration.zoomable} bind:value={zoomable} />
58
62
  <InputValue {id} input={configuration.pannable} bind:value={pannable} />
59
63
 
60
- <RunnableWrapper {render} flexWrap autoRefresh {componentInput} {id} bind:initializing bind:result>
64
+ <RunnableWrapper {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
61
65
  <div class="w-full h-full {css?.container?.class ?? ''}" style={css?.container?.style ?? ''}>
62
66
  {#if result}
63
67
  <Scatter {data} {options} />
@@ -10,7 +10,6 @@ declare const __propDef: {
10
10
  initializing?: boolean | undefined;
11
11
  customCss?: ComponentCustomCSS<'container'> | undefined;
12
12
  render: boolean;
13
- staticOutputs?: string[] | undefined;
14
13
  };
15
14
  events: {
16
15
  [evt: string]: CustomEvent<any>;
@@ -21,6 +20,5 @@ export type AppTimeseriesProps = typeof __propDef.props;
21
20
  export type AppTimeseriesEvents = typeof __propDef.events;
22
21
  export type AppTimeseriesSlots = typeof __propDef.slots;
23
22
  export default class AppTimeseries extends SvelteComponentTyped<AppTimeseriesProps, AppTimeseriesEvents, AppTimeseriesSlots> {
24
- get staticOutputs(): string[];
25
23
  }
26
24
  export {};
@@ -1,11 +1,16 @@
1
- <script>import { onMount } from 'svelte';
1
+ <script>import { getContext, onMount } from 'svelte';
2
+ import { initOutput } from '../../editor/appUtils';
2
3
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
3
4
  export let id;
4
5
  export let componentInput;
5
6
  // export let configuration: Record<string, AppInput>
6
7
  export let initializing = undefined;
7
8
  export let render;
8
- export const staticOutputs = ['result', 'loading'];
9
+ const { worldStore } = getContext('AppViewerContext');
10
+ initOutput($worldStore, id, {
11
+ result: undefined,
12
+ loading: false
13
+ });
9
14
  let result = undefined;
10
15
  let divEl = null;
11
16
  let Plotly;
@@ -22,11 +27,11 @@ $: Plotly &&
22
27
  divEl &&
23
28
  h &&
24
29
  w &&
25
- Plotly.newPlot(divEl, [result], { width: w, height: h, margin: { l: 40, r: 40, b: 40, t: 40, pad: 4 } }, { responsive: true, displayModeBar: false });
30
+ Plotly.newPlot(divEl, [result], { width: w, height: h, margin: { l: 50, r: 40, b: 40, t: 40, pad: 4 } }, { responsive: true, displayModeBar: false });
26
31
  </script>
27
32
 
28
33
  <div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
29
- <RunnableWrapper {render} flexWrap {componentInput} {id} bind:initializing bind:result>
34
+ <RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
30
35
  <div on:pointerdown bind:this={divEl} />
31
36
  </RunnableWrapper>
32
37
  </div>
@@ -6,7 +6,6 @@ declare const __propDef: {
6
6
  componentInput: AppInput | undefined;
7
7
  initializing?: boolean | undefined;
8
8
  render: boolean;
9
- staticOutputs?: string[] | undefined;
10
9
  };
11
10
  events: {
12
11
  pointerdown: PointerEvent;
@@ -19,6 +18,5 @@ export type PlotlyHtmlProps = typeof __propDef.props;
19
18
  export type PlotlyHtmlEvents = typeof __propDef.events;
20
19
  export type PlotlyHtmlSlots = typeof __propDef.slots;
21
20
  export default class PlotlyHtml extends SvelteComponentTyped<PlotlyHtmlProps, PlotlyHtmlEvents, PlotlyHtmlSlots> {
22
- get staticOutputs(): string[];
23
21
  }
24
22
  export {};
@@ -1,4 +1,5 @@
1
- <script>import { onMount } from 'svelte';
1
+ <script>import { getContext, onMount } from 'svelte';
2
+ import { initOutput } from '../../editor/appUtils';
2
3
  import InputValue from '../helpers/InputValue.svelte';
3
4
  import RunnableWrapper from '../helpers/RunnableWrapper.svelte';
4
5
  export let id;
@@ -6,9 +7,13 @@ export let componentInput;
6
7
  export let configuration;
7
8
  export let initializing = undefined;
8
9
  export let render;
9
- export const staticOutputs = ['result', 'loading'];
10
10
  let result = undefined;
11
11
  let divEl = null;
12
+ const { worldStore } = getContext('AppViewerContext');
13
+ initOutput($worldStore, id, {
14
+ result: undefined,
15
+ loading: false
16
+ });
12
17
  let vegaEmbed;
13
18
  onMount(async () => {
14
19
  if (divEl) {
@@ -41,7 +46,7 @@ $: vegaEmbed &&
41
46
  <InputValue {id} input={configuration.canvas} bind:value={canvas} />
42
47
 
43
48
  <div class="w-full h-full" bind:clientHeight={h} bind:clientWidth={w}>
44
- <RunnableWrapper {render} flexWrap {componentInput} {id} bind:initializing bind:result>
49
+ <RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
45
50
  <div on:pointerdown bind:this={divEl} />
46
51
  </RunnableWrapper>
47
52
  </div>
@@ -7,7 +7,6 @@ declare const __propDef: {
7
7
  configuration: Record<string, AppInput>;
8
8
  initializing?: boolean | undefined;
9
9
  render: boolean;
10
- staticOutputs?: string[] | undefined;
11
10
  };
12
11
  events: {
13
12
  pointerdown: PointerEvent;
@@ -20,6 +19,5 @@ export type VegaLiteHtmlProps = typeof __propDef.props;
20
19
  export type VegaLiteHtmlEvents = typeof __propDef.events;
21
20
  export type VegaLiteHtmlSlots = typeof __propDef.slots;
22
21
  export default class VegaLiteHtml extends SvelteComponentTyped<VegaLiteHtmlProps, VegaLiteHtmlEvents, VegaLiteHtmlSlots> {
23
- get staticOutputs(): string[];
24
22
  }
25
23
  export {};
@@ -6,14 +6,20 @@ import InputValue from '../../helpers/InputValue.svelte';
6
6
  import RunnableWrapper from '../../helpers/RunnableWrapper.svelte';
7
7
  import { isObject } from '../../../../../utils';
8
8
  import Alert from '../../../../common/alert/Alert.svelte';
9
+ import { initOutput } from '../../../editor/appUtils';
9
10
  export let id;
10
11
  export let componentInput;
11
12
  export let configuration;
12
13
  export let initializing = undefined;
13
14
  export let render;
14
- export const staticOutputs = ['selectedRow', 'loading', 'result', 'selectedRowIndex'];
15
15
  let result = undefined;
16
16
  const { worldStore, selectedComponent } = getContext('AppViewerContext');
17
+ let outputs = initOutput($worldStore, id, {
18
+ selectedRowIndex: 0,
19
+ selectedRow: {},
20
+ result: [],
21
+ loading: false
22
+ });
17
23
  let selectedRowIndex = -1;
18
24
  function toggleRow(row, rowIndex) {
19
25
  if (selectedRowIndex !== rowIndex) {
@@ -33,8 +39,7 @@ $: selectedRowIndex === -1 &&
33
39
  mounted &&
34
40
  outputs &&
35
41
  toggleRow({ original: result[0] }, 0);
36
- $: outputs = $worldStore?.outputsById[id];
37
- $: outputs?.result?.set(result);
42
+ $: outputs?.result?.set(result ?? []);
38
43
  let clientHeight;
39
44
  let clientWidth;
40
45
  let columnDefs = undefined;
@@ -58,7 +63,7 @@ function onCellValueChanged(event) {
58
63
  <InputValue {id} input={configuration.pagination} bind:value={pagination} />
59
64
  <InputValue {id} input={configuration.pageSize} bind:value={pageSize} />
60
65
 
61
- <RunnableWrapper {render} flexWrap {componentInput} {id} bind:initializing bind:result>
66
+ <RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
62
67
  {#if Array.isArray(result) && result.every(isObject)}
63
68
  <div
64
69
  class="border border-gray-300 shadow-sm divide-y divide-gray-300 flex flex-col h-full"
@@ -86,7 +91,10 @@ function onCellValueChanged(event) {
86
91
  </div>
87
92
  {:else if result != undefined}
88
93
  <Alert title="Parsing issues" type="error" size="xs">
89
- The result should be an array of objects
94
+ The result should be an array of objects, received:
95
+ <pre class="overflow-auto">
96
+ {JSON.stringify(result)}
97
+ </pre>
90
98
  </Alert>
91
99
  {/if}
92
100
  </RunnableWrapper>
@@ -9,7 +9,6 @@ declare const __propDef: {
9
9
  configuration: Record<string, AppInput>;
10
10
  initializing?: boolean | undefined;
11
11
  render: boolean;
12
- staticOutputs?: string[] | undefined;
13
12
  };
14
13
  events: {
15
14
  [evt: string]: CustomEvent<any>;
@@ -20,6 +19,5 @@ export type AppAggridTableProps = typeof __propDef.props;
20
19
  export type AppAggridTableEvents = typeof __propDef.events;
21
20
  export type AppAggridTableSlots = typeof __propDef.slots;
22
21
  export default class AppAggridTable extends SvelteComponentTyped<AppAggridTableProps, AppAggridTableEvents, AppAggridTableSlots> {
23
- get staticOutputs(): string[];
24
22
  }
25
23
  export {};
@@ -11,6 +11,7 @@ import { tableOptions } from './tableOptions';
11
11
  import Alert from '../../../../common/alert/Alert.svelte';
12
12
  import { concatCustomCss } from '../../../utils';
13
13
  import { twMerge } from 'tailwind-merge';
14
+ import { initOutput } from '../../../editor/appUtils';
14
15
  export let id;
15
16
  export let componentInput;
16
17
  export let configuration;
@@ -18,13 +19,6 @@ export let actionButtons;
18
19
  export let initializing = undefined;
19
20
  export let customCss = undefined;
20
21
  export let render;
21
- export const staticOutputs = [
22
- 'selectedRow',
23
- 'loading',
24
- 'result',
25
- 'search',
26
- 'selectedRowIndex'
27
- ];
28
22
  let result = undefined;
29
23
  let search = undefined;
30
24
  let searchValue = '';
@@ -39,7 +33,7 @@ const options = writable({
39
33
  columns: []
40
34
  });
41
35
  let table = createSvelteTable(options);
42
- const { app, worldStore, staticOutputs: staticOutputsStore } = getContext('AppViewerContext');
36
+ const { app, worldStore } = getContext('AppViewerContext');
43
37
  let selectedRowIndex = -1;
44
38
  function toggleRow(row, rowIndex, force = false) {
45
39
  if (selectedRowIndex !== rowIndex || force) {
@@ -96,7 +90,13 @@ let filteredResult = [];
96
90
  $: filteredResult && setOptions(filteredResult);
97
91
  $: search === 'By Component' && (filteredResult = searchInResult(result ?? [], searchValue));
98
92
  $: (search === 'By Runnable' || search === 'Disabled') && (filteredResult = result ?? []);
99
- $: outputs = $worldStore?.outputsById[id];
93
+ let outputs = initOutput($worldStore, id, {
94
+ selectedRowIndex: 0,
95
+ selectedRow: undefined,
96
+ loading: false,
97
+ result: [],
98
+ search: ''
99
+ });
100
100
  function rerender() {
101
101
  table = createSvelteTable(options);
102
102
  if (result) {
@@ -109,7 +109,7 @@ $: css = concatCustomCss($app.css?.tablecomponent, customCss);
109
109
 
110
110
  <InputValue {id} input={configuration.search} bind:value={search} />
111
111
 
112
- <RunnableWrapper {render} flexWrap {componentInput} {id} bind:initializing bind:result>
112
+ <RunnableWrapper {render} {componentInput} {id} bind:initializing bind:result>
113
113
  {#if Array.isArray(result) && result.every(isObject)}
114
114
  <div
115
115
  class={twMerge(
@@ -201,7 +201,11 @@ $: css = concatCustomCss($app.css?.tablecomponent, customCss);
201
201
  {/each}
202
202
 
203
203
  {#if actionButtons.length > 0}
204
- <td class="p-2 " on:click={() => toggleRow(row, rowIndex)}>
204
+ <td
205
+ class="p-2"
206
+ on:keypress={() => toggleRow(row, rowIndex)}
207
+ on:click={() => toggleRow(row, rowIndex)}
208
+ >
205
209
  <div class="center-center h-full w-full flex-wrap gap-1">
206
210
  {#each actionButtons as actionButton, actionIndex (actionIndex)}
207
211
  {#if rowIndex == 0}
@@ -214,7 +218,6 @@ $: css = concatCustomCss($app.css?.tablecomponent, customCss);
214
218
  }}
215
219
  extraQueryParams={{ row: row.original }}
216
220
  bind:componentInput={actionButton.componentInput}
217
- bind:staticOutputs={$staticOutputsStore[actionButton.id]}
218
221
  />
219
222
  {:else}
220
223
  <AppButton
@@ -248,7 +251,10 @@ $: css = concatCustomCss($app.css?.tablecomponent, customCss);
248
251
  </div>
249
252
  {:else if result != undefined}
250
253
  <Alert title="Parsing issues" type="error" size="xs">
251
- The result should be an array of objects
254
+ The result should be an array of objects. Received:
255
+ <pre class="overflow-auto">
256
+ {JSON.stringify(result)}
257
+ </pre>
252
258
  </Alert>
253
259
  {/if}
254
260
  </RunnableWrapper>
@@ -11,7 +11,6 @@ declare const __propDef: {
11
11
  initializing?: boolean | undefined;
12
12
  customCss?: ComponentCustomCSS<'container' | 'tableHeader' | 'tableBody' | 'tableFooter'> | undefined;
13
13
  render: boolean;
14
- staticOutputs?: string[] | undefined;
15
14
  };
16
15
  events: {
17
16
  [evt: string]: CustomEvent<any>;
@@ -22,6 +21,5 @@ export type AppTableProps = typeof __propDef.props;
22
21
  export type AppTableEvents = typeof __propDef.events;
23
22
  export type AppTableSlots = typeof __propDef.slots;
24
23
  export default class AppTable extends SvelteComponentTyped<AppTableProps, AppTableEvents, AppTableSlots> {
25
- get staticOutputs(): string[];
26
24
  }
27
25
  export {};
@@ -1,16 +1,24 @@
1
- <script>import RunnableComponent from './RunnableComponent.svelte';
1
+ <script>import { getContext } from 'svelte';
2
+ import { initOutput } from '../../editor/appUtils';
3
+ import RunnableComponent from './RunnableComponent.svelte';
2
4
  export let id;
3
5
  export let name;
4
6
  export let inlineScript;
5
7
  export let fields;
8
+ export let autoRefresh = false;
6
9
  let result = undefined;
7
- export const staticOutputs = ['result', 'loading'];
10
+ const { worldStore } = getContext('AppViewerContext');
11
+ initOutput($worldStore, id, {
12
+ result: undefined,
13
+ loading: false
14
+ });
8
15
  </script>
9
16
 
10
17
  <RunnableComponent
11
18
  render={false}
12
19
  {id}
13
20
  {fields}
21
+ {autoRefresh}
14
22
  bind:result
15
23
  runnable={{
16
24
  name,
@@ -18,6 +26,7 @@ export const staticOutputs = ['result', 'loading'];
18
26
  type: 'runnableByName'
19
27
  }}
20
28
  wrapperClass="hidden"
29
+ recomputable
21
30
  >
22
31
  <slot />
23
32
  </RunnableComponent>
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  name: string;
8
8
  inlineScript: InlineScript | undefined;
9
9
  fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
10
- staticOutputs?: string[] | undefined;
10
+ autoRefresh?: boolean | undefined;
11
11
  };
12
12
  events: {
13
13
  [evt: string]: CustomEvent<any>;
@@ -20,6 +20,5 @@ export type HiddenComponentProps = typeof __propDef.props;
20
20
  export type HiddenComponentEvents = typeof __propDef.events;
21
21
  export type HiddenComponentSlots = typeof __propDef.slots;
22
22
  export default class HiddenComponent extends SvelteComponentTyped<HiddenComponentProps, HiddenComponentEvents, HiddenComponentSlots> {
23
- get staticOutputs(): string[];
24
23
  }
25
24
  export {};
@@ -1,11 +1,18 @@
1
1
  <script>import { isCodeInjection } from '../../../flows/utils';
2
2
  import { deepEqual } from 'fast-equals';
3
- import { getContext } from 'svelte';
3
+ import { createEventDispatcher, getContext } from 'svelte';
4
4
  import { accessPropertyByPath } from '../../utils';
5
+ import { computeGlobalContext, eval_like } from './eval';
5
6
  export let input;
6
7
  export let value;
7
8
  export let id = undefined;
8
9
  export let error = '';
10
+ export let extraContext = {};
11
+ const { componentControl } = getContext('AppViewerContext');
12
+ const dispatch = createEventDispatcher();
13
+ if (input == undefined) {
14
+ dispatch('done');
15
+ }
9
16
  let lastInput = input ? JSON.parse(JSON.stringify(input)) : undefined;
10
17
  $: if (input && !deepEqual(input, lastInput)) {
11
18
  lastInput = JSON.parse(JSON.stringify(input));
@@ -14,8 +21,8 @@ $: if (input && !deepEqual(input, lastInput)) {
14
21
  lastInput.value = input?.['value'];
15
22
  }
16
23
  }
17
- const { worldStore } = getContext('AppViewerContext');
18
- $: state = $worldStore?.state;
24
+ const { worldStore, state, mode } = getContext('AppViewerContext');
25
+ $: stateId = $worldStore?.stateId;
19
26
  let timeout = undefined;
20
27
  const debounce_ms = 50;
21
28
  function debounce(cb) {
@@ -27,21 +34,26 @@ function debounce(cb) {
27
34
  $: lastInput && $worldStore && debounce(handleConnection);
28
35
  $: lastInput &&
29
36
  lastInput.type == 'template' &&
37
+ $stateId &&
30
38
  $state &&
31
- debounce(() => (value = getValue(lastInput)));
39
+ debounce(async () => {
40
+ value = await getValue(lastInput);
41
+ dispatch('done');
42
+ });
32
43
  $: lastInput &&
33
44
  lastInput.type == 'eval' &&
45
+ $stateId &&
34
46
  $state &&
35
- debounce(() => (value = evalExpr(lastInput)));
36
- function handleConnection() {
47
+ debounce(async () => (value = await evalExpr(lastInput)));
48
+ async function handleConnection() {
37
49
  if (lastInput.type === 'connected') {
38
- $worldStore?.connect(lastInput, onValueChange);
50
+ $worldStore?.connect(lastInput, onValueChange, id);
39
51
  }
40
52
  else if (lastInput.type === 'static' || lastInput.type == 'template') {
41
- value = getValue(lastInput);
53
+ value = await getValue(lastInput);
42
54
  }
43
55
  else if (lastInput.type == 'eval') {
44
- value = evalExpr(lastInput);
56
+ value = await evalExpr(lastInput);
45
57
  }
46
58
  else if (lastInput.type == 'upload') {
47
59
  value = lastInput.value;
@@ -49,10 +61,11 @@ function handleConnection() {
49
61
  else {
50
62
  value = undefined;
51
63
  }
64
+ dispatch('done');
52
65
  }
53
- function evalExpr(input) {
66
+ async function evalExpr(input) {
54
67
  try {
55
- const r = eval_like(input.expr, computeGlobalContext());
68
+ const r = await eval_like(input.expr, computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
56
69
  error = '';
57
70
  return r;
58
71
  }
@@ -61,20 +74,10 @@ function evalExpr(input) {
61
74
  return value;
62
75
  }
63
76
  }
64
- function computeGlobalContext() {
65
- return Object.fromEntries(Object.entries($worldStore?.outputsById ?? {})
66
- .filter(([k, _]) => k != id)
67
- .map(([key, value]) => {
68
- return [
69
- key,
70
- Object.fromEntries(Object.entries(value ?? {}).map((x) => [x[0], x[1].peak()]))
71
- ];
72
- }));
73
- }
74
- export function getValue(input) {
77
+ async function getValue(input) {
75
78
  if (input.type === 'template' && isCodeInjection(input.eval)) {
76
79
  try {
77
- const r = eval_like('`' + input.eval + '`', computeGlobalContext());
80
+ const r = await eval_like('`' + input.eval + '`', computeGlobalContext($worldStore, id, extraContext), true, $state, $mode == 'dnd', $componentControl, $worldStore);
78
81
  error = '';
79
82
  return r;
80
83
  }
@@ -89,26 +92,6 @@ export function getValue(input) {
89
92
  return input.eval;
90
93
  }
91
94
  }
92
- function create_context_function_template(eval_string, context) {
93
- return `
94
- return function (context) {
95
- "use strict";
96
- ${Object.keys(context).length > 0
97
- ? `let ${Object.keys(context).map((key) => ` ${key} = context['${key}']`)};`
98
- : ``}
99
- return ${eval_string};
100
- }
101
- `;
102
- }
103
- function make_context_evaluator(eval_string, context) {
104
- let template = create_context_function_template(eval_string, context);
105
- let functor = Function(template);
106
- return functor();
107
- }
108
- function eval_like(text, context = {}) {
109
- let evaluator = make_context_evaluator(text, context);
110
- return evaluator(context);
111
- }
112
95
  function onValueChange(newValue) {
113
96
  if (lastInput.type === 'connected' && newValue !== undefined && newValue !== null) {
114
97
  const { connection } = lastInput;
@@ -2,13 +2,15 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppInput } from '../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
- input: AppInput;
5
+ input: AppInput | undefined;
6
6
  value: string | number | boolean | Record<string | number, any> | undefined;
7
7
  id?: string | undefined;
8
8
  error?: string | undefined;
9
- getValue?: ((input: AppInput) => any) | undefined;
9
+ extraContext?: Record<string, any> | undefined;
10
10
  };
11
11
  events: {
12
+ done: CustomEvent<any>;
13
+ } & {
12
14
  [evt: string]: CustomEvent<any>;
13
15
  };
14
16
  slots: {};
@@ -17,6 +19,5 @@ export type InputValueProps = typeof __propDef.props;
17
19
  export type InputValueEvents = typeof __propDef.events;
18
20
  export type InputValueSlots = typeof __propDef.slots;
19
21
  export default class InputValue extends SvelteComponentTyped<InputValueProps, InputValueEvents, InputValueSlots> {
20
- get getValue(): (input: AppInput) => any;
21
22
  }
22
23
  export {};
@@ -8,12 +8,12 @@ export let result;
8
8
  export let render;
9
9
  // Sync the result to the output
10
10
  const { worldStore } = getContext('AppViewerContext');
11
- $: outputs = $worldStore?.outputsById[id];
11
+ $: outputs = $worldStore?.outputsById?.[id];
12
12
  $: if (outputs?.loading != undefined) {
13
13
  outputs.loading.set(false, true);
14
14
  }
15
15
  function setOutput(v) {
16
- outputs.result?.set(v, true);
16
+ outputs?.result?.set(v, true);
17
17
  }
18
18
  $: result && outputs && setOutput(result);
19
19
  </script>
@@ -1,6 +1,4 @@
1
- <script>import Button from '../../../common/button/Button.svelte';
2
- import { faRefresh } from '@fortawesome/free-solid-svg-icons';
3
- import { RefreshCcw, RefreshCw } from 'lucide-svelte';
1
+ <script>import { RefreshCw } from 'lucide-svelte';
4
2
  import { getContext } from 'svelte';
5
3
  export let componentId;
6
4
  const { runnableComponents, worldStore } = getContext('AppViewerContext');
@@ -10,6 +8,7 @@ async function refresh() {
10
8
  }
11
9
  let loading = false;
12
10
  $: $worldStore?.outputsById[componentId]?.['loading']?.subscribe({
11
+ id: 'refresh-' + componentId,
13
12
  next: (value) => {
14
13
  loading = value;
15
14
  }
@@ -2,7 +2,7 @@
2
2
  import { findGridItem } from '../../editor/appUtils';
3
3
  export let id;
4
4
  export let shouldWrap = false;
5
- const { app, breakpoint } = getContext('AppViewerContext');
5
+ const { app, breakpoint, mode } = getContext('AppViewerContext');
6
6
  $: gridItem = findGridItem($app, id);
7
7
  let wrapper;
8
8
  $: {
@@ -10,13 +10,12 @@ $: {
10
10
  const wrapperHeight = wrapper.getBoundingClientRect().height;
11
11
  const width = $breakpoint === 'sm' ? 3 : 12;
12
12
  gridItem[width].h = Math.ceil(wrapperHeight / 36);
13
- gridItem = gridItem;
14
13
  }
15
14
  }
16
15
  </script>
17
16
 
18
- {#if shouldWrap}
19
- <div bind:this={wrapper}>
17
+ {#if shouldWrap && $mode !== 'preview'}
18
+ <div class="h-full w-full" bind:this={wrapper}>
20
19
  <slot />
21
20
  </div>
22
21
  {:else}