@primer/primitives 7.17.0-rc.6fa44402 → 7.17.0-rc.8ff6ed39
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/package.json +1 -1
- package/src/PrimerStyleDictionary.ts +0 -6
- package/src/platforms/figma.ts +0 -6
- package/src/transformers/fontFamilyToCss.ts +4 -3
- package/src/transformers/index.ts +0 -1
- package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
- package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
- package/src/transformers/fontFamilyToFigma.ts +0 -47
- package/src/transformers/utilities/hasSpaceInString.ts +0 -6
package/package.json
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
durationToCss,
|
|
13
13
|
figmaAttributes,
|
|
14
14
|
fontFamilyToCss,
|
|
15
|
-
fontFamilyToFigma,
|
|
16
15
|
fontWeightToNumber,
|
|
17
16
|
jsonDeprecated,
|
|
18
17
|
namePathToDotNotation,
|
|
@@ -217,11 +216,6 @@ StyleDictionary.registerTransform({
|
|
|
217
216
|
...fontFamilyToCss,
|
|
218
217
|
})
|
|
219
218
|
|
|
220
|
-
StyleDictionary.registerTransform({
|
|
221
|
-
name: 'fontFamily/figma',
|
|
222
|
-
...fontFamilyToFigma,
|
|
223
|
-
})
|
|
224
|
-
|
|
225
219
|
/**
|
|
226
220
|
* @name {@link PrimerStyleDictionary}
|
|
227
221
|
* @description Returns style dictionary object with primer preset that includes parsers, formats and transformers
|
package/src/platforms/figma.ts
CHANGED
|
@@ -25,7 +25,6 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
|
|
|
25
25
|
'name/pathToFigma',
|
|
26
26
|
// 'name/pathToSlashNotation',
|
|
27
27
|
'figma/attributes',
|
|
28
|
-
'fontFamily/figma',
|
|
29
28
|
'dimension/pixelUnitless',
|
|
30
29
|
// 'border/figma',
|
|
31
30
|
// 'typography/figma',
|
|
@@ -33,11 +32,6 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
|
|
|
33
32
|
],
|
|
34
33
|
options: {
|
|
35
34
|
basePxFontSize: 16,
|
|
36
|
-
fontFamilies: {
|
|
37
|
-
'fontStack/system': 'SF Pro Text',
|
|
38
|
-
'fontStack/sansSerif': 'SF Pro Text',
|
|
39
|
-
'fontStack/monospace': 'SF Mono',
|
|
40
|
-
},
|
|
41
35
|
...options,
|
|
42
36
|
},
|
|
43
37
|
files: [
|
|
@@ -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
|
}
|
|
@@ -27,7 +28,7 @@ export const parseFontFamily = (value: unknown): string => {
|
|
|
27
28
|
* @description converts fontFamily tokens value to string
|
|
28
29
|
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
29
30
|
* @matcher matches all tokens of $type `fontFamily`
|
|
30
|
-
* @transformer returns a
|
|
31
|
+
* @transformer returns a number
|
|
31
32
|
*/
|
|
32
33
|
export const fontFamilyToCss: StyleDictionary.Transform = {
|
|
33
34
|
type: `value`,
|
|
@@ -10,7 +10,6 @@ export {dimensionToPixelUnitless} from './dimensionToPixelUnitless'
|
|
|
10
10
|
export {durationToCss} from './durationToCss'
|
|
11
11
|
export {figmaAttributes} from './figmaAttributes'
|
|
12
12
|
export {fontFamilyToCss} from './fontFamilyToCss'
|
|
13
|
-
export {fontFamilyToFigma} from './fontFamilyToFigma'
|
|
14
13
|
export {fontWeightToNumber} from './fontWeightToNumber'
|
|
15
14
|
export {jsonDeprecated} from './jsonDeprecated'
|
|
16
15
|
export {namePathToCamelCase} from './namePathToCamelCase'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu, 18 Apr 2024 11:
|
|
3
|
+
* Generated on Thu, 18 Apr 2024 08:11:38 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export const PrimerFontStackSystem = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary'
|
|
2
|
-
import {isFontFamily} from '../filters'
|
|
3
|
-
import {hasSpaceInString} from './utilities/hasSpaceInString'
|
|
4
|
-
/**
|
|
5
|
-
* takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
|
|
6
|
-
* @param value
|
|
7
|
-
* @returns string
|
|
8
|
-
*/
|
|
9
|
-
export const parseFontFamily = (
|
|
10
|
-
token: StyleDictionary.TransformedToken,
|
|
11
|
-
fontFamilies: Record<string, string> = {},
|
|
12
|
-
): string => {
|
|
13
|
-
// return value from fontFamilies
|
|
14
|
-
if (token.name in fontFamilies) {
|
|
15
|
-
return fontFamilies[token.name]
|
|
16
|
-
}
|
|
17
|
-
// return string
|
|
18
|
-
if (typeof token.value === 'string') {
|
|
19
|
-
return token.value
|
|
20
|
-
}
|
|
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
|
-
// invalid value
|
|
33
|
-
throw new Error(`Invalid value ${token.value}, should be a string or array of strings`)
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @description converts fontFamily tokens value to string
|
|
37
|
-
* @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
|
|
38
|
-
* @matcher matches all tokens of $type `fontFamily`
|
|
39
|
-
* @transformer returns a string
|
|
40
|
-
*/
|
|
41
|
-
export const fontFamilyToFigma: StyleDictionary.Transform = {
|
|
42
|
-
type: `value`,
|
|
43
|
-
transitive: true,
|
|
44
|
-
matcher: isFontFamily,
|
|
45
|
-
transformer: (token: StyleDictionary.TransformedToken, platform: StyleDictionary.Platform): string =>
|
|
46
|
-
parseFontFamily(token, platform.options?.fontFamilies),
|
|
47
|
-
}
|