@styleframe/theme 2.1.0 → 2.2.0

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @styleframe/theme
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#68](https://github.com/styleframe-dev/styleframe/pull/68) [`653d1fc`](https://github.com/styleframe-dev/styleframe/commit/653d1fc4e8fb80f8c3371e728ffc962cf1fb1cec) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add support for dot notation in variable names
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`653d1fc`](https://github.com/styleframe-dev/styleframe/commit/653d1fc4e8fb80f8c3371e728ffc962cf1fb1cec)]:
12
+ - @styleframe/core@2.3.0
13
+
3
14
  ## 2.1.0
4
15
 
5
16
  ### Minor Changes
package/dist/theme.d.ts CHANGED
@@ -41,7 +41,7 @@ import { Variable } from '@styleframe/core';
41
41
  * });
42
42
  * ```
43
43
  */
44
- export declare function createUseVariable<PropertyName extends string, PropertyType = TokenValue, Delimiter extends string = "--", Defaults extends Record<string, PropertyType> = Record<string, PropertyType>, MergeDefaults extends boolean = false>(propertyName: PropertyName, { defaults, mergeDefaults, transform, delimiter, }?: {
44
+ export declare function createUseVariable<PropertyName extends string, PropertyType = TokenValue, Delimiter extends string = ".", Defaults extends Record<string, PropertyType> = Record<string, PropertyType>, MergeDefaults extends boolean = false>(propertyName: PropertyName, { defaults, mergeDefaults, transform, delimiter, }?: {
45
45
  defaults?: Defaults;
46
46
  mergeDefaults?: MergeDefaults;
47
47
  transform?: (value: PropertyType) => TokenValue;
@@ -180,17 +180,17 @@ export declare const defaultScaleValues: {
180
180
  * @example
181
181
  * ExportKeys<"example-property", { "default": "...", "variant": "..." }> -> {
182
182
  * "exampleProperty": Variable<'example-property'>,
183
- * "examplePropertyVariant": Variable<'example-property--variant'>,
183
+ * "examplePropertyVariant": Variable<'example-property.variant'>,
184
184
  * }
185
185
  */
186
- export declare type ExportKeys<Prefix extends string, T extends Record<string, unknown>, Separator extends string = "--"> = {
186
+ export declare type ExportKeys<Prefix extends string, T extends Record<string, unknown>, Separator extends string = "."> = {
187
187
  [K in keyof T as CamelCase<ExportKeyVariableName<Prefix, K, Separator>>]: Variable<ExportKeyVariableName<Prefix, K, Separator>>;
188
188
  };
189
189
 
190
190
  /**
191
191
  * Helper type to compute the variable name for a given prefix and key
192
192
  */
193
- declare type ExportKeyVariableName<Prefix extends string, K, Separator extends string = "--"> = K extends "default" ? Prefix : `${Prefix}${Separator}${K & (string | number)}`;
193
+ declare type ExportKeyVariableName<Prefix extends string, K, Separator extends string = "."> = K extends "default" ? Prefix : `${Prefix}${Separator}${K & (string | number)}`;
194
194
 
195
195
  export declare function isKeyReferenceValue(value: unknown): value is `@${string}`;
196
196
 
@@ -210,15 +210,15 @@ export declare function isKeyReferenceValue(value: unknown): value is `@${string
210
210
  * });
211
211
  *
212
212
  * const {
213
- * borderColorPrimary, // Variable<'border-color--primary'>
214
- * borderColorSecondary, // Variable<'border-color--secondary'>
213
+ * borderColorPrimary, // Variable<'border-color.primary'>
214
+ * borderColorSecondary, // Variable<'border-color.secondary'>
215
215
  * } = useBorderColor(s, {
216
216
  * primary: ref(colorPrimary),
217
217
  * secondary: ref(colorSecondary),
218
218
  * });
