@pandacss/token-dictionary 0.29.1 → 0.30.1
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.mts +42 -43
- package/dist/index.d.ts +42 -43
- package/dist/index.js +380 -366
- package/dist/index.mjs +385 -364
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CssVarOptions, CssVar } from '@pandacss/shared';
|
|
2
2
|
import { Tokens, SemanticTokens } from '@pandacss/types';
|
|
3
3
|
|
|
4
4
|
type TokenStatus = 'deprecated' | 'experimental' | 'new';
|
|
@@ -15,9 +15,9 @@ interface TokenConditions {
|
|
|
15
15
|
interface TokenReferences {
|
|
16
16
|
[key: string]: Token;
|
|
17
17
|
}
|
|
18
|
-
type TokenExtensions = ExtensionData & {
|
|
18
|
+
type TokenExtensions<T = {}> = ExtensionData & {
|
|
19
19
|
[key: string]: any;
|
|
20
|
-
};
|
|
20
|
+
} & T;
|
|
21
21
|
interface ExtendedToken {
|
|
22
22
|
name: string;
|
|
23
23
|
value: any;
|
|
@@ -85,16 +85,12 @@ declare class Token {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type EnforcePhase = 'pre' | 'post';
|
|
88
|
-
interface Options {
|
|
89
|
-
prefix?: string;
|
|
90
|
-
hash?: boolean;
|
|
91
|
-
}
|
|
92
88
|
interface TokenTransformer {
|
|
93
89
|
name: string;
|
|
94
90
|
enforce?: EnforcePhase;
|
|
95
91
|
type?: 'value' | 'name' | 'extensions';
|
|
96
92
|
match?: (token: Token) => boolean;
|
|
97
|
-
transform: (token: Token,
|
|
93
|
+
transform: (token: Token, dictionary: TokenDictionary) => any;
|
|
98
94
|
}
|
|
99
95
|
interface TokenDictionaryOptions {
|
|
100
96
|
tokens?: Tokens;
|
|
@@ -105,18 +101,25 @@ interface TokenDictionaryOptions {
|
|
|
105
101
|
}
|
|
106
102
|
interface TokenMiddleware {
|
|
107
103
|
enforce?: EnforcePhase;
|
|
108
|
-
transform: (dict: TokenDictionary
|
|
104
|
+
transform: (dict: TokenDictionary) => void;
|
|
109
105
|
}
|
|
110
|
-
declare class TokenDictionary
|
|
106
|
+
declare class TokenDictionary {
|
|
107
|
+
private options;
|
|
111
108
|
allTokens: Token[];
|
|
112
|
-
|
|
113
|
-
hash: boolean | undefined;
|
|
114
|
-
get allNames(): string[];
|
|
109
|
+
byName: Map<string, Token>;
|
|
115
110
|
constructor(options: TokenDictionaryOptions);
|
|
116
|
-
|
|
111
|
+
init(): this;
|
|
112
|
+
get prefix(): string | undefined;
|
|
113
|
+
get hash(): boolean | undefined;
|
|
114
|
+
getByName: (path: string) => Token | undefined;
|
|
115
|
+
formatTokenName: (path: string[]) => string;
|
|
116
|
+
formatCssVar: (path: string[], options: CssVarOptions) => CssVar;
|
|
117
|
+
registerTokens(): this;
|
|
118
|
+
registerToken: (token: Token, transformPhase?: 'pre' | 'post') => void;
|
|
117
119
|
private transforms;
|
|
118
120
|
registerTransform(...transforms: TokenTransformer[]): this;
|
|
119
121
|
private execTransform;
|
|
122
|
+
execTransformOnToken(transform: TokenTransformer, token: Token): void;
|
|
120
123
|
transformTokens(enforce: EnforcePhase): this;
|
|
121
124
|
private middlewares;
|
|
122
125
|
registerMiddleware(...middlewares: TokenMiddleware[]): this;
|
|
@@ -126,42 +129,38 @@ declare class TokenDictionary$1 {
|
|
|
126
129
|
addReferences(): this;
|
|
127
130
|
filter(pattern: Partial<Token> | ((token: Token) => boolean)): Token[];
|
|
128
131
|
addConditionalTokens(): this;
|
|
129
|
-
|
|
130
|
-
build(): void;
|
|
131
|
-
get isEmpty(): boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
declare const formats: {
|
|
135
|
-
groupByCondition(dictionary: TokenDictionary$1): Map<string, Set<Token>>;
|
|
136
|
-
groupByColorPalette(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
137
|
-
groupByCategory(dictionary: TokenDictionary$1): Map<string, Map<string, Token>>;
|
|
138
|
-
getFlattenedValues(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
139
|
-
getVars(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
140
|
-
createVarGetter(dictionary: TokenDictionary$1): (path: string, fallback?: string | number) => string;
|
|
141
|
-
getColorPaletteValues(dictionary: TokenDictionary$1): Set<string>;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
declare class TokenDictionary extends TokenDictionary$1 {
|
|
145
|
-
get: ReturnType<typeof formats.createVarGetter>;
|
|
146
|
-
conditionMap: ReturnType<typeof formats.groupByCondition>;
|
|
147
|
-
categoryMap: ReturnType<typeof formats.groupByCategory>;
|
|
148
|
-
values: ReturnType<typeof formats.getFlattenedValues>;
|
|
149
|
-
colorPalettes: ReturnType<typeof formats.groupByColorPalette>;
|
|
150
|
-
vars: ReturnType<typeof formats.getVars>;
|
|
151
|
-
json: ReturnType<typeof mapToJson>;
|
|
152
|
-
constructor(options: TokenDictionaryOptions);
|
|
153
|
-
getValue: (path: string) => {
|
|
154
|
-
[k: string]: string;
|
|
155
|
-
} | undefined;
|
|
156
|
-
getTokenVar: (path: string) => any;
|
|
132
|
+
expandTokenReferences(): this;
|
|
157
133
|
/**
|
|
158
134
|
* Expand token references to their CSS variable
|
|
159
135
|
*/
|
|
160
|
-
|
|
136
|
+
expandReferenceInValue(value: string): string;
|
|
161
137
|
/**
|
|
162
138
|
* Resolve token references to their actual raw value
|
|
163
139
|
*/
|
|
164
140
|
resolveReference(value: string): string;
|
|
141
|
+
build(): this;
|
|
142
|
+
get isEmpty(): boolean;
|
|
143
|
+
view: ReturnType<TokenDictionaryView['getTokensView']>;
|
|
144
|
+
setComputedView(): this;
|
|
145
|
+
}
|
|
146
|
+
declare class TokenDictionaryView {
|
|
147
|
+
private dictionary;
|
|
148
|
+
constructor(dictionary: TokenDictionary);
|
|
149
|
+
getTokensView(): {
|
|
150
|
+
conditionMap: Map<string, Set<Token>>;
|
|
151
|
+
categoryMap: Map<string, Map<string, Token>>;
|
|
152
|
+
colorPalettes: Map<string, Map<string, string>>;
|
|
153
|
+
vars: Map<string, Map<string, string>>;
|
|
154
|
+
values: Map<string, string>;
|
|
155
|
+
json: Record<string, Record<string, string>>;
|
|
156
|
+
get: (path: string, fallback?: string | number) => string;
|
|
157
|
+
getCategoryValues: (category: string) => Record<string, string> | undefined;
|
|
158
|
+
};
|
|
159
|
+
private processCondition;
|
|
160
|
+
private processColorPalette;
|
|
161
|
+
private processCategory;
|
|
162
|
+
private processValue;
|
|
163
|
+
private processVars;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
export { Token, TokenDictionary };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CssVarOptions, CssVar } from '@pandacss/shared';
|
|
2
2
|
import { Tokens, SemanticTokens } from '@pandacss/types';
|
|
3
3
|
|
|
4
4
|
type TokenStatus = 'deprecated' | 'experimental' | 'new';
|
|
@@ -15,9 +15,9 @@ interface TokenConditions {
|
|
|
15
15
|
interface TokenReferences {
|
|
16
16
|
[key: string]: Token;
|
|
17
17
|
}
|
|
18
|
-
type TokenExtensions = ExtensionData & {
|
|
18
|
+
type TokenExtensions<T = {}> = ExtensionData & {
|
|
19
19
|
[key: string]: any;
|
|
20
|
-
};
|
|
20
|
+
} & T;
|
|
21
21
|
interface ExtendedToken {
|
|
22
22
|
name: string;
|
|
23
23
|
value: any;
|
|
@@ -85,16 +85,12 @@ declare class Token {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
type EnforcePhase = 'pre' | 'post';
|
|
88
|
-
interface Options {
|
|
89
|
-
prefix?: string;
|
|
90
|
-
hash?: boolean;
|
|
91
|
-
}
|
|
92
88
|
interface TokenTransformer {
|
|
93
89
|
name: string;
|
|
94
90
|
enforce?: EnforcePhase;
|
|
95
91
|
type?: 'value' | 'name' | 'extensions';
|
|
96
92
|
match?: (token: Token) => boolean;
|
|
97
|
-
transform: (token: Token,
|
|
93
|
+
transform: (token: Token, dictionary: TokenDictionary) => any;
|
|
98
94
|
}
|
|
99
95
|
interface TokenDictionaryOptions {
|
|
100
96
|
tokens?: Tokens;
|
|
@@ -105,18 +101,25 @@ interface TokenDictionaryOptions {
|
|
|
105
101
|
}
|
|
106
102
|
interface TokenMiddleware {
|
|
107
103
|
enforce?: EnforcePhase;
|
|
108
|
-
transform: (dict: TokenDictionary
|
|
104
|
+
transform: (dict: TokenDictionary) => void;
|
|
109
105
|
}
|
|
110
|
-
declare class TokenDictionary
|
|
106
|
+
declare class TokenDictionary {
|
|
107
|
+
private options;
|
|
111
108
|
allTokens: Token[];
|
|
112
|
-
|
|
113
|
-
hash: boolean | undefined;
|
|
114
|
-
get allNames(): string[];
|
|
109
|
+
byName: Map<string, Token>;
|
|
115
110
|
constructor(options: TokenDictionaryOptions);
|
|
116
|
-
|
|
111
|
+
init(): this;
|
|
112
|
+
get prefix(): string | undefined;
|
|
113
|
+
get hash(): boolean | undefined;
|
|
114
|
+
getByName: (path: string) => Token | undefined;
|
|
115
|
+
formatTokenName: (path: string[]) => string;
|
|
116
|
+
formatCssVar: (path: string[], options: CssVarOptions) => CssVar;
|
|
117
|
+
registerTokens(): this;
|
|
118
|
+
registerToken: (token: Token, transformPhase?: 'pre' | 'post') => void;
|
|
117
119
|
private transforms;
|
|
118
120
|
registerTransform(...transforms: TokenTransformer[]): this;
|
|
119
121
|
private execTransform;
|
|
122
|
+
execTransformOnToken(transform: TokenTransformer, token: Token): void;
|
|
120
123
|
transformTokens(enforce: EnforcePhase): this;
|
|
121
124
|
private middlewares;
|
|
122
125
|
registerMiddleware(...middlewares: TokenMiddleware[]): this;
|
|
@@ -126,42 +129,38 @@ declare class TokenDictionary$1 {
|
|
|
126
129
|
addReferences(): this;
|
|
127
130
|
filter(pattern: Partial<Token> | ((token: Token) => boolean)): Token[];
|
|
128
131
|
addConditionalTokens(): this;
|
|
129
|
-
|
|
130
|
-
build(): void;
|
|
131
|
-
get isEmpty(): boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
declare const formats: {
|
|
135
|
-
groupByCondition(dictionary: TokenDictionary$1): Map<string, Set<Token>>;
|
|
136
|
-
groupByColorPalette(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
137
|
-
groupByCategory(dictionary: TokenDictionary$1): Map<string, Map<string, Token>>;
|
|
138
|
-
getFlattenedValues(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
139
|
-
getVars(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
|
|
140
|
-
createVarGetter(dictionary: TokenDictionary$1): (path: string, fallback?: string | number) => string;
|
|
141
|
-
getColorPaletteValues(dictionary: TokenDictionary$1): Set<string>;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
declare class TokenDictionary extends TokenDictionary$1 {
|
|
145
|
-
get: ReturnType<typeof formats.createVarGetter>;
|
|
146
|
-
conditionMap: ReturnType<typeof formats.groupByCondition>;
|
|
147
|
-
categoryMap: ReturnType<typeof formats.groupByCategory>;
|
|
148
|
-
values: ReturnType<typeof formats.getFlattenedValues>;
|
|
149
|
-
colorPalettes: ReturnType<typeof formats.groupByColorPalette>;
|
|
150
|
-
vars: ReturnType<typeof formats.getVars>;
|
|
151
|
-
json: ReturnType<typeof mapToJson>;
|
|
152
|
-
constructor(options: TokenDictionaryOptions);
|
|
153
|
-
getValue: (path: string) => {
|
|
154
|
-
[k: string]: string;
|
|
155
|
-
} | undefined;
|
|
156
|
-
getTokenVar: (path: string) => any;
|
|
132
|
+
expandTokenReferences(): this;
|
|
157
133
|
/**
|
|
158
134
|
* Expand token references to their CSS variable
|
|
159
135
|
*/
|
|
160
|
-
|
|
136
|
+
expandReferenceInValue(value: string): string;
|
|
161
137
|
/**
|
|
162
138
|
* Resolve token references to their actual raw value
|
|
163
139
|
*/
|
|
164
140
|
resolveReference(value: string): string;
|
|
141
|
+
build(): this;
|
|
142
|
+
get isEmpty(): boolean;
|
|
143
|
+
view: ReturnType<TokenDictionaryView['getTokensView']>;
|
|
144
|
+
setComputedView(): this;
|
|
145
|
+
}
|
|
146
|
+
declare class TokenDictionaryView {
|
|
147
|
+
private dictionary;
|
|
148
|
+
constructor(dictionary: TokenDictionary);
|
|
149
|
+
getTokensView(): {
|
|
150
|
+
conditionMap: Map<string, Set<Token>>;
|
|
151
|
+
categoryMap: Map<string, Map<string, Token>>;
|
|
152
|
+
colorPalettes: Map<string, Map<string, string>>;
|
|
153
|
+
vars: Map<string, Map<string, string>>;
|
|
154
|
+
values: Map<string, string>;
|
|
155
|
+
json: Record<string, Record<string, string>>;
|
|
156
|
+
get: (path: string, fallback?: string | number) => string;
|
|
157
|
+
getCategoryValues: (category: string) => Record<string, string> | undefined;
|
|
158
|
+
};
|
|
159
|
+
private processCondition;
|
|
160
|
+
private processColorPalette;
|
|
161
|
+
private processCategory;
|
|
162
|
+
private processValue;
|
|
163
|
+
private processVars;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
export { Token, TokenDictionary };
|