brumate 0.3.0 → 0.4.1

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.
Files changed (122) hide show
  1. package/README.md +2 -2
  2. package/check.d.ts +49 -0
  3. package/dist/{boot-C25Sa6vq.d.ts → boot-SCWYwuUd.d.ts} +8 -10
  4. package/dist/cli.js +275 -15
  5. package/dist/cli.js.map +1 -1
  6. package/dist/client-BBtVTOIt.js +3506 -0
  7. package/dist/client-BBtVTOIt.js.map +1 -0
  8. package/dist/{client-D0CqSxoO.d.ts → client-Cs3o4key.d.ts} +390 -181
  9. package/dist/{client-routes-JTbGtukf.js → client-routes-BtGpYCef.js} +60 -30
  10. package/dist/client-routes-BtGpYCef.js.map +1 -0
  11. package/dist/{cookies-BzllthiF.js → cookies-Cnbf4w-S.js} +14 -7
  12. package/dist/cookies-Cnbf4w-S.js.map +1 -0
  13. package/dist/{defer-BbD7JQhj.js → defer-BLJjxqVc.js} +4 -4
  14. package/dist/defer-BLJjxqVc.js.map +1 -0
  15. package/dist/{devtools-CQgD7NPB.js → devtools-DTpsVFbn.js} +56 -82
  16. package/dist/devtools-DTpsVFbn.js.map +1 -0
  17. package/dist/{devtools-panel-BVB-W5q4.js → devtools-panel-C1Dfv6nq.js} +397 -333
  18. package/dist/devtools-panel-C1Dfv6nq.js.map +1 -0
  19. package/dist/{events-CSs7OwIC.js → events-LgLdp1R7.js} +34 -5
  20. package/dist/events-LgLdp1R7.js.map +1 -0
  21. package/dist/features-CHY5Ekku.js +30 -0
  22. package/dist/features-CHY5Ekku.js.map +1 -0
  23. package/dist/files-DZIiMDnS.js +506 -0
  24. package/dist/files-DZIiMDnS.js.map +1 -0
  25. package/dist/{forms-Cl21hkHt.d.ts → forms-j1xPAR14.d.ts} +3 -3
  26. package/dist/{forms-Bg-CwGqX.js → forms-nXK7-Lv_.js} +78 -44
  27. package/dist/forms-nXK7-Lv_.js.map +1 -0
  28. package/dist/highlight.js +31 -22
  29. package/dist/highlight.js.map +1 -1
  30. package/dist/{html-mNTKzaDD.js → html-DS9B1H-M.js} +92 -22
  31. package/dist/html-DS9B1H-M.js.map +1 -0
  32. package/dist/{html-Bq1rFxX_.d.ts → html-Gggepsf-.d.ts} +22 -5
  33. package/dist/index.d.ts +98 -10
  34. package/dist/index.js +639 -104
  35. package/dist/index.js.map +1 -1
  36. package/dist/{inspect-BHpOw1LF.js → inspect-DomFHy5O.js} +3832 -695
  37. package/dist/inspect-DomFHy5O.js.map +1 -0
  38. package/dist/{loader-Dos_3NP0.js → loader-D62komKu.js} +20 -14
  39. package/dist/loader-D62komKu.js.map +1 -0
  40. package/dist/logo-DQ_OYhBi.js +10 -0
  41. package/dist/logo-DQ_OYhBi.js.map +1 -0
  42. package/dist/{navigate-O78d_zGN.js → navigate-CfOr-TRF.js} +94 -31
  43. package/dist/navigate-CfOr-TRF.js.map +1 -0
  44. package/dist/nesting-DA5vJw9X.js +265 -0
  45. package/dist/nesting-DA5vJw9X.js.map +1 -0
  46. package/dist/{produce-Doc91GkX.js → produce-BNIpmZq2.js} +138 -9
  47. package/dist/produce-BNIpmZq2.js.map +1 -0
  48. package/dist/{produce-D0V0ICkz.d.ts → produce-CRfouraC.d.ts} +44 -5
  49. package/dist/{rpc-ygMRPmN4.js → rpc-BTMb8jap.js} +11 -6
  50. package/dist/rpc-BTMb8jap.js.map +1 -0
  51. package/dist/runtime/batch.js +9 -7
  52. package/dist/runtime/batch.js.map +1 -1
  53. package/dist/runtime/client.d.ts +4 -4
  54. package/dist/runtime/client.js +4 -4
  55. package/dist/runtime/devtools.d.ts +11 -29
  56. package/dist/runtime/devtools.js +3 -1
  57. package/dist/runtime/env.js +14 -2
  58. package/dist/runtime/env.js.map +1 -1
  59. package/dist/runtime/events.d.ts +23 -1
  60. package/dist/runtime/events.js +1 -1
  61. package/dist/runtime/forms.d.ts +2 -2
  62. package/dist/runtime/forms.js +1 -1
  63. package/dist/runtime/hot.d.ts +1 -1
  64. package/dist/runtime/hot.js +5 -2
  65. package/dist/runtime/hot.js.map +1 -1
  66. package/dist/runtime/html.d.ts +2 -2
  67. package/dist/runtime/html.js +1 -1
  68. package/dist/runtime/loader.d.ts +2 -2
  69. package/dist/runtime/loader.js +2 -2
  70. package/dist/runtime/routes.js +4 -1
  71. package/dist/runtime/routes.js.map +1 -1
  72. package/dist/runtime/server.d.ts +5 -5
  73. package/dist/runtime/server.js +5 -5
  74. package/dist/runtime/signals.d.ts +38 -1
  75. package/dist/runtime/signals.js +33 -1
  76. package/dist/runtime/signals.js.map +1 -1
  77. package/dist/runtime/static-loader.d.ts +2 -2
  78. package/dist/runtime/static-loader.js +1 -1
  79. package/dist/runtime/testing.d.ts +18 -3
  80. package/dist/runtime/testing.js +150 -33
  81. package/dist/runtime/testing.js.map +1 -1
  82. package/dist/{server-CxVDYE_V.js → server-BTtsQFFw.js} +633 -163
  83. package/dist/server-BTtsQFFw.js.map +1 -0
  84. package/dist/{server-DuFYRXrd.d.ts → server-CYw15Dsg.d.ts} +103 -22
  85. package/dist/{static-loader-nZssh66R.js → static-loader-C_GYIFtt.js} +79 -99
  86. package/dist/static-loader-C_GYIFtt.js.map +1 -0
  87. package/dist/{static-loader-Drpr0AzI.d.ts → static-loader-DVuLmXeu.d.ts} +2 -2
  88. package/dist/{stream-DCYZO4IF.js → stream-r4V5zBKm.js} +102 -16
  89. package/dist/stream-r4V5zBKm.js.map +1 -0
  90. package/dist/vite.d.ts +13 -20
  91. package/dist/vite.js +1956 -554
  92. package/dist/vite.js.map +1 -1
  93. package/elements.d.ts +951 -0
  94. package/forms/forms.brm.ts +3 -3
  95. package/package.json +12 -3
  96. package/skills/brumate/SKILL.md +58 -0
  97. package/skills/brumate/references/errors.md +2078 -0
  98. package/skills/brumate/references/events.md +117 -0
  99. package/skills/brumate/references/signals.md +61 -0
  100. package/skills/brumate/references/state.md +235 -0
  101. package/skills/brumate/references/syntax.md +250 -0
  102. package/types.d.ts +4 -4
  103. package/dist/client-BD6XT-s5.js +0 -1968
  104. package/dist/client-BD6XT-s5.js.map +0 -1
  105. package/dist/client-routes-JTbGtukf.js.map +0 -1
  106. package/dist/cookies-BzllthiF.js.map +0 -1
  107. package/dist/defer-BbD7JQhj.js.map +0 -1
  108. package/dist/devtools-CQgD7NPB.js.map +0 -1
  109. package/dist/devtools-panel-BVB-W5q4.js.map +0 -1
  110. package/dist/events-CSs7OwIC.js.map +0 -1
  111. package/dist/files-BXSSrQgc.js +0 -205
  112. package/dist/files-BXSSrQgc.js.map +0 -1
  113. package/dist/forms-Bg-CwGqX.js.map +0 -1
  114. package/dist/html-mNTKzaDD.js.map +0 -1
  115. package/dist/inspect-BHpOw1LF.js.map +0 -1
  116. package/dist/loader-Dos_3NP0.js.map +0 -1
  117. package/dist/navigate-O78d_zGN.js.map +0 -1
  118. package/dist/produce-Doc91GkX.js.map +0 -1
  119. package/dist/rpc-ygMRPmN4.js.map +0 -1
  120. package/dist/server-CxVDYE_V.js.map +0 -1
  121. package/dist/static-loader-nZssh66R.js.map +0 -1
  122. package/dist/stream-DCYZO4IF.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { r as SerialEntry } from "./values-B8C7CLvG.js";
