@widgetic/editor 4.1.14 → 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.
Files changed (76) hide show
  1. package/dist/components/PreviewChromeControls.svelte +15 -21
  2. package/dist/components/WidgetPreview.svelte +136 -105
  3. package/dist/components/color-select/ColorSelect.svelte +203 -224
  4. package/dist/components/color-select/constants.d.ts +4 -2
  5. package/dist/components/color-select/constants.js +4 -2
  6. package/dist/components/color-select/render.js +10 -9
  7. package/dist/components/editors/CompositionEditorApp.svelte +47 -40
  8. package/dist/components/editors/EditLeaseNotice.svelte +44 -33
  9. package/dist/components/editors/EmbedEditor.svelte +133 -259
  10. package/dist/components/editors/PropsEditor.svelte +418 -1338
  11. package/dist/components/editors/props-editor.css +5 -68
  12. package/dist/components/ic/AngleInputController.svelte +202 -277
  13. package/dist/components/ic/BrowserInputController.svelte +813 -803
  14. package/dist/components/ic/CheckboxInputController.svelte +92 -169
  15. package/dist/components/ic/CheckboxInputController.svelte.d.ts +2 -8
  16. package/dist/components/ic/ColorPickerInputController.svelte +1589 -1587
  17. package/dist/components/ic/ColorPickerInputController.svelte.d.ts +3 -3
  18. package/dist/components/ic/DateFieldInputController.svelte +455 -465
  19. package/dist/components/ic/DatePickerInputController.svelte +355 -368
  20. package/dist/components/ic/DatePickerInputController.svelte.d.ts +1 -1
  21. package/dist/components/ic/DropdownInputController.svelte +130 -200
  22. package/dist/components/ic/FixedPositionInputController.svelte +255 -276
  23. package/dist/components/ic/FixedPositionInputController.svelte.d.ts +5 -1
  24. package/dist/components/ic/FontInputController.svelte +2110 -2231
  25. package/dist/components/ic/FontInputController.svelte.d.ts +11 -11
  26. package/dist/components/ic/InputControllerHeader.svelte +141 -147
  27. package/dist/components/ic/InputControllerRow.svelte +74 -0
  28. package/dist/components/ic/InputControllerRow.svelte.d.ts +14 -0
  29. package/dist/components/ic/KnowledgeDocumentsInputController.svelte +84 -47
  30. package/dist/components/ic/KnowledgeTextForm.svelte +35 -33
  31. package/dist/components/ic/NumberControls.svelte +303 -269
  32. package/dist/components/ic/NumberControls.svelte.d.ts +4 -1
  33. package/dist/components/ic/NumberInputController.svelte +361 -301
  34. package/dist/components/ic/NumberInputController.svelte.d.ts +2 -0
  35. package/dist/components/ic/PositionInputController.svelte +253 -176
  36. package/dist/components/ic/PositionInputController.svelte.d.ts +2 -0
  37. package/dist/components/ic/RadioGroupInputController.svelte +71 -137
  38. package/dist/components/ic/RadioGroupInputController.svelte.d.ts +2 -8
  39. package/dist/components/ic/RangeCalendarInputController.svelte +233 -270
  40. package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +2 -2
  41. package/dist/components/ic/RoundedCornersInputController.svelte +412 -435
  42. package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +2 -0
  43. package/dist/components/ic/SliderInputController.svelte +263 -332
  44. package/dist/components/ic/SliderInputController.svelte.d.ts +1 -1
  45. package/dist/components/ic/SliderRangeInputController.svelte +140 -144
  46. package/dist/components/ic/SliderRangeInputController.svelte.d.ts +3 -3
  47. package/dist/components/ic/SwitchInputController.svelte +47 -109
  48. package/dist/components/ic/TagsInputController.svelte +95 -110
  49. package/dist/components/ic/TextAreaInputController.svelte +1794 -1935
  50. package/dist/components/ic/TextAreaPreviewInputController.svelte +436 -438
  51. package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +2 -2
  52. package/dist/components/ic/TextInputController.svelte +65 -75
  53. package/dist/components/ic/TextInputController.svelte.d.ts +2 -0
  54. package/dist/components/ic/TimeInputController.svelte +433 -431
  55. package/dist/components/ic/VectorInputController.svelte +1833 -1831
  56. package/dist/components/ic/VectorInputController.svelte.d.ts +10 -10
  57. package/dist/components/ic/index.d.ts +1 -0
  58. package/dist/components/ic/index.js +1 -0
  59. package/dist/components/ic/shared/CategoryTabs.svelte +28 -35
  60. package/dist/components/ic/shared/ItemGrid.svelte +145 -179
  61. package/dist/components/ic/shared/RecentItemsSection.svelte +208 -271
  62. package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +1 -1
  63. package/dist/components/ui/arrows/OpacitySliderArrows.svelte +23 -38
  64. package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +1 -4
  65. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +45 -0
  66. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte.d.ts +26 -0
  67. package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +20 -12
  68. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte +39 -0
  69. package/dist/components/ui/shadow-picker-host/ShadowPickerHost.svelte.d.ts +10 -0
  70. package/dist/i18n/language.d.ts +43 -36
  71. package/dist/i18n/messages.d.ts +41 -34
  72. package/dist/i18n/messages.js +47 -34
  73. package/dist/i18n/translate.d.ts +1 -1
  74. package/dist/utils.d.ts +7 -0
  75. package/dist/utils.js +26 -2
  76. package/package.json +4 -4
