react-os-shell 0.6.7 → 0.6.9

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
@@ -1221,7 +1221,7 @@ function StatusBadge({ status }) {
1221
1221
  }
1222
1222
 
1223
1223
  // src/version.ts
1224
- var VERSION = "0.6.7" ;
1224
+ var VERSION = "0.6.9" ;
1225
1225
  var APP_VERSION = VERSION;
1226
1226
 
1227
1227
  // src/changelog.ts
@@ -3209,8 +3209,11 @@ function StartMenu({
3209
3209
  const [searchIdx, setSearchIdx] = useState(0);
3210
3210
  const menuRef = useRef(null);
3211
3211
  const flyoutRef = useRef(null);
3212
+ const subFlyoutRef = useRef(null);
3212
3213
  const hoverTimeout = useRef();
3213
3214
  const childHoverTimeout = useRef();
3215
+ const [measuredFlyout, setMeasuredFlyout] = useState(null);
3216
+ const [measuredSub, setMeasuredSub] = useState(null);
3214
3217
  useEffect(() => {
3215
3218
  if (!open) {
3216
3219
  setSearch("");
@@ -3222,6 +3225,20 @@ function StartMenu({
3222
3225
  useEffect(() => {
3223
3226
  setHoveredChild(null);
3224
3227
  }, [hoveredSection]);
3228
+ useLayoutEffect(() => {
3229
+ if (!flyoutRef.current || !hoveredSection || search.length >= 2) return;
3230
+ const h = flyoutRef.current.offsetHeight;
3231
+ if (measuredFlyout?.key !== hoveredSection || measuredFlyout.h !== h) {
3232
+ setMeasuredFlyout({ key: hoveredSection, h });
3233
+ }
3234
+ }, [hoveredSection, search, measuredFlyout]);
3235
+ useLayoutEffect(() => {
3236
+ if (!subFlyoutRef.current || !hoveredChild || search.length >= 2) return;
3237
+ const h = subFlyoutRef.current.offsetHeight;
3238
+ if (measuredSub?.key !== hoveredChild || measuredSub.h !== h) {
3239
+ setMeasuredSub({ key: hoveredChild, h });
3240
+ }
3241
+ }, [hoveredChild, search, measuredSub]);
3225
3242
  useEffect(() => {
3226
3243
  if (!open) return;
3227
3244
  const handler = (e) => {
@@ -3354,7 +3371,8 @@ function StartMenu({
3354
3371
  const sizeConfig = tight ? { small: { w: "w-52", fw: "w-44", text: "text-xs", py: "py-1", px: "px-3", mw: 208, itemH: 24 }, medium: { w: "w-56", fw: "w-48", text: "text-xs", py: "py-1", px: "px-3", mw: 224, itemH: 26 }, large: { w: "w-64", fw: "w-52", text: "text-sm", py: "py-1.5", px: "px-3", mw: 256, itemH: 30 } }[size] : { small: { w: "w-56", fw: "w-48", text: "text-xs", py: "py-1.5", px: "px-3", mw: 224, itemH: 30 }, medium: { w: "w-64", fw: "w-56", text: "text-sm", py: "py-2", px: "px-4", mw: 256, itemH: 36 }, large: { w: "w-72", fw: "w-60", text: "text-sm", py: "py-2.5", px: "px-4", mw: 288, itemH: 40 } }[size];
3355
3372
  const menuGlass = glassStyle();
3356
3373
  const itemCls = `w-full flex items-center gap-2 rounded-lg ${sizeConfig.px} ${sizeConfig.py} ${sizeConfig.text}`;
3357
- const flyoutH = flyoutItems.length * sizeConfig.itemH + 12;
3374
+ const flyoutEstH = flyoutItems.length * sizeConfig.itemH + 12;
3375
+ const flyoutH = measuredFlyout?.key === hoveredSection ? measuredFlyout.h : flyoutEstH;
3358
3376
  const menuWidth = sizeConfig.mw;
3359
3377
  const menuRect = menuRef.current?.getBoundingClientRect();
3360
3378
  const minTop = menuRect ? menuRect.top : taskbarPosition === "top" ? taskbarH + 4 : 4;
@@ -3362,7 +3380,6 @@ function StartMenu({
3362
3380
  let flyoutTop = hoveredY - flyoutH / 2;
3363
3381
  if (flyoutTop < minTop) flyoutTop = minTop;
3364
3382
  if (flyoutTop + flyoutH > maxBottom) flyoutTop = Math.max(minTop, maxBottom - flyoutH);
3365
- const flyoutMaxH = maxBottom - flyoutTop;
3366
3383
  const handleSectionHover = (label, e) => {
3367
3384
  clearTimeout(hoverTimeout.current);
3368
3385
  const rect = e.currentTarget.getBoundingClientRect();
@@ -3570,8 +3587,8 @@ function StartMenu({
3570
3587
  "div",
3571
3588
  {
3572
3589
  ref: flyoutRef,
3573
- className: `fixed ${sizeConfig.fw} rounded-2xl flex flex-col overflow-hidden`,
3574
- style: { left: menuRef.current ? menuRef.current.getBoundingClientRect().right + 4 : menuWidth + 12, top: flyoutTop, maxHeight: flyoutMaxH, animation: "submenu-in 0.1s ease-out", ...menuGlass },
3590
+ className: `fixed ${sizeConfig.fw} rounded-2xl overflow-hidden`,
3591
+ style: { left: menuRef.current ? menuRef.current.getBoundingClientRect().right + 4 : menuWidth + 12, top: flyoutTop, animation: "submenu-in 0.1s ease-out", ...menuGlass },
3575
3592
  onMouseEnter: () => clearTimeout(hoverTimeout.current),
3576
3593
  onMouseLeave: () => {
3577
3594
  hoverTimeout.current = setTimeout(() => {
@@ -3579,7 +3596,7 @@ function StartMenu({
3579
3596
  setHoveredChild(null);
3580
3597
  }, 200);
3581
3598
  },
3582
- children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1 overflow-y-auto", children: flyoutItems.map((item) => {
3599
+ children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1", children: flyoutItems.map((item) => {
3583
3600
  const hasChildren = !!item.children && item.children.length > 0;
3584
3601
  const isChildHovered = hoveredChild === item.to;
3585
3602
  return /* @__PURE__ */ jsxs(
@@ -3621,16 +3638,17 @@ function StartMenu({
3621
3638
  if (!parent || kids.length === 0) return null;
3622
3639
  const flyoutRect = flyoutRef.current?.getBoundingClientRect();
3623
3640
  const subLeft = flyoutRect ? flyoutRect.right + 4 : 0;
3624
- const subH = kids.length * sizeConfig.itemH + 12;
3641
+ const subEstH = kids.length * sizeConfig.itemH + 12;
3642
+ const subH = measuredSub?.key === hoveredChild ? measuredSub.h : subEstH;
3625
3643
  let subTop = hoveredChildY - subH / 2;
3626
3644
  if (subTop < minTop) subTop = minTop;
3627
3645
  if (subTop + subH > maxBottom) subTop = Math.max(minTop, maxBottom - subH);
3628
- const subMaxH = maxBottom - subTop;
3629
3646
  return /* @__PURE__ */ jsx(
3630
3647
  "div",
3631
3648
  {
3632
- className: `fixed ${sizeConfig.fw} rounded-2xl flex flex-col overflow-hidden`,
3633
- style: { left: subLeft, top: subTop, maxHeight: subMaxH, animation: "submenu-in 0.1s ease-out", ...menuGlass },
3649
+ ref: subFlyoutRef,
3650
+ className: `fixed ${sizeConfig.fw} rounded-2xl overflow-hidden`,
3651
+ style: { left: subLeft, top: subTop, animation: "submenu-in 0.1s ease-out", ...menuGlass },
3634
3652
  onMouseEnter: () => {
3635
3653
  clearTimeout(hoverTimeout.current);
3636
3654
  clearTimeout(childHoverTimeout.current);
@@ -3638,7 +3656,7 @@ function StartMenu({
3638
3656
  onMouseLeave: () => {
3639
3657
  childHoverTimeout.current = setTimeout(() => setHoveredChild(null), 200);
3640
3658
  },
3641
- children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1 overflow-y-auto", children: kids.map((child) => /* @__PURE__ */ jsxs("div", { children: [
3659
+ children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1", children: kids.map((child) => /* @__PURE__ */ jsxs("div", { children: [
3642
3660
  /* @__PURE__ */ jsxs(
3643
3661
  "button",
3644
3662
  {