jbx 1.6.0 → 1.7.3

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/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.md]
11
+ max_line_length = off
12
+ trim_trailing_whitespace = false
package/.prettierrc ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 100,
4
+ "editor.formatOnSave": true,
5
+ "proseWrap": "always",
6
+ "tabWidth": 2,
7
+ "requireConfig": false,
8
+ "useTabs": false,
9
+ "trailingComma": "none",
10
+ "bracketSpacing": true,
11
+ "jsxBracketSameLine": false,
12
+ "semi": true
13
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v1.7.0
2
+
3
+ - Add `touch-action: pan-y;`.
4
+
1
5
  # v1.6.0
2
6
 
3
7
  - `Button` now moves when clicked.
package/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import React, { Fragment } from "react";
1
+ import React, { Fragment } from 'react';
2
2
 
3
- import Styled from "styled-components";
4
- import capsize from "capsize";
3
+ import Styled from 'styled-components';
4
+ import capsize from 'capsize';
5
5
 
6
- import { createGlobalStyle } from "styled-components";
6
+ import { createGlobalStyle } from 'styled-components';
7
7
 
8
- const BASE_SIZE = 16;
9
- const SIZE = window.innerHeight > 640 ? 16 : 14;
8
+ const SIZE = window.innerWidth > 1280 ? 16 : window.innerWidth > 640 ? 14 : 12;
9
+ const BASE_SIZE = SIZE;
10
10
  const BASE_RADIUS = SIZE / 2;
11
11
  const SPACE = SIZE;
12
12
  const BASE_FONT_SIZE = SIZE;
@@ -15,7 +15,7 @@ const fontMetrics = {
15
15
  capHeight: 1364,
16
16
  ascent: 1950,
17
17
  descent: -494,
18
- unitsPerEm: 2048,
18
+ unitsPerEm: 2048
19
19
  };
20
20
 
21
21
  export const JBX = createGlobalStyle`
@@ -36,13 +36,13 @@ export const JBX = createGlobalStyle`
36
36
 
37
37
  body {
38
38
  touch-action: manipulation;
39
+ touch-action: pan-y;
39
40
  }
40
41
 
41
42
  body,
42
43
  input,
43
44
  textarea {
44
45
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
45
- font-size: 16px;
46
46
  }
47
47
 
48
48
  body {
@@ -61,106 +61,102 @@ function textProps(capsizeConfig) {
61
61
  const capsizeComputed = {
62
62
  fontMetrics,
63
63
  lineGap: BASE_FONT_SIZE * 0.618,
64
- ...capsizeConfig,
64
+ ...capsizeConfig
65
65
  };
66
66
 
67
67
  return capsize(capsizeComputed);
68
68
  }
69
69
 
70
70
  export const Container = Styled.div({
71
- maxWidth: "1080px",
72
- margin: "0 auto",
73
- padding: `${SIZE * 2.5}px ${SIZE * 1.5}px ${SIZE * 4}px`,
71
+ maxWidth: '1080px',
72
+ margin: '0 auto',
73
+ padding: `${SIZE * 2.5}px ${SIZE * 1.5}px ${SIZE * 4}px`
74
74
  });
75
75
 
76
76
  export const Text = Styled(BaseText)({
77
77
  ...textProps({
78
- capHeight: BASE_FONT_SIZE,
79
- }),
78
+ capHeight: BASE_FONT_SIZE
79
+ })
80
80
  });
81
81
 
82
82
  export const SmallText = Styled(BaseText)({
83
83
  ...textProps({
84
84
  capHeight: BASE_FONT_SIZE * 0.8,
85
- lineGap: BASE_FONT_SIZE / 3,
86
- }),
85
+ lineGap: BASE_FONT_SIZE / 3
86
+ })
87
87
  });
88
88
 
89
89
  export const ButtonContainer = Styled.button({
90
- appearance: "none",
91
- userSelect: "none",
92
- cursor: "pointer",
93
- display: "inline-block",
94
- backgroundColor: "#eee",
95
- boxShadow: "3px 3px 0 #ccc",
90
+ appearance: 'none',
91
+ userSelect: 'none',
92
+ cursor: 'pointer',
93
+ display: 'inline-block',
94
+ backgroundColor: '#eee',
95
+ boxShadow: '3px 3px 0 #ccc',
96
96
  padding: `0 ${SPACE / 2}px`,
97
- border: "none",
97
+ border: 'none',
98
98
  height: SPACE * 2.5,
99
- "&:active": {
99
+ '&:active': {
100
100
  top: 1,
101
101
  left: 1,
102
- boxShadow: "2px 2px 0 #ccc",
103
- },
102
+ boxShadow: '2px 2px 0 #ccc'
103
+ }
104
104
  });
