@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
@@ -36,12 +36,17 @@
36
36
  import {
37
37
  deleteSubtree,
38
38
  duplicateSubtree,
39
- groupLayers,
39
+ getAncestors,
40
40
  isContainerKind,
41
+ isEffectivelyLocked,
42
+ isLayoutPositionLocked,
41
43
  computeAbsoluteRects,
42
44
  contentPadding,
43
45
  reparentLayer,
44
46
  reorderSiblings,
47
+ resolveSlotRect,
48
+ stepAxis,
49
+ syncSlotFromRect,
45
50
  ungroupLayers,
46
51
  wrapSelection,
47
52
  slotFromLocalRect
@@ -173,9 +178,7 @@
173
178
  ];
174
179
 
175
180
  const editingWidget = $derived(
176
- editingWidgetId
177
- ? ((value.widgets ?? []).find((w) => w.id === editingWidgetId) ?? null)
178
- : null
181
+ editingWidgetId ? ((value.widgets ?? []).find((w) => w.id === editingWidgetId) ?? null) : null
179
182
  );
180
183
 
181
184
  const stageDoc = $derived.by((): CanvasDocument => {
@@ -192,9 +195,7 @@
192
195
  });
193
196
 
194
197
  const selectedLayer = $derived(
195
- selectedIds.length === 1
196
- ? (stageDoc.layers.find((l) => l.id === selectedIds[0]) ?? null)
197
- : null
198
+ selectedIds.length === 1 ? (stageDoc.layers.find((l) => l.id === selectedIds[0]) ?? null) : null
198
199
  );
199
200
  const zoomLabel = $derived(zoom === 1 ? 'Fit' : `${Math.round(zoom * 100)}%`);
200
201
  const presetValue = $derived(presetIdForSize(value.width, value.height));
@@ -298,8 +299,7 @@
298
299
  ];
299
300
 
300
301
  const ctxItems = $derived.by((): ContextMenuItem[] => {
301
- const focusIds =
302
- ctxLayerId && !selectedIds.includes(ctxLayerId) ? [ctxLayerId] : selectedIds;
302
+ const focusIds = ctxLayerId && !selectedIds.includes(ctxLayerId) ? [ctxLayerId] : selectedIds;
303
303
  const hasParent = focusIds.some((id) => {
304
304
  const l = stageDoc.layers.find((x) => x.id === id);
305
305
  return !!l?.parentId;
@@ -429,8 +429,7 @@
429
429
  height: extra?.height ?? d.height,
430
430
  background: extra?.background ?? d.background
431
431
  }));
432
- const sizeChanged =
433
- extra?.width != null || extra?.height != null;
432
+ const sizeChanged = extra?.width != null || extra?.height != null;
434
433
  if (sizeChanged && syncInstanceSizes) {
435
434
  next = syncInstanceSizesToDefinition(next, editingWidgetId);
436
435
  }
@@ -513,8 +512,7 @@
513
512
  const candidate = stageDoc.layers.find((l) => l.id === selectedIds[0]);
514
513
  if (candidate && isContainerKind(candidate.kind)) nestParentId = candidate.id;
515
514
  }
516
- const nesting =
517
- nestParentId !== undefined ? { parentId: nestParentId } : undefined;
515
+ const nesting = nestParentId !== undefined ? { parentId: nestParentId } : undefined;
518
516
 
519
517
  const fillRootCanvas =
520
518
  def.kind === 'canvasPanel' &&
@@ -585,9 +583,7 @@
585
583
 