219
219
  * ```
220
220
  */
221
- export declare const useBorderColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-color", T, "--">;
221
+ export declare const useBorderColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-color", T, ".">;
222
222
 
223
223
  /**
224
224
  * Create a set of border-radius variables for use in a Styleframe instance.
@@ -232,9 +232,9 @@ export declare const useBorderColor: <T extends Record<string, TokenValue> = Rec
232
232
  *
233
233
  * const {
234
234
  * borderRadius, // Variable<'border-radius'>
235
- * borderRadiusSm, // Variable<'border-radius--sm'>
236
- * borderRadiusMd, // Variable<'border-radius--md'>
237
- * borderRadiusLg, // Variable<'border-radius--lg'>
235
+ * borderRadiusSm, // Variable<'border-radius.sm'>
236
+ * borderRadiusMd, // Variable<'border-radius.md'>
237
+ * borderRadiusLg, // Variable<'border-radius.lg'>
238
238
  * } = useBorderRadius(s, {
239
239
  * default: "0.25rem",
240
240
  * sm: "0.125rem",
@@ -243,7 +243,7 @@ export declare const useBorderColor: <T extends Record<string, TokenValue> = Rec
243
243
  * });
244
244
  * ```
245
245
  */
246
- export declare const useBorderRadius: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-radius", T, "--">;
246
+ export declare const useBorderRadius: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-radius", T, ".">;
247
247
 
248
248
  /**
249
249
  * Create a set of border-style variables for use in a Styleframe instance.
@@ -287,7 +287,7 @@ export declare const useBorderStyle: <T extends Record<string, TokenValue> = {
287
287
  readonly groove: "groove";
288
288
  readonly inset: "inset";
289
289
  readonly outset: "outset";
290
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-style", T, "--">;
290
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-style", T, ".">;
291
291
 
292
292
  /**
293
293
  * Create a set of border-width variables for use in a Styleframe instance.
@@ -320,7 +320,7 @@ export declare const useBorderWidth: <T extends Record<string, TokenValue> = {
320
320
  thin: string;
321
321
  medium: string;
322
322
  thick: string;
323
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-width", T, "--">;
323
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"border-width", T, ".">;
324
324
 
325
325
  /**
326
326
  * Create a set of box-shadow variables for use in a Styleframe instance.
@@ -337,9 +337,9 @@ export declare const useBorderWidth: <T extends Record<string, TokenValue> = {
337
337
  *
338
338
  * const {
339
339
  * boxShadow, // Variable<'box-shadow'>
340
- * boxShadowSm, // Variable<'box-shadow--sm'>
341
- * boxShadowMd, // Variable<'box-shadow--md'>
342
- * boxShadowLg, // Variable<'box-shadow--lg'>
340
+ * boxShadowSm, // Variable<'box-shadow.sm'>
341
+ * boxShadowMd, // Variable<'box-shadow.md'>
342
+ * boxShadowLg, // Variable<'box-shadow.lg'>
343
343
  * } = useBoxShadow(s, {
344
344
  * default: '@md',
345
345
  * sm: css`0 1px 2px oklcha(${ref(boxShadowColor)} / 0.05)`,
@@ -359,7 +359,7 @@ export declare const useBoxShadow: <T extends Record<string, TokenValue> = {
359
359
  "2xl": string;
360
360
  inner: string;
361
361
  ring: string;
362
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"box-shadow", T, "--">;
362
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"box-shadow", T, ".">;
363
363
 
364
364
  /**
365
365
  * Create a set of breakpoint variables for use in a Styleframe instance.
@@ -372,11 +372,11 @@ export declare const useBoxShadow: <T extends Record<string, TokenValue> = {
372
372
  * const s = styleframe();
373
373
  *
374
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'>
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
380
  * } = useBreakpoint(s, {
381
381
  * xs: 0,
382
382
  * sm: 576,
@@ -392,7 +392,7 @@ export declare const useBreakpoint: <T extends Record<string, TokenValue> = {
392
392
  md: number;
393
393
  lg: number;
394
394
  xl: number;
395
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"breakpoint", T, "--">;
395
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"breakpoint", T, ".">;
396
396
 
397
397
  /**
398
398
  * Create a set of color variables for use in a Styleframe instance.
@@ -405,15 +405,15 @@ export declare const useBreakpoint: <T extends Record<string, TokenValue> = {
405
405
  * const s = styleframe();
406
406
  *
407
407
  * const {
408
- * colorPrimary, // Variable<'color--primary'>
409
- * colorSecondary, // Variable<'color--secondary'>
408
+ * colorPrimary, // Variable<'color.primary'>
409
+ * colorSecondary, // Variable<'color.secondary'>
410
410
  * } = useColors(s, {
411
411
  * primary: "#007bff",
412
412
  * secondary: "#6c757d",
413
413
  * });
414
414
  * ```
415
415
  */
