@geajs/ui 0.2.4 → 0.2.9
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/accordion.d.mts +2 -2
- package/dist/accordion.mjs +92 -122
- package/dist/accordion.mjs.map +1 -1
- package/dist/alert.d.mts +3 -3
- package/dist/alert.mjs +45 -107
- package/dist/alert.mjs.map +1 -1
- package/dist/avatar.d.mts +2 -2
- package/dist/avatar.mjs +38 -62
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.d.mts +1 -1
- package/dist/badge.mjs +18 -43
- package/dist/badge.mjs.map +1 -1
- package/dist/bind.mjs +130 -0
- package/dist/bind.mjs.map +1 -0
- package/dist/button.d.mts +3 -2
- package/dist/button.mjs +30 -85
- package/dist/button.mjs.map +1 -1
- package/dist/card.d.mts +6 -6
- package/dist/card.mjs +82 -194
- package/dist/card.mjs.map +1 -1
- package/dist/checkbox.d.mts +2 -2
- package/dist/checkbox.mjs +30 -31
- package/dist/checkbox.mjs.map +1 -1
- package/dist/clipboard.d.mts +2 -2
- package/dist/clipboard.mjs +49 -55
- package/dist/clipboard.mjs.map +1 -1
- package/dist/collapsible.d.mts +2 -2
- package/dist/collapsible.mjs +18 -45
- package/dist/collapsible.mjs.map +1 -1
- package/dist/combobox.d.mts +2 -2
- package/dist/combobox.mjs +322 -261
- package/dist/combobox.mjs.map +1 -1
- package/dist/compiled-component.mjs +119 -0
- package/dist/compiled-component.mjs.map +1 -0
- package/dist/compiled-reactive-component.mjs +337 -0
- package/dist/compiled-reactive-component.mjs.map +1 -0
- package/dist/component-id.mjs +10 -0
- package/dist/component-id.mjs.map +1 -0
- package/dist/conditional-truthy.mjs +48 -0
- package/dist/conditional-truthy.mjs.map +1 -0
- package/dist/conditional.mjs +54 -0
- package/dist/conditional.mjs.map +1 -0
- package/dist/delegate-event.mjs +53 -0
- package/dist/delegate-event.mjs.map +1 -0
- package/dist/dialog.d.mts +4 -3
- package/dist/dialog.mjs +57 -70
- package/dist/dialog.mjs.map +1 -1
- package/dist/dirty-symbols.mjs +7 -0
- package/dist/dirty-symbols.mjs.map +1 -0
- package/dist/disposer.mjs +46 -0
- package/dist/disposer.mjs.map +1 -0
- package/dist/dnd-manager.d.mts +9 -1
- package/dist/dnd-manager.mjs +67 -29
- package/dist/dnd-manager.mjs.map +1 -1
- package/dist/drag-drop-context.d.mts +1 -1
- package/dist/drag-drop-context.mjs +17 -33
- package/dist/drag-drop-context.mjs.map +1 -1
- package/dist/draggable.d.mts +1 -1
- package/dist/draggable.mjs +2 -91
- package/dist/draggable2.mjs +321 -0
- package/dist/draggable2.mjs.map +1 -0
- package/dist/droppable.d.mts +1 -1
- package/dist/droppable.mjs +20 -44
- package/dist/droppable.mjs.map +1 -1
- package/dist/file-upload.d.mts +2 -2
- package/dist/file-upload.mjs +337 -122
- package/dist/file-upload.mjs.map +1 -1
- package/dist/hover-card.d.mts +2 -2
- package/dist/hover-card.mjs +24 -59
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/input.d.mts +1 -1
- package/dist/input.mjs +1 -93
- package/dist/input2.mjs +56 -0
- package/dist/input2.mjs.map +1 -0
- package/dist/internal-symbols.mjs +9 -0
- package/dist/internal-symbols.mjs.map +1 -0
- package/dist/item-obs.mjs +68 -0
- package/dist/item-obs.mjs.map +1 -0
- package/dist/keyed-list-symbols.mjs +6 -0
- package/dist/keyed-list-symbols.mjs.map +1 -0
- package/dist/keyed-list.mjs +487 -0
- package/dist/keyed-list.mjs.map +1 -0
- package/dist/label.d.mts +1 -1
- package/dist/label.mjs +20 -45
- package/dist/label.mjs.map +1 -1
- package/dist/menu.d.mts +2 -2
- package/dist/menu.mjs +87 -41
- package/dist/menu.mjs.map +1 -1
- package/dist/number-input.d.mts +2 -2
- package/dist/number-input.mjs +28 -32
- package/dist/number-input.mjs.map +1 -1
- package/dist/pagination.d.mts +2 -2
- package/dist/pagination.mjs +12 -35
- package/dist/pagination.mjs.map +1 -1
- package/dist/patch.mjs +21 -0
- package/dist/patch.mjs.map +1 -0
- package/dist/pin-input.d.mts +2 -2
- package/dist/pin-input.mjs +88 -87
- package/dist/pin-input.mjs.map +1 -1
- package/dist/popover.d.mts +2 -2
- package/dist/popover.mjs +45 -67
- package/dist/popover.mjs.map +1 -1
- package/dist/progress.d.mts +2 -2
- package/dist/progress.mjs +37 -43
- package/dist/progress.mjs.map +1 -1
- package/dist/radio-group.d.mts +2 -2
- package/dist/radio-group.mjs +99 -140
- package/dist/radio-group.mjs.map +1 -1
- package/dist/rating-group.d.mts +2 -2
- package/dist/rating-group.mjs +91 -99
- package/dist/rating-group.mjs.map +1 -1
- package/dist/reactive-attr.mjs +13 -0
- package/dist/reactive-attr.mjs.map +1 -0
- package/dist/reactive-bool.mjs +13 -0
- package/dist/reactive-bool.mjs.map +1 -0
- package/dist/reactive-class-name.mjs +15 -0
- package/dist/reactive-class-name.mjs.map +1 -0
- package/dist/reactive-class.mjs +53 -0
- package/dist/reactive-class.mjs.map +1 -0
- package/dist/reactive-style.mjs +21 -0
- package/dist/reactive-style.mjs.map +1 -0
- package/dist/reactive-text.mjs +62 -0
- package/dist/reactive-text.mjs.map +1 -0
- package/dist/select.d.mts +2 -2
- package/dist/select.mjs +106 -186
- package/dist/select.mjs.map +1 -1
- package/dist/separator.d.mts +1 -1
- package/dist/separator.mjs +19 -45
- package/dist/separator.mjs.map +1 -1
- package/dist/skeleton.d.mts +1 -1
- package/dist/skeleton.mjs +11 -35
- package/dist/skeleton.mjs.map +1 -1
- package/dist/slider.d.mts +2 -2
- package/dist/slider.mjs +31 -32
- package/dist/slider.mjs.map +1 -1
- package/dist/switch.d.mts +2 -2
- package/dist/switch.mjs +30 -31
- package/dist/switch.mjs.map +1 -1
- package/dist/tabs.d.mts +7 -2
- package/dist/tabs.mjs +180 -147
- package/dist/tabs.mjs.map +1 -1
- package/dist/tags-input.d.mts +2 -2
- package/dist/tags-input.mjs +102 -188
- package/dist/tags-input.mjs.map +1 -1
- package/dist/textarea.d.mts +1 -1
- package/dist/textarea.mjs +32 -75
- package/dist/textarea.mjs.map +1 -1
- package/dist/theme.css +4 -5
- package/dist/toast.d.mts +1 -1
- package/dist/toast.mjs +14 -34
- package/dist/toast.mjs.map +1 -1
- package/dist/toggle-group.d.mts +2 -2
- package/dist/toggle-group.mjs +78 -85
- package/dist/toggle-group.mjs.map +1 -1
- package/dist/tooltip.d.mts +2 -2
- package/dist/tooltip.mjs +23 -43
- package/dist/tooltip.mjs.map +1 -1
- package/dist/tree-view.d.mts +2 -2
- package/dist/tree-view.mjs +32 -50
- package/dist/tree-view.mjs.map +1 -1
- package/dist/types.d.mts +9 -0
- package/dist/zag-component.d.mts +25 -3
- package/dist/zag-component.mjs +63 -16
- package/dist/zag-component.mjs.map +1 -1
- package/package.json +4 -3
- package/dist/cn.mjs +0 -10
- package/dist/cn.mjs.map +0 -1
- package/dist/draggable.mjs.map +0 -1
- package/dist/input.mjs.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { i as withTracking, r as untrack } from "./bind.mjs";
|
|
2
|
+
//#region ../gea/src/runtime/conditional-truthy.ts
|
|
3
|
+
function conditionalTruthy(parent, anchor, disposer, root, cond, mkTrue) {
|
|
4
|
+
let currentNodes = null;
|
|
5
|
+
let currentChild = null;
|
|
6
|
+
let active = false;
|
|
7
|
+
const sentinel = document.createComment("");
|
|
8
|
+
const p0 = anchor.parentNode ?? parent;
|
|
9
|
+
p0.insertBefore(sentinel, anchor);
|
|
10
|
+
p0.removeChild(anchor);
|
|
11
|
+
function clear() {
|
|
12
|
+
if (currentChild) {
|
|
13
|
+
currentChild.dispose();
|
|
14
|
+
currentChild = null;
|
|
15
|
+
}
|
|
16
|
+
if (currentNodes) {
|
|
17
|
+
for (let i = 0; i < currentNodes.length; i++) {
|
|
18
|
+
const n = currentNodes[i];
|
|
19
|
+
const p = n.parentNode;
|
|
20
|
+
if (p) p.removeChild(n);
|
|
21
|
+
}
|
|
22
|
+
currentNodes = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function mount() {
|
|
26
|
+
const childD = disposer.child();
|
|
27
|
+
const node = untrack(() => mkTrue(childD));
|
|
28
|
+
currentNodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node];
|
|
29
|
+
(sentinel.parentNode ?? parent).insertBefore(node, sentinel);
|
|
30
|
+
currentChild = childD;
|
|
31
|
+
}
|
|
32
|
+
withTracking(disposer, root, () => {
|
|
33
|
+
const next = !!cond();
|
|
34
|
+
if (next === active) return;
|
|
35
|
+
clear();
|
|
36
|
+
active = next;
|
|
37
|
+
if (next) mount();
|
|
38
|
+
});
|
|
39
|
+
disposer.add(() => {
|
|
40
|
+
clear();
|
|
41
|
+
if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel);
|
|
42
|
+
active = false;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { conditionalTruthy as t };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=conditional-truthy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-truthy.mjs","names":[],"sources":["../../gea/src/runtime/conditional-truthy.ts"],"sourcesContent":["import type { Disposer } from './disposer'\nimport { withTracking, untrack } from './with-tracking'\n\ntype BranchFactory = (d: Disposer) => Node\n\nexport function conditionalTruthy(\n parent: Node,\n anchor: Comment,\n disposer: Disposer,\n root: any,\n cond: () => boolean,\n mkTrue: BranchFactory,\n): void {\n let currentNodes: Node[] | null = null\n let currentChild: Disposer | null = null\n let active = false\n\n const sentinel = document.createComment('')\n const p0 = anchor.parentNode ?? parent\n p0.insertBefore(sentinel, anchor)\n p0.removeChild(anchor)\n\n function clear(): void {\n if (currentChild) {\n currentChild.dispose()\n currentChild = null\n }\n if (currentNodes) {\n for (let i = 0; i < currentNodes.length; i++) {\n const n = currentNodes[i]\n const p = n.parentNode\n if (p) p.removeChild(n)\n }\n currentNodes = null\n }\n }\n\n function mount(): void {\n const childD = disposer.child()\n const node = untrack(() => mkTrue(childD))\n currentNodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node]\n const p = sentinel.parentNode ?? parent\n p.insertBefore(node, sentinel)\n currentChild = childD\n }\n\n withTracking(disposer, root, () => {\n const next = !!cond()\n if (next === active) return\n clear()\n active = next\n if (next) mount()\n })\n\n disposer.add(() => {\n clear()\n if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel)\n active = false\n })\n}\n"],"mappings":";;AAKA,SAAgB,kBACd,QACA,QACA,UACA,MACA,MACA,QACM;CACN,IAAI,eAA8B;CAClC,IAAI,eAAgC;CACpC,IAAI,SAAS;CAEb,MAAM,WAAW,SAAS,cAAc,GAAG;CAC3C,MAAM,KAAK,OAAO,cAAc;AAChC,IAAG,aAAa,UAAU,OAAO;AACjC,IAAG,YAAY,OAAO;CAEtB,SAAS,QAAc;AACrB,MAAI,cAAc;AAChB,gBAAa,SAAS;AACtB,kBAAe;;AAEjB,MAAI,cAAc;AAChB,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;IAC5C,MAAM,IAAI,aAAa;IACvB,MAAM,IAAI,EAAE;AACZ,QAAI,EAAG,GAAE,YAAY,EAAE;;AAEzB,kBAAe;;;CAInB,SAAS,QAAc;EACrB,MAAM,SAAS,SAAS,OAAO;EAC/B,MAAM,OAAO,cAAc,OAAO,OAAO,CAAC;AAC1C,iBAAe,KAAK,aAAa,KAAK,MAAM,KAAK,KAAK,WAAW,GAAG,CAAC,KAAK;AAE1E,GADU,SAAS,cAAc,QAC/B,aAAa,MAAM,SAAS;AAC9B,iBAAe;;AAGjB,cAAa,UAAU,YAAY;EACjC,MAAM,OAAO,CAAC,CAAC,MAAM;AACrB,MAAI,SAAS,OAAQ;AACrB,SAAO;AACP,WAAS;AACT,MAAI,KAAM,QAAO;GACjB;AAEF,UAAS,UAAU;AACjB,SAAO;AACP,MAAI,SAAS,WAAY,UAAS,WAAW,YAAY,SAAS;AAClE,WAAS;GACT"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { i as withTracking, r as untrack } from "./bind.mjs";
|
|
2
|
+
//#region ../gea/src/runtime/conditional.ts
|
|
3
|
+
function conditional(parent, anchor, disposer, root, cond, mkTrue, mkFalse) {
|
|
4
|
+
let currentValue = null;
|
|
5
|
+
let currentNodes = null;
|
|
6
|
+
let currentChild = null;
|
|
7
|
+
const sentinel = document.createComment("");
|
|
8
|
+
const p0 = anchor.parentNode ?? parent;
|
|
9
|
+
p0.insertBefore(sentinel, anchor);
|
|
10
|
+
p0.removeChild(anchor);
|
|
11
|
+
const placeholder = () => document.createComment("");
|
|
12
|
+
const elseFactory = mkFalse ?? placeholder;
|
|
13
|
+
function unmount() {
|
|
14
|
+
if (currentChild) {
|
|
15
|
+
currentChild.dispose();
|
|
16
|
+
currentChild = null;
|
|
17
|
+
}
|
|
18
|
+
if (currentNodes) {
|
|
19
|
+
for (let i = 0; i < currentNodes.length; i++) {
|
|
20
|
+
const n = currentNodes[i];
|
|
21
|
+
const p = n.parentNode;
|
|
22
|
+
if (p) p.removeChild(n);
|
|
23
|
+
}
|
|
24
|
+
currentNodes = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function mount(v) {
|
|
28
|
+
const childD = disposer.child();
|
|
29
|
+
const factory = v ? mkTrue : elseFactory;
|
|
30
|
+
const node = untrack(() => factory(childD));
|
|
31
|
+
const nodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node];
|
|
32
|
+
(sentinel.parentNode ?? parent).insertBefore(node, sentinel);
|
|
33
|
+
currentChild = childD;
|
|
34
|
+
currentNodes = nodes;
|
|
35
|
+
}
|
|
36
|
+
function swap(v) {
|
|
37
|
+
if (v === currentValue) return;
|
|
38
|
+
unmount();
|
|
39
|
+
currentValue = v;
|
|
40
|
+
mount(v);
|
|
41
|
+
}
|
|
42
|
+
withTracking(disposer, root, () => {
|
|
43
|
+
swap(!!cond());
|
|
44
|
+
});
|
|
45
|
+
disposer.add(() => {
|
|
46
|
+
unmount();
|
|
47
|
+
if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel);
|
|
48
|
+
currentValue = null;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { conditional as t };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=conditional.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.mjs","names":[],"sources":["../../gea/src/runtime/conditional.ts"],"sourcesContent":["/**\n * conditional(parent, anchor, disposer, root, cond, mkTrue, mkFalse?)\n *\n * Closure-compiled reactive conditional: mounts one of two branches into\n * `parent` immediately before `anchor`, and swaps when `cond()` changes.\n *\n * - Each branch gets its own child disposer scope (`disposer.child()`), so\n * anything the branch sets up (subscriptions, nested conditionals, keyed\n * lists, mounted components) tears down when the branch unmounts.\n * - Dep tracking on `cond` is done lexically via `withTracking(disposer, root, ...)`.\n * `root` is the enclosing component's store proxy — proxy gets during `cond()`\n * push paths into the active scope; on any notified path, the scope re-runs.\n * - `mkFalse` is optional; if omitted, the falsy branch renders a placeholder\n * comment so the anchor position stays well-defined.\n * - DocumentFragment returns are handled: `insertBefore` moves a fragment's\n * children into `parent`, so we capture `childNodes` BEFORE insertion to\n * later remove the exact set of inserted nodes.\n */\n\nimport type { Disposer } from './disposer'\nimport { withTracking, untrack } from './with-tracking'\n\ntype BranchFactory = (d: Disposer) => Node\n\nexport function conditional(\n parent: Node,\n anchor: Comment,\n disposer: Disposer,\n root: any,\n cond: () => boolean,\n mkTrue: BranchFactory,\n mkFalse?: BranchFactory,\n): void {\n let currentValue: boolean | null = null\n let currentNodes: Node[] | null = null\n let currentChild: Disposer | null = null\n\n // Install a persistent sentinel at the compiler anchor's position. The\n // original anchor is removed so downstream compiler walk indices (which\n // treat the conditional slot as a single node position) stay correct. The\n // sentinel stays in the DOM for the lifetime of this conditional and serves\n // as a stable insertion point for every swap.\n const sentinel = document.createComment('')\n const p0 = anchor.parentNode ?? parent\n p0.insertBefore(sentinel, anchor)\n p0.removeChild(anchor)\n\n const placeholder: BranchFactory = () => document.createComment('')\n const elseFactory = mkFalse ?? placeholder\n\n function unmount(): void {\n if (currentChild) {\n currentChild.dispose()\n currentChild = null\n }\n if (currentNodes) {\n for (let i = 0; i < currentNodes.length; i++) {\n const n = currentNodes[i]\n const p = n.parentNode\n if (p) p.removeChild(n)\n }\n currentNodes = null\n }\n }\n\n function mount(v: boolean): void {\n const childD = disposer.child()\n const factory = v ? mkTrue : elseFactory\n // Build the branch's DOM without leaking eager reads into the enclosing\n // withTracking scope. Fine-grained reactive primitives inside the branch\n // (reactiveText, reactiveAttr, keyedList, etc.) set up their own tracking\n // scopes via bind/withTracking — they don't need the outer scope.\n const node = untrack(() => factory(childD))\n // Capture child list BEFORE insertion — DocumentFragment children are\n // moved out of the fragment into `parent` on insertBefore. Use nodeType\n // (11 = DOCUMENT_FRAGMENT_NODE) so the check works regardless of whether\n // `DocumentFragment` is a global in the host environment.\n const isFragment = node.nodeType === 11\n const nodes: Node[] = isFragment ? Array.from(node.childNodes) : [node]\n const p = sentinel.parentNode ?? parent\n p.insertBefore(node, sentinel)\n currentChild = childD\n currentNodes = nodes\n }\n\n function swap(v: boolean): void {\n if (v === currentValue) return\n unmount()\n currentValue = v\n mount(v)\n }\n\n withTracking(disposer, root, () => {\n const v = !!cond()\n swap(v)\n })\n\n // Ensure final teardown when the parent scope disposes. `withTracking`\n // already registers its own teardown for subscriptions; we additionally\n // remove the live branch nodes + dispose the active branch scope.\n disposer.add(() => {\n unmount()\n if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel)\n currentValue = null\n })\n}\n"],"mappings":";;AAwBA,SAAgB,YACd,QACA,QACA,UACA,MACA,MACA,QACA,SACM;CACN,IAAI,eAA+B;CACnC,IAAI,eAA8B;CAClC,IAAI,eAAgC;CAOpC,MAAM,WAAW,SAAS,cAAc,GAAG;CAC3C,MAAM,KAAK,OAAO,cAAc;AAChC,IAAG,aAAa,UAAU,OAAO;AACjC,IAAG,YAAY,OAAO;CAEtB,MAAM,oBAAmC,SAAS,cAAc,GAAG;CACnE,MAAM,cAAc,WAAW;CAE/B,SAAS,UAAgB;AACvB,MAAI,cAAc;AAChB,gBAAa,SAAS;AACtB,kBAAe;;AAEjB,MAAI,cAAc;AAChB,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;IAC5C,MAAM,IAAI,aAAa;IACvB,MAAM,IAAI,EAAE;AACZ,QAAI,EAAG,GAAE,YAAY,EAAE;;AAEzB,kBAAe;;;CAInB,SAAS,MAAM,GAAkB;EAC/B,MAAM,SAAS,SAAS,OAAO;EAC/B,MAAM,UAAU,IAAI,SAAS;EAK7B,MAAM,OAAO,cAAc,QAAQ,OAAO,CAAC;EAM3C,MAAM,QADa,KAAK,aAAa,KACF,MAAM,KAAK,KAAK,WAAW,GAAG,CAAC,KAAK;AAEvE,GADU,SAAS,cAAc,QAC/B,aAAa,MAAM,SAAS;AAC9B,iBAAe;AACf,iBAAe;;CAGjB,SAAS,KAAK,GAAkB;AAC9B,MAAI,MAAM,aAAc;AACxB,WAAS;AACT,iBAAe;AACf,QAAM,EAAE;;AAGV,cAAa,UAAU,YAAY;AAEjC,OAAK,CADM,CAAC,MAAM,CACX;GACP;AAKF,UAAS,UAAU;AACjB,WAAS;AACT,MAAI,SAAS,WAAY,UAAS,WAAW,YAAY,SAAS;AAClE,iBAAe;GACf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region ../gea/src/runtime/delegate-event.ts
|
|
2
|
+
const _NON_BUBBLING = {
|
|
3
|
+
blur: true,
|
|
4
|
+
focus: true,
|
|
5
|
+
mouseenter: true,
|
|
6
|
+
mouseleave: true,
|
|
7
|
+
scroll: true
|
|
8
|
+
};
|
|
9
|
+
function dispatchWithCurrentTarget(handler, event, currentTarget) {
|
|
10
|
+
const previous = Object.getOwnPropertyDescriptor(event, "currentTarget");
|
|
11
|
+
Object.defineProperty(event, "currentTarget", {
|
|
12
|
+
configurable: true,
|
|
13
|
+
value: currentTarget
|
|
14
|
+
});
|
|
15
|
+
try {
|
|
16
|
+
handler(event);
|
|
17
|
+
} finally {
|
|
18
|
+
if (previous) Object.defineProperty(event, "currentTarget", previous);
|
|
19
|
+
else delete event.currentTarget;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function delegateEvent(root, type, pairs, _disposer) {
|
|
23
|
+
const rt = typeof document !== "undefined" ? document : root.ownerDocument;
|
|
24
|
+
const k = "__on_" + type;
|
|
25
|
+
const currentTargetKey = "__onct_" + type;
|
|
26
|
+
const flag = "__d_" + type;
|
|
27
|
+
if (!rt[flag]) {
|
|
28
|
+
rt[flag] = 1;
|
|
29
|
+
rt.addEventListener(type, (e) => {
|
|
30
|
+
for (let n = e.target; n && n !== rt; n = n.parentNode) {
|
|
31
|
+
const h = n[k];
|
|
32
|
+
if (h !== void 0) {
|
|
33
|
+
h(e);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const hct = n[currentTargetKey];
|
|
37
|
+
if (hct !== void 0) {
|
|
38
|
+
dispatchWithCurrentTarget(hct, e, n);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, _NON_BUBBLING[type] === true);
|
|
43
|
+
}
|
|
44
|
+
for (let i = 0; i < pairs.length; i++) {
|
|
45
|
+
const el = pairs[i][0];
|
|
46
|
+
if (el) if (pairs[i][2] === false) el[k] = pairs[i][1];
|
|
47
|
+
else el[currentTargetKey] = pairs[i][1];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { delegateEvent as t };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=delegate-event.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-event.mjs","names":[],"sources":["../../gea/src/runtime/delegate-event.ts"],"sourcesContent":["/**\n * Per-document event delegation via element expando properties.\n *\n * Fast JSX-declared handlers are stored as own properties on their host\n * element (`el.__on_click = handler`). Handlers that need element-local\n * `currentTarget` semantics use the slower `__onct_click` slot.\n * A single document-level listener per eventType walks from `e.target` up,\n * checks the expando on each node, and dispatches.\n *\n * Why this beats a Map<Element, Handler> dispatcher:\n * - Expando lookup is an inline-cached own-property read.\n * - No per-list Map allocation; DOM nodes are the storage.\n * - Detached elements take their handler expando with them, so bulk row\n * teardown avoids removeEventListener / Map.delete work.\n *\n * Although the real DOM listener is installed on the document, Gea exposes\n * element-local handler semantics: while a matched handler runs,\n * `e.currentTarget` is the element that owned that handler.\n */\n\nimport type { Disposer } from './disposer'\n\nconst _NON_BUBBLING: Record<string, true> = {\n blur: true,\n focus: true,\n mouseenter: true,\n mouseleave: true,\n scroll: true,\n}\n\ntype Handler = (e: Event) => void\ntype HandlerPair = [Element, Handler] | [Element, Handler, false]\n\nfunction dispatchWithCurrentTarget(handler: Handler, event: Event, currentTarget: Element): void {\n const previous = Object.getOwnPropertyDescriptor(event, 'currentTarget')\n Object.defineProperty(event, 'currentTarget', { configurable: true, value: currentTarget })\n try {\n handler(event)\n } finally {\n if (previous) Object.defineProperty(event, 'currentTarget', previous)\n else delete (event as any).currentTarget\n }\n}\n\nexport function delegateEvent(root: Element, type: string, pairs: HandlerPair[], _disposer: Disposer): void {\n // Prefer the live global `document` — template clones' ownerDocument may\n // differ from the adopted document (jsdom installs fresh docs per test).\n const rt: any = typeof document !== 'undefined' ? document : root.ownerDocument\n const k = '__on_' + type\n const currentTargetKey = '__onct_' + type\n const flag = '__d_' + type\n if (!rt[flag]) {\n rt[flag] = 1\n rt.addEventListener(\n type,\n (e: Event) => {\n for (let n: Node | null = e.target as Node | null; n && n !== rt; n = n.parentNode) {\n const h = (n as any)[k] as Handler | undefined\n if (h !== undefined) {\n h(e)\n return\n }\n const hct = (n as any)[currentTargetKey] as Handler | undefined\n if (hct !== undefined) {\n dispatchWithCurrentTarget(hct, e, n as Element)\n return\n }\n }\n },\n _NON_BUBBLING[type] === true,\n )\n }\n for (let i = 0; i < pairs.length; i++) {\n const el = pairs[i][0]\n if (el) {\n if (pairs[i][2] === false) {\n ;(el as any)[k] = pairs[i][1]\n } else {\n ;(el as any)[currentTargetKey] = pairs[i][1]\n }\n }\n }\n // No disposer cleanup: when the element is removed from the DOM and GC'd,\n // the expando dies with it. Skipping a symmetric removeDelegate avoids\n // N `delete el[k]` per row on large replace/clear workloads. A dead expando\n // on a detached element is harmless: events no longer bubble through it, so\n // the document listener never walks into it.\n}\n"],"mappings":";AAsBA,MAAM,gBAAsC;CAC1C,MAAM;CACN,OAAO;CACP,YAAY;CACZ,YAAY;CACZ,QAAQ;CACT;AAKD,SAAS,0BAA0B,SAAkB,OAAc,eAA8B;CAC/F,MAAM,WAAW,OAAO,yBAAyB,OAAO,gBAAgB;AACxE,QAAO,eAAe,OAAO,iBAAiB;EAAE,cAAc;EAAM,OAAO;EAAe,CAAC;AAC3F,KAAI;AACF,UAAQ,MAAM;WACN;AACR,MAAI,SAAU,QAAO,eAAe,OAAO,iBAAiB,SAAS;MAChE,QAAQ,MAAc;;;AAI/B,SAAgB,cAAc,MAAe,MAAc,OAAsB,WAA2B;CAG1G,MAAM,KAAU,OAAO,aAAa,cAAc,WAAW,KAAK;CAClE,MAAM,IAAI,UAAU;CACpB,MAAM,mBAAmB,YAAY;CACrC,MAAM,OAAO,SAAS;AACtB,KAAI,CAAC,GAAG,OAAO;AACb,KAAG,QAAQ;AACX,KAAG,iBACD,OACC,MAAa;AACZ,QAAK,IAAI,IAAiB,EAAE,QAAuB,KAAK,MAAM,IAAI,IAAI,EAAE,YAAY;IAClF,MAAM,IAAK,EAAU;AACrB,QAAI,MAAM,KAAA,GAAW;AACnB,OAAE,EAAE;AACJ;;IAEF,MAAM,MAAO,EAAU;AACvB,QAAI,QAAQ,KAAA,GAAW;AACrB,+BAA0B,KAAK,GAAG,EAAa;AAC/C;;;KAIN,cAAc,UAAU,KACzB;;AAEH,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,KAAK,MAAM,GAAG;AACpB,MAAI,GACF,KAAI,MAAM,GAAG,OAAO,MAChB,IAAW,KAAK,MAAM,GAAG;MAEzB,IAAW,oBAAoB,MAAM,GAAG"}
|
package/dist/dialog.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as ZagComponent } from "./zag-component.mjs";
|
|
2
|
+
import { t as JSXNode } from "./types.mjs";
|
|
2
3
|
import * as dialog from "@zag-js/dialog";
|
|
3
4
|
import { OpenChangeDetails } from "@zag-js/dialog";
|
|
4
5
|
import * as _$_zag_js_types0 from "@zag-js/types";
|
|
@@ -6,7 +7,7 @@ import * as _$_zag_js_types0 from "@zag-js/types";
|
|
|
6
7
|
//#region src/components/dialog.d.ts
|
|
7
8
|
interface DialogProps {
|
|
8
9
|
class?: string;
|
|
9
|
-
children?:
|
|
10
|
+
children?: JSXNode;
|
|
10
11
|
triggerLabel?: string;
|
|
11
12
|
title?: string;
|
|
12
13
|
description?: string;
|
|
@@ -25,7 +26,7 @@ declare class Dialog extends ZagComponent<DialogProps> {
|
|
|
25
26
|
open: boolean;
|
|
26
27
|
createMachine(_props: DialogProps): any;
|
|
27
28
|
getMachineProps(props: DialogProps): {
|
|
28
|
-
id:
|
|
29
|
+
id: string;
|
|
29
30
|
open: boolean;
|
|
30
31
|
defaultOpen: boolean;
|
|
31
32
|
modal: boolean;
|
|
@@ -50,7 +51,7 @@ declare class Dialog extends ZagComponent<DialogProps> {
|
|
|
50
51
|
'[data-part="trigger"]': (api: any) => any;
|
|
51
52
|
};
|
|
52
53
|
syncState(api: any): void;
|
|
53
|
-
template(props: DialogProps):
|
|
54
|
+
template(props: DialogProps): any;
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
export { DialogProps, Dialog as default };
|
package/dist/dialog.mjs
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
import { t as ZagComponent } from "./zag-component.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
|
+
import { n as reactiveTextValue, t as reactiveText } from "./reactive-text.mjs";
|
|
4
|
+
import { t as reactiveClass } from "./reactive-class.mjs";
|
|
5
|
+
import { t as conditionalTruthy } from "./conditional-truthy.mjs";
|
|
3
6
|
import { normalizeProps } from "@zag-js/vanilla";
|
|
4
7
|
import * as dialog from "@zag-js/dialog";
|
|
5
8
|
//#region src/components/dialog.tsx
|
|
9
|
+
let _tpl0_root = null;
|
|
10
|
+
function _tpl0_create() {
|
|
11
|
+
const t = document.createElement("template");
|
|
12
|
+
t.innerHTML = "<div><!--1--><div data-part=backdrop class=\"dialog-backdrop fixed inset-0 bg-black/50 z-50\" hidden></div><div data-part=positioner class=\"dialog-positioner fixed inset-0 flex items-center justify-center z-50\" hidden><div data-part=content class=\"dialog-content text-foreground rounded-lg shadow-xl p-6 w-full max-w-md mx-4\"><!--2--><!--3--><div class=dialog-body>0</div><button data-part=close-trigger class=\"dialog-close-trigger absolute top-3 right-3 text-muted-foreground hover:text-foreground\">✕";
|
|
13
|
+
return t.content.firstChild;
|
|
14
|
+
}
|
|
15
|
+
let _tpl1_root = null;
|
|
16
|
+
function _tpl1_create() {
|
|
17
|
+
const t = document.createElement("template");
|
|
18
|
+
t.innerHTML = "<button data-part=trigger class=dialog-trigger>0";
|
|
19
|
+
return t.content.firstChild;
|
|
20
|
+
}
|
|
21
|
+
let _tpl2_root = null;
|
|
22
|
+
function _tpl2_create() {
|
|
23
|
+
const t = document.createElement("template");
|
|
24
|
+
t.innerHTML = "<h2 data-part=title class=\"dialog-title text-lg font-semibold mb-2\">0";
|
|
25
|
+
return t.content.firstChild;
|
|
26
|
+
}
|
|
27
|
+
let _tpl3_root = null;
|
|
28
|
+
function _tpl3_create() {
|
|
29
|
+
const t = document.createElement("template");
|
|
30
|
+
t.innerHTML = "<p data-part=description class=\"dialog-description text-sm text-muted-foreground mb-4\">0";
|
|
31
|
+
return t.content.firstChild;
|
|
32
|
+
}
|
|
6
33
|
var Dialog = class extends ZagComponent {
|
|
7
|
-
static {
|
|
8
|
-
this.__geaTagName = "gea-dialog";
|
|
9
|
-
}
|
|
10
|
-
constructor(...args) {
|
|
11
|
-
super(...args);
|
|
12
|
-
this.props;
|
|
13
|
-
this[geaCondValueSymbol(0)] = !!this.props.title;
|
|
14
|
-
this[geaCondValueSymbol(1)] = !!this.props.description;
|
|
15
|
-
this[geaCondValueSymbol(2)] = !!this.props.triggerLabel;
|
|
16
|
-
this[GEA_REGISTER_COND](0, "c0", () => {
|
|
17
|
-
this.props;
|
|
18
|
-
return this.props.title;
|
|
19
|
-
}, () => {
|
|
20
|
-
this.props;
|
|
21
|
-
return `<h2 data-part="title" class="dialog-title text-lg font-semibold mb-2">${geaEscapeHtml(String(this.props.title))}</h2>`;
|
|
22
|
-
}, null);
|
|
23
|
-
this[GEA_REGISTER_COND](1, "c1", () => {
|
|
24
|
-
this.props;
|
|
25
|
-
return this.props.description;
|
|
26
|
-
}, () => {
|
|
27
|
-
this.props;
|
|
28
|
-
return `<p data-part="description" class="dialog-description text-sm text-muted-foreground mb-4">${geaEscapeHtml(String(this.props.description))}</p>`;
|
|
29
|
-
}, null);
|
|
30
|
-
this[GEA_REGISTER_COND](2, "c2", () => {
|
|
31
|
-
this.props;
|
|
32
|
-
return this.props.triggerLabel;
|
|
33
|
-
}, () => {
|
|
34
|
-
this.props;
|
|
35
|
-
return `<button data-part="trigger" class="dialog-trigger">${geaEscapeHtml(String(this.props.triggerLabel))}</button>`;
|
|
36
|
-
}, null);
|
|
37
|
-
}
|
|
38
34
|
createMachine(_props) {
|
|
39
35
|
return dialog.machine;
|
|
40
36
|
}
|
|
@@ -91,7 +87,7 @@ var Dialog = class extends ZagComponent {
|
|
|
91
87
|
onpointerdown: preventTriggerFocus,
|
|
92
88
|
onmousedown: preventTriggerFocus,
|
|
93
89
|
onclick: (e) => {
|
|
94
|
-
e.
|
|
90
|
+
(e.target?.closest("button, [role=\"button\"]"))?.blur();
|
|
95
91
|
origOnClick?.(e);
|
|
96
92
|
}
|
|
97
93
|
};
|
|
@@ -101,43 +97,34 @@ var Dialog = class extends ZagComponent {
|
|
|
101
97
|
syncState(api) {
|
|
102
98
|
this.open = api.open;
|
|
103
99
|
}
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (key === "title") this[GEA_PATCH_COND](0);
|
|
136
|
-
if (key === "description") this[GEA_PATCH_COND](1);
|
|
137
|
-
if (key === "triggerLabel") this[GEA_PATCH_COND](2);
|
|
138
|
-
}
|
|
139
|
-
__resetEls() {
|
|
140
|
-
this.__e0 = null;
|
|
100
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
101
|
+
const root = (_tpl0_root || (_tpl0_root = _tpl0_create())).cloneNode(true);
|
|
102
|
+
const el0 = root;
|
|
103
|
+
const anchor1 = root.firstChild;
|
|
104
|
+
const anchor2 = root.childNodes[2].firstChild.firstChild;
|
|
105
|
+
const anchor3 = root.childNodes[2].firstChild.childNodes[1];
|
|
106
|
+
const marker4 = root.childNodes[2].firstChild.childNodes[2].firstChild;
|
|
107
|
+
reactiveClass(el0, d, this, () => this.props.class || "");
|
|
108
|
+
conditionalTruthy(anchor1.parentNode, anchor1, d, this, () => this.props.triggerLabel, (d) => {
|
|
109
|
+
const root = (_tpl1_root || (_tpl1_root = _tpl1_create())).cloneNode(true);
|
|
110
|
+
const t0 = root.firstChild;
|
|
111
|
+
reactiveTextValue(t0, d, this, () => this.props.triggerLabel);
|
|
112
|
+
return root;
|
|
113
|
+
});
|
|
114
|
+
conditionalTruthy(anchor2.parentNode, anchor2, d, this, () => this.props.title, (d) => {
|
|
115
|
+
const root = (_tpl2_root || (_tpl2_root = _tpl2_create())).cloneNode(true);
|
|
116
|
+
const t0 = root.firstChild;
|
|
117
|
+
reactiveTextValue(t0, d, this, () => this.props.title);
|
|
118
|
+
return root;
|
|
119
|
+
});
|
|
120
|
+
conditionalTruthy(anchor3.parentNode, anchor3, d, this, () => this.props.description, (d) => {
|
|
121
|
+
const root = (_tpl3_root || (_tpl3_root = _tpl3_create())).cloneNode(true);
|
|
122
|
+
const t0 = root.firstChild;
|
|
123
|
+
reactiveTextValue(t0, d, this, () => this.props.description);
|
|
124
|
+
return root;
|
|
125
|
+
});
|
|
126
|
+
reactiveText(marker4, d, this, () => this.props.children);
|
|
127
|
+
return root;
|
|
141
128
|
}
|
|
142
129
|
};
|
|
143
130
|
//#endregion
|
package/dist/dialog.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.mjs","names":["
|
|
1
|
+
{"version":3,"file":"dialog.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","reactiveTextValue","conditionalTruthy","reactiveText","dialog","OpenChangeDetails","normalizeProps","JSXNode","ZagComponent","DialogProps","class","children","triggerLabel","title","description","open","defaultOpen","modal","closeOnInteractOutside","closeOnEscape","trapFocus","preventScroll","role","onOpenChange","details","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","_tpl1_root","_tpl1_create","_tpl2_root","_tpl2_create","_tpl3_root","_tpl3_create","Dialog","createMachine","_props","machine","getMachineProps","props","id","connectApi","service","connect","getSpreadMap","[data-part=\"positioner\"]","api","getPositionerProps","hidden","[data-part=\"close-trigger\"]","_","getCloseTriggerProps","onclick","e","MouseEvent","defaultPrevented","setOpen","[data-part=\"trigger\"]","getTriggerProps","origOnClick","preventTriggerFocus","PointerEvent","button","preventDefault","onpointerdown","onmousedown","btn","target","HTMLElement","closest","blur","syncState","d","root","cloneNode","el0","anchor1","anchor2","childNodes","anchor3","marker4","parentNode","marker0","t0","t4"],"sources":["../src/components/dialog.tsx"],"sourcesContent":["import * as dialog from '@zag-js/dialog'\nimport type { OpenChangeDetails } from '@zag-js/dialog'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport type { JSXNode } from '../types'\nimport ZagComponent from '../primitives/zag-component'\n\nexport interface DialogProps {\n class?: string\n children?: JSXNode\n triggerLabel?: string\n title?: string\n description?: string\n open?: boolean\n defaultOpen?: boolean\n modal?: boolean\n closeOnInteractOutside?: boolean\n closeOnEscape?: boolean\n trapFocus?: boolean\n preventScroll?: boolean\n role?: string\n 'aria-label'?: string\n onOpenChange?: (details: OpenChangeDetails) => void\n}\n\nexport default class Dialog extends ZagComponent<DialogProps> {\n declare open: boolean\n\n createMachine(_props: DialogProps): any {\n return dialog.machine\n }\n\n getMachineProps(props: DialogProps) {\n return {\n id: this.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n modal: props.modal ?? true,\n closeOnInteractOutside: props.closeOnInteractOutside ?? true,\n closeOnEscape: props.closeOnEscape ?? true,\n trapFocus: props.trapFocus ?? true,\n preventScroll: props.preventScroll ?? true,\n role: props.role ?? 'dialog',\n 'aria-label': props['aria-label'],\n onOpenChange: (details: OpenChangeDetails) => {\n this.open = details.open\n props.onOpenChange?.(details)\n },\n }\n }\n\n connectApi(service: any) {\n return dialog.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"backdrop\"]': 'getBackdropProps',\n '[data-part=\"positioner\"]': (api: any) => ({\n ...api.getPositionerProps(),\n hidden: !api.open,\n }),\n '[data-part=\"content\"]': 'getContentProps',\n '[data-part=\"title\"]': 'getTitleProps',\n '[data-part=\"description\"]': 'getDescriptionProps',\n '[data-part=\"close-trigger\"]': (api: any) => {\n const { id: _, ...props } = api.getCloseTriggerProps()\n return {\n ...props,\n // normalizeProps lowercases onClick → onclick; must match to override\n // Zag's default handler which calls stopPropagation()\n onclick: (e: MouseEvent) => {\n if (e.defaultPrevented) return\n api.setOpen(false)\n },\n }\n },\n '[data-part=\"trigger\"]': (api: any) => {\n const props = api.getTriggerProps()\n const origOnClick = props.onclick\n const preventTriggerFocus = (e: MouseEvent | PointerEvent) => {\n if ('button' in e && e.button !== 0) return\n e.preventDefault()\n }\n return {\n ...props,\n onpointerdown: preventTriggerFocus,\n onmousedown: preventTriggerFocus,\n onclick: (e: MouseEvent) => {\n const btn = (e.target as HTMLElement)?.closest('button, [role=\"button\"]') as HTMLElement | null\n btn?.blur()\n origOnClick?.(e)\n },\n }\n },\n }\n }\n\n syncState(api: any) {\n this.open = api.open\n }\n\n template(props: DialogProps) {\n return (\n <div class={props.class || ''}>\n {props.triggerLabel && (\n <button data-part=\"trigger\" class=\"dialog-trigger\">\n {props.triggerLabel}\n </button>\n )}\n <div data-part=\"backdrop\" class=\"dialog-backdrop fixed inset-0 bg-black/50 z-50\" hidden></div>\n <div\n data-part=\"positioner\"\n class=\"dialog-positioner fixed inset-0 flex items-center justify-center z-50\"\n hidden\n >\n <div data-part=\"content\" class=\"dialog-content text-foreground rounded-lg shadow-xl p-6 w-full max-w-md mx-4\">\n {props.title && (\n <h2 data-part=\"title\" class=\"dialog-title text-lg font-semibold mb-2\">\n {props.title}\n </h2>\n )}\n {props.description && (\n <p data-part=\"description\" class=\"dialog-description text-sm text-muted-foreground mb-4\">\n {props.description}\n </p>\n )}\n <div class=\"dialog-body\">{props.children}</div>\n <button\n data-part=\"close-trigger\"\n class=\"dialog-close-trigger absolute top-3 right-3 text-muted-foreground hover:text-foreground\"\n >\n ✕\n </button>\n </div>\n </div>\n </div>\n )\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirty-symbols.mjs","names":[],"sources":["../../gea/src/runtime/dirty-symbols.ts"],"sourcesContent":["// Dirty markers shared by the store and compiler-emitted keyed-list kernels.\n// These stay on Symbol.for because store modules and compiled component modules\n// can be evaluated through different Vite module instances during tests/dev.\nconst _DIRTY: unique symbol = Symbol.for('gea.d.dirty') as any\nconst _DIRTY_PROPS: unique symbol = Symbol.for('gea.d.dirtyProps') as any\n\nexport { _DIRTY as GEA_DIRTY, _DIRTY_PROPS as GEA_DIRTY_PROPS }\n"],"mappings":";AAGA,MAAM,SAAwB,OAAO,IAAI,cAAc;AACvD,MAAM,eAA8B,OAAO,IAAI,mBAAmB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region ../gea/src/runtime/disposer.ts
|
|
2
|
+
var _Disposer = class _Disposer {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.f = [];
|
|
5
|
+
}
|
|
6
|
+
add(fn) {
|
|
7
|
+
this.f.push(fn);
|
|
8
|
+
}
|
|
9
|
+
dispose() {
|
|
10
|
+
const f = this.f;
|
|
11
|
+
try {
|
|
12
|
+
for (let i = f.length - 1; i >= 0; i--) f[i]();
|
|
13
|
+
} catch {}
|
|
14
|
+
f.length = 0;
|
|
15
|
+
}
|
|
16
|
+
child() {
|
|
17
|
+
const c = new _Disposer();
|
|
18
|
+
this.f.push(_dispatchChild(c));
|
|
19
|
+
return c;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function _dispatchChild(c) {
|
|
23
|
+
return () => c.dispose();
|
|
24
|
+
}
|
|
25
|
+
function createDisposer() {
|
|
26
|
+
return new _Disposer();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Shared no-op disposer for rows that register no cleanup work.
|
|
30
|
+
*
|
|
31
|
+
* The compiler references this (via `@geajs/core`'s export surface) whenever
|
|
32
|
+
* a keyed-list site proves `noRowDisposer: true` — cheaper than emitting a
|
|
33
|
+
* fresh `{ add() {}, dispose() {}, child() { return this } }` literal per
|
|
34
|
+
* row. 09 clear1k ×8 was paying ~8k object-literal allocations before.
|
|
35
|
+
*/
|
|
36
|
+
const NOOP_DISPOSER = {
|
|
37
|
+
add(_fn) {},
|
|
38
|
+
dispose() {},
|
|
39
|
+
child() {
|
|
40
|
+
return NOOP_DISPOSER;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { createDisposer as n, NOOP_DISPOSER as t };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=disposer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposer.mjs","names":[],"sources":["../../gea/src/runtime/disposer.ts"],"sourcesContent":["/**\n * Disposer — LIFO teardown registry.\n *\n * Class-based so the `add` / `dispose` / `child` methods live on the prototype\n * once, instead of being closures created per instance. Each `createDisposer()`\n * call was allocating 3 closures; on a 1000-row keyed list with per-row\n * children that's ~3000 closure allocations that GC had to chase. The class\n * form drops that to one shared prototype plus the per-instance `f[]` array\n * and (for children) a single dispose-bridge closure.\n */\n\nexport interface Disposer {\n add(fn: () => void): void\n dispose(): void\n child(): Disposer\n}\n\nclass _Disposer implements Disposer {\n f: Array<() => void> = []\n add(fn: () => void): void {\n this.f.push(fn)\n }\n dispose(): void {\n const f = this.f\n // Hoisted try/catch (one per dispose call, not per iteration) — measurable\n // on 09_clear1k's ~5000-cleanup teardown. Framework-owned cleanups don't\n // throw under normal operation; if one does, the remainder of THIS\n // disposer's stack is skipped (best-effort teardown: one failure does not\n // run the rest of this disposer's callbacks).\n try {\n for (let i = f.length - 1; i >= 0; i--) f[i]()\n } catch {\n /* one handler threw */\n }\n f.length = 0\n }\n child(): Disposer {\n const c = new _Disposer()\n this.f.push(_dispatchChild(c))\n return c\n }\n}\n\nfunction _dispatchChild(c: _Disposer): () => void {\n return () => c.dispose()\n}\n\nexport function createDisposer(): Disposer {\n return new _Disposer()\n}\n\n/**\n * Shared no-op disposer for rows that register no cleanup work.\n *\n * The compiler references this (via `@geajs/core`'s export surface) whenever\n * a keyed-list site proves `noRowDisposer: true` — cheaper than emitting a\n * fresh `{ add() {}, dispose() {}, child() { return this } }` literal per\n * row. 09 clear1k ×8 was paying ~8k object-literal allocations before.\n */\nexport const NOOP_DISPOSER: Disposer = {\n add(_fn: () => void): void {\n /* no-op */\n },\n dispose(): void {\n /* no-op */\n },\n child(): Disposer {\n return NOOP_DISPOSER\n },\n}\n"],"mappings":";AAiBA,IAAM,YAAN,MAAM,UAA8B;;WACX,EAAE;;CACzB,IAAI,IAAsB;AACxB,OAAK,EAAE,KAAK,GAAG;;CAEjB,UAAgB;EACd,MAAM,IAAI,KAAK;AAMf,MAAI;AACF,QAAK,IAAI,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,IAAK,GAAE,IAAI;UACxC;AAGR,IAAE,SAAS;;CAEb,QAAkB;EAChB,MAAM,IAAI,IAAI,WAAW;AACzB,OAAK,EAAE,KAAK,eAAe,EAAE,CAAC;AAC9B,SAAO;;;AAIX,SAAS,eAAe,GAA0B;AAChD,cAAa,EAAE,SAAS;;AAG1B,SAAgB,iBAA2B;AACzC,QAAO,IAAI,WAAW;;;;;;;;;;AAWxB,MAAa,gBAA0B;CACrC,IAAI,KAAuB;CAG3B,UAAgB;CAGhB,QAAkB;AAChB,SAAO;;CAEV"}
|
package/dist/dnd-manager.d.mts
CHANGED
|
@@ -5,10 +5,11 @@ interface DragResult {
|
|
|
5
5
|
droppableId: string;
|
|
6
6
|
index: number;
|
|
7
7
|
};
|
|
8
|
+
/** `null` when dropped outside any droppable or returned to same position. */
|
|
8
9
|
destination: {
|
|
9
10
|
droppableId: string;
|
|
10
11
|
index: number;
|
|
11
|
-
};
|
|
12
|
+
} | null;
|
|
12
13
|
}
|
|
13
14
|
declare class DndManager {
|
|
14
15
|
droppables: Map<string, HTMLElement>;
|
|
@@ -21,6 +22,13 @@ declare class DndManager {
|
|
|
21
22
|
private _sourceDroppableId;
|
|
22
23
|
private _sourceIndex;
|
|
23
24
|
private _sourceEl;
|
|
25
|
+
/**
|
|
26
|
+
* If the source draggable is nested inside a component-boundary wrapper
|
|
27
|
+
* (e.g. a `<span style="display:contents">` inside the droppable), this
|
|
28
|
+
* holds that wrapper — the actual direct child of the droppable that we
|
|
29
|
+
* move/return. When there is no wrapper, this equals `_sourceEl`.
|
|
30
|
+
*/
|
|
31
|
+
private _sourceWrapper;
|
|
24
32
|
private _sourceHeight;
|
|
25
33
|
private _sourceRect;
|
|
26
34
|
private _savedCssText;
|