windmill-components 1.83.0 → 1.83.2
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.
- package/components/ArgInput.svelte +35 -27
- package/components/DisplayResult.svelte +10 -1
- package/components/DisplayResult.svelte.d.ts +1 -0
- package/components/FlowGraphViewer.svelte +4 -20
- package/components/FlowJobResult.svelte +2 -1
- package/components/FlowJobResult.svelte.d.ts +1 -0
- package/components/FlowStatusViewer.svelte +1 -0
- package/components/Range.svelte.d.ts +2 -2
- package/components/RunForm.svelte +6 -2
- package/components/ScriptBuilder.svelte +6 -4
- package/components/ScriptBuilder.svelte.d.ts +1 -0
- package/components/TemplateEditor.svelte.d.ts +205 -0
- package/components/apps/components/display/PlotlyHtml.svelte +26 -13
- package/components/apps/components/display/table/AppAggridTable.svelte +29 -17
- package/components/apps/components/display/table/AppTable.svelte +17 -4
- package/components/apps/components/display/table/AppTableFooter.svelte +2 -2
- package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +1 -1
- package/components/apps/components/inputs/AppMultiSelect.svelte +3 -1
- package/components/apps/components/inputs/AppSelect.svelte +3 -1
- package/components/apps/components/layout/AppContainer.svelte +4 -2
- package/components/apps/components/layout/AppDrawer.svelte +33 -13
- package/components/apps/components/layout/AppSplitpanes.svelte +7 -6
- package/components/apps/components/layout/AppTabs.svelte +6 -3
- package/components/apps/editor/AppEditor.svelte +25 -37
- package/components/apps/editor/ComponentHeader.svelte +5 -2
- package/components/apps/editor/ComponentHeader.svelte.d.ts +1 -0
- package/components/apps/editor/ConnectionInstructions.svelte +29 -0
- package/components/apps/editor/ConnectionInstructions.svelte.d.ts +14 -0
- package/components/apps/editor/GridEditor.svelte +6 -28
- package/components/apps/editor/SubGridEditor.svelte +7 -19
- package/components/apps/editor/component/Component.svelte +7 -4
- package/components/apps/editor/component/ComponentWrapper.svelte +59 -0
- package/components/apps/editor/component/ComponentWrapper.svelte.d.ts +20 -0
- package/components/apps/editor/component/components.d.ts +32 -19
- package/components/apps/editor/component/components.js +28 -14
- package/components/apps/editor/componentsPanel/CssProperty.svelte +13 -8
- package/components/apps/editor/componentsPanel/CssProperty.svelte.d.ts +4 -2
- package/components/apps/editor/componentsPanel/ListItem.svelte +14 -4
- package/components/apps/editor/componentsPanel/ListItem.svelte.d.ts +5 -0
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte +62 -21
- package/components/apps/editor/componentsPanel/QuickStyleMenu.svelte.d.ts +5 -2
- package/components/apps/editor/componentsPanel/QuickStyleProperty.svelte +1 -0
- package/components/apps/editor/componentsPanel/quickStyleProperties.d.ts +29 -503
- package/components/apps/editor/componentsPanel/quickStyleProperties.js +97 -98
- package/components/apps/editor/componentsPanel/store.d.ts +1 -0
- package/components/apps/editor/componentsPanel/store.js +1 -0
- package/components/apps/editor/contextPanel/ContextPanel.svelte +11 -10
- package/components/apps/editor/contextPanel/components/OutputHeader.svelte +13 -4
- package/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +78 -43
- package/components/apps/editor/settingsPanel/InputsSpecsEditor.svelte +1 -1
- package/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +17 -3
- package/components/apps/editor/settingsPanel/StylePanel.svelte +2 -0
- package/components/apps/editor/settingsPanel/inputEditor/ColorInput.svelte +1 -1
- package/components/apps/editor/settingsPanel/secondaryMenu/SecondaryMenu.svelte +2 -2
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.d.ts +2 -1
- package/components/apps/editor/settingsPanel/secondaryMenu/menuStore.js +9 -3
- package/components/common/button/Button.svelte.d.ts +1 -1
- package/components/common/button/ButtonPopup.svelte.d.ts +1 -1
- package/components/flows/content/FlowLoop.svelte +26 -14
- package/components/flows/flowStore.js +4 -40
- package/components/flows/utils.js +16 -22
- package/components/propertyPicker/ObjectViewer.svelte +12 -4
- package/infer.js +2 -0
- package/init_scripts/python_failure_module.d.ts +2 -0
- package/init_scripts/{python_failure_module.py → python_failure_module.js} +2 -2
- package/init_scripts/python_init_code.d.ts +2 -0
- package/init_scripts/{python_init_code.py → python_init_code.js} +3 -3
- package/init_scripts/python_init_code_clear.d.ts +2 -0
- package/init_scripts/python_init_code_clear.js +5 -0
- package/init_scripts/python_init_code_trigger.d.ts +2 -0
- package/init_scripts/{python_init_code_trigger.py → python_init_code_trigger.js} +2 -2
- package/package.json +673 -671
- package/script_helpers.d.ts +5 -5
- package/script_helpers.js +15 -5
- package/stores.d.ts +4 -3
- package/stores.js +23 -19
- package/utils.d.ts +1 -0
- package/utils.js +8 -0
- package/init_scripts/python_init_code_clear.py +0 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { selectId } from '../../utils';
|
|
3
|
+
import { dfs } from '../appUtils';
|
|
4
|
+
export let id;
|
|
5
|
+
export let type;
|
|
6
|
+
const { app, connectingInput, selectedComponent, focusedGrid } = getContext('AppViewerContext');
|
|
7
|
+
const { manuallyOpened } = getContext('ContextPanel');
|
|
8
|
+
function selectComponent(e, id) {
|
|
9
|
+
if (!$connectingInput.opened) {
|
|
10
|
+
selectId(e, id, selectedComponent, $app);
|
|
11
|
+
if ($focusedGrid?.parentComponentId != id) {
|
|
12
|
+
$focusedGrid = undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// Prevent interaction with the component when connecting an input
|
|
17
|
+
// We let the event bubble up if the component is a container, so we can select a tab for example
|
|
18
|
+
function preventInteraction(event, isContainer = false) {
|
|
19
|
+
if ($connectingInput.opened && !isContainer) {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function onPointerDown(e) {
|
|
24
|
+
if (!$connectingInput.opened) {
|
|
25
|
+
selectComponent(e, id);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const allIdsInPath = dfs($app.grid, id, $app.subgrids ?? {}) ?? [];
|
|
29
|
+
allIdsInPath.forEach((id) => {
|
|
30
|
+
$manuallyOpened[id] = true;
|
|
31
|
+
});
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
38
|
+
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
|
39
|
+
<div
|
|
40
|
+
class={$$props.class}
|
|
41
|
+
on:pointerover={(e) => {
|
|
42
|
+
if ($connectingInput.opened && $connectingInput.hoveredComponent !== id) {
|
|
43
|
+
$connectingInput.hoveredComponent = id
|
|
44
|
+
}
|
|
45
|
+
e.stopPropagation()
|
|
46
|
+
}}
|
|
47
|
+
on:pointerleave={(e) => {
|
|
48
|
+
if ($connectingInput.opened) {
|
|
49
|
+
$connectingInput.hoveredComponent = undefined
|
|
50
|
+
e.stopPropagation()
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
on:pointerdown={onPointerDown}
|
|
54
|
+
on:click|capture={(event) => preventInteraction(event, type === 'tabscomponent')}
|
|
55
|
+
on:drag|capture={preventInteraction}
|
|
56
|
+
on:pointerup|capture={(event) => preventInteraction(event, type === 'tabscomponent')}
|
|
57
|
+
>
|
|
58
|
+
<slot />
|
|
59
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type ComponentWrapperProps = typeof __propDef.props;
|
|
16
|
+
export type ComponentWrapperEvents = typeof __propDef.events;
|
|
17
|
+
export type ComponentWrapperSlots = typeof __propDef.slots;
|
|
18
|
+
export default class ComponentWrapper extends SvelteComponentTyped<ComponentWrapperProps, ComponentWrapperEvents, ComponentWrapperSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -90,7 +90,7 @@ export interface InitialAppComponent extends Partial<Aligned> {
|
|
|
90
90
|
panes?: number[];
|
|
91
91
|
}
|
|
92
92
|
export declare const selectOptions: {
|
|
93
|
-
buttonColorOptions: ("blue" | "gray" | "red" | "green" | "dark" | "light"
|
|
93
|
+
buttonColorOptions: ("none" | "blue" | "gray" | "red" | "green" | "dark" | "light")[];
|
|
94
94
|
tabsKindOptions: string[];
|
|
95
95
|
buttonSizeOptions: string[];
|
|
96
96
|
tableSearchOptions: string[];
|
|
@@ -213,7 +213,7 @@ export declare const components: {
|
|
|
213
213
|
readonly fieldType: "select";
|
|
214
214
|
readonly type: "static";
|
|
215
215
|
readonly onlyStatic: true;
|
|
216
|
-
readonly selectOptions: ("blue" | "gray" | "red" | "green" | "dark" | "light"
|
|
216
|
+
readonly selectOptions: ("none" | "blue" | "gray" | "red" | "green" | "dark" | "light")[];
|
|
217
217
|
readonly value: "blue";
|
|
218
218
|
};
|
|
219
219
|
readonly size: {
|
|
@@ -341,7 +341,7 @@ export declare const components: {
|
|
|
341
341
|
readonly type: "static";
|
|
342
342
|
readonly onlyStatic: true;
|
|
343
343
|
readonly value: "dark";
|
|
344
|
-
readonly selectOptions: ("blue" | "gray" | "red" | "green" | "dark" | "light"
|
|
344
|
+
readonly selectOptions: ("none" | "blue" | "gray" | "red" | "green" | "dark" | "light")[];
|
|
345
345
|
};
|
|
346
346
|
readonly size: {
|
|
347
347
|
readonly fieldType: "select";
|
|
@@ -438,7 +438,7 @@ export declare const components: {
|
|
|
438
438
|
readonly type: "static";
|
|
439
439
|
readonly onlyStatic: true;
|
|
440
440
|
readonly value: "dark";
|
|
441
|
-
readonly selectOptions: ("blue" | "gray" | "red" | "green" | "dark" | "light"
|
|
441
|
+
readonly selectOptions: ("none" | "blue" | "gray" | "red" | "green" | "dark" | "light")[];
|
|
442
442
|
};
|
|
443
443
|
readonly size: {
|
|
444
444
|
readonly fieldType: "select";
|
|
@@ -768,14 +768,34 @@ export declare const components: {
|
|
|
768
768
|
readonly type: "static";
|
|
769
769
|
readonly onlyStatic: true;
|
|
770
770
|
readonly selectOptions: string[];
|
|
771
|
-
readonly value:
|
|
771
|
+
readonly value: string;
|
|
772
772
|
};
|
|
773
|
-
readonly
|
|
774
|
-
readonly
|
|
775
|
-
readonly
|
|
776
|
-
readonly
|
|
777
|
-
|
|
778
|
-
|
|
773
|
+
readonly pagination: {
|
|
774
|
+
readonly type: "oneOf";
|
|
775
|
+
readonly selected: "auto";
|
|
776
|
+
readonly labels: {
|
|
777
|
+
readonly auto: "Auto";
|
|
778
|
+
readonly manual: "Manual";
|
|
779
|
+
};
|
|
780
|
+
readonly configuration: {
|
|
781
|
+
readonly auto: {
|
|
782
|
+
readonly pageSize: {
|
|
783
|
+
readonly type: "static";
|
|
784
|
+
readonly fieldType: "number";
|
|
785
|
+
readonly value: 20;
|
|
786
|
+
readonly onlyStatic: true;
|
|
787
|
+
readonly tooltip: "Number of rows per page";
|
|
788
|
+
};
|
|
789
|
+
};
|
|
790
|
+
readonly manual: {
|
|
791
|
+
readonly pageCount: {
|
|
792
|
+
readonly type: "static";
|
|
793
|
+
readonly fieldType: "number";
|
|
794
|
+
readonly value: -1;
|
|
795
|
+
readonly tooltip: "Number of pages (-1 if you do not know)";
|
|
796
|
+
};
|
|
797
|
+
};
|
|
798
|
+
};
|
|
779
799
|
};
|
|
780
800
|
};
|
|
781
801
|
readonly componentInput: StaticAppInput;
|
|
@@ -803,13 +823,6 @@ export declare const components: {
|
|
|
803
823
|
readonly value: false;
|
|
804
824
|
readonly onlyStatic: true;
|
|
805
825
|
};
|
|
806
|
-
readonly pageSize: {
|
|
807
|
-
readonly type: "static";
|
|
808
|
-
readonly fieldType: "number";
|
|
809
|
-
readonly value: 10;
|
|
810
|
-
readonly onlyStatic: true;
|
|
811
|
-
readonly tooltip: "Number of rows per page";
|
|
812
|
-
};
|
|
813
826
|
};
|
|
814
827
|
readonly componentInput: StaticAppInput;
|
|
815
828
|
};
|
|
@@ -1499,7 +1512,7 @@ export declare const components: {
|
|
|
1499
1512
|
readonly fieldType: "select";
|
|
1500
1513
|
readonly type: "static";
|
|
1501
1514
|
readonly onlyStatic: true;
|
|
1502
|
-
readonly selectOptions: ("blue" | "gray" | "red" | "green" | "dark" | "light"
|
|
1515
|
+
readonly selectOptions: ("none" | "blue" | "gray" | "red" | "green" | "dark" | "light")[];
|
|
1503
1516
|
readonly value: "blue";
|
|
1504
1517
|
};
|
|
1505
1518
|
readonly size: {
|
|
@@ -76,6 +76,33 @@ const onSuccessClick = {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
+
const paginationOneOf = {
|
|
80
|
+
type: 'oneOf',
|
|
81
|
+
selected: 'auto',
|
|
82
|
+
labels: {
|
|
83
|
+
auto: 'Auto',
|
|
84
|
+
manual: 'Manual'
|
|
85
|
+
},
|
|
86
|
+
configuration: {
|
|
87
|
+
auto: {
|
|
88
|
+
pageSize: {
|
|
89
|
+
type: 'static',
|
|
90
|
+
fieldType: 'number',
|
|
91
|
+
value: 20,
|
|
92
|
+
onlyStatic: true,
|
|
93
|
+
tooltip: 'Number of rows per page'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
manual: {
|
|
97
|
+
pageCount: {
|
|
98
|
+
type: 'static',
|
|
99
|
+
fieldType: 'number',
|
|
100
|
+
value: -1,
|
|
101
|
+
tooltip: 'Number of pages (-1 if you do not know)'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
79
106
|
export const components = {
|
|
80
107
|
displaycomponent: {
|
|
81
108
|
name: 'Rich Result',
|
|
@@ -593,13 +620,7 @@ Hello \${ctx.username}
|
|
|
593
620
|
selectOptions: selectOptions.tableSearchOptions,
|
|
594
621
|
value: 'Disabled'
|
|
595
622
|
},
|
|
596
|
-
|
|
597
|
-
fieldType: 'boolean',
|
|
598
|
-
type: 'static',
|
|
599
|
-
onlyStatic: true,
|
|
600
|
-
value: false,
|
|
601
|
-
tooltip: 'Pagination would not be handled by the component but by the script itself. Connect to the pagination output'
|
|
602
|
-
}
|
|
623
|
+
pagination: paginationOneOf
|
|
603
624
|
},
|
|
604
625
|
componentInput: {
|
|
605
626
|
type: 'static',
|
|
@@ -646,13 +667,6 @@ Hello \${ctx.username}
|
|
|
646
667
|
fieldType: 'boolean',
|
|
647
668
|
value: false,
|
|
648
669
|
onlyStatic: true
|
|
649
|
-
},
|
|
650
|
-
pageSize: {
|
|
651
|
-
type: 'static',
|
|
652
|
-
fieldType: 'number',
|
|
653
|
-
value: 10,
|
|
654
|
-
onlyStatic: true,
|
|
655
|
-
tooltip: 'Number of rows per page'
|
|
656
670
|
}
|
|
657
671
|
},
|
|
658
672
|
componentInput: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { createEventDispatcher
|
|
1
|
+
<script>import { Paintbrush2 } from 'lucide-svelte';
|
|
2
|
+
import { createEventDispatcher } from 'svelte';
|
|
3
3
|
import { fade } from 'svelte/transition';
|
|
4
|
-
import { addWhitespaceBeforeCapitals
|
|
4
|
+
import { addWhitespaceBeforeCapitals } from '../../../../utils';
|
|
5
5
|
import { Button, ClearableInput } from '../../../common';
|
|
6
6
|
import Popover from '../../../Popover.svelte';
|
|
7
7
|
import QuickStyleMenu from './QuickStyleMenu.svelte';
|
|
@@ -10,7 +10,7 @@ export let value = {};
|
|
|
10
10
|
export let forceStyle = false;
|
|
11
11
|
export let forceClass = false;
|
|
12
12
|
export let quickStyleProperties = undefined;
|
|
13
|
-
|
|
13
|
+
export let componentType = undefined;
|
|
14
14
|
const dispatch = createEventDispatcher();
|
|
15
15
|
let isQuickMenuOpen = false;
|
|
16
16
|
$: dispatch('change', value);
|
|
@@ -20,12 +20,12 @@ function toggleQuickMenu() {
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<div
|
|
23
|
-
class="sticky top-0 z-20 text-lg bg-
|
|
23
|
+
class="sticky top-0 z-20 text-lg bg-gray-100 font-semibold lowercase leading-none [font-variant:small-caps] text-gray-700 px-3 pb-1 mt-4 mb-1"
|
|
24
24
|
>
|
|
25
25
|
{addWhitespaceBeforeCapitals(name)}
|
|
26
26
|
</div>
|
|
27
27
|
{#if value}
|
|
28
|
-
<div class="
|
|
28
|
+
<div class="px-3">
|
|
29
29
|
{#if value.style !== undefined || forceStyle}
|
|
30
30
|
<div class="pb-2">
|
|
31
31
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
|
@@ -48,7 +48,7 @@ function toggleQuickMenu() {
|
|
|
48
48
|
color="light"
|
|
49
49
|
size="xs"
|
|
50
50
|
btnClasses="!p-1 !w-[34px] !h-[34px] {isQuickMenuOpen
|
|
51
|
-
? '!bg-gray-200/60 hover:!bg-gray-200'
|
|
51
|
+
? '!bg-gray-200/60 hover:!bg-gray-200 focus:!bg-gray-200'
|
|
52
52
|
: ''}"
|
|
53
53
|
aria-label="{isQuickMenuOpen ? 'Close' : 'Open'} styling menu"
|
|
54
54
|
on:click={toggleQuickMenu}
|
|
@@ -65,7 +65,12 @@ function toggleQuickMenu() {
|
|
|
65
65
|
</label>
|
|
66
66
|
{#if quickStyleProperties?.length && isQuickMenuOpen}
|
|
67
67
|
<div transition:fade|local={{ duration: 200 }} class="w-full pt-1">
|
|
68
|
-
<QuickStyleMenu
|
|
68
|
+
<QuickStyleMenu
|
|
69
|
+
bind:value={value.style}
|
|
70
|
+
properties={quickStyleProperties}
|
|
71
|
+
{componentType}
|
|
72
|
+
componentProperty={name}
|
|
73
|
+
/>
|
|
69
74
|
</div>
|
|
70
75
|
{/if}
|
|
71
76
|
</div>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { ComponentCssProperty } from '../../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TypedComponent } from '../component';
|
|
4
|
+
import type { PropertyGroup } from './quickStyleProperties';
|
|
4
5
|
declare const __propDef: {
|
|
5
6
|
props: {
|
|
6
7
|
name: string;
|
|
7
8
|
value?: ComponentCssProperty | undefined;
|
|
8
9
|
forceStyle?: boolean | undefined;
|
|
9
10
|
forceClass?: boolean | undefined;
|
|
10
|
-
quickStyleProperties?:
|
|
11
|
+
quickStyleProperties?: PropertyGroup[] | undefined;
|
|
12
|
+
componentType?: TypedComponent['type'] | undefined;
|
|
11
13
|
};
|
|
12
14
|
events: {
|
|
13
15
|
change: CustomEvent<any>;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
<script>import { slide } from 'svelte/transition';
|
|
2
2
|
import { ChevronDown } from 'lucide-svelte';
|
|
3
3
|
import { isOpenStore } from './store';
|
|
4
|
-
import { createEventDispatcher } from 'svelte';
|
|
4
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
5
5
|
export let title;
|
|
6
6
|
export let prefix = undefined;
|
|
7
|
+
export let openByDefault = false;
|
|
8
|
+
export let wrapperClasses = '';
|
|
9
|
+
export let toggleClasses = '';
|
|
10
|
+
export let contentWrapperClasses = '';
|
|
11
|
+
export let isOpen = false;
|
|
7
12
|
const dispatch = createEventDispatcher();
|
|
8
13
|
$: storeTitle = prefix + title;
|
|
9
14
|
$: isOpen = prefix ? $isOpenStore[storeTitle] : true;
|
|
10
15
|
$: dispatch('open', isOpen);
|
|
16
|
+
onMount(() => {
|
|
17
|
+
if (prefix !== undefined && !(prefix + title in $isOpenStore)) {
|
|
18
|
+
$isOpenStore[prefix + title] = openByDefault;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
11
21
|
</script>
|
|
12
22
|
|
|
13
|
-
<section class="pt-1 pb-2 px-1">
|
|
23
|
+
<section class="pt-1 pb-2 px-1 {wrapperClasses}">
|
|
14
24
|
{#if prefix !== undefined}
|
|
15
25
|
<button
|
|
16
26
|
on:click|preventDefault={() => isOpenStore.toggle(storeTitle)}
|
|
17
27
|
class="w-full flex justify-between items-center text-gray-700 px-2 py-1
|
|
18
|
-
rounded-sm duration-200 hover:bg-gray-100"
|
|
28
|
+
rounded-sm duration-200 hover:bg-gray-100 {toggleClasses}"
|
|
19
29
|
>
|
|
20
30
|
<h1 class="text-sm font-semibold text-left">
|
|
21
31
|
<slot name="title">
|
|
@@ -25,7 +35,7 @@ $: dispatch('open', isOpen);
|
|
|
25
35
|
<ChevronDown class="rotate-0 duration-300 {isOpen ? '!rotate-180' : ''}" />
|
|
26
36
|
</button>
|
|
27
37
|
{#if isOpen}
|
|
28
|
-
<div transition:slide|local={{ duration: 300 }} class="px-2">
|
|
38
|
+
<div transition:slide|local={{ duration: 300 }} class="px-2 {contentWrapperClasses}">
|
|
29
39
|
<slot />
|
|
30
40
|
</div>
|
|
31
41
|
{/if}
|
|
@@ -3,6 +3,11 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
title: string;
|
|
5
5
|
prefix?: string | undefined;
|
|
6
|
+
openByDefault?: boolean | undefined;
|
|
7
|
+
wrapperClasses?: string | undefined;
|
|
8
|
+
toggleClasses?: string | undefined;
|
|
9
|
+
contentWrapperClasses?: string | undefined;
|
|
10
|
+
isOpen?: boolean | undefined;
|
|
6
11
|
};
|
|
7
12
|
events: {
|
|
8
13
|
open: CustomEvent<any>;
|
|
@@ -3,13 +3,17 @@ import parse from 'style-to-object';
|
|
|
3
3
|
import { isValidHexColor } from '../../../../utils';
|
|
4
4
|
import { createStyleStore, StylePropertyType, StylePropertyUnits, STYLE_STORE_KEY } from './quickStyleProperties';
|
|
5
5
|
import QuickStyleProperty from './QuickStyleProperty.svelte';
|
|
6
|
+
import ListItem from './ListItem.svelte';
|
|
6
7
|
export let value = '';
|
|
7
8
|
export let properties;
|
|
9
|
+
export let componentType = undefined;
|
|
10
|
+
export let componentProperty = undefined;
|
|
8
11
|
const { app } = getContext('AppViewerContext');
|
|
9
12
|
const styleStore = createStyleStore(properties);
|
|
10
13
|
setContext(STYLE_STORE_KEY, styleStore);
|
|
11
14
|
let multiValues = initiateMultiValues();
|
|
12
15
|
let mounted = false;
|
|
16
|
+
let isOpen = {};
|
|
13
17
|
$: mounted && $styleStore && writeStyle();
|
|
14
18
|
$: mounted && (!value || value) && parseStyle();
|
|
15
19
|
$: $app && setTopColors();
|
|
@@ -139,32 +143,69 @@ function setMultiValueProperty(index) {
|
|
|
139
143
|
});
|
|
140
144
|
$styleStore.style[index].value = values.join(' ').trim();
|
|
141
145
|
}
|
|
146
|
+
function formatKebabCase(text) {
|
|
147
|
+
text = text.toLowerCase().replace(/-/, ' ');
|
|
148
|
+
if (text.length) {
|
|
149
|
+
text = text[0].toUpperCase() + text.slice(1);
|
|
150
|
+
}
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
142
153
|
onMount(() => {
|
|
143
154
|
parseStyle();
|
|
144
155
|
mounted = true;
|
|
145
156
|
});
|
|
146
157
|
</script>
|
|
147
158
|
|
|
148
|
-
<div class="
|
|
149
|
-
{#each
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
<div class="pb-2 pt-1">
|
|
160
|
+
{#each properties as property, i}
|
|
161
|
+
{#each Object.keys(property) as group, j}
|
|
162
|
+
{@const prefix = `${componentType}_${componentProperty}_${group}`}
|
|
163
|
+
<ListItem
|
|
164
|
+
bind:isOpen={isOpen[prefix]}
|
|
165
|
+
title={group}
|
|
166
|
+
{prefix}
|
|
167
|
+
openByDefault={true}
|
|
168
|
+
wrapperClasses="!px-0 !pt-0"
|
|
169
|
+
toggleClasses="border-b border-gray-300 !rounded-b-none !py-0
|
|
170
|
+
{isOpen[prefix] ? '!bg-gray-100 hover:!bg-gray-200' : ''}"
|
|
171
|
+
>
|
|
172
|
+
<svelte:fragment slot="title">
|
|
173
|
+
<span class="font-semibold text-gray-600 capitalize">
|
|
174
|
+
{group}
|
|
175
|
+
</span>
|
|
176
|
+
</svelte:fragment>
|
|
177
|
+
<div class="flex justify-start items-center flex-wrap gap-x-4 gap-y-1 pt-3">
|
|
178
|
+
{#each property[group] as p}
|
|
179
|
+
{@const {
|
|
180
|
+
prop: { prop },
|
|
181
|
+
index
|
|
182
|
+
} = styleStore.getProp(p)}
|
|
183
|
+
{#if prop !== undefined && index !== undefined}
|
|
184
|
+
<div class="pb-2 pt-1">
|
|
185
|
+
<div class="text-sm font-medium text-gray-600 pb-0.5">
|
|
186
|
+
{formatKebabCase(prop.key)}
|
|
187
|
+
</div>
|
|
188
|
+
<div class="flex items-center gap-1">
|
|
189
|
+
{#if Array.isArray(prop.value)}
|
|
190
|
+
<div class="flex justify-start items-center flex-wrap gap-x-4 gap-y-1">
|
|
191
|
+
{#each prop.value as value, i}
|
|
192
|
+
<QuickStyleProperty
|
|
193
|
+
prop={{ ...prop, value }}
|
|
194
|
+
inline
|
|
195
|
+
bind:value={multiValues[index][i]}
|
|
196
|
+
on:change={() => setMultiValueProperty(index)}
|
|
197
|
+
/>
|
|
198
|
+
{/each}
|
|
199
|
+
</div>
|
|
200
|
+
{:else}
|
|
201
|
+
<QuickStyleProperty {prop} inline bind:value={$styleStore.style[index].value} />
|
|
202
|
+
{/if}
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
{/if}
|
|
206
|
+
{/each}
|
|
207
|
+
</div>
|
|
208
|
+
</ListItem>
|
|
209
|
+
{/each}
|
|
169
210
|
{/each}
|
|
170
211
|
</div>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type
|
|
2
|
+
import { type PropertyGroup } from './quickStyleProperties';
|
|
3
|
+
import type { TypedComponent } from '../component';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
value?: string | undefined;
|
|
6
|
-
properties:
|
|
7
|
+
properties: PropertyGroup[];
|
|
8
|
+
componentType?: TypedComponent['type'] | undefined;
|
|
9
|
+
componentProperty?: string | undefined;
|
|
7
10
|
};
|
|
8
11
|
events: {
|
|
9
12
|
[evt: string]: CustomEvent<any>;
|