586
584
  function addGuide(orientation: 'horizontal' | 'vertical') {
587
585
  const position =
588
- orientation === 'vertical'
589
- ? Math.round(stageDoc.width / 2)
590
- : Math.round(stageDoc.height / 2);
586
+ orientation === 'vertical' ? Math.round(stageDoc.width / 2) : Math.round(stageDoc.height / 2);
591
587
  emit({
592
588
  ...value,
593
589
  guides: [...(value.guides ?? []), createCanvasGuide(orientation, position)]
@@ -599,29 +595,46 @@
599
595
  emit({ ...value, guidesLocked: !value.guidesLocked });
600
596
  }
601
597
 
602
- function nudgeSelected(dx: number, dy: number) {
603
- if (!selectedIds.length) return;
598
+ function parentContentSize(
599
+ layer: CanvasLayer,
600
+ absMap: Map<string, { x: number; y: number; w: number; h: number }>
601
+ ) {
602
+ const parentId = layer.parentId ?? null;
603
+ let bounds = { width: stageDoc.width, height: stageDoc.height };
604
+ if (!parentId) return bounds;
605
+ const parent = stageDoc.layers.find((p) => p.id === parentId);
606
+ const parentAbs = absMap.get(parentId);
607
+ if (parent && parentAbs) {
608
+ const pad = contentPadding(parent);
609
+ bounds = {
610
+ width: Math.max(1, parentAbs.w - pad.left - pad.right),
611
+ height: Math.max(1, parentAbs.h - pad.top - pad.bottom)
612
+ };
613
+ }
614
+ return bounds;
615
+ }
616
+
617
+ function nudgeSelected(dirX: -1 | 0 | 1, dirY: -1 | 0 | 1, coarse: boolean) {
618
+ if (!selectedIds.length || (!dirX && !dirY)) return;
604
619
  const set = new Set(selectedIds);
620
+ const absMap = computeAbsoluteRects(stageDoc.layers, {
621
+ width: stageDoc.width,
622
+ height: stageDoc.height
623
+ });
624
+ const stepOpts = { snap, cell: cellSize, coarse };
605
625
  emitStageLayers(
606
626
  stageDoc.layers.map((l) => {
607
- if (!set.has(l.id) || l.locked) return l;
608
- const x = l.rect.x + dx;
609
- const y = l.rect.y + dy;
610
- const rect = { ...l.rect, x, y };
611
- return {
612
- ...l,
613
- rect,
614
- slot: l.slot
615
- ? {
616
- ...l.slot,
617
- offsets: {
618
- ...l.slot.offsets,
619
- left: l.slot.offsets.left + dx,
620
- top: l.slot.offsets.top + dy
621
- }
622
- }
623
- : defaultSlotFromRect(rect)
627
+ if (!set.has(l.id) || isEffectivelyLocked(stageDoc.layers, l.id)) return l;
628
+ if (getAncestors(stageDoc.layers, l.id).some((a) => set.has(a.id))) return l;
629
+ if (isLayoutPositionLocked(stageDoc.layers, l.id)) return l;
630
+ const bounds = parentContentSize(l, absMap);
631
+ const local = l.slot ? resolveSlotRect(bounds, l.slot) : l.rect;
632
+ const rect = {
633
+ ...local,
634
+ x: dirX ? stepAxis(local.x, dirX, stepOpts) : local.x,
635
+ y: dirY ? stepAxis(local.y, dirY, stepOpts) : local.y
624
636
  };
637
+ return syncSlotFromRect({ ...l, rect }, bounds);
625
638
  })
626
639
  );
627
640
  }
@@ -644,6 +657,8 @@
644
657
  emitStageLayers(
645
658
  stageDoc.layers.map((l) => {
646
659
  if (!set.has(l.id)) return l;
660
+ if (isEffectivelyLocked(stageDoc.layers, l.id)) return l;
661
+ if (isLayoutPositionLocked(stageDoc.layers, l.id)) return l;
647
662
  const parentId = l.parentId ?? null;
648
663
  let bounds = { width: stageDoc.width, height: stageDoc.height };
649
664
  if (parentId) {
@@ -673,19 +688,13 @@
673
688
 
674
689
  function deleteSelected() {
675
690
  if (!selectedIds.length) return;
676
- const next = deleteSubtree(
677
- { ...stageDoc, widgets: value.widgets },
678
- selectedIds
679
- );
691
+ const next = deleteSubtree({ ...stageDoc, widgets: value.widgets }, selectedIds);
680
692
  emitStageLayers(next.layers);
681
693
  selectedIds = [];
682
694
  }
683
695
 
684
696
  function duplicateSelected() {
685
- const result = duplicateSubtree(
686
- { ...stageDoc, widgets: value.widgets },
687
- selectedIds
688
- );
697
+ const result = duplicateSubtree({ ...stageDoc, widgets: value.widgets }, selectedIds);
689
698
  emitStageLayers(result.doc.layers);
690
699
  selectedIds = result.newIds;
691
700
  }
@@ -716,7 +725,9 @@
716
725
  function sendBack() {
717
726
  const set = new Set(selectedIds);
718
727
  let layers = stageDoc.layers;
719
- const parents = new Set(stageDoc.layers.filter((l) => set.has(l.id)).map((l) => l.parentId ?? null));
728
+ const parents = new Set(
729
+ stageDoc.layers.filter((l) => set.has(l.id)).map((l) => l.parentId ?? null)
730
+ );
720
731
  for (const pid of parents) {
721
732
  const siblings = layers
722
733
  .filter((l) => (l.parentId ?? null) === pid)
@@ -729,25 +740,26 @@
729
740
  emitStageLayers(layers);
730
741
  }
731
742
 
732
- function wrapSelected(kind: CanvasLayerKind) {
743
+ function wrapSelected(kind: CanvasLayerKind, ids = selectedIds) {
744
+ if (!ids.length) {
745
+ toast.warning('Select one or more layers to wrap');
746
+ return;
747
+ }
733
748
  const result = wrapSelection(
734
749
  { ...stageDoc, version: 2, widgets: value.widgets ?? [] },
735
- selectedIds,
750
+ ids,
736
751
  kind
737
752
  );
738
- if (!result) return;
753
+ if (!result) {
754
+ toast.warning('Could not wrap selection');
755
+ return;
756
+ }
739
757
  emitStageLayers(result.doc.layers);
740
758
  selectedIds = [result.wrapperId];
741
759
  }
742
760
 
743
- function groupSelected() {
744
- const result = groupLayers(
745
- { ...stageDoc, version: 2, widgets: value.widgets ?? [] },
746
- selectedIds
747
- );
748
- if (!result) return;
749
- emitStageLayers(result.doc.layers);
750
- selectedIds = [result.wrapperId];
761
+ function groupSelected(ids = selectedIds) {
762
+ wrapSelected('group', ids);
751
763
  }
752
764
 
753
765
  function ungroupSelected() {
@@ -803,15 +815,16 @@
803
815
 
804
816
  function handleCtx(id: string) {
805
817
  const targetId = ctxLayerId;
818
+ const focusIds = targetId && !selectedIds.includes(targetId) ? [targetId] : selectedIds;
806
819
  if (targetId && !selectedIds.includes(targetId)) selectedIds = [targetId];
807
820
  if (id === 'duplicate') duplicateSelected();
808
821
  else if (id === 'delete') deleteSelected();
809
822
  else if (id === 'bring-front') bringFront();
810
823
  else if (id === 'send-back') sendBack();
811
- else if (id === 'group') groupSelected();
824
+ else if (id === 'group') groupSelected(focusIds);
812
825
  else if (id === 'ungroup') ungroupSelected();
813
826
  else if (id === 'detach') detachSelected();
814
- else if (id.startsWith('wrap-')) wrapSelected(id.slice(5) as CanvasLayerKind);
827
+ else if (id.startsWith('wrap-')) wrapSelected(id.slice(5) as CanvasLayerKind, focusIds);
815
828
  else if (id === 'create-widget') createWidgetSelected();
816
829
  else if (id === 'lock') {
817
830
  const set = new Set(selectedIds);
@@ -820,9 +833,7 @@
820
833
  );
821
834
  } else if (id === 'hide') {
822
835
  const set = new Set(selectedIds);
823
- emitStageLayers(
824
- stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, visible: false } : l))
825
- );
836
+ emitStageLayers(stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, visible: false } : l)));
826
837
  selectedIds = [];
827
838
  }
828
839
  }
@@ -832,14 +843,10 @@
832
843
  else if (id === 'delete') deleteSelected();
833
844
  else if (id === 'lock') {
834
845
  const set = new Set(selectedIds);
835
- emitStageLayers(
836
- stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, locked: true } : l))
837
- );
846
+ emitStageLayers(stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, locked: true } : l)));
838
847
  } else if (id === 'hide') {
839
848
  const set = new Set(selectedIds);
840
- emitStageLayers(
841
- stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, visible: false } : l))
842
- );
849
+ emitStageLayers(stageDoc.layers.map((l) => (set.has(l.id) ? { ...l, visible: false } : l)));
843
850
  selectedIds = [];
