@bamboocss/shared 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,173 @@
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
+ //#region src/arbitrary-value.d.ts
5
+ declare const getArbitraryValue: (_value: string) => string;
6
+ //#endregion
7
+ //#region src/assign.d.ts
8
+ declare function assign(target: any, ...sources: any[]): any;
9
+ //#endregion
10
+ //#region src/cache-map.d.ts
11
+ declare class CacheMap<K, V> implements Map<K, V> {
12
+ private cache;
13
+ private keysInUse;
14
+ private maxCacheSize;
15
+ constructor(maxCacheSize?: number);
16
+ get(key: K): V | undefined;
17
+ set(key: K, value: V): this;
18
+ delete(key: K): boolean;
19
+ private updateKeyUsage;
20
+ private evictLeastRecentlyUsed;
21
+ clear(): void;
22
+ has(key: K): boolean;
23
+ get size(): number;
24
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
25
+ keys(): MapIterator<K>;
26
+ values(): MapIterator<V>;
27
+ entries(): MapIterator<[K, V]>;
28
+ getOrInsert(key: K, defaultValue: V): V;
29
+ getOrInsertComputed(key: K, callback: (key: K) => V): V;
30
+ [Symbol.iterator](): MapIterator<[K, V]>;
31
+ [Symbol.toStringTag]: string;
32
+ toJSON: () => Map<K, V>;
33
+ }
34
+ //#endregion
35
+ //#region src/calc.d.ts
36
+ type Operand = string | number | {
37
+ ref: string;
38
+ };
39
+ declare const calc: {
40
+ negate(x: Operand): string;
41
+ };
42
+ //#endregion
43
+ //#region src/camelcase-property.d.ts
44
+ declare const camelCaseProperty: (property: string) => string;
45
+ //#endregion
46
+ //#region src/capitalize.d.ts
47
+ declare const capitalize: (s: string) => string;
48
+ declare const dashCase: (s: string) => string;
49
+ declare const uncapitalize: (s: string) => string;
50
+ //#endregion
51
+ //#region src/css-var.d.ts
52
+ interface CssVar {
53
+ var: `--${string}`;
54
+ ref: string;
55
+ }
56
+ interface CssVarOptions {
57
+ fallback?: string;
58
+ prefix?: string;
59
+ hash?: boolean;
60
+ }
61
+ declare function cssVar(name: string, options?: CssVarOptions): CssVar;
62
+ //#endregion
63
+ //#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;
66
+ //#endregion
67
+ //#region src/entries.d.ts
68
+ declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
69
+ declare function entries<A extends symbol | string | number, B>(obj: { [key in A]: B }): [A, B][];
70
+ 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 };
71
+ //#endregion
72
+ //#region src/error.d.ts
73
+ 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';
74
+ declare class BambooError extends Error {
75
+ readonly code: string;
76
+ readonly hint?: string;
77
+ constructor(code: BambooErrorCode, message: string, opts?: {
78
+ hint?: string;
79
+ cause?: unknown;
80
+ });
81
+ }
82
+ //#endregion
83
+ //#region src/esc.d.ts
84
+ declare const esc: (sel: string) => string;
85
+ //#endregion
86
+ //#region src/flatten.d.ts
87
+ declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
88
+ //#endregion
89
+ //#region src/get-or-create-set.d.ts
90
+ declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
91
+ //#endregion
92
+ //#region src/is-css-function.d.ts
93
+ declare const isCssFunction: (v: unknown) => boolean;
94
+ //#endregion
95
+ //#region src/is-css-unit.d.ts
96
+ declare const isCssUnit: (v: unknown) => boolean;
97
+ //#endregion
98
+ //#region src/is-css-var.d.ts
99
+ declare const isCssVar: (v: unknown) => boolean;
100
+ //#endregion
101
+ //#region src/merge-anything.d.ts
102
+ /**
103
+ * Credits: https://github.com/mesqueeb/merge-anything
104
+ */
105
+ declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
106
+ //#endregion
107
+ //#region src/merge-with.d.ts
108
+ declare function mergeWith(target: any, ...sources: any[]): any;
109
+ //#endregion
110
+ //#region src/normalize-style-object.d.ts
111
+ type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
112
+ declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
113
+ declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
114
+ //#endregion
115
+ //#region src/omit.d.ts
116
+ declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>;
117
+ //#endregion
118
+ //#region src/bamboo-config-name.d.ts
119
+ declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
120
+ //#endregion
121
+ //#region src/pick.d.ts
122
+ declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
123
+ //#endregion
124
+ //#region src/property-priority.d.ts
125
+ declare function getPropertyPriority(key: string): number;
126
+ //#endregion
127
+ //#region src/regex.d.ts
128
+ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
129
+ //#endregion
130
+ //#region src/serialize.d.ts
131
+ declare const stringifyJson: (config: Record<string, any>) => string;
132
+ declare const parseJson: (config: string) => any;
133
+ //#endregion
134
+ //#region src/split.d.ts
135
+ declare function splitBy(value: string, separator?: string): any[];
136
+ declare function splitDotPath(path: string): string[];
137
+ declare function getNegativePath(path: string[]): string[];
138
+ declare function getDotPath(obj: any, path: string, fallback?: any): any;
139
+ //#endregion
140
+ //#region src/to-json.d.ts
141
+ type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
142
+ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
143
+ //#endregion
144
+ //#region src/traverse.d.ts
145
+ type CallbackFn = (args: CallbackItem) => void;
146
+ interface CallbackItem {
147
+ value: any;
148
+ path: string;
149
+ paths: string[];
150
+ depth: number;
151
+ parent: any[] | Record<string, unknown>;
152
+ key: string;
153
+ }
154
+ interface TraverseOptions {
155
+ separator?: string;
156
+ maxDepth?: number;
157
+ stop?: (args: CallbackItem) => boolean;
158
+ }
159
+ declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
160
+ //#endregion
161
+ //#region src/typegen.d.ts
162
+ declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>, opts?: {
163
+ fallback?: string;
164
+ stringify?: (value: string) => string;
165
+ }): string;
166
+ //#endregion
167
+ //#region src/unit-conversion.d.ts
168
+ declare function getUnit(value?: string): string | undefined;
169
+ declare function toPx(value?: string | number): string | undefined;
170
+ declare function toEm(value?: string, fontSize?: number): string | undefined;
171
+ declare function toRem(value?: string): string | undefined;
172
+ //#endregion
173
+ 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 };
@@ -0,0 +1,173 @@
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
+ //#region src/arbitrary-value.d.ts
5
+ declare const getArbitraryValue: (_value: string) => string;
6
+ //#endregion
7
+ //#region src/assign.d.ts
8
+ declare function assign(target: any, ...sources: any[]): any;
9
+ //#endregion
10
+ //#region src/cache-map.d.ts
11
+ declare class CacheMap<K, V> implements Map<K, V> {
12
+ private cache;
13
+ private keysInUse;
14
+ private maxCacheSize;
15
+ constructor(maxCacheSize?: number);
16
+ get(key: K): V | undefined;
17
+ set(key: K, value: V): this;
18
+ delete(key: K): boolean;
19
+ private updateKeyUsage;
20
+ private evictLeastRecentlyUsed;
21
+ clear(): void;
22
+ has(key: K): boolean;
23
+ get size(): number;
24
+ forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
25
+ keys(): MapIterator<K>;
26
+ values(): MapIterator<V>;
27
+ entries(): MapIterator<[K, V]>;
28
+ getOrInsert(key: K, defaultValue: V): V;
29
+ getOrInsertComputed(key: K, callback: (key: K) => V): V;
30
+ [Symbol.iterator](): MapIterator<[K, V]>;
31
+ [Symbol.toStringTag]: string;
32
+ toJSON: () => Map<K, V>;
33
+ }
34
+ //#endregion
35
+ //#region src/calc.d.ts
36
+ type Operand = string | number | {
37
+ ref: string;
38
+ };
39
+ declare const calc: {
40
+ negate(x: Operand): string;
41
+ };
42
+ //#endregion
43
+ //#region src/camelcase-property.d.ts
44
+ declare const camelCaseProperty: (property: string) => string;
45
+ //#endregion
46
+ //#region src/capitalize.d.ts
47
+ declare const capitalize: (s: string) => string;
48
+ declare const dashCase: (s: string) => string;
49
+ declare const uncapitalize: (s: string) => string;
50
+ //#endregion
51
+ //#region src/css-var.d.ts
52
+ interface CssVar {
53
+ var: `--${string}`;
54
+ ref: string;
55
+ }
56
+ interface CssVarOptions {
57
+ fallback?: string;
58
+ prefix?: string;
59
+ hash?: boolean;
60
+ }
61
+ declare function cssVar(name: string, options?: CssVarOptions): CssVar;
62
+ //#endregion
63
+ //#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;
66
+ //#endregion
67
+ //#region src/entries.d.ts
68
+ declare function fromEntries<A extends symbol | string | number, B>(entries: [A, B][]): { [key in A]: B };
69
+ declare function entries<A extends symbol | string | number, B>(obj: { [key in A]: B }): [A, B][];
70
+ 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 };
71
+ //#endregion
72
+ //#region src/error.d.ts
73
+ 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';
74
+ declare class BambooError extends Error {
75
+ readonly code: string;
76
+ readonly hint?: string;
77
+ constructor(code: BambooErrorCode, message: string, opts?: {
78
+ hint?: string;
79
+ cause?: unknown;
80
+ });
81
+ }
82
+ //#endregion
83
+ //#region src/esc.d.ts
84
+ declare const esc: (sel: string) => string;
85
+ //#endregion
86
+ //#region src/flatten.d.ts
87
+ declare function flatten(values: Record<string, Record<string, any>>, stop?: WalkObjectStopFn): Record<string, any>;
88
+ //#endregion
89
+ //#region src/get-or-create-set.d.ts
90
+ declare function getOrCreateSet<TKey, TValue>(map: Map<TKey, Set<TValue>>, key: TKey): Set<TValue>;
91
+ //#endregion
92
+ //#region src/is-css-function.d.ts
93
+ declare const isCssFunction: (v: unknown) => boolean;
94
+ //#endregion
95
+ //#region src/is-css-unit.d.ts
96
+ declare const isCssUnit: (v: unknown) => boolean;
97
+ //#endregion
98
+ //#region src/is-css-var.d.ts
99
+ declare const isCssVar: (v: unknown) => boolean;
100
+ //#endregion
101
+ //#region src/merge-anything.d.ts
102
+ /**
103
+ * Credits: https://github.com/mesqueeb/merge-anything
104
+ */
105
+ declare function mergeAndConcat<T, const Tn extends unknown[]>(object: T, ...otherObjects: Tn): any;
106
+ //#endregion
107
+ //#region src/merge-with.d.ts
108
+ declare function mergeWith(target: any, ...sources: any[]): any;
109
+ //#endregion
110
+ //#region src/normalize-style-object.d.ts
111
+ type NormalizeContext = Pick<CreateCssContext, 'utility' | 'conditions'>;
112
+ declare function toResponsiveObject(values: string[], breakpoints: string[]): Record<string, string>;
113
+ declare function normalizeStyleObject(styles: Record<string, any>, context: NormalizeContext, shorthand?: boolean): MappedObject<Record<string, any>, any>;
114
+ //#endregion
115
+ //#region src/omit.d.ts
116
+ declare const omit: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Omit<T, K>;
117
+ //#endregion
118
+ //#region src/bamboo-config-name.d.ts
119
+ declare const BAMBOO_CONFIG_NAME: "__bamboo.config__";
120
+ //#endregion
121
+ //#region src/pick.d.ts
122
+ declare const pick: <T, K extends keyof T | (string & {})>(obj: T, paths: K[]) => Partial<T>;
123
+ //#endregion
124
+ //#region src/property-priority.d.ts
125
+ declare function getPropertyPriority(key: string): number;
126
+ //#endregion
127
+ //#region src/regex.d.ts
128
+ declare const createRegex: (item: Array<string | RegExp>) => RegExp;
129
+ //#endregion
130
+ //#region src/serialize.d.ts
131
+ declare const stringifyJson: (config: Record<string, any>) => string;
132
+ declare const parseJson: (config: string) => any;
133
+ //#endregion
134
+ //#region src/split.d.ts
135
+ declare function splitBy(value: string, separator?: string): any[];
136
+ declare function splitDotPath(path: string): string[];
137
+ declare function getNegativePath(path: string[]): string[];
138
+ declare function getDotPath(obj: any, path: string, fallback?: any): any;
139
+ //#endregion
140
+ //#region src/to-json.d.ts
141
+ type MapToRecord<K extends Map<string, any>> = { [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never };
142
+ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
143
+ //#endregion
144
+ //#region src/traverse.d.ts
145
+ type CallbackFn = (args: CallbackItem) => void;
146
+ interface CallbackItem {
147
+ value: any;
148
+ path: string;
149
+ paths: string[];
150
+ depth: number;
151
+ parent: any[] | Record<string, unknown>;
152
+ key: string;
153
+ }
154
+ interface TraverseOptions {
155
+ separator?: string;
156
+ maxDepth?: number;
157
+ stop?: (args: CallbackItem) => boolean;
158
+ }
159
+ declare function traverse(obj: any, callback: CallbackFn, options?: TraverseOptions): void;
160
+ //#endregion
161
+ //#region src/typegen.d.ts
162
+ declare function unionType(values: IterableIterator<string> | string[] | readonly string[] | Set<string>, opts?: {
163
+ fallback?: string;
164
+ stringify?: (value: string) => string;
165
+ }): string;
166
+ //#endregion
167
+ //#region src/unit-conversion.d.ts
168
+ declare function getUnit(value?: string): string | undefined;
169
+ declare function toPx(value?: string | number): string | undefined;
170
+ declare function toEm(value?: string, fontSize?: number): string | undefined;
171
+ declare function toRem(value?: string): string | undefined;
172
+ //#endregion
173
+ 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 };