@uni-design-system/uni-angular 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/schematics/ng-add/index.js +67 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uni-design-system/uni-angular",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@angular/core": "^21.2.0",
|
|
23
23
|
"@angular/forms": "^21.2.0",
|
|
24
24
|
"@emotion/css": "^11.0.0",
|
|
25
|
-
"@uni-design-system/uni-core": "5.
|
|
25
|
+
"@uni-design-system/uni-core": "^5.1.0"
|
|
26
26
|
},
|
|
27
27
|
"module": "fesm2022/uni-design-system-uni-angular.mjs",
|
|
28
28
|
"typings": "types/uni-design-system-uni-angular.d.ts",
|
|
@@ -520,6 +520,41 @@ var generateColors = (config) => {
|
|
|
520
520
|
* `generateThemes()` for the light+dark pair plus a {@link ContrastReport}.
|
|
521
521
|
*/
|
|
522
522
|
var generatePalette = (config) => generateColors(config);
|
|
523
|
+
var rgba = (hex, alpha) => {
|
|
524
|
+
const { red, green, blue } = hexToRgb(hex);
|
|
525
|
+
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Brand-tinted, theme-scoped elevation shadows (PRD §3.5.C).
|
|
529
|
+
*
|
|
530
|
+
* Light mode replaces the dead-neutral black stacks with a shadow ink pulled
|
|
531
|
+
* toward the brand hue — dark and low-chroma enough to read as shadow, tinted
|
|
532
|
+
* enough to kill the grey "mud" where shadows meet brand surfaces. Dark mode
|
|
533
|
+
* goes near-zero: elevation is carried by the surface lightness steps, with
|
|
534
|
+
* only a faint veil kept on floating overlays (menus/dialogs genuinely need
|
|
535
|
+
* separation) and the `warn` glow tinted by the theme's own error color.
|
|
536
|
+
*/
|
|
537
|
+
var generateShadows = (colors, mode = "light") => {
|
|
538
|
+
const error = colors["error"] ?? "#CC2827";
|
|
539
|
+
if (mode === "dark") return {
|
|
540
|
+
raised: "none",
|
|
541
|
+
menu: `0px 4px 12px ${rgba("#000000", .45)}`,
|
|
542
|
+
dialog: `0px 8px 28px ${rgba("#000000", .55)}`,
|
|
543
|
+
warn: `0 0 5px ${rgba(error, .55)}, inset 0 0 5px ${rgba(error, .35)}`
|
|
544
|
+
};
|
|
545
|
+
const { h } = hexToOklch(colors["primary"] ?? "#000000");
|
|
546
|
+
const ink = oklchToHex({
|
|
547
|
+
l: .22,
|
|
548
|
+
c: .035,
|
|
549
|
+
h
|
|
550
|
+
});
|
|
551
|
+
return {
|
|
552
|
+
raised: `${rgba(ink, .2)} 0px 2px 1px -1px, ${rgba(ink, .14)} 0px 1px 1px 0px, ${rgba(ink, .12)} 0px 1px 3px 0px`,
|
|
553
|
+
menu: `${rgba(ink, .2)} 0px 3px 3px -2px, ${rgba(ink, .14)} 0px 3px 4px 0px, ${rgba(ink, .12)} 0px 1px 8px 0px`,
|
|
554
|
+
dialog: `${rgba(ink, .2)} 0px 3px 5px -1px, ${rgba(ink, .14)} 0px 6px 10px 0px, ${rgba(ink, .12)} 0px 1px 18px 0px`,
|
|
555
|
+
warn: `0 0 5px ${rgba(error, .5)}, inset 0 0 5px ${rgba(error, .3)}`
|
|
556
|
+
};
|
|
557
|
+
};
|
|
523
558
|
var BaseTypography = {
|
|
524
559
|
"display-large": {
|
|
525
560
|
fontFamily: "Red Hat Display",
|
|
@@ -1209,6 +1244,8 @@ var generateThemes = (input) => {
|
|
|
1209
1244
|
lightColors,
|
|
1210
1245
|
darkColors,
|
|
1211
1246
|
radii: input.shape ? ShapeRadii[input.shape] : void 0,
|
|
1247
|
+
lightShadows: generateShadows(lightColors, "light"),
|
|
1248
|
+
darkShadows: generateShadows(darkColors, "dark"),
|
|
1212
1249
|
report: {
|
|
1213
1250
|
checks,
|
|
1214
1251
|
worstRatio,
|
|
@@ -1227,24 +1264,25 @@ var bordersLiteral = () => [
|
|
|
1227
1264
|
" * shared token picks up the change.",
|
|
1228
1265
|
" */",
|
|
1229
1266
|
"const borders = (colors: Colors): Borders => ({",
|
|
1230
|
-
" primary: `1px solid ${colors
|
|
1231
|
-
" secondary: `1px solid ${colors
|
|
1232
|
-
" tertiary: `1px solid ${colors
|
|
1233
|
-
" quaternary: `1px solid ${colors
|
|
1234
|
-
" warn: `1px solid ${colors
|
|
1235
|
-
" success: `1px solid ${colors
|
|
1236
|
-
" light: `1px solid ${colors
|
|
1267
|
+
" primary: `1px solid ${colors['primary']}`,",
|
|
1268
|
+
" secondary: `1px solid ${colors['secondary']}`,",
|
|
1269
|
+
" tertiary: `1px solid ${colors['tertiary']}`,",
|
|
1270
|
+
" quaternary: `1px solid ${colors['quaternary']}`,",
|
|
1271
|
+
" warn: `1px solid ${colors['warn']}`,",
|
|
1272
|
+
" success: `1px solid ${colors['success']}`,",
|
|
1273
|
+
" light: `1px solid ${colors['outline']}`,",
|
|
1237
1274
|
" dark: `1px solid ${colors['on-background']}`,",
|
|
1238
1275
|
" dotted: `1px dotted ${colors['on-background']}`,",
|
|
1239
1276
|
"});"
|
|
1240
1277
|
].join("\n");
|
|
1241
|
-
var themeExport = (exportName, displayName, colorsConst, radii) => [
|
|
1278
|
+
var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) => [
|
|
1242
1279
|
`export const ${exportName}: UniTheme = createTheme({`,
|
|
1243
1280
|
` id: '${exportName}',`,
|
|
1244
1281
|
` name: '${displayName}',`,
|
|
1245
1282
|
` colors: ${colorsConst},`,
|
|
1246
1283
|
` borders: borders(${colorsConst}),`,
|
|
1247
1284
|
` components: components(${colorsConst}),`,
|
|
1285
|
+
` shadows: ${shadowsConst},`,
|
|
1248
1286
|
...radii ? [" radii,"] : [],
|
|
1249
1287
|
"});"
|
|
1250
1288
|
].join("\n");
|
|
@@ -1259,7 +1297,7 @@ var themeExport = (exportName, displayName, colorsConst, radii) => [
|
|
|
1259
1297
|
*/
|
|
1260
1298
|
var emitThemeFile = (input) => {
|
|
1261
1299
|
const { darkMode = true, name = "Brand" } = input;
|
|
1262
|
-
const { lightColors, darkColors, radii, report } = generateThemes(input);
|
|
1300
|
+
const { lightColors, darkColors, radii, lightShadows, darkShadows, report } = generateThemes(input);
|
|
1263
1301
|
const id = name.replace(/\W+/g, "") || "Brand";
|
|
1264
1302
|
const regenerate = [
|
|
1265
1303
|
`--brand=${(Array.isArray(input.seed) ? input.seed : [input.seed]).join(",")}`,
|
|
@@ -1273,12 +1311,16 @@ var emitThemeFile = (input) => {
|
|
|
1273
1311
|
exportName: `${id}Light`,
|
|
1274
1312
|
displayName: `${name} Light`,
|
|
1275
1313
|
colorsConst: "lightColors",
|
|
1276
|
-
colors: lightColors
|
|
1314
|
+
colors: lightColors,
|
|
1315
|
+
shadowsConst: "lightShadows",
|
|
1316
|
+
shadows: lightShadows
|
|
1277
1317
|
}, ...darkMode ? [{
|
|
1278
1318
|
exportName: `${id}Dark`,
|
|
1279
1319
|
displayName: `${name} Dark`,
|
|
1280
1320
|
colorsConst: "darkColors",
|
|
1281
|
-
colors: darkColors
|
|
1321
|
+
colors: darkColors,
|
|
1322
|
+
shadowsConst: "darkShadows",
|
|
1323
|
+
shadows: darkShadows
|
|
1282
1324
|
}] : []];
|
|
1283
1325
|
return {
|
|
1284
1326
|
content: [
|
|
@@ -1295,16 +1337,19 @@ var emitThemeFile = (input) => {
|
|
|
1295
1337
|
" type Borders,",
|
|
1296
1338
|
" type Colors,",
|
|
1297
1339
|
" type ComponentThemes,",
|
|
1340
|
+
" type Shadows,",
|
|
1298
1341
|
" type UniTheme,",
|
|
1299
1342
|
"} from '@uni-design-system/uni-core';",
|
|
1300
1343
|
"",
|
|
1301
1344
|
...modes.map(({ colorsConst, colors }) => `const ${colorsConst}: Colors = {\n${recordLiteral(colors, " ")}\n};\n`),
|
|
1345
|
+
"/** Brand-tinted elevation shadows — theme-scoped, edit freely. */",
|
|
1346
|
+
...modes.map(({ shadowsConst, shadows }) => `const ${shadowsConst}: Shadows = {\n${recordLiteral(shadows, " ")}\n};\n`),
|
|
1302
1347
|
bordersLiteral(),
|
|
1303
1348
|
"",
|
|
1304
1349
|
"/**",
|
|
1305
1350
|
" * Sparse component overrides, deep-merged over Uni component defaults: only",
|
|
1306
1351
|
" * what you write here changes. Point components at your own primitives, e.g.:",
|
|
1307
|
-
" * button: { variants: { secondary: { border: `2px dashed ${colors
|
|
1352
|
+
" * button: { variants: { secondary: { border: `2px dashed ${colors['tertiary']}` } } },",
|
|
1308
1353
|
" * input: { options: { borderRadius: 'max' } },",
|
|
1309
1354
|
" */",
|
|
1310
1355
|
"const components = (colors: Colors): ComponentThemes => ({});",
|
|
@@ -1314,7 +1359,7 @@ var emitThemeFile = (input) => {
|
|
|
1314
1359
|
`const radii = {\n${recordLiteral(radii, " ")}\n};`,
|
|
1315
1360
|
""
|
|
1316
1361
|
] : [],
|
|
1317
|
-
...modes.map(({ exportName, displayName, colorsConst }) => `${themeExport(exportName, displayName, colorsConst, !!radii)}\n`),
|
|
1362
|
+
...modes.map(({ exportName, displayName, colorsConst, shadowsConst }) => `${themeExport(exportName, displayName, colorsConst, shadowsConst, !!radii)}\n`),
|
|
1318
1363
|
"/** First key wins as the default theme when registered via UNI_THEMES. */",
|
|
1319
1364
|
`export const ${id}Themes = { ${modes.map((m) => m.exportName).join(", ")} };`,
|
|
1320
1365
|
""
|
|
@@ -1399,26 +1444,29 @@ var ShadowMap = {
|
|
|
1399
1444
|
}
|
|
1400
1445
|
};
|
|
1401
1446
|
GetBoxShadows(ShadowMap["pressed"]), GetBoxShadows(ShadowMap["raised"]), GetBoxShadows(ShadowMap["focussed"]), GetBoxShadows(ShadowMap["navigation"]), GetBoxShadows(ShadowMap["modal"]);
|
|
1447
|
+
var darkColors = generatePalette({
|
|
1448
|
+
...BASE_PALETTE_CONFIG,
|
|
1449
|
+
mode: "dark"
|
|
1450
|
+
});
|
|
1402
1451
|
var DarkTheme = createTheme({
|
|
1403
1452
|
id: "DarkTheme",
|
|
1404
1453
|
name: "Dark Theme",
|
|
1405
|
-
colors:
|
|
1406
|
-
|
|
1407
|
-
mode: "dark"
|
|
1408
|
-
})
|
|
1454
|
+
colors: darkColors,
|
|
1455
|
+
shadows: generateShadows(darkColors, "dark")
|
|
1409
1456
|
});
|
|
1410
1457
|
var UniThemes = {
|
|
1411
1458
|
LightTheme: createTheme({
|
|
1412
1459
|
id: "LightTheme",
|
|
1413
1460
|
name: "Light Theme",
|
|
1414
|
-
colors: lightColors
|
|
1461
|
+
colors: lightColors,
|
|
1462
|
+
shadows: generateShadows(lightColors, "light")
|
|
1415
1463
|
}),
|
|
1416
1464
|
DarkTheme
|
|
1417
1465
|
};
|
|
1418
1466
|
Object.keys(UniThemes)[0];
|
|
1419
1467
|
//#endregion
|
|
1420
1468
|
//#region package.json
|
|
1421
|
-
var version = "5.
|
|
1469
|
+
var version = "5.1.0";
|
|
1422
1470
|
//#endregion
|
|
1423
1471
|
//#region schematics-src/ng-add/transforms.ts
|
|
1424
1472
|
var addDependencies = (packageJsonText, deps) => {
|