@bgord/design 0.2.1 → 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.
- package/README.md +19 -171
- package/dist/design.cjs.development.js +329 -2
- package/dist/design.cjs.development.js.map +1 -1
- package/dist/design.cjs.production.min.js +1 -1
- package/dist/design.cjs.production.min.js.map +1 -1
- package/dist/design.esm.js +329 -2
- package/dist/design.esm.js.map +1 -1
- package/dist/flex-directions-generator.d.ts +10 -0
- package/dist/flex-wraps-generator.d.ts +10 -0
- package/dist/font-size-generator.d.ts +10 -0
- package/dist/font-weight-generator.d.ts +10 -0
- package/dist/generator.d.ts +9 -1
- package/dist/line-height-generator.d.ts +10 -0
- package/dist/main.css +165 -0
- package/dist/main.min.css +1 -1
- package/dist/postions-generator.d.ts +10 -0
- package/dist/tokens.d.ts +16 -0
- package/dist/widhts-generator.d.ts +10 -0
- package/dist/z-index-generator.d.ts +10 -0
- package/package.json +1 -1
- package/src/flex-directions-generator.ts +32 -0
- package/src/flex-wraps-generator.ts +32 -0
- package/src/font-size-generator.ts +32 -0
- package/src/font-weight-generator.ts +32 -0
- package/src/generate-css.ts +37 -1
- package/src/generator.ts +21 -1
- package/src/line-height-generator.ts +32 -0
- package/src/postions-generator.ts +32 -0
- package/src/tokens.ts +85 -0
- package/src/widhts-generator.ts +32 -0
- package/src/z-index-generator.ts +32 -0
package/README.md
CHANGED
|
@@ -1,181 +1,29 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bgord/design
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Placement:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- displays
|
|
6
|
+
- flex-directions
|
|
7
|
+
- flex-wraps
|
|
8
|
+
- axis-placements
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Spacing:
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
- margins
|
|
13
|
+
- paddings
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
- widhts
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Position:
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
19
|
+
- postions
|
|
20
|
+
- z-index
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
Text:
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
- font-size
|
|
25
|
+
- font-weight
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn storybook
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
This loads the stories from `./stories`.
|
|
32
|
-
|
|
33
|
-
> NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
|
|
34
|
-
|
|
35
|
-
### Example
|
|
36
|
-
|
|
37
|
-
Then run the example inside another:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
cd example
|
|
41
|
-
npm i # or yarn to install dependencies
|
|
42
|
-
npm start # or yarn start
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
|
|
46
|
-
|
|
47
|
-
To do a one-off build, use `npm run build` or `yarn build`.
|
|
48
|
-
|
|
49
|
-
To run tests, use `npm test` or `yarn test`.
|
|
50
|
-
|
|
51
|
-
## Configuration
|
|
52
|
-
|
|
53
|
-
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
|
|
54
|
-
|
|
55
|
-
### Jest
|
|
56
|
-
|
|
57
|
-
Jest tests are set up to run with `npm test` or `yarn test`.
|
|
58
|
-
|
|
59
|
-
### Bundle analysis
|
|
60
|
-
|
|
61
|
-
Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.
|
|
62
|
-
|
|
63
|
-
#### Setup Files
|
|
64
|
-
|
|
65
|
-
This is the folder structure we set up for you:
|
|
66
|
-
|
|
67
|
-
```txt
|
|
68
|
-
/example
|
|
69
|
-
index.html
|
|
70
|
-
index.tsx # test your component here in a demo app
|
|
71
|
-
package.json
|
|
72
|
-
tsconfig.json
|
|
73
|
-
/src
|
|
74
|
-
index.tsx # EDIT THIS
|
|
75
|
-
/test
|
|
76
|
-
blah.test.tsx # EDIT THIS
|
|
77
|
-
/stories
|
|
78
|
-
Thing.stories.tsx # EDIT THIS
|
|
79
|
-
/.storybook
|
|
80
|
-
main.js
|
|
81
|
-
preview.js
|
|
82
|
-
.gitignore
|
|
83
|
-
package.json
|
|
84
|
-
README.md # EDIT THIS
|
|
85
|
-
tsconfig.json
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
#### React Testing Library
|
|
89
|
-
|
|
90
|
-
We do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.
|
|
91
|
-
|
|
92
|
-
### Rollup
|
|
93
|
-
|
|
94
|
-
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
|
|
95
|
-
|
|
96
|
-
### TypeScript
|
|
97
|
-
|
|
98
|
-
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
|
|
99
|
-
|
|
100
|
-
## Continuous Integration
|
|
101
|
-
|
|
102
|
-
### GitHub Actions
|
|
103
|
-
|
|
104
|
-
Two actions are added by default:
|
|
105
|
-
|
|
106
|
-
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
|
|
107
|
-
- `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)
|
|
108
|
-
|
|
109
|
-
## Optimizations
|
|
110
|
-
|
|
111
|
-
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
// ./types/index.d.ts
|
|
115
|
-
declare var __DEV__: boolean;
|
|
116
|
-
|
|
117
|
-
// inside your code...
|
|
118
|
-
if (__DEV__) {
|
|
119
|
-
console.log('foo');
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
|
|
124
|
-
|
|
125
|
-
## Module Formats
|
|
126
|
-
|
|
127
|
-
CJS, ESModules, and UMD module formats are supported.
|
|
128
|
-
|
|
129
|
-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
|
|
130
|
-
|
|
131
|
-
## Deploying the Example Playground
|
|
132
|
-
|
|
133
|
-
The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
cd example # if not already in the example folder
|
|
137
|
-
npm run build # builds to dist
|
|
138
|
-
netlify deploy # deploy the dist folder
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
netlify init
|
|
145
|
-
# build command: yarn build && cd example && yarn && yarn build
|
|
146
|
-
# directory to deploy: example/dist
|
|
147
|
-
# pick yes for netlify.toml
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Named Exports
|
|
151
|
-
|
|
152
|
-
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
|
|
153
|
-
|
|
154
|
-
## Including Styles
|
|
155
|
-
|
|
156
|
-
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
|
|
157
|
-
|
|
158
|
-
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
|
|
159
|
-
|
|
160
|
-
## Publishing to NPM
|
|
161
|
-
|
|
162
|
-
We recommend using [np](https://github.com/sindresorhus/np).
|
|
163
|
-
|
|
164
|
-
## Usage with Lerna
|
|
165
|
-
|
|
166
|
-
When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.
|
|
167
|
-
|
|
168
|
-
The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.
|
|
169
|
-
|
|
170
|
-
Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.
|
|
171
|
-
|
|
172
|
-
```diff
|
|
173
|
-
"alias": {
|
|
174
|
-
- "react": "../node_modules/react",
|
|
175
|
-
- "react-dom": "../node_modules/react-dom"
|
|
176
|
-
+ "react": "../../../node_modules/react",
|
|
177
|
-
+ "react-dom": "../../../node_modules/react-dom"
|
|
178
|
-
},
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)
|
|
27
|
+
TODO:
|
|
28
|
+
- line-height (lh)
|
|
29
|
+
- letter-spacing (ls)
|
|
@@ -1077,6 +1077,270 @@ var AxisPlacementsGenerator = /*#__PURE__*/function () {
|
|
|
1077
1077
|
return AxisPlacementsGenerator;
|
|
1078
1078
|
}();
|
|
1079
1079
|
|
|
1080
|
+
var PositionsGenerator = /*#__PURE__*/function () {
|
|
1081
|
+
function PositionsGenerator(config) {
|
|
1082
|
+
this.spacing = config.spacing;
|
|
1083
|
+
this.displays = config.displays;
|
|
1084
|
+
this.positions = config.positions;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
var _proto = PositionsGenerator.prototype;
|
|
1088
|
+
|
|
1089
|
+
_proto.generateHeader = function generateHeader() {
|
|
1090
|
+
return '/* Positions */\n\n';
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
_proto.generateCss = function generateCss() {
|
|
1094
|
+
var output = ''; // Regular display: data-position="*"
|
|
1095
|
+
|
|
1096
|
+
for (var _i = 0, _Object$entries = Object.entries(this.positions); _i < _Object$entries.length; _i++) {
|
|
1097
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1098
|
+
key = _Object$entries$_i[0],
|
|
1099
|
+
value = _Object$entries$_i[1];
|
|
1100
|
+
output += "*[data-position='" + key + "'] {\n position: " + value + ";\n}\n";
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
return output;
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
_proto.generateFooter = function generateFooter() {
|
|
1107
|
+
return '/* ===================== */\n\n';
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
return PositionsGenerator;
|
|
1111
|
+
}();
|
|
1112
|
+
|
|
1113
|
+
var FlexWrapGenerator = /*#__PURE__*/function () {
|
|
1114
|
+
function FlexWrapGenerator(config) {
|
|
1115
|
+
this.spacing = config.spacing;
|
|
1116
|
+
this.displays = config.displays;
|
|
1117
|
+
this.flexWraps = config.flexWraps;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
var _proto = FlexWrapGenerator.prototype;
|
|
1121
|
+
|
|
1122
|
+
_proto.generateHeader = function generateHeader() {
|
|
1123
|
+
return '/* Flex wraps */\n\n';
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
_proto.generateCss = function generateCss() {
|
|
1127
|
+
var output = ''; // Regular display: data-wrap="*"
|
|
1128
|
+
|
|
1129
|
+
for (var _i = 0, _Object$entries = Object.entries(this.flexWraps); _i < _Object$entries.length; _i++) {
|
|
1130
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1131
|
+
key = _Object$entries$_i[0],
|
|
1132
|
+
value = _Object$entries$_i[1];
|
|
1133
|
+
output += "*[data-wrap='" + key + "'] {\n flex-wrap: " + value + ";\n}\n";
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return output;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
_proto.generateFooter = function generateFooter() {
|
|
1140
|
+
return '/* ===================== */\n\n';
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
return FlexWrapGenerator;
|
|
1144
|
+
}();
|
|
1145
|
+
|
|
1146
|
+
var ZIndexGenerator = /*#__PURE__*/function () {
|
|
1147
|
+
function ZIndexGenerator(config) {
|
|
1148
|
+
this.spacing = config.spacing;
|
|
1149
|
+
this.displays = config.displays;
|
|
1150
|
+
this.zIndexes = config.zIndexes;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
var _proto = ZIndexGenerator.prototype;
|
|
1154
|
+
|
|
1155
|
+
_proto.generateHeader = function generateHeader() {
|
|
1156
|
+
return '/* Displays */\n\n';
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
_proto.generateCss = function generateCss() {
|
|
1160
|
+
var output = ''; // Regular display: data-z="*"
|
|
1161
|
+
|
|
1162
|
+
for (var _i = 0, _Object$entries = Object.entries(this.zIndexes); _i < _Object$entries.length; _i++) {
|
|
1163
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1164
|
+
key = _Object$entries$_i[0],
|
|
1165
|
+
value = _Object$entries$_i[1];
|
|
1166
|
+
output += "*[data-z='" + key + "'] {\n z-index: " + value + ";\n}\n";
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return output;
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
_proto.generateFooter = function generateFooter() {
|
|
1173
|
+
return '/* ===================== */\n\n';
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
return ZIndexGenerator;
|
|
1177
|
+
}();
|
|
1178
|
+
|
|
1179
|
+
var WidthsGenerator = /*#__PURE__*/function () {
|
|
1180
|
+
function WidthsGenerator(config) {
|
|
1181
|
+
this.spacing = config.spacing;
|
|
1182
|
+
this.displays = config.displays;
|
|
1183
|
+
this.widhts = config.widths;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
var _proto = WidthsGenerator.prototype;
|
|
1187
|
+
|
|
1188
|
+
_proto.generateHeader = function generateHeader() {
|
|
1189
|
+
return '/* Widths */\n\n';
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
_proto.generateCss = function generateCss() {
|
|
1193
|
+
var output = ''; // Regular display: data-width="*"
|
|
1194
|
+
|
|
1195
|
+
for (var _i = 0, _Object$entries = Object.entries(this.widhts); _i < _Object$entries.length; _i++) {
|
|
1196
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1197
|
+
key = _Object$entries$_i[0],
|
|
1198
|
+
value = _Object$entries$_i[1];
|
|
1199
|
+
output += "*[data-width='" + key + "'] {\n width: " + value + ";\n}\n";
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
return output;
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
_proto.generateFooter = function generateFooter() {
|
|
1206
|
+
return '/* ===================== */\n\n';
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
return WidthsGenerator;
|
|
1210
|
+
}();
|
|
1211
|
+
|
|
1212
|
+
var FontSizeGenerator = /*#__PURE__*/function () {
|
|
1213
|
+
function FontSizeGenerator(config) {
|
|
1214
|
+
this.spacing = config.spacing;
|
|
1215
|
+
this.displays = config.displays;
|
|
1216
|
+
this.fontSizes = config.fontSizes;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
var _proto = FontSizeGenerator.prototype;
|
|
1220
|
+
|
|
1221
|
+
_proto.generateHeader = function generateHeader() {
|
|
1222
|
+
return '/* Font sizes */\n\n';
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
_proto.generateCss = function generateCss() {
|
|
1226
|
+
var output = ''; // Regular display: data-fs="*"
|
|
1227
|
+
|
|
1228
|
+
for (var _i = 0, _Object$entries = Object.entries(this.fontSizes); _i < _Object$entries.length; _i++) {
|
|
1229
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1230
|
+
key = _Object$entries$_i[0],
|
|
1231
|
+
value = _Object$entries$_i[1];
|
|
1232
|
+
output += "*[data-fs='" + key + "'] {\n font-size: " + value + "px;\n}\n";
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return output;
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
_proto.generateFooter = function generateFooter() {
|
|
1239
|
+
return '/* ===================== */\n\n';
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1242
|
+
return FontSizeGenerator;
|
|
1243
|
+
}();
|
|
1244
|
+
|
|
1245
|
+
var FontWeightGenerator = /*#__PURE__*/function () {
|
|
1246
|
+
function FontWeightGenerator(config) {
|
|
1247
|
+
this.spacing = config.spacing;
|
|
1248
|
+
this.displays = config.displays;
|
|
1249
|
+
this.fontWeights = config.fontWeights;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
var _proto = FontWeightGenerator.prototype;
|
|
1253
|
+
|
|
1254
|
+
_proto.generateHeader = function generateHeader() {
|
|
1255
|
+
return '/* Font sizes */\n\n';
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
_proto.generateCss = function generateCss() {
|
|
1259
|
+
var output = ''; // Regular display: data-fw="*"
|
|
1260
|
+
|
|
1261
|
+
for (var _i = 0, _Object$entries = Object.entries(this.fontWeights); _i < _Object$entries.length; _i++) {
|
|
1262
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1263
|
+
key = _Object$entries$_i[0],
|
|
1264
|
+
value = _Object$entries$_i[1];
|
|
1265
|
+
output += "*[data-fw='" + key + "'] {\n font-weight: " + value + ";\n}\n";
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
return output;
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
_proto.generateFooter = function generateFooter() {
|
|
1272
|
+
return '/* ===================== */\n\n';
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
return FontWeightGenerator;
|
|
1276
|
+
}();
|
|
1277
|
+
|
|
1278
|
+
var LineHeightsGenerator = /*#__PURE__*/function () {
|
|
1279
|
+
function LineHeightsGenerator(config) {
|
|
1280
|
+
this.spacing = config.spacing;
|
|
1281
|
+
this.displays = config.displays;
|
|
1282
|
+
this.lineHeights = config.lineHeights;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
var _proto = LineHeightsGenerator.prototype;
|
|
1286
|
+
|
|
1287
|
+
_proto.generateHeader = function generateHeader() {
|
|
1288
|
+
return '/* Line heights */\n\n';
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
_proto.generateCss = function generateCss() {
|
|
1292
|
+
var output = ''; // Regular display: data-lh="*"
|
|
1293
|
+
|
|
1294
|
+
for (var _i = 0, _Object$entries = Object.entries(this.lineHeights); _i < _Object$entries.length; _i++) {
|
|
1295
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1296
|
+
key = _Object$entries$_i[0],
|
|
1297
|
+
value = _Object$entries$_i[1];
|
|
1298
|
+
output += "*[data-lh='" + key + "'] {\n line-height: " + value + ";\n}\n";
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
return output;
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
_proto.generateFooter = function generateFooter() {
|
|
1305
|
+
return '/* ===================== */\n\n';
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
return LineHeightsGenerator;
|
|
1309
|
+
}();
|
|
1310
|
+
|
|
1311
|
+
var FlexDirectionsGenerator = /*#__PURE__*/function () {
|
|
1312
|
+
function FlexDirectionsGenerator(config) {
|
|
1313
|
+
this.spacing = config.spacing;
|
|
1314
|
+
this.displays = config.displays;
|
|
1315
|
+
this.flexDirections = config.flexDirections;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
var _proto = FlexDirectionsGenerator.prototype;
|
|
1319
|
+
|
|
1320
|
+
_proto.generateHeader = function generateHeader() {
|
|
1321
|
+
return '/* Flex directions */\n\n';
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
_proto.generateCss = function generateCss() {
|
|
1325
|
+
var output = ''; // Regular display: data-direction="*"
|
|
1326
|
+
|
|
1327
|
+
for (var _i = 0, _Object$entries = Object.entries(this.flexDirections); _i < _Object$entries.length; _i++) {
|
|
1328
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
1329
|
+
key = _Object$entries$_i[0],
|
|
1330
|
+
value = _Object$entries$_i[1];
|
|
1331
|
+
output += "*[data-direction='" + key + "'] {\n flex-direction: " + value + ";\n}\n";
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
return output;
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
_proto.generateFooter = function generateFooter() {
|
|
1338
|
+
return '/* ===================== */\n\n';
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
return FlexDirectionsGenerator;
|
|
1342
|
+
}();
|
|
1343
|
+
|
|
1080
1344
|
var Spacing = {
|
|
1081
1345
|
'0': '0',
|
|
1082
1346
|
'3': '3px',
|
|
@@ -1100,6 +1364,61 @@ var AxisPlacements = {
|
|
|
1100
1364
|
center: 'center',
|
|
1101
1365
|
baseline: 'baseline'
|
|
1102
1366
|
};
|
|
1367
|
+
var Positions = {
|
|
1368
|
+
"static": 'static',
|
|
1369
|
+
relative: 'relative',
|
|
1370
|
+
absolute: 'absolute',
|
|
1371
|
+
fixed: 'fixed',
|
|
1372
|
+
sticky: 'sticky',
|
|
1373
|
+
unset: 'unset'
|
|
1374
|
+
};
|
|
1375
|
+
var FlexWraps = {
|
|
1376
|
+
nowrap: 'nowrap',
|
|
1377
|
+
wrap: 'wrap',
|
|
1378
|
+
'wrap-reverse': 'wrap-reverse',
|
|
1379
|
+
unset: 'unset'
|
|
1380
|
+
};
|
|
1381
|
+
var ZIndexes = {
|
|
1382
|
+
'0': '0',
|
|
1383
|
+
'1': '1',
|
|
1384
|
+
'2': '2',
|
|
1385
|
+
'3': '3'
|
|
1386
|
+
};
|
|
1387
|
+
var Widths = {
|
|
1388
|
+
'100%': '100%',
|
|
1389
|
+
auto: 'auto',
|
|
1390
|
+
unset: 'unset'
|
|
1391
|
+
};
|
|
1392
|
+
var FontSizes = {
|
|
1393
|
+
12: '12',
|
|
1394
|
+
14: '14',
|
|
1395
|
+
16: '16',
|
|
1396
|
+
20: '20',
|
|
1397
|
+
24: '24',
|
|
1398
|
+
32: '32'
|
|
1399
|
+
};
|
|
1400
|
+
var FontWeights = {
|
|
1401
|
+
'300': '300',
|
|
1402
|
+
'400': '400',
|
|
1403
|
+
'500': '500',
|
|
1404
|
+
'700': '700',
|
|
1405
|
+
'900': '900',
|
|
1406
|
+
unset: 'unset'
|
|
1407
|
+
};
|
|
1408
|
+
var LineHeights = {
|
|
1409
|
+
'12': '12',
|
|
1410
|
+
'16': '16',
|
|
1411
|
+
'20': '20',
|
|
1412
|
+
'24': '24',
|
|
1413
|
+
'32': '32',
|
|
1414
|
+
unset: 'unset'
|
|
1415
|
+
};
|
|
1416
|
+
var FlexDirections = {
|
|
1417
|
+
row: 'row',
|
|
1418
|
+
'row-reverse': 'row-reverse',
|
|
1419
|
+
column: 'column',
|
|
1420
|
+
'column-reverse': 'column-reverse'
|
|
1421
|
+
};
|
|
1103
1422
|
|
|
1104
1423
|
var GeneratorProcessor = /*#__PURE__*/function () {
|
|
1105
1424
|
function GeneratorProcessor() {}
|
|
@@ -1159,10 +1478,18 @@ function _main() {
|
|
|
1159
1478
|
config = {
|
|
1160
1479
|
spacing: Spacing,
|
|
1161
1480
|
displays: Displays,
|
|
1162
|
-
axisPlacements: AxisPlacements
|
|
1481
|
+
axisPlacements: AxisPlacements,
|
|
1482
|
+
positions: Positions,
|
|
1483
|
+
flexWraps: FlexWraps,
|
|
1484
|
+
zIndexes: ZIndexes,
|
|
1485
|
+
widths: Widths,
|
|
1486
|
+
fontSizes: FontSizes,
|
|
1487
|
+
fontWeights: FontWeights,
|
|
1488
|
+
lineHeights: LineHeights,
|
|
1489
|
+
flexDirections: FlexDirections
|
|
1163
1490
|
};
|
|
1164
1491
|
_context2.next = 3;
|
|
1165
|
-
return new GeneratorProcessor().process([new Margins(config), new Paddings(config), new DisplaysGenerator(config), new AxisPlacementsGenerator(config)]);
|
|
1492
|
+
return new GeneratorProcessor().process([new Margins(config), new Paddings(config), new DisplaysGenerator(config), new AxisPlacementsGenerator(config), new PositionsGenerator(config), new FlexWrapGenerator(config), new ZIndexGenerator(config), new WidthsGenerator(config), new FontSizeGenerator(config), new FontWeightGenerator(config), new LineHeightsGenerator(config), new FlexDirectionsGenerator(config)]);
|
|
1166
1493
|
|
|
1167
1494
|
case 3:
|
|
1168
1495
|
case "end":
|