@fluid-app/portal-sdk 0.1.29 → 0.1.30
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.cjs +85 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +86 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -2734,6 +2734,7 @@ function getThemeModeAttribute(mode) {
|
|
|
2734
2734
|
//#region ../core/src/navigation/system-navigation-items.ts
|
|
2735
2735
|
const SYSTEM_NAVIGATION_SLUGS = [
|
|
2736
2736
|
"contacts",
|
|
2737
|
+
"account",
|
|
2737
2738
|
"messages",
|
|
2738
2739
|
"my-site",
|
|
2739
2740
|
"orders",
|
|
@@ -2776,6 +2777,12 @@ const SYSTEM_NAVIGATION_ITEMS = {
|
|
|
2776
2777
|
icon: "user",
|
|
2777
2778
|
section: "User"
|
|
2778
2779
|
},
|
|
2780
|
+
account: {
|
|
2781
|
+
slug: "profile",
|
|
2782
|
+
label: "Account",
|
|
2783
|
+
icon: "user",
|
|
2784
|
+
section: "User"
|
|
2785
|
+
},
|
|
2779
2786
|
"share/media": {
|
|
2780
2787
|
slug: "share/media",
|
|
2781
2788
|
label: "Media",
|
|
@@ -2826,7 +2833,10 @@ function isSystemNavigationItem(slug) {
|
|
|
2826
2833
|
*/
|
|
2827
2834
|
function getSystemNavigationBySection() {
|
|
2828
2835
|
const sections = {};
|
|
2836
|
+
const seenSlugs = /* @__PURE__ */ new Set();
|
|
2829
2837
|
for (const item of Object.values(SYSTEM_NAVIGATION_ITEMS)) {
|
|
2838
|
+
if (item.slug && seenSlugs.has(item.slug)) continue;
|
|
2839
|
+
if (item.slug) seenSlugs.add(item.slug);
|
|
2830
2840
|
const section = item.section || "Other";
|
|
2831
2841
|
if (!sections[section]) sections[section] = [];
|
|
2832
2842
|
sections[section].push(item);
|
|
@@ -3501,6 +3511,65 @@ function BuilderScreenViewImpl({ screen, className }) {
|
|
|
3501
3511
|
}
|
|
3502
3512
|
const BuilderScreenView = (0, react.memo)(BuilderScreenViewImpl);
|
|
3503
3513
|
//#endregion
|
|
3514
|
+
//#region src/account/account-management-layout.tsx
|
|
3515
|
+
const NAV_ITEMS = [
|
|
3516
|
+
{
|
|
3517
|
+
key: "profile",
|
|
3518
|
+
label: "Profile",
|
|
3519
|
+
slug: "profile",
|
|
3520
|
+
icon: lucide_react.User
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
key: "orders",
|
|
3524
|
+
label: "Orders",
|
|
3525
|
+
slug: "orders",
|
|
3526
|
+
icon: lucide_react.PackageOpen
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
key: "subscriptions",
|
|
3530
|
+
label: "Subscriptions",
|
|
3531
|
+
slug: "subscriptions",
|
|
3532
|
+
icon: lucide_react.Repeat
|
|
3533
|
+
}
|
|
3534
|
+
];
|
|
3535
|
+
function getActiveTab(slug) {
|
|
3536
|
+
const root = slug.split("/")[0];
|
|
3537
|
+
if (root === "orders") return "orders";
|
|
3538
|
+
if (root === "subscriptions") return "subscriptions";
|
|
3539
|
+
return "profile";
|
|
3540
|
+
}
|
|
3541
|
+
function AccountManageLayout({ children }) {
|
|
3542
|
+
const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
|
|
3543
|
+
const activeTab = getActiveTab(currentSlug);
|
|
3544
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3545
|
+
className: "flex flex-col md:flex-row",
|
|
3546
|
+
children: [
|
|
3547
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
3548
|
+
className: "flex gap-1 overflow-x-auto border-b px-4 py-2 md:hidden",
|
|
3549
|
+
children: NAV_ITEMS.map(({ key, slug, label, icon: Icon }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3550
|
+
type: "button",
|
|
3551
|
+
onClick: () => navigate(slug),
|
|
3552
|
+
className: `flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium whitespace-nowrap ${activeTab === key ? "bg-sidebar-primary text-sidebar-primary-foreground" : "hover:bg-sidebar-primary hover:text-sidebar-primary-foreground"}`,
|
|
3553
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "h-4 w-4" }), label]
|
|
3554
|
+
}, key))
|
|
3555
|
+
}),
|
|
3556
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
3557
|
+
className: "hidden w-48 shrink-0 flex-col gap-1 p-4 md:flex",
|
|
3558
|
+
children: NAV_ITEMS.map(({ key, slug, label, icon: Icon }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3559
|
+
type: "button",
|
|
3560
|
+
onClick: () => navigate(slug),
|
|
3561
|
+
className: `flex items-center gap-2 rounded-md px-3 py-2 text-left text-sm font-medium ${activeTab === key ? "bg-sidebar-primary text-sidebar-primary-foreground" : "hover:bg-sidebar-primary hover:text-sidebar-primary-foreground"}`,
|
|
3562
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "h-4 w-4" }), label]
|
|
3563
|
+
}, key))
|
|
3564
|
+
}),
|
|
3565
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3566
|
+
className: "min-w-0 flex-1",
|
|
3567
|
+
children
|
|
3568
|
+
})
|
|
3569
|
+
]
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3572
|
+
//#endregion
|
|
3504
3573
|
//#region src/shell/PageRouter.tsx
|
|
3505
3574
|
const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-CH3B-IQz.cjs")).then((m) => ({ default: m.ProfileScreen })));
|
|
3506
3575
|
const OrdersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./OrdersScreen-TSXDDHZe.cjs")).then((m) => ({ default: m.OrdersScreen })));
|
|
@@ -3527,6 +3596,11 @@ const SYSTEM_SLUG_SCREEN_MAP = {
|
|
|
3527
3596
|
"share/playlist": ShareablesScreen$1,
|
|
3528
3597
|
"share/files": ShareablesScreen$1
|
|
3529
3598
|
};
|
|
3599
|
+
const ACCOUNT_SLUGS = new Set([
|
|
3600
|
+
"profile",
|
|
3601
|
+
"orders",
|
|
3602
|
+
"subscriptions"
|
|
3603
|
+
]);
|
|
3530
3604
|
/** Pre-sorted keys for greedy prefix matching (longest first). */
|
|
3531
3605
|
const SORTED_SCREEN_KEYS = Object.keys(SYSTEM_SLUG_SCREEN_MAP).sort((a, b) => b.length - a.length);
|
|
3532
3606
|
/** Prefix-match a slug against screen map keys, longest match first. */
|
|
@@ -3568,13 +3642,17 @@ function PageRouter({ currentSlug, currentNavItem, customPages, screens, baseSlu
|
|
|
3568
3642
|
});
|
|
3569
3643
|
}
|
|
3570
3644
|
const SystemScreen = SYSTEM_SLUG_SCREEN_MAP[baseSlug] ?? findScreenByPrefix(currentSlug, SYSTEM_SLUG_SCREEN_MAP);
|
|
3571
|
-
if (SystemScreen)
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3645
|
+
if (SystemScreen) {
|
|
3646
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
3647
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3648
|
+
className: "flex h-full items-center justify-center",
|
|
3649
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-2 border-t-transparent" })
|
|
3650
|
+
}),
|
|
3651
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemScreen, {})
|
|
3652
|
+
});
|
|
3653
|
+
if (ACCOUNT_SLUGS.has(baseSlug)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountManageLayout, { children: content });
|
|
3654
|
+
return content;
|
|
3655
|
+
}
|
|
3578
3656
|
if (isSystemNavigationItem(baseSlug)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CoreScreenPlaceholder.CoreScreenPlaceholder, { name: currentNavItem?.label ?? baseSlug });
|
|
3579
3657
|
if (builderScreen) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuilderScreenView, { screen: builderScreen });
|
|
3580
3658
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CoreScreenPlaceholder.CoreScreenPlaceholder, { name: currentNavItem?.label ?? currentSlug });
|