@aglyn/besigner-ui 1.0.0-beta.274 → 1.0.0-beta.277

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 (65) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/app-bar-breadcrumbs.component.js +4 -2
  3. package/src/lib/components/app-bar-breadcrumbs.component.js.map +1 -1
  4. package/src/lib/components/aside-panel.component.js +19 -3
  5. package/src/lib/components/aside-panel.component.js.map +1 -1
  6. package/src/lib/components/besigner-dnd-context.component.js +46 -5
  7. package/src/lib/components/besigner-dnd-context.component.js.map +1 -1
  8. package/src/lib/components/dnd/canvas-drop-indicator.d.ts +11 -0
  9. package/src/lib/components/dnd/canvas-drop-indicator.js +32 -34
  10. package/src/lib/components/dnd/canvas-drop-indicator.js.map +1 -1
  11. package/src/lib/components/dnd/draggable-droppable.js +124 -23
  12. package/src/lib/components/dnd/draggable-droppable.js.map +1 -1
  13. package/src/lib/components/dnd/drop-indicator-geometry.d.ts +64 -0
  14. package/src/lib/components/dnd/drop-indicator-geometry.js +77 -0
  15. package/src/lib/components/dnd/drop-indicator-geometry.js.map +1 -0
  16. package/src/lib/components/dnd/drop-indicator.d.ts +13 -11
  17. package/src/lib/components/dnd/drop-indicator.js +52 -63
  18. package/src/lib/components/dnd/drop-indicator.js.map +1 -1
  19. package/src/lib/components/dnd/drop-surface.d.ts +91 -0
  20. package/src/lib/components/dnd/drop-surface.js +172 -0
  21. package/src/lib/components/dnd/drop-surface.js.map +1 -0
  22. package/src/lib/components/dnd/drop-targeting.d.ts +94 -0
  23. package/src/lib/components/dnd/drop-targeting.js +184 -0
  24. package/src/lib/components/dnd/drop-targeting.js.map +1 -0
  25. package/src/lib/components/element-interactions-form.component.js +5 -9
  26. package/src/lib/components/element-interactions-form.component.js.map +1 -1
  27. package/src/lib/components/element-props-form.component.js +0 -4
  28. package/src/lib/components/element-props-form.component.js.map +1 -1
  29. package/src/lib/components/layout-part-menu.component.d.ts +65 -0
  30. package/src/lib/components/layout-part-menu.component.js +151 -0
  31. package/src/lib/components/layout-part-menu.component.js.map +1 -0
  32. package/src/lib/components/layout-style-picker.component.d.ts +2 -0
  33. package/src/lib/components/layout-style-picker.component.js +2 -2
  34. package/src/lib/components/layout-style-picker.component.js.map +1 -1
  35. package/src/lib/components/node-context-menu.js +8 -0
  36. package/src/lib/components/node-context-menu.js.map +1 -1
  37. package/src/lib/components/node-leaf.js +50 -19
  38. package/src/lib/components/node-leaf.js.map +1 -1
  39. package/src/lib/components/node-overlay.js +61 -21
  40. package/src/lib/components/node-overlay.js.map +1 -1
  41. package/src/lib/components/node-quick-actions.js +40 -23
  42. package/src/lib/components/node-quick-actions.js.map +1 -1
  43. package/src/lib/components/node-tree-view.d.ts +2 -0
  44. package/src/lib/components/node-tree-view.js +16 -4
  45. package/src/lib/components/node-tree-view.js.map +1 -1
  46. package/src/lib/components/viewport-canvas.component.js +3 -1
  47. package/src/lib/components/viewport-canvas.component.js.map +1 -1
  48. package/src/lib/components/viewport-frame.component.js +27 -1
  49. package/src/lib/components/viewport-frame.component.js.map +1 -1
  50. package/src/lib/components/workspace-editor.component.js +43 -22
  51. package/src/lib/components/workspace-editor.component.js.map +1 -1
  52. package/src/lib/contexts/layout-chrome-context.d.ts +10 -0
  53. package/src/lib/contexts/layout-chrome-context.js.map +1 -1
  54. package/src/lib/hooks/use-leaf-drop.d.ts +7 -1
  55. package/src/lib/hooks/use-leaf-drop.js +11 -5
  56. package/src/lib/hooks/use-leaf-drop.js.map +1 -1
  57. package/src/lib/hooks/use-preview-repeats.d.ts +22 -0
  58. package/src/lib/hooks/use-preview-repeats.js +91 -0
  59. package/src/lib/hooks/use-preview-repeats.js.map +1 -0
  60. package/src/lib/utils/repeat-copy.d.ts +36 -0
  61. package/src/lib/utils/repeat-copy.js +51 -0
  62. package/src/lib/utils/repeat-copy.js.map +1 -0
  63. package/src/lib/utils/touch-keyboard.d.ts +41 -0
  64. package/src/lib/utils/touch-keyboard.js +72 -0
  65. package/src/lib/utils/touch-keyboard.js.map +1 -0
