@uni-design-system/uni-core 5.1.0 → 5.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/cjs/index.cjs +152 -37
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +152 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/types/concepts/component/component.types.d.ts +1 -1
- package/dist/types/concepts/component/component.types.d.ts.map +1 -1
- package/dist/types/concepts/generation/dtcg.emitter.d.ts +26 -0
- package/dist/types/concepts/generation/dtcg.emitter.d.ts.map +1 -0
- package/dist/types/concepts/generation/index.d.ts +1 -0
- package/dist/types/concepts/generation/index.d.ts.map +1 -1
- package/dist/types/concepts/theme/themes/base.theme.d.ts +1 -0
- package/dist/types/concepts/theme/themes/base.theme.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -761,6 +761,28 @@ var Z_INDEX = {
|
|
|
761
761
|
overlay: 1080
|
|
762
762
|
};
|
|
763
763
|
//#endregion
|
|
764
|
+
//#region src/concepts/generation/dtcg.emitter.ts
|
|
765
|
+
var dimensionEntries = (record) => Object.fromEntries(Object.entries(record ?? {}).filter(([, value]) => value !== void 0 && value !== "none").map(([key, value]) => [key, {
|
|
766
|
+
$value: String(value),
|
|
767
|
+
$type: "dimension"
|
|
768
|
+
}]));
|
|
769
|
+
/**
|
|
770
|
+
* Render one theme mode's tokens as W3C DTCG JSON for external pipelines
|
|
771
|
+
* (Style Dictionary etc.). Token names are exactly Uni's `ColorToken` strings —
|
|
772
|
+
* one vocabulary everywhere. The native `UniTheme` object remains the primary,
|
|
773
|
+
* lossless output; this is the interop layer.
|
|
774
|
+
*/
|
|
775
|
+
var emitDtcgTokens = (input) => ({
|
|
776
|
+
color: Object.fromEntries(Object.entries(input.colors).filter(([, value]) => value !== void 0).map(([key, value]) => [key, {
|
|
777
|
+
$value: value,
|
|
778
|
+
$type: "color"
|
|
779
|
+
}])),
|
|
780
|
+
size: {
|
|
781
|
+
radius: dimensionEntries(input.radii),
|
|
782
|
+
spacing: dimensionEntries(input.spacing)
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
//#endregion
|
|
764
786
|
//#region src/concepts/generation/shadow.generator.ts
|
|
765
787
|
var rgba = (hex, alpha) => {
|
|
766
788
|
const { red, green, blue } = hexToRgb(hex);
|
|
@@ -995,6 +1017,90 @@ var buildComponents = (c) => ({
|
|
|
995
1017
|
transitionSpeed: .35,
|
|
996
1018
|
elevation: "md"
|
|
997
1019
|
} },
|
|
1020
|
+
breadcrumb: { options: {
|
|
1021
|
+
typeface: "label",
|
|
1022
|
+
color: "on-background-variant",
|
|
1023
|
+
currentColor: "on-background",
|
|
1024
|
+
separatorSymbol: "chevron_right",
|
|
1025
|
+
gap: "xs"
|
|
1026
|
+
} },
|
|
1027
|
+
appBar: { options: {
|
|
1028
|
+
color: "surface",
|
|
1029
|
+
height: 56,
|
|
1030
|
+
divider: "light",
|
|
1031
|
+
typeface: "title-large",
|
|
1032
|
+
padding: "md",
|
|
1033
|
+
gap: "md",
|
|
1034
|
+
elevation: void 0
|
|
1035
|
+
} },
|
|
1036
|
+
drawer: { options: {
|
|
1037
|
+
color: "surface",
|
|
1038
|
+
width: 280,
|
|
1039
|
+
divider: "light",
|
|
1040
|
+
elevation: "menu",
|
|
1041
|
+
padding: "md",
|
|
1042
|
+
backdrop: { background: "rgba(0, 0, 0, 0.4)" }
|
|
1043
|
+
} },
|
|
1044
|
+
avatar: {
|
|
1045
|
+
options: {
|
|
1046
|
+
borderRadius: "max",
|
|
1047
|
+
typeface: "subtitle-2",
|
|
1048
|
+
fallbackSymbol: "person"
|
|
1049
|
+
},
|
|
1050
|
+
variants: {
|
|
1051
|
+
primary: {
|
|
1052
|
+
backgroundColor: c["primary-container"],
|
|
1053
|
+
color: c["on-primary-container"]
|
|
1054
|
+
},
|
|
1055
|
+
secondary: {
|
|
1056
|
+
backgroundColor: c["secondary-container"],
|
|
1057
|
+
color: c["on-secondary-container"]
|
|
1058
|
+
},
|
|
1059
|
+
tertiary: {
|
|
1060
|
+
backgroundColor: c["tertiary-container"],
|
|
1061
|
+
color: c["on-tertiary-container"]
|
|
1062
|
+
},
|
|
1063
|
+
quaternary: {
|
|
1064
|
+
backgroundColor: c["surface-variant"],
|
|
1065
|
+
color: c["on-surface-variant"]
|
|
1066
|
+
},
|
|
1067
|
+
warn: {
|
|
1068
|
+
backgroundColor: c["warn-container"],
|
|
1069
|
+
color: c["on-warn-container"]
|
|
1070
|
+
},
|
|
1071
|
+
success: {
|
|
1072
|
+
backgroundColor: c["success-container"],
|
|
1073
|
+
color: c["on-success-container"]
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
sizes: {
|
|
1077
|
+
sm: {
|
|
1078
|
+
height: 24,
|
|
1079
|
+
width: 24,
|
|
1080
|
+
fontSize: 10
|
|
1081
|
+
},
|
|
1082
|
+
md: {
|
|
1083
|
+
height: 32,
|
|
1084
|
+
width: 32,
|
|
1085
|
+
fontSize: 13
|
|
1086
|
+
},
|
|
1087
|
+
lg: {
|
|
1088
|
+
height: 40,
|
|
1089
|
+
width: 40,
|
|
1090
|
+
fontSize: 16
|
|
1091
|
+
},
|
|
1092
|
+
xl: {
|
|
1093
|
+
height: 56,
|
|
1094
|
+
width: 56,
|
|
1095
|
+
fontSize: 22
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
avatarGroup: { options: {
|
|
1100
|
+
overlap: "sm",
|
|
1101
|
+
ringColor: "surface",
|
|
1102
|
+
ringWidth: 2
|
|
1103
|
+
} },
|
|
998
1104
|
checkbox: { options: { size: 20 } },
|
|
999
1105
|
dialog: { options: {
|
|
1000
1106
|
borderRadius: "lg",
|
|
@@ -1043,6 +1149,22 @@ var buildComponents = (c) => ({
|
|
|
1043
1149
|
focusOutline: `2px solid ${c.primary}`,
|
|
1044
1150
|
focusOutlineOffset: 2
|
|
1045
1151
|
} },
|
|
1152
|
+
textarea: { options: {
|
|
1153
|
+
rows: 3,
|
|
1154
|
+
resize: "vertical"
|
|
1155
|
+
} },
|
|
1156
|
+
tabs: { options: {
|
|
1157
|
+
typeface: "title-small",
|
|
1158
|
+
textColor: "on-surface-variant",
|
|
1159
|
+
activeTextColor: "primary",
|
|
1160
|
+
indicatorColor: "primary",
|
|
1161
|
+
indicatorThickness: "standard",
|
|
1162
|
+
divider: "light",
|
|
1163
|
+
gap: "sm",
|
|
1164
|
+
borderRadius: "none",
|
|
1165
|
+
padding: "md",
|
|
1166
|
+
activeColor: void 0
|
|
1167
|
+
} },
|
|
1046
1168
|
multiSelectDropdown: { options: {
|
|
1047
1169
|
textRole: "input",
|
|
1048
1170
|
textColor: "on-primary-surface",
|
|
@@ -1054,13 +1176,16 @@ var buildComponents = (c) => ({
|
|
|
1054
1176
|
} },
|
|
1055
1177
|
badge: { options: { borderRadius: "xxs" } },
|
|
1056
1178
|
button: {
|
|
1179
|
+
options: {
|
|
1180
|
+
borderRadius: "max",
|
|
1181
|
+
typeface: "button"
|
|
1182
|
+
},
|
|
1057
1183
|
fixed: {
|
|
1058
1184
|
position: "relative",
|
|
1059
1185
|
overflow: "hidden",
|
|
1060
1186
|
outline: "0",
|
|
1061
1187
|
border: "0",
|
|
1062
1188
|
cursor: "pointer",
|
|
1063
|
-
fontFamily: "Euphemia, sans-serif",
|
|
1064
1189
|
transition: "all 0.28s ease"
|
|
1065
1190
|
},
|
|
1066
1191
|
variants: {
|
|
@@ -1111,33 +1236,29 @@ var buildComponents = (c) => ({
|
|
|
1111
1236
|
sizes: {
|
|
1112
1237
|
sm: {
|
|
1113
1238
|
height: 22,
|
|
1114
|
-
borderRadius: 11,
|
|
1115
1239
|
fontSize: 12,
|
|
1116
1240
|
padding: "0 12px",
|
|
1117
|
-
fontFamily: "Euphemia Bold, sans-serif",
|
|
1118
1241
|
fontWeight: 600
|
|
1119
1242
|
},
|
|
1120
1243
|
md: {
|
|
1121
1244
|
height: 26,
|
|
1122
|
-
borderRadius: 13,
|
|
1123
1245
|
fontSize: 16,
|
|
1124
1246
|
padding: "0 16px"
|
|
1125
1247
|
},
|
|
1126
1248
|
lg: {
|
|
1127
1249
|
height: 36,
|
|
1128
|
-
borderRadius: 18,
|
|
1129
1250
|
fontSize: 18,
|
|
1130
1251
|
padding: "0 18px"
|
|
1131
1252
|
},
|
|
1132
1253
|
xl: {
|
|
1133
1254
|
height: 48,
|
|
1134
|
-
borderRadius: 24,
|
|
1135
1255
|
fontSize: 24,
|
|
1136
1256
|
padding: "0 22px"
|
|
1137
1257
|
}
|
|
1138
1258
|
}
|
|
1139
1259
|
},
|
|
1140
1260
|
iconButton: {
|
|
1261
|
+
options: { borderRadius: "max" },
|
|
1141
1262
|
variants: {
|
|
1142
1263
|
ghost: {
|
|
1143
1264
|
backgroundColor: "transparent",
|
|
@@ -1203,23 +1324,23 @@ var buildComponents = (c) => ({
|
|
|
1203
1324
|
fixed: { textFill: c["on-background"] },
|
|
1204
1325
|
variants: {
|
|
1205
1326
|
primary: {
|
|
1206
|
-
backgroundColor: "
|
|
1327
|
+
backgroundColor: c["primary-container"],
|
|
1207
1328
|
color: c.primary
|
|
1208
1329
|
},
|
|
1209
1330
|
secondary: {
|
|
1210
|
-
backgroundColor: "
|
|
1331
|
+
backgroundColor: c["secondary-container"],
|
|
1211
1332
|
color: c.secondary
|
|
1212
1333
|
},
|
|
1213
1334
|
tertiary: {
|
|
1214
|
-
backgroundColor: "
|
|
1335
|
+
backgroundColor: c["tertiary-container"],
|
|
1215
1336
|
color: c.tertiary
|
|
1216
1337
|
},
|
|
1217
1338
|
warn: {
|
|
1218
|
-
backgroundColor: "
|
|
1339
|
+
backgroundColor: c["warn-container"],
|
|
1219
1340
|
color: c.warn
|
|
1220
1341
|
},
|
|
1221
1342
|
success: {
|
|
1222
|
-
backgroundColor: "
|
|
1343
|
+
backgroundColor: c["success-container"],
|
|
1223
1344
|
color: c.success
|
|
1224
1345
|
}
|
|
1225
1346
|
},
|
|
@@ -1231,33 +1352,10 @@ var buildComponents = (c) => ({
|
|
|
1231
1352
|
}
|
|
1232
1353
|
},
|
|
1233
1354
|
card: {
|
|
1355
|
+
options: { borderRadius: "xs" },
|
|
1234
1356
|
fixed: {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
borderRadius: "8px",
|
|
1238
|
-
overflow: "hidden"
|
|
1239
|
-
},
|
|
1240
|
-
variants: {
|
|
1241
|
-
primary: {
|
|
1242
|
-
borderColor: c.primary,
|
|
1243
|
-
backgroundColor: c.background
|
|
1244
|
-
},
|
|
1245
|
-
secondary: {
|
|
1246
|
-
borderColor: c.secondary,
|
|
1247
|
-
backgroundColor: c.background
|
|
1248
|
-
},
|
|
1249
|
-
tertiary: {
|
|
1250
|
-
borderColor: c.tertiary,
|
|
1251
|
-
backgroundColor: c.background
|
|
1252
|
-
},
|
|
1253
|
-
warn: {
|
|
1254
|
-
borderColor: c.warn,
|
|
1255
|
-
backgroundColor: c.background
|
|
1256
|
-
},
|
|
1257
|
-
success: {
|
|
1258
|
-
borderColor: c.success,
|
|
1259
|
-
backgroundColor: c.background
|
|
1260
|
-
}
|
|
1357
|
+
overflow: "hidden",
|
|
1358
|
+
backgroundColor: c.background
|
|
1261
1359
|
}
|
|
1262
1360
|
},
|
|
1263
1361
|
cardHeader: {
|
|
@@ -1328,6 +1426,21 @@ var buildComponents = (c) => ({
|
|
|
1328
1426
|
currentPageBorder: "light",
|
|
1329
1427
|
currentPageBorderRadius: "xs"
|
|
1330
1428
|
} },
|
|
1429
|
+
slider: { options: {
|
|
1430
|
+
color: "primary",
|
|
1431
|
+
trackColor: "surface-variant",
|
|
1432
|
+
borderRadius: "max",
|
|
1433
|
+
trackHeight: 4,
|
|
1434
|
+
thumbSize: 16
|
|
1435
|
+
} },
|
|
1436
|
+
skeleton: { options: {
|
|
1437
|
+
color: "surface-variant",
|
|
1438
|
+
highlightColor: "surface",
|
|
1439
|
+
borderRadius: "xs",
|
|
1440
|
+
animation: "shimmer",
|
|
1441
|
+
duration: 1.4,
|
|
1442
|
+
gap: "sm"
|
|
1443
|
+
} },
|
|
1331
1444
|
snackbar: { options: {
|
|
1332
1445
|
bottomPosition: 40,
|
|
1333
1446
|
transitionDelay: "0.35s",
|
|
@@ -1379,6 +1492,7 @@ var createThemeFromPalette = (config) => {
|
|
|
1379
1492
|
id: config.id ?? "CustomTheme",
|
|
1380
1493
|
name: config.name ?? "Custom Theme",
|
|
1381
1494
|
colors,
|
|
1495
|
+
radii: config.radii,
|
|
1382
1496
|
shadows: generateShadows(colors, config.mode ?? "light"),
|
|
1383
1497
|
icons: config.icons
|
|
1384
1498
|
});
|
|
@@ -1850,6 +1964,6 @@ var debounce = (callback, timeout) => {
|
|
|
1850
1964
|
};
|
|
1851
1965
|
};
|
|
1852
1966
|
//#endregion
|
|
1853
|
-
export { BASE_PALETTE_CONFIG, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitThemeFile, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, toTypeface, toTypefaces, uniColor };
|
|
1967
|
+
export { BASE_PALETTE_CONFIG, BaseTheme, CategoryChroma, CategoryLightness, CategorySaturation, DarkTheme, DefaultThemeId, FontWeightMap, HSLAToString, HSLToHex, HSLToRGB, LightTheme, RGBToHSL, RGBToString, RoleHues, ShadowCssMap, ShadowMap, ShapeRadii, UniThemes, Z_INDEX, classifyScheme, collapseFadeOut, contrastRatio, createTheme, createThemeFromPalette, cycle, darkColors, debounce, emitDtcgTokens, emitThemeFile, expandFadeIn, fadeIn, fadeOut, generateColors, generatePalette, generateShadows, generateThemes, generateUniThemes, getAnalogousHues, getComplimentaryHue, getDeviceOrientation, getDeviceSize, getSplitComplimentaryHues, getTriadicHues, getValue, gradient, hexToHSL, hexToOklch, hexToRgb, inferCategory, lightColors, oklchToHex, randomRangeValue, relativeLuminance, removeInputPlatformStyling, rgbToHex, schemeHues, toTypeface, toTypefaces, uniColor };
|
|
1854
1968
|
|
|
1855
1969
|
//# sourceMappingURL=index.js.map
|