@r2digisolutions/components 0.24.4 → 0.24.6

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.
@@ -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}
@@ -19,6 +19,7 @@
19
19
  } from '../../../utils/marqueeSelect.js';
20
20
  import {
21
21
  createCanvasGuide,
22
+ INSTAGRAM_GRID,
22
23
  pathPointsToDoc,
23
24
  rebakePathLayer,
24
25
  snapLayerRect,
@@ -235,6 +236,26 @@
235
236
  guides.map((g) => ({ orientation: g.orientation, position: g.position }))
236
237
  );
237
238
 
239
+ /** 3×3 Instagram tiles: the cut lines need to read above the alignment grid. */
240
+ const instagramCuts = $derived(
241
+ doc.width === INSTAGRAM_GRID.width && doc.height === INSTAGRAM_GRID.height
242
+ );
243
+ const instagramCells = $derived.by(() => {
244
+ if (!instagramCuts) return [];
245
+ const cells: { n: number; x: number; y: number }[] = [];
246
+ const total = INSTAGRAM_GRID.rows * INSTAGRAM_GRID.cols;
247
+ for (let row = 0; row < INSTAGRAM_GRID.rows; row++) {
248
+ for (let col = 0; col < INSTAGRAM_GRID.cols; col++) {
249
+ cells.push({
250
+ n: total - (row * INSTAGRAM_GRID.cols + col),
251
+ x: col * INSTAGRAM_GRID.cellWidth,
252
+ y: row * INSTAGRAM_GRID.cellHeight
253
+ });
254
+ }
255
+ }
256
+ return cells;
257
+ });
258
+
238
259
  type RulerTick = { pos: number; level: 'major' | 'mid' | 'minor' };
239
260
 
240
261
  /** Nice major step so labels sit ~56–80px apart on screen. */
@@ -333,8 +354,8 @@
333
354
  const cell = Math.max(4, cellSize);
334
355
  const major = cell * 5;
335
356
  const line = 1 / Math.max(0.05, scale);
