rip-lang 3.13.64 → 3.13.65
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 +1 -1
- package/package.json +1 -1
- package/src/compiler.js +1 -1
- package/src/components.js +27 -2
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.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.65-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/package.json
CHANGED
package/src/compiler.js
CHANGED
|
@@ -1072,7 +1072,7 @@ export class CodeGenerator {
|
|
|
1072
1072
|
generateReturn(head, rest, context, sexpr) {
|
|
1073
1073
|
if (rest.length === 0) return 'return';
|
|
1074
1074
|
let [expr] = rest;
|
|
1075
|
-
if (this.sideEffectOnly) return 'return';
|
|
1075
|
+
if (this.sideEffectOnly && !(this.is(expr, '->') || this.is(expr, '=>'))) return 'return';
|
|
1076
1076
|
|
|
1077
1077
|
if (this.is(expr, 'if')) {
|
|
1078
1078
|
let [, condition, body, ...elseParts] = expr;
|
package/src/components.js
CHANGED
|
@@ -489,7 +489,19 @@ export function installComponentSupport(CodeGenerator, Lexer) {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
if (isTemplateElement) {
|
|
492
|
-
let isClassOrIdTail =
|
|
492
|
+
let isClassOrIdTail = false;
|
|
493
|
+
if (tag === 'PROPERTY' && i > 0 && tokens[i - 1][0] === '.') {
|
|
494
|
+
// Trace backward through the .PROPERTY chain to find its root —
|
|
495
|
+
// only a CSS class tail if the chain starts from a line-starting template tag
|
|
496
|
+
let j = i;
|
|
497
|
+
while (j >= 2 && tokens[j - 1][0] === '.' && tokens[j - 2][0] === 'PROPERTY') j -= 2;
|
|
498
|
+
if (j >= 2 && tokens[j - 1][0] === '.' && tokens[j - 2][0] === 'IDENTIFIER' && isTemplateTag(tokens[j - 2][1])) {
|
|
499
|
+
let before = j >= 3 ? tokens[j - 3][0] : null;
|
|
500
|
+
if (!before || before === 'INDENT' || before === 'OUTDENT' || before === 'TERMINATOR' || before === 'RENDER') {
|
|
501
|
+
isClassOrIdTail = true;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
493
505
|
let isBareTag = isClsxCallEnd || (tag === 'IDENTIFIER' && isTemplateTag(token[1])) || isClassOrIdTail;
|
|
494
506
|
|
|
495
507
|
if (isBareTag) {
|
|
@@ -1442,7 +1454,11 @@ export function installComponentSupport(CodeGenerator, Lexer) {
|
|
|
1442
1454
|
this._pushEffect(`${elVar}.setAttribute('${key}', ${valueCode});`);
|
|
1443
1455
|
}
|
|
1444
1456
|
} else {
|
|
1445
|
-
|
|
1457
|
+
if (Array.isArray(value) && value[0] === 'presence') {
|
|
1458
|
+
this._createLines.push(`{ const __v = ${valueCode}; __v == null ? void 0 : ${elVar}.setAttribute('${key}', __v); }`);
|
|
1459
|
+
} else {
|
|
1460
|
+
this._createLines.push(`${elVar}.setAttribute('${key}', ${valueCode});`);
|
|
1461
|
+
}
|
|
1446
1462
|
}
|
|
1447
1463
|
}
|
|
1448
1464
|
}
|
|
@@ -1889,6 +1905,15 @@ export function installComponentSupport(CodeGenerator, Lexer) {
|
|
|
1889
1905
|
return true;
|
|
1890
1906
|
}
|
|
1891
1907
|
|
|
1908
|
+
// Method call on component: [['.', 'this', method], ...args]
|
|
1909
|
+
// Methods may read reactive state internally — treat as reactive so the
|
|
1910
|
+
// call gets wrapped in __effect and re-runs when dependencies change.
|
|
1911
|
+
if (Array.isArray(sexpr[0]) && sexpr[0][0] === '.' && sexpr[0][1] === 'this') {
|
|
1912
|
+
const m = sexpr[0][2];
|
|
1913
|
+
const name = typeof m === 'string' ? m : m instanceof String ? m.valueOf() : null;
|
|
1914
|
+
if (name && this.componentMembers?.has(name)) return true;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1892
1917
|
for (const child of sexpr) {
|
|
1893
1918
|
if (this.hasReactiveDeps(child)) return true;
|
|
1894
1919
|
}
|