@jxsuite/compiler 0.33.0 → 0.34.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/compiler",
3
- "version": "0.33.0",
3
+ "version": "0.34.1",
4
4
  "description": "Jx static HTML compiler, island detector, and site builder",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@apidevtools/json-schema-ref-parser": "^15.4.0",
46
- "@jxsuite/parser": "^0.33.0",
47
- "@jxsuite/runtime": "^0.33.0",
48
- "@jxsuite/schema": "^0.33.0",
46
+ "@jxsuite/parser": "^0.35.0",
47
+ "@jxsuite/runtime": "^0.34.1",
48
+ "@jxsuite/schema": "^0.34.0",
49
49
  "sharp": "^0.35.3"
50
50
  },
51
51
  "devDependencies": {
@@ -957,6 +957,27 @@ function expandComponents(
957
957
 
958
958
  const def = componentDefs.get(node.tagName as string);
959
959
  if (def) {
960
+ // JSON-authored instances pass props as literal `props.*` attribute keys (markdown directives
961
+ // Are normalized to $props by the parser's expandDotPaths, but JSON is parsed verbatim).
962
+ // Lift them into $props so the pre-render sees them, and strip them from attributes so they
963
+ // Don't leak into the emitted HTML. Values stay raw strings — no coercion, matching the
964
+ // Markdown path and the runtime's $props semantics. Explicit $props wins on key conflicts.
965
+ if (node.attributes) {
966
+ let lifted: NonNullable<JxElement["$props"]> | null = null;
967
+ for (const [key, value] of Object.entries(node.attributes)) {
968
+ if (key.startsWith("props.") && key.length > "props.".length) {
969
+ lifted ??= {};
970
+ // JxAttributeValue is JSON-representable (primitives or a $ref object), so the
971
+ // Narrowing to JsonValue is sound.
972
+ lifted[key.slice("props.".length)] = value as JsonValue;
973
+ delete node.attributes[key];
974
+ }
975
+ }
976
+ if (lifted) {
977
+ node.$props = { ...lifted, ...node.$props };
978
+ }
979
+ }
980
+
960
981
  const slotContent =
961
982
  Array.isArray(node.children) && node.children.length > 0
962
983
  ? node.children