windmill-components 1.83.4 → 1.84.6

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.
@@ -1,6 +1,7 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
  import { getDocument } from 'pdfjs-dist';
4
+ import 'pdfjs-dist/build/pdf.worker.entry';
4
5
  import { concatCustomCss } from '../../utils';
5
6
  import InputValue from '../helpers/InputValue.svelte';
6
7
  import { throttle } from '../../../../utils';
@@ -1,4 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import 'pdfjs-dist/build/pdf.worker.entry';
2
3
  import type { ComponentCustomCSS, RichConfigurations } from '../../types';
3
4
  declare const __propDef: {
4
5
  props: {
@@ -104,6 +104,14 @@ function stripSchema(inputs, s) {
104
104
  });
105
105
  return schemaStripped;
106
106
  }
107
+ function generateNextFrontendJobId() {
108
+ const prefix = 'Frontend: ';
109
+ let nextJobNumber = 1;
110
+ while ($jobs.find((j) => j.job === `${prefix}#${nextJobNumber}`)) {
111
+ nextJobNumber++;
112
+ }
113
+ return `${prefix}#${nextJobNumber}`;
114
+ }
107
115
  async function executeComponent(noToast = false, inlineScriptOverride) {
108
116
  if (runnable?.type === 'runnableByName' && runnable.inlineScript?.language === 'frontend') {
109
117
  loading = true;
@@ -114,6 +122,14 @@ async function executeComponent(noToast = false, inlineScriptOverride) {
114
122
  }
115
123
  catch (e) {
116
124
  sendUserToast('Error running frontend script: ' + e.message, true);
125
+ // Manually add a fake job to the job list to show the error
126
+ const job = generateNextFrontendJobId();
127
+ const error = e.body ?? e.message;
128
+ $errorByComponent[job] = {
129
+ error,
130
+ componentId: id
131
+ };
132
+ $jobs = [{ job, component: id, error }, ...$jobs];
117
133
  }
118
134
  loading = false;
119
135
  return;
@@ -1,7 +1,7 @@
1
1
  <script>import { getContext } from 'svelte';
2
2
  import { twMerge } from 'tailwind-merge';
3
- import { initOutput } from '../../editor/appUtils';
4
- import { concatCustomCss, selectId } from '../../utils';
3
+ import { initOutput, selectId } from '../../editor/appUtils';
4
+ import { concatCustomCss } from '../../utils';
5
5
  import AlignWrapper from '../helpers/AlignWrapper.svelte';
6
6
  import InputValue from '../helpers/InputValue.svelte';
7
7
  export let id;
@@ -171,7 +171,10 @@ let selectedJobId = undefined;
171
171
  let testJobLoader;
172
172
  let job = undefined;
173
173
  let testIsLoading = false;
174
- $: selectedJobId && testJobLoader?.watchJob(selectedJobId);
174
+ $: selectedJobId && !selectedJobId?.includes('Frontend') && testJobLoader?.watchJob(selectedJobId);
175
+ $: if (selectedJobId?.includes('Frontend') && selectedJobId) {
176
+ job = undefined;
177
+ }
175
178
  $: hasErrors = Object.keys($errorByComponent).length > 0;
176
179
  let lock = false;
177
180
  function onKeyDown(event) {
@@ -290,7 +293,39 @@ function onKeyDown(event) {
290
293
  <div class="h-full w-full overflow-auto">
291
294
  {#if selectedJobId}
292
295
  {#if !job}
293
- <Skeleton layout={[[40]]} />
296
+ {@const jobResult = $jobs.find((j) => j.job == selectedJobId)}
297
+
298
+ {#if jobResult?.error !== undefined}
299
+ <Splitpanes horizontal class="grow border w-full">
300
+ <Pane size={50} minSize={10}>
301
+ <LogViewer
302
+ content={`Logs are avaiable in the browser console directly`}
303
+ isLoading={false}
304
+ />
305
+ </Pane>
306
+ <Pane size={50} minSize={10} class="text-sm text-gray-600">
307
+ <pre class="overflow-x-auto break-words relative h-full px-2">
308
+ <DisplayResult result={{ error: { name: 'Frontend execution error', message: jobResult.error } }} />
309
+ </pre>
310
+ </Pane>
311
+ </Splitpanes>
312
+ {:else if jobResult?.result !== undefined}
313
+ <Splitpanes horizontal class="grow border w-full">
314
+ <Pane size={50} minSize={10}>
315
+ <LogViewer
316
+ content={`Logs are avaiable in the browser console directly`}
317
+ isLoading={false}
318
+ />
319
+ </Pane>
320
+ <Pane size={50} minSize={10} class="text-sm text-gray-600">
321
+ <pre class="overflow-x-auto break-words relative h-full px-2">
322
+ <DisplayResult result={jobResult.result} />
323
+ </pre>
324
+ </Pane>
325
+ </Splitpanes>
326
+ {:else}
327
+ <Skeleton layout={[[40]]} />
328
+ {/if}
294
329
  {:else}
295
330
  <div class="flex flex-col h-full w-full gap-4 mb-4">
296
331
  {#if job?.['running']}
@@ -3,11 +3,10 @@ import { createEventDispatcher, getContext } from 'svelte';
3
3
  import { twMerge } from 'tailwind-merge';
4
4
  import { columnConfiguration, isFixed, toggleFixed } from '../gridUtils';
5
5
  import Component from './component/Component.svelte';
6
- import { expandGriditem, findGridItem } from './appUtils';
6
+ import { expandGriditem, findGridItem, selectId } from './appUtils';
7
7
  import { push } from '../../../history';
8
8
  import Grid from '../svelte-grid/Grid.svelte';
9
9
  import GridViewer from './GridViewer.svelte';
10
- import { selectId } from '../utils';
11
10
  import ComponentWrapper from './component/ComponentWrapper.svelte';
12
11
  export let containerHeight = undefined;
13
12
  export let containerWidth = undefined;
@@ -23,7 +22,6 @@ export let shouldHighlight = true;
23
22
  const dispatch = createEventDispatcher();
24
23
  const { app, connectingInput, selectedComponent, focusedGrid, mode, parentWidth, breakpoint, allIdsInPath } = getContext('AppViewerContext');
25
24
  const editorContext = getContext('AppEditorContext');
26
- const { manuallyOpened } = getContext('ContextPanel');
27
25
  $: highlight = id === $focusedGrid?.parentComponentId && shouldHighlight;
28
26
  const onpointerdown = (e) => {
29
27
  dispatch('focus');
@@ -3,7 +3,9 @@ import { components, type AppComponent, type BaseComponent } from './component';
3
3
  import type { Output, World } from '../rx';
4
4
  import type { FilledItem } from '../svelte-grid/types';
5
5
  import type { EvalAppInput, StaticAppInput } from '../inputType';
6
+ import { type Writable } from 'svelte/store';
6
7
  export declare function dfs(grid: GridItem[], id: string, subgrids: Record<string, GridItem[]>): string[] | undefined;
8
+ export declare function selectId(e: PointerEvent, id: string, selectedComponent: Writable<string[] | undefined>, app: App): void;
7
9
  export declare function findGridItemParentGrid(app: App, id: string): string | undefined;
8
10
  export declare function allsubIds(app: App, parentId: string): string[];
9
11
  export declare function findGridItem(app: App, id: string): GridItem | undefined;
@@ -3,6 +3,8 @@ import { ccomponents, components, getRecommendedDimensionsByComponent } from './
3
3
  import { gridColumns } from '../gridUtils';
4
4
  import { allItems } from '../utils';
5
5
  import gridHelp from '../svelte-grid/utils/helper';
6
+ import { get } from 'svelte/store';
7
+ import { sendUserToast } from '../../../utils';
6
8
  export function dfs(grid, id, subgrids) {
7
9
  for (const item of grid) {
8
10
  if (item.id === id) {
@@ -22,6 +24,33 @@ export function dfs(grid, id, subgrids) {
22
24
  }
23
25
  return undefined;
24
26
  }
27
+ export function selectId(e, id, selectedComponent, app) {
28
+ if (e.shiftKey) {
29
+ selectedComponent.update((old) => {
30
+ if (old && old?.[0]) {
31
+ if (findGridItemParentGrid(app, old[0]) != findGridItemParentGrid(app, id)) {
32
+ sendUserToast('Cannot multi select items from different grids', true);
33
+ return old;
34
+ }
35
+ }
36
+ if (old == undefined) {
37
+ return [id];
38
+ }
39
+ if (old.includes(id)) {
40
+ return old;
41
+ }
42
+ return [...old, id];
43
+ });
44
+ }
45
+ else {
46
+ if (get(selectedComponent)?.includes(id)) {
47
+ return;
48
+ }
49
+ else {
50
+ selectedComponent.set([id]);
51
+ }
52
+ }
53
+ }
25
54
  function findGridItemById(root, subGrids, id) {
26
55
  for (const gridItem of allItems(root, subGrids)) {
27
56
  if (gridItem.id === id) {
@@ -1,6 +1,5 @@
1
1
  <script>import { getContext } from 'svelte';
2
- import { selectId } from '../../utils';
3
- import { dfs } from '../appUtils';
2
+ import { dfs, selectId } from '../appUtils';
4
3
  export let id;
5
4
  export let type;
6
5
  const { app, connectingInput, selectedComponent, focusedGrid } = getContext('AppViewerContext');
@@ -108,6 +108,8 @@ export type AppViewerContext = {
108
108
  jobs: Writable<{
109
109
  job: string;
110
110
  component: string;
111
+ result?: string;
112
+ error?: string;
111
113
  }[]>;
112
114
  noBackend: boolean;
113
115
  errorByComponent: Writable<Record<string, {
@@ -2,8 +2,6 @@ import type { Schema } from '../../common';
2
2
  import type { App, ComponentCssProperty, GridItem } from './types';
3
3
  import type { AppInput, InputType, ResultAppInput, StaticAppInput } from './inputType';
4
4
  import type { Output } from './rx';
5
- import { type Writable } from 'svelte/store';
6
- export declare function selectId(e: PointerEvent, id: string, selectedComponent: Writable<string[] | undefined>, app: App): void;
7
5
  export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
8
6
  export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<Schema>;
9
7
  export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
@@ -2,35 +2,6 @@ import { FlowService, ScriptService } from '../../gen';
2
2
  import { inferArgs } from '../../infer';
3
3
  import { emptySchema, sendUserToast } from '../../utils';
4
4
  import { twMerge } from 'tailwind-merge';
5
- import { get } from 'svelte/store';
6
- import { findGridItemParentGrid } from './editor/appUtils';
7
- export function selectId(e, id, selectedComponent, app) {
8
- if (e.shiftKey) {
9
- selectedComponent.update((old) => {
10
- if (old && old?.[0]) {
11
- if (findGridItemParentGrid(app, old[0]) != findGridItemParentGrid(app, id)) {
12
- sendUserToast('Cannot multi select items from different grids', true);
13
- return old;
14
- }
15
- }
16
- if (old == undefined) {
17
- return [id];
18
- }
19
- if (old.includes(id)) {
20
- return old;
21
- }
22
- return [...old, id];
23
- });
24
- }
25
- else {
26
- if (get(selectedComponent)?.includes(id)) {
27
- return;
28
- }
29
- else {
30
- selectedComponent.set([id]);
31
- }
32
- }
33
- }
34
5
  export function allItems(grid, subgrids) {
35
6
  if (subgrids == undefined) {
36
7
  return grid;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.83.4",
3
+ "version": "1.84.6",
4
4
  "devDependencies": {
5
5
  "@playwright/test": "^1.31.1",
6
6
  "@sveltejs/adapter-static": "^1.0.0",
7
- "@sveltejs/kit": "1.15.0",
7
+ "@sveltejs/kit": "^1.0.0-next.589",
8
8
  "@sveltejs/package": "^1.0.2",
9
9
  "@tailwindcss/forms": "^0.5.3",
10
10
  "@tailwindcss/typography": "^0.5.8",
@@ -542,7 +542,6 @@
542
542
  "./components/icons/ZammadIcon.svelte": "./components/icons/ZammadIcon.svelte",
543
543
  "./components/icons": "./components/icons/index.js",
544
544
  "./components/jobs/JobDetail.svelte": "./components/jobs/JobDetail.svelte",
545
- "./components/path_store": "./components/path_store.js",
546
545
  "./components/preview/FlowPreviewStatus.svelte": "./components/preview/FlowPreviewStatus.svelte",
547
546
  "./components/progressBar/ProgressBar.svelte": "./components/progressBar/ProgressBar.svelte",
548
547
  "./components/progressBar/ProgressBarGeneralPart.svelte": "./components/progressBar/ProgressBarGeneralPart.svelte",
@@ -1 +0,0 @@
1
- export declare const x = 0;
@@ -1,2 +0,0 @@
1
- // export const usageStore = writable<>(0)
2
- export const x = 0;