@brendanbank/atrium-host-bundle-utils 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -97,8 +97,8 @@ or hosts that want axios-shaped retry).
97
97
 
98
98
  ## Versioning
99
99
 
100
- The package version tracks atrium's image version. Pin `^0.15` for
101
- "compatible with atrium 0.15.x"; bump together with the atrium image
100
+ The package version tracks atrium's image version. Pin `^0.16` for
101
+ "compatible with atrium 0.16.x"; bump together with the atrium image
102
102
  to pick up new registry slots and SDK helpers.
103
103
 
104
104
  ## See also
@@ -83,4 +83,119 @@ export declare function usePerm(): (code: string) => boolean;
83
83
  /** Convenience: does the signed-in user hold the named role? Returns
84
84
  * `false` while loading and when signed out, mirroring `usePerm`. */
85
85
  export declare function useRole(code: string): boolean;
86
+ /** Snapshot of atrium's current router location, mirrored on
87
+ * `window.location`. The fields match react-router's `Location` shape
88
+ * so a host already familiar with `useLocation()` reads the same
89
+ * contract here. */
90
+ export type AtriumLocation = {
91
+ pathname: string;
92
+ search: string;
93
+ hash: string;
94
+ /** Monotonic per-event counter atrium increments on every
95
+ * `atrium:locationchange` dispatch. Use this in effect deps when
96
+ * the effect should re-run on every navigation event, including a
97
+ * re-click of the same href that react-router would otherwise
98
+ * no-op (e.g. clicking the same notification bell item twice — see
99
+ * atrium #81). Without it, `useEffect(…, [search])` stays put
100
+ * because `search` is structurally identical between the two
101
+ * events. Always present from atrium 0.16+; `0` on older images
102
+ * that don't dispatch a nonce. */
103
+ nonce: number;
104
+ };
105
+ /** Subscribe to atrium's react-router location changes from inside a
106
+ * host bundle's React tree. Returns `{ pathname, search, hash, nonce }`
107
+ * — the first three mirror `window.location`; `nonce` is a monotonic
108
+ * counter atrium increments on every dispatch.
109
+ *
110
+ * Bridges the `atrium:locationchange` CustomEvent atrium dispatches
111
+ * on `window` through `useSyncExternalStore`, so multiple subscribers
112
+ * in the same tree share one event listener and the snapshot is
113
+ * referentially stable when nothing changed.
114
+ *
115
+ * ```tsx
116
+ * function FocusDrawer() {
117
+ * const { search } = useAtriumLocation();
118
+ * const focus = new URLSearchParams(search).get('focus');
119
+ * return focus ? <BookingDetail id={focus} /> : null;
120
+ * }
121
+ * ```
122
+ *
123
+ * When you want the effect to re-run on **every** navigation event —
124
+ * including the same-URL re-click case (clicking the same notification
125
+ * bell item twice — atrium #81) — include `nonce` in the deps:
126
+ *
127
+ * ```tsx
128
+ * function FocusDrawer() {
129
+ * const { search, nonce } = useAtriumLocation();
130
+ * useEffect(() => {
131
+ * const focus = new URLSearchParams(search).get('focus');
132
+ * if (focus) openDrawer(focus);
133
+ * // Without `nonce` here, React dedupes on `[search]` so a second
134
+ * // click of the same href doesn't re-open the drawer.
135
+ * }, [search, nonce]);
136
+ * }
137
+ * ```
138
+ *
139
+ * Hosts that don't use React (or want to handle navigation outside a
140
+ * component) can subscribe directly:
141
+ * `window.addEventListener('atrium:locationchange', e => …)`. The
142
+ * event's `detail` carries the same `{pathname, search, hash, nonce}`
143
+ * shape.
144
+ *
145
+ * Available on atrium 0.15.3+; `nonce` lands in 0.16+. On older atrium
146
+ * images the hook still works but only reflects the initial
147
+ * `window.location` (and `nonce` stays at 0). Hosts that need to
148
+ * support pre-0.15.3 atrium can read `window.__ATRIUM_VERSION__` and
149
+ * fall back to `useLocation()` from a wrapper that remounts on route
150
+ * swaps. */
151
+ export declare function useAtriumLocation(): AtriumLocation;
152
+ /** Programmatic navigate that works from inside a host bundle's React
153
+ * tree, where `useNavigate()` from react-router isn't available
154
+ * (atrium owns the router context; the host tree only meets atrium's
155
+ * at the wrapper element produced by `makeWrapperElement`).
156
+ *
157
+ * Returns a stable `navigate(href, opts?)` function that updates the
158
+ * URL via `pushState` / `replaceState` and re-syncs atrium's
159
+ * react-router by dispatching a synthesized `popstate`. Atrium then
160
+ * fires its own `atrium:locationchange` so other host listeners
161
+ * observe the change.
162
+ *
163
+ * The primary use case is **cleaning up a deep-link query param after
164
+ * the host has consumed it** — a flow that previously had no host-
165
+ * observable solution (a raw `history.replaceState` desyncs atrium's
166
+ * router from the browser URL). See atrium #81.
167
+ *
168
+ * ```tsx
169
+ * function FocusDrawer() {
170
+ * const { search } = useAtriumLocation();
171
+ * const navigate = useAtriumNavigate();
172
+ * const focus = new URLSearchParams(search).get('focus');
173
+ * return focus ? (
174
+ * <Drawer
175
+ * opened
176
+ * onClose={() => {
177
+ * // Strip the param so a second click of the same bell item
178
+ * // (which navigates to the same href) is a real change from
179
+ * // atrium's perspective and re-fires the locationchange.
180
+ * const next = new URLSearchParams(search);
181
+ * next.delete('focus');
182
+ * navigate(`/?${next.toString()}`, { replace: true });
183
+ * }}
184
+ * >
185
+ * <BookingDetail id={focus} />
186
+ * </Drawer>
187
+ * ) : null;
188
+ * }
189
+ * ```
190
+ *
191
+ * Available since atrium 0.16. The hook works on older images too —
192
+ * it doesn't depend on any atrium-side surface — but on pre-0.16 the
193
+ * resulting `atrium:locationchange` event won't carry a `nonce`. */
194
+ export declare function useAtriumNavigate(): (href: string, opts?: {
195
+ replace?: boolean;
196
+ }) => void;
197
+ /** Test-only: drop the cached snapshot so the next `getSnapshot` reads
198
+ * `window.location` fresh. Production code never calls this — the
199
+ * cache is updated by the event subscription. */
200
+ export declare function __resetAtriumLocationCacheForTests(): void;
86
201
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS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,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KACzB,IAAI,CAeR;AAED;;kDAEkD;AAClD,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD"}
@@ -21,7 +21,7 @@
21
21
  * intended state — atrium clears its cache on logout via `qc.clear()`,
