@r2digisolutions/components 0.19.20 → 0.19.22

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 (32) hide show
  1. package/dist/components/atoms/Textarea/Textarea.svelte +4 -0
  2. package/dist/components/atoms/Textarea/Textarea.svelte.d.ts +1 -0
  3. package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +165 -71
  4. package/dist/components/molecules/Cascader/Cascader.svelte +2 -0
  5. package/dist/components/molecules/ColorPicker/ColorPicker.svelte +4 -13
  6. package/dist/components/molecules/DatePicker/DatePicker.svelte +2 -0
  7. package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte +2 -0
  8. package/dist/components/molecules/DropdownMenu/DropdownMenu.svelte +12 -21
  9. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +11 -3
  10. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte.d.ts +5 -1
  11. package/dist/components/molecules/MediaLayerList/MediaLayerList.svelte +31 -4
  12. package/dist/components/molecules/MediaStage/MediaStage.svelte +193 -164
  13. package/dist/components/molecules/MediaStage/MediaStage.svelte.d.ts +1 -45
  14. package/dist/components/molecules/MultiSelect/MultiSelect.svelte +2 -0
  15. package/dist/components/molecules/Popover/Popover.svelte +6 -0
  16. package/dist/components/molecules/Select/Select.svelte +36 -14
  17. package/dist/components/molecules/TimePicker/TimePicker.svelte +2 -0
  18. package/dist/components/molecules/TreeSelect/TreeSelect.svelte +2 -0
  19. package/dist/components/molecules/UserMenu/UserMenu.svelte +2 -0
  20. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +155 -147
  21. package/dist/components/organisms/Dialog/Dialog.svelte +19 -3
  22. package/dist/components/organisms/Menubar/Menubar.svelte +121 -43
  23. package/dist/components/organisms/Menubar/Menubar.svelte.d.ts +1 -1
  24. package/dist/components/organisms/NotificationCenter/NotificationCenter.svelte +2 -0
  25. package/dist/components/organisms/PricingTable/PricingTable.svelte +3 -3
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.js +2 -1
  28. package/dist/utils/canvasHierarchy.d.ts +33 -0
  29. package/dist/utils/canvasHierarchy.js +108 -13
  30. package/dist/utils/popoverInvoker.d.ts +11 -0
  31. package/dist/utils/popoverInvoker.js +39 -0
  32. package/package.json +1 -1
@@ -31,12 +31,16 @@
31
31
  applyScrollBoxOffsets,
32
32
  computeAbsoluteRects,
33
33
  contentPadding,
34
- LAYOUT_BOX_KINDS,
34
+ enclosingGroupId,
35
+ isEffectivelyLocked,
35
36
  isEffectivelyVisible,
37
+ isLayoutPositionLocked,
38
+ isLayoutSizeLocked,
36
39
  isMarqueePassThroughKind,
37
40
  paintTransformForLayer,
38
41
  scrollBoxOverflow,
39
42
  scrollBarMetrics,
43
+ selectionAncestorIds,
40
44
  slotFromLocalRect,
41
45
  clipPathForLayer
42
46
  } from '../../../utils/canvasHierarchy.js';
@@ -126,18 +130,14 @@
126
130
  const PAD = 48;
127
131
  const workingLayers = $derived(draftLayers ?? doc.layers);
128
132
  const displayLayers = $derived(
129
- expandWidgets
130
- ? flattenLayersWithWidgets(workingLayers, doc.widgets ?? [])
131
- : workingLayers
133
+ expandWidgets ? flattenLayersWithWidgets(workingLayers, doc.widgets ?? []) : workingLayers
132
134
  );
133
135
  const absMap = $derived(
134
136
  computeAbsoluteRects(displayLayers, { width: doc.width, height: doc.height })
135
137
  );
136
138
  /** Ephemeral scroll offsets for scrollBox preview (not persisted). */
137
139
  let scrollOffsets = $state<Map<string, { x: number; y: number }>>(new Map());
