camelmind 0.2.5 → 0.2.6
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
|
@@ -164,15 +164,25 @@ function GroupSidebar({
|
|
|
164
164
|
return (
|
|
165
165
|
<aside className="hidden md:block w-72 shrink-0 border-r border-gray-200 dark:border-gray-800 overflow-y-auto bg-white dark:bg-gray-950">
|
|
166
166
|
<div className="px-4 py-4">
|
|
167
|
-
{visibleItems.map((entry) =>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
{visibleItems.map((entry) =>
|
|
168
|
+
entry.section ? (
|
|
169
|
+
<CategoryBlock
|
|
170
|
+
key={entry.slug}
|
|
171
|
+
entry={entry}
|
|
172
|
+
currentSlug={currentSlug}
|
|
173
|
+
userRoles={userRoles}
|
|
174
|
+
authEnabled={authEnabled}
|
|
175
|
+
/>
|
|
176
|
+
) : (
|
|
177
|
+
<SectionRow
|
|
178
|
+
key={entry.slug}
|
|
179
|
+
section={entry as NavChild}
|
|
180
|
+
currentSlug={currentSlug}
|
|
181
|
+
userRoles={userRoles}
|
|
182
|
+
authEnabled={authEnabled}
|
|
183
|
+
/>
|
|
184
|
+
)
|
|
185
|
+
)}
|
|
176
186
|
</div>
|
|
177
187
|
</aside>
|
|
178
188
|
)
|
|
@@ -11,7 +11,8 @@ export type NavEntry = {
|
|
|
11
11
|
slug: string
|
|
12
12
|
file: string
|
|
13
13
|
roles: string[]
|
|
14
|
-
section?: NavChild[]
|
|
14
|
+
section?: NavChild[] // renders as ALL CAPS category block with children below
|
|
15
|
+
children?: NavChild[] // renders as a plain collapsible row (no category label)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export type NavGroup = {
|
package/template/lib/nav.ts
CHANGED
|
@@ -29,6 +29,7 @@ function stripNavPrefix(nav: NavConfig, prefix: string): NavConfig {
|
|
|
29
29
|
...e,
|
|
30
30
|
slug: s(e.slug),
|
|
31
31
|
section: e.section ? walkChildren(e.section) : undefined,
|
|
32
|
+
children: e.children ? walkChildren(e.children) : undefined,
|
|
32
33
|
}))
|
|
33
34
|
|
|
34
35
|
return {
|
|
@@ -83,6 +84,11 @@ export function getSlugsFromConfig(nav: NavConfig): string[] {
|
|
|
83
84
|
slugs.push(child.slug)
|
|
84
85
|
}
|
|
85
86
|
}
|
|
87
|
+
if (entry.children) {
|
|
88
|
+
for (const child of flattenChildren(entry.children)) {
|
|
89
|
+
slugs.push(child.slug)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
} else if ("slug" in item) {
|
|
88
94
|
slugs.push((item as NavEntry).slug)
|
|
@@ -112,6 +118,10 @@ export function getEntryBySlugFromConfig(nav: NavConfig, slug: string): (NavEntr
|
|
|
112
118
|
const match = flattenChildren(entry.section).find((c) => c.slug === normalized)
|
|
113
119
|
if (match) return match
|
|
114
120
|
}
|
|
121
|
+
if (entry.children) {
|
|
122
|
+
const match = flattenChildren(entry.children).find((c) => c.slug === normalized)
|
|
123
|
+
if (match) return match
|
|
124
|
+
}
|
|
115
125
|
}
|
|
116
126
|
} else if ("slug" in item) {
|
|
117
127
|
const entry = item as NavEntry
|
|
@@ -140,6 +150,10 @@ export function getGroupForSlugFromConfig(nav: NavConfig, slug: string): NavGrou
|
|
|
140
150
|
const match = flattenChildren(entry.section).find((c) => c.slug === normalized)
|
|
141
151
|
if (match) return group
|
|
142
152
|
}
|
|
153
|
+
if (entry.children) {
|
|
154
|
+
const match = flattenChildren(entry.children).find((c) => c.slug === normalized)
|
|
155
|
+
if (match) return group
|
|
156
|
+
}
|
|
143
157
|
}
|
|
144
158
|
}
|
|
145
159
|
|
|
@@ -162,6 +176,10 @@ export function getSectionForSlugFromConfig(nav: NavConfig, slug: string): NavEn
|
|
|
162
176
|
const match = flattenChildren(entry.section).find((c) => c.slug === normalized)
|
|
163
177
|
if (match) return entry
|
|
164
178
|
}
|
|
179
|
+
if (entry.children) {
|
|
180
|
+
const match = flattenChildren(entry.children).find((c) => c.slug === normalized)
|
|
181
|
+
if (match) return entry
|
|
182
|
+
}
|
|
165
183
|
}
|
|
166
184
|
}
|
|
167
185
|
|
|
@@ -184,6 +202,11 @@ export function getAllPublicEntries(nav: NavConfig): (NavEntry | NavChild)[] {
|
|
|
184
202
|
if (child.roles.length === 0) entries.push(child)
|
|
185
203
|
}
|
|
186
204
|
}
|
|
205
|
+
if (entry.children) {
|
|
206
|
+
for (const child of flattenChildren(entry.children)) {
|
|
207
|
+
if (child.roles.length === 0) entries.push(child)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
187
210
|
}
|
|
188
211
|
} else if ("slug" in item) {
|
|
189
212
|
const entry = item as NavEntry
|