22
22
  * and a shared client would lose host queries the user still wants.
23
23
  */
24
- import { createContext, createElement, useCallback, useContext, useMemo, } from 'react';
24
+ import { createContext, createElement, useCallback, useContext, useMemo, useSyncExternalStore, } from 'react';
25
25
  import { QueryClientProvider, useQuery, } from '@tanstack/react-query';
26
26
  export { __atrium_t__ } from '../i18n';
27
27
  const ME_CONTEXT_PATH = '/users/me/context';
@@ -120,4 +120,180 @@ export function useRole(code) {
120
120
  const { data: me } = useMe();
121
121
  return (me?.roles ?? []).includes(code);
122
122
  }
123
+ const ATRIUM_LOCATION_EVENT = 'atrium:locationchange';
124
+ const SSR_LOCATION = {
125
+ pathname: '/',
126
+ search: '',
127
+ hash: '',
128
+ nonce: 0,
129
+ };
130
+ // Module-level cache so `useSyncExternalStore.getSnapshot` returns a
131
+ // referentially-stable object across renders — re-creating it every
132
+ // call would cause React to tear-loop the subscriber. The cache is
133
+ // refreshed only when an `atrium:locationchange` event lands or, on
134
+ // the first read, lazily from `window.location`.
135
+ let cachedLocation = null;
136
+ function readWindowLocation() {
137
+ if (typeof window === 'undefined')
138
+ return SSR_LOCATION;
139
+ return {
140
+ pathname: window.location.pathname,
141
+ search: window.location.search,
142
+ hash: window.location.hash,
143
+ // No event has been observed yet, so we have no atrium-supplied
144
+ // nonce. Zero is the documented "no nonce yet" value.
145
+ nonce: 0,
146
+ };
147
+ }
148
+ function getLocationSnapshot() {
149
+ if (cachedLocation === null)
150
+ cachedLocation = readWindowLocation();
151
+ return cachedLocation;
152
+ }
153
+ function getServerLocationSnapshot() {
154
+ return SSR_LOCATION;
155
+ }
156
+ function subscribeLocation(onChange) {
157
+ if (typeof window === 'undefined')
158
+ return () => { };
159
+ const handler = (e) => {
160
+ const detail = e
161
+ .detail;
162
+ if (detail &&
163
+ typeof detail.pathname === 'string' &&
164
+ typeof detail.search === 'string' &&
165
+ typeof detail.hash === 'string') {
166
+ cachedLocation = {
167
+ pathname: detail.pathname,
168
+ search: detail.search,
169
+ hash: detail.hash,
170
+ // ``nonce`` was added to the event detail in atrium 0.16
171
+ // (#81). Older images dispatch the event without it; default
172
+ // to 0 so the field is always a number.
173
+ nonce: typeof detail.nonce === 'number' ? detail.nonce : 0,
174
+ };
175
+ }
176
+ else {
177
+ cachedLocation = readWindowLocation();
178
+ }
179
+ onChange();
180
+ };
181
+ window.addEventListener(ATRIUM_LOCATION_EVENT, handler);
182
+ return () => window.removeEventListener(ATRIUM_LOCATION_EVENT, handler);
183
+ }
184
+ /** Subscribe to atrium's react-router location changes from inside a
185
+ * host bundle's React tree. Returns `{ pathname, search, hash, nonce }`
186
+ * — the first three mirror `window.location`; `nonce` is a monotonic
187
+ * counter atrium increments on every dispatch.
188
+ *
189
+ * Bridges the `atrium:locationchange` CustomEvent atrium dispatches
190
+ * on `window` through `useSyncExternalStore`, so multiple subscribers
191
+ * in the same tree share one event listener and the snapshot is
192
+ * referentially stable when nothing changed.
193
+ *
194
+ * ```tsx
195
+ * function FocusDrawer() {
196
+ * const { search } = useAtriumLocation();
197
+ * const focus = new URLSearchParams(search).get('focus');
198
+ * return focus ? <BookingDetail id={focus} /> : null;
199
+ * }
200
+ * ```
201
+ *
202
+ * When you want the effect to re-run on **every** navigation event —
203
+ * including the same-URL re-click case (clicking the same notification
204
+ * bell item twice — atrium #81) — include `nonce` in the deps:
205
+ *
206
+ * ```tsx
207
+ * function FocusDrawer() {
208
+ * const { search, nonce } = useAtriumLocation();
209
+ * useEffect(() => {
210
+ * const focus = new URLSearchParams(search).get('focus');
211
+ * if (focus) openDrawer(focus);
212
+ * // Without `nonce` here, React dedupes on `[search]` so a second
213
+ * // click of the same href doesn't re-open the drawer.
214
+ * }, [search, nonce]);
215
+ * }
216
+ * ```
217
+ *
218
+ * Hosts that don't use React (or want to handle navigation outside a
219
+ * component) can subscribe directly:
220
+ * `window.addEventListener('atrium:locationchange', e => …)`. The
221
+ * event's `detail` carries the same `{pathname, search, hash, nonce}`
222
+ * shape.
223
+ *
224
+ * Available on atrium 0.15.3+; `nonce` lands in 0.16+. On older atrium
225
+ * images the hook still works but only reflects the initial
226
+ * `window.location` (and `nonce` stays at 0). Hosts that need to
227
+ * support pre-0.15.3 atrium can read `window.__ATRIUM_VERSION__` and
228
+ * fall back to `useLocation()` from a wrapper that remounts on route
229
+ * swaps. */
230
+ export function useAtriumLocation() {
231
+ return useSyncExternalStore(subscribeLocation, getLocationSnapshot, getServerLocationSnapshot);
232
+ }
233
+ /** Programmatic navigate that works from inside a host bundle's React
234
+ * tree, where `useNavigate()` from react-router isn't available
235
+ * (atrium owns the router context; the host tree only meets atrium's
236
+ * at the wrapper element produced by `makeWrapperElement`).
237
+ *
238
+ * Returns a stable `navigate(href, opts?)` function that updates the
239
+ * URL via `pushState` / `replaceState` and re-syncs atrium's
240
+ * react-router by dispatching a synthesized `popstate`. Atrium then
241
+ * fires its own `atrium:locationchange` so other host listeners
242
+ * observe the change.
243
+ *
244
+ * The primary use case is **cleaning up a deep-link query param after
245
+ * the host has consumed it** — a flow that previously had no host-
246
+ * observable solution (a raw `history.replaceState` desyncs atrium's
247
+ * router from the browser URL). See atrium #81.
248
+ *
249
+ * ```tsx
250
+ * function FocusDrawer() {
251
+ * const { search } = useAtriumLocation();
252
+ * const navigate = useAtriumNavigate();
253
+ * const focus = new URLSearchParams(search).get('focus');
254
+ * return focus ? (
255
+ * <Drawer
256
+ * opened
257
+ * onClose={() => {
258
+ * // Strip the param so a second click of the same bell item
259
+ * // (which navigates to the same href) is a real change from
260
+ * // atrium's perspective and re-fires the locationchange.
261
+ * const next = new URLSearchParams(search);
262
+ * next.delete('focus');
263
+ * navigate(`/?${next.toString()}`, { replace: true });
264
+ * }}
265
+ * >
266
+ * <BookingDetail id={focus} />
267
+ * </Drawer>
268
+ * ) : null;
269
+ * }
270
+ * ```
271
+ *
272
+ * Available since atrium 0.16. The hook works on older images too —
273
+ * it doesn't depend on any atrium-side surface — but on pre-0.16 the
274
+ * resulting `atrium:locationchange` event won't carry a `nonce`. */
275
+ export function useAtriumNavigate() {
276
+ return useCallback((href, opts) => {
277
+ if (typeof window === 'undefined')
278
+ return;
279
+ if (opts?.replace) {
280
+ window.history.replaceState(window.history.state, '', href);
281
+ }
282
+ else {
283
+ window.history.pushState(window.history.state, '', href);
284
+ }
285
+ // React-router's BrowserHistory subscribes to ``popstate`` for
286
+ // back/forward navigation. Synthesizing one here makes it re-read
287
+ // ``window.location`` and update its internal state, which in turn
288
+ // re-renders atrium's NavigationBridge and dispatches a fresh
289
+ // ``atrium:locationchange`` with a new monotonic nonce.
290
+ window.dispatchEvent(new PopStateEvent('popstate'));
291
+ }, []);
292
+ }
293
+ /** Test-only: drop the cached snapshot so the next `getSnapshot` reads
294
+ * `window.location` fresh. Production code never calls this — the
295
+ * cache is updated by the event subscription. */
296
+ export function __resetAtriumLocationCacheForTests() {
297
+ cachedLocation = null;
298
+ }
123
299
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,wCAAwC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,GAER,MAAM,OAAO,CAAC;AACf,OAAO,EACL,mBAAmB,EACnB,QAAQ,GAGT,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C,KAAK,UAAU,uBAAuB;IACpC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,eAAe,EAAE;QACvC,WAAW,EAAE,SA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WAAW,CAAC,CAAC,IAAY,EAAE,IAA4B,EAAE,EAAE;QAChE,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;QACD,+DAA+D;QAC/D,kEAAkE;QAClE,mEAAmE;QACnE,8DAA8D;QAC9D,wDAAwD;QACxD,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACtD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;kDAEkD;AAClD,MAAM,UAAU,kCAAkC;IAChD,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brendanbank/atrium-host-bundle-utils",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Runtime helpers, Vite preset, and React hooks for atrium host bundles. Wraps the dual-tree mount pattern, the host-bundle Vite library config, and the /users/me/context hook so a host's main.tsx is ~10 lines of registration calls.",
5
5
  "license": "BSD-2-Clause",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@brendanbank/atrium-host-types": "0.15.2"
28
+ "@brendanbank/atrium-host-types": "0.16.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@tanstack/react-query": "^5.0.0",