@symbo.ls/atoms 2.33.27 → 2.33.29

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 (3) hide show
  1. package/Box.js +183 -90
  2. package/Text.js +1 -1
  3. package/package.json +6 -6
package/Box.js CHANGED
@@ -107,7 +107,7 @@ export const Box = {
107
107
  title: (el) => el.call('isString', el.props.title) && el.props.title,
108
108
  contentEditable: (el, s) => {
109
109
  const isEditable = el.props.contentEditable || el.props.contenteditable
110
- if (isEditable) return el.call('exec', isEditable, el, s)
110
+ if (isEditable) return el.call(isEditable, el, s)
111
111
  },
112
112
  dir: (el) => el.props.dir,
113
113
  draggable: (el) => el.props.draggable,
@@ -358,160 +358,248 @@ export const Box = {
358
358
  display: 'none !important'
359
359
  },
360
360
 
361
- height: ({ props, deps }) => deps.transformSizeRatio('height', props),
362
- width: ({ props, deps }) => deps.transformSizeRatio('width', props),
361
+ height: (el) => {
362
+ const { props, deps } = el
363
+ return deps.transformSizeRatio.call(el, 'height', props)
364
+ },
365
+ width: (el) => {
366
+ const { props, deps } = el
367
+ return deps.transformSizeRatio.call(el, 'width', props)
368
+ },
363
369
 
364
370
  boxSizing: ({ props, deps }) =>
365
371
  !deps.isUndefined(props.boxSizing)
366
372
  ? { boxSizing: props.boxSizing }
367
373
  : { boxSizing: 'border-box' },
368
374
 
369
- boxSize: ({ props, deps }) => {
375
+ boxSize: (el) => {
376
+ const { props, deps } = el
370
377
  if (!deps.isString(props.boxSize)) return
371
378
  const [height, width] = props.boxSize.split(' ')
372
379
  return {
373
- ...deps.transformSize('height', height),
374
- ...deps.transformSize('width', width || height)
380
+ ...deps.transformSize.call(el, 'height', height),
381
+ ...deps.transformSize.call(el, 'width', width || height)
375
382
  }
376
383
  },
377
384
 
378
- inlineSize: ({ props, deps }) =>
379
- deps.transformSizeRatio('inlineSize', props),
380
- blockSize: ({ props, deps }) =>
381
- deps.transformSizeRatio('blockSize', props),
385
+ inlineSize: (el) => {
386
+ const { props, deps } = el
387
+ return deps.transformSizeRatio.call(el, 'inlineSize', props)
388
+ },
389
+ blockSize: (el) => {
390
+ const { props, deps } = el
391
+ return deps.transformSizeRatio.call(el, 'blockSize', props)
392
+ },
382
393
 
383
- minWidth: ({ props, deps }) => deps.transformSizeRatio('minWidth', props),
384
- maxWidth: ({ props, deps }) => deps.transformSizeRatio('maxWidth', props),
385
- widthRange: ({ props, deps }) => {
394
+ minWidth: (el) => {
395
+ const { props, deps } = el
396
+ return deps.transformSizeRatio.call(el, 'minWidth', props)
397
+ },
398
+ maxWidth: (el) => {
399
+ const { props, deps } = el
400
+ return deps.transformSizeRatio.call(el, 'maxWidth', props)
401
+ },
402
+ widthRange: (el) => {
403
+ const { props, deps } = el
386
404
  if (!deps.isString(props.widthRange)) return
387
405
  const [minWidth, maxWidth] = props.widthRange.split(' ')
388
406
  return {
389
- ...deps.transformSize('minWidth', minWidth),
390
- ...deps.transformSize('maxWidth', maxWidth || minWidth)
407
+ ...deps.transformSize.call(el, 'minWidth', minWidth),
408
+ ...deps.transformSize.call(el, 'maxWidth', maxWidth || minWidth)
391
409
  }
392
410
  },
393
411
 
394
- minHeight: ({ props, deps }) =>
395
- deps.transformSizeRatio('minHeight', props),
396
- maxHeight: ({ props, deps }) =>
397
- deps.transformSizeRatio('maxHeight', props),
398
- heightRange: ({ props, deps }) => {
412
+ minHeight: (el) => {
413
+ const { props, deps } = el
414
+ return deps.transformSizeRatio.call(el, 'minHeight', props)
415
+ },
416
+ maxHeight: (el) => {
417
+ const { props, deps } = el
418
+ return deps.transformSizeRatio.call(el, 'maxHeight', props)
419
+ },
420
+ heightRange: (el) => {
421
+ const { props, deps } = el
399
422
  if (!deps.isString(props.heightRange)) return
400
423
  const [minHeight, maxHeight] = props.heightRange.split(' ')
401
424
  return {
402
- ...deps.transformSize('minHeight', minHeight),
403
- ...deps.transformSize('maxHeight', maxHeight || minHeight)
425
+ ...deps.transformSize.call(el, 'minHeight', minHeight),
426
+ ...deps.transformSize.call(el, 'maxHeight', maxHeight || minHeight)
404
427
  }
405
428
  },
406
429
 
407
- size: ({ props, deps }) => {
430
+ size: (el) => {
431
+ const { props, deps } = el
408
432
  if (!deps.isString(props.size)) return
409
433
  const [inlineSize, blockSize] = props.size.split(' ')
410
434
  return {
411
- ...deps.transformSizeRatio('inlineSize', inlineSize),
412
- ...deps.transformSizeRatio('blockSize', blockSize || inlineSize)
435
+ ...deps.transformSizeRatio.call(el, 'inlineSize', inlineSize),
436
+ ...deps.transformSizeRatio.call(
437
+ el,
438
+ 'blockSize',
439
+ blockSize || inlineSize
440
+ )
413
441
  }
414
442
  },
415
443
 
416
- minBlockSize: ({ props, deps }) =>
417
- deps.transformSizeRatio('minBlockSize', props),
418
- minInlineSize: ({ props, deps }) =>
419
- deps.transformSizeRatio('minInlineSize', props),
444
+ minBlockSize: (el) => {
445
+ const { props, deps } = el
446
+ return deps.transformSizeRatio.call(el, 'minBlockSize', props)
447
+ },
448
+ minInlineSize: (el) => {
449
+ const { props, deps } = el
450
+ return deps.transformSizeRatio.call(el, 'minInlineSize', props)
451
+ },
420
452
 
421
- maxBlockSize: ({ props, deps }) =>
422
- deps.transformSizeRatio('maxBlockSize', props),
423
- maxInlineSize: ({ props, deps }) =>
424
- deps.transformSizeRatio('maxInlineSize', props),
453
+ maxBlockSize: (el) => {
454
+ const { props, deps } = el
455
+ return deps.transformSizeRatio.call(el, 'maxBlockSize', props)
456
+ },
457
+ maxInlineSize: (el) => {
458
+ const { props, deps } = el
459
+ return deps.transformSizeRatio.call(el, 'maxInlineSize', props)
460
+ },
425
461
 
426
- minSize: ({ props, deps }) => {
462
+ minSize: (el) => {
463
+ const { props, deps } = el
427
464
  if (!deps.isString(props.minSize)) return
428
465
  const [minInlineSize, minBlockSize] = props.minSize.split(' ')
429
466
  return {
430
- ...deps.transformSize('minInlineSize', minInlineSize),
431
- ...deps.transformSize('minBlockSize', minBlockSize || minInlineSize)
467
+ ...deps.transformSize.call(el, 'minInlineSize', minInlineSize),
468
+ ...deps.transformSize.call(
469
+ el,
470
+ 'minBlockSize',
471
+ minBlockSize || minInlineSize
472
+ )
432
473
  }
433
474
  },
434
475
 
435
- maxSize: ({ props, deps }) => {
476
+ maxSize: (el) => {
477
+ const { props, deps } = el
436
478
  if (!deps.isString(props.maxSize)) return
437
479
  const [maxInlineSize, maxBlockSize] = props.maxSize.split(' ')
438
480
  return {
439
- ...deps.transformSize('maxInlineSize', maxInlineSize),
440
- ...deps.transformSize('maxBlockSize', maxBlockSize || maxInlineSize)
481
+ ...deps.transformSize.call(el, 'maxInlineSize', maxInlineSize),
482
+ ...deps.transformSize.call(
483
+ el,
484
+ 'maxBlockSize',
485
+ maxBlockSize || maxInlineSize
486
+ )
441
487
  }
442
488
  },
443
489
 
444
- borderWidth: ({ props, deps }) =>
445
- deps.transformSizeRatio('borderWidth', props),
490
+ borderWidth: (el) => {
491
+ const { props, deps } = el
492
+ return deps.transformSizeRatio.call(el, 'borderWidth', props)
493
+ },
446
494
 
447
- padding: ({ props, deps }) => deps.transformSizeRatio('padding', props),
448
- scrollPadding: ({ props, deps }) =>
449
- deps.transformSizeRatio('scrollPadding', props),
450
- paddingInline: ({ props, deps }) => {
495
+ padding: (el) => {
496
+ const { props, deps } = el
497
+ return deps.transformSizeRatio.call(el, 'padding', props)
498
+ },
499
+ scrollPadding: (el) => {
500
+ const { props, deps } = el
501
+ return deps.transformSizeRatio.call(el, 'scrollPadding', props)
502
+ },
503
+ paddingInline: (el) => {
504
+ const { props, deps } = el
451
505
  if (!deps.isString(props.paddingInline)) return
452
506
  const [paddingInlineStart, paddingInlineEnd] =
453
507
  props.paddingInline.split(' ')
454
508
  return {
455
- ...deps.transformSize('paddingInlineStart', paddingInlineStart),
509
+ ...deps.transformSize.call(
510
+ el,
511
+ 'paddingInlineStart',
512
+ paddingInlineStart
513
+ ),
456
514
  ...deps.transformSize(
457
515
  'paddingInlineEnd',
458
516
  paddingInlineEnd || paddingInlineStart
459
517
  )
460
518
  }
461
519
  },
462
- paddingBlock: ({ props, deps }) => {
520
+ paddingBlock: (el) => {
521
+ const { props, deps } = el
463
522
  if (!deps.isString(props.paddingBlock)) return
464
523
  const [paddingBlockStart, paddingBlockEnd] =
465
524
  props.paddingBlock.split(' ')
466
525
  return {
467
- ...deps.transformSize('paddingBlockStart', paddingBlockStart),
526
+ ...deps.transformSize.call(
527
+ el,
528
+ 'paddingBlockStart',
529
+ paddingBlockStart
530
+ ),
468
531
  ...deps.transformSize(
469
532
  'paddingBlockEnd',
470
533
  paddingBlockEnd || paddingBlockStart
471
534
  )
472
535
  }
473
536
  },
474
- paddingInlineStart: ({ props, deps }) =>
475
- deps.transformSizeRatio('paddingInlineStart', props),
476
- paddingInlineEnd: ({ props, deps }) =>
477
- deps.transformSizeRatio('paddingInlineEnd', props),
478
- paddingBlockStart: ({ props, deps }) =>
479
- deps.transformSizeRatio('paddingBlockStart', props),
480
- paddingBlockEnd: ({ props, deps }) =>
481
- deps.transformSizeRatio('paddingBlockEnd', props),
482
-
483
- margin: ({ props, deps }) => deps.transformSizeRatio('margin', props),
484
- marginInline: ({ props, deps }) => {
537
+ paddingInlineStart: (el) => {
538
+ const { props, deps } = el
539
+ return deps.transformSizeRatio.call(el, 'paddingInlineStart', props)
540
+ },
541
+ paddingInlineEnd: (el) => {
542
+ const { props, deps } = el
543
+ return deps.transformSizeRatio.call(el, 'paddingInlineEnd', props)
544
+ },
545
+ paddingBlockStart: (el) => {
546
+ const { props, deps } = el
547
+ return deps.transformSizeRatio.call(el, 'paddingBlockStart', props)
548
+ },
549
+ paddingBlockEnd: (el) => {
550
+ const { props, deps } = el
551
+ return deps.transformSizeRatio.call(el, 'paddingBlockEnd', props)
552
+ },
553
+
554
+ margin: (el) => {
555
+ const { props, deps } = el
556
+ return deps.transformSizeRatio.call(el, 'margin', props)
557
+ },
558
+ marginInline: (el) => {
559
+ const { props, deps } = el
485
560
  if (!deps.isString(props.marginInline)) return
486
561
  const [marginInlineStart, marginInlineEnd] =
487
562
  props.marginInline.split(' ')
488
563
  return {
489
- ...deps.transformSize('marginInlineStart', marginInlineStart),
564
+ ...deps.transformSize.call(
565
+ el,
566
+ 'marginInlineStart',
567
+ marginInlineStart
568
+ ),
490
569
  ...deps.transformSize(
491
570
  'marginInlineEnd',
492
571
  marginInlineEnd || marginInlineStart
493
572
  )
494
573
  }
495
574
  },
496
- marginBlock: ({ props, deps }) => {
575
+ marginBlock: (el) => {
576
+ const { props, deps } = el
497
577
  if (!deps.isString(props.marginBlock)) return
498
578
  const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
499
579
  return {
500
- ...deps.transformSize('marginBlockStart', marginBlockStart),
580
+ ...deps.transformSize.call(el, 'marginBlockStart', marginBlockStart),
501
581
  ...deps.transformSize(
502
582
  'marginBlockEnd',
503
583
  marginBlockEnd || marginBlockStart
504
584
  )
505
585
  }
506
586
  },
507
- marginInlineStart: ({ props, deps }) =>
508
- deps.transformSizeRatio('marginInlineStart', props),
509
- marginInlineEnd: ({ props, deps }) =>
510
- deps.transformSizeRatio('marginInlineEnd', props),
511
- marginBlockStart: ({ props, deps }) =>
512
- deps.transformSizeRatio('marginBlockStart', props),
513
- marginBlockEnd: ({ props, deps }) =>
514
- deps.transformSizeRatio('marginBlockEnd', props),
587
+ marginInlineStart: (el) => {
588
+ const { props, deps } = el
589
+ return deps.transformSizeRatio.call(el, 'marginInlineStart', props)
590
+ },
591
+ marginInlineEnd: (el) => {
592
+ const { props, deps } = el
593
+ return deps.transformSizeRatio.call(el, 'marginInlineEnd', props)
594
+ },
595
+ marginBlockStart: (el) => {
596
+ const { props, deps } = el
597
+ return deps.transformSizeRatio.call(el, 'marginBlockStart', props)
598
+ },
599
+ marginBlockEnd: (el) => {
600
+ const { props, deps } = el
601
+ return deps.transformSizeRatio.call(el, 'marginBlockEnd', props)
602
+ },
515
603
 
516
604
  gap: ({ props, deps }) =>
517
605
  !deps.isUndefined(props.gap) && {
@@ -549,7 +637,8 @@ export const Box = {
549
637
  (wrap || '')
550
638
  }
551
639
  },
552
- flexAlign: ({ props, deps }) => {
640
+ flexAlign: (el) => {
641
+ const { props, deps } = el
553
642
  if (!deps.isString(props.flexAlign)) return
554
643
  const [alignItems, justifyContent] = props.flexAlign.split(' ')
555
644
  return {
@@ -832,48 +921,48 @@ export const Box = {
832
921
  const { props, deps } = element
833
922
  const globalTheme = deps.getSystemGlobalTheme(element)
834
923
  if (!props.theme) return
835
- const hasSubtheme =
836
- props.theme.includes(' ') && !props.theme.includes('@')
924
+ const theme = deps.exec.call(element, props.theme)
925
+ const hasSubtheme = theme.includes(' ') && !theme.includes('@')
837
926
  const globalThemeForced = `@${props.themeModifier || globalTheme}`
838
927
  if (hasSubtheme) {
839
- const themeAppliedInVal = props.theme.split(' ')
928
+ const themeAppliedInVal = theme.split(' ')
840
929
  themeAppliedInVal.splice(1, 0, globalThemeForced)
841
930
  return deps.getMediaTheme(themeAppliedInVal)
842
- } else if (props.theme.includes('@{globalTheme}'))
843
- props.theme.replace('@{globalTheme}', globalThemeForced)
931
+ } else if (theme.includes('@{globalTheme}'))
932
+ theme.replace('@{globalTheme}', globalThemeForced)
844
933
  return deps.getMediaTheme(
845
- props.theme,
934
+ theme,
846
935
  `@${props.themeModifier || globalTheme}`
847
936
  )
848
937
  },
849
938
 
850
939
  color: (element) => {
851
940
  const { props, deps } = element
852
- const globalTheme = deps.getSystemGlobalTheme(element)
853
941
  if (!props.color) return
942
+ const globalTheme = deps.getSystemGlobalTheme(element)
943
+ const color = deps.exec.call(element, props.color)
854
944
  return {
855
- color: deps.getMediaColor(props.color, globalTheme)
945
+ color: deps.getMediaColor(color, globalTheme)
856
946
  }
857
947
  },
858
948
 
859
949
  background: (element) => {
860
950
  const { props, deps } = element
861
- const globalTheme = deps.getSystemGlobalTheme(element)
862
951
  if (!props.background) return
952
+ const globalTheme = deps.getSystemGlobalTheme(element)
953
+ const background = deps.exec.call(element, props.background)
863
954
  return {
864
- background: deps.getMediaColor(props.background, globalTheme)
955
+ background: deps.getMediaColor(background, globalTheme)
865
956
  }
866
957
  },
867
958
 
868
959
  backgroundColor: (element) => {
869
960
  const { props, deps } = element
870
- const globalTheme = deps.getSystemGlobalTheme(element)
871
961
  if (!props.backgroundColor) return
962
+ const globalTheme = deps.getSystemGlobalTheme(element)
963
+ const backgroundColor = deps.exec.call(element, props.backgroundColor)
872
964
  return {
873
- backgroundColor: deps.getMediaColor(
874
- props.backgroundColor,
875
- globalTheme
876
- )
965
+ backgroundColor: deps.getMediaColor(backgroundColor, globalTheme)
877
966
  }
878
967
  },
879
968
 
@@ -921,8 +1010,10 @@ export const Box = {
921
1010
  !isUndefined(props.outline) && {
922
1011
  outline: deps.transformBorder(props.outline)
923
1012
  },
924
- outlineOffset: ({ props, deps }) =>
925
- deps.transformSizeRatio('outlineOffset', props),
1013
+ outlineOffset: (el) => {
1014
+ const { props, deps } = el
1015
+ return deps.transformSizeRatio.call(el, 'outlineOffset', props)
1016
+ },
926
1017
 
927
1018
  border: ({ props, deps }) =>
928
1019
  (isString(props.border) || isNumber(props.border)) && {
@@ -1129,8 +1220,10 @@ export const Box = {
1129
1220
 
1130
1221
  // scrollbar
1131
1222
  ...{
1132
- scrollbarWidth: ({ props, deps }) =>
1133
- deps.transformSizeRatio('scrollbarWidth', props)
1223
+ scrollbarWidth: (el) => {
1224
+ const { props, deps } = el
1225
+ return deps.transformSizeRatio.call(el, 'scrollbarWidth', props)
1226
+ }
1134
1227
  },
1135
1228
 
1136
1229
  // container queries
package/Text.js CHANGED
@@ -24,7 +24,7 @@ export const Text = {
24
24
  const { key, props, state, deps } = el
25
25
  if (props.text === true)
26
26
  return (state && state[key]) || (props && props[key])
27
- return deps.exec(props.text, el)
27
+ return deps.exec.call(el, props.text)
28
28
  },
29
29
 
30
30
  class: {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.33.27",
3
+ "version": "2.33.29",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "305c78c0cd824b365d3e464dc3ede6b250c8baf1",
6
+ "gitHead": "4a29b29c86a47fa047345b16120cc426bbe57f41",
7
7
  "dependencies": {
8
- "@domql/state": "^2.33.27",
9
- "@domql/utils": "^2.33.27",
10
- "@symbo.ls/emotion": "^2.33.27",
11
- "@symbo.ls/scratch": "^2.33.27"
8
+ "@domql/state": "^2.33.29",
9
+ "@domql/utils": "^2.33.29",
10
+ "@symbo.ls/emotion": "^2.33.29",
11
+ "@symbo.ls/scratch": "^2.33.29"
12
12
  },
13
13
  "source": "src/index.js",
14
14
  "devDependencies": {