105
105
 
106
106
  export const Button = function Button(props) {
107
107
  const { children, ...other } = props;
108
- return React.createElement(
109
- ButtonContainer,
110
- other,
111
- React.createElement(Text, {}, children)
112
- );
108
+ return React.createElement(ButtonContainer, other, React.createElement(Text, {}, children));
113
109
  };
114
110
 
115
111
  export const Input = Styled.input({
116
- "-webkit-text-fill-color": "#777",
112
+ '-webkit-text-fill-color': '#777',
117
113
  opacity: 1,
118
114
  flex: 1,
119
- display: "block",
120
- appearance: "none",
121
- border: "none",
115
+ display: 'block',
116
+ appearance: 'none',
117
+ border: 'none',
122
118
  borderRadius: 0,
123
119
  height: SPACE * 2.5,
124
- backgroundColor: "#eee",
120
+ backgroundColor: '#eee',
125
121
  ...textProps({
126
- capHeight: (BASE_FONT_SIZE * 3) / 3,
122
+ capHeight: (BASE_FONT_SIZE * 3) / 3
127
123
  }),
128
124
  padding: `0 ${SPACE / 2}px`,
129
125
  boxShadow: `inset rgba(0, 0, 0, 0.04) 3px 3px 0, inset rgba(0, 0, 0, 0.03) 0.5px 0.5px 0`,
130
- color: "#777",
126
+ color: '#777'
131
127
  });
132
128
 