2
- import { t as Raw } from "./html-Bq1rFxX_.js";
3
- import { n as Binding, o as PageState, r as ElementReference, s as ScopeId } from "./produce-D0V0ICkz.js";
4
1
  import { t as Context } from "./context-btHuB01Z.js";
2
+ import { n as Raw } from "./html-Gggepsf-.js";
3
+ import { r as SerialEntry } from "./values-B8C7CLvG.js";
4
+ import { l as ScopeId, n as Binding, o as PageState, r as ElementReference } from "./produce-CRfouraC.js";
5
5
  //#region src/runtime/navigate.d.ts
6
6
  /** What the devtools learn of a navigation. See `DevtoolsHooks.navigated`. */
7
7
  interface NavigationReport {
@@ -25,7 +25,84 @@ interface NavigationReport {
25
25
  time: number;
26
26
  }
27
27
  //#endregion
28
- //#region src/runtime/client.d.ts
28
+ //#region src/runtime/client/branches.d.ts
29
+ type Render = (parent: Scope, item?: unknown, index?: number) => string | DocumentFragment;
30
+ /** Shows the branch at `index` of `#if` or `#switch`, or nothing for -1. */
31
+ declare function branch(scope: Scope, anchor: number, index: number, renders: (Render | undefined)[], kinds: number[], holderKind?: number, holderAnchor?: number): void;
32
+ /** Renders the body of `#key` again when its value changes. */
33
+ declare function rekey(scope: Scope, anchor: number, value: unknown, render: Render, kinds: number[], holderKind?: number, holderAnchor?: number): void;
34
+ /**
35
+ * `rekey` for the block around a dynamic tag. The first update keeps the element that the server
36
+ * rendered, when it has the tag already, such as an update of a scope that streams in after an
37
+ * event.
38
+ */
39
+ declare function retag(scope: Scope, anchor: number, value: unknown, render: Render, kinds: number[], holderKind?: number, holderAnchor?: number): void;
40
+ /**
41
+ * Renders the body of a `#try` block again, for its `reset` function. If the
42
+ * body throws, the fallback renders again with the error.
43
+ */
44
+ declare function reset(scope: Scope, anchor: number, id: string, body: string, fallback: string, kinds: number[], holderKind?: number, holderAnchor?: number): Promise<void>;
45
+ /**
46
+ * Renders the body of a `#client` block once, in place of its fallback.
47
+ * `kinds` are the scope IDs inside the fallback, whose instances go.
48
+ */
49
+ declare function fill(scope: Scope, anchor: number, render: Render, kinds?: number[], holderKind?: number, holderAnchor?: number): void;
50
+ /**
51
+ * Shows or hides the body of an `#offscreen` block. A body that the page
52
+ * does not have yet renders the first time it shows. `kind` is the body's
53
+ * scope ID in the compiled component.
54
+ */
55
+ declare function offscreen(scope: Scope, anchor: number, value: unknown, render: Render, kind: number, holderKind?: number, holderAnchor?: number): void;
56
+ /** A hidden `#offscreen` body: its scope, and the ranges of its markup and of its portals. */
57
+ interface HiddenBody {
58
+ scope: Scope;
59
+ ranges: [start: Comment, end: Comment][];
60
+ }
61
+ //#endregion
62
+ //#region src/runtime/client/children.d.ts
63
+ /** Renders a value inserted in markup. Children render here, at `scope`, for their contexts. */
64
+ declare function insert(value: unknown, _ctx?: unknown, scope?: Scope | ScopeId): string;
65
+ /**
66
+ * Children of a component that the client renders. They render where the
67
+ * component inserts them, so they read the contexts that it provides. `from`
68
+ * is the scope of the markup that wrote them.
69
+ */
70
+ declare class Children {
71
+ private given;
72
+ private readonly html;
73
+ constructor(from: Scope | ScopeId | undefined, html: () => string | DocumentFragment);
74
+ /** The scope that the children were written in, found when they render. */
75
+ protected get from(): Scope | undefined;
76
+ render(at: Scope | undefined): string | DocumentFragment;
77
+ }
78
+ /** The children of a component that the client renders. See `Children`. */
79
+ declare function children(from: Scope | ScopeId | undefined, html: () => string | DocumentFragment): Children;
80
+ //#endregion
81
+ //#region src/runtime/client/components.d.ts
82
+ /** A component's client render function, from its `?brumate-render` module. */
83
+ type Component<P = any> = (props: P) => string | DocumentFragment;
84
+ /** Puts a child component that a clone renders in the place of its comment. */
85
+ declare function place(at: Comment, out: string | Node): void;
86
+ /**
87
+ * Renders a child component on the client. With `scope` and `anchor`,
88
+ * records the child's scope so the parent can update its props.
89
+ */
90
+ declare function component<P>(Child: Component<P>, props: P, _ctx?: unknown, scope?: Scope | number, anchor?: number): string;
91
+ /** Renders a child component for a clone: its markup as HTML, or the clone that it made. */
92
+ declare function componentNodes<P>(Child: Component<P>, props: P, _ctx?: unknown, scope?: Scope | number, anchor?: number): string | DocumentFragment;
93
+ /**
94
+ * Renders a dynamic tag for a clone: the element, with its attributes and content, or what a
95
+ * component renders.
96
+ */
97
+ declare function dynamicNodes(tag: unknown, attributes: Record<string, unknown>, inner: Raw | Children | undefined, _ctx?: unknown, scope?: Scope | number, ref?: unknown, foreign?: string): string | Node;
98
+ /** `dynamicNodes` for a dynamic tag inside SVG or MathML, `svg` or `math`. */
99
+ declare function foreignNodes(foreign: string, tag: unknown, attributes: Record<string, unknown>, inner: Raw | Children | undefined, ctx?: unknown, scope?: Scope | number, ref?: unknown): string | Node;
100
+ declare function dynamic(tag: unknown, attributes: Record<string, unknown>, inner: Raw | Children | undefined, _ctx?: unknown, scope?: Scope | number, ref?: unknown): string;
101
+ declare function setSlots(id: ScopeId, values: unknown[]): void;
102
+ declare function setItem(id: ScopeId, value: unknown): void;
103
+ declare function elementAt(scope: ScopeId, anchor: number): ElementReference;
104
+ //#endregion
105
+ //#region src/runtime/client/state.d.ts
29
106
  type Update = [kind: number, name: string];
30
107
  /** The entry of a compiled client module. */
31
108
  interface ClientModule {
@@ -34,20 +111,29 @@ interface ClientModule {
34
111
  props: Record<string, number>;
35
112
  /** Scope kind, then slot, to the updates that read it. */
36
113
  g: Record<number, Record<number, Update[]>>;
114
+ /** The handlers that can write a slot of another component. The others write only their own. */
115
+ w?: string[];
37
116
  /**
38
117
  * Imports a part of the module. A module without it holds every part
39
118
  * itself, as a small component's module does.
40
119
  */
41
120
  load?: (part: string) => Promise<Part>;
121
+ /**
122
+ * The render functions of components that this component sends as values, such as in a
123
+ * prop. The state holds only their IDs, so `dynamic` finds them here.
124
+ */
125
+ components?: (Component & {
126
+ brumateId: string;
127
+ })[];
42
128
  /** Server function ID to the memos that call it, as scope kind and update, for `refresh`. */
43
129
  refresh?: Record<string, Update[]>;
44
130
  /**
45
131
  * The `#try` blocks that catch errors of client code, by the scope kinds
46
132
  * inside their bodies: the kind of the scope that holds the block, the
47
133
  * anchor of the block, the render functions of the body and the `#catch`
48
- * body, and the kinds of both bodies.
134
+ * body, and the kinds of both bodies, and the holder of a block in children.
49
135
  */
50
- t?: Record<number, [owner: number, anchor: number, body: string, fallback: string, kinds: number[]]>;
136
+ t?: Record<number, [owner: number, anchor: number, body: string, fallback: string, kinds: number[], holderKind?: number, holderAnchor?: number]>;
51
137
  }
52
138
  /** A part of a client module: one client root, or the updates. */
53
139
  type Part = Record<string, unknown>;
@@ -65,8 +151,12 @@ interface Scope {
65
151
  c?: Record<number, ScopeId>;
66
152
  /** The scope that rendered a component's root scope. */
67
153
  o?: Scope;
154
+ /** The root scopes of the components that this scope rendered, which go with it. */
155
+ owned?: Set<Scope>;
68
156
  /** For children that a component inserted, the scope where they are, for contexts. */
69
157
  t?: Scope;
158
+ /** For a component that passes its children on, the scope where they are finally inserted. */
159
+ f?: Scope;
70
160
  /** The values that the scope provides, by context key. */
71
161
  v?: Record<string, unknown>;
72
162
  /** The slots that hold the contexts that the scope reads, by context key. */
@@ -77,7 +167,15 @@ interface Scope {
77
167
  * or the setter of `$bind(name, fn)`, as a function or a reference.
78
168
  */
79
169
  b?: Record<number, unknown>;
80
- children: Set<Scope>;
170
+ /**
171
+ * The slots that hold a promise prop. It stays a promise, which a read returns as it is,
172
+ * whether or not it settled.
173
+ */
174
+ plain?: Set<number>;
175
+ /** The promise props that the component received, until `setSlots` takes them. */
176
+ props?: Promise<unknown>[] | undefined;
177
+ /** The scopes inside it, made with the first one. */
178
+ children?: Set<Scope>;
81
179
  /** The `b-root` of the render that the server rendered the scope in. */
82
180
  r?: string;
83
181
  cleanups?: Map<string, () => void>;
@@ -86,6 +184,11 @@ interface Scope {
86
184
  h?: HiddenBody;
87
185
  /** Effects and `$client` callbacks to run when the `#offscreen` body around the scope shows. */
88
186
  w?: Set<string>;
187
+ /**
188
+ * The nodes that updates write, by anchor, of markup that the browser cloned: elements, and
189
+ * the start comments of text inserts.
190
+ */
191
+ n?: Node[];
89
192
  }
90
193
  interface CoreOptions {
91
194
  /** The exports of the serial entry, for the values of the app in the page state. */
@@ -95,6 +198,8 @@ interface CoreOptions {
95
198
  * has no client code, which a build leaves out.
96
199
  */
97
200
  load: (id: string) => Promise<ClientModule> | undefined;
201
+ /** Loads the bundle of a root component of the page, before the modules in it. */
202
+ loadBundle?: (id: string) => Promise<unknown> | undefined;
98
203
  /** Imports a part of a module, once for each part, as the loader preloads it. */
99
204
  loadPart?: (module: ClientModule, part: string) => Promise<Part>;
100
205
  /** Adds event listeners for the `b-on` attributes in new markup. */
@@ -132,6 +237,14 @@ declare const hooks: {
132
237
  record?: (script: Element, state: PageState) => PageState;
133
238
  /** Runs after the scopes of a state record are added. */
134
239
  added?: (added: Scope[]) => void;
240
+ /**
241
+ * Reads a bound element that a part owns, such as a `contenteditable`, when the core starts.
242
+ * Returns `{ value }` when the user changed it since the server rendered it, `false` when
243
+ * not, and nothing for an element of the core, which it reads itself.
244
+ */
245
+ field?: (element: Element) => {
246
+ value: unknown;
247
+ } | false | undefined;
135
248
  };
136
249
  /** What the devtools overlay hears from the core. It is set only in development. */
137
250
  interface DevtoolsHooks {
@@ -144,8 +257,6 @@ interface DevtoolsHooks {
144
257
  }): void;
145
258
  /** A handler starts for an event. */
146
259
  handler?(ref: string, element: Element, event?: Event): void;
147
- /** A part of a component's client code loaded. */
148
- part?(component: string, name: string): void;
149
260
  /**
150
261
  * A handler ran: when its event came, when its code was ready and the
151
262
  * handlers before it had started, when the call returned, and what it
@@ -162,11 +273,6 @@ interface DevtoolsHooks {
162
273
  }): void;
163
274
  /** The updates of a write ran: how many, and how long they took with their effects. */
164
275
  updated?(count: number, start: number, end: number): void;
165
- /**
166
- * Code of a component starts to load: its entry, or a part, and why.
167
- * `done` settles when it has loaded.
168
- */
169
- load?(component: string, part: string, reason: string, done: Promise<unknown>): void;
170
276
  /** The loader asks the server for the body of a `#defer` block. */
171
277
  defer?(template: Element, done: Promise<unknown>): void;
172
278
  /** A slot got a new value. */
@@ -181,6 +287,53 @@ interface DevtoolsHooks {
181
287
  }
182
288
  /** The global key of the devtools hooks. */
183
289
  declare const DEVTOOLS: unique symbol;
290
+ //#endregion
291
+ //#region src/runtime/client/context.d.ts
292
+ /**
293
+ * Writes a provided value, and the slot of every scope that reads it from this provider. The
294
+ * provider can read the same context from above, which this does not write.
295
+ */
296
+ declare function updateContext(scope: Scope, context: Context<unknown>, value: unknown): void;
297
+ /** Provides a value of a context to the scopes inside `scope`. */
298
+ declare function provideValue<T>(context: Context<T>, value: T, scope: Scope | ScopeId): void;
299
+ /** Reads a context, and records its slot so that changes to the provided value reach it. */
300
+ declare function consumeContext<T>(context: Context<T>, scope: Scope | ScopeId, slot?: number): T;
301
+ /**
302
+ * Writes a context that the runtime provides to the whole page, and the
303
+ * slot of every scope that reads it without a provider above it.
304
+ */
305
+ declare function setGlobal(key: string, value: unknown): void;
306
+ /** Reads the route of the page again, after navigation changed it. */
307
+ declare function updateRoute(): void;
308
+ //#endregion
309
+ //#region src/runtime/client/handlers.d.ts
310
+ /**
311
+ * Renders an object of attributes. With `on`, a handler in it that the core
312
+ * made from a reference goes into `on` as a `b-on` entry, with the scope and
313
+ * the arguments of its reference and the modifiers of its wrappers.
314
+ */
315
+ declare function spread(attributes: Record<string, unknown>, on?: string[], names?: boolean): string;
316
+ /**
317
+ * Runs the handler `ref` for an element. The scope comes from the element's
318
+ * `b-b` anchor, or from the nearest element around it that has one, which
319
+ * the compiler checks is in the same scope.
320
+ */
321
+ declare function handle(element: Element, entry: string, event?: Event, typed?: {
322
+ value: unknown;
323
+ }): Promise<unknown>;
324
+ /** Renders the attributes of a form or button that posts to a server function. */
325
+ declare function action(name: string, id: string, method?: string, result?: string): string;
326
+ /**
327
+ * Sends a form of an `$action`. The code is in `rpc.ts`, which every server
328
+ * call loads, so the core holds only this.
329
+ */
330
+ declare function submitAction(form: HTMLFormElement, submitter: HTMLElement | null): void;
331
+ /** Calls a server function. */
332
+ declare function rpc(id: string, args: unknown[]): Promise<unknown>;
333
+ /** A function prop rendered on the client calls the parent's exported handler. */
334
+ declare function handlerProp(value: unknown, ref: string, scope: Scope | number, bound?: unknown[], modifiers?: string[]): unknown;
335
+ //#endregion
336
+ //#region src/runtime/client/resume.d.ts
184
337
  /** Stops reading state records and markers that arrive later. Later records wait for `init`. */
185
338
  declare function dispose(): void;
186
339
  /**
@@ -218,26 +371,19 @@ declare function remount(detail: {
218
371
  declare function leavePage(): void;
219
372
  /** Reads the page state. The loader calls it once, before the first handler. */
220
373
  declare function init(value: CoreOptions): void;
374
+ //#endregion
375
+ //#region src/runtime/client/blocks.d.ts
221
376
  /**
222
- * Renders an object of attributes. With `on`, a handler in it that the core
223
- * made from a reference goes into `on` as a `b-on` entry, with the scope and
224
- * the arguments of its reference and the modifiers of its wrappers.
225
- */
226
- declare function spread(attributes: Record<string, unknown>, on?: string[]): string;
227
- /**
228
- * Why the core loads code, for the Loading tab of the devtools: an event,
229
- * a call of a function prop, a template, the scopes of a state record, a
230
- * write, an error, a reset of `#try`, or a prop of a child.
231
- */
232
- type LoadReason = "event" | "call" | "template" | "state" | "write" | "error" | "reset" | "prop";
233
- declare function loadModule(id: string, reason?: LoadReason): Promise<ClientModule>;
234
- declare function loadPart(module: ClientModule, name: string, reason?: LoadReason): Promise<Part>;
235
- /**
236
- * Runs the handler `ref` for an element. The scope comes from the element's
237
- * `b-b` anchor, or from the nearest element around it that has one, which
238
- * the compiler checks is in the same scope.
377
+ * Names a comment of cloned markup that names a scope, such as the start of an item. The start
378
+ * of a portal, which its scope looks for when it goes, is indexed.
239
379
  */
240
- declare function handle(element: Element, entry: string, event?: Event): Promise<unknown>;
380
+ declare function nameComment(place: Comment, data: string): void;
381
+ //#endregion
382
+ //#region src/runtime/client/code.d.ts
383
+ declare function loadModule(id: string): Promise<ClientModule>;
384
+ declare function loadPart(module: ClientModule, name: string): Promise<Part>;
385
+ //#endregion
386
+ //#region src/runtime/client/errors.d.ts
241
387
  /**
242
388
  * Reports an error of client code: a handler, an effect, a `$client`
243
389
  * callback or a memo that loads. It renders the `#catch` body of the nearest
@@ -246,47 +392,8 @@ declare function handle(element: Element, entry: string, event?: Event): Promise
246
392
  * with the error and the scope, and the error is logged.
247
393
  */
248
394
  declare function fail(scope: Scope | undefined, error: unknown): void;
249
- /** Returns the instance of a scope by its ID. */
250
- declare function scopeOf(id: ScopeId): Scope | undefined;
251
- declare function get(scope: Scope, slot: number): any;
252
- /**
253
- * Writes a slot from code of a component. A prop that a parent bound with
254
- * `$bind` writes the parent's slot too, through any number of levels, and
255
- * the parent's update of the prop then finds the value already there. A
256
- * binding with a setter, `$bind(name, fn)`, calls it in place of the write,
257
- * and the parent's update of the prop writes the value that it keeps.
258
- */
259
- declare function set<T>(scope: Scope, slot: number, value: T): T;
260
- /** What `$bind(name)` passes a child, in markup that the browser renders. */
261
- declare function binding<T>(value: T, scope: Scope | ScopeId, slot: number, set?: unknown): Binding<T>;
262
- /**
263
- * Records the props that a parent bound with `$bind`, among the props that a
264
- * component the browser renders writes: `slots` has the slot of each, by its name.
265
- */
266
- declare function bindings(scope: Scope | ScopeId, props: Record<string, unknown>, slots: Record<string, number>): void;
267
- /**
268
- * The names of a call of a module function, for its shared code. Each ref
269
- * is a slot of `scope`, `[scope, slot]` for a slot of another scope, or
270
- * `[value]` for a value that does not change, such as a literal argument.
271
- */
272
- declare function cells(scope: Scope, links: unknown[], names: string[]): Record<string, unknown>;
273
- /**
274
- * Computes a memo of `$debounced` after its value stops changing for `ms`,
275
- * or one of `$throttled` at most once every `ms`, with the last value after
276
- * the wait. The memo is pending while it waits.
277
- */
278
- declare function timed(scope: Scope, slot: number, ms: number, throttle: boolean, compute: () => unknown): void;
279
- /**
280
- * Writes the result of an async memo when it arrives. Until then the slot
281
- * keeps its value, and `pending` is true. Only the latest load is written.
282
- */
283
- declare function asyncMemo(scope: Scope, slot: number, promise: Promise<unknown>): void;
284
- /**
285
- * Computes a memo. A promise loads, and the memo keeps its value until it
286
- * settles. A memo that reads a value that is still loading keeps its value
287
- * too, and is pending until that value arrives and the memo computes again.
288
- */
289
- declare function memo(scope: Scope, slot: number, compute: () => unknown): void;
395
+ //#endregion
396
+ //#region src/runtime/client/guesses.d.ts
290
397
  /**
291
398
  * Writes a guess into an optimistic value. It goes back to its source when
292
399
  * the source changes, which computes it again, or when every server call of
@@ -295,26 +402,13 @@ declare function memo(scope: Scope, slot: number, compute: () => unknown): void;
295
402
  declare function guess<T>(scope: Scope, slot: number, ...rest: [value: T] | [sourceScope: Scope, sourceSlot: number, value: T]): T;
296
403
  /** Counts a server call, and puts guesses back when the last one finishes. */
297
404
  declare function track<T>(request: Promise<T>): Promise<T>;
298
- /** True while a new value of a memo loads, or while the server still streams its value. */
299
- declare function pending(scope: Scope, slot: number): boolean;
300
- /** `x++`, `x--`, `++x` and `--x`. */
301
- declare function update(scope: Scope, slot: number, delta: number, prefix: boolean): number;
302
- /**
303
- * Resolves when the updates of the writes so far have run, including those
304
- * whose code is loading. `transition` of `brumate/events` waits for it.
305
- */
306
- declare function updated(): Promise<void>;
307
- declare function descendants(scope: Scope, kind: number, result?: Scope[]): Scope[];
308
- /**
309
- * Removes a scope from the page: its cleanups run, and its memo state goes,
310
- * so a load that settles later is not written. Its markup stays.
311
- */
312
- declare function removeScope(scope: Scope): void;
405
+ //#endregion
406
+ //#region src/runtime/client/inserts.d.ts
313
407
  /**
314
408
  * Renders a `#portal` body into its target, between markers with its scope
315
409
  * ID. `kinds` names the body, so a new target first removes it from the old one.
316
410
  */
317
- declare function portalTo(scope: Scope, target: unknown, render: Render, kinds?: number[]): void;
411
+ declare function portalTo(scope: Scope, target: unknown, render: Render, kinds?: number[], holderKind?: number, holderAnchor?: number): void;
318
412
  /** Writes an inserted value between `<!--t…-->` and `<!--/t-->`. */
319
413
  declare function text(scope: Scope, anchor: number, value: unknown): void;
320
414
  /** Writes an inserted value that is the whole content of the element with the anchor. */
@@ -326,43 +420,61 @@ declare function content(scope: Scope, anchor: number, value: unknown): void;
326
420
  */
327
421
  declare function writeText(scope: Scope, anchor: number, value: unknown): void;
328
422
  declare function attr(scope: Scope, anchor: number, name: string, value: unknown): void;
423
+ /** The element of a spread in markup that the browser renders goes to the `ref` of its attributes. */
424
+ declare function restRef<T extends Record<string, unknown>>(values: T, scope: ScopeId, anchor: number, tag?: unknown): T;
329
425
  declare function attrs(scope: Scope, anchor: number, values: Record<string, unknown>, own?: string[]): void;
330
- type Render = (parent: Scope, item?: unknown, index?: number) => string;
331
- /** Shows the branch at `index` of `#if` or `#switch`, or nothing for -1. */
332
- declare function branch(scope: Scope, anchor: number, index: number, renders: (Render | undefined)[], kinds: number[]): void;
333
- /** Renders the body of `#key` again when its value changes. */
334
- declare function rekey(scope: Scope, anchor: number, value: unknown, render: Render, kinds: number[]): void;
335
- /**
336
- * Renders the body of a `#try` block again, for its `reset` function. If the
337
- * body throws, the fallback renders again with the error.
338
- */
339
- declare function reset(scope: Scope, anchor: number, id: string, body: string, fallback: string, kinds: number[]): Promise<void>;
340
- /**
341
- * Renders the body of a `#client` block once, in place of its fallback.
342
- * `kinds` are the scope IDs inside the fallback, whose instances go.
343
- */
344
- declare function fill(scope: Scope, anchor: number, render: Render, kinds?: number[]): void;
345
- /**
346
- * Shows or hides the body of an `#offscreen` block. A body that the page
347
- * does not have yet renders the first time it shows. `kind` is the body's
348
- * scope ID in the compiled component.
349
- */
350
- declare function offscreen(scope: Scope, anchor: number, value: unknown, render: Render, kind: number): void;
351
- /** A hidden `#offscreen` body: its scope, and the ranges of its markup and of its portals. */
352
- interface HiddenBody {
353
- scope: Scope;
354
- ranges: [start: Comment, end: Comment][];
355
- }
356
- /** Updates the items of `#for` or `#repeat`, keeping the elements of items whose keys stay. */
426
+ //#endregion
427
+ //#region src/runtime/client/lists.d.ts
357
428
  /** The items of a `#for` list: an array as it is, since `list` only reads it, or any iterable as an array. */
358
- declare function listOf(value: Iterable<unknown> | ArrayLike<unknown>): unknown[];
359
- declare function list(scope: Scope, anchor: number, items: unknown[], key: (item: unknown, index: number) => unknown, render: Render, assign: (scope: Scope, item: unknown, index: number) => void, fallback: Render | undefined, fallbackKinds: number[]): void;
429
+ declare function toList(value: Iterable<unknown> | ArrayLike<unknown>): unknown[];
430
+ /** Updates the items of `#for` or `#repeat`, keeping the elements of items whose keys stay. */
431
+ declare function list(scope: Scope, anchor: number, items: unknown[], key: (item: unknown, index: number) => unknown, given: Render, assign: (scope: Scope, item: unknown, index: number) => void, givenFallback: Render | undefined, fallbackKinds: number[], holderKind?: number, holderAnchor?: number, park?: Parking): void;
432
+ /**
433
+ * Renders the items of a windowed list that are in view, from `#for … window(height, count)`,
434
+ * with `list`, between the spacers that the server wrote before and after the block. Items that
435
+ * leave the view keep their scopes and nodes while they are in the list.
436
+ */
437
+ declare function windowList(scope: Scope, anchor: number, items: unknown[], key: (item: unknown, index: number) => unknown, render: Render, assign: (scope: Scope, item: unknown, index: number) => void, fallback: Render | undefined, fallbackKinds: number[], height: number, holderKind?: number, holderAnchor?: number): void;
438
+ /**
439
+ * Starts the window of a windowed list that the server rendered: it draws now, and again as
440
+ * the page or the element that scrolls the list scrolls or resizes.
441
+ */
442
+ declare function windowStart(scope: Scope, anchor: number, draw: () => void): void;
443
+ /** The items of a windowed list that are out of view, which keep their scopes and nodes. */
444
+ interface Parking {
445
+ items: Map<unknown, {
446
+ scope: Scope;
447
+ nodes: DocumentFragment;
448
+ }>;
449
+ /** Whether a key is still in the list, so its item keeps its scope when it leaves the view. */
450
+ stays: (key: unknown) => boolean;
451
+ /** The index in the whole list of the first item that was in the page before. */
452
+ was: number;
453
+ /** The index in the whole list of the first item that is in the page now. */
454
+ from: number;
455
+ /** The number of items in the whole list, also when none is in view. */
456
+ total: number;
457
+ /** The scopes of items that came back, which refresh. */
458
+ back?: Scope[];
459
+ }
460
+ //#endregion
461
+ //#region src/runtime/client/page.d.ts
360
462
  /** Sets a style variable on the top-level elements of a component instance. */
361
463
  declare function setVar(scope: Scope, name: string, value: unknown): void;
362
- /** Writes a provided value, and the slot of every scope that reads it from this provider. */
363
- declare function updateContext(scope: Scope, context: Context<unknown>, value: unknown): void;
364
- /** Sets the title of the page. */
365
- declare function title(value: unknown): void;
464
+ /**
465
+ * Warns in development that the browser renders a `#defer` block of a
466
+ * component, such as inside a `#client` body of its parent. Only the server
467
+ * renders the body, so the fallback stays.
468
+ */
469
+ declare function deferInBrowser(id: string): void;
470
+ /** Adds the markup of a `#head` block to the document's head. */
471
+ declare function addHead(html: string | DocumentFragment): void;
472
+ /** Adds the markup of a `#portal` block at the end of the page, after the markup around it. */
473
+ declare function addPortal(html: string | DocumentFragment): void;
474
+ /** Adds a component's stylesheet to the page, if the server did not. */
475
+ declare function addStyle(id: string, css: string): string;
476
+ //#endregion
477
+ //#region src/runtime/client/props.d.ts
366
478
  /**
367
479
  * Updates the props of a child component from a spread. A key that the
368
480
  * spread passed before and no longer has becomes undefined. `after` names
@@ -370,44 +482,20 @@ declare function title(value: unknown): void;
370
482
  */
371
483
  declare function spreadProps(scope: Scope, anchor: number, value: Record<string, unknown> | null | undefined, after: string[]): void;
372
484
  declare function prop(scope: Scope, anchor: number, name: string, value: unknown): void;
373
- /** Runs an effect or a `$client` callback, after the cleanup of its previous run. */
374
- declare function effect(scope: Scope, name: string, callback: () => unknown): void;
375
- /** Renders the attributes of a form or button that posts to a server function. */
376
- declare function action(name: string, id: string, method?: string, result?: string): string;
377
- /**
378
- * Sends a form of an `$action`. The code is in `rpc.ts`, which every server
379
- * call loads, so the core holds only this.
380
- */
381
- declare function submitAction(form: HTMLFormElement, submitter: HTMLElement | null): void;
382
- /** Calls a server function. */
383
- declare function rpc(id: string, args: unknown[]): Promise<unknown>;
384
- /** Renders a value inserted in markup. Children render here, at `scope`, for their contexts. */
385
- declare function insert(value: unknown, _ctx?: unknown, scope?: Scope | ScopeId): string;
386
- /**
387
- * Children of a component that the client renders. They render where the
388
- * component inserts them, so they read the contexts that it provides. `from`
389
- * is the scope of the markup that wrote them.
390
- */
391
- declare class Children {
392
- private readonly from;
393
- private readonly html;
394
- constructor(from: Scope | ScopeId | undefined, html: () => string);
395
- render(at: Scope | undefined): string;
396
- }
397
- /** The children of a component that the client renders. See `Children`. */
398
- declare function children(from: Scope | ScopeId | undefined, html: () => string): Children;
399
- /** A component's client render function, from its `?brumate-render` module. */
400
- type Component<P = any> = (props: P) => string;
485
+ //#endregion
486
+ //#region src/runtime/client/scopes.d.ts
487
+ /** Returns the instance of a scope by its ID. */
488
+ declare function getScope(id: ScopeId): Scope | undefined;
489
+ declare function descendants(scope: Scope, kind: number, result?: Scope[]): Scope[];
401
490
  /**
402
- * Renders a child component on the client. With `scope` and `anchor`,
403
- * records the child's scope so the parent can update its props.
491
+ * Removes a scope from the page: its cleanups run, and its memo state goes,
492
+ * so a load that settles later is not written. Its markup stays.
404
493
  */
405
- declare function component<P>(Child: Component<P>, props: P, _ctx?: unknown, scope?: Scope | number, anchor?: number): string;
406
- declare function dynamic(tag: unknown, attributes: Record<string, unknown>, inner: Raw | Children | undefined, _ctx?: unknown, scope?: Scope | number): string;
494
+ declare function removeScope(scope: Scope): void;
407
495
  /** Work that waits until rendered markup is in the page. */
408
496
  declare const afterInsert: (() => void)[];
409
497
  /** Creates a scope for markup that the client renders, and returns its ID. */
410
- declare function createScope(kind: number, parent?: Scope | ScopeId, module?: string): number;
498
+ declare function createScope(kind: number, parent?: Scope | ScopeId, module?: string, nodes?: number): number;
411
499
  /**
412
500
  * The ID that `$id()` makes, as the server does. Client scope IDs are
413
501
  * negative, so they differ from the server's.
@@ -415,34 +503,155 @@ declare function createScope(kind: number, parent?: Scope | ScopeId, module?: st
415
503
  declare function makeId(scope: Scope | ScopeId, index: number): string;
416
504
  /** Sets the owner of the next component's root scope. */
417
505
  declare function setOwner(scope: Scope | ScopeId): void;
418
- /** Provides a value of a context to the scopes inside `scope`. */
419
- declare function provideValue<T>(context: Context<T>, value: T, scope: Scope | ScopeId): void;
420
- /** Reads a context, and records its slot so that changes to the provided value reach it. */
421
- declare function consumeContext<T>(context: Context<T>, scope: Scope | ScopeId, slot?: number): T;
506
+ /** The scope that `unbind` collects the promise props of its component in. */
507
+ declare function sink(scope: ScopeId): Scope | undefined;
508
+ //#endregion
509
+ //#region src/runtime/client/templates.d.ts
510
+ /** Markup that the browser clones, and the paths to the elements that its render writes. */
511
+ interface Template {
512
+ html: string;
513
+ /** How many elements the render writes, which have `b-x` in `html`. */
514
+ count: number;
515
+ /** `svg` or `math`, for markup whose elements are of SVG or MathML, which parses inside one. */
516
+ foreign?: string;
517
+ t?: HTMLTemplateElement;
518
+ /** The moves that reach the marked nodes of a clone. See `encodeWalk`. */
519
+ walk?: number[];
520
+ }
521
+ /** A template of the markup of a render, which `clone` parses once. */
522
+ declare function template(html: string, count: number, foreign?: string): Template;
422
523
  /**
423
- * Writes a context that the runtime provides to the whole page, and the
424
- * slot of every scope that reads it without a provider above it.
524
+ * A node of a clone: an element, the comment of an insert, or the fragment. The type lets the
525
+ * render pass each to the write that takes it.
425
526
  */
426
- declare function setGlobal(key: string, value: unknown): void;
427
- /** Reads the route of the page again, after navigation changed it. */
428
- declare function updateRoute(): void;
429
- declare function setSlots(id: ScopeId, values: unknown[]): void;
430
- declare function setItem(id: ScopeId, value: unknown): void;
431
- declare function elementAt(scope: ScopeId, anchor: number): ElementReference;
527
+ type ClonedNode = Element & Comment & DocumentFragment;
432
528
  /**
433
- * Warns in development that the browser renders a `#defer` block of a
434
- * component, such as inside a `#client` body of its parent. Only the server
435
- * renders the body, so the fallback stays.
529
+ * Clones a template. Returns the nodes that the template marks, by their index, and the fragment
530
+ * after them, in one array.
436
531
  */
437
- declare function deferInBrowser(id: string): void;
438
- /** Adds the markup of a `#head` block to the document's head. */
439
- declare function addHead(html: string): void;
440
- /** Adds the markup of a `#portal` block at the end of the page, after the markup around it. */
441
- declare function addPortal(html: string): void;
442
- /** Adds a component's stylesheet to the page, if the server did not. */
443
- declare function addStyle(id: string, css: string): string;
444
- /** A function prop rendered on the client calls the parent's exported handler. */
445
- declare function handlerProp(value: unknown, ref: string, scope: Scope | number, bound?: unknown[], modifiers?: string[]): unknown;
532
+ declare function clone(source: Template): ClonedNode[];
533
+ /**
534
+ * Keeps an element of cloned markup on its scope, where updates find it. An element at the top
535
+ * of the clone, or one with handlers, gets its `b-b` too, which `list` and the handlers read to
536
+ * find the scope.
537
+ */
538
+ declare function keep(scope: ScopeId, anchor: number, element: Element, named?: boolean): void;
539
+ /**
540
+ * Puts the value of a text insert of cloned markup in the place of its comment. A text value is
541
+ * a text node, which the scope keeps, as Solid keeps it, so an update sets its data. Other
542
+ * values render between the markers of an insert, as in HTML.
543
+ */
544
+ declare function keepText(scope: ScopeId, anchor: number, place: Comment, value: unknown, at?: ScopeId | Scope): void;
545
+ /** Puts a text insert at the end of an element of cloned markup, as `keepText` does. */
546
+ declare function appendText(scope: ScopeId, anchor: number, parent: Element, value: unknown, at?: ScopeId | Scope): void;
547
+ /** Names the start marker of a block whose markup is in the clone, and keeps it on its scope. */
548
+ declare function markBlock(place: Comment, scope: ScopeId, anchor: number, suffix: string): void;
549
+ /**
550
+ * Fills a nested `#if` of cloned markup with the branch at `index`, or nothing for -1, before
551
+ * the clone is in the page. `branch` updates it later.
552
+ */
553
+ declare function fillBranch(place: Comment, scope: ScopeId, anchor: number, index: number, renders: Render[]): void;
554
+ /** Fills a nested `#for` of cloned markup with its items, before the clone is in the page. */
555
+ declare function fillList(place: Comment, scope: ScopeId, anchor: number, items: unknown[], render: Render): void;
556
+ /** Writes an attribute of an element of cloned markup, as `attribute` writes it in HTML. */
557
+ declare function setAttr(element: Element, name: string, value: unknown): void;
558
+ /** The nodes of a block that renders where it is, in HTML: a place, which the parse fills. */
559
+ declare function nodes(fragment: DocumentFragment): string;
560
+ /**
561
+ * Renders an `#if` or a `#switch` where it is: the branch at `index`, or nothing for -1, between
562
+ * its markers when it has them, which `branch` updates later.
563
+ */
564
+ declare function branchNodes(scope: ScopeId | undefined, anchor: number | undefined, index: number, bodies: (() => string | DocumentFragment)[]): DocumentFragment;
565
+ /**
566
+ * Renders a `#for` or a `#repeat` where it is: its items, or its fallback for none, between its
567
+ * markers when it has them, which `list` updates later.
568
+ */
569
+ declare function listNodes(scope: ScopeId | undefined, anchor: number | undefined, items: unknown[], body: (item: unknown, index: number) => string | DocumentFragment, fallback: (() => string | DocumentFragment) | undefined): DocumentFragment;
570
+ /** Writes attributes that code of a start tag gave as their text, as HTML has them. */
571
+ declare function setAttrText(element: Element, text: string): void;
572
+ /** Puts a value with no markers in the place of a comment of cloned markup, as `insert` does. */
573
+ declare function putText(place: Comment, value: unknown, at?: ScopeId | Scope): void;
574
+ /** Writes the spreads of an element of cloned markup, as `spread` writes them in HTML. */
575
+ declare function setSpread(element: Element, attributes: Record<string, unknown>, on?: string[], names?: boolean): void;
576
+ /** Writes the `b-on` of an element of cloned markup with spreads, as `onAttribute` does. */
577
+ declare function setOn(element: Element, on: string[], own: string): void;
578
+ /** Writes the content of an element of cloned markup, as `insert` writes it in HTML. */
579
+ declare function setContent(element: Element, value: unknown, at?: ScopeId | Scope): void;
580
+ //#endregion
581
+ //#region src/runtime/client/titles.d.ts
582
+ /** Sets the title of the page. */
583
+ declare function title(value: unknown): void;
584
+ //#endregion
585
+ //#region src/runtime/client/updates.d.ts
586
+ declare function get(scope: Scope, slot: number): any;
587
+ /**
588
+ * Writes a slot from code of a component. A prop that a parent bound with
589
+ * `$bind` writes the parent's slot too, through any number of levels, and
590
+ * the parent's update of the prop then finds the value already there. A
591
+ * binding with a setter, `$bind(name, fn)`, calls it in place of the write,
592
+ * and the parent's update of the prop writes the value that it keeps, before
593
+ * the call returns.
594
+ */
595
+ declare function set<T>(scope: Scope, slot: number, value: T): T;
596
+ /** What `$bind(name)` passes a child, in markup that the browser renders. */
597
+ declare function binding<T>(value: T, scope: Scope | ScopeId, slot: number, setter?: unknown): Binding<T>;
598
+ /**
599
+ * Records the props that a parent bound with `$bind`, among the props that a
600
+ * component the browser renders writes: `slots` has the slot of each, by its name.
601
+ */
602
+ declare function bindings(scope: Scope | ScopeId, props: Record<string, unknown>, slots: Record<string, number>): void;
603
+ /**
604
+ * The names of a call of a module function, for its shared code. Each ref
605
+ * is a slot of `scope`, `[scope, slot]` for a slot of another scope, or
606
+ * `[value]` for a value that does not change, such as a literal argument.
607
+ */
608
+ declare function cells(scope: Scope, links: unknown[], names: string[]): Record<string, unknown>;
609
+ /**
610
+ * Computes a memo of `$debounced` after its value stops changing for `ms`,
611
+ * or one of `$throttled` at most once every `ms`, with the last value after
612
+ * the wait. The memo is pending while it waits.
613
+ */
614
+ declare function timed(scope: Scope, slot: number, ms: number, throttle: boolean, compute: () => unknown): void;
615
+ /**
616
+ * Writes the result of an async memo when it arrives. Until then the slot
617
+ * keeps its value, and `pending` is true. Only the latest load is written.
618
+ */
619
+ declare function asyncMemo(scope: Scope, slot: number, promise: Promise<unknown>): void;
620
+ /**
621
+ * `$resolve(memo, { timeout, signal })`: resolves with the value of the memo once it is no longer
622
+ * pending, also after a load that its inputs started. `isLoading` tells whether the memo or a
623
+ * memo that it reads loads, and `read` gives the value or throws the error of the memo.
624
+ */
625
+ declare function resolve(scope: Scope, isLoading: () => boolean, read: () => unknown, options?: {
626
+ timeout?: number;
627
+ signal?: AbortSignal;
628
+ }): Promise<unknown>;
629
+ /**
630
+ * Computes a memo. A promise loads, and the memo keeps its value until it
631
+ * settles. A memo that reads a value that is still loading keeps its value
632
+ * too, and is pending until that value arrives and the memo computes again.
633
+ * A throw is held as the value of the memo, and its readers throw.
634
+ */
635
+ declare function memo(scope: Scope, slot: number, compute: () => unknown): void;
636
+ /** True while a new value of a memo loads, or while the server still streams its value. */
637
+ declare function pending(scope: Scope, slot: number): boolean;
638
+ /** True when a parent bound the prop of the slot with `$bind`. */
639
+ declare function isBound(scope: Scope, slot: number): boolean;
640
+ /** `x++`, `x--`, `++x` and `--x`. */
641
+ declare function update(scope: Scope, slot: number, delta: number, prefix: boolean): number;
642
+ /**
643
+ * Resolves when the updates of the writes so far have run, including those
644
+ * whose code is loading. `transition` of `brumate/events` waits for it.
645
+ */
646
+ declare function updated(): Promise<void>;
647
+ /**
648
+ * Runs an effect, or a `$client` callback when `client` is set, after the cleanup of its previous
649
+ * run. An effect that reads a value that is still loading skips the run, and runs again when the
650
+ * value arrives. A `$client` callback is a handler: the same read throws.
651
+ */
652
+ declare function effect(scope: Scope, name: string, callback: () => unknown, client?: boolean): void;
653
+ //#endregion
654
+ //#region src/runtime/client.d.ts
446
655
  /**
447
656
  * What the loader calls. It is one export, so the loader's import of the core
448
657
  * names one export, and a build keeps the rest only when components call them.
@@ -456,5 +665,5 @@ declare const loader: {
456
665
  updateRoute: typeof updateRoute;
457
666
  };
458
667
  //#endregion
459
- export { offscreen as $, dispose as A, updated as At, handlerProp as B, children as C, text as Ct, createScope as D, update as Dt, content as E, track as Et, fill as F, leaveRoutes as G, init as H, forget as I, loadModule as J, list as K, get as L, effect as M, NavigationReport as Mt, elementAt as N, deferInBrowser as O, updateContext as Ot, fail as P, memo as Q, guess as R, cells as S, submitAction as St, consumeContext as T, title as Tt, insert as U, hooks as V, leavePage as W, loader as X, loadPart as Y, makeId as Z, attrs as _, setSlots as _t, DevtoolsHooks as a, remount as at, branch as b, spread as bt, Part as c, reset as ct, addHead as d, scopeOf as dt, pending as et, addPortal as f, scopes as ft, attr as g, setOwner as gt, asyncMemo as h, setItem as ht, DEVTOOLS as i, rekey as it, dynamic as j, writeText as jt, descendants as k, updateRoute as kt, Scope as l, rpc as lt, afterInsert as m, setGlobal as mt, Component as n, prop as nt, HiddenBody as o, removeRoot as ot, addStyle as p, set as pt, listOf as q, CoreOptions as r, provideValue as rt, LoadReason as s, removeScope as st, ClientModule as t, portalTo as tt, action as u, rpcPrefix as ut, binding as v, setVar as vt, component as w, timed as wt, build as x, spreadProps as xt, bindings as y, skew as yt, handle as z };
460
- //# sourceMappingURL=client-D0CqSxoO.d.ts.map
668
+ export { attr as $, HiddenBody as $t, setContent as A, ClientModule as At, setOwner as B, skew as Bt, keepText as C, spread as Ct, putText as D, setGlobal as Dt, nodes as E, provideValue as Et, createScope as F, Scope as Ft, addPortal as G, dynamicNodes as Gt, prop as H, component as Ht, descendants as I, build as It, setVar as J, place as Jt, addStyle as K, elementAt as Kt, getScope as L, hooks as Lt, setSpread as M, DEVTOOLS as Mt, template as N, DevtoolsHooks as Nt, setAttr as O, updateContext as Ot, afterInsert as P, Part as Pt, windowStart as Q, insert as Qt, makeId as R, rpcPrefix as Rt, keep as S, rpc as St, markBlock as T, consumeContext as Tt, spreadProps as U, componentNodes as Ut, sink as V, Component as Vt, addHead as W, dynamic as Wt, toList as X, setSlots as Xt, list as Y, setItem as Yt, windowList as Z, children as Zt, appendText as _, remount as _t, cells as a, retag as an, writeText as at, fillBranch as b, handle as bt, isBound as c, fail as ct, resolve as d, nameComment as dt, branch as en, attrs as et, set as f, dispose as ft, title as g, leaveRoutes as gt, updated as h, leavePage as ht, bindings as i, reset as in, text as it, setOn as j, CoreOptions as jt, setAttrText as k, updateRoute as kt, memo as l, loadModule as lt, update as m, init as mt, asyncMemo as n, offscreen as nn, portalTo as nt, effect as o, NavigationReport as on, guess as ot, timed as p, forget as pt, deferInBrowser as q, foreignNodes as qt, binding as r, rekey as rn, restRef as rt, get as s, track as st, loader as t, fill as tn, content as tt, pending as u, loadPart as ut, branchNodes as v, removeRoot as vt, listNodes as w, submitAction as wt, fillList as x, handlerProp as xt, clone as y, action as yt, removeScope as z, scopes as zt };
669
+ //# sourceMappingURL=client-Cs3o4key.d.ts.map