@polymorphism-tech/morph-spec 1.0.4 → 2.1.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.
Files changed (152) hide show
  1. package/CLAUDE.md +1381 -0
  2. package/LICENSE +72 -0
  3. package/README.md +89 -6
  4. package/bin/detect-agents.js +225 -0
  5. package/bin/morph-spec.js +120 -0
  6. package/bin/render-template.js +302 -0
  7. package/bin/semantic-detect-agents.js +246 -0
  8. package/bin/validate-agents-skills.js +239 -0
  9. package/bin/validate-agents.js +69 -0
  10. package/bin/validate-phase.js +263 -0
  11. package/content/.azure/README.md +293 -0
  12. package/content/.azure/docs/azure-devops-setup.md +454 -0
  13. package/content/.azure/docs/branch-strategy.md +398 -0
  14. package/content/.azure/docs/local-development.md +515 -0
  15. package/content/.azure/pipelines/pipeline-variables.yml +34 -0
  16. package/content/.azure/pipelines/prod-pipeline.yml +319 -0
  17. package/content/.azure/pipelines/staging-pipeline.yml +234 -0
  18. package/content/.azure/pipelines/templates/build-dotnet.yml +75 -0
  19. package/content/.azure/pipelines/templates/deploy-app-service.yml +94 -0
  20. package/content/.azure/pipelines/templates/deploy-container-app.yml +120 -0
  21. package/content/.azure/pipelines/templates/infra-deploy.yml +90 -0
  22. package/content/.claude/commands/morph-apply.md +118 -26
  23. package/content/.claude/commands/morph-archive.md +9 -9
  24. package/content/.claude/commands/morph-clarify.md +184 -0
  25. package/content/.claude/commands/morph-design.md +275 -0
  26. package/content/.claude/commands/morph-proposal.md +56 -15
  27. package/content/.claude/commands/morph-setup.md +100 -0
  28. package/content/.claude/commands/morph-status.md +47 -32
  29. package/content/.claude/commands/morph-tasks.md +319 -0
  30. package/content/.claude/commands/morph-uiux.md +211 -0
  31. package/content/.claude/skills/specialists/ai-system-architect.md +604 -0
  32. package/content/.claude/skills/specialists/ms-agent-expert.md +143 -89
  33. package/content/.claude/skills/specialists/ui-ux-designer.md +744 -9
  34. package/content/.claude/skills/stacks/dotnet-blazor.md +244 -8
  35. package/content/.claude/skills/stacks/dotnet-nextjs.md +2 -2
  36. package/content/.morph/.morphversion +5 -0
  37. package/content/.morph/config/agents.json +101 -8
  38. package/content/.morph/config/azure-pricing.json +70 -0
  39. package/content/.morph/config/azure-pricing.schema.json +50 -0
  40. package/content/.morph/config/config.template.json +15 -3
  41. package/content/.morph/docs/STORY-DRIVEN-DEVELOPMENT.md +392 -0
  42. package/content/.morph/hooks/README.md +239 -0
  43. package/content/.morph/hooks/pre-commit-agents.sh +24 -0
  44. package/content/.morph/hooks/pre-commit-all.sh +48 -0
  45. package/content/.morph/hooks/pre-commit-costs.sh +91 -0
  46. package/content/.morph/hooks/pre-commit-specs.sh +49 -0
  47. package/content/.morph/hooks/pre-commit-tests.sh +60 -0
  48. package/content/.morph/project.md +5 -4
  49. package/content/.morph/schemas/agent.schema.json +296 -0
  50. package/content/.morph/standards/agent-framework-setup.md +453 -0
  51. package/content/.morph/standards/architecture.md +142 -7
  52. package/content/.morph/standards/azure.md +218 -23
  53. package/content/.morph/standards/coding.md +47 -12
  54. package/content/.morph/standards/dotnet10-migration.md +494 -0
  55. package/content/.morph/standards/fluent-ui-setup.md +590 -0
  56. package/content/.morph/standards/migration-guide.md +514 -0
  57. package/content/.morph/standards/passkeys-auth.md +423 -0
  58. package/content/.morph/standards/vector-search-rag.md +536 -0
  59. package/content/.morph/state.json +18 -0
  60. package/content/.morph/templates/FluentDesignTheme.cs +149 -0
  61. package/content/.morph/templates/MudTheme.cs +281 -0
  62. package/content/.morph/templates/contracts.cs +55 -55
  63. package/content/.morph/templates/decisions.md +4 -4
  64. package/content/.morph/templates/design-system.css +226 -0
  65. package/content/.morph/templates/infra/.dockerignore.example +89 -0
  66. package/content/.morph/templates/infra/Dockerfile.example +82 -0
  67. package/content/.morph/templates/infra/README.md +286 -0
  68. package/content/.morph/templates/infra/app-service.bicep +164 -0
  69. package/content/.morph/templates/infra/deploy.ps1 +229 -0
  70. package/content/.morph/templates/infra/deploy.sh +208 -0
  71. package/content/.morph/templates/infra/main.bicep +41 -7
  72. package/content/.morph/templates/infra/parameters.dev.json +6 -0
  73. package/content/.morph/templates/infra/parameters.prod.json +6 -0
  74. package/content/.morph/templates/infra/parameters.staging.json +29 -0
  75. package/content/.morph/templates/proposal.md +3 -3
  76. package/content/.morph/templates/recap.md +3 -3
  77. package/content/.morph/templates/spec.md +9 -8
  78. package/content/.morph/templates/sprint-status.yaml +68 -0
  79. package/content/.morph/templates/state.template.json +222 -0
  80. package/content/.morph/templates/story.md +143 -0
  81. package/content/.morph/templates/tasks.md +1 -1
  82. package/content/.morph/templates/ui-components.md +276 -0
  83. package/content/.morph/templates/ui-design-system.md +286 -0
  84. package/content/.morph/templates/ui-flows.md +336 -0
  85. package/content/.morph/templates/ui-mockups.md +133 -0
  86. package/content/.morph/test-infra/example.bicep +59 -0
  87. package/content/CLAUDE.md +124 -0
  88. package/content/README.md +79 -0
  89. package/detectors/config-detector.js +223 -0
  90. package/detectors/conversation-analyzer.js +163 -0
  91. package/detectors/index.js +84 -0
  92. package/detectors/standards-generator.js +275 -0
  93. package/detectors/structure-detector.js +221 -0
  94. package/docs/README.md +149 -0
  95. package/docs/api/cost-calculator.js.html +513 -0
  96. package/docs/api/design-system-generator.js.html +382 -0
  97. package/docs/api/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  98. package/docs/api/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  99. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  100. package/docs/api/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  101. package/docs/api/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  102. package/docs/api/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  103. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  104. package/docs/api/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  105. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  106. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  107. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  108. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  109. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  110. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  111. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  112. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  113. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  114. package/docs/api/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  115. package/docs/api/global.html +5263 -0
  116. package/docs/api/index.html +96 -0
  117. package/docs/api/scripts/collapse.js +39 -0
  118. package/docs/api/scripts/commonNav.js +28 -0
  119. package/docs/api/scripts/linenumber.js +25 -0
  120. package/docs/api/scripts/nav.js +12 -0
  121. package/docs/api/scripts/polyfill.js +4 -0
  122. package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -0
  123. package/docs/api/scripts/prettify/lang-css.js +2 -0
  124. package/docs/api/scripts/prettify/prettify.js +28 -0
  125. package/docs/api/scripts/search.js +99 -0
  126. package/docs/api/state-manager.js.html +423 -0
  127. package/docs/api/styles/jsdoc.css +776 -0
  128. package/docs/api/styles/prettify.css +80 -0
  129. package/docs/examples.md +328 -0
  130. package/docs/getting-started.md +302 -0
  131. package/docs/installation.md +361 -0
  132. package/docs/templates.md +418 -0
  133. package/docs/validation-checklist.md +266 -0
  134. package/package.json +39 -12
  135. package/src/commands/cost.js +181 -0
  136. package/src/commands/create-story.js +283 -0
  137. package/src/commands/detect.js +104 -0
  138. package/src/commands/doctor.js +67 -0
  139. package/src/commands/generate.js +149 -0
  140. package/src/commands/init.js +69 -45
  141. package/src/commands/shard-spec.js +224 -0
  142. package/src/commands/sprint-status.js +250 -0
  143. package/src/commands/state.js +333 -0
  144. package/src/commands/sync.js +167 -0
  145. package/src/commands/update-pricing.js +206 -0
  146. package/src/commands/update.js +88 -13
  147. package/src/lib/complexity-analyzer.js +292 -0
  148. package/src/lib/cost-calculator.js +429 -0
  149. package/src/lib/design-system-generator.js +298 -0
  150. package/src/lib/state-manager.js +340 -0
  151. package/src/utils/file-copier.js +59 -0
  152. package/src/utils/version-checker.js +175 -0
