react-os-shell 0.6.7 → 0.6.8
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 +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
1224
|
+
var VERSION = "0.6.8" ;
|
|
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 [measuredFlyoutH, setMeasuredFlyoutH] = useState(null);
|
|
3216
|
+
const [measuredSubH, setMeasuredSubH] = useState(null);
|
|
3214
3217
|
useEffect(() => {
|
|
3215
3218
|
if (!open) {
|
|
3216
3219
|
setSearch("");
|
|
@@ -3222,6 +3225,22 @@ function StartMenu({
|
|
|
3222
3225
|
useEffect(() => {
|
|
3223
3226
|
setHoveredChild(null);
|
|
3224
3227
|
}, [hoveredSection]);
|
|
3228
|
+
useEffect(() => {
|
|
3229
|
+
setMeasuredFlyoutH(null);
|
|
3230
|
+
}, [hoveredSection]);
|
|
3231
|
+
useEffect(() => {
|
|
3232
|
+
setMeasuredSubH(null);
|
|
3233
|
+
}, [hoveredChild]);
|
|
3234
|
+
useLayoutEffect(() => {
|
|
3235
|
+
if (!flyoutRef.current || !hoveredSection || search.length >= 2) return;
|
|
3236
|
+
const h = flyoutRef.current.offsetHeight;
|
|
3237
|
+
if (h !== measuredFlyoutH) setMeasuredFlyoutH(h);
|
|
3238
|
+
}, [hoveredSection, search, measuredFlyoutH]);
|
|
3239
|
+
useLayoutEffect(() => {
|
|
3240
|
+
if (!subFlyoutRef.current || !hoveredChild || search.length >= 2) return;
|
|
3241
|
+
const h = subFlyoutRef.current.offsetHeight;
|
|
3242
|
+
if (h !== measuredSubH) setMeasuredSubH(h);
|
|
3243
|
+
}, [hoveredChild, search, measuredSubH]);
|
|
3225
3244
|
useEffect(() => {
|
|
3226
3245
|
if (!open) return;
|
|
3227
3246
|
const handler = (e) => {
|
|
@@ -3354,7 +3373,8 @@ function StartMenu({
|
|
|
3354
3373
|
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
3374
|
const menuGlass = glassStyle();
|
|
3356
3375
|
const itemCls = `w-full flex items-center gap-2 rounded-lg ${sizeConfig.px} ${sizeConfig.py} ${sizeConfig.text}`;
|
|
3357
|
-
const
|
|
3376
|
+
const flyoutEstH = flyoutItems.length * sizeConfig.itemH + 12;
|
|
3377
|
+
const flyoutH = measuredFlyoutH ?? flyoutEstH;
|
|
3358
3378
|
const menuWidth = sizeConfig.mw;
|
|
3359
3379
|
const menuRect = menuRef.current?.getBoundingClientRect();
|
|
3360
3380
|
const minTop = menuRect ? menuRect.top : taskbarPosition === "top" ? taskbarH + 4 : 4;
|
|
@@ -3362,7 +3382,6 @@ function StartMenu({
|
|
|
3362
3382
|
let flyoutTop = hoveredY - flyoutH / 2;
|
|
3363
3383
|
if (flyoutTop < minTop) flyoutTop = minTop;
|
|
3364
3384
|
if (flyoutTop + flyoutH > maxBottom) flyoutTop = Math.max(minTop, maxBottom - flyoutH);
|
|
3365
|
-
const flyoutMaxH = maxBottom - flyoutTop;
|
|
3366
3385
|
const handleSectionHover = (label, e) => {
|
|
3367
3386
|
clearTimeout(hoverTimeout.current);
|
|
3368
3387
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3570,8 +3589,8 @@ function StartMenu({
|
|
|
3570
3589
|
"div",
|
|
3571
3590
|
{
|
|
3572
3591
|
ref: flyoutRef,
|
|
3573
|
-
className: `fixed ${sizeConfig.fw} rounded-2xl
|
|
3574
|
-
style: { left: menuRef.current ? menuRef.current.getBoundingClientRect().right + 4 : menuWidth + 12, top: flyoutTop,
|
|
3592
|
+
className: `fixed ${sizeConfig.fw} rounded-2xl overflow-hidden`,
|
|
3593
|
+
style: { left: menuRef.current ? menuRef.current.getBoundingClientRect().right + 4 : menuWidth + 12, top: flyoutTop, animation: "submenu-in 0.1s ease-out", ...menuGlass },
|
|
3575
3594
|
onMouseEnter: () => clearTimeout(hoverTimeout.current),
|
|
3576
3595
|
onMouseLeave: () => {
|
|
3577
3596
|
hoverTimeout.current = setTimeout(() => {
|
|
@@ -3579,7 +3598,7 @@ function StartMenu({
|
|
|
3579
3598
|
setHoveredChild(null);
|
|
3580
3599
|
}, 200);
|
|
3581
3600
|
},
|
|
3582
|
-
children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1
|
|
3601
|
+
children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1", children: flyoutItems.map((item) => {
|
|
3583
3602
|
const hasChildren = !!item.children && item.children.length > 0;
|
|
3584
3603
|
const isChildHovered = hoveredChild === item.to;
|
|
3585
3604
|
return /* @__PURE__ */ jsxs(
|
|
@@ -3621,16 +3640,17 @@ function StartMenu({
|
|
|
3621
3640
|
if (!parent || kids.length === 0) return null;
|
|
3622
3641
|
const flyoutRect = flyoutRef.current?.getBoundingClientRect();
|
|
3623
3642
|
const subLeft = flyoutRect ? flyoutRect.right + 4 : 0;
|
|
3624
|
-
const
|
|
3643
|
+
const subEstH = kids.length * sizeConfig.itemH + 12;
|
|
3644
|
+
const subH = measuredSubH ?? subEstH;
|
|
3625
3645
|
let subTop = hoveredChildY - subH / 2;
|
|
3626
3646
|
if (subTop < minTop) subTop = minTop;
|
|
3627
3647
|
if (subTop + subH > maxBottom) subTop = Math.max(minTop, maxBottom - subH);
|
|
3628
|
-
const subMaxH = maxBottom - subTop;
|
|
3629
3648
|
return /* @__PURE__ */ jsx(
|
|
3630
3649
|
"div",
|
|
3631
3650
|
{
|
|
3632
|
-
|
|
3633
|
-
|
|
3651
|
+
ref: subFlyoutRef,
|
|
3652
|
+
className: `fixed ${sizeConfig.fw} rounded-2xl overflow-hidden`,
|
|
3653
|
+
style: { left: subLeft, top: subTop, animation: "submenu-in 0.1s ease-out", ...menuGlass },
|
|
3634
3654
|
onMouseEnter: () => {
|
|
3635
3655
|
clearTimeout(hoverTimeout.current);
|
|
3636
3656
|
clearTimeout(childHoverTimeout.current);
|
|
@@ -3638,7 +3658,7 @@ function StartMenu({
|
|
|
3638
3658
|
onMouseLeave: () => {
|
|
3639
3659
|
childHoverTimeout.current = setTimeout(() => setHoveredChild(null), 200);
|
|
3640
3660
|
},
|
|
3641
|
-
children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1
|
|
3661
|
+
children: /* @__PURE__ */ jsx("div", { className: "py-1 px-1", children: kids.map((child) => /* @__PURE__ */ jsxs("div", { children: [
|
|
3642
3662
|
/* @__PURE__ */ jsxs(
|
|
3643
3663
|
"button",
|
|
3644
3664
|
{
|