windmill-components 1.56.2 → 1.57.1

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 (224) hide show
  1. package/assets/app.css +5 -1
  2. package/components/ArgInput.svelte +6 -6
  3. package/components/CenteredModal.svelte +15 -14
  4. package/components/CenteredModal.svelte.d.ts +1 -0
  5. package/components/DisplayResult.svelte +1 -1
  6. package/components/Dropdown.svelte +4 -3
  7. package/components/Dropdown.svelte.d.ts +2 -0
  8. package/components/Editor.svelte +6 -4
  9. package/components/Editor.svelte.d.ts +2 -0
  10. package/components/EditorBar.svelte +15 -1
  11. package/components/FlowBuilder.svelte +18 -10
  12. package/components/FlowPreviewContent.svelte +1 -1
  13. package/components/GroupEditor.svelte +1 -0
  14. package/components/IconedResourceType.svelte +2 -2
  15. package/components/InputTransformForm.svelte +50 -40
  16. package/components/InputTransformForm.svelte.d.ts +1 -0
  17. package/components/ItemPicker.svelte +63 -57
  18. package/components/ItemPicker.svelte.d.ts +1 -2
  19. package/components/LogViewer.svelte +6 -5
  20. package/components/ModulePreview.svelte +20 -22
  21. package/components/MoveDrawer.svelte +40 -16
  22. package/components/MoveDrawer.svelte.d.ts +2 -2
  23. package/components/PageHeader.svelte +1 -1
  24. package/components/Path.svelte +5 -2
  25. package/components/Popover.svelte +14 -20
  26. package/components/Popover.svelte.d.ts +5 -0
  27. package/components/RadioButton.svelte +5 -3
  28. package/components/RadioButton.svelte.d.ts +2 -0
  29. package/components/ResourceEditor.svelte +2 -1
  30. package/components/ResourcePicker.svelte +1 -0
  31. package/components/RunChart.svelte +0 -1
  32. package/components/SchemaEditor.svelte +3 -0
  33. package/components/SchemaForm.svelte +86 -77
  34. package/components/SchemaForm.svelte.d.ts +4 -0
  35. package/components/ScriptBuilder.svelte +2 -1
  36. package/components/ScriptEditor.svelte +88 -77
  37. package/components/ShareModal.svelte.d.ts +2 -2
  38. package/components/SimpleEditor.svelte +17 -0
  39. package/components/Star.svelte +15 -9
  40. package/components/StringTypeNarrowing.svelte +30 -8
  41. package/components/TemplateEditor.svelte +21 -11
  42. package/components/TestJobLoader.svelte +94 -68
  43. package/components/TestJobLoader.svelte.d.ts +10 -8
  44. package/components/Toggle.svelte +30 -7
  45. package/components/Toggle.svelte.d.ts +4 -0
  46. package/components/Tooltip.svelte +1 -1
  47. package/components/VariableEditor.svelte +4 -3
  48. package/components/VariableEditor.svelte.d.ts +2 -2
  49. package/components/apps/components/DisplayComponent.svelte +1 -1
  50. package/components/apps/components/buttons/AppButton.svelte +16 -10
  51. package/components/apps/components/buttons/AppButton.svelte.d.ts +1 -0
  52. package/components/apps/components/dataDisplay/AppBarChart.svelte +17 -8
  53. package/components/apps/components/dataDisplay/AppHtml.svelte +23 -0
  54. package/components/apps/components/dataDisplay/AppHtml.svelte.d.ts +23 -0
  55. package/components/apps/components/dataDisplay/AppPieChart.svelte +11 -7
  56. package/components/apps/components/dataDisplay/AppScatterChart.svelte +46 -0
  57. package/components/apps/components/dataDisplay/AppScatterChart.svelte.d.ts +21 -0
  58. package/components/apps/components/dataDisplay/AppText.svelte +44 -7
  59. package/components/apps/components/dataDisplay/AppText.svelte.d.ts +1 -0
  60. package/components/apps/components/dataDisplay/AppTimeseries.svelte +57 -0
  61. package/components/apps/components/dataDisplay/AppTimeseries.svelte.d.ts +22 -0
  62. package/components/apps/components/form/AppForm.svelte +35 -18
  63. package/components/apps/components/helpers/AlignWrapper.svelte +2 -1
  64. package/components/apps/components/helpers/AlignWrapper.svelte.d.ts +1 -0
  65. package/components/apps/components/helpers/InputValue.svelte +20 -14
  66. package/components/apps/components/helpers/InputValue.svelte.d.ts +3 -0
  67. package/components/apps/components/helpers/NonRunnableComponent.svelte +7 -6
  68. package/components/apps/components/helpers/NonRunnableComponent.svelte.d.ts +1 -1
  69. package/components/apps/components/helpers/RefreshButton.svelte +16 -11
  70. package/components/apps/components/helpers/RefreshButton.svelte.d.ts +2 -0
  71. package/components/apps/components/helpers/RunnableComponent.svelte +119 -102
  72. package/components/apps/components/helpers/RunnableWrapper.svelte +6 -1
  73. package/components/apps/components/selectInputs/AppCheckbox.svelte +4 -0
  74. package/components/apps/components/selectInputs/AppSelect.svelte +2 -0
  75. package/components/apps/components/table/AppTable.svelte +64 -35
  76. package/components/apps/components/table/AppTableFooter.svelte +2 -1
  77. package/components/apps/components/table/tableOptions.d.ts +2 -9
  78. package/components/apps/components/table/tableOptions.js +5 -2
  79. package/components/apps/components/textInputs/AppTextInput.svelte +7 -4
  80. package/components/apps/editor/AppEditor.svelte +136 -65
  81. package/components/apps/editor/AppEditor.svelte.d.ts +3 -0
  82. package/components/apps/editor/AppEditorHeader.svelte +349 -51
  83. package/components/apps/editor/AppEditorHeader.svelte.d.ts +2 -4
  84. package/components/apps/editor/AppExportButton.svelte +34 -0
  85. package/components/apps/editor/AppExportButton.svelte.d.ts +17 -0
  86. package/components/apps/editor/AppPreview.svelte +20 -7
  87. package/components/apps/editor/AppPreview.svelte.d.ts +6 -0
  88. package/components/apps/editor/AppPublishButton.svelte +53 -0
  89. package/components/apps/editor/AppPublishButton.svelte.d.ts +18 -0
  90. package/components/apps/editor/ComponentEditor.svelte +39 -8
  91. package/components/apps/editor/ComponentEditor.svelte.d.ts +1 -0
  92. package/components/apps/editor/ComponentHeader.svelte +38 -29
  93. package/components/apps/editor/ComponentHeader.svelte.d.ts +3 -1
  94. package/components/apps/editor/GridEditor.svelte +105 -67
  95. package/components/apps/editor/GridEditor.svelte.d.ts +6 -1
  96. package/components/apps/editor/RecomputeAllComponents.svelte +80 -19
  97. package/components/apps/editor/SettingsPanel.svelte +2 -2
  98. package/components/apps/editor/TablePanel.svelte +1 -0
  99. package/components/apps/editor/componentsPanel/ComponentList.svelte +30 -39
  100. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +2 -1
  101. package/components/apps/editor/componentsPanel/componentStaticValues.js +3 -2
  102. package/components/apps/editor/componentsPanel/data.js +201 -91
  103. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +1 -0
  104. package/components/apps/editor/contextPanel/ContextPanel.svelte +69 -47
  105. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +6 -2
  106. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte.d.ts +1 -0
  107. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +56 -20
  108. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte.d.ts +1 -0
  109. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +5 -1
  110. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte.d.ts +2 -0
  111. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +72 -23
  112. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte.d.ts +1 -0
  113. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +30 -22
  114. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +78 -77
  115. package/components/apps/editor/settingsPanel/AlignmentEditor.svelte +38 -33
  116. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +4 -4
  117. package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte.d.ts +1 -11
  118. package/components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte +27 -9
  119. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +19 -24
  120. package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +1 -0
  121. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +12 -5
  122. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +2 -3
  123. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +59 -33
  124. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +5 -2
  125. package/components/apps/editor/settingsPanel/Recompute.svelte +2 -2
  126. package/components/apps/editor/settingsPanel/SelectedRunnable.svelte +21 -3
  127. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte +1 -3
  128. package/components/apps/editor/settingsPanel/SubTypeEditor.svelte.d.ts +0 -1
  129. package/components/apps/editor/settingsPanel/TableActions.svelte +27 -18
  130. package/components/apps/editor/settingsPanel/TableActions.svelte.d.ts +1 -0
  131. package/components/apps/editor/settingsPanel/common/PanelSection.svelte +10 -2
  132. package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +3 -0
  133. package/components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte +6 -4
  134. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +24 -0
  135. package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +17 -0
  136. package/components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte +6 -0
  137. package/components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte.d.ts +17 -0
  138. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +11 -21
  139. package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte.d.ts +0 -1
  140. package/components/apps/editor/settingsPanel/mainInput/InlineScriptList.svelte +1 -2
  141. package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +42 -13
  142. package/components/apps/editorUtils.d.ts +1 -0
  143. package/components/apps/editorUtils.js +11 -0
  144. package/components/apps/gridUtils.js +2 -1
  145. package/components/apps/inputType.d.ts +12 -6
  146. package/components/apps/rx.d.ts +3 -3
  147. package/components/apps/rx.js +9 -4
  148. package/components/apps/store.d.ts +2 -0
  149. package/components/apps/store.js +2 -0
  150. package/components/apps/types.d.ts +20 -4
  151. package/components/apps/utils.d.ts +2 -2
  152. package/components/apps/utils.js +25 -9
  153. package/components/common/button/Button.svelte +8 -8
  154. package/components/common/button/Button.svelte.d.ts +2 -0
  155. package/components/common/confirmationModal/ConfirmationModal.svelte +1 -0
  156. package/components/common/confirmationModal/UnsavedConfirmationModal.svelte +4 -1
  157. package/components/common/popup/Popup.svelte +1 -1
  158. package/components/common/table/AppRow.svelte +31 -4
  159. package/components/common/table/AppRow.svelte.d.ts +4 -0
  160. package/components/common/table/FlowRow.svelte +9 -5
  161. package/components/common/table/Row.svelte +10 -8
  162. package/components/common/table/ScriptRow.svelte +15 -13
  163. package/components/common/tabs/Tabs.svelte +1 -1
  164. package/components/common/toggleButton/ToggleButton.svelte +2 -0
  165. package/components/common/toggleButton/ToggleButton.svelte.d.ts +1 -0
  166. package/components/flows/CreateActionsApp.svelte +43 -0
  167. package/components/flows/CreateActionsApp.svelte.d.ts +14 -0
  168. package/components/flows/CreateActionsFlow.svelte +6 -1
  169. package/components/flows/content/DynamicInputHelpBox.svelte +1 -1
  170. package/components/flows/content/FlowConstants.svelte +82 -0
  171. package/components/flows/content/FlowConstants.svelte.d.ts +14 -0
  172. package/components/flows/content/FlowEditorPanel.svelte +3 -0
  173. package/components/flows/content/FlowInputs.svelte +2 -2
  174. package/components/flows/content/FlowModuleComponent.svelte +4 -1
  175. package/components/flows/content/FlowModuleHeader.svelte +41 -89
  176. package/components/flows/content/FlowModuleHeader.svelte.d.ts +2 -2
  177. package/components/flows/content/FlowSettings.svelte +1 -1
  178. package/components/flows/flowStore.d.ts +1 -1
  179. package/components/flows/flowStore.js +8 -8
  180. package/components/flows/header/FlowImportExportMenu.svelte +1 -1
  181. package/components/flows/header/FlowPreviewButtons.svelte +2 -1
  182. package/components/flows/map/FlowConstantsItem.svelte +13 -0
  183. package/components/flows/map/FlowConstantsItem.svelte.d.ts +14 -0
  184. package/components/flows/map/FlowInputsItem.svelte +1 -2
  185. package/components/flows/map/FlowModuleSchemaItem.svelte +34 -25
  186. package/components/flows/map/FlowModuleSchemaMap.svelte +9 -3
  187. package/components/flows/map/FlowSettingsItem.svelte +6 -8
  188. package/components/flows/pickers/PickHubScript.svelte +1 -1
  189. package/components/flows/propPicker/PropPickerWrapper.svelte +42 -31
  190. package/components/home/ItemsList.svelte +6 -4
  191. package/components/icons/ClickhouseIcon.svelte +22 -0
  192. package/components/icons/ClickhouseIcon.svelte.d.ts +17 -0
  193. package/components/icons/FaunadbIcon.svelte +19 -0
  194. package/components/icons/FaunadbIcon.svelte.d.ts +17 -0
  195. package/components/icons/OpenaiIcon.svelte +18 -0
  196. package/components/icons/OpenaiIcon.svelte.d.ts +17 -0
  197. package/components/icons/index.d.ts +7 -1
  198. package/components/icons/index.js +8 -2
  199. package/components/propertyPicker/ObjectViewer.svelte +11 -4
  200. package/components/propertyPicker/PropPicker.svelte +1 -1
  201. package/components/scriptEditor/LogPanel.svelte +26 -22
  202. package/components/sidebar/FavoriteMenu.svelte +23 -19
  203. package/components/sidebar/SidebarContent.svelte +16 -16
  204. package/components/sidebar/WorkspaceMenu.svelte +18 -17
  205. package/components/splitPanes/SplitPanesWrapper.svelte +1 -5
  206. package/components/splitPanes/SplitPanesWrapper.svelte.d.ts +0 -1
  207. package/editorUtils.js +2 -0
  208. package/gen/core/OpenAPI.js +1 -1
  209. package/gen/models/Policy.d.ts +1 -0
  210. package/gen/services/AppService.d.ts +18 -0
  211. package/gen/services/AppService.js +30 -0
  212. package/gen/services/GranularAclService.d.ts +3 -3
  213. package/gen/services/ResourceService.d.ts +15 -0
  214. package/gen/services/ResourceService.js +17 -0
  215. package/infer.js +4 -0
  216. package/logout.d.ts +1 -0
  217. package/logout.js +5 -3
  218. package/package.json +502 -489
  219. package/stores.d.ts +1 -0
  220. package/stores.js +13 -5
  221. package/utils.d.ts +1 -1
  222. package/utils.js +17 -10
  223. package/components/apps/CreateApp.svelte +0 -68
  224. package/components/apps/CreateApp.svelte.d.ts +0 -14
