rip-lang 3.13.118 → 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 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.118-blue.svg" alt="Version"></a>
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 parts = target.split(".");
2315
+ let hasAt = target[0] === "@";
2316
+ let bare = hasAt ? target.slice(1) : target;
2317
+ let parts = bare ? bare.split(".") : [];
2316
2318
  let emitTarget = () => {
2317
- this.emit("IDENTIFIER", parts[0]);
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() {
@@ -9655,8 +9663,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
9655
9663
  return new CodeGenerator({}).getComponentRuntime();
9656
9664
  }
9657
9665
  // src/browser.js
9658
- var VERSION = "3.13.118";
9659
- var BUILD_DATE = "2026-03-14@10:30:23GMT";
9666
+ var VERSION = "3.13.119";
9667
+ var BUILD_DATE = "2026-03-14@11:16:29GMT";
9660
9668
  if (typeof globalThis !== "undefined") {
9661
9669
  if (!globalThis.__rip)
9662
9670
  new Function(getReactiveRuntime())();
@@ -11083,6 +11091,13 @@ ${indented}`);
11083
11091
  e.stopPropagation();
11084
11092
  return fn();
11085
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
+ }
11086
11101
  _ariaListNav = function(e, h) {
11087
11102
  if (e.isComposing)
11088
11103
  return;
@@ -11135,23 +11150,68 @@ ${indented}`);
11135
11150
  };
11136
11151
  };
11137
11152
  _ariaBindPopover = function(open, popover, setOpen, source = null) {
11138
- let desired, el, get, onToggle, opts, shown, src;
11153
+ let currentFocus, desired, el, get, onToggle, opts, restoreEl, restoreFocus, shown, src;
11139
11154
  get = function(x) {
11140
11155
  return typeof x === "function" ? x() : x;
11141
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
+ };
11142
11167
  el = get(popover);
11143
11168
  if (!el)
11144
11169
  return;
11145
11170
  if (!Object.hasOwn(HTMLElement.prototype, "togglePopover"))
11146
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
+ };
11147
11197
  onToggle = function(e) {
11148
- return setOpen?.(e.newState === "open");
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);
11149
11206
  };
11150
11207
  el.addEventListener("toggle", onToggle);
11151
11208
  shown = el.matches(":popover-open");
11152
11209
  desired = !!open;
11153
11210
  if (shown !== desired) {
11154
11211
  src = get(source);
11212
+ if (desired) {
11213
+ restoreEl = src || currentFocus();
11214
+ }
11155
11215
  opts = src && desired ? { force: desired, source: src } : { force: desired };
11156
11216
  try {
11157
11217
  el.togglePopover(opts);
@@ -11162,13 +11222,48 @@ ${indented}`);
11162
11222
  };
11163
11223
  };
11164
11224
  _ariaBindDialog = function(open, dialog, setOpen, dismissable = true) {
11165
- let el, get, onCancel, onClose;
11225
+ let currentFocus, el, get, onCancel, onClose, restoreEl, restoreFocus;
11166
11226
  get = function(x) {
11167
11227
  return typeof x === "function" ? x() : x;
11168
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
+ };
11169
11239
  el = get(dialog);
11170
11240
  if (!el?.showModal)
11171
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
+ };
11172
11267
  onCancel = function(e) {
11173
11268
  if (!dismissable) {
11174
11269
  e.preventDefault();
@@ -11177,11 +11272,14 @@ ${indented}`);
11177
11272
  return setOpen?.(false);
11178
11273
  };
11179
11274
  onClose = function() {
11180
- return setOpen?.(false);
11275
+ setOpen?.(false);
11276
+ return restoreFocus();
11181
11277
  };
11182
11278
  el.addEventListener("cancel", onCancel);
11183
11279
  el.addEventListener("close", onClose);
11184
11280
  if (open && !el.open) {
11281
+ if (!restoreEl)
11282
+ restoreEl = currentFocus();
11185
11283
  try {
11186
11284
  el.showModal();
11187
11285
  } catch {}