@sincpro/web-composer 1.7.0 → 1.9.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
@@ -146,8 +146,9 @@ breadcrumb behind, no peek, the panels stay), and `useSection(workspace, entries
146
146
  entry of that menu the person is under, to mark it — still the same entry a record and its lines
147
147
  deeper. The menu itself is the app's: its groups, its icons, who may see what.
148
148
  `useWorkspace({ hash: true })` puts the workspace in the URL with the browser's Back working, and
149
- a reload keeps the breadcrumb and the names views gave. Unsaved changes are asked with the
150
- composer's own dialog; `useWorkspace({ confirmDiscard })` replaces it.
149
+ a reload keeps the breadcrumb and the names views gave — drawn on a server too, add
150
+ `serverRendered: true` ([Server rendering](#server-rendering)). Unsaved changes are asked with
151
+ the composer's own dialog; `useWorkspace({ confirmDiscard })` replaces it.
151
152
 
152
153
  ## Where each behaviour lives
153
154
 
@@ -178,6 +179,7 @@ const registry = createRegistry([
178
179
  domain: "accounting",
179
180
  kind: "entry",
180
181
  title: (ref) => `Entry ${ref.id}`,
182
+ noun: "Entry", // ⌘K says what each record it found is: «Entry · ACME»
181
183
  search: async (query) => findEntries(query), // ⌘K asks every domain that searches
182
184
  load: async () => (await import("./EntryView")).EntryView, // lazy: a remote module fits here
183
185
  },
@@ -198,10 +200,21 @@ installComposerCopy(SPANISH_COMPOSER_COPY); // optional: the composer's words in
198
200
 
199
201
  export function App() {
200
202
  const workspace = useWorkspace();
201
- return <Composer workspace={workspace} registry={registry} />;
203
+ return (
204
+ <>
205
+ <button onClick={() => workspace.openPalette()}>Search…</button>
206
+ <Composer workspace={workspace} registry={registry} />
207
+ </>
208
+ );
202
209
  }
203
210
  ```
204
211
 
212
+ `workspace.openPalette()` opens ⌘K from your own bar, as the shortcut does; `openPalette({ query })`
213
+ hands it what was already typed there. Each domain's results show as they arrive: a slow one does
214
+ not hold back the others. A shortcut is written with a Mac's glyphs (⌘K) or the web's words
215
+ (Mod+K) and drawn as each keyboard reads it — Ctrl+K off a Mac; an app that draws shortcuts itself
216
+ does the same with `platformKeys(text)`.
217
+
205
218
  Write a view — it receives its reference and the API, nothing else. It is drawn with whatever
206
219
  your app uses; here, web-ui:
207
220
 
@@ -296,6 +309,42 @@ expect(t.callsTo("open")[0].args).toEqual([paymentRef("F-1"), { to: "modal" }]);
296
309
  t.respond(true); // answers the last chooser it opened, as its view would
