@widgetic/editor 4.1.14 → 4.1.16

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 +44 -281
  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 +5 -5
@@ -18,128 +18,151 @@
18
18
  -->
19
19
 
20
20
  <script module lang="ts">
21
+ /** The nine grid alignments the controller can select — shared between the
22
+ * props contract above and the instance script below. */
21
23
  /** The nine grid alignments the controller can select — shared between the
22
24
  * props contract above and the instance script below. */
23
- const positions = [
24
- 'top-left', 'top-center', 'top-right',
25
- 'center-left', 'center-center', 'center-right',
26
- 'bottom-left', 'bottom-center', 'bottom-right'
27
- ] as const;
28
- type Position = typeof positions[number];
29
-
25
+ const positions = [
26
+ 'top-left',
27
+ 'top-center',
28
+ 'top-right',
29
+ 'center-left',
30
+ 'center-center',
31
+ 'center-right',
32
+ 'bottom-left',
33
+ 'bottom-center',
34
+ 'bottom-right'
35
+ ] as const;
36
+ type Position = (typeof positions)[number];
37
+
38
+ /** Declared props contract — export lets below are annotated from it so the
39
+ * interface cannot drift from what the component actually reads. */
30
40
  /** Declared props contract — export lets below are annotated from it so the
31
41
  * interface cannot drift from what the component actually reads. */
32
- export interface FixedPositionInputControllerProps {
33
- value?: Position;
34
- onChange: (newValue: Position) => void;
35
- onFocus?: () => void;
36
- id?: string;
37
- }
42
+ export interface FixedPositionInputControllerProps {
43
+ value?: Position;
44
+ onChange: (newValue: Position) => void;
45
+ onFocus?: () => void;
46
+ id?: string;
47
+ }
38
48
  </script>
39
49
 
40
50
  <script lang="ts">
41
- // Svelte imports
42
- import { onDestroy } from 'svelte';
43
- import { useEditorLanguage } from '../../i18n/language';
44
- import { fixedPositionLabel } from '../../i18n/labels';
45
-
46
- // The words of the editor in the language of the page.
47
- const { t } = useEditorLanguage();
48
-
51
+ // Svelte imports
49
52
  // Import icons from Tabler
