@barefootjs/client 0.14.0 → 0.15.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.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Compiler built-in JSX tags: `<Async>` and `<Region>`.
3
+ *
4
+ * These are recognised by the BarefootJS compiler **structurally** — by
5
+ * their import from `@barefootjs/client` (`ir.metadata.imports`), never by
6
+ * a bare capitalized tag-name match — and are compiled away: `<Async>`
7
+ * lowers to a streaming boundary (e.g. Hono `<Suspense>`) and `<Region>`
8
+ * lowers to a `bf-region` page-lifecycle boundary (spec/router.md). No
9
+ * runtime value survives in the emitted output; the compiler also elides
10
+ * the import on emit so it never lingers as a phantom runtime import.
11
+ *
12
+ * The real exports here exist so authors can `import { Async, Region }`
13
+ * with full prop-checking and completion, the same way Solid imports
14
+ * `<Show>` / `<Suspense>` from `solid-js`. Importing them is what tells the
15
+ * compiler the tag is the built-in (and keeps a user's own `<Async>` /
16
+ * `<Region>` component from colliding with it).
17
+ *
18
+ * If one of these ever executes, the JSX was rendered outside the
19
+ * BarefootJS compiler pipeline — that's a bug. See
20
+ * piconic-ai/barefootjs#1915.
21
+ */
22
+ export interface AsyncProps {
23
+ /** UI rendered while the streamed children resolve. */
24
+ fallback: unknown;
25
+ /** Content streamed in once resolved. */
26
+ children?: unknown;
27
+ }
28
+ export interface RegionProps {
29
+ /** The page-lifecycle subtree the router disposes / re-hydrates on navigation. */
30
+ children?: unknown;
31
+ }
32
+ /**
33
+ * Streaming async boundary. Lowered by the compiler to the adapter's
34
+ * streaming primitive (Hono `<Suspense>`); `fallback` is shown until the
35
+ * children resolve. Compiled away — never executes at runtime.
36
+ */
37
+ export declare function Async(_props: AsyncProps): any;
38
+ /**
39
+ * Page-lifecycle boundary (spec/router.md). Lowered by the compiler to a
40
+ * wrapper element carrying a deterministic `bf-region` marker the client
41
+ * router matches on. Compiled away — never executes at runtime.
42
+ */
43
+ export declare function Region(_props: RegionProps): any;
44
+ //# sourceMappingURL=builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AAGH,wBAAgB,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,GAAG,CAE7C;AAED;;;;GAIG;AAGH,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,GAAG,CAE/C"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { createSignal, createEffect, createDisposableEffect, createMemo, createRoot, onCleanup, onMount, untrack, batch, setProfilerSink, beginTurn, endTurn, __bfReportOutput, type Reactive, type Signal, type Memo, type CleanupFn, type EffectFn, type ProfilerEventSink, type SubscriberKind, } from '@barefootjs/client/reactive';
1
+ export { createSignal, createEffect, createDisposableEffect, createMemo, createRoot, onCleanup, onMount, untrack, batch, setProfilerSink, beginTurn, endTurn, __bfReportOutput, searchParams, __bfSetServerEnvReader, type Reactive, type Signal, type Memo, type CleanupFn, type EffectFn, type ProfilerEventSink, type SubscriberKind, } from '@barefootjs/client/reactive';
2
2
  export { createRecordingSink, type ProfilerEvent, type ProfilerEventType, type RecordingSink, } from './profiler-events.ts';
3
3
  export { splitProps } from './split-props.ts';
4
4
  export { __slot, type SlotMarker } from './slot.ts';
@@ -6,4 +6,5 @@ export { forwardProps } from './forward-props.ts';
6
6
  export { unwrap } from './unwrap.ts';
7
7
  export { createContext, type Context } from './context.ts';
8
8
  export { useContext, provideContext, createPortal, isSSRPortal, findSiblingSlot, cleanupPortalPlaceholder, type Portal, type PortalChildren, type PortalOptions, type Renderable, } from './shims.ts';
