@ai-matrx/canvas 0.1.1 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CanvasItemId, a as CanvasJson, b as CanvasLayoutNode, c as CanvasPaneId, d as CanvasState, e as CanvasItem, f as CanvasPane } from './controller-oY84BN2c.cjs';
2
- export { g as CANVAS_DEFAULT_WIDTH, h as CANVAS_MIN_SPLIT_FRACTION, i as CANVAS_MIN_WIDTH, j as CANVAS_STORAGE_KEY, k as CanvasAction, l as CanvasController, m as CanvasControllerOptions, n as CanvasErrorReport, o as CanvasErrorSink, p as CanvasOpenInput, q as CanvasOpenTarget, r as CanvasOrientation, s as CanvasPersistencePort, t as CanvasSplitId, u as CanvasStoreBinding, R as ReduxStoreLike, v as bindCanvasToReduxStore, w as canvasActions, x as canvasReducer, y as consoleCanvasErrorSink, z as createCanvasController, A as createCanvasStore, B as createInitialCanvasState, D as createLocalStorageCanvasPersistence, E as isCanvasAction, F as sanitizeCanvasSnapshot, G as toPersistableSnapshot } from './controller-oY84BN2c.cjs';
1
+ import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './controller-Dv6J6XZm.cjs';
2
+ export { m as CANVAS_DEFAULT_WIDTH, n as CANVAS_DESKTOP_LAYOUT_RULES, o as CANVAS_MAIN_WINDOW, p as CANVAS_MIN_SPLIT_FRACTION, q as CANVAS_MIN_WIDTH, r as CANVAS_STORAGE_KEY, s as CANVAS_WEB_LAYOUT_RULES, t as CanvasControllerOptions, u as CanvasErrorReport, v as CanvasErrorSink, w as CanvasKeyValueStore, x as CanvasLayoutRules, y as CanvasOpenInput, z as CanvasOpenTarget, A as CanvasOrientation, B as CanvasPersistencePort, D as CanvasRect, E as CanvasSessionAttachReason, F as CanvasSessionDetachReason, G as CanvasSessionEvent, H as CanvasSessionHooks, I as CanvasSplitId, J as CanvasWindowCloseMode, K as CanvasWindowFrame, L as CanvasWindowPorts, R as ReduxStoreLike, M as bindCanvasToReduxStore, N as canvasActions, O as canvasReducer, P as canvasWindowFrame, Q as canvasWindowOfPane, S as clampDraggedCanvasWidth, T as consoleCanvasErrorSink, U as createCanvasController, V as createCanvasStore, W as createInitialCanvasState, X as createKeyValueCanvasPersistence, Y as createLocalStorageCanvasPersistence, Z as defaultCanvasWidth, _ as fitCanvasWidth, $ as foldCanvasWindows, a0 as isCanvasAction, a1 as listCanvasWindowIds, a2 as resolveCanvasLayoutRules, a3 as sanitizeCanvasSnapshot, a4 as shouldStackSplit, a5 as toPersistableSnapshot } from './controller-Dv6J6XZm.cjs';
3
3
 
4
4
  declare function canvasItemId(kind: string, key: string): CanvasItemId;
