@widgetic/editor 4.0.7 → 4.0.9
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/README.md +12 -1
- package/dist/components/WidgetPreview.svelte +32 -1
- package/dist/components/WidgetPreview.svelte.d.ts +5 -0
- package/dist/components/editors/PropsEditor.svelte +171 -87
- package/dist/components/editors/PropsEditor.svelte.d.ts +3 -2
- package/dist/components/ic/AngleInputController.svelte +21 -7
- package/dist/components/ic/AngleInputController.svelte.d.ts +16 -6
- package/dist/components/ic/BrowserInputController.svelte +28 -15
- package/dist/components/ic/BrowserInputController.svelte.d.ts +25 -19
- package/dist/components/ic/CheckboxInputController.svelte +21 -7
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +25 -15
- package/dist/components/ic/ColorPickerInputController.svelte +47 -19
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +42 -17
- package/dist/components/ic/DateFieldInputController.svelte +21 -7
- package/dist/components/ic/DateFieldInputController.svelte.d.ts +24 -14
- package/dist/components/ic/DatePickerInputController.svelte +25 -8
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +21 -8
- package/dist/components/ic/DropdownInputController.svelte +39 -14
- package/dist/components/ic/DropdownInputController.svelte.d.ts +33 -17
- package/dist/components/ic/FixedPositionInputController.svelte +24 -10
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +16 -4
- package/dist/components/ic/FontInputController.svelte +70 -41
- package/dist/components/ic/FontInputController.svelte.d.ts +33 -18
- package/dist/components/ic/NumberInputController.svelte +23 -9
- package/dist/components/ic/NumberInputController.svelte.d.ts +18 -7
- package/dist/components/ic/PositionInputController.svelte +17 -5
- package/dist/components/ic/PositionInputController.svelte.d.ts +20 -11
- package/dist/components/ic/RadioGroupInputController.svelte +21 -7
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +22 -12
- package/dist/components/ic/RangeCalendarInputController.svelte +34 -16
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +25 -11
- package/dist/components/ic/RoundedCornersInputController.svelte +24 -10
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +26 -16
- package/dist/components/ic/SliderInputController.svelte +41 -18
- package/dist/components/ic/SliderInputController.svelte.d.ts +35 -19
- package/dist/components/ic/SliderRangeInputController.svelte +27 -11
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +22 -9
- package/dist/components/ic/SwitchInputController.svelte +17 -5
- package/dist/components/ic/SwitchInputController.svelte.d.ts +14 -5
- package/dist/components/ic/TagsInputController.svelte +21 -7
- package/dist/components/ic/TagsInputController.svelte.d.ts +16 -6
- package/dist/components/ic/TextAreaInputController.svelte +18 -12
- package/dist/components/ic/TextAreaInputController.svelte.d.ts +6 -4
- package/dist/components/ic/TextAreaPreviewInputController.svelte +21 -7
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +16 -6
- package/dist/components/ic/TextInputController.svelte +23 -8
- package/dist/components/ic/TextInputController.svelte.d.ts +20 -8
- package/dist/components/ic/TimeInputController.svelte +17 -5
- package/dist/components/ic/TimeInputController.svelte.d.ts +14 -5
- package/dist/components/ic/VectorInputController.svelte +29 -10
- package/dist/components/ic/VectorInputController.svelte.d.ts +33 -18
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/schemaViews.d.ts +105 -0
- package/dist/schemaViews.js +11 -0
- package/dist/utils/FontManager.js +1 -1
- package/package.json +9 -6
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { InputControllerConfig } from './index';
|
|
2
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
3
|
+
* interface cannot drift from what the component actually reads. */
|
|
4
|
+
export interface TagsInputControllerProps {
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string[];
|
|
7
|
+
onChange: (newValue: string[]) => void;
|
|
8
|
+
config?: InputControllerConfig;
|
|
9
|
+
helpText?: string;
|
|
10
|
+
onFocus?: () => void;
|
|
11
|
+
}
|
|
2
12
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
13
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
14
|
$$bindings?: Bindings;
|
|
@@ -13,12 +23,12 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
13
23
|
z_$$bindings?: Bindings;
|
|
14
24
|
}
|
|
15
25
|
declare const TagsInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
label:
|
|
17
|
-
value?:
|
|
18
|
-
onChange:
|
|
19
|
-
config?:
|
|
20
|
-
helpText?:
|
|
21
|
-
onFocus?:
|
|
26
|
+
label: TagsInputControllerProps["label"];
|
|
27
|
+
value?: TagsInputControllerProps["value"];
|
|
28
|
+
onChange: TagsInputControllerProps["onChange"];
|
|
29
|
+
config?: TagsInputControllerProps["config"];
|
|
30
|
+
helpText?: TagsInputControllerProps["helpText"];
|
|
31
|
+
onFocus?: TagsInputControllerProps["onFocus"];
|
|
22
32
|
class?: string;
|
|
23
33
|
}, {
|
|
24
34
|
[evt: string]: CustomEvent<any>;
|
|
@@ -22,14 +22,29 @@
|
|
|
22
22
|
- Maintains formatting consistency across operations
|
|
23
23
|
-->
|
|
24
24
|
|
|
25
|
+
<script module lang="ts">
|
|
26
|
+
import type { InputControllerConfig } from './index';
|
|
27
|
+
|
|
28
|
+
/** Declared props contract — the instance script's $props() below is
|
|
29
|
+
* annotated from it so the interface cannot drift from what is read. */
|
|
30
|
+
export interface TextAreaInputControllerProps {
|
|
31
|
+
class?: string;
|
|
32
|
+
label: string;
|
|
33
|
+
value: string;
|
|
34
|
+
onChange: (newValue: string) => void;
|
|
35
|
+
config?: InputControllerConfig;
|
|
36
|
+
description?: string;
|
|
37
|
+
onFocus?: () => void;
|
|
38
|
+
onClose?: () => void;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
25
42
|
<script lang="ts">
|
|
26
43
|
// Svelte imports
|
|
27
44
|
import { onMount, onDestroy } from 'svelte';
|
|
28
45
|
import { writable } from 'svelte/store';
|
|
29
46
|
import type { ComponentEvents } from 'svelte';
|
|
30
47
|
|
|
31
|
-
// Component config
|
|
32
|
-
import type { InputControllerConfig } from './index';
|
|
33
48
|
|
|
34
49
|
// Import Shadcn UI components
|
|
35
50
|
import { Button, ToggleGroup, Popover, Command } from '@widgetic/design-system/components';
|
|
@@ -71,16 +86,7 @@
|
|
|
71
86
|
description = undefined,
|
|
72
87
|
onFocus = () => {},
|
|
73
88
|
onClose = undefined
|
|
74
|
-
} = $props
|
|
75
|
-
class: string;
|
|
76
|
-
label: string;
|
|
77
|
-
value: string;
|
|
78
|
-
onChange: (newValue: string) => void;
|
|
79
|
-
config?: InputControllerConfig;
|
|
80
|
-
description?: string;
|
|
81
|
-
onFocus?: () => void;
|
|
82
|
-
onClose?: () => void;
|
|
83
|
-
}>();
|
|
89
|
+
}: TextAreaInputControllerProps = $props();
|
|
84
90
|
|
|
85
91
|
// Use config values with fallbacks
|
|
86
92
|
const textColor = $derived(config.textColor || '#1a1a1a');
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { InputControllerConfig } from './index';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** Declared props contract — the instance script's $props() below is
|
|
3
|
+
* annotated from it so the interface cannot drift from what is read. */
|
|
4
|
+
export interface TextAreaInputControllerProps {
|
|
5
|
+
class?: string;
|
|
4
6
|
label: string;
|
|
5
7
|
value: string;
|
|
6
8
|
onChange: (newValue: string) => void;
|
|
@@ -8,7 +10,7 @@ type $$ComponentProps = {
|
|
|
8
10
|
description?: string;
|
|
9
11
|
onFocus?: () => void;
|
|
10
12
|
onClose?: () => void;
|
|
11
|
-
}
|
|
12
|
-
declare const TextAreaInputController: import("svelte").Component
|
|
13
|
+
}
|
|
14
|
+
declare const TextAreaInputController: import("svelte").Component<TextAreaInputControllerProps, {}, "value">;
|
|
13
15
|
type TextAreaInputController = ReturnType<typeof TextAreaInputController>;
|
|
14
16
|
export default TextAreaInputController;
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { InputControllerConfig } from './index';
|
|
3
|
+
|
|
4
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
5
|
+
* interface cannot drift from what the component actually reads. */
|
|
6
|
+
export interface TextAreaPreviewInputControllerProps {
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
onChange: (newValue: string) => void;
|
|
10
|
+
config?: InputControllerConfig;
|
|
11
|
+
description?: string;
|
|
12
|
+
portalTarget?: string | HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
1
16
|
<script lang="ts">
|
|
2
17
|
import { Portal } from '@widgetic/design-system/components';
|
|
3
18
|
import { IconArrowsDiagonal } from '@widgetic/design-system/icons';
|
|
4
19
|
import { onMount, onDestroy } from 'svelte';
|
|
5
20
|
|
|
6
21
|
import { TextAreaInputController } from './index';
|
|
7
|
-
import type { InputControllerConfig } from './index';
|
|
8
22
|
|
|
9
23
|
/**
|
|
10
24
|
* Component props
|
|
11
25
|
*/
|
|
12
|
-
export let label:
|
|
13
|
-
export let value:
|
|
14
|
-
export let onChange:
|
|
15
|
-
export let config:
|
|
16
|
-
export let description:
|
|
17
|
-
export let portalTarget:
|
|
26
|
+
export let label: TextAreaPreviewInputControllerProps['label'] = '';
|
|
27
|
+
export let value: TextAreaPreviewInputControllerProps['value'] = '';
|
|
28
|
+
export let onChange: TextAreaPreviewInputControllerProps['onChange'];
|
|
29
|
+
export let config: TextAreaPreviewInputControllerProps['config'] = {};
|
|
30
|
+
export let description: TextAreaPreviewInputControllerProps['description'] = undefined;
|
|
31
|
+
export let portalTarget: TextAreaPreviewInputControllerProps['portalTarget'] = '';
|
|
18
32
|
/**
|
|
19
33
|
* Local Variables
|
|
20
34
|
*/
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { InputControllerConfig } from './index';
|
|
2
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
3
|
+
* interface cannot drift from what the component actually reads. */
|
|
4
|
+
export interface TextAreaPreviewInputControllerProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
onChange: (newValue: string) => void;
|
|
8
|
+
config?: InputControllerConfig;
|
|
9
|
+
description?: string;
|
|
10
|
+
portalTarget?: string | HTMLElement;
|
|
11
|
+
}
|
|
2
12
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
13
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
14
|
$$bindings?: Bindings;
|
|
@@ -15,12 +25,12 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
15
25
|
declare const TextAreaPreviewInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
26
|
/**
|
|
17
27
|
* Component props
|
|
18
|
-
*/ label?:
|
|
19
|
-
value?:
|
|
20
|
-
onChange:
|
|
21
|
-
config?:
|
|
22
|
-
description?:
|
|
23
|
-
portalTarget?:
|
|
28
|
+
*/ label?: TextAreaPreviewInputControllerProps["label"];
|
|
29
|
+
value?: TextAreaPreviewInputControllerProps["value"];
|
|
30
|
+
onChange: TextAreaPreviewInputControllerProps["onChange"];
|
|
31
|
+
config?: TextAreaPreviewInputControllerProps["config"];
|
|
32
|
+
description?: TextAreaPreviewInputControllerProps["description"];
|
|
33
|
+
portalTarget?: TextAreaPreviewInputControllerProps["portalTarget"];
|
|
24
34
|
}, {
|
|
25
35
|
[evt: string]: CustomEvent<any>;
|
|
26
36
|
}, {}, {}, string>;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
3
|
+
* interface cannot drift from what the component actually reads. */
|
|
4
|
+
export interface TextInputControllerProps {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (newValue: string) => void;
|
|
8
|
+
config?: InputControllerConfig;
|
|
9
|
+
type?: 'text' | 'email' | 'url';
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
onFocus?: () => void;
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
1
16
|
<script lang="ts">
|
|
2
17
|
// Import Shadcn UI components from Widgetic design-system package
|
|
3
18
|
import { Input } from '@widgetic/design-system/components';
|
|
@@ -9,16 +24,16 @@
|
|
|
9
24
|
/**
|
|
10
25
|
* Component props
|
|
11
26
|
*/
|
|
12
|
-
export let label:
|
|
13
|
-
export let value:
|
|
14
|
-
export let onChange:
|
|
15
|
-
export let config:
|
|
27
|
+
export let label: TextInputControllerProps['label'];
|
|
28
|
+
export let value: TextInputControllerProps['value'];
|
|
29
|
+
export let onChange: TextInputControllerProps['onChange'];
|
|
30
|
+
export let config: TextInputControllerProps['config'] = {};
|
|
16
31
|
|
|
17
32
|
// Use config values with fallbacks
|
|
18
|
-
export let type: '
|
|
19
|
-
export let placeholder:
|
|
20
|
-
export let description:
|
|
21
|
-
export let onFocus:
|
|
33
|
+
export let type: TextInputControllerProps['type'] = 'text';
|
|
34
|
+
export let placeholder: TextInputControllerProps['placeholder'] = config.placeholder || '';
|
|
35
|
+
export let description: TextInputControllerProps['description'] = undefined;
|
|
36
|
+
export let onFocus: TextInputControllerProps['onFocus'] = () => {};
|
|
22
37
|
|
|
23
38
|
/**
|
|
24
39
|
* Methods
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
2
|
+
* interface cannot drift from what the component actually reads. */
|
|
3
|
+
export interface TextInputControllerProps {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (newValue: string) => void;
|
|
7
|
+
config?: InputControllerConfig;
|
|
8
|
+
type?: 'text' | 'email' | 'url';
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
onFocus?: () => void;
|
|
12
|
+
}
|
|
1
13
|
import type { InputControllerConfig } from './index';
|
|
2
14
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
15
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
@@ -15,14 +27,14 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
15
27
|
declare const TextInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
28
|
/**
|
|
17
29
|
* Component props
|
|
18
|
-
*/ label:
|
|
19
|
-
value:
|
|
20
|
-
onChange:
|
|
21
|
-
config?:
|
|
22
|
-
type?: "
|
|
23
|
-
placeholder?:
|
|
24
|
-
description?:
|
|
25
|
-
onFocus?:
|
|
30
|
+
*/ label: TextInputControllerProps["label"];
|
|
31
|
+
value: TextInputControllerProps["value"];
|
|
32
|
+
onChange: TextInputControllerProps["onChange"];
|
|
33
|
+
config?: TextInputControllerProps["config"];
|
|
34
|
+
type?: TextInputControllerProps["type"];
|
|
35
|
+
placeholder?: TextInputControllerProps["placeholder"];
|
|
36
|
+
description?: TextInputControllerProps["description"];
|
|
37
|
+
onFocus?: TextInputControllerProps["onFocus"];
|
|
26
38
|
}, {
|
|
27
39
|
[evt: string]: CustomEvent<any>;
|
|
28
40
|
}, {}, {}, string>;
|
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
* - 30-minute interval selection
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
+
<script module lang="ts">
|
|
15
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
16
|
+
* interface cannot drift from what the component actually reads. */
|
|
17
|
+
export interface TimeInputControllerProps {
|
|
18
|
+
label: string;
|
|
19
|
+
value?: string;
|
|
20
|
+
onChange: (newValue: string) => void;
|
|
21
|
+
helpText?: string;
|
|
22
|
+
onFocus?: () => void;
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
14
26
|
<script lang="ts">
|
|
15
27
|
import { onMount, onDestroy } from 'svelte';
|
|
16
28
|
import { Button } from '@widgetic/design-system/components';
|
|
@@ -18,12 +30,12 @@
|
|
|
18
30
|
import InputControllerHeader from './InputControllerHeader.svelte';
|
|
19
31
|
import type { InputControllerConfig } from './index';
|
|
20
32
|
|
|
21
|
-
export let label:
|
|
22
|
-
export let value:
|
|
23
|
-
export let onChange:
|
|
33
|
+
export let label: TimeInputControllerProps['label'];
|
|
34
|
+
export let value: TimeInputControllerProps['value'] = "00:00";
|
|
35
|
+
export let onChange: TimeInputControllerProps['onChange'];
|
|
24
36
|
// export let config: InputControllerConfig = {};
|
|
25
|
-
export let helpText:
|
|
26
|
-
export let onFocus:
|
|
37
|
+
export let helpText: TimeInputControllerProps['helpText'] = undefined;
|
|
38
|
+
export let onFocus: TimeInputControllerProps['onFocus'] = () => {};
|
|
27
39
|
|
|
28
40
|
let className = '';
|
|
29
41
|
export { className as class };
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
2
|
+
* interface cannot drift from what the component actually reads. */
|
|
3
|
+
export interface TimeInputControllerProps {
|
|
4
|
+
label: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange: (newValue: string) => void;
|
|
7
|
+
helpText?: string;
|
|
8
|
+
onFocus?: () => void;
|
|
9
|
+
}
|
|
1
10
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
11
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
12
|
$$bindings?: Bindings;
|
|
@@ -12,11 +21,11 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
12
21
|
z_$$bindings?: Bindings;
|
|
13
22
|
}
|
|
14
23
|
declare const TimeInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
label:
|
|
16
|
-
value?:
|
|
17
|
-
onChange:
|
|
18
|
-
helpText?:
|
|
19
|
-
onFocus?:
|
|
24
|
+
label: TimeInputControllerProps["label"];
|
|
25
|
+
value?: TimeInputControllerProps["value"];
|
|
26
|
+
onChange: TimeInputControllerProps["onChange"];
|
|
27
|
+
helpText?: TimeInputControllerProps["helpText"];
|
|
28
|
+
onFocus?: TimeInputControllerProps["onFocus"];
|
|
20
29
|
class?: string;
|
|
21
30
|
}, {
|
|
22
31
|
[evt: string]: CustomEvent<any>;
|
|
@@ -16,6 +16,25 @@
|
|
|
16
16
|
* - Preloads default vectors on mount
|
|
17
17
|
|
|
18
18
|
-->
|
|
19
|
+
<script module lang="ts">
|
|
20
|
+
import type { Writable } from 'svelte/store';
|
|
21
|
+
|
|
22
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
23
|
+
* interface cannot drift from what the component actually reads. */
|
|
24
|
+
export interface VectorInputControllerProps {
|
|
25
|
+
label: string;
|
|
26
|
+
value?: { name: string; category: string; url: string } | null;
|
|
27
|
+
onChange?: (newValue: { name: string; category: string; url: string } | null) => void;
|
|
28
|
+
description?: string;
|
|
29
|
+
controllerId: string;
|
|
30
|
+
openDropdowns: Writable<Set<string>>;
|
|
31
|
+
toggleDropdown: (id: string) => void;
|
|
32
|
+
onFocus?: () => void;
|
|
33
|
+
hideRecentFromList?: boolean;
|
|
34
|
+
hideTrashIcon?: boolean;
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
19
38
|
<script lang="ts">
|
|
20
39
|
// Svelte imports
|
|
21
40
|
import { onMount, onDestroy, tick } from 'svelte';
|
|
@@ -68,14 +87,14 @@
|
|
|
68
87
|
* @prop {Function} toggleDropdown - Function to toggle dropdown state
|
|
69
88
|
* @prop {Function} onFocus - Optional focus handler
|
|
70
89
|
*/
|
|
71
|
-
export let label:
|
|
72
|
-
export let value:
|
|
73
|
-
export let onChange:
|
|
74
|
-
export let description:
|
|
75
|
-
export let controllerId:
|
|
76
|
-
export let openDropdowns:
|
|
77
|
-
export let toggleDropdown:
|
|
78
|
-
export let onFocus:
|
|
90
|
+
export let label: VectorInputControllerProps['label'];
|
|
91
|
+
export let value: VectorInputControllerProps['value'] = null;
|
|
92
|
+
export let onChange: VectorInputControllerProps['onChange'] = undefined;
|
|
93
|
+
export let description: VectorInputControllerProps['description'] = undefined;
|
|
94
|
+
export let controllerId: VectorInputControllerProps['controllerId'];
|
|
95
|
+
export let openDropdowns: VectorInputControllerProps['openDropdowns'];
|
|
96
|
+
export let toggleDropdown: VectorInputControllerProps['toggleDropdown'];
|
|
97
|
+
export let onFocus: VectorInputControllerProps['onFocus'] = () => {};
|
|
79
98
|
|
|
80
99
|
// Vector modal state
|
|
81
100
|
let showVectorModal = false;
|
|
@@ -105,8 +124,8 @@
|
|
|
105
124
|
let isLoadingBatch = false;
|
|
106
125
|
|
|
107
126
|
// Add new prop for controlling vector list behavior
|
|
108
|
-
export let hideRecentFromList:
|
|
109
|
-
export let hideTrashIcon:
|
|
127
|
+
export let hideRecentFromList: VectorInputControllerProps['hideRecentFromList'] = false;
|
|
128
|
+
export let hideTrashIcon: VectorInputControllerProps['hideTrashIcon'] = true;
|
|
110
129
|
|
|
111
130
|
// Add scroll state tracking
|
|
112
131
|
let isScrolled = false;
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
import type { Writable } from 'svelte/store';
|
|
2
|
+
/** Declared props contract — export lets below are annotated from it so the
|
|
3
|
+
* interface cannot drift from what the component actually reads. */
|
|
4
|
+
export interface VectorInputControllerProps {
|
|
5
|
+
label: string;
|
|
6
|
+
value?: {
|
|
7
|
+
name: string;
|
|
8
|
+
category: string;
|
|
9
|
+
url: string;
|
|
10
|
+
} | null;
|
|
11
|
+
onChange?: (newValue: {
|
|
12
|
+
name: string;
|
|
13
|
+
category: string;
|
|
14
|
+
url: string;
|
|
15
|
+
} | null) => void;
|
|
16
|
+
description?: string;
|
|
17
|
+
controllerId: string;
|
|
18
|
+
openDropdowns: Writable<Set<string>>;
|
|
19
|
+
toggleDropdown: (id: string) => void;
|
|
20
|
+
onFocus?: () => void;
|
|
21
|
+
hideRecentFromList?: boolean;
|
|
22
|
+
hideTrashIcon?: boolean;
|
|
23
|
+
}
|
|
1
24
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
25
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
26
|
$$bindings?: Bindings;
|
|
@@ -22,24 +45,16 @@ declare const VectorInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
|
22
45
|
* @prop {any} openDropdowns - Store tracking open dropdown states
|
|
23
46
|
* @prop {Function} toggleDropdown - Function to toggle dropdown state
|
|
24
47
|
* @prop {Function} onFocus - Optional focus handler
|
|
25
|
-
*/ label:
|
|
26
|
-
value?:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} | null) => void) | undefined;
|
|
36
|
-
description?: string | undefined;
|
|
37
|
-
controllerId: string;
|
|
38
|
-
openDropdowns: any;
|
|
39
|
-
toggleDropdown: (id: string) => void;
|
|
40
|
-
onFocus?: () => void;
|
|
41
|
-
hideRecentFromList?: boolean;
|
|
42
|
-
hideTrashIcon?: boolean;
|
|
48
|
+
*/ label: VectorInputControllerProps["label"];
|
|
49
|
+
value?: VectorInputControllerProps["value"];
|
|
50
|
+
onChange?: VectorInputControllerProps["onChange"];
|
|
51
|
+
description?: VectorInputControllerProps["description"];
|
|
52
|
+
controllerId: VectorInputControllerProps["controllerId"];
|
|
53
|
+
openDropdowns: VectorInputControllerProps["openDropdowns"];
|
|
54
|
+
toggleDropdown: VectorInputControllerProps["toggleDropdown"];
|
|
55
|
+
onFocus?: VectorInputControllerProps["onFocus"];
|
|
56
|
+
hideRecentFromList?: VectorInputControllerProps["hideRecentFromList"];
|
|
57
|
+
hideTrashIcon?: VectorInputControllerProps["hideTrashIcon"];
|
|
43
58
|
}, {
|
|
44
59
|
[evt: string]: CustomEvent<any>;
|
|
45
60
|
}, {}, {}, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export type { ContentSchemaItemView, ContentSchemaPropertyView, ContentSchemaView, DesignSchemaComponentView, DesignSchemaGroupView, DesignSchemaPropertyView, DesignSchemaView, } from './schemaViews.js';
|
|
1
2
|
export { default as PropsEditor } from './components/editors/PropsEditor.svelte';
|
|
3
|
+
export { default as FontInputController } from './components/ic/FontInputController.svelte';
|
|
2
4
|
export { default as WidgetPreview } from './components/WidgetPreview.svelte';
|
|
3
5
|
export { setFileBrowserUploadConfig } from '@widgetic/file-browser';
|
|
4
6
|
export { setGoogleFontsApiKey, getGoogleFontsKey } from './config';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// EDITORS
|
|
3
3
|
// Props Editor
|
|
4
4
|
export { default as PropsEditor } from './components/editors/PropsEditor.svelte';
|
|
5
|
+
export { default as FontInputController } from './components/ic/FontInputController.svelte';
|
|
5
6
|
export { default as WidgetPreview } from './components/WidgetPreview.svelte';
|
|
6
7
|
export { setFileBrowserUploadConfig } from '@widgetic/file-browser';
|
|
7
8
|
export { setGoogleFontsApiKey, getGoogleFontsKey } from './config';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical view types for the schemas `PropsEditor` edits.
|
|
3
|
+
*
|
|
4
|
+
* These encode the shapes the schema pipelines actually carry across the
|
|
5
|
+
* package boundary — the same views `widget-creator`'s CreatorApp normalizes
|
|
6
|
+
* to (its local `DesignSchemaView` / `ContentSchemaView` mirror these, and
|
|
7
|
+
* must stay structurally identical). They are deliberately *views*, not
|
|
8
|
+
* validators: field sets stay open (`[key: string]: unknown`) because every
|
|
9
|
+
* schema shape is producer-defined, while the keys the editor reads are named.
|
|
10
|
+
*/
|
|
11
|
+
/** A property of a design-schema component as the editor reads it: the
|
|
12
|
+
* identity keys, the controller that drives the input renderer, and the
|
|
13
|
+
* type/default/constraint keys the item-cloning and value-seeding logic
|
|
14
|
+
* reads. Everything else stays open. */
|
|
15
|
+
export interface DesignSchemaPropertyView {
|
|
16
|
+
id?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
defaultValue?: unknown;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
constraints?: Record<string, unknown>;
|
|
23
|
+
inputController?: {
|
|
24
|
+
type?: string;
|
|
25
|
+
} & Record<string, unknown>;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
/** One accordion group of a design-schema component's properties — the
|
|
29
|
+
* `propertyGroups` form the design tab renders. Open to extra keys. */
|
|
30
|
+
export interface DesignSchemaPropertyGroupView {
|
|
31
|
+
name?: string;
|
|
32
|
+
properties?: DesignSchemaPropertyView[];
|
|
33
|
+
visibilityCondition?: {
|
|
34
|
+
dependsOn: string | string[];
|
|
35
|
+
condition: string;
|
|
36
|
+
} & Record<string, unknown>;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/** One component of a design-schema group: its flat properties, plus the
|
|
40
|
+
* grouped `propertyGroups` form the accordion renderer reads. Open to the
|
|
41
|
+
* schema's own extra keys. */
|
|
42
|
+
export interface DesignSchemaComponentView {
|
|
43
|
+
properties?: DesignSchemaPropertyView[];
|
|
44
|
+
propertyGroups?: DesignSchemaPropertyGroupView[];
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** One component group of the design schema (the `componentGroups` array's
|
|
48
|
+
* members). Open to extra keys; the editor reads `name` and `components`. */
|
|
49
|
+
export interface DesignSchemaGroupView {
|
|
50
|
+
name?: string;
|
|
51
|
+
components?: DesignSchemaComponentView[];
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The design schema as the pipeline carries it: after
|
|
56
|
+
* `normalizeDesignSchemaFromApiResponse` it is **either a group array (the
|
|
57
|
+
* merged single-group form) or null** — the envelope variants
|
|
58
|
+
* (`componentGroups` on an object, legacy `theme`-only payloads) are
|
|
59
|
+
* collapsed upstream of this type.
|
|
60
|
+
*/
|
|
61
|
+
export type DesignSchemaView = DesignSchemaGroupView[];
|
|
62
|
+
/** A property of a content item (or of `genericContent`) as the editor reads
|
|
63
|
+
* it: the id/name the state keys are built from, the controller that drives
|
|
64
|
+
* the input renderer, the legacy `value` seed, and whatever else the schema
|
|
65
|
+
* author put there. */
|
|
66
|
+
export interface ContentSchemaPropertyView {
|
|
67
|
+
id?: string;
|
|
68
|
+
name?: string;
|
|
69
|
+
inputController?: {
|
|
70
|
+
type?: string;
|
|
71
|
+
} & Record<string, unknown>;
|
|
72
|
+
value?: unknown;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** One content-item entry of the content schema (the `contentItems` array's
|
|
76
|
+
* members). `id`, `title` and `properties` are what the editor's item
|
|
77
|
+
* list/merge/preview helpers read. */
|
|
78
|
+
export interface ContentSchemaItemView {
|
|
79
|
+
id?: string;
|
|
80
|
+
title?: string;
|
|
81
|
+
orderNumber?: number;
|
|
82
|
+
properties?: ContentSchemaPropertyView[];
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The content schema as the pipeline carries it: the raw 200 payload's object
|
|
87
|
+
* form (may arrive wrapped as `{ data: … }` from the response envelope), with
|
|
88
|
+
* the keys the editor reads named — `contentItems` (array form; the legacy
|
|
89
|
+
* object form is tolerated at the read sites and Array-guarded before use),
|
|
90
|
+
* `genericContent` (the first-item fallback when a schema ships no items),
|
|
91
|
+
* `options` (editor limits, e.g. `{ max }`), plus the open remainder.
|
|
92
|
+
*/
|
|
93
|
+
export interface ContentSchemaView {
|
|
94
|
+
/** Response-envelope artifact of the upstream API; tolerated, never authored here. */
|
|
95
|
+
data?: {
|
|
96
|
+
contentItems?: ContentSchemaItemView[] | Record<string, unknown>;
|
|
97
|
+
};
|
|
98
|
+
contentItems?: ContentSchemaItemView[];
|
|
99
|
+
genericContent?: {
|
|
100
|
+
title?: string;
|
|
101
|
+
properties?: ContentSchemaPropertyView[];
|
|
102
|
+
};
|
|
103
|
+
options?: Record<string, unknown>;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical view types for the schemas `PropsEditor` edits.
|
|
3
|
+
*
|
|
4
|
+
* These encode the shapes the schema pipelines actually carry across the
|
|
5
|
+
* package boundary — the same views `widget-creator`'s CreatorApp normalizes
|
|
6
|
+
* to (its local `DesignSchemaView` / `ContentSchemaView` mirror these, and
|
|
7
|
+
* must stay structurally identical). They are deliberately *views*, not
|
|
8
|
+
* validators: field sets stay open (`[key: string]: unknown`) because every
|
|
9
|
+
* schema shape is producer-defined, while the keys the editor reads are named.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -163,7 +163,7 @@ class FontManager {
|
|
|
163
163
|
if (FontManager.missingApiKeyWarned)
|
|
164
164
|
return;
|
|
165
165
|
FontManager.missingApiKeyWarned = true;
|
|
166
|
-
console.warn('[FontManager] Google Fonts API key is missing. Set PUBLIC_GOOGLE_FONTS_API_KEY in Frontend/
|
|
166
|
+
console.warn('[FontManager] Google Fonts API key is missing. Set PUBLIC_GOOGLE_FONTS_API_KEY in Frontend/editor/.env ' +
|
|
167
167
|
'(or VITE_GOOGLE_FONTS_API_KEY in widget-creator/.env when using the embedded editor), then restart the dev server.');
|
|
168
168
|
}
|
|
169
169
|
warnForbiddenApiKey() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/editor",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"clean-modules": "rm -rf node_modules",
|
|
30
30
|
"clean-all": "rm -rf node_modules && rm -rf package-lock.json",
|
|
31
31
|
"lps": "npm link @widgetic/design-system @widgetic/api-sdk @widgetic/file-browser @widgetic/cache-layer",
|
|
32
|
+
"llinks": "ls -la node_modules/@widgetic",
|
|
32
33
|
"stop-dev": "lsof -i :5180 | awk 'NR>1 {print $2}' | xargs kill",
|
|
33
|
-
"dev": "npm run stop-dev && npm run dev-sv",
|
|
34
|
+
"dev": "npm run sync-embed-schema && npm run stop-dev && npm run dev-sv",
|
|
35
|
+
"sync-embed-schema": "node ../scripts/sync-embed-schema.mjs",
|
|
34
36
|
"dev-sv": "NODE_ENV=development vite dev --port 5180",
|
|
35
37
|
"dev-open": "npm run dev -- --open",
|
|
36
38
|
"render-build": "bash render-build.sh",
|
|
37
|
-
"build": "NODE_ENV=production vite build",
|
|
39
|
+
"build": "npm run sync-embed-schema && NODE_ENV=production vite build",
|
|
38
40
|
"package": "svelte-package",
|
|
39
41
|
"package:watch": "svelte-package --watch",
|
|
40
42
|
"preview": "vite preview",
|
|
@@ -60,12 +62,12 @@
|
|
|
60
62
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
61
63
|
"@tailwindcss/postcss": "^4.1.4",
|
|
62
64
|
"@tailwindcss/typography": "^0.5.19",
|
|
63
|
-
"@types/eslint": "^9.6.0",
|
|
64
65
|
"@types/fontfaceobserver": "^2.1.3",
|
|
65
|
-
"@types/node": "
|
|
66
|
+
"@types/node": "26.6.2",
|
|
66
67
|
"@widgetic/api-sdk": "^1.0.10",
|
|
67
68
|
"@widgetic/cache-layer": "^0.1.1",
|
|
68
|
-
"@widgetic/design-system": "^0.
|
|
69
|
+
"@widgetic/design-system": "^0.5.12",
|
|
70
|
+
"@widgetic/dev-tools": "^0.2.0",
|
|
69
71
|
"@widgetic/file-browser": "^0.5.16",
|
|
70
72
|
"eslint": "^9.0.0",
|
|
71
73
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -112,6 +114,7 @@
|
|
|
112
114
|
"@tiptap/extension-underline": "^2.9.1",
|
|
113
115
|
"@tiptap/pm": "^2.9.1",
|
|
114
116
|
"@tiptap/starter-kit": "^2.9.1",
|
|
117
|
+
"@widgetic/design-system": ">=0.3.0",
|
|
115
118
|
"bits-ui": "^2.16.3",
|
|
116
119
|
"clsx": "^2.1.1",
|
|
117
120
|
"dotenv": "^16.4.5",
|