@ai-matrx/summon 0.1.9 → 0.1.11

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/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.11
4
+
5
+ UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
+ Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/summon/src`.
7
+
8
+ ## 0.1.10
9
+
10
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 33bf3a23be 24a38ba927 -- apps/shared/summon/src`
11
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
12
+
3
13
  ## 0.1.9
14
+
15
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
16
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
17
+ Diff: `git diff b3962adfda 33bf3a23be -- apps/shared/summon/src`
18
+
19
+ Changed shipped source files (3):
20
+ - `apps/shared/summon/src/core/augment.ts`
21
+ - `apps/shared/summon/src/core/types.ts`
22
+ - `apps/shared/summon/src/index.ts`
23
+
24
+ ## 0.1.8
4
25
  ### Unreleased
5
26
 
6
27
  - **New: `./open` and `./root` — a page pays next to nothing until something opens.** `./open` (framework-free) holds the action creators (plain objects carrying the slices' own type strings: `openOverlay`, `closeOverlay`, `toggleOverlay`, `closeAllInstancesOfOverlay`, `closeOverlaysBoundToPage`, `closeAllOverlays`, `pruneStaleInstances`, `focusWindow`, `restoreWindow`, `toggleWindowsHidden`, `restoreAll`, `minimizeAll`), selectors that read "closed" while the slices are absent, the registry, ports, and `createSummonGate()`. `./root` holds `<SummonRoot store runtime …settings>`, the store hooks, `defineOverlay` and the instance context. The gate is one middleware in a host store: the store carries no summon slice or middleware; the first summon action queues and starts ONE `import()` of the core, which installs itself on evaluation (injects the slices through the host's `attachReducer` inject, adds the close lifecycle + render watchdog, replays the queue). Any module that imports the core statically (the window section, links, persistence) installs it before it renders. `<SummonRoot>` records the host settings (ports, renderWrapper, errorReportExtras, windows) once; `useSummonPorts`, `useSummonConfig` and `useWindowConfig` fall back to them when no provider is above, so a page's own WindowPanel and the lazily loaded host need no provider. Callback-aware opens reserve their event channel id and the handles registry arrives with that first open (`openPendingEventChannel`). Measured in AI Matrx: summon first load per route 73 KB min / 23 KB gz before. Guards: `src/importCost.test.ts` (`./open`/`./root` reach no slice, middleware, react section, window or handles), `src/open/gate.test.ts`, `src/open/actions.parity.test.ts`, `src/root/summonRoot.test.tsx`. Consumer action: none for hosts that mount `summonReducers` or use `<SummonProvider>`; to drop summon from first load, mount `createSummonGate()` + `<SummonRoot>` instead and import openers/selectors from `./open`, `defineOverlay` from `./root`.
package/README.md CHANGED
@@ -201,6 +201,30 @@ Pass the same `ports` object to both. The overlays slice keys are fixed. Without
201
201
 
202
202
  Provider knobs: `fallbacks` (`loading`, `error` components), `errorReportExtras` (extra controls in the error card), `renderWrapper` (wrap every rendered overlay), `keepAliveLimit` (8), `importTimeoutMs` (12 s; a render module that has not loaded becomes a `ChunkLoadError` with Try again), `stallWarnMs` (10 s).
203
203
 