@@ -0,0 +1,382 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>design-system-generator.js - MORPH-SPEC API Documentation</title>
7
+
8
+ <meta name="description" content="API documentation for MORPH-SPEC Framework libraries" />
9
+
10
+ <meta name="keywords" content="morph-spec, api, documentation, blazor, dotnet, framework" />
11
+ <meta name="keyword" content="morph-spec, api, documentation, blazor, dotnet, framework" />
12
+
13
+
14
+
15
+ <script src="scripts/prettify/prettify.js"></script>
16
+ <script src="scripts/prettify/lang-css.js"></script>
17
+ <!--[if lt IE 9]>
18
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
19
+ <![endif]-->
20
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
21
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
22
+ <script src="scripts/nav.js" defer></script>
23
+
24
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
25
+ </head>
26
+ <body>
27
+
28
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
29
+ <label for="nav-trigger" class="navicon-button x">
30
+ <div class="navicon"></div>
31
+ </label>
32
+
33
+ <label for="nav-trigger" class="overlay"></label>
34
+
35
+ <nav >
36
+
37
+ <input type="text" id="nav-search" placeholder="Search" />
38
+
39
+
40
+ <h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/lucasPolymorphism/morph-spec-framework" target="_blank" class="menu-item" id="repository" >GitHub</a></h2><h2><a href="https://www.npmjs.com/package/@polymorphism-tech/morph-spec" target="_blank" class="menu-item" id="npm" >npm</a></h2><h3>Global</h3><ul><li><a href="global.html#AZURE_PRICING">AZURE_PRICING</a></li><li><a href="global.html#addAgent">addAgent</a></li><li><a href="global.html#addCheckpoint">addCheckpoint</a></li><li><a href="global.html#calculateBicepCost">calculateBicepCost</a></li><li><a href="global.html#calculateResourceCost">calculateResourceCost</a></li><li><a href="global.html#calculateTotalCosts">calculateTotalCosts</a></li><li><a href="global.html#ensureFeature">ensureFeature</a></li><li><a href="global.html#generateCSS">generateCSS</a></li><li><a href="global.html#generateDesignSystem">generateDesignSystem</a></li><li><a href="global.html#generateFluentTheme">generateFluentTheme</a></li><li><a href="global.html#generateMudTheme">generateMudTheme</a></li><li><a href="global.html#getFeature">getFeature</a></li><li><a href="global.html#getStatePath">getStatePath</a></li><li><a href="global.html#getSummary">getSummary</a></li><li><a href="global.html#initState">initState</a></li><li><a href="global.html#listFeatures">listFeatures</a></li><li><a href="global.html#loadAzurePricing">loadAzurePricing</a></li><li><a href="global.html#loadCostConfig">loadCostConfig</a></li><li><a href="global.html#loadState">loadState</a></li><li><a href="global.html#markOutput">markOutput</a></li><li><a href="global.html#parseBicepFile">parseBicepFile</a></li><li><a href="global.html#parseBicepFiles">parseBicepFiles</a></li><li><a href="global.html#parseColors">parseColors</a></li><li><a href="global.html#parseDesignSystem">parseDesignSystem</a></li><li><a href="global.html#parseSpacing">parseSpacing</a></li><li><a href="global.html#parseTypography">parseTypography</a></li><li><a href="global.html#removeAgent">removeAgent</a></li><li><a href="global.html#saveState">saveState</a></li><li><a href="global.html#stateExists">stateExists</a></li><li><a href="global.html#updateFeature">updateFeature</a></li><li><a href="global.html#updateFeatureMultiple">updateFeatureMultiple</a></li></ul>
41
+
42
+ </nav>
43
+
44
+ <div id="main">
45
+
46
+ <h1 class="page-title">design-system-generator.js</h1>
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ <section>
55
+ <article>
56
+ <pre class="prettyprint source linenums"><code>/**
57
+ * MORPH-SPEC Design System Generator Library
58
+ *
59
+ * Reads ui-design-system.md and generates:
60
+ * - wwwroot/css/design-system.css (CSS variables)
61
+ * - Themes/FluentDesignTheme.cs (Fluent UI theme)
62
+ * - Themes/MudTheme.cs (MudBlazor theme)
63
+ *
64
+ * Used both by CLI commands and internal automation.
65
+ */
66
+
67
+ import { readFileSync, existsSync } from 'fs';
68
+
69
+ // ============================================================================
70
+ // Parsing Functions
71
+ // ============================================================================
72
+
73
+ /**
74
+ * Parse colors from markdown
75
+ * @param {string} markdown - Markdown content
76
+ * @returns {Object} Colors object with primary, secondary, neutral, semantic
77
+ */
78
+ export function parseColors(markdown) {
79
+ const colors = { primary: {}, secondary: {}, neutral: {}, semantic: {} };
80
+
81
+ // Match color definitions like: - **Primary 500** (`#...`) - ...
82
+ const colorRegex = /(?:^|\n)[-*]\s+\*\*([^*]+)\*\*[^\(]*\(`(#[0-9A-Fa-f]{6})`\)/gm;
83
+
84
+ let match;
85
+ while ((match = colorRegex.exec(markdown)) !== null) {
86
+ const [, name, hex] = match;
87
+ const cleanName = name.trim().toLowerCase().replace(/\s+/g, '-');
88
+
89
+ if (name.includes('Primary')) {
90
+ const variant = name.match(/\d+/)?.[0] || 'default';
91
+ colors.primary[variant] = hex;
92
+ } else if (name.includes('Secondary')) {
93
+ const variant = name.match(/\d+/)?.[0] || 'default';
94
+ colors.secondary[variant] = hex;
95
+ } else if (name.includes('Neutral') || name.includes('Gray')) {
96
+ const variant = name.match(/\d+/)?.[0] || 'default';
97
+ colors.neutral[variant] = hex;
98
+ } else if (name.includes('Success') || name.includes('Error') || name.includes('Warning') || name.includes('Info')) {
99
+ const type = name.toLowerCase().replace(/\s+/g, '-');
100
+ colors.semantic[type] = hex;
101
+ }
102
+ }
103
+
104
+ return colors;
105
+ }
106
+
107
+ /**
108
+ * Parse typography from markdown
109
+ * @param {string} markdown - Markdown content
110
+ * @returns {Object} Typography object with fontFamily, fontSize, fontWeight, lineHeight
111
+ */
112
+ export function parseTypography(markdown) {
113
+ const typography = { fontFamily: {}, fontSize: {}, fontWeight: {}, lineHeight: {} };
114
+
115
+ // Match font family
116
+ const fontFamilyRegex = /(?:font[- ]?family|typeface)[:\s]+([^\n]+)/gi;
117
+ const fontMatch = fontFamilyRegex.exec(markdown);
118
+ if (fontMatch) {
119
+ typography.fontFamily.primary = fontMatch[1].trim();
120
+ }
121
+
122
+ // Match font sizes (but exclude spacing-related)
123
+ const fontSizeRegex = /(?:^|\n)[-*]\s+\*\*([^*]+)\*\*[^:]*:\s*(\d+(?:\.\d+)?(?:rem|px|em))/gm;
124
+ let match;
125
+ while ((match = fontSizeRegex.exec(markdown)) !== null) {
126
+ const [, name, size] = match;
127
+ const lowerName = name.toLowerCase();
128
+ // Skip if it's spacing-related
129
+ if (lowerName.includes('spacing') || lowerName.includes('gap') || lowerName.includes('margin') || lowerName.includes('padding')) {
130
+ continue;
131
+ }
132
+ const cleanName = name.trim().toLowerCase().replace(/\s+/g, '-');
133
+ typography.fontSize[cleanName] = size;
134
+ }
135
+
136
+ return typography;
137
+ }
138
+
139
+ /**
140
+ * Parse spacing from markdown
141
+ * @param {string} markdown - Markdown content
142
+ * @returns {Object} Spacing object with spacing values
143
+ */
144
+ export function parseSpacing(markdown) {
145
+ const spacing = {};
146
+
147
+ // Match spacing definitions
148
+ const spacingRegex = /(?:^|\n)[-*]\s+\*\*([^*]+)\*\*[^:]*:\s*(\d+(?:\.\d+)?(?:rem|px|em))/gm;
149
+ let match;
150
+ while ((match = spacingRegex.exec(markdown)) !== null) {
151
+ const [, name, value] = match;
152
+ if (name.toLowerCase().includes('spacing') || name.toLowerCase().includes('gap') || name.toLowerCase().includes('margin') || name.toLowerCase().includes('padding')) {
153
+ const cleanName = name.trim().toLowerCase().replace(/\s+/g, '-');
154
+ spacing[cleanName] = value;
155
+ }
156
+ }
157
+
158
+ return spacing;
159
+ }
160
+
161
+ /**
162
+ * Parse all design system properties from markdown
163
+ * @param {string} markdownPath - Path to ui-design-system.md file
164
+ * @returns {Object} Parsed design system with colors, typography, spacing
165
+ */
166
+ export function parseDesignSystem(markdownPath) {
167
+ if (!existsSync(markdownPath)) {
168
+ throw new Error(`File not found: ${markdownPath}`);
169
+ }
170
+
171
+ const markdown = readFileSync(markdownPath, 'utf-8');
172
+
173
+ return {
174
+ colors: parseColors(markdown),
175
+ typography: parseTypography(markdown),
176
+ spacing: parseSpacing(markdown)
177
+ };
178
+ }
179
+
180
+ // ============================================================================
181
+ // Generation Functions
182
+ // ============================================================================
183
+
184
+ /**
185
+ * Generate CSS variables file
186
+ * @param {Object} colors - Colors object
187
+ * @param {Object} typography - Typography object
188
+ * @param {Object} spacing - Spacing object
189
+ * @returns {string} CSS content
190
+ */
191
+ export function generateCSS(colors, typography, spacing) {
192
+ let css = `/* Auto-generated by MORPH-SPEC Design System Generator */\n`;
193
+ css += `/* Do not edit manually - regenerate from ui-design-system.md */\n\n`;
194
+ css += `:root {\n`;
195
+
196
+ // Colors
197
+ if (Object.keys(colors.primary).length > 0) {
198
+ css += ` /* Primary Colors */\n`;
199
+ Object.entries(colors.primary).forEach(([variant, hex]) => {
200
+ css += ` --color-primary-${variant}: ${hex};\n`;
201
+ });
202
+ css += `\n`;
203
+ }
204
+
205
+ if (Object.keys(colors.secondary).length > 0) {
206
+ css += ` /* Secondary Colors */\n`;
207
+ Object.entries(colors.secondary).forEach(([variant, hex]) => {
208
+ css += ` --color-secondary-${variant}: ${hex};\n`;
209
+ });
210
+ css += `\n`;
211
+ }
212
+
213
+ if (Object.keys(colors.neutral).length > 0) {
214
+ css += ` /* Neutral Colors */\n`;
215
+ Object.entries(colors.neutral).forEach(([variant, hex]) => {
216
+ css += ` --color-neutral-${variant}: ${hex};\n`;
217
+ });
218
+ css += `\n`;
219
+ }
220
+
221
+ if (Object.keys(colors.semantic).length > 0) {
222
+ css += ` /* Semantic Colors */\n`;
223
+ Object.entries(colors.semantic).forEach(([type, hex]) => {
224
+ css += ` --color-${type}: ${hex};\n`;
225
+ });
226
+ css += `\n`;
227
+ }
228
+
229
+ // Typography
230
+ if (typography.fontFamily.primary) {
231
+ css += ` /* Typography */\n`;
232
+ css += ` --font-family-primary: ${typography.fontFamily.primary};\n`;
233
+ css += `\n`;
234
+ }
235
+
236
+ if (Object.keys(typography.fontSize).length > 0) {
237
+ css += ` /* Font Sizes */\n`;
238
+ Object.entries(typography.fontSize).forEach(([name, size]) => {
239
+ css += ` --font-size-${name}: ${size};\n`;
240
+ });
241
+ css += `\n`;
242
+ }
243
+
244
+ // Spacing
245
+ if (Object.keys(spacing).length > 0) {
246
+ css += ` /* Spacing */\n`;
247
+ Object.entries(spacing).forEach(([name, value]) => {
248
+ css += ` --${name}: ${value};\n`;
249
+ });
250
+ }
251
+
252
+ css += `}\n`;
253
+
254
+ return css;
255
+ }
256
+
257
+ /**
258
+ * Generate Fluent UI theme (C#)
259
+ * @param {Object} colors - Colors object
260
+ * @param {Object} typography - Typography object
261
+ * @param {string} namespace - C# namespace (default: YourProject.Themes)
262
+ * @returns {string} C# code
263
+ */
264
+ export function generateFluentTheme(colors, typography, namespace = 'YourProject.Themes') {
265
+ const primary500 = colors.primary['500'] || '#0078d4';
266
+
267
+ let csharp = `// Auto-generated by MORPH-SPEC Design System Generator\n`;
268
+ csharp += `// Do not edit manually - regenerate from ui-design-system.md\n\n`;
269
+ csharp += `using Microsoft.FluentUI.AspNetCore.Components;\n\n`;
270
+ csharp += `namespace ${namespace};\n\n`;
271
+ csharp += `public static class FluentDesignTheme\n{\n`;
272
+ csharp += ` public static DesignThemePalette GetPalette()\n`;
273
+ csharp += ` {\n`;
274
+ csharp += ` return new DesignThemePalette\n`;
275
+ csharp += ` {\n`;
276
+ csharp += ` Accent = "${primary500}",\n`;
277
+ csharp += ` // Add more theme properties as needed\n`;
278
+ csharp += ` };\n`;
279
+ csharp += ` }\n`;
280
+ csharp += `}\n`;
281
+
282
+ return csharp;
283
+ }
284
+
285
+ /**
286
+ * Generate MudBlazor theme (C#)
287
+ * @param {Object} colors - Colors object
288
+ * @param {Object} typography - Typography object
289
+ * @param {string} namespace - C# namespace (default: YourProject.Themes)
290
+ * @returns {string} C# code
291
+ */
292
+ export function generateMudTheme(colors, typography, namespace = 'YourProject.Themes') {
293
+ const primary500 = colors.primary['500'] || '#594ae2';
294
+ const secondary500 = colors.secondary['500'] || '#ff4081';
295
+
296
+ let csharp = `// Auto-generated by MORPH-SPEC Design System Generator\n`;
297
+ csharp += `// Do not edit manually - regenerate from ui-design-system.md\n\n`;
298
+ csharp += `using MudBlazor;\n\n`;
299
+ csharp += `namespace ${namespace};\n\n`;
300
+ csharp += `public static class MudDesignTheme\n{\n`;
301
+ csharp += ` public static MudTheme GetTheme()\n`;
302
+ csharp += ` {\n`;
303
+ csharp += ` return new MudTheme\n`;
304
+ csharp += ` {\n`;
305
+ csharp += ` Palette = new PaletteLight\n`;
306
+ csharp += ` {\n`;
307
+ csharp += ` Primary = "${primary500}",\n`;
308
+ csharp += ` Secondary = "${secondary500}",\n`;
309
+ csharp += ` // Add more palette colors as needed\n`;
310
+ csharp += ` }\n`;
311
+ csharp += ` };\n`;
312
+ csharp += ` }\n`;
313
+ csharp += `}\n`;
314
+
315
+ return csharp;
316
+ }
317
+
318
+ /**
319
+ * Generate all design system files
320
+ * @param {string} designSystemPath - Path to ui-design-system.md
321
+ * @param {Object} options - Generation options
322
+ * @param {string} options.mode - Generation mode: 'fluent', 'mud', or 'both'
323
+ * @param {string} options.namespace - C# namespace
324
+ * @returns {Object} Generated files content
325
+ */
326
+ export function generateDesignSystem(designSystemPath, options = {}) {
327
+ const { mode = 'both', namespace = 'YourProject.Themes' } = options;
328
+
329
+ // Parse design system
330
+ const { colors, typography, spacing } = parseDesignSystem(designSystemPath);
331
+
332
+ const generated = {
333
+ css: generateCSS(colors, typography, spacing),
334
+ stats: {
335
+ primaryColors: Object.keys(colors.primary).length,
336
+ neutralColors: Object.keys(colors.neutral).length,
337
+ semanticColors: Object.keys(colors.semantic).length,
338
+ fontSizes: Object.keys(typography.fontSize).length,
339
+ spacingValues: Object.keys(spacing).length
340
+ }
341
+ };
342
+
343
+ // Generate themes based on mode
344
+ if (mode === 'fluent' || mode === 'both') {
345
+ generated.fluentTheme = generateFluentTheme(colors, typography, namespace);
346
+ }
347
+
348
+ if (mode === 'mud' || mode === 'both') {
349
+ generated.mudTheme = generateMudTheme(colors, typography, namespace);
350
+ }
351
+
352
+ return generated;
353
+ }
354
+ </code></pre>
355
+ </article>
356
+ </section>
357
+
358
+
359
+
360
+
361
+
362
+
363
+ </div>
364
+
365
+ <br class="clear">
366
+
367
+ <footer>
368
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
369
+ </footer>
370
+
371
+ <script>prettyPrint();</script>
372
+ <script src="scripts/polyfill.js"></script>
373
+ <script src="scripts/linenumber.js"></script>
374
+
375
+ <script src="scripts/search.js" defer></script>
376
+
377
+
378
+ <script src="scripts/collapse.js" defer></script>
379
+
380
+
381
+ </body>
382
+ </html>