@@ -9,274 +9,148 @@
9
9
  <svelte:options runes={false} />
10
10
 
11
11
  <script lang="ts">
12
- import { onMount } from 'svelte';
13
- import { toast, CopyableHeader } from '@widgetic/design-system/components';
14
- import OK from '../icons/ok.svelte';
15
- import PropsEditor from './PropsEditor.svelte';
16
- import { useEditorLanguage } from '../../i18n/language';
12
+ import { onMount } from 'svelte';
13
+ import { toast, CopyableHeader } from '@widgetic/design-system/components';
14
+ import PropsEditor from './PropsEditor.svelte';
15
+ import { useEditorLanguage } from '../../i18n/language';
17
16
 
18
- /** Component configuration — existing public props and methods are preserved. */
19
- let className = '';
20
- export { className as class };
21
- export let style = '';
22
- /** The title of the code box. Without one, the editor's own word in the language of the page. */
23
- export let embedHeaderText: string | undefined = undefined;
24
- export let embedCode = '';
25
- export let height = 720;
26
- export let embedSchema: any;
27
- // Initial values for embed options (overrides schema defaultValue)
28
- export let initialValues: Record<string, any> = {};
29
- // When false, skip the outer full-page dark wrapper (for embedding inside another layout)
30
- export let standalone = true;
31
- /** Show Save status control in the shared drag bar (composition embed overlay). */
32
- export let showSaveButton = false;
33
- /** True when local embed option edits are not yet persisted. */
34
- export let saveDirty = false;
35
- /** True while a save request is in flight. */
36
- export let saveSaving = false;
17
+ /** Component configuration — existing public props and methods are preserved. */
18
+ let className = '';
19
+ export { className as class };
20
+ export let style = '';
21
+ /** The title of the code box. Without one, the editor's own word in the language of the page. */
22
+ export let embedHeaderText: string | undefined = undefined;
23
+ export let embedCode = '';
24
+ export let height = 720;
25
+ export let embedSchema: any;
26
+ // Initial values for embed options (overrides schema defaultValue)
27
+ export let initialValues: Record<string, any> = {};
28
+ // When false, skip the outer full-page dark wrapper (for embedding inside another layout)
29
+ export let standalone = true;
30
+ /** Show Save status control in the shared drag bar (composition embed overlay). */
31
+ export let showSaveButton = false;
32
+ /** True when local embed option edits are not yet persisted. */
33
+ export let saveDirty = false;
34
+ /** True while a save request is in flight. */
35
+ export let saveSaving = false;
37
36
 
