@symbo.ls/atoms 2.11.214 → 2.11.216

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/Collection.js +33 -15
  2. package/Theme.js +17 -2
  3. package/package.json +2 -2
package/Collection.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { isState, getChildStateInKey } from '@domql/state'
4
- import { isString, isNot, isArray, isObject, isObjectLike, diff, deepClone, deepContains } from '@domql/utils'
4
+ import { isString, isNot, isArray, isObject, isObjectLike, deepDiff, deepClone } from '@domql/utils'
5
5
 
6
6
  export const Collection = {
7
7
  define: {
@@ -38,18 +38,25 @@ export const Collection = {
38
38
  if (isState(param)) param = param.parse()
39
39
  if (isNot(param)('array', 'object')) return
40
40
 
41
- if (el.key === 'cnt') {
42
- if (el.__ref.__stateCollectionCache) {
43
- const d = diff(param, el.__ref.__stateCollectionCache) // eslint-disable-line
41
+ const { __ref: ref } = el
42
+
43
+ if (ref.__stateCollectionCache) {
44
+ const d = deepDiff(param, ref.__stateCollectionCache) // eslint-disable-line
45
+ if (Object.keys(d).length) {
46
+ ref.__stateCollectionCache = deepClone(param)
47
+ delete ref.__noCollectionDifference
44
48
  } else {
45
- el.__ref.__stateCollectionCache = deepClone(param)
49
+ ref.__noCollectionDifference = true
50
+ return
46
51
  }
52
+ } else {
53
+ ref.__stateCollectionCache = deepClone(param)
47
54
  }
48
55
 
49
56
  const obj = {
50
57
  tag: 'fragment',
51
58
  props: {
52
- childProps: el.props.childProps
59
+ childProps: el.props && el.props.childProps
53
60
  }
54
61
  }
55
62
 
@@ -58,10 +65,8 @@ export const Collection = {
58
65
  obj[key] = { state: isObjectLike(value) ? value : { value } }
59
66
  }
60
67
 
61
- if (!deepContains(obj, el.content)) {
62
- el.removeContent()
63
- el.content = obj
64
- }
68
+ el.removeContent()
69
+ el.content = obj
65
70
 
66
71
  return obj
67
72
  },
@@ -76,10 +81,25 @@ export const Collection = {
76
81
  if (isState(param)) param = param.parse()
77
82
  if (isNot(param)('array', 'object')) return
78
83
 
84
+ const { __ref: ref } = el
85
+
86
+ if (ref.__propsCollectionCache) {
87
+ const d = deepDiff(param, ref.__propsCollectionCache) // eslint-disable-line
88
+ if (Object.keys(d).length) {
89
+ ref.__propsCollectionCache = deepClone(param)
90
+ delete ref.__noCollectionDifference
91
+ } else {
92
+ ref.__noCollectionDifference = true
93
+ return
94
+ }
95
+ } else {
96
+ ref.__propsCollectionCache = deepClone(param)
97
+ }
98
+
79
99
  const obj = {
80
100
  tag: 'fragment',
81
101
  props: {
82
- childProps: el.props.childProps
102
+ childProps: el.props && el.props.childProps
83
103
  }
84
104
  }
85
105
 
@@ -88,10 +108,8 @@ export const Collection = {
88
108
  obj[key] = { props: isObjectLike(value) ? value : { value } }
89
109
  }
90
110
 
91
- if (!deepContains(obj, el.content)) {
92
- el.removeContent()
93
- el.content = obj
94
- }
111
+ el.removeContent()
112
+ el.content = obj
95
113
 
96
114
  // const set = () => {
97
115
  // el.set(obj, { preventDefineUpdate: '$setPropsCollection' })
package/Theme.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  getMediaColor,
6
6
  transformTextStroke,
7
7
  transformShadow,
8
+ transformBoxShadow,
8
9
  transformBorder,
9
10
  transformBackgroundImage
10
11
  } from '@symbo.ls/scratch'
@@ -25,6 +26,7 @@ export const Theme = {
25
26
  getMediaColor,
26
27
  transformTextStroke,
27
28
  transformShadow,
29
+ transformBoxShadow,
28
30
  transformBorder,
29
31
  transformBackgroundImage
30
32
  },
@@ -119,12 +121,25 @@ export const Theme = {
119
121
  borderBottom: deps.transformBorder(props.borderBottom)
120
122
  }),
121
123
 
124
+ shadow: (element) => {
125
+ const { props, deps } = element
126
+ const globalTheme = deps.getSystemTheme(element)
127
+ if (!props.backgroundImage) return
128
+ return ({
129
+ boxShadow: deps.transformShadow(props.backgroundImage, globalTheme)
130
+ })
131
+ },
132
+
122
133
  boxShadow: ({ props, deps }) => !isUndefined(props.boxShadow) && ({
123
- boxShadow: deps.transformShadow(props.boxShadow)
134
+ boxShadow: deps.transformBoxShadow(props.boxShadow)
124
135
  }),
125
136
 
126
137
  textShadow: ({ props, deps }) => !isUndefined(props.textShadow) && ({
127
- textShadow: deps.transformShadow(props.textShadow)
138
+ textShadow: deps.transformBoxShadow(props.textShadow)
139
+ }),
140
+
141
+ backdropFilter: ({ props, deps }) => !isUndefined(props.backdropFilter) && ({
142
+ backdropFilter: props.backdropFilter
128
143
  }),
129
144
 
130
145
  opacity: ({ props }) => !isUndefined(props.opacity) && ({
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.214",
3
+ "version": "2.11.216",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "707d4101f2b259c80be5c1ad095ca1c0ea6ef35d",
6
+ "gitHead": "23694218fd8511bd183cb4ca1ed0493e3dbcc704",
7
7
  "dependencies": {
8
8
  "@domql/state": "latest",
9
9
  "@domql/utils": "latest",