rip-lang 3.13.62 → 3.13.64

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.62",
3
+ "version": "3.13.64",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/components.js CHANGED
@@ -112,6 +112,8 @@ function isPublicProp(target) {
112
112
 
113
113
  export function installComponentSupport(CodeGenerator, Lexer) {
114
114
 
115
+ let meta = (node, key) => node instanceof String ? node[key] : undefined;
116
+
115
117
  // ==========================================================================
116
118
  // Lexer: Context-sensitive 'offer'/'accept' (only inside component bodies)
117
119
  // ==========================================================================
@@ -260,6 +262,22 @@ export function installComponentSupport(CodeGenerator, Lexer) {
260
262
  // Only process if we're inside a render block
261
263
  if (!inRender) return 1;
262
264
 
265
+ // ─────────────────────────────────────────────────────────────────────
266
+ // Expression output: = expr → text node (stamp .text, skip tag detection)
267
+ // ─────────────────────────────────────────────────────────────────────
268
+ if (tag === '=' && i > 0) {
269
+ let prev = tokens[i - 1][0];
270
+ if (prev === 'TERMINATOR' || prev === 'INDENT' || prev === 'RENDER') {
271
+ tokens.splice(i, 1);
272
+ if (tokens[i] && tokens[i][0] === 'IDENTIFIER') {
273
+ let val = tokens[i][1];
274
+ if (typeof val === 'string') { val = new String(val); tokens[i][1] = val; }
275
+ val.text = true;
276
+ }
277
+ return 0;
278
+ }
279
+ }
280
+
263
281
  // ─────────────────────────────────────────────────────────────────────
264
282
  // Transition modifier
265
283
  // div ~fade → div __transition__: "fade"
@@ -546,11 +564,11 @@ export function installComponentSupport(CodeGenerator, Lexer) {
546
564
  current = current[1];
547
565
  }
548
566
  let raw = typeof current === 'string' ? current : (current instanceof String ? current.valueOf() : null);
549
- if (raw === null) return { tag: null, classes, id: undefined };
567
+ if (raw === null) return { tag: null, classes, id: undefined, base: current };
550
568
  // Split tag#id — e.g. "div#content" → tag: "div", id: "content"
551
569
  let [tag, id] = raw.split('#');
552
570
  if (!tag) tag = 'div'; // bare #id → div
553
- return { tag, classes, id };
571
+ return { tag, classes, id, base: current };
554
572
  };
555
573
 
556
574
  // ==========================================================================
@@ -1047,7 +1065,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1047
1065
  }
1048
1066
 
1049
1067
  // HTML tag (possibly with #id, e.g. div#content)
1050
- if (headStr && this.isHtmlTag(headStr)) {
1068
+ if (headStr && this.isHtmlTag(headStr) && !meta(head, 'text')) {
1051
1069
  let [tagName, id] = headStr.split('#');
1052
1070
  return this.generateTag(tagName || 'div', [], rest, id);
1053
1071
  }
@@ -1070,9 +1088,9 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1070
1088
  return slotVar;
1071
1089
  }
1072
1090
 
1073
- // HTML tag with classes (div.class) and optional #id
1074
- const { tag, classes, id } = this.collectTemplateClasses(sexpr);
1075
- if (tag && this.isHtmlTag(tag)) {
1091
+ // HTML tag with classes (div.class) skip if base is marked .text by = prefix
1092
+ const { tag, classes, id, base } = this.collectTemplateClasses(sexpr);
1093
+ if (!meta(base, 'text') && tag && this.isHtmlTag(tag)) {
1076
1094
  return this.generateTag(tag, classes, [], id);
1077
1095
  }
1078
1096