@skyscanner/bpk-foundations-web 19.2.0 → 19.4.1
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/README.md +4 -4
- package/gulpfile.mjs +117 -0
- package/package.json +4 -4
- package/tokens/base.common.js +1 -0
- package/tokens/base.default.scss +2 -0
- package/tokens/base.es6.d.ts +2 -0
- package/tokens/base.es6.js +2 -0
- package/tokens/base.raw.json +7 -0
- package/tokens/base.scss +2 -0
package/README.md
CHANGED
|
@@ -26,9 +26,9 @@ For web:
|
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
// Individual tokens
|
|
29
|
-
import {
|
|
29
|
+
import { colorSkyGrayTint01 } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
30
30
|
|
|
31
|
-
console.log(
|
|
31
|
+
console.log(colorSkyGrayTint01);
|
|
32
32
|
|
|
33
33
|
// Whole token categories
|
|
34
34
|
import { colors } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
@@ -45,9 +45,9 @@ console.log(tokens);
|
|
|
45
45
|
|
|
46
46
|
```js
|
|
47
47
|
// Individual tokens
|
|
48
|
-
import {
|
|
48
|
+
import { colorSkyGrayTint01 } from '@skyscanner/bpk-foundations-web/tokens/base.common';
|
|
49
49
|
|
|
50
|
-
console.log(
|
|
50
|
+
console.log(colorSkyGrayTint01);
|
|
51
51
|
|
|
52
52
|
// All tokens
|
|
53
53
|
import * as tokens from '@skyscanner/bpk-foundations-web/tokens/base.common';
|
package/gulpfile.mjs
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016-2021 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import path from 'path';
|
|
20
|
+
import { fileURLToPath } from 'url';
|
|
21
|
+
|
|
22
|
+
import { deleteAsync } from 'del';
|
|
23
|
+
import gulp from 'gulp';
|
|
24
|
+
import jsonLint from 'gulp-jsonlint';
|
|
25
|
+
import gulpTheo from 'gulp-theo';
|
|
26
|
+
import _ from 'lodash';
|
|
27
|
+
import gulpMerge from 'merge2';
|
|
28
|
+
import theo from 'theo';
|
|
29
|
+
|
|
30
|
+
import bpkEs6Js from './formatters/bpk.es6.js.mjs';
|
|
31
|
+
import bpkCommonJs from './formatters/bpk.common.js.mjs';
|
|
32
|
+
import bpkDts from './formatters/bpk.d.ts.mjs';
|
|
33
|
+
|
|
34
|
+
import bpkScss from './formatters/bpk.scss.mjs';
|
|
35
|
+
import bpkDefaultScss from './formatters/bpk.default.scss.mjs';
|
|
36
|
+
|
|
37
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
38
|
+
const __dirname = path.dirname(__filename);
|
|
39
|
+
|
|
40
|
+
const RAW_FORMATS = {
|
|
41
|
+
web: ['raw.json'],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const PLATFORM_FORMATS = {
|
|
45
|
+
web: ['scss', 'default.scss', 'common.js', 'es6.js', 'es6.d.ts'],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const createTokenSets = (formats) =>
|
|
49
|
+
_.flatten(
|
|
50
|
+
Object.keys(formats).map((platform) =>
|
|
51
|
+
formats[platform].map((format) =>
|
|
52
|
+
typeof format !== 'string'
|
|
53
|
+
? { platform, ...format }
|
|
54
|
+
: { platform, format },
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const rawTokenSets = createTokenSets(RAW_FORMATS);
|
|
60
|
+
const platformTokenSets = createTokenSets(PLATFORM_FORMATS);
|
|
61
|
+
|
|
62
|
+
theo.registerFormat('scss', bpkScss);
|
|
63
|
+
theo.registerFormat('default.scss', bpkDefaultScss);
|
|
64
|
+
theo.registerFormat('es6.js', bpkEs6Js);
|
|
65
|
+
theo.registerFormat('common.js', bpkCommonJs);
|
|
66
|
+
theo.registerFormat('es6.d.ts', bpkDts);
|
|
67
|
+
|
|
68
|
+
gulp.task('clean', (done) => deleteAsync(['tokens'], done));
|
|
69
|
+
|
|
70
|
+
gulp.task('lint', () =>
|
|
71
|
+
gulp
|
|
72
|
+
.src('./src/*.json')
|
|
73
|
+
.pipe(jsonLint())
|
|
74
|
+
.pipe(jsonLint.reporter())
|
|
75
|
+
.pipe(jsonLint.failAfterError()),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const createTokens = (tokenSets, done) => {
|
|
79
|
+
const streams = tokenSets.map(({ format, nest, platform }) => {
|
|
80
|
+
let outputPath = 'tokens';
|
|
81
|
+
if (nest) {
|
|
82
|
+
outputPath = `${outputPath}/${platform}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return gulp
|
|
86
|
+
.src([`./src/*.json`])
|
|
87
|
+
.pipe(
|
|
88
|
+
gulpTheo({
|
|
89
|
+
transform: { type: platform },
|
|
90
|
+
format: { type: format },
|
|
91
|
+
}),
|
|
92
|
+
)
|
|
93
|
+
.on('error', done)
|
|
94
|
+
.pipe(gulp.dest(path.resolve(__dirname, outputPath)))
|
|
95
|
+
.on('error', done)
|
|
96
|
+
.on(`finish`, () => {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.log('Completed tokens');
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
gulpMerge(streams).on('finish', done);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const createRawTokens = (done) => createTokens(rawTokenSets, done);
|
|
106
|
+
const createPlatformTokens = (done) => createTokens(platformTokenSets, done);
|
|
107
|
+
|
|
108
|
+
gulp.task('tokens:raw', createRawTokens);
|
|
109
|
+
|
|
110
|
+
gulp.task('tokens:platform', createPlatformTokens);
|
|
111
|
+
|
|
112
|
+
gulp.task(
|
|
113
|
+
'tokens',
|
|
114
|
+
gulp.series(gulp.parallel('clean', 'lint'), 'tokens:raw', 'tokens:platform'),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
gulp.task('default', gulp.series('tokens'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/bpk-foundations-web",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.4.1",
|
|
4
4
|
"description": "Common Backpack design tokens for colors, spacing, font, etc.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"tokens": "gulp"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@skyscanner/bpk-foundations-common": "^
|
|
21
|
-
"color": "^
|
|
20
|
+
"@skyscanner/bpk-foundations-common": "^19.4.1",
|
|
21
|
+
"color": "^5.0.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "fce6283d9a98b0480a45aaab5480729bb66fbc15"
|
|
24
24
|
}
|
package/tokens/base.common.js
CHANGED
package/tokens/base.default.scss
CHANGED
|
@@ -667,6 +667,8 @@ $bpk-horizontal-nav-bar-selected-color: rgb(0, 98, 227) !default;
|
|
|
667
667
|
$bpk-icon-size-sm: 1rem !default;
|
|
668
668
|
/// @group icons
|
|
669
669
|
$bpk-icon-size-lg: 1.5rem !default;
|
|
670
|
+
/// @group icons
|
|
671
|
+
$bpk-icon-size-xl: 2rem !default;
|
|
670
672
|
/// @group modals
|
|
671
673
|
$bpk-modal-background-color: rgb(255, 255, 255) !default;
|
|
672
674
|
/// @group modals
|
package/tokens/base.es6.d.ts
CHANGED
|
@@ -342,6 +342,7 @@ export declare const inputDisabledBorderColor = "rgb(239, 243, 248)" as const;
|
|
|
342
342
|
export declare const horizontalNavBarSelectedColor = "rgb(0, 98, 227)" as const;
|
|
343
343
|
export declare const iconSizeSm = "1rem" as const;
|
|
344
344
|
export declare const iconSizeLg = "1.5rem" as const;
|
|
345
|
+
export declare const iconSizeXl = "2rem" as const;
|
|
345
346
|
export declare const modalBackgroundColor = "rgb(255, 255, 255)" as const;
|
|
346
347
|
export declare const modalInitialOpacity = "0" as const;
|
|
347
348
|
export declare const modalOpacity = "1" as const;
|
|
@@ -638,6 +639,7 @@ horizontalNavBarSelectedColor,
|
|
|
638
639
|
export declare const icons = {
|
|
639
640
|
iconSizeSm,
|
|
640
641
|
iconSizeLg,
|
|
642
|
+
iconSizeXl,
|
|
641
643
|
} as const;
|
|
642
644
|
export declare const infoBannerColors = {
|
|
643
645
|
privateInfoBannerDefaultDay,
|
package/tokens/base.es6.js
CHANGED
|
@@ -342,6 +342,7 @@ export const inputDisabledBorderColor = "rgb(239, 243, 248)";
|
|
|
342
342
|
export const horizontalNavBarSelectedColor = "rgb(0, 98, 227)";
|
|
343
343
|
export const iconSizeSm = "1rem";
|
|
344
344
|
export const iconSizeLg = "1.5rem";
|
|
345
|
+
export const iconSizeXl = "2rem";
|
|
345
346
|
export const modalBackgroundColor = "rgb(255, 255, 255)";
|
|
346
347
|
export const modalInitialOpacity = "0";
|
|
347
348
|
export const modalOpacity = "1";
|
|
@@ -638,6 +639,7 @@ horizontalNavBarSelectedColor,
|
|
|
638
639
|
export const icons = {
|
|
639
640
|
iconSizeSm,
|
|
640
641
|
iconSizeLg,
|
|
642
|
+
iconSizeXl,
|
|
641
643
|
};
|
|
642
644
|
export const infoBannerColors = {
|
|
643
645
|
privateInfoBannerDefaultDay,
|
package/tokens/base.raw.json
CHANGED
|
@@ -2808,6 +2808,13 @@
|
|
|
2808
2808
|
"originalValue": "1.5rem",
|
|
2809
2809
|
"name": "ICON_SIZE_LG"
|
|
2810
2810
|
},
|
|
2811
|
+
"ICON_SIZE_XL": {
|
|
2812
|
+
"type": "size",
|
|
2813
|
+
"category": "icons",
|
|
2814
|
+
"value": "2rem",
|
|
2815
|
+
"originalValue": "2rem",
|
|
2816
|
+
"name": "ICON_SIZE_XL"
|
|
2817
|
+
},
|
|
2811
2818
|
"MODAL_BACKGROUND_COLOR": {
|
|
2812
2819
|
"category": "modals",
|
|
2813
2820
|
"value": "rgb(255, 255, 255)",
|
package/tokens/base.scss
CHANGED
|
@@ -667,6 +667,8 @@ $bpk-horizontal-nav-bar-selected-color: rgb(0, 98, 227);
|
|
|
667
667
|
$bpk-icon-size-sm: 1rem;
|
|
668
668
|
/// @group icons
|
|
669
669
|
$bpk-icon-size-lg: 1.5rem;
|
|
670
|
+
/// @group icons
|
|
671
|
+
$bpk-icon-size-xl: 2rem;
|
|
670
672
|
/// @group modals
|
|
671
673
|
$bpk-modal-background-color: rgb(255, 255, 255);
|
|
672
674
|
/// @group modals
|