@seanyeh77/ui 0.30.0 → 0.30.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/dist/index.js CHANGED
@@ -10886,14 +10886,16 @@ function Workbench({ ref, ...p }) {
10886
10886
  const root = React.useRef(null);
10887
10887
  const [dim, setDim] = React.useState({
10888
10888
  w: 1280,
10889
- h: 800
10889
+ h: 800,
10890
+ measured: false
10890
10891
  });
10891
10892
  React.useLayoutEffect(() => {
10892
10893
  const el = root.current;
10893
10894
  if (!el) return;
10894
- const read = () => setDim((d) => d.w === el.clientWidth && d.h === el.clientHeight ? d : {
10895
+ const read = () => setDim((d) => d.measured && d.w === el.clientWidth && d.h === el.clientHeight ? d : {
10895
10896
  w: el.clientWidth,
10896
- h: el.clientHeight
10897
+ h: el.clientHeight,
10898
+ measured: true
10897
10899
  });
10898
10900
  read();
10899
10901
  const ro = new ResizeObserver(read);
@@ -10920,9 +10922,10 @@ function Workbench({ ref, ...p }) {
10920
10922
  const exOverlay = w < 960;
10921
10923
  const sideOverlay = w < 1280;
10922
10924
  const bodyH = Math.max(0, h - TOP);
10923
- const [lastBand, setLastBand] = React.useState(0);
10925
+ const [lastBand, setLastBand] = React.useState(null);
10924
10926
  const band = phone ? 3 : exOverlay ? 2 : sideOverlay ? 1 : 0;
10925
- if (band !== lastBand) {
10927
+ if (dim.measured && lastBand === null) setLastBand(band);
10928
+ else if (dim.measured && band !== lastBand) {
10926
10929
  setLastBand(band);
10927
10930
  setOv({
10928
10931
  explorer: false,
@@ -11063,6 +11066,9 @@ function Workbench({ ref, ...p }) {
11063
11066
  const r = lay.side.includes(viewId) ? "side" : lay.panel.includes(viewId) ? "panel" : null;
11064
11067
  devWarn(!r, "Workbench", `show('${viewId}'): no view has this id. Pass the id of one of the views.`);
11065
11068
  if (!r) return;
11069
+ const cw = root.current?.clientWidth || w;
11070
+ const phone = cw < 600;
11071
+ const sideOverlay = cw < 1280;
11066
11072
  const remember = !phone && !(r === "side" && sideOverlay);
11067
11073
  update((l) => ({
11068
11074
  ...l,