@@ -1,11 +1,19 @@
1
1
  <script>import { classNames } from '../../../../../utils';
2
2
  export let title;
3
3
  export let smallPadding = false;
4
+ export let noPadding = false;
5
+ export let titlePadding = '';
4
6
  </script>
5
7
 
6
- <div class={classNames('flex flex-col gap-2 items-start', smallPadding ? 'p-2' : 'p-4')}>
8
+ <div
9
+ class={classNames(
10
+ $$props.class,
11
+ 'flex flex-col h-full gap-2 items-start',
12
+ noPadding ? '' : smallPadding ? 'p-2' : 'p-4'
13
+ )}
14
+ >
7
15
  <div class="flex justify-between items-center w-full gap-1">
8
- <div class="text-sm font-extrabold">{title}</div>
16
+ <div class="text-sm font-extrabold {titlePadding}">{title}</div>
9
17
  <slot name="action" />
10
18
  </div>
11
19
  <slot />
@@ -1,8 +1,11 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
+ [x: string]: any;
4
5
  title: string;
5
6
  smallPadding?: boolean | undefined;
7
+ noPadding?: boolean | undefined;
8
+ titlePadding?: string | undefined;
6
9
  };
7
10
  events: {
8
11
  [evt: string]: CustomEvent<any>;
@@ -11,7 +11,8 @@ function applyConnection() {
11
11
  componentInput.connection = $connectingInput.input.connection;
12
12
  $connectingInput = {
13
13
  opened: false,
14
- input: undefined
14
+ input: undefined,
15
+ hoveredComponent: undefined
15
16
  };
16
17
  }
17
18
  }
