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.
- package/dist/index.d.ts +75 -0
- package/dist/index.js +12 -0
- package/dist/json/components/bootstrap.json +1 -0
- package/dist/json/components/fluent.json +1 -0
- package/dist/json/components/indigo.json +1 -0
- package/dist/json/components/material.json +1 -0
- package/{json → dist/json}/components/themes.json +31 -1
- package/dist/mcp/generators/css.d.ts +7 -4
- package/dist/mcp/generators/css.js +129 -104
- package/dist/mcp/generators/sass.js +227 -254
- package/dist/mcp/index.js +259 -323
- package/dist/mcp/knowledge/color-usage.js +524 -502
- package/dist/mcp/knowledge/colors.js +61 -50
- package/dist/mcp/knowledge/component-metadata.js +697 -598
- package/dist/mcp/knowledge/component-themes.js +70 -57
- package/dist/mcp/knowledge/custom-palettes.js +4 -9
- package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
- package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
- package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
- package/dist/mcp/knowledge/elevations.d.ts +1 -1
- package/dist/mcp/knowledge/elevations.js +26 -12
- package/dist/mcp/knowledge/index.js +23 -87
- package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
- package/dist/mcp/knowledge/multipliers.js +5 -0
- package/dist/mcp/knowledge/palettes.js +29 -17
- package/dist/mcp/knowledge/platforms/angular.js +98 -120
- package/dist/mcp/knowledge/platforms/blazor.js +39 -34
- package/dist/mcp/knowledge/platforms/common.js +83 -68
- package/dist/mcp/knowledge/platforms/index.js +265 -242
- package/dist/mcp/knowledge/platforms/react.js +43 -35
- package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
- package/dist/mcp/knowledge/sass-api.js +1 -0
- package/dist/mcp/knowledge/typography.js +13 -5
- package/dist/mcp/resources/index.js +1 -0
- package/dist/mcp/resources/presets.js +409 -508
- package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
- package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
- package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
- package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
- package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
- package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
- package/dist/mcp/tools/descriptions.js +98 -154
- package/dist/mcp/tools/handlers/color.js +58 -56
- package/dist/mcp/tools/handlers/component-theme.js +163 -225
- package/dist/mcp/tools/handlers/component-tokens.js +159 -219
- package/dist/mcp/tools/handlers/custom-palette.js +138 -179
- package/dist/mcp/tools/handlers/elevations.js +27 -28
- package/dist/mcp/tools/handlers/index.js +11 -0
- package/dist/mcp/tools/handlers/layout.js +125 -176
- package/dist/mcp/tools/handlers/palette.js +105 -120
- package/dist/mcp/tools/handlers/platform.js +289 -311
- package/dist/mcp/tools/handlers/resource.js +22 -31
- package/dist/mcp/tools/handlers/theme.js +86 -103
- package/dist/mcp/tools/handlers/typography.js +29 -30
- package/dist/mcp/tools/index.js +13 -0
- package/dist/mcp/tools/schemas.js +239 -218
- package/dist/mcp/utils/color.js +277 -239
- package/dist/mcp/utils/preprocessing.js +57 -30
- package/dist/mcp/utils/result.js +43 -45
- package/dist/mcp/utils/sass.js +271 -191
- package/dist/mcp/utils/theming-resolve.d.ts +19 -0
- package/dist/mcp/utils/theming-resolve.js +57 -0
- package/dist/mcp/utils/types.js +96 -53
- package/dist/mcp/validators/custom-palette.js +218 -243
- package/dist/mcp/validators/index.js +3 -0
- package/dist/mcp/validators/palette.js +231 -229
- package/dist/tailwind/utilities/bootstrap.css +1 -0
- package/dist/tailwind/utilities/fluent.css +1 -0
- package/dist/tailwind/utilities/indigo.css +1 -0
- package/dist/tailwind/utilities/material.css +1 -0
- package/package.json +45 -64
- package/sass/json/README.md +12 -7
- package/sass/themes/_mixins.scss +1 -0
- package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
- package/sass/themes/components/grid/_grid-theme.scss +1 -1
- package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
- package/sass/themes/schemas/components/dark/_grid.scss +0 -16
- package/sass/themes/schemas/components/light/_button-group.scss +221 -99
- package/sass/themes/schemas/components/light/_grid.scss +14 -20
- package/LICENSE +0 -21
- package/README.md +0 -391
- package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
- package/dist/mcp/json/components/themes.json.js +0 -143
- package/dist/mcp/json/elevations/indigo.json.js +0 -8
- package/dist/mcp/json/elevations/material.json.js +0 -8
- package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
- package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
- package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
- package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
- package/dist/mcp/vite-env.d.ts +0 -18
- package/index.js +0 -5
- package/json/components/bootstrap.json +0 -1
- package/json/components/fluent.json +0 -1
- package/json/components/indigo.json +0 -1
- package/json/components/material.json +0 -1
- package/tailwind/utilities/bootstrap.css +0 -1
- package/tailwind/utilities/fluent.css +0 -1
- package/tailwind/utilities/indigo.css +0 -1
- package/tailwind/utilities/material.css +0 -1
- /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
- /package/{json → dist/json}/colors/meta/palette.json +0 -0
- /package/{json → dist/json}/colors/presets/palettes.json +0 -0
- /package/{json → dist/json}/elevations/indigo.json +0 -0
- /package/{json → dist/json}/elevations/material.json +0 -0
- /package/{json → dist/json}/typography/presets/typescales.json +0 -0
- /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
- /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 {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
40
|
+
return ELEVATIONS[designSystem];
|
|
33
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate import statements for a Web Components theme.
|
|
44
|
+
*/
|
|
34
45
|
function generateWCImports(options) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
|
|
286
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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";
|