@barefootjs/xslate 0.18.7 → 0.19.1

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.
@@ -188226,7 +188226,7 @@ function collectBooleanTypedProps(ir) {
188226
188226
  return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
188227
188227
  }
188228
188228
  function collectNullableOptionalProps(ir) {
188229
- return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
188229
+ return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
188230
188230
  }
188231
188231
  function collectStringValueNames(ir) {
188232
188232
  const names = new Set;
@@ -188886,10 +188886,11 @@ ${name}="<: ${val} :>"
188886
188886
  if (e.kind === "expr" && !isSupported(parseExpression2(e.expr)).supported)
188887
188887
  return null;
188888
188888
  }
188889
- return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:<: ${this.convertExpressionToKolon(e.expr)} :>`).join(";");
188890
- }
188891
- escapeAttrText(s) {
188892
- return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
188889
+ const args = entries.flatMap((e) => [
188890
+ `'${escapeKolonSingleQuoted(e.cssKey)}'`,
188891
+ e.kind === "literal" ? `'${escapeKolonSingleQuoted(e.value)}'` : this.convertExpressionToKolon(e.expr)
188892
+ ]);
188893
+ return `<: $bf.style_object(${args.join(", ")}) | mark_raw :>`;
188893
188894
  }
188894
188895
  renderAttributes(element) {
188895
188896
  const parts = [];
@@ -15,8 +15,9 @@ import { type ComponentIR } from '@barefootjs/jsx';
15
15
  */
16
16
  export declare function collectBooleanTypedProps(ir: ComponentIR): Set<string>;
17
17
  /**
18
- * Bare references to optional, no-default, non-primitive props (e.g.
19
- * textarea's `rows`) are `undef` when omitted → `defined`-guarded in
18
+ * Bare references to presence-uncertain no-default props (non-primitive
19
+ * typed OR declared optional, #2259 — e.g. textarea's `rows`) are
20
+ * `undef` when omitted → `defined`-guarded in
20
21
  * `emitExpression`. See the `nullableOptionalProps` field docstring.
21
22
  */
22
23
  export declare function collectNullableOptionalProps(ir: ComponentIR): Set<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGzE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAepE"}
1
+ {"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGzE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAMrE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAepE"}
@@ -235,14 +235,17 @@ export declare class XslateAdapter extends BaseAdapter implements IRNodeEmitter<
235
235
  */
236
236
  private readonly elementAttrEmitter;
237
237
  /**
238
- * Lower a `style={{ … }}` object literal to a CSS string with dynamic values
239
- * interpolated as Kolon actions, e.g. `{ backgroundColor: color }` →
240
- * `background-color:<: $color :>`. Returns null when the shape is unsupported
238
+ * Lower a `style={{ … }}` object literal to a `$bf.style_object(...)` call,
239
+ * e.g. `{ backgroundColor: color }` → `<: $bf.style_object('background-color',
240
+ * $color) | mark_raw :>`. `style_object` is the single oracle-matching
241
+ * sanitizer (ported from Hono's `hasUnsafeStyleValue`): it drops any
242
+ * key:value pair whose value could break out of a CSS declaration and
243
+ * HTML-escapes the rest, so the call is piped through `| mark_raw` (not
244
+ * left to Kolon's own autoescape) to avoid double-encoding the
245
+ * already-safe result (#2261). Returns null when the shape is unsupported
241
246
  * or any value can't be lowered (caller falls through to BF101). (#1322)
242
247
  */
243
248
  private tryLowerStyleObject;
244
- /** HTML-attribute escape for static text inlined into a `"..."` attribute. */
245
- private escapeAttrText;
246
249
  private renderAttributes;
247
250
  renderScopeMarker(_instanceIdExpr: string): string;
248
251
  renderSlotMarker(slotId: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"xslate-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/xslate-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAKP,yBAAyB,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EA+BhB,MAAM,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BAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAMD;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,kCAAkC;IAwB1C;;;;OAIG;IACH,OAAO,CAAC,iCAAiC;IAmBzC;;;;;OAKG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAUlB;IAED;;;;;OAKG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,wBAAwB;IAyEhC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;oEACgE;IAChE,OAAO,CAAC,kBAAkB;IAI1B;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;OAIG;IACH,8BAA8B,CAC5B,IAAI,EAAE,MAAM,GACX;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAgBlD;IAED,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO3C;IAED;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,aAAa,eAAsB,CAAA"}
package/dist/build.js CHANGED
@@ -188226,7 +188226,7 @@ function collectBooleanTypedProps(ir) {
188226
188226
  return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
188227
188227
  }
188228
188228
  function collectNullableOptionalProps(ir) {
188229
- return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
188229
+ return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
188230
188230
  }
188231
188231
  function collectStringValueNames(ir) {
188232
188232
  const names = new Set;
@@ -188886,10 +188886,11 @@ ${name}="<: ${val} :>"
188886
188886
  if (e.kind === "expr" && !isSupported(parseExpression2(e.expr)).supported)
188887
188887
  return null;
188888
188888
  }
188889
- return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:<: ${this.convertExpressionToKolon(e.expr)} :>`).join(";");
188890
- }
188891
- escapeAttrText(s) {
188892
- return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
188889
+ const args = entries.flatMap((e) => [
188890
+ `'${escapeKolonSingleQuoted(e.cssKey)}'`,
188891
+ e.kind === "literal" ? `'${escapeKolonSingleQuoted(e.value)}'` : this.convertExpressionToKolon(e.expr)
188892
+ ]);
188893
+ return `<: $bf.style_object(${args.join(", ")}) | mark_raw :>`;
188893
188894
  }
