@gjfleo/theme 0.2.1 → 0.2.4
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/naive-ui/index.js +11 -1201
- package/dist/unocss/index.d.ts +2 -0
- package/dist/unocss/index.js +9 -1
- package/package.json +10 -9
package/dist/naive-ui/index.js
CHANGED
|
@@ -98,8 +98,8 @@ var require_unwrap_element = __commonJS((exports) => {
|
|
|
98
98
|
var require_happens_in = __commonJS((exports) => {
|
|
99
99
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
100
100
|
exports.happensIn = happensIn;
|
|
101
|
-
function happensIn(
|
|
102
|
-
let { target } =
|
|
101
|
+
function happensIn(e, dataSetPropName) {
|
|
102
|
+
let { target } = e;
|
|
103
103
|
while (target) {
|
|
104
104
|
if (target.dataset) {
|
|
105
105
|
if (target.dataset[dataSetPropName] !== undefined)
|
|
@@ -521,8 +521,8 @@ var require_color = __commonJS((exports) => {
|
|
|
521
521
|
return [roundDeg(i[1]), roundPercent(i[5]), roundPercent(i[9]), 1];
|
|
522
522
|
}
|
|
523
523
|
throw new Error(`[seemly/hsla]: Invalid color value ${color}.`);
|
|
524
|
-
} catch (
|
|
525
|
-
throw
|
|
524
|
+
} catch (e) {
|
|
525
|
+
throw e;
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
function hsva(color) {
|
|
@@ -539,8 +539,8 @@ var require_color = __commonJS((exports) => {
|
|
|
539
539
|
return [roundDeg(i[1]), roundPercent(i[5]), roundPercent(i[9]), 1];
|
|
540
540
|
}
|
|
541
541
|
throw new Error(`[seemly/hsva]: Invalid color value ${color}.`);
|
|
542
|
-
} catch (
|
|
543
|
-
throw
|
|
542
|
+
} catch (e) {
|
|
543
|
+
throw e;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
function rgba(color) {
|
|
@@ -588,8 +588,8 @@ var require_color = __commonJS((exports) => {
|
|
|
588
588
|
return [...(0, convert_1.hsv2rgb)(h, s, v), a];
|
|
589
589
|
}
|
|
590
590
|
throw new Error(`[seemly/rgba]: Invalid color value ${color}.`);
|
|
591
|
-
} catch (
|
|
592
|
-
throw
|
|
591
|
+
} catch (e) {
|
|
592
|
+
throw e;
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
595
|
function normalizeAlpha(alphaValue) {
|
|
@@ -942,1217 +942,27 @@ var DEFAULT_LAYERS = {
|
|
|
942
942
|
[LAYER_SHORTCUTS]: -10,
|
|
943
943
|
[LAYER_DEFAULT]: 0
|
|
944
944
|
};
|
|
945
|
-
var defaultSplitRE = /[\\:]?[\s'"`;{}]+/g;
|
|
946
|
-
function splitCode(code) {
|
|
947
|
-
return code.split(defaultSplitRE);
|
|
948
|
-
}
|
|
949
|
-
var extractorSplit = {
|
|
950
|
-
name: "@unocss/core/extractor-split",
|
|
951
|
-
order: 0,
|
|
952
|
-
extract({ code }) {
|
|
953
|
-
return splitCode(code);
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
function toArray(value = []) {
|
|
957
|
-
return Array.isArray(value) ? value : [value];
|
|
958
|
-
}
|
|
959
|
-
function uniq(value) {
|
|
960
|
-
return Array.from(new Set(value));
|
|
961
|
-
}
|
|
962
|
-
function uniqueBy(array, equalFn) {
|
|
963
|
-
return array.reduce((acc, cur) => {
|
|
964
|
-
const index = acc.findIndex((item) => equalFn(cur, item));
|
|
965
|
-
if (index === -1)
|
|
966
|
-
acc.push(cur);
|
|
967
|
-
return acc;
|
|
968
|
-
}, []);
|
|
969
|
-
}
|
|
970
|
-
function isString(s) {
|
|
971
|
-
return typeof s === "string";
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
class CountableSet extends Set {
|
|
975
|
-
_map = /* @__PURE__ */ new Map;
|
|
976
|
-
constructor(values) {
|
|
977
|
-
super();
|
|
978
|
-
if (values) {
|
|
979
|
-
for (const key of values) {
|
|
980
|
-
this.add(key);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
add(key) {
|
|
985
|
-
this._map.set(key, (this._map.get(key) ?? 0) + 1);
|
|
986
|
-
return super.add(key);
|
|
987
|
-
}
|
|
988
|
-
delete(key) {
|
|
989
|
-
if (!this._map.has(key)) {
|
|
990
|
-
return false;
|
|
991
|
-
}
|
|
992
|
-
this._map.delete(key);
|
|
993
|
-
return super.delete(key);
|
|
994
|
-
}
|
|
995
|
-
clear() {
|
|
996
|
-
this._map.clear();
|
|
997
|
-
super.clear();
|
|
998
|
-
}
|
|
999
|
-
getCount(key) {
|
|
1000
|
-
return this._map.get(key) ?? 0;
|
|
1001
|
-
}
|
|
1002
|
-
setCount(key, count) {
|
|
1003
|
-
this._map.set(key, count);
|
|
1004
|
-
return super.add(key);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
function isCountableSet(value) {
|
|
1008
|
-
return value instanceof CountableSet;
|
|
1009
|
-
}
|
|
1010
|
-
function escapeSelector(str) {
|
|
1011
|
-
const length = str.length;
|
|
1012
|
-
let index = -1;
|
|
1013
|
-
let codeUnit;
|
|
1014
|
-
let result = "";
|
|
1015
|
-
const firstCodeUnit = str.charCodeAt(0);
|
|
1016
|
-
while (++index < length) {
|
|
1017
|
-
codeUnit = str.charCodeAt(index);
|
|
1018
|
-
if (codeUnit === 0) {
|
|
1019
|
-
result += "�";
|
|
1020
|
-
continue;
|
|
1021
|
-
}
|
|
1022
|
-
if (codeUnit === 37) {
|
|
1023
|
-
result += "\\%";
|
|
1024
|
-
continue;
|
|
1025
|
-
}
|
|
1026
|
-
if (codeUnit === 44) {
|
|
1027
|
-
result += "\\,";
|
|
1028
|
-
continue;
|
|
1029
|
-
}
|
|
1030
|
-
if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45) {
|
|
1031
|
-
result += `\\${codeUnit.toString(16)} `;
|
|
1032
|
-
continue;
|
|
1033
|
-
}
|
|
1034
|
-
if (index === 0 && length === 1 && codeUnit === 45) {
|
|
1035
|
-
result += `\\${str.charAt(index)}`;
|
|
1036
|
-
continue;
|
|
1037
|
-
}
|
|
1038
|
-
if (codeUnit >= 128 || codeUnit === 45 || codeUnit === 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
|
|
1039
|
-
result += str.charAt(index);
|
|
1040
|
-
continue;
|
|
1041
|
-
}
|
|
1042
|
-
result += `\\${str.charAt(index)}`;
|
|
1043
|
-
}
|
|
1044
|
-
return result;
|
|
1045
|
-
}
|
|
1046
|
-
var e = escapeSelector;
|
|
1047
|
-
function createNanoEvents() {
|
|
1048
|
-
return {
|
|
1049
|
-
events: {},
|
|
1050
|
-
emit(event, ...args) {
|
|
1051
|
-
(this.events[event] || []).forEach((i) => i(...args));
|
|
1052
|
-
},
|
|
1053
|
-
on(event, cb) {
|
|
1054
|
-
(this.events[event] = this.events[event] || []).push(cb);
|
|
1055
|
-
return () => this.events[event] = (this.events[event] || []).filter((i) => i !== cb);
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
function normalizeVariant(variant) {
|
|
1060
|
-
return typeof variant === "function" ? { match: variant } : variant;
|
|
1061
|
-
}
|
|
1062
|
-
function isRawUtil(util) {
|
|
1063
|
-
return util.length === 3;
|
|
1064
|
-
}
|
|
1065
|
-
function notNull(value) {
|
|
1066
|
-
return value != null;
|
|
1067
|
-
}
|
|
1068
|
-
function noop() {}
|
|
1069
|
-
class TwoKeyMap {
|
|
1070
|
-
_map = /* @__PURE__ */ new Map;
|
|
1071
|
-
get(key1, key2) {
|
|
1072
|
-
const m2 = this._map.get(key1);
|
|
1073
|
-
if (m2)
|
|
1074
|
-
return m2.get(key2);
|
|
1075
|
-
}
|
|
1076
|
-
getFallback(key1, key2, fallback) {
|
|
1077
|
-
let m2 = this._map.get(key1);
|
|
1078
|
-
if (!m2) {
|
|
1079
|
-
m2 = /* @__PURE__ */ new Map;
|
|
1080
|
-
this._map.set(key1, m2);
|
|
1081
|
-
}
|
|
1082
|
-
if (!m2.has(key2))
|
|
1083
|
-
m2.set(key2, fallback);
|
|
1084
|
-
return m2.get(key2);
|
|
1085
|
-
}
|
|
1086
|
-
set(key1, key2, value) {
|
|
1087
|
-
let m2 = this._map.get(key1);
|
|
1088
|
-
if (!m2) {
|
|
1089
|
-
m2 = /* @__PURE__ */ new Map;
|
|
1090
|
-
this._map.set(key1, m2);
|
|
1091
|
-
}
|
|
1092
|
-
m2.set(key2, value);
|
|
1093
|
-
return this;
|
|
1094
|
-
}
|
|
1095
|
-
has(key1, key2) {
|
|
1096
|
-
return this._map.get(key1)?.has(key2);
|
|
1097
|
-
}
|
|
1098
|
-
delete(key1, key2) {
|
|
1099
|
-
return this._map.get(key1)?.delete(key2) || false;
|
|
1100
|
-
}
|
|
1101
|
-
deleteTop(key1) {
|
|
1102
|
-
return this._map.delete(key1);
|
|
1103
|
-
}
|
|
1104
|
-
map(fn) {
|
|
1105
|
-
return Array.from(this._map.entries()).flatMap(([k1, m2]) => Array.from(m2.entries()).map(([k2, v]) => {
|
|
1106
|
-
return fn(v, k1, k2);
|
|
1107
|
-
}));
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
class BetterMap extends Map {
|
|
1112
|
-
getFallback(key, fallback) {
|
|
1113
|
-
const v = this.get(key);
|
|
1114
|
-
if (v === undefined) {
|
|
1115
|
-
this.set(key, fallback);
|
|
1116
|
-
return fallback;
|
|
1117
|
-
}
|
|
1118
|
-
return v;
|
|
1119
|
-
}
|
|
1120
|
-
map(mapFn) {
|
|
1121
|
-
const result = [];
|
|
1122
|
-
this.forEach((v, k) => {
|
|
1123
|
-
result.push(mapFn(v, k));
|
|
1124
|
-
});
|
|
1125
|
-
return result;
|
|
1126
|
-
}
|
|
1127
|
-
flatMap(mapFn) {
|
|
1128
|
-
const result = [];
|
|
1129
|
-
this.forEach((v, k) => {
|
|
1130
|
-
result.push(...mapFn(v, k));
|
|
1131
|
-
});
|
|
1132
|
-
return result;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
function normalizeCSSEntries(obj) {
|
|
1136
|
-
if (isString(obj))
|
|
1137
|
-
return obj;
|
|
1138
|
-
return (!Array.isArray(obj) ? Object.entries(obj) : obj).filter((i) => i[1] != null);
|
|
1139
|
-
}
|
|
1140
|
-
function normalizeCSSValues(obj) {
|
|
1141
|
-
if (Array.isArray(obj)) {
|
|
1142
|
-
if (obj.find((i) => !Array.isArray(i) || Array.isArray(i[0])))
|
|
1143
|
-
return obj.map((i) => normalizeCSSEntries(i));
|
|
1144
|
-
else
|
|
1145
|
-
return [obj];
|
|
1146
|
-
} else {
|
|
1147
|
-
return [normalizeCSSEntries(obj)];
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
function clearIdenticalEntries(entry) {
|
|
1151
|
-
return entry.filter(([k, v], idx) => {
|
|
1152
|
-
if (k.startsWith("$$"))
|
|
1153
|
-
return false;
|
|
1154
|
-
for (let i = idx - 1;i >= 0; i--) {
|
|
1155
|
-
if (entry[i][0] === k && entry[i][1] === v)
|
|
1156
|
-
return false;
|
|
1157
|
-
}
|
|
1158
|
-
return true;
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
function entriesToCss(arr) {
|
|
1162
|
-
if (arr == null)
|
|
1163
|
-
return "";
|
|
1164
|
-
return clearIdenticalEntries(arr).map(([key, value]) => value != null && typeof value !== "function" ? `${key}:${value};` : undefined).filter(Boolean).join("");
|
|
1165
|
-
}
|
|
1166
945
|
function isObject(item) {
|
|
1167
946
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
1168
947
|
}
|
|
1169
948
|
function mergeDeep(original, patch, mergeArray = false) {
|
|
1170
949
|
const o = original;
|
|
1171
950
|
const p = patch;
|
|
1172
|
-
if (Array.isArray(p))
|
|
951
|
+
if (Array.isArray(p))
|
|
1173
952
|
if (mergeArray && Array.isArray(p))
|
|
1174
953
|
return [...o, ...p];
|
|
1175
954
|
else
|
|
1176
955
|
return [...p];
|
|
1177
|
-
}
|
|
1178
956
|
const output = { ...o };
|
|
1179
|
-
if (isObject(o) && isObject(p))
|
|
957
|
+
if (isObject(o) && isObject(p))
|
|
1180
958
|
Object.keys(p).forEach((key) => {
|
|
1181
959
|
if (isObject(o[key]) && isObject(p[key]) || Array.isArray(o[key]) && Array.isArray(p[key]))
|
|
1182
960
|
output[key] = mergeDeep(o[key], p[key], mergeArray);
|
|
1183
961
|
else
|
|
1184
962
|
Object.assign(output, { [key]: p[key] });
|
|
1185
963
|
});
|
|
1186
|
-
}
|
|
1187
964
|
return output;
|
|
1188
965
|
}
|
|
1189
|
-
function clone(val) {
|
|
1190
|
-
let k, out, tmp;
|
|
1191
|
-
if (Array.isArray(val)) {
|
|
1192
|
-
out = Array.from({ length: k = val.length });
|
|
1193
|
-
while (k--)
|
|
1194
|
-
out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
1195
|
-
return out;
|
|
1196
|
-
}
|
|
1197
|
-
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
1198
|
-
out = {};
|
|
1199
|
-
for (k in val) {
|
|
1200
|
-
if (k === "__proto__") {
|
|
1201
|
-
Object.defineProperty(out, k, {
|
|
1202
|
-
value: clone(val[k]),
|
|
1203
|
-
configurable: true,
|
|
1204
|
-
enumerable: true,
|
|
1205
|
-
writable: true
|
|
1206
|
-
});
|
|
1207
|
-
} else {
|
|
1208
|
-
out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
return out;
|
|
1212
|
-
}
|
|
1213
|
-
return val;
|
|
1214
|
-
}
|
|
1215
|
-
function isStaticRule(rule) {
|
|
1216
|
-
return isString(rule[0]);
|
|
1217
|
-
}
|
|
1218
|
-
function isStaticShortcut(sc) {
|
|
1219
|
-
return isString(sc[0]);
|
|
1220
|
-
}
|
|
1221
|
-
var regexCache = {};
|
|
1222
|
-
function makeRegexClassGroup(separators = ["-", ":"]) {
|
|
1223
|
-
const key = separators.join("|");
|
|
1224
|
-
if (!regexCache[key])
|
|
1225
|
-
regexCache[key] = new RegExp(`((?:[!@<~\\w+:_-]|\\[&?>?:?\\S*\\])+?)(${key})\\(((?:[~!<>\\w\\s:/\\\\,%#.$?-]|\\[[^\\]]*?\\])+?)\\)(?!\\s*?=>)`, "gm");
|
|
1226
|
-
regexCache[key].lastIndex = 0;
|
|
1227
|
-
return regexCache[key];
|
|
1228
|
-
}
|
|
1229
|
-
function parseVariantGroup(str, separators = ["-", ":"], depth = 5) {
|
|
1230
|
-
const regexClassGroup = makeRegexClassGroup(separators);
|
|
1231
|
-
let hasChanged;
|
|
1232
|
-
let content = str.toString();
|
|
1233
|
-
const prefixes = /* @__PURE__ */ new Set;
|
|
1234
|
-
const groupsByOffset = /* @__PURE__ */ new Map;
|
|
1235
|
-
do {
|
|
1236
|
-
hasChanged = false;
|
|
1237
|
-
content = content.replace(regexClassGroup, (from, pre, sep, body, groupOffset) => {
|
|
1238
|
-
if (!separators.includes(sep))
|
|
1239
|
-
return from;
|
|
1240
|
-
hasChanged = true;
|
|
1241
|
-
prefixes.add(pre + sep);
|
|
1242
|
-
const bodyOffset = groupOffset + pre.length + sep.length + 1;
|
|
1243
|
-
const group = { length: from.length, items: [] };
|
|
1244
|
-
groupsByOffset.set(groupOffset, group);
|
|
1245
|
-
for (const itemMatch of [...body.matchAll(/\S+/g)]) {
|
|
1246
|
-
const itemOffset = bodyOffset + itemMatch.index;
|
|
1247
|
-
let innerItems = groupsByOffset.get(itemOffset)?.items;
|
|
1248
|
-
if (innerItems) {
|
|
1249
|
-
groupsByOffset.delete(itemOffset);
|
|
1250
|
-
} else {
|
|
1251
|
-
innerItems = [{
|
|
1252
|
-
offset: itemOffset,
|
|
1253
|
-
length: itemMatch[0].length,
|
|
1254
|
-
className: itemMatch[0]
|
|
1255
|
-
}];
|
|
1256
|
-
}
|
|
1257
|
-
for (const item of innerItems) {
|
|
1258
|
-
item.className = item.className === "~" ? pre : item.className.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`);
|
|
1259
|
-
group.items.push(item);
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
return "$".repeat(from.length);
|
|
1263
|
-
});
|
|
1264
|
-
depth -= 1;
|
|
1265
|
-
} while (hasChanged && depth);
|
|
1266
|
-
let expanded;
|
|
1267
|
-
if (typeof str === "string") {
|
|
1268
|
-
expanded = "";
|
|
1269
|
-
let prevOffset = 0;
|
|
1270
|
-
for (const [offset, group] of groupsByOffset) {
|
|
1271
|
-
expanded += str.slice(prevOffset, offset);
|
|
1272
|
-
expanded += group.items.map((item) => item.className).join(" ");
|
|
1273
|
-
prevOffset = offset + group.length;
|
|
1274
|
-
}
|
|
1275
|
-
expanded += str.slice(prevOffset);
|
|
1276
|
-
} else {
|
|
1277
|
-
expanded = str;
|
|
1278
|
-
for (const [offset, group] of groupsByOffset) {
|
|
1279
|
-
expanded.overwrite(offset, offset + group.length, group.items.map((item) => item.className).join(" "));
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
return {
|
|
1283
|
-
prefixes: Array.from(prefixes),
|
|
1284
|
-
hasChanged,
|
|
1285
|
-
groupsByOffset,
|
|
1286
|
-
get expanded() {
|
|
1287
|
-
return expanded.toString();
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
function expandVariantGroup(str, separators = ["-", ":"], depth = 5) {
|
|
1292
|
-
const res = parseVariantGroup(str, separators, depth);
|
|
1293
|
-
return typeof str === "string" ? res.expanded : str;
|
|
1294
|
-
}
|
|
1295
|
-
var warned = /* @__PURE__ */ new Set;
|
|
1296
|
-
function warnOnce(msg) {
|
|
1297
|
-
if (warned.has(msg))
|
|
1298
|
-
return;
|
|
1299
|
-
console.warn("[unocss]", msg);
|
|
1300
|
-
warned.add(msg);
|
|
1301
|
-
}
|
|
1302
|
-
function resolveShortcuts(shortcuts) {
|
|
1303
|
-
return toArray(shortcuts).flatMap((s) => {
|
|
1304
|
-
if (Array.isArray(s))
|
|
1305
|
-
return [s];
|
|
1306
|
-
return Object.entries(s);
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
var __RESOLVED = "_uno_resolved";
|
|
1310
|
-
async function resolvePreset(presetInput) {
|
|
1311
|
-
let preset = typeof presetInput === "function" ? await presetInput() : await presetInput;
|
|
1312
|
-
if (__RESOLVED in preset)
|
|
1313
|
-
return preset;
|
|
1314
|
-
preset = { ...preset };
|
|
1315
|
-
Object.defineProperty(preset, __RESOLVED, {
|
|
1316
|
-
value: true,
|
|
1317
|
-
enumerable: false
|
|
1318
|
-
});
|
|
1319
|
-
const shortcuts = preset.shortcuts ? resolveShortcuts(preset.shortcuts) : undefined;
|
|
1320
|
-
preset.shortcuts = shortcuts;
|
|
1321
|
-
if (preset.prefix || preset.layer) {
|
|
1322
|
-
const apply = (i) => {
|
|
1323
|
-
if (!i[2])
|
|
1324
|
-
i[2] = {};
|
|
1325
|
-
const meta = i[2];
|
|
1326
|
-
if (meta.prefix == null && preset.prefix)
|
|
1327
|
-
meta.prefix = toArray(preset.prefix);
|
|
1328
|
-
if (meta.layer == null && preset.layer)
|
|
1329
|
-
meta.layer = preset.layer;
|
|
1330
|
-
};
|
|
1331
|
-
shortcuts?.forEach(apply);
|
|
1332
|
-
preset.rules?.forEach(apply);
|
|
1333
|
-
}
|
|
1334
|
-
return preset;
|
|
1335
|
-
}
|
|
1336
|
-
async function resolvePresets(preset) {
|
|
1337
|
-
const root = await resolvePreset(preset);
|
|
1338
|
-
if (!root.presets)
|
|
1339
|
-
return [root];
|
|
1340
|
-
const nested = (await Promise.all((root.presets || []).flatMap(toArray).flatMap(resolvePresets))).flat();
|
|
1341
|
-
return [root, ...nested];
|
|
1342
|
-
}
|
|
1343
|
-
function mergeContentOptions(optionsArray) {
|
|
1344
|
-
if (optionsArray.length === 0) {
|
|
1345
|
-
return {};
|
|
1346
|
-
}
|
|
1347
|
-
const pipelineIncludes = [];
|
|
1348
|
-
const pipelineExcludes = [];
|
|
1349
|
-
let pipelineDisabled = false;
|
|
1350
|
-
const filesystem = [];
|
|
1351
|
-
const inline = [];
|
|
1352
|
-
const plain = [];
|
|
1353
|
-
for (const options of optionsArray) {
|
|
1354
|
-
if (options.pipeline === false) {
|
|
1355
|
-
pipelineDisabled = true;
|
|
1356
|
-
break;
|
|
1357
|
-
} else {
|
|
1358
|
-
if (options.pipeline?.include) {
|
|
1359
|
-
pipelineIncludes.push(options.pipeline.include);
|
|
1360
|
-
}
|
|
1361
|
-
if (options.pipeline?.exclude) {
|
|
1362
|
-
pipelineExcludes.push(options.pipeline.exclude);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
if (options.filesystem) {
|
|
1366
|
-
filesystem.push(options.filesystem);
|
|
1367
|
-
}
|
|
1368
|
-
if (options.inline) {
|
|
1369
|
-
inline.push(options.inline);
|
|
1370
|
-
}
|
|
1371
|
-
if (options.plain) {
|
|
1372
|
-
plain.push(options.plain);
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
const mergedContent = {
|
|
1376
|
-
pipeline: pipelineDisabled ? false : {
|
|
1377
|
-
include: uniq(mergeFilterPatterns(...pipelineIncludes)),
|
|
1378
|
-
exclude: uniq(mergeFilterPatterns(...pipelineExcludes))
|
|
1379
|
-
}
|
|
1380
|
-
};
|
|
1381
|
-
if (filesystem.length) {
|
|
1382
|
-
mergedContent.filesystem = uniq(filesystem.flat());
|
|
1383
|
-
}
|
|
1384
|
-
if (inline.length) {
|
|
1385
|
-
mergedContent.inline = uniq(inline.flat());
|
|
1386
|
-
}
|
|
1387
|
-
if (plain.length) {
|
|
1388
|
-
mergedContent.plain = uniq(plain.flat());
|
|
1389
|
-
}
|
|
1390
|
-
return mergedContent;
|
|
1391
|
-
}
|
|
1392
|
-
async function resolveConfig(userConfig = {}, defaults = {}) {
|
|
1393
|
-
const config = Object.assign({}, defaults, userConfig);
|
|
1394
|
-
const rawPresets = uniqueBy((await Promise.all((config.presets || []).flatMap(toArray).flatMap(resolvePresets))).flat(), (a, b) => a.name === b.name);
|
|
1395
|
-
const sortedPresets = [
|
|
1396
|
-
...rawPresets.filter((p) => p.enforce === "pre"),
|
|
1397
|
-
...rawPresets.filter((p) => !p.enforce),
|
|
1398
|
-
...rawPresets.filter((p) => p.enforce === "post")
|
|
1399
|
-
];
|
|
1400
|
-
const sources = [
|
|
1401
|
-
...sortedPresets,
|
|
1402
|
-
config
|
|
1403
|
-
];
|
|
1404
|
-
const sourcesReversed = [...sources].reverse();
|
|
1405
|
-
const layers = Object.assign({}, DEFAULT_LAYERS, ...sources.map((i) => i.layers));
|
|
1406
|
-
function getMerged(key) {
|
|
1407
|
-
return uniq(sources.flatMap((p) => toArray(p[key] || [])));
|
|
1408
|
-
}
|
|
1409
|
-
const extractors = getMerged("extractors");
|
|
1410
|
-
let extractorDefault = sourcesReversed.find((i) => i.extractorDefault !== undefined)?.extractorDefault;
|
|
1411
|
-
if (extractorDefault === undefined)
|
|
1412
|
-
extractorDefault = extractorSplit;
|
|
1413
|
-
if (extractorDefault && !extractors.includes(extractorDefault))
|
|
1414
|
-
extractors.unshift(extractorDefault);
|
|
1415
|
-
extractors.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
1416
|
-
const rules = getMerged("rules");
|
|
1417
|
-
const rulesStaticMap = {};
|
|
1418
|
-
const rulesSize = rules.length;
|
|
1419
|
-
const rulesDynamic = rules.filter((rule) => {
|
|
1420
|
-
if (!isStaticRule(rule))
|
|
1421
|
-
return true;
|
|
1422
|
-
const prefixes = toArray(rule[2]?.prefix || "");
|
|
1423
|
-
prefixes.forEach((prefix) => {
|
|
1424
|
-
rulesStaticMap[prefix + rule[0]] = rule;
|
|
1425
|
-
});
|
|
1426
|
-
return false;
|
|
1427
|
-
}).reverse();
|
|
1428
|
-
let theme = mergeThemes(sources.map((p) => p.theme));
|
|
1429
|
-
const extendThemes = getMerged("extendTheme");
|
|
1430
|
-
for (const extendTheme of extendThemes)
|
|
1431
|
-
theme = extendTheme(theme) || theme;
|
|
1432
|
-
const autocomplete = {
|
|
1433
|
-
templates: uniq(sources.flatMap((p) => toArray(p.autocomplete?.templates))),
|
|
1434
|
-
extractors: sources.flatMap((p) => toArray(p.autocomplete?.extractors)).sort((a, b) => (a.order || 0) - (b.order || 0)),
|
|
1435
|
-
shorthands: mergeAutocompleteShorthands(sources.map((p) => p.autocomplete?.shorthands || {}))
|
|
1436
|
-
};
|
|
1437
|
-
let separators = getMerged("separators");
|
|
1438
|
-
if (!separators.length)
|
|
1439
|
-
separators = [":", "-"];
|
|
1440
|
-
const contents = getMerged("content");
|
|
1441
|
-
const content = mergeContentOptions(contents);
|
|
1442
|
-
const resolved = {
|
|
1443
|
-
mergeSelectors: true,
|
|
1444
|
-
warn: true,
|
|
1445
|
-
sortLayers: (layers2) => layers2,
|
|
1446
|
-
...config,
|
|
1447
|
-
blocklist: getMerged("blocklist"),
|
|
1448
|
-
presets: sortedPresets,
|
|
1449
|
-
envMode: config.envMode || "build",
|
|
1450
|
-
shortcutsLayer: config.shortcutsLayer || "shortcuts",
|
|
1451
|
-
layers,
|
|
1452
|
-
theme,
|
|
1453
|
-
rules,
|
|
1454
|
-
rulesSize,
|
|
1455
|
-
rulesDynamic,
|
|
1456
|
-
rulesStaticMap,
|
|
1457
|
-
preprocess: getMerged("preprocess"),
|
|
1458
|
-
postprocess: getMerged("postprocess"),
|
|
1459
|
-
preflights: getMerged("preflights"),
|
|
1460
|
-
autocomplete,
|
|
1461
|
-
variants: getMerged("variants").map(normalizeVariant).sort((a, b) => (a.order || 0) - (b.order || 0)),
|
|
1462
|
-
shortcuts: resolveShortcuts(getMerged("shortcuts")).reverse(),
|
|
1463
|
-
extractors,
|
|
1464
|
-
safelist: getMerged("safelist"),
|
|
1465
|
-
separators,
|
|
1466
|
-
details: config.details ?? config.envMode === "dev",
|
|
1467
|
-
content,
|
|
1468
|
-
transformers: uniqueBy(getMerged("transformers"), (a, b) => a.name === b.name)
|
|
1469
|
-
};
|
|
1470
|
-
for (const p of sources)
|
|
1471
|
-
p?.configResolved?.(resolved);
|
|
1472
|
-
return resolved;
|
|
1473
|
-
}
|
|
1474
|
-
function mergeThemes(themes) {
|
|
1475
|
-
return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
|
|
1476
|
-
}
|
|
1477
|
-
function mergeAutocompleteShorthands(shorthands) {
|
|
1478
|
-
return shorthands.reduce((a, b) => {
|
|
1479
|
-
const rs = {};
|
|
1480
|
-
for (const key in b) {
|
|
1481
|
-
const value = b[key];
|
|
1482
|
-
if (Array.isArray(value))
|
|
1483
|
-
rs[key] = `(${value.join("|")})`;
|
|
1484
|
-
else
|
|
1485
|
-
rs[key] = value;
|
|
1486
|
-
}
|
|
1487
|
-
return {
|
|
1488
|
-
...a,
|
|
1489
|
-
...rs
|
|
1490
|
-
};
|
|
1491
|
-
}, {});
|
|
1492
|
-
}
|
|
1493
|
-
function mergeFilterPatterns(...filterPatterns) {
|
|
1494
|
-
return filterPatterns.flatMap(flatternFilterPattern);
|
|
1495
|
-
}
|
|
1496
|
-
function flatternFilterPattern(pattern) {
|
|
1497
|
-
return Array.isArray(pattern) ? pattern : pattern ? [pattern] : [];
|
|
1498
|
-
}
|
|
1499
|
-
var version = "66.2.1";
|
|
1500
|
-
var symbols = {
|
|
1501
|
-
shortcutsNoMerge: "$$symbol-shortcut-no-merge",
|
|
1502
|
-
noMerge: "$$symbol-no-merge",
|
|
1503
|
-
variants: "$$symbol-variants",
|
|
1504
|
-
parent: "$$symbol-parent",
|
|
1505
|
-
selector: "$$symbol-selector",
|
|
1506
|
-
layer: "$$symbol-layer",
|
|
1507
|
-
sort: "$$symbol-sort"
|
|
1508
|
-
};
|
|
1509
|
-
|
|
1510
|
-
class UnoGeneratorInternal {
|
|
1511
|
-
constructor(userConfig = {}, defaults = {}) {
|
|
1512
|
-
this.userConfig = userConfig;
|
|
1513
|
-
this.defaults = defaults;
|
|
1514
|
-
}
|
|
1515
|
-
version = version;
|
|
1516
|
-
events = createNanoEvents();
|
|
1517
|
-
config = undefined;
|
|
1518
|
-
cache = /* @__PURE__ */ new Map;
|
|
1519
|
-
blocked = /* @__PURE__ */ new Set;
|
|
1520
|
-
parentOrders = /* @__PURE__ */ new Map;
|
|
1521
|
-
activatedRules = /* @__PURE__ */ new Set;
|
|
1522
|
-
static async create(userConfig = {}, defaults = {}) {
|
|
1523
|
-
const uno = new UnoGeneratorInternal(userConfig, defaults);
|
|
1524
|
-
uno.config = await resolveConfig(uno.userConfig, uno.defaults);
|
|
1525
|
-
uno.events.emit("config", uno.config);
|
|
1526
|
-
return uno;
|
|
1527
|
-
}
|
|
1528
|
-
async setConfig(userConfig, defaults) {
|
|
1529
|
-
if (!userConfig)
|
|
1530
|
-
return;
|
|
1531
|
-
if (defaults)
|
|
1532
|
-
this.defaults = defaults;
|
|
1533
|
-
this.userConfig = userConfig;
|
|
1534
|
-
this.blocked.clear();
|
|
1535
|
-
this.parentOrders.clear();
|
|
1536
|
-
this.activatedRules.clear();
|
|
1537
|
-
this.cache.clear();
|
|
1538
|
-
this.config = await resolveConfig(userConfig, this.defaults);
|
|
1539
|
-
this.events.emit("config", this.config);
|
|
1540
|
-
}
|
|
1541
|
-
async applyExtractors(code, id, extracted = /* @__PURE__ */ new Set) {
|
|
1542
|
-
const context = {
|
|
1543
|
-
original: code,
|
|
1544
|
-
code,
|
|
1545
|
-
id,
|
|
1546
|
-
extracted,
|
|
1547
|
-
envMode: this.config.envMode
|
|
1548
|
-
};
|
|
1549
|
-
for (const extractor of this.config.extractors) {
|
|
1550
|
-
const result = await extractor.extract?.(context);
|
|
1551
|
-
if (!result)
|
|
1552
|
-
continue;
|
|
1553
|
-
if (isCountableSet(result) && isCountableSet(extracted)) {
|
|
1554
|
-
for (const token of result)
|
|
1555
|
-
extracted.setCount(token, extracted.getCount(token) + result.getCount(token));
|
|
1556
|
-
} else {
|
|
1557
|
-
for (const token of result)
|
|
1558
|
-
extracted.add(token);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
return extracted;
|
|
1562
|
-
}
|
|
1563
|
-
makeContext(raw, applied) {
|
|
1564
|
-
const context = {
|
|
1565
|
-
rawSelector: raw,
|
|
1566
|
-
currentSelector: applied[1],
|
|
1567
|
-
theme: this.config.theme,
|
|
1568
|
-
generator: this,
|
|
1569
|
-
symbols,
|
|
1570
|
-
variantHandlers: applied[2],
|
|
1571
|
-
constructCSS: (...args) => this.constructCustomCSS(context, ...args),
|
|
1572
|
-
variantMatch: applied
|
|
1573
|
-
};
|
|
1574
|
-
return context;
|
|
1575
|
-
}
|
|
1576
|
-
async parseToken(raw, alias) {
|
|
1577
|
-
if (this.blocked.has(raw))
|
|
1578
|
-
return;
|
|
1579
|
-
const cacheKey = `${raw}${alias ? ` ${alias}` : ""}`;
|
|
1580
|
-
if (this.cache.has(cacheKey))
|
|
1581
|
-
return this.cache.get(cacheKey);
|
|
1582
|
-
let current = raw;
|
|
1583
|
-
for (const p of this.config.preprocess)
|
|
1584
|
-
current = p(raw);
|
|
1585
|
-
if (this.isBlocked(current)) {
|
|
1586
|
-
this.blocked.add(raw);
|
|
1587
|
-
this.cache.set(cacheKey, null);
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
const variantResults = await this.matchVariants(raw, current);
|
|
1591
|
-
if (variantResults.every((i) => !i || this.isBlocked(i[1]))) {
|
|
1592
|
-
this.blocked.add(raw);
|
|
1593
|
-
this.cache.set(cacheKey, null);
|
|
1594
|
-
return;
|
|
1595
|
-
}
|
|
1596
|
-
const handleVariantResult = async (matched) => {
|
|
1597
|
-
const context = this.makeContext(raw, [alias || matched[0], matched[1], matched[2], matched[3]]);
|
|
1598
|
-
if (this.config.details)
|
|
1599
|
-
context.variants = [...matched[3]];
|
|
1600
|
-
const expanded = await this.expandShortcut(context.currentSelector, context);
|
|
1601
|
-
const utils = expanded ? await this.stringifyShortcuts(context.variantMatch, context, expanded[0], expanded[1]) : (await this.parseUtil(context.variantMatch, context))?.map((i) => this.stringifyUtil(i, context)).filter(notNull);
|
|
1602
|
-
return utils;
|
|
1603
|
-
};
|
|
1604
|
-
const result = (await Promise.all(variantResults.map((i) => handleVariantResult(i)))).flat().filter((x) => !!x);
|
|
1605
|
-
if (result?.length) {
|
|
1606
|
-
this.cache.set(cacheKey, result);
|
|
1607
|
-
return result;
|
|
1608
|
-
}
|
|
1609
|
-
this.cache.set(cacheKey, null);
|
|
1610
|
-
}
|
|
1611
|
-
async generate(input, options = {}) {
|
|
1612
|
-
const {
|
|
1613
|
-
id,
|
|
1614
|
-
scope,
|
|
1615
|
-
preflights = true,
|
|
1616
|
-
safelist = true,
|
|
1617
|
-
minify = false,
|
|
1618
|
-
extendedInfo = false
|
|
1619
|
-
} = options;
|
|
1620
|
-
const tokens = isString(input) ? await this.applyExtractors(input, id, extendedInfo ? new CountableSet : /* @__PURE__ */ new Set) : Array.isArray(input) ? new Set(input) : input;
|
|
1621
|
-
if (safelist) {
|
|
1622
|
-
const safelistContext = {
|
|
1623
|
-
generator: this,
|
|
1624
|
-
theme: this.config.theme
|
|
1625
|
-
};
|
|
1626
|
-
this.config.safelist.flatMap((s) => typeof s === "function" ? s(safelistContext) : s).forEach((s) => {
|
|
1627
|
-
const trimedS = s.trim();
|
|
1628
|
-
if (trimedS && !tokens.has(trimedS))
|
|
1629
|
-
tokens.add(trimedS);
|
|
1630
|
-
});
|
|
1631
|
-
}
|
|
1632
|
-
const nl = minify ? "" : `
|
|
1633
|
-
`;
|
|
1634
|
-
const layerSet = /* @__PURE__ */ new Set([LAYER_DEFAULT]);
|
|
1635
|
-
const matched = extendedInfo ? /* @__PURE__ */ new Map : /* @__PURE__ */ new Set;
|
|
1636
|
-
const sheet = /* @__PURE__ */ new Map;
|
|
1637
|
-
let preflightsMap = {};
|
|
1638
|
-
const tokenPromises = Array.from(tokens).map(async (raw) => {
|
|
1639
|
-
if (matched.has(raw))
|
|
1640
|
-
return;
|
|
1641
|
-
const payload = await this.parseToken(raw);
|
|
1642
|
-
if (payload == null)
|
|
1643
|
-
return;
|
|
1644
|
-
if (matched instanceof Map) {
|
|
1645
|
-
matched.set(raw, {
|
|
1646
|
-
data: payload,
|
|
1647
|
-
count: isCountableSet(tokens) ? tokens.getCount(raw) : -1
|
|
1648
|
-
});
|
|
1649
|
-
} else {
|
|
1650
|
-
matched.add(raw);
|
|
1651
|
-
}
|
|
1652
|
-
for (const item of payload) {
|
|
1653
|
-
const parent = item[3] || "";
|
|
1654
|
-
const layer = item[4]?.layer;
|
|
1655
|
-
if (!sheet.has(parent))
|
|
1656
|
-
sheet.set(parent, []);
|
|
1657
|
-
sheet.get(parent).push(item);
|
|
1658
|
-
if (layer)
|
|
1659
|
-
layerSet.add(layer);
|
|
1660
|
-
}
|
|
1661
|
-
});
|
|
1662
|
-
await Promise.all(tokenPromises);
|
|
1663
|
-
await (async () => {
|
|
1664
|
-
if (!preflights)
|
|
1665
|
-
return;
|
|
1666
|
-
const preflightContext = {
|
|
1667
|
-
generator: this,
|
|
1668
|
-
theme: this.config.theme
|
|
1669
|
-
};
|
|
1670
|
-
const preflightLayerSet = /* @__PURE__ */ new Set([]);
|
|
1671
|
-
this.config.preflights.forEach(({ layer = LAYER_PREFLIGHTS }) => {
|
|
1672
|
-
layerSet.add(layer);
|
|
1673
|
-
preflightLayerSet.add(layer);
|
|
1674
|
-
});
|
|
1675
|
-
preflightsMap = Object.fromEntries(await Promise.all(Array.from(preflightLayerSet).map(async (layer) => {
|
|
1676
|
-
const preflights2 = await Promise.all(this.config.preflights.filter((i) => (i.layer || LAYER_PREFLIGHTS) === layer).map(async (i) => await i.getCSS(preflightContext)));
|
|
1677
|
-
const css = preflights2.filter(Boolean).join(nl);
|
|
1678
|
-
return [layer, css];
|
|
1679
|
-
})));
|
|
1680
|
-
})();
|
|
1681
|
-
const layers = this.config.sortLayers(Array.from(layerSet).sort((a, b) => (this.config.layers[a] ?? 0) - (this.config.layers[b] ?? 0) || a.localeCompare(b)));
|
|
1682
|
-
const layerCache = {};
|
|
1683
|
-
const outputCssLayers = this.config.outputToCssLayers;
|
|
1684
|
-
const getLayerAlias = (layer) => {
|
|
1685
|
-
let alias = layer;
|
|
1686
|
-
if (typeof outputCssLayers === "object") {
|
|
1687
|
-
alias = outputCssLayers.cssLayerName?.(layer);
|
|
1688
|
-
}
|
|
1689
|
-
return alias === null ? null : alias ?? layer;
|
|
1690
|
-
};
|
|
1691
|
-
const getLayer = (layer = LAYER_DEFAULT) => {
|
|
1692
|
-
if (layerCache[layer])
|
|
1693
|
-
return layerCache[layer];
|
|
1694
|
-
let css = Array.from(sheet).sort((a, b) => (this.parentOrders.get(a[0]) ?? 0) - (this.parentOrders.get(b[0]) ?? 0) || a[0]?.localeCompare(b[0] || "") || 0).map(([parent, items]) => {
|
|
1695
|
-
const size = items.length;
|
|
1696
|
-
const sorted = items.filter((i) => (i[4]?.layer || LAYER_DEFAULT) === layer).sort((a, b) => {
|
|
1697
|
-
return a[0] - b[0] || (a[4]?.sort || 0) - (b[4]?.sort || 0) || a[5]?.currentSelector?.localeCompare(b[5]?.currentSelector ?? "") || a[1]?.localeCompare(b[1] || "") || a[2]?.localeCompare(b[2] || "") || 0;
|
|
1698
|
-
}).map(([, selector, body, , meta, , variantNoMerge]) => {
|
|
1699
|
-
const scopedSelector = selector ? applyScope(selector, scope) : selector;
|
|
1700
|
-
return [
|
|
1701
|
-
[[scopedSelector ?? "", meta?.sort ?? 0]],
|
|
1702
|
-
body,
|
|
1703
|
-
!!(variantNoMerge ?? meta?.noMerge)
|
|
1704
|
-
];
|
|
1705
|
-
});
|
|
1706
|
-
if (!sorted.length)
|
|
1707
|
-
return;
|
|
1708
|
-
const ruleLines = sorted.reverse().map(([selectorSortPair, body, noMerge], idx) => {
|
|
1709
|
-
if (!noMerge && this.config.mergeSelectors) {
|
|
1710
|
-
for (let i = idx + 1;i < size; i++) {
|
|
1711
|
-
const current = sorted[i];
|
|
1712
|
-
if (current && !current[2] && (selectorSortPair && current[0] || selectorSortPair == null && current[0] == null) && current[1] === body) {
|
|
1713
|
-
if (selectorSortPair && current[0])
|
|
1714
|
-
current[0].push(...selectorSortPair);
|
|
1715
|
-
return null;
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
const selectors = selectorSortPair ? uniq(selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)) : [];
|
|
1720
|
-
return selectors.length ? `${selectors.join(`,${nl}`)}{${body}}` : body;
|
|
1721
|
-
}).filter(Boolean);
|
|
1722
|
-
const rules = Array.from(new Set(ruleLines)).reverse().join(nl);
|
|
1723
|
-
if (!parent)
|
|
1724
|
-
return rules;
|
|
1725
|
-
const parents = parent.split(" $$ ");
|
|
1726
|
-
return `${parents.join("{")}{${nl}${rules}${nl}${"}".repeat(parents.length)}`;
|
|
1727
|
-
}).filter(Boolean).join(nl);
|
|
1728
|
-
if (preflights) {
|
|
1729
|
-
css = [preflightsMap[layer], css].filter(Boolean).join(nl);
|
|
1730
|
-
}
|
|
1731
|
-
let alias;
|
|
1732
|
-
if (outputCssLayers && css) {
|
|
1733
|
-
alias = getLayerAlias(layer);
|
|
1734
|
-
if (alias !== null) {
|
|
1735
|
-
css = `@layer ${alias}{${nl}${css}${nl}}`;
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
const layerMark = minify ? "" : `/* layer: ${layer}${alias && alias !== layer ? `, alias: ${alias}` : ""} */${nl}`;
|
|
1739
|
-
return layerCache[layer] = css ? layerMark + css : "";
|
|
1740
|
-
};
|
|
1741
|
-
const getLayers = (includes = layers, excludes) => {
|
|
1742
|
-
const layers2 = includes.filter((i) => !excludes?.includes(i));
|
|
1743
|
-
return [
|
|
1744
|
-
outputCssLayers && layers2.length > 0 ? `@layer ${layers2.map(getLayerAlias).filter(notNull).join(", ")};` : undefined,
|
|
1745
|
-
...layers2.map((i) => getLayer(i) || "")
|
|
1746
|
-
].filter(Boolean).join(nl);
|
|
1747
|
-
};
|
|
1748
|
-
const setLayer = async (layer, callback) => {
|
|
1749
|
-
const content = await callback(getLayer(layer));
|
|
1750
|
-
layerCache[layer] = content;
|
|
1751
|
-
return content;
|
|
1752
|
-
};
|
|
1753
|
-
return {
|
|
1754
|
-
get css() {
|
|
1755
|
-
return getLayers();
|
|
1756
|
-
},
|
|
1757
|
-
layers,
|
|
1758
|
-
matched,
|
|
1759
|
-
getLayers,
|
|
1760
|
-
getLayer,
|
|
1761
|
-
setLayer
|
|
1762
|
-
};
|
|
1763
|
-
}
|
|
1764
|
-
async matchVariants(raw, current) {
|
|
1765
|
-
const context = {
|
|
1766
|
-
rawSelector: raw,
|
|
1767
|
-
theme: this.config.theme,
|
|
1768
|
-
generator: this
|
|
1769
|
-
};
|
|
1770
|
-
const match = async (result) => {
|
|
1771
|
-
let applied = true;
|
|
1772
|
-
const [, , handlers, variants] = result;
|
|
1773
|
-
while (applied) {
|
|
1774
|
-
applied = false;
|
|
1775
|
-
const processed = result[1];
|
|
1776
|
-
for (const v of this.config.variants) {
|
|
1777
|
-
if (!v.multiPass && variants.has(v))
|
|
1778
|
-
continue;
|
|
1779
|
-
let handler = await v.match(processed, context);
|
|
1780
|
-
if (!handler)
|
|
1781
|
-
continue;
|
|
1782
|
-
if (isString(handler)) {
|
|
1783
|
-
if (handler === processed)
|
|
1784
|
-
continue;
|
|
1785
|
-
handler = { matcher: handler };
|
|
1786
|
-
}
|
|
1787
|
-
if (Array.isArray(handler)) {
|
|
1788
|
-
if (!handler.length)
|
|
1789
|
-
continue;
|
|
1790
|
-
if (handler.length === 1) {
|
|
1791
|
-
handler = handler[0];
|
|
1792
|
-
} else {
|
|
1793
|
-
if (v.multiPass)
|
|
1794
|
-
throw new Error("multiPass can not be used together with array return variants");
|
|
1795
|
-
const clones = handler.map((h) => {
|
|
1796
|
-
const _processed = h.matcher ?? processed;
|
|
1797
|
-
const _handlers = [h, ...handlers];
|
|
1798
|
-
const _variants = new Set(variants);
|
|
1799
|
-
_variants.add(v);
|
|
1800
|
-
return [result[0], _processed, _handlers, _variants];
|
|
1801
|
-
});
|
|
1802
|
-
return (await Promise.all(clones.map((c) => match(c)))).flat();
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
result[1] = handler.matcher ?? processed;
|
|
1806
|
-
handlers.unshift(handler);
|
|
1807
|
-
variants.add(v);
|
|
1808
|
-
applied = true;
|
|
1809
|
-
break;
|
|
1810
|
-
}
|
|
1811
|
-
if (!applied)
|
|
1812
|
-
break;
|
|
1813
|
-
if (handlers.length > 500)
|
|
1814
|
-
throw new Error(`Too many variants applied to "${raw}"`);
|
|
1815
|
-
}
|
|
1816
|
-
return [result];
|
|
1817
|
-
};
|
|
1818
|
-
return await match([
|
|
1819
|
-
raw,
|
|
1820
|
-
current || raw,
|
|
1821
|
-
[],
|
|
1822
|
-
/* @__PURE__ */ new Set
|
|
1823
|
-
]);
|
|
1824
|
-
}
|
|
1825
|
-
applyVariants(parsed, variantHandlers = parsed[4], raw = parsed[1]) {
|
|
1826
|
-
const handler = variantHandlers.slice().sort((a, b) => (a.order || 0) - (b.order || 0)).reduceRight((previous, v) => (input) => {
|
|
1827
|
-
const entries = v.body?.(input.entries) || input.entries;
|
|
1828
|
-
const parents = Array.isArray(v.parent) ? v.parent : [v.parent, undefined];
|
|
1829
|
-
const selector = v.selector?.(input.selector, entries);
|
|
1830
|
-
return (v.handle ?? defaultVariantHandler)({
|
|
1831
|
-
...input,
|
|
1832
|
-
entries,
|
|
1833
|
-
selector: selector || input.selector,
|
|
1834
|
-
parent: parents[0] || input.parent,
|
|
1835
|
-
parentOrder: parents[1] || input.parentOrder,
|
|
1836
|
-
layer: v.layer || input.layer,
|
|
1837
|
-
sort: v.sort || input.sort
|
|
1838
|
-
}, previous);
|
|
1839
|
-
}, (input) => input);
|
|
1840
|
-
const variantContextResult = handler({
|
|
1841
|
-
prefix: "",
|
|
1842
|
-
selector: toEscapedSelector(raw),
|
|
1843
|
-
pseudo: "",
|
|
1844
|
-
entries: parsed[2]
|
|
1845
|
-
});
|
|
1846
|
-
const { parent, parentOrder } = variantContextResult;
|
|
1847
|
-
if (parent != null && parentOrder != null)
|
|
1848
|
-
this.parentOrders.set(parent, parentOrder);
|
|
1849
|
-
const obj = {
|
|
1850
|
-
selector: [
|
|
1851
|
-
variantContextResult.prefix,
|
|
1852
|
-
variantContextResult.selector,
|
|
1853
|
-
variantContextResult.pseudo
|
|
1854
|
-
].join(""),
|
|
1855
|
-
entries: variantContextResult.entries,
|
|
1856
|
-
parent,
|
|
1857
|
-
layer: variantContextResult.layer,
|
|
1858
|
-
sort: variantContextResult.sort,
|
|
1859
|
-
noMerge: variantContextResult.noMerge
|
|
1860
|
-
};
|
|
1861
|
-
for (const p of this.config.postprocess)
|
|
1862
|
-
p(obj);
|
|
1863
|
-
return obj;
|
|
1864
|
-
}
|
|
1865
|
-
constructCustomCSS(context, body, overrideSelector) {
|
|
1866
|
-
const normalizedBody = normalizeCSSEntries(body);
|
|
1867
|
-
if (isString(normalizedBody))
|
|
1868
|
-
return normalizedBody;
|
|
1869
|
-
const { selector, entries, parent } = this.applyVariants([0, overrideSelector || context.rawSelector, normalizedBody, undefined, context.variantHandlers]);
|
|
1870
|
-
const cssBody = `${selector}{${entriesToCss(entries)}}`;
|
|
1871
|
-
if (parent)
|
|
1872
|
-
return `${parent}{${cssBody}}`;
|
|
1873
|
-
return cssBody;
|
|
1874
|
-
}
|
|
1875
|
-
async parseUtil(input, context, internal = false, shortcutPrefix) {
|
|
1876
|
-
const variantResults = isString(input) ? await this.matchVariants(input) : [input];
|
|
1877
|
-
const parse = async ([raw, processed, variantHandlers]) => {
|
|
1878
|
-
if (this.config.details)
|
|
1879
|
-
context.rules = context.rules ?? [];
|
|
1880
|
-
const staticMatch = this.config.rulesStaticMap[processed];
|
|
1881
|
-
if (staticMatch) {
|
|
1882
|
-
if (staticMatch[1] && (internal || !staticMatch[2]?.internal)) {
|
|
1883
|
-
if (this.config.details)
|
|
1884
|
-
context.rules.push(staticMatch);
|
|
1885
|
-
const index = this.config.rules.indexOf(staticMatch);
|
|
1886
|
-
const entries = normalizeCSSValues(staticMatch[1]).filter((i) => i.length);
|
|
1887
|
-
const meta = staticMatch[2];
|
|
1888
|
-
if (entries.length) {
|
|
1889
|
-
context.generator.activatedRules.add(staticMatch);
|
|
1890
|
-
return entries.map((css) => {
|
|
1891
|
-
if (isString(css))
|
|
1892
|
-
return [index, css, meta];
|
|
1893
|
-
return [index, raw, css, meta, variantHandlers];
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
context.variantHandlers = variantHandlers;
|
|
1899
|
-
const { rulesDynamic } = this.config;
|
|
1900
|
-
for (const rule of rulesDynamic) {
|
|
1901
|
-
const [matcher, handler, meta] = rule;
|
|
1902
|
-
if (meta?.internal && !internal)
|
|
1903
|
-
continue;
|
|
1904
|
-
let unprefixed = processed;
|
|
1905
|
-
if (meta?.prefix) {
|
|
1906
|
-
const prefixes = toArray(meta.prefix);
|
|
1907
|
-
if (shortcutPrefix) {
|
|
1908
|
-
const shortcutPrefixes = toArray(shortcutPrefix);
|
|
1909
|
-
if (!prefixes.some((i) => shortcutPrefixes.includes(i)))
|
|
1910
|
-
continue;
|
|
1911
|
-
} else {
|
|
1912
|
-
const prefix = prefixes.find((i) => processed.startsWith(i));
|
|
1913
|
-
if (prefix == null)
|
|
1914
|
-
continue;
|
|
1915
|
-
unprefixed = processed.slice(prefix.length);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
const match = unprefixed.match(matcher);
|
|
1919
|
-
if (!match)
|
|
1920
|
-
continue;
|
|
1921
|
-
let result = await handler(match, context);
|
|
1922
|
-
if (!result)
|
|
1923
|
-
continue;
|
|
1924
|
-
if (this.config.details)
|
|
1925
|
-
context.rules.push(rule);
|
|
1926
|
-
if (typeof result !== "string") {
|
|
1927
|
-
if (Symbol.asyncIterator in result) {
|
|
1928
|
-
const entries2 = [];
|
|
1929
|
-
for await (const r of result) {
|
|
1930
|
-
if (r)
|
|
1931
|
-
entries2.push(r);
|
|
1932
|
-
}
|
|
1933
|
-
result = entries2;
|
|
1934
|
-
} else if (Symbol.iterator in result && !Array.isArray(result)) {
|
|
1935
|
-
result = Array.from(result).filter(notNull);
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
const entries = normalizeCSSValues(result).filter((i) => i.length);
|
|
1939
|
-
if (entries.length) {
|
|
1940
|
-
context.generator.activatedRules.add(rule);
|
|
1941
|
-
const index = this.config.rules.indexOf(rule);
|
|
1942
|
-
return entries.map((css) => {
|
|
1943
|
-
if (isString(css))
|
|
1944
|
-
return [index, css, meta];
|
|
1945
|
-
let variants = variantHandlers;
|
|
1946
|
-
let entryMeta = meta;
|
|
1947
|
-
for (const entry of css) {
|
|
1948
|
-
if (entry[0] === symbols.variants) {
|
|
1949
|
-
if (typeof entry[1] === "function") {
|
|
1950
|
-
variants = entry[1](variants) || variants;
|
|
1951
|
-
} else {
|
|
1952
|
-
variants = [
|
|
1953
|
-
...toArray(entry[1]),
|
|
1954
|
-
...variants
|
|
1955
|
-
];
|
|
1956
|
-
}
|
|
1957
|
-
} else if (entry[0] === symbols.parent) {
|
|
1958
|
-
variants = [
|
|
1959
|
-
{ parent: entry[1] },
|
|
1960
|
-
...variants
|
|
1961
|
-
];
|
|
1962
|
-
} else if (entry[0] === symbols.selector) {
|
|
1963
|
-
variants = [
|
|
1964
|
-
{ selector: entry[1] },
|
|
1965
|
-
...variants
|
|
1966
|
-
];
|
|
1967
|
-
} else if (entry[0] === symbols.layer) {
|
|
1968
|
-
variants = [
|
|
1969
|
-
{ layer: entry[1] },
|
|
1970
|
-
...variants
|
|
1971
|
-
];
|
|
1972
|
-
} else if (entry[0] === symbols.sort) {
|
|
1973
|
-
entryMeta = {
|
|
1974
|
-
...entryMeta,
|
|
1975
|
-
sort: entry[1]
|
|
1976
|
-
};
|
|
1977
|
-
} else if (entry[0] === symbols.noMerge) {
|
|
1978
|
-
entryMeta = {
|
|
1979
|
-
...entryMeta,
|
|
1980
|
-
noMerge: entry[1]
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
return [index, raw, css, entryMeta, variants];
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
};
|
|
1989
|
-
const parsed = (await Promise.all(variantResults.map((i) => parse(i)))).flat().filter((x) => !!x);
|
|
1990
|
-
if (!parsed.length)
|
|
1991
|
-
return;
|
|
1992
|
-
return parsed;
|
|
1993
|
-
}
|
|
1994
|
-
stringifyUtil(parsed, context) {
|
|
1995
|
-
if (!parsed)
|
|
1996
|
-
return;
|
|
1997
|
-
if (isRawUtil(parsed))
|
|
1998
|
-
return [parsed[0], undefined, parsed[1], undefined, parsed[2], this.config.details ? context : undefined, undefined];
|
|
1999
|
-
const {
|
|
2000
|
-
selector,
|
|
2001
|
-
entries,
|
|
2002
|
-
parent,
|
|
2003
|
-
layer: variantLayer,
|
|
2004
|
-
sort: variantSort,
|
|
2005
|
-
noMerge
|
|
2006
|
-
} = this.applyVariants(parsed);
|
|
2007
|
-
const body = entriesToCss(entries);
|
|
2008
|
-
if (!body)
|
|
2009
|
-
return;
|
|
2010
|
-
const { layer: metaLayer, sort: metaSort, ...meta } = parsed[3] ?? {};
|
|
2011
|
-
const ruleMeta = {
|
|
2012
|
-
...meta,
|
|
2013
|
-
layer: variantLayer ?? metaLayer,
|
|
2014
|
-
sort: variantSort ?? metaSort
|
|
2015
|
-
};
|
|
2016
|
-
return [parsed[0], selector, body, parent, ruleMeta, this.config.details ? context : undefined, noMerge];
|
|
2017
|
-
}
|
|
2018
|
-
async expandShortcut(input, context, depth = 5) {
|
|
2019
|
-
if (depth === 0)
|
|
2020
|
-
return;
|
|
2021
|
-
const recordShortcut = this.config.details ? (s) => {
|
|
2022
|
-
context.shortcuts = context.shortcuts ?? [];
|
|
2023
|
-
context.shortcuts.push(s);
|
|
2024
|
-
} : noop;
|
|
2025
|
-
let meta;
|
|
2026
|
-
let result;
|
|
2027
|
-
let stringResult;
|
|
2028
|
-
let inlineResult;
|
|
2029
|
-
for (const s of this.config.shortcuts) {
|
|
2030
|
-
let unprefixed = input;
|
|
2031
|
-
if (s[2]?.prefix) {
|
|
2032
|
-
const prefixes = toArray(s[2].prefix);
|
|
2033
|
-
const prefix = prefixes.find((i) => input.startsWith(i));
|
|
2034
|
-
if (prefix == null)
|
|
2035
|
-
continue;
|
|
2036
|
-
unprefixed = input.slice(prefix.length);
|
|
2037
|
-
}
|
|
2038
|
-
if (isStaticShortcut(s)) {
|
|
2039
|
-
if (s[0] === unprefixed) {
|
|
2040
|
-
meta = meta || s[2];
|
|
2041
|
-
result = s[1];
|
|
2042
|
-
recordShortcut(s);
|
|
2043
|
-
break;
|
|
2044
|
-
}
|
|
2045
|
-
} else {
|
|
2046
|
-
const match = unprefixed.match(s[0]);
|
|
2047
|
-
if (match)
|
|
2048
|
-
result = s[1](match, context);
|
|
2049
|
-
if (result) {
|
|
2050
|
-
meta = meta || s[2];
|
|
2051
|
-
recordShortcut(s);
|
|
2052
|
-
break;
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
if (result) {
|
|
2057
|
-
stringResult = uniq(toArray(result).filter(isString).map((s) => expandVariantGroup(s.trim()).split(/\s+/g)).flat());
|
|
2058
|
-
inlineResult = toArray(result).filter((i) => !isString(i)).map((i) => ({ handles: [], value: i }));
|
|
2059
|
-
}
|
|
2060
|
-
if (!result) {
|
|
2061
|
-
const matched = isString(input) ? await this.matchVariants(input) : [input];
|
|
2062
|
-
for (const match of matched) {
|
|
2063
|
-
const [raw, inputWithoutVariant, handles] = match;
|
|
2064
|
-
if (raw !== inputWithoutVariant) {
|
|
2065
|
-
const expanded = await this.expandShortcut(inputWithoutVariant, context, depth - 1);
|
|
2066
|
-
if (expanded) {
|
|
2067
|
-
stringResult = expanded[0].filter(isString).map((item) => raw.replace(inputWithoutVariant, item));
|
|
2068
|
-
inlineResult = expanded[0].filter((i) => !isString(i)).map((item) => {
|
|
2069
|
-
return { handles: [...item.handles, ...handles], value: item.value };
|
|
2070
|
-
});
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
if (!stringResult?.length && !inlineResult?.length)
|
|
2076
|
-
return;
|
|
2077
|
-
return [
|
|
2078
|
-
[
|
|
2079
|
-
await Promise.all(toArray(stringResult).map(async (s) => (await this.expandShortcut(s, context, depth - 1))?.[0] || [s])),
|
|
2080
|
-
inlineResult
|
|
2081
|
-
].flat(2).filter((x) => !!x),
|
|
2082
|
-
meta
|
|
2083
|
-
];
|
|
2084
|
-
}
|
|
2085
|
-
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
2086
|
-
const layerMap = new BetterMap;
|
|
2087
|
-
const parsed = (await Promise.all(uniq(expanded).map(async (i) => {
|
|
2088
|
-
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i.value), undefined, i.handles]];
|
|
2089
|
-
if (!result && this.config.warn)
|
|
2090
|
-
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
2091
|
-
return result || [];
|
|
2092
|
-
}))).flat(1).filter(Boolean).sort((a, b) => a[0] - b[0]);
|
|
2093
|
-
const [raw, , parentVariants] = parent;
|
|
2094
|
-
const rawStringifiedUtil = [];
|
|
2095
|
-
for (const item of parsed) {
|
|
2096
|
-
if (isRawUtil(item)) {
|
|
2097
|
-
rawStringifiedUtil.push([item[0], undefined, item[1], undefined, item[2], context, undefined]);
|
|
2098
|
-
continue;
|
|
2099
|
-
}
|
|
2100
|
-
const { selector, entries, parent: parent2, sort, noMerge, layer } = this.applyVariants(item, [...item[4], ...parentVariants], raw);
|
|
2101
|
-
const selectorMap = layerMap.getFallback(layer ?? meta.layer, new TwoKeyMap);
|
|
2102
|
-
const mapItem = selectorMap.getFallback(selector, parent2, [[], item[0]]);
|
|
2103
|
-
mapItem[0].push([entries, !!(noMerge ?? item[3]?.noMerge), sort ?? 0]);
|
|
2104
|
-
}
|
|
2105
|
-
return rawStringifiedUtil.concat(layerMap.flatMap((selectorMap, layer) => selectorMap.map(([e2, index], selector, joinedParents) => {
|
|
2106
|
-
const stringify = (flatten, noMerge, entrySortPair) => {
|
|
2107
|
-
const maxSort = Math.max(...entrySortPair.map((e3) => e3[1]));
|
|
2108
|
-
const entriesList = entrySortPair.map((e3) => e3[0]);
|
|
2109
|
-
return (flatten ? [entriesList.flat(1)] : entriesList).map((entries) => {
|
|
2110
|
-
const body = entriesToCss(entries);
|
|
2111
|
-
if (body)
|
|
2112
|
-
return [index, selector, body, joinedParents, { ...meta, noMerge, sort: maxSort, layer }, context, undefined];
|
|
2113
|
-
return;
|
|
2114
|
-
});
|
|
2115
|
-
};
|
|
2116
|
-
const merges = [
|
|
2117
|
-
[e2.filter(([, noMerge]) => noMerge).map(([entries, , sort]) => [entries, sort]), true],
|
|
2118
|
-
[e2.filter(([, noMerge]) => !noMerge).map(([entries, , sort]) => [entries, sort]), false]
|
|
2119
|
-
];
|
|
2120
|
-
return merges.map(([e3, noMerge]) => [
|
|
2121
|
-
...stringify(false, noMerge, e3.filter(([entries]) => entries.some((entry) => entry[0] === symbols.shortcutsNoMerge))),
|
|
2122
|
-
...stringify(true, noMerge, e3.filter(([entries]) => entries.every((entry) => entry[0] !== symbols.shortcutsNoMerge)))
|
|
2123
|
-
]);
|
|
2124
|
-
}).flat(2).filter(Boolean)));
|
|
2125
|
-
}
|
|
2126
|
-
isBlocked(raw) {
|
|
2127
|
-
return !raw || this.config.blocklist.map((e2) => Array.isArray(e2) ? e2[0] : e2).some((e2) => typeof e2 === "function" ? e2(raw) : isString(e2) ? e2 === raw : e2.test(raw));
|
|
2128
|
-
}
|
|
2129
|
-
getBlocked(raw) {
|
|
2130
|
-
const rule = this.config.blocklist.find((e2) => {
|
|
2131
|
-
const v = Array.isArray(e2) ? e2[0] : e2;
|
|
2132
|
-
return typeof v === "function" ? v(raw) : isString(v) ? v === raw : v.test(raw);
|
|
2133
|
-
});
|
|
2134
|
-
return rule ? Array.isArray(rule) ? rule : [rule, undefined] : undefined;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
var regexScopePlaceholder = /\s\$\$\s+/g;
|
|
2138
|
-
function hasScopePlaceholder(css) {
|
|
2139
|
-
return regexScopePlaceholder.test(css);
|
|
2140
|
-
}
|
|
2141
|
-
function applyScope(css, scope) {
|
|
2142
|
-
if (hasScopePlaceholder(css))
|
|
2143
|
-
return css.replace(regexScopePlaceholder, scope ? ` ${scope} ` : " ");
|
|
2144
|
-
else
|
|
2145
|
-
return scope ? `${scope} ${css}` : css;
|
|
2146
|
-
}
|
|
2147
|
-
var attributifyRe = /^\[(.+?)(~?=)"(.*)"\]$/;
|
|
2148
|
-
function toEscapedSelector(raw) {
|
|
2149
|
-
if (attributifyRe.test(raw))
|
|
2150
|
-
return raw.replace(attributifyRe, (_, n, s, i) => `[${e(n)}${s}"${e(i)}"]`);
|
|
2151
|
-
return `.${e(raw)}`;
|
|
2152
|
-
}
|
|
2153
|
-
function defaultVariantHandler(input, next) {
|
|
2154
|
-
return next(input);
|
|
2155
|
-
}
|
|
2156
966
|
|
|
2157
967
|
// src/naive-ui/theme-overrides-shared.ts
|
|
2158
968
|
function getThemeOverridesShared(options = {}) {
|
|
@@ -2256,7 +1066,7 @@ function getThemeOverridesLight(options = {}) {
|
|
|
2256
1066
|
errorColorHover: mergedTheme.dangerHover,
|
|
2257
1067
|
errorColorPressed: mergedTheme.dangerPressed,
|
|
2258
1068
|
errorColorSuppl: mergedTheme.danger,
|
|
2259
|
-
bodyColor:
|
|
1069
|
+
bodyColor: mergedTheme.light
|
|
2260
1070
|
}
|
|
2261
1071
|
};
|
|
2262
1072
|
return mergeDeep(shared, light);
|
package/dist/unocss/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { PresetWind4Theme } from 'unocss';
|
|
4
4
|
|
|
5
|
+
export declare function extendPresetWind4ThemeColor(theme: PresetWind4Theme): void;
|
|
6
|
+
export declare function extendPresetWind4ThemeText(theme: PresetWind4Theme): void;
|
|
5
7
|
export declare function extendPresetWind4Theme(theme: PresetWind4Theme): void;
|
|
6
8
|
|
|
7
9
|
export {};
|
package/dist/unocss/index.js
CHANGED
|
@@ -963,7 +963,7 @@ var themeVariables = {
|
|
|
963
963
|
};
|
|
964
964
|
|
|
965
965
|
// src/unocss/index.ts
|
|
966
|
-
function
|
|
966
|
+
function extendPresetWind4ThemeColor(theme) {
|
|
967
967
|
theme.colors = theme.colors ?? {};
|
|
968
968
|
theme.colors.primary = {
|
|
969
969
|
DEFAULT: themeVariables.primary,
|
|
@@ -1009,12 +1009,20 @@ function extendPresetWind4Theme(theme) {
|
|
|
1009
1009
|
900: "oklch(90.72% 0.026 140)",
|
|
1010
1010
|
950: "oklch(89.23% 0.026 140)"
|
|
1011
1011
|
};
|
|
1012
|
+
}
|
|
1013
|
+
function extendPresetWind4ThemeText(theme) {
|
|
1012
1014
|
theme.text = theme.text ?? {};
|
|
1013
1015
|
theme.text.xs = { fontSize: "0.75rem", lineHeight: "1rem" };
|
|
1014
1016
|
theme.text.sm = { fontSize: "0.875rem", lineHeight: "1.25rem" };
|
|
1015
1017
|
theme.text.base = { fontSize: "0.875rem", lineHeight: "1.25rem" };
|
|
1016
1018
|
theme.text.lg = { fontSize: "1rem", lineHeight: "1.5rem" };
|
|
1017
1019
|
}
|
|
1020
|
+
function extendPresetWind4Theme(theme) {
|
|
1021
|
+
extendPresetWind4ThemeColor(theme);
|
|
1022
|
+
extendPresetWind4ThemeText(theme);
|
|
1023
|
+
}
|
|
1018
1024
|
export {
|
|
1025
|
+
extendPresetWind4ThemeText,
|
|
1026
|
+
extendPresetWind4ThemeColor,
|
|
1019
1027
|
extendPresetWind4Theme
|
|
1020
1028
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjfleo/theme",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"description": "GjfLeo's themes.",
|
|
6
6
|
"author": "gjfLeo <gjfLeo@yeah.net>",
|
|
7
7
|
"exports": {
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
"release": "bumpp && bun publish"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@antfu/eslint-config": "^
|
|
33
|
-
"@gjfleo/eslint-config": "^1.
|
|
32
|
+
"@antfu/eslint-config": "^7.7.2",
|
|
33
|
+
"@gjfleo/eslint-config": "^1.2.5",
|
|
34
34
|
"@types/bun": "latest",
|
|
35
|
-
"bumpp": "^10.
|
|
36
|
-
"bun-plugin-dts": "^0.
|
|
37
|
-
"eslint": "^9.
|
|
38
|
-
"naive-ui": "^2.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
35
|
+
"bumpp": "^10.4.1",
|
|
36
|
+
"bun-plugin-dts": "^0.4.0",
|
|
37
|
+
"eslint": "^9.39.4",
|
|
38
|
+
"naive-ui": "^2.44.1",
|
|
39
|
+
"seemly": "^0.3.10",
|
|
40
|
+
"typescript": "^5.9.3",
|
|
41
|
+
"unocss": "^66.6.6"
|
|
41
42
|
},
|
|
42
43
|
"publishConfig": {
|
|
43
44
|
"access": "public",
|