@cosmicdrift/kumiko-renderer 0.412.0 → 0.413.0

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.
@@ -88,7 +88,7 @@ export function NavTree({ schema, user, testId, allowedNavQns, navBadges, }) {
88
88
  return label.toLowerCase().includes(q);
89
89
  }, [t, q]);
90
90
  const navFilter = useMemo(() => ({ q, matches }), [q, matches]);
91
- return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: "pl-8", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), tree.map((node) => isPureSection(node) ? (_jsx(NavSection, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName)) : (_jsx(SidebarMenu, { children: _jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }) }, node.qualifiedName)))] }) }) }) }));
91
+ return (_jsx(ActiveScreenMarkerContext.Provider, { value: activeMarker, children: _jsx(NavFilterContext.Provider, { value: navFilter, children: _jsx(NavBadgesContext.Provider, { value: navBadges ?? EMPTY_BADGES, children: _jsxs("div", { "data-testid": testId, "data-kumiko-layout": "nav-tree", className: "flex w-full flex-col gap-3", children: [_jsxs("div", { className: "relative mb-0 group-data-[collapsible=icon]:hidden", children: [_jsx(Search, { "aria-hidden": "true", className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), _jsx(SidebarInput, { className: "pl-8", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: t("kumiko.nav.search"), "aria-label": t("kumiko.nav.search") })] }), groupTopLevelRuns(tree).map((run) => run.kind === "section" ? (_jsx(NavSection, { node: run.node, collapsed: collapsed, onToggle: onToggle }, run.node.qualifiedName)) : (_jsx(SidebarMenu, { className: "empty:hidden", children: run.nodes.map((node) => (_jsx(NavMenuNode, { node: node, collapsed: collapsed, onToggle: onToggle }, node.qualifiedName))) }, run.nodes[0].qualifiedName)))] }) }) }) }));
92
92
  }
93
93
  // The runtime badge slot is keyed by the bare nav ID. With no entry it
94
94
  // renders nothing, avoiding layout shift. shrink-0 and ml-auto move it to the
@@ -120,6 +120,26 @@ function isPureSection(node) {
120
120
  node.createAction === undefined &&
121
121
  node.children.length > 0);
122
122
  }
123
+ // Consecutive non-section entries share one <ul>, so the root gap only
124
+ // separates blocks and not every pair of top-level leaves.
125
+ function groupTopLevelRuns(nodes) {
126
+ const runs = [];
127
+ let entries;
128
+ for (const node of nodes) {
129
+ if (isPureSection(node)) {
130
+ entries = undefined;
131
+ runs.push({ kind: "section", node });
132
+ }
133
+ else if (entries === undefined) {
134
+ entries = [node];
135
+ runs.push({ kind: "entries", nodes: entries });
136
+ }
137
+ else {
138
+ entries.push(node);
139
+ }
140
+ }
141
+ return runs;
142
+ }
123
143
  // If the label contains a dot, pass it through t(): the bundle translates
124
144
  // the key; otherwise the key remains visible as a reminder of a missing
125
145
  // translation. Literal string labels are left unchanged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer",
3
- "version": "0.412.0",
3
+ "version": "0.413.0",
4
4
  "description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@cosmicdrift/kumiko-framework": "0.412.0",
52
- "@cosmicdrift/kumiko-types": "0.412.0",
51
+ "@cosmicdrift/kumiko-framework": "0.413.0",
52
+ "@cosmicdrift/kumiko-types": "0.413.0",
53
53
  "@types/qrcode": "^1.5.6",
54
54
  "class-variance-authority": "^0.7.1",
55
55
  "clsx": "^2.1.1",
@@ -79,8 +79,8 @@
79
79
  }
80
80
  },
81
81
  "devDependencies": {
82
- "@cosmicdrift/kumiko-locale-de": "0.412.0",
83
- "@cosmicdrift/kumiko-testing": "0.412.0",
82
+ "@cosmicdrift/kumiko-locale-de": "0.413.0",
83
+ "@cosmicdrift/kumiko-testing": "0.413.0",
84
84
  "@tailwindcss/cli": "^4.3.3",
85
85
  "@testing-library/react": "^16.3.3",
86
86
  "@testing-library/user-event": "^14.6.8",
package/src/changes.json CHANGED
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.413.0",
4
+ "type": "fix",
5
+ "title": "Consecutive top-level nav entries without a section share one list",
6
+ "detail": "NavTree rendered every top-level entry that is not a section (screen leaves, provider nodes such as Content) in its own list, so the 12px gap between blocks also opened between two such entries. Consecutive entries now form one list with the 1px item gap; only sections and runs of entries are separated by the block gap. A run whose entries are all filtered out by the search is hidden."
7
+ },
2
8
  {
3
9
  "version": "0.411.0",
4
10
  "type": "improvement",