@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.
- package/dist/components/atoms/Textarea/Textarea.svelte +4 -0
- package/dist/components/atoms/Textarea/Textarea.svelte.d.ts +1 -0
- package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +165 -71
- package/dist/components/molecules/Cascader/Cascader.svelte +2 -0
- package/dist/components/molecules/ColorPicker/ColorPicker.svelte +4 -13
- package/dist/components/molecules/DatePicker/DatePicker.svelte +2 -0
- package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte +2 -0
- package/dist/components/molecules/DropdownMenu/DropdownMenu.svelte +12 -21
- package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +11 -3
- package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte.d.ts +5 -1
- package/dist/components/molecules/MediaLayerList/MediaLayerList.svelte +31 -4
- package/dist/components/molecules/MediaStage/MediaStage.svelte +193 -164
- package/dist/components/molecules/MediaStage/MediaStage.svelte.d.ts +1 -45
- package/dist/components/molecules/MultiSelect/MultiSelect.svelte +2 -0
- package/dist/components/molecules/Popover/Popover.svelte +6 -0
- package/dist/components/molecules/Select/Select.svelte +36 -14
- package/dist/components/molecules/TimePicker/TimePicker.svelte +2 -0
- package/dist/components/molecules/TreeSelect/TreeSelect.svelte +2 -0
- package/dist/components/molecules/UserMenu/UserMenu.svelte +2 -0
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +155 -147
- package/dist/components/organisms/Dialog/Dialog.svelte +19 -3
- package/dist/components/organisms/Menubar/Menubar.svelte +121 -43
- package/dist/components/organisms/Menubar/Menubar.svelte.d.ts +1 -1
- package/dist/components/organisms/NotificationCenter/NotificationCenter.svelte +2 -0
- package/dist/components/organisms/PricingTable/PricingTable.svelte +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/utils/canvasHierarchy.d.ts +33 -0
- package/dist/utils/canvasHierarchy.js +108 -13
- package/dist/utils/popoverInvoker.d.ts +11 -0
- package/dist/utils/popoverInvoker.js +39 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import { on } from 'svelte/events';
|
|
4
4
|
import { createId } from '../../../utils/id.js';
|
|
5
|
+
import { popoverInvokerToggle } from '../../../utils/popoverInvoker.js';
|
|
5
6
|
|
|
6
7
|
export interface DropdownItem {
|
|
7
8
|
id: string;
|
|
@@ -248,23 +249,6 @@
|
|
|
248
249
|
if (menuEl?.matches(':popover-open')) menuEl.hidePopover();
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
$effect(() => {
|
|
252
|
-
const btn = triggerEl;
|
|
253
|
-
if (!btn) return;
|
|
254
|
-
const onClick = (event: MouseEvent) => {
|
|
255
|
-
event.stopPropagation();
|
|
256
|
-
if (disabled) return;
|
|
257
|
-
const el = menuEl;
|
|
258
|
-
if (!el) return;
|
|
259
|
-
const isOpen = el.matches(':popover-open');
|
|
260
|
-
setTimeout(() => {
|
|
261
|
-
if (isOpen) closeMenu();
|
|
262
|
-
else openMenu();
|
|
263
|
-
}, 0);
|
|
264
|
-
};
|
|
265
|
-
btn.addEventListener('click', onClick);
|
|
266
|
-
return () => btn.removeEventListener('click', onClick);
|
|
267
|
-
});
|
|
268
252
|
|
|
269
253
|
function handleBeforeToggle(event: ToggleEvent) {
|
|
270
254
|
if (event.newState === 'open') {
|
|
@@ -445,6 +429,9 @@
|
|
|
445
429
|
aria-haspopup="menu"
|
|
446
430
|
aria-expanded={open}
|
|
447
431
|
aria-controls={menuId}
|
|
432
|
+
popovertarget={menuId}
|
|
433
|
+
popovertargetaction="toggle"
|
|
434
|
+
{@attach popoverInvokerToggle(() => menuEl)}
|
|
448
435
|
>
|
|
449
436
|
{#if trigger}
|
|
450
437
|
{@render trigger()}
|
|
@@ -476,7 +463,7 @@
|
|
|
476
463
|
ontoggle={handleToggle}
|
|
477
464
|
onbeforetoggle={handleBeforeToggle}
|
|
478
465
|
onkeydown={onMenuKeydown}
|
|
479
|
-
class="dropdown-menu m-0 rounded-xl border-border bg-surface-elevated p-1.5 shadow-xl inset-auto flex-col
|
|
466
|
+
class="dropdown-menu m-0 rounded-xl border-border bg-surface-elevated p-1.5 shadow-xl inset-auto flex-col border text-left outline-none"
|
|
480
467
|
>
|
|
481
468
|
{#if canGoBack}
|
|
482
469
|
<button
|
|
@@ -607,17 +594,21 @@
|
|
|
607
594
|
</div>
|
|
608
595
|
|
|
609
596
|
<style>
|
|
610
|
-
.dropdown-menu {
|
|
597
|
+
.dropdown-menu[popover] {
|
|
611
598
|
position: fixed;
|
|
599
|
+
inset: unset;
|
|
600
|
+
margin: 0;
|
|
612
601
|
}
|
|
613
602
|
|
|
614
603
|
.dropdown-menu-list {
|
|
615
|
-
|
|
616
|
-
overflow
|
|
604
|
+
/* One axis hidden + the other visible computes to auto (nested scrollbar). */
|
|
605
|
+
overflow: var(--dropdown-scroll, visible);
|
|
617
606
|
overscroll-behavior: contain;
|
|
618
607
|
}
|
|
619
608
|
|
|
620
609
|
.dropdown-menu:popover-open {
|
|
621
610
|
display: flex;
|
|
611
|
+
/* UA popover is overflow:auto — that paints a nested scrollbar. */
|
|
612
|
+
overflow: hidden;
|
|
622
613
|
}
|
|
623
614
|
</style>
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
passthrough?: boolean;
|
|
25
25
|
/** Synthetic resolved widget child — not directly editable. */
|
|
26
26
|
readOnly?: boolean;
|
|
27
|
-
/** Parent is a layout box (hBox/vBox/…) — no free drag
|
|
27
|
+
/** Parent is a layout box (hBox/vBox/…) — no free drag. */
|
|
28
|
+
layoutPositionLocked?: boolean;
|
|
29
|
+
/** Parent owns child size (grid / scaleBox) — no free resize. */
|
|
30
|
+
layoutSizeLocked?: boolean;
|
|
31
|
+
/** @deprecated use layoutPositionLocked */
|
|
28
32
|
layoutLocked?: boolean;
|
|
29
33
|
class?: string;
|
|
30
34
|
onclick?: (e: MouseEvent) => void;
|
|
@@ -43,6 +47,8 @@
|
|
|
43
47
|
selected = false,
|
|
44
48
|
passthrough = false,
|
|
45
49
|
readOnly = false,
|
|
50
|
+
layoutPositionLocked = false,
|
|
51
|
+
layoutSizeLocked = false,
|
|
46
52
|
layoutLocked = false,
|
|
47
53
|
class: className = '',
|
|
48
54
|
onclick,
|
|
@@ -52,6 +58,8 @@
|
|
|
52
58
|
}: MediaLayerItemProps = $props();
|
|
53
59
|
|
|
54
60
|
const pos = $derived(displayRect ?? layer.rect);
|
|
61
|
+
const noDrag = $derived(layoutPositionLocked || layoutLocked);
|
|
62
|
+
const noResize = $derived(layoutSizeLocked || layoutLocked);
|
|
55
63
|
let rect = $state<WidgetRect>({ x: 0, y: 0, w: 100, h: 100 });
|
|
56
64
|
let interacting = $state(false);
|
|
57
65
|
|
|
@@ -128,8 +136,8 @@
|
|
|
128
136
|
raiseOnSelect={false}
|
|
129
137
|
stackIndex={stackIndex ?? layer.zIndex}
|
|
130
138
|
transform={paintTransform}
|
|
131
|
-
draggable={!layer.locked && !readOnly && !
|
|
132
|
-
resizable={!layer.locked && !readOnly && !
|
|
139
|
+
draggable={!layer.locked && !readOnly && !noDrag}
|
|
140
|
+
resizable={!layer.locked && !readOnly && !noResize}
|
|
133
141
|
bind:rect
|
|
134
142
|
minW={layer.kind === 'line' || layer.kind === 'arrow' || layer.kind === 'path' ? 16 : 40}
|
|
135
143
|
minH={layer.kind === 'line' ? 4 : layer.kind === 'arrow' || layer.kind === 'path' ? 16 : 24}
|
|
@@ -19,7 +19,11 @@ interface MediaLayerItemProps {
|
|
|
19
19
|
passthrough?: boolean;
|
|
20
20
|
/** Synthetic resolved widget child — not directly editable. */
|
|
21
21
|
readOnly?: boolean;
|
|
22
|
-
/** Parent is a layout box (hBox/vBox/…) — no free drag
|
|
22
|
+
/** Parent is a layout box (hBox/vBox/…) — no free drag. */
|
|
23
|
+
layoutPositionLocked?: boolean;
|
|
24
|
+
/** Parent owns child size (grid / scaleBox) — no free resize. */
|
|
25
|
+
layoutSizeLocked?: boolean;
|
|
26
|
+
/** @deprecated use layoutPositionLocked */
|
|
23
27
|
layoutLocked?: boolean;
|
|
24
28
|
class?: string;
|
|
25
29
|
onclick?: (e: MouseEvent) => void;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
type CanvasElementDef
|
|
8
8
|
} from '../CanvasElementsPanel/CanvasElementsPanel.svelte';
|
|
9
9
|
import type { CanvasLayerKind } from '../../../utils/canvasDocument.js';
|
|
10
|
-
import { isContainerKind } from '../../../utils/canvasHierarchy.js';
|
|
10
|
+
import { isContainerKind, isEffectivelyLocked } from '../../../utils/canvasHierarchy.js';
|
|
11
11
|
import Eye from '@lucide/svelte/icons/eye';
|
|
12
12
|
import EyeOff from '@lucide/svelte/icons/eye-off';
|
|
13
13
|
import Lock from '@lucide/svelte/icons/lock';
|
|
@@ -63,6 +63,26 @@
|
|
|
63
63
|
|
|
64
64
|
const activeIds = $derived(selectedIds ?? (selectedId ? [selectedId] : []));
|
|
65
65
|
const activeSet = $derived(new Set(activeIds));
|
|
66
|
+
const ancestorOfSelection = $derived.by(() => {
|
|
67
|
+
const map = new Map(layers.map((l) => [l.id, l]));
|
|
68
|
+
const out = new Set<string>();
|
|
69
|
+
for (const id of activeIds) {
|
|
70
|
+
let cur = map.get(id);
|
|
71
|
+
while (cur?.parentId) {
|
|
72
|
+
out.add(cur.parentId);
|
|
73
|
+
cur = map.get(cur.parentId);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
});
|
|
78
|
+
const inheritedLocked = $derived.by(() => {
|
|
79
|
+
const map = new Map(layers.map((l) => [l.id, l]));
|
|
80
|
+
const out = new Set<string>();
|
|
81
|
+
for (const l of layers) {
|
|
82
|
+
if (!l.locked && isEffectivelyLocked(layers, l.id, map)) out.add(l.id);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
});
|
|
66
86
|
|
|
67
87
|
let dragId = $state<string | null>(null);
|
|
68
88
|
let dropTargetId = $state<string | null>(null);
|
|
@@ -260,7 +280,9 @@
|
|
|
260
280
|
'flex w-full items-center gap-0.5 rounded-md px-1 py-1 text-left text-xs transition-colors',
|
|
261
281
|
activeSet.has(layer.id)
|
|
262
282
|
? 'bg-brand-500/15 text-primary'
|
|
263
|
-
|
|
283
|
+
: ancestorOfSelection.has(layer.id)
|
|
284
|
+
? 'bg-brand-500/10 text-primary ring-1 ring-inset ring-brand-500/35'
|
|
285
|
+
: 'text-secondary hover:bg-surface-overlay hover:text-primary',
|
|
264
286
|
dragId === layer.id && 'opacity-50',
|
|
265
287
|
nesting && 'ring-1 ring-brand-500 bg-brand-500/10'
|
|
266
288
|
]}
|
|
@@ -378,14 +400,19 @@
|
|
|
378
400
|
{/if}
|
|
379
401
|
</IconButton>
|
|
380
402
|
<IconButton
|
|
381
|
-
label={layer.locked
|
|
403
|
+
label={layer.locked
|
|
404
|
+
? 'Unlock'
|
|
405
|
+
: inheritedLocked.has(layer.id)
|
|
406
|
+
? 'Locked by parent'
|
|
407
|
+
: 'Lock'}
|
|
382
408
|
size="xs"
|
|
409
|
+
disabled={inheritedLocked.has(layer.id)}
|
|
383
410
|
onclick={(e) => {
|
|
384
411
|
e.stopPropagation();
|
|
385
412
|
ontogglelocked?.(layer.id);
|
|
386
413
|
}}
|
|
387
414
|
>
|
|
388
|
-
{#if layer.locked}
|
|
415
|
+
{#if layer.locked || inheritedLocked.has(layer.id)}
|
|
389
416
|
<Lock class="h-3.5 w-3.5" />
|
|
390
417
|
{:else}
|
|
391
418
|
<LockOpen class="h-3.5 w-3.5" />
|