@widgetic/editor 4.1.15 → 4.1.17

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.
@@ -112,8 +112,9 @@
112
112
  on:propertyChange
113
113
  >
114
114
  {#snippet headerContent()}
115
+ <!-- Figma Embed panel: 16 under the grip row (the panel header and its 16 gap), and no padding below: the 16 gap to the first accordion belongs to the list under it (PropsEditor). -->
115
116
  <section
116
- class="embed-editor-code-header flex flex-col gap-3 px-6 pt-3 pb-4"
117
+ class="embed-editor-code-header flex flex-col gap-3 px-6 pt-4 pb-0"
117
118
  aria-label={$t('editor.embed.headerArea')}
118
119
  aria-busy={loading}
119
120
  >
@@ -170,6 +170,11 @@
170
170
 
171
171
  /** Optional content below the shared toolbar, before property fields. */
172
172
  export let headerContent = undefined;
173
+ /**
174
+ * The space above the first accordion when there is only one tab. Under a header block (the Embed code header) Figma's panel gap
175
+ * puts the first accordion 16 below it; without a header the list starts 24 below the panel's top edge.
176
+ */
177
+ $: singleTabTopPaddingClass = headerContent ? 'pt-4' : 'pt-6';
173
178
  export let headerClass = '';
174
179
  export let dragHandleClass = '';
175
180
  export let title: string | undefined = undefined;
@@ -2141,10 +2146,10 @@
2141
2146
  class="h-full"
2142
2147
  type="hover"
2143
2148
  scrollHideDelay={0}
2144
- scrollbarYClasses="flex w-6 touch-none select-none px-2 pb-6 transition-colors duration-fast {headerContent ? 'bg-transparent' : 'bg-background'} {!designSchema || !contentSchema ? 'pt-6' : 'pt-0'} [&>div]:w-2 [&>div]:cursor-pointer [&>div]:rounded-full [&>div]:bg-border [&>div]:duration-fast [&>div]:hover:bg-muted-foreground/30"
2149
+ scrollbarYClasses="flex w-6 touch-none select-none px-2 pb-6 transition-colors duration-fast {headerContent ? 'bg-transparent' : 'bg-background'} {!designSchema || !contentSchema ? singleTabTopPaddingClass : 'pt-0'} [&>div]:w-2 [&>div]:cursor-pointer [&>div]:rounded-full [&>div]:bg-border [&>div]:duration-fast [&>div]:hover:bg-muted-foreground/30"
2145
2150
  >
2146
2151
  <div class="scroll-viewport" data-radix-scroll-area-viewport bind:this={designScrollViewport}>
2147
- <div class="px-6 pb-6 {!designSchema || !contentSchema ? 'pt-6' : 'pt-0'}" bind:this={designContentWrapper}>
2152
+ <div class="px-6 pb-6 {!designSchema || !contentSchema ? singleTabTopPaddingClass : 'pt-0'}" bind:this={designContentWrapper}>
2148
2153
  <Tabs.Content
2149
2154
  value="design"
2150
2155
  class="design-tab-content mt-0! tabs-content-container w-full outline-none {isFirstLoad ? 'initial-load' : !isInitialTabLoad ? 'animate-slide-left' : ''}"
@@ -2257,10 +2262,10 @@
2257
2262
  class="h-full"
2258
2263
  type="hover"
2259
2264
  scrollHideDelay={0}
2260
- scrollbarYClasses="flex w-6 touch-none select-none px-2 pb-6 transition-colors duration-fast {headerContent ? 'bg-transparent' : 'bg-background'} {!designSchema || !contentSchema ? 'pt-6' : 'pt-0'} [&>div]:w-2 [&>div]:cursor-pointer [&>div]:rounded-full [&>div]:bg-border [&>div]:duration-fast [&>div]:hover:bg-muted-foreground/30"
2265
+ scrollbarYClasses="flex w-6 touch-none select-none px-2 pb-6 transition-colors duration-fast {headerContent ? 'bg-transparent' : 'bg-background'} {!designSchema || !contentSchema ? singleTabTopPaddingClass : 'pt-0'} [&>div]:w-2 [&>div]:cursor-pointer [&>div]:rounded-full [&>div]:bg-border [&>div]:duration-fast [&>div]:hover:bg-muted-foreground/30"
2261
2266
  >
2262
2267
  <div class="scroll-viewport" data-radix-scroll-area-viewport bind:this={contentScrollViewport}>
2263
- <div class="px-6 pb-6 {!designSchema || !contentSchema ? 'pt-6' : 'pt-0'}" bind:this={contentWrapper}>
2268
+ <div class="px-6 pb-6 {!designSchema || !contentSchema ? singleTabTopPaddingClass : 'pt-0'}" bind:this={contentWrapper}>
2264
2269
  <Tabs.Content
2265
2270
  value="content"
2266
2271
  class="content-tab-content mt-0! tabs-content-container w-full {isFirstLoad ? 'initial-load' : !isInitialTabLoad ? 'animate-slide-right' : ''}"
@@ -2558,13 +2563,11 @@
2558
2563
  position: static;
2559
2564
  }
2560
2565
 
2561
- :global([data-state="open"] .accordion-trigger svg) {
2562
- transform: rotate(180deg);
2563
- }
2564
-
2565
- :global(.accordion-trigger svg) {
2566
- transition: transform var(--duration-base) ease-out;
2567
- }
2566
+ /*
2567
+ * The accordion arrow is turned and eased by the design system's own trigger (`[&[data-state=open]>svg]:rotate-180` with
2568
+ * `transition-transform duration-base`). A second `transform: rotate(180deg)` here used to be added to the trigger's `rotate`
2569
+ * (Tailwind 4 uses the `rotate` property), which made an open accordion turn a full 360 degrees and point down again.
2570
+ */
2568
2571
 
