@r2digisolutions/components 0.21.2 → 0.21.3
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/molecules/MediaStage/MediaStage.svelte +10 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/canvasHierarchy.d.ts +2 -0
- package/dist/utils/canvasHierarchy.js +3 -0
- package/dist/utils/marqueeSelect.d.ts +2 -0
- package/dist/utils/marqueeSelect.js +32 -7
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
} from '../WidgetCanvas/widgetCanvasContext.js';
|
|
14
14
|
import {
|
|
15
15
|
attachMarqueeSelect,
|
|
16
|
+
mergeMarqueeItemsById,
|
|
16
17
|
resolveMarqueeSelection,
|
|
17
18
|
type MarqueeRect as MarqueeBox
|
|
18
19
|
} from '../../../utils/marqueeSelect.js';
|
|
@@ -473,13 +474,10 @@
|
|
|
473
474
|
selectionLive = rect;
|
|
474
475
|
if (!selectionBaseLayers || !selectionBaseBox) return;
|
|
475
476
|
commitGroupGeometry(
|
|
476
|
-
scaleSelectionAbsolute(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
rect,
|
|
481
|
-
{ width: doc.width, height: doc.height }
|
|
482
|
-
)
|
|
477
|
+
scaleSelectionAbsolute(selectionBaseLayers, selectedIds, selectionBaseBox, rect, {
|
|
478
|
+
width: doc.width,
|
|
479
|
+
height: doc.height
|
|
480
|
+
})
|
|
483
481
|
);
|
|
484
482
|
}
|
|
485
483
|
|
|
@@ -563,16 +561,12 @@
|
|
|
563
561
|
const originX = aRect.left - vRect.left + viewportEl.scrollLeft;
|
|
564
562
|
const originY = aRect.top - vRect.top + viewportEl.scrollTop;
|
|
565
563
|
const s = scale;
|
|
566
|
-
|
|
564
|
+
const items = sorted
|
|
567
565
|
.filter((l) => {
|
|
568
|
-
if (
|
|
569
|
-
!effectivelyVisible.has(l.id) ||
|
|
570
|
-
isEffectivelyLocked(workingLayers, l.id, workingById)
|
|
571
|
-
) {
|
|
572
|
-
return false;
|
|
573
|
-
}
|
|
566
|
+
if (!effectivelyVisible.has(l.id)) return false;
|
|
574
567
|
const realId = resolveSelectableId(l.id);
|
|
575
568
|
if (!sceneLayerIds.has(realId)) return false;
|
|
569
|
+
if (isEffectivelyLocked(workingLayers, realId, workingById)) return false;
|
|
576
570
|
// Don't always rubber-band-select the full-bleed root panel.
|
|
577
571
|
const scene = workingLayers.find((x) => x.id === realId);
|
|
578
572
|
if (scene?.kind === 'canvasPanel') return false;
|
|
@@ -588,6 +582,8 @@
|
|
|
588
582
|
height: r.h * s
|
|
589
583
|
};
|
|
590
584
|
});
|
|
585
|
+
// Flattened widgets emit host + synthetic children with the same selectable id.
|
|
586
|
+
return mergeMarqueeItemsById(items);
|
|
591
587
|
}
|
|
592
588
|
|
|
593
589
|
function clientToDoc(clientX: number, clientY: number) {
|
package/dist/index.d.ts
CHANGED
|
@@ -842,7 +842,7 @@ export type { VisibilityState } from './utils/pageVisibility.svelte.js';
|
|
|
842
842
|
export { network } from './utils/network.svelte.js';
|
|
843
843
|
export { DEFAULT_COLS, DEFAULT_ROW_HEIGHT, DEFAULT_GAP, GRID_DENSITY, clampItem, rectsOverlap, findCollisions, resolveCollisions, compactLayout, updateItem, addItem, removeItem, serializeLayout, parseLayout, layoutBounds, rescaleLayout, resizeItemByEdge } from './utils/layoutGrid.js';
|
|
844
844
|
export type { GridItem, LayoutGridOptions, GridDensity, GridResizeEdge } from './utils/layoutGrid.js';
|
|
845
|
-
export { attachMarqueeSelect, collectMarqueeItems, defaultMarqueeIgnore, getMarqueeModifier, hitTestIds, normalizeRect, rectsIntersect, resolveMarqueeSelection } from './utils/marqueeSelect.js';
|
|
845
|
+
export { attachMarqueeSelect, collectMarqueeItems, defaultMarqueeIgnore, getMarqueeModifier, hitTestIds, mergeMarqueeItemsById, normalizeRect, rectsIntersect, resolveMarqueeSelection } from './utils/marqueeSelect.js';
|
|
846
846
|
export type { AttachMarqueeSelectOptions, MarqueeDragState, MarqueeItemRect, MarqueeModifier, MarqueeRect as MarqueeRectBox } from './utils/marqueeSelect.js';
|
|
847
847
|
export { encodeQR, qrToSvgPath, punchLogoHole } from './utils/qr.js';
|
|
848
848
|
export { renderMarkdown, renderInline, escapeHtml, splitTableRow, slugifyHeading } from './utils/markdown.js';
|
package/dist/index.js
CHANGED
|
@@ -573,7 +573,7 @@ export { resolveAccessor, accessorPatchKey, resolveRowKey } from './utils/column
|
|
|
573
573
|
export { pageVisibility } from './utils/pageVisibility.svelte.js';
|
|
574
574
|
export { network } from './utils/network.svelte.js';
|
|
575
575
|
export { DEFAULT_COLS, DEFAULT_ROW_HEIGHT, DEFAULT_GAP, GRID_DENSITY, clampItem, rectsOverlap, findCollisions, resolveCollisions, compactLayout, updateItem, addItem, removeItem, serializeLayout, parseLayout, layoutBounds, rescaleLayout, resizeItemByEdge } from './utils/layoutGrid.js';
|
|
576
|
-
export { attachMarqueeSelect, collectMarqueeItems, defaultMarqueeIgnore, getMarqueeModifier, hitTestIds, normalizeRect, rectsIntersect, resolveMarqueeSelection } from './utils/marqueeSelect.js';
|
|
576
|
+
export { attachMarqueeSelect, collectMarqueeItems, defaultMarqueeIgnore, getMarqueeModifier, hitTestIds, mergeMarqueeItemsById, normalizeRect, rectsIntersect, resolveMarqueeSelection } from './utils/marqueeSelect.js';
|
|
577
577
|
export { encodeQR, qrToSvgPath, punchLogoHole } from './utils/qr.js';
|
|
578
578
|
export { renderMarkdown, renderInline, escapeHtml, splitTableRow, slugifyHeading } from './utils/markdown.js';
|
|
579
579
|
export { diffLines, diffWords, diffStats, toSplitRows } from './utils/diff.js';
|
|
@@ -9,6 +9,8 @@ export declare const LAYOUT_SIZE_KINDS: ReadonlySet<CanvasLayerKind>;
|
|
|
9
9
|
* Structural shells whose empty area should start a marquee (not a layer drag),
|
|
10
10
|
* matching Figma-style select-drag on the canvas / inside frames.
|
|
11
11
|
* Groups are omitted: they behave like a single object (click/drag the group).
|
|
12
|
+
* Widgets pass when unselected so flattened instance bounds don't eat rubber-band;
|
|
13
|
+
* a selected widget still drag-moves.
|
|
12
14
|
*/
|
|
13
15
|
export declare const MARQUEE_PASS_KINDS: ReadonlySet<CanvasLayerKind>;
|
|
14
16
|
export declare function isContainerKind(kind: CanvasLayerKind): boolean;
|
|
@@ -40,10 +40,13 @@ export const LAYOUT_SIZE_KINDS = new Set(['uniformGrid', 'scaleBox']);
|
|
|
40
40
|
* Structural shells whose empty area should start a marquee (not a layer drag),
|
|
41
41
|
* matching Figma-style select-drag on the canvas / inside frames.
|
|
42
42
|
* Groups are omitted: they behave like a single object (click/drag the group).
|
|
43
|
+
* Widgets pass when unselected so flattened instance bounds don't eat rubber-band;
|
|
44
|
+
* a selected widget still drag-moves.
|
|
43
45
|
*/
|
|
44
46
|
export const MARQUEE_PASS_KINDS = new Set([
|
|
45
47
|
'canvasPanel',
|
|
46
48
|
'overlay',
|
|
49
|
+
'widget',
|
|
47
50
|
...LAYOUT_BOX_KINDS
|
|
48
51
|
]);
|
|
49
52
|
export function isContainerKind(kind) {
|
|
@@ -36,6 +36,8 @@ export interface AttachMarqueeSelectOptions {
|
|
|
36
36
|
export declare function normalizeRect(x0: number, y0: number, x1: number, y1: number): MarqueeRect;
|
|
37
37
|
export declare function rectsIntersect(a: MarqueeRect, b: MarqueeRect): boolean;
|
|
38
38
|
export declare function hitTestIds(marquee: MarqueeRect, items: MarqueeItemRect[]): string[];
|
|
39
|
+
/** Collapse duplicate ids (e.g. widget host + synthetic children) into one union box. */
|
|
40
|
+
export declare function mergeMarqueeItemsById(items: MarqueeItemRect[]): MarqueeItemRect[];
|
|
39
41
|
export declare function getMarqueeModifier(e: Pick<PointerEvent, 'shiftKey' | 'metaKey' | 'ctrlKey'>): MarqueeModifier;
|
|
40
42
|
export declare function resolveMarqueeSelection(hitIds: string[], previousIds: string[], modifier: MarqueeModifier): string[];
|
|
41
43
|
/** Collect `[data-marquee-id]` children in container-local (incl. scroll) coordinates. */
|
|
@@ -9,19 +9,44 @@ export function normalizeRect(x0, y0, x1, y1) {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export function rectsIntersect(a, b) {
|
|
12
|
-
return
|
|
13
|
-
a.x + a.width > b.x &&
|
|
14
|
-
a.y < b.y + b.height &&
|
|
15
|
-
a.y + a.height > b.y);
|
|
12
|
+
return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
|
|
16
13
|
}
|
|
17
14
|
export function hitTestIds(marquee, items) {
|
|
18
15
|
const ids = [];
|
|
16
|
+
const seen = new Set();
|
|
19
17
|
for (const item of items) {
|
|
20
|
-
if (rectsIntersect(marquee, item))
|
|
21
|
-
|
|
18
|
+
if (!rectsIntersect(marquee, item))
|
|
19
|
+
continue;
|
|
20
|
+
if (seen.has(item.id))
|
|
21
|
+
continue;
|
|
22
|
+
seen.add(item.id);
|
|
23
|
+
ids.push(item.id);
|
|
22
24
|
}
|
|
23
25
|
return ids;
|
|
24
26
|
}
|
|
27
|
+
/** Collapse duplicate ids (e.g. widget host + synthetic children) into one union box. */
|
|
28
|
+
export function mergeMarqueeItemsById(items) {
|
|
29
|
+
const map = new Map();
|
|
30
|
+
for (const item of items) {
|
|
31
|
+
const prev = map.get(item.id);
|
|
32
|
+
if (!prev) {
|
|
33
|
+
map.set(item.id, item);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const left = Math.min(prev.x, item.x);
|
|
37
|
+
const top = Math.min(prev.y, item.y);
|
|
38
|
+
const right = Math.max(prev.x + prev.width, item.x + item.width);
|
|
39
|
+
const bottom = Math.max(prev.y + prev.height, item.y + item.height);
|
|
40
|
+
map.set(item.id, {
|
|
41
|
+
id: item.id,
|
|
42
|
+
x: left,
|
|
43
|
+
y: top,
|
|
44
|
+
width: right - left,
|
|
45
|
+
height: bottom - top
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return [...map.values()];
|
|
49
|
+
}
|
|
25
50
|
export function getMarqueeModifier(e) {
|
|
26
51
|
if (e.metaKey || e.ctrlKey)
|
|
27
52
|
return 'toggle';
|
|
@@ -31,7 +56,7 @@ export function getMarqueeModifier(e) {
|
|
|
31
56
|
}
|
|
32
57
|
export function resolveMarqueeSelection(hitIds, previousIds, modifier) {
|
|
33
58
|
if (modifier === 'replace')
|
|
34
|
-
return [...hitIds];
|
|
59
|
+
return [...new Set(hitIds)];
|
|
35
60
|
if (modifier === 'add')
|
|
36
61
|
return [...new Set([...previousIds, ...hitIds])];
|
|
37
62
|
const set = new Set(previousIds);
|