38
- // The words of the editor in the language of the page: the editor above this one chose it (see `provideEditorLanguage`).
39
- const { t } = useEditorLanguage();
37
+ // The words of the editor in the language of the page: the editor above this one chose it (see `provideEditorLanguage`).
38
+ const { t } = useEditorLanguage();
40
39
 
41
- // Loading is currently local initialization; preserve the loading/error presentation.
42
- let loading = true;
43
- let wrapperElement = null;
44
- let internalPropsEditorRef = null;
45
- onMount(() => { loading = false; });
40
+ let loading = true;
41
+ let wrapperElement = null;
42
+ let internalPropsEditorRef = null;
43
+ onMount(() => {
44
+ loading = false;
45
+ });
46
46
 
47
- /**
48
- * Clipboard Interaction Handlers
49
- * Provides copy functionality via the copy button
50
- * with visual feedback via toast notifications
51
- */
52
- let isToastVisible = false;
53
- function showToast(type: 'success' | 'error', message: string, options = {}) {
54
- if (isToastVisible) return;
55
- isToastVisible = true;
56
- toast[type](message, {
57
- ...options,
58
- duration: 5000,
59
- unstyled: true,
60
- // The toast puts itself in place with its own classes below (fixed, at the end of the line), so the corner that the
61
- // toaster knows is only a name it needs.
62
- position: 'bottom-right',
63
- classes: {
64
- toast: 'embed-editor-toast flex items-center gap-3 fixed bottom-5 end-5',
65
- title: 'embed-editor-toast-title',
66
- description: 'embed-editor-toast-description',
67
- closeButton: 'embed-editor-toast-close-button'
68
- },
69
- onAutoClose: () => { isToastVisible = false; },
70
- onDismiss: () => { isToastVisible = false; }
71
- });
72
- }
47
+ /** Guard: one toast at a time for copy actions. */
48
+ let isToastVisible = false;
49
+ function showCopyToast(
50
+ type: 'success' | 'error',
51
+ message: string,
52
+ options: Record<string, unknown> = {}
53
+ ) {
54
+ if (isToastVisible) return;
55
+ isToastVisible = true;
56
+ toast[type](message, {
57
+ ...options,
58
+ duration: 5000,
59
+ onAutoClose: () => {
60
+ isToastVisible = false;
61
+ },
62
+ onDismiss: () => {
63
+ isToastVisible = false;
64
+ }
65
+ });
66
+ }
73
67
 
74
- /** Public: update a design value in the internal PropsEditor (external dimension sync). */
75
- export function updateValue(propertyId: string, value: any) {
76
- internalPropsEditorRef?.updateDesignValue?.(propertyId, value);
77
- }
68
+ /** Public: update a design value in the internal PropsEditor (external dimension sync). */
69
+ export function updateValue(propertyId: string, value: any) {
70
+ internalPropsEditorRef?.updateDesignValue?.(propertyId, value);
71
+ }
78
72
 
79
- /** Public: position the same element used by PropsEditor's built-in drag. */
80
- export function setPosition(left: number, top: number) {
81
- internalPropsEditorRef?.setPosition(left, top);
82
- }
73
+ /** Public: position the same element used by PropsEditor's built-in drag. */
74
+ export function setPosition(left: number, top: number) {
75
+ internalPropsEditorRef?.setPosition(left, top);
76
+ }
83
77
 
84
- /** Public: get current position. */
85
- export function getPosition() {
86
- return internalPropsEditorRef?.getPosition() || { left: 0, top: 0 };
87
- }
78
+ /** Public: get current position. */
79
+ export function getPosition() {
80
+ return internalPropsEditorRef?.getPosition() || { left: 0, top: 0 };
81
+ }
88
82
  </script>
89
83
 
90
84
  <div
