rip-lang 3.13.117 → 3.13.119
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/docs/dist/rip.js +124 -12
- package/docs/dist/rip.min.js +182 -182
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +6 -2
- package/src/lexer.js +13 -6
- package/src/ui.rip +57 -3
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.119-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
|
@@ -2309,12 +2309,20 @@
|
|
|
2309
2309
|
this.emit(",", ",");
|
|
2310
2310
|
return 2 + 1 + space.length + 1;
|
|
2311
2311
|
}
|
|
2312
|
-
let m = /^((?:(?!\s)[$\w\x7f-\uffff])+(?:\.[a-zA-Z_$][\w]*)*)(\s*)=(?!=)/.exec(rest);
|
|
2312
|
+
let m = /^(@?(?:(?!\s)[$\w\x7f-\uffff])+(?:\.[a-zA-Z_$][\w]*)*)(\s*)=(?!=)/.exec(rest);
|
|
2313
2313
|
if (m) {
|
|
2314
2314
|
let target = m[1], space = m[2];
|
|
2315
|
-
let
|
|
2315
|
+
let hasAt = target[0] === "@";
|
|
2316
|
+
let bare = hasAt ? target.slice(1) : target;
|
|
2317
|
+
let parts = bare ? bare.split(".") : [];
|
|
2316
2318
|
let emitTarget = () => {
|
|
2317
|
-
|
|
2319
|
+
if (hasAt) {
|
|
2320
|
+
this.emit("@", "@");
|
|
2321
|
+
if (parts.length > 0)
|
|
2322
|
+
this.emit("PROPERTY", parts[0]);
|
|
2323
|
+
} else {
|
|
2324
|
+
this.emit("IDENTIFIER", parts[0]);
|
|
2325
|
+
}
|
|
2318
2326
|
for (let i = 1;i < parts.length; i++) {
|
|
2319
2327
|
this.emit(".", ".");
|
|
2320
2328
|
this.emit("PROPERTY", parts[i]);
|
|
@@ -2409,6 +2417,7 @@
|
|
|
2409
2417
|
rewrite(tokens) {
|
|
2410
2418
|
this.tokens = tokens;
|
|
2411
2419
|
this.removeLeadingNewlines();
|
|
2420
|
+
this.closeMergeAssignments();
|
|
2412
2421
|
this.closeOpenCalls();
|
|
2413
2422
|
this.closeOpenIndexes();
|
|
2414
2423
|
this.normalizeLines();
|
|
@@ -2418,7 +2427,6 @@
|
|
|
2418
2427
|
this.rewriteTaggedTemplates();
|
|
2419
2428
|
this.addImplicitBracesAndParens();
|
|
2420
2429
|
this.addImplicitCallCommas();
|
|
2421
|
-
this.closeMergeAssignments();
|
|
2422
2430
|
return this.tokens;
|
|
2423
2431
|
}
|
|
2424
2432
|
removeLeadingNewlines() {
|
|
@@ -6158,6 +6166,21 @@ if (typeof globalThis !== 'undefined') {
|
|
|
6158
6166
|
"optindex",
|
|
6159
6167
|
"optcall"
|
|
6160
6168
|
]);
|
|
6169
|
+
var STMT_ONLY = new Set([
|
|
6170
|
+
"def",
|
|
6171
|
+
"class",
|
|
6172
|
+
"if",
|
|
6173
|
+
"unless",
|
|
6174
|
+
"for-in",
|
|
6175
|
+
"for-of",
|
|
6176
|
+
"for-as",
|
|
6177
|
+
"while",
|
|
6178
|
+
"until",
|
|
6179
|
+
"loop",
|
|
6180
|
+
"switch",
|
|
6181
|
+
"try",
|
|
6182
|
+
"throw"
|
|
6183
|
+
]);
|
|
6161
6184
|
function isInline(arr) {
|
|
6162
6185
|
if (!Array.isArray(arr) || arr.length === 0)
|
|
6163
6186
|
return false;
|
|
@@ -7198,12 +7221,11 @@ function _setDataSection() {
|
|
|
7198
7221
|
let paramSyntax = isSingle ? paramList : `(${paramList})`;
|
|
7199
7222
|
let isAsync = this.containsAwait(body);
|
|
7200
7223
|
let prefix = isAsync ? "async " : "";
|
|
7201
|
-
let stmtOnly = new Set(["def", "class", "if", "for-in", "for-of", "for-as", "while", "until", "loop", "switch", "try", "unless"]);
|
|
7202
7224
|
if (!sideEffectOnly) {
|
|
7203
7225
|
if (this.is(body, "block") && body.length === 2) {
|
|
7204
7226
|
let expr = body[1];
|
|
7205
7227
|
let exprHead = Array.isArray(expr) ? expr[0] : null;
|
|
7206
|
-
if (exprHead !== "return" && !
|
|
7228
|
+
if (exprHead !== "return" && !STMT_ONLY.has(exprHead)) {
|
|
7207
7229
|
let code = this.generate(expr, "value");
|
|
7208
7230
|
if (code[0] === "{")
|
|
7209
7231
|
code = `(${code})`;
|
|
@@ -9641,8 +9663,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
|
9641
9663
|
return new CodeGenerator({}).getComponentRuntime();
|
|
9642
9664
|
}
|
|
9643
9665
|
// src/browser.js
|
|
9644
|
-
var VERSION = "3.13.
|
|
9645
|
-
var BUILD_DATE = "2026-03-14@
|
|
9666
|
+
var VERSION = "3.13.119";
|
|
9667
|
+
var BUILD_DATE = "2026-03-14@11:16:29GMT";
|
|
9646
9668
|
if (typeof globalThis !== "undefined") {
|
|
9647
9669
|
if (!globalThis.__rip)
|
|
9648
9670
|
new Function(getReactiveRuntime())();
|
|
@@ -11069,6 +11091,13 @@ ${indented}`);
|
|
|
11069
11091
|
e.stopPropagation();
|
|
11070
11092
|
return fn();
|
|
11071
11093
|
};
|
|
11094
|
+
globalThis.__ariaLastFocusedEl ??= null;
|
|
11095
|
+
if (typeof document !== "undefined" && !globalThis.__ariaFocusTrackerBound) {
|
|
11096
|
+
document.addEventListener("focusin", function(e) {
|
|
11097
|
+
return globalThis.__ariaLastFocusedEl = e.target;
|
|
11098
|
+
}, true);
|
|
11099
|
+
globalThis.__ariaFocusTrackerBound = true;
|
|
11100
|
+
}
|
|
11072
11101
|
_ariaListNav = function(e, h) {
|
|
11073
11102
|
if (e.isComposing)
|
|
11074
11103
|
return;
|
|
@@ -11121,23 +11150,68 @@ ${indented}`);
|
|
|
11121
11150
|
};
|
|
11122
11151
|
};
|
|
11123
11152
|
_ariaBindPopover = function(open, popover, setOpen, source = null) {
|
|
11124
|
-
let desired, el, get, onToggle, opts, shown, src;
|
|
11153
|
+
let currentFocus, desired, el, get, onToggle, opts, restoreEl, restoreFocus, shown, src;
|
|
11125
11154
|
get = function(x) {
|
|
11126
11155
|
return typeof x === "function" ? x() : x;
|
|
11127
11156
|
};
|
|
11157
|
+
currentFocus = function() {
|
|
11158
|
+
let active, last;
|
|
11159
|
+
active = document.activeElement;
|
|
11160
|
+
if (active && active !== document.body)
|
|
11161
|
+
return active;
|
|
11162
|
+
last = globalThis.__ariaLastFocusedEl;
|
|
11163
|
+
if (last?.isConnected !== false)
|
|
11164
|
+
return last;
|
|
11165
|
+
return null;
|
|
11166
|
+
};
|
|
11128
11167
|
el = get(popover);
|
|
11129
11168
|
if (!el)
|
|
11130
11169
|
return;
|
|
11131
11170
|
if (!Object.hasOwn(HTMLElement.prototype, "togglePopover"))
|
|
11132
11171
|
return;
|
|
11172
|
+
restoreEl = null;
|
|
11173
|
+
restoreFocus = function() {
|
|
11174
|
+
let focusAttempt, target;
|
|
11175
|
+
target = restoreEl;
|
|
11176
|
+
restoreEl = null;
|
|
11177
|
+
if (!target?.focus)
|
|
11178
|
+
return;
|
|
11179
|
+
focusAttempt = function(tries = 6) {
|
|
11180
|
+
if (!(target.isConnected !== false))
|
|
11181
|
+
return;
|
|
11182
|
+
try {
|
|
11183
|
+
target.focus({ preventScroll: true });
|
|
11184
|
+
} catch {
|
|
11185
|
+
target.focus();
|
|
11186
|
+
}
|
|
11187
|
+
if (document.activeElement === target || tries <= 1)
|
|
11188
|
+
return;
|
|
11189
|
+
return setTimeout(function() {
|
|
11190
|
+
return focusAttempt(tries - 1);
|
|
11191
|
+
}, 16);
|
|
11192
|
+
};
|
|
11193
|
+
return requestAnimationFrame(function() {
|
|
11194
|
+
return focusAttempt();
|
|
11195
|
+
});
|
|
11196
|
+
};
|
|
11133
11197
|
onToggle = function(e) {
|
|
11134
|
-
|
|
11198
|
+
let isOpen;
|
|
11199
|
+
isOpen = e.newState === "open";
|
|
11200
|
+
if (isOpen) {
|
|
11201
|
+
restoreEl = get(source) || currentFocus();
|
|
11202
|
+
} else {
|
|
11203
|
+
restoreFocus();
|
|
11204
|
+
}
|
|
11205
|
+
return setOpen?.(isOpen);
|
|
11135
11206
|
};
|
|
11136
11207
|
el.addEventListener("toggle", onToggle);
|
|
11137
11208
|
shown = el.matches(":popover-open");
|
|
11138
11209
|
desired = !!open;
|
|
11139
11210
|
if (shown !== desired) {
|
|
11140
11211
|
src = get(source);
|
|
11212
|
+
if (desired) {
|
|
11213
|
+
restoreEl = src || currentFocus();
|
|
11214
|
+
}
|
|
11141
11215
|
opts = src && desired ? { force: desired, source: src } : { force: desired };
|
|
11142
11216
|
try {
|
|
11143
11217
|
el.togglePopover(opts);
|
|
@@ -11148,13 +11222,48 @@ ${indented}`);
|
|
|
11148
11222
|
};
|
|
11149
11223
|
};
|
|
11150
11224
|
_ariaBindDialog = function(open, dialog, setOpen, dismissable = true) {
|
|
11151
|
-
let el, get, onCancel, onClose;
|
|
11225
|
+
let currentFocus, el, get, onCancel, onClose, restoreEl, restoreFocus;
|
|
11152
11226
|
get = function(x) {
|
|
11153
11227
|
return typeof x === "function" ? x() : x;
|
|
11154
11228
|
};
|
|
11229
|
+
currentFocus = function() {
|
|
11230
|
+
let active, last;
|
|
11231
|
+
active = document.activeElement;
|
|
11232
|
+
if (active && active !== document.body)
|
|
11233
|
+
return active;
|
|
11234
|
+
last = globalThis.__ariaLastFocusedEl;
|
|
11235
|
+
if (last?.isConnected !== false)
|
|
11236
|
+
return last;
|
|
11237
|
+
return null;
|
|
11238
|
+
};
|
|
11155
11239
|
el = get(dialog);
|
|
11156
11240
|
if (!el?.showModal)
|
|
11157
11241
|
return;
|
|
11242
|
+
restoreEl = null;
|
|
11243
|
+
restoreFocus = function() {
|
|
11244
|
+
let focusAttempt, target;
|
|
11245
|
+
target = restoreEl;
|
|
11246
|
+
restoreEl = null;
|
|
11247
|
+
if (!target?.focus)
|
|
11248
|
+
return;
|
|
11249
|
+
focusAttempt = function(tries = 6) {
|
|
11250
|
+
if (!(target.isConnected !== false))
|
|
11251
|
+
return;
|
|
11252
|
+
try {
|
|
11253
|
+
target.focus({ preventScroll: true });
|
|
11254
|
+
} catch {
|
|
11255
|
+
target.focus();
|
|
11256
|
+
}
|
|
11257
|
+
if (document.activeElement === target || tries <= 1)
|
|
11258
|
+
return;
|
|
11259
|
+
return setTimeout(function() {
|
|
11260
|
+
return focusAttempt(tries - 1);
|
|
11261
|
+
}, 16);
|
|
11262
|
+
};
|
|
11263
|
+
return requestAnimationFrame(function() {
|
|
11264
|
+
return focusAttempt();
|
|
11265
|
+
});
|
|
11266
|
+
};
|
|
11158
11267
|
onCancel = function(e) {
|
|
11159
11268
|
if (!dismissable) {
|
|
11160
11269
|
e.preventDefault();
|
|
@@ -11163,11 +11272,14 @@ ${indented}`);
|
|
|
11163
11272
|
return setOpen?.(false);
|
|
11164
11273
|
};
|
|
11165
11274
|
onClose = function() {
|
|
11166
|
-
|
|
11275
|
+
setOpen?.(false);
|
|
11276
|
+
return restoreFocus();
|
|
11167
11277
|
};
|
|
11168
11278
|
el.addEventListener("cancel", onCancel);
|
|
11169
11279
|
el.addEventListener("close", onClose);
|
|
11170
11280
|
if (open && !el.open) {
|
|
11281
|
+
if (!restoreEl)
|
|
11282
|
+
restoreEl = currentFocus();
|
|
11171
11283
|
try {
|
|
11172
11284
|
el.showModal();
|
|
11173
11285
|
} catch {}
|