188894
188895
  renderAttributes(element) {
188895
188896
  const parts = [];
package/dist/index.js CHANGED
@@ -188226,7 +188226,7 @@ function collectBooleanTypedProps(ir) {
188226
188226
  return new Set(ir.metadata.propsParams.filter((prop) => prop.type?.primitive === "boolean" || prop.type?.raw === "boolean").map((prop) => prop.name));
188227
188227
  }
188228
188228
  function collectNullableOptionalProps(ir) {
188229
- return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && p.type?.kind !== "primitive").map((p) => p.name));
188229
+ return new Set(ir.metadata.propsParams.filter((p) => p.defaultValue === undefined && !p.isRest && (p.type?.kind !== "primitive" || p.optional)).map((p) => p.name));
188230
188230
  }
188231
188231
  function collectStringValueNames(ir) {
188232
188232
  const names = new Set;
@@ -188886,10 +188886,11 @@ ${name}="<: ${val} :>"
188886
188886
  if (e.kind === "expr" && !isSupported(parseExpression2(e.expr)).supported)
188887
188887
  return null;
188888
188888
  }
188889
- return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:<: ${this.convertExpressionToKolon(e.expr)} :>`).join(";");
188890
- }
188891
- escapeAttrText(s) {
188892
- return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
188889
+ const args = entries.flatMap((e) => [
188890
+ `'${escapeKolonSingleQuoted(e.cssKey)}'`,
188891
+ e.kind === "literal" ? `'${escapeKolonSingleQuoted(e.value)}'` : this.convertExpressionToKolon(e.expr)
188892
+ ]);
188893
+ return `<: $bf.style_object(${args.join(", ")}) | mark_raw :>`;
188893
188894
  }
188894
188895
  renderAttributes(element) {
188895
188896
  const parts = [];
@@ -1,5 +1,5 @@
1
1
  package BarefootJS::Backend::Xslate;
2
- our $VERSION = "0.18.5";
2
+ our $VERSION = "0.19.0";
3
3
  use strict;
4
4
  use warnings;
5
5
  use utf8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/xslate",
3
- "version": "0.18.7",
3
+ "version": "0.19.1",
4
4
  "description": "Text::Xslate (Kolon) adapter for BarefootJS — compiles IR to .tx templates and ships the Xslate rendering backend; runs under any PSGI/Plack app",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,14 +55,14 @@
55
55
  "directory": "packages/adapter-xslate"
56
56
  },
57
57
  "dependencies": {
58
- "@barefootjs/shared": "0.18.7"
58
+ "@barefootjs/shared": "0.19.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@barefootjs/jsx": ">=0.2.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@barefootjs/adapter-tests": "0.1.0",
65
- "@barefootjs/jsx": "0.18.7",
65
+ "@barefootjs/jsx": "0.19.1",
66
66
  "typescript": "^5.0.0"
67
67
  }
68
68
  }
@@ -63,6 +63,20 @@ runAdapterConformanceTests({
63
63
  // #1467 Phase 2e: same `/* @client */` keyed-map elision (data-table).
64
64
  'data-table',
65
65
  ]),
66
+ skipDataPoints: new Set<string>([
67
+ // #2260 — controlled boolean props: the SSR seed evaluates only the
68
+ // static fallback of `props.X ?? internal()` chains.
69
+ 'toggle:gen:pressed:true',
70
+ 'switch:gen:checked:true',
71
+ 'checkbox:gen:checked:true',
72
+ // #2261 — invalid dynamic CSS value kept (escaped) where the oracle
73
+ // drops the property.
74
+ 'style-object-dynamic:gen:color:markup',
75
+ // #2262 — dynamic `.flat` depth 0/negative violates the documented
76
+ // shallow-copy contract (shared with the Mojo Perl runtime).
77
+ 'array-flat-dynamic-depth:gen:depth:zero',
78
+ 'array-flat-dynamic-depth:gen:depth:negative',
79
+ ]),
66
80
  onRenderError: (err, id) => {
67
81
  if (err instanceof XslateNotAvailableError) {
68
82
  console.log(`Skipping [${id}]: ${err.message}`)
@@ -25,8 +25,9 @@ export function collectBooleanTypedProps(ir: ComponentIR): Set<string> {
25
25
  }
26
26
 
27
27
  /**
28
- * Bare references to optional, no-default, non-primitive props (e.g.
29
- * textarea's `rows`) are `undef` when omitted → `defined`-guarded in
28
+ * Bare references to presence-uncertain no-default props (non-primitive
29
+ * typed OR declared optional, #2259 — e.g. textarea's `rows`) are
30
+ * `undef` when omitted → `defined`-guarded in
30
31
  * `emitExpression`. See the `nullableOptionalProps` field docstring.
31
32
  */
32
33
  export function collectNullableOptionalProps(ir: ComponentIR): Set<string> {
@@ -36,7 +37,7 @@ export function collectNullableOptionalProps(ir: ComponentIR): Set<string> {
36
37
  p =>
37
38
  p.defaultValue === undefined &&
38
39
  !p.isRest &&
39
- p.type?.kind !== 'primitive',
40
+ (p.type?.kind !== 'primitive' || p.optional),
40
41
  )
41
42
  .map(p => p.name),
42
43
  )
@@ -1365,9 +1365,14 @@ export class XslateAdapter extends BaseAdapter implements IRNodeEmitter<XslateRe
1365
1365
  }
1366
1366
 
1367
1367
  /**
1368
- * Lower a `style={{ … }}` object literal to a CSS string with dynamic values
1369
- * interpolated as Kolon actions, e.g. `{ backgroundColor: color }` →
1370
- * `background-color:<: $color :>`. Returns null when the shape is unsupported
1368
+ * Lower a `style={{ … }}` object literal to a `$bf.style_object(...)` call,
1369
+ * e.g. `{ backgroundColor: color }` → `<: $bf.style_object('background-color',
1370
+ * $color) | mark_raw :>`. `style_object` is the single oracle-matching
1371
+ * sanitizer (ported from Hono's `hasUnsafeStyleValue`): it drops any
1372
+ * key:value pair whose value could break out of a CSS declaration and
1373
+ * HTML-escapes the rest, so the call is piped through `| mark_raw` (not
1374
+ * left to Kolon's own autoescape) to avoid double-encoding the
1375
+ * already-safe result (#2261). Returns null when the shape is unsupported
1371
1376
  * or any value can't be lowered (caller falls through to BF101). (#1322)
1372
1377
  */
1373
1378
  private tryLowerStyleObject(expr: string): string | null {
@@ -1376,27 +1381,11 @@ export class XslateAdapter extends BaseAdapter implements IRNodeEmitter<XslateRe
1376
1381
  for (const e of entries) {
1377
1382
  if (e.kind === 'expr' && !isSupported(parseExpression(e.expr)).supported) return null
1378
1383
  }
1379
- // The static CSS key + literal value are inlined into a double-quoted
1380
- // `style="..."` attribute as raw template text, so HTML-attr escape them
1381
- // (a value like `'"'` would otherwise break the attribute / inject
1382
- // markup). The dynamic arm's `<: … :>` is HTML-escaped by Kolon.
1383
- return entries
1384
- .map(e =>
1385
- e.kind === 'literal'
1386
- ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}`
1387
- : `${this.escapeAttrText(e.cssKey)}:<: ${this.convertExpressionToKolon(e.expr)} :>`,
1388
- )
1389
- .join(';')
1390
- }
1391
-
1392
- /** HTML-attribute escape for static text inlined into a `"..."` attribute. */
1393
- private escapeAttrText(s: string): string {
1394
- return s
1395
- .replace(/&/g, '&amp;')
1396
- .replace(/"/g, '&quot;')
1397
- .replace(/'/g, '&#39;')
1398
- .replace(/</g, '&lt;')
1399
- .replace(/>/g, '&gt;')
1384
+ const args = entries.flatMap(e => [
1385
+ `'${escapeKolonSingleQuoted(e.cssKey)}'`,
1386
+ e.kind === 'literal' ? `'${escapeKolonSingleQuoted(e.value)}'` : this.convertExpressionToKolon(e.expr),
1387
+ ])
1388
+ return `<: $bf.style_object(${args.join(', ')}) | mark_raw :>`
1400
1389
  }
1401
1390
 
1402
1391
  private renderAttributes(element: IRElement): string {