@barefootjs/shared 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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { BF_SCOPE, BF_SLOT, BF_HOST, BF_AT, BF_ROOT, BF_PROPS, BF_COND, BF_ITEM, BF_PORTAL_OWNER, BF_PORTAL_ID, BF_PORTAL_PLACEHOLDER, BF_PARENT_OWNED_PREFIX, BF_SCOPE_COMMENT_PREFIX, BF_LOOP_START, BF_LOOP_END, BF_LOOP_ITEM, loopItemMarker, loopStartMarker, loopEndMarker, BF_KEY, BF_KEY_PREFIX, BF_PLACEHOLDER, BF_ASYNC, BF_ASYNC_RESOLVE, BF_PARENT_SCOPE_PLACEHOLDER, } from './markers.ts';
1
+ export { BF_SCOPE, BF_SLOT, BF_HOST, BF_AT, BF_ROOT, BF_PROPS, BF_COND, BF_ITEM, BF_PORTAL_OWNER, BF_PORTAL_ID, BF_PORTAL_PLACEHOLDER, BF_PARENT_OWNED_PREFIX, BF_SCOPE_COMMENT_PREFIX, BF_LOOP_START, BF_LOOP_END, BF_LOOP_ITEM, loopItemMarker, loopStartMarker, loopEndMarker, BF_KEY, BF_KEY_PREFIX, BF_PLACEHOLDER, BF_ASYNC, BF_ASYNC_RESOLVE, BF_REGION, BF_PARENT_SCOPE_PLACEHOLDER, BF_SEAM_HYDRATE, BF_SEAM_HYDRATE_WITHIN, BF_SEAM_DISPOSE_WITHIN, BF_SEAM_PUSH_SEARCH, } from './markers.ts';
2
2
  export { classifyDOMProp, toHTMLAttrName, toHTMLAttrNameRuntime, isBooleanAttr, isEventProp, BOOLEAN_ATTRS, } from './dom-prop.ts';
3
3
  export type { DOMPropKind, DOMPropClassification } from './dom-prop.ts';
4
4
  export type { ProfilerEvent, ProfilerEventType, ProfilerSubscriberKind, } from './profiler-events.ts';
package/dist/index.js CHANGED
@@ -29,7 +29,12 @@ var BF_KEY_PREFIX = "data-key-";
29
29
  var BF_PLACEHOLDER = "data-bf-ph";
30
30
  var BF_ASYNC = "bf-async";
31
31
  var BF_ASYNC_RESOLVE = "bf-async-resolve";
32
+ var BF_REGION = "bf-region";
32
33
  var BF_PARENT_SCOPE_PLACEHOLDER = "__BF_PARENT_SCOPE__";
34
+ var BF_SEAM_HYDRATE = "__bf_hydrate";
35
+ var BF_SEAM_HYDRATE_WITHIN = "__bf_hydrate_within";
36
+ var BF_SEAM_DISPOSE_WITHIN = "__bf_dispose_within";
37
+ var BF_SEAM_PUSH_SEARCH = "__bf_pushSearch";
33
38
  // src/dom-prop.ts
