nuclo 0.2.14 → 0.2.15

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.
@@ -7,23 +7,42 @@
7
7
  * reference the node (e.g. attribute applyValue closures capture the
8
8
  * element), so storing them in a strongly-held map would pin the node in
9
9
  * memory forever. With WeakMap storage the whole record is collectible as
10
- * soon as the node is unreachable, and the FinalizationRegistry prunes the
11
- * leftover WeakRef from the iteration set. The notify passes also prune
12
- * dead/disconnected entries as they iterate.
10
+ * soon as the node is unreachable.
11
+ *
12
+ * Dead WeakRefs left in the iteration sets are pruned by the notify passes as
13
+ * they iterate (deref() === undefined, or node disconnected). Registration is
14
+ * the hottest path in list-heavy renders (one text node + often one element
15
+ * per row), so no per-node FinalizationRegistry is used here: its register()
16
+ * cost per row outweighs keeping the sets tidy between updates, and a stale
17
+ * husk is just an empty WeakRef until the next update() sweeps it.
13
18
  */
14
19
  export type TextResolver = () => Primitive;
15
20
  export interface ReactiveTextNodeInfo {
16
21
  resolver: TextResolver;
17
22
  lastValue: string;
23
+ /**
24
+ * DSL semantics: nullish and non-primitive resolver results render as ""
25
+ * (instead of String(value)). Set by the tag-builder text path so it can
26
+ * register the user's resolver directly rather than allocating a
27
+ * sanitizing wrapper closure per text node.
28
+ */
29
+ sanitize?: boolean;
18
30
  }
19
31
  export type AttributeResolver = () => unknown;
20
32
  export interface AttributeResolverRecord {
33
+ key: string;
21
34
  resolver: AttributeResolver;
22
35
  applyValue: (value: unknown) => void;
23
36
  lastValue: unknown;
24
37
  }
25
38
  export interface ReactiveElementInfo {
26
- attributeResolvers: Map<string, AttributeResolverRecord>;
39
+ /**
40
+ * Flat keyed array rather than a Map: elements almost always carry one or
41
+ * two reactive attributes, so linear key lookup on registration beats a Map
42
+ * allocation per element, and the per-update flush iterates with a plain
43
+ * index loop (no iterator/destructuring allocations).
44
+ */
45
+ attributeResolvers: AttributeResolverRecord[];
27
46
  }
28
47
  /**
29
48
  * Iteration set of weak references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AS,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,OAAO,CAAC;CACf;AAyBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,cAAc,EACnE,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,GAC7B,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAO1D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,EAAE,CAkBlD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,eAAe,CAAC,cAAc,CAAC,GAAG,IAAI,CAErF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuclo",
3
3
  "private": false,
4
- "version": "0.2.14",
4
+ "version": "0.2.15",
5
5
  "description": "Lightweight reactive DOM library with global tag builders, SSR, hydration, and atomic CSS — no virtual DOM, no compiler.",
6
6
  "license": "MIT",
7
7
  "author": "Danilo Celestino de Castro (https://github.com/dan2dev)",
@@ -72,7 +72,7 @@
72
72
  "globals": "^17.7.0",
73
73
  "jiti": "^2.7.0",
74
74
  "jsdom": "^29.1.1",
75
- "tsdown": "^0.22.7",
75
+ "tsdown": "^0.22.12",
76
76
  "typescript": "^6.0.3",
77
77
  "typescript-eslint": "^8.64.0",
78
78
  "vitest": "^4.1.10"