@brightsideoy/kama 1.0.0-alpha.24 → 1.0.0-alpha.25

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.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>KAMA</title>
7
7
  <link rel="icon" href="/favicon.png">
8
8
  <link rel="apple-touch-icon" sizes="180x180" href="/favicon.png">
9
- <script type="module" crossorigin src="/assets/index-B962oXcV.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-N7ViZ7U5.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-BdT0OEbg.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useCmsState-BblziYb-.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/schema-helpers-uuDCw8Rb.js">
@@ -37,7 +37,7 @@
37
37
  <link rel="stylesheet" crossorigin href="/assets/CmsImagePreview-CujwG8r_.css">
38
38
  <link rel="stylesheet" crossorigin href="/assets/CmsButton-DATGQeoC.css">
39
39
  <link rel="stylesheet" crossorigin href="/assets/CmsBadge-Ip5hXw8G.css">
40
- <link rel="stylesheet" crossorigin href="/assets/index-pbsspAqA.css">
40
+ <link rel="stylesheet" crossorigin href="/assets/index-DaXMl545.css">
41
41
  </head>
42
42
  <body>
43
43
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightsideoy/kama",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.25",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  // src/components/global/NavigationMenu.astro
3
- import type { TreeNode } from "@/lib/cms";
3
+ import { getTreeNodeMenuTitle, type TreeNode } from "@/lib/cms";
4
4
 
5
5
  export interface Props {
6
6
  tree?: TreeNode[];
@@ -67,6 +67,7 @@ const isExactActive = (itemPath?: string) => {
67
67
  <ul class="nav-list">
68
68
  {
69
69
  topLevelNavItems.map(item => {
70
+ const menuTitle = getTreeNodeMenuTitle(item);
70
71
  // ✨ NEW: Also filter children for notInMenu
71
72
  const visibleChildren =
72
73
  item.children?.filter(child => !(child as any).notInMenu) || [];
@@ -84,7 +85,7 @@ const isExactActive = (itemPath?: string) => {
84
85
  { active: isParentActive },
85
86
  ]}
86
87
  >
87
- <span>{item.title}</span>
88
+ <span>{menuTitle}</span>
88
89
  <span class="indicator">▼</span>
89
90
  </summary>
90
91
  <div class="submenu-container">
@@ -98,7 +99,7 @@ const isExactActive = (itemPath?: string) => {
98
99
  { active: isExactActive(item.path) },
99
100
  ]}
100
101
  >
101
- {item.title} Overview
102
+ {menuTitle} Overview
102
103
  </a>
103
104
  </li>
104
105
  {visibleChildren.map(child => (
@@ -110,7 +111,7 @@ const isExactActive = (itemPath?: string) => {
110
111
  { active: isExactActive(child.path) },
111
112
  ]}
112
113
  >
113
- {child.title}
114
+ {getTreeNodeMenuTitle(child)}
114
115
  </a>
115
116
  </li>
116
117
  ))}
@@ -127,7 +128,7 @@ const isExactActive = (itemPath?: string) => {
127
128
  href={item.path}
128
129
  class:list={["nav-button", { active: isExactActive(item.path) }]}
129
130
  >
130
- {item.title}
131
+ {menuTitle}
131
132
  </a>
132
133
  </li>
133
134
  );
@@ -5,6 +5,7 @@ export interface TreeNode {
5
5
  treeNodeId: number;
6
6
  parentId: number | null;
7
7
  title: string;
8
+ menuTitle?: string;
8
9
  slug: string;
9
10
  path: string;
10
11
  nodeType: string;
@@ -16,6 +17,12 @@ export interface TreeNode {
16
17
  [key: string]: any;
17
18
  }
18
19
 
20
+ export function getTreeNodeMenuTitle(node: Pick<TreeNode, 'title' | 'menuTitle'>): string {
21
+ return typeof node.menuTitle === 'string' && node.menuTitle.trim()
22
+ ? node.menuTitle.trim()
23
+ : node.title;
24
+ }
25
+
19
26
  export interface ContentBlock {
20
27
  instanceId: number;
21
28
  componentId: string;
@@ -3,7 +3,7 @@
3
3
  export const partial = true; // 🎯 Tells Astro not to wrap this in <html><body>
4
4
 
5
5
  import { getTree, getTreeId, getChannelId } from "@/lib/cms";
6
- import type { TreeNode } from "@/lib/cms";
6
+ import { getTreeNodeMenuTitle, type TreeNode } from "@/lib/cms";
7
7
 
8
8
  const safeEnv = (Astro.locals as any).safeEnv || {};
9
9
  const cmsWorker = safeEnv.CMS_WORKER;
@@ -75,6 +75,7 @@ const isExactActive = (itemPath?: string) => {
75
75
  <ul class="nav-list">
76
76
  {
77
77
  topLevelNavItems.map(item => {
78
+ const menuTitle = getTreeNodeMenuTitle(item);
78
79
  const hasChildren = item.children && item.children.length > 0;
79
80
  const isParentActive = isPathActive(item.path);
80
81
 
@@ -89,7 +90,7 @@ const isExactActive = (itemPath?: string) => {
89
90
  { active: isParentActive },
90
91
  ]}
91
92
  >
92
- <span>{item.title}</span>
93
+ <span>{menuTitle}</span>
93
94
  <span class="indicator">▼</span>
94
95
  </summary>
95
96
  <div class="submenu-container">
@@ -103,7 +104,7 @@ const isExactActive = (itemPath?: string) => {
103
104
  { active: isExactActive(item.path) },
104
105
  ]}
105
106
  >
106
- {item.title} Overview
107
+ {menuTitle} Overview
107
108
  </a>
108
109
  </li>
109
110
  {item.children?.map(child => (
@@ -115,7 +116,7 @@ const isExactActive = (itemPath?: string) => {
115
116
  { active: isExactActive(child.path) },
116
117
  ]}
117
118
  >
118
- {child.title}
119
+ {getTreeNodeMenuTitle(child)}
119
120
  </a>
120
121
  </li>
121
122
  ))}
@@ -132,7 +133,7 @@ const isExactActive = (itemPath?: string) => {
132
133
  href={item.path}
133
134
  class:list={["nav-button", { active: isExactActive(item.path) }]}
134
135
  >
135
- {item.title}
136
+ {menuTitle}
136
137
  </a>
137
138
  </li>
138
139
  );