91
- bind:this={wrapperElement}
92
- class="{standalone ? 'embed-editor-standalone-wrapper min-h-screen w-full flex items-center justify-center widgetic-colors widgetic-radius bg-dark p-4' : 'embed-editor-inline-wrapper absolute h-full w-112.5 max-h-full'}"
85
+ bind:this={wrapperElement}
86
+ class={standalone
87
+ ? 'embed-editor-standalone-wrapper bg-inverse flex min-h-screen w-full items-center justify-center p-4 widgetic-colors widgetic-radius'
88
+ : 'embed-editor-inline-wrapper absolute h-full w-editor-panel max-h-full'}
93
89
  >
94
- <PropsEditor
95
- bind:this={internalPropsEditorRef}
96
- class="embed-editor-container rounded-large bg-white shadow-none {className}"
97
- style="border: 2px solid hsl(var(--grey2)); max-height: 100%; {style}"
98
- width="450px"
99
- height={embedSchema ? (standalone ? `min(${height}px, calc(100dvh - 32px))` : `min(${height}px, 100%)`) : 'auto'}
100
- positionTarget={standalone ? null : wrapperElement}
101
- designSchema={embedCode ? embedSchema : null}
102
- contentSchema={null}
103
- initialDesignValues={initialValues}
104
- defaultOpen={true}
105
- showDragHandle={!loading && !!embedCode}
106
- {showSaveButton}
107
- {saveDirty}
108
- {saveSaving}
109
- title={$t('editor.embed.title')}
110
- dragHandleClass="text-forest-green"
111
- headerClass={!loading && embedCode ? 'bg-grey2' : ''}
112
- showSchemaError={false}
113
- on:save
114
- on:propertyChange
115
- >
116
- {#snippet headerContent()}
117
- {#if loading}
118
- <div class="embed-editor-loading subtext text-grey5 flex items-center justify-center h-full">{$t('editor.embed.loading')}</div>
119
- {:else if !embedCode}
120
- <div class="embed-editor-error flex flex-col items-center justify-center h-full">
121
- <div class="embed-editor-error-title text-error text-lg font-medium">{$t('editor.embed.noCode')}</div>
122
- <div class="embed-editor-error-code text-grey5 subtext mt-1">{$t('editor.failure.errorCode', { code: 'EMBED_CODE_NOT_FOUND' })}</div>
123
- </div>
124
- {:else}
125
- <!-- The only additional panel: code display, help link and clipboard control. -->
126
- <section class="embed-editor-code-header header-hover-area relative shrink-0 bg-grey2" aria-label={$t('editor.embed.headerArea')}>
127
- <CopyableHeader
128
- headerText={embedHeaderText ?? $t('editor.embed.codeHeader')}
129
- content={embedCode}
130
- helpText={$t('editor.embed.readMore')}
131
- helpUrl="/embed"
132
- showStandaloneCopyButton={true}
133
- standaloneCopyButtonText={$t('editor.embed.copy')}
134
- copiedTitle={$t('editor.embed.copied')}
135
- copiedDescription={$t('editor.embed.copiedDone')}
136
- copyFailedTitle={$t('editor.embed.copyFailed')}
137
- copyFailedDescription={$t('editor.embed.copyFailedHint')}
138
- showButtonText={false}
139
- buttonClass="bg-grey2 text-grey7 hover:bg-white rounded-small focus:outline-none focus-visible:outline-none focus:shadow-none focus-visible:shadow-none"
140
- style="border-start-start-radius: var(--radius-large); border-start-end-radius: var(--radius-large);"
141
- on:copy={() => {
142
- showToast('success', $t('editor.embed.copied'), {
143
- description: $t('editor.embed.copiedHint'),
144
- icon: OK
145
- });
146
- }}
147
- />
148
- </section>
149
- {/if}
150
- {/snippet}
151
- </PropsEditor>
90
+ <PropsEditor
91
+ bind:this={internalPropsEditorRef}
92
+ class="embed-editor-container {className}"
93
+ style="max-height: 100%; {style}"
94
+ width="450px"
95
+ height={embedSchema
96
+ ? standalone
97
+ ? `min(${height}px, calc(100dvh - 32px))`
98
+ : `min(${height}px, 100%)`
99
+ : 'auto'}
100
+ positionTarget={standalone ? null : wrapperElement}
101
+ designSchema={embedCode ? embedSchema : null}
102
+ contentSchema={null}
103
+ initialDesignValues={initialValues}
104
+ defaultOpen={true}
105
+ showDragHandle={!loading && !!embedCode}
106
+ {showSaveButton}
107
+ {saveDirty}
108
+ {saveSaving}
109
+ title={$t('editor.embed.title')}
110
+ showSchemaError={false}
111
+ on:save
112
+ on:propertyChange
113
+ >
114
+ {#snippet headerContent()}
115
+ <section
116
+ class="embed-editor-code-header flex flex-col gap-3 px-6 pt-3 pb-4"
117
+ aria-label={$t('editor.embed.headerArea')}
118
+ aria-busy={loading}
119
+ >
120
+ <CopyableHeader
121
+ headerText={embedHeaderText ?? $t('editor.embed.codeHeader')}
122
+ content={embedCode}
123
+ helpPrompt={$t('editor.embed.helpPrompt')}
124
+ helpText={$t('editor.embed.learnMore')}
125
+ helpLinkAria={$t('editor.embed.helpLinkAria')}
126
+ helpUrl="/embed"
127
+ {loading}
128
+ errorTitle={!loading && !embedCode ? $t('editor.embed.noCode') : ''}
129
+ errorDetail={!loading && !embedCode
130
+ ? $t('editor.failure.errorCode', { code: 'EMBED_CODE_NOT_FOUND' })
131
+ : ''}
132
+ standaloneCopyButtonText={$t('editor.embed.copy')}
133
+ copiedTitle={$t('editor.embed.copied')}
134
+ copiedDescription={$t('editor.embed.copiedHint')}
135
+ copyFailedTitle={$t('editor.embed.copyFailed')}
136
+ copyFailedDescription={$t('editor.embed.copyFailedHint')}
137
+ showInternalToast={false}
138
+ class="w-full"
139
+ on:copy={() => {
140
+ showCopyToast('success', $t('editor.embed.copied'), {
141
+ description: $t('editor.embed.copiedHint')
142
+ });
143
+ }}
144
+ on:copyError={() => {
145
+ showCopyToast('error', $t('editor.embed.copyFailed'), {
146
+ description: $t('editor.embed.copyFailedHint')
147
+ });
148
+ }}
149
+ />
150
+ {#if loading}
151
+ <span class="sr-only">{$t('editor.embed.loading')}</span>
152
+ {/if}
153
+ </section>
154
+ {/snippet}
155
+ </PropsEditor>
152
156
  </div>
153
-
154
- <style>
155
- /* Remove the DS inline top padding only inside this embed header. */
156
- .embed-editor-code-header :global(.copyable-header) {
157
- padding-top: 0 !important;
158
- }
159
-
160
- /* Style accordion items to match Design system — only within this Embed instance. */
161
- .embed-editor-inline-wrapper :global(.accordion-item),
162
- .embed-editor-standalone-wrapper :global(.accordion-item) {
163
- border: 2px solid hsl(var(--grey2)) !important;
164
- background: white !important;
165
- overflow: hidden !important;
166
- margin-bottom: -2px !important;
167
- position: relative !important;
168
- }
169
-
170
- /* Accordion Item: Handle first, last and single items. */
171
- :global(.embed-editor-container .accordion-item[data-position="only"]) {
172
- border-radius: var(--radius-medium) !important;
173
- }
174
- :global(.embed-editor-container .accordion-item[data-position="first"]) {
175
- border-start-start-radius: var(--radius-medium) !important;
176
- border-start-end-radius: var(--radius-medium) !important;
177
- border-end-start-radius: 0 !important;
178
- border-end-end-radius: 0 !important;
179
- }
180
- :global(.embed-editor-container .accordion-item[data-position="last"]) {
181
- border-start-start-radius: 0 !important;
182
- border-start-end-radius: 0 !important;
183
- border-end-start-radius: var(--radius-medium) !important;
184
- border-end-end-radius: var(--radius-medium) !important;
185
- margin-bottom: 0 !important;
186
- }
187
- :global(.embed-editor-container .accordion-trigger) {
188
- padding: 16px !important;
189
- width: 100% !important;
190
- display: flex !important;
191
- justify-content: space-between !important;
192
- align-items: center !important;
193
- background: white !important;
194
- border: none !important;
195
- }
196
- :global(.embed-editor-container .accordion-trigger:hover .body-medium) {
197
- text-decoration: underline !important;
198
- }
199
- :global(.embed-editor-container .accordion-content) {
200
- padding: 16px !important;
201
- border-top: 2px solid hsl(var(--grey2)) !important;
202
- }
203
- :global(.embed-editor-container .accordion-content > div) {
204
- padding: 0 !important;
205
- background: white !important;
206
- }
207
- /* Style the chevron icon. */
208
- :global(.embed-editor-container .accordion-trigger .chevron) {
209
- transition: transform 200ms ease-out !important;
210
- }
211
- :global(.embed-editor-container .accordion-trigger[data-state="open"] .chevron) {
212
- transform: rotate(180deg) !important;
213
- }
214
- /* Ensure inputs maintain their container width. */
215
- :global(.embed-editor-container input),
216
- :global(.embed-editor-container select),
217
- :global(.embed-editor-container textarea),
218
- :global(.embed-editor-container .input-wrapper),
219
- :global(.embed-editor-container .input-container),
220
- :global(.embed-editor-container .color-picker-popover) {
221
- width: 100%;
222
- min-width: 0;
223
- box-sizing: border-box;
224
- }
225
- /* Ensure popover content stays within bounds. */
226
- :global(.embed-editor-container .popover-content) {
227
- max-width: calc(100% - 2rem);
228
- min-width: 0;
229
- }
230
- /* Button Press Effect */
231
- :global(.embed-editor-container .embed-code-header button) {
232
- transition: background-color 0.1s ease;
233
- }
234
- /** TOASTER STYLES **/
235
- :global(.embed-editor-toast) {
236
- position: fixed !important;
237
- bottom: 20px !important;
238
- inset-inline-end: 20px !important;
239
- top: auto !important;
240
- display: flex !important;
241
- align-items: center !important;
242
- gap: 12px !important;
243
- padding: 16px 24px !important;
244
- background: white !important;
245
- border-radius: var(--radius-small) !important;
246
- box-shadow: 0px 0px 15px 3px rgba(0, 0, 0, 0.1) !important;
247
- }
248
- /* Icon container */
249
- :global(.embed-editor-toast [data-icon]) {
250
- order: -1 !important;
251
- display: flex !important;
252
- align-items: center !important;
253
- justify-content: center !important;
254
- margin: 0 !important;
255
- }
256
- /* Text container */
257
- :global(.embed-editor-toast [data-content]) {
258
- display: flex !important;
259
- flex-direction: column !important;
260
- gap: 4px !important;
261
- margin: 0 !important;
262
- }
263
- /* Toaster close button */
264
- :global(.embed-editor-toast-close-button) {
265
- background: hsl(var(--grey7)) !important;
266
- border: 1px solid hsl(var(--grey5)) !important;
267
- }
268
- :global(.embed-editor-toast-close-button:hover) {
269
- background: hsl(var(--dark)) !important;
270
- border: 1px solid hsl(var(--grey5)) !important;
271
- }
272
- :global(.embed-editor-toast-close-button svg) {
273
- color: white !important;
274
- }
275
- /* Lucide Copy Icon: Set both default and hover colors. */
276
- :global(.embed-editor-container .lucide-copy) {
277
- stroke: hsl(var(--error)) !important;
278
- }
279
- :global(.embed-editor-container button:hover .lucide-copy) {
280
- stroke: hsl(var(--grey7)) !important;
281
- }
282
- </style>