nuclo 0.2.35 → 0.2.36

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 (97) hide show
  1. package/dist/nuclo.cjs +1 -1
  2. package/dist/nuclo.cjs.map +1 -1
  3. package/dist/nuclo.mjs +1 -1
  4. package/dist/nuclo.mjs.map +1 -1
  5. package/dist/nuclo.umd.js +1 -1
  6. package/dist/nuclo.umd.js.map +1 -1
  7. package/package.json +3 -3
  8. package/dist/bootstrap.d.ts +0 -5
  9. package/dist/bootstrap.d.ts.map +0 -1
  10. package/dist/element/attributes.d.ts +0 -6
  11. package/dist/element/attributes.d.ts.map +0 -1
  12. package/dist/element/class-name.d.ts +0 -6
  13. package/dist/element/class-name.d.ts.map +0 -1
  14. package/dist/element/event-attributes.d.ts +0 -5
  15. package/dist/element/event-attributes.d.ts.map +0 -1
  16. package/dist/element/events.d.ts +0 -46
  17. package/dist/element/events.d.ts.map +0 -1
  18. package/dist/element/factory-meta.d.ts +0 -27
  19. package/dist/element/factory-meta.d.ts.map +0 -1
  20. package/dist/element/factory.d.ts +0 -32
  21. package/dist/element/factory.d.ts.map +0 -1
  22. package/dist/element/inline-style.d.ts +0 -9
  23. package/dist/element/inline-style.d.ts.map +0 -1
  24. package/dist/element/lifecycle.d.ts +0 -106
  25. package/dist/element/lifecycle.d.ts.map +0 -1
  26. package/dist/element/modifiers.d.ts +0 -11
  27. package/dist/element/modifiers.d.ts.map +0 -1
  28. package/dist/element/tags.d.ts +0 -5
  29. package/dist/element/tags.d.ts.map +0 -1
  30. package/dist/hydration.d.ts +0 -73
  31. package/dist/hydration.d.ts.map +0 -1
  32. package/dist/index.d.ts +0 -17
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/list/index.d.ts +0 -7
  35. package/dist/list/index.d.ts.map +0 -1
  36. package/dist/list/runtime.d.ts +0 -6
  37. package/dist/list/runtime.d.ts.map +0 -1
  38. package/dist/list/template.d.ts +0 -113
  39. package/dist/list/template.d.ts.map +0 -1
  40. package/dist/list/types.d.ts +0 -57
  41. package/dist/list/types.d.ts.map +0 -1
  42. package/dist/polyfill/Document.d.ts +0 -19
  43. package/dist/polyfill/Document.d.ts.map +0 -1
  44. package/dist/polyfill/Element.d.ts +0 -48
  45. package/dist/polyfill/Element.d.ts.map +0 -1
  46. package/dist/polyfill/Event.d.ts +0 -43
  47. package/dist/polyfill/Event.d.ts.map +0 -1
  48. package/dist/polyfill/Node.d.ts +0 -13
  49. package/dist/polyfill/Node.d.ts.map +0 -1
  50. package/dist/polyfill/Text.d.ts +0 -11
  51. package/dist/polyfill/Text.d.ts.map +0 -1
  52. package/dist/polyfill/index.d.ts +0 -24
  53. package/dist/polyfill/index.d.ts.map +0 -1
  54. package/dist/render.d.ts +0 -33
  55. package/dist/render.d.ts.map +0 -1
  56. package/dist/shared/conditions.d.ts +0 -4
  57. package/dist/shared/conditions.d.ts.map +0 -1
  58. package/dist/shared/dom.d.ts +0 -80
  59. package/dist/shared/dom.d.ts.map +0 -1
  60. package/dist/shared/environment.d.ts +0 -5
  61. package/dist/shared/environment.d.ts.map +0 -1
  62. package/dist/shared/errors.d.ts +0 -2
  63. package/dist/shared/errors.d.ts.map +0 -1
  64. package/dist/shared/renderables.d.ts +0 -4
  65. package/dist/shared/renderables.d.ts.map +0 -1
  66. package/dist/shared/strings.d.ts +0 -19
  67. package/dist/shared/strings.d.ts.map +0 -1
  68. package/dist/shared/type-guards.d.ts +0 -16
  69. package/dist/shared/type-guards.d.ts.map +0 -1
  70. package/dist/ssr/index.d.ts +0 -19
  71. package/dist/ssr/index.d.ts.map +0 -1
  72. package/dist/ssr/render-to-string.d.ts +0 -41
  73. package/dist/ssr/render-to-string.d.ts.map +0 -1
  74. package/dist/style/css.d.ts +0 -26
  75. package/dist/style/css.d.ts.map +0 -1
  76. package/dist/style/engine.d.ts +0 -94
  77. package/dist/style/engine.d.ts.map +0 -1
  78. package/dist/style/index.d.ts +0 -3
  79. package/dist/style/index.d.ts.map +0 -1
  80. package/dist/update/conditional.d.ts +0 -3
  81. package/dist/update/conditional.d.ts.map +0 -1
  82. package/dist/update/reactive-attributes.d.ts +0 -45
  83. package/dist/update/reactive-attributes.d.ts.map +0 -1
  84. package/dist/update/reactive-text.d.ts +0 -38
  85. package/dist/update/reactive-text.d.ts.map +0 -1
  86. package/dist/update/registry.d.ts +0 -116
  87. package/dist/update/registry.d.ts.map +0 -1
  88. package/dist/update/scope.d.ts +0 -7
  89. package/dist/update/scope.d.ts.map +0 -1
  90. package/dist/update/update.d.ts +0 -4
  91. package/dist/update/update.d.ts.map +0 -1
  92. package/dist/when/builder.d.ts +0 -16
  93. package/dist/when/builder.d.ts.map +0 -1
  94. package/dist/when/index.d.ts +0 -44
  95. package/dist/when/index.d.ts.map +0 -1
  96. package/dist/when/runtime.d.ts +0 -59
  97. package/dist/when/runtime.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuclo",
