@widgetic/editor 4.1.17 → 4.1.18

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 (37) hide show
  1. package/dist/components/PreviewChromeControls.svelte +2 -2
  2. package/dist/components/WidgetPreview.svelte +2 -2
  3. package/dist/components/editors/EmbedEditor.svelte +2 -2
  4. package/dist/components/editors/PropsEditor.svelte +115 -19
  5. package/dist/components/ic/AngleInputController.svelte +9 -5
  6. package/dist/components/ic/BrowserInputController.svelte +25 -112
  7. package/dist/components/ic/ColorPickerInputController.svelte +120 -48
  8. package/dist/components/ic/DatePickerInputController.svelte +18 -10
  9. package/dist/components/ic/FixedPositionInputController.svelte +1 -1
  10. package/dist/components/ic/FontInputController.svelte +39 -43
  11. package/dist/components/ic/InputControllerHeader.svelte +1 -1
  12. package/dist/components/ic/KnowledgeDocumentsInputController.svelte +7 -7
  13. package/dist/components/ic/NumberControls.svelte +23 -18
  14. package/dist/components/ic/PositionInputController.svelte +24 -15
  15. package/dist/components/ic/RangeCalendarInputController.svelte +38 -18
  16. package/dist/components/ic/RoundedCornersInputController.svelte +2 -2
  17. package/dist/components/ic/SliderInputController.svelte +11 -4
  18. package/dist/components/ic/TextAreaInputController.svelte +37 -16
  19. package/dist/components/ic/TextAreaPreviewInputController.svelte +9 -8
  20. package/dist/components/ic/TextInputController.svelte +15 -2
  21. package/dist/components/ic/TimeInputController.svelte +1 -1
  22. package/dist/components/ic/VectorInputController.svelte +153 -20
  23. package/dist/components/ic/shared/DropdownChevron.svelte +2 -2
  24. package/dist/components/ic/shared/DropdownChevron.svelte.d.ts +1 -1
  25. package/dist/components/ic/shared/EditorFileBrowserOverlay.svelte +132 -0
  26. package/dist/components/ic/shared/EditorFileBrowserOverlay.svelte.d.ts +27 -0
  27. package/dist/components/ic/shared/ItemGrid.svelte +2 -2
  28. package/dist/components/ic/shared/RecentItemsSection.svelte +6 -6
  29. package/dist/components/ic/shared/editableFieldClasses.d.ts +15 -0
  30. package/dist/components/ic/shared/editableFieldClasses.js +15 -0
  31. package/dist/components/ic/shared/index.d.ts +1 -0
  32. package/dist/components/ic/shared/index.js +1 -0
  33. package/dist/components/ui/calendar-editor-fit/EditorCalendarStyles.svelte +41 -9
  34. package/dist/i18n/language.d.ts +260 -2
  35. package/dist/utils/angleMath.d.ts +2 -0
  36. package/dist/utils/angleMath.js +6 -0
  37. package/package.json +4 -4
@@ -33,6 +33,7 @@
33
33
  let inputValue = String(value);
34
34
  let isEditing = false;
35
35
  let isPressed = false;
36
+ let pressedStepper: 'increment' | 'decrement' | null = null;
36
37
 
37
38
  let autoRepeatTimer: ReturnType<typeof setTimeout> | null = null;
38
39
  let autoRepeatInterval: ReturnType<typeof setInterval> | null = null;
@@ -40,14 +41,14 @@
40
41
  const HOLD_DELAY = 400;
41
42
  const REPEAT_INTERVAL = 80;
42
43
 
43
- // Add unique ID generation
44
+ // Add unique ID generation
44
45
  const inputId = `number-input-${Math.random().toString(36).substr(2, 9)}`;
45
46
 
46
47
  $: isAtMin = !wrapAround && value <= min;
47
48
  $: isAtMax = !wrapAround && value >= max;
48
49
  $: isDisabled = disabled || isLocked;
49
50
 
50
- // Update inputValue when value prop changes and we're not editing
51
+ // Update inputValue when value prop changes and we're not editing
51
52
  $: if (!isEditing) {
52
53
  inputValue = String(value);
53
54
  }
@@ -91,7 +92,7 @@
91
92
  return;
