@mandujs/core 0.4.2 → 0.4.3

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": "@mandujs/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Mandu Framework Core - Spec, Generator, Guard, Runtime",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -122,7 +122,7 @@ function computeSlotImportPath(slotModule: string, fromDir: string): string {
122
122
  }
123
123
 
124
124
  export function generatePageComponent(route: RouteSpec): string {
125
- const pageName = capitalize(route.id);
125
+ const pageName = toPascalCase(route.id);
126
126
  return `// Generated by Mandu - DO NOT EDIT DIRECTLY
127
127
  // Route ID: ${route.id}
128
128
  // Pattern: ${route.pattern}
@@ -143,6 +143,14 @@ export default function ${pageName}Page({ params }: Props): React.ReactElement {
143
143
  `;
144
144
  }
145
145
 
146
- function capitalize(str: string): string {
147
- return str.charAt(0).toUpperCase() + str.slice(1);
146
+ /**
147
+ * Convert string to PascalCase (handles kebab-case, snake_case)
148
+ * "todo-page" → "TodoPage"
149
+ * "user_profile" → "UserProfile"
150
+ */
151
+ function toPascalCase(str: string): string {
152
+ return str
153
+ .split(/[-_]/)
154
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
155
+ .join("");
148
156
  }