844
851
  } else if (id === 'front') bringFront();
845
852
  else if (id === 'back') sendBack();
@@ -875,8 +882,41 @@
875
882
  }
876
883
  }
877
884
 
885
+ function isEditingText(target: EventTarget | null): boolean {
886
+ if (!(target instanceof HTMLElement)) return false;
887
+ if (target.isContentEditable || target.closest('[contenteditable="true"]')) return true;
888
+ const field = target.closest('textarea, select, input');
889
+ if (!field) return false;
890
+ if (field instanceof HTMLTextAreaElement || field instanceof HTMLSelectElement) return true;
891
+ if (field instanceof HTMLInputElement) {
892
+ const type = (field.type || 'text').toLowerCase();
893
+ return (
894
+ type !== 'number' &&
895
+ type !== 'range' &&
896
+ type !== 'checkbox' &&
897
+ type !== 'radio' &&
898
+ type !== 'button' &&
899
+ type !== 'hidden'
900
+ );
901
+ }
902
+ return false;
903
+ }
904
+
878
905
  function handleKeydown(e: KeyboardEvent) {
879
906
  const t = e.target as HTMLElement | null;
907
+ const arrow =
908
+ e.key === 'ArrowLeft' ||
909
+ e.key === 'ArrowRight' ||
910
+ e.key === 'ArrowUp' ||
911
+ e.key === 'ArrowDown';
912
+ if (arrow && selectedIds.length && !isEditingText(e.target)) {
913
+ if (drawMode) return;
914
+ e.preventDefault();
915
+ const dirX: -1 | 0 | 1 = e.key === 'ArrowLeft' ? -1 : e.key === 'ArrowRight' ? 1 : 0;
916
+ const dirY: -1 | 0 | 1 = e.key === 'ArrowUp' ? -1 : e.key === 'ArrowDown' ? 1 : 0;
917
+ nudgeSelected(dirX, dirY, e.shiftKey);
918
+ return;
919
+ }
880
920
  if (t?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
881
921
 
882
922
  if (drawMode) {
@@ -915,9 +955,7 @@
915
955
  if (selectedIds.length === 1) {
916
956
  const cur = stageDoc.layers.find((l) => l.id === selectedIds[0]);
917
957
  const pid = cur?.parentId ?? null;
918
- selectedIds = stageDoc.layers
919
- .filter((l) => (l.parentId ?? null) === pid)
920
- .map((l) => l.id);
958
+ selectedIds = stageDoc.layers.filter((l) => (l.parentId ?? null) === pid).map((l) => l.id);
921
959
  } else if (selectedIds.length > 1) {
922
960
  const parents = new Set(
923
961
  selectedIds.map((id) => stageDoc.layers.find((l) => l.id === id)?.parentId ?? null)
@@ -933,9 +971,7 @@
933
971
  .map((l) => l.id);
934
972
  }
935
973
  } else {
936
- selectedIds = stageDoc.layers
937
- .filter((l) => (l.parentId ?? null) === null)
938
- .map((l) => l.id);
974
+ selectedIds = stageDoc.layers.filter((l) => (l.parentId ?? null) === null).map((l) => l.id);
939
975
  }
940
976
  return;
941
977
  }
@@ -965,16 +1001,6 @@
965
1001
  return;
966
1002
  }
967
1003
  }