133
129
  export const Range = Styled.input({
134
130
  flex: 1,
135
- width: "100%",
136
- appearance: "none",
137
- backgroundColor: "var(--accent-color)",
131
+ width: '100%',
132
+ appearance: 'none',
133
+ backgroundColor: 'var(--accent-color)',
138
134
  height: SPACE,
139
135
  borderRadius: 0,
140
- "&::-webkit-slider-thumb": {
141
- appearance: "none",
142
- boxShadow: "none",
136
+ '&::-webkit-slider-thumb': {
137
+ appearance: 'none',
138
+ boxShadow: 'none',
143
139
  borderRadius: 0,
144
140
  height: SPACE * 2,
145
141
  width: SPACE,
146
- backgroundColor: "#000",
147
- border: "none",
142
+ backgroundColor: '#000',
143
+ border: 'none'
148
144
  },
149
- "&::-moz-range-thumb": {
150
- appearance: "none",
151
- boxShadow: "none",
145
+ '&::-moz-range-thumb': {
146
+ appearance: 'none',
147
+ boxShadow: 'none',
152
148
  borderRadius: 0,
153
149
  height: SPACE * 2,
154
150
  width: SPACE,
155
- backgroundColor: "#000",
156
- border: "none",
157
- },
158
- "&::-webkit-slider-runnable-track": {
159
- appearance: "none",
151
+ backgroundColor: '#000',
152
+ border: 'none'
160
153
  },
161
- ":focus": {
162
- outline: "none",
154
+ '&::-webkit-slider-runnable-track': {
155
+ appearance: 'none'
163
156
  },
157
+ ':focus': {
158
+ outline: 'none'
159
+ }
164
160
  });
165
161
 
166
162
  export const HeaderH4 = Styled.h4({
@@ -170,8 +166,8 @@ export const HeaderH4 = Styled.h4({
170
166
  fontWeight: 700,
171
167
  ...textProps({
172
168
  capHeight: BASE_FONT_SIZE,
173
- lineGap: BASE_FONT_SIZE,
174
- }),
169
+ lineGap: BASE_FONT_SIZE
170
+ })
175
171
  });
176
172
  export const HeaderH3 = Styled.h3({
177
173
  margin: 0,
@@ -180,8 +176,8 @@ export const HeaderH3 = Styled.h3({
180
176
  fontWeight: 500,
181
177
  ...textProps({
182
178
  capHeight: BASE_FONT_SIZE * 1 * 1.25,
183
- lineGap: BASE_FONT_SIZE,
184
- }),
179
+ lineGap: BASE_FONT_SIZE
180
+ })
185
181
  });
186
182
  export const HeaderH2 = Styled.h2({
187
183
  margin: 0,
@@ -190,21 +186,21 @@ export const HeaderH2 = Styled.h2({
190
186
  fontWeight: 500,
191
187
  ...textProps({
192
188
  capHeight: BASE_FONT_SIZE * 1.5,
193
- lineGap: 12,
194
- }),
189
+ lineGap: 12
190
+ })
195
191
  });
196
192
  export const HeaderH1 = Styled.h1({
197
193
  letterSpacing: -1,
198
- margin: "2px 0",
194
+ margin: '2px 0',
199
195
  fontWeight: 700,
200
196
  ...textProps({
201
197
  capHeight: BASE_FONT_SIZE * 3 - 4,
202
- lineGap: BASE_FONT_SIZE,
203
- }),
198
+ lineGap: BASE_FONT_SIZE
199
+ })
204
200
  });
205
201
 
206
202
  export const MainHeader = function MainHeader({ children }) {
207
- const content = String(children).split(" ");
203
+ const content = String(children).split(' ');
208
204
 
209
205
  return React.createElement(
210
206
  Fragment,
@@ -216,12 +212,12 @@ export const MainHeader = function MainHeader({ children }) {
216
212
  key: word,
217
213
  style: {
218
214
  fontWeight: 900,
219
- display: "inline-block",
220
- width: "auto",
221
- padding: "6px",
215
+ display: 'inline-block',
216
+ width: 'auto',
217
+ padding: '6px',
222
218
  margin: 0,
223
- backgroundColor: "var(--accent-color)",
224
- },
219
+ backgroundColor: 'var(--accent-color)'
220
+ }
225
221
  },
226
222
  word
227
223
  )
@@ -230,19 +226,19 @@ export const MainHeader = function MainHeader({ children }) {
230
226
  };
231
227
 
232
228
  export const A = Styled.a({
233
- color: "#000",
234
- boxShadow: "var(--accent-color) 0 2px 0, inset var(--accent-color) 0 -2px 0",
229
+ color: '#000',
230
+ boxShadow: 'var(--accent-color) 0 2px 0, inset var(--accent-color) 0 -2px 0',
235
231
  fontWeight: 700,
236
- textDecoration: "none",
237
- "&:hover": {
238
- color: "#34495e",
239
- },
232
+ textDecoration: 'none',
233
+ '&:hover': {
234
+ color: '#34495e'
235
+ }
240
236
  });
241
237
 
242
238
  export const Space = Styled.div({
243
- display: (props) => (props.inline ? "inline-block" : "block"),
239
+ display: (props) => (props.inline ? 'inline-block' : 'block'),
244
240
  height: (props) => `${SPACE * props.h}px`,
245
- width: (props) => `${SPACE * props.w}px`,
241
+ width: (props) => `${SPACE * props.w}px`
246
242
  });
247
243
 
248
244
  export const Box = Styled.div({
@@ -253,115 +249,112 @@ export const Box = Styled.div({
253
249
 
254
250
  const paddingArr = [padding].flat();
255
251
 
256
- return paddingArr
257
- .map((paddingValue) => `${paddingValue * SPACE}px`)
258
- .join(` `);
252
+ return paddingArr.map((paddingValue) => `${paddingValue * SPACE}px`).join(` `);
259
253
  },
260
254
 
261
- "@media (max-width: 768px)": {
262
- display: ({ hideOnSmall }) => (hideOnSmall ? "none" : undefined),
255
+ '@media (max-width: 768px)': {
256
+ display: ({ hideOnSmall }) => (hideOnSmall ? 'none' : undefined)
263
257
  },
264
258
 
265
- "@media (max-width: 1080px)": {
266
- display: ({ hideOnMedium }) => (hideOnMedium ? "none" : undefined),
267
- },
259
+ '@media (max-width: 1080px)': {
260
+ display: ({ hideOnMedium }) => (hideOnMedium ? 'none' : undefined)
261
+ }
268
262
  });
269
263
 
270
264
  export const Inline = Styled.div({
271
- display: "flex",
272
- flexWrap: "wrap",
265
+ display: 'flex',
266
+ flexWrap: 'wrap',
273
267
  marginLeft: ({ h }) => `${h * SPACE}px`,
274
268
  marginRight: ({ h }) => `${h * SPACE}px`,
275
269
  marginTop: ({ v }) => `${v * SPACE}px`,
276
- marginBottom: ({ v }) => `${v * SPACE}px`,
270
+ marginBottom: ({ v }) => `${v * SPACE}px`
277
271
  });
278
272
 
279
273
  export const LinkButton = Styled.a({
280
274
  capHeight: BASE_FONT_SIZE,
281
- color: "#3498db",
282
- cursor: "pointer",
275
+ color: '#3498db',
276
+ cursor: 'pointer',
283
277
  borderRadius: 5,
284
- borderTop: "1px solid #3498db10",
285
- borderBottom: "1px solid #0000",
286
- backgroundColor: "#3498db20",
278
+ borderTop: '1px solid #3498db10',
279
+ borderBottom: '1px solid #0000',
280
+ backgroundColor: '#3498db20',
287
281
  height: BASE_FONT_SIZE * 2,
288
- display: "flex",
289
- alignItems: "center",
290
- alignContent: "center",
291
- justifyContent: "center",
282
+ display: 'flex',
283
+ alignItems: 'center',
284
+ alignContent: 'center',
285
+ justifyContent: 'center',
292
286
  padding: 0,
293
- "&:hover": {
294
- boxShadow: `rgba(0, 0, 0, 0.1) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 3px 12px`,
295
- },
287
+ '&:hover': {
288
+ boxShadow: `rgba(0, 0, 0, 0.1) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 3px 12px`
289
+ }
296
290
  });
297
291
 
298
292
  export const Dropzone = Styled.div({
299
- height: "120px",
293
+ height: '120px',
300
294
  flex: 1,
301
- "max-width": "320px",
302
- display: "flex",
303
- "text-align": "center",
304
- "align-items": "center",
305
- "align-content": "center",
306
- "justify-content": "center",
307
- "flex-direction": "column",
308
- border: "2px dashed #000",
309
- color: "#000",
310
- padding: "0",
311
- cursor: "pointer",
312
- "& span": {
313
- width: "100%",
314
- cursor: "pointer",
315
- },
316
- "&:hover": {
317
- "border-color": "#999",
295
+ 'max-width': '320px',
296
+ display: 'flex',
297
+ 'text-align': 'center',
298
+ 'align-items': 'center',
299
+ 'align-content': 'center',
300
+ 'justify-content': 'center',
301
+ 'flex-direction': 'column',
302
+ border: '2px dashed #000',
303
+ color: '#000',
304
+ padding: '0',
305
+ cursor: 'pointer',
306
+ '& span': {
307
+ width: '100%',
308
+ cursor: 'pointer'
318
309
  },
319
- "& input": {
320
- position: "absolute",
321
- top: "0",
322
- left: "0",
323
- height: "100%",
324
- width: "100%",
325
- opacity: "0",
326
- cursor: "pointer",
310
+ '&:hover': {
311
+ 'border-color': '#999'
327
312
  },
313
+ '& input': {
314
+ position: 'absolute',
315
+ top: '0',
316
+ left: '0',
317
+ height: '100%',
318
+ width: '100%',
319
+ opacity: '0',
320
+ cursor: 'pointer'
321
+ }
328
322
  });
329
323
 
330
324
  export const Ul = Styled.ul({
331
325
  margin: 0,
332
- padding: `0 0 0 ${BASE_FONT_SIZE / 4}px`,
326
+ padding: `0 0 0 ${BASE_FONT_SIZE / 4}px`
333
327
  });
334
328
 
335
329
  export const Li = Styled.li({
336
330
  margin: `0 0 0 ${SIZE}px`,
337
- padding: `${SIZE / 4}px 0`,
331
+ padding: `${SIZE / 4}px 0`
338
332
  });
339
333
 
340
334
  export const Tabs = Styled.div({});
341
335
 
342
336
  export const Tab = Styled.div({
343
- userSelect: "none",
337
+ userSelect: 'none',
344
338
  padding: SIZE / 2,
345
- cursor: "pointer",
346
- backgroundColor: (props) =>
347
- props.active ? "#000" : props.info ? "#fff" : "#ecf0f1",
348
- color: (props) => (props.active ? "#fff" : "#000"),
349
- paddingLeft: (props) => (props.info ? 0 : undefined),
339
+ cursor: 'pointer',
340
+ backgroundColor: (props) => (props.active ? '#000' : props.info ? '#fff' : '#ecf0f1'),
341
+ color: (props) => (props.active ? '#fff' : '#000'),
342
+ paddingLeft: (props) => (props.info ? 0 : undefined)
350
343
  });
351
344
 
352
345
  export const CodeSnippet = Styled.pre({
353
346
  borderRadius: BASE_RADIUS,
354
- "font-family": "monaco, monospace",
355
- border: "none",
356
- width: "100%",
357
- "font-size": SIZE - 2,
358
- "line-height": "1.5",
347
+ 'font-family': 'monaco, monospace',
348
+ border: 'none',
349
+ width: '100%',
350
+ 'font-size': SIZE - 2,
351
+ 'line-height': '1.5',
359
352
  padding: SIZE,
360
- background: "#ecf0f1",
361
- color: "#34495e",
362
- ":focus": {
363
- outline: "none",
364
- },
353
+ background: '#ecf0f1',
354
+ color: '#34495e',
355
+ ':focus': {
356
+ outline: 'none'
357
+ }
365
358
  });
366
359
 
367
360
  export const CheckboxHidden = Styled.div(({ checked }) => {
@@ -370,12 +363,12 @@ export const CheckboxHidden = Styled.div(({ checked }) => {
370
363
  width: BASE_SIZE * 2 - 4,
371
364
  paddingTop: 2,
372
365
  paddingLeft: 2,
373
- backgroundColor: checked ? "var(--accent-color)" : "white",
366
+ backgroundColor: checked ? 'var(--accent-color)' : 'white',
374
367
  borderRadius: BASE_RADIUS,
375
368
  boxShadow: checked
376
- ? "inset rgba(0, 0, 0, 0.07) 0 0 0 1px"
377
- : "inset rgba(0, 0, 0, 0.33) 0 0 0 1.5px",
378
- cursor: "pointer",
369
+ ? 'inset rgba(0, 0, 0, 0.07) 0 0 0 1px'
370
+ : 'inset rgba(0, 0, 0, 0.33) 0 0 0 1.5px',
371
+ cursor: 'pointer'
379
372
  };
380
373
  });
381
374
 
@@ -389,58 +382,54 @@ export const Checkbox = function Checkbox({ label, checked, onChange }) {
389
382
  }
390
383
  },
391
384
  style: {
392
- alignItems: "center",
393
- cursor: "pointer",
394
- },
385
+ alignItems: 'center',
386
+ cursor: 'pointer'
387
+ }
395
388
  },
396
389
  [
397
390
  React.createElement(
398
391
  CheckboxHidden,
399
392
  {
400
393
  key: 0,
401
- checked,
394
+ checked
402
395
  },
403
396
  React.createElement(
404
- "svg",
397
+ 'svg',
405
398
  {
406
- xmlns: "http://www.w3.org/2000/svg",
407
- width: "24",
408
- height: "24",
409
- fill: "none",
410
- stroke: "currentColor",
411
- strokeLinecap: "round",
412
- strokeLinejoin: "round",
413
- strokeWidth: "2",
414
- className: "feather feather-check",
415
- viewBox: "0 0 24 24",
416
- color: checked ? "white" : "#ddd",
399
+ xmlns: 'http://www.w3.org/2000/svg',
400
+ width: 40 - BASE_SIZE,
401
+ height: 40 - BASE_SIZE,
402
+ fill: 'none',
403
+ stroke: 'currentColor',
404
+ strokeLinecap: 'round',
405
+ strokeLinejoin: 'round',
406
+ strokeWidth: '2',
407
+ className: 'feather feather-check',
408
+ viewBox: '0 0 24 24',
409
+ color: checked ? 'white' : '#ddd'
417
410
  },
418
- React.createElement("path", {
419
- d: "M20 6L9 17 4 12",
411
+ React.createElement('path', {
412
+ d: 'M20 6L9 17 4 12'
420
413
  })
421
414
  )
422
415
  ),
423
416
  React.createElement(Space, { key: 1, w: 0.5 }),
424
- React.createElement(
425
- Text,
426
- { key: 2, style: { userSelect: "none" } },
427
- label
428
- ),
417
+ React.createElement(Text, { key: 2, style: { userSelect: 'none' } }, label)
429
418
  ]
430
419
  );
431
420
  };
432
421
 
433
422
  export const Code = Styled.textarea({
434
- "font-family": "monaco, monospace",
435
- border: "none",
436
- width: "100%",
437
- height: "256px",
438
- "font-size": "12px",
439
- "line-height": "1.309",
440
- padding: "16px 18px",
441
- background: "#ecf0f1",
442
- color: "#34495e",
443
- ":focus": {
444
- outline: "none",
445
- },
423
+ 'font-family': 'monaco, monospace',
424
+ border: 'none',
425
+ width: '100%',
426
+ height: '256px',
427
+ 'font-size': '12px',
428
+ 'line-height': '1.309',
429
+ padding: '16px 18px',
430
+ background: '#ecf0f1',
431
+ color: '#34495e',
432
+ ':focus': {
433
+ outline: 'none'
434
+ }
446
435
  });
package/package.json CHANGED
@@ -1,17 +1,8 @@
1
1
  {
2
2
  "name": "jbx",
3
- "version": "1.6.0",
3
+ "version": "1.7.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "peerDependencies": {
10
- "capsize": "^1.1.0",
11
- "react": "16.13.1",
12
- "react-dom": "16.13.1",
13
- "styled-components": "^5.2.0"
14
- },
15
- "author": "",
16
- "license": "ISC"
6
+ "author": "hi@javier.xyz",
7
+ "license": "Unlicensed"
17
8
  }