297
310
  ```
298
311
 
312
+ ### Server rendering
313
+
314
+ It works in a server-rendered app — Next.js (App Router or Pages Router), any SSR —, and nothing
315
+ changes for a single-page app.
316
+
317
+ - **Server Components** may import from `@sincpro/web-composer`. Every module that needs the
318
+ browser (hooks, context, events) starts with `"use client"`, and a test keeps it so; the model
319
+ (`@sincpro/web-composer/domain`), `createWorkspaceStore`, the copy and `platformKeys` stay
320
+ callable from a server. The workspace itself lives in the browser: hold it in a client
321
+ component of your own, and draw `<Composer>` there.
322
+ - **The workspace in the URL.** The browser never sends the hash to the server.
323
+ `useWorkspace({ hash: true })` reads it as the store is created — a single-page app shows the
324
+ link's place on its first frame —, so hydrating, the browser would draw a place the server did
325
+ not: a hydration error. A server-rendered app asks for
326
+
327
+ ```tsx
328
+ "use client";
329
+ const workspace = useWorkspace({ hash: true, serverRendered: true });
330
+ ```
331
+
332
+ It starts at `initial`, what the server drew, and takes the URL's place once mounted, with its
333
+ breadcrumb on a reload — before the effects of the component that holds it, so
334
+ `if (workspace.get().page === null) workspace.start(home)` in an effect still sees the link.
335
+ `createWorkspaceStore({ hash: true, serverRendered: true })` does the same on its first
336
+ listener or its first change, whichever comes first.
337
+
338
+ - **Drag and drop** is loaded by the browser when the workspace mounts, never on import: a
339
+ server — plain Node included — imports and draws the composer without touching
340
+ `@atlaskit/pragmatic-drag-and-drop`. The browser's bundle still gets it, as any dependency.
341
+ - **The words.** `installComposerCopy` sets the one global there is, and a server renders every
342
+ request in one process: install it in a module every page loads (the root layout's client
343
+ providers), never in one page.
344
+
345
+ The story «16 · Dibujado en el servidor» draws the workspace with `renderToString`, opens a link
346
+ and hydrates it in Chrome: no difference with the server, then the link's record.
347
+
299
348
  ## Your design over it
300
349
 
301
350
  ### Colors
@@ -16,6 +16,8 @@ export type PaletteEntry = {
16
16
  section: typeof PaletteSection.Goto | typeof PaletteSection.Found;
17
17
  id: string;
18
18
  label: string;
19
+ /** A found record's kind, from its `ViewSpec`: «Entry». */
20
+ noun?: string;
19
21
  detail?: string;
20
22
  icon?: Icon;
21
23
  ref: ResourceRef;
@@ -36,7 +38,9 @@ export declare function matches(entry: PaletteEntry, query: string): boolean;
36
38
  /** What is known without asking anyone: the screens, and the actions of the
37
39
  * resource the user is on. */
38
40
  export declare function localEntries(registry: Registry, focused: ResourceRef | null): readonly PaletteEntry[];
39
- /** Asks every domain that searches. A domain that fails is logged and left
40
- * out; the others still answer. */
41
- export declare function searchEntries(registry: Registry, query: string): Promise<readonly PaletteEntry[]>;
41
+ /** Asks every domain that searches. Each answer is added as it arrives and `onAnswer` hears the
42
+ * list so far: a slow domain does not hold back the quick ones, and what is already on screen
43
+ * never moves under the cursor. A domain that fails is logged and left out; the others still
44
+ * answer. Resolves with every answer, for whoever needs them all (an agent). */
45
+ export declare function searchEntries(registry: Registry, query: string, onAnswer?: (found: readonly PaletteEntry[]) => void): Promise<readonly PaletteEntry[]>;
42
46
  export {};
@@ -54,36 +54,43 @@ export function localEntries(registry, focused) {
54
54
  }));
55
55
  return [...actions, ...goto];
56
56
  }
57
- /** Asks every domain that searches. A domain that fails is logged and left
58
- * out; the others still answer. */
59
- export async function searchEntries(registry, query) {
57
+ /** Asks every domain that searches. Each answer is added as it arrives and `onAnswer` hears the
58
+ * list so far: a slow domain does not hold back the quick ones, and what is already on screen
59
+ * never moves under the cursor. A domain that fails is logged and left out; the others still
60
+ * answer. Resolves with every answer, for whoever needs them all (an agent). */
61
+ export async function searchEntries(registry, query, onAnswer) {
60
62
  const text = query.trim();
61
63
  if (text.length < MIN_QUERY)
62
64
  return [];
63
- const specs = registry.all().filter((spec) => spec.search !== undefined);
64
- const answers = await Promise.allSettled(specs.map((spec) => spec.search(text)));
65
65
  const seen = new Set();
66
66
  const found = [];
67
- answers.forEach((answer, i) => {
68
- if (answer.status === "rejected") {
69
- console.warn(`[composer] search failed in «${specs[i]?.domain}»`, answer.reason);
70
- return;
71
- }
72
- for (const hit of answer.value) {
67
+ function add(hits) {
68
+ for (const hit of hits) {
73
69
  const id = `found:${formatRef(hit.ref)}`;
74
70
  if (seen.has(id))
75
71
  continue;
76
72
  seen.add(id);
77
- const icon = registry.resolve(hit.ref)?.icon;
73
+ /* The hit's own kind, not the searching domain's: one search may answer with several. */
74
+ const spec = registry.resolve(hit.ref);
78
75
  found.push({
79
76
  section: PaletteSection.Found,
80
77
  id,
81
78
  label: hit.label,
79
+ ...(spec?.noun === undefined ? {} : { noun: spec.noun }),
82
80
  ...(hit.detail === undefined ? {} : { detail: hit.detail }),
83
- ...(icon === undefined ? {} : { icon }),
81
+ ...(spec?.icon === undefined ? {} : { icon: spec.icon }),
84
82
  ref: hit.ref,
85
83
  });
86
84
  }
87
- });
85
+ onAnswer?.([...found]);
86
+ }
87
+ const specs = registry.all().filter((spec) => spec.search !== undefined);
88
+ await Promise.all(specs.map((spec) =>
89
+ /* A search that throws instead of rejecting is a failure too, not the end of all of them. */
90
+ Promise.resolve()
91
+ .then(() => spec.search(text))
92
+ .then(add, (reason) => {
93
+ console.warn(`[composer] search failed in «${spec.domain}»`, reason);
94
+ })));
88
95
  return found;
89
96
  }
@@ -156,7 +156,8 @@ export type Action = {
156
156
  id: string;
157
157
  label: string;
158
158
  icon?: Icon;
159
- /** Drawn, not bound: the palette is where the shortcut gets learned. */
159
+ /** Drawn, not bound: the palette is where the shortcut gets learned. «⌘E» or «Mod+E», drawn
160
+ * as the keyboard in use names it (`platformKeys`). */
160
161
  shortcut?: string;
161
162
  keywords?: readonly string[];
162
163
  /** Receives the API of the surface the resource is on. */
@@ -173,6 +174,9 @@ export type ViewSpec = {
173
174
  domain: string;
174
175
  kind: string;
175
176
  title: (ref: ResourceRef) => string;
177
+ /** What one of these is called: «Entry», «Member». ⌘K names each record it found with it, so
178
+ * three hits with the same name say which is which. `title` names a record, not its kind. */
179
+ noun?: string;
176
180
  icon?: Icon;
177
181
  /** Where to open when asked beside the page with no zone. */
178
182
  preferredZone?: Zone;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { Destination, focusedRef, PAGE, PaletteSection, PEEK, sectionOf, selecti
11
11
  export { Composer, type ComposerProps } from "./shell/Composer.js";
12
12
  export { type ComposerCopy, composerCopy, ENGLISH_COMPOSER_COPY, installComposerCopy, SPANISH_COMPOSER_COPY, } from "./shell/copy.js";
13
13
  export { type IconProps } from "./shell/icons.js";
14
+ export { platformKeys } from "./shell/keys.js";
14
15
  export { ModalLayer, type ModalLayerProps, ModalWindow, } from "./shell/Modal.js";
15
16
  export { WorkspacePalette, type WorkspacePaletteProps, } from "./shell/Palette.js";
16
17
  export { type PanelActions, PanelFrame, type PanelFrameProps, } from "./shell/PanelFrame.js";
@@ -21,7 +22,7 @@ export { ComposerStyles } from "./shell/styles.js";
21
22
  export { type OnViewError, type ViewErrorAbout, ViewErrorProvider, ViewHost, type ViewHostProps, } from "./shell/ViewHost.js";
22
23
  export { type AgentTool, type AgentToolAnnotations, registerAgentTool, registerAgentTools, toolName, useViewTool, workspaceTools, type WorkspaceToolsOptions, } from "./state/agent.js";
23
24
  export { type ApiFactory, createApiFactory, type Target, targetOf, } from "./state/api.js";
24
- export { type ConfirmDiscard, createWorkspaceStore, type StoreOptions, type WorkspaceStore, } from "./state/store.js";
25
+ export { type ConfirmDiscard, createWorkspaceStore, type OpenPaletteOptions, type StoreOptions, type WorkspaceStore, } from "./state/store.js";
25
26
  export { type ApiCall, createTestApi, type TestApi, type TestApiOptions, } from "./state/testing.js";
26
27
  export { useKeyboard, type UseKeyboardOptions, } from "./state/useKeyboard.js";
27
28
  export { useCrumbs, usePhone, useSection, useWorkspace, useWorkspaceContext, useWorkspaceState, } from "./state/useWorkspace.js";
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export { Destination, focusedRef, PAGE, PaletteSection, PEEK, sectionOf, selecti
10
10
  export { Composer } from "./shell/Composer.js";
11
11
  export { composerCopy, ENGLISH_COMPOSER_COPY, installComposerCopy, SPANISH_COMPOSER_COPY, } from "./shell/copy.js";
12
12
  export {} from "./shell/icons.js";
13
+ export { platformKeys } from "./shell/keys.js";
13
14
  export { ModalLayer, ModalWindow, } from "./shell/Modal.js";
14
15
  export { WorkspacePalette, } from "./shell/Palette.js";
15
16
  export { PanelFrame, } from "./shell/PanelFrame.js";
@@ -13,8 +13,8 @@ export type ComposerProps = {
13
13
  /** Where `api.open(ref)` goes when the caller does not say. The page — what people expect of
14
14
  * a click on a record. */
15
15
  defaultOpen?: Destination;
16
- /** ⌘K, controlled — for a search button in the app's own bar. Without it the composer keeps
17
- * the state and only the shortcut opens it. */
16
+ /** ⌘K, controlled. Without it the composer keeps the state: the shortcut opens it, and so does
17
+ * `workspace.openPalette()` — a «Search…» in the app's own bar needs nothing else. */
18
18
  palette?: boolean;
19
19
  onPaletteChange?: (open: boolean) => void;
20
20
  /** Your design over the composer: icons, the peek drawer, the confirm dialog, the notice, or
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { Destination, destinationOnPhone, focusedRef, modalOver, PEEK, PHONE_WIDTH, Surface, Zone, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -68,11 +69,20 @@ export function Composer({ workspace, registry, empty, keyboard = true, defaultO
68
69
  const state = useWorkspaceState(workspace);
69
70
  const copy = composerCopy();
70
71
  const [paletteState, setPaletteState] = useState(false);
72
+ const [paletteQuery, setPaletteQuery] = useState("");
71
73
  const palette = paletteProp ?? paletteState;
72
74
  const setPalette = useCallback((open) => {
73
75
  setPaletteState(open);
74
76
  onPaletteChange?.(open);
75
77
  }, [onPaletteChange]);
78
+ const openPalette = useCallback((options) => {
79
+ setPaletteQuery(options?.query ?? "");
80
+ setPalette(true);
81
+ }, [setPalette]);
82
+ useEffect(() => {
83
+ workspace.setOpenPalette(openPalette);
84
+ return () => workspace.setOpenPalette(null);
85
+ }, [workspace, openPalette]);
76
86
  const root = useRef(null);
77
87
  const phone = useMeasuredPhone(root, phoneBelow);
78
88
  const api = useMemo(() => createApiFactory(workspace, { registry, defaultOpen }), [workspace, registry, defaultOpen]);
@@ -83,7 +93,7 @@ export function Composer({ workspace, registry, empty, keyboard = true, defaultO
83
93
  useKeyboard({
84
94
  workspace,
85
95
  enabled: keyboard,
86
- onPalette: useCallback(() => setPalette(true), [setPalette]),
96
+ onPalette: openPalette,
87
97
  });
88
98
  useDropMonitor(useMemo(() => ({
89
99
  onPanelToZone: workspace.movePanel,
@@ -134,6 +144,6 @@ export function Composer({ workspace, registry, empty, keyboard = true, defaultO
134
144
  const peekModal = modalOver(state, PEEK);
135
145
  const peekSpec = peeked === null ? null : registry.resolve(peeked);
136
146
  const cameFrom = state.peekTrail.at(-1);
137
- const desk = (_jsxs("div", { ref: root, className: "sc-root", ...(phone ? { "data-phone": "" } : {}), children: [skin.styles ? _jsx(ComposerStyles, {}) : null, state.page === null ? (_jsx("div", { className: "sc-empty", children: empty })) : (_jsx(PanelHost, { workspace: state, registry: registry, store: workspace, api: api, phone: phone, overlay: peeked === null ? null : (_jsxs(_Fragment, { children: [_jsx("div", { style: { display: "contents" }, inert: peekModal !== null, onPointerDownCapture: () => workspace.focusPanel(PEEK), children: _jsx(Drawer, { title: api.titleOf(peeked), onClose: workspace.closePeek, actions: _jsxs(_Fragment, { children: [phone ? null : (_jsx(ChromeButton, { onClick: () => workspace.peekToSide(peekSpec?.preferredZone ?? Zone.Right), children: copy.peek.openAsPanel })), cameFrom === undefined ? null : (_jsx(ChromeButton, { role: "ghost", icon: skin.icons.back, onClick: workspace.peekBack, children: copy.peek.back(api.titleOf(cameFrom)) })), _jsx(ChromeButton, { role: "ghost", onClick: workspace.peekToPage, children: copy.peek.openAsPage })] }), children: _jsx(ViewHost, { resource: peeked, registry: registry, api: api.for(peeked, { surface: Surface.Peek }) }) }) }), peekModal === null ? null : (_jsx(ModalLayer, { modal: peekModal, registry: registry, store: workspace, api: api, phone: phone }))] })) })), phone && state.page !== null && state.panels.length > 0 ? (_jsx(PhoneDock, { panels: state.panels, titleOf: api.titleOf, onBring: workspace.expandPanel })) : null, _jsx(Confirm, { open: asking !== null, title: copy.discard.title, detail: asking === null ? "" : copy.discard.detail(asking.names), keep: copy.discard.keep, discard: copy.discard.discard, onAnswer: (ok) => asking?.answer(ok) }), palette ? (_jsx(WorkspacePalette, { registry: registry, focused: focusedRef(state), onOpen: open, onAction: run, onClose: () => setPalette(false) })) : null] }));
147
+ const desk = (_jsxs("div", { ref: root, className: "sc-root", ...(phone ? { "data-phone": "" } : {}), children: [skin.styles ? _jsx(ComposerStyles, {}) : null, state.page === null ? (_jsx("div", { className: "sc-empty", children: empty })) : (_jsx(PanelHost, { workspace: state, registry: registry, store: workspace, api: api, phone: phone, overlay: peeked === null ? null : (_jsxs(_Fragment, { children: [_jsx("div", { style: { display: "contents" }, inert: peekModal !== null, onPointerDownCapture: () => workspace.focusPanel(PEEK), children: _jsx(Drawer, { title: api.titleOf(peeked), onClose: workspace.closePeek, actions: _jsxs(_Fragment, { children: [phone ? null : (_jsx(ChromeButton, { onClick: () => workspace.peekToSide(peekSpec?.preferredZone ?? Zone.Right), children: copy.peek.openAsPanel })), cameFrom === undefined ? null : (_jsx(ChromeButton, { role: "ghost", icon: skin.icons.back, onClick: workspace.peekBack, children: copy.peek.back(api.titleOf(cameFrom)) })), _jsx(ChromeButton, { role: "ghost", onClick: workspace.peekToPage, children: copy.peek.openAsPage })] }), children: _jsx(ViewHost, { resource: peeked, registry: registry, api: api.for(peeked, { surface: Surface.Peek }) }) }) }), peekModal === null ? null : (_jsx(ModalLayer, { modal: peekModal, registry: registry, store: workspace, api: api, phone: phone }))] })) })), phone && state.page !== null && state.panels.length > 0 ? (_jsx(PhoneDock, { panels: state.panels, titleOf: api.titleOf, onBring: workspace.expandPanel })) : null, _jsx(Confirm, { open: asking !== null, title: copy.discard.title, detail: asking === null ? "" : copy.discard.detail(asking.names), keep: copy.discard.keep, discard: copy.discard.discard, onAnswer: (ok) => asking?.answer(ok) }), palette ? (_jsx(WorkspacePalette, { registry: registry, focused: focusedRef(state), onOpen: open, onAction: run, onClose: () => setPalette(false), initialQuery: paletteQuery })) : null] }));
138
148
  return (_jsx(SkinProvider, { value: skin, children: onViewError === undefined ? (desk) : (_jsx(ViewErrorProvider, { value: onViewError, children: desk })) }));
139
149
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { modalId, Surface, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -5,5 +5,7 @@ export type WorkspacePaletteProps = {
5
5
  onOpen: (ref: ResourceRef, destination: Destination) => void;
6
6
  onAction: (action: Action) => void;
7
7
  onClose: () => void;
8
+ /** What the search box opens with: `workspace.openPalette({ query })`. */
9
+ initialQuery?: string;
8
10
  };
9
- export declare function WorkspacePalette({ registry, focused, onOpen, onAction, onClose, }: WorkspacePaletteProps): import("react").JSX.Element;
11
+ export declare function WorkspacePalette({ registry, focused, onOpen, onAction, onClose, initialQuery, }: WorkspacePaletteProps): import("react").JSX.Element;
@@ -1,8 +1,10 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Destination, localEntries, matches, MIN_QUERY, PaletteSection, searchEntries, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
5
+ import { platformKeys } from "./keys.js";
4
6
  import { useSkin } from "./skin.js";
5
- import { useEffect, useId, useMemo, useRef, useState, } from "react";
7
+ import { useEffect, useId, useMemo, useState, } from "react";
6
8
  /**
7
9
  * ⌘K over the workspace. The list is the model's (`localEntries`,
8
10
  * `searchEntries`); this only draws it and decides WHERE a resource opens,
@@ -47,7 +49,11 @@ function useFound(registry, query) {
47
49
  let current = true;
48
50
  setLoading(true);
49
51
  const timer = setTimeout(() => {
50
- void searchEntries(registry, query).then((entries) => {
52
+ const shown = (entries) => {
53
+ if (current)
54
+ setFound(entries);
55
+ };
56
+ void searchEntries(registry, query, shown).then((entries) => {
51
57
  if (!current)
52
58
  return;
53
59
  setFound(entries);
@@ -61,25 +67,23 @@ function useFound(registry, query) {
61
67
  }, [registry, query]);
62
68
  return { found, loading };
63
69
  }
64
- export function WorkspacePalette({ registry, focused, onOpen, onAction, onClose, }) {
70
+ export function WorkspacePalette({ registry, focused, onOpen, onAction, onClose, initialQuery = "", }) {
65
71
  const copy = composerCopy().palette;
66
72
  const SearchIcon = useSkin().icons.search;
67
73
  const listId = useId();
68
- const [query, setQuery] = useState("");
74
+ const [query, setQuery] = useState(initialQuery);
69
75
  const [cursor, setCursor] = useState(0);
70
76
  const { found, loading } = useFound(registry, query);
71
77
  const local = useMemo(() => localEntries(registry, focused), [registry, focused]);
72
78
  const entries = useMemo(() => [...local.filter((e) => matches(e, query)), ...found], [local, found, query]);
73
79
  const active = entries[Math.min(cursor, entries.length - 1)];
74
- /* The focus goes back where it was: the palette is a path, not a place. */
75
- const returnTo = useRef(null);
76
- useEffect(() => {
77
- returnTo.current = document.activeElement;
78
- return () => {
79
- if (returnTo.current instanceof HTMLElement)
80
- returnTo.current.focus();
81
- };
82
- }, []);
80
+ /* The focus goes back where it was: the palette is a path, not a place. Read while rendering:
81
+ by the time an effect runs, `autoFocus` has already moved it into the query. */
82
+ const [returnTo] = useState(() => typeof document === "undefined" ? null : document.activeElement);
83
+ useEffect(() => () => {
84
+ if (returnTo instanceof HTMLElement)
85
+ returnTo.focus();
86
+ }, [returnTo]);
83
87
  function run(entry, destination) {
84
88
  onClose();
85
89
  if (entry.section === PaletteSection.Actions)
@@ -118,7 +122,8 @@ export function WorkspacePalette({ registry, focused, onOpen, onAction, onClose,
118
122
  }, onKeyDown: onKeyDown })] }), _jsxs("ul", { id: listId, role: "listbox", className: "sc-palette-list", children: [entries.map((entry, i) => {
119
123
  const Icon = entry.icon;
120
124
  const heading = entries[i - 1]?.section !== entry.section;
121
- return (_jsxs("li", { role: "presentation", children: [heading ? (_jsx("p", { className: "sc-palette-section", children: copy.sections[SECTION_KEY[entry.section]] })) : null, _jsxs("div", { id: `${listId}-${entry.id}`, role: "option", "aria-selected": entry === active, onPointerMove: () => setCursor(i), onClick: (e) => run(entry, destinationOf(e)), className: "sc-option", children: [_jsx("span", { className: "sc-option-icon", children: Icon === undefined ? null : _jsx(Icon, { strokeWidth: 2 }) }), _jsx("span", { className: "sc-option-label", children: entry.label }), entry.section !== PaletteSection.Actions && entry.detail !== undefined ? (_jsx("span", { className: "sc-option-detail", children: entry.detail })) : null, entry.section === PaletteSection.Actions &&
122
- entry.shortcut !== undefined ? (_jsx("kbd", { className: "sc-kbd", children: entry.shortcut })) : null] })] }, entry.id));
123
- }), entries.length === 0 && !loading ? (_jsx("li", { className: "sc-palette-empty", children: copy.empty })) : null, loading ? _jsx("li", { className: "sc-palette-empty", children: copy.searching }) : null] }), _jsx("p", { className: "sc-palette-hint", children: copy.hint })] }) }));
125
+ return (_jsxs("li", { role: "presentation", children: [heading ? (_jsx("p", { className: "sc-palette-section", children: copy.sections[SECTION_KEY[entry.section]] })) : null, _jsxs("div", { id: `${listId}-${entry.id}`, role: "option", "aria-selected": entry === active, onPointerMove: () => setCursor(i), onClick: (e) => run(entry, destinationOf(e)), className: "sc-option", children: [_jsx("span", { className: "sc-option-icon", children: Icon === undefined ? null : _jsx(Icon, { strokeWidth: 2 }) }), _jsx("span", { className: "sc-option-label", children: entry.label }), entry.section !== PaletteSection.Actions &&
126
+ (entry.noun !== undefined || entry.detail !== undefined) ? (_jsx("span", { className: "sc-option-detail", children: [entry.noun, entry.detail].filter(Boolean).join(" · ") })) : null, entry.section === PaletteSection.Actions &&
127
+ entry.shortcut !== undefined ? (_jsx("kbd", { className: "sc-kbd", children: platformKeys(entry.shortcut) })) : null] })] }, entry.id));
128
+ }), entries.length === 0 && !loading ? (_jsx("li", { className: "sc-palette-empty", children: copy.empty })) : null, loading ? _jsx("li", { className: "sc-palette-empty", children: copy.searching }) : null] }), _jsx("p", { className: "sc-palette-hint", children: platformKeys(copy.hint) })] }) }));
124
129
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Zone } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Axis, HandleKind, handles, KEYBOARD_STEP, layout, MIN_WINDOW, modalOver, PAGE, phoneLayout, sizeAt, stableOrder, Surface, Zone, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { composerCopy } from "./copy.js";
3
4
  import { useSkin } from "./skin.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Destination, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { formatRef, loadView, rootRef, } from "../domain/index.js";
3
4
  import { composerCopy } from "./copy.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A shortcut is written once and drawn as the keyboard in use prints it. Either notation: a
3
+ * Mac's glyphs (⌘K, ⌥↵, ⌘⇧⏎ — the composer's own copy) or the web's words (Mod+K, Alt+↵, where
4
+ * Mod is ⌘ on a Mac and Ctrl elsewhere). The workspace already takes Ctrl for ⌘; a hint that
5
+ * names a key the keyboard does not have tells a Windows user nothing.
6
+ */
7
+ /** `text` with its shortcuts named for this keyboard. Off a Mac «⌘⇧⏎» and «Mod+Shift+⏎» read
8
+ * «Ctrl+Shift+⏎»; on one, both read «⌘⇧⏎». For an app that draws shortcuts itself:
9
+ * `composerCopy().shortcuts`, its own actions. */
10
+ export declare function platformKeys(text: string, apple?: boolean): string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A shortcut is written once and drawn as the keyboard in use prints it. Either notation: a
3
+ * Mac's glyphs (⌘K, ⌥↵, ⌘⇧⏎ — the composer's own copy) or the web's words (Mod+K, Alt+↵, where
4
+ * Mod is ⌘ on a Mac and Ctrl elsewhere). The workspace already takes Ctrl for ⌘; a hint that
5
+ * names a key the keyboard does not have tells a Windows user nothing.
6
+ */
7
+ const OFF_APPLE = {
8
+ "⌘": "Ctrl+",
9
+ "⌃": "Ctrl+",
10
+ "⌥": "Alt+",
11
+ "⇧": "Shift+",
12
+ };
13
+ const ON_APPLE = {
14
+ mod: "⌘",
15
+ cmd: "⌘",
16
+ ctrl: "⌃",
17
+ alt: "⌥",
18
+ option: "⌥",
19
+ shift: "⇧",
20
+ };
21
+ /** Without a browser (a test, the server) it reads as a Mac: the copy's own notation. */
22
+ function onApple() {
23
+ if (typeof navigator === "undefined")
24
+ return true;
25
+ const agent = navigator;
26
+ return /mac|iphone|ipad|ipod/i.test(agent.userAgentData?.platform ?? navigator.platform);
27
+ }
28
+ /** `text` with its shortcuts named for this keyboard. Off a Mac «⌘⇧⏎» and «Mod+Shift+⏎» read
29
+ * «Ctrl+Shift+⏎»; on one, both read «⌘⇧⏎». For an app that draws shortcuts itself:
30
+ * `composerCopy().shortcuts`, its own actions. */
31
+ export function platformKeys(text, apple = onApple()) {
32
+ if (apple) {
33
+ return text.replace(/\b(mod|cmd|ctrl|alt|option|shift)\+/gi, (word, key) => ON_APPLE[key.toLowerCase()] ?? word);
34
+ }
35
+ return text
36
+ .replace(/[⌘⌃⌥⇧]/g, (key) => OFF_APPLE[key] ?? key)
37
+ .replace(/\b(mod|cmd)\+/gi, "Ctrl+")
38
+ .replace(/\boption\+/gi, "Alt+");
39
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { BackIcon, BottomIcon, CloseIcon, ExpandIcon, LeftIcon, MaximizeIcon, MinimizeIcon, MoreIcon, PeekIcon, RestoreIcon, RightIcon, SearchIcon, WindowIcon, } from "./icons.js";
2
3
  import { createContext, useContext } from "react";
3
4
  export const DEFAULT_ICONS = {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Destination, focusedRef, formatRef, modalId, PAGE, parseRef, PEEK, refOn, rootRef, sameRef, searchEntries, selectionOf, } from "../domain/index.js";
2
3
  import { useEffect, useLayoutEffect, useRef } from "react";
3
4
  /** The draft moved it from `navigator` to `document`; early builds still have the first. */
@@ -180,6 +181,7 @@ export function workspaceTools({ store, registry, titleOf, open, run, }) {
180
181
  {
181
182
  ref: formatRef(entry.ref),
182
183
  label: entry.label,
184
+ ...(entry.noun === undefined ? {} : { noun: entry.noun }),
183
185
  ...(entry.detail === undefined ? {} : { detail: entry.detail }),
184
186
  },
185
187
  ]
@@ -1,6 +1,37 @@
1
- import { draggable, dropTargetForElements, monitorForElements, } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
1
+ "use client";
2
2
  import { DragKind } from "../domain/index.js";
3
3
  import { useEffect, useState } from "react";
4
+ let adapter = null;
5
+ let loading = null;
6
+ /**
7
+ * Context: the drag-and-drop adapter is loaded the first time a browser registers a drag or a
8
+ * drop, never on import. It resolves only through a bundler (a folder with its own
9
+ * `package.json`, extensionless imports inside): imported statically, a server — plain Node, a
10
+ * framework's server render — could not even import the composer. Effects never run on a
11
+ * server, so a server never asks for it. Once loaded it is kept: every registration after the
12
+ * first is immediate, as it always was.
13
+ *
14
+ * A chunk that fails to load leaves nothing draggable and the workspace working; the next
15
+ * element that mounts asks for it again.
16
+ */
17
+ function withDragAdapter(register) {
18
+ if (adapter !== null)
19
+ return register(adapter);
20
+ let cleanup = null;
21
+ let gone = false;
22
+ loading ??= import("@atlaskit/pragmatic-drag-and-drop/element/adapter").then((loaded) => (adapter = loaded), (error) => {
23
+ loading = null;
24
+ throw error;
25
+ });
26
+ loading.then((loaded) => {
27
+ if (!gone)
28
+ cleanup = register(loaded);
29
+ }, () => undefined);
30
+ return () => {
31
+ gone = true;
32
+ cleanup?.();
33
+ };
34
+ }
4
35
  const isDrag = (v) => v["kind"] === DragKind.Panel || v["kind"] === DragKind.Ref;
5
36
  /** Only a DOCKED panel is dragged to another edge. A window moves with the pointer, and a native
6
37
  * drag on the same header would swallow that gesture — `enabled` keeps the two apart. */
@@ -10,7 +41,7 @@ export function useDraggablePanel(ref, panelId, enabled = true) {
10
41
  const el = ref.current;
11
42
  if (el === null || !enabled)
12
43
  return;
13
- return draggable({
44
+ return withDragAdapter(({ draggable }) => draggable({
14
45
  element: el,
15
46
  getInitialData: () => ({
16
47
  kind: DragKind.Panel,
@@ -18,7 +49,7 @@ export function useDraggablePanel(ref, panelId, enabled = true) {
18
49
  }),
19
50
  onDragStart: () => setDragging(true),
20
51
  onDrop: () => setDragging(false),
21
- });
52
+ }));
22
53
  }, [ref, panelId, enabled]);
23
54
  return dragging;
24
55
  }
@@ -28,7 +59,7 @@ export function useDropZone(ref, zone) {
28
59
  const el = ref.current;
29
60
  if (el === null)
30
61
  return;
31
- return dropTargetForElements({
62
+ return withDragAdapter(({ dropTargetForElements }) => dropTargetForElements({
32
63
  element: el,
33
64
  getData: () => ({ kind: DragKind.Zone, zone }),
34
65
  canDrop: ({ source }) => isDrag(source.data) &&
@@ -36,7 +67,7 @@ export function useDropZone(ref, zone) {
36
67
  onDragEnter: () => setOver(true),
37
68
  onDragLeave: () => setOver(false),
38
69
  onDrop: () => setOver(false),
39
- });
70
+ }));
40
71
  }, [ref, zone]);
41
72
  return over;
42
73
  }
@@ -47,7 +78,7 @@ export function useDraggableRef(ref, resource, enabled = true) {
47
78
  const el = ref.current;
48
79
  if (el === null || !enabled)
49
80
  return;
50
- return draggable({
81
+ return withDragAdapter(({ draggable }) => draggable({
51
82
  element: el,
52
83
  getInitialData: () => ({
53
84
  kind: DragKind.Ref,
@@ -55,7 +86,7 @@ export function useDraggableRef(ref, resource, enabled = true) {
55
86
  }),
56
87
  onDragStart: () => setDragging(true),
57
88
  onDrop: () => setDragging(false),
58
- });
89
+ }));
59
90
  }, [ref, resource, enabled]);
60
91
  return dragging;
61
92
  }
@@ -64,18 +95,18 @@ export function useDraggableRef(ref, resource, enabled = true) {
64
95
  * and the buttons never fire. */
65
96
  export function usePanelDragArmed() {
66
97
  const [armed, setArmed] = useState(false);
67
- useEffect(() => monitorForElements({
98
+ useEffect(() => withDragAdapter(({ monitorForElements }) => monitorForElements({
68
99
  canMonitor: ({ source }) => isDrag(source.data) &&
69
100
  (source.data.kind === DragKind.Panel || source.data.kind === DragKind.Ref),
70
101
  onDragStart: () => setArmed(true),
71
102
  onDrop: () => setArmed(false),
72
- }), []);
103
+ })), []);
73
104
  return armed;
74
105
  }
75
106
  /** One monitor for the whole workspace: drop is ONE event with ONE result.
76
107
  * Split across targets, an overlapping zone and tab would both apply. */
77
108
  export function useDropMonitor({ onPanelToZone, onRefToZone }) {
78
- useEffect(() => monitorForElements({
109
+ useEffect(() => withDragAdapter(({ monitorForElements }) => monitorForElements({
79
110
  canMonitor: ({ source }) => isDrag(source.data),
80
111
  onDrop: ({ source, location }) => {
81
112
  const target = location.current.dropTargets[0];
@@ -91,5 +122,5 @@ export function useDropMonitor({ onPanelToZone, onRefToZone }) {
91
122
  return;
92
123
  }
93
124
  },
94
- }), [onPanelToZone, onRefToZone]);
125
+ })), [onPanelToZone, onRefToZone]);
95
126
  }
@@ -58,16 +58,43 @@ export type WorkspaceStore = {
58
58
  setDirty: (surface: string, ref: ResourceRef, dirty: boolean) => void;
59
59
  /** Where `<Composer>` installs its own dialog. A `confirmDiscard` given to the store wins. */
60
60
  setConfirmDiscard: (confirm: ConfirmDiscard | null) => void;
61
+ /** ⌘K, as the shortcut opens it — for a «Search…» in the app's own menu, which holds the
62
+ * store and not the `<Composer>`. `query` hands it what was already typed there. Nothing
63
+ * while no `<Composer>` draws this workspace; already open, it stays as it is. */
64
+ openPalette: (options?: OpenPaletteOptions) => void;
65
+ /** Where `<Composer>` installs its palette. */
66
+ setOpenPalette: (open: ((options?: OpenPaletteOptions) => void) | null) => void;
67
+ };
68
+ export type OpenPaletteOptions = {
69
+ /** What the search box opens with, searched at once. */
70
+ query?: string;
61
71
  };
62
72
  export type StoreOptions = {
63
73
  initial?: Workspace;
64
74
  /** Persist the workspace in the URL hash. The browser's Back and «share this link» come
65
75
  * from here. */
66
76
  hash?: boolean;
77
+ /**
78
+ * The page is drawn on the server and hydrated (SSR, React Server Components). With `hash`,
79
+ * the store starts at `initial` — what the server drew: it never sees the hash — and takes the
80
+ * URL's place once in the browser: when `useWorkspace` mounts, when someone first listens
81
+ * (`<Composer>`, `useWorkspaceState`, `useSection`) or before its first change, whichever comes
82
+ * first. Without it `hash` reads the URL at once, which a single-page app wants: the link's
83
+ * place on its first frame. Without `hash` it changes nothing.
84
+ */
85
+ serverRendered?: boolean;
67
86
  /** Called after every change. Hook for telemetry or saving the user's workspace. */
68
87
  onChange?: (state: Workspace) => void;
69
88
  /** Asked before a change throws away a view with unsaved changes. Without it, `<Composer>`
70
89
  * asks with its own dialog; with neither, nothing is asked. */
71
90
  confirmDiscard?: ConfirmDiscard;
72
91
  };
73
- export declare function createWorkspaceStore({ initial, hash, onChange, confirmDiscard, }?: StoreOptions): WorkspaceStore;
92
+ /** What a `serverRendered` store with `hash` keeps for the hooks. */
93
+ export type Hydration = {
94
+ /** What the server drew: hydrating, the browser draws the same. */
95
+ server: () => Workspace;
96
+ /** Takes the URL's place now, if it has not yet. */
97
+ takeUrl: () => void;
98
+ };
99
+ export declare const hydrationOf: (store: WorkspaceStore) => Hydration | null;
100
+ export declare function createWorkspaceStore({ initial, hash, serverRendered, onChange, confirmDiscard, }?: StoreOptions): WorkspaceStore;
@@ -32,12 +32,21 @@ const onBeforeUnload = (e) => {
32
32
  e.preventDefault();
33
33
  e.returnValue = "";
34
34
  };
35
- export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onChange, confirmDiscard, } = {}) {
36
- let state = hash ? readPlace(initial) : initial;
35
+ /**
36
+ * Context: the hooks' business, not the app's — so it is not a member of `WorkspaceStore`, whose
37
+ * shape stays the same for whoever builds one of their own (a fake in a test).
38
+ */
39
+ const hydrations = new WeakMap();
40
+ export const hydrationOf = (store) => hydrations.get(store) ?? null;
41
+ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, serverRendered = false, onChange, confirmDiscard, } = {}) {
42
+ /** The URL's place, not read yet: it waits for the browser (`serverRendered`). */
43
+ let waiting = hash && serverRendered;
44
+ let state = hash && !waiting ? readPlace(initial) : initial;
37
45
  const listeners = new Set();
38
46
  /** Surface → the resource it has unsaved changes for. */
39
47
  const dirty = new Map();
40
48
  let installed = null;
49
+ let palette = null;
41
50
  let guarding = false;
42
51
  /** A discard being asked asynchronously: every change after it waits in line, so
43
52
  * `back(); open(ref)` keeps its order. */
@@ -47,6 +56,18 @@ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onCh
47
56
  l();
48
57
  onChange?.(state);
49
58
  };
59
+ /** The URL's place, read once in the browser and announced like any change: until now
60
+ * everyone drew `initial`. */
61
+ function takeUrl() {
62
+ if (!waiting || !inBrowser())
63
+ return;
64
+ waiting = false;
65
+ const url = readPlace(initial);
66
+ if (url === state)
67
+ return;
68
+ state = url;
69
+ notify();
70
+ }
50
71
  /** The browser asks before closing the tab only while something is unsaved. */
51
72
  function guardUnload() {
52
73
  const want = dirty.size > 0;
@@ -115,7 +136,10 @@ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onCh
115
136
  const answer = ask(lost);
116
137
  return answer instanceof Promise ? answer.then(proceed) : proceed(answer);
117
138
  }
139
+ /** A change starts from where the URL says: a store that moved before reading it would write
140
+ * its own place over the link. */
118
141
  function go(change, mode = History.Auto) {
142
+ takeUrl();
119
143
  const result = line === null ? run(change, mode) : line.then(() => run(change, mode));
120
144
  if (!(result instanceof Promise))
121
145
  return;
@@ -152,7 +176,10 @@ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onCh
152
176
  else
153
177
  settle(answer);
154
178
  }
179
+ /** Hydrating, React listens only after drawing what the server drew: the first listener in
180
+ * the browser is when the URL's place can be taken. */
155
181
  const subscribe = (listener) => {
182
+ takeUrl();
156
183
  listeners.add(listener);
157
184
  if (listeners.size === 1 && hash && inBrowser())
158
185
  window.addEventListener("popstate", onPopState);
@@ -162,7 +189,7 @@ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onCh
162
189
  window.removeEventListener("popstate", onPopState);
163
190
  };
164
191
  };
165
- return {
192
+ const store = {
166
193
  get: () => state,
167
194
  subscribe,
168
195
  apply: (change) => go(change),
@@ -209,5 +236,12 @@ export function createWorkspaceStore({ initial = model.EMPTY, hash = false, onCh
209
236
  setConfirmDiscard: (confirm) => {
210
237
  installed = confirm;
211
238
  },
239
+ openPalette: (options) => palette?.(options),
240
+ setOpenPalette: (open) => {
241
+ palette = open;
242
+ },
212
243
  };
244
+ if (waiting)
245
+ hydrations.set(store, { server: () => initial, takeUrl });
246
+ return store;
213
247
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { MODAL, PAGE, PEEK } from "../domain/index.js";
2
3
  import { useEffect } from "react";
3
4
  /** Inside a field only Escape survives. Stealing a key from someone who is typing is worse than
@@ -4,7 +4,14 @@ import { type StoreOptions, type WorkspaceStore } from "./store.js";
4
4
  * `useSyncExternalStore` is React, not a state library. What it adds over
5
5
  * `useState` is the one thing we needed: subscribe to a slice, so moving one
6
6
  * panel does not redraw the other five.
7
+ *
8
+ * Its server snapshot is what the server drew: the store as it is, or — `serverRendered` —
9
+ * `initial`, so a part hydrated late (a Suspense boundary) still matches the server's HTML
10
+ * after the store took the URL's place.
7
11
  */
12
+ /** The workspace an app holds. Server-rendered, `{ hash: true, serverRendered: true }`: the
13
+ * first render is the server's, and the URL's place comes once mounted — before the effects of
14
+ * the component that holds it, which may ask `get()` where it is. */
8
15
  export declare function useWorkspace(options?: StoreOptions): WorkspaceStore;
9
16
  export declare function useWorkspaceState(store: WorkspaceStore): Workspace;
10
17
  /** For a global panel — the chat, the assistant — that follows what the user
@@ -1,18 +1,28 @@
1
+ "use client";
1
2
  import { sectionOf, } from "../domain/index.js";
2
- import { createWorkspaceStore, } from "./store.js";
3
- import { useRef, useSyncExternalStore } from "react";
3
+ import { createWorkspaceStore, hydrationOf, } from "./store.js";
4
+ import { useEffect, useRef, useSyncExternalStore } from "react";
4
5
  /**
5
6
  * `useSyncExternalStore` is React, not a state library. What it adds over
6
7
  * `useState` is the one thing we needed: subscribe to a slice, so moving one
7
8
  * panel does not redraw the other five.
9
+ *
10
+ * Its server snapshot is what the server drew: the store as it is, or — `serverRendered` —
11
+ * `initial`, so a part hydrated late (a Suspense boundary) still matches the server's HTML
12
+ * after the store took the URL's place.
8
13
  */
14
+ /** The workspace an app holds. Server-rendered, `{ hash: true, serverRendered: true }`: the
15
+ * first render is the server's, and the URL's place comes once mounted — before the effects of
16
+ * the component that holds it, which may ask `get()` where it is. */
9
17
  export function useWorkspace(options = {}) {
10
18
  const saved = useRef(null);
11
19
  saved.current ??= createWorkspaceStore(options);
12
- return saved.current;
20
+ const store = saved.current;
21
+ useEffect(() => hydrationOf(store)?.takeUrl(), [store]);
22
+ return store;
13
23
  }
14
24
  export function useWorkspaceState(store) {
15
- return useSyncExternalStore(store.subscribe, store.get, store.get);
25
+ return useSyncExternalStore(store.subscribe, store.get, hydrationOf(store)?.server ?? store.get);
16
26
  }
17
27
  /** For a global panel — the chat, the assistant — that follows what the user
18
28
  * is working on. Redraws only when the focused resource or its selection change. */
@@ -40,5 +50,7 @@ export function usePhone(api) {
40
50
  * panel. */
41
51
  export function useSection(store, sections) {
42
52
  const read = () => sectionOf(store.get(), sections);
43
- return useSyncExternalStore(store.subscribe, read, read);
53
+ const server = hydrationOf(store)?.server;
54
+ const drawn = server === undefined ? read : () => sectionOf(server(), sections);
55
+ return useSyncExternalStore(store.subscribe, read, drawn);
44
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-composer",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "The Sincpro workspace for React: one page with its breadcrumb, a peek, side panels and windows, and ⌘K — all over references, never data.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",