34
39
  var BOOLEAN_ATTRS = new Set([
35
40
  "checked",
@@ -206,9 +211,14 @@ export {
206
211
  classifyDOMProp,
207
212
  BOOLEAN_ATTRS,
208
213
  BF_SLOT,
214
+ BF_SEAM_PUSH_SEARCH,
215
+ BF_SEAM_HYDRATE_WITHIN,
216
+ BF_SEAM_HYDRATE,
217
+ BF_SEAM_DISPOSE_WITHIN,
209
218
  BF_SCOPE_COMMENT_PREFIX,
210
219
  BF_SCOPE,
211
220
  BF_ROOT,
221
+ BF_REGION,
212
222
  BF_PROPS,
213
223
  BF_PORTAL_PLACEHOLDER,
214
224
  BF_PORTAL_OWNER,
package/dist/markers.d.ts CHANGED
@@ -109,6 +109,17 @@ export declare const BF_PLACEHOLDER = "data-bf-ph";
109
109
  export declare const BF_ASYNC = "bf-async";
110
110
  /** Async resolve template: `<template bf-async-resolve="a0">` */
111
111
  export declare const BF_ASYNC_RESOLVE = "bf-async-resolve";
112
+ /**
113
+ * Page-lifecycle boundary emitted for an authored `<Region>`:
114
+ * `bf-region="<file scope>:<index>"`
115
+ *
116
+ * Everything outside a `[bf-region]` persists across a client navigation;
117
+ * everything inside is the unit the router disposes, re-loads, and
118
+ * re-hydrates. The value is deterministic (the layout file's `computeFileScope`
119
+ * hash + a per-file index), so a layout that compiles to one shared partial
120
+ * emits the *same* id across every page — which is what the router matches on.
121
+ */
122
+ export declare const BF_REGION = "bf-region";
112
123
  /**
113
124
  * Sentinel value embedded by the compiler on hoisted JSX children that
114
125
  * need a `bf-s` scope marker. The runtime `renderChild` substitutes the
@@ -126,3 +137,11 @@ export declare const BF_ASYNC_RESOLVE = "bf-async-resolve";
126
137
  * - CSR conformance harness (`@barefootjs/adapter-tests/src/csr-render.ts`)
127
138
  */
128
139
  export declare const BF_PARENT_SCOPE_PLACEHOLDER = "__BF_PARENT_SCOPE__";
140
+ /** Re-hydrate the whole document. `window[BF_SEAM_HYDRATE]()`. */
141
+ export declare const BF_SEAM_HYDRATE = "__bf_hydrate";
142
+ /** Re-hydrate only a swapped subtree. `window[BF_SEAM_HYDRATE_WITHIN](root)`. */
143
+ export declare const BF_SEAM_HYDRATE_WITHIN = "__bf_hydrate_within";
144
+ /** Dispose the islands in a subtree. `window[BF_SEAM_DISPOSE_WITHIN](root)`. */
145
+ export declare const BF_SEAM_DISPOSE_WITHIN = "__bf_dispose_within";
146
+ /** Push a new query string into the `searchParams()` env signal. `window[BF_SEAM_PUSH_SEARCH](search)`. */
147
+ export declare const BF_SEAM_PUSH_SEARCH = "__bf_pushSearch";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/shared",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Shared constants for BarefootJS compiler and runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -23,7 +23,12 @@ export {
23
23
  BF_PLACEHOLDER,
24
24
  BF_ASYNC,
25
25
  BF_ASYNC_RESOLVE,
26
+ BF_REGION,
26
27
  BF_PARENT_SCOPE_PLACEHOLDER,
28
+ BF_SEAM_HYDRATE,
29
+ BF_SEAM_HYDRATE_WITHIN,
30
+ BF_SEAM_DISPOSE_WITHIN,
31
+ BF_SEAM_PUSH_SEARCH,
27
32
  } from './markers.ts'
28
33
 
29
34
  export {
package/src/markers.ts CHANGED
@@ -168,6 +168,22 @@ export const BF_ASYNC = 'bf-async'
168
168
  /** Async resolve template: `<template bf-async-resolve="a0">` */
169
169
  export const BF_ASYNC_RESOLVE = 'bf-async-resolve'
170
170
 
171
+ // ---------------------------------------------------------------------------
172
+ // Region (page-lifecycle boundary, spec/router.md)
173
+ // ---------------------------------------------------------------------------
174
+
175
+ /**
176
+ * Page-lifecycle boundary emitted for an authored `<Region>`:
177
+ * `bf-region="<file scope>:<index>"`
178
+ *
179
+ * Everything outside a `[bf-region]` persists across a client navigation;
180
+ * everything inside is the unit the router disposes, re-loads, and
181
+ * re-hydrates. The value is deterministic (the layout file's `computeFileScope`
182
+ * hash + a per-file index), so a layout that compiles to one shared partial
183
+ * emits the *same* id across every page — which is what the router matches on.
184
+ */
185
+ export const BF_REGION = 'bf-region'
186
+
171
187
  // ---------------------------------------------------------------------------
172
188
  // Hoisted-children scope placeholder (#1320)
173
189
  // ---------------------------------------------------------------------------
@@ -189,3 +205,25 @@ export const BF_ASYNC_RESOLVE = 'bf-async-resolve'
189
205
  * - CSR conformance harness (`@barefootjs/adapter-tests/src/csr-render.ts`)
190
206
  */
191
207
  export const BF_PARENT_SCOPE_PLACEHOLDER = '__BF_PARENT_SCOPE__'
208
+
209
+ // ---------------------------------------------------------------------------
210
+ // Client-runtime seam names (router ↔ client `window` bridge)
211
+ // ---------------------------------------------------------------------------
212
+ //
213
+ // The optional client router (`@barefootjs/router`) reaches the client runtime
214
+ // through a few `window.__bf_*` function properties. The runtime *installs*
215
+ // them (`@barefootjs/client/runtime/streaming.ts`, `@barefootjs/client`'s
216
+ // `searchParams`) and the router *reads* them (`@barefootjs/router/seams.ts`),
217
+ // in different packages — so the names live here as the single source of truth.
218
+ // A rename is then a compile error on both sides instead of a silently-broken
219
+ // seam (the router would otherwise fall back to a dynamic import and mask the
220
+ // mismatch).
221
+
222
+ /** Re-hydrate the whole document. `window[BF_SEAM_HYDRATE]()`. */
223
+ export const BF_SEAM_HYDRATE = '__bf_hydrate'
224
+ /** Re-hydrate only a swapped subtree. `window[BF_SEAM_HYDRATE_WITHIN](root)`. */
225
+ export const BF_SEAM_HYDRATE_WITHIN = '__bf_hydrate_within'
226
+ /** Dispose the islands in a subtree. `window[BF_SEAM_DISPOSE_WITHIN](root)`. */
227
+ export const BF_SEAM_DISPOSE_WITHIN = '__bf_dispose_within'
228
+ /** Push a new query string into the `searchParams()` env signal. `window[BF_SEAM_PUSH_SEARCH](search)`. */
229
+ export const BF_SEAM_PUSH_SEARCH = '__bf_pushSearch'