@symbo.ls/atoms 2.11.36 → 2.11.81

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 (2) hide show
  1. package/Collection.js +17 -2
  2. package/package.json +2 -2
package/Collection.js CHANGED
@@ -1,13 +1,18 @@
1
1
  'use strict'
2
2
 
3
- import { isState } from '@domql/state'
4
- import { isNot, isArray, isObject, isObjectLike, diff, deepClone } from '@domql/utils'
3
+ import { isState, getChildStateInKey } from '@domql/state'
4
+ import { isString, isNot, isArray, isObject, isObjectLike, diff, deepClone } from '@domql/utils'
5
5
 
6
6
  export const Collection = {
7
7
  define: {
8
8
  $setCollection: (param, el, state) => {
9
9
  if (!param) return
10
10
 
11
+ if (isString(param)) {
12
+ if (param === 'state') param = state.parse()
13
+ else param = getChildStateInKey(param, state)
14
+ }
15
+
11
16
  let data = isArray(param) ? param : []
12
17
 
13
18
  if (isObject(param)) {
@@ -32,6 +37,11 @@ export const Collection = {
32
37
 
33
38
  $setStateCollection: (param, el, state) => {
34
39
  if (!param) return
40
+
41
+ if (isString(param)) {
42
+ if (param === 'state') param = state.parse()
43
+ else param = getChildStateInKey(param, state)
44
+ }
35
45
  if (isState(param)) param = param.parse()
36
46
  if (isNot(param)('array', 'object')) return
37
47
 
@@ -58,6 +68,11 @@ export const Collection = {
58
68
 
59
69
  $setPropsCollection: (param, el, state) => {
60
70
  if (!param) return
71
+
72
+ if (isString(param)) {
73
+ if (param === 'state') param = state.parse()
74
+ else param = getChildStateInKey(param, state)
75
+ }
61
76
  if (isState(param)) param = param.parse()
62
77
  if (isNot(param)('array', 'object')) return
63
78
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.36",
3
+ "version": "2.11.81",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "dcbcb0c3da036cfdb2fa14632c7dd32f8041af2a",
6
+ "gitHead": "824ee1c1b1ef055b058ae21296b39493503dca98",
7
7
  "dependencies": {
8
8
  "@domql/state": "latest",
9
9
  "@domql/utils": "latest",