@ai-matrx/canvas 0.5.3 → 0.6.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/CHANGELOG.md +15 -0
- package/README.md +6 -0
- package/dist/index.cjs +45 -9
- 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 +45 -9
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +218 -47
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +218 -47
- package/dist/react.js.map +1 -1
- package/dist/styles.css +51 -30
- package/dist/{toggleKind-BD78LnMB.d.cts → toggleKind-DhDmWExm.d.cts} +27 -1
- package/dist/{toggleKind-BD78LnMB.d.ts → toggleKind-DhDmWExm.d.ts} +27 -1
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -403,6 +403,20 @@
|
|
|
403
403
|
|
|
404
404
|
/* ── tabs ───────────────────────────────────────────────────────────────── */
|
|
405
405
|
|
|
406
|
+
/*
|
|
407
|
+
* THE STRIP takes what the header has: it is as wide as its tabs need (the
|
|
408
|
+
* leading slot after it has no basis), so "+" sits right after the last tab
|
|
409
|
+
* and only shrinks when the header runs out of room. Past the tabs' minimum
|
|
410
|
+
* the strip scrolls, and says so: the clipped edge fades and chevrons appear.
|
|
411
|
+
*/
|
|
412
|
+
.mxc-tabstrip {
|
|
413
|
+
flex: 0 1 auto;
|
|
414
|
+
min-width: 0;
|
|
415
|
+
display: flex;
|
|
416
|
+
align-items: center;
|
|
417
|
+
gap: 0.125rem;
|
|
418
|
+
}
|
|
419
|
+
|
|
406
420
|
.mxc-tabs {
|
|
407
421
|
/* The tabs' offset parent, so "keep the active tab in view" measures in strip coordinates. */
|
|
408
422
|
position: relative;
|
|
@@ -413,32 +427,50 @@
|
|
|
413
427
|
gap: 0.125rem;
|
|
414
428
|
overflow-x: auto;
|
|
415
429
|
scrollbar-width: none;
|
|
430
|
+
--mxc-fade-start: 0px;
|
|
431
|
+
--mxc-fade-end: 0px;
|
|
416
432
|
}
|
|
417
433
|
|
|
418
434
|
.mxc-tabs::-webkit-scrollbar {
|
|
419
435
|
display: none;
|
|
420
436
|
}
|
|
421
437
|
|
|
438
|
+
/* Overflow cue: the clipped edge(s) fade out. */
|
|
439
|
+
.mxc-tabstrip[data-overflow-start] > .mxc-tabs {
|
|
440
|
+
--mxc-fade-start: 1.5rem;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.mxc-tabstrip[data-overflow-end] > .mxc-tabs {
|
|
444
|
+
--mxc-fade-end: 1.5rem;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.mxc-tabstrip[data-overflow] > .mxc-tabs {
|
|
448
|
+
-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--mxc-fade-start), #000 calc(100% - var(--mxc-fade-end)), transparent 100%);
|
|
449
|
+
mask-image: linear-gradient(to right, transparent 0, #000 var(--mxc-fade-start), #000 calc(100% - var(--mxc-fade-end)), transparent 100%);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.mxc-tabs-scroll {
|
|
453
|
+
flex: none;
|
|
454
|
+
}
|
|
455
|
+
|
|
422
456
|
/*
|
|
423
457
|
* TAB DENSITY (Claude Code / Codex): 12.5px text, a 14px icon, 6px side
|
|
424
|
-
* padding.
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
* hidden; shown (hover, active, focus) the title fades under it.
|
|
458
|
+
* padding. A tab is as wide as its name (up to 12rem); tabs shrink evenly
|
|
459
|
+
* only when the header is out of room, to a 4.5rem floor (a tab is never
|
|
460
|
+
* squeezed to three letters), then the strip scrolls. The active tab keeps
|
|
461
|
+
* icon + ~10 letters. Every tab reserves the room of its close, so a name is
|
|
462
|
+
* never under the button; the close shows on hover, the active tab and focus.
|
|
430
463
|
*/
|
|
431
464
|
.mxc-tab {
|
|
432
465
|
position: relative;
|
|
433
|
-
flex:
|
|
466
|
+
flex: 0 1 auto;
|
|
434
467
|
min-width: 4.5rem;
|
|
435
468
|
max-width: 12rem;
|
|
436
|
-
container: mxc-tab / inline-size;
|
|
437
469
|
display: flex;
|
|
438
470
|
align-items: center;
|
|
439
471
|
gap: 0.3125rem;
|
|
440
472
|
height: 1.625rem;
|
|
441
|
-
padding: 0 0.375rem;
|
|
473
|
+
padding: 0 1.375rem 0 0.375rem;
|
|
442
474
|
border-radius: 0.375rem;
|
|
443
475
|
font-size: 0.78125rem;
|
|
444
476
|
line-height: 1rem;
|
|
@@ -449,6 +481,11 @@
|
|
|
449
481
|
box-sizing: border-box;
|
|
450
482
|
}
|
|
451
483
|
|
|
484
|
+
/* A tab without a close (BrowserTabs with no onClose) keeps even padding. */
|
|
485
|
+
.mxc-tab:not(:has(> .mxc-tab-close)) {
|
|
486
|
+
padding-right: 0.375rem;
|
|
487
|
+
}
|
|
488
|
+
|
|
452
489
|
.mxc-tab[data-active] {
|
|
453
490
|
min-width: min(7.5rem, 100%);
|
|
454
491
|
background: var(--mxc-tab-active-bg);
|
|
@@ -480,12 +517,6 @@
|
|
|
480
517
|
opacity: 0.75;
|
|
481
518
|
}
|
|
482
519
|
|
|
483
|
-
@container mxc-tab (max-width: 6rem) {
|
|
484
|
-
.mxc-tab:not([data-active]) .mxc-tab-icon {
|
|
485
|
-
display: none;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
520
|
.mxc-tab-icon svg,
|
|
490
521
|
.mxc-favicon {
|
|
491
522
|
width: 0.875rem;
|
|
@@ -497,26 +528,13 @@
|
|
|
497
528
|
}
|
|
498
529
|
|
|
499
530
|
.mxc-tab-title {
|
|
500
|
-
flex:
|
|
531
|
+
flex: 0 1 auto;
|
|
501
532
|
min-width: 0;
|
|
502
533
|
overflow: hidden;
|
|
503
|
-
text-overflow:
|
|
534
|
+
text-overflow: ellipsis;
|
|
504
535
|
white-space: nowrap;
|
|
505
536
|
}
|
|
506
537
|
|
|
507
|
-
/* The close shows: the title's end fades out from under it. */
|
|
508
|
-
.mxc-tab:hover .mxc-tab-title,
|
|
509
|
-
.mxc-tab[data-active] .mxc-tab-title,
|
|
510
|
-
.mxc-tab:focus-within .mxc-tab-title {
|
|
511
|
-
-webkit-mask-image: linear-gradient(to left, transparent 1.125rem, #000 1.875rem);
|
|
512
|
-
mask-image: linear-gradient(to left, transparent 1.125rem, #000 1.875rem);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
.mxc-tab:not(:hover):not([data-active]):not(:focus-within) .mxc-tab-title {
|
|
516
|
-
-webkit-mask-image: linear-gradient(to left, transparent 0, #000 0.75rem);
|
|
517
|
-
mask-image: linear-gradient(to left, transparent 0, #000 0.75rem);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
538
|
.mxc-tab-note {
|
|
521
539
|
flex: none;
|
|
522
540
|
font-size: 0.6875rem;
|
|
@@ -754,6 +772,9 @@
|
|
|
754
772
|
}
|
|
755
773
|
|
|
756
774
|
.mxc-launcher-item {
|
|
775
|
+
/* A double-click must never select the label (or the new tab under it). */
|
|
776
|
+
user-select: none;
|
|
777
|
+
-webkit-user-select: none;
|
|
757
778
|
display: flex;
|
|
758
779
|
align-items: center;
|
|
759
780
|
gap: 0.5rem;
|
|
@@ -46,11 +46,24 @@ interface CanvasHistoryEntry {
|
|
|
46
46
|
readonly key: string;
|
|
47
47
|
readonly title: string | null;
|
|
48
48
|
readonly data: CanvasJson;
|
|
49
|
+
/**
|
|
50
|
+
* The body this content had (its item's `instance`). Back and a navigate to
|
|
51
|
+
* a kept step reuse it, so the SAME live body comes back (a typed draft, a
|
|
52
|
+
* scroll position) while the layer still holds it mounted.
|
|
53
|
+
*/
|
|
54
|
+
readonly instance?: string | undefined;
|
|
49
55
|
}
|
|
50
56
|
/** The built-in "New tab" item: the launcher, shown as a tab. Never registered as a kind. */
|
|
51
57
|
declare const CANVAS_LAUNCHER_KIND = "canvas.launcher";
|
|
52
58
|
/** How many steps Back can go in one tab. Older entries fall off. */
|
|
53
59
|
declare const CANVAS_HISTORY_LIMIT = 50;
|
|
60
|
+
/**
|
|
61
|
+
* How many earlier contents of one tab keep their body MOUNTED (hidden), in
|
|
62
|
+
* each direction: the newest steps Back reaches, and the contents Back left
|
|
63
|
+
* (`CanvasItem.kept`). Older steps still work — their body mounts fresh.
|
|
64
|
+
* Only closing the tab disposes the kept bodies.
|
|
65
|
+
*/
|
|
66
|
+
declare const CANVAS_KEEP_ALIVE_DEPTH = 5;
|
|
54
67
|
interface CanvasItem {
|
|
55
68
|
readonly id: CanvasItemId;
|
|
56
69
|
/** Registered kind id (see `registerCanvasKind`). */
|
|
@@ -64,6 +77,13 @@ interface CanvasItem {
|
|
|
64
77
|
readonly updatedAt: number;
|
|
65
78
|
/** Earlier contents of this tab, oldest first (navigate in place). Absent = no Back. */
|
|
66
79
|
readonly history?: readonly CanvasHistoryEntry[] | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Contents this tab showed that Back has stepped away from (newest last, at
|
|
82
|
+
* most CANVAS_KEEP_ALIVE_DEPTH). Navigating to one again brings back its
|
|
83
|
+
* live body instead of a new one: "+" → Quick Chat → type → Back → Quick
|
|
84
|
+
* Chat finds the draft.
|
|
85
|
+
*/
|
|
86
|
+
readonly kept?: readonly CanvasHistoryEntry[] | undefined;
|
|
67
87
|
/**
|
|
68
88
|
* The mounted body's identity. Minted when the item is created and kept by
|
|
69
89
|
* `rekey`, so a draft that receives its durable id keeps its live body.
|
|
@@ -661,6 +681,12 @@ interface CanvasPresentation {
|
|
|
661
681
|
/** How many panes the window's canvas shows right now. */
|
|
662
682
|
readonly paneCount: number;
|
|
663
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* THE phone breakpoint: a viewport at most this wide (CSS px) is a phone —
|
|
686
|
+
* the canvas is a full-screen layer and presents ONE pane at a time. Same
|
|
687
|
+
* number as styles.css `@media (max-width: 767px)`.
|
|
688
|
+
*/
|
|
689
|
+
declare const CANVAS_PHONE_MAX_WIDTH = 767;
|
|
664
690
|
/** Under this width (px) a body is narrow. */
|
|
665
691
|
declare const CANVAS_NARROW_WIDTH = 480;
|
|
666
692
|
declare function canvasOrientation(width: number, height: number): CanvasPresentationOrientation;
|
|
@@ -706,4 +732,4 @@ interface ToggleKindInput {
|
|
|
706
732
|
/** Returns what the item is after the click. */
|
|
707
733
|
declare function toggleKind(controller: CanvasController, input: ToggleKindInput): CanvasKindVisibility;
|
|
708
734
|
|
|
709
|
-
export {
|
|
735
|
+
export { canvasActions as $, type CanvasControllerOptions as A, type CanvasErrorReport as B, type CanvasItemId as C, type CanvasErrorSink as D, type CanvasKeyValueStore as E, type CanvasKindVisibility as F, type CanvasLayoutRules as G, type CanvasNavigateInput as H, type CanvasOpenInput as I, type CanvasOpenTarget as J, type CanvasOrientation as K, type CanvasPersistencePort as L, type CanvasPreferredTarget as M, type CanvasPresentation as N, type CanvasPresentationOrientation as O, type CanvasRect as P, type CanvasSessionAttachReason as Q, type CanvasSessionDetachReason as R, type CanvasSessionEvent as S, type CanvasSessionHooks as T, type CanvasSplitId as U, type CanvasWindowCloseMode as V, type CanvasWindowFrame as W, type CanvasWindowPorts as X, type ReduxStoreLike as Y, type ToggleKindInput as Z, bindCanvasToReduxStore as _, type CanvasWindowId as a, canvasOrientation as a0, canvasPresentation as a1, canvasReducer as a2, canvasWindowFrame as a3, canvasWindowOfPane as a4, clampDraggedCanvasWidth as a5, consoleCanvasErrorSink as a6, createCanvasController as a7, createCanvasStore as a8, createInitialCanvasState as a9, createKeyValueCanvasPersistence as aa, createLocalStorageCanvasPersistence as ab, defaultCanvasWidth as ac, fitCanvasWidth as ad, foldCanvasWindows as ae, isCanvasAction as af, listCanvasWindowIds as ag, preferredFlowDirection as ah, resolveCanvasLayoutRules as ai, sanitizeCanvasSnapshot as aj, selectCanvasKindVisibility as ak, shouldStackSplit as al, toPersistableSnapshot as am, toggleKind as an, 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_PHONE_MAX_WIDTH as x, CANVAS_STORAGE_KEY as y, CANVAS_WEB_LAYOUT_RULES as z };
|
|
@@ -46,11 +46,24 @@ interface CanvasHistoryEntry {
|
|
|
46
46
|
readonly key: string;
|
|
47
47
|
readonly title: string | null;
|
|
48
48
|
readonly data: CanvasJson;
|
|
49
|
+
/**
|
|
50
|
+
* The body this content had (its item's `instance`). Back and a navigate to
|
|
51
|
+
* a kept step reuse it, so the SAME live body comes back (a typed draft, a
|
|
52
|
+
* scroll position) while the layer still holds it mounted.
|
|
53
|
+
*/
|
|
54
|
+
readonly instance?: string | undefined;
|
|
49
55
|
}
|
|
50
56
|
/** The built-in "New tab" item: the launcher, shown as a tab. Never registered as a kind. */
|
|
51
57
|
declare const CANVAS_LAUNCHER_KIND = "canvas.launcher";
|
|
52
58
|
/** How many steps Back can go in one tab. Older entries fall off. */
|
|
53
59
|
declare const CANVAS_HISTORY_LIMIT = 50;
|
|
60
|
+
/**
|
|
61
|
+
* How many earlier contents of one tab keep their body MOUNTED (hidden), in
|
|
62
|
+
* each direction: the newest steps Back reaches, and the contents Back left
|
|
63
|
+
* (`CanvasItem.kept`). Older steps still work — their body mounts fresh.
|
|
64
|
+
* Only closing the tab disposes the kept bodies.
|
|
65
|
+
*/
|
|
66
|
+
declare const CANVAS_KEEP_ALIVE_DEPTH = 5;
|
|
54
67
|
interface CanvasItem {
|
|
55
68
|
readonly id: CanvasItemId;
|
|
56
69
|
/** Registered kind id (see `registerCanvasKind`). */
|
|
@@ -64,6 +77,13 @@ interface CanvasItem {
|
|
|
64
77
|
readonly updatedAt: number;
|
|
65
78
|
/** Earlier contents of this tab, oldest first (navigate in place). Absent = no Back. */
|
|
66
79
|
readonly history?: readonly CanvasHistoryEntry[] | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Contents this tab showed that Back has stepped away from (newest last, at
|
|
82
|
+
* most CANVAS_KEEP_ALIVE_DEPTH). Navigating to one again brings back its
|
|
83
|
+
* live body instead of a new one: "+" → Quick Chat → type → Back → Quick
|
|
84
|
+
* Chat finds the draft.
|
|
85
|
+
*/
|
|
86
|
+
readonly kept?: readonly CanvasHistoryEntry[] | undefined;
|
|
67
87
|
/**
|
|
68
88
|
* The mounted body's identity. Minted when the item is created and kept by
|
|
69
89
|
* `rekey`, so a draft that receives its durable id keeps its live body.
|
|
@@ -661,6 +681,12 @@ interface CanvasPresentation {
|
|
|
661
681
|
/** How many panes the window's canvas shows right now. */
|
|
662
682
|
readonly paneCount: number;
|
|
663
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* THE phone breakpoint: a viewport at most this wide (CSS px) is a phone —
|
|
686
|
+
* the canvas is a full-screen layer and presents ONE pane at a time. Same
|
|
687
|
+
* number as styles.css `@media (max-width: 767px)`.
|
|
688
|
+
*/
|
|
689
|
+
declare const CANVAS_PHONE_MAX_WIDTH = 767;
|
|
664
690
|
/** Under this width (px) a body is narrow. */
|
|
665
691
|
declare const CANVAS_NARROW_WIDTH = 480;
|
|
666
692
|
declare function canvasOrientation(width: number, height: number): CanvasPresentationOrientation;
|
|
@@ -706,4 +732,4 @@ interface ToggleKindInput {
|
|
|
706
732
|
/** Returns what the item is after the click. */
|
|
707
733
|
declare function toggleKind(controller: CanvasController, input: ToggleKindInput): CanvasKindVisibility;
|
|
708
734
|
|
|
709
|
-
export {
|
|
735
|
+
export { canvasActions as $, type CanvasControllerOptions as A, type CanvasErrorReport as B, type CanvasItemId as C, type CanvasErrorSink as D, type CanvasKeyValueStore as E, type CanvasKindVisibility as F, type CanvasLayoutRules as G, type CanvasNavigateInput as H, type CanvasOpenInput as I, type CanvasOpenTarget as J, type CanvasOrientation as K, type CanvasPersistencePort as L, type CanvasPreferredTarget as M, type CanvasPresentation as N, type CanvasPresentationOrientation as O, type CanvasRect as P, type CanvasSessionAttachReason as Q, type CanvasSessionDetachReason as R, type CanvasSessionEvent as S, type CanvasSessionHooks as T, type CanvasSplitId as U, type CanvasWindowCloseMode as V, type CanvasWindowFrame as W, type CanvasWindowPorts as X, type ReduxStoreLike as Y, type ToggleKindInput as Z, bindCanvasToReduxStore as _, type CanvasWindowId as a, canvasOrientation as a0, canvasPresentation as a1, canvasReducer as a2, canvasWindowFrame as a3, canvasWindowOfPane as a4, clampDraggedCanvasWidth as a5, consoleCanvasErrorSink as a6, createCanvasController as a7, createCanvasStore as a8, createInitialCanvasState as a9, createKeyValueCanvasPersistence as aa, createLocalStorageCanvasPersistence as ab, defaultCanvasWidth as ac, fitCanvasWidth as ad, foldCanvasWindows as ae, isCanvasAction as af, listCanvasWindowIds as ag, preferredFlowDirection as ah, resolveCanvasLayoutRules as ai, sanitizeCanvasSnapshot as aj, selectCanvasKindVisibility as ak, shouldStackSplit as al, toPersistableSnapshot as am, toggleKind as an, 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_PHONE_MAX_WIDTH as x, CANVAS_STORAGE_KEY as y, CANVAS_WEB_LAYOUT_RULES as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/canvas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|