domql 1.5.23 → 1.5.24

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.23",
6
+ "version": "1.5.24",
7
7
  "repository": "https://github.com/rackai/domql",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org"
@@ -24,6 +24,7 @@ const isComponent = (key) => {
24
24
  if(!isFirstKeyString) return
25
25
 
26
26
  const firstCharKey = key.slice(0, 1)
27
+
27
28
  return /^[A-Z]*$/.test(firstCharKey)
28
29
  }
29
30
 
@@ -44,21 +45,34 @@ const create = (element, parent, key, options = {}) => {
44
45
  element = { extend: element }
45
46
  }
46
47
 
48
+ // if PARENT is not given
49
+ if (!parent) parent = root
50
+ if (isNode(parent)) parent = root[`${key}_parent`] = { key: ':root', node: parent }
51
+
52
+ // if element is STRING
53
+ if (isString(element) || isNumber(element)) {
54
+ element = {
55
+ text: element,
56
+ tag: (!element.extend && parent.childExtend && parent.childExtend.tag) ||
57
+ ((nodes.body.indexOf(key) > -1) && key) || 'string'
58
+ }
59
+ }
60
+
47
61
  // define KEY
48
62
  const assignedKey = element.key || key || createID.next().value
49
63
 
50
- const { extend, props, state } = element
64
+ const { extend, props, state, childExtend, childProps } = element
51
65
 
52
66
  if (isComponent(assignedKey)) {
53
- if (!extend && !props && !state) {
67
+ if (!extend && !childExtend && !props && !state || childProps) {
54
68
  element = {
55
69
  extend: assignedKey,
56
70
  props: element
57
71
  }
58
- } else if (!extend) {
72
+ } else if (!extend || extend === true) {
59
73
  element = {
60
- extend: assignedKey,
61
- ...element
74
+ ...element,
75
+ extend: assignedKey
62
76
  }
63
77
  }
64
78
  }
@@ -78,19 +92,6 @@ const create = (element, parent, key, options = {}) => {
78
92
  }
79
93
  }
80
94
 
81
- // if PARENT is not given
82
- if (!parent) parent = root
83
- if (isNode(parent)) parent = root[`${key}_parent`] = { key: ':root', node: parent }
84
-
85
- // if element is STRING
86
- if (isString(element) || isNumber(element)) {
87
- element = {
88
- text: element,
89
- tag: (!element.extend && parent.childExtend && parent.childExtend.tag) ||
90
- ((nodes.body.indexOf(key) > -1) && key) || 'string'
91
- }
92
- }
93
-
94
95
  // assign context
95
96
  if (options.context && !root.context) root.context = options.context
96
97
  element.context = root.context