rip-lang 3.13.125 → 3.13.126

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.125-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.126-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
package/docs/dist/rip.js CHANGED
@@ -4248,16 +4248,11 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
4248
4248
  if (tag === "=" && i > 0) {
4249
4249
  let prev = tokens[i - 1][0];
4250
4250
  if (prev === "TERMINATOR" || prev === "INDENT" || prev === "RENDER") {
4251
- tokens.splice(i, 1);
4252
- if (tokens[i] && tokens[i][0] === "IDENTIFIER") {
4253
- let val = tokens[i][1];
4254
- if (typeof val === "string") {
4255
- val = new String(val);
4256
- tokens[i][1] = val;
4257
- }
4258
- val.text = true;
4259
- }
4260
- return 0;
4251
+ const textToken = gen2("IDENTIFIER", "__text__", token);
4252
+ const callStart = gen2("CALL_START", "(", token);
4253
+ tokens.splice(i, 1, textToken, callStart);
4254
+ this.detectEnd(i + 2, (t) => t[0] === "TERMINATOR" || t[0] === "OUTDENT", (t, j) => tokens.splice(j, 0, gen2("CALL_END", ")", t)), { returnOnNegativeLevel: true });
4255
+ return 2;
4261
4256
  }
4262
4257
  }
4263
4258
  if (tag === "UNARY_MATH" && token[1] === "~" && nextToken && nextToken[0] === "IDENTIFIER") {
@@ -4392,7 +4387,7 @@ Expecting ${expected.join(", ")}, got '${this.tokenNames[symbol] || symbol}'`;
4392
4387
  }
4393
4388
  let isTemplateElement = false;
4394
4389
  let prevTag = i > 0 ? tokens[i - 1][0] : null;
4395
- let isAfterControlFlow = prevTag === "IF" || prevTag === "UNLESS" || prevTag === "WHILE" || prevTag === "UNTIL" || prevTag === "WHEN";
4390
+ let isAfterControlFlow = prevTag === "IF" || prevTag === "UNLESS" || prevTag === "WHILE" || prevTag === "UNTIL" || prevTag === "WHEN" || prevTag === "FORIN" || prevTag === "FOROF" || prevTag === "FORAS" || prevTag === "FORASAWAIT" || prevTag === "BY";
4396
4391
  let isClsxCallEnd = false;
4397
4392
  if (tag === "CALL_END") {
4398
4393
  let depth = 1;
@@ -5398,6 +5393,18 @@ ${blockFactoriesCode}return ${lines.join(`
5398
5393
  if (headStr === "for" || headStr === "for-in" || headStr === "for-of" || headStr === "for-as") {
5399
5394
  return this.generateTemplateLoop(sexpr);
5400
5395
  }
5396
+ if (headStr === "__text__") {
5397
+ const expr = rest[0] ?? "undefined";
5398
+ const textVar2 = this.newTextVar();
5399
+ const exprCode2 = this.generateInComponent(expr, "value");
5400
+ if (this.hasReactiveDeps(expr)) {
5401
+ this._createLines.push(`${textVar2} = document.createTextNode('');`);
5402
+ this._pushEffect(`${textVar2}.data = String(${exprCode2});`);
5403
+ } else {
5404
+ this._createLines.push(`${textVar2} = document.createTextNode(String(${exprCode2}));`);
5405
+ }
5406
+ return textVar2;
5407
+ }
5401
5408
  const textVar = this.newTextVar();
5402
5409
  const exprCode = this.generateInComponent(sexpr, "value");
5403
5410
  if (this.hasReactiveDeps(sexpr)) {
@@ -9152,13 +9159,13 @@ ${this.indent()}}`;
9152
9159
  generateSwitchCaseBody(body, context) {
9153
9160
  let code = "";
9154
9161
  let hasFlow = this.hasExplicitControlFlow(body);
9162
+ let stmts = this.unwrapBlock(body);
9155
9163
  if (hasFlow) {
9156
- for (let s of this.unwrapBlock(body))
9164
+ for (let s of stmts)
9157
9165
  code += this.indent() + this.generate(s, "statement") + `;
9158
9166
  `;
9159
9167
  } else if (context === "value") {
9160
9168
  if (this.is(body, "block") && body.length > 2) {
9161
- let stmts = body.slice(1);
9162
9169
  for (let i = 0;i < stmts.length; i++) {
9163
9170
  if (i === stmts.length - 1)
9164
9171
  code += this.indent() + `return ${this.generate(stmts[i], "value")};
@@ -9172,8 +9179,14 @@ ${this.indent()}}`;
9172
9179
  `;
9173
9180
  }
9174
9181
  } else {
9175
- if (this.is(body, "block") && body.length > 1) {
9176
- for (let s of body.slice(1))
9182
+ if (stmts.length === 1 && this.is(stmts[0], "if") && !this.hasStatementInBranch(stmts[0]) && !this.hasNestedMultiStatement(stmts[0])) {
9183
+ let [_, condition, thenBranch, ...elseBranches] = stmts[0];
9184
+ let thenExpr = this.extractExpression(this.unwrapIfBranch(thenBranch));
9185
+ let elseExpr = this.buildTernaryChain(elseBranches);
9186
+ code += this.indent() + `(${this.unwrap(this.generate(condition, "value"))} ? ${thenExpr} : ${elseExpr});
9187
+ `;
9188
+ } else if (this.is(body, "block") && body.length > 1) {
9189
+ for (let s of stmts)
9177
9190
  code += this.indent() + this.generate(s, "statement") + `;
9178
9191
  `;
9179
9192
  } else {
@@ -9988,8 +10001,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
9988
10001
  return new CodeGenerator({}).getComponentRuntime();
9989
10002
  }
9990
10003
  // src/browser.js
9991
- var VERSION = "3.13.125";
9992
- var BUILD_DATE = "2026-03-19@00:54:22GMT";
10004
+ var VERSION = "3.13.126";
10005
+ var BUILD_DATE = "2026-03-21@06:00:44GMT";
9993
10006
  if (typeof globalThis !== "undefined") {
9994
10007
  if (!globalThis.__rip)
9995
10008
  new Function(getReactiveRuntime())();