92
93
  }
93
94
 
94
- // Handle special cases
95
+ // Handle special cases
95
96
  if (inputValue === '-0') {
96
97
  inputValue = '0';
97
98
  input.value = '0';
@@ -100,31 +101,31 @@
100
101
  return;
101
102
  }
102
103
 
103
- // If starts with 0 and has more digits, remove the leading 0
104
+ // If starts with 0 and has more digits, remove the leading 0
104
105
  if (inputValue.startsWith('0') && inputValue.length > 1 && !inputValue.startsWith('-')) {
105
106
  inputValue = inputValue.substring(1);
106
107
  input.value = inputValue;
107
108
  }
108
109
 
109
- // Don't allow minus sign if:
110
- // 1. min >= 0
111
- // 2. there's already a minus sign
112
- // 3. there are numbers before it
110
+ // Don't allow minus sign if:
111
+ // 1. min >= 0
112
+ // 2. there's already a minus sign
113
+ // 3. there are numbers before it
113
114
  if (inputValue.includes('-')) {
114
115
  if (min >= 0 || inputValue.indexOf('-') > 0 || inputValue.split('-').length > 2) {
115
- // Remove all minus signs or keep only the first one if allowed
116
+ // Remove all minus signs or keep only the first one if allowed
116
117
  inputValue = min >= 0 ? inputValue.replace(/-/g, '') : '-' + inputValue.replace(/-/g, '');
117
118
  input.value = inputValue;
118
119
  }
119
120
  }
120
121
 
121
- // Update regex to prevent minus sign if min >= 0
122
- // Only allow minus at the start of the string
122
+ // Update regex to prevent minus sign if min >= 0
123
+ // Only allow minus at the start of the string
123
124
  const validNumberRegex = min >= 0 ? /^\d*$/ : /^-?\d*$/;
124
125
  if (!validNumberRegex.test(inputValue)) {
125
- // Remove any invalid characters
126
+ // Remove any invalid characters
126
127
  input.value = inputValue.replace(min >= 0 ? /[^\d]/g : /[^\d-]/g, '');
127
- // If there's a minus, ensure it's at the start
128
+ // If there's a minus, ensure it's at the start
128
129
  if (input.value.includes('-') && input.value.indexOf('-') > 0) {
129
130
  input.value = input.value.replace(/-/g, '');
130
131
  }
@@ -136,7 +137,7 @@
136
137
  if (!isNaN(numValue)) {
137
138
  isEditing = true;
138
139
 
139
- // Validate both min and max during typing
140
+ // Validate both min and max during typing
140
141
  if (wrapAround && max === 360) {
141
142
  if (numValue >= 360) {
142
143
  inputValue = '359';
@@ -159,7 +160,7 @@
159
160
  }
160
161
  }
161
162
 
162
- // Value is within range
163
+ // Value is within range
163
164
  value = numValue;
164
165
  onChange(numValue);
165
166
  }
@@ -176,7 +177,7 @@
176
177
  return;
177
178
  }
178
179
 
179
- // Apply validation on blur
180
+ // Apply validation on blur
180
181
  let validatedValue = finalValue;
181
182
  if (!wrapAround) {
182
183
  if (finalValue < min) validatedValue = min;
@@ -193,11 +194,12 @@
193
194
  function startAutoRepeat(operation: 'increment' | 'decrement', event: MouseEvent) {
194
195
  // Only the main button steps: a right or middle click must not
195
196
  if (event.button !== 0) return;
196
- event.preventDefault();
197
+ // Do not preventDefault on mousedown: it suppresses the button :active state and breaks press-feedback scale.
197
198
  stopAutoRepeat();
198
199
 
199
200
  const adjustment = operation === 'increment' ? step : -step;
200
201
  isPressed = true;
202
+ pressedStepper = operation === 'increment' ? 'increment' : 'decrement';
201
203
 
202
204
  // The button turns disabled when the value reaches a limit, and a disabled button gets no mouseup and no mouseleave:
203
205
  // the release is watched on the window too, or the repeat would go on firing `onChange` at the limit until the next press.
@@ -230,8 +232,8 @@
230
232
  }
231
233
 
232
234
  function stopAutoRepeat(event?: MouseEvent | FocusEvent) {
235
+ // Do not preventDefault on mouseup: it can shorten :active and weaken press-feedback on the steppers.
233
236
  if (event) {
234
- event.preventDefault();
235
237
  event.stopPropagation();
236
238
  }
237
239
 
@@ -250,6 +252,7 @@
250
252
  }
251
253
 
252
254
  isPressed = false;
255
+ pressedStepper = null;
253
256
  }
