@solidjs/web 2.0.0-rc.11 → 2.0.0-rc.14

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 (60) hide show
  1. package/dist/server.dev.js +705 -151
  2. package/dist/server.js +604 -123
  3. package/dist/server.observe.js +617 -124
  4. package/dist/web.dev.js +102 -41
  5. package/dist/web.js +75 -37
  6. package/dist/web.observe.js +75 -39
  7. package/frames/dist/assets.js +92 -0
  8. package/frames/dist/bind.dev.js +326 -0
  9. package/frames/dist/bind.js +295 -0
  10. package/frames/dist/client.dev.js +693 -919
  11. package/frames/dist/client.js +636 -917
  12. package/frames/dist/client.observe.js +637 -917
  13. package/frames/dist/regions.js +130 -0
  14. package/frames/dist/server.dev.js +607 -212
  15. package/frames/dist/server.js +554 -212
  16. package/frames/dist/server.observe.js +554 -212
  17. package/frames/dist/trace.js +42 -0
  18. package/frames/dist/wire.js +133 -0
  19. package/package.json +30 -3
  20. package/performance-tracks/dist/performance-tracks.dev.js +2 -1
  21. package/performance-tracks/dist/performance-tracks.observe.js +2 -1
  22. package/performance-tracks/types/index.d.ts +8 -6
  23. package/serialization/dist/decode.js +37 -8
  24. package/serialization/dist/serialization.js +39 -10
  25. package/serialization/types/serializer-decode.d.ts +24 -2
  26. package/server-functions/dist/client.dev.js +178 -72
  27. package/server-functions/dist/client.js +99 -61
  28. package/server-functions/dist/client.observe.js +178 -72
  29. package/server-functions/dist/server.dev.js +117 -56
  30. package/server-functions/dist/server.js +117 -56
  31. package/server-functions/dist/server.observe.js +117 -56
  32. package/skills/server-components/SKILL.md +228 -0
  33. package/types/client.d.ts +37 -2
  34. package/types/constants.d.ts +2 -1
  35. package/types/diagnostics.d.ts +8 -0
  36. package/types/frames/assets-tier.d.ts +78 -0
  37. package/types/frames/bind-tier.d.ts +60 -0
  38. package/types/frames/client.d.ts +37 -3
  39. package/types/frames/frame-client.d.ts +249 -96
  40. package/types/frames/frame-container-plugin.d.ts +2 -10
  41. package/types/frames/frame-sink.d.ts +33 -0
  42. package/types/frames/frame-transport.d.ts +66 -18
  43. package/types/frames/regions-tier.d.ts +45 -0
  44. package/types/frames/serializer-decode.d.ts +24 -2
  45. package/types/frames/server.d.ts +53 -1
  46. package/types/frames/trace-tier.d.ts +2 -0
  47. package/types/frames/tree-rewrite.d.ts +39 -0
  48. package/types/frames/wire-tier.d.ts +116 -0
  49. package/types/index.d.ts +38 -0
  50. package/types/index.server.d.ts +10 -1
  51. package/types/jsx.d.ts +11 -1
  52. package/types/observe.d.ts +182 -12
  53. package/types/request-error-hook.d.ts +5 -0
  54. package/types/serializer-decode.d.ts +24 -2
  55. package/types/server-functions/client.d.ts +26 -0
  56. package/types/server-functions/registry.d.ts +4 -1
  57. package/types/server-functions/shared.d.ts +12 -8
  58. package/types/server-mock.d.ts +13 -1
  59. package/types/server-observe.d.ts +8 -0
  60. package/types/server.d.ts +125 -12