968
-
969
- if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') {
970
- if (!selectedIds.length) return;
971
- e.preventDefault();
972
- const step = e.shiftKey ? (snap ? cellSize * 2 : 10) : snap ? cellSize : 1;
973
- if (e.key === 'ArrowLeft') nudgeSelected(-step, 0);
974
- else if (e.key === 'ArrowRight') nudgeSelected(step, 0);
975
- else if (e.key === 'ArrowUp') nudgeSelected(0, -step);
976
- else nudgeSelected(0, step);
977
- }
978
1004
  }
979
1005
 
980
1006
  async function handleExport(format: CanvasExportFormat) {
@@ -1060,17 +1086,17 @@
1060
1086
  }
1061
1087
  </script>
1062
1088
 
1063
- <svelte:window onkeydown={handleKeydown} />
1089
+ <svelte:window onkeydowncapture={handleKeydown} />
1064
1090
 
1065
- <div class={['relative flex h-full min-h-0 flex-col', className]}>
1091
+ <div class={['min-h-0 relative flex h-full flex-col', className]}>
1066
1092
  <header
1067
- class="flex shrink-0 items-center gap-3 border-b border-border bg-surface-elevated px-3 py-2"
1093
+ class="gap-3 border-border bg-surface-elevated px-3 py-2 flex shrink-0 items-center border-b"
1068
1094
  >