@@ -0,0 +1,172 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * The places a drop target can live. Each is one element in the designer,
18
+ * marked with {@link DROP_SURFACE_ATTRIBUTE}, and a drop only ever resolves
19
+ * against targets on the surface the pointer is actually over.
20
+ *
21
+ * That last part is the reason this exists. dnd-kit hit-tests rectangles, and
22
+ * a rectangle knows nothing about what is painted on top of it: a canvas
23
+ * element scrolled under the hierarchy panel, or under the app bar, still
24
+ * "contains" the pointer. So a row being dragged through the hierarchy could
25
+ * resolve against a canvas element nobody could see, and the marker jumped to
26
+ * wherever that element's edge was.
27
+ */ export var DropSurface = /*#__PURE__*/ function(DropSurface) {
28
+ DropSurface["CANVAS"] = "canvas";
29
+ DropSurface["TREE"] = "tree";
30
+ DropSurface["BREADCRUMBS"] = "breadcrumbs";
31
+ return DropSurface;
32
+ }({});
33
+ export const DROP_SURFACE_ATTRIBUTE = 'data-aglyn-drop-surface';
34
+ const SURFACE_SELECTOR = `[${DROP_SURFACE_ATTRIBUTE}]`;
35
+ /** Props that mark an element as a drop surface. */ export function dropSurfaceProps(surface) {
36
+ return {
37
+ [DROP_SURFACE_ATTRIBUTE]: surface
38
+ };
39
+ }
40
+ /**
41
+ * The surface an element sits on, climbing out of shadow roots: every canvas
42
+ * element lives inside the canvas's closed shadow root, and `closest` stops at
43
+ * a shadow boundary.
44
+ */ export function closestDropSurface(node) {
45
+ let current = node != null ? node : null;
46
+ while(current){
47
+ if (current instanceof Element) {
48
+ const surface = current.closest(SURFACE_SELECTOR);
49
+ if (surface) return surface;
50
+ }
51
+ const root = current.getRootNode == null ? void 0 : current.getRootNode.call(current);
52
+ current = typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root.host : null;
53
+ }
54
+ return null;
55
+ }
56
+ /**
57
+ * The surface painted at a viewport point: `null` when the pointer is over
58
+ * something that is not one (the app bar, the attributes panel), `undefined`
59
+ * when this document cannot hit-test at all, in which case nothing is ruled
60
+ * out on these grounds.
61
+ */ export function dropSurfaceAtPoint(x, y, doc = typeof document === 'undefined' ? undefined : document) {
62
+ if (typeof (doc == null ? void 0 : doc.elementFromPoint) !== 'function') return undefined;
63
+ return closestDropSurface(doc.elementFromPoint(x, y));
64
+ }
65
+ const CLIPPING_OVERFLOW = /hidden|clip|auto|scroll/;
66
+ /**
67
+ * The part of an element that is actually on screen: its rectangle cut down
68
+ * by every ancestor that clips its overflow. The marker is drawn in a portal
69
+ * above everything, so without this a line along a canvas element that runs
70
+ * under a side panel is drawn across the panel.
71
+ */ export function visibleRectOf(element) {
72
+ if (!element) return null;
73
+ const own = element.getBoundingClientRect();
74
+ let left = own.left;
75
+ let top = own.top;
76
+ let right = own.right;
77
+ let bottom = own.bottom;
78
+ let current = element.parentNode;
79
+ while(current){
80
+ if (current instanceof Element) {
81
+ const style = getComputedStyle(current);
82
+ if ([
83
+ style.overflow,
84
+ style.overflowX,
85
+ style.overflowY
86
+ ].some((value)=>CLIPPING_OVERFLOW.test(value))) {
87
+ const clip = current.getBoundingClientRect();
88
+ left = Math.max(left, clip.left);
89
+ top = Math.max(top, clip.top);
90
+ right = Math.min(right, clip.right);
91
+ bottom = Math.min(bottom, clip.bottom);
92
+ }
93
+ current = current.parentNode;
94
+ } else if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
95
+ current = current.host;
96
+ } else {
97
+ current = null;
98
+ }
99
+ }
100
+ return {
101
+ left,
102
+ top,
103
+ right,
104
+ bottom,
105
+ width: Math.max(0, right - left),
106
+ height: Math.max(0, bottom - top)
107
+ };
108
+ }
109
+ /**
110
+ * The visible rectangle of the named surface that holds `rect`. There is one
111
+ * of each per designer today, but a second hierarchy would be picked by where
112
+ * the target is rather than by document order.
113
+ */ export function visibleSurfaceRect(surface, rect) {
114
+ var _candidates_find;
115
+ if (!surface || typeof document === 'undefined') return null;
116
+ const candidates = Array.from(document.querySelectorAll(`[${DROP_SURFACE_ATTRIBUTE}="${surface}"]`));
117
+ const cx = rect.left + rect.width / 2;
118
+ const cy = rect.top + rect.height / 2;
119
+ const holding = (_candidates_find = candidates.find((element)=>{
120
+ const box = element.getBoundingClientRect();
121
+ return cx >= box.left && cx <= box.right && cy >= box.top && cy <= box.bottom;
122
+ })) != null ? _candidates_find : candidates[0];
123
+ return visibleRectOf(holding);
124
+ }
125
+ /** Box of an element worth comparing against, or null when it takes no space. */ function boxOf(element) {
126
+ if (!element) return null;
127
+ const box = element.getBoundingClientRect();
128
+ return box.width > 0 || box.height > 0 ? box : null;
129
+ }
130
+ /**
131
+ * Which way the siblings of a canvas element run, read off the page rather
132
+ * than the schema: a Stack can be a row or a column, a Grid wraps, and a
133
+ * component can lay its children out any way it likes.
134
+ *
135
+ * The neighbours answer first. A sibling BESIDE this element (sharing some of
136
+ * its height, none of its width) means a row; one above or below means a
137
+ * column. Wrapped rows put the previous item on the line above, which is why
138
+ * beside wins whenever either neighbour says so. With no neighbour to ask —
139
+ * an only child — the parent's declared layout decides.
140
+ */ export function flowAxisOf(element) {
141
+ if (!element) return 'vertical';
142
+ const own = boxOf(element);
143
+ let stacked = false;
144
+ if (own) {
145
+ for (const sibling of [
146
+ element.previousElementSibling,
147
+ element.nextElementSibling
148
+ ]){
149
+ const other = boxOf(sibling);
150
+ if (!other) continue;
151
+ const sharedHeight = Math.min(own.bottom, other.bottom) - Math.max(own.top, other.top);
152
+ const sharedWidth = Math.min(own.right, other.right) - Math.max(own.left, other.left);
153
+ if (sharedHeight > 0 && sharedWidth <= 0) return 'horizontal';
154
+ if (sharedWidth > 0 && sharedHeight <= 0) stacked = true;
155
+ }
156
+ }
157
+ if (stacked) return 'vertical';
158
+ const parent = element.parentElement;
159
+ if (parent) {
160
+ const layout = getComputedStyle(parent);
161
+ if (layout.display.includes('flex')) {
162
+ return layout.flexDirection.startsWith('row') ? 'horizontal' : 'vertical';
163
+ }
164
+ if (layout.display.includes('grid')) {
165
+ const columns = layout.gridTemplateColumns.split(' ').filter((track)=>track && track !== 'none');
166
+ return columns.length > 1 ? 'horizontal' : 'vertical';
167
+ }
168
+ }
169
+ return getComputedStyle(element).display.startsWith('inline') ? 'horizontal' : 'vertical';
170
+ }
171
+
172
+ //# sourceMappingURL=drop-surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/besigner/feature/designer/src/lib/components/dnd/drop-surface.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DropAxis, DroppableClientRect } from '@aglyn/besigner'\n\n/**\n * The places a drop target can live. Each is one element in the designer,\n * marked with {@link DROP_SURFACE_ATTRIBUTE}, and a drop only ever resolves\n * against targets on the surface the pointer is actually over.\n *\n * That last part is the reason this exists. dnd-kit hit-tests rectangles, and\n * a rectangle knows nothing about what is painted on top of it: a canvas\n * element scrolled under the hierarchy panel, or under the app bar, still\n * \"contains\" the pointer. So a row being dragged through the hierarchy could\n * resolve against a canvas element nobody could see, and the marker jumped to\n * wherever that element's edge was.\n */\nexport enum DropSurface {\n CANVAS = 'canvas',\n TREE = 'tree',\n BREADCRUMBS = 'breadcrumbs',\n}\n\nexport const DROP_SURFACE_ATTRIBUTE = 'data-aglyn-drop-surface'\n\nconst SURFACE_SELECTOR = `[${DROP_SURFACE_ATTRIBUTE}]`\n\n/** Props that mark an element as a drop surface. */\nexport function dropSurfaceProps(surface: DropSurface) {\n return { [DROP_SURFACE_ATTRIBUTE]: surface }\n}\n\n/**\n * The surface an element sits on, climbing out of shadow roots: every canvas\n * element lives inside the canvas's closed shadow root, and `closest` stops at\n * a shadow boundary.\n */\nexport function closestDropSurface(\n node: Node | null | undefined,\n): Element | null {\n let current: Node | null = node ?? null\n while (current) {\n if (current instanceof Element) {\n const surface = current.closest(SURFACE_SELECTOR)\n if (surface) return surface\n }\n const root = current.getRootNode?.()\n current =\n typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot\n ? root.host\n : null\n }\n return null\n}\n\n/**\n * The surface painted at a viewport point: `null` when the pointer is over\n * something that is not one (the app bar, the attributes panel), `undefined`\n * when this document cannot hit-test at all, in which case nothing is ruled\n * out on these grounds.\n */\nexport function dropSurfaceAtPoint(\n x: number,\n y: number,\n doc: Document | undefined = typeof document === 'undefined'\n ? undefined\n : document,\n): Element | null | undefined {\n if (typeof doc?.elementFromPoint !== 'function') return undefined\n return closestDropSurface(doc.elementFromPoint(x, y))\n}\n\nconst CLIPPING_OVERFLOW = /hidden|clip|auto|scroll/\n\n/**\n * The part of an element that is actually on screen: its rectangle cut down\n * by every ancestor that clips its overflow. The marker is drawn in a portal\n * above everything, so without this a line along a canvas element that runs\n * under a side panel is drawn across the panel.\n */\nexport function visibleRectOf(element: Element | null | undefined) {\n if (!element) return null\n const own = element.getBoundingClientRect()\n let left = own.left\n let top = own.top\n let right = own.right\n let bottom = own.bottom\n let current: Node | null = element.parentNode\n while (current) {\n if (current instanceof Element) {\n const style = getComputedStyle(current)\n if (\n [style.overflow, style.overflowX, style.overflowY].some((value) =>\n CLIPPING_OVERFLOW.test(value),\n )\n ) {\n const clip = current.getBoundingClientRect()\n left = Math.max(left, clip.left)\n top = Math.max(top, clip.top)\n right = Math.min(right, clip.right)\n bottom = Math.min(bottom, clip.bottom)\n }\n current = current.parentNode\n } else if (\n typeof ShadowRoot !== 'undefined' &&\n current instanceof ShadowRoot\n ) {\n current = current.host\n } else {\n current = null\n }\n }\n return {\n left,\n top,\n right,\n bottom,\n width: Math.max(0, right - left),\n height: Math.max(0, bottom - top),\n }\n}\n\n/**\n * The visible rectangle of the named surface that holds `rect`. There is one\n * of each per designer today, but a second hierarchy would be picked by where\n * the target is rather than by document order.\n */\nexport function visibleSurfaceRect(\n surface: DropSurface | undefined,\n rect: DroppableClientRect,\n) {\n if (!surface || typeof document === 'undefined') return null\n const candidates = Array.from(\n document.querySelectorAll(`[${DROP_SURFACE_ATTRIBUTE}=\"${surface}\"]`),\n )\n const cx = rect.left + rect.width / 2\n const cy = rect.top + rect.height / 2\n const holding =\n candidates.find((element) => {\n const box = element.getBoundingClientRect()\n return (\n cx >= box.left && cx <= box.right && cy >= box.top && cy <= box.bottom\n )\n }) ?? candidates[0]\n return visibleRectOf(holding)\n}\n\n/** Box of an element worth comparing against, or null when it takes no space. */\nfunction boxOf(element: Element | null) {\n if (!element) return null\n const box = element.getBoundingClientRect()\n return box.width > 0 || box.height > 0 ? box : null\n}\n\n/**\n * Which way the siblings of a canvas element run, read off the page rather\n * than the schema: a Stack can be a row or a column, a Grid wraps, and a\n * component can lay its children out any way it likes.\n *\n * The neighbours answer first. A sibling BESIDE this element (sharing some of\n * its height, none of its width) means a row; one above or below means a\n * column. Wrapped rows put the previous item on the line above, which is why\n * beside wins whenever either neighbour says so. With no neighbour to ask —\n * an only child — the parent's declared layout decides.\n */\nexport function flowAxisOf(element: Element | null | undefined): DropAxis {\n if (!element) return 'vertical'\n const own = boxOf(element)\n let stacked = false\n if (own) {\n for (const sibling of [\n element.previousElementSibling,\n element.nextElementSibling,\n ]) {\n const other = boxOf(sibling)\n if (!other) continue\n const sharedHeight =\n Math.min(own.bottom, other.bottom) - Math.max(own.top, other.top)\n const sharedWidth =\n Math.min(own.right, other.right) - Math.max(own.left, other.left)\n if (sharedHeight > 0 && sharedWidth <= 0) return 'horizontal'\n if (sharedWidth > 0 && sharedHeight <= 0) stacked = true\n }\n }\n if (stacked) return 'vertical'\n\n const parent = element.parentElement\n if (parent) {\n const layout = getComputedStyle(parent)\n if (layout.display.includes('flex')) {\n return layout.flexDirection.startsWith('row') ? 'horizontal' : 'vertical'\n }\n if (layout.display.includes('grid')) {\n const columns = layout.gridTemplateColumns\n .split(' ')\n .filter((track) => track && track !== 'none')\n return columns.length > 1 ? 'horizontal' : 'vertical'\n }\n }\n return getComputedStyle(element).display.startsWith('inline')\n ? 'horizontal'\n : 'vertical'\n}\n"],"names":["DropSurface","DROP_SURFACE_ATTRIBUTE","SURFACE_SELECTOR","dropSurfaceProps","surface","closestDropSurface","node","current","Element","closest","root","getRootNode","ShadowRoot","host","dropSurfaceAtPoint","x","y","doc","document","undefined","elementFromPoint","CLIPPING_OVERFLOW","visibleRectOf","element","own","getBoundingClientRect","left","top","right","bottom","parentNode","style","getComputedStyle","overflow","overflowX","overflowY","some","value","test","clip","Math","max","min","width","height","visibleSurfaceRect","rect","candidates","Array","from","querySelectorAll","cx","cy","holding","find","box","boxOf","flowAxisOf","stacked","sibling","previousElementSibling","nextElementSibling","other","sharedHeight","sharedWidth","parent","parentElement","layout","display","includes","flexDirection","startsWith","columns","gridTemplateColumns","split","filter","track","length"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID;;;;;;;;;;;CAWC,GACD,OAAO,IAAA,AAAKA,qCAAAA;;;;WAAAA;MAIX;AAED,OAAO,MAAMC,yBAAyB,0BAAyB;AAE/D,MAAMC,mBAAmB,CAAC,CAAC,EAAED,uBAAuB,CAAC,CAAC;AAEtD,kDAAkD,GAClD,OAAO,SAASE,iBAAiBC,OAAoB;IACnD,OAAO;QAAE,CAACH,uBAAuB,EAAEG;IAAQ;AAC7C;AAEA;;;;CAIC,G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,YAChD,eACA;AACN"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type * as Aglyn from '@aglyn/aglyn';
18
+ import { type DropAxis, type DroppableClientRect, DragType, DropRegion } from '@aglyn/besigner';
19
+ import { type CollisionDetection, type Over } from '@dnd-kit/core';
20
+ import type { DropIndicatorInset } from './drop-indicator-geometry';
21
+ import { DropSurface } from './drop-surface';
22
+ /** What a besigner droppable carries in its dnd-kit `data`. */
23
+ export interface DropTargetData {
24
+ node?: Aglyn.NodeSchema<any>;
25
+ type?: DragType;
26
+ accept?: DragType[];
27
+ surface?: DropSurface;
28
+ /** The element as it is drawn now; read live rather than from a cache. */
29
+ getElement?: () => Element | null;
30
+ /** How far in from the target's left edge a hierarchy row's label sits. */
31
+ inset?: DropIndicatorInset;
32
+ /** A hierarchy row whose children are showing beneath it. */
33
+ expanded?: boolean;
34
+ }
35
+ type Point = {
36
+ x: number;
37
+ y: number;
38
+ };
39
+ /**
40
+ * dnd-kit's `pointerWithin`, minus the three ways it picked a target the
41
+ * author could not see.
42
+ *
43
+ * 1. Only targets on the surface under the pointer count (see
44
+ * `DropSurface`). A canvas element scrolled under the hierarchy no longer
45
+ * wins a drag through the hierarchy.
46
+ *
47
+ * 2. Nothing inside the dragged node counts. Those elements move with the
48
+ * drag, and dnd-kit re-measures them whenever any droppable registers or
49
+ * toggles — which a drag does at once, by disabling the dragged row's
50
+ * target. They were caught mid-flight just beside the pointer, and stayed
51
+ * there: invisible targets that the marker jumped onto, every one of which
52
+ * the drop then refused as "inside itself".
53
+ *
54
+ * 3. Over the dragged node's own place on the canvas, nothing counts. That
55
+ * space is where the node already is; dropping there leaves it alone,
56
+ * rather than resolving to whatever holds it and moving it to the end.
57
+ *
58
+ * Two targets with the same rectangle (a Stack that exactly fills its Box)
59
+ * tie on distance, and dnd-kit broke the tie by registration order, which
60
+ * changes whenever either one re-mounts. The deeper node wins now, always.
61
+ */
62
+ export declare const besignerCollisionDetection: CollisionDetection;
63
+ /**
64
+ * The target's rectangle as it is drawn right now.
65
+ *
66
+ * dnd-kit's cached `rect` follows scrolling only for scroll containers it can
67
+ * find by walking up from the element, and that walk stops at a shadow root —
68
+ * so for every canvas element, which lives in the canvas's closed shadow
69
+ * root, it never followed the canvas scrolling at all. A canvas target hands
70
+ * over its element instead, and is measured live.
71
+ */
72
+ export declare function dropTargetRect(over: Pick<Over, 'rect' | 'data'> | null | undefined): DroppableClientRect | null;
73
+ /**
74
+ * Where a drop inside a canvas container actually lands: after its last
75
+ * child that is drawn, because an inside drop appends.
76
+ *
77
+ * The marker used to draw inside as a line across the container's middle,
78
+ * which in any container with content runs between two of its children —
79
+ * in the hero of a page, straight between the heading and the text under
80
+ * it — and reads as "here", when the element was about to go to the end.
81
+ * Null for a container with nothing drawn in it; its middle is honest.
82
+ */
83
+ export declare function insideLandingTarget(node: Aglyn.NodeSchema<any> | undefined): {
84
+ rect: DroppableClientRect;
85
+ region: DropRegion;
86
+ } | null;
87
+ /** Which way the target's siblings run, so which edges mean before and after. */
88
+ export declare function dropAxisOf(data: DropTargetData | undefined): DropAxis;
89
+ /**
90
+ * The region of `over` that `point` names, or null without a target or a
91
+ * point (a keyboard drag that has never seen the pointer).
92
+ */
93
+ export declare function resolveTargetRegion(over: Pick<Over, 'rect' | 'data'> | null | undefined, point: Point | null | undefined, previous?: DropRegion | null): DropRegion | null;
94
+ export {};
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { canvas } from "@aglyn/aglyn";
17
+ import { DragType, DropRegion, refs, resolveDropRegion } from "@aglyn/besigner";
18
+ import { pointerWithin } from "@dnd-kit/core";
19
+ import { closestDropSurface, DROP_SURFACE_ATTRIBUTE, DropSurface, dropSurfaceAtPoint, flowAxisOf } from "./drop-surface.js";
20
+ function targetData(target) {
21
+ return target == null ? void 0 : target.data.current;
22
+ }
23
+ /** The node being dragged, or null for a palette preset (it is not on the page yet). */ function draggedNode(active) {
24
+ const data = active == null ? void 0 : active.data.current;
25
+ if (!(data == null ? void 0 : data.node) || data.type === DragType.PRESET) return null;
26
+ return data.node;
27
+ }
28
+ function depthOf(collision) {
29
+ var _ref;
30
+ var _collision_data, _targetData_node_breadcrumbPath, _targetData_node, _targetData;
31
+ const container = (_collision_data = collision.data) == null ? void 0 : _collision_data.droppableContainer;
32
+ return (_ref = (_targetData = targetData(container)) == null ? void 0 : (_targetData_node = _targetData.node) == null ? void 0 : (_targetData_node_breadcrumbPath = _targetData_node.breadcrumbPath) == null ? void 0 : _targetData_node_breadcrumbPath.length) != null ? _ref : 0;
33
+ }
34
+ /**
35
+ * Where an element would be without the `translate` the drag puts on it. A
36
+ * canvas element follows the pointer by `translate`, which
37
+ * `getBoundingClientRect` includes, so its rectangle while dragged is
38
+ * wherever the pointer was a frame ago.
39
+ */ function untranslatedRect(element) {
40
+ const box = element.getBoundingClientRect();
41
+ const [dx = 0, dy = 0] = (getComputedStyle(element).translate || '').split(' ').map((part)=>parseFloat(part) || 0);
42
+ return {
43
+ left: box.left - dx,
44
+ top: box.top - dy,
45
+ right: box.right - dx,
46
+ bottom: box.bottom - dy
47
+ };
48
+ }
49
+ function contains(rect, { x, y }) {
50
+ return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
51
+ }
52
+ /**
53
+ * dnd-kit's `pointerWithin`, minus the three ways it picked a target the
54
+ * author could not see.
55
+ *
56
+ * 1. Only targets on the surface under the pointer count (see
57
+ * `DropSurface`). A canvas element scrolled under the hierarchy no longer
58
+ * wins a drag through the hierarchy.
59
+ *
60
+ * 2. Nothing inside the dragged node counts. Those elements move with the
61
+ * drag, and dnd-kit re-measures them whenever any droppable registers or
62
+ * toggles — which a drag does at once, by disabling the dragged row's
63
+ * target. They were caught mid-flight just beside the pointer, and stayed
64
+ * there: invisible targets that the marker jumped onto, every one of which
65
+ * the drop then refused as "inside itself".
66
+ *
67
+ * 3. Over the dragged node's own place on the canvas, nothing counts. That
68
+ * space is where the node already is; dropping there leaves it alone,
69
+ * rather than resolving to whatever holds it and moving it to the end.
70
+ *
71
+ * Two targets with the same rectangle (a Stack that exactly fills its Box)
72
+ * tie on distance, and dnd-kit broke the tie by registration order, which
73
+ * changes whenever either one re-mounts. The deeper node wins now, always.
74
+ */ export const besignerCollisionDetection = (args)=>{
75
+ const { active, pointerCoordinates } = args;
76
+ if (!pointerCoordinates) return [];
77
+ const surface = dropSurfaceAtPoint(pointerCoordinates.x, pointerCoordinates.y);
78
+ const dragged = draggedNode(active);
79
+ if (dragged && (surface == null ? void 0 : surface.getAttribute(DROP_SURFACE_ATTRIBUTE)) === DropSurface.CANVAS) {
80
+ var _refs_get;
81
+ const element = (_refs_get = refs.get(dragged.$id)) == null ? void 0 : _refs_get.current;
82
+ if (element && contains(untranslatedRect(element), pointerCoordinates)) {
83
+ return [];
84
+ }
85
+ }
86
+ return pointerWithin(args).filter((collision)=>{
87
+ var _collision_data, _targetData, _node_breadcrumbPath;
88
+ const container = (_collision_data = collision.data) == null ? void 0 : _collision_data.droppableContainer;
89
+ if (surface !== undefined && closestDropSurface(container == null ? void 0 : container.node.current) !== surface) {
90
+ return false;
91
+ }
92
+ const node = (_targetData = targetData(container)) == null ? void 0 : _targetData.node;
93
+ return !(dragged && (node == null ? void 0 : (_node_breadcrumbPath = node.breadcrumbPath) == null ? void 0 : _node_breadcrumbPath.includes(dragged.$id)));
94
+ }).sort((a, b)=>{
95
+ var _ref, _ref1;
96
+ var _a_data, _b_data;
97
+ return ((_ref = (_a_data = a.data) == null ? void 0 : _a_data.value) != null ? _ref : 0) - ((_ref1 = (_b_data = b.data) == null ? void 0 : _b_data.value) != null ? _ref1 : 0) || depthOf(b) - depthOf(a);
98
+ });
99
+ };
100
+ /**
101
+ * The target's rectangle as it is drawn right now.
102
+ *
103
+ * dnd-kit's cached `rect` follows scrolling only for scroll containers it can
104
+ * find by walking up from the element, and that walk stops at a shadow root —
105
+ * so for every canvas element, which lives in the canvas's closed shadow
106
+ * root, it never followed the canvas scrolling at all. A canvas target hands
107
+ * over its element instead, and is measured live.
108
+ */ export function dropTargetRect(over) {
109
+ var _targetData_getElement, _targetData;
110
+ if (!over) return null;
111
+ const element = (_targetData = targetData(over)) == null ? void 0 : (_targetData_getElement = _targetData.getElement) == null ? void 0 : _targetData_getElement.call(_targetData);
112
+ const box = (element == null ? void 0 : element.isConnected) ? element.getBoundingClientRect() : over.rect;
113
+ if (!box) return null;
114
+ return {
115
+ left: box.left,
116
+ top: box.top,
117
+ width: box.width,
118
+ height: box.height,
119
+ right: box.right,
120
+ bottom: box.bottom
121
+ };
122
+ }
123
+ /**
124
+ * Where a drop inside a canvas container actually lands: after its last
125
+ * child that is drawn, because an inside drop appends.
126
+ *
127
+ * The marker used to draw inside as a line across the container's middle,
128
+ * which in any container with content runs between two of its children —
129
+ * in the hero of a page, straight between the heading and the text under
130
+ * it — and reads as "here", when the element was about to go to the end.
131
+ * Null for a container with nothing drawn in it; its middle is honest.
132
+ */ export function insideLandingTarget(node) {
133
+ var _ref;
134
+ const ids = (_ref = node == null ? void 0 : node.nodes) != null ? _ref : [];
135
+ for(let i = ids.length - 1; i >= 0; i -= 1){
136
+ var _refs_get;
137
+ const element = (_refs_get = refs.get(ids[i])) == null ? void 0 : _refs_get.current;
138
+ if (!(element == null ? void 0 : element.isConnected)) continue;
139
+ const box = element.getBoundingClientRect();
140
+ if (!box.width && !box.height) continue;
141
+ return {
142
+ rect: {
143
+ left: box.left,
144
+ top: box.top,
145
+ width: box.width,
146
+ height: box.height,
147
+ right: box.right,
148
+ bottom: box.bottom
149
+ },
150
+ region: flowAxisOf(element) === 'horizontal' ? DropRegion.RIGHT : DropRegion.BOTTOM
151
+ };
152
+ }
153
+ return null;
154
+ }
155
+ /** Which way the target's siblings run, so which edges mean before and after. */ export function dropAxisOf(data) {
156
+ var _data_getElement;
157
+ if ((data == null ? void 0 : data.surface) === DropSurface.TREE) return 'vertical';
158
+ if ((data == null ? void 0 : data.surface) === DropSurface.BREADCRUMBS) return 'horizontal';
159
+ return flowAxisOf(data == null ? void 0 : (_data_getElement = data.getElement) == null ? void 0 : _data_getElement.call(data));
160
+ }
161
+ /**
162
+ * The region of `over` that `point` names, or null without a target or a
163
+ * point (a keyboard drag that has never seen the pointer).
164
+ */ export function resolveTargetRegion(over, point, previous = null) {
165
+ const rect = dropTargetRect(over);
166
+ if (!rect || !point) return null;
167
+ const data = targetData(over);
168
+ const node = data == null ? void 0 : data.node;
169
+ return resolveDropRegion({
170
+ rect,
171
+ x: point.x,
172
+ y: point.y,
173
+ axis: dropAxisOf(data),
174
+ // Leaves (self-closing / text-editable) never offer an inside — the
175
+ // center reads as a sibling insert, matching where the drop actually
176
+ // lands (see dnd-manager onDragEnd).
177
+ acceptsChildren: node ? canvas.nodeAcceptsChildren(node) : true,
178
+ acceptsSiblings: !(node && canvas.isRootNode(node)),
179
+ allowAfter: !((data == null ? void 0 : data.surface) === DropSurface.TREE && (data == null ? void 0 : data.expanded)),
180
+ previous
181
+ });
182
+ }
183
+
184
+ //# sourceMappingURL=drop-targeting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/besigner/feature/designer/src/lib/components/dnd/drop-targeting.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { canvas } from '@aglyn/aglyn'\nimport {\n type DropAxis,\n type DroppableClientRect,\n DragType,\n DropRegion,\n refs,\n resolveDropRegion,\n} from '@aglyn/besigner'\nimport {\n type Active,\n type ClientRect,\n type Collision,\n type CollisionDetection,\n type DroppableContainer,\n type Over,\n pointerWithin,\n} from '@dnd-kit/core'\nimport type { DropIndicatorInset } from './drop-indicator-geometry'\nimport {\n closestDropSurface,\n DROP_SURFACE_ATTRIBUTE,\n DropSurface,\n dropSurfaceAtPoint,\n flowAxisOf,\n} from './drop-surface'\n\n/** What a besigner droppable carries in its dnd-kit `data`. */\nexport interface DropTargetData {\n node?: Aglyn.NodeSchema<any>\n type?: DragType\n accept?: DragType[]\n surface?: DropSurface\n /** The element as it is drawn now; read live rather than from a cache. */\n getElement?: () => Element | null\n /** How far in from the target's left edge a hierarchy row's label sits. */\n inset?: DropIndicatorInset\n /** A hierarchy row whose children are showing beneath it. */\n expanded?: boolean\n}\n\ntype Point = { x: number; y: number }\n\nfunction targetData(target: { data: { current?: unknown } } | null | undefined) {\n return target?.data.current as DropTargetData | undefined\n}\n\n/** The node being dragged, or null for a palette preset (it is not on the page yet). */\nfunction draggedNode(active: Active | null | undefined) {\n const data = active?.data.current as DropTargetData | undefined\n if (!data?.node || data.type === DragType.PRESET) return null\n return data.node\n}\n\nfunction depthOf(collision: Collision) {\n const container = collision.data?.droppableContainer as\n | DroppableContainer\n | undefined\n return targetData(container)?.node?.breadcrumbPath?.length ?? 0\n}\n\n/**\n * Where an element would be without the `translate` the drag puts on it. A\n * canvas element follows the pointer by `translate`, which\n * `getBoundingClientRect` includes, so its rectangle while dragged is\n * wherever the pointer was a frame ago.\n */\nfunction untranslatedRect(element: Element) {\n const box = element.getBoundingClientRect()\n const [dx = 0, dy = 0] = (getComputedStyle(element).translate || '')\n .split(' ')\n .map((part) => parseFloat(part) || 0)\n return {\n left: box.left - dx,\n top: box.top - dy,\n right: box.right - dx,\n bottom: box.bottom - dy,\n }\n}\n\nfunction contains(\n rect: { left: number; top: number; right: number; bottom: number },\n { x, y }: Point,\n) {\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom\n}\n\n/**\n * dnd-kit's `pointerWithin`, minus the three ways it picked a target the\n * author could not see.\n *\n * 1. Only targets on the surface under the pointer count (see\n * `DropSurface`). A canvas element scrolled under the hierarchy no longer\n * wins a drag through the hierarchy.\n *\n * 2. Nothing inside the dragged node counts. Those elements move with the\n * drag, and dnd-kit re-measures them whenever any droppable registers or\n * toggles — which a drag does at once, by disabling the dragged row's\n * target. They were caught mid-flight just beside the pointer, and stayed\n * there: invisible targets that the marker jumped onto, every one of which\n * the drop then refused as \"inside itself\".\n *\n * 3. Over the dragged node's own place on the canvas, nothing counts. That\n * space is where the node already is; dropping there leaves it alone,\n * rather than resolving to whatever holds it and moving it to the end.\n *\n * Two targets with the same rectangle (a Stack that exactly fills its Box)\n * tie on distance, and dnd-kit broke the tie by registration order, which\n * changes whenever either one re-mounts. The deeper node wins now, always.\n */\nexport const besignerCollisionDetection: CollisionDetection = (args) => {\n const { active, pointerCoordinates } = args\n if (!pointerCoordinates) return []\n const surface = dropSurfaceAtPoint(pointerCoordinates.x, pointerCoordinates.y)\n const dragged = draggedNode(active)\n\n if (\n dragged &&\n surface?.getAttribute(DROP_SURFACE_ATTRIBUTE) === DropSurface.CANVAS\n ) {\n const element = refs.get(dragged.$id)?.current\n if (element && contains(untranslatedRect(element), pointerCoordinates)) {\n return []\n }\n }\n\n return pointerWithin(args)\n .filter((collision) => {\n const container = collision.data?.droppableContainer as\n | DroppableContainer\n | undefined\n if (\n surface !== undefined &&\n closestDropSurface(container?.node.current) !== surface\n ) {\n return false\n }\n const node = targetData(container)?.node\n return !(dragged && node?.breadcrumbPath?.includes(dragged.$id))\n })\n .sort(\n (a, b) =>\n (a.data?.value ?? 0) - (b.data?.value ?? 0) || depthOf(b) - depthOf(a),\n )\n}\n\n/**\n * The target's rectangle as it is drawn right now.\n *\n * dnd-kit's cached `rect` follows scrolling only for scroll containers it can\n * find by walking up from the element, and that walk stops at a shadow root —\n * so for every canvas element, which lives in the canvas's closed shadow\n * root, it never followed the canvas scrolling at all. A canvas target hands\n * over its element instead, and is measured live.\n */\nexport function dropTargetRect(\n over: Pick<Over, 'rect' | 'data'> | null | undefined,\n): DroppableClientRect | null {\n if (!over) return null\n const element = targetData(over)?.getElement?.()\n const box: ClientRect | DOMRect | null = element?.isConnected\n ? element.getBoundingClientRect()\n : over.rect\n if (!box) return null\n return {\n left: box.left,\n top: box.top,\n width: box.width,\n height: box.height,\n right: box.right,\n bottom: box.bottom,\n }\n}\n\n/**\n * Where a drop inside a canvas container actually lands: after its last\n * child that is drawn, because an inside drop appends.\n *\n * The marker used to draw inside as a line across the container's middle,\n * which in any container with content runs between two of its children —\n * in the hero of a page, straight between the heading and the text under\n * it — and reads as \"here\", when the element was about to go to the end.\n * Null for a container with nothing drawn in it; its middle is honest.\n */\nexport function insideLandingTarget(\n node: Aglyn.NodeSchema<any> | undefined,\n): { rect: DroppableClientRect; region: DropRegion } | null {\n const ids = node?.nodes ?? []\n for (let i = ids.length - 1; i >= 0; i -= 1) {\n const element = refs.get(ids[i])?.current\n if (!element?.isConnected) continue\n const box = element.getBoundingClientRect()\n if (!box.width && !box.height) continue\n return {\n rect: {\n left: box.left,\n top: box.top,\n width: box.width,\n height: box.height,\n right: box.right,\n bottom: box.bottom,\n },\n region:\n flowAxisOf(element) === 'horizontal'\n ? DropRegion.RIGHT\n : DropRegion.BOTTOM,\n }\n }\n return null\n}\n\n/** Which way the target's siblings run, so which edges mean before and after. */\nexport function dropAxisOf(data: DropTargetData | undefined): DropAxis {\n if (data?.surface === DropSurface.TREE) return 'vertical'\n if (data?.surface === DropSurface.BREADCRUMBS) return 'horizontal'\n return flowAxisOf(data?.getElement?.())\n}\n\n/**\n * The region of `over` that `point` names, or null without a target or a\n * point (a keyboard drag that has never seen the pointer).\n */\nexport function resolveTargetRegion(\n over: Pick<Over, 'rect' | 'data'> | null | undefined,\n point: Point | null | undefined,\n previous: DropRegion | null = null,\n): DropRegion | null {\n const rect = dropTargetRect(over)\n if (!rect || !point) return null\n const data = targetData(over)\n const node = data?.node\n return resolveDropRegion({\n rect,\n x: point.x,\n y: point.y,\n axis: dropAxisOf(data),\n // Leaves (self-closing / text-editable) never offer an inside — the\n // center reads as a sibling insert, matching where the drop actually\n // lands (see dnd-manager onDragEnd).\n acceptsChildren: node ? canvas.nodeAcceptsChildren(node) : true,\n acceptsSiblings: !(node && canvas.isRootNode(node)),\n allowAfter: !(data?.surface === DropSurface.TREE && data?.expanded),\n previous,\n })\n}\n"],"names":["canvas","DragType","DropRegion","refs","resolveDropRegion","pointerWithin","closestDropSurface","DROP_SURFACE_ATTRIBUTE","DropSurface","dropSurfaceAtPoint","flowAxisOf","targetData","target","data","current","draggedNode","active","node","type","PRESET","depthOf","collision","container","droppableContainer","breadcrumbPath","length","untranslatedRect","element","box","getBoundingClientRect","dx","dy","getComputedStyle","translate","split","map","part","parseFloat","left","top","right","bottom","contains","rect","x","y","besignerCollisionDetection","args","pointerCoordinates","surface","dragged","getAttribute","CANVAS","get","$id","filter","undefined","includes","sort","a","b","value","dropTargetRect","over","getElement","isConnected","width","height","insideLandingTarget","ids","nodes","i","region","RIGHT","BOTTOM","dropAxisOf","TREE","BREADCRUMBS","resolveTargetRegion","point","previous","axis","acceptsChildren","nodeAcceptsChildren","acceptsSiblings","isRootNode","allowAfter","expanded"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,MAAM,QAAQ,eAAc;AACrC,SAGEC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,iBAAiB,QACZ,kBAAiB;AACxB,SAOEC,aAAa,QACR,gBAAe;AAEtB,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,WAAW,EACXC,kBAAkB,EAClBC,UAAU,QACL,oBAAgB;AAkBvB,SAASC,WAAWC,MAA0D;IAC5E,OAAOA,0BAAAA,OAAQC,IAAI,CAACC,OAAO;AAC7B;AAEA,sFAAsF,GACtF,SAASC,YAAYC,MAAiC;IACpD,MAAMH,OAAOG,0BAAAA,OAAQH,IAAI,CAACC,OAAO;IACjC,IAAI,EAACD,wBAAAA,KAAMI,IAAI,KAAIJ,KAAKK,IAAI,KAAKjB,SAASkB,MAAM,EAAE,OAAO;IACzD,OAAON,KAAKI,IAAI;AAClB;AAEA,SAASG,QAAQC,SAAoB;;QACjBA,iBAGXV,iCAAAA,kBAAAA;IAHP,MAAMW,aAAYD,kBAAAA,UAAUR,IAAI,qBAAdQ,gBAAgBE,kBAAkB;IAGpD,gBAAOZ,cAAAA,WAAWW,gCAAXX,mBAAAA,YAAuBM,IAAI,sBAA3BN,kCAAAA,iBAA6Ba,cAAc,qBAA3Cb,gCAA6Cc,MAAM,mBAAI;AAChE;AAEA;;;;;CAKC,GACD,SAASC,iBAAiBC,OAAgB;IACxC,MAAMC,MAAMD,QAAQE,qBAAqB;IACzC,MAAM,CAACC,KAAK,CAAC,EAAEC,KAAK,CAAC,CAAC,GAAG,AAACC,CAAAA,iBAAiBL,SAASM,SAAS,IAAI,EAAC,EAC/DC,KAAK,CAAC,KACNC,GAAG,CAAC,CAACC,OAASC,WAAWD,SAAS;IACrC,OAAO;QACLE,MAAMV,IAAIU,IA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0E,QAAQ,CAAD;QACjEP;IACF;AACF"}
@@ -40,20 +40,19 @@ import { besignerDocsUrl } from "../utils/docs-help.js";
40
40
  const nodeSelector = (node == null ? void 0 : node.$id) ? nodeElementSelector(node.$id) : '';