50
- import {
51
- IconArrowUpLeft,
52
- IconArrowUp,
53
- IconArrowUpRight,
54
- IconArrowLeft,
55
- IconCircle,
56
- IconArrowRight,
57
- IconArrowDownLeft,
58
- IconArrowDown,
59
- IconArrowDownRight
60
- }
61
- from '@widgetic/design-system/icons';
62
-
63
- // Fixed-position background & icon SVGs (imported with ?url to avoid absolute /icons/ paths)
64
- import bgDeselected from '../../assets/icons/ic-fixed-position/background-deselected.svg?url';
65
- import bgSelected from '../../assets/icons/ic-fixed-position/background-selected.svg?url';
66
- import blBgDeselected from '../../assets/icons/ic-fixed-position/bottom-left-background-deselected.svg?url';
67
- import blBgSelected from '../../assets/icons/ic-fixed-position/bottom-left-background-selected.svg?url';
68
- import blIcon from '../../assets/icons/ic-fixed-position/bottom-left-icon.svg?url';
69
- import brBgDeselected from '../../assets/icons/ic-fixed-position/bottom-right-background-deselected.svg?url';
70
- import brBgSelected from '../../assets/icons/ic-fixed-position/bottom-right-background-selected.svg?url';
71
- import brIcon from '../../assets/icons/ic-fixed-position/bottom-right-icon.svg?url';
72
- import centerBottomIcon from '../../assets/icons/ic-fixed-position/center-bottom-icon.svg?url';
73
- import centerCenterIcon from '../../assets/icons/ic-fixed-position/center-center-icon.svg?url';
74
- import centerLeftIcon from '../../assets/icons/ic-fixed-position/center-left-icon.svg?url';
75
- import centerRightIcon from '../../assets/icons/ic-fixed-position/center-right-icon.svg?url';
76
- import centerTopIcon from '../../assets/icons/ic-fixed-position/center-top-icon.svg?url';
77
- import tlBgDeselected from '../../assets/icons/ic-fixed-position/top-left-background-deselected.svg?url';
78
- import tlBgSelected from '../../assets/icons/ic-fixed-position/top-left-background-selected.svg?url';
79
- import tlIcon from '../../assets/icons/ic-fixed-position/top-left-icon.svg?url';
80
- import trBgDeselected from '../../assets/icons/ic-fixed-position/top-right-background-deselected.svg?url';
81
- import trBgSelected from '../../assets/icons/ic-fixed-position/top-right-background-selected.svg?url';
82
- import trIcon from '../../assets/icons/ic-fixed-position/top-right-icon.svg?url';
83
-
84
- const fixedPositionIcons: Record<string, string> = {
85
- 'background-deselected': bgDeselected,
86
- 'background-selected': bgSelected,
87
- 'bottom-left-background-deselected': blBgDeselected,
88
- 'bottom-left-background-selected': blBgSelected,
89
- 'bottom-left-icon': blIcon,
90
- 'bottom-right-background-deselected': brBgDeselected,
91
- 'bottom-right-background-selected': brBgSelected,
92
- 'bottom-right-icon': brIcon,
93
- 'center-bottom-icon': centerBottomIcon,
94
- 'center-center-icon': centerCenterIcon,
95
- 'center-left-icon': centerLeftIcon,
96
- 'center-right-icon': centerRightIcon,
97
- 'center-top-icon': centerTopIcon,
98
- 'top-left-background-deselected': tlBgDeselected,
99
- 'top-left-background-selected': tlBgSelected,
100
- 'top-left-icon': tlIcon,
101
- 'top-right-background-deselected': trBgDeselected,
102
- 'top-right-background-selected': trBgSelected,
103
- 'top-right-icon': trIcon,
104
- };
105
-
106
- // Component props
107
- export let value: FixedPositionInputControllerProps['value'] = 'bottom-right';
108
- export let onChange: FixedPositionInputControllerProps['onChange'];
109
- export let onFocus: FixedPositionInputControllerProps['onFocus'] = () => {};
110
- export let id: FixedPositionInputControllerProps['id'] = undefined;
111
-
112
- /**
113
- * Defines all valid position combinations in a 3x3 grid
114
- * Order matters for visual layout and keyboard navigation
115
- */
116
- type Position = typeof positions[number];
117
-
118
- // Map positions to their corresponding icons
119
- const positionIcons = {
120
- 'top-left': IconArrowUpLeft,
121
- 'top-center': IconArrowUp,
122
- 'top-right': IconArrowUpRight,
123
- 'center-left': IconArrowLeft,
124
- 'center-center': IconCircle,
125
- 'center-right': IconArrowRight,
126
- 'bottom-left': IconArrowDownLeft,
127
- 'bottom-center': IconArrowDown,
128
- 'bottom-right': IconArrowDownRight
129
- } as const;
130
-
53
+ // Svelte imports
54
+ import { onDestroy } from 'svelte';
55
+ import { useEditorLanguage } from '../../i18n/language';
56
+ import { fixedPositionLabel } from '../../i18n/labels';
57
+
58
+ // The words of the editor in the language of the page.
59
+ const { t } = useEditorLanguage();
60
+
61
+ // Import icons from Tabler
62
+ import {
63
+ IconArrowUpLeft,
64
+ IconArrowUp,
65
+ IconArrowUpRight,
66
+ IconArrowLeft,
67
+ IconCircle,
68
+ IconArrowRight,
69
+ IconArrowDownLeft,
70
+ IconArrowDown,
71
+ IconArrowDownRight
72
+ } from '@widgetic/design-system/icons';
73
+
74
+ // Fixed-position background & icon SVGs (imported with ?url to avoid absolute /icons/ paths)
75
+ import bgDeselected from '../../assets/icons/ic-fixed-position/background-deselected.svg?url';
76
+ import bgSelected from '../../assets/icons/ic-fixed-position/background-selected.svg?url';
77
+ import blBgDeselected from '../../assets/icons/ic-fixed-position/bottom-left-background-deselected.svg?url';
78
+ import blBgSelected from '../../assets/icons/ic-fixed-position/bottom-left-background-selected.svg?url';
79
+ import blIcon from '../../assets/icons/ic-fixed-position/bottom-left-icon.svg?url';
80
+ import brBgDeselected from '../../assets/icons/ic-fixed-position/bottom-right-background-deselected.svg?url';
81
+ import brBgSelected from '../../assets/icons/ic-fixed-position/bottom-right-background-selected.svg?url';
82
+ import brIcon from '../../assets/icons/ic-fixed-position/bottom-right-icon.svg?url';
83
+ import centerBottomIcon from '../../assets/icons/ic-fixed-position/center-bottom-icon.svg?url';
84
+ import centerCenterIcon from '../../assets/icons/ic-fixed-position/center-center-icon.svg?url';
85
+ import centerLeftIcon from '../../assets/icons/ic-fixed-position/center-left-icon.svg?url';
86
+ import centerRightIcon from '../../assets/icons/ic-fixed-position/center-right-icon.svg?url';
87
+ import centerTopIcon from '../../assets/icons/ic-fixed-position/center-top-icon.svg?url';
88
+ import tlBgDeselected from '../../assets/icons/ic-fixed-position/top-left-background-deselected.svg?url';
89
+ import tlBgSelected from '../../assets/icons/ic-fixed-position/top-left-background-selected.svg?url';
90
+ import tlIcon from '../../assets/icons/ic-fixed-position/top-left-icon.svg?url';
91
+ import trBgDeselected from '../../assets/icons/ic-fixed-position/top-right-background-deselected.svg?url';
92
+ import trBgSelected from '../../assets/icons/ic-fixed-position/top-right-background-selected.svg?url';
93
+ import trIcon from '../../assets/icons/ic-fixed-position/top-right-icon.svg?url';
94
+
95
+ const fixedPositionIcons: Record<string, string> = {
96
+ 'background-deselected': bgDeselected,
97
+ 'background-selected': bgSelected,
98
+ 'bottom-left-background-deselected': blBgDeselected,
99
+ 'bottom-left-background-selected': blBgSelected,
100
+ 'bottom-left-icon': blIcon,
101
+ 'bottom-right-background-deselected': brBgDeselected,
102
+ 'bottom-right-background-selected': brBgSelected,
103
+ 'bottom-right-icon': brIcon,
104
+ 'center-bottom-icon': centerBottomIcon,
105
+ 'center-center-icon': centerCenterIcon,
106
+ 'center-left-icon': centerLeftIcon,
107
+ 'center-right-icon': centerRightIcon,
108
+ 'center-top-icon': centerTopIcon,
109
+ 'top-left-background-deselected': tlBgDeselected,
110
+ 'top-left-background-selected': tlBgSelected,
111
+ 'top-left-icon': tlIcon,
112
+ 'top-right-background-deselected': trBgDeselected,
113
+ 'top-right-background-selected': trBgSelected,
114
+ 'top-right-icon': trIcon
115
+ };
116
+
117
+ // Component props
118
+ export let value: FixedPositionInputControllerProps['value'] = 'bottom-right';
119
+ export let onChange: FixedPositionInputControllerProps['onChange'];
120
+ export let onFocus: FixedPositionInputControllerProps['onFocus'] = () => {};
121
+ export let id: FixedPositionInputControllerProps['id'] = undefined;
122
+
123
+ /**
124
+ * Defines all valid position combinations in a 3x3 grid
125
+ * Order matters for visual layout and keyboard navigation
126
+ */
127
+ type Position = (typeof positions)[number];
128
+
129
+ // Map positions to their corresponding icons
130
+ const positionIcons = {
131
+ 'top-left': IconArrowUpLeft,
132
+ 'top-center': IconArrowUp,
133
+ 'top-right': IconArrowUpRight,
134
+ 'center-left': IconArrowLeft,
135
+ 'center-center': IconCircle,
136
+ 'center-right': IconArrowRight,
137
+ 'bottom-left': IconArrowDownLeft,
138
+ 'bottom-center': IconArrowDown,
139
+ 'bottom-right': IconArrowDownRight
140
+ } as const;
141
+
142
+ /**
143
+ * Updates position state and triggers change event
144
+ * Prevents unnecessary updates when selecting current position
145
+ * @param position - The new position to set
146
+ */
131
147
  /**
132
148
  * Updates position state and triggers change event
133
149
  * Prevents unnecessary updates when selecting current position
134
150
  * @param position - The new position to set
135
151
  */