3
3
  "private": false,
4
- "version": "0.2.35",
4
+ "version": "0.2.36",
5
5
  "description": "Lightweight, type-safe DOM library with plain mutable state and explicit updates — global tag builders, SSR, hydration, and typed CSS, no virtual DOM, no compiler.",
6
6
  "license": "MIT",
7
7
  "author": "Danilo Celestino de Castro (https://github.com/dan2dev)",
@@ -71,10 +71,10 @@
71
71
  "eslint": "^10.11.0",
72
72
  "globals": "^17.12.0",
73
73
  "jiti": "^2.7.0",
74
- "jsdom": "^30.1.0",
74
+ "jsdom": "^30.1.1",
75
75
  "tsdown": "^0.23.0",
76
76
  "typescript": "^7.0.2",
77
- "typescript-eslint": "^8.70.0",
77
+ "typescript-eslint": "^8.70.1",
78
78
  "vitest": "^5.0.1"
79
79
  },
80
80
  "repository": {
@@ -1,5 +0,0 @@
1
- /**
2
- * Initializes the nuclo runtime by exposing tag builders and utilities.
3
- */
4
- export declare function initializeRuntime(): void;
5
- //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AASA;;GAEG;AAEH,wBAAgB,iBAAiB,IAAI,IAAI,CAoBxC"}
@@ -1,6 +0,0 @@
1
- type AttributeKey<TTagName extends ElementTagName> = keyof ExpandedElementAttributes<TTagName>;
2
- type AttributeCandidate<TTagName extends ElementTagName> = ExpandedElementAttributes<TTagName>[AttributeKey<TTagName>];
3
- export declare function applySingleAttribute<TTagName extends ElementTagName>(el: ExpandedElement<TTagName>, key: AttributeKey<TTagName>, raw: AttributeCandidate<TTagName> | undefined, shouldMergeClassName?: boolean): void;
4
- export declare function applyAttributes<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, attributes: ExpandedElementAttributes<TTagName>, mergeClassName?: boolean): void;
5
- export { createReactiveTextNode } from "../update/reactive-text";
6
- //# sourceMappingURL=attributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/element/attributes.ts"],"names":[],"mappings":"AAcA,KAAK,YAAY,CAAC,QAAQ,SAAS,cAAc,IAAI,MAAM,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAC/F,KAAK,kBAAkB,CAAC,QAAQ,SAAS,cAAc,IACrD,yBAAyB,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AA0C9D,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,cAAc,EAClE,EAAE,EAAE,eAAe,CAAC,QAAQ,CAAC,EAC7B,GAAG,EAAE,YAAY,CAAC,QAAQ,CAAC,EAC3B,GAAG,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,SAAS,EAC7C,oBAAoB,UAAQ,GAC3B,IAAI,CAmFN;AAED,wBAAgB,eAAe,CAAC,QAAQ,SAAS,cAAc,EAC7D,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,UAAU,EAAE,yBAAyB,CAAC,QAAQ,CAAC,EAC/C,cAAc,UAAO,GACpB,IAAI,CAYN;AAED,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare function initReactiveClassName(el: HTMLElement): void;
2
- export declare function hasReactiveClassName(el: HTMLElement): boolean;
3
- export declare function addStaticClasses(el: HTMLElement, className: string): void;
4
- export declare function mergeReactiveClassName(el: HTMLElement, reactiveClassName: string): void;
5
- export declare function mergeStaticClassName(el: HTMLElement, newClassName: string): void;
6
- //# sourceMappingURL=class-name.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/element/class-name.ts"],"names":[],"mappings":"AAoCA,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAO3D;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAE7D;AAGD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAQzE;AAGD,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CA+BvF;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAWhF"}
@@ -1,5 +0,0 @@
1
- /** Converts a public camel-cased event attribute to its native IDL property. */
2
- export declare function eventAttributeToProperty(attribute: string): string | null;
3
- /** Assigns an event attribute, falling back when the IDL property is absent. */
4
- export declare function setEventAttribute(element: HTMLElement, property: string, listener: EventListener): void;
5
- //# sourceMappingURL=event-attributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-attributes.d.ts","sourceRoot":"","sources":["../../src/element/event-attributes.ts"],"names":[],"mappings":"AAkBA,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBzE;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,aAAa,GACtB,IAAI,CA2BN"}
@@ -1,46 +0,0 @@
1
- /**
2
- * Typed event listener helper.
3
- *
4
- * Usage:
5
- * button(
6
- * "Click",
7
- * on("click", (e) => {
8
- * // e and currentTarget are inferred from the native event map
9
- * })
10
- * )
11
- *
12
- * Design notes:
13
- * - Returns a NodeModFn so it can be used like any other modifier.
14
- * - Produces no child node (returns void in the modifier body).
15
- * - Provides strong typing of the event object based on the DOM event name.
16
- * - Stores listener references in a WeakMap to prevent memory leaks.
17
- * - Listeners are automatically cleaned up when elements are garbage collected.
18
- */
19
- type EventListenerOptions = boolean | AddEventListenerOptions;
20
- /**
21
- * Remove all listeners of a specific type from an element.
22
- */
23
- export declare function removeAllListeners(element: HTMLElement, type?: string): void;
24
- /**
25
- * Overload for standard HTMLElement events (strongly typed via lib.dom.d.ts)
26
- */
27
- export declare function on<K extends NucloHTMLElementEventName, TTagName extends NucloHTMLElementTagNameForEvent<K> = NucloHTMLElementTagNameForEvent<K>>(type: K, listener: TypedEventListener<HTMLElementTagNameMap[TTagName], NucloHTMLElementEventForName<K>>, options?: EventListenerOptions): NodeModFn<TTagName>;
28
- /**
29
- * Fires once, after the element has been created and connected to the live
30
- * document. Equivalent to `{ onMount: ... }`. May return a cleanup function —
31
- * equivalent to also registering it with on("destroy", ...).
32
- *
33
- * Listed before the generic string overload below on purpose: "mount" is a
34
- * string too, so a less specific overload earlier would shadow this one.
35
- */
36
- export declare function on<TTagName extends ElementTagName = ElementTagName>(type: "mount", listener: MountCallback<HTMLElementTagNameMap[TTagName]>): NodeModFn<TTagName>;
37
- /** Fires once the element has been removed. Equivalent to `{ onDestroy: ... }`. */
38
- export declare function on<TTagName extends ElementTagName = ElementTagName>(type: "destroy", listener: DestroyCallback<HTMLElementTagNameMap[TTagName]>): NodeModFn<TTagName>;
39
- /**
40
- * Fallback / custom event overload (arbitrary event names or custom event types).
41
- * Specify a custom event type with the E generic if needed:
42
- * on<"my-event", CustomEvent<MyDetail>>("my-event", e => { ... })
43
- */
44
- export declare function on<K extends string, E extends Event = Event, TTagName extends ElementTagName = ElementTagName>(type: K, listener: TypedEventListener<HTMLElementTagNameMap[TTagName], E>, options?: EventListenerOptions): NodeModFn<TTagName>;
45
- export {};
46
- //# sourceMappingURL=events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/element/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,KAAK,oBAAoB,GAAG,OAAO,GAAG,uBAAuB,CAAC;AAiD9D;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI,CAyCN;AA+CD;;GAEG;AACH,wBAAgB,EAAE,CAChB,CAAC,SAAS,yBAAyB,EACnC,QAAQ,SAAS,+BAA+B,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC,CAAC,CAAC,EAExF,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,kBAAkB,CAC1B,qBAAqB,CAAC,QAAQ,CAAC,EAC/B,4BAA4B,CAAC,CAAC,CAAC,CAChC,EACD,OAAO,CAAC,EAAE,oBAAoB,GAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEvB;;;;;;;GAOG;AACH,wBAAgB,EAAE,CAAC,QAAQ,SAAS,cAAc,GAAG,cAAc,EACjE,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,GACvD,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEvB,mFAAmF;AACnF,wBAAgB,EAAE,CAAC,QAAQ,SAAS,cAAc,GAAG,cAAc,EACjE,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,GACzD,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEvB;;;;GAIG;AACH,wBAAgB,EAAE,CAChB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,KAAK,GAAG,KAAK,EACvB,QAAQ,SAAS,cAAc,GAAG,cAAc,EAEhD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAChE,OAAO,CAAC,EAAE,oBAAoB,GAC7B,SAAS,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Internal factory metadata.
3
- *
4
- * Tag builders return opaque factory closures; the list() template engine
5
- * needs to see through them (tag name + modifier list) to decide whether a
6
- * row can be built by cloning a skeleton instead of running the factory.
7
- * The metadata is attached under symbols so nothing leaks into the public
8
- * API surface or enumerable properties.
9
- */
10
- export declare const FACTORY_TAG: unique symbol;
11
- export declare const FACTORY_MODS: unique symbol;
12
- export declare function acquireMetadataOnlyFactory(): () => null;
13
- export declare function setFactoryMeta(factory: unknown, tag: string, mods: readonly unknown[]): void;
14
- /** Returns the modifier list of a tag-builder factory, or undefined. */
15
- export declare function getFactoryMods(fn: unknown): readonly unknown[] | undefined;
16
- /** Returns the tag name of a tag-builder factory, or undefined. */
17
- export declare function getFactoryTag(fn: unknown): string | undefined;
18
- export declare function isMetadataOnlyFactoryMode(): boolean;
19
- /**
20
- * Takes the render function and its two args directly (rather than a `() =>`
21
- * thunk) so the hot per-row call in list/runtime.ts doesn't allocate a
22
- * closure just to defer a single call.
23
- */
24
- export declare function withMetadataOnlyFactories<TItem, T>(fn: (item: TItem, index: number) => T, item: TItem, index: number): T;
25
- export declare function getMetadataOnlyFactoryCheckpoint(): number;
26
- export declare function releaseMetadataOnlyFactories(checkpoint: number): void;
27
- //# sourceMappingURL=factory-meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory-meta.d.ts","sourceRoot":"","sources":["../../src/element/factory-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,WAAW,eAA8B,CAAC;AACvD,eAAO,MAAM,YAAY,eAA+B,CAAC;AAgBzD,wBAAgB,0BAA0B,IAAI,MAAM,IAAI,CAKvD;AAOD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,OAAO,EAAE,GACvB,IAAI,CAGN;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,CAE1E;AAED,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAOxH;AAED,wBAAgB,gCAAgC,WAE/C;AAED,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,QAM9D"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Element creation: builds HTML/SVG elements and applies the modifier list
3
- * that was passed to a tag builder (children, attributes, text, on(), ...).
4
- */
5
- import { type NodeModifier } from "./modifiers";
6
- export type { NodeModifier };
7
- /**
8
- * Applies modifiers to an element, appending newly produced Nodes while avoiding
9
- * duplicate DOM insertions (i.e. only appends if parentNode differs).
10
- *
11
- * `localIndex` advances once per appended child so each reactive/static text
12
- * modifier gets a unique `text-N` marker; it is internal bookkeeping only and
13
- * is not returned (no production caller consumed the previous result object).
14
- */
15
- export declare function applyModifiers<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, modifiers: ReadonlyArray<NodeModifier<TTagName>>, startIndex?: number): void;
16
- /**
17
- * Creates an HTML element with the specified tag name and applies modifiers to it.
18
- */
19
- export declare function createHtmlElementWithModifiers<TTagName extends ElementTagName>(tagName: TTagName, modifiers: ReadonlyArray<NodeModifier<TTagName>>): ExpandedElement<TTagName>;
20
- /**
21
- * Creates an SVG element with the specified tag name and applies modifiers to it.
22
- */
23
- export declare function createSvgElementWithModifiers<TTagName extends keyof SVGElementTagNameMap>(tagName: TTagName, modifiers: ReadonlyArray<unknown>): SVGElementTagNameMap[TTagName];
24
- /**
25
- * Creates an HTML tag builder function.
26
- */
27
- export declare function createHtmlTagBuilder<TTagName extends ElementTagName>(tagName: TTagName): ExpandedElementBuilder<TTagName>;
28
- /**
29
- * Creates an SVG tag builder function.
30
- */
31
- export declare function createSvgTagBuilder<TTagName extends keyof SVGElementTagNameMap>(tagName: TTagName): ExpandedSVGElementBuilder<TTagName>;
32
- //# sourceMappingURL=factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/element/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAKnE,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAS,cAAc,EAC5D,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAChD,UAAU,SAAI,GACb,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,SAAS,cAAc,EAC5E,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,GAC/C,eAAe,CAAC,QAAQ,CAAC,CAO3B;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,SAAS,MAAM,oBAAoB,EACvF,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,GAChC,oBAAoB,CAAC,QAAQ,CAAC,CAOhC;AAmED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,cAAc,EAClE,OAAO,EAAE,QAAQ,GAChB,sBAAsB,CAAC,QAAQ,CAAC,CAElC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,MAAM,oBAAoB,EAC7E,OAAO,EAAE,QAAQ,GAChB,yBAAyB,CAAC,QAAQ,CAAC,CAErC"}
@@ -1,9 +0,0 @@
1
- type StyleAssignment = CSSStyleObject;
2
- type StyleResolver = () => StyleAssignment | null | undefined;
3
- /**
4
- * Simplified style management - basic functionality with minimal overhead
5
- */
6
- export declare function assignInlineStyles<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, styles: StyleAssignment | null | undefined): void;
7
- export declare function applyStyleAttribute<TTagName extends ElementTagName>(element: ExpandedElement<TTagName>, styleValue: StyleAssignment | StyleResolver | null | undefined): void;
8
- export {};
9
- //# sourceMappingURL=inline-style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline-style.d.ts","sourceRoot":"","sources":["../../src/element/inline-style.ts"],"names":[],"mappings":"AAKA,KAAK,eAAe,GAAG,cAAc,CAAC;AACtC,KAAK,aAAa,GAAG,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,SAAS,cAAc,EAChE,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GACzC,IAAI,CAeN;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,cAAc,EACjE,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,EAClC,UAAU,EAAE,eAAe,GAAG,aAAa,GAAG,IAAI,GAAG,SAAS,GAC7D,IAAI,CAUN"}
@@ -1,106 +0,0 @@
1
- /**
2
- * Mount/destroy lifecycle hooks.
3
- *
4
- * Two equivalent ways to register them, both funneling into this module:
5
- * - `on("mount", cb)` / `on("destroy", cb)` (./events.ts)
6
- * - `{ onMount: cb }` / `{ onDestroy: cb }` attributes (./attributes.ts)
7
- *
8
- * ── Mount timing ─────────────────────────────────────────────────────────
9
- * A freshly created element is still detached while its own subtree (and,
10
- * for the initial page render, every ancestor up to the root) is being
11
- * assembled — nuclo builds a tree fully off-document before attaching it in
12
- * one shot (render()/hydrate()), and list()/when() do the same for the
13
- * rows/branches they insert into an already-connected host. So onMount can't
14
- * fire the instant a modifier runs; the element is queued and the queue is
15
- * flushed once the surrounding operation (render(), hydrate(), or update())
16
- * finishes inserting its nodes — at that point the element is guaranteed
17
- * connected. See flushMountQueue() and its call sites in render.ts/update.ts.
18
- *
19
- * ── Destroy timing ───────────────────────────────────────────────────────
20
- * onDestroy fires eagerly and synchronously the moment nuclo removes the
21
- * element through its own machinery — see the disposeElementLifecycle() call
22
- * in shared/dom.ts's cleanupNodeTree(), which every ordinary removal
23
- * (list()/when() diffing, any safeRemoveChild() call) already goes through.
24
- * The handful of fast paths that intentionally skip that per-node walk for
25
- * performance (list()'s bulk clear/replace, the single-element when()/else()
26
- * swap) call disposeLifecyclesInSubtree() directly instead, so destroy still
27
- * fires exactly at removal time there too — without paying for a bookkeeping
28
- * walk when nothing in the affected subtree ever registered a lifecycle
29
- * callback (hasActiveLifecycleRegistrations() short-circuits that to a
30
- * single integer comparison in the — by far most common — case where
31
- * lifecycle hooks aren't used at all).
32
- *
33
- * An element removed through means nuclo never observes (e.g. a raw
34
- * `node.remove()` on a container built by render()) is only noticed the next
35
- * time render()/hydrate()/update() runs and finds it disconnected — this
36
- * file does not use a MutationObserver. That never leaks memory (all
37
- * bookkeeping below is WeakMap-based, exactly like every other nuclo
38
- * registry — see test/memory/gc-collectability.test.ts), but if an app
39
- * removes a node that way and never calls update() again afterwards,
40
- * onDestroy for it will not run either. This matches list()/when()'s own
41
- * documented "disconnection is noticed lazily, on the next update()"
42
- * contract; it is not a lifecycle-specific limitation.
43
- *
44
- * ── Ordering (parent/child, any depth) ──────────────────────────────────
45
- * Neither mechanism below cares how many list()s, when()s, or plain
46
- * component functions wrap an element — every element gets its own
47
- * independent WeakMap record, keyed by the element itself, so correctness
48
- * never depends on nesting depth. What nesting *does* affect is the relative
49
- * order two related elements' callbacks fire in, which follows normal
50
- * resource-scoping discipline in both directions:
51
- * - onMount fires parent-before-child. This falls out of queue order for
52
- * free — a parent's own {onMount}/on("mount", ...) modifier is applied
53
- * (queuing it) before the child factories in its own modifier list are
54
- * even invoked, since applying modifiers is a synchronous, in-order walk.
55
- * A child's onMount can safely assume any context the parent's onMount
56
- * set up is already in place.
57
- * - onDestroy fires child-before-parent (see cleanupNodeTree() and
58
- * disposeLifecyclesInSubtree() in shared/dom.ts, both post-order: they
59
- * recurse into every descendant *before* disposing the node itself). A
60
- * parent's onDestroy can safely release something its children were
61
- * still using — they have already run by the time it does.
62
- * Together: mount is top-down, destroy is bottom-up — the same order a
63
- * `try { ... } finally { ... }` stack of nested resource scopes unwinds in,
64
- * applied to the DOM tree instead of the call stack.
65
- *
66
- * ── Memory ───────────────────────────────────────────────────────────────
67
- * Per-element bookkeeping lives in a WeakMap keyed by the element, so it is
68
- * collectible the instant nothing else references the element — exactly the
69
- * same shape as list/runtime.ts's and update/registry.ts's registries. The
70
- * mountQueue holds only WeakRefs, so abandoned builds are collectible even
71
- * if no later operation flushes the queue. Completed mount callbacks are
72
- * released immediately; only their returned cleanup survives until destroy.
73
- */
74
- /** Registers a mount callback for `element`. See the module doc for timing. */
75
- export declare function registerMount<TElement extends Element>(element: TElement, callback: MountCallback<TElement>): void;
76
- /** Registers a destroy callback for `element`. See the module doc for timing. */
77
- export declare function registerDestroy<TElement extends Element>(element: TElement, callback: DestroyCallback<TElement>): void;
78
- /**
79
- * Flushes every element queued since the last flush, firing its mount
80
- * callback(s) now that the surrounding render()/hydrate()/update() pass has
81
- * finished inserting nodes into the (connected) document.
82
- *
83
- * Swaps the shared queue out to a local batch before iterating, so a mount
84
- * callback that itself triggers a nested update() (which pushes onto a fresh
85
- * queue and flushes it in its own, inner call) can't corrupt or be corrupted
86
- * by the batch this call is still draining.
87
- */
88
- export declare function flushMountQueue(): void;
89
- /**
90
- * Finalizes one element's lifecycle: silently cancels a mount that never got
91
- * to run (state was still Pending — built and discarded within one pass), or
92
- * fires its destroy callback(s) (state was Mounted). Idempotent — safe to
93
- * call more than once for the same element, e.g. once eagerly from
94
- * cleanupNodeTree() and, redundantly, once more from a fast-path caller that
95
- * doesn't know whether the eager walk already reached this node.
96
- */
97
- export declare function disposeElementLifecycle(element: Element): void;
98
- /**
99
- * True while at least one element anywhere on the page has a live (Pending
100
- * or Mounted) lifecycle record. Called by disposeLifecyclesInSubtree() in
101
- * shared/dom.ts (its own short-circuit) and, hoisted out of its per-row
102
- * loop, by list/runtime.ts's bulkClearRecords() — so clearing a large
103
- * lifecycle-free list costs one comparison, not one skipped call per row.
104
- */
105
- export declare function hasActiveLifecycleRegistrations(): boolean;
106
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/element/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAsFH,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,QAAQ,SAAS,OAAO,EACpD,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,GAChC,IAAI,CAWN;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,QAAQ,SAAS,OAAO,EACtD,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,GAClC,IAAI,CAMN;AAkDD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAQtC;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB9D;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CAEzD"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Caches the probe result of zero-arity function modifiers so the same
3
- * function is not re-invoked when it reappears during re-renders.
4
- */
5
- export declare const modifierProbeCache: WeakMap<() => unknown, {
6
- value: unknown;
7
- error: boolean;
8
- }>;
9
- export type NodeModifier<TTagName extends ElementTagName = ElementTagName> = NodeMod<TTagName> | NodeModFn<TTagName> | AnyParentNodeModifier;
10
- export declare function applyNodeModifier<TTagName extends ElementTagName>(parent: ExpandedElement<TTagName>, modifier: NodeModifier<TTagName>, index: number): Node | null;
11
- //# sourceMappingURL=modifiers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../src/element/modifiers.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gBAAqB,OAAO;WAAW,OAAO;WAAS,OAAO;EAAK,CAAC;AAEnG,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,cAAc,GAAG,cAAc,IACtE,OAAO,CAAC,QAAQ,CAAC,GACjB,SAAS,CAAC,QAAQ,CAAC,GACnB,qBAAqB,CAAC;AAqDzB,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAChC,KAAK,EAAE,MAAM,GACX,IAAI,GAAG,IAAI,CAsFb"}
@@ -1,5 +0,0 @@
1
- export declare const HTML_TAGS: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "search", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
2
- export declare const SVG_TAGS: readonly ["a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "script", "set", "stop", "style", "svg", "switch", "symbol", "text", "textPath", "title", "tspan", "use", "view"];
3
- export declare const SELF_CLOSING_TAGS: readonly ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "source", "track", "wbr"];
4
- export declare function registerGlobalTagBuilders(target?: Record<string, unknown>): void;
5
- //# sourceMappingURL=tags.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/element/tags.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS,g7BAc4B,CAAC;AAEnD,eAAO,MAAM,QAAQ,4wBAWyC,CAAC;AAE/D,eAAO,MAAM,iBAAiB,iHAGoB,CAAC;AAkDnD,wBAAgB,yBAAyB,CAAC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAc,GAAG,IAAI,CAe5F"}
@@ -1,73 +0,0 @@
1
- /**
2
- * Hydration context — tracks global hydration state and per-parent cursor positions.
3
- *
4
- * During hydration the component tree is built against an existing DOM tree
5
- * (produced by SSR). Instead of creating new nodes, factories claim existing
6
- * children from their parent element by advancing a cursor.
7
- *
8
- * The cursor is a *node pointer* (the next unclaimed child), not an index.
9
- * Indexed childNodes access is O(n) after any tree/attribute mutation in
10
- * jsdom (live NodeList re-materialization) which made hydration O(n²);
11
- * firstChild/nextSibling pointers are O(1) in every DOM implementation.
12
- */
13
- export declare function isHydrating(): boolean;
14
- /**
15
- * True while a tree is being built for SSR serialization (inside
16
- * renderToString). Text children must keep their `<!-- text-N -->` markers in
17
- * this mode so the emitted HTML stays hydratable — even when `isBrowser` is
18
- * true (SSR running under jsdom, or an isomorphic worker that provides a DOM).
19
- * A pure client render leaves this false and skips the markers.
20
- */
21
- export declare function isSerializing(): boolean;
22
- /**
23
- * Runs `fn` with serialization mode enabled, restoring the previous state
24
- * afterwards (so nested/re-entrant renderToString calls behave correctly).
25
- */
26
- export declare function runSerializing<T>(fn: () => T): T;
27
- export declare function startHydration(): void;
28
- export declare function endHydration(): void;
29
- /**
30
- * Runs a callback with hydration temporarily disabled, restoring the previous
31
- * state afterwards. Used when a server/client mismatch forces a subtree to be
32
- * rendered fresh in the middle of a hydration pass — fresh rendering must not
33
- * claim nodes from the surrounding SSR DOM.
34
- */
35
- export declare function runWithoutHydration<T>(fn: () => T): T;
36
- /**
37
- * Returns the next unclaimed child of a parent node (or null at the end)
38
- * without advancing the cursor.
39
- */
40
- export declare function peekChild(parent: Node): Node | null;
41
- /**
42
- * Sets the cursor to a specific child node (or null for "past the end").
43
- */
44
- export declare function setCursor(parent: Node, node: Node | null): void;
45
- /**
46
- * Advances the cursor past whitespace-only text nodes.
47
- *
48
- * Nuclo's own SSR output never produces bare whitespace text nodes (text
49
- * children are always preceded by a `<!-- text-N -->` marker), so unmarked
50
- * whitespace comes from the surrounding template or an HTML
51
- * formatter/minifier. Skipping (without removing) keeps the cursor aligned
52
- * while leaving the document's visual whitespace untouched.
53
- */
54
- export declare function skipWhitespaceText(parent: Node): void;
55
- /**
56
- * Claims the next child node from parent at the current cursor position.
57
- * Advances the cursor by one.
58
- */
59
- export declare function claimChild(parent: Node): Node | null;
60
- /**
61
- * Attempts to claim an existing element from the parent during hydration.
62
- * Returns the claimed element if the next child matches the expected tag, or null.
63
- */
64
- export declare function claimElement(parent: Node, tagName: string): Element | null;
65
- /**
66
- * Removes unclaimed SSR children from a hydrated element.
67
- * Must be called after modifiers have been applied to a claimed element.
68
- * Removes nodes from the cursor through `lastOriginalChild` (the element's
69
- * last child before modifiers ran) — nodes appended by modifiers come after
70
- * that boundary and are preserved.
71
- */
72
- export declare function cleanupUnclaimedChildren(node: Node, lastOriginalChild: Node | null): void;
73
- //# sourceMappingURL=hydration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQhD;AAED,wBAAgB,cAAc,IAAI,IAAI,CAMrC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQrD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAGnD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAE/D;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAUrD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAMpD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CASzF"}
package/dist/index.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export { initializeRuntime } from "./bootstrap";
2
- export { registerGlobalTagBuilders, HTML_TAGS, SVG_TAGS, SELF_CLOSING_TAGS } from "./element/tags";
3
- export { createHtmlTagBuilder, createSvgTagBuilder, createHtmlElementWithModifiers, createSvgElementWithModifiers, } from "./element/factory";
4
- export { applyNodeModifier } from "./element/modifiers";
5
- export { applyAttributes } from "./element/attributes";
6
- export { on } from "./element/events";
7
- export { update } from "./update/update";
8
- export { scope } from "./update/scope";
9
- export { list } from "./list";
10
- export { when } from "./when";
11
- export { render, hydrate } from "./render";
12
- export * from "./style";
13
- export { appendChildren, createComment, createConditionalComment, replaceNodeSafely } from "./shared/dom";
14
- export { isBoolean, isFunction, isNode, isObject, isPrimitive, isTagLike, isZeroArityFunction } from "./shared/type-guards";
15
- export { isBrowser } from "./shared/environment";
16
- import "./bootstrap";
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG3C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,aAAa,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { ListRenderer, ListItemsProvider } from "./types";
2
- /**
3
- * Maps items to DOM elements, keeping them in sync with changes.
4
- * Returns a function compatible with both HTML and SVG contexts.
5
- */
6
- export declare function list<TItem, TTagName extends ElementTagName = ElementTagName>(itemsProvider: ListItemsProvider<TItem>, render: ListRenderer<TItem, TTagName>): ListModifier<TTagName>;
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/list/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,SAAS,cAAc,GAAG,cAAc,EAC1E,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,EACvC,MAAM,EAAE,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,GACpC,YAAY,CAAC,QAAQ,CAAC,CAOxB"}
@@ -1,6 +0,0 @@
1
- import type { ListRenderer, ListRuntime, ListItemsProvider } from "./types";
2
- import type { UpdateScope } from "../update/scope";
3
- export declare function sync<TItem, TTagName extends ElementTagName>(runtime: ListRuntime<TItem, TTagName>): void;
4
- export declare function createListRuntime<TItem, TTagName extends ElementTagName = ElementTagName>(itemsProvider: ListItemsProvider<TItem>, renderItem: ListRenderer<TItem, TTagName>, host: ExpandedElement<TTagName>, index: number): ListRuntime<TItem, TTagName>;
5
- export declare function updateListRuntimes(scope?: UpdateScope): void;
6
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/list/runtime.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAkC,iBAAiB,EAAmB,MAAM,SAAS,CAAC;AAC7H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAqTnD,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,SAAS,cAAc,EACzD,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,GACpC,IAAI,CA4ON;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,SAAS,cAAc,GAAG,cAAc,EACvF,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,EACvC,UAAU,EAAE,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EACzC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,EAC/B,KAAK,EAAE,MAAM,GACZ,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAM9B;AAuKD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAuD5D"}
@@ -1,113 +0,0 @@
1
- /**
2
- * Row-template cloning for list().
3
- *
4
- * Building a row through the normal pipeline costs one createElement + a full
5
- * modifier pass per element. For a keyed list every row comes from the same
6
- * render function, so the structure is identical across rows and only the
7
- * leaves differ (text values, event handlers, reactive resolvers, and —
8
- * rarely — static attribute values). This module:
9
- *
10
- * 1. analyzes the first row's factory tree (via the internal factory
11
- * metadata symbols) and, when every modifier falls into a supported
12
- * shape, records a slot program for the row;
13
- * 2. clones the first row's built element as a skeleton (cloneNode does not
14
- * copy property-assigned `on*` handlers or reactive registrations, and
15
- * reactive classNames are scrubbed so a selected first row can't leak
16
- * its state into the skeleton);
17
- * 3. builds every other row as skeleton.cloneNode(true) + a patch pass that
18
- * walks the new factory tree in lockstep with the slot program.
19
- *
20
- * Any construct outside the supported shape (style objects, on() modifiers,
21
- * nested list()/when(), node children, resolvers returning non-primitives,
22
- * multiple className sources per element, SVG) bails to the normal build
23
- * path — the template is per-list state, so unsupported lists simply never
24
- * activate it. A per-row shape mismatch (heterogeneous render output)
25
- * deactivates the template for that list and rebuilds the row normally.
26
- */
27
- export declare const LEAF_TEXT = 0;
28
- export declare const LEAF_CLASSNAME = 1;
29
- /**
30
- * A clone's dynamic leaf, owned by its list record instead of the global
31
- * reactive registries: template rows have a known lifetime (they live and die
32
- * with their record), so update() can flush them with a tight array walk —
33
- * no WeakRef/WeakMap bookkeeping per row, nothing for the GC sweeps to prune.
34
- */
35
- export interface RowLeaf {
36
- kind: number;
37
- node: Text | HTMLElement;
38
- fn: () => unknown;
39
- last: string;
40
- }
41
- export declare const SLOT_ATTRS = 0;
42
- export declare const SLOT_TEXT = 1;
43
- export declare const SLOT_REACTIVE_TEXT = 2;
44
- export declare const SLOT_CHILD = 3;
45
- export declare const SLOT_NULL = 4;
46
- export declare const ATTR_STATIC = 0;
47
- export declare const ATTR_EVENT = 1;
48
- export declare const ATTR_REACTIVE_CLASSNAME = 2;
49
- export declare const ATTR_NULL = 3;
50
- export interface AttrSpec {
51
- key: string;
52
- kind: number;
53
- /** Static attrs: element exposes the key as a property (filled from the skeleton). */
54
- prop: boolean;
55
- /** Static attrs: first-row value. Events: normalized native property name. */
56
- value?: unknown;
57
- }
58
- export type TemplateSlot = {
59
- kind: typeof SLOT_ATTRS;
60
- keys: AttrSpec[];
61
- } | {
62
- kind: typeof SLOT_TEXT;
63
- } | {
64
- kind: typeof SLOT_REACTIVE_TEXT;
65
- } | {
66
- kind: typeof SLOT_CHILD;
67
- child: TemplateNode;
68
- } | {
69
- kind: typeof SLOT_NULL;
70
- };
71
- export interface TemplateNode {
72
- tag: string;
73
- slots: TemplateSlot[];
74
- }
75
- export interface ListTemplate {
76
- tmpl: TemplateNode;
77
- skeleton: Element;
78
- }
79
- /**
80
- * Classifies a factory's modifier tree into a slot program, or returns null
81
- * when any modifier falls outside the supported shape.
82
- */
83
- export declare function analyzeFactory(tag: string, mods: readonly unknown[]): TemplateNode | null;
84
- /**
85
- * One-time skeleton pass: fills each static attr's property-vs-attribute
86
- * flag and scrubs reactive classNames (the first row may have rendered with
87
- * row-specific state, e.g. a selected row's "danger" class).
88
- */
89
- export declare function prepareSkeleton(tmpl: TemplateNode, skeleton: Element): void;
90
- /**
91
- * Patches a skeleton clone from a fresh factory tree. Returns false on any
92
- * shape mismatch — the caller then rebuilds the row through the normal path
93
- * (a partially patched clone is safe to abandon: its reactive registrations
94
- * are weak and disconnected, so the next update() sweeps them).
95
- */
96
- export declare function instantiateTemplate(tmpl: TemplateNode, mods: readonly unknown[], el: Element, leaves: RowLeaf[]): boolean;
97
- /**
98
- * Converts the normally-built first row of a compatible template into the same
99
- * record-owned dynamic leaf representation used by skeleton clones.
100
- *
101
- * The normal builder has already registered reactive text/className leaves in
102
- * the global registries. Template rows have a tighter lifetime through their
103
- * list record, so unregister those first-row leaves and let updateListRuntimes()
104
- * flush them with the rest of the templated rows.
105
- */
106
- export declare function adoptTemplateLeaves(tmpl: TemplateNode, mods: readonly unknown[], el: Element, leaves: RowLeaf[]): boolean;
107
- /**
108
- * Flushes a template row's dynamic leaves: re-evaluates each resolver and
109
- * writes the DOM only on change. Resolver errors leave the previous value in
110
- * place (matching the notify passes' error tolerance).
111
- */
112
- export declare function flushRowLeaves(leaves: RowLeaf[]): void;
113
- //# sourceMappingURL=template.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/list/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;IACzB,EAAE,EAAE,MAAM,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,IAAI,EAAE,OAAO,CAAC;IACd,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,OAAO,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,OAAO,SAAS,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,OAAO,kBAAkB,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,OAAO,UAAU,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,OAAO,SAAS,CAAA;CAAE,CAAC;AAE/B,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,YAAY,GAAG,IAAI,CAqFzF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CA8B3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,EAAE,EAAE,OAAO,EACX,MAAM,EAAE,OAAO,EAAE,GAChB,OAAO,CAiHT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,EAAE,EAAE,OAAO,EACX,MAAM,EAAE,OAAO,EAAE,GAChB,OAAO,CAwET;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAuBtD"}