@atlaskit/primitives 0.4.2 → 0.6.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/inline.partial.js +23 -91
  3. package/dist/cjs/components/internal/base-box.partial.js +81 -99
  4. package/dist/cjs/components/stack.partial.js +23 -47
  5. package/dist/cjs/internal/xcss.js +16 -4
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/components/inline.partial.js +19 -63
  8. package/dist/es2019/components/internal/base-box.partial.js +72 -68
  9. package/dist/es2019/components/stack.partial.js +19 -19
  10. package/dist/es2019/internal/xcss.js +9 -2
  11. package/dist/es2019/version.json +1 -1
  12. package/dist/esm/components/inline.partial.js +22 -91
  13. package/dist/esm/components/internal/base-box.partial.js +81 -99
  14. package/dist/esm/components/stack.partial.js +22 -47
  15. package/dist/esm/internal/xcss.js +13 -2
  16. package/dist/esm/version.json +1 -1
  17. package/dist/types/components/box.d.ts +1 -2
  18. package/dist/types/components/inline.partial.d.ts +28 -39
  19. package/dist/types/components/internal/base-box.partial.d.ts +42 -43
  20. package/dist/types/components/stack.partial.d.ts +25 -20
  21. package/dist/types/components/types.d.ts +2 -48
  22. package/dist/types/internal/xcss.d.ts +37 -8
  23. package/package.json +2 -3
  24. package/report.api.md +160 -144
  25. package/scripts/spacing-codegen-template.tsx +30 -30
  26. package/tmp/api-report-tmp.d.ts +124 -130
  27. package/dist/cjs/components/internal/types.js +0 -8
  28. package/dist/cjs/components/internal/utils.js +0 -16
  29. package/dist/es2019/components/internal/types.js +0 -1
  30. package/dist/es2019/components/internal/utils.js +0 -2
  31. package/dist/esm/components/internal/types.js +0 -1
  32. package/dist/esm/components/internal/utils.js +0 -7
  33. package/dist/types/components/internal/types.d.ts +0 -8
  34. package/dist/types/components/internal/utils.d.ts +0 -3
package/report.api.md CHANGED
@@ -15,6 +15,8 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ /// <reference types="react" />
19
+
18
20
  import { ComponentPropsWithoutRef } from 'react';
19
21
  import { ComponentPropsWithRef } from 'react';
20
22
  import type { CSSProperties } from 'react';
@@ -23,11 +25,13 @@ import { CSSPseudos } from '@emotion/serialize';
23
25
  import { ElementType } from 'react';
24
26
  import { FC } from 'react';
25
27
  import { ForwardRefExoticComponent } from 'react';
28
+ import { JSXElementConstructor } from 'react';
26
29
  import { MemoExoticComponent } from 'react';
27
30
  import { ReactElement } from 'react';
28
31
  import { ReactNode } from 'react';
29
32
  import { RefAttributes } from 'react';
30
33
  import { SerializedStyles } from '@emotion/react';
34
+ import { SerializedStyles as SerializedStyles_2 } from '@emotion/serialize';
31
35
 
32
36
  // @public (undocumented)
33
37
  type AlignBlock = 'baseline' | 'center' | 'end' | 'start';
@@ -53,6 +57,12 @@ const alignSelfMap: {
53
57
  readonly baseline: SerializedStyles;
54
58
  };
55
59
 
60
+ // @public (undocumented)
61
+ type AllowedBoxStyles = keyof SafeCSSObject;
62
+
63
+ // @public (undocumented)
64
+ type AllowedInlineStyles = 'backgroundColor' | 'padding';
65
+
56
66
  // @public (undocumented)
57
67
  type BackgroundColor = keyof typeof backgroundColorMap;
58
68
 
@@ -172,7 +182,7 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
172
182
  backgroundColor?: BackgroundColor;
173
183
  shadow?: Shadow;
174
184
  borderStyle?: BorderStyle;
175
- borderWidth?: BorderWidth | ResponsiveObject<BorderWidth>;
185
+ borderWidth?: BorderWidth;
176
186
  borderColor?: BorderColor;
177
187
  borderRadius?: BorderRadius;
178
188
  layer?: Layer;
