@ai-matrx/canvas 0.7.3 → 0.8.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 +12 -0
- package/README.md +2 -2
- package/dist/react.cjs +140 -49
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +34 -15
- package/dist/react.d.ts +34 -15
- package/dist/react.js +140 -49
- package/dist/react.js.map +1 -1
- package/dist/styles.css +94 -40
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
Owner feedback (Arman, 2026-10-03), a split canvas: tabs read "The Shap" | "Agent con" | an icon sliver | "+" — "when there is a split, the tabs should not get split like this."
|
|
6
|
+
|
|
7
|
+
- **A split keeps ONE window-wide tab strip** (Chrome split view). `CanvasColumn` draws `CanvasWindowTabs` above the panes whenever the layout is a split (side by side, stacked or down): every pane's tabs in one row, the panes' visible tabs drawn as ONE joined tab (the focused pane's half strongest), one "+" that opens in the focused pane. Pane headers keep Back/Forward, a draggable title, kind controls, menu, expand and close — no strip of their own. Phones are unchanged (one presented pane whose strip carries every tab).
|
|
8
|
+
- **Tabs shrink evenly to a readable floor, then scroll.** Every tab: `flex: 0 1 12rem`, floor `CANVAS_TAB_MIN_WIDTH` 120px (icon + ~10 letters + "…"); a cut name always ends in an ellipsis (never clipped). Past the floor the tab list scrolls sideways — wheel and trackpad, the current tab kept in view, no drawn scrollbar — and "All tabs (N)" stays.
|
|
9
|
+
- **Removed:** the icon-sliver compact mode (`data-compact`), the windowed `fitCanvasTabs`, `CANVAS_ACTIVE_TAB_MIN_WIDTH`, and the hidden-count badge on "All tabs". **Added:** `CanvasWindowTabs`, `canvasTabsOverflow`, `planCanvasTabStrip`, types `CanvasStripTab` / `CanvasStripEntry`.
|
|
10
|
+
|
|
11
|
+
### Consumer action
|
|
12
|
+
|
|
13
|
+
- None for hosts that render `<CanvasColumn/>`. A host that imported `fitCanvasTabs` or `CANVAS_ACTIVE_TAB_MIN_WIDTH` (none known) uses `canvasTabsOverflow` / `CANVAS_TAB_MIN_WIDTH`.
|
|
14
|
+
|
|
3
15
|
## 0.7.3
|
|
4
16
|
|
|
5
17
|
Census on 0.7.2 (40 web routes, 1440px window, chat open, canvas 360/640/900): with a 900px canvas the page beside it was 56px and route headers were 29-67px wide.
|
package/README.md
CHANGED
|
@@ -67,9 +67,9 @@ Navigating to something already open elsewhere focuses it there (a launcher tab
|
|
|
67
67
|
|
|
68
68
|
**Forward.** After Back the header also shows Forward (`selectCanvasCanGoForward`); it returns the same live body Back left. A navigate somewhere new ends the forward trail. Shortcut data `canvas.back` / `canvas.forward` (⌘[ / ⌘]) is for a desktop host; browsers own those keys.
|
|
69
69
|
|
|
70
|
-
**The strip
|
|
70
|
+
**The strip** (Chrome's model). Tabs share the strip evenly — 12rem each with room — and shrink together to one readable floor, icon + ~10 letters + "…" (`CANVAS_TAB_MIN_WIDTH`, 120px); a cut name always ends in an ellipsis and every tab's tooltip is its full name. Past the floor the tab list scrolls sideways (wheel, trackpad; the current tab is kept in view) and "All tabs (N)" lists every tab (`canvasTabsOverflow` is the rule). A tab never shrinks to an icon sliver and nothing in the header overlaps another control.
|
|
71
71
|
|
|
72
|
-
**Splits.** A side-by-side split whose panes would be narrower than `paneMinWidth` (web: `CANVAS_PANE_MIN_WIDTH`, 280px) renders stacked; the tree is unchanged.
|
|
72
|
+
**Splits.** A split canvas keeps ONE window-wide tab strip above its panes (`CanvasWindowTabs`), never one per pane: every pane's tabs are in it, the panes' visible tabs are drawn as ONE joined tab (the focused pane's half strongest; `planCanvasTabStrip`), and its "+" opens in the focused pane. Each pane header keeps its own Back/Forward, title, kind controls and menu. A side-by-side split whose panes would be narrower than `paneMinWidth` (web: `CANVAS_PANE_MIN_WIDTH`, 280px) renders stacked under the same one strip; the tree is unchanged.
|
|
73
73
|
|
|
74
74
|
**Phones** (`CANVAS_PHONE_MAX_WIDTH`, 767px): the column presents ONE pane — the focused one when it holds a tab, else the first that does (`selectCanvasPresentedPaneId`) — whose strip carries every pane's tabs; choosing a tab from another pane presents that pane. The pane menu offers no Split. The layout tree is untouched, so a wider screen gets its split back.
|
|
75
75
|
|
package/dist/react.cjs
CHANGED
|
@@ -34,7 +34,6 @@ var react_exports = {};
|
|
|
34
34
|
__export(react_exports, {
|
|
35
35
|
BrowserBar: () => BrowserBar,
|
|
36
36
|
BrowserTabs: () => BrowserTabs,
|
|
37
|
-
CANVAS_ACTIVE_TAB_MIN_WIDTH: () => CANVAS_ACTIVE_TAB_MIN_WIDTH,
|
|
38
37
|
CANVAS_TAB_MIN_WIDTH: () => CANVAS_TAB_MIN_WIDTH,
|
|
39
38
|
CanvasColumn: () => CanvasColumn,
|
|
40
39
|
CanvasFrame: () => CanvasFrame,
|
|
@@ -48,13 +47,15 @@ __export(react_exports, {
|
|
|
48
47
|
CanvasTab: () => CanvasTab,
|
|
49
48
|
CanvasToggle: () => CanvasToggle,
|
|
50
49
|
CanvasWindowScope: () => CanvasWindowScope,
|
|
50
|
+
CanvasWindowTabs: () => CanvasWindowTabs,
|
|
51
51
|
beginCanvasResize: () => beginCanvasResize,
|
|
52
52
|
canvasSessionKey: () => canvasSessionKey,
|
|
53
|
+
canvasTabsOverflow: () => canvasTabsOverflow,
|
|
53
54
|
defineCanvasKind: () => defineCanvasKind,
|
|
54
|
-
fitCanvasTabs: () => fitCanvasTabs,
|
|
55
55
|
getCanvasKind: () => getCanvasKind,
|
|
56
56
|
itemTitle: () => itemTitle,
|
|
57
57
|
listCanvasKinds: () => listCanvasKinds,
|
|
58
|
+
planCanvasTabStrip: () => planCanvasTabStrip,
|
|
58
59
|
registerCanvasKind: () => registerCanvasKind,
|
|
59
60
|
registerCanvasKinds: () => registerCanvasKinds,
|
|
60
61
|
useCanvas: () => useCanvas,
|
|
@@ -2636,6 +2637,10 @@ var CanvasSinglePaneContext = (0, import_react7.createContext)(false);
|
|
|
2636
2637
|
function useCanvasSinglePane() {
|
|
2637
2638
|
return (0, import_react7.useContext)(CanvasSinglePaneContext);
|
|
2638
2639
|
}
|
|
2640
|
+
var CanvasWindowTabsContext = (0, import_react7.createContext)(false);
|
|
2641
|
+
function useCanvasWindowTabs() {
|
|
2642
|
+
return (0, import_react7.useContext)(CanvasWindowTabsContext);
|
|
2643
|
+
}
|
|
2639
2644
|
function useSlotSize(slots, paneId) {
|
|
2640
2645
|
return (0, import_react7.useSyncExternalStore)(
|
|
2641
2646
|
slots.subscribe,
|
|
@@ -3048,6 +3053,20 @@ function windowTabsSignature(state, windowId) {
|
|
|
3048
3053
|
}
|
|
3049
3054
|
return rows.join("");
|
|
3050
3055
|
}
|
|
3056
|
+
function paneActivesSignature(state, windowId) {
|
|
3057
|
+
const frame2 = canvasWindowFrame(state, windowId);
|
|
3058
|
+
if (!frame2) return "";
|
|
3059
|
+
return listPaneIds(frame2.layout).map((paneId) => `${paneId}${state.panes[paneId]?.activeItemId ?? ""}`).join("");
|
|
3060
|
+
}
|
|
3061
|
+
function parsePaneActives(signature) {
|
|
3062
|
+
const actives = /* @__PURE__ */ new Map();
|
|
3063
|
+
if (!signature) return actives;
|
|
3064
|
+
for (const row of signature.split("")) {
|
|
3065
|
+
const [paneId = "", itemId = ""] = row.split("");
|
|
3066
|
+
if (itemId) actives.set(paneId, itemId);
|
|
3067
|
+
}
|
|
3068
|
+
return actives;
|
|
3069
|
+
}
|
|
3051
3070
|
function parseWindowTabs(signature) {
|
|
3052
3071
|
if (!signature) return [];
|
|
3053
3072
|
const perPane = /* @__PURE__ */ new Map();
|
|
@@ -3078,6 +3097,7 @@ function CanvasPaneView({ paneId }) {
|
|
|
3078
3097
|
const canGoForward = useCanvasState((s) => active ? selectCanvasCanGoForward(s, active.id) : false);
|
|
3079
3098
|
const kind = useItemKind(active?.kind ?? "");
|
|
3080
3099
|
const singlePane = useCanvasSinglePane();
|
|
3100
|
+
const inWindowStrip = useCanvasWindowTabs() && !singlePane;
|
|
3081
3101
|
const windowTabs = useCanvasState((s) => singlePane ? windowTabsSignature(s, windowId) : "");
|
|
3082
3102
|
const sectionRef = (0, import_react9.useRef)(null);
|
|
3083
3103
|
const bodyRef = (0, import_react9.useRef)(null);
|
|
@@ -3122,8 +3142,8 @@ function CanvasPaneView({ paneId }) {
|
|
|
3122
3142
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ArrowRightIcon, {})
|
|
3123
3143
|
}
|
|
3124
3144
|
) : null,
|
|
3125
|
-
single && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SingleTitle, { item: active, kind }) : tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: pane.activeItemId }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }),
|
|
3126
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-new-tab", label: "New tab", onClick: () => void canvas.newTab(paneId), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, {}) })
|
|
3145
|
+
inWindowStrip ? active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaneTitle, { item: active, kind }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }) : single && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SingleTitle, { item: active, kind }) : tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: pane.activeItemId }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }),
|
|
3146
|
+
inWindowStrip ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-new-tab", label: "New tab", onClick: () => void canvas.newTab(paneId), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, {}) })
|
|
3127
3147
|
] }),
|
|
3128
3148
|
leading: Leading && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Leading, { ...kindProps }) : null,
|
|
3129
3149
|
actions: Action && kindProps ? (
|
|
@@ -3184,24 +3204,56 @@ function SingleTitle({ item, kind }) {
|
|
|
3184
3204
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mxc-tab-close", "data-slot": "browser-tab-close", "aria-label": `Close ${title}`, onClick: () => canvas.close(item.id), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {}) })
|
|
3185
3205
|
] });
|
|
3186
3206
|
}
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3207
|
+
function PaneTitle({ item, kind }) {
|
|
3208
|
+
const title = itemTitle(item, kind);
|
|
3209
|
+
const drag = useTabDrag(item.id, title);
|
|
3210
|
+
const Icon = kind?.icon ?? AlertIcon;
|
|
3211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "mxc-panel-title mxc-pane-title", "data-draggable": "", title, ...drag, children: [
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "mxc-title-icon" }),
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-tab-title", children: title })
|
|
3214
|
+
] });
|
|
3215
|
+
}
|
|
3216
|
+
var CANVAS_TAB_MIN_WIDTH = 120;
|
|
3190
3217
|
var TAB_GAP = 2;
|
|
3191
|
-
function
|
|
3192
|
-
if (count <=
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
const
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
}
|
|
3202
|
-
|
|
3218
|
+
function canvasTabsOverflow(count, width) {
|
|
3219
|
+
if (count <= 1 || width <= 0) return false;
|
|
3220
|
+
return count * CANVAS_TAB_MIN_WIDTH + (count - 1) * TAB_GAP > width;
|
|
3221
|
+
}
|
|
3222
|
+
function planCanvasTabStrip(tabs, actives) {
|
|
3223
|
+
const joined = actives ? tabs.filter((tab) => actives.get(tab.paneId) === tab.itemId) : [];
|
|
3224
|
+
if (joined.length < 2) return tabs.map((tab) => ({ type: "tab", tab }));
|
|
3225
|
+
const entries = [];
|
|
3226
|
+
let placed = false;
|
|
3227
|
+
for (const tab of tabs) {
|
|
3228
|
+
if (!joined.includes(tab)) entries.push({ type: "tab", tab });
|
|
3229
|
+
else if (!placed) {
|
|
3230
|
+
entries.push({ type: "split", tabs: joined });
|
|
3231
|
+
placed = true;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
return entries;
|
|
3235
|
+
}
|
|
3236
|
+
function CanvasWindowTabs() {
|
|
3203
3237
|
const canvas = useCanvas();
|
|
3238
|
+
const { windowId } = useCanvasInternals();
|
|
3239
|
+
const signature = useCanvasState((s) => windowTabsSignature(s, windowId));
|
|
3240
|
+
const activesSignature = useCanvasState((s) => paneActivesSignature(s, windowId));
|
|
3241
|
+
const focusedPaneId = useCanvasState((s) => selectCanvasFocusedPaneId(s, windowId));
|
|
3242
|
+
const focusedActive = useCanvasState((s) => focusedPaneId ? s.panes[focusedPaneId]?.activeItemId ?? null : null);
|
|
3243
|
+
const tabs = parseWindowTabs(signature);
|
|
3244
|
+
const actives = parsePaneActives(activesSignature);
|
|
3245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mxc-window-tabs", "data-slot": "canvas-window-tabs", children: [
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: focusedActive, actives }),
|
|
3247
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-new-tab", label: "New tab", onClick: () => void canvas.newTab(focusedPaneId ?? void 0), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, {}) })
|
|
3248
|
+
] });
|
|
3249
|
+
}
|
|
3250
|
+
function TabStrip({
|
|
3251
|
+
tabs,
|
|
3252
|
+
activeItemId,
|
|
3253
|
+
actives
|
|
3254
|
+
}) {
|
|
3204
3255
|
const strip = (0, import_react9.useRef)(null);
|
|
3256
|
+
const list = (0, import_react9.useRef)(null);
|
|
3205
3257
|
const [width, setWidth] = (0, import_react9.useState)(0);
|
|
3206
3258
|
const read = (0, import_react9.useRef)(() => {
|
|
3207
3259
|
});
|
|
@@ -3227,48 +3279,75 @@ function TabStrip({ tabs, activeItemId }) {
|
|
|
3227
3279
|
useIsoLayoutEffect4(() => {
|
|
3228
3280
|
read.current();
|
|
3229
3281
|
}, [tabs.length]);
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3282
|
+
(0, import_react9.useEffect)(() => {
|
|
3283
|
+
const el = list.current;
|
|
3284
|
+
if (!el) return void 0;
|
|
3285
|
+
const onWheel = (event) => {
|
|
3286
|
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX) || el.scrollWidth <= el.clientWidth) return;
|
|
3287
|
+
event.preventDefault();
|
|
3288
|
+
el.scrollLeft += event.deltaY;
|
|
3289
|
+
};
|
|
3290
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
3291
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
3292
|
+
}, []);
|
|
3293
|
+
useIsoLayoutEffect4(() => {
|
|
3294
|
+
const el = list.current;
|
|
3295
|
+
if (!el || !activeItemId) return;
|
|
3296
|
+
const tab = [...el.querySelectorAll("[data-mxc-tab]")].find((node) => node.dataset.mxcTab === activeItemId);
|
|
3297
|
+
if (!tab) return;
|
|
3298
|
+
const box = el.getBoundingClientRect();
|
|
3299
|
+
const rect = tab.getBoundingClientRect();
|
|
3300
|
+
if (rect.left < box.left) el.scrollLeft -= box.left - rect.left;
|
|
3301
|
+
else if (rect.right > box.right) el.scrollLeft += rect.right - box.right;
|
|
3302
|
+
}, [activeItemId, width, tabs.length]);
|
|
3303
|
+
const entries = planCanvasTabStrip(tabs, actives);
|
|
3304
|
+
const overflow = canvasTabsOverflow(tabs.length, width);
|
|
3305
|
+
const joined = entries.some((entry) => entry.type === "split");
|
|
3306
|
+
const isActive = (tab) => actives ? actives.get(tab.paneId) === tab.itemId : tab.itemId === activeItemId;
|
|
3307
|
+
const tabView = (tab) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3308
|
+
ItemTab,
|
|
3309
|
+
{
|
|
3310
|
+
itemId: tab.itemId,
|
|
3311
|
+
paneId: tab.paneId,
|
|
3312
|
+
index: tab.index,
|
|
3313
|
+
active: isActive(tab),
|
|
3314
|
+
current: joined && tab.itemId === activeItemId
|
|
3315
|
+
},
|
|
3316
|
+
tab.itemId
|
|
3317
|
+
);
|
|
3234
3318
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3235
3319
|
"div",
|
|
3236
3320
|
{
|
|
3237
3321
|
ref: strip,
|
|
3238
3322
|
className: "mxc-tabstrip",
|
|
3239
|
-
"data-overflow":
|
|
3240
|
-
|
|
3241
|
-
style: { ["--mxc-tab-min"]: `${CANVAS_TAB_MIN_WIDTH}px`, ["--mxc-tab-active-min"]: `${CANVAS_ACTIVE_TAB_MIN_WIDTH}px` },
|
|
3323
|
+
"data-overflow": overflow ? "" : void 0,
|
|
3324
|
+
style: { ["--mxc-tab-min"]: `${CANVAS_TAB_MIN_WIDTH}px` },
|
|
3242
3325
|
children: [
|
|
3243
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3244
|
-
"
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
if (next) canvas.activate(next.itemId);
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: list, className: "mxc-tabs", role: "tablist", "aria-label": "Canvas tabs", "aria-multiselectable": joined ? true : void 0, children: entries.map(
|
|
3327
|
+
(entry) => entry.type === "tab" ? tabView(entry.tab) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3328
|
+
"div",
|
|
3329
|
+
{
|
|
3330
|
+
className: "mxc-tab-group",
|
|
3331
|
+
"data-split": "",
|
|
3332
|
+
role: "presentation",
|
|
3333
|
+
style: { ["--mxc-group-n"]: entry.tabs.length },
|
|
3334
|
+
children: entry.tabs.map(tabView)
|
|
3253
3335
|
},
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
),
|
|
3257
|
-
|
|
3336
|
+
`split:${entry.tabs.map((tab) => tab.itemId).join("|")}`
|
|
3337
|
+
)
|
|
3338
|
+
) }),
|
|
3339
|
+
overflow ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabListMenu, { tabs, activeItemId }) : null
|
|
3258
3340
|
]
|
|
3259
3341
|
}
|
|
3260
3342
|
);
|
|
3261
3343
|
}
|
|
3262
|
-
function TabListMenu({ tabs, activeItemId
|
|
3344
|
+
function TabListMenu({ tabs, activeItemId }) {
|
|
3263
3345
|
const canvas = useCanvas();
|
|
3264
3346
|
const { ports, layer } = useCanvasInternals();
|
|
3265
3347
|
const blocking = (0, import_react9.useRef)(null);
|
|
3266
3348
|
(0, import_react9.useEffect)(() => () => blocking.current?.(), []);
|
|
3267
3349
|
const label = `All tabs (${tabs.length})`;
|
|
3268
|
-
const trigger = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
3269
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronDownIcon, {}),
|
|
3270
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-tab-list-count", "aria-hidden": "true", children: hidden })
|
|
3271
|
-
] });
|
|
3350
|
+
const trigger = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-tab-list", label, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronDownIcon, {}) });
|
|
3272
3351
|
const showMenu = ports.showMenu;
|
|
3273
3352
|
if (showMenu) {
|
|
3274
3353
|
return trigger({
|
|
@@ -3324,7 +3403,13 @@ function TabListEntry({ itemId, active }) {
|
|
|
3324
3403
|
}
|
|
3325
3404
|
);
|
|
3326
3405
|
}
|
|
3327
|
-
function ItemTab({
|
|
3406
|
+
function ItemTab({
|
|
3407
|
+
itemId,
|
|
3408
|
+
paneId,
|
|
3409
|
+
index,
|
|
3410
|
+
active,
|
|
3411
|
+
current = false
|
|
3412
|
+
}) {
|
|
3328
3413
|
const canvas = useCanvas();
|
|
3329
3414
|
const item = useCanvasState((s) => s.items[itemId]);
|
|
3330
3415
|
const kind = useItemKind(item?.kind ?? "");
|
|
@@ -3338,6 +3423,8 @@ function ItemTab({ itemId, paneId, index, active }) {
|
|
|
3338
3423
|
title,
|
|
3339
3424
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, {}),
|
|
3340
3425
|
active,
|
|
3426
|
+
"data-mxc-tab": itemId,
|
|
3427
|
+
"data-current": current ? "" : void 0,
|
|
3341
3428
|
onSelect: () => canvas.activate(itemId),
|
|
3342
3429
|
onClose: () => canvas.close(itemId),
|
|
3343
3430
|
...drag,
|
|
@@ -3523,6 +3610,7 @@ function CanvasColumn({ className, style, onLiveWidth, placement = "docked" }) {
|
|
|
3523
3610
|
};
|
|
3524
3611
|
}, [layer]);
|
|
3525
3612
|
if (!layout) return null;
|
|
3613
|
+
const windowTabs = !singlePane && layout.type === "split";
|
|
3526
3614
|
const fitted = fitCanvasWidth(width, region, controller.rules);
|
|
3527
3615
|
const shown = dragWidth ?? fitted;
|
|
3528
3616
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -3550,10 +3638,13 @@ function CanvasColumn({ className, style, onLiveWidth, placement = "docked" }) {
|
|
|
3550
3638
|
}
|
|
3551
3639
|
}
|
|
3552
3640
|
) : null,
|
|
3553
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasSlotsContext.Provider, { value: slots, children: /* @__PURE__ */ (0, import_jsx_runtime8.
|
|
3554
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasSlotsContext.Provider, { value: slots, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasSinglePaneContext.Provider, { value: singlePane, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(CanvasWindowTabsContext.Provider, { value: windowTabs, children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mxc-layout", "data-single-pane": singlePane ? "" : void 0, "data-window-tabs": windowTabs ? "" : void 0, children: [
|
|
3643
|
+
windowTabs ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasWindowTabs, {}) : null,
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mxc-layout-panes", children: singlePane ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasPaneView, { paneId: presentedPaneId ?? listPaneIds(layout)[0] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayoutNodeView, { node: layout }) })
|
|
3645
|
+
] }),
|
|
3555
3646
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasBodyLayer, {})
|
|
3556
|
-
] }) })
|
|
3647
|
+
] }) }) })
|
|
3557
3648
|
] })
|
|
3558
3649
|
}
|
|
3559
3650
|
);
|