@bamboocss/shared 1.11.1 → 1.11.3
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 +1357 -0
- package/dist/index.d.cts +284 -0
- package/dist/index.d.mts +284 -0
- package/dist/index.mjs +724 -898
- 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 +304 -0
- package/dist/shared.d.cts +102 -0
- package/dist/shared.d.mts +102 -0
- package/dist/shared.mjs +240 -283
- 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/shared.mjs
CHANGED
|
@@ -1,328 +1,285 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/assert.ts
|
|
2
2
|
function isObject(value) {
|
|
3
|
-
|
|
3
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/compact.ts
|
|
8
8
|
function compact(value) {
|
|
9
|
-
|
|
9
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value]) => value !== void 0));
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/condition.ts
|
|
13
|
+
const isBaseCondition = (v) => v === "base";
|
|
14
14
|
function filterBaseConditions(c) {
|
|
15
|
-
|
|
15
|
+
return c.slice().filter((v) => !isBaseCondition(v));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/hash.ts
|
|
19
19
|
function toChar(code) {
|
|
20
|
-
|
|
20
|
+
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
21
21
|
}
|
|
22
22
|
function toName(code) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let name = "";
|
|
24
|
+
let x;
|
|
25
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toChar(x % 52) + name;
|
|
26
|
+
return toChar(x % 52) + name;
|
|
27
27
|
}
|
|
28
28
|
function toPhash(h, x) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
let i = x.length;
|
|
30
|
+
while (i) h = h * 33 ^ x.charCodeAt(--i);
|
|
31
|
+
return h;
|
|
32
32
|
}
|
|
33
33
|
function toHash(value) {
|
|
34
|
-
|
|
34
|
+
return toName(toPhash(5381, value) >>> 0);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/important.ts
|
|
38
|
+
const importantRegex = /\s*!(important)?/i;
|
|
39
39
|
function isImportant(value) {
|
|
40
|
-
|
|
40
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
41
41
|
}
|
|
42
42
|
function withoutImportant(value) {
|
|
43
|
-
|
|
43
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
44
44
|
}
|
|
45
45
|
function withoutSpace(str) {
|
|
46
|
-
|
|
46
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
return get;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/memo.ts
|
|
50
|
+
const memo = (fn) => {
|
|
51
|
+
const cache = /* @__PURE__ */ new Map();
|
|
52
|
+
const get = (...args) => {
|
|
53
|
+
const key = JSON.stringify(args);
|
|
54
|
+
if (cache.has(key)) return cache.get(key);
|
|
55
|
+
const result = fn(...args);
|
|
56
|
+
cache.set(key, result);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
return get;
|
|
62
60
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/merge-props.ts
|
|
63
|
+
const MERGE_OMIT = new Set([
|
|
64
|
+
"__proto__",
|
|
65
|
+
"constructor",
|
|
66
|
+
"prototype"
|
|
67
|
+
]);
|
|
66
68
|
function mergeProps(...sources) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
return prev;
|
|
80
|
-
}, {});
|
|
69
|
+
return sources.reduce((prev, obj) => {
|
|
70
|
+
if (!obj) return prev;
|
|
71
|
+
Object.keys(obj).forEach((key) => {
|
|
72
|
+
if (MERGE_OMIT.has(key)) return;
|
|
73
|
+
const prevValue = prev[key];
|
|
74
|
+
const value = obj[key];
|
|
75
|
+
if (isObject(prevValue) && isObject(value)) prev[key] = mergeProps(prevValue, value);
|
|
76
|
+
else prev[key] = value;
|
|
77
|
+
});
|
|
78
|
+
return prev;
|
|
79
|
+
}, {});
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/walk-object.ts
|
|
83
|
+
const isNotNullish = (element) => element != null;
|
|
85
84
|
function walkObject(target, predicate, options = {}) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return predicate(value, path);
|
|
104
|
-
}
|
|
105
|
-
return inner(target);
|
|
85
|
+
const { stop, getKey } = options;
|
|
86
|
+
function inner(value, path = []) {
|
|
87
|
+
if (isObjectOrArray(value)) {
|
|
88
|
+
const result = {};
|
|
89
|
+
for (const [prop, child] of Object.entries(value)) {
|
|
90
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
91
|
+
const childPath = [...path, key];
|
|
92
|
+
if (stop?.(value, childPath)) return predicate(value, path);
|
|
93
|
+
const next = inner(child, childPath);
|
|
94
|
+
if (isNotNullish(next)) result[key] = next;
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
return predicate(value, path);
|
|
99
|
+
}
|
|
100
|
+
return inner(target);
|
|
106
101
|
}
|
|
107
102
|
function mapObject(obj, fn) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
if (Array.isArray(obj)) return obj.map((value) => fn(value));
|
|
104
|
+
if (!isObject(obj)) return fn(obj);
|
|
105
|
+
return walkObject(obj, (value) => fn(value));
|
|
111
106
|
}
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/normalize-style-object.ts
|
|
114
109
|
function toResponsiveObject(values, breakpoints) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
return acc;
|
|
122
|
-
},
|
|
123
|
-
{}
|
|
124
|
-
);
|
|
110
|
+
return values.reduce((acc, current, index) => {
|
|
111
|
+
const key = breakpoints[index];
|
|
112
|
+
if (current != null) acc[key] = current;
|
|
113
|
+
return acc;
|
|
114
|
+
}, {});
|
|
125
115
|
}
|
|
126
116
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
stop: (value) => Array.isArray(value),
|
|
136
|
-
getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
|
|
137
|
-
}
|
|
138
|
-
);
|
|
117
|
+
const { utility, conditions } = context;
|
|
118
|
+
const { hasShorthand, resolveShorthand } = utility;
|
|
119
|
+
return walkObject(styles, (value) => {
|
|
120
|
+
return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
|
|
121
|
+
}, {
|
|
122
|
+
stop: (value) => Array.isArray(value),
|
|
123
|
+
getKey: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0
|
|
124
|
+
});
|
|
139
125
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/classname.ts
|
|
128
|
+
const fallbackCondition = {
|
|
129
|
+
shift: (v) => v,
|
|
130
|
+
finalize: (v) => v,
|
|
131
|
+
breakpoints: { keys: [] }
|
|
146
132
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
const sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
|
|
134
|
+
const ENTRY_SEP = "]___[";
|
|
135
|
+
const COND_SEP = "<___>";
|
|
150
136
|
function createCss(context) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
walkObject(normalizedObject, (value, paths) => {
|
|
191
|
-
if (value == null) return;
|
|
192
|
-
const important = isImportant(value);
|
|
193
|
-
const [prop, ...allConditions] = conds.shift(paths);
|
|
194
|
-
const conditions = filterBaseConditions(allConditions);
|
|
195
|
-
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
196
|
-
let className = hashFn(conditions, transformed.className);
|
|
197
|
-
if (important) className = `${className}!`;
|
|
198
|
-
classNames.add(className);
|
|
199
|
-
});
|
|
200
|
-
return Array.from(classNames).join(" ");
|
|
201
|
-
});
|
|
137
|
+
const { utility, hash, grouped, conditions: conds = fallbackCondition } = context;
|
|
138
|
+
const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
|
|
139
|
+
const hashFn = (conditions, className) => {
|
|
140
|
+
let result;
|
|
141
|
+
if (hash) {
|
|
142
|
+
const baseArray = [...conds.finalize(conditions), className];
|
|
143
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
144
|
+
} else result = [...conds.finalize(conditions), formatClassName(className)].join(":");
|
|
145
|
+
return result;
|
|
146
|
+
};
|
|
147
|
+
if (grouped) return memo(({ base, ...styles } = {}) => {
|
|
148
|
+
const normalizedObject = normalizeStyleObject(Object.assign(styles, base), context);
|
|
149
|
+
const hashes = [];
|
|
150
|
+
walkObject(normalizedObject, (value, paths) => {
|
|
151
|
+
if (value == null) return;
|
|
152
|
+
const [prop, ...allConditions] = conds.shift(paths);
|
|
153
|
+
const conditions = filterBaseConditions(allConditions);
|
|
154
|
+
const parts = [`${prop}${ENTRY_SEP}value:${value}`];
|
|
155
|
+
if (conditions.length) parts.push(`cond:${conditions.join(COND_SEP)}`);
|
|
156
|
+
hashes.push(parts.join(ENTRY_SEP));
|
|
157
|
+
});
|
|
158
|
+
if (hashes.length === 0) return "";
|
|
159
|
+
hashes.sort();
|
|
160
|
+
const groupId = hashes.join("|");
|
|
161
|
+
return formatClassName(utility.toHash(["grouped", groupId], toHash));
|
|
162
|
+
});
|
|
163
|
+
return memo(({ base, ...styles } = {}) => {
|
|
164
|
+
const normalizedObject = normalizeStyleObject(Object.assign(styles, base), context);
|
|
165
|
+
const classNames = /* @__PURE__ */ new Set();
|
|
166
|
+
walkObject(normalizedObject, (value, paths) => {
|
|
167
|
+
if (value == null) return;
|
|
168
|
+
const important = isImportant(value);
|
|
169
|
+
const [prop, ...allConditions] = conds.shift(paths);
|
|
170
|
+
let className = hashFn(filterBaseConditions(allConditions), utility.transform(prop, withoutImportant(sanitize(value))).className);
|
|
171
|
+
if (important) className = `${className}!`;
|
|
172
|
+
classNames.add(className);
|
|
173
|
+
});
|
|
174
|
+
return Array.from(classNames).join(" ");
|
|
175
|
+
});
|
|
202
176
|
}
|
|
203
177
|
function compactStyles(...styles) {
|
|
204
|
-
|
|
178
|
+
return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
205
179
|
}
|
|
206
180
|
function createMergeCss(context) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
181
|
+
function resolve(styles) {
|
|
182
|
+
const allStyles = compactStyles(...styles);
|
|
183
|
+
if (allStyles.length === 1) return allStyles;
|
|
184
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
185
|
+
}
|
|
186
|
+
function mergeCss(...styles) {
|
|
187
|
+
return mergeProps(...resolve(styles));
|
|
188
|
+
}
|
|
189
|
+
function assignCss(...styles) {
|
|
190
|
+
return Object.assign({}, ...resolve(styles));
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
mergeCss: memo(mergeCss),
|
|
194
|
+
assignCss
|
|
195
|
+
};
|
|
219
196
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/hypenate-property.ts
|
|
199
|
+
const wordRegex = /([A-Z])/g;
|
|
200
|
+
const msRegex = /^ms-/;
|
|
201
|
+
const hypenateProperty = memo((property) => {
|
|
202
|
+
if (property.startsWith("--")) return property;
|
|
203
|
+
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
227
204
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/is-css-function.ts
|
|
207
|
+
const fnRegExp = new RegExp(`^(${[
|
|
208
|
+
"min",
|
|
209
|
+
"max",
|
|
210
|
+
"clamp",
|
|
211
|
+
"calc"
|
|
212
|
+
].join("|")})\\(.*\\)`);
|
|
213
|
+
const isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/is-css-unit.ts
|
|
216
|
+
const lengthUnitsPattern = `(?:${"cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%".split(",").join("|")})`;
|
|
217
|
+
const lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
218
|
+
const isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/is-css-var.ts
|
|
221
|
+
const isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/pattern-fns.ts
|
|
224
|
+
const patternFns = {
|
|
225
|
+
map: mapObject,
|
|
226
|
+
isCssFunction,
|
|
227
|
+
isCssVar,
|
|
228
|
+
isCssUnit
|
|
249
229
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
230
|
+
const getPatternStyles = (pattern, styles) => {
|
|
231
|
+
if (!pattern?.defaultValues) return styles;
|
|
232
|
+
const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
233
|
+
return Object.assign({}, defaults, compact(styles));
|
|
254
234
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return Object.fromEntries(recipeParts);
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/slot.ts
|
|
237
|
+
const getSlotRecipes = (recipe = {}) => {
|
|
238
|
+
const init = (slot) => ({
|
|
239
|
+
className: [recipe.className, slot].filter(Boolean).join("__"),
|
|
240
|
+
base: recipe.base?.[slot] ?? {},
|
|
241
|
+
variants: {},
|
|
242
|
+
defaultVariants: recipe.defaultVariants ?? {},
|
|
243
|
+
compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
|
|
244
|
+
});
|
|
245
|
+
const recipeParts = (recipe.slots ?? []).map((slot) => [slot, init(slot)]);
|
|
246
|
+
for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) recipeParts.forEach(([slot, slotRecipe]) => {
|
|
247
|
+
slotRecipe.variants[variantsKey] ??= {};
|
|
248
|
+
slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};
|
|
249
|
+
});
|
|
250
|
+
return Object.fromEntries(recipeParts);
|
|
276
251
|
};
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
252
|
+
const getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({
|
|
253
|
+
...compoundVariant,
|
|
254
|
+
css: compoundVariant.css[slotName]
|
|
255
|
+
}));
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/split-props.ts
|
|
280
258
|
function splitProps(props, ...keys) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
259
|
+
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
260
|
+
const dKeys = Object.keys(descriptors);
|
|
261
|
+
const split = (k) => {
|
|
262
|
+
const clone = {};
|
|
263
|
+
for (let i = 0; i < k.length; i++) {
|
|
264
|
+
const key = k[i];
|
|
265
|
+
if (descriptors[key]) {
|
|
266
|
+
Object.defineProperty(clone, key, descriptors[key]);
|
|
267
|
+
delete descriptors[key];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return clone;
|
|
271
|
+
};
|
|
272
|
+
const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
|
|
273
|
+
return keys.map(fn).concat(split(dKeys));
|
|
296
274
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}, /* @__PURE__ */ new Set([]));
|
|
306
|
-
return Array.from(set);
|
|
307
|
-
};
|
|
308
|
-
export {
|
|
309
|
-
compact,
|
|
310
|
-
createCss,
|
|
311
|
-
createMergeCss,
|
|
312
|
-
filterBaseConditions,
|
|
313
|
-
getPatternStyles,
|
|
314
|
-
getSlotCompoundVariant,
|
|
315
|
-
getSlotRecipes,
|
|
316
|
-
hypenateProperty,
|
|
317
|
-
isBaseCondition,
|
|
318
|
-
isObject,
|
|
319
|
-
mapObject,
|
|
320
|
-
memo,
|
|
321
|
-
mergeProps,
|
|
322
|
-
patternFns,
|
|
323
|
-
splitProps,
|
|
324
|
-
toHash,
|
|
325
|
-
uniq,
|
|
326
|
-
walkObject,
|
|
327
|
-
withoutSpace
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/uniq.ts
|
|
277
|
+
const uniq = (...items) => {
|
|
278
|
+
const set = items.reduce((acc, currItems) => {
|
|
279
|
+
if (currItems) currItems.forEach((item) => acc.add(item));
|
|
280
|
+
return acc;
|
|
281
|
+
}, /* @__PURE__ */ new Set([]));
|
|
282
|
+
return Array.from(set);
|
|
328
283
|
};
|
|
284
|
+
//#endregion
|
|
285
|
+
export { compact, createCss, createMergeCss, filterBaseConditions, getPatternStyles, getSlotCompoundVariant, getSlotRecipes, hypenateProperty, isBaseCondition, isObject, mapObject, memo, mergeProps, patternFns, splitProps, toHash, uniq, walkObject, withoutSpace };
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/shared",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.3",
|
|
4
4
|
"description": "Shared utilities for css bamboo",
|
|
5
5
|
"homepage": "https://bamboo-css.com",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/bamboocss/bamboo.git",
|
|
11
11
|
"directory": "packages/shared"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
|
-
"main": "dist/index.
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
18
|
"module": "dist/index.mjs",
|
|
19
|
-
"types": "dist/index.d.
|
|
19
|
+
"types": "dist/index.d.cts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"source": "./src/index.ts",
|
|
23
|
-
"types": "./dist/index.d.
|
|
24
|
-
"require": "./dist/index.
|
|
23
|
+
"types": "./dist/index.d.cts",
|
|
24
|
+
"require": "./dist/index.cjs",
|
|
25
25
|
"import": {
|
|
26
26
|
"types": "./dist/index.d.mts",
|
|
27
27
|
"default": "./dist/index.mjs"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"build-fast": "
|
|
38
|
-
"dev": "
|
|
36
|
+
"build": "tsdown --dts && tsx scripts/postbuild.ts",
|
|
37
|
+
"build-fast": "tsdown --dts=false",
|
|
38
|
+
"dev": "tsdown --dts=false --watch --on-success=\"tsx scripts/postbuild.ts\""
|
|
39
39
|
}
|
|
40
40
|
}
|