@tokenami/config 0.0.11

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 @jjenzz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @tokenami/config
2
+
3
+ This is an internal package, not intended for public usage.
@@ -0,0 +1,272 @@
1
+ import * as v from 'valibot';
2
+
3
+ declare const defaultConfig: {
4
+ readonly include: readonly never[];
5
+ readonly grid: string;
6
+ readonly responsive: {};
7
+ readonly theme: {};
8
+ readonly aliases: {};
9
+ readonly selectors: {
10
+ readonly active: string;
11
+ readonly 'any-link': string;
12
+ readonly checked: string;
13
+ readonly current: string;
14
+ readonly default: string;
15
+ readonly defined: string;
16
+ readonly disabled: string;
17
+ readonly empty: string;
18
+ readonly enabled: string;
19
+ readonly first: string;
20
+ readonly 'first-child': string;
21
+ readonly 'first-of-type': string;
22
+ readonly focus: string;
23
+ readonly 'focus-visible': string;
24
+ readonly 'focus-within': string;
25
+ readonly fullscreen: string;
26
+ readonly hover: string;
27
+ readonly 'in-range': string;
28
+ readonly indeterminate: string;
29
+ readonly invalid: string;
30
+ readonly 'last-child': string;
31
+ readonly 'last-of-type': string;
32
+ readonly left: string;
33
+ readonly link: string;
34
+ readonly 'local-link': string;
35
+ readonly 'nth-col': string;
36
+ readonly 'nth-last-col': string;
37
+ readonly 'only-child': string;
38
+ readonly 'only-of-type': string;
39
+ readonly optional: string;
40
+ readonly 'out-of-range': string;
41
+ readonly paused: string;
42
+ readonly 'picture-in-picture': string;
43
+ readonly 'placeholder-shown': string;
44
+ readonly playing: string;
45
+ readonly 'read-only': string;
46
+ readonly 'read-write': string;
47
+ readonly required: string;
48
+ readonly right: string;
49
+ readonly root: string;
50
+ readonly scope: string;
51
+ readonly target: string;
52
+ readonly 'user-invalid': string;
53
+ readonly 'user-valid': string;
54
+ readonly valid: string;
55
+ readonly visited: string;
56
+ readonly after: string;
57
+ readonly backdrop: string;
58
+ readonly before: string;
59
+ readonly cue: string;
60
+ readonly 'cue-region': string;
61
+ readonly 'file-selector-button': string;
62
+ readonly 'first-letter': string;
63
+ readonly 'first-line': string;
64
+ readonly marker: string;
65
+ readonly placeholder: string;
66
+ readonly selection: string;
67
+ };
68
+ readonly properties: {
69
+ readonly 'accent-color': readonly "color"[];
70
+ readonly animation: readonly "anim"[];
71
+ readonly 'animation-timing-function': readonly "ease"[];
72
+ readonly background: readonly ("color" | "surface")[];
73
+ readonly 'background-color': readonly "color"[];
74
+ readonly 'background-image': readonly "surface"[];
75
+ readonly 'background-position': readonly "grid"[];
76
+ readonly 'background-position-x': readonly "grid"[];
77
+ readonly 'background-position-y': readonly "grid"[];
78
+ readonly 'block-size': readonly ("grid" | "size")[];
79
+ readonly border: readonly "border"[];
80
+ readonly 'border-block': readonly "border"[];
81
+ readonly 'border-block-color': readonly "color"[];
82
+ readonly 'border-block-end': readonly "border"[];
83
+ readonly 'border-block-end-color': readonly "color"[];
84
+ readonly 'border-block-end-style': readonly "line-style"[];
85
+ readonly 'border-block-end-width': readonly "grid"[];
86
+ readonly 'border-block-start': readonly "border"[];
87
+ readonly 'border-block-start-color': readonly "color"[];
88
+ readonly 'border-block-start-style': readonly "line-style"[];
89
+ readonly 'border-block-start-width': readonly "grid"[];
90
+ readonly 'border-block-style': readonly "line-style"[];
91
+ readonly 'border-block-width': readonly "grid"[];
92
+ readonly 'border-bottom': readonly "border"[];
93
+ readonly 'border-bottom-color': readonly "color"[];
94
+ readonly 'border-bottom-left-radius': readonly "radii"[];
95
+ readonly 'border-bottom-right-radius': readonly "radii"[];
96
+ readonly 'border-bottom-style': readonly "line-style"[];
97
+ readonly 'border-bottom-width': readonly "grid"[];
98
+ readonly 'border-color': readonly "color"[];
99
+ readonly 'border-end-end-radius': readonly "radii"[];
100
+ readonly 'border-end-start-radius': readonly "radii"[];
101
+ readonly 'border-inline': readonly "border"[];
102
+ readonly 'border-inline-color': readonly "color"[];
103
+ readonly 'border-inline-end': readonly "border"[];
104
+ readonly 'border-inline-end-color': readonly "color"[];
105
+ readonly 'border-inline-end-style': readonly "line-style"[];
106
+ readonly 'border-inline-end-width': readonly "grid"[];
107
+ readonly 'border-inline-start': readonly "border"[];
108
+ readonly 'border-inline-start-color': readonly "color"[];
109
+ readonly 'border-inline-start-style': readonly "line-style"[];
110
+ readonly 'border-inline-start-width': readonly "grid"[];
111
+ readonly 'border-inline-style': readonly "line-style"[];
112
+ readonly 'border-inline-width': readonly "grid"[];
113
+ readonly 'border-left': readonly "border"[];
114
+ readonly 'border-left-color': readonly "color"[];
115
+ readonly 'border-left-style': readonly "line-style"[];
116
+ readonly 'border-left-width': readonly "grid"[];
117
+ readonly 'border-radius': readonly "radii"[];
118
+ readonly 'border-right': readonly "border"[];
119
+ readonly 'border-right-color': readonly "color"[];
120
+ readonly 'border-right-style': readonly "line-style"[];
121
+ readonly 'border-right-width': readonly "grid"[];
122
+ readonly 'border-start-end-radius': readonly "radii"[];
123
+ readonly 'border-start-start-radius': readonly "radii"[];
124
+ readonly 'border-style': readonly "line-style"[];
125
+ readonly 'border-top': readonly "border"[];
126
+ readonly 'border-top-color': readonly "color"[];
127
+ readonly 'border-top-left-radius': readonly "radii"[];
128
+ readonly 'border-top-right-radius': readonly "radii"[];
129
+ readonly 'border-top-style': readonly "line-style"[];
130
+ readonly 'border-top-width': readonly "grid"[];
131
+ readonly 'border-width': readonly "grid"[];
132
+ readonly bottom: readonly "grid"[];
133
+ readonly 'box-shadow': readonly "shadow"[];
134
+ readonly 'caret-color': readonly "color"[];
135
+ readonly color: readonly "color"[];
136
+ readonly 'column-gap': readonly "grid"[];
137
+ readonly 'column-rule-color': readonly "color"[];
138
+ readonly 'column-rule-width': readonly "grid"[];
139
+ readonly 'column-width': readonly ("grid" | "size")[];
140
+ readonly 'flex-basis': readonly ("grid" | "size")[];
141
+ readonly 'font-family': readonly "font"[];
142
+ readonly 'font-size': readonly "font-size"[];
143
+ readonly 'font-weight': readonly "weight"[];
144
+ readonly gap: readonly "grid"[];
145
+ readonly height: readonly ("grid" | "size")[];
146
+ readonly 'inline-size': readonly ("grid" | "size")[];
147
+ readonly inset: readonly "grid"[];
148
+ readonly 'inset-block': readonly "grid"[];
149
+ readonly 'inset-block-end': readonly "grid"[];
150
+ readonly 'inset-block-start': readonly "grid"[];
151
+ readonly 'inset-inline': readonly "grid"[];
152
+ readonly 'inset-inline-end': readonly "grid"[];
153
+ readonly 'inset-inline-start': readonly "grid"[];
154
+ readonly left: readonly "grid"[];
155
+ readonly 'letter-spacing': readonly "tracking"[];
156
+ readonly 'line-height': readonly "leading"[];
157
+ readonly margin: readonly "grid"[];
158
+ readonly 'margin-block': readonly "grid"[];
159
+ readonly 'margin-block-end': readonly "grid"[];
160
+ readonly 'margin-block-start': readonly "grid"[];
161
+ readonly 'margin-bottom': readonly "grid"[];
162
+ readonly 'margin-inline': readonly "grid"[];
163
+ readonly 'margin-inline-end': readonly "grid"[];
164
+ readonly 'margin-inline-start': readonly "grid"[];
165
+ readonly 'margin-left': readonly "grid"[];
166
+ readonly 'margin-right': readonly "grid"[];
167
+ readonly 'margin-top': readonly "grid"[];
168
+ readonly 'max-block-size': readonly ("grid" | "size")[];
169
+ readonly 'max-height': readonly ("grid" | "size")[];
170
+ readonly 'max-inline-size': readonly ("grid" | "size")[];
171
+ readonly 'max-width': readonly ("grid" | "size")[];
172
+ readonly 'min-block-size': readonly ("grid" | "size")[];
173
+ readonly 'min-height': readonly ("grid" | "size")[];
174
+ readonly 'min-inline-size': readonly ("grid" | "size")[];
175
+ readonly 'min-width': readonly ("grid" | "size")[];
176
+ readonly opacity: readonly "alpha"[];
177
+ readonly 'outline-color': readonly "color"[];
178
+ readonly padding: readonly "grid"[];
179
+ readonly 'padding-block': readonly "grid"[];
180
+ readonly 'padding-block-end': readonly "grid"[];
181
+ readonly 'padding-block-start': readonly "grid"[];
182
+ readonly 'padding-bottom': readonly "grid"[];
183
+ readonly 'padding-inline': readonly "grid"[];
184
+ readonly 'padding-inline-end': readonly "grid"[];
185
+ readonly 'padding-inline-start': readonly "grid"[];
186
+ readonly 'padding-left': readonly "grid"[];
187
+ readonly 'padding-right': readonly "grid"[];
188
+ readonly 'padding-top': readonly "grid"[];
189
+ readonly right: readonly "grid"[];
190
+ readonly 'row-gap': readonly "grid"[];
191
+ readonly 'scroll-margin': readonly "grid"[];
192
+ readonly 'scroll-margin-bottom': readonly "grid"[];
193
+ readonly 'scroll-margin-left': readonly "grid"[];
194
+ readonly 'scroll-margin-right': readonly "grid"[];
195
+ readonly 'scroll-margin-top': readonly "grid"[];
196
+ readonly 'scroll-padding': readonly "grid"[];
197
+ readonly 'scroll-padding-bottom': readonly "grid"[];
198
+ readonly 'scroll-padding-left': readonly "grid"[];
199
+ readonly 'scroll-padding-right': readonly "grid"[];
200
+ readonly 'scroll-padding-top': readonly "grid"[];
201
+ readonly 'text-decoration-color': readonly "color"[];
202
+ readonly 'text-shadow': readonly "shadow"[];
203
+ readonly top: readonly "grid"[];
204
+ readonly transition: readonly "transition"[];
205
+ readonly 'transition-timing-function': readonly "ease"[];
206
+ readonly width: readonly ("grid" | "size")[];
207
+ readonly 'z-index': readonly "z"[];
208
+ };
209
+ };
210
+ type DefaultConfig = typeof defaultConfig;
211
+
212
+ declare const properties: readonly ["-webkit-line-clamp", "accent-color", "align-tracks", "all", "animation", "animation-composition", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timeline", "animation-timing-function", "appearance", "aspect-ratio", "backdrop-filter", "backface-visibility", "background", "background-attachment", "background-blend-mode", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-position-x", "background-position-y", "background-repeat", "background-size", "block-overflow", "block-size", "border", "border-style", "border-color", "border-width", "border-top", "border-top-color", "border-top-style", "border-top-width", "border-right", "border-right-color", "border-right-style", "border-right-width", "border-bottom", "border-bottom-color", "border-bottom-style", "border-bottom-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-block", "border-block-width", "border-block-style", "border-block-color", "border-block-start", "border-block-end", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-inline", "border-inline-color", "border-inline-style", "border-inline-width", "border-inline-start", "border-inline-end", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-radius", "border-top-left-radius", "border-top-right-radius", "border-bottom-left-radius", "border-bottom-right-radius", "border-start-end-radius", "border-start-start-radius", "border-end-end-radius", "border-end-start-radius", "border-collapse", "border-spacing", "box-decoration-break", "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "caption-side", "caret", "caret-color", "caret-shape", "clear", "clip", "clip-path", "color", "color-scheme", "column-fill", "column-span", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "columns", "column-count", "column-width", "contain", "contain-intrinsic-block-size", "contain-intrinsic-height", "contain-intrinsic-inline-size", "contain-intrinsic-size", "contain-intrinsic-width", "container", "container-name", "container-type", "content", "content-visibility", "counter-increment", "counter-reset", "counter-set", "cursor", "direction", "display", "empty-cells", "filter", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "font", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-optical-sizing", "font-palette", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-synthesis", "font-variant", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-emoji", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-variation-settings", "font-weight", "forced-color-adjust", "gap", "row-gap", "column-gap", "grid", "grid-area", "grid-auto-rows", "grid-auto-columns", "grid-auto-flow", "grid-column", "grid-column-end", "grid-column-start", "grid-row", "grid-row-end", "grid-row-start", "grid-template", "grid-template-rows", "grid-template-columns", "grid-template-areas", "hanging-punctuation", "height", "hyphenate-character", "hyphenate-limit-chars", "hyphens", "image-orientation", "image-rendering", "image-resolution", "initial-letter", "inline-size", "input-security", "inset", "top", "right", "bottom", "left", "inset-block", "inset-block-end", "inset-block-start", "inset-inline", "inset-inline-end", "inset-inline-start", "isolation", "justify-tracks", "letter-spacing", "line-break", "line-clamp", "line-height", "line-height-step", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", "margin-block", "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end", "margin-inline-start", "margin-trim", "mask", "mask-border", "mask-border-mode", "mask-border-outset", "mask-border-repeat", "mask-border-slice", "mask-border-source", "mask-border-width", "mask-clip", "mask-composite", "mask-image", "mask-mode", "mask-origin", "mask-position", "mask-repeat", "mask-size", "mask-type", "math-depth", "math-shift", "math-style", "max-block-size", "max-height", "max-inline-size", "max-lines", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "mix-blend-mode", "object-fit", "object-position", "offset", "offset-anchor", "offset-distance", "offset-path", "offset-position", "offset-rotate", "opacity", "order", "orphans", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-anchor", "overflow-block", "overflow-clip-margin", "overflow-inline", "overflow-wrap", "overflow-x", "overflow-y", "overscroll-behavior", "overscroll-behavior-block", "overscroll-behavior-inline", "overscroll-behavior-x", "overscroll-behavior-y", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "padding-block", "padding-block-end", "padding-block-start", "padding-inline", "padding-inline-end", "padding-inline-start", "page", "page-break-after", "page-break-before", "page-break-inside", "paint-order", "perspective", "perspective-origin", "place-content", "align-content", "justify-content", "place-items", "align-items", "justify-items", "place-self", "align-self", "justify-self", "pointer-events", "position", "print-color-adjust", "quotes", "resize", "rotate", "ruby-align", "ruby-merge", "ruby-position", "scale", "scroll-behavior", "scroll-margin", "scroll-margin-top", "scroll-margin-right", "scroll-margin-bottom", "scroll-margin-left", "scroll-margin-block", "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-inline", "scroll-margin-inline-end", "scroll-margin-inline-start", "scroll-padding", "scroll-padding-top", "scroll-padding-right", "scroll-padding-bottom", "scroll-padding-left", "scroll-padding-block", "scroll-padding-block-end", "scroll-padding-block-start", "scroll-padding-inline", "scroll-padding-inline-end", "scroll-padding-inline-start", "scroll-snap-align", "scroll-snap-stop", "scroll-snap-type", "scroll-timeline", "scroll-timeline-axis", "scroll-timeline-name", "scrollbar-color", "scrollbar-gutter", "scrollbar-width", "shape-image-threshold", "shape-margin", "shape-outside", "tab-size", "table-layout", "text-align", "text-align-last", "text-combine-upright", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-decoration-thickness", "text-decoration-skip-ink", "text-emphasis", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style", "text-indent", "text-justify", "text-orientation", "text-overflow", "text-rendering", "text-shadow", "text-size-adjust", "text-transform", "text-underline-offset", "text-underline-position", "touch-action", "transform", "transform-box", "transform-origin", "transform-style", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "translate", "unicode-bidi", "user-select", "vertical-align", "view-transition-name", "visibility", "white-space", "widows", "width", "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index", "zoom"];
213
+ type CSSProperty = (typeof properties)[number];
214
+
215
+ declare function tokenProperty(name: string): TokenProperty;
216
+ declare function variantProperty(variant: string, name: string): TokenProperty;
217
+ declare function tokenValue<TK extends string, N extends string>(themeKey: TK, name: N): TokenValue<TK, N>;
218
+ declare function arbitraryValue(value: string): ArbitraryValue;
219
+ declare const gridValueSchema: v.NumberSchema<number>;
220
+ type GridValue = v.Output<typeof gridValueSchema>;
221
+ declare const GridValue: {
222
+ safeParse: (input: unknown) => v.SafeParseResult<v.NumberSchema<number>>;
223
+ };
224
+ type TokenProperty<P extends string = string> = `--${P}`;
225
+ declare const TokenProperty: {
226
+ safeParse: (input: unknown) => v.SafeParseResult<v.StringSchema<string>>;
227
+ };
228
+ type TokenValue<TK extends string = string, V extends string = string> = `var(--${TK}_${V})`;
229
+ declare const TokenValue: {
230
+ safeParse: (input: unknown) => v.SafeParseResult<v.StringSchema<string>>;
231
+ };
232
+ type ArbitraryValue = `var(---,${string})`;
233
+ declare const ArbitraryValue: v.StringSchema<string>;
234
+ type ThemeKey = 'alpha' | 'border' | 'color' | 'ease' | 'font-size' | 'leading' | 'line-style' | 'radii' | 'size' | 'shadow' | 'tracking' | 'transition' | 'weight' | 'z' | (string & {});
235
+ type ThemeValues = Record<string, string | number>;
236
+ type Theme = Partial<Record<ThemeKey, ThemeValues>>;
237
+ type Aliases = Record<string, readonly (CSSProperty | (string & {}))[]>;
238
+ type PropertiesOptions = readonly ('grid' | ThemeKey)[];
239
+ type DeepReadonly<T> = {
240
+ readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
241
+ };
242
+ type Exact<T, V extends T> = Exclude<keyof V, keyof T> extends never ? V : T;
243
+ interface Config extends DeepReadonly<{
244
+ include: string[];
245
+ exclude?: string[];
246
+ grid?: string;
247
+ responsive?: {
248
+ [atRule: string]: string;
249
+ };
250
+ selectors?: {
251
+ [name: string]: string | string[];
252
+ };
253
+ keyframes?: {
254
+ [name: string]: {
255
+ [step: string]: {
256
+ [cssProperty: string]: string;
257
+ };
258
+ };
259
+ };
260
+ aliases?: Aliases;
261
+ theme: Theme;
262
+ properties?: Partial<Record<CSSProperty, PropertiesOptions>>;
263
+ }> {
264
+ }
265
+ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepReadonly<T>;
266
+ declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
267
+ declare function getTokenValueParts(tokenValue: TokenValue): {
268
+ themeKey: string;
269
+ token: string;
270
+ } | undefined;
271
+
272
+ export { Aliases, ArbitraryValue, CSSProperty, Config, DefaultConfig, GridValue, Theme, TokenProperty, TokenValue, arbitraryValue, createConfig, defaultConfig, getTokenPropertyName, getTokenValueParts, properties, tokenProperty, tokenValue, variantProperty };