@primer/primitives 7.17.0-rc.a85cfb75 → 7.17.0-rc.ac784da5
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/build.js +578 -0
- package/dist/css/functional/themes/dark-colorblind.css +0 -10
- package/dist/css/functional/themes/dark-dimmed.css +0 -10
- package/dist/css/functional/themes/dark-high-contrast.css +0 -10
- package/dist/css/functional/themes/dark-tritanopia.css +0 -10
- package/dist/css/functional/themes/dark.css +0 -10
- package/dist/css/functional/themes/light-colorblind.css +0 -10
- package/dist/css/functional/themes/light-high-contrast.css +0 -10
- package/dist/css/functional/themes/light-tritanopia.css +0 -10
- package/dist/css/functional/themes/light.css +0 -10
- package/dist/docs/functional/themes/dark-colorblind.json +0 -145
- package/dist/docs/functional/themes/dark-dimmed.json +0 -145
- package/dist/docs/functional/themes/dark-high-contrast.json +0 -145
- package/dist/docs/functional/themes/dark-tritanopia.json +0 -145
- package/dist/docs/functional/themes/dark.json +0 -145
- package/dist/docs/functional/themes/light-colorblind.json +0 -145
- package/dist/docs/functional/themes/light-high-contrast.json +0 -145
- package/dist/docs/functional/themes/light-tritanopia.json +0 -145
- package/dist/docs/functional/themes/light.json +0 -145
- package/dist/docs/functional/typography/typography.json +3 -39
- package/dist/figma/figma.json +1 -10
- package/dist/figma/themes/dark-colorblind.json +0 -80
- package/dist/figma/themes/dark-dimmed.json +0 -80
- package/dist/figma/themes/dark-high-contrast.json +0 -80
- package/dist/figma/themes/dark-tritanopia.json +0 -80
- package/dist/figma/themes/dark.json +0 -80
- package/dist/figma/themes/light-colorblind.json +0 -80
- package/dist/figma/themes/light-high-contrast.json +0 -80
- package/dist/figma/themes/light-tritanopia.json +0 -80
- package/dist/figma/themes/light.json +0 -80
- package/dist/internalCss/dark-colorblind.css +0 -10
- package/dist/internalCss/dark-dimmed.css +0 -10
- package/dist/internalCss/dark-high-contrast.css +0 -10
- package/dist/internalCss/dark-tritanopia.css +0 -10
- package/dist/internalCss/dark.css +0 -10
- package/dist/internalCss/light-colorblind.css +0 -10
- package/dist/internalCss/light-high-contrast.css +0 -10
- package/dist/internalCss/light-tritanopia.css +0 -10
- package/dist/internalCss/light.css +0 -10
- package/dist/styleLint/functional/themes/dark-colorblind.json +0 -145
- package/dist/styleLint/functional/themes/dark-dimmed.json +0 -145
- package/dist/styleLint/functional/themes/dark-high-contrast.json +0 -145
- package/dist/styleLint/functional/themes/dark-tritanopia.json +0 -145
- package/dist/styleLint/functional/themes/dark.json +0 -145
- package/dist/styleLint/functional/themes/light-colorblind.json +0 -145
- package/dist/styleLint/functional/themes/light-high-contrast.json +0 -145
- package/dist/styleLint/functional/themes/light-tritanopia.json +0 -145
- package/dist/styleLint/functional/themes/light.json +0 -145
- package/dist/styleLint/functional/typography/typography.json +3 -39
- package/package.json +11 -4
- package/src/PrimerStyleDictionary.ts +0 -6
- package/src/filters/index.ts +0 -1
- package/src/formats/jsonFigma.ts +0 -1
- package/src/platforms/figma.ts +1 -3
- package/src/tokens/functional/color/dark/display-dark.json5 +0 -66
- package/src/tokens/functional/color/light/display-light.json5 +0 -66
- package/src/tokens/functional/typography/typography.json +3 -21
- package/src/transformers/fontFamilyToCss.ts +3 -2
- package/src/transformers/fontFamilyToFigma.ts +0 -12
- package/src/transformers/index.ts +0 -1
- package/tokens/base/size/size.json +57 -0
- package/tokens/base/typography/typography.json +20 -0
- package/tokens/functional/size/border.json +48 -0
- package/tokens/functional/size/breakpoints.json +24 -0
- package/tokens/functional/size/size-coarse.json +27 -0
- package/tokens/functional/size/size-fine.json +27 -0
- package/tokens/functional/size/size.json +189 -0
- package/tokens/functional/size/viewport.json +24 -0
- package/tokens/functional/typography/typography.json +213 -0
- package/tokens/removed/color.json +421 -0
- package/tokens-v2-private/css/tokens/base/size/size.css +24 -0
- package/tokens-v2-private/css/tokens/base/typography/typography.css +11 -0
- package/tokens-v2-private/css/tokens/functional/size/border.css +17 -0
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +13 -0
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +11 -0
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +11 -0
- package/tokens-v2-private/css/tokens/functional/size/size.css +54 -0
- package/tokens-v2-private/css/tokens/functional/size/viewport.css +6 -0
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +47 -0
- package/tokens-v2-private/docs/docValues.json +2209 -0
- package/tokens-v2-private/js/module/tokens/base/size/size.js +266 -0
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +77 -0
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +165 -0
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +101 -0
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +73 -0
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +73 -0
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +824 -0
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +101 -0
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +809 -0
- package/tokens-v2-private/js/tokens/base/size/size.js +22 -0
- package/tokens-v2-private/js/tokens/base/typography/typography.js +9 -0
- package/tokens-v2-private/js/tokens/functional/size/border.js +15 -0
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +11 -0
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +8 -0
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +8 -0
- package/tokens-v2-private/js/tokens/functional/size/size.js +52 -0
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +11 -0
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +45 -0
- package/tokens-v2-private/scss/tokens/base/size/size.scss +21 -0
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +8 -0
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +14 -0
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +10 -0
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +7 -0
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +7 -0
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +51 -0
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +10 -0
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +44 -0
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +31 -0
- package/tokens-v2-private/ts/tokens/base/size/size.js +30 -0
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +20 -0
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +19 -0
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +28 -0
- package/tokens-v2-private/ts/tokens/functional/size/border.js +27 -0
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +20 -0
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +19 -0
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +29 -0
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +28 -0
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +29 -0
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +28 -0
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +103 -0
- package/tokens-v2-private/ts/tokens/functional/size/size.js +102 -0
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +20 -0
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +19 -0
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +131 -0
- package/tokens-v2-private/ts/tokens/functional/typography/typography.js +130 -0
- package/dist/figma/typography/typography.json +0 -32
- package/src/filters/isNumber.ts +0 -8
- package/src/transformers/floatToPixel.ts +0 -33
- package/src/transformers/utilities/hasSpaceInString.ts +0 -6
|
@@ -3783,151 +3783,6 @@
|
|
|
3783
3783
|
"attributes": {},
|
|
3784
3784
|
"path": ["display", "indigo", "borderColor", "emphasis"]
|
|
3785
3785
|
},
|
|
3786
|
-
"display-pink-bgColor-muted": {
|
|
3787
|
-
"value": "#ffe5f1",
|
|
3788
|
-
"$type": "color",
|
|
3789
|
-
"$extensions": {
|
|
3790
|
-
"org.primer.figma": {
|
|
3791
|
-
"collection": "mode",
|
|
3792
|
-
"mode": "light",
|
|
3793
|
-
"group": "component (internal)",
|
|
3794
|
-
"scopes": ["bgColor"]
|
|
3795
|
-
}
|
|
3796
|
-
},
|
|
3797
|
-
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
3798
|
-
"isSource": true,
|
|
3799
|
-
"original": {
|
|
3800
|
-
"value": "{base.display.color.pink.0}",
|
|
3801
|
-
"$type": "color",
|
|
3802
|
-
"$extensions": {
|
|
3803
|
-
"org.primer.figma": {
|
|
3804
|
-
"collection": "mode",
|
|
3805
|
-
"mode": "light",
|
|
3806
|
-
"group": "component (internal)",
|
|
3807
|
-
"scopes": ["bgColor"]
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3810
|
-
},
|
|
3811
|
-
"name": "display-pink-bgColor-muted",
|
|
3812
|
-
"attributes": {},
|
|
3813
|
-
"path": ["display", "pink", "bgColor", "muted"]
|
|
3814
|
-
},
|
|
3815
|
-
"display-pink-bgColor-emphasis": {
|
|
3816
|
-
"value": "#ce2c85",
|
|
3817
|
-
"$type": "color",
|
|
3818
|
-
"$extensions": {
|
|
3819
|
-
"org.primer.figma": {
|
|
3820
|
-
"collection": "mode",
|
|
3821
|
-
"mode": "light",
|
|
3822
|
-
"group": "component (internal)",
|
|
3823
|
-
"scopes": ["bgColor"]
|
|
3824
|
-
}
|
|
3825
|
-
},
|
|
3826
|
-
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
3827
|
-
"isSource": true,
|
|
3828
|
-
"original": {
|
|
3829
|
-
"value": "{base.display.color.pink.5}",
|
|
3830
|
-
"$type": "color",
|
|
3831
|
-
"$extensions": {
|
|
3832
|
-
"org.primer.figma": {
|
|
3833
|
-
"collection": "mode",
|
|
3834
|
-
"mode": "light",
|
|
3835
|
-
"group": "component (internal)",
|
|
3836
|
-
"scopes": ["bgColor"]
|
|
3837
|
-
}
|
|
3838
|
-
}
|
|
3839
|
-
},
|
|
3840
|
-
"name": "display-pink-bgColor-emphasis",
|
|
3841
|
-
"attributes": {},
|
|
3842
|
-
"path": ["display", "pink", "bgColor", "emphasis"]
|
|
3843
|
-
},
|
|
3844
|
-
"display-pink-fgColor": {
|
|
3845
|
-
"value": "#b12f79",
|
|
3846
|
-
"$type": "color",
|
|
3847
|
-
"$extensions": {
|
|
3848
|
-
"org.primer.figma": {
|
|
3849
|
-
"collection": "mode",
|
|
3850
|
-
"mode": "light",
|
|
3851
|
-
"group": "component (internal)",
|
|
3852
|
-
"scopes": ["fgColor"]
|
|
3853
|
-
}
|
|
3854
|
-
},
|
|
3855
|
-
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
3856
|
-
"isSource": true,
|
|
3857
|
-
"original": {
|
|
3858
|
-
"value": "{base.display.color.pink.6}",
|
|
3859
|
-
"$type": "color",
|
|
3860
|
-
"$extensions": {
|
|
3861
|
-
"org.primer.figma": {
|
|
3862
|
-
"collection": "mode",
|
|
3863
|
-
"mode": "light",
|
|
3864
|
-
"group": "component (internal)",
|
|
3865
|
-
"scopes": ["fgColor"]
|
|
3866
|
-
}
|
|
3867
|
-
}
|
|
3868
|
-
},
|
|
3869
|
-
"name": "display-pink-fgColor",
|
|
3870
|
-
"attributes": {},
|
|
3871
|
-
"path": ["display", "pink", "fgColor"]
|
|
3872
|
-
},
|
|
3873
|
-
"display-pink-borderColor-muted": {
|
|
3874
|
-
"value": "#fdc9e2",
|
|
3875
|
-
"$type": "color",
|
|
3876
|
-
"$extensions": {
|
|
3877
|
-
"org.primer.figma": {
|
|
3878
|
-
"collection": "mode",
|
|
3879
|
-
"mode": "light",
|
|
3880
|
-
"group": "component (internal)",
|
|
3881
|
-
"scopes": ["borderColor"]
|
|
3882
|
-
}
|
|
3883
|
-
},
|
|
3884
|
-
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
3885
|
-
"isSource": true,
|
|
3886
|
-
"original": {
|
|
3887
|
-
"value": "{base.display.color.pink.1}",
|
|
3888
|
-
"$type": "color",
|
|
3889
|
-
"$extensions": {
|
|
3890
|
-
"org.primer.figma": {
|
|
3891
|
-
"collection": "mode",
|
|
3892
|
-
"mode": "light",
|
|
3893
|
-
"group": "component (internal)",
|
|
3894
|
-
"scopes": ["borderColor"]
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
},
|
|
3898
|
-
"name": "display-pink-borderColor-muted",
|
|
3899
|
-
"attributes": {},
|
|
3900
|
-
"path": ["display", "pink", "borderColor", "muted"]
|
|
3901
|
-
},
|
|
3902
|
-
"display-pink-borderColor-emphasis": {
|
|
3903
|
-
"value": "#ce2c85",
|
|
3904
|
-
"$type": "color",
|
|
3905
|
-
"$extensions": {
|
|
3906
|
-
"org.primer.figma": {
|
|
3907
|
-
"collection": "mode",
|
|
3908
|
-
"mode": "light",
|
|
3909
|
-
"group": "component (internal)",
|
|
3910
|
-
"scopes": ["borderColor"]
|
|
3911
|
-
}
|
|
3912
|
-
},
|
|
3913
|
-
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
3914
|
-
"isSource": true,
|
|
3915
|
-
"original": {
|
|
3916
|
-
"value": "{base.display.color.pink.5}",
|
|
3917
|
-
"$type": "color",
|
|
3918
|
-
"$extensions": {
|
|
3919
|
-
"org.primer.figma": {
|
|
3920
|
-
"collection": "mode",
|
|
3921
|
-
"mode": "light",
|
|
3922
|
-
"group": "component (internal)",
|
|
3923
|
-
"scopes": ["borderColor"]
|
|
3924
|
-
}
|
|
3925
|
-
}
|
|
3926
|
-
},
|
|
3927
|
-
"name": "display-pink-borderColor-emphasis",
|
|
3928
|
-
"attributes": {},
|
|
3929
|
-
"path": ["display", "pink", "borderColor", "emphasis"]
|
|
3930
|
-
},
|
|
3931
3786
|
"avatar-bgColor": {
|
|
3932
3787
|
"value": "#ffffff",
|
|
3933
3788
|
"$type": "color",
|
|
@@ -2,23 +2,11 @@
|
|
|
2
2
|
"fontStack-system": {
|
|
3
3
|
"value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
4
4
|
"$type": "fontFamily",
|
|
5
|
-
"$extensions": {
|
|
6
|
-
"org.primer.figma": {
|
|
7
|
-
"collection": "typography",
|
|
8
|
-
"scopes": ["all"]
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
5
|
"filePath": "src/tokens/functional/typography/typography.json",
|
|
12
6
|
"isSource": true,
|
|
13
7
|
"original": {
|
|
14
8
|
"value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
15
|
-
"$type": "fontFamily"
|
|
16
|
-
"$extensions": {
|
|
17
|
-
"org.primer.figma": {
|
|
18
|
-
"collection": "typography",
|
|
19
|
-
"scopes": ["all"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
9
|
+
"$type": "fontFamily"
|
|
22
10
|
},
|
|
23
11
|
"name": "fontStack-system",
|
|
24
12
|
"attributes": {},
|
|
@@ -27,23 +15,11 @@
|
|
|
27
15
|
"fontStack-sansSerif": {
|
|
28
16
|
"value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
29
17
|
"$type": "fontFamily",
|
|
30
|
-
"$extensions": {
|
|
31
|
-
"org.primer.figma": {
|
|
32
|
-
"collection": "typography",
|
|
33
|
-
"scopes": ["all"]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
18
|
"filePath": "src/tokens/functional/typography/typography.json",
|
|
37
19
|
"isSource": true,
|
|
38
20
|
"original": {
|
|
39
21
|
"value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
40
|
-
"$type": "fontFamily"
|
|
41
|
-
"$extensions": {
|
|
42
|
-
"org.primer.figma": {
|
|
43
|
-
"collection": "typography",
|
|
44
|
-
"scopes": ["all"]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
22
|
+
"$type": "fontFamily"
|
|
47
23
|
},
|
|
48
24
|
"name": "fontStack-sansSerif",
|
|
49
25
|
"attributes": {},
|
|
@@ -52,23 +28,11 @@
|
|
|
52
28
|
"fontStack-monospace": {
|
|
53
29
|
"value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
54
30
|
"$type": "fontFamily",
|
|
55
|
-
"$extensions": {
|
|
56
|
-
"org.primer.figma": {
|
|
57
|
-
"collection": "typography",
|
|
58
|
-
"scopes": ["all"]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
31
|
"filePath": "src/tokens/functional/typography/typography.json",
|
|
62
32
|
"isSource": true,
|
|
63
33
|
"original": {
|
|
64
34
|
"value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
65
|
-
"$type": "fontFamily"
|
|
66
|
-
"$extensions": {
|
|
67
|
-
"org.primer.figma": {
|
|
68
|
-
"collection": "typography",
|
|
69
|
-
"scopes": ["all"]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
35
|
+
"$type": "fontFamily"
|
|
72
36
|
},
|
|
73
37
|
"name": "fontStack-monospace",
|
|
74
38
|
"attributes": {},
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/primitives",
|
|
3
|
-
"version": "7.17.0-rc.
|
|
3
|
+
"version": "7.17.0-rc.ac784da5",
|
|
4
4
|
"description": "Typography, spacing, and color primitives for Primer design system",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
+
"tokens-v2-private",
|
|
8
|
+
"build.js",
|
|
9
|
+
"tokens/",
|
|
7
10
|
"src/**/*",
|
|
8
11
|
"!src/**/*.test.ts"
|
|
9
12
|
],
|
|
@@ -30,6 +33,8 @@
|
|
|
30
33
|
"build:v8": "ts-node ./scripts/buildTokens.ts",
|
|
31
34
|
"build:fallbacks": "ts-node ./scripts/buildFallbacks.ts",
|
|
32
35
|
"build:figma": "ts-node scripts/buildFigma.ts",
|
|
36
|
+
"build:tokens": "node -e \"require('./build')._init()\"",
|
|
37
|
+
"build:new-tokens": "npm run build:tokens && npm run build:next && npm run build:figma",
|
|
33
38
|
"tokenJson:check": "ts-node scripts/diffThemes.ts && ts-node scripts/diffTokenProps.ts",
|
|
34
39
|
"contrast:check": "ts-node scripts/color-contrast.ts",
|
|
35
40
|
"format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
|
|
@@ -39,12 +44,14 @@
|
|
|
39
44
|
"lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config .eslintrc.js",
|
|
40
45
|
"lint:tokens": "ts-node ./scripts/validateTokenJson.ts",
|
|
41
46
|
"prebuild": "rm -rf dist",
|
|
47
|
+
"prebuild:tokens": "rm -rf tokens-v2-private",
|
|
42
48
|
"prebuild:next": "rm -rf dist",
|
|
43
|
-
"prepack": "npm run build && npm run build:next",
|
|
49
|
+
"prepack": "npm run build && npm run build:tokens && npm run build:next",
|
|
44
50
|
"prepare": "husky",
|
|
45
51
|
"release": "changeset publish",
|
|
46
|
-
"start:storybook": "npm run build && cd docs/storybook && npm run storybook",
|
|
47
|
-
"test": "jest --verbose --coverage"
|
|
52
|
+
"start:storybook": "npm run build:next && cd docs/storybook && npm run storybook",
|
|
53
|
+
"test": "jest --verbose --coverage",
|
|
54
|
+
"watch": "ls data/**/*.scss scripts/**/*.ts | entr -s 'npm run build'"
|
|
48
55
|
},
|
|
49
56
|
"prettier": "@github/prettier-config",
|
|
50
57
|
"devDependencies": {
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
shadowToCss,
|
|
24
24
|
typographyToCss,
|
|
25
25
|
dimensionToRemPxArray,
|
|
26
|
-
floatToPixel,
|
|
27
26
|
} from './transformers'
|
|
28
27
|
import {
|
|
29
28
|
javascriptCommonJs,
|
|
@@ -133,11 +132,6 @@ StyleDictionary.registerTransform({
|
|
|
133
132
|
...colorToHex,
|
|
134
133
|
})
|
|
135
134
|
|
|
136
|
-
StyleDictionary.registerTransform({
|
|
137
|
-
name: 'float/pixel',
|
|
138
|
-
...floatToPixel,
|
|
139
|
-
})
|
|
140
|
-
|
|
141
135
|
StyleDictionary.registerTransform({
|
|
142
136
|
name: 'dimension/rem',
|
|
143
137
|
...dimensionToRem,
|
package/src/filters/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ export {isDeprecated} from './isDeprecated'
|
|
|
7
7
|
export {isFromFile} from './isFromFile'
|
|
8
8
|
export {isFontFamily} from './isFontFamily'
|
|
9
9
|
export {isFontWeight} from './isFontWeight'
|
|
10
|
-
export {isNumber} from './isNumber'
|
|
11
10
|
export {isShadow} from './isShadow'
|
|
12
11
|
export {isSource} from './isSource'
|
|
13
12
|
export {isTypography} from './isTypography'
|
package/src/formats/jsonFigma.ts
CHANGED
package/src/platforms/figma.ts
CHANGED
|
@@ -3,11 +3,9 @@ import type {PlatformInitializer} from '../types/PlatformInitializer'
|
|
|
3
3
|
import {isSource} from '../filters'
|
|
4
4
|
|
|
5
5
|
const validFigmaToken = (token: StyleDictionary.TransformedToken) => {
|
|
6
|
-
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily'
|
|
6
|
+
const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily']
|
|
7
7
|
// is a siource token, not an included one
|
|
8
8
|
if (!isSource(token)) return false
|
|
9
|
-
|
|
10
|
-
if (`${token.value}`.substring(token.value.length - 2) === 'em') return false
|
|
11
9
|
// has a collection attribute
|
|
12
10
|
if (
|
|
13
11
|
!('$extensions' in token) ||
|
|
@@ -1056,71 +1056,5 @@
|
|
|
1056
1056
|
},
|
|
1057
1057
|
},
|
|
1058
1058
|
},
|
|
1059
|
-
pink: {
|
|
1060
|
-
bgColor: {
|
|
1061
|
-
muted: {
|
|
1062
|
-
$value: '{base.display.color.pink.0}',
|
|
1063
|
-
$type: 'color',
|
|
1064
|
-
$extensions: {
|
|
1065
|
-
'org.primer.figma': {
|
|
1066
|
-
collection: 'mode',
|
|
1067
|
-
mode: 'light',
|
|
1068
|
-
group: 'component (internal)',
|
|
1069
|
-
scopes: ['bgColor'],
|
|
1070
|
-
},
|
|
1071
|
-
},
|
|
1072
|
-
},
|
|
1073
|
-
emphasis: {
|
|
1074
|
-
$value: '{base.display.color.pink.5}',
|
|
1075
|
-
$type: 'color',
|
|
1076
|
-
$extensions: {
|
|
1077
|
-
'org.primer.figma': {
|
|
1078
|
-
collection: 'mode',
|
|
1079
|
-
mode: 'light',
|
|
1080
|
-
group: 'component (internal)',
|
|
1081
|
-
scopes: ['bgColor'],
|
|
1082
|
-
},
|
|
1083
|
-
},
|
|
1084
|
-
},
|
|
1085
|
-
},
|
|
1086
|
-
fgColor: {
|
|
1087
|
-
$value: '{base.display.color.pink.6}',
|
|
1088
|
-
$type: 'color',
|
|
1089
|
-
$extensions: {
|
|
1090
|
-
'org.primer.figma': {
|
|
1091
|
-
collection: 'mode',
|
|
1092
|
-
mode: 'light',
|
|
1093
|
-
group: 'component (internal)',
|
|
1094
|
-
scopes: ['fgColor'],
|
|
1095
|
-
},
|
|
1096
|
-
},
|
|
1097
|
-
},
|
|
1098
|
-
borderColor: {
|
|
1099
|
-
muted: {
|
|
1100
|
-
$value: '{base.display.color.pink.1}',
|
|
1101
|
-
$type: 'color',
|
|
1102
|
-
$extensions: {
|
|
1103
|
-
'org.primer.figma': {
|
|
1104
|
-
collection: 'mode',
|
|
1105
|
-
mode: 'light',
|
|
1106
|
-
group: 'component (internal)',
|
|
1107
|
-
scopes: ['borderColor'],
|
|
1108
|
-
},
|
|
1109
|
-
},
|
|
1110
|
-
},
|
|
1111
|
-
emphasis: {
|
|
1112
|
-
$value: '{base.display.color.pink.5}',
|
|
1113
|
-
$type: 'color',
|
|
1114
|
-
$extensions: {
|
|
1115
|
-
'org.primer.figma': {
|
|
1116
|
-
collection: 'mode',
|
|
1117
|
-
mode: 'light',
|
|
1118
|
-
group: 'component (internal)',
|
|
1119
|
-
scopes: ['borderColor'],
|
|
1120
|
-
},
|
|
1121
|
-
},
|
|
1122
|
-
},
|
|
1123
|
-
},
|
|
1124
|
-
},
|
|
1125
1059
|
},
|
|
1126
1060
|
}
|
|
@@ -1056,71 +1056,5 @@
|
|
|
1056
1056
|
},
|
|
1057
1057
|
},
|
|
1058
1058
|
},
|
|
1059
|
-
pink: {
|
|
1060
|
-
bgColor: {
|
|
1061
|
-
muted: {
|
|
1062
|
-
$value: '{base.display.color.pink.0}',
|
|
1063
|
-
$type: 'color',
|
|
1064
|
-
$extensions: {
|
|
1065
|
-
'org.primer.figma': {
|
|
1066
|
-
collection: 'mode',
|
|
1067
|
-
mode: 'light',
|
|
1068
|
-
group: 'component (internal)',
|
|
1069
|
-
scopes: ['bgColor'],
|
|
1070
|
-
},
|
|
1071
|
-
},
|
|
1072
|
-
},
|
|
1073
|
-
emphasis: {
|
|
1074
|
-
$value: '{base.display.color.pink.5}',
|
|
1075
|
-
$type: 'color',
|
|
1076
|
-
$extensions: {
|
|
1077
|
-
'org.primer.figma': {
|
|
1078
|
-
collection: 'mode',
|
|
1079
|
-
mode: 'light',
|
|
1080
|
-
group: 'component (internal)',
|
|
1081
|
-
scopes: ['bgColor'],
|
|
1082
|
-
},
|
|
1083
|
-
},
|
|
1084
|
-
},
|
|
1085
|
-
},
|
|
1086
|
-
fgColor: {
|
|
1087
|
-
$value: '{base.display.color.pink.6}',
|
|
1088
|
-
$type: 'color',
|
|
1089
|
-
$extensions: {
|
|
1090
|
-
'org.primer.figma': {
|
|
1091
|
-
collection: 'mode',
|
|
1092
|
-
mode: 'light',
|
|
1093
|
-
group: 'component (internal)',
|
|
1094
|
-
scopes: ['fgColor'],
|
|
1095
|
-
},
|
|
1096
|
-
},
|
|
1097
|
-
},
|
|
1098
|
-
borderColor: {
|
|
1099
|
-
muted: {
|
|
1100
|
-
$value: '{base.display.color.pink.1}',
|
|
1101
|
-
$type: 'color',
|
|
1102
|
-
$extensions: {
|
|
1103
|
-
'org.primer.figma': {
|
|
1104
|
-
collection: 'mode',
|
|
1105
|
-
mode: 'light',
|
|
1106
|
-
group: 'component (internal)',
|
|
1107
|
-
scopes: ['borderColor'],
|
|
1108
|
-
},
|
|
1109
|
-
},
|
|
1110
|
-
},
|
|
1111
|
-
emphasis: {
|
|
1112
|
-
$value: '{base.display.color.pink.5}',
|
|
1113
|
-
$type: 'color',
|
|
1114
|
-
$extensions: {
|
|
1115
|
-
'org.primer.figma': {
|
|
1116
|
-
collection: 'mode',
|
|
1117
|
-
mode: 'light',
|
|
1118
|
-
group: 'component (internal)',
|
|
1119
|
-
scopes: ['borderColor'],
|
|
1120
|
-
},
|
|
1121
|
-
},
|
|
1122
|
-
},
|
|
1123
|
-
},
|
|
1124
|
-
},
|
|
1125
1059
|
},
|
|
1126
1060
|
}
|
|
@@ -2,33 +2,15 @@
|
|
|
2
2
|
"fontStack": {
|
|
3
3
|
"system": {
|
|
4
4
|
"$value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
5
|
-
"$type": "fontFamily"
|
|
6
|
-
"$extensions": {
|
|
7
|
-
"org.primer.figma": {
|
|
8
|
-
"collection": "typography",
|
|
9
|
-
"scopes": ["all"]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
5
|
+
"$type": "fontFamily"
|
|
12
6
|
},
|
|
13
7
|
"sansSerif": {
|
|
14
8
|
"$value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
|
|
15
|
-
"$type": "fontFamily"
|
|
16
|
-
"$extensions": {
|
|
17
|
-
"org.primer.figma": {
|
|
18
|
-
"collection": "typography",
|
|
19
|
-
"scopes": ["all"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
9
|
+
"$type": "fontFamily"
|
|
22
10
|
},
|
|
23
11
|
"monospace": {
|
|
24
12
|
"$value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
25
|
-
"$type": "fontFamily"
|
|
26
|
-
"$extensions": {
|
|
27
|
-
"org.primer.figma": {
|
|
28
|
-
"collection": "typography",
|
|
29
|
-
"scopes": ["all"]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
13
|
+
"$type": "fontFamily"
|
|
32
14
|
}
|
|
33
15
|
},
|
|
34
16
|
"text": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type StyleDictionary from 'style-dictionary'
|
|
2
2
|
import {isFontFamily} from '../filters'
|
|
3
3
|
import {getTokenValue} from './utilities/getTokenValue'
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const hasSpaceInName = (string: string) => /\s/g.test(string)
|
|
5
6
|
/**
|
|
6
7
|
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
7
8
|
* @param value
|
|
@@ -17,7 +18,7 @@ export const parseFontFamily = (value: unknown): string => {
|
|
|
17
18
|
if (typeof string !== 'string') {
|
|
18
19
|
throw new Error(`Invalid value in array ${string}, must be a string`)
|
|
19
20
|
}
|
|
20
|
-
return
|
|
21
|
+
return hasSpaceInName(string) ? `'${string}'` : string
|
|
21
22
|
})
|
|
22
23
|
.join(', ')
|
|
23
24
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type StyleDictionary from 'style-dictionary'
|
|
2
2
|
import {isFontFamily} from '../filters'
|
|
3
|
-
import {hasSpaceInString} from './utilities/hasSpaceInString'
|
|
4
3
|
/**
|
|
5
4
|
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
6
5
|
* @param value
|
|
@@ -18,17 +17,6 @@ export const parseFontFamily = (
|
|
|
18
17
|
if (typeof token.value === 'string') {
|
|
19
18
|
return token.value
|
|
20
19
|
}
|
|
21
|
-
// return stringified array
|
|
22
|
-
if (Array.isArray(token.value)) {
|
|
23
|
-
return token.value
|
|
24
|
-
.map((string: string) => {
|
|
25
|
-
if (typeof string !== 'string') {
|
|
26
|
-
throw new Error(`Invalid value in array ${string}, must be a string`)
|
|
27
|
-
}
|
|
28
|
-
return hasSpaceInString(string) ? `'${string}'` : string
|
|
29
|
-
})
|
|
30
|
-
.join(', ')
|
|
31
|
-
}
|
|
32
20
|
// invalid value
|
|
33
21
|
throw new Error(`Invalid value ${token.value}, should be a string or array of strings`)
|
|
34
22
|
}
|
|
@@ -4,7 +4,6 @@ export {colorToHexAlpha} from './colorToHexAlpha'
|
|
|
4
4
|
export {colorToHexMix} from './colorToHexMix'
|
|
5
5
|
export {colorToRgbAlpha} from './colorToRgbAlpha'
|
|
6
6
|
export {colorToRgbaFloat} from './colorToRgbaFloat'
|
|
7
|
-
export {floatToPixel} from './floatToPixel'
|
|
8
7
|
export {dimensionToRem} from './dimensionToRem'
|
|
9
8
|
export {dimensionToRemPxArray} from './dimensionToRemPxArray'
|
|
10
9
|
export {dimensionToPixelUnitless} from './dimensionToPixelUnitless'
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"base": {
|
|
3
|
+
"size": {
|
|
4
|
+
"4": {
|
|
5
|
+
"value": "4px"
|
|
6
|
+
},
|
|
7
|
+
"8": {
|
|
8
|
+
"value": "8px"
|
|
9
|
+
},
|
|
10
|
+
"12": {
|
|
11
|
+
"value": "12px"
|
|
12
|
+
},
|
|
13
|
+
"16": {
|
|
14
|
+
"value": "16px"
|
|
15
|
+
},
|
|
16
|
+
"20": {
|
|
17
|
+
"value": "20px"
|
|
18
|
+
},
|
|
19
|
+
"24": {
|
|
20
|
+
"value": "24px"
|
|
21
|
+
},
|
|
22
|
+
"28": {
|
|
23
|
+
"value": "28px"
|
|
24
|
+
},
|
|
25
|
+
"32": {
|
|
26
|
+
"value": "32px"
|
|
27
|
+
},
|
|
28
|
+
"36": {
|
|
29
|
+
"value": "36px"
|
|
30
|
+
},
|
|
31
|
+
"40": {
|
|
32
|
+
"value": "40px"
|
|
33
|
+
},
|
|
34
|
+
"44": {
|
|
35
|
+
"value": "44px"
|
|
36
|
+
},
|
|
37
|
+
"48": {
|
|
38
|
+
"value": "48px"
|
|
39
|
+
},
|
|
40
|
+
"64": {
|
|
41
|
+
"value": "64px"
|
|
42
|
+
},
|
|
43
|
+
"80": {
|
|
44
|
+
"value": "80px"
|
|
45
|
+
},
|
|
46
|
+
"96": {
|
|
47
|
+
"value": "96px"
|
|
48
|
+
},
|
|
49
|
+
"112": {
|
|
50
|
+
"value": "112px"
|
|
51
|
+
},
|
|
52
|
+
"128": {
|
|
53
|
+
"value": "128px"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"<namespace>": {
|
|
3
|
+
"borderInset": {
|
|
4
|
+
"thin": {
|
|
5
|
+
"value": "inset 0 0 0 {<namespace>.borderWidth.thin}"
|
|
6
|
+
},
|
|
7
|
+
"thick": {
|
|
8
|
+
"value": "inset 0 0 0 {<namespace>.borderWidth.thick}"
|
|
9
|
+
},
|
|
10
|
+
"thicker": {
|
|
11
|
+
"value": "inset 0 0 0 {<namespace>.borderWidth.thicker}"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"borderWidth": {
|
|
15
|
+
"thin": {
|
|
16
|
+
"value": "max(1px, 0.0625rem)"
|
|
17
|
+
},
|
|
18
|
+
"thick": {
|
|
19
|
+
"value": "max(2px, 0.125rem)"
|
|
20
|
+
},
|
|
21
|
+
"thicker": {
|
|
22
|
+
"value": "max(4px, 0.25rem)"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"borderRadius": {
|
|
26
|
+
"small": {
|
|
27
|
+
"value": "3px"
|
|
28
|
+
},
|
|
29
|
+
"medium": {
|
|
30
|
+
"value": "6px"
|
|
31
|
+
},
|
|
32
|
+
"large": {
|
|
33
|
+
"value": "12px"
|
|
34
|
+
},
|
|
35
|
+
"full": {
|
|
36
|
+
"value": "100vh"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"outline": {
|
|
41
|
+
"focus": {
|
|
42
|
+
"offset": {
|
|
43
|
+
"$value": "1px",
|
|
44
|
+
"$type": "dimension"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|