254
257
 
255
258
  function handleKeyDown(e: KeyboardEvent) {
@@ -343,6 +346,7 @@
343
346
  kind="minus"
344
347
  label={$t('editor.stepper.decrease')}
345
348
  disabled={isDisabled || isAtMin}
349
+ data-pressed={pressedStepper === 'decrement' ? 'true' : undefined}
346
350
  onmousedown={(e: MouseEvent) => startAutoRepeat('decrement', e)}
347
351
  onmouseup={stopAutoRepeat}
348
352
  onmouseleave={stopAutoRepeat}
@@ -352,6 +356,7 @@
352
356
  kind="plus"
353
357
  label={$t('editor.stepper.increase')}
354
358
  disabled={isDisabled || isAtMax}
359
+ data-pressed={pressedStepper === 'increment' ? 'true' : undefined}
355
360
  onmousedown={(e: MouseEvent) => startAutoRepeat('increment', e)}
356
361
  onmouseup={stopAutoRepeat}
357
362
  onmouseleave={stopAutoRepeat}
@@ -250,7 +250,10 @@
250
250
  >
251
251
  <!-- Grid lines -->
252
252
  <!-- Grid lines -->
253
- <div class="absolute inset-0 grid-background"></div>
253
+ <div
254
+ class="absolute inset-0 grid-background"
255
+ class:grid-background-emphasis={isHovering || isDragging}
256
+ ></div>
254
257
 
255
258
  <!-- Position indicator thumb -->
256
259
  <!-- svelte-ignore element_invalid_self_closing_tag -->
@@ -299,51 +302,57 @@
299
302
  outline: none !important;
300
303
  }
301
304
 
302
- /* Grid lines at x/y 46, 93, 139 px on the 185px pad (Figma IC Position). */
303
- /* Grid background using gradients */
305
+ /* Grid lines at x/y 46, 93, 139 px on the 185px pad (Figma IC Position). The colour of the lines is a variable: the pad
306
+ greys out when it is hovered or dragged, and the light green lines would vanish on that grey, so then they turn to a
307
+ darker grey (the strong border at 40%) that stays visible on it. */
304
308
  .grid-background {
309
+ --position-grid-line: var(--brand-subtle);
305
310
  background-image:
306
311
  linear-gradient(
307
312
  to right,
308
313
  transparent calc(46px - 0.01px),
309
- var(--brand-subtle) 46px,
310
- var(--brand-subtle) calc(46px + 1px),
314
+ var(--position-grid-line) 46px,
315
+ var(--position-grid-line) calc(46px + 1px),
311
316
  transparent calc(46px + 1px)
312
317
  ),
313
318
  linear-gradient(
314
319
  to right,
315
320
  transparent calc(93px - 0.01px),
316
- var(--brand-subtle) 93px,
317
- var(--brand-subtle) calc(93px + 1px),
321
+ var(--position-grid-line) 93px,
322
+ var(--position-grid-line) calc(93px + 1px),
318
323
  transparent calc(93px + 1px)
319
324
  ),
320
325
  linear-gradient(
321
326
  to right,
322
327
  transparent calc(139px - 0.01px),
323
- var(--brand-subtle) 139px,
324
- var(--brand-subtle) calc(139px + 1px),
328
+ var(--position-grid-line) 139px,
329
+ var(--position-grid-line) calc(139px + 1px),
325
330
  transparent calc(139px + 1px)
326
331
  ),
327
332
  linear-gradient(
328
333
  to bottom,
329
334
  transparent calc(46px - 0.01px),
330
- var(--brand-subtle) 46px,
331
- var(--brand-subtle) calc(46px + 1px),
335
+ var(--position-grid-line) 46px,
336
+ var(--position-grid-line) calc(46px + 1px),
332
337
  transparent calc(46px + 1px)
333
338
  ),
334
339
  linear-gradient(
335
340
  to bottom,
336
341
  transparent calc(93px - 0.01px),
337
- var(--brand-subtle) 93px,
338
- var(--brand-subtle) calc(93px + 1px),
342
+ var(--position-grid-line) 93px,
343
+ var(--position-grid-line) calc(93px + 1px),
339
344
  transparent calc(93px + 1px)
340
345
  ),
341
346
  linear-gradient(
342
347
  to bottom,
343
348
  transparent calc(139px - 0.01px),
344
- var(--brand-subtle) 139px,
345
- var(--brand-subtle) calc(139px + 1px),
349
+ var(--position-grid-line) 139px,
350
+ var(--position-grid-line) calc(139px + 1px),
346
351
  transparent calc(139px + 1px)
347
352
  );
348
353
  }