416
- export declare const useColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"color", T, "--">;
416
+ export declare const useColor: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"color", T, ".">;
417
417
 
418
418
  /**
419
419
  * Create a set of lightness levels for a color variable.
@@ -425,12 +425,12 @@ export declare const useColor: <T extends Record<string, TokenValue> = Record<st
425
425
  *
426
426
  * const s = styleframe();
427
427
  *
428
- * const colorPrimary = s.variable("color--primary", "#007bff");
428
+ * const { colorPrimary } = useColor(s, { primary: "#007bff" });
429
429
  *
430
430
  * const {
431
- * colorPrimary100, // Variable<'color--primary-100'>
432
- * colorPrimary200, // Variable<'color--primary-200'>
433
- * colorPrimary300, // Variable<'color--primary-300'>
431
+ * colorPrimary100, // Variable<'color.primary-100'>
432
+ * colorPrimary200, // Variable<'color.primary-200'>
433
+ * colorPrimary300, // Variable<'color.primary-300'>
434
434
  * ...
435
435
  * } = useColorLightnessLevels(s, colorPrimary, {
436
436
  * 100: 10,
@@ -448,12 +448,12 @@ export declare function useColorLightness<Name extends string, T extends Record<
448
448
  * @usage
449
449
  * const s = styleframe();
450
450
  *
451
- * const colorPrimary = s.variable("color--primary", "#007bff");
451
+ * const { colorPrimary } = useColor(s, { primary: "#007bff" });
452
452
  *
453
453
  * const {
454
- * colorPrimaryShade50, // Variable<'color--primary-shade-50'>
455
- * colorPrimaryShade100, // Variable<'color--primary-shade-100'>
456
- * colorPrimaryShade150, // Variable<'color--primary-shade-150'>
454
+ * colorPrimaryShade50, // Variable<'color.primary-shade-50'>
455
+ * colorPrimaryShade100, // Variable<'color.primary-shade-100'>
456
+ * colorPrimaryShade150, // Variable<'color.primary-shade-150'>
457
457
  * ...
458
458
  * } = useColorShadeLevels(s, colorPrimary, {
459
459
  * 50: 5,
@@ -471,12 +471,12 @@ export declare function useColorShade<Name extends string, T extends Record<stri
471
471
  * @usage
472
472
  * const s = styleframe();
473
473
  *
474
- * const colorPrimary = s.variable("color--primary", "#007bff");
474
+ * const { colorPrimary } = useColor(s, { primary: "#007bff" });
475
475
  *
476
476
  * const {
477
- * colorPrimaryTint50, // Variable<'color--primary-tint-50'>
478
- * colorPrimaryTint100, // Variable<'color--primary-tint-100'>
479
- * colorPrimaryTint150, // Variable<'color--primary-tint-150'>
477
+ * colorPrimaryTint50, // Variable<'color.primary-tint-50'>
478
+ * colorPrimaryTint100, // Variable<'color.primary-tint-100'>
479
+ * colorPrimaryTint150, // Variable<'color.primary-tint-150'>
480
480
  * ...
481
481
  * } = useColorTintLevels(s, colorPrimary, {
482
482
  * 50: 5,
@@ -500,8 +500,8 @@ export declare function useColorTint<Name extends string, T extends Record<strin
500
500
  *
501
501
  * const {
502
502
  * fontFamily, // Variable<'font-family'>
503
- * fontFamilyPrint, // Variable<'font-family--print'>
504
- * fontFamilyMono, // Variable<'font-family--mono'>
503
+ * fontFamilyPrint, // Variable<'font-family.print'>
504
+ * fontFamilyMono, // Variable<'font-family.mono'>
505
505
  * } = useFontFamily(s, {
506
506
  * default: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
507
507
  * print: "'Georgia', 'Times New Roman', 'Times', serif",
@@ -514,7 +514,7 @@ export declare const useFontFamily: <T extends Record<string, TokenValue> = {
514
514
  base: string;
515
515
  print: string;
516
516
  mono: string;
517
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-family", T, "--">;
517
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-family", T, ".">;
518
518
 
519
519
  /**
520
520
  * Create a set of font-size variables for use in a Styleframe instance.
@@ -528,9 +528,9 @@ export declare const useFontFamily: <T extends Record<string, TokenValue> = {
528
528
  *
529
529
  * const {
530
530
  * fontSize, // Variable<'font-size'>
531
- * fontSizeSm, // Variable<'font-size--sm'>
532
- * fontSizeMd, // Variable<'font-size--md'>
533
- * fontSizeLg, // Variable<'font-size--lg'>
531
+ * fontSizeSm, // Variable<'font-size.sm'>
532
+ * fontSizeMd, // Variable<'font-size.md'>
533
+ * fontSizeLg, // Variable<'font-size.lg'>
534
534
  * } = useFontSize(s, {
535
535
  * default: "1rem",
536
536
  * sm: "0.875rem",
@@ -541,7 +541,7 @@ export declare const useFontFamily: <T extends Record<string, TokenValue> = {
541
541
  */
