@christianirack/brainllm-runtime 0.10.4 → 0.10.6
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/brain-router.js +12 -8
- package/package.json +1 -1
package/brain-router.js
CHANGED
|
@@ -320,21 +320,25 @@ export function router(o = {}) {
|
|
|
320
320
|
const shown = u => load(u).then(ok => ok && landed(u)) // the browser restores scroll; focus is ours (it would reset to body)
|
|
321
321
|
if (!gs.length) return e.intercept({ focusReset: 'manual', handler: () => shown(to) })
|
|
322
322
|
let g
|
|
323
|
-
|
|
323
|
+
const opts = {
|
|
324
324
|
focusReset: 'manual',
|
|
325
|
-
// Chrome 141+: decided before the URL commits (cancel = the address bar never changes; native redirect).
|
|
326
|
-
async precommitHandler(c) {
|
|
327
|
-
g = await check(to)
|
|
328
|
-
if (typeof g === 'string' && c.redirect) c.redirect(new URL(app(g), location.href).href), (g = true)
|
|
329
|
-
else if (g === false) throw new DOMException('guard', 'AbortError')
|
|
330
|
-
},
|
|
331
325
|
async handler() {
|
|
332
326
|
if (g === undefined) g = await check(to) // no precommit support: the URL already committed
|
|
333
327
|
if (g === true) return shown(nav.currentEntry ? nav.currentEntry.url : to)
|
|
334
328
|
if (g === null) return hard(to)
|
|
335
329
|
nav.navigate(g === false ? from : new URL(app(g), location.href).href, { history: 'replace' })
|
|
336
330
|
},
|
|
337
|
-
}
|
|
331
|
+
}
|
|
332
|
+
// Chrome 141+: decided before the URL commits (cancel = the address bar never changes; native redirect).
|
|
333
|
+
// Only on cancelable events: a back/forward traverse is not cancelable and intercept() throws with a
|
|
334
|
+
// precommitHandler there, leaving the old view on screen; the handler then decides after the commit.
|
|
335
|
+
if (e.cancelable)
|
|
336
|
+
opts.precommitHandler = async c => {
|
|
337
|
+
g = await check(to)
|
|
338
|
+
if (typeof g === 'string' && c.redirect) c.redirect(new URL(app(g), location.href).href), (g = true)
|
|
339
|
+
else if (g === false) throw new DOMException('guard', 'AbortError')
|
|
340
|
+
}
|
|
341
|
+
e.intercept(opts)
|
|
338
342
|
}
|
|
339
343
|
nav.addEventListener('navigate', h)
|
|
340
344
|
ahead.scan()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christianirack/brainllm-runtime",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "The BRAINLLM runtime for the Rust-built web compiler for LLMs: dependency-free ES modules (signals, DOM, router, data, forms, channels). The brain binary embeds this same version.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|