@geajs/ui 0.2.9 → 0.2.10
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/bind.mjs +74 -35
- package/dist/bind.mjs.map +1 -1
- package/dist/combobox.mjs +74 -6
- package/dist/combobox.mjs.map +1 -1
- package/dist/compiled-component.mjs +11 -9
- package/dist/compiled-component.mjs.map +1 -1
- package/dist/compiled-reactive-component.mjs +129 -31
- package/dist/compiled-reactive-component.mjs.map +1 -1
- package/dist/component-id.mjs +12 -1
- package/dist/component-id.mjs.map +1 -1
- package/dist/conditional.mjs.map +1 -1
- package/dist/delegate-event.mjs +9 -9
- package/dist/delegate-event.mjs.map +1 -1
- package/dist/disposer.mjs +30 -11
- package/dist/disposer.mjs.map +1 -1
- package/dist/draggable2.mjs +135 -32
- package/dist/draggable2.mjs.map +1 -1
- package/dist/file-upload.mjs +74 -6
- package/dist/file-upload.mjs.map +1 -1
- package/dist/hover-card.mjs +2 -2
- package/dist/hover-card.mjs.map +1 -1
- package/dist/input2.mjs +2 -2
- package/dist/input2.mjs.map +1 -1
- package/dist/item-obs.mjs +11 -48
- package/dist/item-obs.mjs.map +1 -1
- package/dist/keyed-list.mjs +90 -39
- package/dist/keyed-list.mjs.map +1 -1
- package/dist/menu.mjs +7 -7
- package/dist/menu.mjs.map +1 -1
- package/dist/pin-input.mjs +6 -6
- package/dist/pin-input.mjs.map +1 -1
- package/dist/progress.mjs +2 -2
- package/dist/progress.mjs.map +1 -1
- package/dist/rating-group.mjs +8 -8
- package/dist/rating-group.mjs.map +1 -1
- package/dist/reactive-attr.mjs +2 -2
- package/dist/reactive-attr.mjs.map +1 -1
- package/dist/reactive-bool.mjs +2 -2
- package/dist/reactive-bool.mjs.map +1 -1
- package/dist/reactive-class-name.mjs +2 -2
- package/dist/reactive-class-name.mjs.map +1 -1
- package/dist/reactive-class.mjs +5 -4
- package/dist/reactive-class.mjs.map +1 -1
- package/dist/reactive-style.mjs +15 -12
- package/dist/reactive-style.mjs.map +1 -1
- package/dist/reactive-text.mjs +4 -4
- package/dist/reactive-text.mjs.map +1 -1
- package/dist/tags-input.mjs +10 -10
- package/dist/tags-input.mjs.map +1 -1
- package/dist/tooltip.mjs +3 -3
- package/dist/tooltip.mjs.map +1 -1
- package/dist/zag-component.d.mts +1 -0
- package/dist/zag-component.mjs +10 -1
- package/dist/zag-component.mjs.map +1 -1
- package/package.json +1 -1
package/dist/tags-input.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags-input.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","reactiveTextValue","conditionalTruthy","reactiveAttr","GEA_DOM_ITEM","createItemObservable","
|
|
1
|
+
{"version":3,"file":"tags-input.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","reactiveTextValue","conditionalTruthy","reactiveAttr","GEA_DOM_ITEM","createItemObservable","readItem","GEA_PROXY_RAW","_rescue","keyedList","tagsInput","normalizeProps","ZagComponent","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","_tpl1_root","_tpl1_create","_tpl2_root","_tpl2_create","__rq_L0","Map","TagsInput","value","createMachine","_props","machine","getMachineProps","props","id","defaultValue","max","maxLength","disabled","readOnly","invalid","addOnPaste","editable","allowDuplicates","name","form","placeholder","blurBehavior","delimiter","onValueChange","details","ValueChangeDetails","connectApi","service","connect","getSpreadMap","[data-part=\"item\"]","api","el","ds","HTMLElement","dataset","getItemProps","index","[data-part=\"item-preview\"]","getItemPreviewProps","[data-part=\"item-text\"]","getItemTextProps","[data-part=\"item-delete-trigger\"]","getItemDeleteTriggerProps","syncState","d","root","cloneNode","el0","anchor1","anchor2","childNodes","class","parentNode","label","marker0","t0","__ki_L0","__geaItemObservable","i","el1","el2","el3","el4","el5","el6","marker7","el8","el9","String","t7","container","anchor","disposer","pending","path","key","tag","createEntry","item","idx","__k","__r","__raw","__prev","obs","current","_fire","__rd","child","__obs","__li","__el","element","patchEntry","e","newItem","newIdx"],"sources":["../src/components/tags-input.tsx"],"sourcesContent":["import * as tagsInput from '@zag-js/tags-input'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport ZagComponent from '../primitives/zag-component'\n\nexport default class TagsInput extends ZagComponent {\n declare value: string[]\n\n createMachine(_props: any): any {\n return tagsInput.machine\n }\n\n getMachineProps(props: any) {\n return {\n id: this.id,\n value: props.value,\n defaultValue: props.defaultValue,\n max: props.max,\n maxLength: props.maxLength,\n disabled: props.disabled,\n readOnly: props.readOnly,\n invalid: props.invalid,\n addOnPaste: props.addOnPaste ?? false,\n editable: props.editable ?? true,\n allowDuplicates: props.allowDuplicates ?? false,\n name: props.name,\n form: props.form,\n placeholder: props.placeholder,\n blurBehavior: props.blurBehavior,\n delimiter: props.delimiter,\n onValueChange: (details: tagsInput.ValueChangeDetails) => {\n this.value = details.value\n props.onValueChange?.(details)\n },\n }\n }\n\n connectApi(service: any) {\n return tagsInput.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"root\"]': 'getRootProps',\n '[data-part=\"label\"]': 'getLabelProps',\n '[data-part=\"control\"]': 'getControlProps',\n '[data-part=\"input\"]': 'getInputProps',\n '[data-part=\"hidden-input\"]': 'getHiddenInputProps',\n '[data-part=\"clear-trigger\"]': 'getClearTriggerProps',\n '[data-part=\"item\"]': (api, el) => {\n const ds = (el as HTMLElement).dataset\n return api.getItemProps({ index: ds.index!, value: ds.value! })\n },\n '[data-part=\"item-preview\"]': (api, el) => {\n const ds = (el as HTMLElement).dataset\n return api.getItemPreviewProps({ index: ds.index!, value: ds.value! })\n },\n '[data-part=\"item-text\"]': (api, el) => {\n const ds = (el as HTMLElement).dataset\n return api.getItemTextProps({ index: ds.index!, value: ds.value! })\n },\n '[data-part=\"item-delete-trigger\"]': (api, el) => {\n const ds = (el as HTMLElement).dataset\n return api.getItemDeleteTriggerProps({ index: ds.index!, value: ds.value! })\n },\n }\n }\n\n syncState(api: any) {\n this.value = api.value\n }\n\n template(props: any) {\n return (\n <div data-part=\"root\" class={props.class || ''}>\n {props.label && (\n <label data-part=\"label\" class=\"tags-input-label text-sm font-medium mb-1 block\">\n {props.label}\n </label>\n )}\n <div\n data-part=\"control\"\n class=\"tags-input-control flex flex-wrap gap-1.5 rounded-md border border-input bg-transparent px-3 py-2 shadow-xs focus-within:ring-1 focus-within:ring-ring\"\n >\n {(this.value || []).map((tag: string, i: number) => (\n <span\n key={`${tag}-${i}`}\n data-part=\"item\"\n data-index={String(i)}\n data-value={tag}\n class=\"tags-input-item inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs font-medium\"\n >\n <span\n data-part=\"item-preview\"\n data-index={String(i)}\n data-value={tag}\n class=\"inline-flex items-center gap-1 data-[highlighted]:ring-2 data-[highlighted]:ring-ring data-[highlighted]:rounded-xs\"\n >\n <span data-part=\"item-text\" data-index={String(i)} data-value={tag}>\n {tag}\n </span>\n </span>\n <button\n data-part=\"item-delete-trigger\"\n data-index={String(i)}\n data-value={tag}\n class=\"tags-input-item-delete text-muted-foreground hover:text-foreground\"\n >\n ✕\n </button>\n </span>\n ))}\n <input\n data-part=\"input\"\n class=\"tags-input-input flex-1 bg-transparent text-sm outline-hidden placeholder:text-muted-foreground min-w-[60px]\"\n />\n </div>\n <input data-part=\"hidden-input\" type=\"hidden\" />\n </div>\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;AAIA,IAAIc,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMC,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAIC,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMP,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAIG,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMT,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QA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,MAAMC,QAAQ/G,qBAAqBoG,KAAK;IAExC,MAAMa,OAAOnC,QAAQkC,OAAMX,KAAKQ,KAAK;AACrC,WAAO;KACLZ,KAAKK;KACLF,MAAMA,QAAQA,KAAKlG,kBAAkBkG;KACrCc,SAASD;KACTnB,UAAUe;KACVH,KAAKK;KACN;;GAEHI,aAAaC,GAAGC,SAASC,WAAW;AAElCF,MAAEhB,OADYiB,WAAWA,QAAQnH,kBAAkBmH;AAEnDD,MAAEV,IAAIC,UAAUU;AAChBD,MAAEV,IAAIE,OAAO;;GAEhB,CAAC;AACF,SAAOzC"}
|
package/dist/tooltip.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { t as ZagComponent } from "./zag-component.mjs";
|
|
|
2
2
|
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
3
3
|
import { n as reactiveTextValue, t as reactiveText } from "./reactive-text.mjs";
|
|
4
4
|
import { t as reactiveClass } from "./reactive-class.mjs";
|
|
5
|
-
import { t as
|
|
5
|
+
import { t as reactiveStyleProp } from "./reactive-style.mjs";
|
|
6
6
|
import { normalizeProps } from "@zag-js/vanilla";
|
|
7
7
|
import * as tooltip from "@zag-js/tooltip";
|
|
8
8
|
//#region src/components/tooltip.tsx
|
|
@@ -59,8 +59,8 @@ var Tooltip = class extends ZagComponent {
|
|
|
59
59
|
const marker3 = root.firstChild.firstChild;
|
|
60
60
|
const marker4 = root.childNodes[1].firstChild.firstChild;
|
|
61
61
|
reactiveClass(el0, d, this, () => this.props.class || "");
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
reactiveStyleProp(el1, d, this, "display", () => "inline-block");
|
|
63
|
+
reactiveStyleProp(el2, d, this, "display", () => "inline-block");
|
|
64
64
|
reactiveText(marker3, d, this, () => this.props.children);
|
|
65
65
|
reactiveTextValue(marker4, d, this, () => this.props.content);
|
|
66
66
|
return root;
|
package/dist/tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","
|
|
1
|
+
{"version":3,"file":"tooltip.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClass","reactiveStyleProp","reactiveText","reactiveTextValue","tooltip","normalizeProps","ZagComponent","_tpl0_root","_tpl0_create","t","document","createElement","innerHTML","content","firstChild","Tooltip","open","createMachine","_props","machine","getMachineProps","props","id","defaultOpen","openDelay","closeDelay","closeOnPointerDown","closeOnEscape","closeOnScroll","interactive","disabled","positioning","onOpenChange","details","OpenChangeDetails","connectApi","service","connect","getSpreadMap","syncState","api","d","root","cloneNode","el0","el1","el2","marker3","marker4","childNodes","class","t3","children","t4"],"sources":["../src/components/tooltip.tsx"],"sourcesContent":["import * as tooltip from '@zag-js/tooltip'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport ZagComponent from '../primitives/zag-component'\n\nexport default class Tooltip extends ZagComponent {\n declare open: boolean\n\n createMachine(_props: any): any {\n return tooltip.machine\n }\n\n getMachineProps(props: any) {\n return {\n id: this.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n openDelay: props.openDelay ?? 400,\n closeDelay: props.closeDelay ?? 150,\n closeOnPointerDown: props.closeOnPointerDown ?? true,\n closeOnEscape: props.closeOnEscape ?? true,\n closeOnScroll: props.closeOnScroll ?? true,\n interactive: props.interactive ?? false,\n disabled: props.disabled,\n positioning: props.positioning,\n 'aria-label': props['aria-label'],\n onOpenChange: (details: tooltip.OpenChangeDetails) => {\n this.open = details.open\n props.onOpenChange?.(details)\n },\n }\n }\n\n connectApi(service: any) {\n return tooltip.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"trigger\"]': 'getTriggerProps',\n '[data-part=\"positioner\"]': 'getPositionerProps',\n '[data-part=\"content\"]': 'getContentProps',\n '[data-part=\"arrow\"]': 'getArrowProps',\n '[data-part=\"arrow-tip\"]': 'getArrowTipProps',\n }\n }\n\n syncState(api: any) {\n this.open = api.open\n }\n\n template(props: any) {\n return (\n <div class={props.class || ''} style={{ display: 'inline-block' }}>\n <div data-part=\"trigger\" class=\"tooltip-trigger\" style={{ display: 'inline-block' }}>\n {props.children}\n </div>\n <div data-part=\"positioner\" class=\"tooltip-positioner\">\n <div\n data-part=\"content\"\n class=\"tooltip-content z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground shadow-md\"\n >\n {props.content}\n </div>\n </div>\n </div>\n )\n }\n}\n"],"mappings":";;;;;;;;AAIA,IAAIQ,aAAa;AACjB,SAASC,eAAe;CACtB,MAAMC,IAAIC,SAASC,cAAc,WAAW;AAC5CF,GAAEG,YAAY;AACd,QAAOH,EAAEI,QAAQC;;AAEnB,IAAqBC,UAArB,cAAqCT,aAAa;CAEhDW,cAAcC,QAAkB;AAC9B,SAAOd,QAAQe;;CAEjBC,gBAAgBC,OAAY;AAC1B,SAAO;GACLC,IAAI,KAAKA;GACTN,MAAMK,MAAML;GACZO,aAAaF,MAAME;GACnBC,WAAWH,MAAMG,aAAa;GAC9BC,YAAYJ,MAAMI,cAAc;GAChCC,oBAAoBL,MAAMK,sBAAsB;GAChDC,eAAeN,MAAMM,iBAAiB;GACtCC,eAAeP,MAAMO,iBAAiB;GACtCC,aAAaR,MAAMQ,eAAe;GAClCC,UAAUT,MAAMS;GAChBC,aAAaV,MAAMU;GACnB,cAAcV,MAAM;GACpBW,eAAeC,YAAuC;AACpD,SAAKjB,OAAOiB,QAAQjB;AACpBK,UAAMW,eAAeC,QAAQ;;GAEhC;;CAEHE,WAAWC,SAAc;AACvB,SAAOhC,QAAQiC,QAAQD,SAAS/B,eAAe;;CAEjDiC,eAAe;AACb,SAAO;GACL,2BAAyB;GACzB,8BAA4B;GAC5B,2BAAyB;GACzB,yBAAuB;GACvB,6BAA2B;GAC5B;;CAEHC,UAAUC,KAAU;AAClB,OAAKxB,OAAOwB,IAAIxB;;CAElB,CAACjB,qBAAqB0C,GAAG;EACvB,MAAMC,QAAQnC,eAAeA,aAAaC,cAAc,GAAGmC,UAAU,KAAK;EAC1E,MAAMC,MAAMF;EACZ,MAAMG,MAAMD;EACZ,MAAME,MAAMJ,KAAK5B;EACjB,MAAMiC,UAAUL,KAAK5B,WAAWA;EAChC,MAAMkC,UAAUN,KAAKO,WAAW,GAAGnC,WAAWA;AAC9Cd,gBAAc4C,KAAKH,GAAG,YAAY,KAAKpB,MAAM6B,SAAS,GAAG;AACzDjD,oBAAkB4C,KAAKJ,GAAG,MAAM,iBAAiB,eAAe;AAChExC,oBAAkB6C,KAAKL,GAAG,MAAM,iBAAiB,eAAe;AAEhEvC,eAAaiD,SAAIV,GAAG,YAAY,KAAKpB,MAAM+B,SAAS;AAEpDjD,oBAAkBkD,SAAIZ,GAAG,YAAY,KAAKpB,MAAMR,QAAQ;AACxD,SAAO6B"}
|
package/dist/zag-component.d.mts
CHANGED
|
@@ -22,6 +22,7 @@ interface SpreadMap {
|
|
|
22
22
|
declare class ZagComponent<P = Record<string, unknown>> extends Component<P> {
|
|
23
23
|
_machine: VanillaMachine<any> | null;
|
|
24
24
|
_api: any;
|
|
25
|
+
_machineStarted: boolean;
|
|
25
26
|
_spreadCleanups: Map<string, SpreadCleanup>;
|
|
26
27
|
_spreadScheduled: boolean;
|
|
27
28
|
_zagIdMap: Map<string, Element>;
|
package/dist/zag-component.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { VanillaMachine, normalizeProps, spreadProps } from "@zag-js/vanilla";
|
|
|
4
4
|
var ZagComponent = class extends Component {
|
|
5
5
|
constructor(..._args) {
|
|
6
6
|
super(..._args);
|
|
7
|
+
this._machineStarted = false;
|
|
7
8
|
this._spreadCleanups = /* @__PURE__ */ new Map();
|
|
8
9
|
this._spreadScheduled = false;
|
|
9
10
|
this._zagIdMap = /* @__PURE__ */ new Map();
|
|
@@ -36,7 +37,7 @@ var ZagComponent = class extends Component {
|
|
|
36
37
|
this._machine.scope.getById = ((id) => {
|
|
37
38
|
return origGetById(id) || zagIdMap.get(id) || null;
|
|
38
39
|
});
|
|
39
|
-
this.
|
|
40
|
+
this._machineStarted = false;
|
|
40
41
|
this._api = this.connectApi(this._machine.service);
|
|
41
42
|
this.syncState(this._api);
|
|
42
43
|
this._machine.subscribe(() => {
|
|
@@ -140,6 +141,13 @@ var ZagComponent = class extends Component {
|
|
|
140
141
|
} catch {}
|
|
141
142
|
}
|
|
142
143
|
this._applyAllSpreads();
|
|
144
|
+
if (this._machine && !this._machineStarted) {
|
|
145
|
+
this._machineStarted = true;
|
|
146
|
+
this._machine.start();
|
|
147
|
+
this._api = this.connectApi(this._machine.service);
|
|
148
|
+
this.syncState(this._api);
|
|
149
|
+
this._applyAllSpreads();
|
|
150
|
+
}
|
|
143
151
|
}
|
|
144
152
|
_cacheArrayContainers() {
|
|
145
153
|
if (!this._listStates) return;
|
|
@@ -165,6 +173,7 @@ var ZagComponent = class extends Component {
|
|
|
165
173
|
this._machine = null;
|
|
166
174
|
}
|
|
167
175
|
this._api = null;
|
|
176
|
+
this._machineStarted = false;
|
|
168
177
|
this._zagIdMap?.clear();
|
|
169
178
|
this._elementCache?.clear();
|
|
170
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zag-component.mjs","names":[],"sources":["../src/primitives/zag-component.ts"],"sourcesContent":["import { Component, GEA_ON_PROP_CHANGE } from '@geajs/core'\nimport { VanillaMachine, normalizeProps, spreadProps } from '@zag-js/vanilla'\n\n/**\n * Under the closure-compiled runtime there is no `[GEA_MAPS]` registry on the\n * component. Zag integration now uses `registerListState(listId, state)` /\n * `onItemSync(listId, idx)` hooks that the compiled `keyedList` call invokes.\n * We keep a local Map of list states keyed by the compiler's listId string.\n */\ninterface ListStateRecord {\n container: Element\n containerProp?: string\n getContainer?: () => Element\n}\n\ntype SpreadCleanup = () => void\ntype PropsGetter = string | ((api: any, el: Element) => Record<string, any>)\n\nexport interface SpreadMap {\n [selector: string]: PropsGetter\n}\n\nexport default class ZagComponent<P = Record<string, unknown>> extends Component<P> {\n declare _machine: VanillaMachine<any> | null\n declare _api: any\n // Initialize fields eagerly — under the closure-compiled runtime, `created()`\n // may be called AFTER `[GEA_CREATE_TEMPLATE]`, which references these caches.\n _spreadCleanups: Map<string, SpreadCleanup> = new Map()\n _spreadScheduled: boolean = false\n _zagIdMap: Map<string, Element> = new Map()\n _elementCache: Map<string, Element[]> = new Map()\n\n createMachine(_props: any): any {\n return null\n }\n\n getMachineProps(_props: any): any {\n return {}\n }\n\n connectApi(_service: any): any {\n return null\n }\n\n getSpreadMap() {\n return {}\n }\n\n syncState(_api: any): void {}\n\n created(props: P) {\n if (!this._spreadCleanups) this._spreadCleanups = new Map()\n if (this._spreadScheduled === undefined) this._spreadScheduled = false\n if (!this._zagIdMap) this._zagIdMap = new Map()\n if (!this._elementCache) this._elementCache = new Map()\n\n const machineDef = this.createMachine(props)\n if (!machineDef) return\n\n const machineProps = this.getMachineProps(props)\n this._machine = new VanillaMachine(machineDef, machineProps)\n\n // Patch scope.getById: Zag uses IDs like \"tags-input:xyz:...\" for DOM\n // lookups, but _applyAllSpreads restores compiler binding IDs on elements.\n // The mapping lets Zag find elements by their expected Zag IDs.\n const zagIdMap = this._zagIdMap\n const origGetById = this._machine.scope.getById\n this._machine.scope.getById = ((id: string) => {\n return origGetById(id) || zagIdMap.get(id) || null\n }) as typeof origGetById\n\n this._machine.start()\n\n this._api = this.connectApi(this._machine.service)\n this.syncState(this._api)\n\n this._machine.subscribe(() => {\n if (!this._machine) return\n this._api = this.connectApi(this._machine.service)\n this._scheduleSpreadApplication()\n })\n }\n\n _syncMachineProps() {\n const machine = this._machine as any\n if (!machine?.userPropsRef) return\n const next = this.getMachineProps(this.props)\n machine.userPropsRef.current = next\n this._api = this.connectApi(this._machine!.service)\n this._scheduleSpreadApplication()\n }\n\n [GEA_ON_PROP_CHANGE](_key: string, _next: unknown) {\n this._syncMachineProps()\n }\n\n _scheduleSpreadApplication() {\n if (this._spreadScheduled) return\n this._spreadScheduled = true\n queueMicrotask(() => {\n this._spreadScheduled = false\n this._applyAllSpreads()\n })\n }\n\n _resolveProps(getter: PropsGetter, el: Element): Record<string, any> | null {\n if (typeof getter === 'function') {\n return getter(this._api, el)\n }\n const method = this._api[getter]\n if (typeof method !== 'function') return null\n return method.call(this._api)\n }\n\n _queryAllIncludingSelf(selector: string): Element[] {\n const results = this.$$(selector)\n const root = this.el\n if (root && root.matches(selector) && !results.includes(root)) {\n results.unshift(root)\n }\n // Exclude elements that live inside ANOTHER component's subtree. Every\n // mounted Gea component tags its root element with `GEA_DOM_COMPONENT`\n // (Symbol.for('gea.dom.component')). Walking up from each match toward\n // `root`, if we cross a tagged element whose component !== this, that\n // match belongs to a nested component — skip it. Prevents a parent\n // ZagComponent (e.g. Dialog) from clobbering child-Zag parts like\n // `[data-part=\"trigger\"]` shared by Select/Menu/Tabs, which live inside\n // a slot (`props.children`) and aren't tracked in `this._cc`.\n const COMP = Symbol.for('gea.dom.component')\n if (!root) return results\n const filtered: Element[] = []\n for (const el of results) {\n let cur: Element | null = el\n let foreign = false\n while (cur && cur !== root) {\n const owner = (cur as any)[COMP]\n if (owner && owner !== this) {\n foreign = true\n break\n }\n cur = cur.parentElement\n }\n if (!foreign) filtered.push(el)\n }\n return filtered\n }\n\n _applyAllSpreads() {\n if (!this.rendered || !this._api) return\n const map = this.getSpreadMap()\n\n for (const selector in map) {\n const getter = map[selector]\n\n let elements = this._elementCache.get(selector)\n if (!elements) {\n elements = this._queryAllIncludingSelf(selector)\n this._elementCache.set(selector, elements)\n }\n\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i]\n const key = selector + ':' + i\n const nextProps = this._resolveProps(getter, el)\n if (!nextProps) continue\n\n // Preserve compiled binding IDs: Zag's spreadProps overrides element\n // IDs, but the compiler's observers rely on getElementById with binding\n // IDs. We restore the binding ID and store the Zag ID in _zagIdMap so\n // scope.getById (patched in created()) can still find elements.\n // Note: we never clear _zagIdMap here because spreadProps caches\n // previous attrs and skips unchanged values — on subsequent calls the\n // ID won't be re-set, so we'd lose the mapping.\n const bindingId = el.id\n const cleanup = spreadProps(el, nextProps)\n if (bindingId && el.id !== bindingId) {\n this._zagIdMap.set(el.id, el)\n el.id = bindingId\n }\n this._spreadCleanups.set(key, cleanup)\n }\n }\n }\n\n /** Compiled keyedList calls this on the owner after each reconciliation. */\n onItemSync(_listId: string, _idx: number) {\n this._elementCache.clear()\n this._scheduleSpreadApplication()\n }\n\n /** Compiled keyedList calls this once per list at construction. */\n registerListState(listId: string, state: ListStateRecord) {\n if (!this._listStates) this._listStates = new Map()\n this._listStates.set(listId, state)\n }\n\n unregisterListState(listId: string) {\n this._listStates?.delete(listId)\n }\n\n declare _listStates: Map<string, ListStateRecord>\n\n onAfterRender() {\n this._cacheArrayContainers()\n this._elementCache.clear()\n // If the machine was stopped (parent conditional removed this component's\n // subtree) and the subtree is now re-shown, re-create the Zag machine\n // so spread props + event handlers work again.\n if ((this as any)._machineStopped && !this._machine) {\n ;(this as any)._machineStopped = false\n try {\n this.created(this.props)\n } catch {\n /* isolated */\n }\n }\n this._applyAllSpreads()\n }\n\n _cacheArrayContainers() {\n if (!this._listStates) return\n for (const state of this._listStates.values()) {\n if (state.getContainer) state.container = state.getContainer()\n if (state.container && state.containerProp) (this as any)[state.containerProp] = state.container\n }\n }\n\n /** Stop the Zag machine + spread cleanups without fully disposing the\n * component. Invoked when a parent conditional slot removes this\n * component's DOM subtree so side effects on `<html>` (pointer-events,\n * aria-hidden, scroll lock) are restored. The component instance stays\n * alive so it can re-render if the conditional becomes truthy again. */\n _stopMachine() {\n for (const cleanup of this._spreadCleanups.values()) {\n try {\n cleanup()\n } catch {\n /* isolated */\n }\n }\n this._spreadCleanups.clear()\n if (this._machine) {\n try {\n this._machine.stop()\n } catch {\n /* isolated */\n }\n this._machine = null\n }\n this._api = null\n this._zagIdMap?.clear()\n this._elementCache?.clear()\n }\n\n dispose() {\n this._stopMachine()\n super.dispose()\n }\n\n static normalizeProps = normalizeProps\n}\n"],"mappings":";;;AAsBA,IAAqB,eAArB,cAAuE,UAAa;;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,WAAW,OAAO;AACvB,OAAK,eAAe,OAAO;;CAG7B,UAAU;AACR,OAAK,cAAc;AACnB,QAAM,SAAS;;;wBAGO"}
|
|
1
|
+
{"version":3,"file":"zag-component.mjs","names":[],"sources":["../src/primitives/zag-component.ts"],"sourcesContent":["import { Component, GEA_ON_PROP_CHANGE } from '@geajs/core'\nimport { VanillaMachine, normalizeProps, spreadProps } from '@zag-js/vanilla'\n\n/**\n * Under the closure-compiled runtime there is no `[GEA_MAPS]` registry on the\n * component. Zag integration now uses `registerListState(listId, state)` /\n * `onItemSync(listId, idx)` hooks that the compiled `keyedList` call invokes.\n * We keep a local Map of list states keyed by the compiler's listId string.\n */\ninterface ListStateRecord {\n container: Element\n containerProp?: string\n getContainer?: () => Element\n}\n\ntype SpreadCleanup = () => void\ntype PropsGetter = string | ((api: any, el: Element) => Record<string, any>)\n\nexport interface SpreadMap {\n [selector: string]: PropsGetter\n}\n\nexport default class ZagComponent<P = Record<string, unknown>> extends Component<P> {\n declare _machine: VanillaMachine<any> | null\n declare _api: any\n _machineStarted = false\n // Initialize fields eagerly — under the closure-compiled runtime, `created()`\n // may be called AFTER `[GEA_CREATE_TEMPLATE]`, which references these caches.\n _spreadCleanups: Map<string, SpreadCleanup> = new Map()\n _spreadScheduled: boolean = false\n _zagIdMap: Map<string, Element> = new Map()\n _elementCache: Map<string, Element[]> = new Map()\n\n createMachine(_props: any): any {\n return null\n }\n\n getMachineProps(_props: any): any {\n return {}\n }\n\n connectApi(_service: any): any {\n return null\n }\n\n getSpreadMap() {\n return {}\n }\n\n syncState(_api: any): void {}\n\n created(props: P) {\n if (!this._spreadCleanups) this._spreadCleanups = new Map()\n if (this._spreadScheduled === undefined) this._spreadScheduled = false\n if (!this._zagIdMap) this._zagIdMap = new Map()\n if (!this._elementCache) this._elementCache = new Map()\n\n const machineDef = this.createMachine(props)\n if (!machineDef) return\n\n const machineProps = this.getMachineProps(props)\n this._machine = new VanillaMachine(machineDef, machineProps)\n\n // Patch scope.getById: Zag uses IDs like \"tags-input:xyz:...\" for DOM\n // lookups, but _applyAllSpreads restores compiler binding IDs on elements.\n // The mapping lets Zag find elements by their expected Zag IDs.\n const zagIdMap = this._zagIdMap\n const origGetById = this._machine.scope.getById\n this._machine.scope.getById = ((id: string) => {\n return origGetById(id) || zagIdMap.get(id) || null\n }) as typeof origGetById\n\n this._machineStarted = false\n\n this._api = this.connectApi(this._machine.service)\n this.syncState(this._api)\n\n this._machine.subscribe(() => {\n if (!this._machine) return\n this._api = this.connectApi(this._machine.service)\n this._scheduleSpreadApplication()\n })\n }\n\n _syncMachineProps() {\n const machine = this._machine as any\n if (!machine?.userPropsRef) return\n const next = this.getMachineProps(this.props)\n machine.userPropsRef.current = next\n this._api = this.connectApi(this._machine!.service)\n this._scheduleSpreadApplication()\n }\n\n [GEA_ON_PROP_CHANGE](_key: string, _next: unknown) {\n this._syncMachineProps()\n }\n\n _scheduleSpreadApplication() {\n if (this._spreadScheduled) return\n this._spreadScheduled = true\n queueMicrotask(() => {\n this._spreadScheduled = false\n this._applyAllSpreads()\n })\n }\n\n _resolveProps(getter: PropsGetter, el: Element): Record<string, any> | null {\n if (typeof getter === 'function') {\n return getter(this._api, el)\n }\n const method = this._api[getter]\n if (typeof method !== 'function') return null\n return method.call(this._api)\n }\n\n _queryAllIncludingSelf(selector: string): Element[] {\n const results = this.$$(selector)\n const root = this.el\n if (root && root.matches(selector) && !results.includes(root)) {\n results.unshift(root)\n }\n // Exclude elements that live inside ANOTHER component's subtree. Every\n // mounted Gea component tags its root element with `GEA_DOM_COMPONENT`\n // (Symbol.for('gea.dom.component')). Walking up from each match toward\n // `root`, if we cross a tagged element whose component !== this, that\n // match belongs to a nested component — skip it. Prevents a parent\n // ZagComponent (e.g. Dialog) from clobbering child-Zag parts like\n // `[data-part=\"trigger\"]` shared by Select/Menu/Tabs, which live inside\n // a slot (`props.children`) and aren't tracked in `this._cc`.\n const COMP = Symbol.for('gea.dom.component')\n if (!root) return results\n const filtered: Element[] = []\n for (const el of results) {\n let cur: Element | null = el\n let foreign = false\n while (cur && cur !== root) {\n const owner = (cur as any)[COMP]\n if (owner && owner !== this) {\n foreign = true\n break\n }\n cur = cur.parentElement\n }\n if (!foreign) filtered.push(el)\n }\n return filtered\n }\n\n _applyAllSpreads() {\n if (!this.rendered || !this._api) return\n const map = this.getSpreadMap()\n\n for (const selector in map) {\n const getter = map[selector]\n\n let elements = this._elementCache.get(selector)\n if (!elements) {\n elements = this._queryAllIncludingSelf(selector)\n this._elementCache.set(selector, elements)\n }\n\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i]\n const key = selector + ':' + i\n const nextProps = this._resolveProps(getter, el)\n if (!nextProps) continue\n\n // Preserve compiled binding IDs: Zag's spreadProps overrides element\n // IDs, but the compiler's observers rely on getElementById with binding\n // IDs. We restore the binding ID and store the Zag ID in _zagIdMap so\n // scope.getById (patched in created()) can still find elements.\n // Note: we never clear _zagIdMap here because spreadProps caches\n // previous attrs and skips unchanged values — on subsequent calls the\n // ID won't be re-set, so we'd lose the mapping.\n const bindingId = el.id\n const cleanup = spreadProps(el, nextProps)\n if (bindingId && el.id !== bindingId) {\n this._zagIdMap.set(el.id, el)\n el.id = bindingId\n }\n this._spreadCleanups.set(key, cleanup)\n }\n }\n }\n\n /** Compiled keyedList calls this on the owner after each reconciliation. */\n onItemSync(_listId: string, _idx: number) {\n this._elementCache.clear()\n this._scheduleSpreadApplication()\n }\n\n /** Compiled keyedList calls this once per list at construction. */\n registerListState(listId: string, state: ListStateRecord) {\n if (!this._listStates) this._listStates = new Map()\n this._listStates.set(listId, state)\n }\n\n unregisterListState(listId: string) {\n this._listStates?.delete(listId)\n }\n\n declare _listStates: Map<string, ListStateRecord>\n\n onAfterRender() {\n this._cacheArrayContainers()\n this._elementCache.clear()\n // If the machine was stopped (parent conditional removed this component's\n // subtree) and the subtree is now re-shown, re-create the Zag machine\n // so spread props + event handlers work again.\n if ((this as any)._machineStopped && !this._machine) {\n ;(this as any)._machineStopped = false\n try {\n this.created(this.props)\n } catch {\n /* isolated */\n }\n }\n this._applyAllSpreads()\n // Entry actions and effects query Zag part IDs. Start only after the DOM\n // and ID mappings exist, including images that loaded before mount.\n if (this._machine && !this._machineStarted) {\n this._machineStarted = true\n this._machine.start()\n this._api = this.connectApi(this._machine.service)\n this.syncState(this._api)\n this._applyAllSpreads()\n }\n }\n\n _cacheArrayContainers() {\n if (!this._listStates) return\n for (const state of this._listStates.values()) {\n if (state.getContainer) state.container = state.getContainer()\n if (state.container && state.containerProp) (this as any)[state.containerProp] = state.container\n }\n }\n\n /** Stop the Zag machine + spread cleanups without fully disposing the\n * component. Invoked when a parent conditional slot removes this\n * component's DOM subtree so side effects on `<html>` (pointer-events,\n * aria-hidden, scroll lock) are restored. The component instance stays\n * alive so it can re-render if the conditional becomes truthy again. */\n _stopMachine() {\n for (const cleanup of this._spreadCleanups.values()) {\n try {\n cleanup()\n } catch {\n /* isolated */\n }\n }\n this._spreadCleanups.clear()\n if (this._machine) {\n try {\n this._machine.stop()\n } catch {\n /* isolated */\n }\n this._machine = null\n }\n this._api = null\n this._machineStarted = false\n this._zagIdMap?.clear()\n this._elementCache?.clear()\n }\n\n dispose() {\n this._stopMachine()\n super.dispose()\n }\n\n static normalizeProps = normalizeProps\n}\n"],"mappings":";;;AAsBA,IAAqB,eAArB,cAAuE,UAAa;;;yBAGhE;yCAG4B,IAAI,KAAK;0BAC3B;mCACM,IAAI,KAAK;uCACH,IAAI,KAAK;;CAEjD,cAAc,QAAkB;AAC9B,SAAO;;CAGT,gBAAgB,QAAkB;AAChC,SAAO,EAAE;;CAGX,WAAW,UAAoB;AAC7B,SAAO;;CAGT,eAAe;AACb,SAAO,EAAE;;CAGX,UAAU,MAAiB;CAE3B,QAAQ,OAAU;AAChB,MAAI,CAAC,KAAK,gBAAiB,MAAK,kCAAkB,IAAI,KAAK;AAC3D,MAAI,KAAK,qBAAqB,KAAA,EAAW,MAAK,mBAAmB;AACjE,MAAI,CAAC,KAAK,UAAW,MAAK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