@styleframe/theme 1.0.0 → 1.0.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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/dist/theme.d.ts +772 -0
- package/dist/theme.js +2507 -0
- package/dist/theme.umd.cjs +4 -0
- package/package.json +16 -6
- package/.tsbuildinfo +0 -1
- package/src/constants/border.ts +0 -0
- package/src/constants/breakpoint.ts +0 -0
- package/src/constants/color.ts +0 -0
- package/src/constants/index.ts +0 -4
- package/src/constants/scale.ts +0 -3
- package/src/constants/typography.ts +0 -0
- package/src/index.ts +0 -4
- package/src/shims.d.ts +0 -8
- package/src/types.ts +0 -32
- package/src/utils/createUseVariable.test.ts +0 -928
- package/src/utils/createUseVariable.ts +0 -107
- package/src/utils/index.ts +0 -1
- package/src/variables/index.ts +0 -22
- package/src/variables/useBorderColor.ts +0 -27
- package/src/variables/useBorderRadius.test.ts +0 -335
- package/src/variables/useBorderRadius.ts +0 -26
- package/src/variables/useBorderStyle.test.ts +0 -569
- package/src/variables/useBorderStyle.ts +0 -49
- package/src/variables/useBorderWidth.test.ts +0 -535
- package/src/variables/useBorderWidth.ts +0 -38
- package/src/variables/useBoxShadow.test.ts +0 -336
- package/src/variables/useBoxShadow.ts +0 -54
- package/src/variables/useBreakpoint.test.ts +0 -447
- package/src/variables/useBreakpoint.ts +0 -38
- package/src/variables/useColor.test.ts +0 -360
- package/src/variables/useColor.ts +0 -35
- package/src/variables/useColorLightness.test.ts +0 -168
- package/src/variables/useColorLightness.ts +0 -59
- package/src/variables/useColorShade.test.ts +0 -166
- package/src/variables/useColorShade.ts +0 -52
- package/src/variables/useColorTint.test.ts +0 -164
- package/src/variables/useColorTint.ts +0 -52
- package/src/variables/useEasing.ts +0 -0
- package/src/variables/useFontFamily.test.ts +0 -228
- package/src/variables/useFontFamily.ts +0 -33
- package/src/variables/useFontSize.test.ts +0 -299
- package/src/variables/useFontSize.ts +0 -32
- package/src/variables/useFontStyle.test.ts +0 -555
- package/src/variables/useFontStyle.ts +0 -37
- package/src/variables/useFontWeight.test.ts +0 -650
- package/src/variables/useFontWeight.ts +0 -55
- package/src/variables/useLetterSpacing.test.ts +0 -455
- package/src/variables/useLetterSpacing.ts +0 -41
- package/src/variables/useLineHeight.test.ts +0 -410
- package/src/variables/useLineHeight.ts +0 -41
- package/src/variables/useMultiplier.test.ts +0 -722
- package/src/variables/useMultiplier.ts +0 -44
- package/src/variables/useScale.test.ts +0 -393
- package/src/variables/useScale.ts +0 -52
- package/src/variables/useScalePowers.test.ts +0 -412
- package/src/variables/useScalePowers.ts +0 -35
- package/src/variables/useSpacing.test.ts +0 -309
- package/src/variables/useSpacing.ts +0 -26
- package/src/vite-env.d.ts +0 -1
- package/test-scale.js +0 -22
- package/tsconfig.json +0 -7
- package/vite.config.ts +0 -5
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
import { CamelCase } from 'scule';
|
|
2
|
+
import { Reference } from '@styleframe/core';
|
|
3
|
+
import { Styleframe } from '@styleframe/core';
|
|
4
|
+
import { TokenValue } from '@styleframe/core';
|
|
5
|
+
import { Variable } from '@styleframe/core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a generic composable function for a CSS property.
|
|
9
|
+
*
|
|
10
|
+
* This factory function generates `use*` composables (like `useFontFamily`, `useLineHeight`, etc.)
|
|
11
|
+
* from a CSS property name string.
|
|
12
|
+
*
|
|
13
|
+
* @param propertyName - The CSS property name (e.g., 'font-family', 'line-height')
|
|
14
|
+
* @returns A composable function that creates variables for the given property
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { styleframe } from "styleframe";
|
|
19
|
+
* import { createUseVariable } from "styleframe/theme";
|
|
20
|
+
*
|
|
21
|
+
* // Create a useFontFamily composable
|
|
22
|
+
* const useFontFamily = createUseVariable("font-family");
|
|
23
|
+
*
|
|
24
|
+
* const s = styleframe();
|
|
25
|
+
* const { fontFamily, fontFamilyMono } = useFontFamily(s, {
|
|
26
|
+
* default: "Arial, sans-serif",
|
|
27
|
+
* mono: "Courier, monospace",
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Create a useLineHeight composable
|
|
34
|
+
* const useLineHeight = createUseVariable("line-height");
|
|
35
|
+
*
|
|
36
|
+
* const s = styleframe();
|
|
37
|
+
* const { lineHeight, lineHeightTight, lineHeightLoose } = useLineHeight(s, {
|
|
38
|
+
* default: "1.5",
|
|
39
|
+
* tight: "1.25",
|
|
40
|
+
* loose: "1.75",
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createUseVariable<PropertyName extends string, Delimiter extends string = "--", Defaults extends Record<string, TokenValue> = Record<string, TokenValue>, MergeDefaults extends boolean = false>(propertyName: PropertyName, { defaults, mergeDefaults, transform, delimiter, }?: {
|
|
45
|
+
defaults?: Defaults;
|
|
46
|
+
mergeDefaults?: MergeDefaults;
|
|
47
|
+
transform?: (value: TokenValue) => TokenValue;
|
|
48
|
+
delimiter?: Delimiter;
|
|
49
|
+
}): <T extends Record<string, TokenValue> = Defaults>(s: Styleframe, tokens?: T) => ExportKeys<PropertyName, MergeDefaults extends true ? Defaults & T : T, Delimiter>;
|
|
50
|
+
|
|
51
|
+
export declare const defaultBorderStyleValues: {
|
|
52
|
+
readonly default: "@solid";
|
|
53
|
+
readonly none: "none";
|
|
54
|
+
readonly solid: "solid";
|
|
55
|
+
readonly dashed: "dashed";
|
|
56
|
+
readonly dotted: "dotted";
|
|
57
|
+
readonly double: "double";
|
|
58
|
+
readonly groove: "groove";
|
|
59
|
+
readonly inset: "inset";
|
|
60
|
+
readonly outset: "outset";
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export declare const defaultBorderWidthValues: {
|
|
64
|
+
default: string;
|
|
65
|
+
none: number;
|
|
66
|
+
thin: string;
|
|
67
|
+
medium: string;
|
|
68
|
+
thick: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export declare const defaultBoxShadowValues: {
|
|
72
|
+
default: string;
|
|
73
|
+
none: string;
|
|
74
|
+
xs: string;
|
|
75
|
+
sm: string;
|
|
76
|
+
md: string;
|
|
77
|
+
lg: string;
|
|
78
|
+
xl: string;
|
|
79
|
+
"2xl": string;
|
|
80
|
+
inner: string;
|
|
81
|
+
ring: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export declare const defaultBreakpointValues: {
|
|
85
|
+
xs: number;
|
|
86
|
+
sm: number;
|
|
87
|
+
md: number;
|
|
88
|
+
lg: number;
|
|
89
|
+
xl: number;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export declare const defaultColorLightnessValues: {
|
|
93
|
+
readonly 50: 5;
|
|
94
|
+
readonly 100: 10;
|
|
95
|
+
readonly 200: 20;
|
|
96
|
+
readonly 300: 30;
|
|
97
|
+
readonly 400: 40;
|
|
98
|
+
readonly 500: 50;
|
|
99
|
+
readonly 600: 60;
|
|
100
|
+
readonly 700: 70;
|
|
101
|
+
readonly 800: 80;
|
|
102
|
+
readonly 900: 90;
|
|
103
|
+
readonly 950: 95;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export declare const defaultColorShadeValues: {
|
|
107
|
+
readonly 50: 5;
|
|
108
|
+
readonly 100: 10;
|
|
109
|
+
readonly 150: 15;
|
|
110
|
+
readonly 200: 20;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export declare const defaultColorTintValues: {
|
|
114
|
+
readonly 50: 5;
|
|
115
|
+
readonly 100: 10;
|
|
116
|
+
readonly 150: 15;
|
|
117
|
+
readonly 200: 20;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare const defaultFontFamilyValues: {
|
|
121
|
+
default: string;
|
|
122
|
+
base: string;
|
|
123
|
+
print: string;
|
|
124
|
+
mono: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export declare const defaultFontSizeValues: {
|
|
128
|
+
default: string;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export declare const defaultFontWeightValues: {
|
|
132
|
+
default: string;
|
|
133
|
+
extralight: number;
|
|
134
|
+
light: number;
|
|
135
|
+
normal: string;
|
|
136
|
+
medium: number;
|
|
137
|
+
semibold: number;
|
|
138
|
+
bold: string;
|
|
139
|
+
black: number;
|
|
140
|
+
lighter: string;
|
|
141
|
+
bolder: string;
|
|
142
|
+
inherit: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export declare const defaultLetterSpacingValues: {
|
|
146
|
+
default: string;
|
|
147
|
+
tighter: string;
|
|
148
|
+
tight: string;
|
|
149
|
+
normal: string;
|
|
150
|
+
wide: string;
|
|
151
|
+
wider: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export declare const defaultLineHeightValues: {
|
|
155
|
+
default: string;
|
|
156
|
+
tight: number;
|
|
157
|
+
snug: number;
|
|
158
|
+
normal: number;
|
|
159
|
+
relaxed: number;
|
|
160
|
+
loose: number;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export declare const defaultScalePowerValues: readonly number[];
|
|
164
|
+
|
|
165
|
+
export declare const defaultScaleValues: {
|
|
166
|
+
readonly default: "@minor-third";
|
|
167
|
+
readonly "minor-second": 1.067;
|
|
168
|
+
readonly "major-second": 1.125;
|
|
169
|
+
readonly "minor-third": 1.2;
|
|
170
|
+
readonly "major-third": 1.25;
|
|
171
|
+
readonly "perfect-fourth": 1.333;
|
|
172
|
+
readonly "augmented-fourth": 1.414;
|
|
173
|
+
readonly "perfect-fifth": 1.5;
|
|
174
|
+
readonly golden: 1.618;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Generic type that transforms keys to their export names with a given prefix
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ExportKeys<"example-property", { "default": "...", "variant": "..." }> -> {
|
|
182
|
+
* "exampleProperty": Variable<'example-property'>,
|
|
183
|
+
* "examplePropertyVariant": Variable<'example-property--variant'>,
|
|
184
|
+
* }
|
|
185
|
+
*/
|
|
186
|
+
export declare type ExportKeys<Prefix extends string, T extends Record<string, TokenValue>, Separator extends string = "--"> = {
|
|
187
|
+
[K in keyof T as CamelCase<ExportKeyVariableName<Prefix, K, Separator>>]: Variable<ExportKeyVariableName<Prefix, K, Separator>>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Helper type to compute the variable name for a given prefix and key
|
|
192
|
+
*/
|
|
193
|
+
declare type ExportKeyVariableName<Prefix extends string, K, Separator extends string = "--"> = K extends "default" ? Prefix : `${Prefix}${Separator}${K & (string | number)}`;
|
|
194
|
+
|
|
195
|
+
export declare function isKeyReferenceValue(value: unknown): value is string;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Create a set of border-color variables for use in a Styleframe instance.
|
|
199
|
+
*
|
|
200
|
+
* @usage
|
|
201
|
+
* ```typescript
|
|
202
|
+
* import { styleframe } from "styleframe";
|
|
203
|
+
* import { useBorderColor, useColor } from "styleframe/theme";
|
|
204
|
+
*
|
|
205
|
+
* const s = styleframe();
|
|
206
|
+
*
|
|
207
|
+
* const { colorPrimary, colorSecondary } = useColor(s, {
|
|
208
|
+
* primary: "#007bff",
|
|
209
|
+
* secondary: "#6c757d",
|
|
210
|
+
* });
|
|
211
|
+
*
|
|
212
|
+
* const {
|
|
213
|
+
* borderColorPrimary, // Variable<'border-color--primary'>
|
|
214
|
+
* borderColorSecondary, // Variable<'border-color--secondary'>
|
|
215
|
+
* } = useBorderColor(s, {
|
|
216
|
+
* primary: ref(colorPrimary),
|
|
217
|
+
* secondary: ref(colorSecondary),
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export declare const useBorderColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-color", T, "--">;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Create a set of border-radius variables for use in a Styleframe instance.
|
|
225
|
+
*
|
|
226
|
+
* @usage
|
|
227
|
+
* ```typescript
|
|
228
|
+
* import { styleframe } from "styleframe";
|
|
229
|
+
* import { useBorderRadius } from "styleframe/theme";
|
|
230
|
+
*
|
|
231
|
+
* const s = styleframe();
|
|
232
|
+
*
|
|
233
|
+
* const {
|
|
234
|
+
* borderRadius, // Variable<'border-radius'>
|
|
235
|
+
* borderRadiusSm, // Variable<'border-radius--sm'>
|
|
236
|
+
* borderRadiusMd, // Variable<'border-radius--md'>
|
|
237
|
+
* borderRadiusLg, // Variable<'border-radius--lg'>
|
|
238
|
+
* } = useBorderRadius(s, {
|
|
239
|
+
* default: "0.25rem",
|
|
240
|
+
* sm: "0.125rem",
|
|
241
|
+
* md: "0.25rem",
|
|
242
|
+
* lg: "0.5rem",
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
export declare const useBorderRadius: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-radius", T, "--">;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Create a set of border-style variables for use in a Styleframe instance.
|
|
250
|
+
*
|
|
251
|
+
* @usage
|
|
252
|
+
* ```typescript
|
|
253
|
+
* import { styleframe } from "styleframe";
|
|
254
|
+
* import { useBorderStyle } from "styleframe/theme";
|
|
255
|
+
*
|
|
256
|
+
* const s = styleframe();
|
|
257
|
+
*
|
|
258
|
+
* const {
|
|
259
|
+
* borderStyleNone,
|
|
260
|
+
* borderStyleSolid,
|
|
261
|
+
* borderStyleDashed,
|
|
262
|
+
* borderStyleDotted,
|
|
263
|
+
* borderStyleDouble,
|
|
264
|
+
* borderStyleGroove,
|
|
265
|
+
* borderStyleInset,
|
|
266
|
+
* borderStyleOutset,
|
|
267
|
+
* borderStyle,
|
|
268
|
+
* } = useBorderStyle(s, {
|
|
269
|
+
* default: "solid",
|
|
270
|
+
* none: "none",
|
|
271
|
+
* dashed: "dashed",
|
|
272
|
+
* dotted: "dotted",
|
|
273
|
+
* double: "double",
|
|
274
|
+
* groove: "groove",
|
|
275
|
+
* inset: "inset",
|
|
276
|
+
* outset: "outset",
|
|
277
|
+
* });
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
export declare const useBorderStyle: <T extends Record<string, TokenValue> = {
|
|
281
|
+
readonly default: "@solid";
|
|
282
|
+
readonly none: "none";
|
|
283
|
+
readonly solid: "solid";
|
|
284
|
+
readonly dashed: "dashed";
|
|
285
|
+
readonly dotted: "dotted";
|
|
286
|
+
readonly double: "double";
|
|
287
|
+
readonly groove: "groove";
|
|
288
|
+
readonly inset: "inset";
|
|
289
|
+
readonly outset: "outset";
|
|
290
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-style", T, "--">;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Create a set of border-width variables for use in a Styleframe instance.
|
|
294
|
+
*
|
|
295
|
+
* @usage
|
|
296
|
+
* ```typescript
|
|
297
|
+
* import { styleframe } from "styleframe";
|
|
298
|
+
* import { useBorderWidth } from "styleframe/theme";
|
|
299
|
+
*
|
|
300
|
+
* const s = styleframe();
|
|
301
|
+
*
|
|
302
|
+
* const {
|
|
303
|
+
* borderWidthNone,
|
|
304
|
+
* borderWidthThin,
|
|
305
|
+
* borderWidthMedium,
|
|
306
|
+
* borderWidthThick,
|
|
307
|
+
* borderWidth,
|
|
308
|
+
* } = useBorderWidth(s, {
|
|
309
|
+
* default: "thin",
|
|
310
|
+
* none: 0,
|
|
311
|
+
* thin: "thin",
|
|
312
|
+
* medium: "medium",
|
|
313
|
+
* thick: "thick",
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
export declare const useBorderWidth: <T extends Record<string, TokenValue> = {
|
|
318
|
+
default: string;
|
|
319
|
+
none: number;
|
|
320
|
+
thin: string;
|
|
321
|
+
medium: string;
|
|
322
|
+
thick: string;
|
|
323
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-width", T, "--">;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Create a set of box-shadow variables for use in a Styleframe instance.
|
|
327
|
+
*
|
|
328
|
+
* @usage
|
|
329
|
+
* ```typescript
|
|
330
|
+
* import { styleframe } from "styleframe";
|
|
331
|
+
* import { useBoxShadow } from "styleframe/theme";
|
|
332
|
+
*
|
|
333
|
+
* const s = styleframe();
|
|
334
|
+
* const { variable } = s;
|
|
335
|
+
*
|
|
336
|
+
* const boxShadowColor = s.variable("box-shadow-color", "0 0 0");
|
|
337
|
+
*
|
|
338
|
+
* const {
|
|
339
|
+
* boxShadow, // Variable<'box-shadow'>
|
|
340
|
+
* boxShadowSm, // Variable<'box-shadow--sm'>
|
|
341
|
+
* boxShadowMd, // Variable<'box-shadow--md'>
|
|
342
|
+
* boxShadowLg, // Variable<'box-shadow--lg'>
|
|
343
|
+
* } = useBoxShadow(s, {
|
|
344
|
+
* default: '@md',
|
|
345
|
+
* sm: css`0 1px 2px oklcha(${ref(boxShadowColor)} / 0.05)`,
|
|
346
|
+
* md: css`0 4px 8px oklcha(${ref(boxShadowColor)} / 0.1)`,
|
|
347
|
+
* lg: css`0 8px 16px oklcha(${ref(boxShadowColor)} / 0.15)`,
|
|
348
|
+
* });
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
export declare const useBoxShadow: <T extends Record<string, TokenValue> = {
|
|
352
|
+
default: string;
|
|
353
|
+
none: string;
|
|
354
|
+
xs: string;
|
|
355
|
+
sm: string;
|
|
356
|
+
md: string;
|
|
357
|
+
lg: string;
|
|
358
|
+
xl: string;
|
|
359
|
+
"2xl": string;
|
|
360
|
+
inner: string;
|
|
361
|
+
ring: string;
|
|
362
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"box-shadow", T, "--">;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Create a set of breakpoint variables for use in a Styleframe instance.
|
|
366
|
+
*
|
|
367
|
+
* @usage
|
|
368
|
+
* ```typescript
|
|
369
|
+
* import { styleframe } from "styleframe";
|
|
370
|
+
* import { useBreakpoint } from "styleframe/theme";
|
|
371
|
+
*
|
|
372
|
+
* const s = styleframe();
|
|
373
|
+
*
|
|
374
|
+
* const {
|
|
375
|
+
* breakpointXs, // Variable<'breakpoint--xs'>
|
|
376
|
+
* breakpointSm, // Variable<'breakpoint--sm'>
|
|
377
|
+
* breakpointMd, // Variable<'breakpoint--md'>
|
|
378
|
+
* breakpointLg, // Variable<'breakpoint--lg'>
|
|
379
|
+
* breakpointXl, // Variable<'breakpoint--xl'>
|
|
380
|
+
* } = useBreakpoint(s, {
|
|
381
|
+
* xs: 0,
|
|
382
|
+
* sm: 576,
|
|
383
|
+
* md: 992,
|
|
384
|
+
* lg: 1200,
|
|
385
|
+
* xl: 1440,
|
|
386
|
+
* });
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
export declare const useBreakpoint: <T extends Record<string, TokenValue> = {
|
|
390
|
+
xs: number;
|
|
391
|
+
sm: number;
|
|
392
|
+
md: number;
|
|
393
|
+
lg: number;
|
|
394
|
+
xl: number;
|
|
395
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"breakpoint", T, "--">;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Create a set of color variables for use in a Styleframe instance.
|
|
399
|
+
*
|
|
400
|
+
* @usage
|
|
401
|
+
* ```typescript
|
|
402
|
+
* import { styleframe } from "styleframe";
|
|
403
|
+
* import { useColors } from "styleframe/theme";
|
|
404
|
+
*
|
|
405
|
+
* const s = styleframe();
|
|
406
|
+
*
|
|
407
|
+
* const {
|
|
408
|
+
* colorPrimary, // Variable<'color--primary'>
|
|
409
|
+
* colorSecondary, // Variable<'color--secondary'>
|
|
410
|
+
* } = useColors(s, {
|
|
411
|
+
* primary: "#007bff",
|
|
412
|
+
* secondary: "#6c757d",
|
|
413
|
+
* });
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
export declare const useColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"color", T, "--">;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Create a set of lightness levels for a color variable.
|
|
420
|
+
*
|
|
421
|
+
* @usage
|
|
422
|
+
* ```typescript
|
|
423
|
+
* import { styleframe } from "styleframe";
|
|
424
|
+
* import { useColors } from "styleframe/theme";
|
|
425
|
+
*
|
|
426
|
+
* const s = styleframe();
|
|
427
|
+
*
|
|
428
|
+
* const colorPrimary = s.variable("color--primary", "#007bff");
|
|
429
|
+
*
|
|
430
|
+
* const {
|
|
431
|
+
* colorPrimary100, // Variable<'color--primary-100'>
|
|
432
|
+
* colorPrimary200, // Variable<'color--primary-200'>
|
|
433
|
+
* colorPrimary300, // Variable<'color--primary-300'>
|
|
434
|
+
* ...
|
|
435
|
+
* } = useColorLightnessLevels(s, colorPrimary, {
|
|
436
|
+
* 100: 10,
|
|
437
|
+
* 200: 20,
|
|
438
|
+
* 300: 30,
|
|
439
|
+
* ...
|
|
440
|
+
* });
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
export declare function useColorLightness<Name extends string, T extends Record<string | number, number>>(s: Styleframe, color: Variable<Name>, levels: T): ExportKeys<Name, T, "-">;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Create a set of relative color shade (darker) levels
|
|
447
|
+
*
|
|
448
|
+
* @usage
|
|
449
|
+
* const s = styleframe();
|
|
450
|
+
*
|
|
451
|
+
* const colorPrimary = s.variable("color--primary", "#007bff");
|
|
452
|
+
*
|
|
453
|
+
* const {
|
|
454
|
+
* colorPrimaryShade50, // Variable<'color--primary-shade-50'>
|
|
455
|
+
* colorPrimaryShade100, // Variable<'color--primary-shade-100'>
|
|
456
|
+
* colorPrimaryShade150, // Variable<'color--primary-shade-150'>
|
|
457
|
+
* ...
|
|
458
|
+
* } = useColorShadeLevels(s, colorPrimary, {
|
|
459
|
+
* 50: 5,
|
|
460
|
+
* 100: 10,
|
|
461
|
+
* 150: 15,
|
|
462
|
+
* ...
|
|
463
|
+
* });
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
export declare function useColorShade<Name extends string, T extends Record<string | number, number>>(s: Styleframe, color: Variable<Name>, levels: T): ExportKeys<`${Name}-shade`, T, "-">;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Create a set of relative color tint (lighter) levels
|
|
470
|
+
*
|
|
471
|
+
* @usage
|
|
472
|
+
* const s = styleframe();
|
|
473
|
+
*
|
|
474
|
+
* const colorPrimary = s.variable("color--primary", "#007bff");
|
|
475
|
+
*
|
|
476
|
+
* const {
|
|
477
|
+
* colorPrimaryTint50, // Variable<'color--primary-tint-50'>
|
|
478
|
+
* colorPrimaryTint100, // Variable<'color--primary-tint-100'>
|
|
479
|
+
* colorPrimaryTint150, // Variable<'color--primary-tint-150'>
|
|
480
|
+
* ...
|
|
481
|
+
* } = useColorTintLevels(s, colorPrimary, {
|
|
482
|
+
* 50: 5,
|
|
483
|
+
* 100: 10,
|
|
484
|
+
* 150: 15,
|
|
485
|
+
* ...
|
|
486
|
+
* });
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
export declare function useColorTint<Name extends string, T extends Record<string | number, number>>(s: Styleframe, color: Variable<Name>, levels: T): ExportKeys<`${Name}-tint`, T, "-">;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Create a set of font family variables for use in a Styleframe instance.
|
|
493
|
+
*
|
|
494
|
+
* @usage
|
|
495
|
+
* ```typescript
|
|
496
|
+
* import { styleframe } from "styleframe";
|
|
497
|
+
* import { useFontFamily } from "styleframe/theme";
|
|
498
|
+
*
|
|
499
|
+
* const s = styleframe();
|
|
500
|
+
*
|
|
501
|
+
* const {
|
|
502
|
+
* fontFamily, // Variable<'font-family'>
|
|
503
|
+
* fontFamilyPrint, // Variable<'font-family--print'>
|
|
504
|
+
* fontFamilyMono, // Variable<'font-family--mono'>
|
|
505
|
+
* } = useFontFamily(s, {
|
|
506
|
+
* default: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
|
|
507
|
+
* print: "'Georgia', 'Times New Roman', 'Times', serif",
|
|
508
|
+
* mono: "'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
|
|
509
|
+
* });
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
512
|
+
export declare const useFontFamily: <T extends Record<string, TokenValue> = {
|
|
513
|
+
default: string;
|
|
514
|
+
base: string;
|
|
515
|
+
print: string;
|
|
516
|
+
mono: string;
|
|
517
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-family", T, "--">;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Create a set of font-size variables for use in a Styleframe instance.
|
|
521
|
+
*
|
|
522
|
+
* @usage
|
|
523
|
+
* ```typescript
|
|
524
|
+
* import { styleframe } from "styleframe";
|
|
525
|
+
* import { useFontSize } from "styleframe/theme";
|
|
526
|
+
*
|
|
527
|
+
* const s = styleframe();
|
|
528
|
+
*
|
|
529
|
+
* const {
|
|
530
|
+
* fontSize, // Variable<'font-size'>
|
|
531
|
+
* fontSizeSm, // Variable<'font-size--sm'>
|
|
532
|
+
* fontSizeMd, // Variable<'font-size--md'>
|
|
533
|
+
* fontSizeLg, // Variable<'font-size--lg'>
|
|
534
|
+
* } = useFontSize(s, {
|
|
535
|
+
* default: "1rem",
|
|
536
|
+
* sm: "0.875rem",
|
|
537
|
+
* md: "1rem",
|
|
538
|
+
* lg: "1.25rem",
|
|
539
|
+
* });
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
export declare const useFontSize: <T extends Record<string, TokenValue> = {
|
|
543
|
+
default: string;
|
|
544
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-size", T, "--">;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Create a set of font-weight variables for use in a Styleframe instance.
|
|
548
|
+
*
|
|
549
|
+
* @usage
|
|
550
|
+
* ```typescript
|
|
551
|
+
* import { styleframe } from "styleframe";
|
|
552
|
+
* import { useFontWeight } from "styleframe/theme";
|
|
553
|
+
*
|
|
554
|
+
* const s = styleframe();
|
|
555
|
+
*
|
|
556
|
+
* const {
|
|
557
|
+
* fontWeightExtralight,
|
|
558
|
+
* fontWeightLight,
|
|
559
|
+
* fontWeightNormal,
|
|
560
|
+
* fontWeightMedium,
|
|
561
|
+
* fontWeightSemibold,
|
|
562
|
+
* fontWeightBold,
|
|
563
|
+
* fontWeightBlack,
|
|
564
|
+
* fontWeightLighter,
|
|
565
|
+
* fontWeightBolder,
|
|
566
|
+
* fontWeight,
|
|
567
|
+
* } = useFontWeight(s, {
|
|
568
|
+
* default: "normal",
|
|
569
|
+
* extralight: 200,
|
|
570
|
+
* light: 300,
|
|
571
|
+
* normal: "normal",
|
|
572
|
+
* medium: 500,
|
|
573
|
+
* semibold: 600,
|
|
574
|
+
* bold: 700,
|
|
575
|
+
* black: 900,
|
|
576
|
+
* lighter: "lighter",
|
|
577
|
+
* bolder: "bolder",
|
|
578
|
+
* inherit: "inherit",
|
|
579
|
+
* });
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
export declare const useFontWeight: <T extends Record<string, TokenValue> = {
|
|
583
|
+
default: string;
|
|
584
|
+
extralight: number;
|
|
585
|
+
light: number;
|
|
586
|
+
normal: string;
|
|
587
|
+
medium: number;
|
|
588
|
+
semibold: number;
|
|
589
|
+
bold: string;
|
|
590
|
+
black: number;
|
|
591
|
+
lighter: string;
|
|
592
|
+
bolder: string;
|
|
593
|
+
inherit: string;
|
|
594
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-weight", T, "--">;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Create a set of letter-spacing variables for use in a Styleframe instance.
|
|
598
|
+
*
|
|
599
|
+
* @usage
|
|
600
|
+
* ```typescript
|
|
601
|
+
* import { styleframe } from "styleframe";
|
|
602
|
+
* import { useLetterSpacing } from "styleframe/theme";
|
|
603
|
+
*
|
|
604
|
+
* const s = styleframe();
|
|
605
|
+
*
|
|
606
|
+
* const {
|
|
607
|
+
* letterSpacingTighter,
|
|
608
|
+
* letterSpacingTight,
|
|
609
|
+
* letterSpacingNormal,
|
|
610
|
+
* letterSpacingWide,
|
|
611
|
+
* letterSpacingWider,
|
|
612
|
+
* letterSpacing,
|
|
613
|
+
* } = useLetterSpacing(s, {
|
|
614
|
+
* default: "normal",
|
|
615
|
+
* tighter: "-0.05em",
|
|
616
|
+
* tight: "-0.025em",
|
|
617
|
+
* normal: "normal",
|
|
618
|
+
* wide: "0.05em",
|
|
619
|
+
* wider: "0.1em",
|
|
620
|
+
* });
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
export declare const useLetterSpacing: <T extends Record<string, TokenValue> = {
|
|
624
|
+
default: string;
|
|
625
|
+
tighter: string;
|
|
626
|
+
tight: string;
|
|
627
|
+
normal: string;
|
|
628
|
+
wide: string;
|
|
629
|
+
wider: string;
|
|
630
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"letter-spacing", T, "--">;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Create a set of line-height variables for use in a Styleframe instance.
|
|
634
|
+
*
|
|
635
|
+
* @usage
|
|
636
|
+
* ```typescript
|
|
637
|
+
* import { styleframe } from "styleframe";
|
|
638
|
+
* import { useLineHeight } from "styleframe/theme";
|
|
639
|
+
*
|
|
640
|
+
* const s = styleframe();
|
|
641
|
+
*
|
|
642
|
+
* const {
|
|
643
|
+
* lineHeightTight,
|
|
644
|
+
* lineHeightSnug,
|
|
645
|
+
* lineHeightNormal,
|
|
646
|
+
* lineHeightRelaxed,
|
|
647
|
+
* lineHeightLoose,
|
|
648
|
+
* lineHeight,
|
|
649
|
+
* } = useLineHeight(s, {
|
|
650
|
+
* default: "normal",
|
|
651
|
+
* tight: 1.2,
|
|
652
|
+
* snug: 1.35,
|
|
653
|
+
* normal: 1.5,
|
|
654
|
+
* relaxed: 1.65,
|
|
655
|
+
* loose: 1.9,
|
|
656
|
+
* });
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
export declare const useLineHeight: <T extends Record<string, TokenValue> = {
|
|
660
|
+
default: string;
|
|
661
|
+
tight: number;
|
|
662
|
+
snug: number;
|
|
663
|
+
normal: number;
|
|
664
|
+
relaxed: number;
|
|
665
|
+
loose: number;
|
|
666
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"line-height", T, "--">;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Create a font-size scale for use in a Styleframe instance.
|
|
670
|
+
*
|
|
671
|
+
* @usage
|
|
672
|
+
* ```typescript
|
|
673
|
+
* import { styleframe } from "styleframe";
|
|
674
|
+
* import { useFontSize, useScale, useScalePowers, useMultiplier } from "styleframe/theme";
|
|
675
|
+
*
|
|
676
|
+
* const s = styleframe();
|
|
677
|
+
*
|
|
678
|
+
* const { scale } = useScale(s);
|
|
679
|
+
* const { fontSize } = useFontSize(s);
|
|
680
|
+
*
|
|
681
|
+
* const scalePowers = useScalePowers(s, scale, defaultScalePowerValues);
|
|
682
|
+
*
|
|
683
|
+
* const {
|
|
684
|
+
* fontSizeXs, // Variable<'font-size--xs'>
|
|
685
|
+
* fontSizeSm, // Variable<'font-size--sm'>
|
|
686
|
+
* fontSizeMd, // Variable<'font-size--md'>
|
|
687
|
+
* fontSizeLg, // Variable<'font-size--lg'>
|
|
688
|
+
* fontSizeXl, // Variable<'font-size--xl'>
|
|
689
|
+
* } = useMultiplier(s, fontSize, {
|
|
690
|
+
* xs: scalePowers[-2],
|
|
691
|
+
* sm: scalePowers[-1],
|
|
692
|
+
* md: scalePowers[0],
|
|
693
|
+
* lg: scalePowers[1],
|
|
694
|
+
* xl: scalePowers[2],
|
|
695
|
+
* });
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
export declare function useMultiplier<Name extends string, T extends Record<string | number, TokenValue>>(s: Styleframe, variable: Variable<Name>, values: T): ExportKeys<Name, T>;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Create a set of scale variables for use in a Styleframe instance.
|
|
702
|
+
*
|
|
703
|
+
* @usage
|
|
704
|
+
* ```typescript
|
|
705
|
+
* import { styleframe } from "styleframe";
|
|
706
|
+
* import { useScale } from "styleframe/theme";
|
|
707
|
+
*
|
|
708
|
+
* const s = styleframe();
|
|
709
|
+
*
|
|
710
|
+
* const {
|
|
711
|
+
* scaleMinorSecond,
|
|
712
|
+
* scaleMajorSecond,
|
|
713
|
+
* scaleMinorThird,
|
|
714
|
+
* scaleMajorThird,
|
|
715
|
+
* scalePerfectFourth,
|
|
716
|
+
* scaleAugmentedFourth,
|
|
717
|
+
* scalePerfectFifth,
|
|
718
|
+
* scaleGolden,
|
|
719
|
+
* scale,
|
|
720
|
+
* } = useScale(s, {
|
|
721
|
+
* default: 1.2,
|
|
722
|
+
* minorSecond: 1.067,
|
|
723
|
+
* majorSecond: 1.125,
|
|
724
|
+
* minorThird: 1.2,
|
|
725
|
+
* majorThird: 1.25,
|
|
726
|
+
* perfectFourth: 1.333,
|
|
727
|
+
* augmentedFourth: 1.414,
|
|
728
|
+
* perfectFifth: 1.5,
|
|
729
|
+
* golden: 1.618,
|
|
730
|
+
* });
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
export declare const useScale: <T extends Record<string, TokenValue> = {
|
|
734
|
+
readonly default: "@minor-third";
|
|
735
|
+
readonly "minor-second": 1.067;
|
|
736
|
+
readonly "major-second": 1.125;
|
|
737
|
+
readonly "minor-third": 1.2;
|
|
738
|
+
readonly "major-third": 1.25;
|
|
739
|
+
readonly "perfect-fourth": 1.333;
|
|
740
|
+
readonly "augmented-fourth": 1.414;
|
|
741
|
+
readonly "perfect-fifth": 1.5;
|
|
742
|
+
readonly golden: 1.618;
|
|
743
|
+
}>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"scale", T, "--">;
|
|
744
|
+
|
|
745
|
+
export declare function useScalePowers<T extends readonly number[]>(s: Styleframe, scale: Variable | Reference, powers?: T): Record<number, TokenValue>;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Create a set of spacing variables for use in a Styleframe instance.
|
|
749
|
+
*
|
|
750
|
+
* @usage
|
|
751
|
+
* ```typescript
|
|
752
|
+
* import { styleframe } from "styleframe";
|
|
753
|
+
* import { useSpacing } from "styleframe/theme";
|
|
754
|
+
*
|
|
755
|
+
* const s = styleframe();
|
|
756
|
+
*
|
|
757
|
+
* const {
|
|
758
|
+
* spacing, // Variable<'spacing'>
|
|
759
|
+
* spacingSm, // Variable<'spacing--sm'>
|
|
760
|
+
* spacingMd, // Variable<'spacing--md'>
|
|
761
|
+
* spacingLg, // Variable<'spacing--lg'>
|
|
762
|
+
* } = useSpacing(s, {
|
|
763
|
+
* default: "1rem",
|
|
764
|
+
* sm: "0.875rem",
|
|
765
|
+
* md: "1rem",
|
|
766
|
+
* lg: "1.25rem",
|
|
767
|
+
* });
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
export declare const useSpacing: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"spacing", T, "--">;
|
|
771
|
+
|
|
772
|
+
export { }
|