@cosmicdrift/kumiko-renderer-web 0.149.1 → 0.149.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer-web",
|
|
3
|
-
"version": "0.149.
|
|
3
|
+
"version": "0.149.2",
|
|
4
4
|
"description": "Web-platform bindings for @cosmicdrift/kumiko-renderer. HTML default-primitives, browser history-based navigation, EventSource-backed live events, and a one-call createKumikoApp that mounts the whole stack via react-dom.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"./styles.css": "./src/styles.css"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.149.
|
|
20
|
-
"@cosmicdrift/kumiko-headless": "0.149.
|
|
21
|
-
"@cosmicdrift/kumiko-renderer": "0.149.
|
|
19
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.149.2",
|
|
20
|
+
"@cosmicdrift/kumiko-headless": "0.149.2",
|
|
21
|
+
"@cosmicdrift/kumiko-renderer": "0.149.2",
|
|
22
22
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
23
23
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
24
24
|
"@radix-ui/react-label": "^2.1.8",
|
|
@@ -834,4 +834,40 @@ describe("WorkspaceShell — EINE Nav", () => {
|
|
|
834
834
|
// Die screen-children sind ersetzt, nicht zusätzlich gerendert.
|
|
835
835
|
expect(screen.queryByText("content")).toBeNull();
|
|
836
836
|
});
|
|
837
|
+
|
|
838
|
+
test("navBadges pass through to NavTree leaf items", () => {
|
|
839
|
+
const schema = {
|
|
840
|
+
featureName: "bmc",
|
|
841
|
+
entities: {},
|
|
842
|
+
screens: [],
|
|
843
|
+
navs: [
|
|
844
|
+
{ id: "system", label: "System", screen: "bmc:screen:system" },
|
|
845
|
+
{ id: "orders", label: "Orders", screen: "bmc:screen:orders" },
|
|
846
|
+
],
|
|
847
|
+
workspaces: [
|
|
848
|
+
ws("admin", {
|
|
849
|
+
label: "Admin",
|
|
850
|
+
roles: ["admin"],
|
|
851
|
+
order: 1,
|
|
852
|
+
isDefault: true,
|
|
853
|
+
navMembers: ["bmc:nav:system", "bmc:nav:orders"],
|
|
854
|
+
}),
|
|
855
|
+
],
|
|
856
|
+
} as const;
|
|
857
|
+
|
|
858
|
+
renderShell(
|
|
859
|
+
<WorkspaceShell
|
|
860
|
+
brand={<div>Brand</div>}
|
|
861
|
+
schema={schema}
|
|
862
|
+
user={{ id: "u1", roles: ["admin"] }}
|
|
863
|
+
navBadges={new Map([["orders", <span>3</span>]])}
|
|
864
|
+
>
|
|
865
|
+
<div>content</div>
|
|
866
|
+
</WorkspaceShell>,
|
|
867
|
+
);
|
|
868
|
+
const ordersItems = screen.getAllByText("Orders");
|
|
869
|
+
const systemItems = screen.getAllByText("System");
|
|
870
|
+
expect(ordersItems.some((el) => el.closest("li")?.textContent?.includes("3"))).toBe(true);
|
|
871
|
+
expect(systemItems.every((el) => !el.closest("li")?.textContent?.includes("3"))).toBe(true);
|
|
872
|
+
});
|
|
837
873
|
});
|
|
@@ -75,6 +75,8 @@ export type WorkspaceShellProps = {
|
|
|
75
75
|
* Info. Klebt am unteren Rand via `mt-auto` (siehe Sidebar.footer).
|
|
76
76
|
* Symmetrisch zu DefaultAppShell.sidebarFooter. */
|
|
77
77
|
readonly sidebarFooter?: ReactNode;
|
|
78
|
+
/** Runtime badge slot per nav leaf (bare nav id), same as DefaultAppShell. */
|
|
79
|
+
readonly navBadges?: ReadonlyMap<string, ReactNode>;
|
|
78
80
|
/** Screen content. */
|
|
79
81
|
readonly children: ReactNode;
|
|
80
82
|
};
|
|
@@ -86,6 +88,7 @@ export function WorkspaceShell({
|
|
|
86
88
|
user,
|
|
87
89
|
initialWorkspaceId,
|
|
88
90
|
sidebarFooter,
|
|
91
|
+
navBadges,
|
|
89
92
|
children,
|
|
90
93
|
}: WorkspaceShellProps): ReactNode {
|
|
91
94
|
const app = useMemo(() => toAppSchema(schema), [schema]);
|
|
@@ -207,6 +210,7 @@ export function WorkspaceShell({
|
|
|
207
210
|
schema={app}
|
|
208
211
|
{...(user !== undefined && { user })}
|
|
209
212
|
{...(allowedNavQns !== undefined && { allowedNavQns })}
|
|
213
|
+
{...(navBadges !== undefined && { navBadges })}
|
|
210
214
|
/>
|
|
211
215
|
);
|
|
212
216
|
|