igniteui-theming 25.1.0 → 25.2.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 (128) hide show
  1. package/dist/index.d.ts +75 -0
  2. package/dist/index.js +12 -0
  3. package/dist/json/components/bootstrap.json +1 -0
  4. package/dist/json/components/fluent.json +1 -0
  5. package/dist/json/components/indigo.json +1 -0
  6. package/dist/json/components/material.json +1 -0
  7. package/{json → dist/json}/components/themes.json +31 -1
  8. package/dist/mcp/generators/css.d.ts +7 -4
  9. package/dist/mcp/generators/css.js +129 -104
  10. package/dist/mcp/generators/sass.js +227 -254
  11. package/dist/mcp/index.js +259 -323
  12. package/dist/mcp/knowledge/color-usage.js +524 -502
  13. package/dist/mcp/knowledge/colors.js +61 -50
  14. package/dist/mcp/knowledge/component-metadata.js +697 -598
  15. package/dist/mcp/knowledge/component-themes.js +70 -57
  16. package/dist/mcp/knowledge/custom-palettes.js +4 -9
  17. package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
  18. package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
  19. package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
  20. package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
  21. package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
  22. package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
  23. package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
  24. package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
  25. package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
  26. package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
  27. package/dist/mcp/knowledge/elevations.d.ts +1 -1
  28. package/dist/mcp/knowledge/elevations.js +26 -12
  29. package/dist/mcp/knowledge/index.js +23 -87
  30. package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
  31. package/dist/mcp/knowledge/multipliers.js +5 -0
  32. package/dist/mcp/knowledge/palettes.js +29 -17
  33. package/dist/mcp/knowledge/platforms/angular.js +98 -120
  34. package/dist/mcp/knowledge/platforms/blazor.js +39 -34
  35. package/dist/mcp/knowledge/platforms/common.js +83 -68
  36. package/dist/mcp/knowledge/platforms/index.js +265 -242
  37. package/dist/mcp/knowledge/platforms/react.js +43 -35
  38. package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
  39. package/dist/mcp/knowledge/sass-api.js +1 -0
  40. package/dist/mcp/knowledge/typography.js +13 -5
  41. package/dist/mcp/resources/index.js +1 -0
  42. package/dist/mcp/resources/presets.js +409 -508
  43. package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
  44. package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
  45. package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
  46. package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
  47. package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
  48. package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
  49. package/dist/mcp/tools/descriptions.js +98 -154
  50. package/dist/mcp/tools/handlers/color.js +58 -56
  51. package/dist/mcp/tools/handlers/component-theme.js +163 -225
  52. package/dist/mcp/tools/handlers/component-tokens.js +159 -219
  53. package/dist/mcp/tools/handlers/custom-palette.js +138 -179
  54. package/dist/mcp/tools/handlers/elevations.js +27 -28
  55. package/dist/mcp/tools/handlers/index.js +11 -0
  56. package/dist/mcp/tools/handlers/layout.js +125 -176
  57. package/dist/mcp/tools/handlers/palette.js +105 -120
  58. package/dist/mcp/tools/handlers/platform.js +289 -311
  59. package/dist/mcp/tools/handlers/resource.js +22 -31
  60. package/dist/mcp/tools/handlers/theme.js +86 -103
  61. package/dist/mcp/tools/handlers/typography.js +29 -30
  62. package/dist/mcp/tools/index.js +13 -0
  63. package/dist/mcp/tools/schemas.js +239 -218
  64. package/dist/mcp/utils/color.js +277 -239
  65. package/dist/mcp/utils/preprocessing.js +57 -30
  66. package/dist/mcp/utils/result.js +43 -45
  67. package/dist/mcp/utils/sass.js +271 -191
  68. package/dist/mcp/utils/theming-resolve.d.ts +19 -0
  69. package/dist/mcp/utils/theming-resolve.js +57 -0
  70. package/dist/mcp/utils/types.js +96 -53
  71. package/dist/mcp/validators/custom-palette.js +218 -243
  72. package/dist/mcp/validators/index.js +3 -0
  73. package/dist/mcp/validators/palette.js +231 -229
  74. package/dist/tailwind/utilities/bootstrap.css +1 -0
  75. package/dist/tailwind/utilities/fluent.css +1 -0
  76. package/dist/tailwind/utilities/indigo.css +1 -0
  77. package/dist/tailwind/utilities/material.css +1 -0
  78. package/package.json +45 -64
  79. package/sass/json/README.md +12 -7
  80. package/sass/themes/_mixins.scss +1 -0
  81. package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
  82. package/sass/themes/components/grid/_grid-theme.scss +1 -1
  83. package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
  84. package/sass/themes/schemas/components/dark/_grid.scss +0 -16
  85. package/sass/themes/schemas/components/light/_button-group.scss +221 -99
  86. package/sass/themes/schemas/components/light/_grid.scss +14 -20
  87. package/LICENSE +0 -21
  88. package/README.md +0 -391
  89. package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
  90. package/dist/mcp/json/components/themes.json.js +0 -143
  91. package/dist/mcp/json/elevations/indigo.json.js +0 -8
  92. package/dist/mcp/json/elevations/material.json.js +0 -8
  93. package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
  94. package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
  95. package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
  96. package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
  97. package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
  98. package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
  99. package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
  100. package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
  101. package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
  102. package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
  103. package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
  104. package/dist/mcp/vite-env.d.ts +0 -18
  105. package/index.js +0 -5
  106. package/json/components/bootstrap.json +0 -1
  107. package/json/components/fluent.json +0 -1
  108. package/json/components/indigo.json +0 -1
  109. package/json/components/material.json +0 -1
  110. package/tailwind/utilities/bootstrap.css +0 -1
  111. package/tailwind/utilities/fluent.css +0 -1
  112. package/tailwind/utilities/indigo.css +0 -1
  113. package/tailwind/utilities/material.css +0 -1
  114. /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
  115. /package/{json → dist/json}/colors/meta/palette.json +0 -0
  116. /package/{json → dist/json}/colors/presets/palettes.json +0 -0
  117. /package/{json → dist/json}/elevations/indigo.json +0 -0
  118. /package/{json → dist/json}/elevations/material.json +0 -0
  119. /package/{json → dist/json}/typography/presets/typescales.json +0 -0
  120. /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
  121. /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
  122. /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
  123. /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
  124. /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
  125. /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
  126. /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
  127. /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
  128. /package/{tailwind → dist/tailwind}/themes/light/material.css +0 -0
