windmill-components 1.60.2 → 1.60.4

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 (73) hide show
  1. package/components/AppConnect.svelte +4 -0
  2. package/components/ArgInput.svelte +0 -1
  3. package/components/ArgInput.svelte.d.ts +0 -2
  4. package/components/DisplayResult.svelte +9 -6
  5. package/components/FlowMetadata.svelte +19 -3
  6. package/components/FlowPreviewContent.svelte +15 -9
  7. package/components/FolderEditor.svelte +1 -1
  8. package/components/InputTransformForm.svelte +1 -2
  9. package/components/JobArgs.svelte +1 -1
  10. package/components/ModulePreview.svelte +2 -1
  11. package/components/Popover.model.d.ts +4 -0
  12. package/components/Popover.model.js +3 -0
  13. package/components/Popover.svelte +0 -2
  14. package/components/Popover.svelte.d.ts +2 -1
  15. package/components/ResourceEditor.svelte +11 -1
  16. package/components/ResourcePicker.svelte +10 -1
  17. package/components/RunForm.svelte +41 -37
  18. package/components/RunForm.svelte.d.ts +1 -0
  19. package/components/ScriptBuilder.svelte +3 -1
  20. package/components/ScriptEditor.svelte +1 -0
  21. package/components/TemplateEditor.svelte +14 -1
  22. package/components/TestJobLoader.svelte +1 -1
  23. package/components/Tooltip.svelte +8 -3
  24. package/components/Tooltip.svelte.d.ts +5 -0
  25. package/components/UserSettings.svelte +14 -25
  26. package/components/apps/components/buttons/AppButton.svelte +16 -0
  27. package/components/apps/components/dataDisplay/AppHtml.svelte +22 -14
  28. package/components/apps/components/dataDisplay/AppHtml.svelte.d.ts +0 -2
  29. package/components/apps/components/dataDisplay/VegaLiteHtml.svelte +53 -0
  30. package/components/apps/components/dataDisplay/VegaLiteHtml.svelte.d.ts +23 -0
  31. package/components/apps/components/helpers/InputValue.svelte +24 -5
  32. package/components/apps/components/helpers/InputValue.svelte.d.ts +1 -0
  33. package/components/apps/components/helpers/RunnableComponent.svelte +5 -2
  34. package/components/apps/components/selectInputs/AppSelect.svelte +11 -3
  35. package/components/apps/components/table/AppTable.svelte +16 -12
  36. package/components/apps/editor/AppEditor.svelte +7 -2
  37. package/components/apps/editor/AppPreview.svelte +26 -4
  38. package/components/apps/editor/AppPreview.svelte.d.ts +2 -0
  39. package/components/apps/editor/ComponentEditor.svelte +7 -0
  40. package/components/apps/editor/componentsPanel/ComponentList.svelte +2 -1
  41. package/components/apps/editor/componentsPanel/data.js +39 -0
  42. package/components/apps/editor/contextPanel/ContextPanel.svelte +3 -2
  43. package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +4 -1
  44. package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +8 -56
  45. package/components/apps/editor/inlineScriptsPanel/utils.d.ts +15 -0
  46. package/components/apps/editor/inlineScriptsPanel/utils.js +28 -0
  47. package/components/apps/editor/settingsPanel/ComponentPanel.svelte +9 -14
  48. package/components/apps/editor/settingsPanel/ComponentPanel.svelte.d.ts +0 -3
  49. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +6 -2
  50. package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +4 -2
  51. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +8 -7
  52. package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte.d.ts +1 -1
  53. package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
  54. package/components/apps/editor/settingsPanel/TableActions.svelte +7 -2
  55. package/components/apps/editor/settingsPanel/common/PanelSection.svelte +10 -1
  56. package/components/apps/editor/settingsPanel/common/PanelSection.svelte.d.ts +1 -0
  57. package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte +25 -0
  58. package/components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte.d.ts +19 -0
  59. package/components/apps/editorUtils.js +39 -0
  60. package/components/apps/inputType.d.ts +8 -1
  61. package/components/apps/types.d.ts +5 -3
  62. package/components/apps/utils.d.ts +2 -0
  63. package/components/apps/utils.js +15 -0
  64. package/components/common/button/Button.svelte +1 -1
  65. package/components/common/kbd/Kbd.svelte +6 -6
  66. package/components/common/table/Row.svelte +1 -1
  67. package/components/flows/content/CapturePayload.svelte +3 -3
  68. package/components/flows/content/FlowModuleComponent.svelte +4 -2
  69. package/components/flows/utils.js +1 -1
  70. package/components/propertyPicker/PropPicker.svelte +7 -1
  71. package/package.json +7 -3
  72. package/script_helpers.d.ts +3 -3
  73. package/script_helpers.js +18 -19
