@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/shared.mjs CHANGED
@@ -1,328 +1,285 @@
1
- // src/assert.ts
1
+ //#region src/assert.ts
2
2
  function isObject(value) {
3
- return typeof value === "object" && value != null && !Array.isArray(value);
3
+ return typeof value === "object" && value != null && !Array.isArray(value);
4
4
  }
5
- var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
6
-
7
- // src/compact.ts
5
+ const isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
6
+ //#endregion
7
+ //#region src/compact.ts
8
8
  function compact(value) {
9
- return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
9
+ return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value]) => value !== void 0));
10
10
  }
11
-
12
- // src/condition.ts
13
- var isBaseCondition = (v) => v === "base";
11
+ //#endregion
12
+ //#region src/condition.ts
13
+ const isBaseCondition = (v) => v === "base";
14
14
  function filterBaseConditions(c) {
15
- return c.slice().filter((v) => !isBaseCondition(v));
15
+ return c.slice().filter((v) => !isBaseCondition(v));
16
16
  }
17
-
18
- // src/hash.ts
17
+ //#endregion
18
+ //#region src/hash.ts
19
19
  function toChar(code) {
20
- return String.fromCharCode(code + (code > 25 ? 39 : 97));
20
+ return String.fromCharCode(code + (code > 25 ? 39 : 97));
21
21
  }
22
22
  function toName(code) {
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;
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
- let i = x.length;
30
- while (i) h = h * 33 ^ x.charCodeAt(--i);
31
- return h;
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
- return toName(toPhash(5381, value) >>> 0);
34
+ return toName(toPhash(5381, value) >>> 0);
35
35
  }
36
-
37
- // src/important.ts
38
- var importantRegex = /\s*!(important)?/i;
36
+ //#endregion
37
+ //#region src/important.ts
38
+ const importantRegex = /\s*!(important)?/i;
39
39
  function isImportant(value) {
40
- return typeof value === "string" ? importantRegex.test(value) : false;
40
+ return typeof value === "string" ? importantRegex.test(value) : false;
41
41
  }
42
42
  function withoutImportant(value) {
43
- return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
43
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
44
44
  }
45
45
  function withoutSpace(str) {
46
- return typeof str === "string" ? str.replaceAll(" ", "_") : str;
46
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
47
47
  }