542
542
  export declare const useFontSize: <T extends Record<string, TokenValue> = {
543
543
  default: string;
544
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-size", T, "--">;
544
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-size", T, ".">;
545
545
 
546
546
  /**
547
547
  * Create a set of font-weight variables for use in a Styleframe instance.
@@ -591,7 +591,7 @@ export declare const useFontWeight: <T extends Record<string, TokenValue> = {
591
591
  lighter: string;
592
592
  bolder: string;
593
593
  inherit: string;
594
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-weight", T, "--">;
594
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"font-weight", T, ".">;
595
595
 
596
596
  /**
597
597
  * Create a set of letter-spacing variables for use in a Styleframe instance.
@@ -627,7 +627,7 @@ export declare const useLetterSpacing: <T extends Record<string, TokenValue> = {
627
627
  normal: string;
628
628
  wide: string;
629
629
  wider: string;
630
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"letter-spacing", T, "--">;
630
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"letter-spacing", T, ".">;
631
631
 
632
632
  /**
633
633
  * Create a set of line-height variables for use in a Styleframe instance.
@@ -663,7 +663,7 @@ export declare const useLineHeight: <T extends Record<string, TokenValue> = {
663
663
  normal: number;
664
664
  relaxed: number;
665
665
  loose: number;
666
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"line-height", T, "--">;
666
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"line-height", T, ".">;
667
667
 
668
668
  /**
669
669
  * Create a font-size scale for use in a Styleframe instance.
@@ -681,11 +681,11 @@ export declare const useLineHeight: <T extends Record<string, TokenValue> = {
681
681
  * const scalePowers = useScalePowers(s, scale, defaultScalePowerValues);
682
682
  *
683
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'>
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
689
  * } = useMultiplier(s, fontSize, {
690
690
  * xs: scalePowers[-2],
691
691
  * sm: scalePowers[-1],
@@ -740,7 +740,7 @@ export declare const useScale: <T extends Record<string, TokenValue> = {
740
740
  readonly "augmented-fourth": 1.414;
741
741
  readonly "perfect-fifth": 1.5;
742
742
  readonly golden: 1.618;
743
- }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"scale", T, "--">;
743
+ }>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"scale", T, ".">;
744
744
 
745
745
  export declare function useScalePowers<T extends readonly number[]>(s: Styleframe, scale: Variable | Reference, powers?: T): Record<number, TokenValue>;
746
746
 
@@ -756,9 +756,9 @@ export declare function useScalePowers<T extends readonly number[]>(s: Stylefram
756
756
  *
757
757
  * const {
758
758
  * spacing, // Variable<'spacing'>
759
- * spacingSm, // Variable<'spacing--sm'>
760
- * spacingMd, // Variable<'spacing--md'>
761
- * spacingLg, // Variable<'spacing--lg'>
759
+ * spacingSm, // Variable<'spacing.sm'>
760
+ * spacingMd, // Variable<'spacing.md'>
761
+ * spacingLg, // Variable<'spacing.lg'>
762
762
  * } = useSpacing(s, {
763
763
  * default: "1rem",
764
764
  * sm: "0.875rem",
@@ -767,6 +767,6 @@ export declare function useScalePowers<T extends readonly number[]>(s: Stylefram
767
767
  * });
768
768
  * ```
769
769
  */
770
- export declare const useSpacing: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"spacing", T, "--">;
770
+ export declare const useSpacing: <T extends Record<string, TokenValue> = Record<string, TokenValue>>(s: Styleframe, tokens?: T | undefined) => ExportKeys<"spacing", T, ".">;
771
771
 
772
772
  export { }