domql 1.5.21 → 1.5.23

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.21",
6
+ "version": "1.5.23",
7
7
  "repository": "https://github.com/rackai/domql",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org"
@@ -19,6 +19,14 @@ import { registry } from './mixins'
19
19
 
20
20
  const ENV = process.env.NODE_ENV
21
21
 
22
+ const isComponent = (key) => {
23
+ const isFirstKeyString = isString(key)
24
+ if(!isFirstKeyString) return
25
+
26
+ const firstCharKey = key.slice(0, 1)
27
+ return /^[A-Z]*$/.test(firstCharKey)
28
+ }
29
+
22
30
  /**
23
31
  * Creating a domQL element using passed parameters
24
32
  */
@@ -39,11 +47,19 @@ const create = (element, parent, key, options = {}) => {
39
47
  // define KEY
40
48
  const assignedKey = element.key || key || createID.next().value
41
49
 
42
- const firstKeyChar = isString(assignedKey) && assignedKey.slice(0, 1)
43
- if (!element.extend && !element.props && /^[A-Z]*$/.test(firstKeyChar)) {
44
- element = {
45
- extend: assignedKey,
46
- props: element
50
+ const { extend, props, state } = element
51
+
52
+ if (isComponent(assignedKey)) {
53
+ if (!extend && !props && !state) {
54
+ element = {
55
+ extend: assignedKey,
56
+ props: element
57
+ }
58
+ } else if (!extend) {
59
+ element = {
60
+ extend: assignedKey,
61
+ ...element
62
+ }
47
63
  }
48
64
  }
49
65
 
@@ -15,13 +15,13 @@ const initProps = (element, parent) => {
15
15
  return propValue
16
16
  }
17
17
 
18
+ if (matchParent && props !== 'match') propsStack.push(matchParent)
19
+ if (matchParentChild) propsStack.push(matchParentChild)
20
+
18
21
  if (isObject(props)) {
19
22
  propsStack.push(props)
20
23
  }
21
24
 
22
- if (matchParent && props !== 'match') propsStack.push(matchParent)
23
- if (matchParentChild) propsStack.push(matchParentChild)
24
-
25
25
  if (props === 'inherit') {
26
26
  if (parent.props) propsStack.push(parent.props)
27
27
  } else if (isMatch) {
@@ -11,8 +11,6 @@ import { createNode } from '.'
11
11
  import { updateProps } from './props'
12
12
  import createState from './state'
13
13
 
14
- import { measure } from '@domql/performance'
15
-
16
14
  const UPDATE_DEFAULT_OPTIONS = {
17
15
  stackChanges: false,
18
16
  cleanExec: true,