@@ -0,0 +1,78 @@
1
+ /**
2
+ * `@solidjs/web/frames/assets` — the frames client's ASSETS tier (frames
3
+ * savings pass §3 row C5): what a segment's `seg:<k>:assets` record does to
4
+ * the document head, loaded on demand through the tier mechanism
5
+ * (`prepareTier("assets")`, frame-client.ts).
6
+ *
7
+ * What rides in this chunk, and so leaves the eager frames client: the
8
+ * import-free mirror of the client asset registry's head conventions
9
+ * (`ensureStylesheet` / `ensurePreload` / `ensureModulePreload` /
10
+ * `applyInlineStyles`, `findHeadElement`'s attribute-compared lookup and
11
+ * head.ts's `qualifierValue`), the per-frame flush a pending stylesheet
12
+ * wakes, and the assets pass over a record (modules, typed preloads, inline
13
+ * styles). The eager client keeps the record itself (`chunkToRecords`'
14
+ * `assets` case, the host's `seg::assets` accumulate), the pass's walk over
15
+ * the store, and the reveal's READINESS TERM: a segment whose assets record
16
+ * carries stylesheets or inline styles while this tier is not resident is
17
+ * not ready — the server's `<Loading>` fallback stays on screen; the reveal
18
+ * happens at max(tier load, stylesheet load) (frames savings pass §1,
19
+ * "assets": no FOUC, no blank). Once the tier is resident only stylesheets
20
+ * gate: inline styles apply at the record's arrival (the walk runs ahead of
21
+ * the segments in the same flush), modules and preloads likewise, and a
22
+ * segment with none of these never waits on the tier.
23
+ *
24
+ * The module's exports ARE its dispatch: `prepareTier` stamps the load with
25
+ * the module once it has resolved (`tierLoads.assets.r`), and the eager
26
+ * client calls `gate` from `#segmentReady` and `apply` from `#flush`'s
27
+ * assets walk off that stamp. No `install()`: the tier registers nothing
28
+ * and imports nothing of the client — it needs no shared instance, only
29
+ * the frame handed to `gate` (its `apply` is the flush a settled sheet
30
+ * triggers).
31
+ *
32
+ * The server announces this tier wherever it emits an assets chunk
33
+ * (`sink.needs("assets")` — the shell's pre-flush assets, a style-gated
34
+ * fragment's, a late module / preload; frame-sink.ts): `X-Frame-Tiers` /
35
+ * `chunk.tiers` on a stream, `_$HY.r["sc:tiers"]` + a `modulepreload` on a
36
+ * document — so the load is a warm start; an un-announced record starts it
37
+ * from the readiness check or the walk and the segment waits (the same DOM,
38
+ * later).
39
+ * @experimental
40
+ */
41
+ import type { Frame } from "./frame-client.js";
42
+ /** A stylesheet entry as the sink writes it: a url, or `{ href, attrs }`. */
43
+ export type StylesheetEntry = string | {
44
+ href: string;
45
+ attrs?: Record<string, string>;
46
+ };
47
+ /** A typed preload entry (`<link rel="preload">`): request-qualifying attributes, optional href. */
48
+ export interface PreloadEntry {
49
+ href?: string;
50
+ attrs: Record<string, string>;
51
+ }
52
+ /** An inline style entry (`<style data-asset>`). */
53
+ export interface InlineStyleEntry {
54
+ id: string;
55
+ content?: string;
56
+ attrs?: Record<string, string>;
57
+ }
58
+ /** The head-affecting members of a `seg:<k>:assets` record. */
59
+ export interface AssetsRecord {
60
+ modules?: string[];
61
+ styles?: StylesheetEntry[];
62
+ inlineStyles?: InlineStyleEntry[];
63
+ preloads?: PreloadEntry[];
64
+ }
65
+ /**
66
+ * The stylesheet gate for one segment (`#segmentReady`'s style term, once
67
+ * the tier is resident): ensure every named sheet is in the head — pending
68
+ * links are inserted now, even while another prerequisite is missing, so
69
+ * the load overlaps the rest of the stream — and report whether all have
70
+ * settled. `frame` is re-flushed when a pending one settles.
71
+ */
72
+ export declare function gate(entries: StylesheetEntry[], frame: Frame): boolean;
73
+ /**
74
+ * The assets pass for one record (`#flush`'s walk, once per record identity
75
+ * per mount): module preloads, typed preloads, inline styles. Stylesheets
76
+ * are the gate's (`gate`) — never applied here.
77
+ */
78
+ export declare function apply(record: AssetsRecord): void;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Register a text start marker's position on its parent element's consumer
3
+ * entry for the occurrence — the one its attribute markers opened, if any,
4
+ * so an element is one consumer however its positions are spelled. The slot
5
+ * sync's walk dispatches here (frame-client.ts `collectSlots`).
6
+ */
7
+ export declare function text(start: Comment, elements: Map<string, any>): void;
8
+ /**
9
+ * An element's positions join each occurrence's consumer list, in document
10
+ * order. The slot sync's walk dispatches here for every server element with
11
+ * attributes (frame-client.ts `collectSlots`).
12
+ */
13
+ export declare function positions(el: Element, elements: Map<string, any>): void;
14
+ /**
15
+ * The consumer set the slot sync found for a MOUNTED data occurrence — at
16
+ * the mount (the set the fill was handed) and on every re-sync. A changed
17
+ * set (a morph replaced one of its elements, a response added or dropped a
18
+ * bound position) rebinds in place through the mount's rebinder: the fill's
19
+ * computation stays, the binding gets the new set.
20
+ */
21
+ export declare function sync(frame: object, occurrence: string, consumers: any[]): void;
22
+ /** The mount's rebind callback (`ctx.onRebind`), registered during the
23
+ * invocation — before `sync` records the mount's set. */
24
+ export declare function rebinder(frame: object, occurrence: string, fn: (consumers: any[]) => void): void;
25
+ /** The occurrence is gone (unmounted, or re-invoked: the new invocation
26
+ * registers its own rebinder). */
27
+ export declare function unmount(frame: object, occurrence: string): void;
28
+ /** The positions of an incoming element a client fill writes (see
29
+ * `owned`). */
30
+ interface Owned {
31
+ attrs: Set<string>;
32
+ class: string[] | null;
33
+ style: string[] | null;
34
+ }
35
+ export declare function owned(el: Element): Owned | null;
36
+ /**
37
+ * Apply the server's value for `name` (null: absent) to an element with
38
+ * binding-slot positions: a client-owned attribute is left alone; owned
39
+ * `class`/`style` NAMES are re-imposed over the server's string. Returns
40
+ * whether the attribute changed, or undefined when the position is not
41
+ * owned and the caller writes it. (The eager wrapper answers `undefined`
42
+ * itself for a null `owned`; the arms call here with one.)
43
+ */
44
+ export declare function apply(oldEl: Element, name: string, value: string, owned: Owned): boolean | undefined;
45
+ /**
46
+ * Bind a binding-slot occurrence (principles §9.2.3). The fill runs ONCE,
47
+ * untracked, under the occurrence's owner — a component body: a top-level
48
+ * read is a one-time read (dev names it through `untrack`'s label), and state
49
+ * created in the body lives as long as the occurrence. Its object's value
50
+ * positions are written by one render effect over every consuming element,
51
+ * diffed per position by `assign`, so a getter's change re-reads the
52
+ * occurrence and touches only what moved. Handlers and refs are read once
53
+ * when an element binds and handed to `assign`, which binds them as client
54
+ * JSX does (delegation, tuples). A consumer change (`ctx.onRebind`: the morph
55
+ * replaced an element, a response bound a new position) rebinds without
56
+ * re-running the fill. The client entry's `slotsFor` dispatches here under
57
+ * the occurrence's owner (client.ts).
58
+ */
59
+ export declare function bind(fill: (args: any) => any, args: any, ctx: any, label: string | undefined): void;
60
+ export {};
@@ -1,6 +1,10 @@
1
+ import { type TierModule } from "./frame-client.js";
1
2
  export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.js";