@@ -0,0 +1,28 @@
1
+ export function getAppScripts(grid) {
2
+ return grid.reduce((acc, gridComponent) => {
3
+ const component = gridComponent.data;
4
+ const componentInput = component.componentInput;
5
+ if (component.type === 'tablecomponent') {
6
+ component.actionButtons.forEach((actionButton) => {
7
+ if (actionButton.componentInput?.type !== 'runnable') {
8
+ return;
9
+ }
10
+ processRunnable(actionButton.componentInput.runnable, actionButton.id, acc);
11
+ });
12
+ }
13
+ if (componentInput?.type === 'runnable') {
14
+ processRunnable(componentInput.runnable, gridComponent.id, acc);
15
+ }
16
+ return acc;
17
+ }, { inline: [], imported: [] });
18
+ }
19
+ function processRunnable(runnable, id, list) {
20
+ if (runnable?.type === undefined) {
21
+ return;
22
+ }
23
+ const type = runnable.type === 'runnableByPath' ? 'imported' : 'inline';
24
+ list[type].push({
25
+ name: runnable[runnable.type === 'runnableByPath' ? 'path' : 'name'],
26
+ id
27
+ });
28
+ }
@@ -8,7 +8,7 @@ import StaticInputEditor from './inputEditor/StaticInputEditor.svelte';
8
8
  import ConnectedInputEditor from './inputEditor/ConnectedInputEditor.svelte';
9
9
  import Badge from '../../../common/badge/Badge.svelte';
10
10
  import { capitalize, classNames } from '../../../../utils';
11
- import { fieldTypeToTsType } from '../../utils';
11
+ import { buildExtraLib, fieldTypeToTsType } from '../../utils';
12
12
  import Recompute from './Recompute.svelte';
13
13
  import Tooltip from '../../../Tooltip.svelte';
14
14
  import ComponentInputTypeEditor from './ComponentInputTypeEditor.svelte';
@@ -54,20 +54,9 @@ function removeGridElement() {
54
54
  }
55
55
  }
56
56
  }
57
- export function buildExtraLib(components) {
58
- return Object.entries(components)
59
- .filter(([k, v]) => k != component?.id)
60
- .map(([k, v]) => [k, Object.fromEntries(Object.entries(v).map(([k, v]) => [k, v.peak()]))])
61
- .map(([k, v]) => `
62
-
63
- declare const ${k} = ${JSON.stringify(v)};
64
-
65
- `)
66
- .join('\n');
67
- }
68
57
  $: extraLib =
69
58
  component?.componentInput?.type === 'template' && $worldStore
70
- ? buildExtraLib($worldStore?.outputsById ?? {})
59
+ ? buildExtraLib($worldStore?.outputsById ?? {}, component?.id, false)
71
60
  : undefined;
72
61
  </script>
73
62
 
@@ -131,6 +120,7 @@ $: extraLib =
131
120
  </svelte:fragment>
132
121
 
133
122
  <InputsSpecsEditor
123
+ id={component.id}
134
124
  shouldCapitalize={false}
135
125
  bind:inputSpecs={component.componentInput.fields}
136
126
  userInputEnabled={component.type !== 'buttoncomponent'}
@@ -144,7 +134,12 @@ $: extraLib =
144
134
 
