@ai-matrx/canvas 0.7.1 → 0.7.3
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 +21 -0
- package/README.md +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +24 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +24 -5
- package/dist/react.js.map +1 -1
- package/dist/styles.css +14 -9
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -1057,7 +1057,11 @@ var CANVAS_PANE_MIN_WIDTH = 280;
|
|
|
1057
1057
|
var CANVAS_WEB_LAYOUT_RULES = {
|
|
1058
1058
|
defaultWidth: CANVAS_DEFAULT_WIDTH,
|
|
1059
1059
|
minWidth: CANVAS_MIN_WIDTH,
|
|
1060
|
-
|
|
1060
|
+
// The page beside the canvas keeps room for its route header (title, mode switch,
|
|
1061
|
+
// the shell's own controls): a 2026-10-03 census of 40 routes found headers 29-67px
|
|
1062
|
+
// wide at 420 with a 900px canvas. Hosts pass `regionWidth` so this is the PAGE's
|
|
1063
|
+
// width, not the window's.
|
|
1064
|
+
centreMinWidth: 600,
|
|
1061
1065
|
// Split down 70/30 like the desktop: what opens below (notifications, a feed) is the smaller pane.
|
|
1062
1066
|
stackSplit: 0.7,
|
|
1063
1067
|
sideSplit: 0.5,
|
|
@@ -3199,15 +3203,30 @@ function TabStrip({ tabs, activeItemId }) {
|
|
|
3199
3203
|
const canvas = useCanvas();
|
|
3200
3204
|
const strip = (0, import_react9.useRef)(null);
|
|
3201
3205
|
const [width, setWidth] = (0, import_react9.useState)(0);
|
|
3206
|
+
const read = (0, import_react9.useRef)(() => {
|
|
3207
|
+
});
|
|
3202
3208
|
useIsoLayoutEffect4(() => {
|
|
3203
3209
|
const el = strip.current;
|
|
3204
3210
|
if (!el) return void 0;
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3211
|
+
let live = true;
|
|
3212
|
+
const measure = () => {
|
|
3213
|
+
if (live) setWidth(Math.floor(el.getBoundingClientRect().width));
|
|
3214
|
+
};
|
|
3215
|
+
read.current = measure;
|
|
3216
|
+
measure();
|
|
3217
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
3208
3218
|
observer?.observe(el);
|
|
3209
|
-
|
|
3219
|
+
void document.fonts?.ready?.then(measure);
|
|
3220
|
+
const frame2 = typeof requestAnimationFrame === "undefined" ? 0 : requestAnimationFrame(() => requestAnimationFrame(measure));
|
|
3221
|
+
return () => {
|
|
3222
|
+
live = false;
|
|
3223
|
+
observer?.disconnect();
|
|
3224
|
+
if (frame2 && typeof cancelAnimationFrame !== "undefined") cancelAnimationFrame(frame2);
|
|
3225
|
+
};
|
|
3210
3226
|
}, []);
|
|
3227
|
+
useIsoLayoutEffect4(() => {
|
|
3228
|
+
read.current();
|
|
3229
|
+
}, [tabs.length]);
|
|
3211
3230
|
const activeIndex = Math.max(0, tabs.findIndex((tab) => tab.itemId === activeItemId));
|
|
3212
3231
|
const fit = fitCanvasTabs(tabs.length, activeIndex, width);
|
|
3213
3232
|
const shown = tabs.slice(fit.start, fit.end);
|