5
5
  declare function parseCanvasItemId(id: CanvasItemId): {
@@ -13,6 +13,8 @@ declare function parseCanvasItemId(id: CanvasItemId): {
13
13
  */
14
14
  declare function findNonJson(value: unknown, path?: string): string | null;
15
15
  declare function isCanvasJson(value: unknown): value is CanvasJson;
16
+ /** Brands a host's window id. `CANVAS_MAIN_WINDOW` is the default window. */
17
+ declare function canvasWindowId(id: string): CanvasWindowId;
16
18
 
17
19
  /**
18
20
  * Pure helpers over the canvas layout tree. Every function returns a new tree
@@ -23,17 +25,122 @@ declare function listPaneIds(node: CanvasLayoutNode): CanvasPaneId[];
23
25
  /** Renormalizes to sum 1; falls back to even sizes for garbage input. */
24
26
  declare function normalizeSizes(sizes: readonly number[], count: number): number[];
25
27
 
26
- declare const selectCanvasIsOpen: (s: CanvasState) => boolean;
27
- declare const selectCanvasIsFullscreen: (s: CanvasState) => boolean;
28
- declare const selectCanvasWidth: (s: CanvasState) => number;
29
- declare const selectCanvasLayout: (s: CanvasState) => CanvasLayoutNode;
30
- declare const selectCanvasFocusedPaneId: (s: CanvasState) => CanvasPaneId;
28
+ /**
29
+ * A canvas store that lives in ANOTHER process — an Electron renderer bound to
30
+ * the one store in the main process over IPC.
31
+ *
32
+ * - dispatch is async and fire-and-forget: the action goes to the owner, and
33
+ * the state changes when the owner's next snapshot arrives (no optimistic
34
+ * copy that could disagree with the owner);
35
+ * - every update is a WHOLE snapshot with no shared object identity, so each
36
+ * one is merged into the previous state structurally: anything unchanged
37
+ * keeps its old reference, an identical snapshot changes nothing and wakes
38
+ * nobody — selector results stay stable and useSyncExternalStore never loops;
39
+ * - the binding is marked `authority: "remote"`: the owner hydrates and saves,
40
+ * so a controller over it never does.
41
+ *
42
+ * The owner side (main process) is the ordinary `createCanvasStore()` +
43
+ * `createCanvasController({ persistence })`; see the README.
44
+ */
45
+
46
+ interface RemoteCanvasStoreOptions {
47
+ /** The owner's state at connect time (e.g. from an `invoke("canvas:get")`). */
48
+ readonly initialSnapshot: CanvasState;
49
+ /** Sends one action to the owner. A rejection is reported, never swallowed. */
50
+ readonly dispatch: (action: CanvasAction) => Promise<void> | void;
51
+ /** Delivers every new owner snapshot; returns the unsubscribe. */
52
+ readonly subscribe: (onSnapshot: (snapshot: CanvasState) => void) => () => void;
53
+ /** Where a failed dispatch is reported. Default: console.error. */
54
+ readonly onError?: ((error: unknown, action: CanvasAction) => void) | undefined;
55
+ }
56
+ interface RemoteCanvasStore extends CanvasStoreBinding {
57
+ /** Stops listening to the owner. */
58
+ dispose(): void;
59
+ }
60
+ declare function createRemoteCanvasStore(options: RemoteCanvasStoreOptions): RemoteCanvasStore;
61
+ /**
62
+ * Returns `next`, but with every subtree that is deep-equal to the same subtree
63
+ * of `prev` replaced by `prev`'s object. When nothing changed it returns `prev`
64
+ * itself. Plain JSON only (what crosses a process boundary).
65
+ */
66
+ declare function shareStructure<T>(prev: T, next: T): T;
67
+
68
+ /**
69
+ * The canvas's keyboard shortcuts, as DATA. A web host gets them bound in the
70
+ * DOM by `CanvasProvider`; a desktop host binds the same table in its main
71
+ * process (menu accelerators / `before-input-event`), because keys pressed
72
+ * inside a native web view never reach the renderer's DOM. Every shortcut runs
73
+ * through `runCanvasCommand`, so both paths do exactly the same thing.
74
+ */
75
+
76
+ type CanvasCommandId = "canvas.toggle" | "canvas.toggleFullscreen" | "canvas.exitFullscreen" | "canvas.closeTab" | "canvas.nextTab" | "canvas.previousTab" | "canvas.splitRight" | "canvas.splitDown";
77
+ /**
78
+ * When a shortcut applies:
79
+ * - "presented": a canvas column is on screen in this window;
80
+ * - "fullscreen": the canvas is expanded (and Escape is not owned by a menu or dialog);
81
+ * - "canvas-focus": keyboard focus is inside the canvas (a tab, a pane, a native body).
82
+ */
83
+ type CanvasShortcutWhen = "presented" | "fullscreen" | "canvas-focus";
84
+ interface CanvasShortcut {
85
+ readonly id: CanvasCommandId;
86
+ /** Electron accelerator syntax: "CmdOrCtrl+\\", "Escape", "Ctrl+Shift+Tab". */
87
+ readonly accelerator: string;
88
+ readonly when: CanvasShortcutWhen;
89
+ readonly label: string;
90
+ /** False when browsers reserve the keys (⌘W, Ctrl+Tab): only a desktop host can bind it. */
91
+ readonly web: boolean;
92
+ }
93
+ declare const CANVAS_SHORTCUTS: readonly CanvasShortcut[];
94
+ /** The tooltip hint for a command, e.g. "⌘\\" on a Mac. */
95
+ declare function canvasShortcutHint(id: CanvasCommandId, isMac: boolean): string | null;
96
+ /**
97
+ * Runs one command against a window's canvas. Returns true when it did
98
+ * something (so a binding knows whether to swallow the key).
99
+ */
100
+ declare function runCanvasCommand(controller: CanvasController, id: CanvasCommandId, windowId?: CanvasWindowId): boolean;
101
+ /** The subset of a KeyboardEvent an accelerator is matched against. */
102
+ interface CanvasKeyInput {
103
+ readonly key: string;
104
+ readonly code?: string;
105
+ readonly metaKey: boolean;
106
+ readonly ctrlKey: boolean;
107
+ readonly altKey: boolean;
108
+ readonly shiftKey: boolean;
109
+ }
110
+ /**
111
+ * Whether a key event is this accelerator. "CmdOrCtrl" is ⌘ on a Mac and Ctrl
112
+ * elsewhere; symbol keys match by physical key (⌥\ types « on a Mac).
113
+ */
114
+ declare function matchesCanvasAccelerator(input: CanvasKeyInput, accelerator: string, isMac: boolean): boolean;
115
+
116
+ /**
117
+ * Selectors over CanvasState. Each returns a value that is referentially
118
+ * stable for an unchanged state, so they are safe in useSyncExternalStore and
119
+ * in a host's useSelector. Window-scoped selectors default to the main window;
120
+ * an unknown window reads as closed and empty.
121
+ */
122
+
123
+ declare const selectCanvasIsOpen: (s: CanvasState, windowId?: CanvasWindowId) => boolean;
124
+ declare const selectCanvasIsFullscreen: (s: CanvasState, windowId?: CanvasWindowId) => boolean;
125
+ /** The width the person chose, or null while the host's layout rule decides. */
126
+ declare const selectCanvasWidth: (s: CanvasState, windowId?: CanvasWindowId) => number | null;
127
+ declare const selectCanvasLayout: (s: CanvasState, windowId?: CanvasWindowId) => CanvasLayoutNode | null;
128
+ declare const selectCanvasFocusedPaneId: (s: CanvasState, windowId?: CanvasWindowId) => CanvasPaneId | null;
31
129
  declare const selectCanvasIsHydrated: (s: CanvasState) => boolean;
130
+ /** Every item on the canvas, in every window. */
32
131
  declare const selectCanvasItemCount: (s: CanvasState) => number;
33
132
  declare const selectCanvasPane: (s: CanvasState, paneId: CanvasPaneId) => CanvasPane | undefined;
34
133
  declare const selectCanvasItem: (s: CanvasState, itemId: CanvasItemId) => CanvasItem | undefined;
35
- declare function selectCanvasPaneCount(s: CanvasState): number;
36
- /** The item the person is looking at in the focused pane. */
37
- declare function selectCanvasActiveItem(s: CanvasState): CanvasItem | null;
134
+ declare function selectCanvasPaneCount(s: CanvasState, windowId?: CanvasWindowId): number;
135
+ /** Items shown in one window. */
136
+ declare function selectCanvasWindowItemCount(s: CanvasState, windowId?: CanvasWindowId): number;
137
+ /** The item the person is looking at in a window's focused pane. */
138
+ declare function selectCanvasActiveItem(s: CanvasState, windowId?: CanvasWindowId): CanvasItem | null;
139
+ /** Windows other than main (second app windows and pop-outs), by id. Stable per state. */
140
+ declare function selectCanvasWindows(s: CanvasState): CanvasState["windows"];
141
+ /** One extra window, or undefined (main is never in this map). */
142
+ declare const selectCanvasExtraWindow: (s: CanvasState, windowId: CanvasWindowId) => CanvasExtraWindow | undefined;
143
+ /** The window an item is in, or null when it is not on the canvas. */
144
+ declare const selectCanvasWindowOfItem: typeof canvasWindowOfItem;
38
145
 
39
- export { CanvasItem, CanvasItemId, CanvasJson, CanvasLayoutNode, CanvasPane, CanvasPaneId, CanvasState, canvasItemId, findNonJson, isCanvasJson, listPaneIds, normalizeSizes, parseCanvasItemId, selectCanvasActiveItem, selectCanvasFocusedPaneId, selectCanvasIsFullscreen, selectCanvasIsHydrated, selectCanvasIsOpen, selectCanvasItem, selectCanvasItemCount, selectCanvasLayout, selectCanvasPane, selectCanvasPaneCount, selectCanvasWidth };
146
+ export { CANVAS_SHORTCUTS, CanvasAction, type CanvasCommandId, CanvasController, CanvasExtraWindow, CanvasItem, CanvasItemId, CanvasJson, type CanvasKeyInput, CanvasLayoutNode, CanvasPane, CanvasPaneId, type CanvasShortcut, type CanvasShortcutWhen, CanvasState, CanvasStoreBinding, CanvasWindowId, type RemoteCanvasStore, type RemoteCanvasStoreOptions, canvasItemId, canvasShortcutHint, canvasWindowId, canvasWindowOfItem, createRemoteCanvasStore, findNonJson, isCanvasJson, listPaneIds, matchesCanvasAccelerator, normalizeSizes, parseCanvasItemId, runCanvasCommand, selectCanvasActiveItem, selectCanvasExtraWindow, selectCanvasFocusedPaneId, selectCanvasIsFullscreen, selectCanvasIsHydrated, selectCanvasIsOpen, selectCanvasItem, selectCanvasItemCount, selectCanvasLayout, selectCanvasPane, selectCanvasPaneCount, selectCanvasWidth, selectCanvasWindowItemCount, selectCanvasWindowOfItem, selectCanvasWindows, shareStructure };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CanvasItemId, a as CanvasJson, b as CanvasLayoutNode, c as CanvasPaneId, d as CanvasState, e as CanvasItem, f as CanvasPane } from './controller-oY84BN2c.js';
2
- export { g as CANVAS_DEFAULT_WIDTH, h as CANVAS_MIN_SPLIT_FRACTION, i as CANVAS_MIN_WIDTH, j as CANVAS_STORAGE_KEY, k as CanvasAction, l as CanvasController, m as CanvasControllerOptions, n as CanvasErrorReport, o as CanvasErrorSink, p as CanvasOpenInput, q as CanvasOpenTarget, r as CanvasOrientation, s as CanvasPersistencePort, t as CanvasSplitId, u as CanvasStoreBinding, R as ReduxStoreLike, v as bindCanvasToReduxStore, w as canvasActions, x as canvasReducer, y as consoleCanvasErrorSink, z as createCanvasController, A as createCanvasStore, B as createInitialCanvasState, D as createLocalStorageCanvasPersistence, E as isCanvasAction, F as sanitizeCanvasSnapshot, G as toPersistableSnapshot } from './controller-oY84BN2c.js';
1
+ import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './controller-Dv6J6XZm.js';
2
+ export { m as CANVAS_DEFAULT_WIDTH, n as CANVAS_DESKTOP_LAYOUT_RULES, o as CANVAS_MAIN_WINDOW, p as CANVAS_MIN_SPLIT_FRACTION, q as CANVAS_MIN_WIDTH, r as CANVAS_STORAGE_KEY, s as CANVAS_WEB_LAYOUT_RULES, t as CanvasControllerOptions, u as CanvasErrorReport, v as CanvasErrorSink, w as CanvasKeyValueStore, x as CanvasLayoutRules, y as CanvasOpenInput, z as CanvasOpenTarget, A as CanvasOrientation, B as CanvasPersistencePort, D as CanvasRect, E as CanvasSessionAttachReason, F as CanvasSessionDetachReason, G as CanvasSessionEvent, H as CanvasSessionHooks, I as CanvasSplitId, J as CanvasWindowCloseMode, K as CanvasWindowFrame, L as CanvasWindowPorts, R as ReduxStoreLike, M as bindCanvasToReduxStore, N as canvasActions, O as canvasReducer, P as canvasWindowFrame, Q as canvasWindowOfPane, S as clampDraggedCanvasWidth, T as consoleCanvasErrorSink, U as createCanvasController, V as createCanvasStore, W as createInitialCanvasState, X as createKeyValueCanvasPersistence, Y as createLocalStorageCanvasPersistence, Z as defaultCanvasWidth, _ as fitCanvasWidth, $ as foldCanvasWindows, a0 as isCanvasAction, a1 as listCanvasWindowIds, a2 as resolveCanvasLayoutRules, a3 as sanitizeCanvasSnapshot, a4 as shouldStackSplit, a5 as toPersistableSnapshot } from './controller-Dv6J6XZm.js';
3
3
 
4
4
  declare function canvasItemId(kind: string, key: string): CanvasItemId;
5
5
  declare function parseCanvasItemId(id: CanvasItemId): {
@@ -13,6 +13,8 @@ declare function parseCanvasItemId(id: CanvasItemId): {
13
13
  */
14
14
  declare function findNonJson(value: unknown, path?: string): string | null;
15
15
  declare function isCanvasJson(value: unknown): value is CanvasJson;
16
+ /** Brands a host's window id. `CANVAS_MAIN_WINDOW` is the default window. */
17
+ declare function canvasWindowId(id: string): CanvasWindowId;
16
18
 
17
19
  /**
18
20
  * Pure helpers over the canvas layout tree. Every function returns a new tree
@@ -23,17 +25,122 @@ declare function listPaneIds(node: CanvasLayoutNode): CanvasPaneId[];
23
25
  /** Renormalizes to sum 1; falls back to even sizes for garbage input. */
24
26
  declare function normalizeSizes(sizes: readonly number[], count: number): number[];
25
27
 
26
- declare const selectCanvasIsOpen: (s: CanvasState) => boolean;
27
- declare const selectCanvasIsFullscreen: (s: CanvasState) => boolean;
28
- declare const selectCanvasWidth: (s: CanvasState) => number;
29
- declare const selectCanvasLayout: (s: CanvasState) => CanvasLayoutNode;
30
- declare const selectCanvasFocusedPaneId: (s: CanvasState) => CanvasPaneId;
28
+ /**
29
+ * A canvas store that lives in ANOTHER process — an Electron renderer bound to
30
+ * the one store in the main process over IPC.
31
+ *
32
+ * - dispatch is async and fire-and-forget: the action goes to the owner, and
33
+ * the state changes when the owner's next snapshot arrives (no optimistic
34
+ * copy that could disagree with the owner);
35
+ * - every update is a WHOLE snapshot with no shared object identity, so each
36
+ * one is merged into the previous state structurally: anything unchanged
37
+ * keeps its old reference, an identical snapshot changes nothing and wakes
38
+ * nobody — selector results stay stable and useSyncExternalStore never loops;
39
+ * - the binding is marked `authority: "remote"`: the owner hydrates and saves,
40
+ * so a controller over it never does.
41
+ *
42
+ * The owner side (main process) is the ordinary `createCanvasStore()` +
43
+ * `createCanvasController({ persistence })`; see the README.
44
+ */
45
+
46
+ interface RemoteCanvasStoreOptions {
47
+ /** The owner's state at connect time (e.g. from an `invoke("canvas:get")`). */
48
+ readonly initialSnapshot: CanvasState;
49
+ /** Sends one action to the owner. A rejection is reported, never swallowed. */
50
+ readonly dispatch: (action: CanvasAction) => Promise<void> | void;
51
+ /** Delivers every new owner snapshot; returns the unsubscribe. */
52
+ readonly subscribe: (onSnapshot: (snapshot: CanvasState) => void) => () => void;
53
+ /** Where a failed dispatch is reported. Default: console.error. */
54
+ readonly onError?: ((error: unknown, action: CanvasAction) => void) | undefined;
55
+ }
56
+ interface RemoteCanvasStore extends CanvasStoreBinding {
57
+ /** Stops listening to the owner. */
58
+ dispose(): void;
59
+ }
60
+ declare function createRemoteCanvasStore(options: RemoteCanvasStoreOptions): RemoteCanvasStore;
61
+ /**
62
+ * Returns `next`, but with every subtree that is deep-equal to the same subtree
63
+ * of `prev` replaced by `prev`'s object. When nothing changed it returns `prev`
64
+ * itself. Plain JSON only (what crosses a process boundary).
65
+ */
66
+ declare function shareStructure<T>(prev: T, next: T): T;
67
+
68
+ /**
69
+ * The canvas's keyboard shortcuts, as DATA. A web host gets them bound in the
70
+ * DOM by `CanvasProvider`; a desktop host binds the same table in its main
71
+ * process (menu accelerators / `before-input-event`), because keys pressed
72
+ * inside a native web view never reach the renderer's DOM. Every shortcut runs
73
+ * through `runCanvasCommand`, so both paths do exactly the same thing.
74
+ */
75
+
76
+ type CanvasCommandId = "canvas.toggle" | "canvas.toggleFullscreen" | "canvas.exitFullscreen" | "canvas.closeTab" | "canvas.nextTab" | "canvas.previousTab" | "canvas.splitRight" | "canvas.splitDown";
77
+ /**
78
+ * When a shortcut applies:
79
+ * - "presented": a canvas column is on screen in this window;
80
+ * - "fullscreen": the canvas is expanded (and Escape is not owned by a menu or dialog);
81
+ * - "canvas-focus": keyboard focus is inside the canvas (a tab, a pane, a native body).
82
+ */
83
+ type CanvasShortcutWhen = "presented" | "fullscreen" | "canvas-focus";
84
+ interface CanvasShortcut {
85
+ readonly id: CanvasCommandId;
86
+ /** Electron accelerator syntax: "CmdOrCtrl+\\", "Escape", "Ctrl+Shift+Tab". */
87
+ readonly accelerator: string;
88
+ readonly when: CanvasShortcutWhen;
89
+ readonly label: string;
90
+ /** False when browsers reserve the keys (⌘W, Ctrl+Tab): only a desktop host can bind it. */
91
+ readonly web: boolean;
92
+ }
93
+ declare const CANVAS_SHORTCUTS: readonly CanvasShortcut[];
94
+ /** The tooltip hint for a command, e.g. "⌘\\" on a Mac. */
95
+ declare function canvasShortcutHint(id: CanvasCommandId, isMac: boolean): string | null;
96
+ /**
97
+ * Runs one command against a window's canvas. Returns true when it did
98
+ * something (so a binding knows whether to swallow the key).
99
+ */
100
+ declare function runCanvasCommand(controller: CanvasController, id: CanvasCommandId, windowId?: CanvasWindowId): boolean;
101
+ /** The subset of a KeyboardEvent an accelerator is matched against. */
102
+ interface CanvasKeyInput {
103
+ readonly key: string;
104
+ readonly code?: string;
105
+ readonly metaKey: boolean;
106
+ readonly ctrlKey: boolean;
107
+ readonly altKey: boolean;
108
+ readonly shiftKey: boolean;
109
+ }
110
+ /**
111
+ * Whether a key event is this accelerator. "CmdOrCtrl" is ⌘ on a Mac and Ctrl
112
+ * elsewhere; symbol keys match by physical key (⌥\ types « on a Mac).
113
+ */
114
+ declare function matchesCanvasAccelerator(input: CanvasKeyInput, accelerator: string, isMac: boolean): boolean;
115
+
116
+ /**
117
+ * Selectors over CanvasState. Each returns a value that is referentially
118
+ * stable for an unchanged state, so they are safe in useSyncExternalStore and
119
+ * in a host's useSelector. Window-scoped selectors default to the main window;
120
+ * an unknown window reads as closed and empty.
121
+ */
122
+
123
+ declare const selectCanvasIsOpen: (s: CanvasState, windowId?: CanvasWindowId) => boolean;
124
+ declare const selectCanvasIsFullscreen: (s: CanvasState, windowId?: CanvasWindowId) => boolean;
125
+ /** The width the person chose, or null while the host's layout rule decides. */
126
+ declare const selectCanvasWidth: (s: CanvasState, windowId?: CanvasWindowId) => number | null;
127
+ declare const selectCanvasLayout: (s: CanvasState, windowId?: CanvasWindowId) => CanvasLayoutNode | null;
128
+ declare const selectCanvasFocusedPaneId: (s: CanvasState, windowId?: CanvasWindowId) => CanvasPaneId | null;
31
129
  declare const selectCanvasIsHydrated: (s: CanvasState) => boolean;
130
+ /** Every item on the canvas, in every window. */
32
131
  declare const selectCanvasItemCount: (s: CanvasState) => number;
33
132
  declare const selectCanvasPane: (s: CanvasState, paneId: CanvasPaneId) => CanvasPane | undefined;
34
133
  declare const selectCanvasItem: (s: CanvasState, itemId: CanvasItemId) => CanvasItem | undefined;
35
- declare function selectCanvasPaneCount(s: CanvasState): number;
36
- /** The item the person is looking at in the focused pane. */
37
- declare function selectCanvasActiveItem(s: CanvasState): CanvasItem | null;
134
+ declare function selectCanvasPaneCount(s: CanvasState, windowId?: CanvasWindowId): number;
135
+ /** Items shown in one window. */
136
+ declare function selectCanvasWindowItemCount(s: CanvasState, windowId?: CanvasWindowId): number;
137
+ /** The item the person is looking at in a window's focused pane. */
138
+ declare function selectCanvasActiveItem(s: CanvasState, windowId?: CanvasWindowId): CanvasItem | null;
139
+ /** Windows other than main (second app windows and pop-outs), by id. Stable per state. */
140
+ declare function selectCanvasWindows(s: CanvasState): CanvasState["windows"];
141
+ /** One extra window, or undefined (main is never in this map). */
142
+ declare const selectCanvasExtraWindow: (s: CanvasState, windowId: CanvasWindowId) => CanvasExtraWindow | undefined;
143
+ /** The window an item is in, or null when it is not on the canvas. */
144
+ declare const selectCanvasWindowOfItem: typeof canvasWindowOfItem;
38
145
 
39
- export { CanvasItem, CanvasItemId, CanvasJson, CanvasLayoutNode, CanvasPane, CanvasPaneId, CanvasState, canvasItemId, findNonJson, isCanvasJson, listPaneIds, normalizeSizes, parseCanvasItemId, selectCanvasActiveItem, selectCanvasFocusedPaneId, selectCanvasIsFullscreen, selectCanvasIsHydrated, selectCanvasIsOpen, selectCanvasItem, selectCanvasItemCount, selectCanvasLayout, selectCanvasPane, selectCanvasPaneCount, selectCanvasWidth };
146
+ export { CANVAS_SHORTCUTS, CanvasAction, type CanvasCommandId, CanvasController, CanvasExtraWindow, CanvasItem, CanvasItemId, CanvasJson, type CanvasKeyInput, CanvasLayoutNode, CanvasPane, CanvasPaneId, type CanvasShortcut, type CanvasShortcutWhen, CanvasState, CanvasStoreBinding, CanvasWindowId, type RemoteCanvasStore, type RemoteCanvasStoreOptions, canvasItemId, canvasShortcutHint, canvasWindowId, canvasWindowOfItem, createRemoteCanvasStore, findNonJson, isCanvasJson, listPaneIds, matchesCanvasAccelerator, normalizeSizes, parseCanvasItemId, runCanvasCommand, selectCanvasActiveItem, selectCanvasExtraWindow, selectCanvasFocusedPaneId, selectCanvasIsFullscreen, selectCanvasIsHydrated, selectCanvasIsOpen, selectCanvasItem, selectCanvasItemCount, selectCanvasLayout, selectCanvasPane, selectCanvasPaneCount, selectCanvasWidth, selectCanvasWindowItemCount, selectCanvasWindowOfItem, selectCanvasWindows, shareStructure };