336
- const fine = 'color-mix(in oklab, #0f172a 28%, transparent)';
337
- const bold = 'color-mix(in oklab, #0f172a 48%, transparent)';
357
+ const fine = 'color-mix(in oklab, #171717 28%, transparent)';
358
+ const bold = 'color-mix(in oklab, #171717 48%, transparent)';
338
359
  return [
339
360
  `background-image:`,
340
361
  `linear-gradient(to right, ${fine} ${line}px, transparent ${line}px),`,
@@ -990,7 +1011,6 @@
990
1011
 
991
1012
  /** Drag from ruler: live full-stage preview, commit guide on release. */
992
1013
  function beginRulerDrag(orientation: CanvasGuideOrientation, e: PointerEvent) {
993
- if (guidesLocked) return;
994
1014
  e.preventDefault();
995
1015
  e.stopPropagation();
996
1016
  setGuidePreview(orientation, e.clientX, e.clientY);
@@ -1001,7 +1021,7 @@
1001
1021
  const onUp = (ev: PointerEvent) => {
1002
1022
  const pt = clientToDoc(ev.clientX, ev.clientY);
1003
1023
  const pos = clampGuidePos(orientation, orientation === 'vertical' ? pt.x : pt.y);
1004
- patchGuides([...guides, createCanvasGuide(orientation, pos)]);
1024
+ patchGuides([...guides, createCanvasGuide(orientation, pos)], false);
1005
1025
  guidePreview = null;
1006
1026
  window.removeEventListener('pointermove', onMove);
1007
1027
  window.removeEventListener('pointerup', onUp);
@@ -1011,7 +1031,8 @@
1011
1031
  }
1012
1032
 
1013
1033
  function removeGuide(id: string) {
1014
- if (guidesLocked) return;
1034
+ const guide = guides.find((g) => g.id === id);
1035
+ if (!guide || guidesLocked || guide.locked) return;
1015
1036
  patchGuides(guides.filter((g) => g.id !== id));
1016
1037
  }
1017
1038
 
@@ -1277,13 +1298,7 @@
1277
1298
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1278
1299
  <div
1279
1300
  bind:this={viewportEl}
1280
- class="min-h-0 min-w-0 relative flex-1 overflow-auto"
1281
- style:background-color="#dfe3e8"
1282
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1283
- 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent 25%),linear-gradient(45deg,transparent
1284
- 75%,#cfd5dc 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1285
- style:background-size="16px 16px"
1286
- style:background-position="0 0,0 8px,8px -8px,-8px 0"
1301
+ class="min-h-0 min-w-0 relative flex-1 overflow-auto bg-neutral-200 dark:bg-neutral-950"
1287
1302
  role="presentation"
1288
1303
  onclick={clearSelectionIfEmptyClick}
1289
1304
  ondragover={handleElementDragOver}
@@ -1347,11 +1362,11 @@
1347
1362
  {#if artboardTransparent}
1348
1363
  <div
1349
1364
  class="inset-0 absolute"
1350
- style:background-color="#e8ebef"
1351
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1352
- 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent
1353
- 25%),linear-gradient(45deg,transparent 75%,#cfd5dc
1354
- 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1365
+ style:background-color="#f5f5f5"
1366
+ style:background-image="linear-gradient(45deg,#e5e5e5 25%,transparent
1367
+ 25%),linear-gradient(-45deg,#e5e5e5 25%,transparent
1368
+ 25%),linear-gradient(45deg,transparent 75%,#e5e5e5
1369
+ 75%),linear-gradient(-45deg,transparent 75%,#e5e5e5 75%)"
1355
1370
  style:background-size="16px 16px"
1356
1371
  style:background-position="0 0,0 8px,8px -8px,-8px 0"
1357
1372
  ></div>
@@ -1537,7 +1552,7 @@
1537
1552
  >
1538
1553
  <div
1539
1554
  data-scroll-thumb="y"
1540
- 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"
1555
+ class="left-0.5 right-0.5 bg-neutral-400/80 absolute cursor-grab rounded-full active:cursor-grabbing"
1541
1556
  style:top="{vScroll.offset}px"
1542
1557
  style:height="{vScroll.thumb}px"
1543
1558
  onpointerdown={(e) =>
@@ -1555,7 +1570,7 @@
1555
1570
  >
1556
1571
  <div
1557
1572
  data-scroll-thumb="x"
1558
- 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"
1573
+ class="top-0.5 bottom-0.5 bg-neutral-400/80 absolute cursor-grab rounded-full active:cursor-grabbing"
1559
1574
  style:left="{hScroll.offset}px"
1560
1575
  style:width="{hScroll.thumb}px"
1561
1576
  onpointerdown={(e) =>
@@ -1593,8 +1608,6 @@
1593
1608
 
1594
1609
  <!-- Guides stay on the artboard. Rulers stay on the workspace edges. -->
1595
1610
  {#if showGuides}
1596
- {@const originX = RULER_LEFT + tickX(0)}
1597
- {@const originY = RULER_TOP + tickY(0)}
1598
1611
  {#each guides as guide (guide.id)}
1599
1612
  {@const locked = guidesLocked || !!guide.locked}
1600
1613
  {@const hiding = draggingGuideId === guide.id && guidePreview}
@@ -1612,29 +1625,78 @@
1612
1625
  style:z-index="2100000"
1613
1626
  style:left={guide.orientation === 'vertical'
1614
1627
  ? `${RULER_LEFT + tickX(guide.position)}px`
1615
- : `${originX}px`}
1628
+ : '0px'}
1616
1629
  style:top={guide.orientation === 'horizontal'
1617
1630
  ? `${RULER_TOP + tickY(guide.position)}px`
1618
- : `${originY}px`}
1619
- style:width={guide.orientation === 'horizontal' ? `${boardW}px` : undefined}
1620
- style:height={guide.orientation === 'vertical' ? `${boardH}px` : undefined}
1631
+ : '0px'}
1632
+ style:width={guide.orientation === 'horizontal'
1633
+ ? `${RULER_LEFT + tickX(0) + boardW}px`
1634
+ : undefined}
1635
+ style:height={guide.orientation === 'vertical'
1636
+ ? `${RULER_TOP + tickY(0) + boardH}px`
1637
+ : undefined}
1621
1638
  title={locked ? 'Guide locked' : 'Drag to move · Double-click to remove'}
1622
1639
  onpointerdown={(e) => beginGuideDrag(guide, e)}
1623
1640
  ondblclick={() => removeGuide(guide.id)}
1624
1641
  >
1642
+ <span
1643
+ class="pointer-events-none absolute left-1/2 w-px -translate-x-1/2 bg-white"
1644
+ style:top="0px"
1645
+ style:height="{Math.max(0, RULER_TOP + tickY(0))}px"
1646
+ style:display={guide.orientation === 'vertical' ? undefined : 'none'}
1647
+ aria-hidden="true"
1648
+ ></span>
1649
+ <span
1650
+ class="pointer-events-none absolute top-1/2 h-px w-full -translate-y-1/2 bg-white"
1651
+ style:left="0px"
1652
+ style:width={guide.orientation === 'horizontal'
1653
+ ? `${Math.max(0, RULER_LEFT + tickX(0))}px`
1654
+ : undefined}
1655
+ style:display={guide.orientation === 'horizontal' ? undefined : 'none'}
1656
+ aria-hidden="true"
1657
+ ></span>
1625
1658
  <span
1626
1659
  class={[
1627
- 'pointer-events-none absolute bg-[#00c2ff]',
1660
+ 'pointer-events-none absolute bg-neutral-950',
1628
1661
  guide.orientation === 'vertical'
1629
- ? 'top-0 left-1/2 h-full w-px -translate-x-1/2'
1630
- : 'left-0 top-1/2 h-px w-full -translate-y-1/2',
1631
- locked && 'opacity-60'
1662
+ ? 'left-1/2 w-px -translate-x-1/2'
1663
+ : 'h-px -translate-y-1/2'
1632
1664
  ]}
1633
- style:box-shadow="0 0 0 1px rgba(0,194,255,0.35)"
1665
+ style:top={guide.orientation === 'vertical'
1666
+ ? `${Math.max(0, RULER_TOP + tickY(0))}px`
1667
+ : '50%'}
1668
+ style:left={guide.orientation === 'horizontal'
1669
+ ? `${Math.max(0, RULER_LEFT + tickX(0))}px`
1670
+ : undefined}
1671
+ style:height={guide.orientation === 'vertical' ? `${boardH}px` : undefined}
1672
+ style:width={guide.orientation === 'horizontal' ? `${boardW}px` : undefined}
1634
1673
  aria-hidden="true"
1635
1674
  ></span>
1675
+ <span
1676
+ class="pointer-events-none absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
1677
+ style:left={guide.orientation === 'vertical'
1678
+ ? '10px'
1679
+ : `${Math.max(0, RULER_LEFT + tickX(0)) + 6}px`}
1680
+ style:top={guide.orientation === 'vertical'
1681
+ ? `${Math.max(0, RULER_TOP + tickY(0)) + 6}px`
1682
+ : '10px'}
1683
+ >
1684
+ {Math.round(guide.position)}
1685
+ </span>
1636
1686
  </div>
1637
1687
  {/each}
1688
+ {#if instagramCuts}
1689
+ {#each instagramCells as cell (cell.n)}
1690
+ <span
1691
+ class="pointer-events-none absolute z-[2100001] text-[11px] font-medium leading-none text-white"
1692
+ style:left="{RULER_LEFT + tickX(cell.x) + 6}px"
1693
+ style:top="{RULER_TOP + tickY(cell.y) + 6}px"
1694
+ style:text-shadow="0 0 2px #000, 0 1px 2px #000"
1695
+ >
1696
+ {cell.n}
1697
+ </span>
1698
+ {/each}
1699
+ {/if}
1638
1700
  {/if}
1639
1701
 
1640
1702
  <!-- Pen draft preview -->
@@ -1672,7 +1734,7 @@
1672
1734
  {/if}
1673
1735
  </svg>
1674
1736
  <div
1675
- 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]"
1737
+ 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]"
1676
1738
  >
1677
1739
  Click to add · near start to close · double-click / Enter to finish · Esc cancel
1678
1740
  </div>
@@ -1714,26 +1776,48 @@
1714
1776
  {/if}
1715
1777
 
1716
1778
  {#if guidePreview}
1717
- <div
1718
- class="pointer-events-none absolute z-50 overflow-hidden"
1719
- style:left={`${RULER_LEFT + tickX(0)}px`}
1720
- style:top={`${RULER_TOP + tickY(0)}px`}
1721
- style:width={`${boardW}px`}
1722
- style:height={`${boardH}px`}
1723
- aria-hidden="true"
1724
- >
1779
+ {@const previewPos = Math.round(
1780
+ (guidePreview.orientation === 'vertical' ? guidePreview.x : guidePreview.y) / scale
1781
+ )}
1782
+ <div class="pointer-events-none absolute inset-0 z-50 overflow-hidden" aria-hidden="true">
1725
1783
  {#if guidePreview.orientation === 'vertical'}
1726
1784
  <div
1727
- class="top-0 bottom-0 absolute w-px bg-[#00c2ff]"
1728
- style:left={`${guidePreview.x}px`}
1729
- style:box-shadow="0 0 0 1px rgba(0,194,255,0.35)"
1785
+ class="absolute top-0 w-px bg-white"
1786
+ style:left={`${RULER_LEFT + tickX(0) + guidePreview.x}px`}
1787
+ style:height={`${Math.max(0, RULER_TOP + tickY(0))}px`}
1788
+ ></div>
1789
+ <div
1790
+ class="absolute w-px bg-neutral-950"
1791
+ style:left={`${RULER_LEFT + tickX(0) + guidePreview.x}px`}
1792
+ style:top={`${Math.max(0, RULER_TOP + tickY(0))}px`}
1793
+ style:height={`${boardH}px`}
1730
1794
  ></div>
1795
+ <span
1796
+ class="absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
1797
+ style:left={`${RULER_LEFT + tickX(0) + guidePreview.x + 10}px`}
1798
+ style:top={`${Math.max(0, RULER_TOP + tickY(0)) + 6}px`}
1799
+ >
1800
+ {previewPos}
1801
+ </span>
1731
1802
  {:else}
1732
1803
  <div
1733
- class="left-0 right-0 absolute h-px bg-[#00c2ff]"
1734
- style:top={`${guidePreview.y}px`}
1735
- style:box-shadow="0 0 0 1px rgba(0,194,255,0.35)"
1804
+ class="absolute left-0 h-px bg-white"
1805
+ style:top={`${RULER_TOP + tickY(0) + guidePreview.y}px`}
1806
+ style:width={`${Math.max(0, RULER_LEFT + tickX(0))}px`}
1807
+ ></div>
1808
+ <div
1809
+ class="absolute h-px bg-neutral-950"
1810
+ style:top={`${RULER_TOP + tickY(0) + guidePreview.y}px`}
1811
+ style:left={`${Math.max(0, RULER_LEFT + tickX(0))}px`}
1812
+ style:width={`${boardW}px`}
1736
1813
  ></div>
1814
+ <span
1815
+ class="absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
1816
+ style:left={`${Math.max(0, RULER_LEFT + tickX(0)) + 6}px`}
1817
+ style:top={`${RULER_TOP + tickY(0) + guidePreview.y + 10}px`}
1818
+ >
1819
+ {previewPos}
1820
+ </span>
1737
1821
  {/if}
1738
1822
  </div>
1739
1823
  {/if}
@@ -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={[