138
- const paintAbsMap = $derived(
139
- applyScrollBoxOffsets(displayLayers, absMap, scrollOffsets)
140
- );
140
+ const paintAbsMap = $derived(applyScrollBoxOffsets(displayLayers, absMap, scrollOffsets));
141
141
  const sorted = $derived.by(() => {
142
142
  const out: typeof displayLayers = [];
143
143
  const walk = (parentId: string | null) => {
@@ -162,6 +162,8 @@
162
162
  });
163
163
  const selectedSet = $derived(new Set(selectedIds));
164
164
  const sceneLayerIds = $derived(new Set(workingLayers.map((l) => l.id)));
165
+ const ancestorOutlineIds = $derived(selectionAncestorIds(workingLayers, selectedIds));
166
+ const workingById = $derived(new Map(workingLayers.map((l) => [l.id, l])));
165
167
 
166
168
  function resolveSelectableId(id: string): string {
167
169
  if (sceneLayerIds.has(id)) return id;
@@ -315,12 +317,8 @@
315
317
  : { left: 0, top: 0, right: 0, bottom: 0 };
316
318
  const originX = (parentAbs?.x ?? 0) + pad.left;
317
319
  const originY = (parentAbs?.y ?? 0) + pad.top;
318
- const contentW = parentAbs
319
- ? Math.max(0, parentAbs.w - pad.left - pad.right)
320
- : doc.width;
321
- const contentH = parentAbs
322
- ? Math.max(0, parentAbs.h - pad.top - pad.bottom)
323
- : doc.height;
320
+ const contentW = parentAbs ? Math.max(0, parentAbs.w - pad.left - pad.right) : doc.width;
321
+ const contentH = parentAbs ? Math.max(0, parentAbs.h - pad.top - pad.bottom) : doc.height;
324
322
  const local = {
325
323
  x: absRect.x - originX,
326
324
  y: absRect.y - originY,
@@ -360,22 +358,31 @@
360
358
  }
361
359
 
362
360
  function isLayoutLocked(layer: CanvasLayer): boolean {
363
- const parentId = layer.parentId ?? null;
364
- if (!parentId) return false;
365
- const parent = workingLayers.find((l) => l.id === parentId);
366
- return !!parent && LAYOUT_BOX_KINDS.has(parent.kind);
361
+ return isLayoutPositionLocked(workingLayers, layer.id, workingById);
362
+ }
363
+
364
+ function isSizeLocked(layer: CanvasLayer): boolean {
365
+ return isLayoutSizeLocked(workingLayers, layer.id, workingById);
366
+ }
367
+
368
+ function layerLocked(layer: CanvasLayer): boolean {
369
+ const realId = resolveSelectableId(layer.id);
370
+ return isEffectivelyLocked(workingLayers, realId, workingById);
367
371
  }
368
372
 
369
373
  function handleRect(layer: CanvasLayer, rect: WidgetRect) {
370
374
  if (!sceneLayerIds.has(layer.id)) return;
371
- if (isLayoutLocked(layer)) return;
375
+ if (layerLocked(layer)) return;
376
+ const positionLocked = isLayoutLocked(layer);
377
+ const sizeLocked = isSizeLocked(layer);
378
+ if (positionLocked && sizeLocked) return;
372
379
  const layers = draftLayers ?? doc.layers;
373
380
  const source = layers.find((l) => l.id === layer.id);
374
381
  if (!source) return;
375
382
 
376
383
  const minW = source.kind === 'line' || source.kind === 'arrow' ? 24 : 40;
377
384
  const minH = source.kind === 'line' ? 2 : 24;
378
- const nextAbs = snapLayerRect(
385
+ let nextAbs = snapLayerRect(
379
386
  { x: rect.x, y: rect.y, w: rect.w, h: rect.h },
380
387
  cellSize,
381
388
  snap,
@@ -386,19 +393,29 @@
386
393
  );
387
394
 
388
395
  const prevAbs = absMap.get(source.id) ?? source.rect;
396
+ if (positionLocked) {
397
+ nextAbs = { ...nextAbs, x: prevAbs.x, y: prevAbs.y };
398
+ }
399
+ if (sizeLocked) {
400
+ nextAbs = { ...nextAbs, w: prevAbs.w, h: prevAbs.h };
401
+ }
389
402
  const dx = nextAbs.x - prevAbs.x;
390
403
  const dy = nextAbs.y - prevAbs.y;
391
- const moving =
392
- Math.abs(nextAbs.w - prevAbs.w) < 0.5 && Math.abs(nextAbs.h - prevAbs.h) < 0.5;
404
+ const moving = Math.abs(nextAbs.w - prevAbs.w) < 0.5 && Math.abs(nextAbs.h - prevAbs.h) < 0.5;
405
+ if (moving && Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01) return;
393
406
  const groupMove =
394
407
  moving &&
408
+ !positionLocked &&
395
409
  selectedIds.length > 1 &&
396
410
  selectedSet.has(source.id) &&
397
411
  (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01);
398
412
 
399
413
  if (groupMove) {
400
414
  draftLayers = layers.map((l) => {
401
- if (!selectedSet.has(l.id) || l.locked) return l;
415
+ if (!selectedSet.has(l.id) || isEffectivelyLocked(workingLayers, l.id, workingById)) {
416
+ return l;
417
+ }
418
+ if (isLayoutPositionLocked(workingLayers, l.id, workingById)) return l;
402
419
  const a = absMap.get(l.id) ?? l.rect;
403
420
  const moved = {
404
421
  x: a.x + dx,
@@ -411,21 +428,30 @@
411
428
  return;
412
429
  }
413
430
 
414
- const updated = applyTextAutoSize(
415
- source,
416
- absToLocalUpdate(source, nextAbs),
417
- prevAbs,
418
- nextAbs
419
- );
431
+ const updated = applyTextAutoSize(source, absToLocalUpdate(source, nextAbs), prevAbs, nextAbs);
420
432
  draftLayers = layers.map((l) => (l.id === updated.id ? updated : l));
421
433
  // If somehow interact end already fired without draft, commit immediately.
422
434
  if (interactCount === 0) commitDraft();
423
435
  }
424
436
 
437
+ function groupedChildPassthrough(layer: CanvasLayer): boolean {
438
+ if (selectedSet.has(layer.id)) return false;
439
+ return !!enclosingGroupId(workingLayers, layer.id);
440
+ }
441
+
425
442
  function selectLayer(id: string, e: MouseEvent) {
426
443
  e.stopPropagation();
427
- const realId = resolveSelectableId(id);
428
- if (e.shiftKey || e.metaKey || e.ctrlKey) {
444
+ let realId = resolveSelectableId(id);
445
+ if (e.metaKey || e.ctrlKey) {
446
+ const hit = pickLayerAtDoc(clientToDoc(e.clientX, e.clientY));
447
+ if (hit) realId = resolveSelectableId(hit);
448
+ const set = new Set(selectedIds);
449
+ if (set.has(realId)) set.delete(realId);
450
+ else set.add(realId);
451
+ onselect?.([...set]);
452
+ return;
453
+ }
454
+ if (e.shiftKey) {
429
455
  const set = new Set(selectedIds);
430
456
  if (set.has(realId)) set.delete(realId);
431
457
  else set.add(realId);
@@ -490,7 +516,9 @@
490
516
  const s = scale;
491
517
  return sorted
492
518
  .filter((l) => {
493
- if (!effectivelyVisible.has(l.id) || l.locked) return false;
519
+ if (!effectivelyVisible.has(l.id) || isEffectivelyLocked(workingLayers, l.id, workingById)) {
520
+ return false;
521
+ }
494
522
  const realId = resolveSelectableId(l.id);
495
523
  if (!sceneLayerIds.has(realId)) return false;
496
524
  // Don't always rubber-band-select the full-bleed root panel.
@@ -523,7 +551,9 @@
523
551
  function pickLayerAtDoc(pt: { x: number; y: number }): string | null {
524
552
  for (let i = sorted.length - 1; i >= 0; i--) {
525
553
  const l = sorted[i];
526
- if (!effectivelyVisible.has(l.id) || l.locked) continue;
554
+ if (!effectivelyVisible.has(l.id) || isEffectivelyLocked(workingLayers, l.id, workingById)) {
555
+ continue;
556
+ }
527
557
  const selectable = resolveSelectableId(l.id);
528
558
  if (!sceneLayerIds.has(l.id) && !sceneLayerIds.has(selectable)) continue;
529
559
  const r = paintAbsMap.get(l.id) ?? l.rect;
@@ -556,17 +586,17 @@
556
586
  const pt = clientToDoc(e.clientX, e.clientY);
557
587
  const boxId = findScrollBoxAtDoc(pt);
558
588
  if (!boxId) return;
559
- setScrollOffset(boxId, {
560
- x: (scrollOffsets.get(boxId)?.x ?? 0) + e.deltaX,
561
- y: (scrollOffsets.get(boxId)?.y ?? 0) + e.deltaY
562
- }, e);
589
+ setScrollOffset(
590
+ boxId,
591
+ {
592
+ x: (scrollOffsets.get(boxId)?.x ?? 0) + e.deltaX,
593
+ y: (scrollOffsets.get(boxId)?.y ?? 0) + e.deltaY
594
+ },
595
+ e
596
+ );
563
597
  }
564
598
 
565
- function setScrollOffset(
566
- boxId: string,
567
- raw: { x: number; y: number },
568
- e?: WheelEvent
569
- ) {
599
+ function setScrollOffset(boxId: string, raw: { x: number; y: number }, e?: WheelEvent) {
570
600
  const { maxX, maxY } = scrollBoxOverflow(boxId, displayLayers, absMap);
571
601
  if (maxX <= 0 && maxY <= 0) return;
572
602
  const cur = scrollOffsets.get(boxId) ?? { x: 0, y: 0 };
@@ -729,7 +759,7 @@
729
759
  }
730
760
 
731
761
  function beginPathPointDrag(index: number, e: PointerEvent) {
732
- if (!selectedPath || selectedPath.locked) return;
762
+ if (!selectedPath || isEffectivelyLocked(workingLayers, selectedPath.id, workingById)) return;
733
763
  e.preventDefault();
734
764
  e.stopPropagation();
735
765
  activePathPoint = index;
@@ -758,7 +788,7 @@
758
788
  }
759
789
 
760
790
  function insertPathPoint(afterIndex: number, e: MouseEvent) {
761
- if (!selectedPath || selectedPath.locked) return;
791
+ if (!selectedPath || isEffectivelyLocked(workingLayers, selectedPath.id, workingById)) return;
762
792
  e.preventDefault();
763
793
  e.stopPropagation();
764
794
  const docs = pathAbsPoints(selectedPath);
@@ -768,7 +798,7 @@
768
798
  }
769
799
 
770
800
  function removeActivePathPoint() {
771
- if (!selectedPath || selectedPath.locked || activePathPoint == null) return;
801
+ if (!selectedPath || isEffectivelyLocked(workingLayers, selectedPath.id, workingById) || activePathPoint == null) return;
772
802
  const docs = pathAbsPoints(selectedPath);
773
803
  if (docs.length <= 2) return;
774
804
  docs.splice(activePathPoint, 1);
@@ -816,10 +846,7 @@
816
846
  const onMove = (ev: PointerEvent) => {
817
847
  setGuidePreview(guide.orientation, ev.clientX, ev.clientY);
818
848
  const pt = clientToDoc(ev.clientX, ev.clientY);
819
- const pos = clampGuidePos(
820
- guide.orientation,
821
- guide.orientation === 'vertical' ? pt.x : pt.y
822
- );
849
+ const pos = clampGuidePos(guide.orientation, guide.orientation === 'vertical' ? pt.x : pt.y);
823
850
  patchGuides(guides.map((g) => (g.id === guide.id ? { ...g, position: pos } : g)));
824
851
  };
825
852
  const onUp = (ev: PointerEvent) => {
@@ -1018,20 +1045,20 @@
1018
1045
  }}
1019
1046
  />
1020
1047
 
1021
- <div bind:this={stageEl} class={['relative flex h-full min-h-0 w-full flex-col', className]}>
1048
+ <div bind:this={stageEl} class={['min-h-0 relative flex h-full w-full flex-col', className]}>
1022
1049
  <!-- Top ruler — slim, crisp ticks -->
1023
1050
  <div
1024
- class="relative z-30 flex shrink-0 border-b border-black/10 bg-[#eceff3] dark:border-white/10 dark:bg-[#1e2329]"
1051
+ class="border-black/10 dark:border-white/10 relative z-30 flex shrink-0 border-b bg-[#eceff3] dark:bg-[#1e2329]"
1025
1052
  >
1026
1053
  <div
1027
- class="shrink-0 border-r border-black/10 bg-[#e2e6eb] dark:border-white/10 dark:bg-[#181c21]"
1054
+ class="border-black/10 dark:border-white/10 shrink-0 border-r bg-[#e2e6eb] dark:bg-[#181c21]"
1028
1055
  style:width={`${RULER_LEFT}px`}
1029
1056
  style:height={`${RULER_TOP}px`}
1030
1057
  ></div>
1031
1058
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1032
1059
  <div
1033
1060
  data-ruler="x"
1034
- class="relative min-w-0 flex-1 cursor-ns-resize overflow-hidden"
1061
+ class="min-w-0 relative flex-1 cursor-ns-resize overflow-hidden"
1035
1062
  style:height={`${RULER_TOP}px`}
1036
1063
  title="Drag down to add a horizontal guide"
1037
1064
  onpointerdown={(e) => {
@@ -1039,7 +1066,7 @@
1039
1066
  beginRulerDrag('horizontal', e);
1040
1067
  }}
1041
1068
  >
1042
- <svg class="absolute inset-0 h-full w-full" aria-hidden="true">
1069
+ <svg class="inset-0 absolute h-full w-full" aria-hidden="true">
1043
1070
  {#each rulerTicksX as tick (tick.pos)}
1044
1071
  {@const left = tickX(tick.pos)}
1045
1072
  {#if left >= -8 && left <= (vw || 0) + 8}
@@ -1073,12 +1100,12 @@
1073
1100
  </div>
1074
1101
  </div>
1075
1102
 
1076
- <div class="flex min-h-0 min-w-0 flex-1">
1103
+ <div class="min-h-0 min-w-0 flex flex-1">
1077
1104
  <!-- Left ruler — upright labels (not rotated) so digits stay readable -->
1078
1105
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1079
1106
  <div
1080
1107
  data-ruler="y"
1081
- class="relative z-30 shrink-0 cursor-ew-resize overflow-hidden border-r border-black/10 bg-[#eceff3] dark:border-white/10 dark:bg-[#1e2329]"
1108
+ class="border-black/10 dark:border-white/10 relative z-30 shrink-0 cursor-ew-resize overflow-hidden border-r bg-[#eceff3] dark:bg-[#1e2329]"
1082
1109
  style:width={`${RULER_LEFT}px`}
1083
1110
  title="Drag right to add a vertical guide"
1084
1111
  onpointerdown={(e) => {
@@ -1086,7 +1113,7 @@
1086
1113
  beginRulerDrag('vertical', e);
1087
1114
  }}
1088
1115
  >
1089
- <svg class="pointer-events-none absolute inset-0 h-full w-full" aria-hidden="true">
1116
+ <svg class="inset-0 pointer-events-none absolute h-full w-full" aria-hidden="true">
1090
1117
  {#each rulerTicksY as tick (tick.pos)}
1091
1118
  {@const top = tickY(tick.pos)}
1092
1119
  {#if top >= -8 && top <= (vh || 0) + 8}
@@ -1111,7 +1138,7 @@
1111
1138
  {@const top = tickY(tick.pos)}
1112
1139
  {#if top >= 4 && top <= (vh || 0) - 2}
1113
1140
  <span
1114
- class="pointer-events-none absolute left-0.5 w-[20px] text-right font-mono text-[9px] leading-none tabular-nums text-slate-700 dark:text-slate-200"
1141
+ class="left-0.5 font-mono text-slate-700 dark:text-slate-200 pointer-events-none absolute w-[20px] text-right text-[9px] leading-none tabular-nums"
1115
1142
  style:top={`${top}px`}
1116
1143
  style:transform="translateY(-50%)"
1117
1144
  >
@@ -1126,9 +1153,11 @@
1126
1153
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1127
1154
  <div
1128
1155
  bind:this={viewportEl}
1129
- class="relative min-h-0 min-w-0 flex-1 overflow-auto"
1156
+ class="min-h-0 min-w-0 relative flex-1 overflow-auto"
1130
1157
  style:background-color="#dfe3e8"
1131
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#cfd5dc 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1158
+ style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1159
+ 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent 25%),linear-gradient(45deg,transparent
1160
+ 75%,#cfd5dc 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1132
1161
  style:background-size="16px 16px"
1133
1162
  style:background-position="0 0,0 8px,8px -8px,-8px 0"
1134
1163
  role="presentation"
@@ -1166,104 +1195,127 @@
1166
1195
  }}
1167
1196
  onmousemove={handleDrawMove}
1168
1197
  class={[
1169
- 'relative shrink-0 overflow-visible shadow-[0_8px_40px_rgba(15,23,42,0.18)] ring-1 ring-black/10',
1198
+ 'ring-black/10 relative shrink-0 overflow-visible shadow-[0_8px_40px_rgba(15,23,42,0.18)] ring-1',
1170
1199
  drawMode && 'cursor-crosshair'
1171
1200
  ]}
1172
1201
  style:width={`${boardW}px`}
1173
1202
  style:height={`${boardH}px`}
1174
1203
  >
1175
1204
  <div
1176
- class="absolute left-0 top-0 origin-top-left overflow-visible"
1205
+ class="left-0 top-0 absolute origin-top-left overflow-visible"
1177
1206
  style:width={`${doc.width}px`}
1178
1207
  style:height={`${doc.height}px`}
1179
1208
  style:transform={`scale(${scale})`}
1180
1209
  >
1181
1210
  <!-- Artboard surface (clipped). Layers sit above and may overhang like a compositor. -->
1182
- <div class="pointer-events-none absolute inset-0 overflow-hidden" aria-hidden="true">
1211
+ <div class="inset-0 pointer-events-none absolute overflow-hidden" aria-hidden="true">
1183
1212
  {#if artboardTransparent}
1184
1213
  <div
1185
- class="absolute inset-0"
1214
+ class="inset-0 absolute"
1186
1215
  style:background-color="#e8ebef"
1187
- style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#cfd5dc 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1216
+ style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
1217
+ 25%),linear-gradient(-45deg,#cfd5dc 25%,transparent
1218
+ 25%),linear-gradient(45deg,transparent 75%,#cfd5dc
1219
+ 75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
1188
1220
  style:background-size="16px 16px"
1189
1221
  style:background-position="0 0,0 8px,8px -8px,-8px 0"
1190
1222
  ></div>
1191
1223
  {/if}
1192
- <div class="absolute inset-0" style:background-color={doc.background}></div>
1224
+ <div class="inset-0 absolute" style:background-color={doc.background}></div>
1193
1225
  </div>
1194
1226
 
1195
1227
  {#if showGrid}
1196
1228
  <div
1197
- class="pointer-events-none absolute inset-0 z-100 overflow-hidden"
1229
+ class="inset-0 pointer-events-none absolute z-100 overflow-hidden"
1198
1230
  style={gridOverlayStyle}
1199
1231
  aria-hidden="true"
1200
1232
  ></div>
1201
1233
  {/if}
1202
1234
 
1203
- <div class={['absolute inset-0 overflow-visible', drawMode && 'pointer-events-none']}>
1235
+ <div class={['inset-0 absolute overflow-visible', drawMode && 'pointer-events-none']}>
1204
1236
  {#each sorted as layer, paintIndex (layer.id)}
1205
1237
  {#if effectivelyVisible.has(layer.id)}
1206
- {@const realId = resolveSelectableId(layer.id)}
1207
- {@const isSynthetic = !sceneLayerIds.has(layer.id)}
1208
- {@const lockedPass = !!layer.locked || isSynthetic}
1209
- {@const displayRect = paintAbsMap.get(layer.id) ?? layer.rect}
1210
- {@const clipPath = clipPathForLayer(layer.id, displayLayers, paintAbsMap)}
1211
- {@const sceneLayer = workingLayers.find((l) => l.id === realId)}
1212
- {@const marqueeBg =
1213
- !!sceneLayer && isMarqueePassThroughKind(sceneLayer.kind)}
1214
- {@const isSelected = selectedSet.has(realId) && !isSynthetic}
1215
- {@const dragOk =
1216
- !layer.locked &&
1217
- !isSynthetic &&
1218
- !isLayoutLocked(layer) &&
1219
- (!marqueeBg ||
1220
- (isSelected && sceneLayer?.kind !== 'canvasPanel'))}
1221
- <!-- svelte-ignore a11y_no_static_element_interactions -->
1222
- <div
1223
- data-layer-item
1224
- data-marquee-id={realId}
1225
- class="contents"
1226
- oncontextmenu={(e) => {
1227
- if (lockedPass && isSynthetic) {
1238
+ {@const realId = resolveSelectableId(layer.id)}
1239
+ {@const isSynthetic = !sceneLayerIds.has(layer.id)}
1240
+ {@const lockedPass = layerLocked(layer) || isSynthetic}
1241
+ {@const displayRect = paintAbsMap.get(layer.id) ?? layer.rect}
1242
+ {@const clipPath = clipPathForLayer(layer.id, displayLayers, paintAbsMap)}
1243
+ {@const sceneLayer = workingLayers.find((l) => l.id === realId)}
1244
+ {@const marqueeBg = !!sceneLayer && isMarqueePassThroughKind(sceneLayer.kind)}
1245
+ {@const isSelected = selectedSet.has(realId) && !isSynthetic}
1246
+ {@const positionLocked = isLayoutLocked(layer)}
1247
+ {@const sizeLocked = isSizeLocked(layer)}
1248
+ {@const dragOk =
1249
+ !lockedPass &&
1250
+ (!marqueeBg || (isSelected && sceneLayer?.kind !== 'canvasPanel'))}
1251
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
1252
+ <div
1253
+ data-layer-item
1254
+ data-marquee-id={realId}
1255
+ class="contents"
1256
+ oncontextmenu={(e) => {
1257
+ if (lockedPass && isSynthetic) {
1258
+ e.preventDefault();
1259
+ e.stopPropagation();
1260
+ onselect?.([realId]);
1261
+ oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
1262
+ return;
1263
+ }
1264
+ if (lockedPass) return;
1228
1265
  e.preventDefault();
1229
1266
  e.stopPropagation();
1230
- onselect?.([realId]);
1267
+ if (!selectedSet.has(realId)) onselect?.([realId]);
1231
1268
  oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
1232
- return;
1233
- }
1234
- if (layer.locked) return;
1235
- e.preventDefault();
1236
- e.stopPropagation();
1237
- if (!selectedSet.has(realId)) onselect?.([realId]);
1238
- oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
1239
- }}
1240
- >
1241
- <MediaLayerItem
1242
- {layer}
1243
- {displayRect}
1244
- {clipPath}
1245
- stackIndex={paintIndex}
1246
- paintTransform={paintTransformForLayer(
1269
+ }}
1270
+ >
1271
+ <MediaLayerItem
1272
+ {layer}
1273
+ {displayRect}
1274
+ {clipPath}
1275
+ stackIndex={paintIndex}
1276
+ paintTransform={paintTransformForLayer(
1277
+ displayLayers,
1278
+ layer.id,
1279
+ paintAbsMap,
1280
+ layerById
1281
+ )}
1282
+ selected={isSelected}
1283
+ passthrough={lockedPass || groupedChildPassthrough(layer)}
1284
+ readOnly={isSynthetic}
1285
+ layoutPositionLocked={positionLocked || (marqueeBg && !dragOk)}
1286
+ layoutSizeLocked={sizeLocked}
1287
+ onclick={(e) => selectLayer(layer.id, e)}
1288
+ ondblclick={(e) => {
1289
+ if (lockedPass) return;
1290
+ const pt = clientToDoc(e.clientX, e.clientY);
1291
+ const hit = pickLayerAtDoc(pt) ?? realId;
1292
+ onenterlayer?.(hit);
1293
+ }}
1294
+ onchange={(rect) => handleRect(layer, rect)}
1295
+ oninteract={handleLayerInteract}
1296
+ />
1297
+ </div>
1298
+ {/if}
1299
+ {/each}
1300
+
1301
+ {#each ancestorOutlineIds as pid (pid)}
1302
+ {@const outline = paintAbsMap.get(pid)}
1303
+ {#if outline}
1304
+ <div
1305
+ class="pointer-events-none absolute z-[999980] outline outline-1 outline-dashed outline-[#3b82f6]/80"
1306
+ style:left="{outline.x}px"
1307
+ style:top="{outline.y}px"
1308
+ style:width="{outline.w}px"
1309
+ style:height="{outline.h}px"
1310
+ style:transform={paintTransformForLayer(
1247
1311
  displayLayers,
1248
- layer.id,
1312
+ pid,
1249
1313
  paintAbsMap,
1250
1314
  layerById
1251
1315
  )}
1252
- selected={isSelected}
1253
- passthrough={!!layer.locked}
1254
- readOnly={isSynthetic}
1255
- layoutLocked={isLayoutLocked(layer) || (marqueeBg && !dragOk)}
1256
- onclick={(e) => selectLayer(layer.id, e)}
1257
- ondblclick={(e) => {
1258
- if (layer.locked) return;
1259
- const pt = clientToDoc(e.clientX, e.clientY);
1260
- const hit = pickLayerAtDoc(pt) ?? realId;
1261
- onenterlayer?.(hit);
1262
- }}
1263
- onchange={(rect) => handleRect(layer, rect)}
1264
- oninteract={handleLayerInteract}
1265
- />
1266
- </div>
1316
+ style:transform-origin="0 0"
1317
+ aria-hidden="true"
1318
+ ></div>
1267
1319
  {/if}
1268
1320
  {/each}
1269
1321
 
@@ -1280,13 +1332,9 @@
1280
1332
  maxY: scrollOver.maxY
1281
1333
  }}
1282
1334
  {@const vScroll =
1283
- chrome.maxY > 0
1284
- ? scrollBarMetrics(boxRect.h, chrome.maxY, chrome.y)
1285
- : null}
1335
+ chrome.maxY > 0 ? scrollBarMetrics(boxRect.h, chrome.maxY, chrome.y) : null}
1286
1336
  {@const hScroll =
1287
- chrome.maxX > 0
1288
- ? scrollBarMetrics(boxRect.w, chrome.maxX, chrome.x)
1289
- : null}
1337
+ chrome.maxX > 0 ? scrollBarMetrics(boxRect.w, chrome.maxX, chrome.x) : null}
1290
1338
  {#if vScroll || hScroll}
1291
1339
  <div
1292
1340
  class="pointer-events-none absolute z-[999990]"
@@ -1298,56 +1346,42 @@
1298
1346
  {#if vScroll}
1299
1347
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1300
1348
  <div
1301
- class="pointer-events-auto absolute bottom-0 right-0 top-0 w-2.5 rounded-r-md bg-black/[0.04] dark:bg-white/[0.06]"
1349
+ class="bottom-0 right-0 top-0 w-2.5 rounded-r-md bg-black/[0.04] dark:bg-white/[0.06] pointer-events-auto absolute"
1302
1350
  style:margin-bottom={hScroll ? '10px' : '0'}
1303
1351
  onpointerdown={(e) =>
1304
1352
  jumpScrollTrack(box.id, 'y', chrome, vScroll, hScroll, e)}
1305
1353
  >
1306
1354
  <div
1307
1355
  data-scroll-thumb="y"
1308
- class="absolute left-0.5 right-0.5 cursor-grab rounded-full bg-slate-400/75 shadow-sm active:cursor-grabbing dark:bg-slate-500/85"
1356
+ 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"
1309
1357
  style:top="{vScroll.offset}px"
1310
1358
  style:height="{vScroll.thumb}px"
1311
1359
  onpointerdown={(e) =>
1312
- beginScrollThumbDrag(
1313
- box.id,
1314
- 'y',
1315
- chrome,
1316
- vScroll,
1317
- hScroll,
1318
- e
1319
- )}
1360
+ beginScrollThumbDrag(box.id, 'y', chrome, vScroll, hScroll, e)}
1320
1361
  ></div>
1321
1362
  </div>
1322
1363
  {/if}
1323
1364
  {#if hScroll}
1324
1365
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1325
1366
  <div
1326
- class="pointer-events-auto absolute bottom-0 left-0 h-2.5 rounded-b-md bg-black/[0.04] dark:bg-white/[0.06]"
1367
+ class="bottom-0 left-0 h-2.5 rounded-b-md bg-black/[0.04] dark:bg-white/[0.06] pointer-events-auto absolute"
1327
1368
  style:right={vScroll ? '10px' : '0'}
1328
1369
  onpointerdown={(e) =>
1329
1370
  jumpScrollTrack(box.id, 'x', chrome, vScroll, hScroll, e)}
1330
1371
  >
1331
1372
  <div
1332
1373
  data-scroll-thumb="x"
1333
- class="absolute top-0.5 bottom-0.5 cursor-grab rounded-full bg-slate-400/75 shadow-sm active:cursor-grabbing dark:bg-slate-500/85"
1374
+ 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"
1334
1375
  style:left="{hScroll.offset}px"
1335
1376
  style:width="{hScroll.thumb}px"
1336
1377
  onpointerdown={(e) =>
1337
- beginScrollThumbDrag(
1338
- box.id,
1339
- 'x',
1340
- chrome,
1341
- vScroll,
1342
- hScroll,
1343
- e
1344
- )}
1378
+ beginScrollThumbDrag(box.id, 'x', chrome, vScroll, hScroll, e)}
1345
1379
  ></div>
1346
1380
  </div>
1347
1381
  {/if}
1348
1382
  {#if vScroll && hScroll}
1349
1383
  <div
1350
- class="absolute bottom-0 right-0 h-2.5 w-2.5 rounded-br-md bg-black/[0.06] dark:bg-white/[0.08]"
1384
+ class="bottom-0 right-0 h-2.5 w-2.5 rounded-br-md bg-black/[0.06] dark:bg-white/[0.08] absolute"
1351
1385
  aria-hidden="true"
1352
1386
  ></div>
1353
1387
  {/if}
@@ -1382,9 +1416,7 @@
1382
1416
  locked && 'cursor-default',
1383
1417
  hiding && 'opacity-0'
1384
1418
  ]}
1385
- style={guide.orientation === 'vertical'
1386
- ? `left:${screenX}px`
1387
- : `top:${screenY}px`}
1419
+ style={guide.orientation === 'vertical' ? `left:${screenX}px` : `top:${screenY}px`}
1388
1420
  title={locked ? 'Guide locked' : 'Drag to move · Double-click to remove'}
1389
1421
  onpointerdown={(e) => beginGuideDrag(guide, e)}
1390
1422
  ondblclick={() => removeGuide(guide.id)}
@@ -1393,7 +1425,7 @@
1393
1425
  class={[
1394
1426
  'pointer-events-none absolute bg-[#00c2ff]',
1395
1427
  guide.orientation === 'vertical'
1396
- ? 'left-1/2 top-0 h-full w-px -translate-x-1/2'
1428
+ ? 'top-0 left-1/2 h-full w-px -translate-x-1/2'
1397
1429
  : 'left-0 top-1/2 h-px w-full -translate-y-1/2',
1398
1430
  locked && 'opacity-60'
1399
1431
  ]}
@@ -1406,10 +1438,7 @@
1406
1438
 
1407
1439
  <!-- Pen draft preview -->
1408
1440
  {#if drawMode && draftPoints.length}
1409
- <svg
1410
- class="pointer-events-none absolute inset-0 z-45 overflow-visible"
1411
- aria-hidden="true"
1412
- >
1441
+ <svg class="inset-0 pointer-events-none absolute z-45 overflow-visible" aria-hidden="true">
1413
1442
  {#each draftPoints as p, i (i)}
1414
1443
  {@const sx = RULER_LEFT + tickX(p.x)}
1415
1444
  {@const sy = RULER_TOP + tickY(p.y)}
@@ -1442,14 +1471,14 @@
1442
1471
  {/if}
1443
1472
  </svg>
1444
1473
  <div
1445
- class="pointer-events-none absolute bottom-3 left-1/2 z-50 -translate-x-1/2 rounded-md bg-slate-900/90 px-3 py-1.5 text-[11px] text-white shadow"
1474
+ 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]"
1446
1475
  >
1447
1476
  Click to add · near start to close · double-click / Enter to finish · Esc cancel
1448
1477
  </div>
1449
1478
  {/if}
1450
1479
 
1451
1480
  <!-- Editable path points -->
1452
- {#if selectedPath && !drawMode && !selectedPath.locked}
1481
+ {#if selectedPath && !drawMode && !isEffectivelyLocked(workingLayers, selectedPath.id, workingById)}
1453
1482
  {@const docs = pathAbsPoints(selectedPath)}
1454
1483
  {#each docs as p, i (i)}
1455
1484
  {@const sx = RULER_LEFT + tickX(p.x)}
@@ -1461,7 +1490,7 @@
1461
1490
  <!-- svelte-ignore a11y_no_static_element_interactions -->
1462
1491
  <button
1463
1492
  type="button"
1464
- class="absolute z-45 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-dashed border-blue-400/80 bg-white/80"
1493
+ class="h-3 w-3 border-blue-400/80 bg-white/80 absolute z-45 -translate-x-1/2 -translate-y-1/2 rounded-full border border-dashed"
1465
1494
  style:left={`${mx}px`}
1466
1495
  style:top={`${my}px`}
1467
1496
  title="Double-click to add point"
@@ -1472,8 +1501,8 @@
1472
1501
  <div
1473
1502
  data-path-point={i}
1474
1503
  class={[
1475
- 'absolute z-46 h-3 w-3 -translate-x-1/2 -translate-y-1/2 cursor-grab rounded-full border-2 border-blue-500 bg-white shadow',
1476
- activePathPoint === i && 'ring-2 ring-blue-400'
1504
+ 'h-3 w-3 border-blue-500 bg-white shadow absolute z-46 -translate-x-1/2 -translate-y-1/2 cursor-grab rounded-full border-2',
1505
+ activePathPoint === i && 'ring-blue-400 ring-2'
1477
1506
  ]}
1478
1507
  style:left={`${sx}px`}
1479
1508
  style:top={`${sy}px`}
@@ -1485,16 +1514,16 @@
1485
1514
 
1486
1515
  <!-- Full-stage guide preview while dragging (edge to edge) -->
1487
1516
  {#if guidePreview}
1488
- <div class="pointer-events-none absolute inset-0 z-50" aria-hidden="true">
1517
+ <div class="inset-0 pointer-events-none absolute z-50" aria-hidden="true">
1489
1518
  {#if guidePreview.orientation === 'vertical'}
1490
1519
  <div
1491
- class="absolute top-0 bottom-0 w-px bg-[#00c2ff]"
1520
+ class="top-0 bottom-0 absolute w-px bg-[#00c2ff]"
1492
1521
  style:left={`${guidePreview.x}px`}
1493
1522
  style:box-shadow="0 0 0 1px rgba(0,194,255,0.35)"
1494
1523
  ></div>
1495
1524
  {:else}
1496
1525
  <div
1497
- class="absolute left-0 right-0 h-px bg-[#00c2ff]"
1526
+ class="left-0 right-0 absolute h-px bg-[#00c2ff]"
1498
1527
  style:top={`${guidePreview.y}px`}
1499
1528
  style:box-shadow="0 0 0 1px rgba(0,194,255,0.35)"
1500
1529
  ></div>