@lumx/core 3.0.7 → 3.1.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/{CONTRIBUTING.md → dist/CONTRIBUTING.md} +0 -0
- package/{LICENSE.md → dist/LICENSE.md} +0 -0
- package/{css → dist/css}/_retro-compat-v2.css +0 -0
- package/{css → dist/css}/design-tokens.css +0 -0
- package/{css → dist/css}/material.css +0 -0
- package/{js → dist/js}/constants/design-tokens.js +0 -0
- package/{js → dist/js}/constants/design-tokens.min.js +0 -0
- package/{js → dist/js}/constants/design-tokens.min.js.map +0 -0
- package/{js → dist/js}/constants/design-tokens.ts +0 -0
- package/{js → dist/js}/constants/index.js +0 -0
- package/{js → dist/js}/constants/index.min.js +0 -0
- package/{js → dist/js}/constants/index.min.js.map +0 -0
- package/{js → dist/js}/constants/index.ts +0 -0
- package/{js → dist/js}/constants/keycodes.js +0 -0
- package/{js → dist/js}/constants/keycodes.min.js +0 -0
- package/{js → dist/js}/constants/keycodes.min.js.map +0 -0
- package/{js → dist/js}/constants/keycodes.ts +0 -0
- package/{js → dist/js}/custom-colors.js +0 -0
- package/{js → dist/js}/custom-colors.min.js +0 -0
- package/dist/js/custom-colors.min.js.map +1 -0
- package/{js → dist/js}/custom-colors.ts +0 -0
- package/{js → dist/js}/date-picker.js +0 -0
- package/{js → dist/js}/date-picker.min.js +0 -0
- package/dist/js/date-picker.min.js.map +1 -0
- package/{js → dist/js}/date-picker.ts +0 -0
- package/{js → dist/js}/utils.js +0 -0
- package/{js → dist/js}/utils.min.js +0 -0
- package/dist/js/utils.min.js.map +1 -0
- package/{js → dist/js}/utils.ts +0 -0
- package/{lumx.css → dist/lumx.css} +1 -1
- package/{lumx.min.css → dist/lumx.min.css} +1 -1
- package/dist/package.json +81 -0
- package/{scss → dist/scss}/_components.scss +0 -0
- package/{scss → dist/scss}/_core.scss +0 -0
- package/{scss → dist/scss}/_design-tokens.scss +0 -0
- package/{scss → dist/scss}/_retro-compat-v2.scss +0 -0
- package/{scss → dist/scss}/components/avatar/_index.scss +0 -0
- package/{scss → dist/scss}/components/badge/_index.scss +0 -0
- package/{scss → dist/scss}/components/button/_index.scss +0 -0
- package/{scss → dist/scss}/components/button/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/button/_variables.scss +0 -0
- package/{scss → dist/scss}/components/checkbox/_index.scss +0 -0
- package/{scss → dist/scss}/components/checkbox/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/chip/_index.scss +0 -0
- package/{scss → dist/scss}/components/chip/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/chip/_variables.scss +0 -0
- package/{scss → dist/scss}/components/comment-block/_index.scss +0 -0
- package/{scss → dist/scss}/components/date-picker/_index.scss +0 -0
- package/{scss → dist/scss}/components/dialog/_index.scss +0 -0
- package/{scss → dist/scss}/components/dialog/_variables.scss +0 -0
- package/{scss → dist/scss}/components/divider/_index.scss +0 -0
- package/{scss → dist/scss}/components/divider/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/divider/_variables.scss +0 -0
- package/{scss → dist/scss}/components/drag-handle/_index.scss +0 -0
- package/{scss → dist/scss}/components/dropdown/_index.scss +0 -0
- package/{scss → dist/scss}/components/expansion-panel/_index.scss +0 -0
- package/{scss → dist/scss}/components/expansion-panel/_variables.scss +0 -0
- package/{scss → dist/scss}/components/flag/_index.scss +0 -0
- package/{scss → dist/scss}/components/flex-box/_index.scss +0 -0
- package/{scss → dist/scss}/components/generic-block/_index.scss +0 -0
- package/{scss → dist/scss}/components/grid/_index.scss +0 -0
- package/dist/scss/components/grid-column/_index.scss +18 -0
- package/{scss → dist/scss}/components/icon/_index.scss +0 -0
- package/{scss → dist/scss}/components/icon/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/icon/_variables.scss +0 -0
- package/{scss → dist/scss}/components/image-block/_index.scss +0 -0
- package/{scss → dist/scss}/components/inline-list/_index.scss +0 -0
- package/{scss → dist/scss}/components/input-helper/_index.scss +0 -0
- package/{scss → dist/scss}/components/input-helper/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/input-helper/_variables.scss +0 -0
- package/{scss → dist/scss}/components/input-label/_index.scss +0 -0
- package/{scss → dist/scss}/components/input-label/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/lightbox/_index.scss +0 -0
- package/{scss → dist/scss}/components/lightbox/_variables.scss +0 -0
- package/{scss → dist/scss}/components/link/_index.scss +0 -0
- package/{scss → dist/scss}/components/link/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/link-preview/_index.scss +0 -0
- package/{scss → dist/scss}/components/list/_index.scss +0 -0
- package/{scss → dist/scss}/components/list/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/list/_variables.scss +0 -0
- package/{scss → dist/scss}/components/message/_index.scss +0 -0
- package/{scss → dist/scss}/components/mosaic/_index.scss +0 -0
- package/{scss → dist/scss}/components/notification/_index.scss +0 -0
- package/{scss → dist/scss}/components/notification/_variables.scss +0 -0
- package/{scss → dist/scss}/components/notification-block/_index.scss +0 -0
- package/{scss → dist/scss}/components/popover/_index.scss +0 -0
- package/{scss → dist/scss}/components/popover/_variables.scss +0 -0
- package/{scss → dist/scss}/components/post-block/_index.scss +0 -0
- package/{scss → dist/scss}/components/progress/_index.scss +20 -0
- package/dist/scss/components/progress/_variables.scss +12 -0
- package/{scss → dist/scss}/components/progress-tracker/_index.scss +0 -0
- package/{scss → dist/scss}/components/progress-tracker/_variables.scss +0 -0
- package/{scss → dist/scss}/components/radio-button/_index.scss +0 -0
- package/{scss → dist/scss}/components/radio-button/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/select/_index.scss +0 -0
- package/{scss → dist/scss}/components/select/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/side-navigation/_index.scss +0 -0
- package/{scss → dist/scss}/components/side-navigation/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/skeleton/_index.scss +0 -0
- package/{scss → dist/scss}/components/skeleton/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/slider/_index.scss +0 -0
- package/{scss → dist/scss}/components/slideshow/_index.scss +0 -0
- package/{scss → dist/scss}/components/slideshow/_variables.scss +0 -0
- package/{scss → dist/scss}/components/switch/_index.scss +0 -0
- package/{scss → dist/scss}/components/switch/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/table/_index.scss +0 -0
- package/{scss → dist/scss}/components/table/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/tabs/_index.scss +0 -0
- package/{scss → dist/scss}/components/tabs/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/text/_index.scss +0 -0
- package/{scss → dist/scss}/components/text-field/_index.scss +0 -0
- package/{scss → dist/scss}/components/text-field/_mixins.scss +0 -0
- package/{scss → dist/scss}/components/text-field/_variables.scss +0 -0
- package/{scss → dist/scss}/components/thumbnail/_index.scss +0 -0
- package/{scss → dist/scss}/components/thumbnail/_variables.scss +0 -0
- package/{scss → dist/scss}/components/toolbar/_index.scss +0 -0
- package/{scss → dist/scss}/components/toolbar/_variables.scss +0 -0
- package/{scss → dist/scss}/components/tooltip/_index.scss +0 -0
- package/{scss → dist/scss}/components/tooltip/_variables.scss +0 -0
- package/{scss → dist/scss}/components/uploader/_index.scss +0 -0
- package/{scss → dist/scss}/components/user-block/_index.scss +0 -0
- package/{scss → dist/scss}/core/base/_functions.scss +0 -0
- package/{scss → dist/scss}/core/base/_helpers.scss +0 -0
- package/{scss → dist/scss}/core/base/_index.scss +0 -0
- package/{scss → dist/scss}/core/base/_normalize.scss +0 -0
- package/{scss → dist/scss}/core/base/_variables.scss +0 -0
- package/{scss → dist/scss}/core/color/_functions.scss +0 -0
- package/{scss → dist/scss}/core/color/_index.scss +0 -0
- package/{scss → dist/scss}/core/color/_variables.scss +0 -0
- package/{scss → dist/scss}/core/elevation/_mixins.scss +0 -0
- package/{scss → dist/scss}/core/elevation/_variables.scss +0 -0
- package/{scss → dist/scss}/core/size/_variables.scss +0 -0
- package/{scss → dist/scss}/core/spacing/_index.scss +0 -0
- package/{scss → dist/scss}/core/spacing/_variables.scss +0 -0
- package/{scss → dist/scss}/core/state/_mixins.scss +0 -0
- package/{scss → dist/scss}/core/state/_variables.scss +0 -0
- package/{scss → dist/scss}/core/typography/_index.scss +0 -0
- package/{scss → dist/scss}/core/typography/_mixins.scss +0 -0
- package/{scss → dist/scss}/core/typography/_variables.scss +0 -0
- package/{scss → dist/scss}/lumx.scss +1 -0
- package/package.json +4 -8
- package/src/css/_retro-compat-v2.css +117 -0
- package/src/css/design-tokens.css +544 -0
- package/src/css/material.css +62 -0
- package/src/js/constants/design-tokens.ts +2157 -0
- package/src/js/constants/index.ts +35 -0
- package/src/js/constants/keycodes.ts +44 -0
- package/src/js/custom-colors.ts +56 -0
- package/src/js/date-picker.ts +71 -0
- package/src/js/utils.ts +296 -0
- package/src/scss/_components.scss +35 -0
- package/src/scss/_core.scss +12 -0
- package/src/scss/_design-tokens.scss +1667 -0
- package/src/scss/_retro-compat-v2.scss +95 -0
- package/src/scss/components/avatar/_index.scss +42 -0
- package/src/scss/components/badge/_index.scss +47 -0
- package/src/scss/components/button/_index.scss +166 -0
- package/src/scss/components/button/_mixins.scss +271 -0
- package/src/scss/components/button/_variables.scss +6 -0
- package/src/scss/components/checkbox/_index.scss +231 -0
- package/src/scss/components/checkbox/_mixins.scss +69 -0
- package/src/scss/components/chip/_index.scss +156 -0
- package/src/scss/components/chip/_mixins.scss +37 -0
- package/src/scss/components/chip/_variables.scss +1 -0
- package/src/scss/components/comment-block/_index.scss +170 -0
- package/src/scss/components/date-picker/_index.scss +67 -0
- package/src/scss/components/dialog/_index.scss +169 -0
- package/src/scss/components/dialog/_variables.scss +8 -0
- package/src/scss/components/divider/_index.scss +39 -0
- package/src/scss/components/divider/_mixins.scss +60 -0
- package/src/scss/components/divider/_variables.scss +7 -0
- package/src/scss/components/drag-handle/_index.scss +7 -0
- package/src/scss/components/dropdown/_index.scss +22 -0
- package/src/scss/components/expansion-panel/_index.scss +80 -0
- package/src/scss/components/expansion-panel/_variables.scss +2 -0
- package/src/scss/components/flag/_index.scss +41 -0
- package/src/scss/components/flex-box/_index.scss +132 -0
- package/src/scss/components/generic-block/_index.scss +11 -0
- package/src/scss/components/grid/_index.scss +147 -0
- package/src/scss/components/grid-column/_index.scss +18 -0
- package/src/scss/components/icon/_index.scss +106 -0
- package/src/scss/components/icon/_mixins.scss +42 -0
- package/src/scss/components/icon/_variables.scss +6 -0
- package/src/scss/components/image-block/_index.scss +108 -0
- package/src/scss/components/inline-list/_index.scss +15 -0
- package/src/scss/components/input-helper/_index.scss +27 -0
- package/src/scss/components/input-helper/_mixins.scss +12 -0
- package/src/scss/components/input-helper/_variables.scss +1 -0
- package/src/scss/components/input-label/_index.scss +23 -0
- package/src/scss/components/input-label/_mixins.scss +12 -0
- package/src/scss/components/lightbox/_index.scss +59 -0
- package/src/scss/components/lightbox/_variables.scss +1 -0
- package/src/scss/components/link/_index.scss +35 -0
- package/src/scss/components/link/_mixins.scss +25 -0
- package/src/scss/components/link-preview/_index.scss +95 -0
- package/src/scss/components/list/_index.scss +96 -0
- package/src/scss/components/list/_mixins.scss +128 -0
- package/src/scss/components/list/_variables.scss +7 -0
- package/src/scss/components/message/_index.scss +36 -0
- package/src/scss/components/mosaic/_index.scss +120 -0
- package/src/scss/components/notification/_index.scss +78 -0
- package/src/scss/components/notification/_variables.scss +3 -0
- package/src/scss/components/notification-block/_index.scss +42 -0
- package/src/scss/components/popover/_index.scss +64 -0
- package/src/scss/components/popover/_variables.scss +1 -0
- package/src/scss/components/post-block/_index.scss +101 -0
- package/src/scss/components/progress/_index.scss +190 -0
- package/src/scss/components/progress/_variables.scss +12 -0
- package/src/scss/components/progress-tracker/_index.scss +131 -0
- package/src/scss/components/progress-tracker/_variables.scss +2 -0
- package/src/scss/components/radio-button/_index.scss +180 -0
- package/src/scss/components/radio-button/_mixins.scss +82 -0
- package/src/scss/components/select/_index.scss +295 -0
- package/src/scss/components/select/_mixins.scss +36 -0
- package/src/scss/components/side-navigation/_index.scss +69 -0
- package/src/scss/components/side-navigation/_mixins.scss +61 -0
- package/src/scss/components/skeleton/_index.scss +143 -0
- package/src/scss/components/skeleton/_mixins.scss +9 -0
- package/src/scss/components/slider/_index.scss +209 -0
- package/src/scss/components/slideshow/_index.scss +171 -0
- package/src/scss/components/slideshow/_variables.scss +1 -0
- package/src/scss/components/switch/_index.scss +257 -0
- package/src/scss/components/switch/_mixins.scss +77 -0
- package/src/scss/components/table/_index.scss +138 -0
- package/src/scss/components/table/_mixins.scss +115 -0
- package/src/scss/components/tabs/_index.scss +111 -0
- package/src/scss/components/tabs/_mixins.scss +104 -0
- package/src/scss/components/text/_index.scss +29 -0
- package/src/scss/components/text-field/_index.scss +323 -0
- package/src/scss/components/text-field/_mixins.scss +149 -0
- package/src/scss/components/text-field/_variables.scss +2 -0
- package/src/scss/components/thumbnail/_index.scss +227 -0
- package/src/scss/components/thumbnail/_variables.scss +6 -0
- package/src/scss/components/toolbar/_index.scss +38 -0
- package/src/scss/components/toolbar/_variables.scss +1 -0
- package/src/scss/components/tooltip/_index.scss +91 -0
- package/src/scss/components/tooltip/_variables.scss +4 -0
- package/src/scss/components/uploader/_index.scss +115 -0
- package/src/scss/components/user-block/_index.scss +106 -0
- package/src/scss/core/base/_functions.scss +3 -0
- package/src/scss/core/base/_helpers.scss +21 -0
- package/src/scss/core/base/_index.scss +54 -0
- package/src/scss/core/base/_normalize.scss +353 -0
- package/src/scss/core/base/_variables.scss +39 -0
- package/src/scss/core/color/_functions.scss +7 -0
- package/src/scss/core/color/_index.scss +15 -0
- package/src/scss/core/color/_variables.scss +4 -0
- package/src/scss/core/elevation/_mixins.scss +10 -0
- package/src/scss/core/elevation/_variables.scss +7 -0
- package/src/scss/core/size/_variables.scss +3 -0
- package/src/scss/core/spacing/_index.scss +15 -0
- package/src/scss/core/spacing/_variables.scss +22 -0
- package/src/scss/core/state/_mixins.scss +127 -0
- package/src/scss/core/state/_variables.scss +1 -0
- package/src/scss/core/typography/_index.scss +16 -0
- package/src/scss/core/typography/_mixins.scss +25 -0
- package/src/scss/core/typography/_variables.scss +6 -0
- package/src/scss/lumx.scss +69 -0
- package/style-dictionary/.eslintignore +1 -0
- package/style-dictionary/README.md +19 -0
- package/style-dictionary/config/_run.js +12 -0
- package/style-dictionary/config/_transform-group.js +16 -0
- package/style-dictionary/config/gen-css-variables.js +25 -0
- package/style-dictionary/config/gen-scss-variables.js +65 -0
- package/style-dictionary/config/gen-ts-variables.js +52 -0
- package/style-dictionary/config/utils/_color-attributes.js +24 -0
- package/style-dictionary/config/utils/_color-rgba-value.js +22 -0
- package/style-dictionary/config/utils/_css-prefer-variable.js +24 -0
- package/style-dictionary/config/utils/_genHeader.js +3 -0
- package/style-dictionary/config/utils/_lumx-variables.js +12 -0
- package/style-dictionary/config/utils/_pickFieldsInTree.js +22 -0
- package/style-dictionary/config/utils/_prettier-scss.js +13 -0
- package/style-dictionary/config/utils/_prettier-ts.js +13 -0
- package/style-dictionary/config/utils/_resolve-structure-alias.js +76 -0
- package/style-dictionary/index.js +11 -0
- package/style-dictionary/properties/components/button.json +206 -0
- package/style-dictionary/properties/components/material.json +64 -0
- package/style-dictionary/properties/components/navigation.json +207 -0
- package/style-dictionary/properties/components/tabs.json +168 -0
- package/style-dictionary/properties/components/text-field.json +167 -0
- package/style-dictionary/properties/core/border-radius.json +3 -0
- package/style-dictionary/properties/core/color.json +421 -0
- package/style-dictionary/properties/core/size.json +11 -0
- package/style-dictionary/properties/core/spacing.json +11 -0
- package/style-dictionary/properties/core/typography.json +127 -0
- package/tsconfig.json +3 -0
- package/webpack.config.js +202 -0
- package/js/custom-colors.min.js.map +0 -1
- package/js/date-picker.min.js.map +0 -1
- package/js/utils.min.js.map +0 -1
- package/scss/components/progress/_variables.scss +0 -2
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** LUMX THEME */
|
|
2
|
+
|
|
3
|
+
@import "~sass-mq";
|
|
4
|
+
@import "../css/design-tokens";
|
|
5
|
+
|
|
6
|
+
// TODO: remove in next major version
|
|
7
|
+
@import "../css/retro-compat-v2";
|
|
8
|
+
@import "./design-tokens";
|
|
9
|
+
|
|
10
|
+
// TODO: remove in next major version
|
|
11
|
+
@import "./retro-compat-v2";
|
|
12
|
+
@import "./core";
|
|
13
|
+
@import "./components";
|
|
14
|
+
@import "./core/base/normalize";
|
|
15
|
+
@import "./core/base/index";
|
|
16
|
+
@import "./core/base/helpers";
|
|
17
|
+
@import "./core/spacing/index";
|
|
18
|
+
@import "./core/color/index";
|
|
19
|
+
@import "./core/typography/index";
|
|
20
|
+
@import "./components/avatar/index";
|
|
21
|
+
@import "./components/badge/index";
|
|
22
|
+
@import "./components/button/index";
|
|
23
|
+
@import "./components/checkbox/index";
|
|
24
|
+
@import "./components/chip/index";
|
|
25
|
+
@import "./components/comment-block/index";
|
|
26
|
+
@import "./components/date-picker/index";
|
|
27
|
+
@import "./components/dialog/index";
|
|
28
|
+
@import "./components/divider/index";
|
|
29
|
+
@import "./components/drag-handle/index";
|
|
30
|
+
@import "./components/dropdown/index";
|
|
31
|
+
@import "./components/expansion-panel/index";
|
|
32
|
+
@import "./components/flag/index";
|
|
33
|
+
@import "./components/flex-box/index";
|
|
34
|
+
@import "./components/generic-block/index";
|
|
35
|
+
@import "./components/grid/index";
|
|
36
|
+
@import "./components/grid-column/index";
|
|
37
|
+
@import "./components/icon/index";
|
|
38
|
+
@import "./components/image-block/index";
|
|
39
|
+
@import "./components/inline-list/index";
|
|
40
|
+
@import "./components/input-helper/index";
|
|
41
|
+
@import "./components/input-label/index";
|
|
42
|
+
@import "./components/lightbox/index";
|
|
43
|
+
@import "./components/link/index";
|
|
44
|
+
@import "./components/link-preview/index";
|
|
45
|
+
@import "./components/list/index";
|
|
46
|
+
@import "./components/message/index";
|
|
47
|
+
@import "./components/mosaic/index";
|
|
48
|
+
@import "./components/notification/index";
|
|
49
|
+
@import "./components/notification-block/index";
|
|
50
|
+
@import "./components/popover/index";
|
|
51
|
+
@import "./components/post-block/index";
|
|
52
|
+
@import "./components/progress/index";
|
|
53
|
+
@import "./components/progress-tracker/index";
|
|
54
|
+
@import "./components/radio-button/index";
|
|
55
|
+
@import "./components/select/index";
|
|
56
|
+
@import "./components/side-navigation/index";
|
|
57
|
+
@import "./components/skeleton/index";
|
|
58
|
+
@import "./components/slideshow/index";
|
|
59
|
+
@import "./components/slider/index";
|
|
60
|
+
@import "./components/switch/index";
|
|
61
|
+
@import "./components/table/index";
|
|
62
|
+
@import "./components/tabs/index";
|
|
63
|
+
@import "./components/text/index";
|
|
64
|
+
@import "./components/text-field/index";
|
|
65
|
+
@import "./components/thumbnail/index";
|
|
66
|
+
@import "./components/toolbar/index";
|
|
67
|
+
@import "./components/tooltip/index";
|
|
68
|
+
@import "./components/uploader/index";
|
|
69
|
+
@import "./components/user-block/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Style dictionary
|
|
2
|
+
|
|
3
|
+
This folder contains the [style dictionary](https://amzn.github.io/style-dictionary/) for the LumX Design System.
|
|
4
|
+
|
|
5
|
+
## Directory structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
- properties => style dictionary properties
|
|
9
|
+
- config => build configs (export to SCSS, to TS, etc.)
|
|
10
|
+
- index.js => main build script
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Generate code (SCSS, JS, etc.) from the style dictionary
|
|
14
|
+
|
|
15
|
+
To generate everything, simply run:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
yarn generate:design-tokens
|
|
19
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const resolveStructureAlias = require('./utils/_resolve-structure-alias');
|
|
2
|
+
const StyleDictionary = require('style-dictionary');
|
|
3
|
+
|
|
4
|
+
const [config] = process.argv.slice(2);
|
|
5
|
+
if (config) {
|
|
6
|
+
// Load style dictionary config.
|
|
7
|
+
const dictionary = StyleDictionary.extend(require(`./${config}`)());
|
|
8
|
+
resolveStructureAlias(dictionary.properties);
|
|
9
|
+
|
|
10
|
+
// Build.
|
|
11
|
+
dictionary.buildAllPlatforms();
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const StyleDictionary = require("style-dictionary");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Transform group:
|
|
5
|
+
*/
|
|
6
|
+
const name = "transform-group-custom";
|
|
7
|
+
StyleDictionary.registerTransformGroup({
|
|
8
|
+
name,
|
|
9
|
+
transforms: [
|
|
10
|
+
require("./utils/_lumx-variables"),
|
|
11
|
+
require("./utils/_color-attributes"),
|
|
12
|
+
require("./utils/_color-rgba-value"),
|
|
13
|
+
require("./utils/_css-prefer-variable")
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
module.exports = name;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const transformGroup = require('./_transform-group');
|
|
3
|
+
|
|
4
|
+
module.exports = () => {
|
|
5
|
+
const baseDir = `${__dirname}/../`;
|
|
6
|
+
const buildPath = `${path.resolve(baseDir, `../src/css/`)}/`;
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
source: [`${baseDir}/properties/**/*.json`],
|
|
10
|
+
platforms: {
|
|
11
|
+
css: {
|
|
12
|
+
transformGroup,
|
|
13
|
+
buildPath,
|
|
14
|
+
files: [
|
|
15
|
+
{
|
|
16
|
+
format: 'css/variables',
|
|
17
|
+
destination: 'design-tokens.css',
|
|
18
|
+
mapName: 'lumx-design-tokens',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
actions: [require('./utils/_prettier-scss')({ buildPath })],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const StyleDictionary = require('style-dictionary');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const _ = require('lodash');
|
|
4
|
+
const transformGroup = require('./_transform-group');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SCSS generator
|
|
8
|
+
* Inspired by https://raw.githubusercontent.com/amzn/style-dictionary/9d867ef3ad72cf68557434ce1a28ba996a5ac467/lib/common/templates/scss/map-deep.template
|
|
9
|
+
*/
|
|
10
|
+
const format = 'scss/custom-map-deep';
|
|
11
|
+
StyleDictionary.registerFormat({
|
|
12
|
+
name: format,
|
|
13
|
+
formatter(dictionary, depth = 0) {
|
|
14
|
+
// List SCSS variables.
|
|
15
|
+
const scssVariables = dictionary.allProperties
|
|
16
|
+
.map(({ name, value, comment }) => `$${name}: ${value} !default;${comment ? ` // ${comment}` : ''}`)
|
|
17
|
+
.join('\n');
|
|
18
|
+
|
|
19
|
+
// Build SCSS map (from SCSS variable values).
|
|
20
|
+
function processProperties(prop) {
|
|
21
|
+
const indent = ' '.repeat(depth + 1);
|
|
22
|
+
if (prop.hasOwnProperty('value')) {
|
|
23
|
+
return `$${prop.name}`;
|
|
24
|
+
} else {
|
|
25
|
+
const subProps = Object.keys(prop)
|
|
26
|
+
.filter(key => !key.startsWith('$') &&_.isPlainObject(prop[key]))
|
|
27
|
+
.map((key) => `${indent}'${key}': ${processProperties(prop[key], depth + 1)}`)
|
|
28
|
+
.join(',\n');
|
|
29
|
+
return `(\n${subProps}\n${' '.repeat(depth)})`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const scssMapName = this.mapName || 'tokens';
|
|
33
|
+
const scssMap = `$${scssMapName}: ${processProperties(dictionary.properties)} !default;`;
|
|
34
|
+
|
|
35
|
+
return `
|
|
36
|
+
${require('./utils/_genHeader')()}
|
|
37
|
+
|
|
38
|
+
${scssVariables}
|
|
39
|
+
|
|
40
|
+
${scssMap}
|
|
41
|
+
`;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
module.exports = () => {
|
|
46
|
+
const baseDir = `${__dirname}/../`;
|
|
47
|
+
const buildPath = `${path.resolve(baseDir, `../src/scss/`)}/`;
|
|
48
|
+
return {
|
|
49
|
+
source: [`${baseDir}/properties/**/*.json`],
|
|
50
|
+
platforms: {
|
|
51
|
+
scss: {
|
|
52
|
+
transformGroup,
|
|
53
|
+
buildPath,
|
|
54
|
+
files: [
|
|
55
|
+
{
|
|
56
|
+
destination: '_design-tokens.scss',
|
|
57
|
+
format,
|
|
58
|
+
mapName: 'lumx-design-tokens',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
actions: [require('./utils/_prettier-scss')({ buildPath })],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const StyleDictionary = require('style-dictionary');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const pickFieldsInTree = require('./utils/_pickFieldsInTree');
|
|
4
|
+
const transformGroup = require('./_transform-group');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Typescript generator:
|
|
8
|
+
*/
|
|
9
|
+
const format = 'typescript/map-deep';
|
|
10
|
+
StyleDictionary.registerFormat({
|
|
11
|
+
name: format,
|
|
12
|
+
formatter(dictionary) {
|
|
13
|
+
const properties = this.pickFields
|
|
14
|
+
? pickFieldsInTree(dictionary.properties, this.pickFields)
|
|
15
|
+
: dictionary.properties;
|
|
16
|
+
return `
|
|
17
|
+
${require('./utils/_genHeader')()}
|
|
18
|
+
|
|
19
|
+
export const DESIGN_TOKENS = ${JSON.stringify(properties)}
|
|
20
|
+
`;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
module.exports = () => {
|
|
25
|
+
const baseDir = `${__dirname}/../`;
|
|
26
|
+
const buildPath = `${path.resolve(baseDir, `../src/js/constants/`)}/`;
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
source: [`${baseDir}/properties/**/*.json`],
|
|
30
|
+
platforms: {
|
|
31
|
+
ts: {
|
|
32
|
+
transformGroup,
|
|
33
|
+
buildPath,
|
|
34
|
+
files: [
|
|
35
|
+
{
|
|
36
|
+
format,
|
|
37
|
+
destination: 'design-tokens.ts',
|
|
38
|
+
pickFields: [
|
|
39
|
+
'version',
|
|
40
|
+
'comment',
|
|
41
|
+
'value',
|
|
42
|
+
'attributes.hex',
|
|
43
|
+
'attributes.rgb',
|
|
44
|
+
'$aliasedFrom'
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
actions: [require('./utils/_prettier-ts')({ buildPath })],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const StyleDictionary = require("style-dictionary");
|
|
2
|
+
const tinycolor2 = require("tinycolor2");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Color value transform to RGBA object with added opacity if provided.
|
|
6
|
+
*/
|
|
7
|
+
const name = "color/attributes";
|
|
8
|
+
|
|
9
|
+
StyleDictionary.registerTransform({
|
|
10
|
+
name,
|
|
11
|
+
type: "attribute",
|
|
12
|
+
matcher: (prop) => /\bcolor\b/.exec(prop.name),
|
|
13
|
+
transformer: ({ value, attributes = {}, opacity = 1 }) => {
|
|
14
|
+
const color = tinycolor2(value);
|
|
15
|
+
if (!color.getFormat() || color.getFormat() === "name") {
|
|
16
|
+
// Skip if format "name" or undefined.
|
|
17
|
+
return attributes;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const colorWithAlpha = color.setAlpha(opacity);
|
|
21
|
+
return { ...attributes, rgb: colorWithAlpha.toRgb(), hex: colorWithAlpha.toHex() };
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
module.exports = name;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const StyleDictionary = require("style-dictionary");
|
|
2
|
+
const tinycolor2 = require("tinycolor2");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Color value transform to RGBA object with added opacity if provided.
|
|
6
|
+
*/
|
|
7
|
+
const name = "color/rgba-value";
|
|
8
|
+
|
|
9
|
+
StyleDictionary.registerTransform({
|
|
10
|
+
name,
|
|
11
|
+
type: "value",
|
|
12
|
+
matcher: (prop) => /\bcolor\b/.exec(prop.name),
|
|
13
|
+
transformer: ({ value, attributes = {} }) => {
|
|
14
|
+
const color = tinycolor2(attributes.rgb);
|
|
15
|
+
if (!color.getFormat() || color.getFormat() === "name") {
|
|
16
|
+
// Skip if format "name" or undefined.
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
return color.toRgbString();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
module.exports = name;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const StyleDictionary = require("style-dictionary");
|
|
2
|
+
|
|
3
|
+
const name = "css/prefer-variable";
|
|
4
|
+
|
|
5
|
+
StyleDictionary.registerTransform({
|
|
6
|
+
name,
|
|
7
|
+
type: "value",
|
|
8
|
+
matcher: (prop) => prop.preferCSSVariable,
|
|
9
|
+
transformer: (prop, config) => {
|
|
10
|
+
const extension = config.files[0].destination.replace(/.*\./, '');
|
|
11
|
+
let name;
|
|
12
|
+
if ((prop[`$config.${extension}`] || {}).aliasEquivalentCSSVariable) {
|
|
13
|
+
// Keep original prop name.
|
|
14
|
+
name = prop.name;
|
|
15
|
+
} else if (prop.$aliasedFrom) {
|
|
16
|
+
// Use the prop name for the original prop.
|
|
17
|
+
name = ('lumx.'+prop.$aliasedFrom).replace(/\./g, '-');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!name) return prop.value;
|
|
21
|
+
return`var(--${name})`;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
module.exports = name;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const StyleDictionary = require('style-dictionary');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Transform variable names.
|
|
5
|
+
*/
|
|
6
|
+
const name = 'name/lumx-variables';
|
|
7
|
+
StyleDictionary.registerTransform({
|
|
8
|
+
name,
|
|
9
|
+
type: 'name',
|
|
10
|
+
transformer: (prop) => `lumx-${prop.path.join('-')}`,
|
|
11
|
+
});
|
|
12
|
+
module.exports = name;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const fp = require('lodash/fp');
|
|
3
|
+
|
|
4
|
+
module.exports = function pickFieldsInTree(object, fields) {
|
|
5
|
+
if (!_.isPlainObject(object)) return null;
|
|
6
|
+
|
|
7
|
+
const values = fields.map((field) => _.get(object, field));
|
|
8
|
+
if (values.filter(Boolean).length > 0) {
|
|
9
|
+
return values.reduce((acc, value, index) => {
|
|
10
|
+
if (value) return _.set(acc, fields[index], value);
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return fp.flow(
|
|
16
|
+
Object.entries,
|
|
17
|
+
fp.filter(([, value]) => _.isPlainObject(value)),
|
|
18
|
+
fp.map(([key, value]) => [key, pickFieldsInTree(value, fields)]),
|
|
19
|
+
fp.filter(([, value]) => !_.isEmpty(value)),
|
|
20
|
+
Object.fromEntries,
|
|
21
|
+
)(object);
|
|
22
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const StyleDictionary = require('style-dictionary');
|
|
2
|
+
const execSync = require('child_process').execSync;
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const bin = path.resolve(__dirname, '../../../../../node_modules/.bin');
|
|
5
|
+
|
|
6
|
+
module.exports = function ({ buildPath }) {
|
|
7
|
+
const name = 'prettier/style';
|
|
8
|
+
StyleDictionary.registerAction({
|
|
9
|
+
name,
|
|
10
|
+
do: () => execSync(`${bin}/prettier --write '${path.resolve(buildPath)}/**'`),
|
|
11
|
+
});
|
|
12
|
+
return name;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const StyleDictionary = require('style-dictionary');
|
|
2
|
+
const execSync = require('child_process').execSync;
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const bin = path.resolve(__dirname, '../../../../../node_modules/.bin');
|
|
5
|
+
|
|
6
|
+
module.exports = function ({ buildPath }) {
|
|
7
|
+
const name = 'prettier/ts';
|
|
8
|
+
StyleDictionary.registerAction({
|
|
9
|
+
name,
|
|
10
|
+
do: () => execSync(`${bin}/eslint --fix '${path.resolve(buildPath)}'`),
|
|
11
|
+
});
|
|
12
|
+
return name;
|
|
13
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const _ = require("lodash");
|
|
2
|
+
const RGX = /^{([^}]+)}$/;
|
|
3
|
+
|
|
4
|
+
// Returns the string path matching the regexp or null if invalid.
|
|
5
|
+
const asAliasPath = (maybePath) => _.get(_.isString(maybePath) && maybePath.match(RGX), [1], null);
|
|
6
|
+
|
|
7
|
+
function getNested(tree, path) {
|
|
8
|
+
function recur(node, path) {
|
|
9
|
+
if (!path || !node) return undefined;
|
|
10
|
+
const [first, ...rest] = path.split(".");
|
|
11
|
+
const value = node[first];
|
|
12
|
+
if (rest.length === 0 || !value) return value;
|
|
13
|
+
const aliasPath = asAliasPath(value);
|
|
14
|
+
if (aliasPath) return recur(recur(tree, aliasPath), rest.join("."));
|
|
15
|
+
if (_.isPlainObject(value)) return recur(value, rest.join("."));
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return recur(tree, path);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function copyPropsRecursively(node, props) {
|
|
23
|
+
if (_.isPlainObject(node)) {
|
|
24
|
+
if ('value' in node) {
|
|
25
|
+
Object.assign(node, props);
|
|
26
|
+
} else {
|
|
27
|
+
for (let value of Object.values(node)) {
|
|
28
|
+
copyPropsRecursively(value, props)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Style dictionary does not resolve alias in the property tree, only in property object (= object with a value key).
|
|
36
|
+
*
|
|
37
|
+
* By default
|
|
38
|
+
* This works : `{ "color": { "value": "{theme.baseColor}", "attr": "{foo.bar}" }}`
|
|
39
|
+
* This does not : `{ "color": "{foo.bar}" }`
|
|
40
|
+
*
|
|
41
|
+
* This function resolve the second use case.
|
|
42
|
+
*/
|
|
43
|
+
module.exports = function(tree) {
|
|
44
|
+
function resolveAliasInNode(node) {
|
|
45
|
+
// Skip if not object.
|
|
46
|
+
if (!_.isPlainObject(node)) return;
|
|
47
|
+
|
|
48
|
+
// Resolve alias (if any).
|
|
49
|
+
for (const [key, value] of Object.entries(node)) {
|
|
50
|
+
let aliasPath = asAliasPath(value);
|
|
51
|
+
let aliasValue = getNested(tree, aliasPath);
|
|
52
|
+
if (typeof aliasValue === "object" && "value" in aliasValue) {
|
|
53
|
+
aliasValue = Object.fromEntries(Object.entries(aliasValue).filter(([key]) => !key.startsWith('$config') && key !== "version" && key !== "comment"));
|
|
54
|
+
}
|
|
55
|
+
if (key === "$extend") {
|
|
56
|
+
if (typeof aliasValue !== "object") {
|
|
57
|
+
throw new Error("Can't $extend a value that is not an object.");
|
|
58
|
+
}
|
|
59
|
+
delete node["$extend"];
|
|
60
|
+
const baseProps = _.cloneDeep(node);
|
|
61
|
+
Object.assign(node, _.cloneDeep(aliasValue));
|
|
62
|
+
copyPropsRecursively(node, baseProps);
|
|
63
|
+
} else if (aliasValue) {
|
|
64
|
+
node[key] = aliasValue;
|
|
65
|
+
if (typeof aliasValue === "object" && "value" in aliasValue) {
|
|
66
|
+
node[key]["$aliasedFrom"] = aliasPath;
|
|
67
|
+
}
|
|
68
|
+
} else if (_.isPlainObject(value)) {
|
|
69
|
+
resolveAliasInNode(value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
resolveAliasInNode(tree);
|
|
75
|
+
resolveAliasInNode(tree);
|
|
76
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const exec = require('child_process').exec;
|
|
2
|
+
|
|
3
|
+
const CONFIGS = ['gen-scss-variables', 'gen-ts-variables', 'gen-css-variables'];
|
|
4
|
+
|
|
5
|
+
// For each config
|
|
6
|
+
for (const config of CONFIGS) {
|
|
7
|
+
exec(`yarn node '${__dirname}/config/_run' '${config}'`, (error, stdout, stderr) => {
|
|
8
|
+
console.error(stderr);
|
|
9
|
+
console.log(stdout);
|
|
10
|
+
});
|
|
11
|
+
}
|