@genesislcap/foundation-ui 14.372.0 → 14.373.1-FUI-2457.1
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/custom-elements.json +1 -1
- package/dist/dts/design-system-provider/design-system-provider.utils.d.ts +1 -1
- package/dist/dts/design-system-provider/design-system-provider.utils.d.ts.map +1 -1
- package/dist/esm/design-system-provider/default-design-tokens.json +60 -0
- package/dist/esm/design-system-provider/design-system-provider.utils.js +20 -6
- package/package.json +18 -18
|
@@ -14506,7 +14506,7 @@
|
|
|
14506
14506
|
{
|
|
14507
14507
|
"name": "config",
|
|
14508
14508
|
"type": {
|
|
14509
|
-
"text": "DesignTokensConfig"
|
|
14509
|
+
"text": "Partial<DesignTokensConfig> | DesignTokensConfig"
|
|
14510
14510
|
}
|
|
14511
14511
|
}
|
|
14512
14512
|
]
|
|
@@ -123,5 +123,5 @@ export declare const selectCustomToken: (...path: string[]) => {
|
|
|
123
123
|
$value: TokenValue;
|
|
124
124
|
$type?: string;
|
|
125
125
|
};
|
|
126
|
-
export declare const configureDesignSystem: (provider: HTMLElement, config: DesignTokensConfig) => void;
|
|
126
|
+
export declare const configureDesignSystem: (provider: HTMLElement, config: Partial<DesignTokensConfig> | DesignTokensConfig) => void;
|
|
127
127
|
//# sourceMappingURL=design-system-provider.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system-provider.utils.d.ts","sourceRoot":"","sources":["../../../src/design-system-provider/design-system-provider.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EA8BX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAc,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAoB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"design-system-provider.utils.d.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;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,MAAM,EAAE;YAOQ,UAAU;YAAU,MAAM;CAQpF,CAAC;AAiBF,eAAO,MAAM,qBAAqB,GAChC,UAAU,WAAW,EACrB,QAAQ,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,SAkGzD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"design_tokens": {
|
|
3
|
+
"color": {
|
|
4
|
+
"accent": {
|
|
5
|
+
"$value": "#0EAFE2",
|
|
6
|
+
"$type": "color"
|
|
7
|
+
},
|
|
8
|
+
"neutral": {
|
|
9
|
+
"$value": "#7C909B",
|
|
10
|
+
"$type": "color"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"fontFamily": {
|
|
14
|
+
"bodyFont": {
|
|
15
|
+
"$value": "Roboto, \"Segoe UI\", Arial, Helvetica, sans-serif",
|
|
16
|
+
"$type": "fontFamily"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"typography": {
|
|
20
|
+
"baseFontSize": {
|
|
21
|
+
"$value": "14px",
|
|
22
|
+
"$type": "dimension"
|
|
23
|
+
},
|
|
24
|
+
"baseLineHeight": {
|
|
25
|
+
"$value": "20px",
|
|
26
|
+
"$type": "dimension"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"mode": {
|
|
30
|
+
"luminance": {
|
|
31
|
+
"$value": 0.23,
|
|
32
|
+
"$type": "number"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"style": {
|
|
36
|
+
"density": {
|
|
37
|
+
"$value": 0,
|
|
38
|
+
"$type": "number"
|
|
39
|
+
},
|
|
40
|
+
"baseHeightMultiplier": {
|
|
41
|
+
"$value": 10,
|
|
42
|
+
"$type": "number"
|
|
43
|
+
},
|
|
44
|
+
"borderRadius": {
|
|
45
|
+
"$value": 4,
|
|
46
|
+
"$type": "number"
|
|
47
|
+
},
|
|
48
|
+
"strokeWidth": {
|
|
49
|
+
"$value": 1,
|
|
50
|
+
"$type": "number"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"space": {
|
|
54
|
+
"designUnit": {
|
|
55
|
+
"$value": 4,
|
|
56
|
+
"$type": "number"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { TypeRampValues } from '@genesislcap/foundation-utils';
|
|
2
|
+
import { TypeRampValues, deepMerge } from '@genesislcap/foundation-utils';
|
|
3
3
|
import { parseColorHexRGB } from '@microsoft/fast-colors';
|
|
4
4
|
import { PaletteRGB, SwatchRGB, accentPalette, controlCornerRadius, designUnit, neutralPalette, baseLayerLuminance, baseHeightMultiplier, density, strokeWidth, bodyFont, typeRampBaseFontSize, typeRampBaseLineHeight, typeRampMinus1FontSize, typeRampMinus1LineHeight, typeRampMinus2FontSize, typeRampMinus2LineHeight, typeRampPlus1FontSize, typeRampPlus1LineHeight, typeRampPlus2FontSize, typeRampPlus2LineHeight, typeRampPlus3FontSize, typeRampPlus3LineHeight, typeRampPlus4FontSize, typeRampPlus4LineHeight, typeRampPlus5FontSize, typeRampPlus5LineHeight, typeRampPlus6FontSize, typeRampPlus6LineHeight, } from '@microsoft/fast-components';
|
|
5
5
|
import { observable } from '@microsoft/fast-element';
|
|
6
|
+
import defaultDesignTokens from './default-design-tokens.json';
|
|
6
7
|
/**
|
|
7
8
|
* Observable class for design tokens config that components can subscribe to.
|
|
8
9
|
* @public
|
|
@@ -208,8 +209,21 @@ export const selectCustomToken = (...path) => {
|
|
|
208
209
|
}
|
|
209
210
|
return select(path, config.customTokens);
|
|
210
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Deep merges two design tokens config objects, with the source config taking precedence over defaults.
|
|
214
|
+
* This ensures all required tokens are present even if the incoming config is incomplete.
|
|
215
|
+
*
|
|
216
|
+
* @param defaults - The default design tokens config
|
|
217
|
+
* @param source - The incoming design tokens config to merge
|
|
218
|
+
* @returns A merged DesignTokensConfig with all required tokens
|
|
219
|
+
*/
|
|
220
|
+
const mergeDesignTokens = (defaults, source) => {
|
|
221
|
+
return deepMerge(defaults, source);
|
|
222
|
+
};
|
|
211
223
|
export const configureDesignSystem = (provider, config) => {
|
|
212
|
-
|
|
224
|
+
// Merge incoming config with defaults to ensure all required tokens are present
|
|
225
|
+
const mergedConfig = mergeDesignTokens(defaultDesignTokens, config);
|
|
226
|
+
const designTokens = mergedConfig.design_tokens;
|
|
213
227
|
accentPalette.setValueFor(provider, paletteFromHex(designTokens.color.accent.$value));
|
|
214
228
|
neutralPalette.setValueFor(provider, paletteFromHex(designTokens.color.neutral.$value));
|
|
215
229
|
bodyFont.setValueFor(provider, designTokens.fontFamily.bodyFont.$value);
|
|
@@ -240,9 +254,9 @@ export const configureDesignSystem = (provider, config) => {
|
|
|
240
254
|
typeRampPlus6FontSize.setValueFor(provider, getTypeRampValue(baseFontSize, TypeRampValues.plusSix));
|
|
241
255
|
typeRampPlus6LineHeight.setValueFor(provider, getTypeRampValue(baseLineHeight, TypeRampValues.plusSix));
|
|
242
256
|
// Apply custom tokens if provided
|
|
243
|
-
if (
|
|
244
|
-
applyCustomTokens(provider,
|
|
257
|
+
if (mergedConfig.customTokens) {
|
|
258
|
+
applyCustomTokens(provider, mergedConfig.customTokens);
|
|
245
259
|
}
|
|
246
|
-
// Update the observable value with full config - FAST will automatically notify all subscribers
|
|
247
|
-
designTokensObservable.value = structuredClone(
|
|
260
|
+
// Update the observable value with full merged config - FAST will automatically notify all subscribers
|
|
261
|
+
designTokensObservable.value = structuredClone(mergedConfig);
|
|
248
262
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-ui",
|
|
3
3
|
"description": "Genesis Foundation UI",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.373.1-FUI-2457.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@genesislcap/foundation-testing": "14.
|
|
87
|
-
"@genesislcap/genx": "14.
|
|
88
|
-
"@genesislcap/rollup-builder": "14.
|
|
89
|
-
"@genesislcap/ts-builder": "14.
|
|
90
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
91
|
-
"@genesislcap/vite-builder": "14.
|
|
92
|
-
"@genesislcap/webpack-builder": "14.
|
|
86
|
+
"@genesislcap/foundation-testing": "14.373.1-FUI-2457.1",
|
|
87
|
+
"@genesislcap/genx": "14.373.1-FUI-2457.1",
|
|
88
|
+
"@genesislcap/rollup-builder": "14.373.1-FUI-2457.1",
|
|
89
|
+
"@genesislcap/ts-builder": "14.373.1-FUI-2457.1",
|
|
90
|
+
"@genesislcap/uvu-playwright-builder": "14.373.1-FUI-2457.1",
|
|
91
|
+
"@genesislcap/vite-builder": "14.373.1-FUI-2457.1",
|
|
92
|
+
"@genesislcap/webpack-builder": "14.373.1-FUI-2457.1",
|
|
93
93
|
"copyfiles": "^2.4.1"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
@@ -98,15 +98,15 @@
|
|
|
98
98
|
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
|
99
99
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
|
100
100
|
"@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
|
|
101
|
-
"@genesislcap/expression-builder": "14.
|
|
102
|
-
"@genesislcap/foundation-comms": "14.
|
|
103
|
-
"@genesislcap/foundation-criteria": "14.
|
|
104
|
-
"@genesislcap/foundation-errors": "14.
|
|
105
|
-
"@genesislcap/foundation-events": "14.
|
|
106
|
-
"@genesislcap/foundation-logger": "14.
|
|
107
|
-
"@genesislcap/foundation-notifications": "14.
|
|
108
|
-
"@genesislcap/foundation-user": "14.
|
|
109
|
-
"@genesislcap/foundation-utils": "14.
|
|
101
|
+
"@genesislcap/expression-builder": "14.373.1-FUI-2457.1",
|
|
102
|
+
"@genesislcap/foundation-comms": "14.373.1-FUI-2457.1",
|
|
103
|
+
"@genesislcap/foundation-criteria": "14.373.1-FUI-2457.1",
|
|
104
|
+
"@genesislcap/foundation-errors": "14.373.1-FUI-2457.1",
|
|
105
|
+
"@genesislcap/foundation-events": "14.373.1-FUI-2457.1",
|
|
106
|
+
"@genesislcap/foundation-logger": "14.373.1-FUI-2457.1",
|
|
107
|
+
"@genesislcap/foundation-notifications": "14.373.1-FUI-2457.1",
|
|
108
|
+
"@genesislcap/foundation-user": "14.373.1-FUI-2457.1",
|
|
109
|
+
"@genesislcap/foundation-utils": "14.373.1-FUI-2457.1",
|
|
110
110
|
"@microsoft/fast-colors": "5.3.1",
|
|
111
111
|
"@microsoft/fast-components": "2.30.6",
|
|
112
112
|
"@microsoft/fast-element": "1.14.0",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"access": "public"
|
|
129
129
|
},
|
|
130
130
|
"customElements": "dist/custom-elements.json",
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "e90b6462c1782f491ef86a83a1b6f9fd43f42c10"
|
|
132
132
|
}
|