48
-
49
- // src/memo.ts
50
- var memo = (fn) => {
51
- const cache = /* @__PURE__ */ new Map();
52
- const get = (...args) => {
53
- const key = JSON.stringify(args);
54
- if (cache.has(key)) {
55
- return cache.get(key);
56
- }
57
- const result = fn(...args);
58
- cache.set(key, result);
59
- return result;
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
- // src/merge-props.ts
65
- var MERGE_OMIT = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
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
- return sources.reduce((prev, obj) => {
68
- if (!obj) return prev;
69
- Object.keys(obj).forEach((key) => {
70
- if (MERGE_OMIT.has(key)) return;
71
- const prevValue = prev[key];
72
- const value = obj[key];
73
- if (isObject(prevValue) && isObject(value)) {
74
- prev[key] = mergeProps(prevValue, value);
75
- } else {
76
- prev[key] = value;
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
- // src/walk-object.ts
84
- var isNotNullish = (element) => element != null;
81
+ //#endregion
82
+ //#region src/walk-object.ts
83
+ const isNotNullish = (element) => element != null;
85
84
  function walkObject(target, predicate, options = {}) {
86
- const { stop, getKey } = options;
87
- function inner(value, path = []) {
88
- if (isObjectOrArray(value)) {
89
- const result = {};
90
- for (const [prop, child] of Object.entries(value)) {
91
- const key = getKey?.(prop, child) ?? prop;
92
- const childPath = [...path, key];
93
- if (stop?.(value, childPath)) {
94
- return predicate(value, path);
95
- }
96
- const next = inner(child, childPath);
97
- if (isNotNullish(next)) {
98
- result[key] = next;
99
- }
100
- }
101
- return result;
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
- if (Array.isArray(obj)) return obj.map((value) => fn(value));
109
- if (!isObject(obj)) return fn(obj);
110
- return walkObject(obj, (value) => fn(value));
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
- // src/normalize-style-object.ts
107
+ //#endregion
108
+ //#region src/normalize-style-object.ts
114
109
  function toResponsiveObject(values, breakpoints) {
115
- return values.reduce(
116
- (acc, current, index) => {
117
- const key = breakpoints[index];
118
- if (current != null) {
119
- acc[key] = current;
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
- const { utility, conditions } = context;
128
- const { hasShorthand, resolveShorthand } = utility;
129
- return walkObject(
130
- styles,
131
- (value) => {
132
- return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
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
- // src/classname.ts
142
- var fallbackCondition = {
143
- shift: (v) => v,
144
- finalize: (v) => v,
145
- breakpoints: { keys: [] }
126
+ //#endregion
127
+ //#region src/classname.ts
128
+ const fallbackCondition = {
129
+ shift: (v) => v,
130
+ finalize: (v) => v,
131
+ breakpoints: { keys: [] }
146
132
  };
147
- var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
148
- var ENTRY_SEP = "]___[";
149
- var COND_SEP = "<___>";
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
- const { utility, hash, grouped, conditions: conds = fallbackCondition } = context;
152
- const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
153
- const hashFn = (conditions, className) => {
154
- let result;
155
- if (hash) {
156
- const baseArray = [...conds.finalize(conditions), className];
157
- result = formatClassName(utility.toHash(baseArray, toHash));
158
- } else {
159
- const baseArray = [...conds.finalize(conditions), formatClassName(className)];
160
- result = baseArray.join(":");
161
- }
162
- return result;
163
- };
164
- if (grouped) {
165
- return memo(({ base, ...styles } = {}) => {
166
- const styleObject = Object.assign(styles, base);
167
- const normalizedObject = normalizeStyleObject(styleObject, context);
168
- const hashes = [];
169
- walkObject(normalizedObject, (value, paths) => {
170
- if (value == null) return;
171
- const [prop, ...allConditions] = conds.shift(paths);
172
- const conditions = filterBaseConditions(allConditions);
173
- const parts = [`${prop}${ENTRY_SEP}value:${value}`];
174
- if (conditions.length) {
175
- parts.push(`cond:${conditions.join(COND_SEP)}`);
176
- }
177
- hashes.push(parts.join(ENTRY_SEP));
178
- });
179
- if (hashes.length === 0) return "";
180
- hashes.sort();
181
- const groupId = hashes.join("|");
182
- const shortHash = utility.toHash(["grouped", groupId], toHash);
183
- return formatClassName(shortHash);
184
- });
185
- }
186
- return memo(({ base, ...styles } = {}) => {
187
- const styleObject = Object.assign(styles, base);
188
- const normalizedObject = normalizeStyleObject(styleObject, context);
189
- const classNames = /* @__PURE__ */ new Set();
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
- return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
178
+ return styles.flat().filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
205
179
  }
206
180
  function createMergeCss(context) {
207
- function resolve(styles) {
208
- const allStyles = compactStyles(...styles);
209
- if (allStyles.length === 1) return allStyles;
210
- return allStyles.map((style) => normalizeStyleObject(style, context));
211
- }
212
- function mergeCss(...styles) {
213
- return mergeProps(...resolve(styles));
214
- }
215
- function assignCss(...styles) {
216
- return Object.assign({}, ...resolve(styles));
217
- }
218
- return { mergeCss: memo(mergeCss), assignCss };
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
- // src/hypenate-property.ts
222
- var wordRegex = /([A-Z])/g;
223
- var msRegex = /^ms-/;
224
- var hypenateProperty = memo((property) => {
225
- if (property.startsWith("--")) return property;
226
- return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
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
- // src/is-css-function.ts
230
- var fns = ["min", "max", "clamp", "calc"];
231
- var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
232
- var isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);
233
-
234
- // src/is-css-unit.ts
235
- var lengthUnits = "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,%";
236
- var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
237
- var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
238
- var isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);
239
-
240
- // src/is-css-var.ts
241
- var isCssVar = (v) => typeof v === "string" && /^var\(--.+\)$/.test(v);
242
-
243
- // src/pattern-fns.ts
244
- var patternFns = {
245
- map: mapObject,
246
- isCssFunction,
247
- isCssVar,
248
- isCssUnit
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
- var getPatternStyles = (pattern, styles) => {
251
- if (!pattern?.defaultValues) return styles;
252
- const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;
253
- return Object.assign({}, defaults, compact(styles));
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
- // src/slot.ts
257
- var getSlotRecipes = (recipe = {}) => {
258
- const init = (slot) => ({
259
- className: [recipe.className, slot].filter(Boolean).join("__"),
260
- base: recipe.base?.[slot] ?? {},
261
- variants: {},
262
- defaultVariants: recipe.defaultVariants ?? {},
263
- compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []
264
- });
265
- const slots = recipe.slots ?? [];
266
- const recipeParts = slots.map((slot) => [slot, init(slot)]);
267
- for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {
268
- for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {
269
- recipeParts.forEach(([slot, slotRecipe]) => {
270
- slotRecipe.variants[variantsKey] ??= {};
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
- var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
278
-
279
- // src/split-props.ts
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
- const descriptors = Object.getOwnPropertyDescriptors(props);
282
- const dKeys = Object.keys(descriptors);
283
- const split = (k) => {
284
- const clone = {};
285
- for (let i = 0; i < k.length; i++) {
286
- const key = k[i];
287
- if (descriptors[key]) {
288
- Object.defineProperty(clone, key, descriptors[key]);
289
- delete descriptors[key];
290
- }
291
- }
292
- return clone;
293
- };
294
- const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
295
- return keys.map(fn).concat(split(dKeys));
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
- // src/uniq.ts
299
- var uniq = (...items) => {
300
- const set = items.reduce((acc, currItems) => {
301
- if (currItems) {
302
- currItems.forEach((item) => acc.add(item));
303
- }
304
- return acc;
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.1",
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/chakra-ui/bamboo.git",
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.js",
17
+ "main": "dist/index.cjs",
18
18
  "module": "dist/index.mjs",
19
- "types": "dist/index.d.ts",
19
+ "types": "dist/index.d.cts",
20
20
  "exports": {
21
21
  ".": {
22
22
  "source": "./src/index.ts",
23
- "types": "./dist/index.d.ts",
24
- "require": "./dist/index.js",
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": "tsup --dts && tsx scripts/postbuild.ts",
37
- "build-fast": "tsup --no-dts",
38
- "dev": "tsup --no-dts --watch --onSuccess=\"tsx scripts/postbuild.ts\""
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
  }