@r2digisolutions/components 0.24.3 → 0.24.5

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 (24) hide show
  1. package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +25 -5
  2. package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +1 -1
  3. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +1 -0
  4. package/dist/components/molecules/MediaStage/MediaStage.svelte +27 -30
  5. package/dist/components/molecules/PropertyField/PropertyField.svelte +14 -22
  6. package/dist/components/molecules/Stepper/Stepper.svelte +2 -0
  7. package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte +25 -6
  8. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +330 -78
  9. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte.d.ts +9 -1
  10. package/dist/components/organisms/CanvasEditor/CanvasPageStrip.svelte +135 -0
  11. package/dist/components/organisms/CanvasEditor/CanvasPageStrip.svelte.d.ts +13 -0
  12. package/dist/components/organisms/CanvasEditor/CanvasQuickDock.svelte +132 -0
  13. package/dist/components/organisms/CanvasEditor/CanvasQuickDock.svelte.d.ts +10 -0
  14. package/dist/components/organisms/DataListPage/DataListPage.svelte.d.ts +1 -1
  15. package/dist/components/organisms/ResourceStudio/ResourceStudio.svelte.d.ts +1 -1
  16. package/dist/components/organisms/SearchResults/SearchResults.svelte.d.ts +1 -1
  17. package/dist/components/templates/ListingTemplate/ListingTemplate.svelte.d.ts +1 -1
  18. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplate.svelte.d.ts +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +1 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/utils/canvasDocument.d.ts +44 -0
  23. package/dist/utils/canvasDocument.js +139 -5
  24. package/package.json +1 -1
@@ -1200,7 +1200,11 @@
1200
1200
  patch({ fontSize: Number((e.currentTarget as HTMLInputElement).value) })}
1201
1201
  />
1202
1202
  </PropertyField>
1203
- <PropertyField label="Weight">
1203
+ <PropertyField
1204
+ label="Weight"
1205
+ modified={fieldModified('fontWeight')}
1206
+ onreset={() => resetField('fontWeight')}
1207
+ >
1204
1208
  <Select
1205
1209
  size="xs"
1206
1210
  options={weightOptions}
@@ -1208,7 +1212,11 @@
1208
1212
  onchange={(v) => patch({ fontWeight: v })}
1209
1213
  />
1210
1214
  </PropertyField>
1211
- <PropertyField label="Style">
1215
+ <PropertyField
1216
+ label="Style"
1217
+ modified={fieldModified('fontStyle')}
1218
+ onreset={() => resetField('fontStyle')}
1219
+ >
1212
1220
  <Select
1213
1221
  size="xs"
1214
1222
  options={styleOptions}
@@ -1216,7 +1224,11 @@
1216
1224
  onchange={(v) => patch({ fontStyle: v as CanvasLayer['fontStyle'] })}
1217
1225
  />
1218
1226
  </PropertyField>
1219
- <PropertyField label="Decoration">
1227
+ <PropertyField
1228
+ label="Decoration"
1229
+ modified={fieldModified('textDecoration')}
1230
+ onreset={() => resetField('textDecoration')}
1231
+ >
1220
1232
  <Select
1221
1233
  size="xs"
1222
1234
  options={decoOptions}
@@ -1296,7 +1308,11 @@
1296
1308
  />
1297
1309
  </PropertyField>
1298
1310
  {/if}
1299
- <PropertyField label="Letter spacing">
1311
+ <PropertyField
1312
+ label="Letter spacing"
1313
+ modified={fieldModified('letterSpacing')}
1314
+ onreset={() => resetField('letterSpacing')}
1315
+ >
1300
1316
  <Input
1301
1317
  type="number"
1302
1318
  size="sm"
@@ -1305,7 +1321,11 @@
1305
1321
  patch({ letterSpacing: Number((e.currentTarget as HTMLInputElement).value) })}
1306
1322
  />
1307
1323
  </PropertyField>
1308
- <PropertyField label="Line height">
1324
+ <PropertyField
1325
+ label="Line height"
1326
+ modified={fieldModified('lineHeight')}
1327
+ onreset={() => resetField('lineHeight')}
1328
+ >
1309
1329
  <Input
1310
1330
  type="number"
1311
1331
  size="sm"
@@ -228,7 +228,7 @@
228
228
  ]}
229
229
  aria-haspopup="listbox"
