brumate 0.5.2 → 0.6.0
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/dist/{boot-Difa0qdg.d.ts → boot-CMvhoWRu.d.ts} +2 -2
- package/dist/cli.js +2 -2
- package/dist/{client-DvsU9qxG.d.ts → client-C4kNKGwH.d.ts} +18 -5
- package/dist/{client-De-7aGlO.js → client-eVI8Wc95.js} +171 -29
- package/dist/client-eVI8Wc95.js.map +1 -0
- package/dist/{defer-DlFYiAuK.js → defer-pKO0S6UT.js} +2 -2
- package/dist/{defer-DlFYiAuK.js.map → defer-pKO0S6UT.js.map} +1 -1
- package/dist/{devtools-Di_dI9tS.js → devtools-DqqqdI4b.js} +4 -4
- package/dist/{devtools-Di_dI9tS.js.map → devtools-DqqqdI4b.js.map} +1 -1
- package/dist/{devtools-panel-BvIKX1LY.js → devtools-panel--GYjFZ35.js} +2 -2
- package/dist/{devtools-panel-BvIKX1LY.js.map → devtools-panel--GYjFZ35.js.map} +1 -1
- package/dist/{features-D5kLyihb.js → features-CbgII-o7.js} +4 -2
- package/dist/features-CbgII-o7.js.map +1 -0
- package/dist/{files-s4wmjcZV.js → files-CR-V05xd.js} +2 -2
- package/dist/{files-s4wmjcZV.js.map → files-CR-V05xd.js.map} +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BLPt-dZZ.js → inspect-ddfGeww0.js} +236 -57
- package/dist/inspect-ddfGeww0.js.map +1 -0
- package/dist/{loader-krRrJuIv.js → loader-CQkAXO0g.js} +11 -3
- package/dist/loader-CQkAXO0g.js.map +1 -0
- package/dist/routes-D21FQyGF.js +51 -0
- package/dist/routes-D21FQyGF.js.map +1 -0
- package/dist/{rpc-BYYAj1vV.js → rpc-BgYnfg_a.js} +3 -3
- package/dist/{rpc-BYYAj1vV.js.map → rpc-BgYnfg_a.js.map} +1 -1
- package/dist/runtime/bundles.d.ts +1 -1
- package/dist/runtime/client.d.ts +2 -2
- package/dist/runtime/client.js +3 -3
- package/dist/runtime/devtools.d.ts +1 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/routes.js +1 -51
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/server.js +3 -3
- package/dist/runtime/signals.d.ts +2 -140
- package/dist/runtime/signals.js +4 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +24 -4
- package/dist/runtime/testing.js +66 -2
- package/dist/runtime/testing.js.map +1 -1
- package/dist/{produce-Cq6KKi7b.js → search-params-CM1RWR2P.js} +25 -3
- package/dist/search-params-CM1RWR2P.js.map +1 -0
- package/dist/{server-Doy5HR7r.js → server-BcT9icQ4.js} +107 -40
- package/dist/server-BcT9icQ4.js.map +1 -0
- package/dist/{server-CAwIqrXl.d.ts → server-dP_ucRiJ.d.ts} +42 -3
- package/dist/signals-BwD4u22K.d.ts +165 -0
- package/dist/{static-loader-9Nc1GvF0.d.ts → static-loader-CGthkX0s.d.ts} +2 -2
- package/dist/{static-loader-DoHWsf9t.js → static-loader-DCxASuzA.js} +3 -3
- package/dist/{static-loader-DoHWsf9t.js.map → static-loader-DCxASuzA.js.map} +1 -1
- package/dist/{stream-BdhzvPQO.js → stream-DRjx0keF.js} +2 -2
- package/dist/{stream-BdhzvPQO.js.map → stream-DRjx0keF.js.map} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +17 -12
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +231 -35
- package/package.json +6 -1
- package/skills/brumate/references/errors.md +32 -12
- package/skills/brumate/references/signals.md +27 -25
- package/skills/brumate/references/syntax.md +1 -1
- package/dist/client-De-7aGlO.js.map +0 -1
- package/dist/features-D5kLyihb.js.map +0 -1
- package/dist/inspect-BLPt-dZZ.js.map +0 -1
- package/dist/loader-krRrJuIv.js.map +0 -1
- package/dist/produce-Cq6KKi7b.js.map +0 -1
- package/dist/runtime/routes.js.map +0 -1
- package/dist/server-Doy5HR7r.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as SerialEntry } from "./values-B8C7CLvG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Wt as ClientModule } from "./client-C4kNKGwH.js";
|
|
3
3
|
//#region src/runtime/boot.d.ts
|
|
4
4
|
interface LoaderOptions {
|
|
5
5
|
/**
|
|
@@ -51,4 +51,4 @@ interface NavigateOptions {
|
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
export { NavigateOptions as n, LoaderOptions as t };
|
|
54
|
-
//# sourceMappingURL=boot-
|
|
54
|
+
//# sourceMappingURL=boot-CMvhoWRu.d.ts.map
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as getLocation, H as findError, j as analyzeProjectProps, o as CompileError, r as inspect, s as compile, w as resolveFromDisk, z as BrumateError } from "./inspect-
|
|
3
|
-
import { h as findPackages, o as findPackageServerFile, s as findServerImport, t as collectSources, v as resolveComponentPackage } from "./files-
|
|
2
|
+
import { B as getLocation, H as findError, j as analyzeProjectProps, o as CompileError, r as inspect, s as compile, w as resolveFromDisk, z as BrumateError } from "./inspect-ddfGeww0.js";
|
|
3
|
+
import { h as findPackages, o as findPackageServerFile, s as findServerImport, t as collectSources, v as resolveComponentPackage } from "./files-CR-V05xd.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { cp } from "node:fs/promises";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as Context } from "./context-btHuB01Z.js";
|
|
2
2
|
import { a as PageState, c as ScopeId, n as ElementReference, p as Raw, t as Binding } from "./shared-CzbnWkVA.js";
|
|
3
3
|
import { r as SerialEntry } from "./values-B8C7CLvG.js";
|
|
4
|
+
import { k as SearchParamOptions } from "./signals-BwD4u22K.js";
|
|
4
5
|
//#region src/runtime/navigate.d.ts
|
|
5
6
|
/** What the devtools learn of a navigation. See `DevtoolsHooks.navigated`. */
|
|
6
7
|
interface NavigationReport {
|
|
@@ -606,12 +607,14 @@ interface Template {
|
|
|
606
607
|
count: number;
|
|
607
608
|
/** `svg` or `math`, for markup whose elements are of SVG or MathML, which parses inside one. */
|
|
608
609
|
foreign?: string;
|
|
610
|
+
/** Its clones hold markers or `<template>` elements, which their insert indexes and starts. */
|
|
611
|
+
m?: 1;
|
|
609
612
|
t?: HTMLTemplateElement;
|
|
610
613
|
/** The moves that reach the marked nodes of a clone. See `encodeWalk`. */
|
|
611
614
|
walk?: number[];
|
|
612
615
|
}
|
|
613
616
|
/** A template of the markup of a render, which `clone` parses once. */
|
|
614
|
-
declare function template(html: string, count: number, foreign?: string): Template;
|
|
617
|
+
declare function template(html: string, count: number, foreign?: string, indexed?: 1): Template;
|
|
615
618
|
/**
|
|
616
619
|
* A node of a clone: an element, the comment of an insert, or the fragment. The type lets the
|
|
617
620
|
* render pass each to the write that takes it.
|
|
@@ -670,6 +673,15 @@ declare function setOn(element: Element, on: string[], own: string): void;
|
|
|
670
673
|
/** Writes the content of an element of cloned markup, as `insert` writes it in HTML. */
|
|
671
674
|
declare function setContent(element: Element, value: unknown, at?: ScopeId | Scope): void;
|
|
672
675
|
//#endregion
|
|
676
|
+
//#region src/runtime/client/search.d.ts
|
|
677
|
+
/** `$searchParam` in the browser: the parameter of the URL of the page. */
|
|
678
|
+
declare function searchParam(name: string, options?: SearchParamOptions<unknown>): unknown;
|
|
679
|
+
/**
|
|
680
|
+
* The effect of `$searchParam`: it writes the URL when the signal changes, and follows the
|
|
681
|
+
* history while the scope lives.
|
|
682
|
+
*/
|
|
683
|
+
declare function paramEffect(scope: Scope, slot: number, name: string, options?: SearchParamOptions<unknown>): () => () => void;
|
|
684
|
+
//#endregion
|
|
673
685
|
//#region src/runtime/client/titles.d.ts
|
|
674
686
|
/** Sets the title of the page. */
|
|
675
687
|
declare function title(value: unknown): void;
|
|
@@ -705,8 +717,9 @@ declare function cells(scope: Scope, links: unknown[], names: string[]): Record<
|
|
|
705
717
|
*/
|
|
706
718
|
declare function timed(scope: Scope, slot: number, ms: number, throttle: boolean, compute: () => unknown): void;
|
|
707
719
|
/**
|
|
708
|
-
* Reports the rejection of a memo that the browser renders and
|
|
709
|
-
* The error reaches the nearest `#try` around
|
|
720
|
+
* Reports the rejection of a memo that the browser renders and that only an `await` reads, so it
|
|
721
|
+
* has no slot. The server throws the error at the `await`. It reaches the nearest `#try` around
|
|
722
|
+
* the scope, or `onError`. A memo that nothing reads is not declared at all.
|
|
710
723
|
*/
|
|
711
724
|
declare function unreadMemo(scope: Scope | ScopeId, value: unknown): void;
|
|
712
725
|
/**
|
|
@@ -762,5 +775,5 @@ declare const loader: {
|
|
|
762
775
|
updateRoute: typeof updateRoute;
|
|
763
776
|
};
|
|
764
777
|
//#endregion
|
|
765
|
-
export {
|
|
766
|
-
//# sourceMappingURL=client-
|
|
778
|
+
export { toList as $, skew as $t, putText as A, leaveRoutes as At, getScope as B, provideValue as Bt, fillBranch as C, fail as Ct, listNodes as D, forget as Dt, keepText as E, dispose as Et, setSpread as F, handlerProp as Ft, prop as G, CoreOptions as Gt, removeScope as H, updateContext as Ht, template as I, rpc as It, addPortal as J, Scope as Jt, spreadProps as K, DEVTOOLS as Kt, afterInsert as L, spread as Lt, setAttrText as M, removeRoot as Mt, setContent as N, action as Nt, markBlock as O, init as Ot, setOn as P, handle as Pt, list as Q, scopes as Qt, createScope as R, submitAction as Rt, clone as S, wait as St, keep as T, nameComment as Tt, setOwner as U, updateRoute as Ut, makeId as V, setGlobal as Vt, sink as W, ClientModule as Wt, deferInBrowser as X, hooks as Xt, addStyle as Y, build as Yt, setVar as Z, rpcPrefix as Zt, title as _, rekey as _n, fillValue as _t, cells as a, elementAt as an, portalTo as at, appendText as b, NavigationReport as bn, reveal as bt, isBound as c, setItem as cn, writeText as ct, resolve as d, insert as dn, after as dt, Component as en, windowList as et, set as f, HiddenBody as fn, attempt as ft, updated as g, offscreen as gn, fillSpread as gt, update as h, held as hn, fillSettled as ht, bindings as i, dynamicNodes as in, content as it, setAttr as j, remount as jt, nodes as k, leavePage as kt, memo as l, setSlots as ln, guess as lt, unreadMemo as m, fill as mn, fillAttrs as mt, asyncMemo as n, componentNodes as nn, attr as nt, effect as o, foreignNodes as on, restRef as ot, timed as p, branch as pn, countLoads as pt, addHead as q, DevtoolsHooks as qt, binding as r, dynamic as rn, attrs as rt, get as s, place as sn, text as st, loader as t, component as tn, windowStart as tt, pending as u, children as un, track as ut, paramEffect as v, reset as vn, keepValue as vt, fillList as w, loadModule as wt, branchNodes as x, started as xt, searchParam as y, retag as yn, loading as yt, descendants as z, consumeContext as zt };
|
|
779
|
+
//# sourceMappingURL=client-C4kNKGwH.d.ts.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { C as spread$1, T as textValue, b as ownValue, f as handlerEntry, g as isRaw, n as VOID_ELEMENTS, o as attributeText, p as insertValue, r as actionAttributes, s as bindEntry, v as onAttribute, y as onValue } from "./html-t1JpkODI.js";
|
|
2
|
-
import { a as HAS_CLIENT_HTML, c as HAS_LATE_MARKUP, d as HAS_ROOT_WAIT, f as HAS_ROUTES, g as
|
|
3
|
-
import { C as useSerialEntry, _ as
|
|
2
|
+
import { _ as HAS_WINDOWS, a as HAS_CLIENT_HTML, c as HAS_LATE_MARKUP, d as HAS_ROOT_WAIT, f as HAS_ROUTES, g as HAS_TRIES, h as HAS_TITLES, i as HAS_CHILDREN, m as HAS_TEMPLATES, n as HAS_BINDINGS, o as HAS_DYNAMIC, s as HAS_FIELDS, u as HAS_LOADING } from "./features-CbgII-o7.js";
|
|
3
|
+
import { C as parseId, E as useSerialEntry, _ as isBinding, a as Binding, b as mergeHandlers, c as ElementReference, d as PARTS, g as isAsyncIterable, h as addEntryHandlers, l as FunctionReference, m as SlotReference, r as writeParam, s as ChildrenReference, t as readParam, u as MemoError, v as isPropWrapper, w as stateValues, y as isSlotReference } from "./search-params-CM1RWR2P.js";
|
|
4
4
|
import { n as ROUTE_KEY } from "./context-CTiSzQRc.js";
|
|
5
5
|
import { n as trustedHTML, t as loadOnce } from "./skew-FRmAy9iy.js";
|
|
6
|
+
import { n as navigate } from "./routes-D21FQyGF.js";
|
|
6
7
|
//#region src/runtime/client/state.ts
|
|
7
8
|
let options;
|
|
8
9
|
/** The URL prefix of server function calls, from the options. */
|
|
@@ -674,7 +675,13 @@ function insertHTML(before, html) {
|
|
|
674
675
|
for (const scope of client) if (scopes.has(scope.id)) live.push(scope);
|
|
675
676
|
if (live.length > 0) refresh(live, true);
|
|
676
677
|
}
|
|
677
|
-
/**
|
|
678
|
+
/**
|
|
679
|
+
* True when a clone holds markup that it rendered as HTML, or markers and `<template>` elements
|
|
680
|
+
* of its own (`clone` of an indexed template), whose markers its insert indexes. The flag is
|
|
681
|
+
* global and the next insert takes it, so an insert that runs between such a clone and its own
|
|
682
|
+
* insert would take it instead and the clone would not be indexed. No render does that today:
|
|
683
|
+
* a render makes its clones and returns them, and the insert comes after all of them.
|
|
684
|
+
*/
|
|
678
685
|
let clonedMarkup = false;
|
|
679
686
|
/** Notes that a clone holds markup that it rendered as HTML. */
|
|
680
687
|
function markCloned() {
|
|
@@ -768,14 +775,14 @@ let inPass = (run) => run();
|
|
|
768
775
|
function setPass(pass) {
|
|
769
776
|
inPass = pass;
|
|
770
777
|
}
|
|
771
|
-
let waiting$
|
|
778
|
+
let waiting$2 = 0;
|
|
772
779
|
/**
|
|
773
780
|
* Calls a function of another component at once, as a pass, when its code has loaded and no call
|
|
774
781
|
* waits before it, so the caller reads what the function wrote. Returns false when it did not
|
|
775
782
|
* call, and `call` is the way then.
|
|
776
783
|
*/
|
|
777
784
|
function callNow(ref, scope, args) {
|
|
778
|
-
const fn = waiting$
|
|
785
|
+
const fn = waiting$2 === 0 && !codeReady() ? loadedFunction(ref) : void 0;
|
|
779
786
|
if (!fn) return false;
|
|
780
787
|
inPass(() => fn(scope, ...args));
|
|
781
788
|
return true;
|
|
@@ -790,9 +797,9 @@ let lastCall = Promise.resolve();
|
|
|
790
797
|
function call(ref, scope, args) {
|
|
791
798
|
const code = codeReady();
|
|
792
799
|
const loaded = code ? Promise.all([resolve$1(ref), code]).then(([fn]) => fn) : resolve$1(ref);
|
|
793
|
-
waiting$
|
|
800
|
+
waiting$2++;
|
|
794
801
|
const started = lastCall.then(() => loaded).finally(() => {
|
|
795
|
-
waiting$
|
|
802
|
+
waiting$2--;
|
|
796
803
|
}).then((fn) => ({ value: inPass(() => fn(scope, ...args)) }));
|
|
797
804
|
lastCall = started.catch(() => {});
|
|
798
805
|
return started.then((result) => result.value);
|
|
@@ -1224,8 +1231,9 @@ function isThenable(value) {
|
|
|
1224
1231
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
1225
1232
|
}
|
|
1226
1233
|
/**
|
|
1227
|
-
* Reports the rejection of a memo that the browser renders and
|
|
1228
|
-
* The error reaches the nearest `#try` around
|
|
1234
|
+
* Reports the rejection of a memo that the browser renders and that only an `await` reads, so it
|
|
1235
|
+
* has no slot. The server throws the error at the `await`. It reaches the nearest `#try` around
|
|
1236
|
+
* the scope, or `onError`. A memo that nothing reads is not declared at all.
|
|
1229
1237
|
*/
|
|
1230
1238
|
function unreadMemo(scope, value) {
|
|
1231
1239
|
if (isThenable(value)) {
|
|
@@ -1420,8 +1428,8 @@ function trigger(scope, slot) {
|
|
|
1420
1428
|
pass(() => queueWrite(scope, slot));
|
|
1421
1429
|
return;
|
|
1422
1430
|
}
|
|
1423
|
-
if (waiting) {
|
|
1424
|
-
waiting.push([
|
|
1431
|
+
if (waiting$1) {
|
|
1432
|
+
waiting$1.push([
|
|
1425
1433
|
scope,
|
|
1426
1434
|
slot,
|
|
1427
1435
|
loadModule(id).then(() => childrenReady(scope)).catch((error) => fail(scope, error))
|
|
@@ -1431,7 +1439,7 @@ function trigger(scope, slot) {
|
|
|
1431
1439
|
const from = origin;
|
|
1432
1440
|
const via = viaContext;
|
|
1433
1441
|
const list = [[scope, slot]];
|
|
1434
|
-
if (running > 0) waiting = list;
|
|
1442
|
+
if (running > 0) waiting$1 = list;
|
|
1435
1443
|
const loading = loadModule(id).then(async () => {
|
|
1436
1444
|
const waits = [children];
|
|
1437
1445
|
for (const [target, , load] of list) waits.push(...codeAbove(target), load);
|
|
@@ -1459,7 +1467,7 @@ function trigger(scope, slot) {
|
|
|
1459
1467
|
});
|
|
1460
1468
|
}
|
|
1461
1469
|
/** The writes of the pass that runs that wait for code, to run as one pass of their own. */
|
|
1462
|
-
let waiting;
|
|
1470
|
+
let waiting$1;
|
|
1463
1471
|
/** The updates that wait for their code. */
|
|
1464
1472
|
const loadingUpdates = /* @__PURE__ */ new Set();
|
|
1465
1473
|
/**
|
|
@@ -1500,8 +1508,8 @@ function pass(write) {
|
|
|
1500
1508
|
if (--running === 0) {
|
|
1501
1509
|
for (const level of levels.reverse()) for (const [key, runEffect] of level?.e ?? []) pendingEffects.set(key, runEffect);
|
|
1502
1510
|
levels = [];
|
|
1503
|
-
held = waiting !== void 0;
|
|
1504
|
-
waiting = void 0;
|
|
1511
|
+
held = waiting$1 !== void 0;
|
|
1512
|
+
waiting$1 = void 0;
|
|
1505
1513
|
depths.clear();
|
|
1506
1514
|
failed = false;
|
|
1507
1515
|
stuck = false;
|
|
@@ -1990,12 +1998,12 @@ function action(name, id, method, result) {
|
|
|
1990
1998
|
* call loads, so the core holds only this.
|
|
1991
1999
|
*/
|
|
1992
2000
|
function submitAction(form, submitter) {
|
|
1993
|
-
import("./rpc-
|
|
2001
|
+
import("./rpc-BgYnfg_a.js").then((module) => module.sendAction(form, submitter));
|
|
1994
2002
|
}
|
|
1995
2003
|
/** Calls a server function. */
|
|
1996
2004
|
async function rpc(id, args) {
|
|
1997
2005
|
const signal = memoSignal();
|
|
1998
|
-
return track(import("./rpc-
|
|
2006
|
+
return track(import("./rpc-BgYnfg_a.js").then((module) => module.call(rpcPrefix, id, args, signal)));
|
|
1999
2007
|
}
|
|
2000
2008
|
/** A function prop rendered on the client calls the parent's exported handler. */
|
|
2001
2009
|
function handlerProp(value, ref, scope, bound = [], modifiers) {
|
|
@@ -2336,11 +2344,12 @@ function init(value) {
|
|
|
2336
2344
|
//#endregion
|
|
2337
2345
|
//#region src/runtime/client/templates.ts
|
|
2338
2346
|
/** A template of the markup of a render, which `clone` parses once. */
|
|
2339
|
-
function template(html, count, foreign) {
|
|
2347
|
+
function template(html, count, foreign, indexed) {
|
|
2340
2348
|
return {
|
|
2341
2349
|
html,
|
|
2342
2350
|
count,
|
|
2343
|
-
foreign
|
|
2351
|
+
foreign,
|
|
2352
|
+
m: indexed
|
|
2344
2353
|
};
|
|
2345
2354
|
}
|
|
2346
2355
|
/**
|
|
@@ -2371,7 +2380,7 @@ function parseTemplate(source) {
|
|
|
2371
2380
|
const mark = /^x(\d+)$/.exec(node.data);
|
|
2372
2381
|
if (mark) paths[Number(mark[1])] = findPath(node);
|
|
2373
2382
|
}
|
|
2374
|
-
options?.listen(root);
|
|
2383
|
+
if (!source.m) options?.listen(root);
|
|
2375
2384
|
source.t = element;
|
|
2376
2385
|
return paths;
|
|
2377
2386
|
}
|
|
@@ -2423,6 +2432,7 @@ function encodeWalk(paths) {
|
|
|
2423
2432
|
*/
|
|
2424
2433
|
function clone(source) {
|
|
2425
2434
|
const walk = source.walk ??= encodeWalk(parseTemplate(source));
|
|
2435
|
+
if (source.m) markCloned();
|
|
2426
2436
|
const fragment = source.t.content.cloneNode(true);
|
|
2427
2437
|
const cloned = new Array(source.count + 1);
|
|
2428
2438
|
cloned[source.count] = fragment;
|
|
@@ -2772,8 +2782,16 @@ function portalTo(scope, target, render, kinds = [], holderKind, holderAnchor) {
|
|
|
2772
2782
|
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
2773
2783
|
if (!(element instanceof Element)) return;
|
|
2774
2784
|
const id = nextId;
|
|
2775
|
-
const
|
|
2776
|
-
|
|
2785
|
+
const out = inPlace(scope, render, holderKind, holderAnchor)(scope);
|
|
2786
|
+
if (typeof out === "string") {
|
|
2787
|
+
insertHTML({ parent: element }, `<!--P${id}-->${out}<!--/P-->`);
|
|
2788
|
+
return;
|
|
2789
|
+
}
|
|
2790
|
+
const start = document.createComment("");
|
|
2791
|
+
nameComment(start, `P${id}`);
|
|
2792
|
+
out.prepend(start);
|
|
2793
|
+
out.append(document.createComment("/P"));
|
|
2794
|
+
insertHTML({ parent: element }, out);
|
|
2777
2795
|
}
|
|
2778
2796
|
/** Writes an inserted value between `<!--t…-->` and `<!--/t-->`. */
|
|
2779
2797
|
function text(scope, anchor, value) {
|
|
@@ -2995,7 +3013,7 @@ function within$1(own, render) {
|
|
|
2995
3013
|
* so the insert of anything else does not take them. `give` puts them back before the body goes
|
|
2996
3014
|
* in, and the caller sets `done`, and `f` if it handles failures, before any wait settles.
|
|
2997
3015
|
*/
|
|
2998
|
-
function bound(body) {
|
|
3016
|
+
function bound$1(body) {
|
|
2999
3017
|
const own = {
|
|
3000
3018
|
n: 0,
|
|
3001
3019
|
c: writes,
|
|
@@ -3034,7 +3052,7 @@ function give(own) {
|
|
|
3034
3052
|
*/
|
|
3035
3053
|
function attempt(body) {
|
|
3036
3054
|
if (!boundary) return toNodes(body());
|
|
3037
|
-
const [out, own] = bound(body);
|
|
3055
|
+
const [out, own] = bound$1(body);
|
|
3038
3056
|
if (own) {
|
|
3039
3057
|
const outer = join();
|
|
3040
3058
|
own.done = () => {
|
|
@@ -3348,7 +3366,7 @@ function hold(at, key, render, show) {
|
|
|
3348
3366
|
return;
|
|
3349
3367
|
}
|
|
3350
3368
|
drop(at);
|
|
3351
|
-
const [out, own] = bound(render);
|
|
3369
|
+
const [out, own] = bound$1(render);
|
|
3352
3370
|
if (!own) {
|
|
3353
3371
|
show(out);
|
|
3354
3372
|
return;
|
|
@@ -3395,7 +3413,7 @@ function release(at) {
|
|
|
3395
3413
|
* not render it again.
|
|
3396
3414
|
*/
|
|
3397
3415
|
function holdRow(list, render) {
|
|
3398
|
-
const [out, own] = bound(render);
|
|
3416
|
+
const [out, own] = bound$1(render);
|
|
3399
3417
|
if (!own) return out;
|
|
3400
3418
|
let row;
|
|
3401
3419
|
for (const scope of own.w[0]) if (scope.p === list) row ??= scope;
|
|
@@ -3501,7 +3519,7 @@ function renderLoading(group, body, fallback) {
|
|
|
3501
3519
|
const made = rendered.length;
|
|
3502
3520
|
const queued = afterInsert.length;
|
|
3503
3521
|
const turn = group && !(group.o === "natural" || group.o === "sequential" && group.m.length === 0);
|
|
3504
|
-
const result = bound(body);
|
|
3522
|
+
const result = bound$1(body);
|
|
3505
3523
|
const nodes = toNodes(result[0]);
|
|
3506
3524
|
let own = result[1];
|
|
3507
3525
|
if (!own) {
|
|
@@ -4195,6 +4213,130 @@ function addStyle(id, css) {
|
|
|
4195
4213
|
return "";
|
|
4196
4214
|
}
|
|
4197
4215
|
//#endregion
|
|
4216
|
+
//#region src/runtime/client/search.ts
|
|
4217
|
+
/** The signals of the page that follow a parameter, by scope and slot. */
|
|
4218
|
+
const bound = /* @__PURE__ */ new Map();
|
|
4219
|
+
/** The changes of the URL that wait for the end of the writes of one pass. */
|
|
4220
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
4221
|
+
/** `$searchParam` in the browser: the parameter of the URL of the page. */
|
|
4222
|
+
function searchParam(name, options) {
|
|
4223
|
+
return readParam(new URLSearchParams(location.search), name, options);
|
|
4224
|
+
}
|
|
4225
|
+
/**
|
|
4226
|
+
* The effect of `$searchParam`: it writes the URL when the signal changes, and follows the
|
|
4227
|
+
* history while the scope lives.
|
|
4228
|
+
*/
|
|
4229
|
+
function paramEffect(scope, slot, name, options) {
|
|
4230
|
+
return () => {
|
|
4231
|
+
const key = `${scope.id}:${slot}`;
|
|
4232
|
+
if (!options?.server) {
|
|
4233
|
+
bound.set(key, {
|
|
4234
|
+
scope,
|
|
4235
|
+
slot,
|
|
4236
|
+
name,
|
|
4237
|
+
options
|
|
4238
|
+
});
|
|
4239
|
+
globalThis[HOOK] = follow;
|
|
4240
|
+
}
|
|
4241
|
+
const text = writeParam(get(scope, slot), options);
|
|
4242
|
+
const current = readParam(new URLSearchParams(location.search), name, options);
|
|
4243
|
+
if (writeParam(current, options) !== text) {
|
|
4244
|
+
if (waiting.size === 0) queueMicrotask(commit);
|
|
4245
|
+
waiting.set(name, {
|
|
4246
|
+
text,
|
|
4247
|
+
options
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4250
|
+
return () => void bound.delete(key);
|
|
4251
|
+
};
|
|
4252
|
+
}
|
|
4253
|
+
/** The key of the hook with which the loader asks whether a change of the URL is ours. */
|
|
4254
|
+
const HOOK = Symbol.for("brumate.search");
|
|
4255
|
+
/** Writes the changes of one pass to the URL, as one entry of the history. */
|
|
4256
|
+
function commit() {
|
|
4257
|
+
const url = new URL(location.href);
|
|
4258
|
+
let push = false;
|
|
4259
|
+
let server = false;
|
|
4260
|
+
const changes = /* @__PURE__ */ new Map();
|
|
4261
|
+
for (const [name, { text, options }] of waiting) {
|
|
4262
|
+
changes.set(name, text);
|
|
4263
|
+
push ||= options?.history === "push";
|
|
4264
|
+
server ||= options?.server === true;
|
|
4265
|
+
}
|
|
4266
|
+
const names = new Set(waiting.keys());
|
|
4267
|
+
waiting.clear();
|
|
4268
|
+
url.search = editQuery(url.search, changes);
|
|
4269
|
+
if (server) {
|
|
4270
|
+
navigate(url.href, {
|
|
4271
|
+
replace: !push,
|
|
4272
|
+
scroll: false
|
|
4273
|
+
});
|
|
4274
|
+
return;
|
|
4275
|
+
}
|
|
4276
|
+
if (push) history.pushState({}, "", url);
|
|
4277
|
+
else history.replaceState(history.state, "", url);
|
|
4278
|
+
pass(() => {
|
|
4279
|
+
for (const { scope, slot, name, options } of bound.values()) if (names.has(name)) set(scope, slot, readParam(url.searchParams, name, options));
|
|
4280
|
+
});
|
|
4281
|
+
document.dispatchEvent(new Event("brumate:search"));
|
|
4282
|
+
updateRoute();
|
|
4283
|
+
}
|
|
4284
|
+
/** The names of the parameters in a query string, as the URL reads them. */
|
|
4285
|
+
function queryName(piece) {
|
|
4286
|
+
return new URLSearchParams(piece).keys().next().value ?? "";
|
|
4287
|
+
}
|
|
4288
|
+
/**
|
|
4289
|
+
* The query string with the changes made, and every other parameter as it was written. The
|
|
4290
|
+
* first piece of a changed name takes the new text, and its other pieces go.
|
|
4291
|
+
*/
|
|
4292
|
+
function editQuery(search, changes) {
|
|
4293
|
+
const pieces = [];
|
|
4294
|
+
const done = /* @__PURE__ */ new Set();
|
|
4295
|
+
for (const piece of search.slice(1).split("&")) {
|
|
4296
|
+
const name = piece === "" ? "" : queryName(piece);
|
|
4297
|
+
if (!changes.has(name)) {
|
|
4298
|
+
if (piece !== "") pieces.push(piece);
|
|
4299
|
+
continue;
|
|
4300
|
+
}
|
|
4301
|
+
const text = changes.get(name);
|
|
4302
|
+
if (text !== null && !done.has(name)) pieces.push(new URLSearchParams({ [name]: text }).toString());
|
|
4303
|
+
done.add(name);
|
|
4304
|
+
}
|
|
4305
|
+
for (const [name, text] of changes) if (text !== null && !done.has(name)) pieces.push(new URLSearchParams({ [name]: text }).toString());
|
|
4306
|
+
return pieces.length > 0 ? `?${pieces.join("&")}` : "";
|
|
4307
|
+
}
|
|
4308
|
+
/**
|
|
4309
|
+
* Writes the signals whose parameter changed, from `from` to the URL now. False when another
|
|
4310
|
+
* parameter changed, or the path did: the page loads then.
|
|
4311
|
+
*/
|
|
4312
|
+
function follow(from) {
|
|
4313
|
+
const before = new URL(from);
|
|
4314
|
+
const now = new URL(location.href);
|
|
4315
|
+
if (before.pathname !== now.pathname) return false;
|
|
4316
|
+
const names = /* @__PURE__ */ new Set([...before.searchParams.keys(), ...now.searchParams.keys()]);
|
|
4317
|
+
const changed = [];
|
|
4318
|
+
for (const name of names) {
|
|
4319
|
+
if (same(before.searchParams.getAll(name), now.searchParams.getAll(name))) continue;
|
|
4320
|
+
let owned = false;
|
|
4321
|
+
for (const item of bound.values()) if (item.name === name) {
|
|
4322
|
+
changed.push(item);
|
|
4323
|
+
owned = true;
|
|
4324
|
+
}
|
|
4325
|
+
if (!owned) return false;
|
|
4326
|
+
}
|
|
4327
|
+
pass(() => {
|
|
4328
|
+
for (const { scope, slot, name, options } of changed) set(scope, slot, readParam(now.searchParams, name, options));
|
|
4329
|
+
});
|
|
4330
|
+
updateRoute();
|
|
4331
|
+
return true;
|
|
4332
|
+
}
|
|
4333
|
+
/** True for two lists of texts that are equal item by item. */
|
|
4334
|
+
function same(a, b) {
|
|
4335
|
+
if (a.length !== b.length) return false;
|
|
4336
|
+
for (let index = 0; index < a.length; index++) if (a[index] !== b[index]) return false;
|
|
4337
|
+
return true;
|
|
4338
|
+
}
|
|
4339
|
+
//#endregion
|
|
4198
4340
|
//#region src/runtime/client.ts
|
|
4199
4341
|
/**
|
|
4200
4342
|
* What the loader calls. It is one export, so the loader's import of the core
|
|
@@ -4210,6 +4352,6 @@ const loader = {
|
|
|
4210
4352
|
};
|
|
4211
4353
|
function noop() {}
|
|
4212
4354
|
//#endregion
|
|
4213
|
-
export {
|
|
4355
|
+
export { fillBranch as $, createScope as $t, started as A, setGlobal as At, spreadProps as B, memo as Bt, fillAttrs as C, rpc as Ct, keepValue as D, track as Dt, fillValue as E, guess as Et, portalTo as F, bindings as Ft, elementAt as G, unreadMemo as Gt, componentNodes as H, resolve as Ht, restRef as I, cells as It, setItem as J, fail as Jt, foreignNodes as K, update as Kt, text as L, effect as Lt, attr as M, updateRoute as Mt, attrs as N, asyncMemo as Nt, loading as O, consumeContext as Ot, content as P, binding as Pt, clone as Q, afterInsert as Qt, writeText as R, get as Rt, countLoads as S, handlerProp as St, fillSpread as T, submitAction as Tt, dynamic as U, set as Ut, component as V, pending as Vt, dynamicNodes as W, timed as Wt, appendText as X, insert as Xt, setSlots as Y, children as Yt, branchNodes as Z, title as Zt, rekey as _, leaveRoutes as _t, addPortal as a, sink as an, nodes as at, after as b, action as bt, setVar as c, DEVTOOLS as cn, setAttrText as ct, windowList as d, rpcPrefix as dn, setSpread as dt, descendants as en, fillList as et, windowStart as f, scopes as fn, template as ft, offscreen as g, leavePage as gt, held as h, init as ht, addHead as i, setOwner as in, markBlock as it, wait as j, updateContext as jt, reveal as k, provideValue as kt, list as l, build as ln, setContent as lt, fill as m, forget as mt, paramEffect as n, makeId as nn, keepText as nt, addStyle as o, loadModule as on, putText as ot, branch as p, skew as pn, dispose as pt, place as q, updated as qt, searchParam as r, removeScope as rn, listNodes as rt, deferInBrowser as s, nameComment as sn, setAttr as st, loader as t, getScope as tn, keep as tt, toList as u, hooks as un, setOn as ut, reset as v, remount as vt, fillSettled as w, spread as wt, attempt as x, handle as xt, retag as y, removeRoot as yt, prop as z, isBound as zt };
|
|
4214
4356
|
|
|
4215
|
-
//# sourceMappingURL=client-
|
|
4357
|
+
//# sourceMappingURL=client-eVI8Wc95.js.map
|