41
41
  const nodeAutomations = ((_interactions_automations = interactions.automations) != null ? _interactions_automations : []).filter((automation)=>automation.selector === nodeSelector);
42
42
  const nodeExperiment = ((_interactions_sectionExperiments = interactions.sectionExperiments) != null ? _interactions_sectionExperiments : []).find((experiment)=>experiment.nodeId === (node == null ? void 0 : node.$id));
43
+ // No padding of its own: the tab panel insets this the same 16px it
44
+ // insets Attributes and the Styles fields. Padding here as well put the
45
+ // controls twice as far from the panel's edges as anything else in it,
46
+ // and the top margin the label kept from sitting under the attribute
47
+ // fields added the same again above it.
43
48
  if (!interactions.onCreateInteraction || !(node == null ? void 0 : node.$id)) {
44
49
  return /*#__PURE__*/ _jsx(Typography, {
45
50
  variant: "body2",
46
51
  color: "text.secondary",
47
- sx: {
48
- p: 2
49
- },
50
52
  children: 'Interactions are not available on this kind of document.'
51
53
  });
52
54
  }
53
55
  return /*#__PURE__*/ _jsx(Stack, {
54
- sx: {
55
- p: 2
56
- },
57
56
  children: /*#__PURE__*/ _jsxs(FormControl, {
58
57
  margin: "none",
59
58
  fullWidth: true,
@@ -61,9 +60,6 @@ import { besignerDocsUrl } from "../utils/docs-help.js";
61
60
  /*#__PURE__*/ _jsxs(Typography, {
62
61
  variant: "overline",
63
62
  color: "text.secondary",
64
- sx: {
65
- mt: 2
66
- },
67
63
  children: [
68
64
  'Interactions',
69
65
  /*#__PURE__*/ _jsx(HelpTip, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/components/element-interactions-form.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { HelpTip } from '@aglyn/shared-ui-jsx'\nimport {\n Button,\n FormControl,\n IconButton,\n MenuItem as MuiMenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react-lite'\nimport { useContext } from 'react'\nimport {\n InteractionsContext,\n nodeElementSelector,\n type InteractionTriggerEvent,\n} from '../contexts/interactions-context'\nimport { besignerDocsUrl } from '../utils/docs-help'\n\nexport interface ElementInteractionsFormProps {\n node: Aglyn.NodeSchema<any>\n}\n\n/**\n * Interactions on the selected element, as its own panel tab.\n *\n * They used to sit at the bottom of Attributes, under every field the\n * component declares — so on anything with more than a handful of attributes\n * they were below the fold, and an author had no reason to believe the\n * element had any. An interaction is not an attribute: it is a behaviour, it\n * is authored in a dialog rather than a field, and it now lives with the\n * canvas states and styles as a peer.\n *\n * The list, the trigger picker and the section experiment move verbatim; what\n * changes is where they are.\n */\nexport const ElementInteractionsForm = observer(\n (props: ElementInteractionsFormProps) => {\n const { node } = props\n const interactions = useContext(InteractionsContext)\n const nodeSelector = node?.$id ? nodeElementSelector(node.$id) : ''\n const nodeAutomations = (interactions.automations ?? []).filter(\n (automation) => automation.selector === nodeSelector,\n )\n const nodeExperiment = (interactions.sectionExperiments ?? []).find(\n (experiment) => experiment.nodeId === node?.$id,\n )\n if (!interactions.onCreateInteraction || !node?.$id) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ p: 2 }}>\n {'Interactions are not available on this kind of document.'}\n </Typography>\n )\n }\n return (\n <Stack sx={{ p: 2 }}>\n <FormControl margin=\"none\" fullWidth>\n {/* Interactions (AGL-258): automations bound to this\n element's stable data-aglyn selector. */}\n <Typography\n variant=\"overline\"\n color=\"text.secondary\"\n sx={{ mt: 2 }}\n >\n {'Interactions'}\n {/* AGL-2167 — the trigger list says when, and\n nothing here says what an interaction can then\n do, or that the target is picked by clicking. */}\n <HelpTip\n title=\"Interactions\"\n excerpt=\"Run an action when this element is clicked, hovered, or scrolled into view. Targets are picked by clicking them on the canvas.\"\n href={besignerDocsUrl('interactions', '#fluent-interactions')}\n sx={{ ml: 0.25, fontSize: '0.9em' }}\n />\n </Typography>\n {nodeAutomations.map((automation) => (\n <Stack\n key={automation.id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center', mb: 0.5 }}\n >\n <Typography variant=\"body2\" noWrap sx={{ flex: 1 }}>\n {automation.name ?? automation.id}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {automation.event}\n </Typography>\n {/* Manage in place (wave v7): toggle + remove\n without leaving the canvas. */}\n {interactions.onToggleInteraction ? (\n <Switch\n size=\"small\"\n checked={automation.enabled !== false}\n onChange={(event) =>\n interactions.onToggleInteraction?.({\n id: automation.id,\n enabled: event.target.checked,\n })\n }\n slotProps={{\n input: { 'aria-label': 'Interaction enabled' },\n }}\n />\n ) : automation.enabled === false ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n >\n {'off'}\n </Typography>\n ) : null}\n {/* Fluent builder (AGL-319): edit reopens the\n inline dialog — no Automation detour. */}\n {interactions.onEditInteraction && node?.$id ? (\n <IconButton\n size=\"small\"\n aria-label=\"Edit interaction\"\n onClick={() =>\n interactions.onEditInteraction?.({\n id: automation.id,\n nodeId: node.$id as string,\n })\n }\n >\n {'✎'}\n </IconButton>\n ) : null}\n {interactions.onDeleteInteraction ? (\n <IconButton\n size=\"small\"\n aria-label=\"Remove interaction\"\n onClick={() =>\n interactions.onDeleteInteraction?.({\n id: automation.id,\n })\n }\n >\n {'✕'}\n </IconButton>\n ) : null}\n </Stack>\n ))}\n <TextField\n select\n size=\"small\"\n label=\"Add interaction\"\n value=\"\"\n onChange={(event) => {\n const trigger = event.target\n .value as InteractionTriggerEvent\n if (trigger && node?.$id) {\n interactions.onCreateInteraction?.({\n nodeId: node.$id,\n event: trigger,\n })\n }\n }}\n >\n <MuiMenuItem value=\"elementClick\">\n {'When clicked…'}\n </MuiMenuItem>\n {/* Hover choreography (AGL-562). */}\n <MuiMenuItem value=\"elementHoverEnter\">\n {'When hovered…'}\n </MuiMenuItem>\n <MuiMenuItem value=\"elementHoverLeave\">\n {'When hover ends…'}\n </MuiMenuItem>\n <MuiMenuItem value=\"elementVisible\">\n {'When scrolled into view…'}\n </MuiMenuItem>\n </TextField>\n {interactions.onCreateSectionExperiment ? (\n nodeExperiment ? (\n <Typography\n variant=\"caption\"\n color=\"primary\"\n sx={{ mt: 1 }}\n >\n {`A/B test: ${nodeExperiment.name ?? nodeExperiment.id}` +\n ` (${nodeExperiment.status ?? 'draft'})`}\n </Typography>\n ) : (\n <Button\n color=\"primary\"\n size=\"small\"\n sx={{ mt: 1, alignSelf: 'flex-start' }}\n onClick={() =>\n node?.$id &&\n interactions.onCreateSectionExperiment?.({\n nodeId: node.$id,\n })\n }\n >\n {'A/B test this section'}\n </Button>\n )\n ) : null}\n </FormControl>\n </Stack>\n )\n },\n)\nElementInteractionsForm.displayName = 'ElementInteractionsForm'\n\nexport default ElementInteractionsForm\n"],"names":["HelpTip","Button","FormControl","IconButton","MenuItem","MuiMenuItem","Stack","Switch","TextField","Typography","observer","useContext","InteractionsContext","nodeElementSelector","besignerDocsUrl","ElementInteractionsForm","props","interactions","nodeExperiment","node","nodeSelector","$id","nodeAutomations","automations","filter","automation","selector","sectionExperiments","find","experiment","nodeId","onCreateInteraction","variant","color","sx","p","margin","fullWidth","mt","title","excerpt","href","ml","fontSize","map","direction","spacing","alignItems","mb","noWrap","flex","name","id","event","onToggleInteraction","size","checked","enabled","onChange","target","slotProps","input","onEditInteraction","aria-label","onClick","onDeleteInteraction","select","label","value","trigger","onCreateSectionExperiment","status","alignSelf","displayName"],"mappings":"AAAA;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AW,GAAG;AAEtC,eAAe1D,wBAAuB"}
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/components/element-interactions-form.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { HelpTip } from '@aglyn/shared-ui-jsx'\nimport {\n Button,\n FormControl,\n IconButton,\n MenuItem as MuiMenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { observer } from 'mobx-react-lite'\nimport { useContext } from 'react'\nimport {\n InteractionsContext,\n nodeElementSelector,\n type InteractionTriggerEvent,\n} from '../contexts/interactions-context'\nimport { besignerDocsUrl } from '../utils/docs-help'\n\nexport interface ElementInteractionsFormProps {\n node: Aglyn.NodeSchema<any>\n}\n\n/**\n * Interactions on the selected element, as its own panel tab.\n *\n * They used to sit at the bottom of Attributes, under every field the\n * component declares — so on anything with more than a handful of attributes\n * they were below the fold, and an author had no reason to believe the\n * element had any. An interaction is not an attribute: it is a behaviour, it\n * is authored in a dialog rather than a field, and it now lives with the\n * canvas states and styles as a peer.\n *\n * The list, the trigger picker and the section experiment move verbatim; what\n * changes is where they are.\n */\nexport const ElementInteractionsForm = observer(\n (props: ElementInteractionsFormProps) => {\n const { node } = props\n const interactions = useContext(InteractionsContext)\n const nodeSelector = node?.$id ? nodeElementSelector(node.$id) : ''\n const nodeAutomations = (interactions.automations ?? []).filter(\n (automation) => automation.selector === nodeSelector,\n )\n const nodeExperiment = (interactions.sectionExperiments ?? []).find(\n (experiment) => experiment.nodeId === node?.$id,\n )\n // No padding of its own: the tab panel insets this the same 16px it\n // insets Attributes and the Styles fields. Padding here as well put the\n // controls twice as far from the panel's edges as anything else in it,\n // and the top margin the label kept from sitting under the attribute\n // fields added the same again above it.\n if (!interactions.onCreateInteraction || !node?.$id) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Interactions are not available on this kind of document.'}\n </Typography>\n )\n }\n return (\n <Stack>\n <FormControl margin=\"none\" fullWidth>\n {/* Interactions (AGL-258): automations bound to this\n element's stable data-aglyn selector. */}\n <Typography variant=\"overline\" color=\"text.secondary\">\n {'Interactions'}\n {/* AGL-2167 — the trigger list says when, and\n nothing here says what an interaction can then\n do, or that the target is picked by clicking. */}\n <HelpTip\n title=\"Interactions\"\n excerpt=\"Run an action when this element is clicked, hovered, or scrolled into view. Targets are picked by clicking them on the canvas.\"\n href={besignerDocsUrl('interactions', '#fluent-interactions')}\n sx={{ ml: 0.25, fontSize: '0.9em' }}\n />\n </Typography>\n {nodeAutomations.map((automation) => (\n <Stack\n key={automation.id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center', mb: 0.5 }}\n >\n <Typography variant=\"body2\" noWrap sx={{ flex: 1 }}>\n {automation.name ?? automation.id}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {automation.event}\n </Typography>\n {/* Manage in place (wave v7): toggle + remove\n without leaving the canvas. */}\n {interactions.onToggleInteraction ? (\n <Switch\n size=\"small\"\n checked={automation.enabled !== false}\n onChange={(event) =>\n interactions.onToggleInteraction?.({\n id: automation.id,\n enabled: event.target.checked,\n })\n }\n slotProps={{\n input: { 'aria-label': 'Interaction enabled' },\n }}\n />\n ) : automation.enabled === false ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n >\n {'off'}\n </Typography>\n ) : null}\n {/* Fluent builder (AGL-319): edit reopens the\n inline dialog — no Automation detour. */}\n {interactions.onEditInteraction && node?.$id ? (\n <IconButton\n size=\"small\"\n aria-label=\"Edit interaction\"\n onClick={() =>\n interactions.onEditInteraction?.({\n id: automation.id,\n nodeId: node.$id as string,\n })\n }\n >\n {'✎'}\n </IconButton>\n ) : null}\n {interactions.onDeleteInteraction ? (\n <IconButton\n size=\"small\"\n aria-label=\"Remove interaction\"\n onClick={() =>\n interactions.onDeleteInteraction?.({\n id: automation.id,\n })\n }\n >\n {'✕'}\n </IconButton>\n ) : null}\n </Stack>\n ))}\n <TextField\n select\n size=\"small\"\n label=\"Add interaction\"\n value=\"\"\n onChange={(event) => {\n const trigger = event.target\n .value as InteractionTriggerEvent\n if (trigger && node?.$id) {\n interactions.onCreateInteraction?.({\n nodeId: node.$id,\n event: trigger,\n })\n }\n }}\n >\n <MuiMenuItem value=\"elementClick\">\n {'When clicked…'}\n </MuiMenuItem>\n {/* Hover choreography (AGL-562). */}\n <MuiMenuItem value=\"elementHoverEnter\">\n {'When hovered…'}\n </MuiMenuItem>\n <MuiMenuItem value=\"elementHoverLeave\">\n {'When hover ends…'}\n </MuiMenuItem>\n <MuiMenuItem value=\"elementVisible\">\n {'When scrolled into view…'}\n </MuiMenuItem>\n </TextField>\n {interactions.onCreateSectionExperiment ? (\n nodeExperiment ? (\n <Typography\n variant=\"caption\"\n color=\"primary\"\n sx={{ mt: 1 }}\n >\n {`A/B test: ${nodeExperiment.name ?? nodeExperiment.id}` +\n ` (${nodeExperiment.status ?? 'draft'})`}\n </Typography>\n ) : (\n <Button\n color=\"primary\"\n size=\"small\"\n sx={{ mt: 1, alignSelf: 'flex-start' }}\n onClick={() =>\n node?.$id &&\n interactions.onCreateSectionExperiment?.({\n nodeId: node.$id,\n })\n }\n >\n {'A/B test this section'}\n </Button>\n )\n ) : null}\n </FormControl>\n </Stack>\n )\n },\n)\nElementInteractionsForm.displayName = 'ElementInteractionsForm'\n\nexport default ElementInteractionsForm\n"],"names":["HelpTip","Button","FormControl","IconButton","MenuItem","MuiMenuItem","Stack","Switch","TextField","Typography","observer","useContext","InteractionsContext","nodeElementSelector","besignerDocsUrl","ElementInteractionsForm","props","interactions","nodeExperiment","node","nodeSelector","$id","nodeAutomations","automations","filter","automation","selector","sectionExperiments","find","experiment","nodeId","onCreateInteraction","variant","color","margin","fullWidth","title","excerpt","href","sx","ml","fontSize","map","direction","spacing","alignItems","mb","noWrap","flex","name","id","event","onToggleInteraction","size","checked","enabled","onChange","target","slotProps","input","onEditInteraction","aria-label","onClick","onDeleteInteraction","select","label","value","trigger","onCreateSectionExperiment","mt","status","alignSelf","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAGA,SAASA,OAAO,QAAQ,uBAAsB;AAC9C,SACEC,MAAM,EACNC,WAAW,EACXC,UAAU,EACVC,YAAYC,WAAW,EACvBC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,QAAQ,QAAO;AAClC,SACEC,mBAAmB,EACnBC,mBAAmB,QAEd,sCAAkC;AACzC,SAASC,eAAe,QAAQ,wBAAoB;AAMpD;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,0BAA0BL,SACrC,CAACM;QAI0BC,2BAGDA,kCAyIEC,sBACPA;IAhJnB,MAAM,EAAEC,IAAI,EAAE,GAAGH;IACjB,MAAMC,eAAeN,WAAWC;IAChC,MAAMQ,eAAeD,CAAAA,wBAAAA,KAAME,GAAG,IAAGR,oBAAoBM,KAAKE,GAAG,IAAI;IACjE,MAAMC,kBAAkB,EAACL,4BAAAA,aAAaM,WAAW,YAAxBN,4BAA4B,EAAE,EAAEO,MAAM,CAC7D,CAACC,aAAeA,WAAWC,QAAQ,KAAKN;IAE1C,MAAMF,iBAAiB,EAACD,mCAAAA,aAAaU,kBAAkB,YAA/BV,mCAAmC,EAAE,EAAEW,IAAI,CACjE,CAACC,aAAeA,WAAWC,MAAM,MAAKX,wBAAAA,KAAME,GAAG;IAEjD,oEAAoE;IACpE,wEAAwE;IACxE,uEAAuE;I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jB;oBACCgC,OAAM;oBACNoB,MAAK;oBACLd,IAAI;wBAAE8B,IAAI;wBAAGE,WAAW;oBAAa;oBACrCT,SAAS,IACP3C,CAAAA,wBAAAA,KAAME,GAAG,MACTJ,aAAamD,yBAAyB,oBAAtCnD,aAAamD,yBAAyB,MAAtCnD,cAAyC;4BACvCa,QAAQX,KAAKE,GAAG;wBAClB;8BAGD;qBAGH;;;;AAIZ,GACD;AACDN,wBAAwByD,WAAW,GAAG;AAEtC,eAAezD,wBAAuB"}
@@ -49,7 +49,6 @@ import { readAttributeFieldValue } from "../utils/attribute-field-value.js";
49
49
  import { besignerDocsUrl } from "../utils/docs-help.js";
50
50
  import { buildStyleThemeScales } from "../utils/theme-scale-options.js";
51
51
  import { numericTextValue } from "../utils/numeric-text-value.js";
52
- import ElementInfoDetails from "./element-info-details.component.js";
53
52
  import useInsertTokenOptions from "../hooks/use-insert-token-options.js";
54
53
  import useRepeatSources from "../hooks/use-repeat-sources.js";
55
54
  import { InteractionsContext, nodeElementSelector } from "../contexts/interactions-context.js";
@@ -2422,9 +2421,6 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
2422
2421
  fullWidth: true,
2423
2422
  children: "Delete Element"
2424
2423
  })
2425
- }),
2426
- /*#__PURE__*/ _jsx(ElementInfoDetails, {
2427
- node: node
2428
2424
  })
2429
2425
  ]
2430
2426
  });