windmill-components 1.77.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 (136) hide show
  1. package/components/ArgInput.svelte +4 -14
  2. package/components/LightweightArgInput.svelte +315 -0
  3. package/components/LightweightArgInput.svelte.d.ts +47 -0
  4. package/components/LightweightSchemaForm.svelte +31 -0
  5. package/components/LightweightSchemaForm.svelte.d.ts +18 -0
  6. package/components/ModulePreview.svelte +1 -0
  7. package/components/Multiselect.svelte.d.ts +2 -2
  8. package/components/Path.svelte +4 -0
  9. package/components/Range.svelte.d.ts +2 -2
  10. package/components/SimpleEditor.svelte +1 -1
  11. package/components/SimpleEditor.svelte.d.ts +2 -0
  12. package/components/TemplateEditor.svelte +3 -0
  13. package/components/TemplateEditor.svelte.d.ts +0 -204
  14. package/components/VariableEditor.svelte +2 -1
  15. package/components/apps/components/buttons/AppButton.svelte +5 -3
  16. package/components/apps/components/buttons/AppButton.svelte.d.ts +0 -2
  17. package/components/apps/components/buttons/AppFormButton.svelte +1 -1
  18. package/components/apps/components/display/AppBarChart.svelte +7 -3
  19. package/components/apps/components/display/AppBarChart.svelte.d.ts +0 -2
  20. package/components/apps/components/display/AppDisplayComponent.svelte +7 -3
  21. package/components/apps/components/display/AppDisplayComponent.svelte.d.ts +0 -2
  22. package/components/apps/components/display/AppHtml.svelte +7 -11
  23. package/components/apps/components/display/AppHtml.svelte.d.ts +0 -2
  24. package/components/apps/components/display/AppIcon.svelte +0 -1
  25. package/components/apps/components/display/AppIcon.svelte.d.ts +0 -2
  26. package/components/apps/components/display/AppImage.svelte +0 -1
  27. package/components/apps/components/display/AppImage.svelte.d.ts +0 -2
  28. package/components/apps/components/display/AppMap.svelte +10 -3
  29. package/components/apps/components/display/AppMap.svelte.d.ts +0 -2
  30. package/components/apps/components/display/AppPdf.svelte +8 -3
  31. package/components/apps/components/display/AppPdf.svelte.d.ts +0 -2
  32. package/components/apps/components/display/AppPieChart.svelte +7 -3
  33. package/components/apps/components/display/AppPieChart.svelte.d.ts +0 -2
  34. package/components/apps/components/display/AppScatterChart.svelte +7 -3
  35. package/components/apps/components/display/AppScatterChart.svelte.d.ts +0 -2
  36. package/components/apps/components/display/AppText.svelte +41 -17
  37. package/components/apps/components/display/AppText.svelte.d.ts +0 -2
  38. package/components/apps/components/display/AppTimeseries.svelte +7 -3
  39. package/components/apps/components/display/AppTimeseries.svelte.d.ts +0 -2
  40. package/components/apps/components/display/PlotlyHtml.svelte +9 -4
  41. package/components/apps/components/display/PlotlyHtml.svelte.d.ts +0 -2
  42. package/components/apps/components/display/VegaLiteHtml.svelte +8 -3
  43. package/components/apps/components/display/VegaLiteHtml.svelte.d.ts +0 -2
  44. package/components/apps/components/display/table/AppAggridTable.svelte +9 -4
  45. package/components/apps/components/display/table/AppAggridTable.svelte.d.ts +0 -2
  46. package/components/apps/components/display/table/AppTable.svelte +15 -12
  47. package/components/apps/components/display/table/AppTable.svelte.d.ts +0 -2
  48. package/components/apps/components/helpers/HiddenComponent.svelte +8 -2
  49. package/components/apps/components/helpers/HiddenComponent.svelte.d.ts +0 -2
  50. package/components/apps/components/helpers/NonRunnableComponent.svelte +2 -2
  51. package/components/apps/components/helpers/ResizeWrapper.svelte +3 -4
  52. package/components/apps/components/helpers/RunnableComponent.svelte +3 -18
  53. package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +0 -1
  54. package/components/apps/components/helpers/RunnableWrapper.svelte +0 -2
  55. package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +0 -1
  56. package/components/apps/components/inputs/AppCheckbox.svelte +4 -2
  57. package/components/apps/components/inputs/AppCheckbox.svelte.d.ts +0 -2
  58. package/components/apps/components/inputs/AppDateInput.svelte +4 -2
  59. package/components/apps/components/inputs/AppDateInput.svelte.d.ts +0 -2
  60. package/components/apps/components/inputs/AppFileInput.svelte +4 -2
  61. package/components/apps/components/inputs/AppFileInput.svelte.d.ts +0 -2
  62. package/components/apps/components/inputs/AppMultiSelect.svelte +4 -2
  63. package/components/apps/components/inputs/AppMultiSelect.svelte.d.ts +0 -2
  64. package/components/apps/components/inputs/AppNumberInput.svelte +4 -2
  65. package/components/apps/components/inputs/AppNumberInput.svelte.d.ts +0 -2
  66. package/components/apps/components/inputs/AppRangeInput.svelte +5 -2
  67. package/components/apps/components/inputs/AppRangeInput.svelte.d.ts +0 -2
  68. package/components/apps/components/inputs/AppSelect.svelte +4 -2
  69. package/components/apps/components/inputs/AppSelect.svelte.d.ts +0 -2
  70. package/components/apps/components/inputs/AppSliderInputs.svelte +4 -2
  71. package/components/apps/components/inputs/AppSliderInputs.svelte.d.ts +0 -2
  72. package/components/apps/components/inputs/AppTextInput.svelte +5 -3
  73. package/components/apps/components/inputs/AppTextInput.svelte.d.ts +0 -2
  74. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +5 -2
  75. package/components/apps/components/inputs/currency/AppCurrencyInput.svelte.d.ts +0 -2
  76. package/components/apps/components/layout/AppContainer.svelte +0 -1
  77. package/components/apps/components/layout/AppContainer.svelte.d.ts +0 -2
  78. package/components/apps/components/layout/AppTabs.svelte +3 -6
  79. package/components/apps/components/layout/AppTabs.svelte.d.ts +0 -2
  80. package/components/apps/editor/AppComponentInput.svelte +2 -1
  81. package/components/apps/editor/AppEditor.svelte +9 -12
  82. package/components/apps/editor/AppPreview.svelte +66 -14
  83. package/components/apps/editor/GridEditor.svelte +6 -27
  84. package/components/apps/editor/GridPanel.svelte +3 -1
  85. package/components/apps/editor/GridViewer.svelte +91 -0
  86. package/components/apps/editor/GridViewer.svelte.d.ts +32 -0
  87. package/components/apps/editor/SubGridEditor.svelte +73 -50
  88. package/components/apps/editor/appUtils.d.ts +3 -2
  89. package/components/apps/editor/appUtils.js +14 -19
  90. package/components/apps/editor/component/Component.svelte +2 -43
  91. package/components/apps/editor/component/ComponentNavigation.svelte +17 -12
  92. package/components/apps/editor/component/components.d.ts +2 -2
  93. package/components/apps/editor/component/components.js +42 -79
  94. package/components/apps/editor/componentsPanel/ComponentList.svelte +5 -4
  95. package/components/apps/editor/componentsPanel/componentStaticValues.d.ts +1 -1
  96. package/components/apps/editor/contextPanel/ComponentOutput.svelte +23 -33
  97. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte +14 -13
  98. package/components/apps/editor/contextPanel/ComponentOutputViewer.svelte.d.ts +0 -1
  99. package/components/apps/editor/contextPanel/ContextPanel.svelte +16 -23
  100. package/components/apps/editor/contextPanel/SubGridOutput.svelte +5 -10
  101. package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte +9 -6
  102. package/components/apps/editor/contextPanel/components/BackgroundScriptOutput.svelte.d.ts +0 -1
  103. package/components/apps/editor/contextPanel/components/BackgroundScriptsOutput.svelte +1 -2
  104. package/components/apps/editor/contextPanel/components/OutputHeader.svelte +62 -41
  105. package/components/apps/editor/contextPanel/components/OutputHeader.svelte.d.ts +0 -2
  106. package/components/apps/editor/contextPanel/components/TableActionOutput.svelte +2 -4
  107. package/components/apps/editor/contextPanel/components/TableActionOutput.svelte.d.ts +0 -1
  108. package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte +1 -2
  109. package/components/apps/editor/contextPanel/components/TableActionsOutput.svelte.d.ts +0 -1
  110. package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +2 -2
  111. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +6 -2
  112. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +5 -9
  113. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +12 -7
  114. package/components/apps/editor/settingsPanel/GridPane.svelte +1 -3
  115. package/components/apps/editor/settingsPanel/GridTab.svelte +1 -3
  116. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -16
  117. package/components/apps/editor/settingsPanel/TableActions.svelte +2 -5
  118. package/components/apps/gridUtils.d.ts +1 -3
  119. package/components/apps/gridUtils.js +1 -15
  120. package/components/apps/rx.d.ts +1 -1
  121. package/components/apps/rx.js +8 -10
  122. package/components/apps/svelte-grid/Grid.svelte +8 -12
  123. package/components/apps/svelte-grid/Grid.svelte.d.ts +0 -2
  124. package/components/apps/svelte-grid/MoveResize.svelte +1 -1
  125. package/components/apps/svelte-grid/types.d.ts +12 -16
  126. package/components/apps/svelte-grid/utils/helper.d.ts +1 -5
  127. package/components/apps/types.d.ts +9 -7
  128. package/components/apps/utils.js +2 -2
  129. package/components/common/button/Button.svelte.d.ts +1 -1
  130. package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
  131. package/components/common/menu/Menu.svelte.d.ts +1 -1
  132. package/components/propertyPicker/ObjectViewer.svelte +1 -1
  133. package/components/propertyPicker/PropPicker.svelte +4 -1
  134. package/package.json +4 -2
  135. package/components/apps/editor/AppComponentInputs.svelte +0 -13
  136. package/components/apps/editor/AppComponentInputs.svelte.d.ts +0 -20