@@ -20,7 +21,7 @@ $: $connectingInput && applyConnection();
20
21
 
21
22
  {#if componentInput.type === 'connected'}
22
23
  {#if componentInput.connection}
23
- <div class="flex justify-between w-full">
24
+ <div class="flex justify-between w-full gap-1">
24
25
  <span class="text-xs">Status</span>
25
26
  <Badge color="green">Connected</Badge>
26
27
  </div>
@@ -46,7 +47,7 @@ $: $connectingInput && applyConnection();
46
47
  Disconnect
47
48
  </Button>
48
49
  {:else}
49
- <div class="flex justify-between w-full">
50
+ <div class="flex justify-between w-full gap-1">
50
51
  <span class="text-xs">Status</span>
51
52
  <Badge color="yellow">Not connected</Badge>
52
53
  </div>
@@ -58,7 +59,8 @@ $: $connectingInput && applyConnection();
58
59
  if (componentInput.type === 'connected') {
59
60
  $connectingInput = {
60
61
  opened: true,
61
- input: undefined
62
+ input: undefined,
63
+ hoveredComponent: undefined
62
64
  }
63
65
  }
64
66
  }}
@@ -0,0 +1,24 @@
1
+ <script>import SimpleEditor from '../../../../SimpleEditor.svelte';
2
+ export let code;
3
+ export let value;
4
+ function parseJson() {
5
+ try {
6
+ value = JSON.parse(code);
7
+ error = '';
8
+ }
9
+ catch (e) {
10
+ error = e.message;
11
+ }
12
+ }
13
+ let error = '';
14
+ $: code && parseJson();
15
+ </script>
16
+
17
+ <div class="flex flex-col w-full">
18
+ <div class="border border-gray-300 w-full">
19
+ <SimpleEditor autoHeight lang="json" bind:code />
20
+ </div>
21
+ {#if error != ''}
22
+ <span class="text-red-600 text-xs">{error}</span>
23
+ {/if}
24
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ code: string;
5
+ value: any;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type JsonEditorProps = typeof __propDef.props;
13
+ export type JsonEditorEvents = typeof __propDef.events;
14
+ export type JsonEditorSlots = typeof __propDef.slots;
15
+ export default class JsonEditor extends SvelteComponentTyped<JsonEditorProps, JsonEditorEvents, JsonEditorSlots> {
16
+ }
17
+ export {};
@@ -0,0 +1,6 @@
1
+ <script>export let componentInput;
2
+ </script>
3
+
4
+ {#if componentInput}
5
+ <input type="text" placeholder="column" bind:value={componentInput.column} />
6
+ {/if}
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { RowAppInput } from '../../../inputType';
3
+ declare const __propDef: {
4
+ props: {
5
+ componentInput: RowAppInput | undefined;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type RowInputEditorProps = typeof __propDef.props;
13
+ export type RowInputEditorEvents = typeof __propDef.events;
14
+ export type RowInputEditorSlots = typeof __propDef.slots;
15
+ export default class RowInputEditor extends SvelteComponentTyped<RowInputEditorProps, RowInputEditorEvents, RowInputEditorSlots> {
16
+ }
17
+ export {};
@@ -1,17 +1,15 @@
1
1
  <script>import Toggle from '../../../../Toggle.svelte';
2
2
  import { staticValues } from '../../componentsPanel/componentStaticValues';
3
- import SimpleEditor from '../../../../SimpleEditor.svelte';
4
3
  import ArrayStaticInputEditor from '../ArrayStaticInputEditor.svelte';
5
4
  import ResourcePicker from '../../../../ResourcePicker.svelte';
5
+ import JsonEditor from './JsonEditor.svelte';
6
+ import { getContext } from 'svelte';
6
7
  export let componentInput;
7
- export let canHide = false;
8
+ const { onchange } = getContext('AppEditorContext');
9
+ $: componentInput && onchange?.();
8
10
  </script>
9
11
 
10
12
  {#if componentInput?.type === 'static'}
11
- {#if canHide}
12
- <Toggle bind:checked={componentInput.visible} options={{ right: 'Visible' }} />
13
- {/if}
14
-
15
13
  {#if componentInput.fieldType === 'number'}
16
14
  <input type="number" bind:value={componentInput.value} />
17
15
  {:else if componentInput.fieldType === 'textarea'}
@@ -27,7 +25,7 @@ export let canHide = false;
27
25
  {/each}
28
26
  </select>
29
27
  {:else if componentInput.fieldType === 'object'}
30
- {#if componentInput.format}
28
+ {#if componentInput?.format?.startsWith('resource-')}
31
29
  <ResourcePicker
32
30
  initialValue={componentInput.value?.split('$res:')[1] || ''}
33
31
  on:change={(e) => {
@@ -42,22 +40,14 @@ export let canHide = false;
42
40
  : undefined}
43
41
  />
44
42
  {:else}
45
- <div class="border rounded-sm w-full">
46
- <SimpleEditor
47
- lang="json"
48
- code={JSON.stringify(componentInput.value, null, 2)}
49
- class="few-lines-editor"
50
- on:change={(e) => {
51
- if (componentInput?.type === 'static' && componentInput.value) {
52
- componentInput.value = JSON.parse(e.detail.code)
53
- }
54
- }}
55
- />
56
- </div>
43
+ <JsonEditor
44
+ bind:value={componentInput.value}
45
+ code={JSON.stringify(componentInput.value, null, 2)}
46
+ />
57
47
  {/if}
58
48
  {:else if componentInput.fieldType === 'array'}
59
- <ArrayStaticInputEditor bind:componentInput {canHide} />
49
+ <ArrayStaticInputEditor bind:componentInput />
60
50
  {:else}
61
- <input bind:value={componentInput.value} />
51
+ <input type="text" placeholder="Static value" bind:value={componentInput.value} />
62
52
  {/if}
63
53
  {/if}
@@ -3,7 +3,6 @@ import type { StaticAppInput } from '../../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  componentInput: StaticAppInput | undefined;
6
- canHide?: boolean | undefined;
7
6
  };
8
7
  events: {
9
8
  [evt: string]: CustomEvent<any>;
@@ -23,8 +23,7 @@ const dispatch = createEventDispatcher();
23
23
 
24
24
  {#if inlineScripts.length === 0}
25
25
  <div class="flex flex-col w-full h-full">
26
- <div class="text-md ">No inline scripts</div>
27
- <div class="text-sm">Add inline scripts to your app</div>
26
+ <div class="text-md">No detached inline scripts</div>
28
27
  </div>
29
28
  {:else if filteredItems.length === 0}
30
29
  <NoItemFound />
@@ -6,36 +6,53 @@ import InlineScriptList from './InlineScriptList.svelte';
6
6
  import WorkspaceScriptList from './WorkspaceScriptList.svelte';
7
7
  import WorkspaceFlowList from './WorkspaceFlowList.svelte';
8
8
  import { getContext } from 'svelte';
9
+ import { loadSchema, schemaToInputsSpec } from '../../../utils';
10
+ import { emptySchema } from '../../../../../utils';
9
11
  export let appInput;
10
12
  let tab = 'inlinescripts';
11
13
  let filter = '';
12
14
  let picker;
13
- const { app } = getContext('AppEditorContext');
14
- function pickScript(path) {
15
+ const { app, workspace } = getContext('AppEditorContext');
16
+ async function loadSchemaFromTriggerable(path, runType) {
17
+ return loadSchema(workspace, path, runType) ?? emptySchema();
18
+ }
19
+ async function pickScript(path) {
15
20
  if (appInput.type === 'runnable') {
21
+ const schema = await loadSchemaFromTriggerable(path, 'script');
22
+ const fields = schemaToInputsSpec(schema);
16
23
  appInput.runnable = {
17
24
  type: 'runnableByPath',
18
25
  path,
19
- runType: 'script'
26
+ runType: 'script',
27
+ schema
20
28
  };
29
+ appInput.fields = fields;
21
30
  }
22
31
  }
23
- function pickFlow(path) {
32
+ async function pickFlow(path) {
24
33
  if (appInput.type === 'runnable') {
34
+ const schema = await loadSchemaFromTriggerable(path, 'flow');
35
+ const fields = schemaToInputsSpec(schema);
25
36
  appInput.runnable = {
26
37
  type: 'runnableByPath',
27
38
  path,
28
- runType: 'flow'
39
+ runType: 'flow',
40
+ schema
29
41
  };
42
+ appInput.fields = fields;
30
43
  }
31
44
  }
32
- function pickHubScript(path) {
45
+ async function pickHubScript(path) {
33
46
  if (appInput.type === 'runnable') {
47
+ const schema = await loadSchemaFromTriggerable(path, 'hubscript');
48
+ const fields = schemaToInputsSpec(schema);
34
49
  appInput.runnable = {
35
50
  type: 'runnableByPath',
36
51
  path,
37
- runType: 'hubscript'
52
+ runType: 'hubscript',
53
+ schema
38
54
  };
55
+ appInput.fields = fields;
39
56
  }
40
57
  }
41
58
  function pickInlineScript(name) {
@@ -49,22 +66,32 @@ function pickInlineScript(name) {
49
66
  };
50
67
  $app.unusedInlineScripts.splice(unusedInlineScriptIndex, 1);
51
68
  }
69
+ $app = $app;
52
70
  }
53
71
  function createScript() {
54
72
  let index = 0;
55
- let newScriptPath = `inline_script_${index}`;
73
+ let newScriptPath = `Inline Script ${index}`;
56
74
  const names = $app.grid.reduce((acc, gridItem) => {
57
75
  const { componentInput } = gridItem.data;
58
76
  if (componentInput?.type === 'runnable' &&
59
77
  componentInput?.runnable?.type === 'runnableByName') {
60
78
  acc.push(componentInput.runnable.name);
61
79
  }
80
+ if (componentInput?.type === 'tablecomponent') {
81
+ componentInput.actionButtons.forEach((actionButton) => {
82
+ if (actionButton.componentInput?.type === 'runnable') {
83
+ if (actionButton.componentInput.runnable?.type === 'runnableByName') {
84
+ acc.push(actionButton.componentInput.runnable.name);
85
+ }
86
+ }
87
+ });
88
+ }
62
89
  return acc;
63
90
  }, []);
64
- const unusedNames = Object.keys($app.unusedInlineScripts ?? {});
91
+ const unusedNames = $app.unusedInlineScripts.map((x) => x.name);
65
92
  // Find a name that is not used by any other inline script
66
93
  while (names.includes(newScriptPath) || unusedNames.includes(newScriptPath)) {
67
- newScriptPath = `inline_script_${++index}`;
94
+ newScriptPath = `Inline Script ${++index}`;
68
95
  }
69
96
  appInput.runnable = {
70
97
  type: 'runnableByName',
@@ -77,14 +104,14 @@ function createScript() {
77
104
  </script>
78
105
 
79
106
  <Drawer bind:this={picker} size="1000px">
80
- <DrawerContent title="Picker" on:close={picker.closeDrawer}>
107
+ <DrawerContent title="Script/Flow Picker" on:close={picker.closeDrawer}>
81
108
  <div>
82
109
  <div class="max-w-6xl">
83
110
  <Tabs bind:selected={tab}>
84
111
  <Tab size="sm" value="inlinescripts">
85
112
  <div class="flex gap-2 items-center my-1">
86
113
  <Building size={18} />
87
- Inline Scripts
114
+ Detached Inline Scripts
88
115
  </div>
89
116
  </Tab>
90
117
  <Tab size="sm" value="workspacescripts">
@@ -137,6 +164,7 @@ function createScript() {
137
164
  color="light"
138
165
  variant="border"
139
166
  startIcon={{ icon: faPlus }}
167
+ btnClasses="truncate"
140
168
  >
141
169
  Create an inline script
142
170
  </Button>
@@ -145,7 +173,8 @@ function createScript() {
145
173
  size="sm"
146
174
  color="blue"
147
175
  startIcon={{ icon: faMousePointer }}
176
+ btnClasses="truncate"
148
177
  >
149
- Select a script
178
+ Select a script or flow
150
179
  </Button>
151
180
  </div>
@@ -0,0 +1 @@
1
+ export declare function defaultCode(component: string, language: string): string | undefined;
@@ -0,0 +1,11 @@
1
+ export function defaultCode(component, language) {
2
+ if (component === 'tablecomponent' && language === 'deno') {
3
+ return `export async function main(x: string) {
4
+ return [
5
+ { foo: x, bar: 42 },
6
+ { foo: "static", bar: 84 }]
7
+ }
8
+ `;
9
+ }
10
+ return undefined;
11
+ }
@@ -15,8 +15,9 @@ function disableDrag(component) {
15
15
  return component;
16
16
  }
17
17
  function toggleFixed(component) {
18
+ const nValue = !component[gridColumns[0]].fixed;
18
19
  gridColumns.forEach((column) => {
19
- component[column].fixed = !component[column].fixed;
20
+ component[column].fixed = nValue;
20
21
  });
21
22
  return component;
22
23
  }
@@ -1,6 +1,6 @@
1
1
  import type { staticValues } from './editor/componentsPanel/componentStaticValues';
2
2
  import type { InlineScript } from './types';
3
- export type InputType = 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any';
3
+ export type InputType = 'text' | 'textarea' | 'template' | 'number' | 'boolean' | 'select' | 'date' | 'time' | 'datetime' | 'object' | 'array' | 'any';
4
4
  export type InputConnection = {
5
5
  componentId: string;
6
6
  path: string;
@@ -13,10 +13,13 @@ export type UserInput<U> = {
13
13
  type: 'user';
14
14
  value: U | undefined;
15
15
  };
16
+ export type RowInput = {
17
+ type: 'row';
18
+ column: string;
19
+ };
16
20
  export type StaticInput<U> = {
17
21
  value: U | undefined;
18
22
  type: 'static';
19
- visible?: boolean | undefined;
20
23
  };
21
24
  export type TemplateInput = {
22
25
  eval: string;
@@ -24,6 +27,7 @@ export type TemplateInput = {
24
27
  };
25
28
  type RunnableByPath = {
26
29
  path: string;
30
+ schema: any;
27
31
  runType: 'script' | 'flow' | 'hubscript';
28
32
  type: 'runnableByPath';
29
33
  };
@@ -35,17 +39,16 @@ type RunnableByName = {
35
39
  export type Runnable = RunnableByPath | RunnableByName | undefined;
36
40
  export type ResultInput = {
37
41
  runnable: Runnable;
38
- fields: Record<string, StaticAppInput | ConnectedAppInput>;
42
+ fields: Record<string, StaticAppInput | ConnectedAppInput | RowAppInput | UserAppInput>;
39
43
  type: 'runnable';
40
44
  };
41
- type AppInputSpec<T extends InputType, U, V extends InputType = never> = (StaticInput<U> | ConnectedInput | UserInput<U> | ResultInput | TemplateInput) & InputConfiguration<T, U, V>;
45
+ type AppInputSpec<T extends InputType, U, V extends InputType = never> = (StaticInput<U> | ConnectedInput | UserInput<U> | RowInput | ResultInput | TemplateInput) & InputConfiguration<T, U, V>;
42
46
  type InputConfiguration<T extends InputType, U, V extends InputType> = {
43
47
  fieldType: T;
44
- defaultValue: U;
45
48
  subFieldType?: V;
46
49
  format?: string | undefined;
47
50
  };
48
- export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & {
51
+ export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', string> | AppInputSpec<'template', string> | AppInputSpec<'number', number> | AppInputSpec<'boolean', boolean> | AppInputSpec<'date', string> | AppInputSpec<'time', string> | AppInputSpec<'datetime', string> | AppInputSpec<'any', any> | AppInputSpec<'object', Record<string | number, any>> | AppInputSpec<'object', string> | (AppInputSpec<'select', string> & {
49
52
  /**
50
53
  * One of the keys of `staticValues` from `lib/components/apps/editor/componentsPanel/componentStaticValues`
51
54
  */
@@ -53,6 +56,9 @@ export type AppInput = AppInputSpec<'text', string> | AppInputSpec<'textarea', s
53
56
  }) | AppInputSpec<'array', string[], 'text'> | AppInputSpec<'array', string[], 'textarea'> | AppInputSpec<'array', number[], 'number'> | AppInputSpec<'array', boolean[], 'boolean'> | AppInputSpec<'array', string[], 'date'> | AppInputSpec<'array', string[], 'time'> | AppInputSpec<'array', string[], 'datetime'> | AppInputSpec<'array', object[], 'object'> | (AppInputSpec<'array', string[], 'select'> & {
54
57
  optionValuesKey: keyof typeof staticValues;
55
58
  });
59
+ export type RowAppInput = Extract<AppInput, {
60
+ type: 'row';
61
+ }>;
56
62
  export type StaticAppInput = Extract<AppInput, {
57
63
  type: 'static';
58
64
  }>;
@@ -15,12 +15,12 @@ export interface Input<T> extends Subscriber<T> {
15
15
  }
16
16
  export type World = {
17
17
  outputsById: Record<string, Record<string, Output<any>>>;
18
- connect: <T>(inputSpec: AppInput, next: (x: T) => void, previousValue: T) => Input<T>;
18
+ connect: <T>(inputSpec: AppInput, next: (x: T) => void) => Input<T>;
19
19
  state: Writable<number>;
20
20
  };
21
- export declare function buildWorld(components: Record<string, string[]>, previousWorld: World | undefined): World;
21
+ export declare function buildWorld(components: Record<string, string[]>, previousWorld: World | undefined, context: Record<string, any>): World;
22
22
  export declare function buildObservableWorld(): {
23
- connect: <T>(inputSpec: AppInput, next: (x: T) => void, previousValue: T) => Input<T>;
23
+ connect: <T>(inputSpec: AppInput, next: (x: T) => void) => Input<T>;
24
24
  newOutput: <T_1>(id: string, name: string, state: Writable<number>, previousValue: T_1) => Output<T_1>;
25
25
  };
26
26
  export declare function cachedInput<T>(nextParan: (x: T) => void): Input<T>;
@@ -1,8 +1,12 @@
1
1
  import { writable } from 'svelte/store';
2
- export function buildWorld(components, previousWorld) {
2
+ export function buildWorld(components, previousWorld, context) {
3
3
  const newWorld = buildObservableWorld();
4
- const outputsById = {};
5
4
  const state = writable(0);
5
+ const outputsById = {
6
+ ctx: Object.fromEntries(Object.entries(context).map(([k, v]) => {
7
+ return [k, newWorld.newOutput('ctx', k, state, v)];
8
+ }))
9
+ };
6
10
  for (const [k, outputs] of Object.entries(components)) {
7
11
  outputsById[k] = {};
8
12
  for (const o of outputs) {
@@ -14,7 +18,7 @@ export function buildWorld(components, previousWorld) {
14
18
  }
15
19
  export function buildObservableWorld() {
16
20
  const observables = {};
17
- function connect(inputSpec, next, previousValue) {
21
+ function connect(inputSpec, next) {
18
22
  if (inputSpec.type === 'static') {
19
23
  return {
20
24
  peak: () => inputSpec.value,
@@ -31,7 +35,7 @@ export function buildObservableWorld() {
31
35
  };
32
36
  }
33
37
  const { componentId, path } = connection;
34
- const [p] = path ? path.split('.') : [undefined];
38
+ const [p] = path ? path.split('.')[0].split('[') : [undefined];
35
39
  let obs = observables[`${componentId}.${p}`];
36
40
  if (!obs) {
37
41
  console.warn('Observable at ' + componentId + '.' + p + ' not found');
@@ -41,6 +45,7 @@ export function buildObservableWorld() {
41
45
  };
42
46
  }
43
47
  obs.subscribe(input);
48
+ input.next(obs.peak());
44
49
  return input;
45
50
  }
46
51
  else if (inputSpec.type === 'user') {
@@ -0,0 +1,2 @@
1
+ import type { App } from './types';
2
+ export declare const importStore: import("svelte/store").Writable<App | undefined>;
@@ -0,0 +1,2 @@
1
+ import { writable } from "svelte/store";
2
+ export const importStore = writable(undefined);
@@ -12,6 +12,8 @@ export type TextInputComponent = BaseComponent<'textinputcomponent'>;
12
12
  export type PasswordInputComponent = BaseComponent<'passwordinputcomponent'>;
13
13
  export type DateInputComponent = BaseComponent<'dateinputcomponent'>;
14
14
  export type NumberInputComponent = BaseComponent<'numberinputcomponent'>;
15
+ export type HtmlComponent = BaseComponent<'htmlcomponent'>;
16
+ export type TimeseriesComponent = BaseComponent<'timeseriescomponent'>;
15
17
  export type ButtonComponent = BaseComponent<'buttoncomponent'> & {
16
18
  recomputeIds: string[] | undefined;
17
19
  };
@@ -21,6 +23,7 @@ export type FormComponent = BaseComponent<'formcomponent'> & {
21
23
  export type RunFormComponent = BaseComponent<'runformcomponent'>;
22
24
  export type BarChartComponent = BaseComponent<'barchartcomponent'>;
23
25
  export type PieChartComponent = BaseComponent<'piechartcomponent'>;
26
+ export type ScatterChartComponent = BaseComponent<'scatterchartcomponent'>;
24
27
  export type TableComponent = BaseComponent<'tablecomponent'> & {
25
28
  actionButtons: (BaseAppComponent & ButtonComponent)[];
26
29
  };
@@ -39,7 +42,9 @@ export type Aligned = {
39
42
  export interface BaseAppComponent extends Partial<Aligned> {
40
43
  id: ComponentID;
41
44
  componentInput: AppInput | undefined;
42
- configuration: Record<string, StaticAppInput | ConnectedAppInput | UserAppInput>;
45
+ configuration: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput) & {
46
+ onlyStatic?: boolean;
47
+ }>;
43
48
  card: boolean | undefined;
44
49
  /**
45
50
  * If `true` then the wrapper will allow items to flow outside of it's borders.
@@ -48,7 +53,7 @@ export interface BaseAppComponent extends Partial<Aligned> {
48
53
  */
49
54
  softWrap?: boolean;
50
55
  }
51
- export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | BarChartComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent);
56
+ export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | BarChartComponent | TimeseriesComponent | HtmlComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ScatterChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent);
52
57
  export type ComponentSet = {
53
58
  title: string;
54
59
  components: AppComponent[];
@@ -70,7 +75,7 @@ export type InlineScript = {
70
75
  };
71
76
  export type App = {
72
77
  grid: GridItem[];
73
- title: string;
78
+ fullscreen: boolean;
74
79
  unusedInlineScripts: Array<{
75
80
  name: string;
76
81
  inlineScript: InlineScript;
@@ -80,17 +85,28 @@ export type ConnectingInput = {
80
85
  opened: boolean;
81
86
  input?: ConnectedInput;
82
87
  sourceName?: string;
88
+ hoveredComponent: string | undefined;
83
89
  };
84
90
  export type AppEditorContext = {
85
91
  worldStore: Writable<World | undefined>;
86
92
  staticOutputs: Writable<Record<string, string[]>>;
93
+ lazyGrid: Writable<GridItem[]>;
87
94
  app: Writable<App>;
95
+ summary: Writable<string>;
88
96
  selectedComponent: Writable<string | undefined>;
89
97
  mode: Writable<EditorMode>;
90
98
  connectingInput: Writable<ConnectingInput>;
91
99
  breakpoint: Writable<EditorBreakpoint>;
92
- runnableComponents: Writable<Record<string, () => void>>;
100
+ runnableComponents: Writable<Record<string, () => Promise<void>>>;
101
+ staticExporter: Writable<Record<string, () => any>>;
93
102
  appPath: string;
103
+ workspace: string;
104
+ onchange: (() => void) | undefined;
105
+ isEditor: boolean;
106
+ jobs: Writable<{
107
+ job: string;
108
+ component: string;
109
+ }[]>;
94
110
  };
95
111
  export type EditorMode = 'dnd' | 'preview';
96
112
  export type EditorBreakpoint = 'sm' | 'lg';
@@ -1,8 +1,8 @@
1
1
  import type { Schema } from '../../common';
2
- import type { AppInput, AppInputs, InputType, ResultAppInput } from './inputType';
2
+ import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
3
3
  import type { AppComponent } from './types';
4
4
  export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
5
- export declare function schemaToInputsSpec(schema: Schema): AppInputs;
5
+ export declare function schemaToInputsSpec(schema: Schema): Record<string, StaticAppInput>;
6
6
  export declare const displayData: Record<AppComponent['type'], {
7
7
  name: string;
8
8
  icon: any;