@widgetic/editor 4.1.13 → 4.1.15
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/dist/components/PreviewChromeControls.svelte +15 -21
- package/dist/components/WidgetPreview.svelte +136 -105
- package/dist/components/color-select/ColorSelect.svelte +203 -224
- package/dist/components/color-select/constants.d.ts +4 -2
- package/dist/components/color-select/constants.js +4 -2
- package/dist/components/color-select/render.js +10 -9
- package/dist/components/editors/CompositionEditorApp.svelte +55 -40
- package/dist/components/editors/EditLeaseNotice.svelte +44 -33
- package/dist/components/editors/EmbedEditor.svelte +133 -259
- package/dist/components/editors/PropsEditor.svelte +426 -1333
- package/dist/components/editors/props-editor.css +5 -68
- package/dist/components/ic/AngleInputController.svelte +202 -277
- package/dist/components/ic/BrowserInputController.svelte +813 -803
- package/dist/components/ic/CheckboxInputController.svelte +92 -169
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
- package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
- package/dist/components/ic/DateFieldInputController.svelte +455 -465
- package/dist/components/ic/DatePickerInputController.svelte +355 -368
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
- package/dist/components/ic/DropdownInputController.svelte +130 -200
- package/dist/components/ic/FixedPositionInputController.svelte +255 -276
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
- package/dist/components/ic/FontInputController.svelte +2110 -2231
- package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
- package/dist/components/ic/InputControllerHeader.svelte +141 -147
- package/dist/components/ic/InputControllerRenderer.svelte +5 -1
- package/dist/components/ic/InputControllerRenderer.svelte.d.ts +2 -1
- package/dist/components/ic/InputControllerRow.svelte +74 -0
- package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte +401 -0
- package/dist/components/ic/KnowledgeDocumentsInputController.svelte.d.ts +11 -0
- package/dist/components/ic/KnowledgeTextForm.svelte +109 -0
- package/dist/components/ic/KnowledgeTextForm.svelte.d.ts +15 -0
- package/dist/components/ic/NumberControls.svelte +303 -269
- package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
- package/dist/components/ic/NumberInputController.svelte +361 -301
- package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
- package/dist/components/ic/PositionInputController.svelte +253 -176
- package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
- package/dist/components/ic/RadioGroupInputController.svelte +71 -137
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
- package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
- package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
- package/dist/components/ic/SliderInputController.svelte +263 -332
- package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
- package/dist/components/ic/SliderRangeInputController.svelte +140 -144
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
- package/dist/components/ic/SwitchInputController.svelte +47 -109
- package/dist/components/ic/TagsInputController.svelte +95 -110
- package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
- package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
- package/dist/components/ic/TextInputController.svelte +65 -75
- package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
- package/dist/components/ic/TimeInputController.svelte +433 -431
- package/dist/components/ic/VectorInputController.svelte +1833 -1831
- package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
- package/dist/components/ic/index.d.ts +2 -0
- package/dist/components/ic/index.js +2 -0
- package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
- package/dist/components/ic/shared/ItemGrid.svelte +145 -179
- package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
- package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
- package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
- package/dist/composition/compositionApi.d.ts +21 -1
- package/dist/composition/compositionApi.js +64 -5
- package/dist/composition/knowledgeDocuments.d.ts +90 -0
- package/dist/composition/knowledgeDocuments.js +94 -0
- package/dist/composition/knowledgeDocumentsPanel.d.ts +152 -0
- package/dist/composition/knowledgeDocumentsPanel.js +443 -0
- package/dist/i18n/language.d.ts +86 -36
- package/dist/i18n/messages.d.ts +97 -34
- package/dist/i18n/messages.js +104 -34
- package/dist/i18n/translate.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/knowledgeDocumentsContext.d.ts +10 -0
- package/dist/knowledgeDocumentsContext.js +31 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +26 -2
- package/package.json +4 -4
|
@@ -1,217 +1,140 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
|
|
2
|
+
import type { InputControllerConfig } from './index';
|
|
3
3
|
|
|
4
4
|
/** Declared props contract — export lets below are annotated from it so the
|
|
5
5
|
* interface cannot drift from what the component actually reads. */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
export interface CheckboxInputControllerProps {
|
|
7
|
+
value:
|
|
8
|
+
| string[]
|
|
9
|
+
| { value: string; label: string }[]
|
|
10
|
+
| string
|
|
11
|
+
| { value: string; label: string };
|
|
12
|
+
onChange: (newValue: string[]) => void;
|
|
13
|
+
config?: InputControllerConfig;
|
|
14
|
+
description?: string;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
options?: { value: string; label: string }[];
|
|
17
|
+
}
|
|
14
18
|
</script>
|
|
15
19
|
|
|
16
20
|
<script lang="ts">
|
|
17
|
-
|
|
18
|
-
* CheckboxInputController Component
|
|
19
|
-
* A reusable checkbox group input component that handles multiple selections from a list of options.
|
|
20
|
-
* Supports custom styling, external state management, and accessibility features.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Svelte Lifecycle Imports
|
|
25
|
-
* Required for component setup and cleanup
|
|
26
|
-
*/
|
|
27
|
-
import { onMount, onDestroy } from 'svelte';
|
|
28
|
-
|
|
21
|
+
import { onMount } from 'svelte';
|
|
29
22
|
/**
|
|
30
23
|
* UI Components Imports
|
|
31
24
|
* Shadcn UI checkbox components for consistent styling and behavior
|
|
32
25
|
*/
|
|
33
|
-
|
|
26
|
+
import { Label, Checkbox } from '@widgetic/design-system/components';
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export let config: CheckboxInputControllerProps['config'] = {}; // Additional configuration options
|
|
42
|
-
export let description: CheckboxInputControllerProps['description'] = undefined; // Optional help description text
|
|
43
|
-
export let onFocus: CheckboxInputControllerProps['onFocus'] = () => {}; // Focus event handler
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Configuration Options
|
|
47
|
-
* Derived from config prop with fallbacks
|
|
48
|
-
*/
|
|
49
|
-
export let options: CheckboxInputControllerProps['options'] = config.options || []; // Available options
|
|
28
|
+
export let value: CheckboxInputControllerProps['value'];
|
|
29
|
+
export let onChange: CheckboxInputControllerProps['onChange'];
|
|
30
|
+
export let config: CheckboxInputControllerProps['config'] = {};
|
|
31
|
+
export let description: CheckboxInputControllerProps['description'] = undefined;
|
|
32
|
+
export let onFocus: CheckboxInputControllerProps['onFocus'] = () => {};
|
|
33
|
+
export let options: CheckboxInputControllerProps['options'] = config.options || [];
|
|
50
34
|
|
|
51
35
|
/**
|
|
52
36
|
* Local state
|
|
53
37
|
*/
|
|
54
|
-
|
|
38
|
+
let selectedValues: string[] = [];
|
|
55
39
|
|
|
56
40
|
// Initialize selectedValues based on the input value
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
41
|
+
onMount(() => {
|
|
42
|
+
if (Array.isArray(value)) {
|
|
43
|
+
selectedValues = value.map((v) => (typeof v === 'object' ? v.value : v));
|
|
44
|
+
} else if (value) {
|
|
45
|
+
selectedValues = [typeof value === 'object' ? value.value : value];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
64
48
|
|
|
65
49
|
/**
|
|
66
50
|
* Handles value changes from the checkbox group
|
|
67
51
|
* @param optionValue - The value of the clicked checkbox
|
|
68
52
|
* @param checked - Whether the checkbox is checked or not
|
|
69
53
|
*/
|
|
70
|
-
|
|
54
|
+
function handleValueChange(optionValue: string, checked: boolean) {
|
|
71
55
|
// console.log('CheckboxInputController: handleValueChange', optionValue, checked);
|
|
72
|
-
|
|
73
|
-
if (checked) {
|
|
56
|
+
if (checked) {
|
|
74
57
|
// Add value if not already in array
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
onChange(selectedValues);
|
|
84
|
-
}
|
|
58
|
+
if (!selectedValues.includes(optionValue)) {
|
|
59
|
+
selectedValues = [...selectedValues, optionValue];
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
selectedValues = selectedValues.filter((v) => v !== optionValue);
|
|
63
|
+
}
|
|
64
|
+
onChange(selectedValues);
|
|
65
|
+
}
|
|
85
66
|
|
|
86
67
|
/**
|
|
87
68
|
* Handles click on the entire row
|
|
88
69
|
* @param optionValue - The value to toggle
|
|
89
70
|
*/
|
|
90
|
-
|
|
71
|
+
function handleRowClick(optionValue: string) {
|
|
91
72
|
// Toggle the checkbox
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
const isCurrentlySelected = selectedValues.includes(optionValue);
|
|
74
|
+
handleValueChange(optionValue, !isCurrentlySelected);
|
|
75
|
+
}
|
|
95
76
|
|
|
96
77
|
/**
|
|
97
78
|
* Stops event propagation to prevent double-firing of click events
|
|
98
79
|
* @param event - The mouse event
|
|
99
80
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Create proper event handlers for shadcn components
|
|
106
|
-
*/
|
|
107
|
-
function createHandlers() {
|
|
108
|
-
return {
|
|
109
|
-
// Use a function that returns a new object with events
|
|
110
|
-
// Note that these are not Svelte event directives but rather
|
|
111
|
-
// props expected by the shadcn components
|
|
112
|
-
onclick: stopPropagation
|
|
113
|
-
};
|
|
114
|
-
}
|
|
81
|
+
function stopPropagation(event: MouseEvent) {
|
|
82
|
+
event.stopPropagation();
|
|
83
|
+
}
|
|
115
84
|
|
|
116
85
|
/**
|
|
117
86
|
* Update local value when external value changes
|
|
118
87
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
88
|
+
$: {
|
|
89
|
+
if (value) {
|
|
90
|
+
if (Array.isArray(value)) {
|
|
91
|
+
selectedValues = value.map((v) => (typeof v === 'object' ? v.value : v));
|
|
92
|
+
} else {
|
|
93
|
+
selectedValues = [typeof value === 'object' ? value.value : value];
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
selectedValues = [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
130
99
|
|
|
131
100
|
/**
|
|
132
101
|
* Helper function to check if a value is selected
|
|
133
102
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
103
|
+
function isChecked(optionValue: string): boolean {
|
|
104
|
+
return selectedValues.includes(optionValue);
|
|
105
|
+
}
|
|
137
106
|
</script>
|
|
138
107
|
|
|
139
|
-
<div class="flex flex-col gap-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
108
|
+
<div class="flex flex-col gap-1">
|
|
109
|
+
<div
|
|
110
|
+
class="flex w-full flex-col gap-2 rounded-lg bg-accent px-3 py-4 transition-colors duration-fast hover:bg-accent-hover focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background"
|
|
111
|
+
onfocusin={onFocus}
|
|
112
|
+
>
|
|
113
|
+
{#each options as option}
|
|
114
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
115
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
116
|
+
<div
|
|
117
|
+
class="flex cursor-pointer items-center gap-2"
|
|
118
|
+
onclick={() => handleRowClick(option.value)}
|
|
119
|
+
>
|
|
120
|
+
<Checkbox
|
|
121
|
+
id={`checkbox-${option.value}`}
|
|
122
|
+
checked={isChecked(option.value)}
|
|
123
|
+
onCheckedChange={(checked) => handleValueChange(option.value, checked)}
|
|
124
|
+
onclick={stopPropagation}
|
|
125
|
+
/>
|
|
126
|
+
<Label
|
|
127
|
+
for={`checkbox-${option.value}`}
|
|
128
|
+
class="w-full cursor-pointer select-none text-body text-foreground"
|
|
129
|
+
onclick={stopPropagation}
|
|
130
|
+
>
|
|
131
|
+
{option.label}
|
|
132
|
+
</Label>
|
|
133
|
+
</div>
|
|
134
|
+
{/each}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
{#if description}
|
|
138
|
+
<p class="text-caption text-muted-foreground">{description}</p>
|
|
139
|
+
{/if}
|
|
171
140
|
</div>
|
|
172
|
-
|
|
173
|
-
<style>
|
|
174
|
-
/* Custom checkbox styling to match design system */
|
|
175
|
-
:global(.checkbox-item:focus-visible),
|
|
176
|
-
:global(.checkbox-item:focus-within) {
|
|
177
|
-
outline: none;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* Update checkbox styles */
|
|
181
|
-
:global(.checkbox-item) {
|
|
182
|
-
border-radius: 3px; /* Set rounded corners to 3px */
|
|
183
|
-
width: 16px; /* Set width to 20px */
|
|
184
|
-
height: 16px; /* Set height to 20px */
|
|
185
|
-
border: 2px solid hsl(var(--grey7)); /* Set border to 2px */
|
|
186
|
-
display: flex; /* Ensure the checkbox is a flex container */
|
|
187
|
-
align-items: center; /* Center the checkmark vertically */
|
|
188
|
-
justify-content: center; /* Center the checkmark horizontally */
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/* Scale the checkmark */
|
|
192
|
-
:global(.checkbox-item svg) {
|
|
193
|
-
width: 16px; /* Set width of checkmark to 16px */
|
|
194
|
-
height: 16px; /* Set height of checkmark to 16px */
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/* Remove pointer events from labels when disabled */
|
|
198
|
-
:global(.checkbox-item[disabled] + label) {
|
|
199
|
-
pointer-events: none;
|
|
200
|
-
opacity: 0.5;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/* Ensure checkmark is white when checked */
|
|
204
|
-
:global(.checkbox-item[data-state="checked"]) {
|
|
205
|
-
color: white !important;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/* Target the SVG directly for more specificity */
|
|
209
|
-
:global(.checkbox-item[data-state="checked"] svg) {
|
|
210
|
-
color: white !important;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/* Hide checkmark when unchecked */
|
|
214
|
-
:global(.checkbox-item[data-state="unchecked"] svg) {
|
|
215
|
-
display: none;
|
|
216
|
-
}
|
|
217
|
-
</style>
|
|
@@ -32,18 +32,12 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
32
32
|
z_$$bindings?: Bindings;
|
|
33
33
|
}
|
|
34
34
|
declare const CheckboxInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
35
|
-
|
|
36
|
-
* Component Props
|
|
37
|
-
* External properties that configure the checkbox group's behavior and appearance
|
|
38
|
-
*/ value: CheckboxInputControllerProps["value"];
|
|
35
|
+
value: CheckboxInputControllerProps["value"];
|
|
39
36
|
onChange: CheckboxInputControllerProps["onChange"];
|
|
40
37
|
config?: CheckboxInputControllerProps["config"];
|
|
41
38
|
description?: CheckboxInputControllerProps["description"];
|
|
42
39
|
onFocus?: CheckboxInputControllerProps["onFocus"];
|
|
43
|
-
|
|
44
|
-
* Configuration Options
|
|
45
|
-
* Derived from config prop with fallbacks
|
|
46
|
-
*/ options?: CheckboxInputControllerProps["options"];
|
|
40
|
+
options?: CheckboxInputControllerProps["options"];
|
|
47
41
|
}, {
|
|
48
42
|
[evt: string]: CustomEvent<any>;
|
|
49
43
|
}, {}, {}, string>;
|