@@ -1,18 +1,20 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
  import { FileInput } from '../../../common';
4
+ import { initOutput } from '../../editor/appUtils';
4
5
  import { concatCustomCss } from '../../utils';
5
6
  import InputValue from '../helpers/InputValue.svelte';
6
7
  export let id;
7
8
  export let configuration;
8
- export const staticOutputs = ['result'];
9
9
  export let customCss = undefined;
10
10
  export let render;
11
11
  const { app, worldStore } = getContext('AppViewerContext');
12
12
  let acceptedFileTypes = undefined;
13
13
  let allowMultiple = undefined;
14
14
  let text = undefined;
15
- $: outputs = $worldStore?.outputsById[id];
15
+ let outputs = initOutput($worldStore, id, {
16
+ result: []
17
+ });
16
18
  // Receives Base64 encoded strings from the input component
17
19
  async function handleChange(files) {
18
20
  outputs?.result.set(files);
@@ -5,7 +5,6 @@ declare const __propDef: {
5
5
  props: {
6
6
  id: string;
7
7
  configuration: Record<string, AppInput>;
8
- staticOutputs?: string[] | undefined;
9
8
  customCss?: ComponentCustomCSS<'container'> | undefined;
10
9
  render: boolean;
11
10
  };
@@ -18,6 +17,5 @@ export type AppFileInputProps = typeof __propDef.props;
18
17
  export type AppFileInputEvents = typeof __propDef.events;
19
18
  export type AppFileInputSlots = typeof __propDef.slots;
20
19
  export default class AppFileInput extends SvelteComponentTyped<AppFileInputProps, AppFileInputEvents, AppFileInputSlots> {
21
- get staticOutputs(): string[];
22
20
  }
23
21
  export {};
@@ -4,7 +4,7 @@ import { concatCustomCss } from '../../utils';
4
4
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
5
5
  import InputValue from '../helpers/InputValue.svelte';
6
6
  import { SELECT_INPUT_DEFAULT_STYLE } from '../../../../defaults';
7
- export const staticOutputs = ['result'];
7
+ import { initOutput } from '../../editor/appUtils';
8
8
  export let id;
9
9
  export let configuration;
10
10
  export let horizontalAlignment = undefined;
@@ -14,7 +14,9 @@ export let render;
14
14
  const { app, worldStore, connectingInput, selectedComponent } = getContext('AppViewerContext');
15
15
  let items;
16
16
  let placeholder = 'Select an item';
17
- $: outputs = $worldStore?.outputsById[id];
17
+ let outputs = initOutput($worldStore, id, {
18
+ result: []
19
+ });
18
20
  // $: outputs && handleOutputs()
19
21
  // function handleOutputs() {
20
22
  // value = outputs.result.peak()
@@ -3,7 +3,6 @@ import type { AppInput } from '../../inputType';
3
3
  import type { ComponentCustomCSS } from '../../types';
4
4
  declare const __propDef: {
5
5
  props: {
6
- staticOutputs?: string[] | undefined;
7
6
  id: string;
8
7
  configuration: Record<string, AppInput>;
9
8
  horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
@@ -22,6 +21,5 @@ export type AppMultiSelectProps = typeof __propDef.props;
22
21
  export type AppMultiSelectEvents = typeof __propDef.events;
23
22
  export type AppMultiSelectSlots = typeof __propDef.slots;
24
23
  export default class AppMultiSelect extends SvelteComponentTyped<AppMultiSelectProps, AppMultiSelectEvents, AppMultiSelectSlots> {
25
- get staticOutputs(): string[];
26
24
  }
27
25
  export {};
@@ -1,12 +1,12 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { twMerge } from 'tailwind-merge';
3
+ import { initOutput } from '../../editor/appUtils';
3
4
  import { concatCustomCss } from '../../utils';
4
5
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
5
6
  import InputValue from '../helpers/InputValue.svelte';
6
7
  export let id;
7
8
  export let configuration;
8
9
  export let verticalAlignment = undefined;
9
- export const staticOutputs = ['result'];
10
10
  export let customCss = undefined;
11
11
  export let render;
12
12
  const { app, worldStore, selectedComponent } = getContext('AppViewerContext');
@@ -16,7 +16,9 @@ let value = undefined;
16
16
  let min = undefined;
17
17
  let max = undefined;
18
18
  let step = 1;
19
- $: outputs = $worldStore?.outputsById[id];
19
+ let outputs = initOutput($worldStore, id, {
20
+ result: undefined
21
+ });
20
22
  $: handleDefault(defaultValue);
21
23
  $: outputs?.result.set(value);
22
24
  function handleDefault(defaultValue) {
@@ -6,7 +6,6 @@ declare const __propDef: {
6
6
  id: string;
7
7
  configuration: Record<string, AppInput>;
8
8
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
9
- staticOutputs?: string[] | undefined;
10
9
  customCss?: ComponentCustomCSS<'input'> | undefined;
11
10
  render: boolean;
12
11
  };
@@ -21,6 +20,5 @@ export type AppNumberInputProps = typeof __propDef.props;
21
20
  export type AppNumberInputEvents = typeof __propDef.events;
22
21
  export type AppNumberInputSlots = typeof __propDef.slots;
23
22
  export default class AppNumberInput extends SvelteComponentTyped<AppNumberInputProps, AppNumberInputEvents, AppNumberInputSlots> {
24
- get staticOutputs(): string[];
25
23
  }
26
24
  export {};
@@ -4,10 +4,10 @@ import AlignWrapper from '../helpers/AlignWrapper.svelte';
4
4
  import InputValue from '../helpers/InputValue.svelte';
5
5
  import { concatCustomCss } from '../../utils';
6
6
  import { twMerge } from 'tailwind-merge';
7
+ import { initOutput } from '../../editor/appUtils';
7
8
  export let id;
8
9
  export let configuration;
9
10
  export let verticalAlignment = undefined;
10
- export const staticOutputs = ['result'];
11
11
  export let customCss = undefined;
12
12
  export let render;
13
13
  const { app, worldStore } = getContext('AppViewerContext');
@@ -16,7 +16,10 @@ let max = 42;
16
16
  let step = 1;
17
17
  let slider;
18
18
  let values = [0, 0];
19
- $: outputs = $worldStore?.outputsById[id];
19
+ let outputs = initOutput($worldStore, id, {
20
+ result: null
21
+ });
22
+ console.log('reset');
20
23
  $: outputs?.result.set(values);
21
24
  $: css = concatCustomCss($app.css?.rangecomponent, customCss);
22
25
  let lastStyle = undefined;
@@ -6,7 +6,6 @@ declare const __propDef: {
6
6
  id: string;
7
7
  configuration: Record<string, AppInput>;
8
8
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
9
- staticOutputs?: string[] | undefined;
10
9
  customCss?: ComponentCustomCSS<'handles' | 'bar' | 'limits' | 'values'> | undefined;
11
10
  render: boolean;
12
11
  };
@@ -21,6 +20,5 @@ export type AppRangeInputProps = typeof __propDef.props;
21
20
  export type AppRangeInputEvents = typeof __propDef.events;
22
21
  export type AppRangeInputSlots = typeof __propDef.slots;
23
22
  export default class AppRangeInput extends SvelteComponentTyped<AppRangeInputProps, AppRangeInputEvents, AppRangeInputSlots> {
24
- get staticOutputs(): string[];
25
23
  }
26
24
  export {};
@@ -4,7 +4,7 @@ import { concatCustomCss } from '../../utils';
4
4
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
5
5
  import InputValue from '../helpers/InputValue.svelte';
6
6
  import { SELECT_INPUT_DEFAULT_STYLE } from '../../../../defaults';
7
- export const staticOutputs = ['result'];
7
+ import { initOutput } from '../../editor/appUtils';
8
8
  export let id;
9
9
  export let configuration;
10
10
  export let horizontalAlignment = undefined;
@@ -14,7 +14,9 @@ export let render;
14
14
  const { app, worldStore, connectingInput, selectedComponent } = getContext('AppViewerContext');
15
15
  let items;
16
16
  let placeholder = 'Select an item';
17
- $: outputs = $worldStore?.outputsById[id];
17
+ let outputs = initOutput($worldStore, id, {
18
+ result: undefined
19
+ });
18
20
  let value = outputs?.result.peak();
19
21
  $: items && handleItems();
20
22
  let listItems = [];
@@ -3,7 +3,6 @@ import type { AppInput } from '../../inputType';
3
3
  import type { ComponentCustomCSS } from '../../types';
4
4
  declare const __propDef: {
5
5
  props: {
6
- staticOutputs?: string[] | undefined;
7
6
  id: string;
8
7
  configuration: Record<string, AppInput>;
9
8
  horizontalAlignment?: 'left' | 'center' | 'right' | undefined;
@@ -22,6 +21,5 @@ export type AppSelectProps = typeof __propDef.props;
22
21
  export type AppSelectEvents = typeof __propDef.events;
23
22
  export type AppSelectSlots = typeof __propDef.slots;
24
23
  export default class AppSelect extends SvelteComponentTyped<AppSelectProps, AppSelectEvents, AppSelectSlots> {
25
- get staticOutputs(): string[];
26
24
  }
27
25
  export {};
@@ -4,10 +4,10 @@ import AlignWrapper from '../helpers/AlignWrapper.svelte';
4
4
  import InputValue from '../helpers/InputValue.svelte';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { concatCustomCss } from '../../utils';
7
+ import { initOutput } from '../../editor/appUtils';
7
8
  export let id;
8
9
  export let configuration;
9
10
  export let verticalAlignment = undefined;
10
- export const staticOutputs = ['result'];
11
11
  export let customCss = undefined;
12
12
  export let render;
13
13
  const { app, worldStore, selectedComponent } = getContext('AppViewerContext');
@@ -15,7 +15,9 @@ let min = 0;
15
15
  let max = 42;
16
16
  let step = 1;
17
17
  let slider;
18
- $: outputs = $worldStore?.outputsById[id];
18
+ let outputs = initOutput($worldStore, id, {
19
+ result: 0 || null
20
+ });
19
21
  let values = [outputs?.result.peak() ?? 0];
20
22
  $: values && handleValues();
21
23
  function handleValues() {
@@ -6,7 +6,6 @@ declare const __propDef: {
6
6
  id: string;
7
7
  configuration: Record<string, AppInput>;
8
8
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
9
- staticOutputs?: string[] | undefined;
10
9
  customCss?: ComponentCustomCSS<'handle' | 'limits' | 'value' | 'bar'> | undefined;
11
10
  render: boolean;
12
11
  };
@@ -19,6 +18,5 @@ export type AppSliderInputsProps = typeof __propDef.props;
19
18
  export type AppSliderInputsEvents = typeof __propDef.events;
20
19
  export type AppSliderInputsSlots = typeof __propDef.slots;
21
20
  export default class AppSliderInputs extends SvelteComponentTyped<AppSliderInputsProps, AppSliderInputsEvents, AppSliderInputsSlots> {
22
- get staticOutputs(): string[];
23
21
  }
24
22
  export {};
@@ -1,5 +1,6 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { twMerge } from 'tailwind-merge';
3
+ import { initOutput } from '../../editor/appUtils';
3
4
  import { concatCustomCss } from '../../utils';
4
5
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
5
6
  import InputValue from '../helpers/InputValue.svelte';
@@ -7,7 +8,6 @@ export let id;
7
8
  export let configuration;
8
9
  export let inputType = 'text';
9
10
  export let verticalAlignment = undefined;
10
- export const staticOutputs = ['result'];
11
11
  export let customCss = undefined;
12
12
  export let appCssKey = 'textinputcomponent';
13
13
  export let render;
@@ -15,9 +15,11 @@ const { app, worldStore, selectedComponent } = getContext('AppViewerContext');
15
15
  let placeholder = undefined;
16
16
  let defaultValue = undefined;
17
17
  let value = undefined;
18
- $: outputs = $worldStore?.outputsById[id];
18
+ let outputs = initOutput($worldStore, id, {
19
+ result: ''
20
+ });
19
21
  $: handleDefault(defaultValue);
20
- $: outputs?.result.set(value);
22
+ $: outputs?.result.set(value ?? '');
21
23
  function handleDefault(defaultValue) {
22
24
  value = defaultValue;
23
25
  }
@@ -7,7 +7,6 @@ declare const __propDef: {
7
7
  configuration: Record<string, AppInput>;
8
8
  inputType?: string | undefined;
9
9
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
10
- staticOutputs?: string[] | undefined;
11
10
  customCss?: ComponentCustomCSS<'input'> | undefined;
12
11
  appCssKey?: "textinputcomponent" | "passwordinputcomponent" | "emailinputcomponent" | undefined;
13
12
  render: boolean;
@@ -23,6 +22,5 @@ export type AppTextInputProps = typeof __propDef.props;
23
22
  export type AppTextInputEvents = typeof __propDef.events;
24
23
  export type AppTextInputSlots = typeof __propDef.slots;
25
24
  export default class AppTextInput extends SvelteComponentTyped<AppTextInputProps, AppTextInputEvents, AppTextInputSlots> {
26
- get staticOutputs(): string[];
27
25
  }
28
26
  export {};
@@ -1,4 +1,5 @@
1
- <script>import { getContext } from 'svelte';
1
+ <script>import { initOutput } from '../../../editor/appUtils';
2
+ import { getContext } from 'svelte';
2
3
  import { twMerge } from 'tailwind-merge';
3
4
  import { concatCustomCss } from '../../../utils';
4
5
  import AlignWrapper from '../../helpers/AlignWrapper.svelte';
@@ -7,10 +8,12 @@ import CurrencyInput from './CurrencyInput.svelte';
7
8
  export let id;
8
9
  export let configuration;
9
10
  export let verticalAlignment = undefined;
10
- export const staticOutputs = ['result'];
11
11
  export let customCss = undefined;
12
12
  export let render;
13
13
  const { app, worldStore } = getContext('AppViewerContext');
14
+ initOutput($worldStore, id, {
15
+ result: undefined
16
+ });
14
17
  let defaultValue = undefined;
15
18
  let isNegativeAllowed = undefined;
16
19
  let currency = undefined;
@@ -6,7 +6,6 @@ declare const __propDef: {
6
6
  id: string;
7
7
  configuration: Record<string, AppInput>;
8
8
  verticalAlignment?: 'top' | 'center' | 'bottom' | undefined;
9
- staticOutputs?: string[] | undefined;
10
9
  customCss?: ComponentCustomCSS<'input'> | undefined;
11
10
  render: boolean;
12
11
  };
@@ -19,6 +18,5 @@ export type AppCurrencyInputProps = typeof __propDef.props;
19
18
  export type AppCurrencyInputEvents = typeof __propDef.events;
20
19
  export type AppCurrencyInputSlots = typeof __propDef.slots;
21
20
  export default class AppCurrencyInput extends SvelteComponentTyped<AppCurrencyInputProps, AppCurrencyInputEvents, AppCurrencyInputSlots> {
22
- get staticOutputs(): string[];
23
21
  }
24
22
  export {};
@@ -6,7 +6,6 @@ export let configuration;
6
6
  export let componentContainerHeight;
7
7
  export let customCss = undefined;
8
8
  export let render;
9
- export const staticOutputs = [];
10
9
  const { app, focusedGrid, selectedComponent } = getContext('AppViewerContext');
11
10
  function onFocus() {
12
11
  $focusedGrid = {
@@ -8,7 +8,6 @@ declare const __propDef: {
8
8
  componentContainerHeight: number;
9
9
  customCss?: ComponentCustomCSS<'container'> | undefined;
10
10
  render: boolean;
11
- staticOutputs?: string[] | undefined;
12
11
  };
13
12
  events: {
14
13
  [evt: string]: CustomEvent<any>;
@@ -19,6 +18,5 @@ export type AppContainerProps = typeof __propDef.props;
19
18
  export type AppContainerEvents = typeof __propDef.events;
20
19
  export type AppContainerSlots = typeof __propDef.slots;
21
20
  export default class AppContainer extends SvelteComponentTyped<AppContainerProps, AppContainerEvents, AppContainerSlots> {
22
- get staticOutputs(): string[];
23
21
  }
24
22
  export {};
@@ -11,16 +11,13 @@ export let tabs;
11
11
  export let customCss = undefined;
12
12
  export let render;
13
13
  export let initializing = configuration.tabsKind != undefined;
14
- export const staticOutputs = ['selectedTabIndex'];
15
14
  const { app, worldStore, focusedGrid, selectedComponent, mode, componentControl } = getContext('AppViewerContext');
16
15
  let selected = tabs[0];
17
16
  let kind = undefined;
18
17
  let tabHeight = 0;
19
- $: outputs = $worldStore
20
- ? initOutput($worldStore, id, {
21
- selectedTabIndex: 0
22
- })
23
- : undefined;
18
+ let outputs = initOutput($worldStore, id, {
19
+ selectedTabIndex: 0
20
+ });
24
21
  function handleTabSelection() {
25
22
  const selectedIndex = tabs?.indexOf(selected);
26
23
  outputs?.selectedTabIndex.set(selectedIndex, true);
@@ -10,7 +10,6 @@ declare const __propDef: {
10
10
  customCss?: ComponentCustomCSS<'tabRow' | 'tabs' | 'selectedTab' | 'container'> | undefined;
11
11
  render: boolean;
12
12
  initializing?: boolean | undefined;
13
- staticOutputs?: string[] | undefined;
14
13
  };
15
14
  events: {
16
15
  pointerdown: PointerEvent;
@@ -23,6 +22,5 @@ export type AppTabsProps = typeof __propDef.props;
23
22
  export type AppTabsEvents = typeof __propDef.events;
24
23
  export type AppTabsSlots = typeof __propDef.slots;
25
24
  export default class AppTabs extends SvelteComponentTyped<AppTabsProps, AppTabsEvents, AppTabsSlots> {
26
- get staticOutputs(): string[];
27
25
  }
28
26
  export {};
@@ -25,7 +25,8 @@ export let resourceOnly = false;
25
25
  id={component.id}
26
26
  shouldCapitalize={false}
27
27
  bind:inputSpecs={component.componentInput.fields}
28
- userInputEnabled={component.type !== 'buttoncomponent'}
28
+ userInputEnabled={component.type === 'formcomponent' ||
29
+ component.type === 'formbuttoncomponent'}
29
30
  {resourceOnly}
30
31
  />
31
32
  {/if}
@@ -33,8 +33,6 @@ export let policy;
33
33
  export let summary;
34
34
  export let fromHub = false;
35
35
  const appStore = writable(app);
36
- const worldStore = writable(undefined);
37
- const staticOutputs = writable({});
38
36
  const selectedComponent = writable(undefined);
39
37
  const mode = writable(initialMode);
40
38
  const breakpoint = writable('lg');
@@ -49,9 +47,14 @@ const runnableComponents = writable({});
49
47
  const errorByComponent = writable({});
50
48
  const focusedGrid = writable(undefined);
51
49
  const pickVariableCallback = writable(undefined);
50
+ let context = {
51
+ email: $userStore?.email,
52
+ username: $userStore?.username,
53
+ query: Object.fromEntries($page.url.searchParams.entries()),
54
+ hash: $page.url.hash
55
+ };
52
56
  setContext('AppViewerContext', {
53
- worldStore,
54
- staticOutputs,
57
+ worldStore: buildWorld(context),
55
58
  app: appStore,
56
59
  summary: summaryStore,
57
60
  selectedComponent,
@@ -76,7 +79,8 @@ setContext('AppViewerContext', {
76
79
  });
77
80
  setContext('AppEditorContext', {
78
81
  history,
79
- pickVariableCallback
82
+ pickVariableCallback,
83
+ ontextfocus: writable(undefined)
80
84
  });
81
85
  let timeout = undefined;
82
86
  $: $appStore && saveDraft();
@@ -95,17 +99,10 @@ let mounted = false;
95
99
  onMount(() => {
96
100
  mounted = true;
97
101
  });
98
- let context = {
99
- email: $userStore?.email,
100
- username: $userStore?.username,
101
- query: Object.fromEntries($page.url.searchParams.entries()),
102
- hash: $page.url.hash
103
- };
104
102
  function hashchange(e) {
105
103
  context.hash = e.newURL.split('#')[1];
106
104
  context = context;
107
105
  }
108
- $: mounted && ($worldStore = buildWorld($staticOutputs, $worldStore, context));
109
106
  $: previewing = $mode === 'preview';
110
107
  $: width = $breakpoint === 'sm' ? 'min-w-[400px] max-w-[656px]' : 'min-w-[710px] w-full';
111
108
  let selectedTab = 'insert';
@@ -1,10 +1,15 @@
1
- <script>import { onMount, setContext } from 'svelte';
1
+ <script>import { setContext } from 'svelte';
2
2
  import { writable } from 'svelte/store';
3
3
  import { buildWorld } from '../rx';
4
- import GridEditor from './GridEditor.svelte';
5
4
  import { classNames } from '../../../utils';
6
5
  import Button from '../../common/button/Button.svelte';
7
6
  import { Unlock } from 'lucide-svelte';
7
+ import RecomputeAllComponents from './RecomputeAllComponents.svelte';
8
+ import GridViewer from './GridViewer.svelte';
9
+ import { Component } from './component';
10
+ import { twMerge } from 'tailwind-merge';
11
+ import { columnConfiguration } from '../gridUtils';
12
+ import { HiddenComponent } from '../components';
8
13
  export let app;
9
14
  export let appPath;
10
15
  export let breakpoint;
@@ -16,8 +21,6 @@ export let context;
16
21
  export let noBackend = false;
17
22
  export let isLocked = false;
18
23
  const appStore = writable(app);
19
- const worldStore = writable(undefined);
20
- const staticOutputs = writable({});
21
24
  const selectedComponent = writable(undefined);
22
25
  const mode = writable('preview');
23
26
  const connectingInput = writable({
@@ -26,9 +29,9 @@ const connectingInput = writable({
26
29
  hoveredComponent: undefined
27
30
  });
28
31
  const runnableComponents = writable({});
32
+ const parentWidth = writable(0);
29
33
  setContext('AppViewerContext', {
30
- worldStore,
31
- staticOutputs,
34
+ worldStore: buildWorld(context),
32
35
  app: appStore,
33
36
  summary: writable(summary),
34
37
  selectedComponent,
@@ -47,24 +50,20 @@ setContext('AppViewerContext', {
47
50
  openDebugRun: writable(undefined),
48
51
  focusedGrid: writable(undefined),
49
52
  stateId: writable(0),
50
- parentWidth: writable(0),
53
+ parentWidth,
51
54
  state: writable({}),
52
55
  componentControl: writable({})
53
56
  });
54
57
  setContext('AppEditorContext', {
55
58
  history: undefined,
56
- pickVariableCallback: writable(undefined)
57
- });
58
- let mounted = false;
59
- onMount(() => {
60
- mounted = true;
59
+ pickVariableCallback: writable(undefined),
60
+ ontextfocus: writable(undefined)
61
61
  });
62
62
  let ncontext = context;
63
63
  function hashchange(e) {
64
64
  ncontext.hash = e.newURL.split('#')[1];
65
65
  ncontext = ncontext;
66
66
  }
67
- $: mounted && ($worldStore = buildWorld($staticOutputs, $worldStore, ncontext));
68
67
  $: width = $breakpoint === 'sm' ? 'max-w-[640px]' : 'w-full ';
69
68
  $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-none' : '';
70
69
  </script>
@@ -80,9 +79,48 @@ $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-non
80
79
  >
81
80
  {#if $appStore.grid}
82
81
  <div class={classNames('mx-auto', width)}>
83
- <GridEditor {policy} />
82
+ <div
83
+ class="w-full sticky top-0 flex justify-between border-b bg-gray-50 px-4 py-1 items-center gap-4"
84
+ style="z-index: 1000;"
85
+ >
86
+ <h2 class="truncate">{summary}</h2>
87
+ <RecomputeAllComponents />
88
+ <div class="text-2xs text-gray-600">
89
+ {policy.on_behalf_of ? `on behalf of ${policy.on_behalf_of_email}` : ''}
90
+ </div>
91
+ </div>
84
92
  </div>
85
93
  {/if}
94
+ <div
95
+ style={app.css?.['app']?.['grid']?.style}
96
+ class={twMerge('px-4 pt-4 pb-2 overflow-visible', app.css?.['app']?.['grid']?.class ?? '')}
97
+ bind:clientWidth={$parentWidth}
98
+ >
99
+ <div>
100
+ <GridViewer
101
+ onTopId={$selectedComponent}
102
+ items={app.grid}
103
+ let:dataItem
104
+ rowHeight={36}
105
+ cols={columnConfiguration}
106
+ gap={[4, 2]}
107
+ >
108
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
109
+ <div
110
+ class={'h-full w-full center-center'}
111
+ on:pointerdown={() => ($selectedComponent = dataItem.data.id)}
112
+ >
113
+ <Component
114
+ render={true}
115
+ pointerdown={false}
116
+ component={dataItem.data}
117
+ selected={false}
118
+ locked={true}
119
+ />
120
+ </div>
121
+ </GridViewer>
122
+ </div>
123
+ </div>
86
124
  </div>
87
125
 
88
126
  {#if isLocked}
@@ -98,3 +136,17 @@ $: lockedClasses = isLocked ? '!max-h-[400px] overflow-hidden pointer-events-non
98
136
  </div>
99
137
  {/if}
100
138
  </div>
139
+
140
+ {#if app.hiddenInlineScripts}
141
+ {#each app.hiddenInlineScripts as script, index}
142
+ {#if script}
143
+ <HiddenComponent
144
+ id={`bg_${index}`}
145
+ inlineScript={script.inlineScript}
146
+ name={script.name}
147
+ fields={script.fields}
148
+ autoRefresh={script.autoRefresh ?? false}
149
+ />
150
+ {/if}
151
+ {/each}
152
+ {/if}
@@ -1,6 +1,6 @@
1
1
  <script>import { getContext, afterUpdate } from 'svelte';
2
2
  import { classNames } from '../../../utils';
3
- import { columnConfiguration, disableDrag, enableDrag, isFixed, toggleFixed } from '../gridUtils';
3
+ import { columnConfiguration, isFixed, toggleFixed } from '../gridUtils';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import RecomputeAllComponents from './RecomputeAllComponents.svelte';
6
6
  import HiddenComponent from '../components/helpers/HiddenComponent.svelte';
@@ -9,25 +9,9 @@ import { deepEqual } from 'fast-equals';
9
9
  import { push } from '../../../history';
10
10
  import { expandGriditem, findGridItem } from './appUtils';
11
11
  import Grid from '../svelte-grid/Grid.svelte';
12
- import { settableOutput } from '../rx';
13
12
  export let policy;
14
- const { selectedComponent, app, mode, connectingInput, staticOutputs, runnableComponents, summary, focusedGrid, parentWidth, breakpoint } = getContext('AppViewerContext');
13
+ const { selectedComponent, app, mode, connectingInput, runnableComponents, summary, focusedGrid, parentWidth, breakpoint } = getContext('AppViewerContext');
15
14
  const { history } = getContext('AppEditorContext');
16
- // The drag is disabled when the user is connecting an input
17
- // or when the user is previewing the app
18
- // or when the focused grid is a subgrid
19
- $: setAllDrags($mode === 'preview' || $connectingInput.opened);
20
- function setAllDrags(enable) {
21
- const fct = enable ? disableDrag : enableDrag;
22
- $app.grid.map((gridItem) => {
23
- const disabledGridItem = fct(gridItem);
24
- if (disabledGridItem?.data?.subGrids) {
25
- disabledGridItem.data.subGrids = disabledGridItem.data.subGrids.map((subgrid) => subgrid?.map((subgridItem) => fct(subgridItem)) ?? []);
26
- }
27
- return disabledGridItem;
28
- });
29
- Object.values($app.subgrids ?? {}).map((subgrid) => subgrid?.map((subgridItem) => fct(subgridItem)) ?? []);
30
- }
31
15
  function removeGridElement(component) {
32
16
  if (component) {
33
17
  $app.grid = $app.grid.filter((gridComponent) => {
@@ -48,20 +32,16 @@ function removeGridElement(component) {
48
32
  }
49
33
  return gridComponent.data.id !== component?.id;
50
34
  });
51
- // Delete static inputs
52
- delete $staticOutputs[component.id];
53
- $staticOutputs = $staticOutputs;
54
35
  delete $runnableComponents[component.id];
55
36
  $runnableComponents = $runnableComponents;
56
37
  $selectedComponent = undefined;
57
38
  }
58
39
  }
59
40
  function selectComponent(id) {
60
- // Component selection is handled manually in the Map component (pointerdown
61
- // event propagation is stopped to enable paning).
62
- // Update the 'selectComponent()' function as well when this is updated.
63
41
  if (!$connectingInput.opened) {
64
- $selectedComponent = id;
42
+ if ($selectedComponent !== id) {
43
+ $selectedComponent = id;
44
+ }
65
45
  $focusedGrid = undefined;
66
46
  }
67
47
  }
@@ -129,9 +109,9 @@ afterUpdate(() => {
129
109
  <div class={!$focusedGrid && $mode !== 'preview' ? 'border-gray-400 border border-dashed' : ''}>
130
110
  <Grid
131
111
  onTopId={$selectedComponent}
132
- fillSpace={false}
133
112
  items={$app.grid}
134
113
  on:redraw={(e) => {
114
+ push(history, $app)
135
115
  $app.grid = e.detail
136
116
  }}
137
117
  let:dataItem
@@ -199,7 +179,6 @@ afterUpdate(() => {
199
179
  name={script.name}
200
180
  fields={script.fields}
201
181
  autoRefresh={script.autoRefresh ?? false}
202
- bind:staticOutputs={$staticOutputs[`bg_${index}`]}
203
182
  />
204
183
  {/if}
205
184
  {/each}