2
- export { FRAME_STREAM_HEADER, FRAME_HAVE_HEADER, FRAME_HAVE_BUDGET, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.js";
3
- export type { Slot } from "./server.js";
3
+ export type { TierModule } from "./frame-client.js";
4
+ /** @internal */
5
+ export { isAsyncValue } from "./frame-client.js";
6
+ export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.js";
7
+ export type { Slot, BindingSlot, SlotOutput, SlotError } from "./server.js";
4
8
  /**
5
9
  * Client-condition twin of the server face's `asyncArg` (DR-2 value tier):
6
10
  * the identity that types an async value crossing the slot border as its
@@ -16,6 +20,24 @@ export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T
16
20
  * @experimental
17
21
  */
18
22
  export declare function getFrameHost(): any;
23
+ /**
24
+ * Options for `installServerComponents`.
25
+ * @experimental
26
+ */
27
+ export interface InstallOptions {
28
+ /**
29
+ * Frames-client tiers by name → loader. A tier's module's exports are its
30
+ * appliers (the runtime dispatches to them once resident) and its
31
+ * optional `install()` is called once the import resolves; every live
32
+ * frame is then flushed so what the tier makes applicable applies (a held
33
+ * occurrence mounts, a style-gated segment requests its sheets). A name
34
+ * with no loader is resident (eager); `trace` (`@solidjs/web/frames/trace`),
35
+ * `regions` (`@solidjs/web/frames/regions`) and `assets`
36
+ * (`@solidjs/web/frames/assets`) have built-in loaders that an entry here
37
+ * replaces. See `installServerComponents`.
38
+ */
39
+ tiers?: Record<string, () => Promise<TierModule>>;
40
+ }
19
41
  /**
20
42
  * Installs the server-component transport policy on the server-function
21
43
  * client — the identity split (DR-1): CONTENT is keyed by the call's
@@ -31,6 +53,18 @@ export declare function getFrameHost(): any;
31
53
  * Call once in the client entry (an explicit call — the package is
32
54
  * `sideEffects: false`, so a bare import would be tree-shaken away);
33
55
  * call again to rebind to a custom host.
56
+ *
57
+ * `options.tiers` maps a frames-client tier's name to its loader (`() =>
58
+ * import(...)`, the module whose exports are the tier's appliers, with an
59
+ * optional `install()`): the client resolves tier chunks itself, so the
60
+ * server announces NAMES only (`_$HY.r["sc:tiers"]`, `X-Frame-Tiers`) and
61
+ * the loads start here from the document's record — the `modulepreload`
62
+ * the document may also carry made the fetch warm. The built-in table
63
+ * carries `trace` (the container tier's client half,
64
+ * `@solidjs/web/frames/trace`), `regions` (nested server-content regions,
65
+ * `@solidjs/web/frames/regions`) and `assets` (the head mirror and the
66
+ * stylesheet gate, `@solidjs/web/frames/assets`); a loader given here for
67
+ * a name replaces the built-in one (tests gate a tier's load this way).
34
68
  * @experimental
35
69
  */
36
- export declare function installServerComponents(host?: any): void;
70
+ export declare function installServerComponents(host?: any, options?: InstallOptions): void;