@@ -1,289 +1,278 @@
1
- import { quoteFontFamily, generatePaletteCode, generateTypographyCode, generateUseStatement, generateElevationsCode } from "../../utils/sass.js";
2
1
  import { PALETTE_PRESETS } from "../palettes.js";
3
- import { PALETTE_PRESETS_PATHS, ELEVATIONS, TYPOGRAPHY_PRESETS_PATHS } from "./common.js";
4
- const WEBCOMPONENTS_PLATFORM = {
5
- id: "webcomponents",
6
- name: "Ignite UI for Web Components",
7
- packageName: "igniteui-webcomponents",
8
- /**
9
- * The Sass module to import for theming
10
- */
11
- themingModule: "igniteui-theming",
12
- /**
13
- * Detection patterns in package.json dependencies
14
- */
15
- detectionPatterns: [
16
- "igniteui-webcomponents",
17
- "@infragistics/igniteui-webcomponents"
18
- ],
19
- /**
20
- * No required root class (themes apply via CSS variables on :root)
21
- */
22
- rootClass: null
2
+ import { ELEVATIONS, PALETTE_PRESETS_PATHS, TYPOGRAPHY_PRESETS_PATHS } from "./common.js";
3
+ import { generateElevationsCode, generatePaletteCode, generateTypographyCode, generateUseStatement, quoteFontFamily } from "../../utils/sass.js";
4
+ //#region src/knowledge/platforms/webcomponents.ts
5
+ /**
6
+ * Ignite UI for Web Components Platform Knowledge
7
+ *
8
+ * This module contains platform-specific information for generating
9
+ * valid Sass theme code for Ignite UI for Web Components applications.
10
+ *
11
+ * Key differences from Angular:
12
+ * - Uses `igniteui-theming` directly (not forwarded through another module)
13
+ * - No `core()` or `theme()` mixins - uses individual mixins: `palette()`, `typography()`, `elevations()`
14
+ * - Ships precompiled CSS themes, but users can install igniteui-theming for custom Sass themes
15
+ * - Components use ThemingController for runtime theme switching via CSS variables
16
+ * - Generated CSS variables follow --ig-* naming convention
17
+ */
18
+ var WEBCOMPONENTS_PLATFORM = {
19
+ id: "webcomponents",
20
+ name: "Ignite UI for Web Components",
21
+ packageName: "igniteui-webcomponents",
22
+ themingModule: "igniteui-theming",
23
+ detectionPatterns: ["igniteui-webcomponents", "@infragistics/igniteui-webcomponents"],
24
+ rootClass: null
23
25
  };
26
+ /**
27
+ * Generate the file header comment for Web Components themes.
28
+ */
24
29
  function generateWCHeader() {
25
- return [
26
- "// Generated by Ignite UI Theming MCP Server",
27
- "// Platform: Ignite UI for Web Components",
28
- ""
29
- ];
30
+ return [
31
+ "// Generated by Ignite UI Theming MCP Server",
32
+ "// Platform: Ignite UI for Web Components",
33
+ ""
34
+ ];
30
35
  }
36
+ /**
37
+ * Get the elevation preset variable for a design system.
38
+ */
31
39
  function getWCElevationPreset(designSystem) {
32
- return ELEVATIONS[designSystem];
40
+ return ELEVATIONS[designSystem];
33
41
  }
42
+ /**
43
+ * Generate import statements for a Web Components theme.
44
+ */
34
45
  function generateWCImports(options) {
35
- const {
36
- designSystem,
37
- variant,
38
- hasCustomColors,
39
- includeTypography,
40
- includeElevations
41
- } = options;
42
- const lines = [];
43
- if (hasCustomColors) {
44
- lines.push("// Import the theming module");
45
- lines.push(generateUseStatement("webcomponents"));
46
- if (includeTypography) {
47
- const typographyModule = TYPOGRAPHY_PRESETS_PATHS[designSystem];
48
- lines.push(`@use '${typographyModule}' as *;`);
49
- }
50
- if (includeElevations) {
51
- lines.push("@use 'igniteui-theming/sass/elevations/presets' as *;");
52
- }
53
- } else {
54
- const paletteModule = PALETTE_PRESETS_PATHS[variant][designSystem];
55
- lines.push("// Import palette preset");
56
- lines.push(`@use '${paletteModule}' as *;`);
57
- lines.push("");
58
- lines.push("// Import base theme configuration");
59
- lines.push(generateUseStatement("webcomponents"));
60
- if (includeTypography) {
61
- const typographyModule = TYPOGRAPHY_PRESETS_PATHS[designSystem];
62
- lines.push(`@use '${typographyModule}' as *;`);
63
- }
64
- if (includeElevations) {
65
- lines.push("@use 'igniteui-theming/sass/elevations/presets' as *;");
66
- }
67
- }
68
- return lines;
46
+ const { designSystem, variant, hasCustomColors, includeTypography, includeElevations } = options;
47
+ const lines = [];
48
+ if (hasCustomColors) {
49
+ lines.push("// Import the theming module");
50
+ lines.push(generateUseStatement("webcomponents"));
51
+ if (includeTypography) {
52
+ const typographyModule = TYPOGRAPHY_PRESETS_PATHS[designSystem];
53
+ lines.push(`@use '${typographyModule}' as *;`);
54
+ }
55
+ if (includeElevations) lines.push("@use 'igniteui-theming/sass/elevations/presets' as *;");
56
+ } else {
57
+ const paletteModule = PALETTE_PRESETS_PATHS[variant][designSystem];
58
+ lines.push("// Import palette preset");
59
+ lines.push(`@use '${paletteModule}' as *;`);
60
+ lines.push("");
61
+ lines.push("// Import base theme configuration");
62
+ lines.push(generateUseStatement("webcomponents"));
63
+ if (includeTypography) {
64
+ const typographyModule = TYPOGRAPHY_PRESETS_PATHS[designSystem];
65
+ lines.push(`@use '${typographyModule}' as *;`);
66
+ }
67
+ if (includeElevations) lines.push("@use 'igniteui-theming/sass/elevations/presets' as *;");
68
+ }
69
+ return lines;
69
70
  }
71
+ /**
72
+ * Generate CSS @property declarations for progress tracking.
73
+ * These are required by some components.
74
+ */
70
75
  function generateWCProgressProperties(indent = "") {
71
- return [
72
- `${indent}@property --_progress-integer {`,
73
- `${indent} syntax: '<integer>';`,
74
- `${indent} initial-value: 0;`,
75
- `${indent} inherits: true;`,
76
- `${indent}}`,
77
- "",
78
- `${indent}@property --_progress-fraction {`,
79
- `${indent} syntax: '<integer>';`,
80
- `${indent} initial-value: 0;`,
81
- `${indent} inherits: true;`,
82
- `${indent}}`
83
- ];
76
+ return [
77
+ `${indent}@property --_progress-integer {`,
78
+ `${indent} syntax: '<integer>';`,
79
+ `${indent} initial-value: 0;`,
80
+ `${indent} inherits: true;`,
81
+ `${indent}}`,
82
+ "",
83
+ `${indent}@property --_progress-fraction {`,
84
+ `${indent} syntax: '<integer>';`,
85
+ `${indent} initial-value: 0;`,
86
+ `${indent} inherits: true;`,
87
+ `${indent}}`
88
+ ];
84
89
  }
90
+ /**
91
+ * Generate :root CSS variables for theme configuration.
92
+ */
85
93
  function generateWCRootVariables(options) {
86
- const { designSystem, variant, usePaletteMap = false, indent = "" } = options;
87
- const lines = [];
88
- lines.push(`${indent}:root {`);
89
- if (usePaletteMap) {
90
- lines.push(
91
- `${indent} --ig-theme: #{map.get($palette, '_meta', 'variant')};`
92
- );
93
- lines.push(`${indent} --ig-theme-variant: #{$variant};`);
94
- } else {
95
- lines.push(`${indent} --ig-theme: ${designSystem};`);
96
- lines.push(`${indent} --ig-theme-variant: ${variant};`);
97
- }
98
- lines.push(`${indent} --ig-size-small: 1;`);
99
- lines.push(`${indent} --ig-size-medium: 2;`);
100
- lines.push(`${indent} --ig-size-large: 3;`);
101
- lines.push(`${indent} --ig-scrollbar-size: #{rem(16px)};`);
102
- lines.push(`${indent}}`);
103
- return lines;
94
+ const { designSystem, variant, usePaletteMap = false, indent = "" } = options;
95
+ const lines = [];
96
+ lines.push(`${indent}:root {`);
97
+ if (usePaletteMap) {
98
+ lines.push(`${indent} --ig-theme: #{map.get($palette, '_meta', 'variant')};`);
99
+ lines.push(`${indent} --ig-theme-variant: #{$variant};`);
100
+ } else {
101
+ lines.push(`${indent} --ig-theme: ${designSystem};`);
102
+ lines.push(`${indent} --ig-theme-variant: ${variant};`);
103
+ }
104
+ lines.push(`${indent} --ig-size-small: 1;`);
105
+ lines.push(`${indent} --ig-size-medium: 2;`);
106
+ lines.push(`${indent} --ig-size-large: 3;`);
107
+ lines.push(`${indent} --ig-scrollbar-size: #{rem(16px)};`);
108
+ lines.push(`${indent}}`);
109
+ return lines;
104
110
  }
111
+ /**
112
+ * Generate RTL direction support.
113
+ */
105
114
  function generateWCRtlSupport(indent = "") {
106
- return [
107
- `${indent}body[dir='rtl'] {`,
108
- `${indent} --ig-dir: -1;`,
109
- `${indent}}`
110
- ];
115
+ return [
116
+ `${indent}body[dir='rtl'] {`,
117
+ `${indent} --ig-dir: -1;`,
118
+ `${indent}}`
119
+ ];
111
120
  }
121
+ /**
122
+ * Generate scrollbar customization using palette colors.
123
+ */
112
124
  function generateWCScrollbarCustomization() {
113
- return [
114
- "// Scrollbar customization",
115
- ":root {",
116
- " --ig-scrollbar-thumb-background: #{color($color: gray, $variant: 400)};",
117
- " --ig-scrollbar-track-background: #{color($color: gray, $variant: 100)};",
118
- "}"
119
- ];
125
+ return [
126
+ "// Scrollbar customization",
127
+ ":root {",
128
+ " --ig-scrollbar-thumb-background: #{color($color: gray, $variant: 400)};",
129
+ " --ig-scrollbar-track-background: #{color($color: gray, $variant: 100)};",
130
+ "}"
131
+ ];
120
132
  }
133
+ /**
134
+ * Generate theming mixin calls (palette, elevations, typography, spacing).
135
+ */
121
136
  function generateWCThemingMixins(options) {
122
- const {
123
- paletteVar,
124
- typefaceValue,
125
- elevationsVar,
126
- includeTypography,
127
- includeElevations,
128
- includeSpacing,
129
- indent = "",
130
- addComments = false
131
- } = options;
132
- const lines = [];
133
- if (addComments) lines.push(`${indent}// Apply palette CSS variables`);
134
- lines.push(`${indent}@include palette(${paletteVar});`);
135
- if (addComments) lines.push("");
136
- if (includeElevations) {
137
- if (addComments) lines.push(`${indent}// Apply elevation CSS variables`);
138
- lines.push(...generateElevationsCode({ elevationsVar, indent }));
139
- if (addComments) lines.push("");
140
- }
141
- if (includeTypography) {
142
- if (addComments) lines.push(`${indent}// Apply typography CSS variables`);
143
- lines.push(
144
- ...generateTypographyCode({
145
- fontFamily: typefaceValue,
146
- typeScaleVar: "$type-scale",
147
- indent
148
- })
149
- );
150
- if (addComments) lines.push("");
151
- }
152
- if (includeSpacing) {
153
- if (addComments) lines.push(`${indent}// Apply spacing CSS variables`);
154
- lines.push(`${indent}@include spacing();`);
155
- }
156
- return lines;
137
+ const { paletteVar, typefaceValue, elevationsVar, includeTypography, includeElevations, includeSpacing, indent = "", addComments = false } = options;
138
+ const lines = [];
139
+ if (addComments) lines.push(`${indent}// Apply palette CSS variables`);
140
+ lines.push(`${indent}@include palette(${paletteVar});`);
141
+ if (addComments) lines.push("");
142
+ if (includeElevations) {
143
+ if (addComments) lines.push(`${indent}// Apply elevation CSS variables`);
144
+ lines.push(...generateElevationsCode({
145
+ elevationsVar,
146
+ indent
147
+ }));
148
+ if (addComments) lines.push("");
149
+ }
150
+ if (includeTypography) {
151
+ if (addComments) lines.push(`${indent}// Apply typography CSS variables`);
152
+ lines.push(...generateTypographyCode({
153
+ fontFamily: typefaceValue,
154
+ typeScaleVar: "$type-scale",
155
+ indent
156
+ }));
157
+ if (addComments) lines.push("");
158
+ }
159
+ if (includeSpacing) {
160
+ if (addComments) lines.push(`${indent}// Apply spacing CSS variables`);
161
+ lines.push(`${indent}@include spacing();`);
162
+ }
163
+ return lines;
157
164
  }
165
+ /**
166
+ * Generate a custom palette theme with a theme() mixin wrapper.
167
+ */
158
168
  function generateCustomPaletteTheme(template, typefaceValue) {
159
- const {
160
- designSystem,
161
- variant,
162
- primaryColor,
163
- secondaryColor,
164
- surfaceColor,
165
- grayColor,
166
- customPaletteName = "$my-palette",
167
- includeTypography = true,
168
- includeElevations = true,
169
- includeSpacing = true
170
- } = template;
171
- const lines = [];
172
- const presetName = `${variant}-${designSystem}-palette`;
173
- const presetColors = PALETTE_PRESETS[presetName];
174
- const effectivePrimary = primaryColor || presetColors.primary;
175
- const effectiveSecondary = secondaryColor || presetColors.secondary;
176
- const effectiveSurface = surfaceColor || presetColors.surface;
177
- const paletteResult = generatePaletteCode({
178
- primary: effectivePrimary,
179
- secondary: effectiveSecondary,
180
- surface: effectiveSurface,
181
- gray: grayColor,
182
- variableName: customPaletteName.replace(/^\$/, ""),
183
- useVariableReferences: true
184
- });
185
- lines.push("// Custom color palette");
186
- lines.push(...paletteResult.colorVariables);
187
- lines.push("");
188
- lines.push(...paletteResult.paletteDefinition);
189
- lines.push("");
190
- lines.push("// Theme configuration");
191
- lines.push("@mixin theme($palette, $variant) {");
192
- lines.push(" // Root-level CSS custom properties");
193
- lines.push(...generateWCProgressProperties(" "));
194
- lines.push("");
195
- lines.push(
196
- ...generateWCRootVariables({
197
- designSystem,
198
- variant,
199
- usePaletteMap: true,
200
- indent: " "
201
- })
202
- );
203
- lines.push("");
204
- lines.push(...generateWCRtlSupport(" "));
205
- lines.push("");
206
- lines.push(
207
- ...generateWCThemingMixins({
208
- paletteVar: "$palette",
209
- typefaceValue,
210
- elevationsVar: getWCElevationPreset(designSystem),
211
- includeTypography,
212
- includeElevations,
213
- includeSpacing,
214
- indent: " "
215
- })
216
- );
217
- lines.push("}");
218
- lines.push("");
219
- lines.push("// Apply the theme");
220
- lines.push(`@include theme(${paletteResult.variableName}, '${variant}');`);
221
- return lines;
169
+ const { designSystem, variant, primaryColor, secondaryColor, surfaceColor, grayColor, customPaletteName = "$my-palette", includeTypography = true, includeElevations = true, includeSpacing = true } = template;
170
+ const lines = [];
171
+ const presetColors = PALETTE_PRESETS[`${variant}-${designSystem}-palette`];
172
+ const paletteResult = generatePaletteCode({
173
+ primary: primaryColor || presetColors.primary,
174
+ secondary: secondaryColor || presetColors.secondary,
175
+ surface: surfaceColor || presetColors.surface,
176
+ gray: grayColor,
177
+ variableName: customPaletteName.replace(/^\$/, ""),
178
+ useVariableReferences: true
179
+ });
180
+ lines.push("// Custom color palette");
181
+ lines.push(...paletteResult.colorVariables);
182
+ lines.push("");
183
+ lines.push(...paletteResult.paletteDefinition);
184
+ lines.push("");
185
+ lines.push("// Theme configuration");
186
+ lines.push("@mixin theme($palette, $variant) {");
187
+ lines.push(" // Root-level CSS custom properties");
188
+ lines.push(...generateWCProgressProperties(" "));
189
+ lines.push("");
190
+ lines.push(...generateWCRootVariables({
191
+ designSystem,
192
+ variant,
193
+ usePaletteMap: true,
194
+ indent: " "
195
+ }));
196
+ lines.push("");
197
+ lines.push(...generateWCRtlSupport(" "));
198
+ lines.push("");
199
+ lines.push(...generateWCThemingMixins({
200
+ paletteVar: "$palette",
201
+ typefaceValue,
202
+ elevationsVar: getWCElevationPreset(designSystem),
203
+ includeTypography,
204
+ includeElevations,
205
+ includeSpacing,
206
+ indent: " "
207
+ }));
208
+ lines.push("}");
209
+ lines.push("");
210
+ lines.push("// Apply the theme");
211
+ lines.push(`@include theme(${paletteResult.variableName}, '${variant}');`);
212
+ return lines;
222
213
  }
214
+ /**
215
+ * Generate a preset palette theme (uses predefined palette from design system).
216
+ */
223
217
  function generatePresetPaletteTheme(template, typefaceValue) {
224
- const {
225
- designSystem,
226
- variant,
227
- includeTypography = true,
228
- includeElevations = true,
229
- includeSpacing = true
230
- } = template;
231
- const lines = [];
232
- lines.push(...generateWCScrollbarCustomization());
233
- lines.push("");
234
- lines.push(...generateWCProgressProperties());
235
- lines.push("");
236
- lines.push(...generateWCRootVariables({ designSystem, variant }));
237
- lines.push("");
238
- lines.push(...generateWCRtlSupport());
239
- lines.push("");
240
- lines.push(
241
- ...generateWCThemingMixins({
242
- paletteVar: "$palette",
243
- typefaceValue,
244
- elevationsVar: getWCElevationPreset(designSystem),
245
- includeTypography,
246
- includeElevations,
247
- includeSpacing,
248
- addComments: true
249
- })
250
- );
251
- return lines;
218
+ const { designSystem, variant, includeTypography = true, includeElevations = true, includeSpacing = true } = template;
219
+ const lines = [];
220
+ lines.push(...generateWCScrollbarCustomization());
221
+ lines.push("");
222
+ lines.push(...generateWCProgressProperties());
223
+ lines.push("");
224
+ lines.push(...generateWCRootVariables({
225
+ designSystem,
226
+ variant
227
+ }));
228
+ lines.push("");
229
+ lines.push(...generateWCRtlSupport());
230
+ lines.push("");
231
+ lines.push(...generateWCThemingMixins({
232
+ paletteVar: "$palette",
233
+ typefaceValue,
234
+ elevationsVar: getWCElevationPreset(designSystem),
235
+ includeTypography,
236
+ includeElevations,
237
+ includeSpacing,
238
+ addComments: true
239
+ }));
240
+ return lines;
252
241
  }
242
+ /**
243
+ * Generate Sass code for a Web Components theme
244
+ *
245
+ * Web Components themes use igniteui-theming directly and call individual
246
+ * mixins (palette, typography, elevations) rather than a unified theme() mixin.
247
+ *
248
+ * This function orchestrates smaller helper functions for:
249
+ * - Header generation (generateWCHeader)
250
+ * - Import statements (generateWCImports)
251
+ * - Custom or preset palette themes
252
+ */
253
253
  function generateWebComponentsThemeSass(template) {
254
- const {
255
- designSystem,
256
- variant,
257
- primaryColor,
258
- secondaryColor,
259
- surfaceColor,
260
- fontFamily,
261
- includeTypography = true,
262
- includeElevations = true
263
- } = template;
264
- const typefaceValue = fontFamily ? quoteFontFamily(fontFamily) : "$typeface";
265
- const hasCustomColors = !!(primaryColor || secondaryColor || surfaceColor);
266
- const lines = [];
267
- lines.push(...generateWCHeader());
268
- lines.push(
269
- ...generateWCImports({
270
- designSystem,
271
- variant,
272
- hasCustomColors,
273
- includeTypography,
274
- includeElevations
275
- })
276
- );
277
- lines.push("");
278
- if (hasCustomColors) {
279
- lines.push(...generateCustomPaletteTheme(template, typefaceValue));
280
- } else {
281
- lines.push(...generatePresetPaletteTheme(template, typefaceValue));
282
- }
283
- return lines.join("\n");
254
+ const { designSystem, variant, primaryColor, secondaryColor, surfaceColor, fontFamily, includeTypography = true, includeElevations = true } = template;
255
+ const typefaceValue = fontFamily ? quoteFontFamily(fontFamily) : "$typeface";
256
+ const hasCustomColors = !!(primaryColor || secondaryColor || surfaceColor);
257
+ const lines = [];
258
+ lines.push(...generateWCHeader());
259
+ lines.push(...generateWCImports({
260
+ designSystem,
261
+ variant,
262
+ hasCustomColors,
263
+ includeTypography,
264
+ includeElevations
265
+ }));
266
+ lines.push("");
267
+ if (hasCustomColors) lines.push(...generateCustomPaletteTheme(template, typefaceValue));
268
+ else lines.push(...generatePresetPaletteTheme(template, typefaceValue));
269
+ return lines.join("\n");
284
270
  }
285
- const WEBCOMPONENTS_USAGE_EXAMPLES = {
286
- basic: `
271
+ /**
272
+ * Example usage documentation
273
+ */
274
+ var WEBCOMPONENTS_USAGE_EXAMPLES = {
275
+ basic: `
287
276
  // Basic Material Light Theme for Web Components
288
277
  @use 'igniteui-theming/sass/color/presets/light/material' as *;
289
278
  @use 'igniteui-theming' as *;
@@ -307,7 +296,7 @@ const WEBCOMPONENTS_USAGE_EXAMPLES = {
307
296
  );
308
297
  @include spacing();
309
298
  `,
310
- customPalette: `
299
+ customPalette: `
311
300
  // Custom Palette Theme for Web Components
312
301
  @use 'igniteui-theming' as *;
313
302
  @use 'igniteui-theming/sass/typography/presets/material' as *;
@@ -335,7 +324,7 @@ $my-palette: palette(
335
324
  );
336
325
  @include spacing();
337
326
  `,
338
- darkTheme: `
327
+ darkTheme: `
339
328
  // Dark Indigo Theme for Web Components
340
329
  @use 'igniteui-theming/sass/color/presets/dark/indigo' as *;
341
330
  @use 'igniteui-theming' as *;
@@ -358,7 +347,7 @@ $my-palette: palette(
358
347
  );
359
348
  @include spacing();
360
349
  `,
361
- minimalConfig: `
350
+ minimalConfig: `
362
351
  // Minimal theme (palette only, no typography/elevations)
363
352
  @use 'igniteui-theming/sass/color/presets/light/bootstrap' as *;
364
353
  @use 'igniteui-theming' as *;
@@ -371,11 +360,14 @@ $my-palette: palette(
371
360
  @include palette($palette);
372
361
  `
373
362
  };
374
- const WEBCOMPONENTS_RUNTIME_CONFIG = {
375
- /**
376
- * JavaScript API for runtime theme switching
377
- */
378
- configureThemeAPI: `
363
+ /**
364
+ * Runtime theme configuration for Web Components
365
+ *
366
+ * Web Components support runtime theme switching via the configureTheme() function
367
+ * and CSS variables. This is different from Angular which requires Sass recompilation.
368
+ */
369
+ var WEBCOMPONENTS_RUNTIME_CONFIG = {
370
+ configureThemeAPI: `
379
371
  import { configureTheme } from 'igniteui-webcomponents';
380
372
 
381
373
  // Switch to dark material theme at runtime
@@ -384,26 +376,8 @@ configureTheme('material', 'dark');
384
376
  // Switch to light indigo theme
385
377
  configureTheme('indigo', 'light');
386
378
  `,
387
- /**
388
- * CSS variables that control the theme at runtime
389
- */
390
- runtimeVariables: ["--ig-theme", "--ig-theme-variant"],
391
- /**
392
- * Events dispatched during theme changes
393
- */
394
- themeChangeEvents: ["igc-change-theme", "igc-changed-theme"]
395
- };
396
- export {
397
- WEBCOMPONENTS_PLATFORM,
398
- WEBCOMPONENTS_RUNTIME_CONFIG,
399
- WEBCOMPONENTS_USAGE_EXAMPLES,
400
- generateWCHeader,
401
- generateWCImports,
402
- generateWCProgressProperties,
403
- generateWCRootVariables,
404
- generateWCRtlSupport,
405
- generateWCScrollbarCustomization,
406
- generateWCThemingMixins,
407
- generateWebComponentsThemeSass,
408
- getWCElevationPreset
379
+ runtimeVariables: ["--ig-theme", "--ig-theme-variant"],
380
+ themeChangeEvents: ["igc-change-theme", "igc-changed-theme"]
409
381
  };
382
+ //#endregion
383
+ export { WEBCOMPONENTS_PLATFORM, WEBCOMPONENTS_RUNTIME_CONFIG, WEBCOMPONENTS_USAGE_EXAMPLES, generateWCHeader, generateWCImports, generateWCProgressProperties, generateWCRootVariables, generateWCRtlSupport, generateWCScrollbarCustomization, generateWCThemingMixins, generateWebComponentsThemeSass, getWCElevationPreset };
@@ -0,0 +1 @@
1
+ import "../utils/types.js";
@@ -1,5 +1,13 @@
1
- import typescalesData from "../json/typography/presets/typescales.json.js";
2
- const TYPOGRAPHY_PRESETS = typescalesData;
3
- export {
4
- TYPOGRAPHY_PRESETS
5
- };
1
+ import typescales_default from "../theming/dist/json/typography/presets/typescales.js";
2
+ //#region src/knowledge/typography.ts
3
+ /**
4
+ * Typography presets for each design system.
5
+ * These are loaded from the JSON files generated by buildJSON.mjs
6
+ * which is the single source of truth from the Sass code.
7
+ */
8
+ /**
9
+ * Typography presets loaded from JSON.
10
+ */
11
+ var TYPOGRAPHY_PRESETS = typescales_default;
12
+ //#endregion
13
+ export { TYPOGRAPHY_PRESETS };
@@ -0,0 +1 @@
1
+ import "./presets.js";