@@ -183,18 +193,16 @@ type BaseBoxPropsFoundation<T extends ElementType> = {
183
193
  overflow?: Overflow;
184
194
  overflowInline?: OverflowInline;
185
195
  overflowBlock?: OverflowBlock;
186
- padding?: Padding | ResponsiveObject<Padding>;
187
- paddingBlock?: PaddingBlock | ResponsiveObject<PaddingBlock>;
188
- paddingBlockStart?: PaddingBlockStart | ResponsiveObject<PaddingBlockStart>;
189
- paddingBlockEnd?: PaddingBlockEnd | ResponsiveObject<PaddingBlockEnd>;
190
- paddingInline?: PaddingInline | ResponsiveObject<PaddingInline>;
191
- paddingInlineStart?:
192
- | PaddingInlineStart
193
- | ResponsiveObject<PaddingInlineStart>;
194
- paddingInlineEnd?: PaddingInlineEnd | ResponsiveObject<PaddingInlineEnd>;
196
+ padding?: Padding;
197
+ paddingBlock?: PaddingBlock;
198
+ paddingBlockStart?: PaddingBlockStart;
199
+ paddingBlockEnd?: PaddingBlockEnd;
200
+ paddingInline?: PaddingInline;
201
+ paddingInlineStart?: PaddingInlineStart;
202
+ paddingInlineEnd?: PaddingInlineEnd;
195
203
  width?: Width;
196
204
  height?: Height;
197
- display?: Display | ResponsiveObject<Display>;
205
+ display?: Display;
198
206
  position?: Position;
199
207
  ref?: ComponentPropsWithRef<T>['ref'];
200
208
  };
@@ -283,9 +291,9 @@ type BorderWidth_2 = keyof typeof borderWidthMap_2;
283
291
 
284
292
  // @public (undocumented)
285
293
  const borderWidthMap: {
286
- readonly 'size.0': 'var(--ds-width-0)';
287
- readonly 'size.050': 'var(--ds-width-050)';
288
- readonly 'size.100': 'var(--ds-width-100)';
294
+ readonly 'size.0': SerializedStyles;
295
+ readonly 'size.050': SerializedStyles;
296
+ readonly 'size.100': SerializedStyles;
289
297
  };
290
298
 
291
299
  // @public (undocumented)
