windmill-components 1.34.0 → 1.35.42

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 (93) hide show
  1. package/components/AppConnect.svelte +1 -1
  2. package/components/ArgInput.svelte +2 -2
  3. package/components/ArgInput.svelte.d.ts +2 -2
  4. package/components/CenteredPage.svelte +2 -2
  5. package/components/Editor.svelte +7 -82
  6. package/components/Editor.svelte.d.ts +0 -2
  7. package/components/EditorBar.svelte +45 -39
  8. package/components/FlowBuilder.svelte +4 -4
  9. package/components/FlowJobResult.svelte +17 -18
  10. package/components/FlowModulesViewer.svelte +97 -0
  11. package/components/FlowModulesViewer.svelte.d.ts +17 -0
  12. package/components/FlowPreview.svelte +35 -34
  13. package/components/FlowPreviewContent.svelte +4 -1
  14. package/components/FlowStatusViewer.svelte +31 -49
  15. package/components/FlowViewer.svelte +60 -159
  16. package/components/FlowViewer.svelte.d.ts +0 -1
  17. package/components/IconedResourceType.svelte +3 -3
  18. package/components/InputTransformForm.svelte +2 -2
  19. package/components/ModuleStep.svelte +1 -1
  20. package/components/Multiselect.svelte +1 -1
  21. package/components/SchemaEditor.svelte +2 -2
  22. package/components/SchemaViewer.svelte +58 -68
  23. package/components/ScriptBuilder.svelte +118 -132
  24. package/components/ScriptEditor.svelte +115 -338
  25. package/components/ScriptEditor.svelte.d.ts +0 -2
  26. package/components/ScriptSchema.svelte +45 -44
  27. package/components/SharedBadge.svelte +1 -1
  28. package/components/SimpleEditor.svelte +143 -0
  29. package/components/SimpleEditor.svelte.d.ts +35 -0
  30. package/components/{Drawer.svelte → common/drawer/Drawer.svelte} +0 -0
  31. package/components/{Drawer.svelte.d.ts → common/drawer/Drawer.svelte.d.ts} +0 -0
  32. package/components/common/drawer/DrawerContent.svelte +19 -0
  33. package/components/common/drawer/DrawerContent.svelte.d.ts +20 -0
  34. package/components/common/menu/Menu.svelte +57 -0
  35. package/components/common/menu/Menu.svelte.d.ts +23 -0
  36. package/components/common/menu/MenuItem.svelte +9 -0
  37. package/components/common/menu/MenuItem.svelte.d.ts +27 -0
  38. package/components/common/tabs/Tab.svelte +17 -0
  39. package/components/{tabs → common/tabs}/Tab.svelte.d.ts +1 -2
  40. package/components/common/tabs/TabContent.svelte +12 -0
  41. package/components/common/tabs/TabContent.svelte.d.ts +19 -0
  42. package/components/common/tabs/Tabs.svelte +20 -0
  43. package/components/common/tabs/Tabs.svelte.d.ts +24 -0
  44. package/components/flows/FlowModuleHeader.svelte +1 -2
  45. package/components/flows/FlowSettings.svelte +41 -37
  46. package/components/flows/flowState.js +2 -2
  47. package/components/flows/flowStateUtils.js +7 -9
  48. package/components/flows/flowStore.js +24 -0
  49. package/components/flows/utils.d.ts +1 -1
  50. package/components/flows/utils.js +9 -9
  51. package/components/icons/GithubIcon.svelte +17 -0
  52. package/components/icons/GithubIcon.svelte.d.ts +17 -0
  53. package/components/jobs/JobDetail.svelte +176 -0
  54. package/components/jobs/JobDetail.svelte.d.ts +17 -0
  55. package/components/landing/FlowGettingStarted.svelte +95 -0
  56. package/components/landing/FlowGettingStarted.svelte.d.ts +19 -0
  57. package/components/landing/FlowLandingBox.svelte +69 -0
  58. package/components/landing/FlowLandingBox.svelte.d.ts +17 -0
  59. package/components/landing/RessourceGettingStarted.svelte +51 -0
  60. package/components/landing/RessourceGettingStarted.svelte.d.ts +19 -0
  61. package/components/landing/ScriptBox.svelte +81 -0
  62. package/components/landing/ScriptBox.svelte.d.ts +17 -0
  63. package/components/landing/ScriptGettingStarted.svelte +93 -0
  64. package/components/landing/ScriptGettingStarted.svelte.d.ts +19 -0
  65. package/components/script_editor/LogPanel.svelte +172 -0
  66. package/components/script_editor/LogPanel.svelte.d.ts +22 -0
  67. package/components/sidebar/MenuLink.svelte +49 -0
  68. package/components/sidebar/MenuLink.svelte.d.ts +21 -0
  69. package/components/sidebar/SidebarContent.svelte +55 -0
  70. package/components/sidebar/SidebarContent.svelte.d.ts +16 -0
  71. package/components/sidebar/UserMenu.svelte +62 -0
  72. package/components/sidebar/UserMenu.svelte.d.ts +16 -0
  73. package/components/sidebar/WorkspaceMenu.svelte +66 -0
  74. package/components/sidebar/WorkspaceMenu.svelte.d.ts +16 -0
  75. package/editorUtils.d.ts +25 -0
  76. package/editorUtils.js +43 -0
  77. package/gen/core/OpenAPI.js +1 -1
  78. package/gen/models/FlowModule.d.ts +5 -3
  79. package/gen/models/ForloopFlow.d.ts +2 -2
  80. package/gen/services/ScriptService.d.ts +4 -6
  81. package/gen/services/ScriptService.js +2 -2
  82. package/logout.js +1 -1
  83. package/package.json +33 -15
  84. package/script_helpers.js +1 -1
  85. package/stores.d.ts +0 -1
  86. package/stores.js +0 -1
  87. package/utils.d.ts +1 -0
  88. package/utils.js +4 -1
  89. package/components/tabs/Tab.svelte +0 -12
  90. package/components/tabs/TabPanel.svelte +0 -11
  91. package/components/tabs/TabPanel.svelte.d.ts +0 -20
  92. package/components/tabs/Tabs.svelte +0 -3
  93. package/components/tabs/Tabs.svelte.d.ts +0 -23
