@ai-matrx/canvas 0.8.5 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +5 -4
- package/dist/index.cjs +63 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +197 -65
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +23 -7
- package/dist/react.d.ts +23 -7
- package/dist/react.js +197 -65
- package/dist/react.js.map +1 -1
- package/dist/styles.css +15 -10
- package/dist/{toggleKind-BoFnqhzq.d.cts → toggleKind-CI2nBjum.d.cts} +47 -2
- package/dist/{toggleKind-BoFnqhzq.d.ts → toggleKind-CI2nBjum.d.ts} +47 -2
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -453,9 +453,9 @@
|
|
|
453
453
|
* THE STRIP takes the header's free width (flex-basis 0: what it shows never
|
|
454
454
|
* changes how wide it is). Tabs share it evenly — 12rem each with room,
|
|
455
455
|
* shrinking together to a readable floor (--mxc-tab-min: icon + ~10 letters +
|
|
456
|
-
* "…") — and past the floor the
|
|
457
|
-
*
|
|
458
|
-
* never
|
|
456
|
+
* "…") — and past the floor only the tabs that fit WHOLE are drawn, around
|
|
457
|
+
* the current one; "All tabs" holds the rest. A tab is never sliced at an
|
|
458
|
+
* edge, never a sliver, and nothing overlaps a control.
|
|
459
459
|
*/
|
|
460
460
|
.mxc-tabstrip {
|
|
461
461
|
flex: 1 1 0;
|
|
@@ -474,17 +474,16 @@
|
|
|
474
474
|
display: flex;
|
|
475
475
|
align-items: center;
|
|
476
476
|
gap: 0.125rem;
|
|
477
|
-
overflow
|
|
478
|
-
overflow-y: hidden;
|
|
479
|
-
overscroll-behavior-x: contain;
|
|
480
|
-
scrollbar-width: none;
|
|
477
|
+
overflow: hidden;
|
|
481
478
|
}
|
|
482
479
|
|
|
483
|
-
.
|
|
484
|
-
|
|
480
|
+
/* The current tab alone is wider than the room (a phone's header): it goes under its floor, its name ending in "…". */
|
|
481
|
+
.mxc-tabs[data-squeezed] > .mxc-tab,
|
|
482
|
+
.mxc-tabs[data-squeezed] > .mxc-tab-group {
|
|
483
|
+
min-width: 0;
|
|
485
484
|
}
|
|
486
485
|
|
|
487
|
-
/* "All tabs":
|
|
486
|
+
/* "All tabs": how many tabs are out of the strip, and a chevron. */
|
|
488
487
|
.mxc-tab-list {
|
|
489
488
|
flex: none;
|
|
490
489
|
width: auto;
|
|
@@ -493,6 +492,12 @@
|
|
|
493
492
|
padding: 0 0.25rem;
|
|
494
493
|
}
|
|
495
494
|
|
|
495
|
+
.mxc-tab-list-count {
|
|
496
|
+
font-size: 0.6875rem;
|
|
497
|
+
font-variant-numeric: tabular-nums;
|
|
498
|
+
line-height: 1;
|
|
499
|
+
}
|
|
500
|
+
|
|
496
501
|
.mxc-tab-list-menu {
|
|
497
502
|
max-height: min(24rem, 70vh);
|
|
498
503
|
overflow-y: auto;
|
|
@@ -491,6 +491,12 @@ declare function toPersistableSnapshot(state: CanvasState, isRestorable: (kind:
|
|
|
491
491
|
*/
|
|
492
492
|
/** The web's narrowest side-by-side pane (px): below it, a side-by-side split renders stacked. */
|
|
493
493
|
declare const CANVAS_PANE_MIN_WIDTH = 280;
|
|
494
|
+
/**
|
|
495
|
+
* The shortest pane (px): its header plus a body that shows a few rows of a
|
|
496
|
+
* list. A stack gives every pane at least this; a split that cannot opens the
|
|
497
|
+
* other way, or as a tab.
|
|
498
|
+
*/
|
|
499
|
+
declare const CANVAS_PANE_MIN_HEIGHT = 200;
|
|
494
500
|
interface CanvasLayoutRules {
|
|
495
501
|
/** Width before the person drags the edge: CSS px, or a fraction of the region the canvas shares. */
|
|
496
502
|
readonly defaultWidth: number | {
|
|
@@ -506,6 +512,8 @@ interface CanvasLayoutRules {
|
|
|
506
512
|
readonly sideSplit: number;
|
|
507
513
|
/** Side-by-side panes that would be narrower than this render stacked. 0 = never. */
|
|
508
514
|
readonly paneMinWidth: number;
|
|
515
|
+
/** Stacked panes keep at least this height; a split that would go under it opens the other way or as a tab. 0 = never. */
|
|
516
|
+
readonly paneMinHeight: number;
|
|
509
517
|
}
|
|
510
518
|
/** The web app's numbers (the defaults). */
|
|
511
519
|
declare const CANVAS_WEB_LAYOUT_RULES: CanvasLayoutRules;
|
|
@@ -525,6 +533,26 @@ declare function fitCanvasWidth(stored: number | null, region: number, rules: Ca
|
|
|
525
533
|
declare function clampDraggedCanvasWidth(next: number, region: number, rules: CanvasLayoutRules): number;
|
|
526
534
|
/** Whether a side-by-side split this wide (px) with this many children renders stacked. */
|
|
527
535
|
declare function shouldStackSplit(width: number, children: number, rules: CanvasLayoutRules): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Where a new split of a pane this size goes. The asked orientation when both
|
|
538
|
+
* panes keep their minimum; else the other axis when IT fits; else null — the
|
|
539
|
+
* new tab joins the pane instead (a pane is never split into two too small to
|
|
540
|
+
* use). A side-by-side split that is too narrow but tall enough is kept: it
|
|
541
|
+
* renders stacked (`shouldStackSplit`) and gets its columns back when wider.
|
|
542
|
+
* An unmeasured pane (no size) splits as asked.
|
|
543
|
+
*/
|
|
544
|
+
declare function fitCanvasSplit(size: {
|
|
545
|
+
readonly width: number;
|
|
546
|
+
readonly height: number;
|
|
547
|
+
} | null | undefined, orientation: "horizontal" | "vertical", rules: CanvasLayoutRules): "horizontal" | "vertical" | null;
|
|
548
|
+
/**
|
|
549
|
+
* A split's shares, fitted so every child keeps its minimum (px) along the
|
|
550
|
+
* split: what a child is short of comes out of the children above their
|
|
551
|
+
* minimum, in proportion to their spare room. When the minimums together do
|
|
552
|
+
* not fit, each child gets its minimum's share of the room. `total` 0 (not
|
|
553
|
+
* measured) keeps the shares.
|
|
554
|
+
*/
|
|
555
|
+
declare function fitCanvasSplitSizes(sizes: readonly number[], total: number, mins: readonly number[]): number[];
|
|
528
556
|
|
|
529
557
|
/**
|
|
530
558
|
* The canvas controller: the ONE imperative API every caller uses. It wraps a
|
|
@@ -643,8 +671,20 @@ interface CanvasController {
|
|
|
643
671
|
activate(itemId: CanvasItemId): void;
|
|
644
672
|
focusPane(paneId: CanvasPaneId): void;
|
|
645
673
|
moveItem(itemId: CanvasItemId, toPaneId: CanvasPaneId, index?: number): void;
|
|
646
|
-
/**
|
|
674
|
+
/**
|
|
675
|
+
* Splits with the layout rules' share (stackSplit for "vertical", sideSplit for "horizontal").
|
|
676
|
+
* A split that would leave a pane under `paneMinHeight` / `paneMinWidth` goes the other way, or
|
|
677
|
+
* not at all (see `fitSplit`).
|
|
678
|
+
*/
|
|
647
679
|
splitPane(paneId: CanvasPaneId, orientation: CanvasOrientation, moveItemId?: CanvasItemId): void;
|
|
680
|
+
/**
|
|
681
|
+
* Where a split of this pane would go right now: the asked orientation, the other one when only
|
|
682
|
+
* it keeps both panes usable, or null (no room — a "split" open joins the pane as a tab).
|
|
683
|
+
* Measured through `registerPaneMeasure`; an unmeasured pane splits as asked.
|
|
684
|
+
*/
|
|
685
|
+
fitSplit(paneId: CanvasPaneId, orientation: CanvasOrientation): CanvasOrientation | null;
|
|
686
|
+
/** A column reports its panes' drawn sizes (px) so splits respect the minimums. Returns the unregister. */
|
|
687
|
+
registerPaneMeasure(measure: CanvasPaneMeasure): () => void;
|
|
648
688
|
closePane(paneId: CanvasPaneId): void;
|
|
649
689
|
resizeSplit(splitId: CanvasSplitId, sizes: readonly number[]): void;
|
|
650
690
|
show(windowId?: CanvasWindowId): void;
|
|
@@ -672,6 +712,11 @@ interface CanvasController {
|
|
|
672
712
|
/** Loads the persisted snapshot, starts autosave and session tracking. Returns a disposer. */
|
|
673
713
|
start(): () => void;
|
|
674
714
|
}
|
|
715
|
+
/** A pane's drawn size in CSS px, or null when this measurer does not draw it. */
|
|
716
|
+
type CanvasPaneMeasure = (paneId: CanvasPaneId) => {
|
|
717
|
+
readonly width: number;
|
|
718
|
+
readonly height: number;
|
|
719
|
+
} | null;
|
|
675
720
|
declare function createCanvasController(options: CanvasControllerOptions): CanvasController;
|
|
676
721
|
|
|
677
722
|
/**
|
|
@@ -751,4 +796,4 @@ interface ToggleKindInput {
|
|
|
751
796
|
/** Returns what the item is after the click. */
|
|
752
797
|
declare function toggleKind(controller: CanvasController, input: ToggleKindInput): CanvasKindVisibility;
|
|
753
798
|
|
|
754
|
-
export {
|
|
799
|
+
export { type ReduxStoreLike as $, CANVAS_STORAGE_KEY as A, CANVAS_WEB_LAYOUT_RULES as B, type CanvasItemId as C, type CanvasControllerOptions as D, type CanvasErrorReport as E, type CanvasErrorSink as F, type CanvasKeyValueStore as G, type CanvasKindVisibility as H, type CanvasLayoutRules as I, type CanvasNavigateInput as J, type CanvasOpenInput as K, type CanvasOpenTarget as L, type CanvasOrientation as M, type CanvasPaneMeasure as N, type CanvasPersistencePort as O, type CanvasPreferredTarget as P, type CanvasPresentation as Q, type CanvasPresentationOrientation as R, type CanvasRect as S, type CanvasSessionAttachReason as T, type CanvasSessionDetachReason as U, type CanvasSessionEvent as V, type CanvasSessionHooks as W, type CanvasSplitId as X, type CanvasWindowCloseMode as Y, type CanvasWindowFrame as Z, type CanvasWindowPorts as _, type CanvasWindowId as a, type ToggleKindInput as a0, bindCanvasToReduxStore as a1, canvasActions as a2, canvasOrientation as a3, canvasPresentation as a4, canvasReducer as a5, canvasWindowFrame as a6, canvasWindowOfPane as a7, clampDraggedCanvasWidth as a8, consoleCanvasErrorSink as a9, createCanvasController as aa, createCanvasStore as ab, createInitialCanvasState as ac, createKeyValueCanvasPersistence as ad, createLocalStorageCanvasPersistence as ae, defaultCanvasWidth as af, fitCanvasSplit as ag, fitCanvasSplitSizes as ah, fitCanvasWidth as ai, foldCanvasWindows as aj, isCanvasAction as ak, listCanvasWindowIds as al, preferredFlowDirection as am, resolveCanvasLayoutRules as an, sanitizeCanvasSnapshot as ao, selectCanvasKindVisibility as ap, shouldStackSplit as aq, toPersistableSnapshot as ar, toggleKind as as, type CanvasJson as b, type CanvasLayoutNode as c, type CanvasPaneId as d, type CanvasStoreBinding as e, type CanvasState as f, type CanvasAction as g, type CanvasController as h, type CanvasItem as i, type CanvasExtraWindow as j, type CanvasHistoryEntry as k, type CanvasPane as l, canvasWindowOfItem as m, CANVAS_DEFAULT_KEY as n, CANVAS_DEFAULT_WIDTH as o, CANVAS_DESKTOP_LAYOUT_RULES as p, CANVAS_HISTORY_LIMIT as q, CANVAS_KEEP_ALIVE_DEPTH as r, CANVAS_LAUNCHER_KIND as s, CANVAS_MAIN_WINDOW as t, CANVAS_MIN_SPLIT_FRACTION as u, CANVAS_MIN_WIDTH as v, CANVAS_NARROW_WIDTH as w, CANVAS_PANE_MIN_HEIGHT as x, CANVAS_PANE_MIN_WIDTH as y, CANVAS_PHONE_MAX_WIDTH as z };
|
|
@@ -491,6 +491,12 @@ declare function toPersistableSnapshot(state: CanvasState, isRestorable: (kind:
|
|
|
491
491
|
*/
|
|
492
492
|
/** The web's narrowest side-by-side pane (px): below it, a side-by-side split renders stacked. */
|
|
493
493
|
declare const CANVAS_PANE_MIN_WIDTH = 280;
|
|
494
|
+
/**
|
|
495
|
+
* The shortest pane (px): its header plus a body that shows a few rows of a
|
|
496
|
+
* list. A stack gives every pane at least this; a split that cannot opens the
|
|
497
|
+
* other way, or as a tab.
|
|
498
|
+
*/
|
|
499
|
+
declare const CANVAS_PANE_MIN_HEIGHT = 200;
|
|
494
500
|
interface CanvasLayoutRules {
|
|
495
501
|
/** Width before the person drags the edge: CSS px, or a fraction of the region the canvas shares. */
|
|
496
502
|
readonly defaultWidth: number | {
|
|
@@ -506,6 +512,8 @@ interface CanvasLayoutRules {
|
|
|
506
512
|
readonly sideSplit: number;
|
|
507
513
|
/** Side-by-side panes that would be narrower than this render stacked. 0 = never. */
|
|
508
514
|
readonly paneMinWidth: number;
|
|
515
|
+
/** Stacked panes keep at least this height; a split that would go under it opens the other way or as a tab. 0 = never. */
|
|
516
|
+
readonly paneMinHeight: number;
|
|
509
517
|
}
|
|
510
518
|
/** The web app's numbers (the defaults). */
|
|
511
519
|
declare const CANVAS_WEB_LAYOUT_RULES: CanvasLayoutRules;
|
|
@@ -525,6 +533,26 @@ declare function fitCanvasWidth(stored: number | null, region: number, rules: Ca
|
|
|
525
533
|
declare function clampDraggedCanvasWidth(next: number, region: number, rules: CanvasLayoutRules): number;
|
|
526
534
|
/** Whether a side-by-side split this wide (px) with this many children renders stacked. */
|
|
527
535
|
declare function shouldStackSplit(width: number, children: number, rules: CanvasLayoutRules): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Where a new split of a pane this size goes. The asked orientation when both
|
|
538
|
+
* panes keep their minimum; else the other axis when IT fits; else null — the
|
|
539
|
+
* new tab joins the pane instead (a pane is never split into two too small to
|
|
540
|
+
* use). A side-by-side split that is too narrow but tall enough is kept: it
|
|
541
|
+
* renders stacked (`shouldStackSplit`) and gets its columns back when wider.
|
|
542
|
+
* An unmeasured pane (no size) splits as asked.
|
|
543
|
+
*/
|
|
544
|
+
declare function fitCanvasSplit(size: {
|
|
545
|
+
readonly width: number;
|
|
546
|
+
readonly height: number;
|
|
547
|
+
} | null | undefined, orientation: "horizontal" | "vertical", rules: CanvasLayoutRules): "horizontal" | "vertical" | null;
|
|
548
|
+
/**
|
|
549
|
+
* A split's shares, fitted so every child keeps its minimum (px) along the
|
|
550
|
+
* split: what a child is short of comes out of the children above their
|
|
551
|
+
* minimum, in proportion to their spare room. When the minimums together do
|
|
552
|
+
* not fit, each child gets its minimum's share of the room. `total` 0 (not
|
|
553
|
+
* measured) keeps the shares.
|
|
554
|
+
*/
|
|
555
|
+
declare function fitCanvasSplitSizes(sizes: readonly number[], total: number, mins: readonly number[]): number[];
|
|
528
556
|
|
|
529
557
|
/**
|
|
530
558
|
* The canvas controller: the ONE imperative API every caller uses. It wraps a
|
|
@@ -643,8 +671,20 @@ interface CanvasController {
|
|
|
643
671
|
activate(itemId: CanvasItemId): void;
|
|
644
672
|
focusPane(paneId: CanvasPaneId): void;
|
|
645
673
|
moveItem(itemId: CanvasItemId, toPaneId: CanvasPaneId, index?: number): void;
|
|
646
|
-
/**
|
|
674
|
+
/**
|
|
675
|
+
* Splits with the layout rules' share (stackSplit for "vertical", sideSplit for "horizontal").
|
|
676
|
+
* A split that would leave a pane under `paneMinHeight` / `paneMinWidth` goes the other way, or
|
|
677
|
+
* not at all (see `fitSplit`).
|
|
678
|
+
*/
|
|
647
679
|
splitPane(paneId: CanvasPaneId, orientation: CanvasOrientation, moveItemId?: CanvasItemId): void;
|
|
680
|
+
/**
|
|
681
|
+
* Where a split of this pane would go right now: the asked orientation, the other one when only
|
|
682
|
+
* it keeps both panes usable, or null (no room — a "split" open joins the pane as a tab).
|
|
683
|
+
* Measured through `registerPaneMeasure`; an unmeasured pane splits as asked.
|
|
684
|
+
*/
|
|
685
|
+
fitSplit(paneId: CanvasPaneId, orientation: CanvasOrientation): CanvasOrientation | null;
|
|
686
|
+
/** A column reports its panes' drawn sizes (px) so splits respect the minimums. Returns the unregister. */
|
|
687
|
+
registerPaneMeasure(measure: CanvasPaneMeasure): () => void;
|
|
648
688
|
closePane(paneId: CanvasPaneId): void;
|
|
649
689
|
resizeSplit(splitId: CanvasSplitId, sizes: readonly number[]): void;
|
|
650
690
|
show(windowId?: CanvasWindowId): void;
|
|
@@ -672,6 +712,11 @@ interface CanvasController {
|
|
|
672
712
|
/** Loads the persisted snapshot, starts autosave and session tracking. Returns a disposer. */
|
|
673
713
|
start(): () => void;
|
|
674
714
|
}
|
|
715
|
+
/** A pane's drawn size in CSS px, or null when this measurer does not draw it. */
|
|
716
|
+
type CanvasPaneMeasure = (paneId: CanvasPaneId) => {
|
|
717
|
+
readonly width: number;
|
|
718
|
+
readonly height: number;
|
|
719
|
+
} | null;
|
|
675
720
|
declare function createCanvasController(options: CanvasControllerOptions): CanvasController;
|
|
676
721
|
|
|
677
722
|
/**
|
|
@@ -751,4 +796,4 @@ interface ToggleKindInput {
|
|
|
751
796
|
/** Returns what the item is after the click. */
|
|
752
797
|
declare function toggleKind(controller: CanvasController, input: ToggleKindInput): CanvasKindVisibility;
|
|
753
798
|
|
|
754
|
-
export {
|
|
799
|
+
export { type ReduxStoreLike as $, CANVAS_STORAGE_KEY as A, CANVAS_WEB_LAYOUT_RULES as B, type CanvasItemId as C, type CanvasControllerOptions as D, type CanvasErrorReport as E, type CanvasErrorSink as F, type CanvasKeyValueStore as G, type CanvasKindVisibility as H, type CanvasLayoutRules as I, type CanvasNavigateInput as J, type CanvasOpenInput as K, type CanvasOpenTarget as L, type CanvasOrientation as M, type CanvasPaneMeasure as N, type CanvasPersistencePort as O, type CanvasPreferredTarget as P, type CanvasPresentation as Q, type CanvasPresentationOrientation as R, type CanvasRect as S, type CanvasSessionAttachReason as T, type CanvasSessionDetachReason as U, type CanvasSessionEvent as V, type CanvasSessionHooks as W, type CanvasSplitId as X, type CanvasWindowCloseMode as Y, type CanvasWindowFrame as Z, type CanvasWindowPorts as _, type CanvasWindowId as a, type ToggleKindInput as a0, bindCanvasToReduxStore as a1, canvasActions as a2, canvasOrientation as a3, canvasPresentation as a4, canvasReducer as a5, canvasWindowFrame as a6, canvasWindowOfPane as a7, clampDraggedCanvasWidth as a8, consoleCanvasErrorSink as a9, createCanvasController as aa, createCanvasStore as ab, createInitialCanvasState as ac, createKeyValueCanvasPersistence as ad, createLocalStorageCanvasPersistence as ae, defaultCanvasWidth as af, fitCanvasSplit as ag, fitCanvasSplitSizes as ah, fitCanvasWidth as ai, foldCanvasWindows as aj, isCanvasAction as ak, listCanvasWindowIds as al, preferredFlowDirection as am, resolveCanvasLayoutRules as an, sanitizeCanvasSnapshot as ao, selectCanvasKindVisibility as ap, shouldStackSplit as aq, toPersistableSnapshot as ar, toggleKind as as, type CanvasJson as b, type CanvasLayoutNode as c, type CanvasPaneId as d, type CanvasStoreBinding as e, type CanvasState as f, type CanvasAction as g, type CanvasController as h, type CanvasItem as i, type CanvasExtraWindow as j, type CanvasHistoryEntry as k, type CanvasPane as l, canvasWindowOfItem as m, CANVAS_DEFAULT_KEY as n, CANVAS_DEFAULT_WIDTH as o, CANVAS_DESKTOP_LAYOUT_RULES as p, CANVAS_HISTORY_LIMIT as q, CANVAS_KEEP_ALIVE_DEPTH as r, CANVAS_LAUNCHER_KIND as s, CANVAS_MAIN_WINDOW as t, CANVAS_MIN_SPLIT_FRACTION as u, CANVAS_MIN_WIDTH as v, CANVAS_NARROW_WIDTH as w, CANVAS_PANE_MIN_HEIGHT as x, CANVAS_PANE_MIN_WIDTH as y, CANVAS_PHONE_MAX_WIDTH as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/canvas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "The AI Matrx canvas: a docked right-hand column with split panes, tabs, full screen, a kind registry, Redux-compatible state and persistence.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|