@plutocms/core 0.39.2 → 0.40.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## [0.40.0](https://github.com/plutocms/pluto/compare/v0.39.2...v0.40.0) (2026-10-31)
5
+
6
+
7
+ ### Features
8
+
9
+ * **admin:** navbar menus in the bar color, palette overlay class, nav children with enabled ([#310](https://github.com/plutocms/pluto/issues/310)) ([cec92ac](https://github.com/plutocms/pluto/commit/cec92ac7061fdb8a209d832344328fae8838f826))
10
+
4
11
  ## [0.39.2](https://github.com/plutocms/pluto/compare/v0.39.1...v0.39.2) (2026-10-31)
5
12
 
6
13
 
@@ -69,12 +69,15 @@
69
69
  }
70
70
 
71
71
  /*
72
- * The overlay of the admin search (Cmd/Ctrl+K) is darker than the Nuxt UI
73
- * default and blurs the page under it. The overlay is the sibling just before
74
- * the modal content, which carries `pluto-admin-search` (app/layouts/admin.vue).
75
- * Other modals keep the Nuxt UI overlay.
72
+ * The overlay of a palette (the admin search, Cmd/Ctrl+K, and the palettes of
73
+ * the layers, such as the block palette) is darker than the Nuxt UI default and
74
+ * blurs the page under it. The overlay is the sibling just before the modal
75
+ * content. The content carries `pluto-admin-search` (app/layouts/admin.vue) or
76
+ * `pluto-palette`: a layer sets `:ui="{ content: 'pluto-palette' }"` on the
77
+ * `UModal` of its palette. Other modals keep the Nuxt UI overlay.
76
78
  */
77
- :root[data-pluto-admin] [data-slot='overlay']:has(+ .pluto-admin-search) {
79
+ :root[data-pluto-admin]
80
+ [data-slot='overlay']:has(+ :is(.pluto-admin-search, .pluto-palette)) {
78
81
  background-color: oklch(13% 0.03 273 / 0.6);
79
82
  backdrop-filter: blur(6px);
80
83
  }
@@ -135,7 +135,11 @@ const portalTarget = usePlutoAdminPortal()
135
135
  <div class="h-full">
136
136
  <UDropdownMenu
137
137
  :items="items"
138
- :ui="{ content: 'w-64' }"
138
+ :content="{ sideOffset: 2 }"
139
+ :ui="{
140
+ content: 'w-64 bg-(--pluto-admin-navbar)',
141
+ arrow: 'fill-(--pluto-admin-navbar)',
142
+ }"
139
143
  :modal="false"
140
144
  :portal="portalTarget ?? true"
141
145
  :arrow="{ width: 14, height: 7 }"
@@ -214,10 +214,13 @@ const editButton = computed(() => {
214
214
  <UDropdownMenu
215
215
  :open="menuOpen"
216
216
  :items="newMenuItems"
217
- :content="{ align: 'start', onCloseAutoFocus }"
217
+ :content="{ align: 'start', sideOffset: 2, onCloseAutoFocus }"
218
218
  :modal="false"
219
219
  :portal="portalTarget ?? true"
220
- :ui="{ content: 'min-w-48' }"
220
+ :ui="{
221
+ content: 'min-w-48 bg-(--pluto-admin-navbar)',
222
+ arrow: 'fill-(--pluto-admin-navbar)',
223
+ }"
221
224
  :arrow="{ width: 14, height: 7 }"
222
225
  @update:open="onUpdateOpen"
223
226
  >
@@ -57,14 +57,23 @@ export function usePlutoAdminNav() {
57
57
 
58
58
  const items = computed<PlutoNavItem[]>(() => {
59
59
  const registered = registry.nav.list.value
60
- const resolveLabels = (item: PlutoNavItem): PlutoNavItem => ({
61
- ...item,
62
- label: tx(item.label),
63
- children: item.children?.map((child) => ({
64
- ...child,
65
- label: tx(child.label),
66
- })),
67
- })
60
+ // A child with `enabled` shows only when the test passes (for example a
61
+ // child for admins only). An item with its own `to` and one visible child
62
+ // stays a plain link, like Settings with one page.
63
+ const resolveLabels = (item: PlutoNavItem): PlutoNavItem => {
64
+ const children = item.children
65
+ ?.filter((child) => child.enabled?.() ?? true)
66
+ .map((child) => ({
67
+ ...child,
68
+ label: tx(child.label),
69
+ }))
70
+ return {
71
+ ...item,
72
+ label: tx(item.label),
73
+ children:
74
+ item.to && children && children.length < 2 ? undefined : children,
75
+ }
76
+ }
68
77
 
69
78
  const isVisible = (type: PlutoContentType): boolean =>
70
79
  !type.capabilities?.read || can(type.capabilities.read)
@@ -8,12 +8,17 @@
8
8
  * The composable makes the element itself. A target that Vue renders can
9
9
  * appear after the portal looks for it. Pass `portalTarget ?? true` to the
10
10
  * `portal` prop of `UDropdownMenu`.
11
+ *
12
+ * The menus look like the bar: the target also carries `data-pluto-admin-dark`
13
+ * (the dark tokens in both color modes), and a menu sets the bar color
14
+ * (`bg-(--pluto-admin-navbar)`, also on its arrow) and `sideOffset: 2`.
11
15
  */
12
16
  export function usePlutoAdminPortal() {
13
17
  const portalTarget = shallowRef<HTMLElement>()
14
18
  onMounted(() => {
15
19
  const el = document.createElement('div')
16
20
  el.setAttribute('data-pluto-admin-scope', '')
21
+ el.setAttribute('data-pluto-admin-dark', '')
17
22
  document.body.append(el)
18
23
  portalTarget.value = el
19
24
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plutocms/core",
3
3
  "type": "module",
4
- "version": "0.39.2",
4
+ "version": "0.40.0",
5
5
  "description": "The base layer every Pluto app extends: the admin, the content model, and the GitHub CMS",
6
6
  "author": "Victor Ribeiro",
7
7
  "license": "MIT",
@@ -59,6 +59,8 @@ export interface PlutoNavChild {
59
59
  newTo?: string
60
60
  /** The text of that "+" (`New <type>`). */
61
61
  newLabel?: string
62
+ /** Reactive visibility test, like `PlutoEntry.enabled`. A child without it shows. */
63
+ enabled?: () => boolean
62
64
  }
63
65
 
64
66
  export interface PlutoNavItem extends PlutoEntry {