145
135
  {#if Object.values(component.configuration).length > 0}
146
136
  <PanelSection title={`Configuration (${Object.values(component.configuration).length})`}>
147
- <InputsSpecsEditor bind:inputSpecs={component.configuration} userInputEnabled={false} />
137
+ <InputsSpecsEditor
138
+ {rowColumns}
139
+ id={component.id}
140
+ bind:inputSpecs={component.configuration}
141
+ userInputEnabled={false}
142
+ />
148
143
  </PanelSection>
149
144
  {/if}
150
145
 
@@ -1,12 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import type { AppComponent } from '../../types';
3
- import type { Output } from '../../rx';
4
3
  declare const __propDef: {
5
4
  props: {
6
5
  component: AppComponent | undefined;
7
6
  onDelete?: (() => void) | undefined;
8
7
  rowColumns?: boolean | undefined;
9
- buildExtraLib?: ((components: Record<string, Record<string, Output<any>>>) => string) | undefined;
10
8
  };
11
9
  events: {
12
10
  [evt: string]: CustomEvent<any>;
@@ -17,6 +15,5 @@ export type ComponentPanelProps = typeof __propDef.props;
17
15
  export type ComponentPanelEvents = typeof __propDef.events;
18
16
  export type ComponentPanelSlots = typeof __propDef.slots;
19
17
  export default class ComponentPanel extends SvelteComponentTyped<ComponentPanelProps, ComponentPanelEvents, ComponentPanelSlots> {
20
- get buildExtraLib(): (components: Record<string, Record<string, Output<any>>>) => string;
21
18
  }
22
19
  export {};
@@ -1,8 +1,10 @@
1
- <script>import Toggle from '../../../Toggle.svelte';
2
- import ConnectedInputEditor from './inputEditor/ConnectedInputEditor.svelte';
1
+ <script>import ConnectedInputEditor from './inputEditor/ConnectedInputEditor.svelte';
2
+ import EvalInputEditor from './inputEditor/EvalInputEditor.svelte';
3
3
  import RowInputEditor from './inputEditor/RowInputEditor.svelte';
4
4
  import StaticInputEditor from './inputEditor/StaticInputEditor.svelte';
5
+ export let id;
5
6
  export let componentInput;
7
+ export let hasRows = false;
6
8
  </script>
7
9
 
8
10
  {#if componentInput.type === 'connected'}
@@ -11,6 +13,8 @@ export let componentInput;
11
13
  <RowInputEditor bind:componentInput />
12
14
  {:else if componentInput.type === 'static'}
13
15
  <StaticInputEditor bind:componentInput />
16
+ {:else if componentInput.type === 'eval'}
17
+ <EvalInputEditor {hasRows} {id} bind:componentInput />
14
18
  {:else if componentInput.type === 'user'}
15
19
  <span class="text-2xs italic text-gray-6f00">Field's value is set by the user</span>
16
20
  {/if}
@@ -1,8 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { ConnectedAppInput, RowAppInput, StaticAppInput, UserAppInput } from '../../inputType';
2
+ import type { ConnectedAppInput, EvalAppInput, RowAppInput, StaticAppInput, UserAppInput } from '../../inputType';
3
3
  declare const __propDef: {
4
4
  props: {
5
- componentInput: StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput;
5
+ id: string;
6
+ componentInput: StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput | EvalAppInput;
7
+ hasRows?: boolean | undefined;
6
8
  };
7
9
  events: {
8
10
  [evt: string]: CustomEvent<any>;
@@ -6,9 +6,9 @@ import InputsSpecEditor from './InputsSpecEditor.svelte';
6
6
  import { getContext } from 'svelte';
7
7
  import Tooltip from '../../../Tooltip.svelte';
8
8
  import Popover from '../../../Popover.svelte';
9
+ export let id;
9
10
  export let inputSpecs;
10
11
  export let userInputEnabled = true;
11
- export let staticOnly = false;
12
12
  export let shouldCapitalize = true;
13
13
  export let rowColumns = false;
14
14
  const { connectingInput } = getContext('AppEditorContext');
@@ -38,7 +38,7 @@ const { connectingInput } = getContext('AppEditorContext');
38
38
  : capitalize(fieldTypeToTsType(input.fieldType))}
39
39
  </Badge>
40
40
 
41
- {#if !inputSpecs[inputSpecKey].onlyStatic}
41
+ {#if !inputSpecs[inputSpecKey].onlyStatic && inputSpecs[inputSpecKey].type != 'eval'}
42
42
  <ToggleButtonGroup
43
43
  bind:selected={inputSpecs[inputSpecKey].type}
44
44
  on:selected={(e) => {
@@ -68,9 +68,8 @@ const { connectingInput } = getContext('AppEditorContext');
68
68
  value="row"
69
69
  startIcon={{ icon: faTableCells }}
70
70
  size="xs"
71
- disabled={staticOnly}
72
71
  >
73
- <Tooltip>
72
+ <Tooltip scale={0.6} placement="top-end" wrapperClass="center-center">
74
73
  Use the column name to have the value of the cell be passed to the action
75
74
  </Tooltip>
76
75
  </ToggleButton>
@@ -85,7 +84,6 @@ const { connectingInput } = getContext('AppEditorContext');
85
84
  startIcon={{ icon: faUser }}
86
85
  size="xs"
87
86
  iconOnly
88
- disabled={staticOnly}
89
87
  />
90
88
  <svelte:fragment slot="text">User Input</svelte:fragment>
91
89
  </Popover>
@@ -97,7 +95,6 @@ const { connectingInput } = getContext('AppEditorContext');
97
95
  startIcon={{ icon: faArrowRight }}
98
96
  size="xs"
99
97
  iconOnly
100
- disabled={staticOnly}
101
98
  />
102
99
  <svelte:fragment slot="text">Connect</svelte:fragment>
103
100
  </Popover>
@@ -106,7 +103,11 @@ const { connectingInput } = getContext('AppEditorContext');
106
103
  </div>
107
104
  </div>
108
105
 
109
- <InputsSpecEditor bind:componentInput={inputSpecs[inputSpecKey]} />
106
+ <InputsSpecEditor
107
+ hasRows={rowColumns}
108
+ {id}
109
+ bind:componentInput={inputSpecs[inputSpecKey]}
110
+ />
110
111
  </div>
111
112
  {/each}
112
113
  </div>
@@ -2,9 +2,9 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { BaseAppComponent } from '../../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
+ id: string;
5
6
  inputSpecs: BaseAppComponent['configuration'];
6
7
  userInputEnabled?: boolean | undefined;
7
- staticOnly?: boolean | undefined;
8
8
  shouldCapitalize?: boolean | undefined;
9
9
  rowColumns?: boolean | undefined;
10
10
  };
@@ -14,7 +14,7 @@ function onChange(event, id) {
14
14
  }
15
15
  </script>
16
16
 
17
- <PanelSection title="Recompute after this compute">
17
+ <PanelSection title="Recompute others" tooltip="Select components to recompute after running this script">
18
18
  {#if Object.keys($runnableComponents ?? {}).filter((id) => id !== ownId).length > 0}
19
19
  <table class="divide-y divide-gray-300 border w-full">
20
20
  <thead class="bg-gray-50">
@@ -11,7 +11,7 @@ export let components;
11
11
  export let id;
12
12
  const { selectedComponent, staticOutputs } = getContext('AppEditorContext');
13
13
  function addComponent() {
14
- const actionId = getNextId(components.map((x) => x.id.split('-')[1]));
14
+ const actionId = getNextId(components.map((x) => x.id.split('_')[1]));
15
15
  const newComponent = {
16
16
  id: `${id}_${actionId}`,
17
17
  type: 'buttoncomponent',
@@ -32,6 +32,11 @@ function addComponent() {
32
32
  type: 'static',
33
33
  value: 'xs',
34
34
  optionValuesKey: 'buttonSizeOptions'
35
+ },
36
+ disabled: {
37
+ fieldType: 'boolean',
38
+ type: 'eval',
39
+ expr: 'false'
35
40
  }
36
41
  },
37
42
  componentInput: {
@@ -72,7 +77,7 @@ function deleteComponent(cid) {
72
77
  {#each components as component}
73
78
  <div
74
79
  class={classNames(
75
- 'w-full text-xs font-bold gap-1 py-1.5 px-2 cursor-pointer transition-all justify-between flex items-center border border-gray-3 rounded-md',
80
+ 'w-full text-xs font-bold gap-1 truncate py-1.5 px-2 cursor-pointer transition-all justify-between flex items-center border border-gray-3 rounded-md',
76
81
  'bg-white border-gray-300 hover:bg-gray-100 focus:bg-gray-100 text-gray-700',
77
82
  $selectedComponent === component.id ? 'outline outline-blue-500 bg-red-400' : ''
78
83
  )}
@@ -1,8 +1,10 @@
1
1
  <script>import { classNames } from '../../../../../utils';
2
+ import Tooltip from '../../../../Tooltip.svelte';
2
3
  export let title;
3
4
  export let smallPadding = false;
4
5
  export let noPadding = false;
5
6
  export let titlePadding = '';
7
+ export let tooltip = '';
6
8
  </script>
7
9
 
8
10
  <div
@@ -13,7 +15,14 @@ export let titlePadding = '';
13
15
  )}
14
16
  >
15
17
  <div class="flex justify-between items-center w-full gap-1">
16
- <div class="text-sm font-extrabold {titlePadding}">{title}</div>
18
+ <div class="text-sm font-extrabold {titlePadding}">
19
+ {title}
20
+ {#if tooltip}
21
+ <Tooltip>
22
+ {tooltip}
23
+ </Tooltip>
24
+ {/if}
25
+ </div>
17
26
  <slot name="action" />
18
27
  </div>
19
28
  <slot />
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  smallPadding?: boolean | undefined;
7
7
  noPadding?: boolean | undefined;
8
8
  titlePadding?: string | undefined;
9
+ tooltip?: string | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1,25 @@
1
+ <script>import { getContext } from 'svelte';
2
+ import SimpleEditor from '../../../../SimpleEditor.svelte';
3
+ import { buildExtraLib } from '../../../utils';
4
+ export let componentInput;
5
+ export let id;
6
+ export let hasRows = false;
7
+ const { onchange, worldStore } = getContext('AppEditorContext');
8
+ $: componentInput && onchange?.();
9
+ $: extraLib =
10
+ componentInput?.expr && $worldStore
11
+ ? buildExtraLib($worldStore?.outputsById ?? {}, id, hasRows)
12
+ : undefined;
13
+ </script>
14
+
15
+ {#if componentInput?.type === 'eval'}
16
+ <div class="border border-gray-300 ">
17
+ <SimpleEditor
18
+ lang="javascript"
19
+ bind:code={componentInput.expr}
20
+ shouldBindKey={false}
21
+ {extraLib}
22
+ autoHeight
23
+ />
24
+ </div>
25
+ {/if}
@@ -0,0 +1,19 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { EvalAppInput } from '../../../inputType';
3
+ declare const __propDef: {
4
+ props: {
5
+ componentInput: EvalAppInput | undefined;
6
+ id: string;
7
+ hasRows?: boolean | undefined;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type EvalInputEditorProps = typeof __propDef.props;
15
+ export type EvalInputEditorEvents = typeof __propDef.events;
16
+ export type EvalInputEditorSlots = typeof __propDef.slots;
17
+ export default class EvalInputEditor extends SvelteComponentTyped<EvalInputEditorProps, EvalInputEditorEvents, EvalInputEditorSlots> {
18
+ }
19
+ export {};
@@ -94,6 +94,45 @@ const DEFAULT_CODES = {
94
94
  <h1 class="absolute top-4 left-2 text-white">
95
95
  Hello world
96
96
  </h1>'''`,
97
+ },
98
+ vegalitecomponent: {
99
+ deno: `
100
+ export async function main() {
101
+ return {
102
+ data: {
103
+ values: [
104
+ { a: "A", b: 28 },
105
+ { a: "B", b: 55 },
106
+ { a: "C", b: 43 },
107
+ { a: "D", b: 91 },
108
+ ],
109
+ },
110
+ mark: "bar",
111
+ encoding: {
112
+ x: { field: "a", type: "ordinal" },
113
+ y: { field: "b", type: "quantitative" },
114
+ },
115
+ };
116
+ }
117
+ `,
118
+ python3: `
119
+ def main():
120
+ return {
121
+ "data": {
122
+ "values": [
123
+ { "a": "A", "b": 28 },
124
+ { "a": "B", "b": 55 },
125
+ { "a": "C", "b": 43 },
126
+ { "a": "D", "b": 91 },
127
+ ],
128
+ },
129
+ "mark": "bar",
130
+ "encoding": {
131
+ "x": { "field": "a", "type": "ordinal" },
132
+ "y": { "field": "b", "type": "quantitative" },
133
+ },
134
+ }
135
+ `
97
136
  },
98
137
  piechartcomponent: {
99
138
  deno: `export async function main() {
@@ -13,6 +13,10 @@ export type UserInput<U> = {
13
13
  type: 'user';
14
14
  value: U | undefined;
15
15
  };
16
+ export type EvalInput = {
17
+ type: 'eval';
18
+ expr: string;
19
+ };
16
20
  export type RowInput = {
17
21
  type: 'row';
18
22
  column: string;
@@ -43,7 +47,7 @@ export type ResultInput = {
43
47
  type: 'runnable';
44
48
  value?: any;
45
49
  };
46
- type AppInputSpec<T extends InputType, U, V extends InputType = never> = (StaticInput<U> | ConnectedInput | UserInput<U> | RowInput | ResultInput | TemplateInput) & InputConfiguration<T, U, V>;
50
+ type AppInputSpec<T extends InputType, U, V extends InputType = never> = (StaticInput<U> | ConnectedInput | UserInput<U> | RowInput | EvalInput | ResultInput | TemplateInput) & InputConfiguration<T, U, V>;
47
51
  type InputConfiguration<T extends InputType, U, V extends InputType> = {
48
52
  fieldType: T;
49
53
  subFieldType?: V;
@@ -72,5 +76,8 @@ export type UserAppInput = Extract<AppInput, {
72
76
  export type ResultAppInput = Extract<AppInput, {
73
77
  type: 'runnable';
74
78
  }>;
79
+ export type EvalAppInput = Extract<AppInput, {
80
+ type: 'eval';
81
+ }>;
75
82
  export type AppInputs = Record<string, AppInput>;
76
83
  export {};
@@ -2,7 +2,7 @@ import type { Schema } from '../../common';
2
2
  import type { Preview } from '../../gen';
3
3
  import type { FilledItem } from 'svelte-grid';
4
4
  import type { Writable } from 'svelte/store';
5
- import type { AppInput, ConnectedAppInput, ConnectedInput, RowAppInput, StaticAppInput, UserAppInput } from './inputType';
5
+ import type { AppInput, ConnectedAppInput, ConnectedInput, EvalAppInput, RowAppInput, StaticAppInput, UserAppInput } from './inputType';
6
6
  import type { World } from './rx';
7
7
  type BaseComponent<T extends string> = {
8
8
  type: T;
@@ -14,6 +14,7 @@ export type DateInputComponent = BaseComponent<'dateinputcomponent'>;
14
14
  export type NumberInputComponent = BaseComponent<'numberinputcomponent'>;
15
15
  export type SliderComponent = BaseComponent<'slidercomponent'>;
16
16
  export type HtmlComponent = BaseComponent<'htmlcomponent'>;
17
+ export type VegaLiteComponent = BaseComponent<'vegalitecomponent'>;
17
18
  export type TimeseriesComponent = BaseComponent<'timeseriescomponent'>;
18
19
  export type ButtonComponent = BaseComponent<'buttoncomponent'> & {
19
20
  recomputeIds: string[] | undefined;
@@ -43,8 +44,9 @@ export type Aligned = {
43
44
  export interface BaseAppComponent extends Partial<Aligned> {
44
45
  id: ComponentID;
45
46
  componentInput: AppInput | undefined;
46
- configuration: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput) & {
47
+ configuration: Record<string, (StaticAppInput | ConnectedAppInput | UserAppInput | RowAppInput | EvalAppInput) & {
47
48
  onlyStatic?: boolean;
49
+ evaluatedValue?: boolean;
48
50
  tooltip?: string;
49
51
  }>;
50
52
  card: boolean | undefined;
@@ -55,7 +57,7 @@ export interface BaseAppComponent extends Partial<Aligned> {
55
57
  */
56
58
  softWrap?: boolean;
57
59
  }
58
- export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | SliderComponent | BarChartComponent | TimeseriesComponent | HtmlComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ScatterChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent);
60
+ export type AppComponent = BaseAppComponent & (RunFormComponent | DisplayComponent | TextInputComponent | PasswordInputComponent | DateInputComponent | NumberInputComponent | SliderComponent | BarChartComponent | TimeseriesComponent | HtmlComponent | TableComponent | TextComponent | TableComponent | ButtonComponent | PieChartComponent | ScatterChartComponent | ImageComponent | InputComponent | SelectComponent | CheckboxComponent | RadioComponent | FormComponent | VegaLiteComponent);
59
61
  export type ComponentSet = {
60
62
  title: string;
61
63
  components: AppComponent[];
@@ -1,5 +1,6 @@
1
1
  import type { Schema } from '../../common';
2
2
  import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
3
+ import type { Output } from './rx';
3
4
  import type { App, AppComponent } from './types';
4
5
  export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
5
6
  export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
@@ -16,3 +17,4 @@ export declare function toStatic(app: App, staticExporter: Record<string, () =>
16
17
  app: App;
17
18
  summary: string;
18
19
  };
20
+ export declare function buildExtraLib(components: Record<string, Record<string, Output<any>>>, idToExclude: string, hasRows: boolean): string;
@@ -72,6 +72,10 @@ export const displayData = {
72
72
  name: 'Html',
73
73
  icon: Code2
74
74
  },
75
+ vegalitecomponent: {
76
+ name: 'Vega Lite',
77
+ icon: PieChart
78
+ },
75
79
  timeseriescomponent: {
76
80
  name: 'Timeseries',
77
81
  icon: GripHorizontal
@@ -198,3 +202,14 @@ export function toStatic(app, staticExporter, summary) {
198
202
  });
199
203
  return { app: newApp, summary };
200
204
  }
205
+ export function buildExtraLib(components, idToExclude, hasRows) {
206
+ return Object.entries(components)
207
+ .filter(([k, v]) => k != idToExclude)
208
+ .map(([k, v]) => [k, Object.fromEntries(Object.entries(v).map(([k, v]) => [k, v.peak()]))])
209
+ .map(([k, v]) => `
210
+
211
+ declare const ${k} = ${JSON.stringify(v)};
212
+
213
+ `)
214
+ .join('\n') + (hasRows ? 'declare const row: Record<string, any>;' : '');
215
+ }
@@ -51,7 +51,7 @@ const colorVariants = {
51
51
  };
52
52
  $: buttonProps = {
53
53
  id,
54
- class: classNames(colorVariants[color][variant], variant === 'border' ? 'border' : '', ButtonType.FontSizeClasses[size], ButtonType.SpacingClasses[spacingSize], 'focus:ring-2 font-semibold', 'duration-200 rounded-md', 'justify-center items-center text-center whitespace-nowrap inline-flex', btnClasses, disabled ? 'bg-gray-300' : ''),
54
+ class: classNames(colorVariants?.[color]?.[variant], variant === 'border' ? 'border' : '', ButtonType.FontSizeClasses[size], ButtonType.SpacingClasses[spacingSize], 'focus:ring-2 font-semibold', 'duration-200 rounded-md', 'justify-center items-center text-center whitespace-nowrap inline-flex', btnClasses, disabled ? '!bg-gray-300 !text-gray-600 !cursor-not-allowed' : ''),
55
55
  href,
56
56
  target,
57
57
  tabindex: disabled ? -1 : 0,
@@ -1,7 +1,7 @@
1
- <kbd
2
- class="mx-1 px-2 py-1 text-xs font-mono font-semibold text-gray-800
3
- bg-gray-100 border border-gray-200 rounded-lg
4
- dark:bg-gray-600 dark:text-gray-100 dark:border-gray-500 {$$props.class}"
1
+ <span
2
+ class="{$$props.class} rounded border bg-white/70 px-1.5 !text-xs text-gray-600 shadow-sm font-light transition-all group-hover:border-primary-500 group-hover:text-primary-500"
5
3
  >
6
- <slot />
7
- </kbd>
4
+ <kbd>
5
+ <slot />
6
+ </kbd>
7
+ </span>
@@ -36,7 +36,7 @@ first-of-type:rounded-t-md last-of-type:rounded-b-md {color}"
36
36
  </div>
37
37
  </a>
38
38
  {#if $$slots.badges}
39
- <div class="w-32 hidden md:flex flex-row gap-1 items-start flex-wrap">
39
+ <div class="hidden md:flex flex-row gap-1 items-start flex-wrap">
40
40
  <slot name="badges" />
41
41
  </div>
42
42
  {/if}
@@ -106,11 +106,11 @@ async function getCaptureInput() {
106
106
  Copy as flow inputs and test args
107
107
  </Button>
108
108
  </svelte:fragment>
109
- <h3 class="mt-2">Derived inputs schema</h3>
109
+ <h3 class="my-2 mt-8">Derived schema</h3>
110
110
  <div class="box p-2">
111
111
  <SchemaViewer schema={jsonSchema} />
112
112
  </div>
113
- <h3 class="mt-2">Test args</h3>
114
- <SchemaForm class="h-full pt-4" schema={$flowStore.schema} args={$previewArgs} />
113
+ <h3 class="mt-8">Test args</h3>
114
+ <SchemaForm class="pt-4" schema={$flowStore.schema} args={$previewArgs} />
115
115
  </DrawerContent>
116
116
  </Drawer>
@@ -90,6 +90,8 @@ afterUpdate(() => {
90
90
  const panesTop = panes.getBoundingClientRect().top;
91
91
  totalTopGap = panesTop - wrapperTop;
92
92
  });
93
+ let isScript = true;
94
+ $: isScript != (value.type === 'script') && (isScript = value.type === 'script');
93
95
  </script>
94
96
 
95
97
  <svelte:window on:keydown={onKeyDown} />
@@ -139,7 +141,7 @@ afterUpdate(() => {
139
141
  style="max-height: calc(100% - {totalTopGap}px) !important;"
140
142
  >
141
143
  <Splitpanes horizontal>
142
- <Pane size={value.type === 'script' ? 30 : 50} minSize={20}>
144
+ <Pane size={isScript ? 30 : 50} minSize={20}>
143
145
  {#if value.type === 'rawscript'}
144
146
  <div class="h-full">
145
147
  <Editor
@@ -173,7 +175,7 @@ afterUpdate(() => {
173
175
  <FlowPathViewer path={value.path} />
174
176
  {/if}
175
177
  </Pane>
176
- <Pane size={value.type === 'script' ? 70 : 50} minSize={20}>
178
+ <Pane size={isScript ? 70 : 50} minSize={20}>
177
179
  <Tabs bind:selected>
178
180
  <Tab value="inputs"><span class="font-semibold">Step Input</span></Tab>
179
181
  <Tab value="test"><span class="font-semibold text-md">Test this step</span></Tab>
@@ -71,7 +71,7 @@ export async function loadSchemaFromModule(module) {
71
71
  let input_transforms = mod.input_transforms ?? module.input_transforms ?? {};
72
72
  if (JSON.stringify(keys.sort()) !== JSON.stringify(Object.keys(input_transforms).sort())) {
73
73
  input_transforms = keys.reduce((accu, key) => {
74
- let nv = input_transforms[key] ?? {
74
+ let nv = input_transforms[key] ?? (module.id == 'failure' && ['message', 'name'].includes(key)) ? { type: 'javascript', expr: `error.${key}` } : {
75
75
  type: 'static',
76
76
  value: undefined
77
77
  };
@@ -80,7 +80,13 @@ async function loadResources() {
80
80
  <div class="overflow-y-auto mb-2">
81
81
  <ObjectViewer
82
82
  pureViewer={!$propPickerConfig}
83
- json={{ previous_result: { error: 'The error to handle' } }}
83
+ json={{
84
+ error: {
85
+ message: 'The error message',
86
+ name: 'The error name',
87
+ stack: 'The error stack'
88
+ }
89
+ }}
84
90
  on:select
85
91
  />
86
92
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.60.2",
3
+ "version": "1.60.4",
4
4
  "devDependencies": {
5
5
  "@playwright/test": "^1.29.2",
6
6
  "@sveltejs/adapter-static": "^1.0.0",
@@ -25,7 +25,7 @@
25
25
  "path-browserify": "^1.0.1",
26
26
  "postcss": "^8.4.18",
27
27
  "postcss-load-config": "^4.0.1",
28
- "prettier": "^2.8.1",
28
+ "prettier": "^2.8.3",
29
29
  "prettier-plugin-svelte": "^2.9.0",
30
30
  "simple-svelte-autocomplete": "^2.5.1",
31
31
  "stylelint-config-recommended": "^9.0.0",
@@ -52,7 +52,7 @@
52
52
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
53
53
  "@leeoniya/ufuzzy": "^0.9.0",
54
54
  "@redocly/json-to-json-schema": "^0.0.1",
55
- "@tanstack/svelte-table": "^8.7.2",
55
+ "@tanstack/svelte-table": "^8.7.6",
56
56
  "async-mutex": "^0.4.0",
57
57
  "chartjs-adapter-date-fns": "^2.0.0",
58
58
  "chartjs-plugin-zoom": "^2.0.0",
@@ -125,6 +125,7 @@
125
125
  "./components/PageHeader.svelte": "./components/PageHeader.svelte",
126
126
  "./components/Password.svelte": "./components/Password.svelte",
127
127
  "./components/Path.svelte": "./components/Path.svelte",
128
+ "./components/Popover.model": "./components/Popover.model.js",
128
129
  "./components/Popover.svelte": "./components/Popover.svelte",
129
130
  "./components/RadioButton.svelte": "./components/RadioButton.svelte",
130
131
  "./components/Range.svelte": "./components/Range.svelte",
@@ -168,6 +169,7 @@
168
169
  "./components/apps/components/dataDisplay/AppScatterChart.svelte": "./components/apps/components/dataDisplay/AppScatterChart.svelte",
169
170
  "./components/apps/components/dataDisplay/AppText.svelte": "./components/apps/components/dataDisplay/AppText.svelte",
170
171
  "./components/apps/components/dataDisplay/AppTimeseries.svelte": "./components/apps/components/dataDisplay/AppTimeseries.svelte",
172
+ "./components/apps/components/dataDisplay/VegaLiteHtml.svelte": "./components/apps/components/dataDisplay/VegaLiteHtml.svelte",
171
173
  "./components/apps/components/dateInputs/AppDateInput.svelte": "./components/apps/components/dateInputs/AppDateInput.svelte",
172
174
  "./components/apps/components/form/AppForm.svelte": "./components/apps/components/form/AppForm.svelte",
173
175
  "./components/apps/components/helpers/AlignWrapper.svelte": "./components/apps/components/helpers/AlignWrapper.svelte",
@@ -209,6 +211,7 @@
209
211
  "./components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte": "./components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte",
210
212
  "./components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte": "./components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte",
211
213
  "./components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte": "./components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte",
214
+ "./components/apps/editor/inlineScriptsPanel/utils": "./components/apps/editor/inlineScriptsPanel/utils.js",
212
215
  "./components/apps/editor/settingsPanel/AlignmentEditor.svelte": "./components/apps/editor/settingsPanel/AlignmentEditor.svelte",
213
216
  "./components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte": "./components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte",
214
217
  "./components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte": "./components/apps/editor/settingsPanel/ComponentInputTypeEditor.svelte",
@@ -224,6 +227,7 @@
224
227
  "./components/apps/editor/settingsPanel/TableActions.svelte": "./components/apps/editor/settingsPanel/TableActions.svelte",
225
228
  "./components/apps/editor/settingsPanel/common/PanelSection.svelte": "./components/apps/editor/settingsPanel/common/PanelSection.svelte",
226
229
  "./components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte": "./components/apps/editor/settingsPanel/inputEditor/ConnectedInputEditor.svelte",
230
+ "./components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte": "./components/apps/editor/settingsPanel/inputEditor/EvalInputEditor.svelte",
227
231
  "./components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte": "./components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte",
228
232
  "./components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte": "./components/apps/editor/settingsPanel/inputEditor/RowInputEditor.svelte",
229
233
  "./components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte": "./components/apps/editor/settingsPanel/inputEditor/RunnableInputEditor.svelte",