@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.js
CHANGED
|
@@ -990,7 +990,11 @@ var CANVAS_PANE_MIN_WIDTH = 280;
|
|
|
990
990
|
var CANVAS_WEB_LAYOUT_RULES = {
|
|
991
991
|
defaultWidth: CANVAS_DEFAULT_WIDTH,
|
|
992
992
|
minWidth: CANVAS_MIN_WIDTH,
|
|
993
|
-
|
|
993
|
+
// The page beside the canvas keeps room for its route header (title, mode switch,
|
|
994
|
+
// the shell's own controls): a 2026-10-03 census of 40 routes found headers 29-67px
|
|
995
|
+
// wide at 420 with a 900px canvas. Hosts pass `regionWidth` so this is the PAGE's
|
|
996
|
+
// width, not the window's.
|
|
997
|
+
centreMinWidth: 600,
|
|
994
998
|
// Split down 70/30 like the desktop: what opens below (notifications, a feed) is the smaller pane.
|
|
995
999
|
stackSplit: 0.7,
|
|
996
1000
|
sideSplit: 0.5,
|
|
@@ -3154,15 +3158,30 @@ function TabStrip({ tabs, activeItemId }) {
|
|
|
3154
3158
|
const canvas = useCanvas();
|
|
3155
3159
|
const strip = useRef7(null);
|
|
3156
3160
|
const [width, setWidth] = useState5(0);
|
|
3161
|
+
const read = useRef7(() => {
|
|
3162
|
+
});
|
|
3157
3163
|
useIsoLayoutEffect4(() => {
|
|
3158
3164
|
const el = strip.current;
|
|
3159
3165
|
if (!el) return void 0;
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3166
|
+
let live = true;
|
|
3167
|
+
const measure = () => {
|
|
3168
|
+
if (live) setWidth(Math.floor(el.getBoundingClientRect().width));
|
|
3169
|
+
};
|
|
3170
|
+
read.current = measure;
|
|
3171
|
+
measure();
|
|
3172
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
3163
3173
|
observer?.observe(el);
|
|
3164
|
-
|
|
3174
|
+
void document.fonts?.ready?.then(measure);
|
|
3175
|
+
const frame2 = typeof requestAnimationFrame === "undefined" ? 0 : requestAnimationFrame(() => requestAnimationFrame(measure));
|
|
3176
|
+
return () => {
|
|
3177
|
+
live = false;
|
|
3178
|
+
observer?.disconnect();
|
|
3179
|
+
if (frame2 && typeof cancelAnimationFrame !== "undefined") cancelAnimationFrame(frame2);
|
|
3180
|
+
};
|
|
3165
3181
|
}, []);
|
|
3182
|
+
useIsoLayoutEffect4(() => {
|
|
3183
|
+
read.current();
|
|
3184
|
+
}, [tabs.length]);
|
|
3166
3185
|
const activeIndex = Math.max(0, tabs.findIndex((tab) => tab.itemId === activeItemId));
|
|
3167
3186
|
const fit = fitCanvasTabs(tabs.length, activeIndex, width);
|
|
3168
3187
|
const shown = tabs.slice(fit.start, fit.end);
|