354
+
355
+ .grid-background-emphasis {
356
+ --position-grid-line: color-mix(in oklab, var(--border-strong) 40%, transparent);
357
+ }
349
358
  </style>
@@ -81,6 +81,15 @@
81
81
  * Handles date range conversion and validation
82
82
  * Preserves timezone information during conversion
83
83
  */
84
+ function toCalendarDatePart(raw: unknown): CalendarDate | undefined {
85
+ if (raw instanceof CalendarDate) return raw;
86
+ if (typeof raw === 'object' && raw !== null && 'year' in raw && 'month' in raw && 'day' in raw) {
87
+ const part = raw as { year: number; month: number; day: number };
88
+ return new CalendarDate(part.year, part.month, part.day);
89
+ }
90
+ return undefined;
91
+ }
92
+
84
93
  function updateCurrentValue() {
85
94
  if (!value) {
86
95
  currentValue = undefined;
@@ -88,29 +97,33 @@
88
97
  }
89
98
 
90
99
  try {
91
- const newRange: DateRange = {};
92
- if (value.start && typeof value.start === 'object' && 'year' in value.start) {
93
- const start = value.start;
94
- newRange.start =
95
- start instanceof CalendarDate
96
- ? start
97
- : new CalendarDate(start.year, start.month, start.day);
98
- }
99
- if (value.end && typeof value.end === 'object' && 'year' in value.end) {
100
- const end = value.end;
101
- newRange.end =
102
- end instanceof CalendarDate ? end : new CalendarDate(end.year, end.month, end.day);
103
- }
104
- currentValue = newRange.start || newRange.end ? newRange : undefined;
100
+ const start = toCalendarDatePart(value.start);
101
+ const end = toCalendarDatePart(value.end);
102
+ currentValue = start || end ? { start, end } : undefined;
105
103
  } catch (error) {
106
104
  console.error('Error updating range value:', error);
107
105
  currentValue = undefined;
108
106
  }
109
107
  }
110
108
 
111
- // Watch for value changes and update internal state
109
+ // Watch for value changes and update internal state.
110
+ // It stays above `rangeCalendarValue` and `rangeCalendarPlaceholder`: `currentValue` is assigned inside
111
+ // `updateCurrentValue()`, which the compiler cannot see, so a statement written before this one would read the empty
112
+ // range of the first run and never run again (the calendar would open on today, with no range painted).
112
113
  $: (value, updateCurrentValue());
113
114
 
115
+ $: rangeCalendarValue =
116
+ currentValue?.start instanceof CalendarDate && currentValue?.end instanceof CalendarDate
117
+ ? { start: currentValue.start, end: currentValue.end }
118
+ : undefined;
119
+
120
+ $: rangeCalendarPlaceholder =
121
+ currentValue?.start instanceof CalendarDate
122
+ ? currentValue.start
123
+ : currentValue?.end instanceof CalendarDate
124
+ ? currentValue.end
125
+ : undefined;
126
+
114
127
  // Track dropdown state through store subscription
115
128
  $: open = $openDropdowns?.has(controllerId) || false;
116
129
 
@@ -174,6 +187,12 @@
174
187
  toggleDropdown(controllerId);
175
188
  }
176
189
 
