rip-lang 3.13.118 → 3.13.120
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 +118 -19
- package/docs/dist/rip.min.js +183 -183
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/compiler.js +7 -6
- package/src/grammar/grammar.rip +2 -2
- package/src/lexer.js +13 -6
- package/src/parser.js +2 -2
- 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.120-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() {
|
|
@@ -3412,9 +3420,9 @@
|
|
|
3412
3420
|
case 331:
|
|
3413
3421
|
return ["import", $[$0 - 4], $[$0]];
|
|
3414
3422
|
case 332:
|
|
3415
|
-
return ["import",
|
|
3423
|
+
return ["import", $[$0 - 4], $[$0 - 2], $[$0]];
|
|
3416
3424
|
case 333:
|
|
3417
|
-
return ["import",
|
|
3425
|
+
return ["import", $[$0 - 7], $[$0 - 4], $[$0]];
|
|
3418
3426
|
case 344:
|
|
3419
3427
|
return ["*", $[$0]];
|
|
3420
3428
|
case 345:
|
|
@@ -8210,6 +8218,14 @@ ${this.indent()}}`;
|
|
|
8210
8218
|
}
|
|
8211
8219
|
if (this.options.skipImports)
|
|
8212
8220
|
return "";
|
|
8221
|
+
if (rest.length === 3) {
|
|
8222
|
+
let [def, named, source2] = rest;
|
|
8223
|
+
let fixedSource2 = this.addJsExtensionAndAssertions(source2);
|
|
8224
|
+
if (named[0] === "*" && named.length === 2)
|
|
8225
|
+
return `import ${def}, * as ${named[1]} from ${fixedSource2}`;
|
|
8226
|
+
let names = named.map((i) => Array.isArray(i) && i.length === 2 ? `${i[0]} as ${i[1]}` : i).join(", ");
|
|
8227
|
+
return `import ${def}, { ${names} } from ${fixedSource2}`;
|
|
8228
|
+
}
|
|
8213
8229
|
let [specifier, source] = rest;
|
|
8214
8230
|
let fixedSource = this.addJsExtensionAndAssertions(source);
|
|
8215
8231
|
if (typeof specifier === "string")
|
|
@@ -8217,13 +8233,6 @@ ${this.indent()}}`;
|
|
|
8217
8233
|
if (Array.isArray(specifier)) {
|
|
8218
8234
|
if (specifier[0] === "*" && specifier.length === 2)
|
|
8219
8235
|
return `import * as ${specifier[1]} from ${fixedSource}`;
|
|
8220
|
-
if (typeof specifier[0] === "string" && Array.isArray(specifier[1])) {
|
|
8221
|
-
let def = specifier[0], second = specifier[1];
|
|
8222
|
-
if (second[0] === "*" && second.length === 2)
|
|
8223
|
-
return `import ${def}, * as ${second[1]} from ${fixedSource}`;
|
|
8224
|
-
let names2 = (Array.isArray(second) ? second : [second]).map((i) => Array.isArray(i) && i.length === 2 ? `${i[0]} as ${i[1]}` : i).join(", ");
|
|
8225
|
-
return `import ${def}, { ${names2} } from ${fixedSource}`;
|
|
8226
|
-
}
|
|
8227
8236
|
let names = specifier.map((i) => Array.isArray(i) && i.length === 2 ? `${i[0]} as ${i[1]}` : i).join(", ");
|
|
8228
8237
|
return `import { ${names} } from ${fixedSource}`;
|
|
8229
8238
|
}
|
|
@@ -9655,8 +9664,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
|
|
|
9655
9664
|
return new CodeGenerator({}).getComponentRuntime();
|
|
9656
9665
|
}
|
|
9657
9666
|
// src/browser.js
|
|
9658
|
-
var VERSION = "3.13.
|
|
9659
|
-
var BUILD_DATE = "2026-03-14@
|
|
9667
|
+
var VERSION = "3.13.120";
|
|
9668
|
+
var BUILD_DATE = "2026-03-14@11:34:17GMT";
|
|
9660
9669
|
if (typeof globalThis !== "undefined") {
|
|
9661
9670
|
if (!globalThis.__rip)
|
|
9662
9671
|
new Function(getReactiveRuntime())();
|
|
@@ -11083,6 +11092,13 @@ ${indented}`);
|
|
|
11083
11092
|
e.stopPropagation();
|
|
11084
11093
|
return fn();
|
|
11085
11094
|
};
|
|
11095
|
+
globalThis.__ariaLastFocusedEl ??= null;
|
|
11096
|
+
if (typeof document !== "undefined" && !globalThis.__ariaFocusTrackerBound) {
|
|
11097
|
+
document.addEventListener("focusin", function(e) {
|
|
11098
|
+
return globalThis.__ariaLastFocusedEl = e.target;
|
|
11099
|
+
}, true);
|
|
11100
|
+
globalThis.__ariaFocusTrackerBound = true;
|
|
11101
|
+
}
|
|
11086
11102
|
_ariaListNav = function(e, h) {
|
|
11087
11103
|
if (e.isComposing)
|
|
11088
11104
|
return;
|
|
@@ -11135,23 +11151,68 @@ ${indented}`);
|
|
|
11135
11151
|
};
|
|
11136
11152
|
};
|
|
11137
11153
|
_ariaBindPopover = function(open, popover, setOpen, source = null) {
|
|
11138
|
-
let desired, el, get, onToggle, opts, shown, src;
|
|
11154
|
+
let currentFocus, desired, el, get, onToggle, opts, restoreEl, restoreFocus, shown, src;
|
|
11139
11155
|
get = function(x) {
|
|
11140
11156
|
return typeof x === "function" ? x() : x;
|
|
11141
11157
|
};
|
|
11158
|
+
currentFocus = function() {
|
|
11159
|
+
let active, last;
|
|
11160
|
+
active = document.activeElement;
|
|
11161
|
+
if (active && active !== document.body)
|
|
11162
|
+
return active;
|
|
11163
|
+
last = globalThis.__ariaLastFocusedEl;
|
|
11164
|
+
if (last?.isConnected !== false)
|
|
11165
|
+
return last;
|
|
11166
|
+
return null;
|
|
11167
|
+
};
|
|
11142
11168
|
el = get(popover);
|
|
11143
11169
|
if (!el)
|
|
11144
11170
|
return;
|
|
11145
11171
|
if (!Object.hasOwn(HTMLElement.prototype, "togglePopover"))
|
|
11146
11172
|
return;
|
|
11173
|
+
restoreEl = null;
|
|
11174
|
+
restoreFocus = function() {
|
|
11175
|
+
let focusAttempt, target;
|
|
11176
|
+
target = restoreEl;
|
|
11177
|
+
restoreEl = null;
|
|
11178
|
+
if (!target?.focus)
|
|
11179
|
+
return;
|
|
11180
|
+
focusAttempt = function(tries = 6) {
|
|
11181
|
+
if (!(target.isConnected !== false))
|
|
11182
|
+
return;
|
|
11183
|
+
try {
|
|
11184
|
+
target.focus({ preventScroll: true });
|
|
11185
|
+
} catch {
|
|
11186
|
+
target.focus();
|
|
11187
|
+
}
|
|
11188
|
+
if (document.activeElement === target || tries <= 1)
|
|
11189
|
+
return;
|
|
11190
|
+
return setTimeout(function() {
|
|
11191
|
+
return focusAttempt(tries - 1);
|
|
11192
|
+
}, 16);
|
|
11193
|
+
};
|
|
11194
|
+
return requestAnimationFrame(function() {
|
|
11195
|
+
return focusAttempt();
|
|
11196
|
+
});
|
|
11197
|
+
};
|
|
11147
11198
|
onToggle = function(e) {
|
|
11148
|
-
|
|
11199
|
+
let isOpen;
|
|
11200
|
+
isOpen = e.newState === "open";
|
|
11201
|
+
if (isOpen) {
|
|
11202
|
+
restoreEl = get(source) || currentFocus();
|
|
11203
|
+
} else {
|
|
11204
|
+
restoreFocus();
|
|
11205
|
+
}
|
|
11206
|
+
return setOpen?.(isOpen);
|
|
11149
11207
|
};
|
|
11150
11208
|
el.addEventListener("toggle", onToggle);
|
|
11151
11209
|
shown = el.matches(":popover-open");
|
|
11152
11210
|
desired = !!open;
|
|
11153
11211
|
if (shown !== desired) {
|
|
11154
11212
|
src = get(source);
|
|
11213
|
+
if (desired) {
|
|
11214
|
+
restoreEl = src || currentFocus();
|
|
11215
|
+
}
|
|
11155
11216
|
opts = src && desired ? { force: desired, source: src } : { force: desired };
|
|
11156
11217
|
try {
|
|
11157
11218
|
el.togglePopover(opts);
|
|
@@ -11162,13 +11223,48 @@ ${indented}`);
|
|
|
11162
11223
|
};
|
|
11163
11224
|
};
|
|
11164
11225
|
_ariaBindDialog = function(open, dialog, setOpen, dismissable = true) {
|
|
11165
|
-
let el, get, onCancel, onClose;
|
|
11226
|
+
let currentFocus, el, get, onCancel, onClose, restoreEl, restoreFocus;
|
|
11166
11227
|
get = function(x) {
|
|
11167
11228
|
return typeof x === "function" ? x() : x;
|
|
11168
11229
|
};
|
|
11230
|
+
currentFocus = function() {
|
|
11231
|
+
let active, last;
|
|
11232
|
+
active = document.activeElement;
|
|
11233
|
+
if (active && active !== document.body)
|
|
11234
|
+
return active;
|
|
11235
|
+
last = globalThis.__ariaLastFocusedEl;
|
|
11236
|
+
if (last?.isConnected !== false)
|
|
11237
|
+
return last;
|
|
11238
|
+
return null;
|
|
11239
|
+
};
|
|
11169
11240
|
el = get(dialog);
|
|
11170
11241
|
if (!el?.showModal)
|
|
11171
11242
|
return;
|
|
11243
|
+
restoreEl = null;
|
|
11244
|
+
restoreFocus = function() {
|
|
11245
|
+
let focusAttempt, target;
|
|
11246
|
+
target = restoreEl;
|
|
11247
|
+
restoreEl = null;
|
|
11248
|
+
if (!target?.focus)
|
|
11249
|
+
return;
|
|
11250
|
+
focusAttempt = function(tries = 6) {
|
|
11251
|
+
if (!(target.isConnected !== false))
|
|
11252
|
+
return;
|
|
11253
|
+
try {
|
|
11254
|
+
target.focus({ preventScroll: true });
|
|
11255
|
+
} catch {
|
|
11256
|
+
target.focus();
|
|
11257
|
+
}
|
|
11258
|
+
if (document.activeElement === target || tries <= 1)
|
|
11259
|
+
return;
|
|
11260
|
+
return setTimeout(function() {
|
|
11261
|
+
return focusAttempt(tries - 1);
|
|
11262
|
+
}, 16);
|
|
11263
|
+
};
|
|
11264
|
+
return requestAnimationFrame(function() {
|
|
11265
|
+
return focusAttempt();
|
|
11266
|
+
});
|
|
11267
|
+
};
|
|
11172
11268
|
onCancel = function(e) {
|
|
11173
11269
|
if (!dismissable) {
|
|
11174
11270
|
e.preventDefault();
|
|
@@ -11177,11 +11273,14 @@ ${indented}`);
|
|
|
11177
11273
|
return setOpen?.(false);
|
|
11178
11274
|
};
|
|
11179
11275
|
onClose = function() {
|
|
11180
|
-
|
|
11276
|
+
setOpen?.(false);
|
|
11277
|
+
return restoreFocus();
|
|
11181
11278
|
};
|
|
11182
11279
|
el.addEventListener("cancel", onCancel);
|
|
11183
11280
|
el.addEventListener("close", onClose);
|
|
11184
11281
|
if (open && !el.open) {
|
|
11282
|
+
if (!restoreEl)
|
|
11283
|
+
restoreEl = currentFocus();
|
|
11185
11284
|
try {
|
|
11186
11285
|
el.showModal();
|
|
11187
11286
|
} catch {}
|