204
+ ### Pay only when something opens: the gate
205
+
206
+ A large app keeps summon out of every route's first load: the store carries no summon slice or
207
+ middleware, and the root mounts only `<SummonRoot>`.
208
+
209
+ ```tsx
210
+ import { configureStore } from "@reduxjs/toolkit";
211
+ import { createSummonGate } from "@ai-matrx/summon/open";
212
+ import { SummonRoot } from "@ai-matrx/summon/root";
213
+
214
+ const gate = createSummonGate({ ports });
215
+ const root = createInjectableRootReducer(); // your combineReducers wrapper with an inject(reducers)
216
+ gate.attachReducer((reducers) => root.inject(reducers));
217
+ export const store = configureStore({ reducer: root, middleware: (g) => g().concat(gate.middleware) });
218
+
219
+ <SummonRoot store={store} ports={ports} runtime={() => import("./WindowRuntime")}>{app}</SummonRoot>;
220
+ ```
221
+
222
+ Openers and selectors come from `./open`, `defineOverlay` from `./root`. The first summon action is
223
+ queued and starts one `import()` of the core, which injects the slices, adds the middleware and
224
+ replays the queue; a module that imports the core statically (a page's `WindowPanel`) installs it
225
+ before it renders. `runtime` (tray sync, router port) mounts once the core is installed.
226
+ `prefetchSummonRuntime()` starts the load early (idle, pointer intent).
227
+
204
228
  ## Ports
205
229
 
206
230
  Every port has a working default, so a bare host needs none. Override only what you have; pass them as `ports` on the provider (a partial object).
@@ -324,6 +324,19 @@ declare const minimizeAll: Creator<[payload: {
324
324
  viewportWidth: number;
325
325
  viewportHeight: number;
326
326
  }>;
327
+ interface UrlSyncEntryPayload {
328
+ typeKey: string;
329
+ instanceId: string;
330
+ args?: Readonly<Record<string, string>>;
331
+ }
332
+ declare const registerSyncEntry: Creator<[payload: UrlSyncEntryPayload], UrlSyncEntryPayload>;
333
+ declare const unregisterSyncEntry: Creator<[payload: {
334
+ typeKey: string;
335
+ instanceId: string;
336
+ }], {
337
+ typeKey: string;
338
+ instanceId: string;
339
+ }>;
327
340
  /** Every slice key the summon reducers own; an action under one of them needs the runtime. */
328
341
  declare const SUMMON_SLICE_KEYS: readonly ["overlays", "windowManager", "urlSync", "overlayState"];
329
342
  declare function isSummonAction(action: unknown): action is {
@@ -362,6 +375,15 @@ declare const selectWindowsHidden: (state: {
362
375
  windowsHidden: boolean;
363
376
  };
364
377
  }) => boolean;
378
+ interface WindowLike {
379
+ readonly zIndex: number;
380
+ }
381
+ /** Every registered window, topmost first (empty before the runtime is installed). Memoized on the map. */
382
+ declare function selectAllWindows<W extends WindowLike = WindowLike>(state: {
383
+ windowManager?: {
384
+ windows: Record<string, W>;
385
+ };
386
+ }): readonly W[];
365
387
 
366
388
  /** What the core hands the gate when it loads. */
367
389
  interface SummonCore {
@@ -394,4 +416,4 @@ interface CreateSummonGateOptions {
394
416
  }
395
417
  declare function createSummonGate(options?: CreateSummonGateOptions): SummonGate;
396
418
 
397
- export { locationRouter as $, type AnyOverlayMeta as A, closeOverlay as B, type CloseOverlaysBoundToPagePayload as C, DEFAULT_INSTANCE_ID as D, type ErrorSinkPort as E, closeOverlaysBoundToPage as F, consoleErrorSink as G, consoleNotify as H, type InstanceKey as I, debugOff as J, type KeepAlive as K, type LinkHydrateContext as L, type MobilePresentation as M, type NotifyOptions as N, type OverlayState as O, type PruneStaleInstancesPayload as P, defaultWindowIdFor as Q, type RawOpenPayload as R, type SummonPorts as S, type ToggleOverlayPayload as T, type UnbiddenHomeRoute as U, getOverlayMeta as V, type WindowPreservation as W, getOverlayMetaByLinkKey as X, instanceKey as Y, isRegisteredOverlay as Z, listOpenInstanceKeys as _, type StateWithOverlays as a, openOverlay as a0, overlayIdsBoundToPage as a1, parseInstanceKey as a2, registerOverlayMeta as a3, resetOverlayRegistry as a4, resolvePorts as a5, selectIsOverlayOpen as a6, selectOpenInstances as a7, selectOverlay as a8, selectOverlayData as a9, subscribeToOverlayRegistry as aa, toggleOverlay as ab, type CreateSummonGateOptions as ac, SUMMON_INSTALLED_ACTION as ad, SUMMON_SLICE_KEYS as ae, type SummonAction as af, type SummonGate as ag, closeAllOverlays as ah, createSummonGate as ai, ensureSummonRuntime as aj, focusWindow as ak, installSummonCore as al, isSummonAction as am, isSummonInstalled as an, minimizeAll as ao, prefetchSummonRuntime as ap, pruneStaleInstances as aq, restoreAll as ar, restoreWindow as as, selectAnyOverlayTouched as at, selectWindowsHidden as au, subscribeSummonInstalled as av, toggleWindowsHidden as aw, type OverlayDefinitionMeta as b, type SummonCore as c, type CloseAllInstancesPayload as d, type CloseOverlayPayload as e, DEFAULT_PORTS as f, type DebugPort as g, type IdentityPort as h, type InstanceMode as i, type NotifyPort as j, type OpenInstanceView as k, type OpenOverlayPayload as l, type OverlayDataOf as m, type OverlayHostDispatch as n, type OverlayId as o, type OverlayInstance as p, type OverlayLinkSpec as q, type OverlayPersistencePort as r, type OverlayRawData as s, type OverlayWindowOptions as t, type RouterPort as u, type StoredValue as v, type Unsubscribe as w, allOverlayMeta as x, anonymousIdentity as y, closeAllInstancesOfOverlay as z };
419
+ export { locationRouter as $, type AnyOverlayMeta as A, closeOverlay as B, type CloseOverlaysBoundToPagePayload as C, DEFAULT_INSTANCE_ID as D, type ErrorSinkPort as E, closeOverlaysBoundToPage as F, consoleErrorSink as G, consoleNotify as H, type InstanceKey as I, debugOff as J, type KeepAlive as K, type LinkHydrateContext as L, type MobilePresentation as M, type NotifyOptions as N, type OverlayState as O, type PruneStaleInstancesPayload as P, defaultWindowIdFor as Q, type RawOpenPayload as R, type SummonPorts as S, type ToggleOverlayPayload as T, type UnbiddenHomeRoute as U, getOverlayMeta as V, type WindowPreservation as W, getOverlayMetaByLinkKey as X, instanceKey as Y, isRegisteredOverlay as Z, listOpenInstanceKeys as _, type StateWithOverlays as a, openOverlay as a0, overlayIdsBoundToPage as a1, parseInstanceKey as a2, registerOverlayMeta as a3, resetOverlayRegistry as a4, resolvePorts as a5, selectIsOverlayOpen as a6, selectOpenInstances as a7, selectOverlay as a8, selectOverlayData as a9, unregisterSyncEntry as aA, subscribeToOverlayRegistry as aa, toggleOverlay as ab, type CreateSummonGateOptions as ac, SUMMON_INSTALLED_ACTION as ad, SUMMON_SLICE_KEYS as ae, type SummonAction as af, type SummonGate as ag, type UrlSyncEntryPayload as ah, closeAllOverlays as ai, createSummonGate as aj, ensureSummonRuntime as ak, focusWindow as al, installSummonCore as am, isSummonAction as an, isSummonInstalled as ao, minimizeAll as ap, prefetchSummonRuntime as aq, pruneStaleInstances as ar, registerSyncEntry as as, restoreAll as at, restoreWindow as au, selectAllWindows as av, selectAnyOverlayTouched as aw, selectWindowsHidden as ax, subscribeSummonInstalled as ay, toggleWindowsHidden as az, type OverlayDefinitionMeta as b, type SummonCore as c, type CloseAllInstancesPayload as d, type CloseOverlayPayload as e, DEFAULT_PORTS as f, type DebugPort as g, type IdentityPort as h, type InstanceMode as i, type NotifyPort as j, type OpenInstanceView as k, type OpenOverlayPayload as l, type OverlayDataOf as m, type OverlayHostDispatch as n, type OverlayId as o, type OverlayInstance as p, type OverlayLinkSpec as q, type OverlayPersistencePort as r, type OverlayRawData as s, type OverlayWindowOptions as t, type RouterPort as u, type StoredValue as v, type Unsubscribe as w, allOverlayMeta as x, anonymousIdentity as y, closeAllInstancesOfOverlay as z };
@@ -324,6 +324,19 @@ declare const minimizeAll: Creator<[payload: {
324
324
  viewportWidth: number;
325
325
  viewportHeight: number;
326
326
  }>;
327
+ interface UrlSyncEntryPayload {
328
+ typeKey: string;
329
+ instanceId: string;
330
+ args?: Readonly<Record<string, string>>;
331
+ }
332
+ declare const registerSyncEntry: Creator<[payload: UrlSyncEntryPayload], UrlSyncEntryPayload>;
333
+ declare const unregisterSyncEntry: Creator<[payload: {
334
+ typeKey: string;
335
+ instanceId: string;
336
+ }], {
337
+ typeKey: string;
338
+ instanceId: string;
339
+ }>;
327
340
  /** Every slice key the summon reducers own; an action under one of them needs the runtime. */
328
341
  declare const SUMMON_SLICE_KEYS: readonly ["overlays", "windowManager", "urlSync", "overlayState"];
329
342
  declare function isSummonAction(action: unknown): action is {
@@ -362,6 +375,15 @@ declare const selectWindowsHidden: (state: {
362
375
  windowsHidden: boolean;
363
376
  };
364
377
  }) => boolean;
378
+ interface WindowLike {
379
+ readonly zIndex: number;
380
+ }
381
+ /** Every registered window, topmost first (empty before the runtime is installed). Memoized on the map. */
382
+ declare function selectAllWindows<W extends WindowLike = WindowLike>(state: {
383
+ windowManager?: {
384
+ windows: Record<string, W>;
385
+ };
386
+ }): readonly W[];
365
387
 
366
388
  /** What the core hands the gate when it loads. */
367
389
  interface SummonCore {
@@ -394,4 +416,4 @@ interface CreateSummonGateOptions {
394
416
  }
395
417
  declare function createSummonGate(options?: CreateSummonGateOptions): SummonGate;
396
418
 
397
- export { locationRouter as $, type AnyOverlayMeta as A, closeOverlay as B, type CloseOverlaysBoundToPagePayload as C, DEFAULT_INSTANCE_ID as D, type ErrorSinkPort as E, closeOverlaysBoundToPage as F, consoleErrorSink as G, consoleNotify as H, type InstanceKey as I, debugOff as J, type KeepAlive as K, type LinkHydrateContext as L, type MobilePresentation as M, type NotifyOptions as N, type OverlayState as O, type PruneStaleInstancesPayload as P, defaultWindowIdFor as Q, type RawOpenPayload as R, type SummonPorts as S, type ToggleOverlayPayload as T, type UnbiddenHomeRoute as U, getOverlayMeta as V, type WindowPreservation as W, getOverlayMetaByLinkKey as X, instanceKey as Y, isRegisteredOverlay as Z, listOpenInstanceKeys as _, type StateWithOverlays as a, openOverlay as a0, overlayIdsBoundToPage as a1, parseInstanceKey as a2, registerOverlayMeta as a3, resetOverlayRegistry as a4, resolvePorts as a5, selectIsOverlayOpen as a6, selectOpenInstances as a7, selectOverlay as a8, selectOverlayData as a9, subscribeToOverlayRegistry as aa, toggleOverlay as ab, type CreateSummonGateOptions as ac, SUMMON_INSTALLED_ACTION as ad, SUMMON_SLICE_KEYS as ae, type SummonAction as af, type SummonGate as ag, closeAllOverlays as ah, createSummonGate as ai, ensureSummonRuntime as aj, focusWindow as ak, installSummonCore as al, isSummonAction as am, isSummonInstalled as an, minimizeAll as ao, prefetchSummonRuntime as ap, pruneStaleInstances as aq, restoreAll as ar, restoreWindow as as, selectAnyOverlayTouched as at, selectWindowsHidden as au, subscribeSummonInstalled as av, toggleWindowsHidden as aw, type OverlayDefinitionMeta as b, type SummonCore as c, type CloseAllInstancesPayload as d, type CloseOverlayPayload as e, DEFAULT_PORTS as f, type DebugPort as g, type IdentityPort as h, type InstanceMode as i, type NotifyPort as j, type OpenInstanceView as k, type OpenOverlayPayload as l, type OverlayDataOf as m, type OverlayHostDispatch as n, type OverlayId as o, type OverlayInstance as p, type OverlayLinkSpec as q, type OverlayPersistencePort as r, type OverlayRawData as s, type OverlayWindowOptions as t, type RouterPort as u, type StoredValue as v, type Unsubscribe as w, allOverlayMeta as x, anonymousIdentity as y, closeAllInstancesOfOverlay as z };
419
+ export { locationRouter as $, type AnyOverlayMeta as A, closeOverlay as B, type CloseOverlaysBoundToPagePayload as C, DEFAULT_INSTANCE_ID as D, type ErrorSinkPort as E, closeOverlaysBoundToPage as F, consoleErrorSink as G, consoleNotify as H, type InstanceKey as I, debugOff as J, type KeepAlive as K, type LinkHydrateContext as L, type MobilePresentation as M, type NotifyOptions as N, type OverlayState as O, type PruneStaleInstancesPayload as P, defaultWindowIdFor as Q, type RawOpenPayload as R, type SummonPorts as S, type ToggleOverlayPayload as T, type UnbiddenHomeRoute as U, getOverlayMeta as V, type WindowPreservation as W, getOverlayMetaByLinkKey as X, instanceKey as Y, isRegisteredOverlay as Z, listOpenInstanceKeys as _, type StateWithOverlays as a, openOverlay as a0, overlayIdsBoundToPage as a1, parseInstanceKey as a2, registerOverlayMeta as a3, resetOverlayRegistry as a4, resolvePorts as a5, selectIsOverlayOpen as a6, selectOpenInstances as a7, selectOverlay as a8, selectOverlayData as a9, unregisterSyncEntry as aA, subscribeToOverlayRegistry as aa, toggleOverlay as ab, type CreateSummonGateOptions as ac, SUMMON_INSTALLED_ACTION as ad, SUMMON_SLICE_KEYS as ae, type SummonAction as af, type SummonGate as ag, type UrlSyncEntryPayload as ah, closeAllOverlays as ai, createSummonGate as aj, ensureSummonRuntime as ak, focusWindow as al, installSummonCore as am, isSummonAction as an, isSummonInstalled as ao, minimizeAll as ap, prefetchSummonRuntime as aq, pruneStaleInstances as ar, registerSyncEntry as as, restoreAll as at, restoreWindow as au, selectAllWindows as av, selectAnyOverlayTouched as aw, selectWindowsHidden as ax, subscribeSummonInstalled as ay, toggleWindowsHidden as az, type OverlayDefinitionMeta as b, type SummonCore as c, type CloseAllInstancesPayload as d, type CloseOverlayPayload as e, DEFAULT_PORTS as f, type DebugPort as g, type IdentityPort as h, type InstanceMode as i, type NotifyPort as j, type OpenInstanceView as k, type OpenOverlayPayload as l, type OverlayDataOf as m, type OverlayHostDispatch as n, type OverlayId as o, type OverlayInstance as p, type OverlayLinkSpec as q, type OverlayPersistencePort as r, type OverlayRawData as s, type OverlayWindowOptions as t, type RouterPort as u, type StoredValue as v, type Unsubscribe as w, allOverlayMeta as x, anonymousIdentity as y, closeAllInstancesOfOverlay as z };
package/dist/index.cjs CHANGED
@@ -115,7 +115,7 @@ __export(src_exports, {
115
115
  rectsEqual: () => rectsEqual,
116
116
  registerCloseFlusher: () => registerCloseFlusher,
117
117
  registerOverlayMeta: () => registerOverlayMeta,
118
- registerSyncEntry: () => registerSyncEntry,
118
+ registerSyncEntry: () => registerSyncEntry2,
119
119
  registerWindow: () => registerWindow,
120
120
  releaseOverlayInstance: () => releaseOverlayInstance,
121
121
  releaseTransientWindow: () => releaseTransientWindow,
@@ -165,7 +165,7 @@ __export(src_exports, {
165
165
  toggleWindowsHidden: () => toggleWindowsHidden2,
166
166
  trayChipsPerRow: () => trayChipsPerRow,
167
167
  traySlotRect: () => traySlotRect,
168
- unregisterSyncEntry: () => unregisterSyncEntry,
168
+ unregisterSyncEntry: () => unregisterSyncEntry2,
169
169
  unregisterWindow: () => unregisterWindow,
170
170
  updateWindowPersistence: () => updateWindowPersistence,
171
171
  updateWindowRect: () => updateWindowRect,
@@ -341,6 +341,8 @@ var restoreWindow = creator(W + "restoreWindow", pass());
341
341
  var toggleWindowsHidden = creator(W + "toggleWindowsHidden", () => void 0);
342
342
  var restoreAll = creator(W + "restoreAll", () => void 0);
343
343
  var minimizeAll = creator(W + "minimizeAll", pass());
344
+ var registerSyncEntry = creator("urlSync/registerSyncEntry", pass());
345
+ var unregisterSyncEntry = creator("urlSync/unregisterSyncEntry", pass());
344
346
 
345
347
  // src/open/selectors.ts
346
348
  var import_global_slot2 = require("@ai-matrx/kit/global-slot");
@@ -371,6 +373,7 @@ function listOpenInstanceKeys(state2) {
371
373
  }
372
374
  return keys;
373
375
  }
376
+ var EMPTY_WINDOWS = Object.freeze([]);
374
377
 
375
378
  // src/core/overlaysSlice.ts
376
379
  var initialState = { overlays: {} };
@@ -1700,7 +1703,7 @@ var urlSyncSlice = (0, import_toolkit3.createSlice)({
1700
1703
  }
1701
1704
  });
1702
1705
  var linksReducer = urlSyncSlice.reducer;
1703
- var { setHydrated, registerSyncEntry, unregisterSyncEntry } = urlSyncSlice.actions;
1706
+ var { setHydrated, registerSyncEntry: registerSyncEntry2, unregisterSyncEntry: unregisterSyncEntry2 } = urlSyncSlice.actions;
1704
1707
  var selectUrlSyncEntries = (state2) => state2.urlSync.entries;
1705
1708
  var selectIsUrlHydrated = (state2) => state2.urlSync.isHydrated;
1706
1709