domql 1.5.9 → 1.5.10

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "DOM rendering Javascript framework at early stage.",
4
4
  "private": false,
5
5
  "author": "rackai",
6
- "version": "1.5.9",
6
+ "version": "1.5.10",
7
7
  "repository": "https://github.com/rackai/domql",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org"
@@ -32,6 +32,17 @@ const create = (element, parent, key, options = {}) => {
32
32
  element = { extend: element }
33
33
  }
34
34
 
35
+ // define KEY
36
+ const assignedKey = element.key || key || createID.next().value
37
+
38
+ const firstKeyChar = assignedKey.slice(0, 1)
39
+ if (!element.extend && !element.props && /^[A-Z]*$/.test(firstKeyChar)) {
40
+ element = {
41
+ component: assignedKey,
42
+ props: element
43
+ }
44
+ }
45
+
35
46
  if (options.components) {
36
47
  const { components } = options
37
48
  const { extend, component } = element
@@ -40,9 +51,6 @@ const create = (element, parent, key, options = {}) => {
40
51
  else console.warn(extend, 'is not in library', components, element)
41
52
  }
42
53
 
43
- // define KEY
44
- const assignedKey = element.key || key || createID.next().value
45
-
46
54
  // if PARENT is not given
47
55
  if (!parent) parent = root
48
56
  if (isNode(parent)) parent = root[`${key}_parent`] = { key: ':root', node: parent }
@@ -56,6 +64,10 @@ const create = (element, parent, key, options = {}) => {
56
64
  }
57
65
  }
58
66
 
67
+ // assign context
68
+ if (options.context && !root.context) root.context = options.context
69
+ element.context = root.context
70
+
59
71
  // create EXTEND inheritance
60
72
  applyExtend(element, parent, options)
61
73
 
@@ -117,10 +129,6 @@ const create = (element, parent, key, options = {}) => {
117
129
  // enable CHANGES storing
118
130
  if (!element.__changes) element.__changes = []
119
131
 
120
- // assign context
121
- if (options.context && !root.context) root.context = options.context
122
- element.context = root.context
123
-
124
132
  // Add _root element property
125
133
  const hasRoot = parent.parent && parent.parent.key === ':root'
126
134
  if (!element.__root) element.__root = hasRoot ? parent : parent.__root
@@ -8,6 +8,7 @@ const initProps = (element, parent) => {
8
8
 
9
9
  const isMatch = isString(props) && props.indexOf('match') > -1
10
10
  const matchParent = parent.props && parent.props[element.key]
11
+ const matchParentChild = parent.props && parent.props.childProps
11
12
 
12
13
  const objectizeStringProperty = propValue => {
13
14
  if (isString(propValue)) return { inheritedString: propValue }
@@ -15,6 +16,7 @@ const initProps = (element, parent) => {
15
16
  }
16
17
 
17
18
  if (matchParent && props !== 'match') propsStack.push(matchParent)
19
+ if (matchParentChild) propsStack.push(matchParentChild)
18
20
 
19
21
  if (isObject(props)) {
20
22
  propsStack.push(props)