@jay-framework/compiler-jay-html 0.22.1 → 0.23.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.
@@ -404,3 +404,69 @@ Example with accessor (built-in guard):
404
404
  <recurse ref="node" accessor="child" />
405
405
  </div>
406
406
  ```
407
+
408
+ ## Conditional Parsing: Type-Aware Comparison (DL#163)
409
+
410
+ The `===`/`!==` operators in conditionals behave differently based on the left side's resolved type:
411
+
412
+ ### Enum types
413
+
414
+ Right side is a **variant literal** (existing behavior):
415
+
416
+ ```
417
+ if="status === active" → vs.status === Status.active
418
+ ```
419
+
420
+ The compiler resolves the type name and validates the variant exists.
421
+
422
+ ### String types
423
+
424
+ Right side is a **field reference** by default. Use quotes for string literals:
425
+
426
+ ```
427
+ if="url === currentPath" → vs.url === vs.currentPath
428
+ if="url === '/about'" → vs.url === '/about'
429
+ ```
430
+
431
+ ### `^=` startsWith operator
432
+
433
+ String-only operator. Generates `.startsWith()`:
434
+
435
+ ```
436
+ if="path ^= prefix" → vs.path.startsWith(vs.prefix)
437
+ if="path ^= '/docs'" → vs.path.startsWith('/docs')
438
+ ```
439
+
440
+ ### `jay.` built-in bindings
441
+
442
+ Accessors starting with `jay.` are mapped to `vs.__jay?.` in compiled output:
443
+
444
+ ```
445
+ jay.params.slug → vs.__jay?.params?.slug
446
+ jay.url.path → vs.__jay?.url?.path
447
+ ```
448
+
449
+ The runtime injects `__jay: { params, url: { path } }` into ViewState before rendering. In slow render, `jay.*` bindings always produce runtime code (never resolved at build time).
450
+
451
+ ## Graceful Parse Error Handling (DL#165)
452
+
453
+ `doParse()` catches PEG parser errors and returns a `RenderFragment` with validation messages and a type-appropriate fallback value instead of throwing. This prevents page crashes from invalid expressions.
454
+
455
+ ### Fallback values by start rule
456
+
457
+ | startRule | Fallback | Effect |
458
+ | ---------------------- | -------------------------------------- | -------------------- |
459
+ | `conditionFunc` | `vs => false` | Conditional hidden |
460
+ | `condition` | `false` | Condition false |
461
+ | `dynamicText` | `dt(vs => '[INVALID: expr]')` | Visible error marker |
462
+ | `dynamicAttribute` | `da(vs => '[INVALID: expr]')` | Visible error marker |
463
+ | `classExpression` | `''` | No classes |
464
+ | `booleanAttribute` | `ba(vs => false)` | Attribute absent |
465
+ | `dynamicComponentProp` | `vs => undefined` | Prop undefined |
466
+ | `accessor` | Null `Accessor` with `JayUnknown` type | No data |
467
+
468
+ Structural parsing (`parseImportNames`, `parseEnumValues`) still throws — contract-level errors can't be rendered as fallbacks.
469
+
470
+ ### Multiple root elements
471
+
472
+ `ensureSingleChildElement` auto-wraps multiple body children in `<div style="display: contents">` instead of returning a validation error. The wrapper is layout-transparent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "author": "",
36
36
  "dependencies": {
37
- "@jay-framework/compiler-analyze-exported-types": "^0.22.1",
38
- "@jay-framework/compiler-shared": "^0.22.1",
39
- "@jay-framework/component": "^0.22.1",
40
- "@jay-framework/logger": "^0.22.1",
41
- "@jay-framework/runtime": "^0.22.1",
42
- "@jay-framework/secure": "^0.22.1",
37
+ "@jay-framework/compiler-analyze-exported-types": "^0.23.0",
38
+ "@jay-framework/compiler-shared": "^0.23.0",
39
+ "@jay-framework/component": "^0.23.0",
40
+ "@jay-framework/logger": "^0.23.0",
41
+ "@jay-framework/runtime": "^0.23.0",
42
+ "@jay-framework/secure": "^0.23.0",
43
43
  "@types/js-yaml": "^4.0.9",
44
44
  "change-case": "^4.1.2",
45
45
  "he": "^1.2.0",
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@caiogondim/strip-margin": "^1.0.0",
55
- "@jay-framework/4-react": "^0.22.1",
56
- "@jay-framework/dev-environment": "^0.22.1",
55
+ "@jay-framework/4-react": "^0.23.0",
56
+ "@jay-framework/dev-environment": "^0.23.0",
57
57
  "@testing-library/jest-dom": "^6.2.0",
58
58
  "@types/js-beautify": "^1",
59
59
  "@types/node": "^20.11.5",