@bamboocss/shared 1.11.2 → 1.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,12 +1,21 @@
1
- import { astish } from "./astish.cjs";
2
- import { A as isString, C as CreateCssContext, D as isFunction, E as isBoolean, O as isObject, S as compact, T as createMergeCss, _ as WalkObjectStopFn, a as getPatternStyles, b as filterBaseConditions, c as memo, d as withoutImportant, f as withoutSpace, g as WalkObjectOptions, h as MappedObject, i as getSlotRecipes, j as isSymbol, k as isObjectOrArray, l as isImportant, m as toHash, n as splitProps, o as patternFns, p as hypenateProperty, r as getSlotCompoundVariant, s as mergeProps, t as uniq, u as markImportant, v as mapObject, w as createCss, x as isBaseCondition, y as walkObject } from "./uniq-i0QQ2OJM.cjs";
3
-
4
1
  //#region src/arbitrary-value.d.ts
5
2
  declare const getArbitraryValue: (_value: string) => string;
6
3
  //#endregion
4
+ //#region src/assert.d.ts
5
+ declare const isString: (v: any) => v is string;
6
+ declare const isBoolean: (v: any) => v is boolean;
7
+ type AnyFunction = (...args: any[]) => any;
8
+ declare const isFunction: (v: any) => v is AnyFunction;
9
+ declare function isObject(value: any): value is Record<string, any>;
10
+ declare const isSymbol: (v: any) => v is symbol;
11
+ declare const isObjectOrArray: (obj: unknown) => obj is object;
12
+ //#endregion
7
13
  //#region src/assign.d.ts
8
14
  declare function assign(target: any, ...sources: any[]): any;
9
15
  //#endregion
16
+ //#region src/astish.d.ts
17
+ declare const astish: (val: string, tree?: any[]) => Record<string, any>;
18
+ //#endregion
10
19
  //#region src/cache-map.d.ts
