@nifrajs/web-vanilla 2.0.0 → 2.2.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,KAAK,QAAQ,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,CAO/E"}
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,KAAK,QAAQ,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,CAc/E"}
package/dist/compose.js CHANGED
@@ -6,7 +6,14 @@ export function compose(chain, props) {
6
6
  const last = chain.length - 1;
7
7
  let node = chain[last](props);
8
8
  for (let i = last - 1; i >= 0; i--) {
9
- node = chain[i]({ ...props, children: node });
9
+ // Each layout receives its own loader data at its own index. Layouts are the chain's leading
10
+ // prefix, so `layoutData[i]` belongs to `chain[i]`; anything past that end (a client-only `_error`
11
+ // boundary marker, the page) reads `undefined` and is unaffected.
12
+ node = chain[i]({
13
+ ...props,
14
+ data: props.layoutData?.[i] ?? null,
15
+ children: node,
16
+ });
10
17
  }
11
18
  return node;
12
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAAyB,EAAE,KAAkB;IACnE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IAC7B,IAAI,IAAI,GAAI,KAAK,CAAC,IAAI,CAAsB,CAAC,KAAK,CAAC,CAAA;IACnD,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,GAAI,KAAK,CAAC,CAAC,CAAsB,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IACrE,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAAyB,EAAE,KAAkB;IACnE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IAC7B,IAAI,IAAI,GAAI,KAAK,CAAC,IAAI,CAAsB,CAAC,KAAK,CAAC,CAAA;IACnD,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,6FAA6F;QAC7F,mGAAmG;QACnG,kEAAkE;QAClE,IAAI,GAAI,KAAK,CAAC,CAAC,CAAsB,CAAC;YACpC,GAAG,KAAK;YACR,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI;YACnC,QAAQ,EAAE,IAAI;SACf,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/web-vanilla",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Zero-framework render adapter for @nifrajs/web — auto-escaping tagged-template HTML, ~0 KB client JS, interactivity via @nifrajs/web/islands.",
5
5
  "keywords": [
6
6
  "bun",
@@ -33,7 +33,7 @@
33
33
  "typecheck": "tsc --noEmit"
34
34
  },
35
35
  "peerDependencies": {
36
- "@nifrajs/web": "^2.0.0"
36
+ "@nifrajs/web": "^2.2.0"
37
37
  },
38
38
  "license": "MIT",
39
39
  "publishConfig": {
package/src/compose.ts CHANGED
@@ -17,7 +17,14 @@ export function compose(chain: readonly unknown[], props: RenderProps): Template
17
17
  const last = chain.length - 1
18
18
  let node = (chain[last] as VanillaComponent)(props)
19
19
  for (let i = last - 1; i >= 0; i--) {
20
- node = (chain[i] as VanillaComponent)({ ...props, children: node })
20
+ // Each layout receives its own loader data at its own index. Layouts are the chain's leading
21
+ // prefix, so `layoutData[i]` belongs to `chain[i]`; anything past that end (a client-only `_error`
22
+ // boundary marker, the page) reads `undefined` and is unaffected.
23
+ node = (chain[i] as VanillaComponent)({
24
+ ...props,
25
+ data: props.layoutData?.[i] ?? null,
26
+ children: node,
27
+ })
21
28
  }
22
29
  return node
23
30
  }