9
+ export { Async, Region, type AsyncProps, type RegionProps, } from './builtins.ts';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,gBAAgB,EAKhB,YAAY,EACZ,sBAAsB,EACtB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAA;AAKnB,OAAO,EACL,KAAK,EACL,MAAM,EACN,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -12,7 +12,9 @@ import {
12
12
  setProfilerSink,
13
13
  beginTurn,
14
14
  endTurn,
15
- __bfReportOutput
15
+ __bfReportOutput,
16
+ searchParams,
17
+ __bfSetServerEnvReader
16
18
  } from "@barefootjs/client/reactive";
17
19
 
18
20
  // src/profiler-events.ts
@@ -176,12 +178,23 @@ function findSiblingSlot(_el, _slotSelector) {
176
178
  function cleanupPortalPlaceholder(_portalId) {
177
179
  return browserOnly("cleanupPortalPlaceholder");
178
180
  }
181
+ // src/builtins.ts
182
+ function compiledAway(name) {
183
+ throw new Error(`[barefootjs] <${name}> is a compiler built-in and is compiled away. ` + `If you are seeing this at runtime, the JSX was rendered without going ` + `through the BarefootJS compiler — please report a bug.`);
184
+ }
185
+ function Async(_props) {
186
+ return compiledAway("Async");
187
+ }
188
+ function Region(_props) {
189
+ return compiledAway("Region");
190
+ }
179
191
  export {
180
192
  useContext,
181
193
  unwrap,
182
194
  untrack,
183
195
  splitProps,
184
196
  setProfilerSink,
197
+ searchParams,
185
198
  provideContext,
186
199
  onMount,
187
200
  onCleanup,
@@ -201,5 +214,8 @@ export {
201
214
  beginTurn,
202
215
  batch,
203
216
  __slot,
204
- __bfReportOutput
217
+ __bfSetServerEnvReader,
218
+ __bfReportOutput,
219
+ Region,
220
+ Async
205
221
  };
@@ -227,4 +227,31 @@ export declare function onMount(fn: () => void): void;
227
227
  * doubled() // 10
228
228
  */
229
229
  export declare function createMemo<T>(fn: () => T, __bfId?: string): Memo<T>;
230
+ /**
231
+ * Adapter/host hook: teach `@barefootjs/client` how to read the current
232
+ * request's environment values during SSR. The reader receives an env key
233
+ * (`'search'`, …) and returns the raw value, or `undefined` to defer (to the
234
+ * `globalThis` seam, else the empty default). Call once with a reader that
235
+ * resolves per-request.
236
+ */
237
+ export declare function __bfSetServerEnvReader(reader: ((key: string) => string | undefined) | null): void;
238
+ /**
239
+ * Reactive read of the current query string as `URLSearchParams`.
240
+ *
241
+ * ```tsx
242
+ * const sort = createMemo(() => searchParams().get('sort') ?? 'recent')
243
+ * ```
244
+ *
245
+ * A same-route, query-only navigation (`/list?sort=price`) driven by
246
+ * `@barefootjs/router` updates this signal and the URL **without a swap or
247
+ * re-hydration**. On the server it reflects the current request's query.
248
+ *
249
+ * Reactivity is **router-driven**: the signal is seeded once on first read and
250
+ * thereafter updated only through the `window.__bf_pushSearch` seam, which
251
+ * `startRouter()` drives (including on `popstate`). Without the router running
252
+ * — or after a non-router `history` change — the value is read-once; the seam
253
+ * name is shared with `@barefootjs/router` via `BF_SEAM_PUSH_SEARCH`, so the
254
+ * installer (here) and the pusher agree by construction.
255
+ */
256
+ export declare const searchParams: Reactive<() => URLSearchParams>;
230
257
  //# sourceMappingURL=reactive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../src/reactive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;CAAE,CAAA;AAE3D,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjB,uDAAuD;IACvD,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI;CAC1C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,IAAI,CAAA;AAClC,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,SAAS,CAAA;AAC7C,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;AAavC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACnD,mEAAmE;IACnE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1D,gFAAgF;IAChF,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7D,iDAAiD;IACjD,YAAY,CAAC,YAAY,EAAE,MA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,GAAG,CAAC,CAQzC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAWvC;AAaD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAwBnE;AAmCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,GACnD,IAAI,CAEN;AA4DD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,iCAKxB,CAAA"}
package/dist/reactive.js CHANGED
@@ -1,3 +1,89 @@
1
+ // ../shared/src/markers.ts
2
+ var BF_SEAM_PUSH_SEARCH = "__bf_pushSearch";
3
+ // ../shared/src/dom-prop.ts
4
+ var BOOLEAN_ATTRS = new Set([
5
+ "checked",
6
+ "disabled",
7
+ "readonly",
8
+ "selected",
9
+ "required",
10
+ "hidden",
11
+ "autofocus",
12
+ "autoplay",
13
+ "controls",
14
+ "loop",
15
+ "muted",
16
+ "open",
17
+ "multiple",
18
+ "novalidate",
19
+ "formnovalidate"
20
+ ]);
21
+ var SVG_XML_CAMEL_ATTRS = new Set([
22
+ "allowReorder",
23
+ "attributeName",
24
+ "attributeType",
25
+ "autoReverse",
26
+ "baseFrequency",
27
+ "baseProfile",
28
+ "calcMode",
29
+ "clipPathUnits",
30
+ "contentScriptType",
31
+ "contentStyleType",
32
+ "diffuseConstant",
33
+ "edgeMode",
34
+ "externalResourcesRequired",
35
+ "filterRes",
36
+ "filterUnits",
37
+ "glyphRef",
38
+ "gradientTransform",
39
+ "gradientUnits",
40
+ "kernelMatrix",
41
+ "kernelUnitLength",
42
+ "keyPoints",
43
+ "keySplines",
44
+ "keyTimes",
45
+ "lengthAdjust",
46
+ "limitingConeAngle",
47
+ "markerHeight",
48
+ "markerUnits",
49
+ "markerWidth",
50
+ "maskContentUnits",
51
+ "maskUnits",
52
+ "numOctaves",
53
+ "pathLength",
54
+ "patternContentUnits",
55
+ "patternTransform",
56
+ "patternUnits",
57
+ "pointsAtX",
58
+ "pointsAtY",
59
+ "pointsAtZ",
60
+ "preserveAlpha",
61
+ "preserveAspectRatio",
62
+ "primitiveUnits",
63
+ "refX",
64
+ "refY",
65
+ "repeatCount",
66
+ "repeatDur",
67
+ "requiredExtensions",
68
+ "requiredFeatures",
69
+ "specularConstant",
70
+ "specularExponent",
71
+ "spreadMethod",
72
+ "startOffset",
73
+ "stdDeviation",
74
+ "stitchTiles",
75
+ "surfaceScale",
76
+ "systemLanguage",
77
+ "tableValues",
78
+ "targetX",
79
+ "targetY",
80
+ "textLength",
81
+ "viewBox",
82
+ "viewTarget",
83
+ "xChannelSelector",
84
+ "yChannelSelector",
85
+ "zoomAndPan"
86
+ ]);
1
87
  // src/reactive.ts
2
88
  var profilerSink = null;
3
89
  var signalSeq = 0;
@@ -275,9 +361,44 @@ function createMemo(fn, __bfId) {
275
361
  }, id, "memo");
276
362
  return value;
277
363
  }