@@ -1,14 +1,12 @@
1
- <script>import { scriptPathToHref } from '../utils';
2
- import { Job, JobService } from '../gen';
3
- import { arePreviewsReady, workspaceStore } from '../stores';
1
+ <script>import { JobService } from '../gen';
2
+ import { workspaceStore } from '../stores';
4
3
  import FlowJobResult from './FlowJobResult.svelte';
5
- import IconedPath from './IconedPath.svelte';
6
4
  import FlowPreviewStatus from './preview/FlowPreviewStatus.svelte';
7
5
  import { Button } from 'flowbite-svelte';
8
6
  import Icon from 'svelte-awesome';
9
7
  import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
10
- import ProgressBar from './ProgressBar.svelte';
11
8
  import { createEventDispatcher } from 'svelte';
9
+ import { onDestroy } from 'svelte';
12
10
  const dispatch = createEventDispatcher();
13
11
  export let jobId;
14
12
  export let root = false;
@@ -19,20 +17,7 @@ export let jobResult = {
19
17
  loopJobs: []
20
18
  };
21
19
  let forloop_selected = '';
22
- let isReadyIndex = $arePreviewsReady.push(false);
23
- function shouldReset() {
24
- if (jobId != lastJobid) {
25
- lastJobid = jobId;
26
- jobResult = {
27
- job: undefined,
28
- innerJobs: [],
29
- loopJobs: []
30
- };
31
- loadJobInProgress();
32
- }
33
- }
34
- let lastJobid = jobId;
35
- $: jobId && shouldReset();
20
+ let timeout;
36
21
  async function loadJobInProgress() {
37
22
  const job = await JobService.getJob({
38
23
  workspace: $workspaceStore ?? '',
@@ -40,44 +25,41 @@ async function loadJobInProgress() {
40
25
  });
41
26
  jobResult.job = job;
42
27
  jobResult = jobResult;
43
- if (job.type === 'CompletedJob') {
44
- arePreviewsReady.update((isReady) => {
45
- isReady[isReadyIndex - 1] = true;
46
- return isReady;
47
- });
28
+ if (job?.type !== 'CompletedJob') {
29
+ timeout = setTimeout(() => loadJobInProgress(), 500);
48
30
  }
49
- else {
50
- setTimeout(() => loadJobInProgress(), 500);
31
+ else if (root) {
32
+ dispatch('jobsLoaded', jobResult);
51
33
  }
52
34
  }
53
- $: {
54
- if (root) {
55
- if ($arePreviewsReady.every(Boolean) && !(hasModules && $arePreviewsReady.length === 1)) {
56
- arePreviewsReady.update(() => []);
57
- dispatch('jobsLoaded', jobResult);
58
- }
35
+ $: hasModules =
36
+ jobResult.job &&
37
+ Array.isArray(jobResult.job?.raw_flow?.modules) &&
38
+ jobResult.job?.raw_flow?.modules.length > 1;
39
+ function updateJobId() {
40
+ if (jobId !== jobResult.job?.id) {
41
+ loadJobInProgress();
59
42
  }
60
43
  }
61
- $: job = jobResult.job;
62
- $: innerJobs = jobResult.innerJobs;
63
- $: loopJobs = jobResult.loopJobs;
64
- $: hasModules = job && Array.isArray(job?.raw_flow?.modules) && job?.raw_flow?.modules.length > 1;
65
- $: loadJobInProgress();
44
+ $: jobId && updateJobId();
45
+ onDestroy(() => {
46
+ timeout && clearTimeout(timeout);
47
+ });
66
48
  </script>
67
49
 
68
- {#if job}
50
+ {#if jobResult.job}
69
51
  <div class="flow-root w-full space-y-4">
70
52
  <h3 class="text-md leading-6 font-bold text-gray-900 border-b pb-2">Preview results</h3>
71
- <FlowPreviewStatus {job} />
72
- {#if `result` in job}
73
- <FlowJobResult {job} />
74
- {:else if job.logs}
53
+ <FlowPreviewStatus job={jobResult.job} />
54
+ {#if `result` in jobResult.job}
55
+ <FlowJobResult job={jobResult.job} />
56
+ {:else if jobResult.job.logs}
75
57
  <div class="text-xs p-4 bg-gray-50 overflow-auto max-h-80 border">
76
- <pre class="w-full">{job.logs}</pre>
58
+ <pre class="w-full">{jobResult.job.logs}</pre>
77
59
  </div>
78
60
  {/if}
79
61
 
80
- {#if Array.isArray(forloopJobIds) && forloopJobIds?.length > 0 && Array.isArray(loopJobs)}
62
+ {#if Array.isArray(forloopJobIds) && forloopJobIds?.length > 0 && Array.isArray(jobResult.loopJobs)}
81
63
  <h3 class="text-md leading-6 font-bold text-gray-900 border-b mb-4">
82
64
  Loop results ({forloopJobIds.length} items)
83
65
  </h3>
@@ -102,27 +84,27 @@ $: loadJobInProgress();
102
84
  />
103
85
  </Button>
104
86
  <div class="border p-6" class:hidden={forloop_selected != loopJobId}>
105
- <svelte:self jobId={loopJobId} bind:jobResult={loopJobs[j]} />
87
+ <svelte:self jobId={loopJobId} bind:jobResult={jobResult.loopJobs[j]} />
106
88
  </div>
107
89
  {/each}
108
- {:else if hasModules && Array.isArray(innerJobs)}
90
+ {:else if hasModules && Array.isArray(jobResult.innerJobs)}
109
91
  <ul class="w-full">
110
92
  <h3 class="text-md leading-6 font-bold text-gray-900 border-b mb-4 py-2">
111
93
  Detailed results
112
94
  </h3>
113
95
 
114
- {#each job?.flow_status?.modules ?? [] as module, i}
96
+ {#each jobResult.job?.flow_status?.modules ?? [] as module, i}
115
97
  <p class="text-gray-500 mb-6 w-full ">
116
98
  Step
117
99
  <span class="font-medium text-gray-900"> {i + 1} </span> out of
118
- <span class="font-medium text-gray-900">{job?.raw_flow?.modules.length}</span>
100
+ <span class="font-medium text-gray-900">{jobResult.job?.raw_flow?.modules.length}</span>
119
101
  </p>
120
102
 
121
103
  {#if ['InProgress', 'Success', 'Error'].includes(module.type)}
122
104
  <li class="w-full border p-6 space-y-2">
123
105
  <svelte:self
124
106
  jobId={module.job}
125
- bind:jobResult={innerJobs[i]}
107
+ bind:jobResult={jobResult.innerJobs[i]}
126
108
  forloopJobIds={module.forloop_jobs}
127
109
  />
128
110
  </li>
@@ -1,15 +1,12 @@
1
- <script>import { scriptPathToHref } from '../utils';
2
- import Highlight from 'svelte-highlight';
1
+ <script>import Highlight from 'svelte-highlight';
3
2
  import json from 'svelte-highlight/languages/json';
4
- import python from 'svelte-highlight/languages/python';
5
- import typescript from 'svelte-highlight/languages/typescript';
6
- import { slide } from 'svelte/transition';
7
- import Tabs from './Tabs.svelte';
3
+ import Tabs from './common/tabs/Tabs.svelte';
4
+ import Tab from './common/tabs/Tab.svelte';
5
+ import TabContent from './common/tabs/TabContent.svelte';
8
6
  import SchemaViewer from './SchemaViewer.svelte';
9
7
  import FieldHeader from './FieldHeader.svelte';
10
- import InputTransformsViewer from './InputTransformsViewer.svelte';
11
8
  import SvelteMarkdown from 'svelte-markdown';
12
- import IconedPath from './IconedPath.svelte';
9
+ import FlowModulesViewer from './FlowModulesViewer.svelte';
13
10
  export let flow;
14
11
  export let initialOpen = undefined;
15
12
  let flowFiltered = {
@@ -18,7 +15,6 @@ let flowFiltered = {
18
15
  value: flow.value,
19
16
  schema: flow.schema
20
17
  };
21
- export let embedded = false;
22
18
  export let tab = 'ui';
23
19
  let open = {};
24
20
  if (initialOpen) {
@@ -29,155 +25,60 @@ function toAny(x) {
29
25
  }
30
26
  </script>
31
27
 
32
- {#if !embedded}
33
- <Tabs
34
- tabs={[
35
- ['ui', 'Flow rendered'],
36
- ['json', 'JSON'],
37
- ['schema', 'Input schema of the flow']
38
- ]}
39
- bind:tab
40
- />
41
- {/if}
42
- {#if tab == 'ui'}
43
- <div class="flow-root w-full pb-4">
44
- {#if !embedded}
45
- <h2 class="my-4">{flow.summary}</h2>
46
- <SvelteMarkdown source={flow.description ?? ''} />
28
+ <Tabs bind:selected={tab}>
29
+ <Tab value="ui">Flow rendered</Tab>
30
+ <Tab value="json">Json</Tab>
31
+ <Tab value="schema">Input schema of the flow</Tab>
47
32
 
48
- <p class="font-black text-lg w-full my-4">
49
- <span>Inputs</span>
50
- </p>
51
- {#if flow.schema && flow.schema.properties && Object.keys(flow.schema.properties).length > 0 && flow.schema}
52
- <ul class="my-2">
53
- {#each Object.entries(flow.schema.properties) as [inp, v]}
54
- <li class="list-disc flex flex-row">
55
- <FieldHeader
56
- label={inp}
57
- required={flow.schema.required?.includes(inp)}
58
- type={toAny(v)?.type}
59
- contentEncoding={toAny(v)?.contentEncoding}
60
- format={toAny(v)?.format}
61
- itemsType={toAny(v)?.itemsType}
62
- /><span class="ml-4 mt-2 text-xs"
63
- >{toAny(v)?.default != undefined
64
- ? 'default: ' + JSON.stringify(toAny(v)?.default)
65
- : ''}</span
66
- >
67
- </li>
68
- {/each}
69
- </ul>
70
- {:else}
71
- <div class="text-gray-700 text-xs italic mb-4">No inputs</div>
72
- {/if}
73
- {/if}
33
+ <svelte:fragment slot="content">
34
+ <TabContent value="ui">
35
+ <div class="flow-root w-full pb-4">
36
+ <h2 class="my-4">{flow.summary}</h2>
37
+ <SvelteMarkdown source={flow.description ?? ''} />
74
38
 
75
- <p class="font-black text-lg my-6 w-full">
76
- <span>{flow?.value?.modules?.length} Step{flow?.value?.modules?.length > 1 ? 's' : ''} </span>
77
- <span class="mt-4" />
78
- </p>
79
- <ul class="-mb-8 w-full">
80
- {#each flow?.value?.modules ?? [] as mod, i}
81
- <li class="w-full">
82
- <div class="relative pb-8 w-full">
83
- {#if i < (flow?.value?.modules ?? []).length - 1}
84
- <span
85
- class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"
86
- aria-hidden="true"
87
- />
88
- {/if}
89
- <div class="relative flex space-x-3">
90
- <div>
91
- <span
92
- class="h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center ring-8 ring-white text-white"
93
- >{i + 1}
94
- </span>
95
- </div>
96
- <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
97
- <div class="w-full">
98
- <span class="text-black">{mod?.summary ?? ''}</span>
99
- <p class="text-sm text-gray-500">
100
- {#if mod?.value?.type == 'script'}
101
- Script at path <a
102
- target="_blank"
103
- href={scriptPathToHref(mod?.value?.path ?? '')}
104
- class="font-medium text-gray-900"
105
- >
106
- <IconedPath path={mod?.value?.path ?? ''} />
107
- </a>
108
- {#if mod?.value?.path?.startsWith('hub/')}
109
- <div>
110
- <button
111
- on:click={async () => {
112
- open[i] = !open[i]
113
- }}
114
- class="mb-2 underline text-black"
115
- >
116
- View code and inputs {open[i] ? '(-)' : '(+)'}</button
117
- >
118
- {#if open[i]}
119
- <div class="border border-black p-2 bg-gray-50 divide-y">
120
- <InputTransformsViewer inputTransforms={mod?.input_transform} />
121
- <div class="w-full h-full mt-6">
122
- <iframe
123
- style="height: 400px;"
124
- class="w-full h-full text-sm"
125
- title="embedded script from hub"
126
- frameborder="0"
127
- src="https://hub.windmill.dev/embed/script/{mod?.value?.path?.substring(
128
- 4
129
- )}"
130
- />
131
- </div>
132
- </div>
133
- {/if}
134
- </div>
135
- {/if}
136
- {:else if mod?.value?.type == 'rawscript'}
137
- <button
138
- on:click={() => (open[i] = !open[i])}
139
- class="mb-2 underline text-black"
140
- >
141
- Raw {mod?.value?.language} script {open[i] ? '(-)' : '(+)'}</button
142
- >
143
-
144
- {#if open[i]}
145
- <div transition:slide class="border border-black p-2 bg-gray-50 w-full">
146
- <InputTransformsViewer inputTransforms={mod?.input_transform} />
147
-
148
- <Highlight
149
- language={mod?.value?.language == 'deno' ? typescript : python}
150
- code={mod?.value?.content}
151
- />
152
- </div>
153
- {/if}
154
- {:else if mod?.value?.type == 'flow'}
155
- Flow at path {mod?.value?.path}
156
- {:else if mod?.value?.type == 'forloopflow'}
157
- For loop over all the elements of the list returned as a result of step {i}:
158
- <svelte:self flow={mod?.value} embedded={true} />
159
- {/if}
160
- </p>
161
- </div>
162
- </div>
163
- </div>
164
- </div>
165
- </li>
166
- {/each}
167
- </ul>
168
- </div>
169
- {:else if tab == 'json'}
170
- <div class="relative">
171
- <button
172
- on:click={async () => {
173
- await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
174
- }}
175
- class="absolute default-secondary-button-v2 bg-white/30 right-0 my-2 ml-4"
176
- >copy content</button
177
- >
178
- <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
179
- </div>
180
- {:else if tab == 'schema'}
181
- <div class="my-4" />
182
- <SchemaViewer schema={flow.schema} />
183
- {/if}
39
+ <p class="font-black text-lg w-full my-4">
40
+ <span>Inputs</span>
41
+ </p>
42
+ {#if flow.schema && flow.schema.properties && Object.keys(flow.schema.properties).length > 0 && flow.schema}
43
+ <ul class="my-2">
44
+ {#each Object.entries(flow.schema.properties) as [inp, v]}
45
+ <li class="list-disc flex flex-row">
46
+ <FieldHeader
47
+ label={inp}
48
+ required={flow.schema.required?.includes(inp)}
49
+ type={toAny(v)?.type}
50
+ contentEncoding={toAny(v)?.contentEncoding}
51
+ format={toAny(v)?.format}
52
+ itemsType={toAny(v)?.itemsType}
53
+ /><span class="ml-4 mt-2 text-xs"
54
+ >{toAny(v)?.default != undefined
55
+ ? 'default: ' + JSON.stringify(toAny(v)?.default)
56
+ : ''}</span
57
+ >
58
+ </li>
59
+ {/each}
60
+ </ul>
61
+ {:else}
62
+ <div class="text-gray-700 text-xs italic mb-4">No inputs</div>
63
+ {/if}
64
+ <FlowModulesViewer modules={flow?.value?.modules} />
65
+ </div>
66
+ </TabContent>
67
+ <TabContent value="json">
68
+ <div class="relative">
69
+ <button
70
+ on:click={async () => {
71
+ await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
72
+ }}
73
+ class="absolute default-secondary-button-v2 bg-white/30 right-0 my-2 ml-4"
74
+ >copy content</button
75
+ >
76
+ <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
77
+ </div>
78
+ </TabContent>
79
+ <TabContent value="schema">
80
+ <div class="my-4" />
81
+ <SchemaViewer schema={flow.schema} />
82
+ </TabContent>
83
+ </svelte:fragment>
84
+ </Tabs>
@@ -9,7 +9,6 @@ declare const __propDef: {
9
9
  schema?: any;
10
10
  };
11
11
  initialOpen?: number | undefined;
12
- embedded?: boolean | undefined;
13
12
  tab?: "json" | "schema" | "ui" | undefined;
14
13
  };
15
14
  events: {
@@ -1,11 +1,11 @@
1
- <script>import { faGithub } from '@fortawesome/free-brands-svg-icons';
2
- import Icon from 'svelte-awesome';
1
+ <script>import Icon from 'svelte-awesome';
3
2
  import AirtableIcon from './icons/AirtableIcon.svelte';
4
3
  import DbIcon from './icons/DbIcon.svelte';
5
4
  import DiscordIcon from './icons/DiscordIcon.svelte';
6
5
  import GcalIcon from './icons/GcalIcon.svelte';
7
6
  import GCloudIcon from './icons/GCloudIcon.svelte';
8
7
  import GdriveIcon from './icons/GdriveIcon.svelte';
8
+ import GithubIcon from './icons/GithubIcon.svelte';
9
9
  import GitlabIcon from './icons/GItlabIcon.svelte';
10
10
  import GmailIcon from './icons/GmailIcon.svelte';
11
11
  import GSheetsIcon from './icons/GSheetsIcon.svelte';
@@ -42,7 +42,7 @@ export let width = '24px';
42
42
  {:else if name === 'slack'}
43
43
  <Slack {height} {width} />
44
44
  {:else if name === 'github'}
45
- <Icon data={faGithub} scale={1.4} />
45
+ <GithubIcon />
46
46
  {:else if name === 'gmail'}
47
47
  <GmailIcon {height} {width} />
48
48
  {:else if name === 'gsheets'}
@@ -2,11 +2,11 @@
2
2
  import { Button, Tooltip } from 'flowbite-svelte';
3
3
  import Icon from 'svelte-awesome';
4
4
  import ArgInput from './ArgInput.svelte';
5
- import Editor from './Editor.svelte';
6
5
  import FieldHeader from './FieldHeader.svelte';
7
6
  import DynamicInputHelpBox from './flows/DynamicInputHelpBox.svelte';
8
7
  import { codeToStaticTemplate, getDefaultExpr, isCodeInjection } from './flows/utils';
9
8
  import OverlayPropertyPicker from './propertyPicker/OverlayPropertyPicker.svelte';
9
+ import SimpleEditor from './SimpleEditor.svelte';
10
10
  import Toggle from './Toggle.svelte';
11
11
  export let schema;
12
12
  export let arg;
@@ -188,7 +188,7 @@ $: checked = propertyType == 'javascript';
188
188
  }}
189
189
  >
190
190
  <div class="border rounded p-2 mt-2 border-gray-300">
191
- <Editor
191
+ <SimpleEditor
192
192
  bind:this={monacos[argName]}
193
193
  on:focus={() => focusProp(argName, true)}
194
194
  bind:code={arg.expr}
@@ -114,7 +114,7 @@ $: opened = $stepOpened === String(indexes.join('-'));
114
114
  inputTransform={true}
115
115
  importPath={String(indexes.join('-'))}
116
116
  bind:pickableProperties={stepPropPicker.pickableProperties}
117
- bind:args={mod.input_transform}
117
+ bind:args={mod.input_transforms}
118
118
  bind:extraLib={stepPropPicker.extraLib}
119
119
  />
120
120
  {/if}
@@ -82,7 +82,7 @@
82
82
  }
83
83
  }
84
84
 
85
- function handleBlur(e) {
85
+ function handleBlur() {
86
86
  optionsVisibility(false)
87
87
  }
88
88
 
@@ -3,9 +3,9 @@ import { faPen, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
3
3
  import { Button } from 'flowbite-svelte';
4
4
  import { createEventDispatcher } from 'svelte';
5
5
  import Icon from 'svelte-awesome';
6
- import Editor from './Editor.svelte';
7
6
  import SchemaEditorProperty from './SchemaEditorProperty.svelte';
8
7
  import SchemaModal, { DEFAULT_PROPERTY, schemaToModal } from './SchemaModal.svelte';
8
+ import SimpleEditor from './SimpleEditor.svelte';
9
9
  import TableCustom from './TableCustom.svelte';
10
10
  import Toggle from './Toggle.svelte';
11
11
  import Tooltip from './Tooltip.svelte';
@@ -208,7 +208,7 @@ function switchTab() {
208
208
  </div>
209
209
  {:else}
210
210
  <div class="border rounded mt-4 p-2">
211
- <Editor
211
+ <SimpleEditor
212
212
  on:change={() => {
213
213
  try {
214
214
  schema = JSON.parse(schemaString)
@@ -2,77 +2,67 @@
2
2
  import Highlight from 'svelte-highlight';
3
3
  import json from 'svelte-highlight/languages/json';
4
4
  import TableCustom from './TableCustom.svelte';
5
+ import Tab from './common/tabs/Tab.svelte';
6
+ import TabContent from './common/tabs/TabContent.svelte';
7
+ import Tabs from './common/tabs/Tabs.svelte';
5
8
  export let schema = emptySchema();
6
- let viewJsonSchema = false;
7
9
  </script>
8
10
 
9
11
  <div class="w-full">
10
- <div class="flex flex-col sm:flex-row text-base">
11
- <button
12
- class="text-xs sm:text-base py-1 px-6 block hover:text-blue-500 focus:outline-noneborder-gray-200 {viewJsonSchema
13
- ? 'text-gray-500 '
14
- : 'text-gray-700 font-semibold '}"
15
- on:click={() => (viewJsonSchema = false)}
16
- >
17
- arguments
18
- </button><button
19
- class="py-1 px-6 block hover:text-blue-500 focus:outline-none border-gray-200 {viewJsonSchema
20
- ? 'text-gray-700 font-semibold '
21
- : 'text-gray-500'}"
22
- on:click={() => (viewJsonSchema = true)}
23
- >
24
- advanced
25
- </button>
26
- </div>
27
- </div>
28
- <!--json schema or table view-->
29
- <div class="border-t py-1">
30
- <div class={viewJsonSchema ? 'hidden' : ''}>
31
- {#if schema && schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
32
- <div class="flex flex-row">
33
- <TableCustom>
34
- <tr slot="header-row" class="underline">
35
- <th>name</th>
36
- <th>type</th>
37
- <th>description</th>
38
- <th>default</th>
39
- <th>format</th>
40
- <th>required</th>
41
- </tr>
42
- <tbody slot="body">
43
- {#each Object.entries(schema.properties) as [name, property] (name)}
44
- <tr>
45
- <td>{name}</td>
46
- <td
47
- >{#if !property.type} any {:else} {property.type} {/if}</td
48
- >
49
- <td>{property.description}</td>
50
- <td
51
- >{property.default == '<function call>'
52
- ? '<function call>'
53
- : property.default
54
- ? JSON.stringify(property.default)
55
- : ''}</td
56
- >
57
- <td
58
- >{property.format ?? ''}
59
- {property.contentEncoding ? `(encoding: ${property.contentEncoding})` : ''}</td
60
- >
61
- <td
62
- >{#if schema.required.includes(name)}
63
- <span class="text-red-600 font-bold text-lg">*</span>
64
- {/if}</td
65
- >
12
+ <Tabs selected="arguments">
13
+ <Tab value="arguments">Arguments</Tab>
14
+ <Tab value="advanced">Advanced</Tab>
15
+ <svelte:fragment slot="content">
16
+ <TabContent value="arguments">
17
+ {#if schema && schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
18
+ <div class="flex flex-row">
19
+ <TableCustom>
20
+ <tr slot="header-row" class="underline">
21
+ <th>name</th>
22
+ <th>type</th>
23
+ <th>description</th>
24
+ <th>default</th>
25
+ <th>format</th>
26
+ <th>required</th>
66
27
  </tr>
67
- {/each}
68
- </tbody>
69
- </TableCustom>
70
- </div>
71
- {:else}
72
- <div class="text-gray-700 text-xs italic">This script has no arguments</div>
73
- {/if}
74
- </div>
75
- <div class={viewJsonSchema ? '' : 'hidden'}>
76
- <Highlight language={json} code={JSON.stringify(schema, null, 4)} />
77
- </div>
28
+ <tbody slot="body">
29
+ {#each Object.entries(schema.properties) as [name, property] (name)}
30
+ <tr>
31
+ <td>{name}</td>
32
+ <td
33
+ >{#if !property.type} any {:else} {property.type} {/if}</td
34
+ >
35
+ <td>{property.description}</td>
36
+ <td
37
+ >{property.default == '<function call>'
38
+ ? '<function call>'
39
+ : property.default
40
+ ? JSON.stringify(property.default)
41
+ : ''}</td
42
+ >
43
+ <td
44
+ >{property.format ?? ''}
45
+ {property.contentEncoding
46
+ ? `(encoding: ${property.contentEncoding})`
47
+ : ''}</td
48
+ >
49
+ <td
50
+ >{#if schema.required.includes(name)}
51
+ <span class="text-red-600 font-bold text-lg">*</span>
52
+ {/if}</td
53
+ >
54
+ </tr>
55
+ {/each}
56
+ </tbody>
57
+ </TableCustom>
58
+ </div>
59
+ {:else}
60
+ <div class="text-gray-700 text-xs italic">This script has no arguments</div>
61
+ {/if}
62
+ </TabContent>
63
+ <TabContent value="advanced">
64
+ <Highlight language={json} code={JSON.stringify(schema, null, 4)} />
65
+ </TabContent>
66
+ </svelte:fragment>
67
+ </Tabs>
78
68
  </div>