@symbo.ls/atoms 2.34.20 → 2.34.22

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.
Files changed (5) hide show
  1. package/Box.js +32 -0
  2. package/Grid.js +26 -18
  3. package/index.js +0 -1
  4. package/package.json +6 -6
  5. package/Flex.js +0 -29
package/Box.js CHANGED
@@ -346,6 +346,32 @@ export const Box = {
346
346
  },
347
347
 
348
348
  class: {
349
+ // flex
350
+ ...{
351
+ flow: ({ props }) => {
352
+ const { flow, reverse } = props
353
+ if (!isString(flow)) return
354
+ let [direction, wrap] = (flow || 'row').split(' ')
355
+ if (flow.startsWith('x') || flow === 'row') direction = 'row'
356
+ if (flow.startsWith('y') || flow === 'column') direction = 'column'
357
+ return {
358
+ display: 'flex',
359
+ flexFlow:
360
+ (direction || '') +
361
+ (!direction.includes('-reverse') && reverse ? '-reverse' : '') +
362
+ ' ' +
363
+ (wrap || '')
364
+ }
365
+ },
366
+ wrap: ({ props }) =>
367
+ props.wrap && { display: 'flex', flexWrap: props.wrap },
368
+ align: ({ props }) => {
369
+ if (!isString(props.align)) return
370
+ const [alignItems, justifyContent] = props.align.split(' ')
371
+ return { display: 'flex', alignItems, justifyContent }
372
+ }
373
+ },
374
+
349
375
  // block
350
376
  ...{
351
377
  show: (el, s, ctx) =>
@@ -1275,3 +1301,9 @@ export const Gutter = {
1275
1301
  size: 'C1'
1276
1302
  }
1277
1303
  }
1304
+
1305
+ export const Flex = {
1306
+ props: {
1307
+ display: 'flex'
1308
+ }
1309
+ }
package/Grid.js CHANGED
@@ -1,29 +1,37 @@
1
1
  'use strict'
2
2
 
3
- import { getSpacingBasedOnRatio } from '@symbo.ls/scratch'
4
-
5
3
  export const Grid = {
6
- deps: { getSpacingBasedOnRatio },
7
-
8
4
  props: { display: 'grid' },
9
5
 
10
6
  class: {
11
- area: ({ props }) => props.area ? ({ gridArea: props.area }) : null,
12
- template: ({ props }) => props.template ? ({ gridTemplate: props.template }) : null,
13
- templateAreas: ({ props }) => props.templateAreas ? ({ gridTemplateAreas: props.templateAreas }) : null,
7
+ area: ({ props }) => (props.area ? { gridArea: props.area } : null),
8
+ template: ({ props }) =>
9
+ props.template ? { gridTemplate: props.template } : null,
10
+ templateAreas: ({ props }) =>
11
+ props.templateAreas ? { gridTemplateAreas: props.templateAreas } : null,
14
12
 
15
- column: ({ props }) => props.column ? ({ gridColumn: props.column }) : null,
16
- columns: ({ props }) => props.columns ? ({ gridTemplateColumns: props.columns }) : null,
17
- templateColumns: ({ props }) => props.templateColumns ? ({ gridTemplateColumns: props.templateColumns }) : null,
18
- autoColumns: ({ props }) => props.autoColumns ? ({ gridAutoColumns: props.autoColumns }) : null,
19
- columnStart: ({ props }) => props.columnStart ? ({ gridColumnStart: props.columnStart }) : null,
13
+ column: ({ props }) => (props.column ? { gridColumn: props.column } : null),
14
+ columns: ({ props }) =>
15
+ props.columns ? { gridTemplateColumns: props.columns } : null,
16
+ templateColumns: ({ props }) =>
17
+ props.templateColumns
18
+ ? { gridTemplateColumns: props.templateColumns }
19
+ : null,
20
+ autoColumns: ({ props }) =>
21
+ props.autoColumns ? { gridAutoColumns: props.autoColumns } : null,
22
+ columnStart: ({ props }) =>
23
+ props.columnStart ? { gridColumnStart: props.columnStart } : null,
20
24
 
21
- row: ({ props }) => props.row ? ({ gridRow: props.row }) : null,
22
- rows: ({ props }) => props.rows ? ({ gridTemplateRows: props.rows }) : null,
23
- templateRows: ({ props }) => props.templateRows ? ({ gridTemplateRows: props.templateRows }) : null,
24
- autoRows: ({ props }) => props.autoRows ? ({ gridAutoRows: props.autoRows }) : null,
25
- rowStart: ({ props }) => props.rowStart ? ({ gridRowStart: props.rowStart }) : null,
25
+ row: ({ props }) => (props.row ? { gridRow: props.row } : null),
26
+ rows: ({ props }) => (props.rows ? { gridTemplateRows: props.rows } : null),
27
+ templateRows: ({ props }) =>
28
+ props.templateRows ? { gridTemplateRows: props.templateRows } : null,
29
+ autoRows: ({ props }) =>
30
+ props.autoRows ? { gridAutoRows: props.autoRows } : null,
31
+ rowStart: ({ props }) =>
32
+ props.rowStart ? { gridRowStart: props.rowStart } : null,
26
33
 
27
- autoFlow: ({ props }) => props.autoFlow ? ({ gridAutoFlow: props.autoFlow }) : null
34
+ autoFlow: ({ props }) =>
35
+ props.autoFlow ? { gridAutoFlow: props.autoFlow } : null
28
36
  }
29
37
  }
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  export * from './Box.js'
4
- export * from './Flex.js'
5
4
  export * from './Grid.js'
6
5
  export * from './Img.js'
7
6
  export * from './Form.js'
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.34.20",
3
+ "version": "2.34.22",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "ee2e9cb9831ae904b984868e68219e95fd9ceeaf",
6
+ "gitHead": "7c230f00e3044681e6ab652e1f638eeea8dac1ec",
7
7
  "dependencies": {
8
- "@domql/state": "^2.34.20",
9
- "@domql/utils": "^2.34.20",
10
- "@symbo.ls/emotion": "^2.34.20",
11
- "@symbo.ls/scratch": "^2.34.20"
8
+ "@domql/state": "^2.34.22",
9
+ "@domql/utils": "^2.34.22",
10
+ "@symbo.ls/emotion": "^2.34.22",
11
+ "@symbo.ls/scratch": "^2.34.22"
12
12
  },
13
13
  "source": "src/index.js",
14
14
  "devDependencies": {
package/Flex.js DELETED
@@ -1,29 +0,0 @@
1
- 'use strict'
2
-
3
- import { isString } from '@domql/utils'
4
-
5
- export const Flex = {
6
- props: {
7
- display: 'flex'
8
- },
9
-
10
- class: {
11
- flow: ({ props }) => {
12
- const { flow, reverse } = props
13
- if (!isString(flow)) return
14
- let [direction, wrap] = (flow || 'row').split(' ')
15
- if (flow.startsWith('x') || flow === 'row') direction = 'row'
16
- if (flow.startsWith('y') || flow === 'column') direction = 'column'
17
- return {
18
- flexFlow: (direction || '') + (!direction.includes('-reverse') && reverse ? '-reverse' : '') + ' ' + (wrap || '')
19
- }
20
- },
21
-
22
- wrap: ({ props }) => props.wrap && ({ flexWrap: props.wrap }),
23
- align: ({ props }) => {
24
- if (!isString(props.align)) return
25
- const [alignItems, justifyContent] = props.align.split(' ')
26
- return { alignItems, justifyContent }
27
- }
28
- }
29
- }