@salesforce/ui-theme-manager 11.46.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/LICENSE.txt +82 -0
- package/README.md +29 -0
- package/dist/authoring/core/ThemeManagerPanelRoot.d.cts +43 -0
- package/dist/authoring/core/ThemeManagerPanelRoot.d.ts +43 -0
- package/dist/authoring/core/ThemeManagerPanelRoot.d.ts.map +1 -0
- package/dist/authoring/core/components/AssetsSection.d.cts +12 -0
- package/dist/authoring/core/components/AssetsSection.d.ts +12 -0
- package/dist/authoring/core/components/AssetsSection.d.ts.map +1 -0
- package/dist/authoring/core/components/BordersSection.d.cts +9 -0
- package/dist/authoring/core/components/BordersSection.d.ts +9 -0
- package/dist/authoring/core/components/BordersSection.d.ts.map +1 -0
- package/dist/authoring/core/components/ButtonSection.d.cts +9 -0
- package/dist/authoring/core/components/ButtonSection.d.ts +9 -0
- package/dist/authoring/core/components/ButtonSection.d.ts.map +1 -0
- package/dist/authoring/core/components/ColorEditors.d.cts +8 -0
- package/dist/authoring/core/components/ColorEditors.d.ts +8 -0
- package/dist/authoring/core/components/ColorEditors.d.ts.map +1 -0
- package/dist/authoring/core/components/ColorField.d.cts +45 -0
- package/dist/authoring/core/components/ColorField.d.ts +45 -0
- package/dist/authoring/core/components/ColorField.d.ts.map +1 -0
- package/dist/authoring/core/components/SaveBar.d.cts +8 -0
- package/dist/authoring/core/components/SaveBar.d.ts +8 -0
- package/dist/authoring/core/components/SaveBar.d.ts.map +1 -0
- package/dist/authoring/core/components/SearchBox.d.cts +16 -0
- package/dist/authoring/core/components/SearchBox.d.ts +16 -0
- package/dist/authoring/core/components/SearchBox.d.ts.map +1 -0
- package/dist/authoring/core/components/TabSwitcher.d.cts +13 -0
- package/dist/authoring/core/components/TabSwitcher.d.ts +13 -0
- package/dist/authoring/core/components/TabSwitcher.d.ts.map +1 -0
- package/dist/authoring/core/components/ThemeGallery.d.cts +9 -0
- package/dist/authoring/core/components/ThemeGallery.d.ts +9 -0
- package/dist/authoring/core/components/ThemeGallery.d.ts.map +1 -0
- package/dist/authoring/core/components/TypographySection.d.cts +9 -0
- package/dist/authoring/core/components/TypographySection.d.ts +9 -0
- package/dist/authoring/core/components/TypographySection.d.ts.map +1 -0
- package/dist/authoring/core/index.d.cts +8 -0
- package/dist/authoring/core/index.d.ts +8 -0
- package/dist/authoring/core/index.d.ts.map +1 -0
- package/dist/authoring/core/labels.d.cts +89 -0
- package/dist/authoring/core/labels.d.ts +89 -0
- package/dist/authoring/core/labels.d.ts.map +1 -0
- package/dist/authoring/react/index.d.cts +16 -0
- package/dist/authoring/react/index.d.ts +16 -0
- package/dist/authoring/react/index.d.ts.map +1 -0
- package/dist/authoring/react/index.js +1 -0
- package/dist/authoring/react/styles.css +1 -0
- package/dist/authoring/web-component/index.d.cts +34 -0
- package/dist/authoring/web-component/index.d.ts +34 -0
- package/dist/authoring/web-component/index.d.ts.map +1 -0
- package/dist/authoring/web-component/index.js +729 -0
- package/dist/protocol/brandCss.cjs +255 -0
- package/dist/protocol/brandCss.d.cts +42 -0
- package/dist/protocol/brandCss.d.ts +42 -0
- package/dist/protocol/brandCss.d.ts.map +1 -0
- package/dist/protocol/brandCss.js +255 -0
- package/dist/protocol/brandResolver.cjs +61 -0
- package/dist/protocol/brandResolver.d.cts +28 -0
- package/dist/protocol/brandResolver.d.ts +28 -0
- package/dist/protocol/brandResolver.d.ts.map +1 -0
- package/dist/protocol/brandResolver.js +61 -0
- package/dist/protocol/brandSearch.cjs +64 -0
- package/dist/protocol/brandSearch.d.cts +133 -0
- package/dist/protocol/brandSearch.d.ts +133 -0
- package/dist/protocol/brandSearch.d.ts.map +1 -0
- package/dist/protocol/brandSearch.js +64 -0
- package/dist/protocol/brandTypes.cjs +30 -0
- package/dist/protocol/brandTypes.d.cts +198 -0
- package/dist/protocol/brandTypes.d.ts +198 -0
- package/dist/protocol/brandTypes.d.ts.map +1 -0
- package/dist/protocol/brandTypes.js +30 -0
- package/dist/protocol/deriveColors.cjs +67 -0
- package/dist/protocol/deriveColors.d.cts +39 -0
- package/dist/protocol/deriveColors.d.ts +39 -0
- package/dist/protocol/deriveColors.d.ts.map +1 -0
- package/dist/protocol/deriveColors.js +67 -0
- package/dist/protocol/index.cjs +55 -0
- package/dist/protocol/index.d.cts +20 -0
- package/dist/protocol/index.d.ts +20 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +55 -0
- package/dist/protocol/messageTypes.cjs +32 -0
- package/dist/protocol/messageTypes.d.cts +86 -0
- package/dist/protocol/messageTypes.d.ts +86 -0
- package/dist/protocol/messageTypes.d.ts.map +1 -0
- package/dist/protocol/messageTypes.js +32 -0
- package/dist/protocol/ootbThemes.cjs +229 -0
- package/dist/protocol/ootbThemes.d.cts +6 -0
- package/dist/protocol/ootbThemes.d.ts +6 -0
- package/dist/protocol/ootbThemes.d.ts.map +1 -0
- package/dist/protocol/ootbThemes.js +229 -0
- package/dist/protocol/themeCss.cjs +47 -0
- package/dist/protocol/themeCss.d.cts +18 -0
- package/dist/protocol/themeCss.d.ts +18 -0
- package/dist/protocol/themeCss.d.ts.map +1 -0
- package/dist/protocol/themeCss.js +47 -0
- package/dist/protocol/types.d.cts +74 -0
- package/dist/protocol/types.d.ts +74 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/utils.cjs +10 -0
- package/dist/protocol/utils.d.cts +20 -0
- package/dist/protocol/utils.d.ts +20 -0
- package/dist/protocol/utils.d.ts.map +1 -0
- package/dist/protocol/utils.js +10 -0
- package/dist/runtime/fontFace.cjs +43 -0
- package/dist/runtime/fontFace.d.cts +15 -0
- package/dist/runtime/fontFace.d.ts +15 -0
- package/dist/runtime/fontFace.d.ts.map +1 -0
- package/dist/runtime/fontFace.js +43 -0
- package/dist/runtime/previewContent.cjs +344 -0
- package/dist/runtime/previewContent.d.cts +43 -0
- package/dist/runtime/previewContent.d.ts +43 -0
- package/dist/runtime/previewContent.d.ts.map +1 -0
- package/dist/runtime/previewContent.js +344 -0
- package/dist/runtime/previewRuntime.d.cts +10 -0
- package/dist/runtime/previewRuntime.d.ts +10 -0
- package/dist/runtime/previewRuntime.d.ts.map +1 -0
- package/dist/runtime/theme-preview-runtime.js +466 -0
- package/package.json +74 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
function createBuiltInThemes() {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
5
|
+
metadata: {
|
|
6
|
+
developerName: "cosmos",
|
|
7
|
+
label: "Cosmos",
|
|
8
|
+
description: "Salesforce default theme with signature blues"
|
|
9
|
+
},
|
|
10
|
+
colors: {
|
|
11
|
+
primary: "#0176D3",
|
|
12
|
+
secondary: "#032D60",
|
|
13
|
+
background: "#FFFFFF",
|
|
14
|
+
surface: "#F3F3F3",
|
|
15
|
+
text: "#181818",
|
|
16
|
+
textSecondary: "#444444",
|
|
17
|
+
accent: "#0B5CAB",
|
|
18
|
+
error: "#BA0517",
|
|
19
|
+
success: "#2E844A"
|
|
20
|
+
},
|
|
21
|
+
typography: {
|
|
22
|
+
headingFamily: "'Inter', sans-serif",
|
|
23
|
+
bodyFamily: "'Inter', sans-serif",
|
|
24
|
+
baseFontSize: "16px",
|
|
25
|
+
headingWeight: "700",
|
|
26
|
+
bodyWeight: "400",
|
|
27
|
+
lineHeight: "1.5"
|
|
28
|
+
},
|
|
29
|
+
spacing: { density: "default", baseUnit: "8px" },
|
|
30
|
+
borders: { radius: "4px", radiusSmall: "2px", radiusLarge: "8px" },
|
|
31
|
+
buttons: {
|
|
32
|
+
primaryBg: "#0176D3",
|
|
33
|
+
primaryText: "#FFFFFF",
|
|
34
|
+
borderRadius: "4px",
|
|
35
|
+
paddingX: "16px",
|
|
36
|
+
paddingY: "8px"
|
|
37
|
+
},
|
|
38
|
+
logo: null
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
42
|
+
metadata: {
|
|
43
|
+
developerName: "luxury_hotel",
|
|
44
|
+
label: "Luxury Hotel Portal",
|
|
45
|
+
description: "Sophisticated theme for a luxury hotel portal with gold accents"
|
|
46
|
+
},
|
|
47
|
+
colors: {
|
|
48
|
+
primary: "#1A365D",
|
|
49
|
+
secondary: "#C9A96E",
|
|
50
|
+
background: "#FAF9F7",
|
|
51
|
+
surface: "#FFFFFF",
|
|
52
|
+
text: "#1A202C",
|
|
53
|
+
textSecondary: "#4A5568",
|
|
54
|
+
accent: "#C5A54E",
|
|
55
|
+
error: "#D32F2F",
|
|
56
|
+
success: "#2E7D32"
|
|
57
|
+
},
|
|
58
|
+
typography: {
|
|
59
|
+
headingFamily: "'Playfair Display', serif",
|
|
60
|
+
bodyFamily: "'Inter', sans-serif",
|
|
61
|
+
baseFontSize: "16px",
|
|
62
|
+
headingWeight: "700",
|
|
63
|
+
bodyWeight: "400",
|
|
64
|
+
lineHeight: "1.6"
|
|
65
|
+
},
|
|
66
|
+
spacing: { density: "spacious", baseUnit: "8px" },
|
|
67
|
+
borders: { radius: "12px", radiusSmall: "6px", radiusLarge: "20px" },
|
|
68
|
+
buttons: {
|
|
69
|
+
primaryBg: "#C5A54E",
|
|
70
|
+
primaryText: "#FFFFFF",
|
|
71
|
+
borderRadius: "8px",
|
|
72
|
+
paddingX: "24px",
|
|
73
|
+
paddingY: "12px"
|
|
74
|
+
},
|
|
75
|
+
logo: null
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
79
|
+
metadata: {
|
|
80
|
+
developerName: "midnight",
|
|
81
|
+
label: "Midnight",
|
|
82
|
+
description: "Dark theme with deep blues and purples"
|
|
83
|
+
},
|
|
84
|
+
colors: {
|
|
85
|
+
primary: "#6B5CE7",
|
|
86
|
+
secondary: "#A78BFA",
|
|
87
|
+
background: "#0F0F23",
|
|
88
|
+
surface: "#1A1A3E",
|
|
89
|
+
text: "#E8E8F0",
|
|
90
|
+
textSecondary: "#A0A0C0",
|
|
91
|
+
accent: "#8B5CF6",
|
|
92
|
+
error: "#F87171",
|
|
93
|
+
success: "#4ADE80"
|
|
94
|
+
},
|
|
95
|
+
typography: {
|
|
96
|
+
headingFamily: "'Inter', sans-serif",
|
|
97
|
+
bodyFamily: "'Inter', sans-serif",
|
|
98
|
+
baseFontSize: "16px",
|
|
99
|
+
headingWeight: "600",
|
|
100
|
+
bodyWeight: "400",
|
|
101
|
+
lineHeight: "1.6"
|
|
102
|
+
},
|
|
103
|
+
spacing: { density: "default", baseUnit: "8px" },
|
|
104
|
+
borders: { radius: "6px", radiusSmall: "3px", radiusLarge: "12px" },
|
|
105
|
+
buttons: {
|
|
106
|
+
primaryBg: "#6B5CE7",
|
|
107
|
+
primaryText: "#FFFFFF",
|
|
108
|
+
borderRadius: "6px",
|
|
109
|
+
paddingX: "20px",
|
|
110
|
+
paddingY: "10px"
|
|
111
|
+
},
|
|
112
|
+
logo: null
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
116
|
+
metadata: {
|
|
117
|
+
developerName: "sunrise",
|
|
118
|
+
label: "Sunrise",
|
|
119
|
+
description: "Warm theme with vibrant oranges and yellows"
|
|
120
|
+
},
|
|
121
|
+
colors: {
|
|
122
|
+
primary: "#EA580C",
|
|
123
|
+
secondary: "#D97706",
|
|
124
|
+
background: "#FFFBF5",
|
|
125
|
+
surface: "#FEF3E2",
|
|
126
|
+
text: "#1C1917",
|
|
127
|
+
textSecondary: "#57534E",
|
|
128
|
+
accent: "#F59E0B",
|
|
129
|
+
error: "#DC2626",
|
|
130
|
+
success: "#16A34A"
|
|
131
|
+
},
|
|
132
|
+
typography: {
|
|
133
|
+
headingFamily: "'Inter', sans-serif",
|
|
134
|
+
bodyFamily: "'Inter', sans-serif",
|
|
135
|
+
baseFontSize: "16px",
|
|
136
|
+
headingWeight: "700",
|
|
137
|
+
bodyWeight: "400",
|
|
138
|
+
lineHeight: "1.5"
|
|
139
|
+
},
|
|
140
|
+
spacing: { density: "spacious", baseUnit: "8px" },
|
|
141
|
+
borders: { radius: "8px", radiusSmall: "4px", radiusLarge: "16px" },
|
|
142
|
+
buttons: {
|
|
143
|
+
primaryBg: "#EA580C",
|
|
144
|
+
primaryText: "#FFFFFF",
|
|
145
|
+
borderRadius: "8px",
|
|
146
|
+
paddingX: "18px",
|
|
147
|
+
paddingY: "10px"
|
|
148
|
+
},
|
|
149
|
+
logo: null
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
153
|
+
metadata: {
|
|
154
|
+
developerName: "high_contrast",
|
|
155
|
+
label: "High Contrast",
|
|
156
|
+
description: "Maximum contrast for accessibility with bold colors"
|
|
157
|
+
},
|
|
158
|
+
colors: {
|
|
159
|
+
primary: "#000000",
|
|
160
|
+
secondary: "#1A1A1A",
|
|
161
|
+
background: "#FFFFFF",
|
|
162
|
+
surface: "#F5F5F5",
|
|
163
|
+
text: "#000000",
|
|
164
|
+
textSecondary: "#333333",
|
|
165
|
+
accent: "#0000FF",
|
|
166
|
+
error: "#CC0000",
|
|
167
|
+
success: "#006600"
|
|
168
|
+
},
|
|
169
|
+
typography: {
|
|
170
|
+
headingFamily: "'Inter', sans-serif",
|
|
171
|
+
bodyFamily: "'Inter', sans-serif",
|
|
172
|
+
baseFontSize: "18px",
|
|
173
|
+
headingWeight: "900",
|
|
174
|
+
bodyWeight: "500",
|
|
175
|
+
lineHeight: "1.6"
|
|
176
|
+
},
|
|
177
|
+
spacing: { density: "spacious", baseUnit: "10px" },
|
|
178
|
+
borders: { radius: "0px", radiusSmall: "0px", radiusLarge: "0px" },
|
|
179
|
+
buttons: {
|
|
180
|
+
primaryBg: "#000000",
|
|
181
|
+
primaryText: "#FFFFFF",
|
|
182
|
+
borderRadius: "0px",
|
|
183
|
+
paddingX: "20px",
|
|
184
|
+
paddingY: "12px"
|
|
185
|
+
},
|
|
186
|
+
logo: null
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
$schema: "https://salesforce.com/schema/theme.json",
|
|
190
|
+
metadata: {
|
|
191
|
+
developerName: "muted_professional",
|
|
192
|
+
label: "Muted Professional",
|
|
193
|
+
description: "Subtle grays and navy for a refined business look"
|
|
194
|
+
},
|
|
195
|
+
colors: {
|
|
196
|
+
primary: "#2C3E50",
|
|
197
|
+
secondary: "#34495E",
|
|
198
|
+
background: "#FAFBFC",
|
|
199
|
+
surface: "#EDF2F7",
|
|
200
|
+
text: "#2D3748",
|
|
201
|
+
textSecondary: "#718096",
|
|
202
|
+
accent: "#4A5568",
|
|
203
|
+
error: "#C53030",
|
|
204
|
+
success: "#38A169"
|
|
205
|
+
},
|
|
206
|
+
typography: {
|
|
207
|
+
headingFamily: "'Inter', sans-serif",
|
|
208
|
+
bodyFamily: "'Inter', sans-serif",
|
|
209
|
+
baseFontSize: "15px",
|
|
210
|
+
headingWeight: "600",
|
|
211
|
+
bodyWeight: "400",
|
|
212
|
+
lineHeight: "1.5"
|
|
213
|
+
},
|
|
214
|
+
spacing: { density: "compact", baseUnit: "6px" },
|
|
215
|
+
borders: { radius: "3px", radiusSmall: "2px", radiusLarge: "6px" },
|
|
216
|
+
buttons: {
|
|
217
|
+
primaryBg: "#2C3E50",
|
|
218
|
+
primaryText: "#FFFFFF",
|
|
219
|
+
borderRadius: "3px",
|
|
220
|
+
paddingX: "14px",
|
|
221
|
+
paddingY: "8px"
|
|
222
|
+
},
|
|
223
|
+
logo: null
|
|
224
|
+
}
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
createBuiltInThemes
|
|
229
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function themeToVariables(theme) {
|
|
4
|
+
return {
|
|
5
|
+
"--tm-color-primary": theme.colors.primary,
|
|
6
|
+
"--tm-color-secondary": theme.colors.secondary,
|
|
7
|
+
"--tm-color-background": theme.colors.background,
|
|
8
|
+
"--tm-color-surface": theme.colors.surface,
|
|
9
|
+
"--tm-color-text": theme.colors.text,
|
|
10
|
+
"--tm-color-text-secondary": theme.colors.textSecondary,
|
|
11
|
+
"--tm-color-accent": theme.colors.accent,
|
|
12
|
+
"--tm-color-error": theme.colors.error,
|
|
13
|
+
"--tm-color-success": theme.colors.success,
|
|
14
|
+
"--tm-font-heading": theme.typography.headingFamily,
|
|
15
|
+
"--tm-font-body": theme.typography.bodyFamily,
|
|
16
|
+
"--tm-font-size-base": theme.typography.baseFontSize,
|
|
17
|
+
"--tm-heading-weight": theme.typography.headingWeight,
|
|
18
|
+
"--tm-body-weight": theme.typography.bodyWeight,
|
|
19
|
+
"--tm-line-height": theme.typography.lineHeight,
|
|
20
|
+
"--tm-spacing-base": theme.spacing.baseUnit,
|
|
21
|
+
"--tm-border-radius": theme.borders.radius,
|
|
22
|
+
"--tm-border-radius-small": theme.borders.radiusSmall,
|
|
23
|
+
"--tm-border-radius-large": theme.borders.radiusLarge,
|
|
24
|
+
"--tm-button-primary-bg": theme.buttons.primaryBg,
|
|
25
|
+
"--tm-button-primary-text": theme.buttons.primaryText,
|
|
26
|
+
"--tm-button-radius": theme.buttons.borderRadius,
|
|
27
|
+
"--tm-button-padding-x": theme.buttons.paddingX,
|
|
28
|
+
"--tm-button-padding-y": theme.buttons.paddingY
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function generateThemeCss(theme) {
|
|
32
|
+
const vars = themeToVariables(theme);
|
|
33
|
+
const cssVars = Object.entries(vars).map(([key, value]) => ` ${key}: ${value};`).join("\n");
|
|
34
|
+
return `/**
|
|
35
|
+
* Theme: ${theme.metadata.label}
|
|
36
|
+
* ${theme.metadata.description}
|
|
37
|
+
* Developer Name: ${theme.metadata.developerName}
|
|
38
|
+
* Generated by Salesforce UI Theme Manager
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
:root {
|
|
42
|
+
${cssVars}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
exports.generateThemeCss = generateThemeCss;
|
|
47
|
+
exports.themeToVariables = themeToVariables;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Theme } from './types.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Maps a Theme object to a flat record of CSS custom properties.
|
|
4
|
+
* CSS variable names use the `--tm-*` prefix (theme-manager).
|
|
5
|
+
*
|
|
6
|
+
* @param theme - The theme to convert
|
|
7
|
+
* @returns Record of CSS variable names to values
|
|
8
|
+
*/
|
|
9
|
+
export declare function themeToVariables(theme: Theme): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a complete CSS stylesheet string with `:root` selector and
|
|
12
|
+
* all theme variables.
|
|
13
|
+
*
|
|
14
|
+
* @param theme - The theme to convert
|
|
15
|
+
* @returns CSS string ready for injection or file output
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateThemeCss(theme: Theme): string;
|
|
18
|
+
//# sourceMappingURL=themeCss.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Theme } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Maps a Theme object to a flat record of CSS custom properties.
|
|
4
|
+
* CSS variable names use the `--tm-*` prefix (theme-manager).
|
|
5
|
+
*
|
|
6
|
+
* @param theme - The theme to convert
|
|
7
|
+
* @returns Record of CSS variable names to values
|
|
8
|
+
*/
|
|
9
|
+
export declare function themeToVariables(theme: Theme): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a complete CSS stylesheet string with `:root` selector and
|
|
12
|
+
* all theme variables.
|
|
13
|
+
*
|
|
14
|
+
* @param theme - The theme to convert
|
|
15
|
+
* @returns CSS string ready for injection or file output
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateThemeCss(theme: Theme): string;
|
|
18
|
+
//# sourceMappingURL=themeCss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeCss.d.ts","sourceRoot":"","sources":["../../src/protocol/themeCss.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BrE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAiBrD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function themeToVariables(theme) {
|
|
2
|
+
return {
|
|
3
|
+
"--tm-color-primary": theme.colors.primary,
|
|
4
|
+
"--tm-color-secondary": theme.colors.secondary,
|
|
5
|
+
"--tm-color-background": theme.colors.background,
|
|
6
|
+
"--tm-color-surface": theme.colors.surface,
|
|
7
|
+
"--tm-color-text": theme.colors.text,
|
|
8
|
+
"--tm-color-text-secondary": theme.colors.textSecondary,
|
|
9
|
+
"--tm-color-accent": theme.colors.accent,
|
|
10
|
+
"--tm-color-error": theme.colors.error,
|
|
11
|
+
"--tm-color-success": theme.colors.success,
|
|
12
|
+
"--tm-font-heading": theme.typography.headingFamily,
|
|
13
|
+
"--tm-font-body": theme.typography.bodyFamily,
|
|
14
|
+
"--tm-font-size-base": theme.typography.baseFontSize,
|
|
15
|
+
"--tm-heading-weight": theme.typography.headingWeight,
|
|
16
|
+
"--tm-body-weight": theme.typography.bodyWeight,
|
|
17
|
+
"--tm-line-height": theme.typography.lineHeight,
|
|
18
|
+
"--tm-spacing-base": theme.spacing.baseUnit,
|
|
19
|
+
"--tm-border-radius": theme.borders.radius,
|
|
20
|
+
"--tm-border-radius-small": theme.borders.radiusSmall,
|
|
21
|
+
"--tm-border-radius-large": theme.borders.radiusLarge,
|
|
22
|
+
"--tm-button-primary-bg": theme.buttons.primaryBg,
|
|
23
|
+
"--tm-button-primary-text": theme.buttons.primaryText,
|
|
24
|
+
"--tm-button-radius": theme.buttons.borderRadius,
|
|
25
|
+
"--tm-button-padding-x": theme.buttons.paddingX,
|
|
26
|
+
"--tm-button-padding-y": theme.buttons.paddingY
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function generateThemeCss(theme) {
|
|
30
|
+
const vars = themeToVariables(theme);
|
|
31
|
+
const cssVars = Object.entries(vars).map(([key, value]) => ` ${key}: ${value};`).join("\n");
|
|
32
|
+
return `/**
|
|
33
|
+
* Theme: ${theme.metadata.label}
|
|
34
|
+
* ${theme.metadata.description}
|
|
35
|
+
* Developer Name: ${theme.metadata.developerName}
|
|
36
|
+
* Generated by Salesforce UI Theme Manager
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
:root {
|
|
40
|
+
${cssVars}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
generateThemeCss,
|
|
46
|
+
themeToVariables
|
|
47
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Theme data model types.
|
|
8
|
+
*
|
|
9
|
+
* Evolution policy: Add new fields as optional. Never rename or remove fields.
|
|
10
|
+
* Never change field semantics. This schema is embedded in generated theme
|
|
11
|
+
* artifacts that may outlive the editor version that created them.
|
|
12
|
+
*/
|
|
13
|
+
export interface ThemeMetadata {
|
|
14
|
+
developerName: string;
|
|
15
|
+
label: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ThemeColors {
|
|
19
|
+
primary: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
background: string;
|
|
22
|
+
surface: string;
|
|
23
|
+
text: string;
|
|
24
|
+
textSecondary: string;
|
|
25
|
+
accent: string;
|
|
26
|
+
error: string;
|
|
27
|
+
success: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ThemeTypography {
|
|
30
|
+
headingFamily: string;
|
|
31
|
+
bodyFamily: string;
|
|
32
|
+
baseFontSize: string;
|
|
33
|
+
headingWeight: string;
|
|
34
|
+
bodyWeight: string;
|
|
35
|
+
lineHeight: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ThemeSpacing {
|
|
38
|
+
density: "compact" | "default" | "spacious";
|
|
39
|
+
baseUnit: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ThemeBorders {
|
|
42
|
+
radius: string;
|
|
43
|
+
radiusSmall: string;
|
|
44
|
+
radiusLarge: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ThemeButtons {
|
|
47
|
+
primaryBg: string;
|
|
48
|
+
primaryText: string;
|
|
49
|
+
borderRadius: string;
|
|
50
|
+
paddingX: string;
|
|
51
|
+
paddingY: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Root theme object. Portable across hosts.
|
|
55
|
+
*/
|
|
56
|
+
export interface Theme {
|
|
57
|
+
$schema: string;
|
|
58
|
+
metadata: ThemeMetadata;
|
|
59
|
+
colors: ThemeColors;
|
|
60
|
+
typography: ThemeTypography;
|
|
61
|
+
spacing: ThemeSpacing;
|
|
62
|
+
borders: ThemeBorders;
|
|
63
|
+
buttons: ThemeButtons;
|
|
64
|
+
logo: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Component-level style overrides. Allows per-component customization that
|
|
68
|
+
* overrides global theme tokens.
|
|
69
|
+
*/
|
|
70
|
+
export interface ComponentOverride {
|
|
71
|
+
component: string;
|
|
72
|
+
styles: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Theme data model types.
|
|
8
|
+
*
|
|
9
|
+
* Evolution policy: Add new fields as optional. Never rename or remove fields.
|
|
10
|
+
* Never change field semantics. This schema is embedded in generated theme
|
|
11
|
+
* artifacts that may outlive the editor version that created them.
|
|
12
|
+
*/
|
|
13
|
+
export interface ThemeMetadata {
|
|
14
|
+
developerName: string;
|
|
15
|
+
label: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ThemeColors {
|
|
19
|
+
primary: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
background: string;
|
|
22
|
+
surface: string;
|
|
23
|
+
text: string;
|
|
24
|
+
textSecondary: string;
|
|
25
|
+
accent: string;
|
|
26
|
+
error: string;
|
|
27
|
+
success: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ThemeTypography {
|
|
30
|
+
headingFamily: string;
|
|
31
|
+
bodyFamily: string;
|
|
32
|
+
baseFontSize: string;
|
|
33
|
+
headingWeight: string;
|
|
34
|
+
bodyWeight: string;
|
|
35
|
+
lineHeight: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ThemeSpacing {
|
|
38
|
+
density: "compact" | "default" | "spacious";
|
|
39
|
+
baseUnit: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ThemeBorders {
|
|
42
|
+
radius: string;
|
|
43
|
+
radiusSmall: string;
|
|
44
|
+
radiusLarge: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ThemeButtons {
|
|
47
|
+
primaryBg: string;
|
|
48
|
+
primaryText: string;
|
|
49
|
+
borderRadius: string;
|
|
50
|
+
paddingX: string;
|
|
51
|
+
paddingY: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Root theme object. Portable across hosts.
|
|
55
|
+
*/
|
|
56
|
+
export interface Theme {
|
|
57
|
+
$schema: string;
|
|
58
|
+
metadata: ThemeMetadata;
|
|
59
|
+
colors: ThemeColors;
|
|
60
|
+
typography: ThemeTypography;
|
|
61
|
+
spacing: ThemeSpacing;
|
|
62
|
+
borders: ThemeBorders;
|
|
63
|
+
buttons: ThemeButtons;
|
|
64
|
+
logo: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Component-level style overrides. Allows per-component customization that
|
|
68
|
+
* overrides global theme tokens.
|
|
69
|
+
*/
|
|
70
|
+
export interface ComponentOverride {
|
|
71
|
+
component: string;
|
|
72
|
+
styles: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/protocol/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function escapeHtml(text) {
|
|
4
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5
|
+
}
|
|
6
|
+
function camelToLabel(str) {
|
|
7
|
+
return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
8
|
+
}
|
|
9
|
+
exports.camelToLabel = camelToLabel;
|
|
10
|
+
exports.escapeHtml = escapeHtml;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Escapes HTML special characters in a string.
|
|
8
|
+
*
|
|
9
|
+
* @param text - The text to escape
|
|
10
|
+
* @returns Escaped HTML string
|
|
11
|
+
*/
|
|
12
|
+
export declare function escapeHtml(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Converts camelCase string to Title Case label.
|
|
15
|
+
*
|
|
16
|
+
* @param str - The camelCase string
|
|
17
|
+
* @returns Title Case label
|
|
18
|
+
*/
|
|
19
|
+
export declare function camelToLabel(str: string): string;
|
|
20
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Escapes HTML special characters in a string.
|
|
8
|
+
*
|
|
9
|
+
* @param text - The text to escape
|
|
10
|
+
* @returns Escaped HTML string
|
|
11
|
+
*/
|
|
12
|
+
export declare function escapeHtml(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Converts camelCase string to Title Case label.
|
|
15
|
+
*
|
|
16
|
+
* @param str - The camelCase string
|
|
17
|
+
* @returns Title Case label
|
|
18
|
+
*/
|
|
19
|
+
export declare function camelToLabel(str: string): string;
|
|
20
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/protocol/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function escapeHtml(text) {
|
|
2
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3
|
+
}
|
|
4
|
+
function camelToLabel(str) {
|
|
5
|
+
return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
camelToLabel,
|
|
9
|
+
escapeHtml
|
|
10
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const KNOWN_FONTS = {
|
|
4
|
+
"Salesforce Sans": "https://c1.sfdcstatic.com/etc/clientlibs/sfdc-aem-master/clientlibs_base/fonts/SalesforceSans.woff2"
|
|
5
|
+
};
|
|
6
|
+
function generateFontFaceRules(brand) {
|
|
7
|
+
const rules = [];
|
|
8
|
+
const processedFonts = /* @__PURE__ */ new Set();
|
|
9
|
+
const addFontFace = (font) => {
|
|
10
|
+
if (!font || typeof font !== "object") return;
|
|
11
|
+
if (!("name" in font)) return;
|
|
12
|
+
const fontObj = font;
|
|
13
|
+
const name = fontObj.name;
|
|
14
|
+
if (processedFonts.has(name)) return;
|
|
15
|
+
processedFonts.add(name);
|
|
16
|
+
const fontUrl = fontObj.url || fontObj.src || fontObj.fontUrl || fontObj.woff2;
|
|
17
|
+
if (fontUrl) {
|
|
18
|
+
rules.push(` @font-face {
|
|
19
|
+
font-family: "${name}";
|
|
20
|
+
src: url("${fontUrl}") format("woff2");
|
|
21
|
+
font-display: swap;
|
|
22
|
+
}`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (KNOWN_FONTS[name]) {
|
|
26
|
+
rules.push(` @font-face {
|
|
27
|
+
font-family: "${name}";
|
|
28
|
+
src: url("${KNOWN_FONTS[name]}") format("woff2");
|
|
29
|
+
font-display: swap;
|
|
30
|
+
}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (brand.baseFontFamily) {
|
|
34
|
+
addFontFace(brand.baseFontFamily);
|
|
35
|
+
}
|
|
36
|
+
const heading1 = brand.typography?.heading?.heading1;
|
|
37
|
+
if (heading1?.fontFamily) {
|
|
38
|
+
addFontFace(heading1.fontFamily);
|
|
39
|
+
}
|
|
40
|
+
return rules.length > 0 ? "\n" + rules.join("\n") + "\n" : "";
|
|
41
|
+
}
|
|
42
|
+
exports.KNOWN_FONTS = KNOWN_FONTS;
|
|
43
|
+
exports.generateFontFaceRules = generateFontFaceRules;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Brand } from '../protocol/brandTypes.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Known Salesforce fonts that can be loaded from Salesforce CDN.
|
|
4
|
+
* Maps font family name to font file URL.
|
|
5
|
+
*/
|
|
6
|
+
export declare const KNOWN_FONTS: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Generates @font-face rules for fonts that have a known source.
|
|
9
|
+
* Only emits rules for fonts actually used by the brand (body/heading).
|
|
10
|
+
*
|
|
11
|
+
* @param brand - The resolved brand object
|
|
12
|
+
* @returns CSS @font-face rules string (may be empty)
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateFontFaceRules(brand: Brand): string;
|
|
15
|
+
//# sourceMappingURL=fontFace.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Brand } from '../protocol/brandTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Known Salesforce fonts that can be loaded from Salesforce CDN.
|
|
4
|
+
* Maps font family name to font file URL.
|
|
5
|
+
*/
|
|
6
|
+
export declare const KNOWN_FONTS: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Generates @font-face rules for fonts that have a known source.
|
|
9
|
+
* Only emits rules for fonts actually used by the brand (body/heading).
|
|
10
|
+
*
|
|
11
|
+
* @param brand - The resolved brand object
|
|
12
|
+
* @returns CSS @font-face rules string (may be empty)
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateFontFaceRules(brand: Brand): string;
|
|
15
|
+
//# sourceMappingURL=fontFace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fontFace.d.ts","sourceRoot":"","sources":["../../src/runtime/fontFace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAmB,MAAM,wBAAwB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG9C,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAuD1D"}
|