@bamboocss/shared 1.12.0 → 1.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/shared",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Shared utilities for css bamboo",
5
5
  "homepage": "https://bamboo-css.com",
6
6
  "license": "MIT",
package/dist/astish.d.cts DELETED
@@ -1,4 +0,0 @@
1
- //#region src/astish.d.ts
2
- declare const astish: (val: string, tree?: any[]) => Record<string, any>;
3
- //#endregion
4
- export { astish };
package/dist/astish.d.mts DELETED
@@ -1,4 +0,0 @@
1
- //#region src/astish.d.ts
2
- declare const astish: (val: string, tree?: any[]) => Record<string, any>;
3
- //#endregion
4
- export { astish };
package/dist/index.d.cts DELETED
@@ -1,284 +0,0 @@
1
- //#region src/arbitrary-value.d.ts
2
- declare const getArbitraryValue: (_value: string) => string;
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
13
- //#region src/assign.d.ts
14
- declare function assign(target: any, ...sources: any[]): any;
15
- //#endregion
16
- //#region src/astish.d.ts
17
- declare const astish: (val: string, tree?: any[]) => Record<string, any>;
18
- //#endregion
19
- //#region src/cache-map.d.ts
20
- declare class CacheMap<K, V> implements Map<K, V> {
21
- private cache;
22
- private keysInUse;
23
- private maxCacheSize;
24
- constructor(maxCacheSize?: number);
25
- get(key: K): V | undefined;
26
- set(key: K, value: V): this;
27
- delete(key: K): boolean;
28
- private updateKeyUsage;
29
- private evictLeastRecentlyUsed;
30
- clear(): void;
31
- has(key: K): boolean;
32
- get size(): number;
33
- forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
34
- keys(): MapIterator<K>;
35
- values(): MapIterator<V>;
36
- entries(): MapIterator<[K, V]>;
37
- getOrInsert(key: K, defaultValue: V): V;
38
- getOrInsertComputed(key: K, callback: (key: K) => V): V;
39
- [Symbol.iterator](): MapIterator<[K, V]>;
40
- [Symbol.toStringTag]: string;
41
- toJSON: () => Map<K, V>;
42
- }
43
- //#endregion
44
- //#region src/calc.d.ts
45
- type Operand = string | number | {
46
- ref: string;
47
- };
48
- declare const calc: {
49
- negate(x: Operand): string;
50
- };
51
- //#endregion
52
- //#region src/camelcase-property.d.ts
53
- declare const camelCaseProperty: (property: string) => string;
54
- //#endregion
55
- //#region src/capitalize.d.ts
56
- declare const capitalize: (s: string) => string;
57
- declare const dashCase: (s: string) => string;
58
- declare const uncapitalize: (s: string) => string;
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
106
- //#region src/css-var.d.ts
107
- interface CssVar {
108
- var: `--${string}`;
109
- ref: string;
110
- }
111
- interface CssVarOptions {
112
- fallback?: string;
113
- prefix?: string;
114
- hash?: boolean;
115
- }
116
- declare function cssVar(name: string, options?: CssVarOptions): CssVar;
117
- //#endregion
118
- //#region src/deep-set.d.ts
119
- type Dict$2 = Record<string, any>;
120
- declare const deepSet: <T extends Dict$2>(target: T, path: string[], value: Dict$2 | string) => T;
121
- //#endregion
122
- //#region src/entries.d.ts
123
- declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
124
- declare function entries<A extends symbol | string | number, B>(obj: { [key in A]: B }): [A, B][];
125
- declare function mapEntries<A, B, K extends string | number | symbol>(obj: { [key in K]: A }, f: (key: K, val: A) => [K, B]): { [key in K]: B };
126
- //#endregion
127
- //#region src/error.d.ts
128
- type BambooErrorCode = 'CONFIG_NOT_FOUND' | 'CONFIG_ERROR' | 'NOT_FOUND' | 'CONDITION' | 'MISSING_STUDIO' | 'INVALID_LAYER' | 'UNKNOWN_RECIPE' | 'INVALID_RECIPE' | 'UNKNOWN_TYPE' | 'UNKNOWN_ARTIFACT' | 'UNKNOWN_LITERAL_TYPE' | 'UNKNOWN_RESULT_TYPE' | 'MISSING_PARAMS' | 'NO_CONTEXT' | 'INVALID_TOKEN';
129
- declare class BambooError extends Error {
130
- readonly code: string;
131
- readonly hint?: string;
132
- constructor(code: BambooErrorCode, message: string, opts?: {
133
- hint?: string;
134
- cause?: unknown;
135
- });
136
- }
137
- //#endregion
138
- //#region src/esc.d.ts
139
- declare const esc: (sel: string) => string;
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
152
- //#region src/flatten.d.ts
153
- declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
154
- //#endregion
155
- //#region src/get-or-create-set.d.ts
156
- declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
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
171
- //#region src/is-css-function.d.ts
172
- declare const isCssFunction: (v: unknown) => boolean;
173
- //#endregion
174
- //#region src/is-css-unit.d.ts
175
- declare const isCssUnit: (v: unknown) => boolean;
176
- //#endregion
177
- //#region src/is-css-var.d.ts
178
- declare const isCssVar: (v: unknown) => boolean;
179
- //#endregion
180
- //#region src/memo.d.ts
181
- declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
182
- //#endregion
183
- //#region src/merge-anything.d.ts
184
- /**
185
- * Credits: https://github.com/mesqueeb/merge-anything
186
- */
187
- declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
188
- //#endregion
189
- //#region src/merge-props.d.ts
190
- declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
191
- //#endregion
192
- //#region src/merge-with.d.ts
193
- declare function mergeWith(target: any, ...sources: any[]): any;
194
- //#endregion
195
- //#region src/normalize-style-object.d.ts
196
- type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
197
- declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
198
- declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
199
- //#endregion
200
- //#region src/omit.d.ts
201
- declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>;
202
- //#endregion
203
- //#region src/bamboo-config-name.d.ts
204
- declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
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
215
- //#region src/pick.d.ts
216
- declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
217
- //#endregion
218
- //#region src/property-priority.d.ts
219
- declare function getPropertyPriority(key: string): number;
220
- //#endregion
221
- //#region src/regex.d.ts
222
- declare const createRegex: (item: Array<string | RegExp>) => RegExp;
223
- //#endregion
224
- //#region src/serialize.d.ts
225
- declare const stringifyJson: (config: Record<string, any>) => string;
226
- declare const parseJson: (config: string) => any;
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
236
- //#region src/split.d.ts
237
- declare function splitBy(value: string, separator?: string): any[];
238
- declare function splitDotPath(path: string): string[];
239
- declare function getNegativePath(path: string[]): string[];
240
- declare function getDotPath(obj: any, path: string, fallback?: any): any;
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
248
- //#region src/to-json.d.ts
249
- type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
250
- declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
251
- //#endregion
252
- //#region src/traverse.d.ts
253
- type CallbackFn = (args: CallbackItem) => void;
254
- interface CallbackItem {
255
- value: any;
256
- path: string;
257
- paths: string[];
258
- depth: number;
259
- parent: any[] | Record<string, unknown>;
260
- key: string;
261
- }
262
- interface TraverseOptions {
263
- separator?: string;
264
- maxDepth?: number;
265
- stop?: (args: CallbackItem) => boolean;
266
- }
267
- declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
268
- //#endregion
269
- //#region src/typegen.d.ts
270
- declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>, opts?: {
271
- fallback?: string;
272
- stringify?: (value: string) => string;
273
- }): string;
274
- //#endregion
275
- //#region src/uniq.d.ts
276
- declare const uniq: <T>(...items: T[][]) => T[];
277
- //#endregion
278
- //#region src/unit-conversion.d.ts
279
- declare function getUnit(value?: string): string | undefined;
280
- declare function toPx(value?: string | number): string | undefined;
281
- declare function toEm(value?: string, fontSize?: number): string | undefined;
282
- declare function toRem(value?: string): string | undefined;
283
- //#endregion
284
- export { BAMBOO_CONFIG_NAME, BambooError, BambooErrorCode, CacheMap, CreateCssContext, CssVar, CssVarOptions, MapToRecord, MappedObject, WalkObjectOptions, WalkObjectStopFn, assign, astish, calc, camelCaseProperty, capitalize, compact, createCss, createMergeCss, createRegex, cssVar, dashCase, deepSet, entries, esc, filterBaseConditions, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPatternStyles, getPropertyPriority, getSlotCompoundVariant, getSlotRecipes, getUnit, hypenateProperty, isBaseCondition, isBoolean, isCssFunction, isCssUnit, isCssVar, isFunction, isImportant, isObject, isObjectOrArray, isString, isSymbol, mapEntries, mapObject, mapToJson, markImportant, memo, mergeAndConcat, mergeProps, mergeWith, normalizeStyleObject, omit, parseJson, patternFns, pick, splitBy, splitDotPath, splitProps, stringifyJson, toEm, toHash, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType, uniq, walkObject, withoutImportant, withoutSpace };
package/dist/index.d.mts DELETED
@@ -1,284 +0,0 @@
1
- //#region src/arbitrary-value.d.ts
2
- declare const getArbitraryValue: (_value: string) => string;
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
13
- //#region src/assign.d.ts
14
- declare function assign(target: any, ...sources: any[]): any;
15
- //#endregion
16
- //#region src/astish.d.ts
17
- declare const astish: (val: string, tree?: any[]) => Record<string, any>;
18
- //#endregion
19
- //#region src/cache-map.d.ts
20
- declare class CacheMap<K, V> implements Map<K, V> {
21
- private cache;
22
- private keysInUse;
23
- private maxCacheSize;
24
- constructor(maxCacheSize?: number);
25
- get(key: K): V | undefined;
26
- set(key: K, value: V): this;
27
- delete(key: K): boolean;
28
- private updateKeyUsage;
29
- private evictLeastRecentlyUsed;
30
- clear(): void;
31
- has(key: K): boolean;
32
- get size(): number;
33
- forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
34
- keys(): MapIterator<K>;
35
- values(): MapIterator<V>;
36
- entries(): MapIterator<[K, V]>;
37
- getOrInsert(key: K, defaultValue: V): V;
38
- getOrInsertComputed(key: K, callback: (key: K) => V): V;
39
- [Symbol.iterator](): MapIterator<[K, V]>;
40
- [Symbol.toStringTag]: string;
41
- toJSON: () => Map<K, V>;
42
- }
43
- //#endregion
44
- //#region src/calc.d.ts
45
- type Operand = string | number | {
46
- ref: string;
47
- };
48
- declare const calc: {
49
- negate(x: Operand): string;
50
- };
51
- //#endregion
52
- //#region src/camelcase-property.d.ts
53
- declare const camelCaseProperty: (property: string) => string;
54
- //#endregion
55
- //#region src/capitalize.d.ts
56
- declare const capitalize: (s: string) => string;
57
- declare const dashCase: (s: string) => string;
58
- declare const uncapitalize: (s: string) => string;
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
106
- //#region src/css-var.d.ts
107
- interface CssVar {
108
- var: `--${string}`;
109
- ref: string;
110
- }
111
- interface CssVarOptions {
112
- fallback?: string;
113
- prefix?: string;
114
- hash?: boolean;
115
- }
116
- declare function cssVar(name: string, options?: CssVarOptions): CssVar;
117
- //#endregion
118
- //#region src/deep-set.d.ts
119
- type Dict$2 = Record<string, any>;
120
- declare const deepSet: <T extends Dict$2>(target: T, path: string[], value: Dict$2 | string) => T;
121
- //#endregion
122
- //#region src/entries.d.ts
123
- declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
124
- declare function entries<A extends symbol | string | number, B>(obj: { [key in A]: B }): [A, B][];
125
- declare function mapEntries<A, B, K extends string | number | symbol>(obj: { [key in K]: A }, f: (key: K, val: A) => [K, B]): { [key in K]: B };
126
- //#endregion
127
- //#region src/error.d.ts
128
- type BambooErrorCode = 'CONFIG_NOT_FOUND' | 'CONFIG_ERROR' | 'NOT_FOUND' | 'CONDITION' | 'MISSING_STUDIO' | 'INVALID_LAYER' | 'UNKNOWN_RECIPE' | 'INVALID_RECIPE' | 'UNKNOWN_TYPE' | 'UNKNOWN_ARTIFACT' | 'UNKNOWN_LITERAL_TYPE' | 'UNKNOWN_RESULT_TYPE' | 'MISSING_PARAMS' | 'NO_CONTEXT' | 'INVALID_TOKEN';
129
- declare class BambooError extends Error {
130
- readonly code: string;
131
- readonly hint?: string;
132
- constructor(code: BambooErrorCode, message: string, opts?: {
133
- hint?: string;
134
- cause?: unknown;
135
- });
136
- }
137
- //#endregion
138
- //#region src/esc.d.ts
139
- declare const esc: (sel: string) => string;
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
152
- //#region src/flatten.d.ts
153
- declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
154
- //#endregion
155
- //#region src/get-or-create-set.d.ts
156
- declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
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
171
- //#region src/is-css-function.d.ts
172
- declare const isCssFunction: (v: unknown) => boolean;
173
- //#endregion
174
- //#region src/is-css-unit.d.ts
175
- declare const isCssUnit: (v: unknown) => boolean;
176
- //#endregion
177
- //#region src/is-css-var.d.ts
178
- declare const isCssVar: (v: unknown) => boolean;
179
- //#endregion
180
- //#region src/memo.d.ts
181
- declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
182
- //#endregion
183
- //#region src/merge-anything.d.ts
184
- /**
185
- * Credits: https://github.com/mesqueeb/merge-anything
186
- */
187
- declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
188
- //#endregion
189
- //#region src/merge-props.d.ts
190
- declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
191
- //#endregion
192
- //#region src/merge-with.d.ts
193
- declare function mergeWith(target: any, ...sources: any[]): any;
194
- //#endregion
195
- //#region src/normalize-style-object.d.ts
196
- type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
197
- declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
198
- declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
199
- //#endregion
200
- //#region src/omit.d.ts
201
- declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>;
202
- //#endregion
203
- //#region src/bamboo-config-name.d.ts
204
- declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
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
215
- //#region src/pick.d.ts
216
- declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
217
- //#endregion
218
- //#region src/property-priority.d.ts
219
- declare function getPropertyPriority(key: string): number;
220
- //#endregion
221
- //#region src/regex.d.ts
222
- declare const createRegex: (item: Array<string | RegExp>) => RegExp;
223
- //#endregion
224
- //#region src/serialize.d.ts
225
- declare const stringifyJson: (config: Record<string, any>) => string;
226
- declare const parseJson: (config: string) => any;
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
236
- //#region src/split.d.ts
237
- declare function splitBy(value: string, separator?: string): any[];
238
- declare function splitDotPath(path: string): string[];
239
- declare function getNegativePath(path: string[]): string[];
240
- declare function getDotPath(obj: any, path: string, fallback?: any): any;
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
248
- //#region src/to-json.d.ts
249
- type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
250
- declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
251
- //#endregion
252
- //#region src/traverse.d.ts
253
- type CallbackFn = (args: CallbackItem) => void;
254
- interface CallbackItem {
255
- value: any;
256
- path: string;
257
- paths: string[];
258
- depth: number;
259
- parent: any[] | Record<string, unknown>;
260
- key: string;
261
- }
262
- interface TraverseOptions {
263
- separator?: string;
264
- maxDepth?: number;
265
- stop?: (args: CallbackItem) => boolean;
266
- }
267
- declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
268
- //#endregion
269
- //#region src/typegen.d.ts
270
- declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>, opts?: {
271
- fallback?: string;
272
- stringify?: (value: string) => string;
273
- }): string;
274
- //#endregion
275
- //#region src/uniq.d.ts
276
- declare const uniq: <T>(...items: T[][]) => T[];
277
- //#endregion
278
- //#region src/unit-conversion.d.ts
279
- declare function getUnit(value?: string): string | undefined;
280
- declare function toPx(value?: string | number): string | undefined;
281
- declare function toEm(value?: string, fontSize?: number): string | undefined;
282
- declare function toRem(value?: string): string | undefined;
283
- //#endregion
284
- export { BAMBOO_CONFIG_NAME, BambooError, BambooErrorCode, CacheMap, CreateCssContext, CssVar, CssVarOptions, MapToRecord, MappedObject, WalkObjectOptions, WalkObjectStopFn, assign, astish, calc, camelCaseProperty, capitalize, compact, createCss, createMergeCss, createRegex, cssVar, dashCase, deepSet, entries, esc, filterBaseConditions, flatten, fromEntries, getArbitraryValue, getDotPath, getNegativePath, getOrCreateSet, getPatternStyles, getPropertyPriority, getSlotCompoundVariant, getSlotRecipes, getUnit, hypenateProperty, isBaseCondition, isBoolean, isCssFunction, isCssUnit, isCssVar, isFunction, isImportant, isObject, isObjectOrArray, isString, isSymbol, mapEntries, mapObject, mapToJson, markImportant, memo, mergeAndConcat, mergeProps, mergeWith, normalizeStyleObject, omit, parseJson, patternFns, pick, splitBy, splitDotPath, splitProps, stringifyJson, toEm, toHash, toPx, toRem, toResponsiveObject, traverse, uncapitalize, unionType, uniq, walkObject, withoutImportant, withoutSpace };
@@ -1,9 +0,0 @@
1
- //#region src/normalize-html.d.ts
2
- declare function normalizeHTMLProps(props: Record<string, any>): {
3
- [k: string]: any;
4
- };
5
- declare namespace normalizeHTMLProps {
6
- var keys: string[];
7
- }
8
- //#endregion
9
- export { normalizeHTMLProps };
@@ -1,9 +0,0 @@
1
- //#region src/normalize-html.d.ts
2
- declare function normalizeHTMLProps(props: Record<string, any>): {
3
- [k: string]: any;
4
- };
5
- declare namespace normalizeHTMLProps {
6
- var keys: string[];
7
- }
8
- //#endregion
9
- export { normalizeHTMLProps };
package/dist/shared.d.cts DELETED
@@ -1,102 +0,0 @@
1
- //#region src/assert.d.ts
2
- declare function isObject(value: any): value is Record<string, any>;
3
- //#endregion
4
- //#region src/classname.d.ts
5
- interface CreateCssContext {
6
- hash?: boolean;
7
- grouped?: boolean;
8
- /**
9
- * Partial properties from the Utility class
10
- */
11
- utility: {
12
- prefix: string;
13
- hasShorthand: boolean;
14
- resolveShorthand: (prop: string) => string;
15
- transform: (prop: string, value: any) => {
16
- className: string;
17
- };
18
- toHash: (path: string[], toHash: (str: string) => string) => string;
19
- };
20
- /**
21
- * Partial properties from the Condition class
22
- */
23
- conditions?: {
24
- breakpoints: {
25
- keys: string[];
26
- };
27
- shift: (paths: string[]) => string[];
28
- finalize: (paths: string[]) => string[];
29
- };
30
- }
31
- declare function createCss(context: CreateCssContext): ({
32
- base,
33
- ...styles
34
- }?: Record<string, any>) => string;
35
- interface StyleObject {
36
- [key: string]: any;
37
- }
38
- declare function createMergeCss(context: CreateCssContext): {
39
- mergeCss: (...styles: StyleObject[]) => StyleObject;
40
- assignCss: (...styles: StyleObject[]) => any;
41
- };
42
- //#endregion
43
- //#region src/compact.d.ts
44
- declare function compact<T extends Record<string, any>>(value: T): T;
45
- //#endregion
46
- //#region src/condition.d.ts
47
- declare const isBaseCondition: (v: string) => v is "base";
48
- declare function filterBaseConditions(c: string[]): string[];
49
- //#endregion
50
- //#region src/important.d.ts
51
- declare function withoutSpace<T extends string | number | boolean>(str: T): string | T;
52
- //#endregion
53
- //#region src/hash.d.ts
54
- declare function toHash(value: string): string;
55
- //#endregion
56
- //#region src/hypenate-property.d.ts
57
- declare const hypenateProperty: (property: string) => string;
58
- //#endregion
59
- //#region src/memo.d.ts
60
- declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
61
- //#endregion
62
- //#region src/merge-props.d.ts
63
- declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
64
- //#endregion
65
- //#region src/walk-object.d.ts
66
- type Predicate<R = any> = (value: any, path: string[]) => R;
67
- 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 };
68
- type WalkObjectStopFn = (value: any, path: string[]) => boolean;
69
- interface WalkObjectOptions {
70
- stop?: WalkObjectStopFn;
71
- getKey?(prop: string, value: any): string;
72
- }
73
- declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
74
- declare function mapObject(obj: any, fn: (value: any) => any): any;
75
- //#endregion
76
- //#region src/pattern-fns.d.ts
77
- declare const patternFns: {
78
- map: typeof mapObject;
79
- isCssFunction: (v: unknown) => boolean;
80
- isCssVar: (v: unknown) => boolean;
81
- isCssUnit: (v: unknown) => boolean;
82
- };
83
- declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
84
- //#endregion
85
- //#region src/slot.d.ts
86
- declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
87
- declare const getSlotCompoundVariant: <T extends {
88
- css: any;
89
- }>(compoundVariants: T[], slotName: string) => (T & {
90
- css: any;
91
- })[];
92
- //#endregion
93
- //#region src/split-props.d.ts
94
- type Dict = Record<string, unknown>;
95
- type PredicateFn = (key: string) => boolean;
96
- type Key = PredicateFn | string[];
97
- declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
98
- //#endregion
99
- //#region src/uniq.d.ts
100
- declare const uniq: <T>(...items: T[][]) => T[];
101
- //#endregion
102
- export { compact, createCss, createMergeCss, filterBaseConditions, getPatternStyles, getSlotCompoundVariant, getSlotRecipes, hypenateProperty, isBaseCondition, isObject, mapObject, memo, mergeProps, patternFns, splitProps, toHash, uniq, walkObject, withoutSpace };
package/dist/shared.d.mts DELETED
@@ -1,102 +0,0 @@
1
- //#region src/assert.d.ts
2
- declare function isObject(value: any): value is Record<string, any>;
3
- //#endregion
4
- //#region src/classname.d.ts
5
- interface CreateCssContext {
6
- hash?: boolean;
7
- grouped?: boolean;
8
- /**
9
- * Partial properties from the Utility class
10
- */
11
- utility: {
12
- prefix: string;
13
- hasShorthand: boolean;
14
- resolveShorthand: (prop: string) => string;
15
- transform: (prop: string, value: any) => {
16
- className: string;
17
- };
18
- toHash: (path: string[], toHash: (str: string) => string) => string;
19
- };
20
- /**
21
- * Partial properties from the Condition class
22
- */
23
- conditions?: {
24
- breakpoints: {
25
- keys: string[];
26
- };
27
- shift: (paths: string[]) => string[];
28
- finalize: (paths: string[]) => string[];
29
- };
30
- }
31
- declare function createCss(context: CreateCssContext): ({
32
- base,
33
- ...styles
34
- }?: Record<string, any>) => string;
35
- interface StyleObject {
36
- [key: string]: any;
37
- }
38
- declare function createMergeCss(context: CreateCssContext): {
39
- mergeCss: (...styles: StyleObject[]) => StyleObject;
40
- assignCss: (...styles: StyleObject[]) => any;
41
- };
42
- //#endregion
43
- //#region src/compact.d.ts
44
- declare function compact<T extends Record<string, any>>(value: T): T;
45
- //#endregion
46
- //#region src/condition.d.ts
47
- declare const isBaseCondition: (v: string) => v is "base";
48
- declare function filterBaseConditions(c: string[]): string[];
49
- //#endregion
50
- //#region src/important.d.ts
51
- declare function withoutSpace<T extends string | number | boolean>(str: T): string | T;
52
- //#endregion
53
- //#region src/hash.d.ts
54
- declare function toHash(value: string): string;
55
- //#endregion
56
- //#region src/hypenate-property.d.ts
57
- declare const hypenateProperty: (property: string) => string;
58
- //#endregion
59
- //#region src/memo.d.ts
60
- declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
61
- //#endregion
62
- //#region src/merge-props.d.ts
63
- declare function mergeProps<T extends Record<string, unknown>>(...sources: T[]): T;
64
- //#endregion
65
- //#region src/walk-object.d.ts
66
- type Predicate<R = any> = (value: any, path: string[]) => R;
67
- 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 };
68
- type WalkObjectStopFn = (value: any, path: string[]) => boolean;
69
- interface WalkObjectOptions {
70
- stop?: WalkObjectStopFn;
71
- getKey?(prop: string, value: any): string;
72
- }
73
- declare function walkObject<T, K>(target: T, predicate: Predicate<K>, options?: WalkObjectOptions): MappedObject<T, ReturnType<Predicate<K>>>;
74
- declare function mapObject(obj: any, fn: (value: any) => any): any;
75
- //#endregion
76
- //#region src/pattern-fns.d.ts
77
- declare const patternFns: {
78
- map: typeof mapObject;
79
- isCssFunction: (v: unknown) => boolean;
80
- isCssVar: (v: unknown) => boolean;
81
- isCssUnit: (v: unknown) => boolean;
82
- };
83
- declare const getPatternStyles: (pattern: any, styles: Record<string, any>) => any;
84
- //#endregion
85
- //#region src/slot.d.ts
86
- declare const getSlotRecipes: (recipe?: Record<string, any>) => Record<string, any>;
87
- declare const getSlotCompoundVariant: <T extends {
88
- css: any;
89
- }>(compoundVariants: T[], slotName: string) => (T & {
90
- css: any;
91
- })[];
92
- //#endregion
93
- //#region src/split-props.d.ts
94
- type Dict = Record<string, unknown>;
95
- type PredicateFn = (key: string) => boolean;
96
- type Key = PredicateFn | string[];
97
- declare function splitProps(props: Dict, ...keys: Key[]): Dict[];
98
- //#endregion
99
- //#region src/uniq.d.ts
100
- declare const uniq: <T>(...items: T[][]) => T[];
101
- //#endregion
102
- export { compact, createCss, createMergeCss, filterBaseConditions, getPatternStyles, getSlotCompoundVariant, getSlotRecipes, hypenateProperty, isBaseCondition, isObject, mapObject, memo, mergeProps, patternFns, splitProps, toHash, uniq, walkObject, withoutSpace };