2569
2572
  /* Content card headers: underline title on hover, not when hovering the drag handle. */
2570
2573
  :global(.content-item-trigger:hover .content-title),
@@ -187,7 +187,7 @@
187
187
 
188
188
  <NumberControls
189
189
  class="min-w-0 flex-1"
190
- surfacePaddingClass="pe-1.5 ps-3"
190
+ surfacePaddingClass="pe-1.5"
191
191
  {value}
192
192
  {onChange}
193
193
  {min}
@@ -737,7 +737,7 @@
737
737
  {#if isFileBrowserOpen}
738
738
  <Portal target={portalTarget}>
739
739
  <div
740
- class="browser-input-file-browser-overlay pointer-events-auto absolute inset-0 z-[999999] flex flex-col overflow-hidden bg-black/40 p-0"
740
+ class="browser-input-file-browser-overlay pointer-events-auto absolute inset-0 z-[999999] flex flex-col overflow-hidden bg-muted-foreground/80 p-0 backdrop-blur-[3px]"
741
741
  >
742
742
  <!-- svelte-ignore a11y_click_events_have_key_events -->
743
743
  <!-- svelte-ignore a11y_no_static_element_interactions -->
@@ -38,7 +38,7 @@
38
38
  * Shadcn UI select components for consistent styling and behavior
39
39
  */
40
40
  import { Select } from '@widgetic/design-system/components';
41
- import { IconChevronDown, IconChevronUp } from '@widgetic/design-system/icons';
41
+ import DropdownChevron from './shared/DropdownChevron.svelte';
42
42
 
43
43
  // The words of the editor in the language of the page.
44
44
  const { t } = useEditorLanguage();
@@ -182,17 +182,7 @@
182
182
  >
183
183
  {triggerContent}
184
184
  </span>
185
- {#if open}
186
- <IconChevronUp
187
- class="size-4 shrink-0 stroke-[1.333] text-muted-foreground"
188
- aria-hidden="true"
189
- />
190
- {:else}
191
- <IconChevronDown
192
- class="size-4 shrink-0 stroke-[1.333] text-muted-foreground"
193
- aria-hidden="true"
194
- />
195
- {/if}
185
+ <DropdownChevron {open} />
196
186
  </Select.Trigger>
197
187
 
198
188
  <Select.Content
@@ -52,8 +52,6 @@
52
52
  import {
53
53
  IconCheck,
54
54
  IconCloudUpload,
55
- IconChevronDown,
56
- IconChevronUp,
57
55
  IconTrash
58
56
  } from '@widgetic/design-system/icons';
59
57
  import fontsJsonUrl from '../../assets/fonts.json?url';
@@ -86,6 +84,7 @@
86
84
  // Import shared components
87
85
  import { SearchInput } from '@widgetic/design-system/components';
88
86
  import CategoryTabs from './shared/CategoryTabs.svelte';
87
+ import DropdownChevron from './shared/DropdownChevron.svelte';
89
88
  import { RecentItemsSection, ItemGrid } from './shared';
90
89
  import { useEditorLanguage } from '../../i18n/language';
91
90
  import { categoryLabel, fontWeightLabel } from '../../i18n/labels';
@@ -1825,11 +1824,7 @@
1825
1824
  >
1826
1825
  {resolvedFont?.family || $t('editor.font.select')}
1827
1826
  </span>
1828
- {#if $openDropdowns?.has(controllerId)}
1829
- <IconChevronUp class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
1830
- {:else}
1831
- <IconChevronDown class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
1832
- {/if}
1827
+ <DropdownChevron open={$openDropdowns?.has(controllerId)} />
1833
1828
  </Popover.Trigger>
1834
1829
 
1835
1830
  <Popover.Content
@@ -2060,11 +2055,7 @@
2060
2055
  <span class="truncate flex-1 text-start text-body text-foreground">
2061
2056
  {fontWeightLabel(displayWeight || 'Regular', $t)}
2062
2057
  </span>
2063
- {#if $openDropdowns?.has('weight-' + controllerId)}
2064
- <IconChevronUp class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
2065
- {:else}
2066
- <IconChevronDown class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
2067
- {/if}
2058
+ <DropdownChevron open={$openDropdowns?.has('weight-' + controllerId)} />
2068
2059
  </Popover.Trigger>
2069
2060
  <Popover.Content
2070
2061
  align="end"
@@ -2,6 +2,7 @@
2
2
  import { onDestroy } from 'svelte';
3
3
  import { Input, StepperButton } from '@widgetic/design-system/components';
4
4
  import { useEditorLanguage } from '../../i18n/language';
5
+ import { steppedNumber } from './numberControlsSteps';
5
6
 
6
7
  const { t } = useEditorLanguage();
7
8
 
@@ -19,8 +20,13 @@
19
20
  let className = '';
20
21
  export { className as class };
21
22
  export let disabled: boolean = false;
22
- /** Padding on the accent surface (Figma IC Number vs IC Angle field). */
23
- export let surfacePaddingClass: string = 'pe-1 ps-3';
23
+ /**
24
+ * Padding at the end of the accent surface, after the steppers (Figma IC Number vs IC Angle field).
25
+ * The padding at the start is not on the surface: it is inside the text hit area, so the hit area reaches the edge.
26
+ */
27
+ export let surfacePaddingClass: string = 'pe-1';
28
+ /** Padding at the start of the text hit area: it keeps the value 12px in from the edge (Figma IC Number: the value is at x=12). */
29
+ export let inputPaddingClass: string = 'ps-3';
24
30
  /** @deprecated use `class` — kept for Angle layout width. */
25
31
  export let width: string | undefined = undefined;
26
32
 
@@ -49,26 +55,30 @@
49
55
  const surfaceBaseClass =
50
56
  'number-controls-surface flex h-9 w-full min-w-0 items-center gap-1 rounded-lg bg-accent 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 disabled:pointer-events-none disabled:opacity-50';
51
57
 
52
- function handleValueChange(adjustment: number) {
58
+ /**
59
+ * One step of the stepper (button, hold or arrow key). Returns false when nothing was applied because the value is at a limit.
60
+ */
61
+ function handleValueChange(adjustment: number): boolean {
53
62
  try {
54
- let newValue = value + adjustment;
55
-
56
- if (wrapAround) {
57
- if (newValue >= 360) newValue -= 360;
58
- if (newValue < 0) newValue += 360;
59
- } else {
60
- if (min !== undefined && newValue < min) {
61
- newValue = min;
62
- }
63
- if (max !== undefined && newValue > max) {
64
- newValue = max;
65
- }
63
+ const newValue = steppedNumber(value, adjustment, { min, max, wrapAround });
64
+
65
+ // At a limit there is nothing to apply, and nothing to repeat: no event for the page, and a held button stops here
66
+ if (newValue === value) {
67
+ stopAutoRepeat();
68
+ return false;
66
69
  }
67
70
 
68
71
  value = newValue;
72
+ // The field shows the new number at once, also when the person has typed in it. It used to keep the typed text
73
+ // (`isEditing` stays true while the field has the focus, and a stepper button does not take the focus) and
74
+ // `handleBlur` then wrote that old text back over the number the stepper had set.
75
+ inputValue = String(newValue);
76
+ isEditing = false;
69
77
  onChange(newValue);
78
+ return true;
70
79
  } catch (error) {
71
80
  console.error('Error in handleValueChange:', error);
81
+ return false;
72
82
  }
73
83
  }
74
84
 
@@ -181,12 +191,21 @@
181
191
  }
182
192
 
183
193
  function startAutoRepeat(operation: 'increment' | 'decrement', event: MouseEvent) {
194
+ // Only the main button steps: a right or middle click must not
195
+ if (event.button !== 0) return;
184
196
  event.preventDefault();
185
197
  stopAutoRepeat();
186
198
 
187
199
  const adjustment = operation === 'increment' ? step : -step;
188
200
  isPressed = true;
189
- handleValueChange(adjustment);
201
+
202
+ // The button turns disabled when the value reaches a limit, and a disabled button gets no mouseup and no mouseleave:
203
+ // the release is watched on the window too, or the repeat would go on firing `onChange` at the limit until the next press.
204
+ window.addEventListener('mouseup', releasePress);
205
+ window.addEventListener('blur', releasePress);
206
+
207
+ // At a limit there is nothing to hold
208
+ if (!handleValueChange(adjustment)) return;
190
209
 
191
210
  autoRepeatTimer = setTimeout(() => {
192
211
  if (isPressed) {
@@ -199,12 +218,28 @@
199
218
  }, HOLD_DELAY);
200
219
  }
201
220
 
221
+ /** The release of a press, seen on the window (see `startAutoRepeat`). */
222
+ function releasePress() {
223
+ stopAutoRepeat();
224
+ }
225
+
226
+ /** A stepper button pressed with the keyboard (Enter or Space) clicks without a mouse down: `detail` is 0 then. */
227
+ function handleStepperClick(operation: 'increment' | 'decrement', event: MouseEvent) {
228
+ if (event.detail !== 0) return;
229
+ handleValueChange(operation === 'increment' ? step : -step);
230
+ }
231
+
202
232
  function stopAutoRepeat(event?: MouseEvent | FocusEvent) {
203
233
  if (event) {
204
234
  event.preventDefault();
205
235
  event.stopPropagation();
206
236
  }
207
237
 
238
+ if (typeof window !== 'undefined') {
239
+ window.removeEventListener('mouseup', releasePress);
240
+ window.removeEventListener('blur', releasePress);
241
+ }
242
+
208
243
  if (autoRepeatTimer !== null) {
209
244
  clearTimeout(autoRepeatTimer);
210
245
  autoRepeatTimer = null;
@@ -258,13 +293,20 @@
258
293
  class:opacity-50={disabled}
259
294
  class:pointer-events-none={disabled}
260
295
  >
261
- <div
262
- class="flex min-w-0 flex-1 items-center {suffix
263
- ? 'justify-start gap-0'
264
- : ''}"
296
+ <!--
297
+ The hit area of the text: from the start edge of the surface to the steppers, with the surface's own rounded corner at
298
+ the start edge, so the whole area reads as one field. A label focuses the input when the area is clicked, so nothing in
299
+ it is dead space (the padding that keeps the value 12px in used to sit on the surface, outside the input, and the input
300
+ drew its own square hover box inside the rounded surface, which looked cut out).
301
+ -->
302
+ <label
303
+ for={inputId}
304
+ class="number-controls-hit-area flex h-full min-w-0 flex-1 items-center rounded-s-lg {inputPaddingClass} {isDisabled
305
+ ? 'cursor-default'
306
+ : 'cursor-text'} {suffix ? 'justify-start gap-0' : ''}"
265
307
  >
266
308
  {#if suffix}
267
- <div class="number-controls-value inline-flex max-w-full min-w-0 items-baseline gap-0">
309
+ <span class="number-controls-value inline-flex max-w-full min-w-0 items-baseline gap-0">
268
310
  <Input
269
311
  id={inputId}
270
312
  type="text"
@@ -276,10 +318,10 @@
276
318
  readonly={isLocked}
277
319
  {disabled}
278
320
  size={Math.max(1, inputValue.length)}
279
- class="number-controls-input number-controls-input-with-suffix h-full w-auto min-w-[1ch] max-w-full shrink border-0 bg-transparent px-0 text-start text-body text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
321
+ class="number-controls-input number-controls-input-with-suffix h-full w-auto min-w-[1ch] max-w-full shrink border-0 bg-transparent px-0 text-start text-body text-foreground shadow-none hover:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
280
322
  />
281
323
  <span class="pointer-events-none shrink-0 text-body text-foreground">{suffix}</span>
282
- </div>
324
+ </span>
283
325
  {:else}
284
326
  <Input
285
327
  id={inputId}
@@ -291,10 +333,10 @@
291
333
  onkeydown={handleKeyDown}
292
334
  readonly={isLocked}
293
335
  {disabled}
294
- class="number-controls-input h-full min-w-0 flex-1 border-0 bg-transparent px-0 text-body text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
336
+ class="number-controls-input h-full min-w-0 flex-1 border-0 bg-transparent px-0 text-body text-foreground shadow-none hover:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 {customInputClass}"
295
337
  />
296
338
  {/if}
297
- </div>
339
+ </label>
298
340
 
299
341
  <div class="flex shrink-0 items-center gap-0">
300
342
  <StepperButton
@@ -304,6 +346,7 @@
304
346
  onmousedown={(e: MouseEvent) => startAutoRepeat('decrement', e)}
305
347
  onmouseup={stopAutoRepeat}
306
348
  onmouseleave={stopAutoRepeat}
349
+ onclick={(e: MouseEvent) => handleStepperClick('decrement', e)}
307
350
  />
308
351
  <StepperButton
309
352
  kind="plus"
@@ -312,6 +355,7 @@
312
355
  onmousedown={(e: MouseEvent) => startAutoRepeat('increment', e)}
313
356
  onmouseup={stopAutoRepeat}
314
357
  onmouseleave={stopAutoRepeat}
358
+ onclick={(e: MouseEvent) => handleStepperClick('increment', e)}
315
359
  />
316
360
  </div>
317
361
  </div>
@@ -24,7 +24,11 @@ declare const NumberControls: $$__sveltets_2_IsomorphicComponent<{
24
24
  suffix?: string;
25
25
  /** Extra classes on the outer control surface (default full width of the control column). */ class?: string;
26
26
  disabled?: boolean;
27
- /** Padding on the accent surface (Figma IC Number vs IC Angle field). */ surfacePaddingClass?: string;
27
+ /**
28
+ * Padding at the end of the accent surface, after the steppers (Figma IC Number vs IC Angle field).
29
+ * The padding at the start is not on the surface: it is inside the text hit area, so the hit area reaches the edge.
30
+ */ surfacePaddingClass?: string;
31
+ /** Padding at the start of the text hit area: it keeps the value 12px in from the edge (Figma IC Number: the value is at x=12). */ inputPaddingClass?: string;
28
32
  /** @deprecated use `class` — kept for Angle layout width. */ width?: string | undefined;
29
33
  }, {
30
34
  [evt: string]: CustomEvent<any>;
@@ -58,7 +58,6 @@
58
58
  IconBold,
59
59
  IconBrush,
60
60
  IconCheck,
61
- IconChevronDown,
62
61
  IconChevronUp,
63
62
  IconH1,
64
63
  IconH2,
@@ -85,6 +84,7 @@
85
84
 
86
85
  // Add local ColorPickerInputController import
87
86
  import ColorPickerInputController from './ColorPickerInputController.svelte';
87
+ import DropdownChevron from './shared/DropdownChevron.svelte';
88
88
 
89
89
  // Looking things up and listening for scrolling in the tree the editor is in (a module has a shadow root)
90
90
  import {
@@ -1245,11 +1245,7 @@
1245
1245
  <span class="text-label-small">{$t(currentTextStyleMessageKey)}</span>
1246
1246
  {/if}
1247
1247
  {/if}
1248
- {#if textStyleDropdownOpen}
1249
- <IconChevronUp class={toolbarIconClass} />
1250
- {:else}
1251
- <IconChevronDown class={toolbarIconClass} />
1252
- {/if}
1248
+ <DropdownChevron open={textStyleDropdownOpen} class={toolbarIconClass} />
1253
1249
  </div>
1254
1250
  </Button>
1255
1251
  </Popover.Trigger>
@@ -1335,11 +1331,7 @@
1335
1331
  {:else}
1336
1332
  <IconList class={toolbarIconClass} />
1337
1333
  {/if}
1338
- {#if listStyleDropdownOpen}
1339
- <IconChevronUp class={toolbarIconClass} />
1340
- {:else}
1341
- <IconChevronDown class={toolbarIconClass} />
1342
- {/if}
1334
+ <DropdownChevron open={listStyleDropdownOpen} class={toolbarIconClass} />
1343
1335
  </div>
1344
1336
  </Button>
1345
1337
  </Popover.Trigger>
@@ -46,8 +46,6 @@
46
46
 
47
47
  import {
48
48
  IconCloudUpload,
49
- IconChevronDown,
50
- IconChevronUp,
51
49
  IconAlertTriangle
52
50
  } from '@widgetic/design-system/icons';
53
51
 
@@ -57,6 +55,7 @@
57
55
  // import { SearchInput } from './shared';
58
56
  import { SearchInput } from '@widgetic/design-system/components';
59
57
  import CategoryTabs from './shared/CategoryTabs.svelte';
58
+ import DropdownChevron from './shared/DropdownChevron.svelte';
60
59
  import { RecentItemsSection, ItemGrid } from './shared';
61
60
  import { useEditorLanguage } from '../../i18n/language';
62
61
  import { categoryLabel } from '../../i18n/labels';
@@ -1613,11 +1612,7 @@
1613
1612
  </span>
1614
1613
  {/if}
1615
1614
  </div>
1616
- {#if $openDropdowns?.has(controllerId)}
1617
- <IconChevronUp class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
1618
- {:else}
1619
- <IconChevronDown class="size-4 shrink-0 stroke-[1.333] text-muted-foreground" />
1620
- {/if}
1615
+ <DropdownChevron open={$openDropdowns?.has(controllerId)} />
1621
1616
  </Popover.Trigger>
1622
1617
 
1623
1618
  <Popover.Content
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The arithmetic of the number stepper (`NumberControls.svelte`), kept apart from the component so Node can test it.
3
+ */
4
+ export interface NumberStepLimits {
5
+ /** The lowest value; no limit when left out. */
6
+ min?: number;
7
+ /** The highest value; no limit when left out. */
8
+ max?: number;
9
+ /** An angle: a step past 360 comes back round to 0, and a step below 0 to 360, instead of stopping at a limit. */
10
+ wrapAround?: boolean;
11
+ }
12
+ /**
13
+ * The value after one press of a stepper button (or one arrow key): `currentValue` moved by `adjustment`, then kept inside
14
+ * the limits, or brought back round for an angle. At a limit the result is `currentValue` itself, which tells the caller
15
+ * that there is nothing to apply (and nothing to repeat).
16
+ */
17
+ export declare function steppedNumber(currentValue: number, adjustment: number, { min, max, wrapAround }?: NumberStepLimits): number;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The arithmetic of the number stepper (`NumberControls.svelte`), kept apart from the component so Node can test it.
3
+ */
4
+ /**
5
+ * The value after one press of a stepper button (or one arrow key): `currentValue` moved by `adjustment`, then kept inside
6
+ * the limits, or brought back round for an angle. At a limit the result is `currentValue` itself, which tells the caller
7
+ * that there is nothing to apply (and nothing to repeat).
8
+ */
9
+ export function steppedNumber(currentValue, adjustment, { min, max, wrapAround = false } = {}) {
10
+ let steppedValue = currentValue + adjustment;
11
+ if (wrapAround) {
12
+ if (steppedValue >= 360)
13
+ steppedValue -= 360;
14
+ if (steppedValue < 0)
15
+ steppedValue += 360;
16
+ return steppedValue;
17
+ }
18
+ if (min !== undefined && steppedValue < min)
19
+ steppedValue = min;
20
+ if (max !== undefined && steppedValue > max)
21
+ steppedValue = max;
22
+ return steppedValue;
23
+ }
@@ -0,0 +1,23 @@
1
+ <!--
2
+ The arrow of a dropdown trigger (Figma IC Dropdown, Select Trigger): ONE chevron that turns half a turn while the list is open.
3
+ It used to be two icons swapped on open (chevron down, chevron up), so it jumped from one to the other. The accordion turns
4
+ one arrow with `transition-transform duration-base`, and so does this one: the same 160 ms, the same ease.
5
+ -->
6
+ <script lang="ts">
7
+ import { IconChevronDown } from '@widgetic/design-system/icons';
8
+
9
+ let {
10
+ open = false,
11
+ class: className = 'size-4 shrink-0 stroke-[1.333] text-muted-foreground'
12
+ }: {
13
+ /** True while the list the trigger opens is open: the arrow points up. */
14
+ open?: boolean;
15
+ /** The size and colour of the arrow. */
16
+ class?: string;
17
+ } = $props();
18
+ </script>
19
+
20
+ <IconChevronDown
21
+ class="{className} transition-transform duration-base {open ? 'rotate-180' : ''}"
22
+ aria-hidden="true"
23
+ />
@@ -0,0 +1,9 @@
1
+ type $$ComponentProps = {
2
+ /** True while the list the trigger opens is open: the arrow points up. */
3
+ open?: boolean;
4
+ /** The size and colour of the arrow. */
5
+ class?: string;
6
+ };
7
+ declare const DropdownChevron: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type DropdownChevron = ReturnType<typeof DropdownChevron>;
9
+ export default DropdownChevron;
@@ -283,251 +283,7 @@ export declare const EDITOR_CATALOGS: {
283
283
  readonly 'editor.embed.helpLinkAria': "Read more about embedding";
284
284
  readonly 'editor.schema.subtitleFont': "Subtitle Font";
285
285
  };
286
- readonly fileBrowser: {
287
- readonly 'action.cancel': "Cancel";
288
- readonly 'action.confirm': "Confirm";
289
- readonly 'action.create': "Create";
290
- readonly 'action.delete': "Delete";
291
- readonly 'action.done': "Done";
292
- readonly 'action.download': "Download";
293
- readonly 'action.move': "Move";
294
- readonly 'action.rename': "Rename";
295
- readonly 'action.tryAgain': "Try again";
296
- readonly 'action.preview': "Preview";
297
- readonly 'action.play': "Play";
298
- readonly 'action.pause': "Pause";
299
- readonly 'action.mute': "Mute";
300
- readonly 'action.unmute': "Unmute";
301
- readonly 'action.select': "Select";
302
- readonly 'action.selected': "Selected";
303
- readonly 'action.clearItems': "Clear items";
304
- readonly 'action.addToEditor': "Add to Editor";
305
- readonly 'list.separator': ", ";
306
- readonly 'toast.inBackground': "This will happen in the background";
307
- readonly 'toast.unknownError': "Unknown error occurred";
308
- readonly 'toast.regionLabel': "Notifications";
309
- readonly 'toast.closeLabel': "Close notification";
310
- readonly 'search.placeholder': "Search...";
311
- readonly 'filter.by': "Filter by {type}";
312
- readonly 'filterName.all': "All";
313
- readonly 'filterName.image': "Image";
314
- readonly 'filterName.audio': "Audio";
315
- readonly 'filterName.video': "Video";
316
- readonly 'filterName.document': "Document";
317
- readonly 'filterName.font': "Font";
318
- readonly 'filterName.svg': "SVG";
319
- readonly 'filterOption.all': "All";
320
- readonly 'filterOption.image': "Images";
321
- readonly 'filterOption.video': "Videos";
322
- readonly 'filterOption.document': "Documents";
323
- readonly 'filterOption.audio': "Audio";
324
- readonly 'filterOption.font': "Fonts";
325
- readonly 'filterOption.svg': "SVG";
326
- readonly 'sort.name': "Name";
327
- readonly 'sort.date': "Date";
328
- readonly 'sort.size': "Size";
329
- readonly 'breadcrumbs.back': "Back";
330
- readonly 'breadcrumbs.forward': "Forward";
331
- readonly 'breadcrumbs.root': "File browser";
332
- readonly 'breadcrumbs.label': "breadcrumb";
333
- readonly 'empty.library': "No files yet!";
334
- readonly 'empty.libraryFiltered': "No files of this type!";
335
- readonly 'empty.folder': "No files in this folder!";
336
- readonly 'library.partialNotice': "Some files could not be loaded.";
337
- readonly 'library.truncatedNotice': "Only the newest files are shown.";
338
- readonly 'library.notSetUp': "The media library is not set up correctly.";
339
- readonly 'library.defaultLabel': "My uploads";
340
- readonly 'libraryError.loadFailed': "Could not load the files";
341
- readonly 'libraryError.uploadFailed': "The upload failed";
342
- readonly 'libraryError.renameFailed': "Could not rename the file";
343
- readonly 'libraryError.deleteFailed': "Could not delete the file";
344
- readonly 'libraryError.unreachable': "Could not reach the media library";
345
- readonly 'libraryError.timeout': "The media library did not answer in time";
346
- readonly 'libraryError.renameNotAllowed': "This media library does not allow renaming files";
347
- readonly 'libraryError.deleteNotAllowed': "This media library does not allow deleting files";
348
- readonly 'libraryError.fileGone': "The file is no longer in the list";
349
- readonly 'libraryError.repeatedPage': "The media library keeps returning the same files, so the rest was not loaded";
350
- readonly 'libraryError.accessToken': "Could not get an access token from the page";
351
- readonly 'libraryError.accessTokenRenew': "Could not get a fresh access token from the page";
352
- readonly 'libraryError.fileTooLarge': "Files over {limit} MB cannot be uploaded here yet";
353
- readonly 'libraryError.uploadNotAllowed': "This media library does not accept uploads";
354
- readonly 'size.bytes': "{size} Bytes";
355
- readonly 'size.kb': "{size} KB";
356
- readonly 'size.mb': "{size} MB";
357
- readonly 'size.gb': "{size} GB";
358
- readonly 'size.tb': "{size} TB";
359
- readonly 'fileKind.any': "any";
360
- readonly 'fileKind.image': "image";
361
- readonly 'fileKind.video': "video";
362
- readonly 'fileKind.audio': "audio";
363
- readonly 'fileKind.document': "document";
364
- readonly 'fileKind.font': "font";
365
- readonly 'fileKind.svg': "SVG";
366
- readonly 'fileTypes.allowed': "Allowed types: {types}";
367
- readonly 'fileTypes.allowedSvg': "Allowed types: SVG files (.svg)";
368
- readonly 'fileTypes.allowedDocument': "Allowed types: document files ({types})";
369
- readonly 'fileTypes.addAll': "Add images ({images}), audio ({audio}), video ({video}), documents ({documents}), fonts ({fonts}) or vector graphics ({svg}).";
370
- readonly 'fileTypes.fontNaming': "Font naming convention:\nFontFamily-Weight.extension\n\nExample:\nGeistMono-Black.ttf";
371
- readonly 'upload.uploading': "Uploading...";
372
- readonly 'upload.foldersNotAllowed': "Folders cannot be uploaded";
373
- readonly 'upload.invalidType': "Invalid file type. Please use {types} files only.";
374
- readonly 'upload.dropActive': "Drop to upload {types} files";
375
- readonly 'upload.button': "Upload {types} files";
376
- readonly 'upload.dragHint': "or drag and drop {types} files here";
377
- readonly 'upload.chooseOrDrop': "Upload or drop {types} files here";
378
- readonly 'upload.chooseOrDropLink': "Upload";
379
- readonly 'upload.panelTitle': "File Upload Progress";
380
- readonly 'upload.progress': "{total, plural, other {{done}/# files uploaded}}";
381
- readonly 'upload.failedCount': "{count} failed";
382
- readonly 'upload.expandPanel': "Expand panel";
383
- readonly 'upload.collapsePanel': "Collapse panel";
384
- readonly 'upload.expandUploader': "Expand uploader";
385
- readonly 'upload.collapseUploader': "Collapse uploader";
386
- readonly 'upload.closeUploader': "Close uploader";
387
- readonly 'upload.cancel': "Cancel upload";
388
- readonly 'upload.retry': "Retry upload";
389
- readonly 'upload.retryFailed': "Retry failed uploads?";
390
- readonly 'upload.clearCompleted': "Clear completed uploads";
391
- readonly 'upload.completedAlt': "Completed";
392
- readonly 'upload.networkError': "Network error";
393
- readonly 'upload.unknownError': "Unknown error";
394
- readonly 'upload.skippedOne': "Skipped duplicate file: {name}";
395
- readonly 'upload.skippedMany': "{count, plural, one {Skipped # duplicate file} other {Skipped # duplicate files}}";
396
- readonly 'upload.time.calculating': "calculating...";
397
- readonly 'upload.time.lessThanSecond': "less than a second";
398
- readonly 'upload.time.seconds': "{count, plural, one {# second} other {# seconds}}";
399
- readonly 'upload.time.minutes': "{count, plural, one {# minute} other {# minutes}}";
400
- readonly 'upload.timeLeft': "{time} left";
401
- readonly 'upload.complete': "Upload complete.";
402
- readonly 'upload.removeFile': "Remove file";
403
- readonly 'upload.uploadingProgress': "{total, plural, other {Uploading {done}/# files}}";
404
- readonly 'upload.filesTotal': "{count, plural, one {# file} other {# files}}";
405
- readonly 'upload.completeCount': "{done}/{total} complete";
406
- readonly 'dialog.delete.folderTitle': "Delete folder";
407
- readonly 'dialog.delete.itemsTitle': "Delete items";
408
- readonly 'dialog.delete.fileTitle': "Delete file";
409
- readonly 'dialog.delete.folderMessage': "Delete '{name}' and all content inside?";
410
- readonly 'dialog.delete.itemsMessage': "{count, plural, one {Are you sure you want to delete # item?} other {Are you sure you want to delete # items?}}";
411
- readonly 'dialog.delete.fileMessage': "Delete '{name}'?";
412
- readonly 'dialog.newFolder.placeholder': "folder name...";
413
- readonly 'dialog.newFolder.invalidTitle': "Invalid folder name";
414
- readonly 'dialog.newFolder.required': "Folder name is required";
415
- readonly 'dialog.newFolder.invalidCharacters': "Folder name can only contain letters, numbers, and spaces";
416
- readonly 'dialog.newFolder.tooLong': "Folder name cannot exceed {max} characters";
417
- readonly 'dialog.rename.filePlaceholder': "file name...";
418
- readonly 'dialog.rename.folderPlaceholder': "folder name...";
419
- readonly 'dialog.rename.invalidTitle': "Invalid name";
420
- readonly 'dialog.rename.enterName': "Please enter a name";
421
- readonly 'dialog.rename.enterDifferentName': "Please enter a different name";
422
- readonly 'dialog.rename.enterValidName': "Please enter a valid name";
423
- readonly 'dialog.rename.tooShort': "Name must be at least 1 character long";
424
- readonly 'dialog.rename.tooLong': "Name must be {max} characters or less";
425
- readonly 'dialog.close': "Close modal";
426
- readonly 'toast.rename.started': "Renaming \"{name}\"...";
427
- readonly 'toast.rename.done': "Item renamed";
428
- readonly 'toast.rename.doneDetail': "Successfully renamed \"{oldName}\" to \"{newName}\"";
429
- readonly 'toast.rename.failed': "Rename failed";
430
- readonly 'toast.rename.noChange': "No changes were made";
431
- readonly 'toast.rename.noItem': "No valid item selected";
432
- readonly 'toast.rename.unknownError': "An unknown error occurred";
433
- readonly 'toast.delete.started': "{count, plural, one {Deleting \"{name}\"...} other {Deleting # items...}}";
434
- readonly 'toast.delete.doneFolder': "Deleted folder \"{name}\"";
435
- readonly 'toast.delete.doneFile': "Deleted \"{name}\"";
436
- readonly 'toast.delete.doneMany': "{count, plural, one {Deleted # item} other {Deleted # items}}";
437
- readonly 'toast.delete.doneFolderDetail': "Folder and its contents were deleted successfully";
438
- readonly 'toast.delete.doneFileDetail': "Item was deleted successfully";
439
- readonly 'toast.delete.doneManyDetail': "{count, plural, one {# item was deleted successfully} other {# items were deleted successfully}}";
440
- readonly 'toast.delete.doneNames': "Deleted: {names}";
441
- readonly 'toast.delete.failedOne': "Failed to delete \"{name}\"";
442
- readonly 'toast.delete.failedMany': "{count, plural, one {Failed to delete # item} other {Failed to delete # items}}";
443
- readonly 'toast.delete.failedNames': "Failed to delete: {names}";
444
- readonly 'toast.delete.failedSome': "Some items could not be deleted";
445
- readonly 'toast.delete.failedAll': "Failed to delete items";
446
- readonly 'toast.folder.created': "Folder created";
447
- readonly 'toast.folder.createdDetail': "Created folder \"{name}\"";
448
- readonly 'toast.folder.failed': "Failed to create folder";
449
- readonly 'toast.navigation.failed': "Navigation failed";
450
- readonly 'toast.navigation.noFolder': "Could not find the target folder location";
451
- readonly 'toast.navigation.error': "An error occurred while navigating to the target folder";
452
- readonly 'toast.filesAdded': "Files added";
453
- readonly 'toast.filesAddedDetail': "{count, plural, one {Added # file to the editor} other {Added # files to the editor}}";
454
- readonly 'folder.currentLocation': "current location";
455
- readonly 'folder.open': "Open folder {name}";
456
- readonly 'folder.empty': "Empty";
457
- readonly 'folder.itemCount': "{count, plural, one {# item} other {# items}}";
458
- readonly 'item.previewLabel': "Preview {name}";
459
- readonly 'item.audioFile': "Audio file";
460
- readonly 'item.documentFile': "Document file";
461
- readonly 'item.deleteMissing': "Delete missing file";
462
- readonly 'item.folder': "Folder";
463
- readonly 'recent.title': "Recent Files";
464
- readonly 'recent.empty': "No recent files available!";
465
- readonly 'newFolder.alt': "New Folder";
466
- readonly 'newFolder.label': "New folder";
467
- readonly 'search.noResults': "No results found";
468
- readonly 'menu.open': "Open menu";
469
- readonly 'menu.moreOptions': "More options";
470
- readonly 'toolbar.more': "+{count} more";
471
- readonly 'toolbar.moveMany': "{count, plural, one {Move # file} other {Move # files}}";
472
- readonly 'toolbar.deleteMany': "{count, plural, one {Delete # file} other {Delete # files}}";
473
- readonly 'selectedFiles.title': "Selected files";
474
- readonly 'selectedFiles.empty': "No files selected";
475
- readonly 'selectedFiles.count': "{count, plural, one {# file selected} other {# files selected}}";
476
- readonly 'selectedFiles.confirmMany': "{count, plural, one {Use # file} other {Use # files}}";
477
- readonly 'searchModal.placeholder': "Search files and folders...";
478
- readonly 'searchModal.jumpToFolder': "Jump to folder";
479
- readonly 'searchModal.empty': "No files found";
480
- readonly 'moveDialog.titleOne': "Move \"{name}\"";
481
- readonly 'moveDialog.titleMany': "{count, plural, one {Move # item} other {Move # items}}";
482
- readonly 'moveDialog.rootName': "File browser";
483
- readonly 'moveDialog.movingTo': "Moving to {name}";
484
- readonly 'moveDialog.confirmFolder': "Move folder";
485
- readonly 'moveDialog.confirmItem': "Move to folder";
486
- readonly 'moveDialog.confirmMany': "{count, plural, one {Move # item} other {Move # items}}";
487
- readonly 'moveDialog.failedFolder': "Failed to move folder";
488
- readonly 'moveDialog.failedItems': "Failed to move items";
489
- readonly 'moveDialog.noTarget': "No target folder selected";
490
- readonly 'moveDialog.noItems': "No items selected to move";
491
- readonly 'moveDialog.pickDestination': "Please select a destination folder";
492
- readonly 'moveDialog.noneMoved': "No items were moved successfully";
493
- readonly 'moveDialog.partialTitle': "Some items moved";
494
- readonly 'moveDialog.partialDetail': "{total, plural, other {Moved {moved} out of # items}}";
495
- readonly 'moveDialog.doneFolder': "Folder moved";
496
- readonly 'moveDialog.doneOne': "Item moved";
497
- readonly 'moveDialog.doneMany': "Items moved";
498
- readonly 'moveDialog.doneFolderDetail': "Moved folder \"{name}\" successfully";
499
- readonly 'moveDialog.doneItemsDetail': "{count, plural, one {Moved # item successfully} other {Moved # items successfully}}";
500
- readonly 'preview.audioFailed': "Audio failed to load";
501
- readonly 'preview.audioUnsupported': "Your browser does not support the audio element.";
502
- readonly 'preview.videoFailed': "Video failed to load";
503
- readonly 'preview.videoUnsupported': "Your browser does not support the video tag.";
504
- readonly 'preview.errorAlt': "Error";
505
- readonly 'preview.fileNotFound': "File not found";
506
- readonly 'preview.loading': "Loading...";
507
- readonly 'preview.textFailed': "Failed to load text file";
508
- readonly 'preview.textFailedReason': "Failed to load text file: {reason}";
509
- readonly 'preview.unavailable': "Preview not available for this file type.";
510
- readonly 'preview.pdfLoading': "Loading PDF...";
511
- readonly 'preview.pdfFailed': "Failed to load PDF";
512
- readonly 'preview.pdfPage': "Page {page} of {total}";
513
- readonly 'preview.pdfPreviousPage': "Previous page";
514
- readonly 'preview.pdfNextPage': "Next page";
515
- readonly 'fontPreview.sample': "The quick brown fox jumps over the lazy dog";
516
- readonly 'fontPreview.sampleShort': "The quick fox";
517
- readonly 'metadata.title': "File Information";
518
- readonly 'metadata.name': "Name:";
519
- readonly 'metadata.type': "Type:";
520
- readonly 'metadata.size': "Size:";
521
- readonly 'metadata.modified': "Last Modified:";
522
- readonly 'metadata.notAvailable': "N/A";
523
- readonly 'date.fewSecondsAgo': "A few seconds ago";
524
- readonly 'date.hoursAgo': "{count, plural, one {# hour ago} other {# hours ago}}";
525
- readonly 'date.daysAgo': "{count, plural, one {# day ago} other {# days ago}}";
526
- readonly 'date.weeksAgo': "{count, plural, one {# week ago} other {# weeks ago}}";
527
- readonly 'date.aboutAMonthAgo': "About a month ago";
528
- readonly 'date.severalMonthsAgo': "Several months ago";
529
- readonly 'date.overAYearAgo': "Over a year ago";
530
- };
286
+ readonly fileBrowser: any;
531
287
  readonly shadEditor: {
532
288
  readonly 'shadEditor.toolbar.undo': "Undo (\u2318Z)";
533
289
  readonly 'shadEditor.toolbar.redo': "Redo (\u2318\u21E7Z)";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/editor",
3
- "version": "4.1.15",
3
+ "version": "4.1.17",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -66,7 +66,7 @@
66
66
  "@tailwindcss/typography": "^0.5.19",
67
67
  "@types/fontfaceobserver": "^2.1.3",
68
68
  "@types/node": "26.6.2",
69
- "@widgetic/api-sdk": "^1.0.10",
69
+ "@widgetic/api-sdk": "^2.0.1",
70
70
  "@widgetic/cache-layer": "^0.1.1",
71
71
  "@widgetic/design-system": "^0.5.23",
72
72
  "@widgetic/dev-tools": "^0.2.0",