@grafloria/element 0.4.51 → 0.4.53
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/package.json +2 -2
- package/src/lib/dashboard-kit/commit.d.ts +82 -0
- package/src/lib/dashboard-kit/commit.js +121 -0
- package/src/lib/dashboard-kit/dashboard.d.ts +1 -1
- package/src/lib/dashboard-kit/grid-binder.d.ts +35 -42
- package/src/lib/dashboard-kit/grid-binder.js +403 -525
- package/src/lib/dashboard-kit/split-binder.js +1 -1
- package/src/lib/dashboard-kit/zones.d.ts +7 -0
- package/src/lib/dashboard-kit/zones.js +12 -6
|
@@ -1358,7 +1358,7 @@ export function bindDashboardSplit(api, group, options = {}) {
|
|
|
1358
1358
|
const cells = cellsFromSplit(after, columns, rowsGuess());
|
|
1359
1359
|
const cell = (_a = cells.get(node.id)) !== null && _a !== void 0 ? _a : { x: 0, y: 0, w: Math.max(1, spec.w), h: Math.max(1, spec.h) };
|
|
1360
1360
|
const displaced = [new SetSplitTreeCommand(group.id, tree, normalizeSplit(after))];
|
|
1361
|
-
void ((_b = options.onDropIn) === null || _b === void 0 ? void 0 : _b.call(options, node, cell, displaced));
|
|
1361
|
+
void ((_b = options.onDropIn) === null || _b === void 0 ? void 0 : _b.call(options, node, cell, displaced, { boardId: group.id }));
|
|
1362
1362
|
fire({ type: 'drop-in', kind: 'palette', nodeId: node.id, changed: true });
|
|
1363
1363
|
};
|
|
1364
1364
|
window.addEventListener('pointermove', onMove, true);
|
|
@@ -81,6 +81,13 @@ export interface ResolveInput {
|
|
|
81
81
|
ghostSubtree: ReadonlySet<string>;
|
|
82
82
|
/** The board's gap, the tolerance around the vacated cell. */
|
|
83
83
|
gap: number;
|
|
84
|
+
/**
|
|
85
|
+
* The containers the dragged tile's OWN board sits in, innermost first or
|
|
86
|
+
* in any order: their bands do not apply to it. A widget leaving its page
|
|
87
|
+
* through the page's left fifth is moving within the page, not asking to
|
|
88
|
+
* be put beside the container it is still inside.
|
|
89
|
+
*/
|
|
90
|
+
homeChain: ReadonlySet<string>;
|
|
84
91
|
}
|
|
85
92
|
export type Zone = {
|
|
86
93
|
kind: 'off';
|
|
@@ -106,22 +106,28 @@ export function resolve(input) {
|
|
|
106
106
|
const px = x + dx;
|
|
107
107
|
const py = y + dy;
|
|
108
108
|
for (const c of board.children()) {
|
|
109
|
-
|
|
109
|
+
// the held container at rest — unless the hand has left that frame for the live one
|
|
110
|
+
const atRest = held && c.id === held.containerId && inRect(held.frame0, x, y) ? held.frame0 : null;
|
|
110
111
|
const frame = atRest !== null && atRest !== void 0 ? atRest : c.frame;
|
|
111
112
|
const tx = atRest ? x : px;
|
|
112
113
|
const ty = atRest ? y : py;
|
|
113
114
|
if (!inRect(frame, tx, ty))
|
|
114
115
|
continue;
|
|
115
|
-
|
|
116
|
+
// A band does not reach THROUGH a nested container: a hand over a
|
|
117
|
+
// section inside the page is inside the page, wherever the outer
|
|
118
|
+
// container's fifth falls (the inset margin is what remains of the
|
|
119
|
+
// band there). The page's plain widgets do not stop it.
|
|
120
|
+
const ndx0 = atRest ? c.frame.x - atRest.x : dx;
|
|
121
|
+
const ndy0 = atRest ? c.frame.y - atRest.y : dy;
|
|
122
|
+
const overNested = !!c.inner && c.inner.children().some((cc) => inRect(cc.frame, x + ndx0, y + ndy0));
|
|
123
|
+
const side = overNested || input.homeChain.has(c.id) ? null : bandOf(frame, c.stripHeight, tx, ty, c.band);
|
|
116
124
|
if (side)
|
|
117
125
|
return { kind: 'beside', board, containerId: c.id, side, kept: false };
|
|
118
126
|
if (opaque(board, c) || !c.inner)
|
|
119
127
|
return { kind: 'plain', board, grace: false };
|
|
120
|
-
|
|
121
|
-
const ndy = atRest ? c.frame.y - atRest.y : dy;
|
|
122
|
-
if (!c.inner.contains(x + ndx, y + ndy))
|
|
128
|
+
if (!c.inner.contains(x + ndx0, y + ndy0))
|
|
123
129
|
return { kind: 'plain', board, grace: false }; // the margin: the container's own frame
|
|
124
|
-
return descend(c.inner,
|
|
130
|
+
return descend(c.inner, ndx0, ndy0);
|
|
125
131
|
}
|
|
126
132
|
return { kind: 'plain', board, grace: false };
|
|
127
133
|
};
|