364
+ var serverEnvReader = null;
365
+ function __bfSetServerEnvReader(reader) {
366
+ serverEnvReader = reader;
367
+ }
368
+ function resolveServerEnv(key) {
369
+ if (serverEnvReader) {
370
+ const v = serverEnvReader(key);
371
+ if (v !== undefined)
372
+ return v;
373
+ }
374
+ const seam = globalThis.__bf_serverEnvReader;
375
+ return typeof seam === "function" ? seam(key) : undefined;
376
+ }
377
+ function createEnvSignal(key, readClient, parse, pushSeam) {
378
+ let getRaw = null;
379
+ function ensureClientSignal() {
380
+ if (!getRaw) {
381
+ const [get, set] = createSignal(readClient());
382
+ getRaw = get;
383
+ const w = window;
384
+ w[pushSeam] = (next) => {
385
+ set(next);
386
+ };
387
+ }
388
+ return getRaw();
389
+ }
390
+ return () => {
391
+ if (typeof window === "undefined") {
392
+ return parse(resolveServerEnv(key) ?? "");
393
+ }
394
+ return parse(ensureClientSignal());
395
+ };
396
+ }
397
+ var searchParams = createEnvSignal("search", () => window.location.search, (raw) => new URLSearchParams(raw), BF_SEAM_PUSH_SEARCH);
278
398
  export {
279
399
  untrack,
280
400
  setProfilerSink,
401
+ searchParams,
281
402
  onMount,
282
403
  onCleanup,
283
404
  endTurn,
@@ -288,5 +409,6 @@ export {
288
409
  createDisposableEffect,
289
410
  beginTurn,
290
411
  batch,
412
+ __bfSetServerEnvReader,
291
413
  __bfReportOutput
292
414
  };
@@ -97,4 +97,33 @@ export declare function rehydrateAll(): void;
97
97
  * // safe to read Counter's post-init DOM state
98
98
  */
99
99
  export declare function flushHydration(): void;
100
+ /**
101
+ * Re-hydrate only the scopes inside `root` (and `root` itself), in
102
+ * document order. Unlike `rehydrateAll()` — which schedules a walk over
103
+ * the *whole document* — this is a synchronous, subtree-scoped walk: its
104
+ * cost is O(scopes in `root`), not O(document).
105
+ *
106
+ * Intended for a client router that has just swapped a content region:
107
+ * the component registry is already populated from the initial load, so
108
+ * no deferral is needed; only the freshly inserted islands need to init.
109
+ */
110
+ export declare function rehydrateScope(root: Element): void;
111
+ /**
112
+ * Dispose every hydrated scope inside `root` (and `root` itself): runs
113
+ * each scope's `createRoot` dispose fn, tearing down its effects, memos,
114
+ * and `onCleanup` callbacks. Used by a client router before it removes a
115
+ * content region, so the outgoing islands release timers/listeners/
116
+ * subscriptions instead of leaking.
117
+ *
118
+ * Also resets the per-scope hydration marks so the *same* DOM nodes could
119
+ * be re-hydrated if they are ever re-inserted:
120
+ * - element scopes: their `hydratedScopes` entry (via `disposeOneScope`),
121
+ * - `bf-h` child scopes: their `hydratedScopes` entry (they have no own
122
+ * disposer — their reactive graph is owned by an ancestor root being
123
+ * disposed here),
124
+ * - comment scopes: the `__bfInitialized` flag on the `<!--bf-scope:-->`
125
+ * anchor (otherwise `hydrateCommentScope` short-circuits on the stale
126
+ * flag and never re-initializes the scope).
127
+ */
128
+ export declare function disposeScope(root: Element): void;
100
129
  //# sourceMappingURL=hydrate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/runtime/hydrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAS9C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEvE;AA8CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI,CAgB7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC"}
1
+ {"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/runtime/hydrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAS9C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEvE;AA8CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI,CAgB7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAalD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAiBhD"}
@@ -1,4 +1,4 @@
1
- export { createSignal, createEffect, createDisposableEffect, createMemo, createRoot, onCleanup, onMount, untrack, batch, setProfilerSink, beginTurn, endTurn, __bfReportOutput, type Reactive, type Signal, type Memo, type CleanupFn, type EffectFn, type ProfilerEventSink, type SubscriberKind, } from '@barefootjs/client/reactive';
1
+ export { createSignal, createEffect, createDisposableEffect, createMemo, createRoot, onCleanup, onMount, untrack, batch, setProfilerSink, beginTurn, endTurn, __bfReportOutput, searchParams, __bfSetServerEnvReader, type Reactive, type Signal, type Memo, type CleanupFn, type EffectFn, type ProfilerEventSink, type SubscriberKind, } from '@barefootjs/client/reactive';
2
2
  export { createRecordingSink, type ProfilerEvent, type ProfilerEventType, type RecordingSink, } from '../profiler-events.ts';
3
3
  export { splitProps } from '../split-props.ts';
4
4
  export { __slot, type SlotMarker } from '../slot.ts';
@@ -16,7 +16,7 @@ export { applyRestAttrs } from './apply-rest-attrs.ts';
16
16
  export { spreadAttrs } from './spread-attrs.ts';
17
17
  export { styleToCss } from './style.ts';
18
18
  export { findScope, find, $, $c, $t, qsa, qsaChildScope, qsaChildScopes, cssEscape } from './query.ts';
19
- export { hydrate, rehydrateAll, flushHydration, getRegisteredDef } from './hydrate.ts';
19
+ export { hydrate, rehydrateAll, rehydrateScope, disposeScope, flushHydration, getRegisteredDef } from './hydrate.ts';
20
20
  export { registerComponent, getComponentInit, initChild, upsertChild } from './registry.ts';
21
21
  export { insert, type BranchConfig, type BranchTemplateResult } from './insert.ts';
22
22
  export { __bfSlot } from './branch-slot.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts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,
10
10
  untrack as untrack3,
@@ -12,7 +12,9 @@ import {
12
12
  setProfilerSink,
13
13
  beginTurn,
14
14
  endTurn,
15
- __bfReportOutput as __bfReportOutput2
15
+ __bfReportOutput as __bfReportOutput2,
16
+ searchParams,
17
+ __bfSetServerEnvReader
16
18
  } from "@barefootjs/client/reactive";
17
19
 
18
20
  // src/profiler-events.ts
@@ -173,6 +175,9 @@ var BF_PLACEHOLDER = "data-bf-ph";
173
175
  var BF_ASYNC = "bf-async";
174
176
  var BF_ASYNC_RESOLVE = "bf-async-resolve";
175
177
  var BF_PARENT_SCOPE_PLACEHOLDER = "__BF_PARENT_SCOPE__";
178
+ var BF_SEAM_HYDRATE = "__bf_hydrate";
179
+ var BF_SEAM_HYDRATE_WITHIN = "__bf_hydrate_within";
180
+ var BF_SEAM_DISPOSE_WITHIN = "__bf_dispose_within";
176
181
  // ../shared/src/dom-prop.ts
177
182
  var BOOLEAN_ATTRS = new Set([
178
183
  "checked",
@@ -851,6 +856,7 @@ function upsertChild(parent, name, slotId, props, key, anchorScope) {
851
856
  }
852
857
 
853
858
  // src/runtime/hydrate.ts
859
+ import { createRoot } from "@barefootjs/client/reactive";
854
860
  var registeredDefs = new Map;
855
861
  function getRegisteredDef(name) {
856
862
  return registeredDefs.get(name);
@@ -899,6 +905,55 @@ function flushHydration() {
899
905
  rafScheduled = false;
900
906
  walkAllInDocumentOrder();
901
907
  }
908
+ function rehydrateScope(root) {
909
+ if (typeof document === "undefined")
910
+ return;
911
+ hydrateElementScope(root);
912
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT);
913
+ while (walker.nextNode()) {
914
+ const node = walker.currentNode;
915
+ if (node.nodeType === Node.ELEMENT_NODE) {
916
+ hydrateElementScope(node);
917
+ } else if (node.nodeType === Node.COMMENT_NODE) {
918
+ hydrateCommentScope(node);
919
+ }
920
+ }
921
+ }
922
+ function disposeScope(root) {
923
+ if (typeof document === "undefined")
924
+ return;
925
+ disposeOneScope(root);
926
+ clearChildScopeMark(root);
927
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT);
928
+ while (walker.nextNode()) {
929
+ const node = walker.currentNode;
930
+ if (node.nodeType === Node.ELEMENT_NODE) {
931
+ disposeOneScope(node);
932
+ clearChildScopeMark(node);
933
+ } else if (node.nodeType === Node.COMMENT_NODE) {
934
+ clearCommentScopeFlag(node);
935
+ }
936
+ }
937
+ }
938
+ function disposeOneScope(el) {
939
+ const dispose = scopeDisposers.get(el);
940
+ if (dispose) {
941
+ scopeDisposers.delete(el);
942
+ hydratedScopes.delete(el);
943
+ dispose();
944
+ }
945
+ }
946
+ function clearChildScopeMark(el) {
947
+ if (el.hasAttribute(BF_HOST))
948
+ hydratedScopes.delete(el);
949
+ }
950
+ function clearCommentScopeFlag(comment) {
951
+ if (!comment.nodeValue?.startsWith(BF_SCOPE_COMMENT_PREFIX))
952
+ return;
953
+ const flagged = comment;
954
+ if (flagged.__bfInitialized)
955
+ flagged.__bfInitialized = false;
956
+ }
902
957
  function walkAllInDocumentOrder() {
903
958
  if (typeof document === "undefined")
904
959
  return;
@@ -926,10 +981,14 @@ function parseProps(json, where) {
926
981
  return {};
927
982
  }
928
983
  }
984
+ var scopeDisposers = new WeakMap;
929
985
  function runInit(scope, def, props) {
930
986
  const prevScope = setCurrentScope(scope);
931
987
  try {
932
- def.init(scope, props);
988
+ createRoot((dispose) => {
989
+ scopeDisposers.set(scope, dispose);
990
+ def.init(scope, props);
991
+ });
933
992
  } finally {
934
993
  setCurrentScope(prevScope);
935
994
  }
@@ -1584,7 +1643,7 @@ function upsertChildItem(primaryEl, name, slotId, props, key, anchorScope) {
1584
1643
  return null;
1585
1644
  }
1586
1645
  // src/runtime/map-array.ts
1587
- import { createSignal, createEffect, createRoot } from "@barefootjs/client/reactive";
1646
+ import { createSignal, createEffect, createRoot as createRoot2 } from "@barefootjs/client/reactive";
1588
1647
  function findLoopMarkers2(container, markerId) {
1589
1648
  let start = null;
1590
1649
  let end = null;
@@ -1666,7 +1725,7 @@ function createItemScope(item, index, renderItem, existingPrimary, existingExtra
1666
1725
  let setItem;
1667
1726
  let extras = [];
1668
1727
  let startMarker = null;
1669
- createRoot((d) => {
1728
+ createRoot2((d) => {
1670
1729
  dispose = d;
1671
1730
  const [itemAccessor, itemSetter] = createSignal(item);
1672
1731
  setItem = itemSetter;
@@ -1852,7 +1911,7 @@ function createAnchorScope(item, index, key, renderItem, existingAnchor) {
1852
1911
  let dispose;
1853
1912
  let setItem;
1854
1913
  let returned;
1855
- createRoot((d) => {
1914
+ createRoot2((d) => {
1856
1915
  dispose = d;
1857
1916
  const [itemAccessor, itemSetter] = createSignal(item);
1858
1917
  setItem = itemSetter;
@@ -2480,7 +2539,9 @@ function setupStreaming() {
2480
2539
  return;
2481
2540
  const w = window;
2482
2541
  w.__bf_swap = __bf_swap;
2483
- w.__bf_hydrate = rehydrateAll;
2542
+ w[BF_SEAM_HYDRATE] = rehydrateAll;
2543
+ w[BF_SEAM_HYDRATE_WITHIN] = rehydrateScope;
2544
+ w[BF_SEAM_DISPOSE_WITHIN] = disposeScope;
2484
2545
  }
2485
2546
  export {
2486
2547
  useContext,
@@ -2495,8 +2556,10 @@ export {
2495
2556
  setupStreaming,
2496
2557
  setProfilerSink,
2497
2558
  setCurrentScope,
2559
+ searchParams,
2498
2560
  renderChild,
2499
2561
  render,
2562
+ rehydrateScope,
2500
2563
  rehydrateAll,
2501
2564
  registerTemplate,
2502
2565
  registerComponent,
@@ -2533,9 +2596,10 @@ export {
2533
2596
  escapeText,
2534
2597
  escapeAttr,
2535
2598
  endTurn,
2599
+ disposeScope,
2536
2600
  cssEscape,
2537
2601
  createSignal2 as createSignal,
2538
- createRoot2 as createRoot,
2602
+ createRoot3 as createRoot,
2539
2603
  createRecordingSink,
2540
2604
  createPortal,
2541
2605
  createMemo,
@@ -2551,6 +2615,7 @@ export {
2551
2615
  __bf_swap,
2552
2616
  __bfText,
2553
2617
  __bfSlot,
2618
+ __bfSetServerEnvReader,
2554
2619
  __bfReportOutput2 as __bfReportOutput,
2555
2620
  $t,
2556
2621
  $c,