11
20
  declare class CacheMap<K, V> implements Map<K, V> {
12
21
  private cache;
@@ -48,6 +57,52 @@ declare const capitalize: (s: string) => string;
48
57
  declare const dashCase: (s: string) => string;
49
58
  declare const uncapitalize: (s: string) => string;
50
59
  //#endregion
60
+ //#region src/classname.d.ts
61
+ interface CreateCssContext {
62
+ hash?: boolean;
63
+ grouped?: boolean;
64
+ /**
65
+ * Partial properties from the Utility class
66
+ */
67
+ utility: {
68
+ prefix: string;
69
+ hasShorthand: boolean;
70
+ resolveShorthand: (prop: string) => string;
71
+ transform: (prop: string, value: any) => {
72
+ className: string;
73
+ };
74
+ toHash: (path: string[], toHash: (str: string) => string) => string;
75
+ };
76
+ /**
77
+ * Partial properties from the Condition class
78
+ */
79
+ conditions?: {
80
+ breakpoints: {
81
+ keys: string[];
82
+ };
83
+ shift: (paths: string[]) => string[];
84
+ finalize: (paths: string[]) => string[];
85
+ };
86
+ }
87
+ declare function createCss(context: CreateCssContext): ({
88
+ base,
89
+ ...styles
90
+ }?: Record<string, any>) => string;
91
+ interface StyleObject {
92
+ [key: string]: any;
93
+ }
94
+ declare function createMergeCss(context: CreateCssContext): {
95
+ mergeCss: (...styles: StyleObject[]) => StyleObject;
96
+ assignCss: (...styles: StyleObject[]) => any;
97
+ };
98
+ //#endregion
99
+ //#region src/compact.d.ts
100
+ declare function compact<T extends Record<string, any>>(value: T): T;
101
+ //#endregion
102
+ //#region src/condition.d.ts
103
+ declare const isBaseCondition: (v: string) => v is "base";
104
+ declare function filterBaseConditions(c: string[]): string[];
105
+ //#endregion
51
106
  //#region src/css-var.d.ts
52
107
  interface CssVar {
53
108
  var: `--${string}`;
@@ -61,8 +116,8 @@ interface CssVarOptions {
61
116
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
62
117
  //#endregion
63
118
  //#region src/deep-set.d.ts
64
- type Dict = Record<string, any>;
65
- declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
119
+ type Dict$2 = Record<string, any>;
120
+ declare const deepSet: <T extends Dict$2>(target: T, path: string[], value: Dict$2 | string) => T;
66
121
  //#endregion
67
122
  //#region src/entries.d.ts
68
123
  declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
@@ -83,12 +138,36 @@ declare class BambooError extends Error {
83
138
  //#region src/esc.d.ts
84
139
  declare const esc: (sel: string) => string;
85
140
  //#endregion
141
+ //#region src/walk-object.d.ts
142
+ type Predicate<R = any> = (value: any, path: string[]) => R;
143
+ type MappedObject<T, K> = { [Prop in keyof T]: T[Prop] extends Array<any> ? MappedObject<T[Prop][number], K>[] : T[Prop] extends Record<string, unknown> ? MappedObject<T[Prop], K> : K };
144
+ type WalkObjectStopFn = (value: any, path: string[]) => boolean;
145
+ interface WalkObjectOptions {
146
+ stop?: WalkObjectStopFn;
147
+ getKey?(prop: string, value: any): string;
148
+ }
149
+ declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
150
+ declare function mapObject(obj: any, fn: (value: any) => any): any;
151
+ //#endregion
86
152
  //#region src/flatten.d.ts
87
153
  declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
88
154
  //#endregion
89
155
  //#region src/get-or-create-set.d.ts
90
156
  declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
91
157
  //#endregion
158
+ //#region src/hash.d.ts
159
+ declare function toHash(value: string): string;
160
+ //#endregion
161
+ //#region src/hypenate-property.d.ts
162
+ declare const hypenateProperty: (property: string) => string;
163
+ //#endregion
164
+ //#region src/important.d.ts
165
+ declare function isImportant<T extends string | number | boolean>(value: T): boolean;
166
+ declare function withoutImportant<T extends string | number | boolean>(value: T): string | T;
167
+ declare function withoutSpace<T extends string | number | boolean>(str: T): string | T;
168
+ type Dict$1 = Record<string, unknown>;
169
+ declare function markImportant(obj: Dict$1): {};
170
+ //#endregion
92
171
  //#region src/is-css-function.d.ts
93
172
  declare const isCssFunction: (v: unknown) => boolean;
94
173
  //#endregion
@@ -98,12 +177,18 @@ declare const isCssUnit: (v: unknown) => boolean;
98
177
  //#region src/is-css-var.d.ts
99
178
  declare const isCssVar: (v: unknown) => boolean;
100
179
  //#endregion
180
+ //#region src/memo.d.ts
181
+ declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
182
+ //#endregion
101
183
  //#region src/merge-anything.d.ts
102
184
  /**
103
185
  * Credits: https://github.com/mesqueeb/merge-anything
104
186
  */
105
187
  declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
106
188
  //#endregion
189
+ //#region src/merge-props.d.ts
190
+ declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
191
+ //#endregion
107
192
  //#region src/merge-with.d.ts
108
193
  declare function mergeWith(target: any, ...sources: any[]): any;
109
194
  //#endregion
@@ -118,6 +203,15 @@ declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) =
118
203
  //#region src/bamboo-config-name.d.ts
119
204
  declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
120
205
  //#endregion
206
+ //#region src/pattern-fns.d.ts
207
+ declare const patternFns: {
208
+ map: typeof mapObject;
209
+ isCssFunction: (v: unknown) => boolean;
210
+ isCssVar: (v: unknown) => boolean;
211
+ isCssUnit: (v: unknown) => boolean;
212
+ };
213
+ declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
214
+ //#endregion
121
215
  //#region src/pick.d.ts
122
216
  declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
123
217
  //#endregion
@@ -131,12 +225,26 @@ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
131
225
  declare const stringifyJson: (config: Record<string, any>) => string;
132
226
  declare const parseJson: (config: string) => any;
133
227
  //#endregion
228
+ //#region src/slot.d.ts
229
+ declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
230
+ declare const getSlotCompoundVariant: <T extends {
231
+ css: any;
232
+ }>(compoundVariants: T[], slotName: string) => (T & {
233
+ css: any;
234
+ })[];
235
+ //#endregion
134
236
  //#region src/split.d.ts
135
237
  declare function splitBy(value: string, separator?: string): any[];
136
238
  declare function splitDotPath(path: string): string[];
137
239
  declare function getNegativePath(path: string[]): string[];
138
240
  declare function getDotPath(obj: any, path: string, fallback?: any): any;
139
241
  //#endregion
242
+ //#region src/split-props.d.ts
243
+ type Dict = Record<string, unknown>;
244
+ type PredicateFn = (key: string) => boolean;
245
+ type Key = PredicateFn | string[];
246
+ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
247
+ //#endregion
140
248
  //#region src/to-json.d.ts
141
249
  type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
142
250
  declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
@@ -164,6 +272,9 @@ declare function unionType(values: IterableIterator<string> | string[] | readonl
164
272
  stringify?: (value: string) => string;
165
273
  }): string;
166
274
  //#endregion
275
+ //#region src/uniq.d.ts
276
+ declare const uniq: <T>(...items: T[][]) => T[];
277
+ //#endregion
167
278
  //#region src/unit-conversion.d.ts
168
279
  declare function getUnit(value?: string): string | undefined;
169
280
  declare function toPx(value?: string | number): string | undefined;
package/dist/index.d.mts CHANGED
@@ -1,12 +1,21 @@
1
- import { astish } from "./astish.mjs";
2
- import { A as isString, C as CreateCssContext, D as isFunction, E as isBoolean, O as isObject, S as compact, T as createMergeCss, _ as WalkObjectStopFn, a as getPatternStyles, b as filterBaseConditions, c as memo, d as withoutImportant, f as withoutSpace, g as WalkObjectOptions, h as MappedObject, i as getSlotRecipes, j as isSymbol, k as isObjectOrArray, l as isImportant, m as toHash, n as splitProps, o as patternFns, p as hypenateProperty, r as getSlotCompoundVariant, s as mergeProps, t as uniq, u as markImportant, v as mapObject, w as createCss, x as isBaseCondition, y as walkObject } from "./uniq-DcY1asOl.mjs";
3
-
4
1
  //#region src/arbitrary-value.d.ts
5
2
  declare const getArbitraryValue: (_value: string) => string;
6
3
  //#endregion
4
+ //#region src/assert.d.ts
5
+ declare const isString: (v: any) => v is string;
6
+ declare const isBoolean: (v: any) => v is boolean;
7
+ type AnyFunction = (...args: any[]) => any;
8
+ declare const isFunction: (v: any) => v is AnyFunction;
9
+ declare function isObject(value: any): value is Record<string, any>;
10
+ declare const isSymbol: (v: any) => v is symbol;
11
+ declare const isObjectOrArray: (obj: unknown) => obj is object;
12
+ //#endregion
7
13
  //#region src/assign.d.ts
8
14
  declare function assign(target: any, ...sources: any[]): any;
9
15
  //#endregion
16
+ //#region src/astish.d.ts
17
+ declare const astish: (val: string, tree?: any[]) => Record<string, any>;
18
+ //#endregion
10
19
  //#region src/cache-map.d.ts
11
20
  declare class CacheMap<K, V> implements Map<K, V> {
12
21
  private cache;
@@ -48,6 +57,52 @@ declare const capitalize: (s: string) => string;
48
57
  declare const dashCase: (s: string) => string;
49
58
  declare const uncapitalize: (s: string) => string;
50
59
  //#endregion
60
+ //#region src/classname.d.ts
61
+ interface CreateCssContext {
62
+ hash?: boolean;
63
+ grouped?: boolean;
64
+ /**
65
+ * Partial properties from the Utility class
66
+ */
67
+ utility: {
68
+ prefix: string;
69
+ hasShorthand: boolean;
70
+ resolveShorthand: (prop: string) => string;
71
+ transform: (prop: string, value: any) => {
72
+ className: string;
73
+ };
74
+ toHash: (path: string[], toHash: (str: string) => string) => string;
75
+ };
76
+ /**
77
+ * Partial properties from the Condition class
78
+ */
79
+ conditions?: {
80
+ breakpoints: {
81
+ keys: string[];
82
+ };
83
+ shift: (paths: string[]) => string[];
84
+ finalize: (paths: string[]) => string[];
85
+ };
86
+ }
87
+ declare function createCss(context: CreateCssContext): ({
88
+ base,
89
+ ...styles
90
+ }?: Record<string, any>) => string;
91
+ interface StyleObject {
92
+ [key: string]: any;
93
+ }
94
+ declare function createMergeCss(context: CreateCssContext): {
95
+ mergeCss: (...styles: StyleObject[]) => StyleObject;
96
+ assignCss: (...styles: StyleObject[]) => any;
97
+ };
98
+ //#endregion
99
+ //#region src/compact.d.ts
100
+ declare function compact<T extends Record<string, any>>(value: T): T;
101
+ //#endregion
102
+ //#region src/condition.d.ts
103
+ declare const isBaseCondition: (v: string) => v is "base";
104
+ declare function filterBaseConditions(c: string[]): string[];
105
+ //#endregion
51
106
  //#region src/css-var.d.ts
52
107
  interface CssVar {
53
108
  var: `--${string}`;
@@ -61,8 +116,8 @@ interface CssVarOptions {
61
116
  declare function cssVar(name: string, options?: CssVarOptions): CssVar;
62
117
  //#endregion
63
118
  //#region src/deep-set.d.ts
64
- type Dict = Record<string, any>;
65
- declare const deepSet: <T extends Dict>(target: T, path: string[], value: Dict | string) => T;
119
+ type Dict$2 = Record<string, any>;
120
+ declare const deepSet: <T extends Dict$2>(target: T, path: string[], value: Dict$2 | string) => T;
66
121
  //#endregion
67
122
  //#region src/entries.d.ts
68
123
  declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
@@ -83,12 +138,36 @@ declare class BambooError extends Error {
83
138
  //#region src/esc.d.ts
84
139
  declare const esc: (sel: string) => string;
85
140
  //#endregion
141
+ //#region src/walk-object.d.ts
142
+ type Predicate<R = any> = (value: any, path: string[]) => R;
143
+ type MappedObject<T, K> = { [Prop in keyof T]: T[Prop] extends Array<any> ? MappedObject<T[Prop][number], K>[] : T[Prop] extends Record<string, unknown> ? MappedObject<T[Prop], K> : K };
144
+ type WalkObjectStopFn = (value: any, path: string[]) => boolean;
145
+ interface WalkObjectOptions {
146
+ stop?: WalkObjectStopFn;
147
+ getKey?(prop: string, value: any): string;
148
+ }
149
+ declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
150
+ declare function mapObject(obj: any, fn: (value: any) => any): any;
151
+ //#endregion
86
152
  //#region src/flatten.d.ts
87
153
  declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
88
154
  //#endregion
89
155
  //#region src/get-or-create-set.d.ts
90
156
  declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
91
157
  //#endregion
158
+ //#region src/hash.d.ts
159
+ declare function toHash(value: string): string;
160
+ //#endregion
161
+ //#region src/hypenate-property.d.ts
162
+ declare const hypenateProperty: (property: string) => string;
163
+ //#endregion
164
+ //#region src/important.d.ts
165
+ declare function isImportant<T extends string | number | boolean>(value: T): boolean;
166
+ declare function withoutImportant<T extends string | number | boolean>(value: T): string | T;
167
+ declare function withoutSpace<T extends string | number | boolean>(str: T): string | T;
168
+ type Dict$1 = Record<string, unknown>;
169
+ declare function markImportant(obj: Dict$1): {};
170
+ //#endregion
92
171
  //#region src/is-css-function.d.ts
93
172
  declare const isCssFunction: (v: unknown) => boolean;
94
173
  //#endregion
@@ -98,12 +177,18 @@ declare const isCssUnit: (v: unknown) => boolean;
98
177
  //#region src/is-css-var.d.ts
99
178
  declare const isCssVar: (v: unknown) => boolean;
100
179
  //#endregion
180
+ //#region src/memo.d.ts
181
+ declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
182
+ //#endregion
101
183
  //#region src/merge-anything.d.ts
102
184
  /**
103
185
  * Credits: https://github.com/mesqueeb/merge-anything
104
186
  */
105
187
  declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
106
188
  //#endregion
189
+ //#region src/merge-props.d.ts
190
+ declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
191
+ //#endregion
107
192
  //#region src/merge-with.d.ts
108
193
  declare function mergeWith(target: any, ...sources: any[]): any;
109
194
  //#endregion
@@ -118,6 +203,15 @@ declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) =
118
203
  //#region src/bamboo-config-name.d.ts
119
204
  declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
120
205
  //#endregion
206
+ //#region src/pattern-fns.d.ts
207
+ declare const patternFns: {
208
+ map: typeof mapObject;
209
+ isCssFunction: (v: unknown) => boolean;
210
+ isCssVar: (v: unknown) => boolean;
211
+ isCssUnit: (v: unknown) => boolean;
212
+ };
213
+ declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
214
+ //#endregion
121
215
  //#region src/pick.d.ts
122
216
  declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
123
217
  //#endregion
@@ -131,12 +225,26 @@ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
131
225
  declare const stringifyJson: (config: Record<string, any>) => string;
132
226
  declare const parseJson: (config: string) => any;
133
227
  //#endregion
228
+ //#region src/slot.d.ts
229
+ declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
230
+ declare const getSlotCompoundVariant: <T extends {
231
+ css: any;
232
+ }>(compoundVariants: T[], slotName: string) => (T & {
233
+ css: any;
234
+ })[];
235
+ //#endregion
134
236
  //#region src/split.d.ts
135
237
  declare function splitBy(value: string, separator?: string): any[];
136
238
  declare function splitDotPath(path: string): string[];
137
239
  declare function getNegativePath(path: string[]): string[];
138
240
  declare function getDotPath(obj: any, path: string, fallback?: any): any;
139
241
  //#endregion
242
+ //#region src/split-props.d.ts
243
+ type Dict = Record<string, unknown>;
244
+ type PredicateFn = (key: string) => boolean;
245
+ type Key = PredicateFn | string[];
246
+ declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
247
+ //#endregion
140
248
  //#region src/to-json.d.ts
141
249
  type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
142
250
  declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
@@ -164,6 +272,9 @@ declare function unionType(values: IterableIterator<string> | string[] | readonl
164
272
  stringify?: (value: string) => string;
165
273
  }): string;
166
274
  //#endregion
275
+ //#region src/uniq.d.ts
276
+ declare const uniq: <T>(...items: T[][]) => T[];
277
+ //#endregion
167
278
  //#region src/unit-conversion.d.ts
168
279
  declare function getUnit(value?: string): string | undefined;
169
280
  declare function toPx(value?: string | number): string | undefined;