1069
- <div class="flex min-w-0 items-center gap-2">
1095
+ <div class="min-w-0 gap-2 flex items-center">
1070
1096
  {#if editingWidget}
1071
1097
  <button
1072
1098
  type="button"
1073
- class="inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-secondary hover:bg-surface-overlay"
1099
+ class="gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-secondary hover:bg-surface-overlay inline-flex items-center"
1074
1100
  onclick={() => {
1075
1101
  exitWidgetEdit();
1076
1102
  selectedIds = [];
@@ -1080,9 +1106,9 @@
1080
1106
  Scene
1081
1107
  </button>
1082
1108
  <span class="text-muted">/</span>
1083
- <span class="truncate text-sm font-semibold text-primary">{editingWidget.name}</span>
1109
+ <span class="text-sm font-semibold text-primary truncate">{editingWidget.name}</span>
1084
1110
  {:else}
1085
- <span class="hidden text-sm font-semibold text-primary sm:inline">Canvas</span>
1111
+ <span class="text-sm font-semibold text-primary sm:inline hidden">Canvas</span>
1086
1112
  <Select
1087
1113
  size="sm"
1088
1114
  class="w-44"
@@ -1095,15 +1121,15 @@
1095
1121
  {/if}
1096
1122
  </div>
1097
1123
 
1098
- <div class="hidden h-5 w-px bg-border sm:block"></div>
1124
+ <div class="h-5 bg-border sm:block hidden w-px"></div>
1099
1125
 
1100
- <div class="flex items-center rounded-lg border border-border bg-surface p-0.5">
1126
+ <div class="rounded-lg border-border bg-surface p-0.5 flex items-center border">
1101
1127
  <IconButton label="Zoom out" size="sm" onclick={() => setZoom(zoom - 0.1)}>
1102
1128
  <ZoomOut class="h-3.5 w-3.5" />
1103
1129
  </IconButton>
1104
1130
  <button
1105
1131
  type="button"
1106
- class="min-w-11 rounded-md px-1 py-1 font-mono text-[11px] tabular-nums text-secondary hover:bg-surface-overlay"
1132
+ class="min-w-11 rounded-md px-1 py-1 font-mono text-secondary hover:bg-surface-overlay text-[11px] tabular-nums"
1107
1133
  onclick={() => setZoom(1)}
1108
1134
  title="Fit to view"
1109
1135
  >
@@ -1114,26 +1140,16 @@
1114
1140
  </IconButton>
1115
1141
  </div>
1116
1142
 
1117
- <div class="flex items-center rounded-lg border border-border bg-surface p-0.5">
1118
- <IconButton
1119
- label="Undo"
1120
- size="sm"
1121
- disabled={!history.past.length}
1122
- onclick={undo}
1123
- >
1143
+ <div class="rounded-lg border-border bg-surface p-0.5 flex items-center border">
1144
+ <IconButton label="Undo" size="sm" disabled={!history.past.length} onclick={undo}>
1124
1145
  <Undo2 class="h-3.5 w-3.5" />
1125
1146
  </IconButton>
1126
- <IconButton
1127
- label="Redo"
1128
- size="sm"
1129
- disabled={!history.future.length}
1130
- onclick={redo}
1131
- >
1147
+ <IconButton label="Redo" size="sm" disabled={!history.future.length} onclick={redo}>
1132
1148
  <Redo2 class="h-3.5 w-3.5" />
1133
1149
  </IconButton>
1134
1150
  </div>
1135
1151
 
1136
- <div class="flex items-center rounded-lg border border-border bg-surface p-0.5">
1152
+ <div class="rounded-lg border-border bg-surface p-0.5 flex items-center border">
1137
1153
  <Tooltip content="Toggle grid">
1138
1154
  <IconButton
1139
1155
  label="Toggle grid"
@@ -1150,7 +1166,7 @@
1150
1166
  </Tooltip>
1151
1167
  {#if showGrid}
1152
1168
  <select
1153
- class="h-8 min-w-0 shrink-0 rounded-md border-0 bg-transparent px-1 font-mono text-[11px] tabular-nums text-secondary outline-none hover:bg-surface-overlay focus-visible:bg-surface-overlay"
1169
+ class="h-8 min-w-0 rounded-md px-1 font-mono text-secondary hover:bg-surface-overlay focus-visible:bg-surface-overlay shrink-0 border-0 bg-transparent text-[11px] tabular-nums outline-none"
1154
1170
  aria-label="Grid cell size"
1155
1171
  value={String(cellSize)}
1156
1172
  onchange={(e) => (cellSize = Number(e.currentTarget.value))}
@@ -1176,9 +1192,9 @@
1176
1192
  </Tooltip>
1177
1193
  </div>
1178
1194
 
1179
- <div class="hidden h-5 w-px bg-border sm:block"></div>
1195
+ <div class="h-5 bg-border sm:block hidden w-px"></div>
1180
1196
 
1181
- <div class="flex items-center gap-0.5">
1197
+ <div class="gap-0.5 flex items-center">
1182
1198
  <Tooltip content={drawMode ? 'Exit pen tool (Esc)' : 'Pen — draw path / shape'}>
1183
1199
  <IconButton
1184
1200
  label="Pen tool"
@@ -1191,9 +1207,9 @@
1191
1207
  </Tooltip>
1192
1208
  </div>
1193
1209
 
1194
- <div class="hidden h-5 w-px bg-border sm:block"></div>
1210
+ <div class="h-5 bg-border sm:block hidden w-px"></div>
1195
1211
 
1196
- <div class="flex items-center gap-0.5">
1212
+ <div class="gap-0.5 flex items-center">
1197
1213
  <Tooltip content={showGuides ? 'Hide guides' : 'Show guides'}>
1198
1214
  <IconButton
1199
1215
  label="Toggle guides"
@@ -1231,8 +1247,8 @@
1231
1247
  </div>
1232
1248
 
1233
1249
  {#if selectedIds.length}
1234
- <div class="hidden h-5 w-px bg-border md:block"></div>
1235
- <div class="hidden items-center gap-1 md:flex">
1250
+ <div class="h-5 bg-border md:block hidden w-px"></div>
1251
+ <div class="gap-1 md:flex hidden items-center">
1236
1252
  <DropdownMenu
1237
1253
  size="sm"
1238
1254
  align="start"
@@ -1241,9 +1257,7 @@
1241
1257
  onselect={(id) => alignSelected(id as CanvasAlign)}
1242
1258
  >
1243
1259
  {#snippet trigger()}
1244
- <span
1245
- class="inline-flex items-center gap-1.5 text-xs font-medium text-secondary"
1246
- >
1260
+ <span class="gap-1.5 text-xs font-medium text-secondary inline-flex items-center">
1247
1261
  <AlignHorizontalJustifyCenter class="h-3.5 w-3.5" />
1248
1262
  Align
1249
1263
  </span>
@@ -1257,7 +1271,7 @@
1257
1271
  onselect={handleWrapMenu}
1258
1272
  >
1259
1273
  {#snippet trigger()}
1260
- <span class="inline-flex items-center gap-1.5 text-xs font-medium text-secondary">
1274
+ <span class="gap-1.5 text-xs font-medium text-secondary inline-flex items-center">
1261
1275
  <Group class="h-3.5 w-3.5" />
1262
1276
  Group
1263
1277
  </span>
@@ -1266,7 +1280,7 @@
1266
1280
  </div>
1267
1281
  {/if}
1268
1282
 
1269
- <div class="ml-auto flex items-center gap-1">
1283
+ <div class="gap-1 ml-auto flex items-center">
1270
1284
  <IconButton
1271
1285
  label="Toggle sidebar"
1272
1286
  size="sm"
@@ -1293,7 +1307,7 @@
1293
1307
  onselect={(id) => handleExport(id as CanvasExportFormat)}
1294
1308
  >
1295
1309
  {#snippet trigger()}
1296
- <span class="inline-flex items-center gap-1.5 px-1 text-xs font-medium">
1310
+ <span class="gap-1.5 px-1 text-xs font-medium inline-flex items-center">
1297
1311
  <Download class="h-3.5 w-3.5" />
1298
1312
  {exporting ? 'Exporting…' : 'Export'}
1299
1313
  </span>
@@ -1302,7 +1316,7 @@
1302
1316
  </div>
1303
1317
  </header>
1304
1318
 
1305
- <div class="relative min-h-0 flex-1">
1319
+ <div class="min-h-0 relative flex-1">
1306
1320
  <EditorShell
1307
1321
  sidebarTitle="Assets"
1308
1322
  inspectorTitle="Inspector"
@@ -1335,12 +1349,12 @@
1335
1349
  class="h-full"
1336
1350
  >
1337
1351
  {#snippet start()}
1338
- <div class="flex h-full min-h-0 flex-col bg-surface-elevated">
1339
- <div class="flex shrink-0 gap-1 border-b border-border p-2">
1352
+ <div class="min-h-0 bg-surface-elevated flex h-full flex-col">
1353
+ <div class="gap-1 border-border p-2 flex shrink-0 border-b">
1340
1354
  <button
1341
1355
  type="button"
1342
1356
  class={[
1343
- 'flex-1 rounded-md px-2 py-1.5 text-xs font-medium transition-colors',
1357
+ 'rounded-md px-2 py-1.5 text-xs font-medium flex-1 transition-colors',
1344
1358
  sidebarTab === 'elements'
1345
1359
  ? 'bg-brand-500 text-white'
1346
1360
  : 'text-secondary hover:bg-surface-overlay'
@@ -1352,7 +1366,7 @@
1352
1366
  <button
1353
1367
  type="button"
1354
1368
  class={[
1355
- 'flex-1 rounded-md px-2 py-1.5 text-xs font-medium transition-colors',
1369
+ 'rounded-md px-2 py-1.5 text-xs font-medium flex-1 transition-colors',
1356
1370
  sidebarTab === 'widgets'
1357
1371
  ? 'bg-brand-500 text-white'
1358
1372
  : 'text-secondary hover:bg-surface-overlay'
@@ -1364,7 +1378,7 @@
1364
1378
  <button
1365
1379
  type="button"
1366
1380
  class={[
1367
- 'flex-1 rounded-md px-2 py-1.5 text-xs font-medium transition-colors',
1381
+ 'rounded-md px-2 py-1.5 text-xs font-medium flex-1 transition-colors',
1368
1382
  sidebarTab === 'uploads'
1369
1383
  ? 'bg-brand-500 text-white'
1370
1384
  : 'text-secondary hover:bg-surface-overlay'
@@ -1378,11 +1392,11 @@
1378
1392
  {#if sidebarTab === 'elements'}
1379
1393
  <CanvasElementsPanel onadd={addElement} />
1380
1394
  {:else if sidebarTab === 'widgets'}
1381
- <div class="flex flex-col gap-2 p-3">
1382
- <p class="text-[11px] text-muted">
1395
+ <div class="gap-2 p-3 flex flex-col">
1396
+ <p class="text-muted text-[11px]">
1383
1397
  Click to place · pencil to edit · dblclick name to rename
1384
1398
  </p>
1385
- <label class="flex items-center gap-2 text-[11px] text-secondary">
1399
+ <label class="gap-2 text-secondary flex items-center text-[11px]">
1386
1400
  <input
1387
1401
  type="checkbox"
1388
1402
  class="rounded border-border"
@@ -1393,15 +1407,15 @@
1393
1407
  {#each value.widgets ?? [] as w (w.id)}
1394
1408
  <div
1395
1409
  class={[
1396
- 'flex items-center gap-0.5 rounded-lg border bg-surface px-1 py-1 text-xs',
1410
+ 'gap-0.5 rounded-lg bg-surface px-1 py-1 text-xs flex items-center border',
1397
1411
  editingWidgetId === w.id
1398
- ? 'border-brand-500 ring-1 ring-brand-500/30'
1412
+ ? 'border-brand-500 ring-brand-500/30 ring-1'
1399
1413
  : 'border-border'
1400
1414
  ]}
1401
1415
  >
1402
1416
  <button
1403
1417
  type="button"
1404
- class="flex min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 py-1.5 text-left hover:bg-surface-overlay"
1418
+ class="min-w-0 gap-2 rounded-md px-1.5 py-1.5 hover:bg-surface-overlay flex flex-1 items-center text-left"
1405
1419
  title="Place instance on canvas"
1406
1420
  onclick={() => {
1407
1421
  if (editingWidgetId) {
@@ -1416,13 +1430,11 @@
1416
1430
  }
1417
1431
  }}
1418
1432
  >
1419
- <Component class="h-4 w-4 shrink-0 text-brand-600" />
1420
- <span class="min-w-0 flex-1 truncate font-medium" title={w.name}>
1433
+ <Component class="h-4 w-4 text-brand-600 shrink-0" />
1434
+ <span class="min-w-0 font-medium flex-1 truncate" title={w.name}>
1421
1435
  {w.name}
1422
1436
  </span>
1423
- <span class="shrink-0 text-[10px] text-muted"
1424
- >{w.width}×{w.height}</span
1425
- >
1437
+ <span class="text-muted shrink-0 text-[10px]">{w.width}×{w.height}</span>
1426
1438
  </button>
1427
1439
  <IconButton
1428
1440
  label="Rename widget"
@@ -1466,7 +1478,7 @@
1466
1478
  </IconButton>
1467
1479
  </div>
1468
1480
  {:else}
1469
- <p class="py-6 text-center text-xs text-muted">
1481
+ <p class="py-6 text-xs text-muted text-center">
1470
1482
  Select layers and Create Widget, or Group → Create Widget
1471
1483
  </p>
1472
1484
  {/each}
@@ -1478,7 +1490,7 @@
1478
1490
  accept="image/*,video/*"
1479
1491
  helperText="Images or video"
1480
1492
  allowText={false}
1481
- onassetschange={onassetschange}
1493
+ {onassetschange}
1482
1494
  onselect={(id) => {
1483
1495
  const asset = assets.find((a) => a.id === id);
1484
1496
  if (asset) addFromAsset(asset);
@@ -1503,15 +1515,11 @@
1503
1515
  onselect={selectFromList}
1504
1516
  ontogglevisible={(id) =>
1505
1517
  emitStageLayers(
1506
- stageDoc.layers.map((l) =>
1507
- l.id === id ? { ...l, visible: !l.visible } : l
1508
- )
1518
+ stageDoc.layers.map((l) => (l.id === id ? { ...l, visible: !l.visible } : l))
1509
1519
  )}
1510
1520
  ontogglelocked={(id) =>
1511
1521
  emitStageLayers(
1512
- stageDoc.layers.map((l) =>
1513
- l.id === id ? { ...l, locked: !l.locked } : l
1514
- )
1522
+ stageDoc.layers.map((l) => (l.id === id ? { ...l, locked: !l.locked } : l))
1515
1523
  )}
1516
1524
  onreorder={(ids, parentId) =>
1517
1525
  emitStageLayers(reorderSiblings(stageDoc.layers, parentId, ids))}
@@ -1536,7 +1544,7 @@
1536
1544
  {/snippet}
1537
1545
 
1538
1546
  {#snippet workspace()}
1539
- <div class="h-full min-h-0">
1547
+ <div class="min-h-0 h-full">
1540
1548
  <MediaStage
1541
1549
  document={stageDoc}
1542
1550
  {selectedIds}
@@ -1626,7 +1634,7 @@
1626
1634
  </EditorShell>
1627
1635
 
1628
1636
  {#if selectedIds.length > 1}
1629
- <div class="pointer-events-none absolute inset-x-0 bottom-4 z-30 flex justify-center px-4">
1637
+ <div class="inset-x-0 bottom-4 px-4 pointer-events-none absolute z-30 flex justify-center">
1630
1638
  <div class="pointer-events-auto">
1631
1639
  <BulkActionBar
1632
1640
  count={selectedIds.length}
@@ -1667,7 +1675,7 @@
1667
1675
  {#snippet trigger()}
1668
1676
  <Tooltip content="Wrap in parent" side="top">
1669
1677
  <span
1670
- class="inline-flex h-7 w-7 items-center justify-center rounded-md text-secondary hover:bg-surface-overlay hover:text-primary"
1678
+ class="h-7 w-7 rounded-md text-secondary hover:bg-surface-overlay hover:text-primary inline-flex items-center justify-center"
1671
1679
  aria-label="Wrap in parent"
1672
1680
  >
1673
1681
  <Group class="h-3.5 w-3.5" />