230
230
  aria-expanded={open}
231
- aria-label={label}
231
+ aria-label={`${label}: ${current?.label ?? value} ${shortCode}`}
232
232
  onclick={() => (open = !open)}
233
233
  >
234
234
  {#if showFlags && current?.flag}
@@ -335,6 +335,7 @@
335
335
  flush
336
336
  clipContent={layer.kind === 'text' || layer.kind === 'sticky' ? !textAuto : true}
337
337
  handleStyle="canva"
338
+ snapMode="live"
338
339
  hugContent={textAuto}
339
340
  hugMaxWidth={layer.textMaxWidth ?? 0}
340
341
  resizeEdges={textAuto ? [...TEXT_RESIZE_EDGES] : undefined}
@@ -332,14 +332,15 @@
332
332
  const gridOverlayStyle = $derived.by(() => {
333
333
  const cell = Math.max(4, cellSize);
334
334
  const major = cell * 5;
335
- const fine = 'color-mix(in oklab, #0f172a 18%, transparent)';
336
- const bold = 'color-mix(in oklab, #0f172a 32%, transparent)';
335
+ const line = 1 / Math.max(0.05, scale);
336
+ const fine = 'color-mix(in oklab, #171717 28%, transparent)';
337
+ const bold = 'color-mix(in oklab, #171717 48%, transparent)';
337
338
  return [
338
339
  `background-image:`,
339
- `linear-gradient(to right, ${fine} 1px, transparent 1px),`,
340
- `linear-gradient(to bottom, ${fine} 1px, transparent 1px),`,
341
- `linear-gradient(to right, ${bold} 1px, transparent 1px),`,
342
- `linear-gradient(to bottom, ${bold} 1px, transparent 1px);`,
340
+ `linear-gradient(to right, ${fine} ${line}px, transparent ${line}px),`,
341
+ `linear-gradient(to bottom, ${fine} ${line}px, transparent ${line}px),`,
342
+ `linear-gradient(to right, ${bold} ${line}px, transparent ${line}px),`,
343
+ `linear-gradient(to bottom, ${bold} ${line}px, transparent ${line}px);`,
343
344
  `background-size:${cell}px ${cell}px, ${cell}px ${cell}px, ${major}px ${major}px, ${major}px ${major}px;`
344
345
  ].join('');
345
346
  });
@@ -1276,13 +1277,7 @@
1276
1277
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1277
1278
  <div
1278
1279
  bind:this={viewportEl}
1279
- class="min-h-0 min-w-0 relative flex-1 overflow-auto"
1280
- style:background-color="#dfe3e8"
1281
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1282
- 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent 25%),linear-gradient(45deg,transparent
1283
- 75%,#cfd5dc 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1284
- style:background-size="16px 16px"
1285
- style:background-position="0 0,0 8px,8px -8px,-8px 0"
1280
+ class="min-h-0 min-w-0 relative flex-1 overflow-auto bg-neutral-200 dark:bg-neutral-950"
1286
1281
  role="presentation"
1287
1282
  onclick={clearSelectionIfEmptyClick}
1288
1283
  ondragover={handleElementDragOver}
@@ -1346,11 +1341,11 @@
1346
1341
  {#if artboardTransparent}
1347
1342
  <div
1348
1343
  class="inset-0 absolute"
1349
- style:background-color="#e8ebef"
1350
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1351
- 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent
1352
- 25%),linear-gradient(45deg,transparent 75%,#cfd5dc
1353
- 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1344
+ style:background-color="#f5f5f5"
1345
+ style:background-image="linear-gradient(45deg,#e5e5e5 25%,transparent
1346
+ 25%),linear-gradient(-45deg,#e5e5e5 25%,transparent
1347
+ 25%),linear-gradient(45deg,transparent 75%,#e5e5e5
1348
+ 75%),linear-gradient(-45deg,transparent 75%,#e5e5e5 75%)"
1354
1349
  style:background-size="16px 16px"
1355
1350
  style:background-position="0 0,0 8px,8px -8px,-8px 0"
1356
1351
  ></div>
@@ -1358,14 +1353,6 @@
1358
1353
  <div class="inset-0 absolute" style:background-color={doc.background}></div>
1359
1354
  </div>
1360
1355
 
1361
- {#if showGrid}
1362
- <div
1363
- class="inset-0 pointer-events-none absolute z-100 overflow-hidden"
1364
- style={gridOverlayStyle}
1365
- aria-hidden="true"
1366
- ></div>
1367
- {/if}
1368
-
1369
1356
  <div class={['inset-0 absolute overflow-visible', drawMode && 'pointer-events-none']}>
1370
1357
  {#each sorted as layer, paintIndex (layer.id)}
1371
1358
  {#if effectivelyVisible.has(layer.id)}
@@ -1493,6 +1480,7 @@
1493
1480
  showChrome={false}
1494
1481
  flush
1495
1482
  handleStyle="canva"
1483
+ snapMode="live"
1496
1484
  handlesVisible={true}
1497
1485
  raiseOnSelect={false}
1498
1486
  stackIndex={999999}
@@ -1543,7 +1531,7 @@
1543
1531
  >
1544
1532
  <div
1545
1533
  data-scroll-thumb="y"
1546
- class="left-0.5 right-0.5 bg-slate-400/75 shadow-sm dark:bg-slate-500/85 absolute cursor-grab rounded-full active:cursor-grabbing"
1534
+ class="left-0.5 right-0.5 bg-neutral-400/80 absolute cursor-grab rounded-full active:cursor-grabbing"
1547
1535
  style:top="{vScroll.offset}px"
1548
1536
  style:height="{vScroll.thumb}px"
1549
1537
  onpointerdown={(e) =>
@@ -1561,7 +1549,7 @@
1561
1549
  >
1562
1550
  <div
1563
1551
  data-scroll-thumb="x"
1564
- class="top-0.5 bottom-0.5 bg-slate-400/75 shadow-sm dark:bg-slate-500/85 absolute cursor-grab rounded-full active:cursor-grabbing"
1552
+ class="top-0.5 bottom-0.5 bg-neutral-400/80 absolute cursor-grab rounded-full active:cursor-grabbing"
1565
1553
  style:left="{hScroll.offset}px"
1566
1554
  style:width="{hScroll.thumb}px"
1567
1555
  onpointerdown={(e) =>
@@ -1580,6 +1568,14 @@
1580
1568
  {/if}
1581
1569
  {/each}
1582
1570
  </div>
1571
+ {#if showGrid}
1572
+ <div
1573
+ class="pointer-events-none absolute inset-0 overflow-hidden"
1574
+ style:z-index="2000000"
1575
+ style={gridOverlayStyle}
1576
+ aria-hidden="true"
1577
+ ></div>
1578
+ {/if}
1583
1579
  </div>
1584
1580
  </div>
1585
1581
  </div>
@@ -1600,13 +1596,14 @@
1600
1596
  <div
1601
1597
  data-guide={guide.id}
1602
1598
  class={[
1603
- 'absolute z-40',
1599
+ 'absolute',
1604
1600
  guide.orientation === 'vertical'
1605
1601
  ? 'w-2 -translate-x-1/2 cursor-col-resize'
1606
1602
  : 'h-2 -translate-y-1/2 cursor-row-resize',
1607
1603
  locked && 'cursor-default',
1608
1604
  hiding && 'opacity-0'
1609
1605
  ]}
1606
+ style:z-index="2100000"
1610
1607
  style:left={guide.orientation === 'vertical'
1611
1608
  ? `${RULER_LEFT + tickX(guide.position)}px`
1612
1609
  : `${originX}px`}
@@ -1669,7 +1666,7 @@
1669
1666
  {/if}
1670
1667
  </svg>
1671
1668
  <div
1672
- class="bottom-3 rounded-md bg-slate-900/90 px-3 py-1.5 text-white shadow pointer-events-none absolute left-1/2 z-50 -translate-x-1/2 text-[11px]"
1669
+ class="bottom-3 rounded-md bg-neutral-900/90 px-3 py-1.5 text-white pointer-events-none absolute left-1/2 z-50 -translate-x-1/2 text-[11px]"
1673
1670
  >
1674
1671
  Click to add · near start to close · double-click / Enter to finish · Esc cancel
1675
1672
  </div>
@@ -45,9 +45,7 @@
45
45
  }: PropertyFieldProps = $props();
46
46
 
47
47
  const canReset = $derived(!!onreset && modified && !disabled);
48
- const columns = $derived(
49
- compact ? `${labelWidth} minmax(0, 1fr)` : `1.25rem ${labelWidth} minmax(0, 1fr)`
50
- );
48
+ const columns = $derived(`${labelWidth} minmax(0, 1fr)`);
51
49
  </script>
52
50
 
53
51
  <div
@@ -59,33 +57,27 @@
59
57
  ]}
60
58
  style:grid-template-columns={columns}
61
59
  >
62
- {#if !compact}
63
- <!-- Reset gutter: always reserved so every row shares the same label/value columns -->
64
- <span class="flex h-7 w-5 items-center justify-center">
65
- {#if canReset}
66
- <Tooltip content="Reset to default" side="top">
67
- <IconButton
68
- label="Reset to default"
69
- size="xs"
70
- class="text-amber-500 hover:bg-amber-500/10 hover:text-amber-600 dark:text-amber-400 dark:hover:text-amber-300"
71
- onclick={() => onreset?.()}
72
- >
73
- <RotateCcw class="h-3 w-3" strokeWidth={2.5} />
74
- </IconButton>
75
- </Tooltip>
76
- {/if}
77
- </span>
78
- {/if}
79
-
80
60
  <span class="flex min-w-0 items-center justify-start gap-0.5 text-left" title={label}>
81
61
  <Text
82
62
  size="xs"
83
63
  tone={canReset ? 'primary' : 'secondary'}
84
64
  as="span"
85
- class={['min-w-0 flex-1 truncate font-medium', canReset && 'text-amber-700 dark:text-amber-400']}
65
+ class={['min-w-0 truncate font-medium', canReset && 'text-amber-700 dark:text-amber-400']}
86
66
  >
87
67
  {label}
88
68
  </Text>
69
+ {#if canReset}
70
+ <Tooltip content="Restablecer" side="top">
71
+ <IconButton
72
+ label="Restablecer"
73
+ size="xs"
74
+ class="shrink-0 text-amber-500 hover:bg-amber-500/10 hover:text-amber-600 dark:text-amber-400 dark:hover:text-amber-300"
75
+ onclick={() => onreset?.()}
76
+ >
77
+ <RotateCcw class="h-3 w-3" strokeWidth={2.5} />
78
+ </IconButton>
79
+ </Tooltip>
80
+ {/if}
89
81
  {#if exposed !== null}
90
82
  <IconButton
91
83
  label={exposed ? 'Hide from instances' : 'Expose on instances'}
@@ -187,6 +187,7 @@
187
187
  type="button"
188
188
  disabled={!navigable}
189
189
  onclick={() => goTo(index)}
190
+ aria-label={`${index + 1}. ${step.label}`}
190
191
  aria-current={state === 'current' || state === 'error' ? 'step' : undefined}
191
192
  aria-disabled={step.disabled || undefined}
192
193
  class={[
@@ -215,6 +216,7 @@
215
216
  type="button"
216
217
  disabled={!navigable}
217
218
  onclick={() => goTo(index)}
219
+ aria-label={`${index + 1}. ${step.label}`}
218
220
  aria-current={state === 'current' || state === 'error' ? 'step' : undefined}
219
221
  aria-disabled={step.disabled || undefined}
220
222
  class={[
@@ -161,6 +161,8 @@
161
161
  }: WidgetFrameProps = $props();
162
162
 
163
163
  const canvas = getContext<WidgetCanvasContext | undefined>(WIDGET_CANVAS_CONTEXT);
164
+ /** Document pixels per screen pixel, so chrome stays the same size when the artboard is zoomed. */
165
+ const ui = $derived(1 / Math.max(0.05, canvas?.scale || 1));
164
166
 
165
167
  let mode = $state<'move' | 'resize' | null>(null);
166
168
  let rotating = $state(false);
@@ -647,7 +649,7 @@
647
649
  !isCanva && showChrome && 'rounded-xl border-border bg-surface-elevated overflow-hidden border',
648
650
  !isCanva && !showChrome && 'bg-transparent',
649
651
  isCanva && 'bg-transparent',
650
- canvaBorder && 'outline outline-2 outline-[#3b82f6]',
652
+ canvaBorder && 'outline outline-[#3b82f6]',
651
653
  freeform ? 'shadow-md absolute' : 'relative',
652
654
  isCanva && 'shadow-none',
653
655
  mode === 'move' && 'cursor-grabbing opacity-95',
@@ -656,6 +658,7 @@
656
658
  frameClassName
657
659
  ]}
658
660
  style={rootStyle}
661
+ style:outline-width={canvaBorder ? `${2 * ui}px` : undefined}
659
662
  onpointerdown={(e) => {
660
663
  bringToFront();
661
664
  if (!showChrome && freeform && draggable && e.button === 0) {
@@ -814,14 +817,21 @@
814
817
 
815
818
  {#if isCanva && mode === 'resize'}
816
819
  <div
817
- class="rounded-md bg-neutral-900 px-2 py-1 font-medium text-white top-0 shadow-md pointer-events-none absolute left-1/2 z-30 -translate-x-1/2 -translate-y-[calc(100%+8px)] text-[11px] whitespace-nowrap"
820
+ class="rounded-md bg-neutral-900 font-medium text-white top-0 shadow-md pointer-events-none absolute left-1/2 z-30 whitespace-nowrap"
821
+ style:padding="{4 * ui}px {8 * ui}px"
822
+ style:font-size="{11 * ui}px"
823
+ style:transform="translate(-50%, calc(-100% - {8 * ui}px))"
818
824
  >
819
825
  {Math.round(rect.w)} × {Math.round(hugContent && hugLiveH > 0 ? hugLiveH : rect.h)}
820
826
  </div>
821
827
  {/if}
822
828
  {#if isCanva && rotating}
823
829
  <div
824
- class="rounded-md bg-neutral-900 px-2 py-1 font-medium text-white mt-8 shadow-md pointer-events-none absolute top-full left-1/2 z-30 -translate-x-1/2 text-[11px] whitespace-nowrap"
830
+ class="rounded-md bg-neutral-900 font-medium text-white shadow-md pointer-events-none absolute top-full left-1/2 z-30 whitespace-nowrap"
831
+ style:margin-top="{32 * ui}px"
832
+ style:padding="{4 * ui}px {8 * ui}px"
833
+ style:font-size="{11 * ui}px"
834
+ style:transform="translateX(-50%)"
825
835
  >
826
836
  {Math.round(rotation)}°
827
837
  </div>
@@ -832,6 +842,9 @@
832
842
  <div
833
843
  data-resize-handle
834
844
  class={[edgeAccent, h.class]}
845
+ style:width={isCanva ? `${12 * ui}px` : undefined}
846
+ style:height={isCanva ? `${12 * ui}px` : undefined}
847
+ style:border-width={isCanva ? `${2 * ui}px` : undefined}
835
848
  role="separator"
836
849
  aria-orientation={h.edge === 'e' || h.edge === 'w' ? 'vertical' : 'horizontal'}
837
850
  aria-label={`Resize ${title ?? 'widget'} (${h.edge})`}
@@ -841,13 +854,19 @@
841
854
 
842
855
  {#if isCanva && onrotation}
843
856
  <div
844
- class="h-3 pointer-events-none absolute top-full left-1/2 z-20 w-px -translate-x-1/2 bg-[#3b82f6]"
857
+ class="pointer-events-none absolute top-full left-1/2 z-20 -translate-x-1/2 bg-[#3b82f6]"
858
+ style:width="{Math.max(1, ui)}px"
859
+ style:height="{12 * ui}px"
845
860
  ></div>
846
861
  <div
847
862
  class={[
848
863
  edgeAccent,
849
- 'mt-3 h-6 w-6 top-full left-1/2 z-20 flex -translate-x-1/2 cursor-grab items-center justify-center active:cursor-grabbing'
864
+ 'top-full left-1/2 z-20 flex -translate-x-1/2 cursor-grab items-center justify-center active:cursor-grabbing'
850
865
  ]}
866
+ style:width="{24 * ui}px"
867
+ style:height="{24 * ui}px"
868
+ style:margin-top="{12 * ui}px"
869
+ style:border-width="{2 * ui}px"
851
870
  role="slider"
852
871
  tabindex="0"
853
872
  aria-label="Rotar"
@@ -870,7 +889,7 @@
870
889
  }
871
890
  }}
872
891
  >
873
- <RotateCw class="h-3 w-3 text-[#3b82f6]" />
892
+ <RotateCw width={12 * ui} height={12 * ui} class="text-[#3b82f6]" />
874
893
  </div>
875
894
  {/if}
876
895
  {#if !isCanva}