@@ -298,19 +306,6 @@ const borderWidthMap_2: {
298
306
  // @public
299
307
  export const Box: BoxComponent;
300
308
 
301
- // @public (undocumented)
302
- const BOX_RESPONSIVE_PROPS: readonly [
303
- 'borderWidth',
304
- 'display',
305
- 'padding',
306
- 'paddingBlock',
307
- 'paddingBlockStart',
308
- 'paddingBlockEnd',
309
- 'paddingInline',
310
- 'paddingInlineStart',
311
- 'paddingInlineEnd',
312
- ];
313
-
314
309
  // @public (undocumented)
315
310
  type BoxComponent<T extends ElementType = 'div'> = (<
316
311
  T extends ElementType = 'div',
@@ -322,15 +317,23 @@ type BoxComponent<T extends ElementType = 'div'> = (<
322
317
  // @public (undocumented)
323
318
  export type BoxProps<T extends ElementType = 'div'> = Omit<
324
319
  BaseBoxProps<T>,
325
- 'className' | BoxResponsiveProp
320
+ 'className'
326
321
  > &
327
322
  PublicBoxPropsBase;
328
323
 
329
324
  // @public (undocumented)
330
- type BoxResponsiveProp = typeof BOX_RESPONSIVE_PROPS[number];
325
+ type BoxStyles = SerializedStyles_2 & {
326
+ [boxTag]: true;
327
+ };
331
328
 
332
- // @public
333
- type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxl' | 'xxs';
329
+ // @public (undocumented)
330
+ const boxTag: unique symbol;
331
+
332
+ // @public (undocumented)
333
+ type BoxXCSS = {
334
+ readonly symbol: typeof uniqueSymbol;
335
+ readonly styles: BoxStyles;
336
+ };
334
337
 
335
338
  // @public (undocumented)
336
339
  const dimensionMap: {
@@ -349,11 +352,11 @@ type Display = keyof typeof displayMap;
349
352
 
350
353
  // @public (undocumented)
351
354
  const displayMap: {
352
- readonly block: 'block';
353
- readonly inline: 'inline';
354
- readonly flex: 'flex';
355
- readonly 'inline-flex': 'inline-flex';
356
- readonly 'inline-block': 'inline-block';
355
+ readonly block: SerializedStyles;
356
+ readonly inline: SerializedStyles;
357
+ readonly flex: SerializedStyles;
358
+ readonly 'inline-flex': SerializedStyles;
359
+ readonly 'inline-block': SerializedStyles;
357
360
  };
358
361
 
359
362
  // @public (undocumented)
@@ -382,6 +385,12 @@ const flexShrinkMap: {
382
385
  readonly '1': SerializedStyles;
383
386
  };
384
387
 
388
+ // @public (undocumented)
389
+ type Gap = keyof typeof inlineSpaceMap.gap;
390
+
391
+ // @public (undocumented)
392
+ type Gap_2 = keyof typeof stackSpaceMap.gap;
393
+
385
394
  // @public (undocumented)
386
395
  type Grow = 'fill' | 'hug';
387
396
 
@@ -434,16 +443,43 @@ export interface InlineProps<T extends ElementType = 'div'> {
434
443
  as?: 'div' | 'ol' | 'span' | 'ul';
435
444
  children: ReactNode;
436
445
  grow?: Grow;
437
- // (undocumented)
438
446
  ref?: ComponentPropsWithRef<T>['ref'];
439
- rowSpace?: RowSpace;
447
+ rowSpace?: RowGap;
440
448
  separator?: string;
441
449
  shouldWrap?: boolean;
442
- space?: Space;
450
+ space?: Gap;
443
451
  spread?: Spread;
444
452
  testId?: string;
445
453
  }
446
454
 
455
+ // @public
456
+ const inlineSpaceMap: {
457
+ [k: string]: {
458
+ readonly '0': SerializedStyles;
459
+ readonly '025': SerializedStyles;
460
+ readonly '050': SerializedStyles;
461
+ readonly '075': SerializedStyles;
462
+ readonly '100': SerializedStyles;
463
+ readonly '150': SerializedStyles;
464
+ readonly '200': SerializedStyles;
465
+ readonly '250': SerializedStyles;
466
+ readonly '300': SerializedStyles;
467
+ readonly '400': SerializedStyles;
468
+ readonly '500': SerializedStyles;
469
+ readonly '600': SerializedStyles;
470
+ readonly '800': SerializedStyles;
471
+ readonly '1000': SerializedStyles;
472
+ };
473
+ };
474
+
475
+ // @public (undocumented)
476
+ type InlineStyles = SerializedStyles_2 & {
477
+ [inlineTag]: true;
478
+ };
479
+
480
+ // @public (undocumented)
481
+ const inlineTag: unique symbol;
482
+
447
483
  // @public (undocumented)
448
484
  type Layer = keyof typeof LAYERS;
449
485
 
@@ -500,45 +536,47 @@ const overflowMap: {
500
536
  };
501
537
 
502
538
  // @public (undocumented)
503
- type Padding = keyof typeof paddingMap;
539
+ type Padding = keyof typeof paddingMap.padding;
504
540
 
505
541
  // @public (undocumented)
506
542
  type Padding_2 = keyof typeof paddingMap_2;
507
543
 
508
544
  // @public (undocumented)
509
- type PaddingBlock = keyof typeof paddingMap;
545
+ type PaddingBlock = keyof typeof paddingMap.paddingBlock;
510
546
 
511
547
  // @public (undocumented)
512
- type PaddingBlockEnd = keyof typeof paddingMap;
548
+ type PaddingBlockEnd = keyof typeof paddingMap.paddingBlockEnd;
513
549
 
514
550
  // @public (undocumented)
515
- type PaddingBlockStart = keyof typeof paddingMap;
551
+ type PaddingBlockStart = keyof typeof paddingMap.paddingBlockStart;
516
552
 
517
553
  // @public (undocumented)
518
- type PaddingInline = keyof typeof paddingMap;
554
+ type PaddingInline = keyof typeof paddingMap.paddingInline;
519
555
 
520
556
  // @public (undocumented)
521
- type PaddingInlineEnd = keyof typeof paddingMap;
557
+ type PaddingInlineEnd = keyof typeof paddingMap.paddingInlineEnd;
522
558
 
523
559
  // @public (undocumented)
524
- type PaddingInlineStart = keyof typeof paddingMap;
560
+ type PaddingInlineStart = keyof typeof paddingMap.paddingInlineStart;
525
561
 
526
562
  // @public
527
563
  const paddingMap: {
528
- readonly 'space.0': 'var(--ds-space-0)';
529
- readonly 'space.025': 'var(--ds-space-025)';
530
- readonly 'space.050': 'var(--ds-space-050)';
531
- readonly 'space.075': 'var(--ds-space-075)';
532
- readonly 'space.100': 'var(--ds-space-100)';
533
- readonly 'space.150': 'var(--ds-space-150)';
534
- readonly 'space.200': 'var(--ds-space-200)';
535
- readonly 'space.250': 'var(--ds-space-250)';
536
- readonly 'space.300': 'var(--ds-space-300)';
537
- readonly 'space.400': 'var(--ds-space-400)';
538
- readonly 'space.500': 'var(--ds-space-500)';
539
- readonly 'space.600': 'var(--ds-space-600)';
540
- readonly 'space.800': 'var(--ds-space-800)';
541
- readonly 'space.1000': 'var(--ds-space-1000)';
564
+ [k: string]: {
565
+ readonly 'space.0': SerializedStyles;
566
+ readonly 'space.025': SerializedStyles;
567
+ readonly 'space.050': SerializedStyles;
568
+ readonly 'space.075': SerializedStyles;
569
+ readonly 'space.100': SerializedStyles;
570
+ readonly 'space.150': SerializedStyles;
571
+ readonly 'space.200': SerializedStyles;
572
+ readonly 'space.250': SerializedStyles;
573
+ readonly 'space.300': SerializedStyles;
574
+ readonly 'space.400': SerializedStyles;
575
+ readonly 'space.500': SerializedStyles;
576
+ readonly 'space.600': SerializedStyles;
577
+ readonly 'space.800': SerializedStyles;
578
+ readonly 'space.1000': SerializedStyles;
579
+ };
542
580
  };
543
581
 
544
582
  // @public (undocumented)
@@ -572,50 +610,23 @@ const positionMap: {
572
610
 
573
611
  // @public (undocumented)
574
612
  type PublicBoxPropsBase = {
575
- borderWidth?: BorderWidth;
576
- display?: Display;
577
- padding?: Padding;
578
- paddingBlock?: PaddingBlock;
579
- paddingBlockStart?: PaddingBlockStart;
580
- paddingBlockEnd?: PaddingBlockEnd;
581
- paddingInline?: PaddingInline;
582
- paddingInlineStart?: PaddingInlineStart;
583
- paddingInlineEnd?: PaddingInlineEnd;
584
- xcss?: SafeCSS;
613
+ xcss?: BoxXCSS;
585
614
  };
586
615
 
587
- // @public
588
- type ResponsiveObject<T> = Partial<Record<Breakpoint, T>>;
589
-
590
- // @public (undocumented)
591
- type RowSpace = keyof typeof rowSpaceMap;
592
-
593
616
  // @public (undocumented)
594
- const rowSpaceMap: {
595
- readonly '0': SerializedStyles;
596
- readonly '025': SerializedStyles;
597
- readonly '050': SerializedStyles;
598
- readonly '075': SerializedStyles;
599
- readonly '100': SerializedStyles;
600
- readonly '150': SerializedStyles;
601
- readonly '200': SerializedStyles;
602
- readonly '250': SerializedStyles;
603
- readonly '300': SerializedStyles;
604
- readonly '400': SerializedStyles;
605
- readonly '500': SerializedStyles;
606
- readonly '600': SerializedStyles;
607
- readonly '800': SerializedStyles;
608
- readonly '1000': SerializedStyles;
609
- };
610
-
611
- // @public (undocumented)
612
- type SafeCSS = XCSS | XCSS[];
617
+ type RowGap = keyof typeof inlineSpaceMap.rowGap;
613
618
 
614
619
  // @public (undocumented)
615
620
  type SafeCSSObject = CSSPseudos &
616
621
  TokenisedProps &
617
622
  Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
618
623
 
624
+ // @public (undocumented)
625
+ type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<
626
+ SafeCSSObject,
627
+ T
628
+ >;
629
+
619
630
  // @public (undocumented)
620
631
  type Shadow = keyof typeof shadowMap;
621
632
 
@@ -628,48 +639,6 @@ const shadowMap: {
628
639
  readonly raised: SerializedStyles;
629
640
  };
630
641
 
631
- // @public (undocumented)
632
- type Space = keyof typeof spaceMap;
633
-
634
- // @public (undocumented)
635
- type Space_2 = keyof typeof spaceMap_2;
636
-
637
- // @public
638
- const spaceMap: {
639
- readonly '0': SerializedStyles;
640
- readonly '025': SerializedStyles;
641
- readonly '050': SerializedStyles;
642
- readonly '075': SerializedStyles;
643
- readonly '100': SerializedStyles;
644
- readonly '150': SerializedStyles;
645
- readonly '200': SerializedStyles;
646
- readonly '250': SerializedStyles;
647
- readonly '300': SerializedStyles;
648
- readonly '400': SerializedStyles;
649
- readonly '500': SerializedStyles;
650
- readonly '600': SerializedStyles;
651
- readonly '800': SerializedStyles;
652
- readonly '1000': SerializedStyles;
653
- };
654
-
655
- // @public
656
- const spaceMap_2: {
657
- readonly '0': SerializedStyles;
658
- readonly '025': SerializedStyles;
659
- readonly '050': SerializedStyles;
660
- readonly '075': SerializedStyles;
661
- readonly '100': SerializedStyles;
662
- readonly '150': SerializedStyles;
663
- readonly '200': SerializedStyles;
664
- readonly '250': SerializedStyles;
665
- readonly '300': SerializedStyles;
666
- readonly '400': SerializedStyles;
667
- readonly '500': SerializedStyles;
668
- readonly '600': SerializedStyles;
669
- readonly '800': SerializedStyles;
670
- readonly '1000': SerializedStyles;
671
- };
672
-
673
642
  // @public (undocumented)
674
643
  type Spread = 'space-between';
675
644
 
@@ -701,13 +670,32 @@ export interface StackProps<T extends ElementType = 'div'> {
701
670
  as?: 'div' | 'ol' | 'span' | 'ul';
702
671
  children: ReactNode;
703
672
  grow?: Grow_2;
704
- // (undocumented)
705
673
  ref?: ComponentPropsWithRef<T>['ref'];
706
- space?: Space_2;
674
+ space?: Gap_2;
707
675
  spread?: Spread_2;
708
676
  testId?: string;
709
677
  }
710
678
 
679
+ // @public
680
+ const stackSpaceMap: {
681
+ [k: string]: {
682
+ readonly '0': SerializedStyles;
683
+ readonly '025': SerializedStyles;
684
+ readonly '050': SerializedStyles;
685
+ readonly '075': SerializedStyles;
686
+ readonly '100': SerializedStyles;
687
+ readonly '150': SerializedStyles;
688
+ readonly '200': SerializedStyles;
689
+ readonly '250': SerializedStyles;
690
+ readonly '300': SerializedStyles;
691
+ readonly '400': SerializedStyles;
692
+ readonly '500': SerializedStyles;
693
+ readonly '600': SerializedStyles;
694
+ readonly '800': SerializedStyles;
695
+ readonly '1000': SerializedStyles;
696
+ };
697
+ };
698
+
711
699
  // @public (undocumented)
712
700
  type TextColor = keyof typeof textColorMap;
713
701
 
@@ -827,12 +815,40 @@ const widthMap: {
827
815
  };
828
816
 
829
817
  // @public (undocumented)
830
- type XCSS = ReturnType<typeof xcss>;
831
-
832
- // @public (undocumented)
833
- export const xcss: (style?: SafeCSSObject | SafeCSSObject[] | undefined) => {
818
+ export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(
819
+ style: Primitive extends typeof Box
820
+ ? ScopedSafeCSSObject<AllowedBoxStyles>
821
+ : Primitive extends typeof Inline
822
+ ? ScopedSafeCSSObject<AllowedInlineStyles>
823
+ : never,
824
+ ): {
834
825
  readonly symbol: typeof uniqueSymbol;
835
- readonly styles: SerializedStyles;
826
+ readonly styles: Primitive extends (<T extends ElementType<any> = 'div'>(
827
+ props: BoxProps<T>,
828
+ ) => ReactElement<any, JSXElementConstructor<any> | string> | null) &
829
+ FC<BoxProps<'div'>>
830
+ ? BoxStyles
831
+ : Primitive extends MemoExoticComponent<
832
+ ForwardRefExoticComponent<
833
+ Pick<
834
+ InlineProps<ElementType<any>>,
835
+ | 'alignBlock'
836
+ | 'alignInline'
837
+ | 'as'
838
+ | 'children'
839
+ | 'grow'
840
+ | 'rowSpace'
841
+ | 'separator'
842
+ | 'shouldWrap'
843
+ | 'space'
844
+ | 'spread'
845
+ | 'testId'
846
+ > &
847
+ RefAttributes<any>
848
+ >
849
+ >
850
+ ? InlineStyles
851
+ : never;
836
852
  };
837
853
 
838
854
  // (No @packageDocumentation comment for this package)
@@ -3,13 +3,12 @@ import parserTypeScript from 'prettier/parser-typescript';
3
3
 
4
4
  import { spacing as tokens } from '@atlaskit/tokens/tokens-raw';
5
5
 
6
- import { capitalize, tokenCall, tokenToStyle } from './utils';
6
+ import { capitalize, tokenToStyle } from './utils';
7
7
 
8
8
  const spacingProperties: Record<
9
9
  string,
10
10
  {
11
11
  cssProperties: readonly string[];
12
- responsiveOutput?: boolean;
13
12
  propNameFormatter?: (propName: string) => string;
14
13
  }
15
14
  > = {
@@ -23,14 +22,13 @@ const spacingProperties: Record<
23
22
  'paddingInlineStart',
24
23
  'paddingInlineEnd',
25
24
  ],
26
- responsiveOutput: true,
27
25
  },
28
- space: {
29
- cssProperties: ['gap'],
26
+ inlineSpace: {
27
+ cssProperties: ['gap', 'rowGap'],
30
28
  propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
31
29
  },
32
- rowSpace: {
33
- cssProperties: ['rowGap'],
30
+ stackSpace: {
31
+ cssProperties: ['gap'],
34
32
  propNameFormatter: tokenName => tokenName.replace(spacingTokenPrefix, ''),
35
33
  },
36
34
  } as const;
@@ -52,32 +50,34 @@ export const createSpacingStylesFromTemplate = (
52
50
  throw new Error(`[codegen] Unknown option found "${spacingProperty}"`);
53
51
  }
54
52
 
55
- const { cssProperties, responsiveOutput, propNameFormatter } =
53
+ const { cssProperties, propNameFormatter } =
56
54
  spacingProperties[spacingProperty]!;
57
55
 
58
56
  return (
59
57
  prettier.format(
60
58
  `
61
- const ${spacingProperty}Map = {
62
- ${activeTokens
63
- .sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
64
- .map(token => {
65
- const propName = propNameFormatter
66
- ? propNameFormatter(token.name)
67
- : token.name;
68
-
69
- // a responsive output simply prints out a mapping of tokens
70
- if (responsiveOutput) {
71
- return `'${token.name}': ${tokenCall(token.name, token.fallback)}`;
72
- }
73
-
74
- return `'${propName}': ${tokenToStyle(
75
- [cssProperties] as any,
76
- token.name,
77
- token.fallback,
78
- )}`;
79
- })}
80
- } as const;`,
59
+ const ${spacingProperty}Map = Object.fromEntries(
60
+ [
61
+ '${cssProperties.join("','")}',
62
+ ].map((property: string) => [
63
+ property,
64
+ {
65
+ ${activeTokens
66
+ .sort((a, b) =>
67
+ a.name.localeCompare(b.name, undefined, { numeric: true }),
68
+ )
69
+ .map(token => {
70
+ const propName = propNameFormatter
71
+ ? propNameFormatter(token.name)
72
+ : token.name;
73
+ return `'${propName}': ${tokenToStyle(
74
+ '[property]' as any,
75
+ token.name,
76
+ token.fallback,
77
+ )}`;
78
+ })}
79
+ } as const,
80
+ ]));`,
81
81
  {
82
82
  singleQuote: true,
83
83
  trailingComma: 'all',
@@ -89,8 +89,8 @@ const ${spacingProperty}Map = {
89
89
  .map(
90
90
  cssProperty =>
91
91
  `\nexport type ${capitalize(
92
- cssProperties.length === 1 ? spacingProperty : cssProperty,
93
- )} = keyof typeof ${spacingProperty}Map;`,
92
+ cssProperty,
93
+ )} = keyof typeof ${spacingProperty}Map.${cssProperty};`,
94
94
  )
95
95
  .join('') +
96
96
  '\n')