136
- function handlePositionClick(position: Position) {
137
- if (position !== value) {
138
- value = position;
139
- onChange(position);
140
- }
141
- }
142
-
152
+ function handlePositionClick(position: Position) {
153
+ if (position !== value) {
154
+ value = position;
155
+ onChange(position);
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Determines the appropriate background SVG path based on position and state
161
+ * Uses simplified backgrounds for center positions to reduce complexity
162
+ * @param position - The position to get background for
163
+ * @param isSelected - Whether the position is currently selected
164
+ * @returns Path to the appropriate background SVG
165
+ */
143
166
  /**
144
167
  * Determines the appropriate background SVG path based on position and state
145
168
  * Uses simplified backgrounds for center positions to reduce complexity
@@ -147,227 +170,183 @@
147
170
  * @param isSelected - Whether the position is currently selected
148
171
  * @returns Path to the appropriate background SVG
149
172
  */
150
- function getBackgroundPath(position: Position, isSelected: boolean) {
151
- const state = isSelected ? 'selected' : 'deselected';
152
-
153
- // Use simple background for center positions and center column
154
- if (position === 'center-left' ||
155
- position === 'center-center' ||
156
- position === 'center-right' ||
157
- position === 'top-center' ||
158
- position === 'bottom-center') {
159
- return fixedPositionIcons[`background-${state}`];
160
- }
161
-
162
- // Use position-specific backgrounds for corners
163
- return fixedPositionIcons[`${position}-background-${state}`];
164
- }
165
-
173
+ function getBackgroundPath(position: Position, isSelected: boolean) {
174
+ const state = isSelected ? 'selected' : 'deselected';
175
+
176
+ // Use simple background for center positions and center column
177
+ if (
178
+ position === 'center-left' ||
179
+ position === 'center-center' ||
180
+ position === 'center-right' ||
181
+ position === 'top-center' ||
182
+ position === 'bottom-center'
183
+ ) {
184
+ return fixedPositionIcons[`background-${state}`];
185
+ }
186
+
187
+ // Use position-specific backgrounds for corners
188
+ return fixedPositionIcons[`${position}-background-${state}`];
189
+ }
190
+
191
+ /**
192
+ * Generates a complete SVG icon dynamically
193
+ * Creates a Blob URL for memory-efficient SVG handling
194
+ * @param position - The position to get icon for
195
+ * @returns Path to the appropriate icon SVG
196
+ */
166
197
  /**
167
198
  * Generates a complete SVG icon dynamically
168
199
  * Creates a Blob URL for memory-efficient SVG handling
169
200
  * @param position - The position to get icon for
170
201
  * @returns Path to the appropriate icon SVG
171
202
  */
172
- function getIconPath(position: Position) {
173
- // Create white version of icons by adding stroke="white" to the SVG paths
174
- const iconSvg = `
203
+ function getIconPath(position: Position) {
204
+ // Create white version of icons by adding stroke="white" to the SVG paths
205
+ const iconSvg = `
175
206
  <svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
176
207
  ${getIconPaths(position)}
177
208
  </svg>
178
209
  `;
179
-
180
- const blob = new Blob([iconSvg], { type: 'image/svg+xml' });
181
- return URL.createObjectURL(blob);
182
- }
183
210
 
211
+ const blob = new Blob([iconSvg], { type: 'image/svg+xml' });
212
+ return URL.createObjectURL(blob);
213
+ }
214
+
215
+ /**
216
+ * Generates SVG paths dynamically
217
+ * Uses the current selected position to determine the color of the paths
218
+ * @param position - The position to get paths for
219
+ * @returns SVG paths for the appropriate icon
220
+ */
184
221
  /**
185
222
  * Generates SVG paths dynamically
186
223
  * Uses the current selected position to determine the color of the paths
187
224
  * @param position - The position to get paths for
188
225
  * @returns SVG paths for the appropriate icon
189
226
  */
190
- function getIconPaths(position: Position) {
191
- const color = value === position ? 'white' : '#2E2E2E';
192
-
193
- switch (position) {
194
- case 'top-left':
195
- return `
227
+ function getIconPaths(position: Position) {
228
+ const color = value === position ? 'white' : '#2E2E2E';
229
+
230
+ switch (position) {
231
+ case 'top-left':
232
+ return `
196
233
  <path d="M7.49487 7L17.4949 17" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
197
234
  <path d="M16.4949 7H7.49487V16" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
198
235
  `;
199
- case 'top-center':
200
- return `
236
+ case 'top-center':
237
+ return `
201
238
  <path d="M12.4949 5V19" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
202
239
  <path d="M18.4949 11L12.4949 5" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
203
240
  <path d="M6.49487 11L12.4949 5" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
204
241
  `;
205
- case 'top-right':
206
- return `
242
+ case 'top-right':
243
+ return `
207
244
  <path d="M17.4949 7L7.49487 17" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
208
245
  <path d="M8.49487 7H17.4949V16" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
209
246
  `;
210
- case 'center-left':
211
- return `
247
+ case 'center-left':
248
+ return `
212
249
  <path d="M5.49487 12H19.4949" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
213
250
  <path d="M11.4949 18L5.49487 12" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
214
251
  <path d="M11.4949 6L5.49487 12" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
215
252
  `;
216
- case 'center-center':
217
- return `
253
+ case 'center-center':
254
+ return `
218
255
  <path d="M5.49487 12C5.49487 12.9193 5.67593 13.8295 6.02772 14.6788C6.3795 15.5281 6.89512 16.2997 7.54513 16.9497C8.19514 17.5998 8.96681 18.1154 9.81609 18.4672C10.6654 18.8189 11.5756 19 12.4949 19C13.4141 19 14.3244 18.8189 15.1737 18.4672C16.0229 18.1154 16.7946 17.5998 17.4446 16.9497C18.0946 16.2997 18.6102 15.5281 18.962 14.6788C19.3138 13.8295 19.4949 12.9193 19.4949 12C19.4949 11.0807 19.3138 10.1705 18.962 9.32122C18.6102 8.47194 18.0946 7.70026 17.4446 7.05025C16.7946 6.40024 16.0229 5.88463 15.1737 5.53284C14.3244 5.18106 13.4141 5 12.4949 5C11.5756 5 10.6654 5.18106 9.81609 5.53284C8.96681 5.88463 8.19514 6.40024 7.54513 7.05025C6.89512 7.70026 6.3795 8.47194 6.02772 9.32122C5.67593 10.1705 5.49487 11.0807 5.49487 12Z" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
219
256
  `;
220
- case 'center-right':
221
- return `
257
+ case 'center-right':
258
+ return `
222
259
  <path d="M19.4949 12H5.49487" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
223
260
  <path d="M13.4949 6L19.4949 12" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
224
261
  <path d="M13.4949 18L19.4949 12" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
225
262
  `;
226
- case 'bottom-left':
227
- return `
263
+ case 'bottom-left':
264
+ return `
228
265
  <path d="M7.49487 17L17.4949 7" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
229
266
  <path d="M16.4949 17H7.49487V8" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
230
267
  `;
231
- case 'bottom-center':
232
- return `
268
+ case 'bottom-center':
269
+ return `
233
270
  <path d="M12.4949 19V5" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
234
271
  <path d="M18.4949 13L12.4949 19" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
235
272
  <path d="M6.49487 13L12.4949 19" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
236
273
  `;
237
- case 'bottom-right':
238
- return `
274
+ case 'bottom-right':
275
+ return `
239
276
  <path d="M17.4949 17L7.49487 7" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
240
277
  <path d="M8.49487 17H17.4949V8" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
241
278
  `;
242
- }
243
- }
244
-
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Splits the combined position value into vertical and horizontal components
284
+ * @param position - Combined position value (e.g., "bottom-right")
285
+ * @returns Object with separate vertical and horizontal values
286
+ */
245
287
  /**
246
288
  * Splits the combined position value into vertical and horizontal components
247
289
  * @param position - Combined position value (e.g., "bottom-right")
248
290
  * @returns Object with separate vertical and horizontal values
249
291
  */
250
- function splitPosition(position: Position) {
251
- const [vertical, horizontal] = position.split('-');
252
- return { vertical, horizontal };
253
- }
254
-
255
- // Reactive values for position components
256
- $: ({ vertical, horizontal } = splitPosition(value as Position));
257
-
258
- // Cleanup object URLs when component is destroyed
259
- onDestroy(() => {
260
- positions.forEach(position => {
261
- URL.revokeObjectURL(getIconPath(position));
262
- });
263
- });
264
-
265
- function getCornerRounding(pos: Position): string {
266
- switch (pos) {
267
- case 'top-left': return 'rounded-tl-[15px]'; // rtl-ok: the corner of the picture of a screen
268
- case 'top-right': return 'rounded-tr-[15px]'; // rtl-ok: the corner of the picture of a screen
269
- case 'bottom-left': return 'rounded-bl-[15px]'; // rtl-ok: the corner of the picture of a screen
270
- case 'bottom-right': return 'rounded-br-[15px]'; // rtl-ok: the corner of the picture of a screen
271
- default: return '';
272
- }
273
- }
292
+ function splitPosition(position: Position) {
293
+ const [vertical, horizontal] = position.split('-');
294
+ return { vertical, horizontal };
295
+ }
296
+
297
+ // Reactive values for position components
298
+ $: ({ vertical, horizontal } = splitPosition(value as Position));
299
+
300
+ // Cleanup object URLs when component is destroyed
301
+ onDestroy(() => {
302
+ positions.forEach((position) => {
303
+ URL.revokeObjectURL(getIconPath(position));
304
+ });
305
+ });
306
+
307
+ function getCornerRounding(pos: Position): string {
308
+ switch (pos) {
309
+ case 'top-left':
310
+ return 'rounded-tl-[15px]'; // rtl-ok: the corner of the picture of a screen
311
+ case 'top-right':
312
+ return 'rounded-tr-[15px]'; // rtl-ok: the corner of the picture of a screen
313
+ case 'bottom-left':
314
+ return 'rounded-bl-[15px]'; // rtl-ok: the corner of the picture of a screen
315
+ case 'bottom-right':
316
+ return 'rounded-br-[15px]'; // rtl-ok: the corner of the picture of a screen
317
+ default:
318
+ return '';
319
+ }
320
+ }
274
321
  </script>
275
322
 
276
- <!-- Container with relative positioning for overlay -->
277
- <div class="relative widgetic-colors">
278
- <!-- Grid component: the nine places of a screen, top left to bottom right, are a picture of the screen, so it is a left to right island -->
279
- <div
280
- class="fixed-position-grid grid grid-cols-3 gap-[1px] w-fit bg-white rounded-large relative"
281
- dir="ltr"
282
- {id}
283
- >
284
- {#each positions as position}
285
- <button
286
- class="w-[61px] h-[36px] flex items-center justify-center relative focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 transition-colors group/button {getCornerRounding(position)} {
287
- position === value
288
- ? 'bg-sage-green hover:bg-sage-green z-[100]'
289
- : 'bg-grey1 data-[state=open]:bg-grey2 hover:bg-grey2 z-10'
290
- }"
291
- on:click={() => handlePositionClick(position)}
292
- on:focus={onFocus}
293
- aria-label={$t('editor.fixedPosition.set', { position: fixedPositionLabel(position, $t) })}
294
- aria-pressed={position === value}
295
- >
296
- <svelte:component
297
- this={positionIcons[position]}
298
- class="w-6 h-6 pointer-events-none {
299
- position === value
300
- ? '[&>*]:stroke-white [&>*]:group-hover/button:[&>*]:stroke-white'
301
- : '[&>*]:stroke-[hsl(var(--grey5))] group-hover/button:[&>*]:stroke-[hsl(var(--grey7))]'
302
- }"
303
- stroke="currentColor"
304
- />
305
- </button>
306
- {/each}
307
- </div>
308
-
323
+ <!-- Grid: nine alignments as a left-to-right island (picture of a screen). -->
309
324
  <!-- Border overlay with hover effect -->
310
325
  <!-- svelte-ignore element_invalid_self_closing_tag -->
311
- <div
312
- class="absolute inset-0 pointer-events-none rounded-large border border-grey2 transition-colors duration-200 hover:border-forest-green z-50"
313
- aria-hidden="true"
314
- />
326
+ <!-- Grid component: the nine places of a screen, top left to bottom right, are a picture of the screen, so it is a left to right island -->
327
+ <div
328
+ class="fixed-position-grid grid w-full max-w-editor-control grid-cols-3 gap-0.5 rounded-lg bg-background"
329
+ dir="ltr"
330
+ {id}
331
+ >
332
+ {#each positions as position}
333
+ <button
334
+ type="button"
335
+ class="flex h-9 items-center justify-center transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background {getCornerRounding(
336
+ position
337
+ )} {position === value
338
+ ? 'bg-primary text-primary-foreground'
339
+ : 'bg-accent text-foreground hover:bg-accent-hover'}"
340
+ on:click={() => handlePositionClick(position)}
341
+ on:focus={onFocus}
342
+ aria-label={$t('editor.fixedPosition.set', { position: fixedPositionLabel(position, $t) })}
343
+ aria-pressed={position === value}
344
+ >
345
+ <svelte:component
346
+ this={positionIcons[position]}
347
+ class="pointer-events-none size-4 stroke-[1.333]"
348
+ aria-hidden="true"
349
+ />
350
+ </button>
351
+ {/each}
315
352
  </div>
316
-
317
- <style>
318
- /* Base button styles */
319
- button {
320
- outline: none !important;
321
- border: none !important;
322
- }
323
-
324
- /* Icon styles */
325
- :global(.fixed-position-grid button svg) {
326
- stroke-width: 2;
327
- pointer-events: none;
328
- }
329
-
330
- /* Focus states */
331
- :global(.fixed-position-grid button:focus-visible),
332
- :global(.fixed-position-grid button:focus-within) {
333
- outline: none !important;
334
- }
335
-
336
- :global(.fixed-position-grid:focus-within) {
337
- outline: none !important;
338
- }
339
-
340
- /* Selected state */
341
- :global(.fixed-position-grid button[aria-pressed="true"]) {
342
- background-color: hsl(var(--sage-green)) !important;
343
- }
344
-
345
- :global(.fixed-position-grid button[aria-pressed="true"]:hover) {
346
- background-color: hsl(var(--sage-green)) !important;
347
- }
348
-
349
- /* Unselected state */
350
- :global(.fixed-position-grid button:not([aria-pressed="true"]):hover) {
351
- background-color: hsl(var(--grey2)) !important;
352
- }
353
-
354
- /* Icon colors */
355
- :global(.fixed-position-grid button[aria-pressed="true"] svg *) {
356
- stroke: white !important;
357
- fill: none !important;
358
- }
359
-
360
- :global(.fixed-position-grid button[aria-pressed="true"]:hover svg *) {
361
- stroke: white !important;
362
- fill: none !important;
363
- }
364
-
365
- :global(.fixed-position-grid button:not([aria-pressed="true"]):hover svg *) {
366
- stroke: hsl(var(--grey7)) !important;
367
- }
368
-
369
- /* Container hover state */
370
- .relative:hover .absolute {
371
- border-color: hsl(var(--forest-green)) !important;
372
- }
373
- </style>
@@ -1,7 +1,11 @@
1
+ /** The nine grid alignments the controller can select — shared between the
2
+ * props contract above and the instance script below. */
1
3
  /** The nine grid alignments the controller can select — shared between the
2
4
  * props contract above and the instance script below. */
3
5
  declare const positions: readonly ["top-left", "top-center", "top-right", "center-left", "center-center", "center-right", "bottom-left", "bottom-center", "bottom-right"];
4
- type Position = typeof positions[number];
6
+ type Position = (typeof positions)[number];
7
+ /** Declared props contract — export lets below are annotated from it so the
8
+ * interface cannot drift from what the component actually reads. */
5
9
  /** Declared props contract — export lets below are annotated from it so the
6
10
  * interface cannot drift from what the component actually reads. */
7
11
  export interface FixedPositionInputControllerProps {