190
+ function handleOpenChange(isOpen: boolean) {
191
+ if (isOpen !== open) {
192
+ toggleDropdown(controllerId);
193
+ }
194
+ }
195
+
177
196
  /**
178
197
  * Closes dropdown if currently open
179
198
  * Used for cleanup and external close triggers
@@ -213,7 +232,7 @@
213
232
  <!-- Range Calendar Container (Figma IC Date Range 172:504) -->
214
233
  <div bind:this={controllerElement} class="range-calendar-input-controller">
215
234
  <InputControllerRow {label} {helpText}>
216
- <Popover.Root {open} onOpenChange={handleToggle}>
235
+ <Popover.Root {open} onOpenChange={handleOpenChange}>
217
236
  <Popover.Trigger
218
237
  id="range-calendar"
219
238
  class="range-calendar-trigger group flex h-9 w-full items-center gap-2 rounded-lg bg-accent px-3 transition-colors duration-fast hover:bg-accent-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
@@ -227,7 +246,7 @@
227
246
  {formatDateRange(currentValue, $locale, $t)}
228
247
  </span>
229
248
  <IconCalendar
230
- class="size-4 shrink-0 stroke-[1.333] text-muted-foreground transition-colors duration-fast group-hover:text-foreground"
249
+ class="size-4 shrink-0 stroke-2 text-muted-foreground transition-colors duration-fast group-hover:text-foreground"
231
250
  aria-hidden="true"
232
251
  />
233
252
  </Popover.Trigger>
@@ -239,7 +258,8 @@
239
258
  >
240
259
  <!-- Style the range calendar -->
241
260
  <RangeCalendar
242
- value={currentValue}
261
+ value={rangeCalendarValue}
262
+ placeholder={rangeCalendarPlaceholder}
243
263
  locale={$locale}
244
264
  calendarLabel={$t('editor.date.rangeCalendarLabel')}
245
265
  previousLabel={$t('editor.date.previousMonth')}
@@ -416,9 +416,9 @@
416
416
  aria-pressed={isLocked}
417
417
  >
418
418
  {#if isLocked}
419
- <IconLock class="size-4 stroke-[1.333]" aria-hidden="true" />
419
+ <IconLock class="size-4 stroke-2" aria-hidden="true" />
420
420
  {:else}
421
- <IconLockOpen class="size-4 stroke-[1.333]" aria-hidden="true" />
421
+ <IconLockOpen class="size-4 stroke-2" aria-hidden="true" />
422
422
  {/if}
423
423
  </button>
424
424
  </div>
@@ -75,6 +75,8 @@
75
75
 
76
76
  let sliderContainer: HTMLDivElement;
77
77
  let lastValue = value;
78
+ /** Keeps the readout in sync while dragging before the parent value prop updates. */
79
+ let liveValue: number | number[] = value;
78
80
  let isCurrentlyFocused = false;
79
81
  let isClickHandled = false;
80
82
 
@@ -140,6 +142,7 @@
140
142
  * @param newValue - New slider value(s)
141
143
  */
142
144
  function handleChange(newValue: number | number[]) {
145
+ liveValue = newValue;
143
146
  if (newValue !== lastValue && !isCurrentlyFocused) {
144
147
  handleFocus();
145
148
  isCurrentlyFocused = true;
@@ -235,13 +238,17 @@
235
238
  }
236
239
  }
237
240
 
241
+ $: if (value !== undefined) {
242
+ liveValue = value;
243
+ }
244
+
238
245
  $: sliderValue =
239
246
  sliderType === 'single'
240
- ? typeof value === 'number'
241
- ? value
247
+ ? typeof liveValue === 'number'
248
+ ? liveValue
242
249
  : min
243
- : Array.isArray(value)
244
- ? value
250
+ : Array.isArray(liveValue)
251
+ ? liveValue
245
252
  : [min, max];
246
253
 
247
254
  // Helper function to safely get array value
@@ -54,11 +54,11 @@
54
54
  IconButton
55
55
  } from '@widgetic/design-system/components';
