@bamboocss/shared 1.11.1 → 1.11.2
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/astish.cjs +19 -0
- package/dist/astish.d.cts +4 -0
- package/dist/astish.d.mts +4 -0
- package/dist/astish.mjs +17 -20
- package/dist/index.cjs +1033 -0
- package/dist/index.d.cts +173 -0
- package/dist/index.d.mts +173 -0
- package/dist/index.mjs +462 -960
- package/dist/normalize-html.cjs +17 -0
- package/dist/normalize-html.d.cts +9 -0
- package/dist/normalize-html.d.mts +9 -0
- package/dist/normalize-html.mjs +11 -7
- package/dist/shared.cjs +21 -0
- package/dist/shared.d.cts +2 -0
- package/dist/shared.d.mts +2 -0
- package/dist/shared.mjs +2 -328
- package/dist/uniq-DRfJ796t.mjs +310 -0
- package/dist/uniq-DcY1asOl.d.mts +112 -0
- package/dist/uniq-i0QQ2OJM.d.cts +112 -0
- package/dist/uniq-xizdZz1Z.cjs +501 -0
- package/package.json +9 -9
- package/dist/astish.js +0 -46
- package/dist/index.js +0 -1557
- package/dist/normalize-html.js +0 -37
- package/dist/shared.js +0 -373
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_uniq = require("./uniq-xizdZz1Z.cjs");
|
|
3
|
+
const require_astish = require("./astish.cjs");
|
|
4
|
+
//#region src/arbitrary-value.ts
|
|
5
|
+
const getArbitraryValue = (_value) => {
|
|
6
|
+
if (!_value || typeof _value !== "string") return _value;
|
|
7
|
+
const value = _value.trim();
|
|
8
|
+
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
9
|
+
const innerValue = value.slice(1, -1);
|
|
10
|
+
let bracketCount = 0;
|
|
11
|
+
for (let i = 0; i < innerValue.length; i++) if (innerValue[i] === "[") bracketCount++;
|
|
12
|
+
else if (innerValue[i] === "]") {
|
|
13
|
+
if (bracketCount === 0) return value;
|
|
14
|
+
bracketCount--;
|
|
15
|
+
}
|
|
16
|
+
if (bracketCount === 0) return innerValue.trim();
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/assign.ts
|
|
22
|
+
function assign(target, ...sources) {
|
|
23
|
+
for (const source of sources) for (const key in source) if (!target?.hasOwnProperty?.(key)) target[key] = source[key];
|
|
24
|
+
return target;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/cache-map.ts
|
|
28
|
+
var CacheMap = class {
|
|
29
|
+
cache;
|
|
30
|
+
keysInUse;
|
|
31
|
+
maxCacheSize;
|
|
32
|
+
constructor(maxCacheSize = 1e3) {
|
|
33
|
+
this.maxCacheSize = maxCacheSize;
|
|
34
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
35
|
+
this.keysInUse = [];
|
|
36
|
+
}
|
|
37
|
+
get(key) {
|
|
38
|
+
if (!this.cache.has(key)) return;
|
|
39
|
+
this.updateKeyUsage(key);
|
|
40
|
+
return this.cache.get(key);
|
|
41
|
+
}
|
|
42
|
+
set(key, value) {
|
|
43
|
+
if (!this.cache.has(key) && this.cache.size === this.maxCacheSize) this.evictLeastRecentlyUsed();
|
|
44
|
+
this.cache.set(key, value);
|
|
45
|
+
this.updateKeyUsage(key);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
delete(key) {
|
|
49
|
+
const result = this.cache.delete(key);
|
|
50
|
+
if (result) {
|
|
51
|
+
const index = this.keysInUse.indexOf(key);
|
|
52
|
+
if (index !== -1) this.keysInUse.splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
updateKeyUsage(key) {
|
|
57
|
+
const index = this.keysInUse.indexOf(key);
|
|
58
|
+
if (index !== -1) this.keysInUse.splice(index, 1);
|
|
59
|
+
this.keysInUse.push(key);
|
|
60
|
+
}
|
|
61
|
+
evictLeastRecentlyUsed() {
|
|
62
|
+
const keyToEvict = this.keysInUse.shift();
|
|
63
|
+
if (keyToEvict !== void 0) this.cache.delete(keyToEvict);
|
|
64
|
+
}
|
|
65
|
+
clear() {
|
|
66
|
+
this.cache.clear();
|
|
67
|
+
this.keysInUse = [];
|
|
68
|
+
}
|
|
69
|
+
has(key) {
|
|
70
|
+
return this.cache.has(key);
|
|
71
|
+
}
|
|
72
|
+
get size() {
|
|
73
|
+
return this.cache.size;
|
|
74
|
+
}
|
|
75
|
+
forEach(callback, thisArg) {
|
|
76
|
+
this.cache.forEach(callback, thisArg);
|
|
77
|
+
}
|
|
78
|
+
keys() {
|
|
79
|
+
return this.cache.keys();
|
|
80
|
+
}
|
|
81
|
+
values() {
|
|
82
|
+
return this.cache.values();
|
|
83
|
+
}
|
|
84
|
+
entries() {
|
|
85
|
+
return this.cache.entries();
|
|
86
|
+
}
|
|
87
|
+
getOrInsert(key, defaultValue) {
|
|
88
|
+
if (this.cache.has(key)) {
|
|
89
|
+
this.updateKeyUsage(key);
|
|
90
|
+
return this.cache.get(key);
|
|
91
|
+
}
|
|
92
|
+
this.set(key, defaultValue);
|
|
93
|
+
return defaultValue;
|
|
94
|
+
}
|
|
95
|
+
getOrInsertComputed(key, callback) {
|
|
96
|
+
if (this.cache.has(key)) {
|
|
97
|
+
this.updateKeyUsage(key);
|
|
98
|
+
return this.cache.get(key);
|
|
99
|
+
}
|
|
100
|
+
const value = callback(key);
|
|
101
|
+
this.set(key, value);
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
[Symbol.iterator]() {
|
|
105
|
+
return this.cache[Symbol.iterator]();
|
|
106
|
+
}
|
|
107
|
+
[Symbol.toStringTag] = "CacheMap";
|
|
108
|
+
toJSON = () => {
|
|
109
|
+
return this.cache;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/calc.ts
|
|
114
|
+
function isCssVar$1(value) {
|
|
115
|
+
return require_uniq.isObject(value) && "ref" in value;
|
|
116
|
+
}
|
|
117
|
+
function getRef(operand) {
|
|
118
|
+
return isCssVar$1(operand) ? operand.ref : operand.toString();
|
|
119
|
+
}
|
|
120
|
+
const calcRegex = /calc/g;
|
|
121
|
+
const toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(calcRegex, "");
|
|
122
|
+
const multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
|
|
123
|
+
const calc = { negate(x) {
|
|
124
|
+
const value = getRef(x);
|
|
125
|
+
if (value != null && !Number.isNaN(parseFloat(value))) return String(value).startsWith("-") ? String(value).slice(1) : `-${value}`;
|
|
126
|
+
return multiply(value, -1);
|
|
127
|
+
} };
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/camelcase-property.ts
|
|
130
|
+
const regex = /-(\w|$)/g;
|
|
131
|
+
const callback = (_dashChar, char) => char.toUpperCase();
|
|
132
|
+
const camelCaseProperty = require_uniq.memo((property) => {
|
|
133
|
+
if (property.startsWith("--")) return property;
|
|
134
|
+
let str = property.toLowerCase();
|
|
135
|
+
str = str.startsWith("-ms-") ? str.substring(1) : str;
|
|
136
|
+
return str.replace(regex, callback);
|
|
137
|
+
});
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/capitalize.ts
|
|
140
|
+
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
141
|
+
const camelCaseRegex = /([a-z])([A-Z])/g;
|
|
142
|
+
const dashCase = (s) => s.replace(camelCaseRegex, "$1-$2").toLowerCase();
|
|
143
|
+
const uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/css-var.ts
|
|
146
|
+
const escRegex = /[^a-zA-Z0-9_\u0081-\uffff-]/g;
|
|
147
|
+
function esc$1(string) {
|
|
148
|
+
return `${string}`.replace(escRegex, (s) => `\\${s}`);
|
|
149
|
+
}
|
|
150
|
+
const dashCaseRegex = /[A-Z]/g;
|
|
151
|
+
function dashCase$1(string) {
|
|
152
|
+
return string.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
|
|
153
|
+
}
|
|
154
|
+
function cssVar(name, options = {}) {
|
|
155
|
+
const { fallback = "", prefix = "", hash } = options;
|
|
156
|
+
const variable = hash ? [
|
|
157
|
+
"-",
|
|
158
|
+
prefix,
|
|
159
|
+
require_uniq.toHash(name)
|
|
160
|
+
].filter(Boolean).join("-") : dashCase$1([
|
|
161
|
+
"-",
|
|
162
|
+
prefix,
|
|
163
|
+
esc$1(name)
|
|
164
|
+
].filter(Boolean).join("-"));
|
|
165
|
+
return {
|
|
166
|
+
var: variable,
|
|
167
|
+
ref: `var(${variable}${fallback ? `, ${fallback}` : ""})`
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/deep-set.ts
|
|
172
|
+
const deepSet = (target, path, value) => {
|
|
173
|
+
const isValueObject = require_uniq.isObject(value);
|
|
174
|
+
if (!path.length && isValueObject) return require_uniq.mergeProps(target, value);
|
|
175
|
+
let current = target;
|
|
176
|
+
for (let i = 0; i < path.length; i++) {
|
|
177
|
+
const key = path[i];
|
|
178
|
+
current[key] ||= {};
|
|
179
|
+
if (i === path.length - 1) if (isValueObject && require_uniq.isObject(current[key])) current[key] = require_uniq.mergeProps(current[key], value);
|
|
180
|
+
else current[key] = value;
|
|
181
|
+
else current = current[key];
|
|
182
|
+
}
|
|
183
|
+
return target;
|
|
184
|
+
};
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/entries.ts
|
|
187
|
+
function fromEntries(entries) {
|
|
188
|
+
const result = {};
|
|
189
|
+
entries.forEach((kv) => {
|
|
190
|
+
result[kv[0]] = kv[1];
|
|
191
|
+
});
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function entries(obj) {
|
|
195
|
+
const result = [];
|
|
196
|
+
for (const key in obj) result.push([key, obj[key]]);
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
function mapEntries(obj, f) {
|
|
200
|
+
const result = {};
|
|
201
|
+
for (const key in obj) {
|
|
202
|
+
const kv = f(key, obj[key]);
|
|
203
|
+
result[kv[0]] = kv[1];
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/error.ts
|
|
209
|
+
var BambooError = class extends Error {
|
|
210
|
+
code;
|
|
211
|
+
hint;
|
|
212
|
+
constructor(code, message, opts) {
|
|
213
|
+
super(message, { cause: opts?.cause });
|
|
214
|
+
this.code = `ERR_BAMBOO_${code}`;
|
|
215
|
+
this.hint = opts?.hint;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/esc.ts
|
|
220
|
+
const rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g;
|
|
221
|
+
const fcssescape = function(ch, asCodePoint) {
|
|
222
|
+
if (!asCodePoint) return "\\" + ch;
|
|
223
|
+
if (ch === "\0") return "�";
|
|
224
|
+
if (ch === "-" && ch.length === 1) return "\\-";
|
|
225
|
+
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16);
|
|
226
|
+
};
|
|
227
|
+
const esc = (sel) => {
|
|
228
|
+
return (sel + "").replace(rcssescape, fcssescape);
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/flatten.ts
|
|
232
|
+
function filterDefault(path) {
|
|
233
|
+
if (path[0] === "DEFAULT") return path;
|
|
234
|
+
return path.filter((item) => item !== "DEFAULT");
|
|
235
|
+
}
|
|
236
|
+
function flatten(values, stop) {
|
|
237
|
+
const result = {};
|
|
238
|
+
require_uniq.walkObject(values, (token, paths) => {
|
|
239
|
+
paths = filterDefault(paths);
|
|
240
|
+
if (token) result[paths.join(".")] = token.value;
|
|
241
|
+
}, { stop: stop ?? ((v) => {
|
|
242
|
+
return require_uniq.isObject(v) && "value" in v;
|
|
243
|
+
}) });
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/get-or-create-set.ts
|
|
248
|
+
function getOrCreateSet(map, key) {
|
|
249
|
+
let set = map.get(key);
|
|
250
|
+
if (!set) {
|
|
251
|
+
map.set(key, /* @__PURE__ */ new Set());
|
|
252
|
+
set = map.get(key);
|
|
253
|
+
}
|
|
254
|
+
return set;
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/merge-anything.ts
|
|
258
|
+
/**
|
|
259
|
+
* Credits: https://github.com/mesqueeb/merge-anything
|
|
260
|
+
*/
|
|
261
|
+
const MERGE_OMIT$1 = new Set([
|
|
262
|
+
"__proto__",
|
|
263
|
+
"constructor",
|
|
264
|
+
"prototype"
|
|
265
|
+
]);
|
|
266
|
+
function concatArrays(originVal, newVal) {
|
|
267
|
+
if (Array.isArray(originVal) && Array.isArray(newVal)) return originVal.concat(newVal);
|
|
268
|
+
return newVal;
|
|
269
|
+
}
|
|
270
|
+
function assignProp(carry, key, newVal, originalObject) {
|
|
271
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
272
|
+
if (propType === "enumerable") carry[key] = newVal;
|
|
273
|
+
if (propType === "nonenumerable") Object.defineProperty(carry, key, {
|
|
274
|
+
value: newVal,
|
|
275
|
+
enumerable: false,
|
|
276
|
+
writable: true,
|
|
277
|
+
configurable: true
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function mergeRecursively(origin, newComer, compareFn) {
|
|
281
|
+
if (!require_uniq.isObject(newComer)) return newComer;
|
|
282
|
+
let newObject = {};
|
|
283
|
+
if (require_uniq.isObject(origin)) {
|
|
284
|
+
const props = Object.getOwnPropertyNames(origin);
|
|
285
|
+
const symbols = Object.getOwnPropertySymbols(origin);
|
|
286
|
+
newObject = [...props, ...symbols].reduce((carry, key) => {
|
|
287
|
+
if (require_uniq.isString(key) && MERGE_OMIT$1.has(key)) return carry;
|
|
288
|
+
const targetVal = origin[key];
|
|
289
|
+
if (!require_uniq.isSymbol(key) && !Object.getOwnPropertyNames(newComer).includes(key) || require_uniq.isSymbol(key) && !Object.getOwnPropertySymbols(newComer).includes(key)) assignProp(carry, key, targetVal, origin);
|
|
290
|
+
return carry;
|
|
291
|
+
}, {});
|
|
292
|
+
}
|
|
293
|
+
const props = Object.getOwnPropertyNames(newComer);
|
|
294
|
+
const symbols = Object.getOwnPropertySymbols(newComer);
|
|
295
|
+
return [...props, ...symbols].reduce((carry, key) => {
|
|
296
|
+
if (require_uniq.isString(key) && MERGE_OMIT$1.has(key)) return carry;
|
|
297
|
+
let newVal = newComer[key];
|
|
298
|
+
const targetVal = require_uniq.isObject(origin) ? origin[key] : void 0;
|
|
299
|
+
if (targetVal !== void 0 && require_uniq.isObject(newVal)) newVal = mergeRecursively(targetVal, newVal, compareFn);
|
|
300
|
+
assignProp(carry, key, compareFn ? compareFn(targetVal, newVal, key) : newVal, newComer);
|
|
301
|
+
return carry;
|
|
302
|
+
}, newObject);
|
|
303
|
+
}
|
|
304
|
+
function mergeAndConcat(object, ...otherObjects) {
|
|
305
|
+
return otherObjects.reduce((result, newComer) => {
|
|
306
|
+
return mergeRecursively(result, newComer, concatArrays);
|
|
307
|
+
}, object);
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/merge-with.ts
|
|
311
|
+
const MERGE_OMIT = new Set([
|
|
312
|
+
"__proto__",
|
|
313
|
+
"constructor",
|
|
314
|
+
"prototype"
|
|
315
|
+
]);
|
|
316
|
+
function mergeWith(target, ...sources) {
|
|
317
|
+
const customizer = sources.pop();
|
|
318
|
+
for (const source of sources) for (const key in source) {
|
|
319
|
+
if (require_uniq.isString(key) && MERGE_OMIT.has(key)) continue;
|
|
320
|
+
const merged = customizer(target[key], source[key]);
|
|
321
|
+
if (merged === void 0) if (require_uniq.isObject(target[key]) && require_uniq.isObject(source[key])) target[key] = mergeWith({}, target[key], source[key], customizer);
|
|
322
|
+
else target[key] = source[key];
|
|
323
|
+
else target[key] = merged;
|
|
324
|
+
}
|
|
325
|
+
return target;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/traverse.ts
|
|
329
|
+
const defaultOptions = {
|
|
330
|
+
separator: ".",
|
|
331
|
+
maxDepth: Infinity
|
|
332
|
+
};
|
|
333
|
+
function traverse(obj, callback, options = defaultOptions) {
|
|
334
|
+
const maxDepth = options.maxDepth ?? defaultOptions.maxDepth;
|
|
335
|
+
const separator = options.separator ?? defaultOptions.separator;
|
|
336
|
+
const stack = [{
|
|
337
|
+
value: obj,
|
|
338
|
+
path: "",
|
|
339
|
+
paths: [],
|
|
340
|
+
depth: -1,
|
|
341
|
+
parent: null,
|
|
342
|
+
key: ""
|
|
343
|
+
}];
|
|
344
|
+
while (stack.length > 0) {
|
|
345
|
+
const currentItem = stack.pop();
|
|
346
|
+
if (currentItem.parent !== null) callback(currentItem);
|
|
347
|
+
if (options.stop?.(currentItem)) continue;
|
|
348
|
+
if (require_uniq.isObjectOrArray(currentItem.value) && currentItem.depth < maxDepth) {
|
|
349
|
+
const keys = Object.keys(currentItem.value);
|
|
350
|
+
for (let i = keys.length - 1; i >= 0; i--) {
|
|
351
|
+
const key = keys[i];
|
|
352
|
+
const value = currentItem.value[key];
|
|
353
|
+
const path = currentItem.path ? currentItem.path + separator + key : key;
|
|
354
|
+
const paths = currentItem.paths.concat(key);
|
|
355
|
+
stack.push({
|
|
356
|
+
value,
|
|
357
|
+
path,
|
|
358
|
+
paths,
|
|
359
|
+
depth: currentItem.depth + 1,
|
|
360
|
+
parent: currentItem.value,
|
|
361
|
+
key
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/omit.ts
|
|
369
|
+
const omit = (obj, paths) => {
|
|
370
|
+
const result = { ...obj };
|
|
371
|
+
traverse(result, ({ path, parent, key }) => {
|
|
372
|
+
if (paths.includes(path)) delete parent[key];
|
|
373
|
+
});
|
|
374
|
+
return result;
|
|
375
|
+
};
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/bamboo-config-name.ts
|
|
378
|
+
const BAMBOO_CONFIG_NAME = "__bamboo.config__";
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/split.ts
|
|
381
|
+
function splitBy(value, separator = ",") {
|
|
382
|
+
const result = [];
|
|
383
|
+
let current = "";
|
|
384
|
+
let depth = 0;
|
|
385
|
+
for (let i = 0; i < value.length; i++) {
|
|
386
|
+
const char = value[i];
|
|
387
|
+
if (char === "(") depth++;
|
|
388
|
+
else if (char === ")") depth--;
|
|
389
|
+
else if (char === separator && depth === 0) {
|
|
390
|
+
result.push(current);
|
|
391
|
+
current = "";
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
current += char;
|
|
395
|
+
}
|
|
396
|
+
result.push(current);
|
|
397
|
+
return result;
|
|
398
|
+
}
|
|
399
|
+
function splitDotPath(path) {
|
|
400
|
+
return path.split(".").reduce((acc, curr) => {
|
|
401
|
+
const last = acc[acc.length - 1];
|
|
402
|
+
if (last != null && !isNaN(Number(last)) && !isNaN(Number(curr))) acc[acc.length - 1] = `${last}.${curr}`;
|
|
403
|
+
else acc.push(curr);
|
|
404
|
+
return acc;
|
|
405
|
+
}, []);
|
|
406
|
+
}
|
|
407
|
+
function getNegativePath(path) {
|
|
408
|
+
return path.slice(0, -1).concat(`-${path.at(-1)}`);
|
|
409
|
+
}
|
|
410
|
+
function getDotPath(obj, path, fallback) {
|
|
411
|
+
if (typeof path !== "string") return fallback;
|
|
412
|
+
const idx = path.indexOf(".");
|
|
413
|
+
if (idx === -1) return obj?.[path] ?? fallback;
|
|
414
|
+
const key = path.slice(0, idx);
|
|
415
|
+
const nextPath = path.slice(idx + 1);
|
|
416
|
+
const checkValue = obj?.[key]?.[nextPath];
|
|
417
|
+
if (checkValue) return checkValue;
|
|
418
|
+
return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/pick.ts
|
|
422
|
+
const pick = (obj, paths) => {
|
|
423
|
+
const result = {};
|
|
424
|
+
traverse(obj, ({ path, value }) => {
|
|
425
|
+
if (paths.includes(path)) deepSet(result, splitDotPath(path), value);
|
|
426
|
+
});
|
|
427
|
+
return result;
|
|
428
|
+
};
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/property-priority.ts
|
|
431
|
+
/**
|
|
432
|
+
* Slightly modified from https://github.com/facebook/stylex/blob/main/packages/%40stylexjs/babel-plugin/src/shared/utils/property-priorities.js
|
|
433
|
+
* License: MIT
|
|
434
|
+
*/
|
|
435
|
+
const longHandPhysical = /* @__PURE__ */ new Set();
|
|
436
|
+
const longHandLogical = /* @__PURE__ */ new Set();
|
|
437
|
+
const shorthandsOfLonghands = /* @__PURE__ */ new Set();
|
|
438
|
+
const shorthandsOfShorthands = /* @__PURE__ */ new Set();
|
|
439
|
+
longHandLogical.add("backgroundBlendMode");
|
|
440
|
+
longHandLogical.add("isolation");
|
|
441
|
+
longHandLogical.add("mixBlendMode");
|
|
442
|
+
shorthandsOfShorthands.add("animation");
|
|
443
|
+
longHandLogical.add("animationComposition");
|
|
444
|
+
longHandLogical.add("animationDelay");
|
|
445
|
+
longHandLogical.add("animationDirection");
|
|
446
|
+
longHandLogical.add("animationDuration");
|
|
447
|
+
longHandLogical.add("animationFillMode");
|
|
448
|
+
longHandLogical.add("animationIterationCount");
|
|
449
|
+
longHandLogical.add("animationName");
|
|
450
|
+
longHandLogical.add("animationPlayState");
|
|
451
|
+
shorthandsOfLonghands.add("animationRange");
|
|
452
|
+
longHandLogical.add("animationRangeEnd");
|
|
453
|
+
longHandLogical.add("animationRangeStart");
|
|
454
|
+
longHandLogical.add("animationTimingFunction");
|
|
455
|
+
longHandLogical.add("animationTimeline");
|
|
456
|
+
shorthandsOfLonghands.add("scrollTimeline");
|
|
457
|
+
longHandLogical.add("scrollTimelineAxis");
|
|
458
|
+
longHandLogical.add("scrollTimelineName");
|
|
459
|
+
longHandLogical.add("timelineScope");
|
|
460
|
+
shorthandsOfLonghands.add("viewTimeline");
|
|
461
|
+
longHandLogical.add("viewTimelineAxis");
|
|
462
|
+
longHandLogical.add("viewTimelineInset");
|
|
463
|
+
longHandLogical.add("viewTimelineName");
|
|
464
|
+
shorthandsOfShorthands.add("background");
|
|
465
|
+
longHandLogical.add("backgroundAttachment");
|
|
466
|
+
longHandLogical.add("backgroundClip");
|
|
467
|
+
longHandLogical.add("backgroundColor");
|
|
468
|
+
longHandLogical.add("backgroundImage");
|
|
469
|
+
longHandLogical.add("backgroundOrigin");
|
|
470
|
+
longHandLogical.add("backgroundRepeat");
|
|
471
|
+
longHandLogical.add("backgroundSize");
|
|
472
|
+
shorthandsOfLonghands.add("backgroundPosition");
|
|
473
|
+
longHandLogical.add("backgroundPositionX");
|
|
474
|
+
longHandLogical.add("backgroundPositionY");
|
|
475
|
+
shorthandsOfShorthands.add("border");
|
|
476
|
+
shorthandsOfLonghands.add("borderColor");
|
|
477
|
+
shorthandsOfLonghands.add("borderStyle");
|
|
478
|
+
shorthandsOfLonghands.add("borderWidth");
|
|
479
|
+
shorthandsOfShorthands.add("borderBlock");
|
|
480
|
+
longHandLogical.add("borderBlockColor");
|
|
481
|
+
longHandLogical.add("borderBlockStyle");
|
|
482
|
+
longHandLogical.add("borderBlockWidth");
|
|
483
|
+
shorthandsOfLonghands.add("borderBlockStart");
|
|
484
|
+
shorthandsOfLonghands.add("borderTop");
|
|
485
|
+
longHandLogical.add("borderBlockStartColor");
|
|
486
|
+
longHandPhysical.add("borderTopColor");
|
|
487
|
+
longHandLogical.add("borderBlockStartStyle");
|
|
488
|
+
longHandPhysical.add("borderTopStyle");
|
|
489
|
+
longHandLogical.add("borderBlockStartWidth");
|
|
490
|
+
longHandPhysical.add("borderTopWidth");
|
|
491
|
+
shorthandsOfLonghands.add("borderBlockEnd");
|
|
492
|
+
shorthandsOfLonghands.add("borderBottom");
|
|
493
|
+
longHandLogical.add("borderBlockEndColor");
|
|
494
|
+
longHandPhysical.add("borderBottomColor");
|
|
495
|
+
longHandLogical.add("borderBlockEndStyle");
|
|
496
|
+
longHandPhysical.add("borderBottomStyle");
|
|
497
|
+
longHandLogical.add("borderBlockEndWidth");
|
|
498
|
+
longHandPhysical.add("borderBottomWidth");
|
|
499
|
+
shorthandsOfShorthands.add("borderInline");
|
|
500
|
+
shorthandsOfLonghands.add("borderInlineColor");
|
|
501
|
+
shorthandsOfLonghands.add("borderInlineStyle");
|
|
502
|
+
shorthandsOfLonghands.add("borderInlineWidth");
|
|
503
|
+
shorthandsOfLonghands.add("borderInlineStart");
|
|
504
|
+
shorthandsOfLonghands.add("borderLeft");
|
|
505
|
+
longHandLogical.add("borderInlineStartColor");
|
|
506
|
+
longHandPhysical.add("borderLeftColor");
|
|
507
|
+
longHandLogical.add("borderInlineStartStyle");
|
|
508
|
+
longHandPhysical.add("borderLeftStyle");
|
|
509
|
+
longHandLogical.add("borderInlineStartWidth");
|
|
510
|
+
longHandPhysical.add("borderLeftWidth");
|
|
511
|
+
shorthandsOfLonghands.add("borderInlineEnd");
|
|
512
|
+
shorthandsOfLonghands.add("borderRight");
|
|
513
|
+
longHandLogical.add("borderInlineEndColor");
|
|
514
|
+
longHandPhysical.add("borderRightColor");
|
|
515
|
+
longHandLogical.add("borderInlineEndStyle");
|
|
516
|
+
longHandPhysical.add("borderRightStyle");
|
|
517
|
+
longHandLogical.add("borderInlineEndWidth");
|
|
518
|
+
longHandPhysical.add("borderRightWidth");
|
|
519
|
+
shorthandsOfLonghands.add("borderImage");
|
|
520
|
+
longHandLogical.add("borderImageOutset");
|
|
521
|
+
longHandLogical.add("borderImageRepeat");
|
|
522
|
+
longHandLogical.add("borderImageSlice");
|
|
523
|
+
longHandLogical.add("borderImageSource");
|
|
524
|
+
longHandLogical.add("borderImageWidth");
|
|
525
|
+
shorthandsOfLonghands.add("borderRadius");
|
|
526
|
+
longHandLogical.add("borderStartEndRadius");
|
|
527
|
+
longHandLogical.add("borderStartStartRadius");
|
|
528
|
+
longHandLogical.add("borderEndEndRadius");
|
|
529
|
+
longHandLogical.add("borderEndStartRadius");
|
|
530
|
+
longHandPhysical.add("borderTopLeftRadius");
|
|
531
|
+
longHandPhysical.add("borderTopRightRadius");
|
|
532
|
+
longHandPhysical.add("borderBottomLeftRadius");
|
|
533
|
+
longHandPhysical.add("borderBottomRightRadius");
|
|
534
|
+
longHandLogical.add("boxShadow");
|
|
535
|
+
longHandLogical.add("accentColor");
|
|
536
|
+
longHandLogical.add("appearance");
|
|
537
|
+
longHandLogical.add("aspectRatio");
|
|
538
|
+
shorthandsOfLonghands.add("caret");
|
|
539
|
+
longHandLogical.add("caretColor");
|
|
540
|
+
longHandLogical.add("caretShape");
|
|
541
|
+
longHandLogical.add("cursor");
|
|
542
|
+
longHandLogical.add("imeMode");
|
|
543
|
+
longHandLogical.add("inputSecurity");
|
|
544
|
+
shorthandsOfLonghands.add("outline");
|
|
545
|
+
longHandLogical.add("outlineColor");
|
|
546
|
+
longHandLogical.add("outlineOffset");
|
|
547
|
+
longHandLogical.add("outlineStyle");
|
|
548
|
+
longHandLogical.add("outlineWidth");
|
|
549
|
+
longHandLogical.add("pointerEvents");
|
|
550
|
+
longHandLogical.add("resize");
|
|
551
|
+
longHandLogical.add("textOverflow");
|
|
552
|
+
longHandLogical.add("userSelect");
|
|
553
|
+
shorthandsOfLonghands.add("gridGap");
|
|
554
|
+
shorthandsOfLonghands.add("gap");
|
|
555
|
+
longHandLogical.add("gridRowGap");
|
|
556
|
+
longHandLogical.add("rowGap");
|
|
557
|
+
longHandLogical.add("gridColumnGap");
|
|
558
|
+
longHandLogical.add("columnGap");
|
|
559
|
+
shorthandsOfLonghands.add("placeContent");
|
|
560
|
+
longHandLogical.add("alignContent");
|
|
561
|
+
longHandLogical.add("justifyContent");
|
|
562
|
+
shorthandsOfLonghands.add("placeItems");
|
|
563
|
+
longHandLogical.add("alignItems");
|
|
564
|
+
longHandLogical.add("justifyItems");
|
|
565
|
+
shorthandsOfLonghands.add("placeSelf");
|
|
566
|
+
longHandLogical.add("alignSelf");
|
|
567
|
+
longHandLogical.add("justifySelf");
|
|
568
|
+
longHandLogical.add("boxSizing");
|
|
569
|
+
longHandLogical.add("fieldSizing");
|
|
570
|
+
longHandLogical.add("blockSize");
|
|
571
|
+
longHandPhysical.add("height");
|
|
572
|
+
longHandLogical.add("inlineSize");
|
|
573
|
+
longHandPhysical.add("width");
|
|
574
|
+
longHandLogical.add("maxBlockSize");
|
|
575
|
+
longHandPhysical.add("maxHeight");
|
|
576
|
+
longHandLogical.add("maxInlineSize");
|
|
577
|
+
longHandPhysical.add("maxWidth");
|
|
578
|
+
longHandLogical.add("minBlockSize");
|
|
579
|
+
longHandPhysical.add("minHeight");
|
|
580
|
+
longHandLogical.add("minInlineSize");
|
|
581
|
+
longHandPhysical.add("minWidth");
|
|
582
|
+
shorthandsOfShorthands.add("margin");
|
|
583
|
+
shorthandsOfLonghands.add("marginBlock");
|
|
584
|
+
longHandLogical.add("marginBlockStart");
|
|
585
|
+
longHandPhysical.add("marginTop");
|
|
586
|
+
longHandLogical.add("marginBlockEnd");
|
|
587
|
+
longHandPhysical.add("marginBottom");
|
|
588
|
+
shorthandsOfLonghands.add("marginInline");
|
|
589
|
+
longHandLogical.add("marginInlineStart");
|
|
590
|
+
longHandPhysical.add("marginLeft");
|
|
591
|
+
longHandLogical.add("marginInlineEnd");
|
|
592
|
+
longHandPhysical.add("marginRight");
|
|
593
|
+
longHandLogical.add("marginTrim");
|
|
594
|
+
shorthandsOfLonghands.add("overscrollBehavior");
|
|
595
|
+
longHandLogical.add("overscrollBehaviorBlock");
|
|
596
|
+
longHandPhysical.add("overscrollBehaviorY");
|
|
597
|
+
longHandLogical.add("overscrollBehaviorInline");
|
|
598
|
+
longHandPhysical.add("overscrollBehaviorX");
|
|
599
|
+
shorthandsOfShorthands.add("padding");
|
|
600
|
+
shorthandsOfLonghands.add("paddingBlock");
|
|
601
|
+
longHandLogical.add("paddingBlockStart");
|
|
602
|
+
longHandPhysical.add("paddingTop");
|
|
603
|
+
longHandLogical.add("paddingBlockEnd");
|
|
604
|
+
longHandPhysical.add("paddingBottom");
|
|
605
|
+
shorthandsOfLonghands.add("paddingInline");
|
|
606
|
+
longHandLogical.add("paddingInlineStart");
|
|
607
|
+
longHandPhysical.add("paddingLeft");
|
|
608
|
+
longHandLogical.add("paddingInlineEnd");
|
|
609
|
+
longHandPhysical.add("paddingRight");
|
|
610
|
+
longHandLogical.add("visibility");
|
|
611
|
+
longHandLogical.add("color");
|
|
612
|
+
longHandLogical.add("colorScheme");
|
|
613
|
+
longHandLogical.add("forcedColorAdjust");
|
|
614
|
+
longHandLogical.add("opacity");
|
|
615
|
+
longHandLogical.add("printColorAdjust");
|
|
616
|
+
shorthandsOfLonghands.add("columns");
|
|
617
|
+
longHandLogical.add("columnCount");
|
|
618
|
+
longHandLogical.add("columnWidth");
|
|
619
|
+
longHandLogical.add("columnFill");
|
|
620
|
+
longHandLogical.add("columnSpan");
|
|
621
|
+
shorthandsOfLonghands.add("columnRule");
|
|
622
|
+
longHandLogical.add("columnRuleColor");
|
|
623
|
+
longHandLogical.add("columnRuleStyle");
|
|
624
|
+
longHandLogical.add("columnRuleWidth");
|
|
625
|
+
longHandLogical.add("contain");
|
|
626
|
+
shorthandsOfLonghands.add("containIntrinsicSize");
|
|
627
|
+
longHandLogical.add("containIntrinsicBlockSize");
|
|
628
|
+
longHandLogical.add("containIntrinsicWidth");
|
|
629
|
+
longHandLogical.add("containIntrinsicHeight");
|
|
630
|
+
longHandLogical.add("containIntrinsicInlineSize");
|
|
631
|
+
shorthandsOfLonghands.add("container");
|
|
632
|
+
longHandLogical.add("containerName");
|
|
633
|
+
longHandLogical.add("containerType");
|
|
634
|
+
longHandLogical.add("contentVisibility");
|
|
635
|
+
longHandLogical.add("counterIncrement");
|
|
636
|
+
longHandLogical.add("counterReset");
|
|
637
|
+
longHandLogical.add("counterSet");
|
|
638
|
+
longHandLogical.add("display");
|
|
639
|
+
shorthandsOfLonghands.add("flex");
|
|
640
|
+
longHandLogical.add("flexBasis");
|
|
641
|
+
longHandLogical.add("flexGrow");
|
|
642
|
+
longHandLogical.add("flexShrink");
|
|
643
|
+
shorthandsOfLonghands.add("flexFlow");
|
|
644
|
+
longHandLogical.add("flexDirection");
|
|
645
|
+
longHandLogical.add("flexWrap");
|
|
646
|
+
longHandLogical.add("order");
|
|
647
|
+
shorthandsOfShorthands.add("font");
|
|
648
|
+
longHandLogical.add("fontFamily");
|
|
649
|
+
longHandLogical.add("fontSize");
|
|
650
|
+
longHandLogical.add("fontStretch");
|
|
651
|
+
longHandLogical.add("fontStyle");
|
|
652
|
+
longHandLogical.add("fontWeight");
|
|
653
|
+
longHandLogical.add("lineHeight");
|
|
654
|
+
shorthandsOfLonghands.add("fontVariant");
|
|
655
|
+
longHandLogical.add("fontVariantAlternates");
|
|
656
|
+
longHandLogical.add("fontVariantCaps");
|
|
657
|
+
longHandLogical.add("fontVariantEastAsian");
|
|
658
|
+
longHandLogical.add("fontVariantEmoji");
|
|
659
|
+
longHandLogical.add("fontVariantLigatures");
|
|
660
|
+
longHandLogical.add("fontVariantNumeric");
|
|
661
|
+
longHandLogical.add("fontVariantPosition");
|
|
662
|
+
longHandLogical.add("fontFeatureSettings");
|
|
663
|
+
longHandLogical.add("fontKerning");
|
|
664
|
+
longHandLogical.add("fontLanguageOverride");
|
|
665
|
+
longHandLogical.add("fontOpticalSizing");
|
|
666
|
+
longHandLogical.add("fontPalette");
|
|
667
|
+
longHandLogical.add("fontVariationSettings");
|
|
668
|
+
longHandLogical.add("fontSizeAdjust");
|
|
669
|
+
longHandLogical.add("fontSmooth");
|
|
670
|
+
longHandLogical.add("fontSynthesisPosition");
|
|
671
|
+
longHandLogical.add("fontSynthesisSmallCaps");
|
|
672
|
+
longHandLogical.add("fontSynthesisStyle");
|
|
673
|
+
longHandLogical.add("fontSynthesisWeight");
|
|
674
|
+
shorthandsOfLonghands.add("fontSynthesis");
|
|
675
|
+
longHandLogical.add("lineHeightStep");
|
|
676
|
+
longHandLogical.add("boxDecorationBreak");
|
|
677
|
+
longHandLogical.add("breakAfter");
|
|
678
|
+
longHandLogical.add("breakBefore");
|
|
679
|
+
longHandLogical.add("breakInside");
|
|
680
|
+
longHandLogical.add("orphans");
|
|
681
|
+
longHandLogical.add("widows");
|
|
682
|
+
longHandLogical.add("content");
|
|
683
|
+
longHandLogical.add("quotes");
|
|
684
|
+
shorthandsOfShorthands.add("grid");
|
|
685
|
+
longHandLogical.add("gridAutoFlow");
|
|
686
|
+
longHandLogical.add("gridAutoRows");
|
|
687
|
+
longHandLogical.add("gridAutoColumns");
|
|
688
|
+
shorthandsOfShorthands.add("gridTemplate");
|
|
689
|
+
shorthandsOfLonghands.add("gridTemplateAreas");
|
|
690
|
+
longHandLogical.add("gridTemplateColumns");
|
|
691
|
+
longHandLogical.add("gridTemplateRows");
|
|
692
|
+
shorthandsOfShorthands.add("gridArea");
|
|
693
|
+
shorthandsOfLonghands.add("gridRow");
|
|
694
|
+
longHandLogical.add("gridRowStart");
|
|
695
|
+
longHandLogical.add("gridRowEnd");
|
|
696
|
+
shorthandsOfLonghands.add("gridColumn");
|
|
697
|
+
longHandLogical.add("gridColumnStart");
|
|
698
|
+
longHandLogical.add("gridColumnEnd");
|
|
699
|
+
longHandLogical.add("alignTracks");
|
|
700
|
+
longHandLogical.add("justifyTracks");
|
|
701
|
+
longHandLogical.add("masonryAutoFlow");
|
|
702
|
+
longHandLogical.add("imageOrientation");
|
|
703
|
+
longHandLogical.add("imageRendering");
|
|
704
|
+
longHandLogical.add("imageResolution");
|
|
705
|
+
longHandLogical.add("objectFit");
|
|
706
|
+
longHandLogical.add("objectPosition");
|
|
707
|
+
longHandLogical.add("initialLetter");
|
|
708
|
+
longHandLogical.add("initialLetterAlign");
|
|
709
|
+
shorthandsOfLonghands.add("listStyle");
|
|
710
|
+
longHandLogical.add("listStyleImage");
|
|
711
|
+
longHandLogical.add("listStylePosition");
|
|
712
|
+
longHandLogical.add("listStyleType");
|
|
713
|
+
longHandLogical.add("clip");
|
|
714
|
+
longHandLogical.add("clipPath");
|
|
715
|
+
shorthandsOfLonghands.add("mask");
|
|
716
|
+
longHandLogical.add("maskClip");
|
|
717
|
+
longHandLogical.add("maskComposite");
|
|
718
|
+
longHandLogical.add("maskImage");
|
|
719
|
+
longHandLogical.add("maskMode");
|
|
720
|
+
longHandLogical.add("maskOrigin");
|
|
721
|
+
longHandLogical.add("maskPosition");
|
|
722
|
+
longHandLogical.add("maskRepeat");
|
|
723
|
+
longHandLogical.add("maskSize");
|
|
724
|
+
longHandLogical.add("maskType");
|
|
725
|
+
shorthandsOfLonghands.add("maskBorder");
|
|
726
|
+
longHandLogical.add("maskBorderMode");
|
|
727
|
+
longHandLogical.add("maskBorderOutset");
|
|
728
|
+
longHandLogical.add("maskBorderRepeat");
|
|
729
|
+
longHandLogical.add("maskBorderSlice");
|
|
730
|
+
longHandLogical.add("maskBorderSource");
|
|
731
|
+
longHandLogical.add("maskBorderWidth");
|
|
732
|
+
shorthandsOfShorthands.add("all");
|
|
733
|
+
longHandLogical.add("textRendering");
|
|
734
|
+
longHandLogical.add("zoom");
|
|
735
|
+
shorthandsOfLonghands.add("offset");
|
|
736
|
+
longHandLogical.add("offsetAnchor");
|
|
737
|
+
longHandLogical.add("offsetDistance");
|
|
738
|
+
longHandLogical.add("offsetPath");
|
|
739
|
+
longHandLogical.add("offsetPosition");
|
|
740
|
+
longHandLogical.add("offsetRotate");
|
|
741
|
+
longHandLogical.add("WebkitBoxOrient");
|
|
742
|
+
longHandLogical.add("WebkitLineClamp");
|
|
743
|
+
longHandPhysical.add("lineClamp");
|
|
744
|
+
longHandPhysical.add("maxLines");
|
|
745
|
+
longHandLogical.add("blockOverflow");
|
|
746
|
+
shorthandsOfLonghands.add("overflow");
|
|
747
|
+
longHandLogical.add("overflowBlock");
|
|
748
|
+
longHandPhysical.add("overflowY");
|
|
749
|
+
longHandLogical.add("overflowInline");
|
|
750
|
+
longHandPhysical.add("overflowX");
|
|
751
|
+
longHandLogical.add("overflowClipMargin");
|
|
752
|
+
longHandLogical.add("scrollGutter");
|
|
753
|
+
longHandLogical.add("scrollBehavior");
|
|
754
|
+
longHandLogical.add("page");
|
|
755
|
+
longHandLogical.add("pageBreakAfter");
|
|
756
|
+
longHandLogical.add("pageBreakBefore");
|
|
757
|
+
longHandLogical.add("pageBreakInside");
|
|
758
|
+
shorthandsOfShorthands.add("inset");
|
|
759
|
+
shorthandsOfLonghands.add("insetBlock");
|
|
760
|
+
longHandLogical.add("insetBlockStart");
|
|
761
|
+
longHandPhysical.add("top");
|
|
762
|
+
longHandLogical.add("insetBlockEnd");
|
|
763
|
+
longHandPhysical.add("bottom");
|
|
764
|
+
shorthandsOfLonghands.add("insetInline");
|
|
765
|
+
longHandLogical.add("insetInlineStart");
|
|
766
|
+
longHandPhysical.add("left");
|
|
767
|
+
longHandLogical.add("insetInlineEnd");
|
|
768
|
+
longHandPhysical.add("right");
|
|
769
|
+
longHandLogical.add("clear");
|
|
770
|
+
longHandLogical.add("float");
|
|
771
|
+
longHandLogical.add("overlay");
|
|
772
|
+
longHandLogical.add("position");
|
|
773
|
+
longHandLogical.add("zIndex");
|
|
774
|
+
longHandLogical.add("rubyAlign");
|
|
775
|
+
longHandLogical.add("rubyMerge");
|
|
776
|
+
longHandLogical.add("rubyPosition");
|
|
777
|
+
longHandLogical.add("overflowAnchor");
|
|
778
|
+
shorthandsOfShorthands.add("scrollMargin");
|
|
779
|
+
shorthandsOfLonghands.add("scrollMarginBlock");
|
|
780
|
+
longHandLogical.add("scrollMarginBlockStart");
|
|
781
|
+
longHandPhysical.add("scrollMarginTop");
|
|
782
|
+
longHandLogical.add("scrollMarginBlockEnd");
|
|
783
|
+
longHandPhysical.add("scrollMarginBottom");
|
|
784
|
+
shorthandsOfLonghands.add("scrollMarginInline");
|
|
785
|
+
longHandLogical.add("scrollMarginInlineStart");
|
|
786
|
+
longHandPhysical.add("scrollMarginLeft");
|
|
787
|
+
longHandLogical.add("scrollMarginInlineEnd");
|
|
788
|
+
longHandPhysical.add("scrollMarginRight");
|
|
789
|
+
shorthandsOfShorthands.add("scrollPadding");
|
|
790
|
+
shorthandsOfLonghands.add("scrollPaddingBlock");
|
|
791
|
+
longHandLogical.add("scrollPaddingBlockStart");
|
|
792
|
+
longHandPhysical.add("scrollPaddingTop");
|
|
793
|
+
longHandLogical.add("scrollPaddingBlockEnd");
|
|
794
|
+
longHandPhysical.add("scrollPaddingBottom");
|
|
795
|
+
shorthandsOfLonghands.add("scrollPaddingInline");
|
|
796
|
+
longHandLogical.add("scrollPaddingInlineStart");
|
|
797
|
+
longHandPhysical.add("scrollPaddingLeft");
|
|
798
|
+
longHandLogical.add("scrollPaddingInlineEnd");
|
|
799
|
+
longHandPhysical.add("scrollPaddingRight");
|
|
800
|
+
longHandLogical.add("scrollSnapAlign");
|
|
801
|
+
longHandLogical.add("scrollSnapStop");
|
|
802
|
+
shorthandsOfLonghands.add("scrollSnapType");
|
|
803
|
+
longHandLogical.add("scrollbarColor");
|
|
804
|
+
longHandLogical.add("scrollbarWidth");
|
|
805
|
+
longHandLogical.add("shapeImageThreshold");
|
|
806
|
+
longHandLogical.add("shapeMargin");
|
|
807
|
+
longHandLogical.add("shapeOutside");
|
|
808
|
+
longHandLogical.add("azimuth");
|
|
809
|
+
longHandLogical.add("borderCollapse");
|
|
810
|
+
longHandLogical.add("borderSpacing");
|
|
811
|
+
longHandLogical.add("captionSide");
|
|
812
|
+
longHandLogical.add("emptyCells");
|
|
813
|
+
longHandLogical.add("tableLayout");
|
|
814
|
+
longHandLogical.add("verticalAlign");
|
|
815
|
+
shorthandsOfLonghands.add("textDecoration");
|
|
816
|
+
longHandLogical.add("textDecorationColor");
|
|
817
|
+
longHandLogical.add("textDecorationLine");
|
|
818
|
+
longHandLogical.add("textDecorationSkip");
|
|
819
|
+
longHandLogical.add("textDecorationSkipInk");
|
|
820
|
+
longHandLogical.add("textDecorationStyle");
|
|
821
|
+
longHandLogical.add("textDecorationThickness");
|
|
822
|
+
shorthandsOfLonghands.add("WebkitTextStroke");
|
|
823
|
+
longHandLogical.add("WebkitTextStrokeColor");
|
|
824
|
+
longHandLogical.add("WebkitTextStrokeWidth");
|
|
825
|
+
longHandLogical.add("WebkitTextFillColor");
|
|
826
|
+
shorthandsOfLonghands.add("textEmphasis");
|
|
827
|
+
longHandLogical.add("textEmphasisColor");
|
|
828
|
+
longHandLogical.add("textEmphasisPosition");
|
|
829
|
+
longHandLogical.add("textEmphasisStyle");
|
|
830
|
+
longHandLogical.add("textShadow");
|
|
831
|
+
longHandLogical.add("textUnderlineOffset");
|
|
832
|
+
longHandLogical.add("textUnderlinePosition");
|
|
833
|
+
longHandLogical.add("hangingPunctuation");
|
|
834
|
+
longHandLogical.add("hyphenateCharacter");
|
|
835
|
+
longHandLogical.add("hyphenateLimitChars");
|
|
836
|
+
longHandLogical.add("hyphens");
|
|
837
|
+
longHandLogical.add("letterSpacing");
|
|
838
|
+
longHandLogical.add("lineBreak");
|
|
839
|
+
longHandLogical.add("overflowWrap");
|
|
840
|
+
longHandLogical.add("paintOrder");
|
|
841
|
+
longHandLogical.add("tabSize");
|
|
842
|
+
longHandLogical.add("textAlign");
|
|
843
|
+
longHandLogical.add("textAlignLast");
|
|
844
|
+
longHandLogical.add("textIndent");
|
|
845
|
+
longHandLogical.add("textJustify");
|
|
846
|
+
longHandLogical.add("textSizeAdjust");
|
|
847
|
+
longHandLogical.add("textTransform");
|
|
848
|
+
shorthandsOfLonghands.add("textWrap");
|
|
849
|
+
longHandLogical.add("textWrapMode");
|
|
850
|
+
longHandLogical.add("textWrapStyle");
|
|
851
|
+
longHandLogical.add("whiteSpace");
|
|
852
|
+
longHandLogical.add("whiteSpaceCollapse");
|
|
853
|
+
longHandLogical.add("whiteSpaceTrim");
|
|
854
|
+
longHandLogical.add("wordBreak");
|
|
855
|
+
longHandLogical.add("wordSpacing");
|
|
856
|
+
longHandLogical.add("wordWrap");
|
|
857
|
+
longHandLogical.add("backfaceVisibility");
|
|
858
|
+
longHandLogical.add("perspective");
|
|
859
|
+
longHandLogical.add("perspectiveOrigin");
|
|
860
|
+
longHandLogical.add("rotate");
|
|
861
|
+
longHandLogical.add("scale");
|
|
862
|
+
longHandLogical.add("transform");
|
|
863
|
+
longHandLogical.add("transformBox");
|
|
864
|
+
longHandLogical.add("transformOrigin");
|
|
865
|
+
longHandLogical.add("transformStyle");
|
|
866
|
+
longHandLogical.add("translate");
|
|
867
|
+
shorthandsOfLonghands.add("transition");
|
|
868
|
+
longHandLogical.add("transitionBehavior");
|
|
869
|
+
longHandLogical.add("transitionDelay");
|
|
870
|
+
longHandLogical.add("transitionDuration");
|
|
871
|
+
longHandLogical.add("transitionProperty");
|
|
872
|
+
longHandLogical.add("transitionTimingFunction");
|
|
873
|
+
longHandLogical.add("viewTransitionName");
|
|
874
|
+
longHandLogical.add("willChange");
|
|
875
|
+
longHandLogical.add("direction");
|
|
876
|
+
longHandLogical.add("textCombineUpright");
|
|
877
|
+
longHandLogical.add("textOrientation");
|
|
878
|
+
longHandLogical.add("unicodeBidi");
|
|
879
|
+
longHandLogical.add("writingMode");
|
|
880
|
+
longHandLogical.add("backdropFilter");
|
|
881
|
+
longHandLogical.add("filter");
|
|
882
|
+
longHandLogical.add("mathDepth");
|
|
883
|
+
longHandLogical.add("mathShift");
|
|
884
|
+
longHandLogical.add("mathStyle");
|
|
885
|
+
longHandLogical.add("touchAction");
|
|
886
|
+
function getPropertyPriority(key) {
|
|
887
|
+
if (key === "all") return 0;
|
|
888
|
+
if (key.startsWith("--")) return 1;
|
|
889
|
+
if (longHandPhysical.has(key)) return 4e3;
|
|
890
|
+
if (longHandLogical.has(key)) return 3e3;
|
|
891
|
+
if (shorthandsOfLonghands.has(key)) return 2e3;
|
|
892
|
+
if (shorthandsOfShorthands.has(key)) return 1e3;
|
|
893
|
+
return 3e3;
|
|
894
|
+
}
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region src/regex.ts
|
|
897
|
+
const createRegex = (item) => {
|
|
898
|
+
const regex = item.map((item) => typeof item === "string" ? `^${item}$` : item.source).join("|");
|
|
899
|
+
return new RegExp(regex);
|
|
900
|
+
};
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/serialize.ts
|
|
903
|
+
const stringifyJson = (config) => {
|
|
904
|
+
return JSON.stringify(config, (_key, value) => {
|
|
905
|
+
if (typeof value === "function") return value.toString();
|
|
906
|
+
return value;
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
const parseJson = (config) => {
|
|
910
|
+
return JSON.parse(config);
|
|
911
|
+
};
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region src/to-json.ts
|
|
914
|
+
function mapToJson(map) {
|
|
915
|
+
const obj = {};
|
|
916
|
+
map.forEach((value, key) => {
|
|
917
|
+
if (value instanceof Map) obj[key] = Object.fromEntries(value);
|
|
918
|
+
else obj[key] = value;
|
|
919
|
+
});
|
|
920
|
+
return obj;
|
|
921
|
+
}
|
|
922
|
+
//#endregion
|
|
923
|
+
//#region src/typegen.ts
|
|
924
|
+
function unionType(values, opts = {}) {
|
|
925
|
+
const { fallback, stringify = JSON.stringify } = opts;
|
|
926
|
+
const arr = Array.from(values);
|
|
927
|
+
if (fallback != null && !arr.length) return fallback;
|
|
928
|
+
return arr.map((v) => stringify(v)).join(" | ");
|
|
929
|
+
}
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/unit-conversion.ts
|
|
932
|
+
const BASE_FONT_SIZE = 16;
|
|
933
|
+
const UNIT_PX = "px";
|
|
934
|
+
const UNIT_EM = "em";
|
|
935
|
+
const UNIT_REM = "rem";
|
|
936
|
+
const DIGIT_REGEX = new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`);
|
|
937
|
+
const UNIT_REGEX = new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`);
|
|
938
|
+
const VALUE_REGEX = new RegExp(`${DIGIT_REGEX.source}(${UNIT_REGEX.source})`);
|
|
939
|
+
function getUnit(value = "") {
|
|
940
|
+
return value.match(VALUE_REGEX)?.[1];
|
|
941
|
+
}
|
|
942
|
+
function toPx(value = "") {
|
|
943
|
+
if (typeof value === "number") return `${value}px`;
|
|
944
|
+
const unit = getUnit(value);
|
|
945
|
+
if (!unit) return value;
|
|
946
|
+
if (unit === UNIT_PX) return value;
|
|
947
|
+
if (unit === UNIT_EM || unit === UNIT_REM) return `${parseFloat(value) * BASE_FONT_SIZE}${UNIT_PX}`;
|
|
948
|
+
}
|
|
949
|
+
function toEm(value = "", fontSize = BASE_FONT_SIZE) {
|
|
950
|
+
const unit = getUnit(value);
|
|
951
|
+
if (!unit) return value;
|
|
952
|
+
if (unit === UNIT_EM) return value;
|
|
953
|
+
if (unit === UNIT_PX) return `${parseFloat(value) / fontSize}${UNIT_EM}`;
|
|
954
|
+
if (unit === UNIT_REM) return `${parseFloat(value) * BASE_FONT_SIZE / fontSize}${UNIT_EM}`;
|
|
955
|
+
}
|
|
956
|
+
function toRem(value = "") {
|
|
957
|
+
const unit = getUnit(value);
|
|
958
|
+
if (!unit) return value;
|
|
959
|
+
if (unit === UNIT_REM) return value;
|
|
960
|
+
if (unit === UNIT_EM) return `${parseFloat(value)}${UNIT_REM}`;
|
|
961
|
+
if (unit === UNIT_PX) return `${parseFloat(value) / BASE_FONT_SIZE}${UNIT_REM}`;
|
|
962
|
+
}
|
|
963
|
+
//#endregion
|
|
964
|
+
exports.BAMBOO_CONFIG_NAME = BAMBOO_CONFIG_NAME;
|
|
965
|
+
exports.BambooError = BambooError;
|
|
966
|
+
exports.CacheMap = CacheMap;
|
|
967
|
+
exports.assign = assign;
|
|
968
|
+
exports.astish = require_astish.astish;
|
|
969
|
+
exports.calc = calc;
|
|
970
|
+
exports.camelCaseProperty = camelCaseProperty;
|
|
971
|
+
exports.capitalize = capitalize;
|
|
972
|
+
exports.compact = require_uniq.compact;
|
|
973
|
+
exports.createCss = require_uniq.createCss;
|
|
974
|
+
exports.createMergeCss = require_uniq.createMergeCss;
|
|
975
|
+
exports.createRegex = createRegex;
|
|
976
|
+
exports.cssVar = cssVar;
|
|
977
|
+
exports.dashCase = dashCase;
|
|
978
|
+
exports.deepSet = deepSet;
|
|
979
|
+
exports.entries = entries;
|
|
980
|
+
exports.esc = esc;
|
|
981
|
+
exports.filterBaseConditions = require_uniq.filterBaseConditions;
|
|
982
|
+
exports.flatten = flatten;
|
|
983
|
+
exports.fromEntries = fromEntries;
|
|
984
|
+
exports.getArbitraryValue = getArbitraryValue;
|
|
985
|
+
exports.getDotPath = getDotPath;
|
|
986
|
+
exports.getNegativePath = getNegativePath;
|
|
987
|
+
exports.getOrCreateSet = getOrCreateSet;
|
|
988
|
+
exports.getPatternStyles = require_uniq.getPatternStyles;
|
|
989
|
+
exports.getPropertyPriority = getPropertyPriority;
|
|
990
|
+
exports.getSlotCompoundVariant = require_uniq.getSlotCompoundVariant;
|
|
991
|
+
exports.getSlotRecipes = require_uniq.getSlotRecipes;
|
|
992
|
+
exports.getUnit = getUnit;
|
|
993
|
+
exports.hypenateProperty = require_uniq.hypenateProperty;
|
|
994
|
+
exports.isBaseCondition = require_uniq.isBaseCondition;
|
|
995
|
+
exports.isBoolean = require_uniq.isBoolean;
|
|
996
|
+
exports.isCssFunction = require_uniq.isCssFunction;
|
|
997
|
+
exports.isCssUnit = require_uniq.isCssUnit;
|
|
998
|
+
exports.isCssVar = require_uniq.isCssVar;
|
|
999
|
+
exports.isFunction = require_uniq.isFunction;
|
|
1000
|
+
exports.isImportant = require_uniq.isImportant;
|
|
1001
|
+
exports.isObject = require_uniq.isObject;
|
|
1002
|
+
exports.isObjectOrArray = require_uniq.isObjectOrArray;
|
|
1003
|
+
exports.isString = require_uniq.isString;
|
|
1004
|
+
exports.isSymbol = require_uniq.isSymbol;
|
|
1005
|
+
exports.mapEntries = mapEntries;
|
|
1006
|
+
exports.mapObject = require_uniq.mapObject;
|
|
1007
|
+
exports.mapToJson = mapToJson;
|
|
1008
|
+
exports.markImportant = require_uniq.markImportant;
|
|
1009
|
+
exports.memo = require_uniq.memo;
|
|
1010
|
+
exports.mergeAndConcat = mergeAndConcat;
|
|
1011
|
+
exports.mergeProps = require_uniq.mergeProps;
|
|
1012
|
+
exports.mergeWith = mergeWith;
|
|
1013
|
+
exports.normalizeStyleObject = require_uniq.normalizeStyleObject;
|
|
1014
|
+
exports.omit = omit;
|
|
1015
|
+
exports.parseJson = parseJson;
|
|
1016
|
+
exports.patternFns = require_uniq.patternFns;
|
|
1017
|
+
exports.pick = pick;
|
|
1018
|
+
exports.splitBy = splitBy;
|
|
1019
|
+
exports.splitDotPath = splitDotPath;
|
|
1020
|
+
exports.splitProps = require_uniq.splitProps;
|
|
1021
|
+
exports.stringifyJson = stringifyJson;
|
|
1022
|
+
exports.toEm = toEm;
|
|
1023
|
+
exports.toHash = require_uniq.toHash;
|
|
1024
|
+
exports.toPx = toPx;
|
|
1025
|
+
exports.toRem = toRem;
|
|
1026
|
+
exports.toResponsiveObject = require_uniq.toResponsiveObject;
|
|
1027
|
+
exports.traverse = traverse;
|
|
1028
|
+
exports.uncapitalize = uncapitalize;
|
|
1029
|
+
exports.unionType = unionType;
|
|
1030
|
+
exports.uniq = require_uniq.uniq;
|
|
1031
|
+
exports.walkObject = require_uniq.walkObject;
|
|
1032
|
+
exports.withoutImportant = require_uniq.withoutImportant;
|
|
1033
|
+
exports.withoutSpace = require_uniq.withoutSpace;
|