56
56
  import {
57
- IconArrowsDiagonalMinimize,
58
57
  IconBold,
59
58
  IconBrush,
60
59
  IconCheck,
61
60
  IconChevronUp,
61
+ IconX,
62
62
  IconH1,
63
63
  IconH2,
64
64
  IconH3,
@@ -166,7 +166,7 @@
166
166
  { value: 'h3', messageKey: 'editor.textArea.heading3', icon: IconH3 }
167
167
  ];
168
168
 
169
- const toolbarIconClass = 'size-4 shrink-0 stroke-[1.333]';
169
+ const toolbarIconClass = 'size-4 shrink-0 stroke-2';
170
170
 
171
171
  /** The message of the style the toolbar button shows: the plain text's when the style is none of the options. */
172
172
  let currentTextStyleMessageKey = $derived<EditorMessageKey>(
@@ -199,6 +199,20 @@
199
199
  // Add these variables to track focus state
200
200
  let editorHasFocus = $state(false);
201
201
  let toolbarRef: HTMLDivElement;
202
+ let richTextPortalTarget: HTMLElement | null = $state(null);
203
+
204
+ function resolveRichTextPortalTarget(): HTMLElement | undefined {
205
+ const portalHost = queryInTreeOf(toolbarRef, '.text-area-portal');
206
+ if (portalHost instanceof HTMLElement) return portalHost;
207
+ if (typeof document !== 'undefined') {
208
+ return document.getElementById('editor-portal') ?? document.body;
209
+ }
210
+ return undefined;
211
+ }
212
+
213
+ const toolbarPopoverPortalProps = $derived({
214
+ to: richTextPortalTarget ?? resolveRichTextPortalTarget() ?? undefined
215
+ });
202
216
 
203
217
  // Static styles — avoid $derived so teardown does not leave inert derived reads.
204
218
  const editorStyle = `
@@ -905,8 +919,10 @@
905
919
 
906
920
  // If clicking toolbar elements or color picker, maintain expanded state
907
921
  if (
908
- target.matches('input, button, [role="button"], [tabindex="0"]') ||
909
- target.closest('.color-picker-container')
922
+ target.matches('input, button, [role="button"], [role="combobox"], [tabindex="0"]') ||
923
+ target.closest(
924
+ '.color-picker-container, [data-radix-popper-content-wrapper], [data-state="open"]'
925
+ )
910
926
  ) {
911
927
  // Keep toolbar enabled since we're interacting with it
912
928
  editorHasFocus = true;
@@ -1060,6 +1076,7 @@
1060
1076
  let stopListeningForScroll: () => void = () => {};
1061
1077
 
1062
1078
  onMount(() => {
1079
+ richTextPortalTarget = resolveRichTextPortalTarget() ?? null;
1063
1080
  stopListeningForScroll = listenForScroll(toolbarRef, handleScroll);
1064
1081
  });
1065
1082
 
@@ -1086,8 +1103,10 @@
1086
1103
  if (editorInstance) {
1087
1104
  const target = e.target as HTMLElement;
1088
1105
  const isInteractive =
1089
- target.matches('button, input, [role="button"], [tabindex="0"]') ||
1090
- target.closest('button, input, [role="button"], [tabindex="0"]');
1106
+ target.matches('button, input, [role="button"], [role="combobox"], [tabindex="0"]') ||
1107
+ target.closest(
1108
+ 'button, input, [role="button"], [role="combobox"], [tabindex="0"], [data-radix-popper-content-wrapper]'
1109
+ );
1091
1110
 
1092
1111
  if (!isInteractive) {
1093
1112
  e.preventDefault();
@@ -1128,14 +1147,14 @@
1128
1147
 
1129
1148
  <!-- Main editor container -->
1130
1149
  <div
1131
- class="main-editor-container group relative flex h-full w-full flex-col gap-2 overflow-hidden rounded-lg bg-accent pt-2.5 px-4 pb-4"
1150
+ class="main-editor-container group relative flex h-full min-h-0 w-full flex-col overflow-hidden rounded-lg bg-accent px-4 pb-4 pt-4 [--editor-padding-top:0px]"
1132
1151
  style={editorStyle}
1133
1152
  on:mousedown={handleMouseDown}
1134
1153
  >
1135
- <!-- Toolbar at the top -->
1154
+ <!-- Toolbar at the top: the 36 row of buttons has 16 above it (the padding of the card) and 16 below it, then the line (1) and 16 of text space. -->
1136
1155
  <div
1137
1156
  bind:this={toolbarRef}
1138
- class="toolbar-container sticky top-0 z-10 h-9 shrink-0 select-none overflow-visible border-b border-border bg-transparent"
1157
+ class="toolbar-container sticky top-0 z-20 mb-4 h-[calc(2.25rem+1rem+1px)] shrink-0 select-none overflow-visible border-b border-border bg-transparent pb-4"
1139
1158
  on:mousedown={handleToolbarInteraction}
1140
1159
  on:click={handleToolbarInteraction}
1141
1160
  on:keydown={handleToolbarKeyDown}
@@ -1144,7 +1163,7 @@
1144
1163
  tabindex="-1"
1145
1164
  >
1146
1165
  <div
1147
- class="toolbar-items-row relative flex h-full w-full max-w-[370px] items-center justify-between gap-2"
1166
+ class="toolbar-items-row relative flex h-full w-full min-w-0 items-center justify-between gap-2"
1148
1167
  >
1149
1168
  <!-- Format cluster centered; close stays on the right -->
1150
1169
  <div
@@ -1251,9 +1270,10 @@
1251
1270
  </Popover.Trigger>
1252
1271
 
1253
1272
  <Popover.Content
1254
- class="w-[200px] rounded-xl border border-border bg-popover p-1 shadow-none"
1273
+ class="richtext-toolbar-popover z-[60] w-[200px] rounded-xl border border-border bg-popover p-1 shadow-none"
1255
1274
  align="end"
1256
1275
  sideOffset={8}
1276
+ portalProps={toolbarPopoverPortalProps}
1257
1277
  >
1258
1278
  <Command.Root>
1259
1279
  <Command.List
@@ -1337,9 +1357,10 @@
1337
1357
  </Popover.Trigger>
1338
1358
 
1339
1359
  <Popover.Content
1340
- class="style-dropdown-container w-[200px] rounded-xl border border-border bg-popover p-1 shadow-none"
1360
+ class="richtext-toolbar-popover z-[60] w-[200px] rounded-xl border border-border bg-popover p-1 shadow-none"
1341
1361
  align="end"
1342
1362
  sideOffset={8}
1363
+ portalProps={toolbarPopoverPortalProps}
1343
1364
  >
1344
1365
  <Command.Root>
1345
1366
  <Command.List
@@ -1382,11 +1403,11 @@
1382
1403
  </div>
1383
1404
  </div>
1384
1405
 
1385
- {#if onClose && !showColorPicker && !isColorPickerAnimating}
1406
+ {#if onClose}
1386
1407
  <IconButton
1387
1408
  variant="ghost"
1388
- size="default"
1389
- class="toolbar-close-button z-10 ms-auto shrink-0"
1409
+ size="sm"
1410
+ class="toolbar-close-button z-30 ms-auto shrink-0"
1390
1411
  label={$t('editor.textArea.closePanel')}
1391
1412
  onclick={(e) => {
1392
1413
  e.stopPropagation();
@@ -1394,7 +1415,7 @@
1394
1415
  onClose();
1395
1416
  }}
1396
1417
  >
1397
- <IconArrowsDiagonalMinimize class={toolbarIconClass} />
1418
+ <IconX class={toolbarIconClass} />
1398
1419
  </IconButton>
1399
1420
  {/if}
1400
1421
 
@@ -15,7 +15,7 @@
15
15
 
16
16
  <script lang="ts">
17
17
  import { Portal } from '@widgetic/design-system/components';
18
- import { IconArrowsDiagonal } from '@widgetic/design-system/icons';
18
+ import { IconArrowsDiagonal, IconX } from '@widgetic/design-system/icons';
19
19
  import {
20
20
  dirForUserText,
21
21
  useTextDirection
@@ -210,7 +210,7 @@
210
210
  aria-hidden="true"
211
211
  >
212
212
  <IconArrowsDiagonal
213
- class="size-4 stroke-[1.333] text-muted-foreground transition-colors duration-fast group-hover:text-foreground"
213
+ class="size-4 stroke-2 text-muted-foreground transition-colors duration-fast group-hover:text-foreground"
214
214
  />
215
215
  </div>
216
216
  </div>
@@ -223,21 +223,22 @@
223
223
 
224
224
  <!-- Text Area Input Controller in Portal -->
225
225
  {#if isShowingTextArea}
226
- <Portal target={portalTarget} class="text-area-portal absolute top-0 start-0 w-full h-full">
227
- <!-- Blocking overlay -->
226
+ <Portal target={portalTarget} class="text-area-portal absolute inset-0 z-50 flex max-h-full min-h-0 flex-col overflow-hidden">
227
+ <!-- Blocking overlay: clicks pass through to portalled popovers; only the editor card receives pointer events. -->
228
228
  <div
229
- class="absolute inset-0 bg-background {isClosing
229
+ class="text-area-portal-overlay pointer-events-auto absolute inset-0 z-0 bg-background {isClosing
230
230
  ? 'fade-out-animation'
231
231
  : 'fade-in-animation'}"
232
- style="z-index: 50; transform: translateZ(0); backface-visibility: hidden;"
232
+ style="transform: translateZ(0); backface-visibility: hidden;"
233
+ role="presentation"
233
234
  ></div>
234
235
  <!-- svelte-ignore a11y_no_static_element_interactions -->
235
236
  <div
236
237
  bind:this={portalContentRef}
237
- class="text-area-portal-content absolute mt-4 mx-6 mb-6 inset-0 {isClosing
238
+ class="text-area-portal-content pointer-events-auto absolute z-10 mx-6 mb-6 mt-4 flex min-h-0 max-h-[calc(100%-2rem)] flex-1 flex-col inset-x-0 bottom-0 top-4 {isClosing
238
239
  ? 'scale-out-animation'
239
240
  : 'scale-in-animation'}"
240
- style="z-index: 51; transform: translateZ(0); backface-visibility: hidden;"
241
+ style="transform: translateZ(0); backface-visibility: hidden;"
241
242
  on:mouseenter={handlePortalMouseEnter}
242
243
  on:mouseleave={handlePortalMouseLeave}
243
244
  >
@@ -21,6 +21,11 @@
21
21
  import { useTextDirection } from '@widgetic/design-system/components/textDirection';
22
22
  import { directionOfFieldValue } from '../../utils/fieldDirection';
23
23
  import InputControllerRow from './InputControllerRow.svelte';
24
+ import {
25
+ editableFieldSurfaceClass,
26
+ editableFieldSurfacePadding,
27
+ embeddedInputClass
28
+ } from './shared/editableFieldClasses';
24
29
 
25
30
  // Component props
26
31
  import type { InputControllerConfig } from './index';
@@ -67,9 +72,17 @@
67
72
  </script>
68
73
 
69
74
  <InputControllerRow {label} {description}>
75
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
76
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
70
77
  <div
71
- class="flex h-9 w-full items-center rounded-lg bg-accent px-3 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"
78
+ class="{editableFieldSurfaceClass} {editableFieldSurfacePadding}"
72
79
  onfocusin={onFocus}
80
+ onclick={(e) => {
81
+ const target = e.currentTarget.querySelector('input');
82
+ if (target instanceof HTMLInputElement && e.target !== target) {
83
+ target.focus();
84
+ }
85
+ }}
73
86
  >
74
87
  <Input
75
88
  id="text-input"
@@ -85,7 +98,7 @@
85
98
  onChange(newValue);
86
99
  }
87
100
  }}
88
- class="h-full w-full border-0 bg-transparent px-0 text-body text-foreground shadow-none placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0"
101
+ class={embeddedInputClass}
89
102
  />
90
103
  </div>
91
104
  </InputControllerRow>
@@ -417,7 +417,7 @@
417
417
  >
418
418
  <span class="flex size-4 shrink-0 items-center justify-center">
419
419
  {#if timeOption === value}
420
- <IconCheck class="size-4 stroke-[1.333]" aria-hidden="true" />
420
+ <IconCheck class="size-4 stroke-2" aria-hidden="true" />
421
421
  {/if}
422
422
  </span>
423
423
  <span class="min-w-0 flex-1 truncate">{timeOption}</span>