@domql/element 2.4.10 → 2.4.12

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/applyParam.js CHANGED
@@ -4,7 +4,7 @@ import { isFunction } from '@domql/utils'
4
4
  import { registry } from './mixins'
5
5
 
6
6
  export const applyParam = (param, element, options) => {
7
- const { node, context } = element
7
+ const { node, context, __ref: ref } = element
8
8
  const prop = element[param]
9
9
 
10
10
  const DOMQLProperty = registry[param]
@@ -14,6 +14,8 @@ export const applyParam = (param, element, options) => {
14
14
  const hasDefine = element.define && element.define[param]
15
15
  const hasContextDefine = context && context.define && context.define[param]
16
16
 
17
+ if (!ref.__if) return
18
+
17
19
  if (isGlobalTransformer && !hasContextDefine) {
18
20
  if (isFunction(isGlobalTransformer)) {
19
21
  isGlobalTransformer(prop, element, node, options)
package/create.js CHANGED
@@ -1,8 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  import createNode from './node'
4
-
5
- import { isObject, isFunction, isString, exec, is, isNode, isUndefined, createKey } from '@domql/utils'
6
4
  import { ROOT } from './tree'
7
5
  import { TAGS } from '@domql/registry'
8
6
  import { triggerEventOn } from '@domql/event'
@@ -15,9 +13,20 @@ import { createProps } from './props'
15
13
  import { applyExtend } from './extend'
16
14
  import { registry } from './mixins'
17
15
  import { addMethods } from './methods/set'
18
- import { assignClass } from './mixins/classList'
16
+ import { assignKeyAsClassname } from './mixins/classList'
19
17
  import { throughInitialExec } from './iterate'
20
18
 
19
+ import {
20
+ isObject,
21
+ isFunction,
22
+ isString,
23
+ exec,
24
+ is,
25
+ isNode,
26
+ isUndefined,
27
+ generateKey
28
+ } from '@domql/utils'
29
+
21
30
  import OPTIONS from './cache/options'
22
31
 
23
32
  import {
@@ -34,123 +43,155 @@ const ENV = process.env.NODE_ENV
34
43
  * Creating a domQL element using passed parameters
35
44
  */
36
45
  const create = (element, parent, key, options = OPTIONS.create || {}) => {
37
- if (options && !OPTIONS.create) {
38
- OPTIONS.create = options
39
- OPTIONS.create.context = element.context || options.context
40
- }
41
-
42
- // if ELEMENT is not given
43
- if (element === undefined) {
44
- if (ENV === 'test' || ENV === 'development') {
45
- console.warn(key, 'element is undefined in', parent && parent.__ref && parent.__ref.path)
46
- }
47
- element = {}
48
- }
49
- if (isString(key) && key.slice(0, 2 === '__')) {
50
- if (ENV === 'test' || ENV === 'development') {
51
- console.warn(key, 'seems like to be in __ref')
52
- }
53
- }
54
- if (element === null) return
55
- if (element === true) element = { text: true }
56
-
57
- // if element is extend
58
- if (element.__hash) {
59
- element = { extend: element }
60
- }
61
-
62
- // if PARENT is not given
63
- if (!parent) parent = ROOT
64
- if (isNode(parent)) {
65
- parent = ROOT[`${key}_parent`] = { key: ':root', node: parent }
66
- }
46
+ cacheOptions(element, options)
67
47
 
68
48
  // if element is STRING
69
49
  if (checkIfPrimitive(element)) {
70
- element = applyValueAsText(element, parent, key)
71
- }
72
-
73
- // define KEY
74
- const assignedKey = (key || element.key || createKey()).toString()
75
-
76
- if (checkIfKeyIsComponent(assignedKey)) {
77
- element = applyKeyComponentAsExtend(element, parent, assignedKey)
50
+ return applyValueAsText(element, parent, key)
78
51
  }
79
52
 
80
- // TODO: move as define plugins
81
- // Responsive rendering
82
- if (checkIfMedia(assignedKey)) {
83
- element = applyMediaProps(element, parent, assignedKey)
84
- }
53
+ element = redefineElement(element, parent, key, options)
54
+ parent = redefineParent(element, parent, key)
55
+ key = createKey(element, parent, key)
85
56
 
86
- if (element.__ref) element.__ref.origin = element
87
- else element.__ref = { origin: element } // eslint-disable-line
88
- const __ref = element.__ref
57
+ const ref = addRef(element, parent, key)
89
58
 
90
59
  // assign context
91
60
  applyContext(element, parent, options)
92
- const { context } = element
93
61
 
94
- if (context && context.components) {
95
- applyComponentFromContext(element, parent, options)
96
- }
62
+ applyComponentFromContext(element, parent, options)
97
63
 
98
64
  // create EXTEND inheritance
99
65
  applyExtend(element, parent, options)
100
66
 
101
67
  // create and assign a KEY
102
- element.key = assignedKey
68
+ element.key = key
103
69
 
104
70
  // Only resolve extends, skip everything else
105
71
  if (options.onlyResolveExtends) {
106
72
  return onlyResolveExtends(element, parent, options)
107
73
  }
108
74
 
109
- if (Object.keys(options).length) {
110
- registry.defaultOptions = options
111
- if (options.ignoreChildExtend) delete options.ignoreChildExtend
112
- }
75
+ replaceOptions(element, parent, options)
113
76
 
114
77
  addCaching(element, parent)
115
78
 
116
79
  addMethods(element, parent)
117
80
 
118
- // enable STATE
119
- element.state = createState(element, parent)
81
+ createState(element, parent)
120
82
 
121
- // don't render IF in condition
122
- checkIf(element, parent)
83
+ createIfConditionFlag(element, parent)
123
84
 
124
85
  // if it already HAS a NODE
125
- if (element.node && __ref.__if) { // TODO: check on if
126
- return assignNode(element, parent, assignedKey)
86
+ if (element.node && ref.__if) {
87
+ return assignNode(element, parent, key)
127
88
  }
128
89
 
129
90
  // apply props settings
130
- if (__ref.__if) createProps(element, parent)
91
+ createProps(element, parent)
131
92
 
132
93
  // apply variants
133
94
  applyVariant(element, parent)
134
95
 
135
- // run `on.init`
136
- const initReturns = triggerEventOn('init', element, options)
137
- if (initReturns === false) return element
96
+ const onInit = triggerEventOn('init', element, options)
97
+ if (onInit === false) return element
138
98
 
139
- // run `on.beforeClassAssign`
140
99
  triggerEventOn('beforeClassAssign', element, options)
141
100
 
142
101
  // generate a CLASS name
143
- assignClass(element)
102
+ assignKeyAsClassname(element)
144
103
 
145
104
  renderElement(element, parent, options)
146
105
 
147
- if (parent.__ref && parent.__ref.__children) parent.__ref.__children.push(element.key)
106
+ addElementIntoParentChildren(element, parent)
148
107
 
149
108
  triggerEventOn('complete', element, options)
150
109
 
151
110
  return element
152
111
  }
153
112
 
113
+ const createBasedOnType = (element, parent, key, options) => {
114
+ // if ELEMENT is not given
115
+ if (element === undefined) {
116
+ if (ENV === 'test' || ENV === 'development') {
117
+ console.warn(key, 'element is undefined in', parent && parent.__ref && parent.__ref.path)
118
+ }
119
+ return {}
120
+ }
121
+ if (isString(key) && key.slice(0, 2 === '__')) {
122
+ if (ENV === 'test' || ENV === 'development') {
123
+ console.warn(key, 'seems like to be in __ref')
124
+ }
125
+ }
126
+ if (element === null) return
127
+ if (element === true) return { text: true }
128
+
129
+ // if element is extend
130
+ if (element.__hash) {
131
+ return { extend: element }
132
+ }
133
+
134
+ return element
135
+ }
136
+
137
+ const redefineElement = (element, parent, key, options) => {
138
+ const elementWrapper = createBasedOnType(element, parent, key, options)
139
+
140
+ if (checkIfKeyIsComponent(key)) {
141
+ return applyKeyComponentAsExtend(elementWrapper, parent, key)
142
+ }
143
+
144
+ // TODO: move as define plugins
145
+ // Responsive rendering
146
+ if (checkIfMedia(key)) {
147
+ return applyMediaProps(elementWrapper, parent, key)
148
+ }
149
+
150
+ return elementWrapper
151
+ }
152
+
153
+ const redefineParent = (element, parent, key, options) => {
154
+ if (!parent) return ROOT
155
+ if (isNode(parent)) {
156
+ const parentNodeWrapper = { key: ':root', node: parent }
157
+ ROOT[`${key}_parent`] = parentNodeWrapper
158
+ return parentNodeWrapper
159
+ }
160
+ return parent
161
+ }
162
+
163
+ const cacheOptions = (element, options) => {
164
+ if (options && !OPTIONS.create) {
165
+ OPTIONS.create = options
166
+ OPTIONS.create.context = element.context || options.context
167
+ }
168
+ }
169
+
170
+ const createKey = (element, parent, key) => {
171
+ return (
172
+ key ||
173
+ element.key ||
174
+ generateKey()
175
+ ).toString()
176
+ }
177
+
178
+ const addRef = (element, parent) => {
179
+ if (element.__ref) element.__ref.origin = element
180
+ else element.__ref = { origin: element }
181
+ return element.__ref
182
+ }
183
+
184
+ const replaceOptions = (element, parent, options) => {
185
+ if (Object.keys(options).length) {
186
+ registry.defaultOptions = options
187
+ if (options.ignoreChildExtend) delete options.ignoreChildExtend
188
+ }
189
+ }
190
+
191
+ const addElementIntoParentChildren = (element, parent) => {
192
+ if (parent.__ref && parent.__ref.__children) parent.__ref.__children.push(element.key)
193
+ }
194
+
154
195
  const renderElement = (element, parent, options) => {
155
196
  const { __ref: ref, key } = element
156
197
 
@@ -188,7 +229,7 @@ const applyContext = (element, parent, options) => {
188
229
  if (!element.context) element.context = parent.context || options.context || ROOT.context
189
230
  }
190
231
 
191
- const checkIf = (element, parent) => {
232
+ const createIfConditionFlag = (element, parent) => {
192
233
  const { __ref: ref } = element
193
234
 
194
235
  if (isFunction(element.if)) {
@@ -249,7 +290,6 @@ const onlyResolveExtends = (element, parent, options) => {
249
290
  if (!__ref.__attr) __ref.__attr = {}
250
291
 
251
292
  if (!element.props) element.props = {}
252
- if (!element.state) element.state = element.parent.state || {}
253
293
 
254
294
  createState(element, parent, { skipApplyMethods: true, ...options })
255
295
  createProps(element, parent)
@@ -278,7 +318,6 @@ const onlyResolveExtends = (element, parent, options) => {
278
318
  }
279
319
  }
280
320
 
281
- delete element.parent
282
321
  delete element.update
283
322
  delete element.__element
284
323
 
@@ -287,8 +326,6 @@ const onlyResolveExtends = (element, parent, options) => {
287
326
  delete element.props.__element
288
327
 
289
328
  // added by createState
290
- delete element.state.__element
291
- delete element.state.__element
292
329
  if (!options.keepRef) delete element.__ref
293
330
 
294
331
  return element
@@ -24,13 +24,15 @@ module.exports = __toCommonJS(applyParam_exports);
24
24
  var import_utils = require("@domql/utils");
25
25
  var import_mixins = require("./mixins");
26
26
  const applyParam = (param, element, options) => {
27
- const { node, context } = element;
27
+ const { node, context, __ref: ref } = element;
28
28
  const prop = element[param];
29
29
  const DOMQLProperty = import_mixins.registry[param];
30
30
  const DOMQLPropertyFromContext = context && context.registry && context.registry[param];
31
31
  const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty;
32
32
  const hasDefine = element.define && element.define[param];
33
33
  const hasContextDefine = context && context.define && context.define[param];
34
+ if (!ref.__if)
35
+ return;
34
36
  if (isGlobalTransformer && !hasContextDefine) {
35
37
  if ((0, import_utils.isFunction)(isGlobalTransformer)) {
36
38
  isGlobalTransformer(prop, element, node, options);
@@ -32,7 +32,6 @@ __export(create_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(create_exports);
34
34
  var import_node = __toESM(require("./node"), 1);
35
- var import_utils = require("@domql/utils");
36
35
  var import_tree = require("./tree");
37
36
  var import_registry = require("@domql/registry");
38
37
  var import_event = require("@domql/event");
@@ -46,19 +45,52 @@ var import_mixins = require("./mixins");
46
45
  var import_set = require("./methods/set");
47
46
  var import_classList = require("./mixins/classList");
48
47
  var import_iterate = require("./iterate");
48
+ var import_utils = require("@domql/utils");
49
49
  var import_options = __toESM(require("./cache/options"), 1);
50
50
  var import_component = require("./utils/component");
51
51
  const ENV = "development";
52
52
  const create = (element, parent, key, options = import_options.default.create || {}) => {
53
- if (options && !import_options.default.create) {
54
- import_options.default.create = options;
55
- import_options.default.create.context = element.context || options.context;
53
+ cacheOptions(element, options);
54
+ if (checkIfPrimitive(element)) {
55
+ return applyValueAsText(element, parent, key);
56
+ }
57
+ element = redefineElement(element, parent, key, options);
58
+ parent = redefineParent(element, parent, key);
59
+ key = createKey(element, parent, key);
60
+ const ref = addRef(element, parent, key);
61
+ applyContext(element, parent, options);
62
+ (0, import_component.applyComponentFromContext)(element, parent, options);
63
+ (0, import_extend.applyExtend)(element, parent, options);
64
+ element.key = key;
65
+ if (options.onlyResolveExtends) {
66
+ return onlyResolveExtends(element, parent, options);
67
+ }
68
+ replaceOptions(element, parent, options);
69
+ addCaching(element, parent);
70
+ (0, import_set.addMethods)(element, parent);
71
+ (0, import_state.createState)(element, parent);
72
+ createIfConditionFlag(element, parent);
73
+ if (element.node && ref.__if) {
74
+ return (0, import_render.assignNode)(element, parent, key);
56
75
  }
76
+ (0, import_props.createProps)(element, parent);
77
+ (0, import_component.applyVariant)(element, parent);
78
+ const onInit = (0, import_event.triggerEventOn)("init", element, options);
79
+ if (onInit === false)
80
+ return element;
81
+ (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
82
+ (0, import_classList.assignKeyAsClassname)(element);
83
+ renderElement(element, parent, options);
84
+ addElementIntoParentChildren(element, parent);
85
+ (0, import_event.triggerEventOn)("complete", element, options);
86
+ return element;
87
+ };
88
+ const createBasedOnType = (element, parent, key, options) => {
57
89
  if (element === void 0) {
58
90
  if (ENV === "test" || ENV === "development") {
59
91
  console.warn(key, "element is undefined in", parent && parent.__ref && parent.__ref.path);
60
92
  }
61
- element = {};
93
+ return {};
62
94
  }
63
95
  if ((0, import_utils.isString)(key) && key.slice(0, 2 === "__")) {
64
96
  if (ENV === "test" || ENV === "development") {
@@ -68,65 +100,58 @@ const create = (element, parent, key, options = import_options.default.create ||
68
100
  if (element === null)
69
101
  return;
70
102
  if (element === true)
71
- element = { text: true };
103
+ return { text: true };
72
104
  if (element.__hash) {
73
- element = { extend: element };
105
+ return { extend: element };
74
106
  }
75
- if (!parent)
76
- parent = import_tree.ROOT;
77
- if ((0, import_utils.isNode)(parent)) {
78
- parent = import_tree.ROOT[`${key}_parent`] = { key: ":root", node: parent };
107
+ return element;
108
+ };
109
+ const redefineElement = (element, parent, key, options) => {
110
+ const elementWrapper = createBasedOnType(element, parent, key, options);
111
+ if ((0, import_component.checkIfKeyIsComponent)(key)) {
112
+ return (0, import_component.applyKeyComponentAsExtend)(elementWrapper, parent, key);
79
113
  }
80
- if (checkIfPrimitive(element)) {
81
- element = applyValueAsText(element, parent, key);
114
+ if (checkIfMedia(key)) {
115
+ return applyMediaProps(elementWrapper, parent, key);
82
116
  }
83
- const assignedKey = (key || element.key || (0, import_utils.createKey)()).toString();
84
- if ((0, import_component.checkIfKeyIsComponent)(assignedKey)) {
85
- element = (0, import_component.applyKeyComponentAsExtend)(element, parent, assignedKey);
117
+ return elementWrapper;
118
+ };
119
+ const redefineParent = (element, parent, key, options) => {
120
+ if (!parent)
121
+ return import_tree.ROOT;
122
+ if ((0, import_utils.isNode)(parent)) {
123
+ const parentNodeWrapper = { key: ":root", node: parent };
124
+ import_tree.ROOT[`${key}_parent`] = parentNodeWrapper;
125
+ return parentNodeWrapper;
86
126
  }
87
- if (checkIfMedia(assignedKey)) {
88
- element = applyMediaProps(element, parent, assignedKey);
127
+ return parent;
128
+ };
129
+ const cacheOptions = (element, options) => {
130
+ if (options && !import_options.default.create) {
131
+ import_options.default.create = options;
132
+ import_options.default.create.context = element.context || options.context;
89
133
  }
134
+ };
135
+ const createKey = (element, parent, key) => {
136
+ return (key || element.key || (0, import_utils.generateKey)()).toString();
137
+ };
138
+ const addRef = (element, parent) => {
90
139
  if (element.__ref)
91
140
  element.__ref.origin = element;
92
141
  else
93
142
  element.__ref = { origin: element };
94
- const __ref = element.__ref;
95
- applyContext(element, parent, options);
96
- const { context } = element;
97
- if (context && context.components) {
98
- (0, import_component.applyComponentFromContext)(element, parent, options);
99
- }
100
- (0, import_extend.applyExtend)(element, parent, options);
101
- element.key = assignedKey;
102
- if (options.onlyResolveExtends) {
103
- return onlyResolveExtends(element, parent, options);
104
- }
143
+ return element.__ref;
144
+ };
145
+ const replaceOptions = (element, parent, options) => {
105
146
  if (Object.keys(options).length) {
106
147
  import_mixins.registry.defaultOptions = options;
107
148
  if (options.ignoreChildExtend)
108
149
  delete options.ignoreChildExtend;
109
150
  }
110
- addCaching(element, parent);
111
- (0, import_set.addMethods)(element, parent);
112
- element.state = (0, import_state.createState)(element, parent);
113
- checkIf(element, parent);
114
- if (element.node && __ref.__if) {
115
- return (0, import_render.assignNode)(element, parent, assignedKey);
116
- }
117
- if (__ref.__if)
118
- (0, import_props.createProps)(element, parent);
119
- (0, import_component.applyVariant)(element, parent);
120
- const initReturns = (0, import_event.triggerEventOn)("init", element, options);
121
- if (initReturns === false)
122
- return element;
123
- (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
124
- (0, import_classList.assignClass)(element);
125
- renderElement(element, parent, options);
151
+ };
152
+ const addElementIntoParentChildren = (element, parent) => {
126
153
  if (parent.__ref && parent.__ref.__children)
127
154
  parent.__ref.__children.push(element.key);
128
- (0, import_event.triggerEventOn)("complete", element, options);
129
- return element;
130
155
  };
131
156
  const renderElement = (element, parent, options) => {
132
157
  const { __ref: ref, key } = element;
@@ -155,7 +180,7 @@ const applyContext = (element, parent, options) => {
155
180
  if (!element.context)
156
181
  element.context = parent.context || options.context || import_tree.ROOT.context;
157
182
  };
158
- const checkIf = (element, parent) => {
183
+ const createIfConditionFlag = (element, parent) => {
159
184
  const { __ref: ref } = element;
160
185
  if ((0, import_utils.isFunction)(element.if)) {
161
186
  const ifPassed = element.if(element, element.state);
@@ -209,8 +234,6 @@ const onlyResolveExtends = (element, parent, options) => {
209
234
  __ref.__attr = {};
210
235
  if (!element.props)
211
236
  element.props = {};
212
- if (!element.state)
213
- element.state = element.parent.state || {};
214
237
  (0, import_state.createState)(element, parent, { skipApplyMethods: true, ...options });
215
238
  (0, import_props.createProps)(element, parent);
216
239
  (0, import_component.applyVariant)(element, parent);
@@ -228,13 +251,10 @@ const onlyResolveExtends = (element, parent, options) => {
228
251
  create((0, import_utils.exec)(prop, element), element, param, options);
229
252
  }
230
253
  }
231
- delete element.parent;
232
254
  delete element.update;
233
255
  delete element.__element;
234
256
  delete element.props.update;
235
257
  delete element.props.__element;
236
- delete element.state.__element;
237
- delete element.state.__element;
238
258
  if (!options.keepRef)
239
259
  delete element.__ref;
240
260
  return element;
@@ -19,14 +19,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var classList_exports = {};
20
20
  __export(classList_exports, {
21
21
  applyClassListOnNode: () => applyClassListOnNode,
22
- assignClass: () => assignClass,
22
+ assignKeyAsClassname: () => assignKeyAsClassname,
23
23
  classList: () => classList,
24
24
  classify: () => classify,
25
25
  default: () => classList_default
26
26
  });
27
27
  module.exports = __toCommonJS(classList_exports);
28
28
  var import_utils = require("@domql/utils");
29
- const assignClass = (element) => {
29
+ const assignKeyAsClassname = (element) => {
30
30
  const { key } = element;
31
31
  if (element.class === true)
32
32
  element.class = key;
package/dist/cjs/node.js CHANGED
@@ -60,8 +60,6 @@ const createNode = (element, options) => {
60
60
  if ((0, import_utils.isFunction)(node.setAttribute))
61
61
  node.setAttribute("key", element.key);
62
62
  }
63
- if (!ref.__if)
64
- return element;
65
63
  if (element.tag !== "string" || element.tag !== "fragment") {
66
64
  (0, import_iterate.throughInitialDefine)(element);
67
65
  (0, import_iterate.throughInitialExec)(element);
@@ -63,9 +63,11 @@ const syncProps = (props, element) => {
63
63
  };
64
64
  const createProps = function(element, parent, cached) {
65
65
  const propsStack = cached || createPropsStack(element, parent);
66
- const { __ref } = element;
66
+ const { __ref: ref } = element;
67
+ if (!ref.__if)
68
+ return;
67
69
  if (propsStack.length) {
68
- __ref.__props = propsStack;
70
+ ref.__props = propsStack;
69
71
  syncProps(propsStack, element);
70
72
  element.props.update = update;
71
73
  }
@@ -76,6 +76,8 @@ const applyKeyComponentAsExtend = (element, parent, key) => {
76
76
  };
77
77
  const applyComponentFromContext = (element, parent, options) => {
78
78
  const { context } = element;
79
+ if (!context || !context.components)
80
+ return;
79
81
  const { components } = context;
80
82
  const { extend } = element;
81
83
  const execExtend = (0, import_utils.exec)(extend, element);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { exec, isObject, isString } from '@domql/utils'
4
4
 
5
- export const assignClass = (element) => {
5
+ export const assignKeyAsClassname = (element) => {
6
6
  const { key } = element
7
7
  if (element.class === true) element.class = key
8
8
  else if (!element.class && typeof key === 'string' && key.charAt(0) === '_' && key.charAt(1) !== '_') {
package/node.js CHANGED
@@ -44,8 +44,6 @@ export const createNode = (element, options) => {
44
44
  if (isFunction(node.setAttribute)) node.setAttribute('key', element.key)
45
45
  }
46
46
 
47
- if (!ref.__if) return element
48
-
49
47
  // iterate through all given params
50
48
  if (element.tag !== 'string' || element.tag !== 'fragment') {
51
49
  // iterate through define
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.4.10",
3
+ "version": "2.4.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -26,12 +26,11 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@domql/event": "latest",
29
- "@domql/node": "^2.3.125",
30
- "@domql/render": "^2.4.7",
29
+ "@domql/render": "latest",
31
30
  "@domql/state": "latest",
32
31
  "@domql/utils": "latest"
33
32
  },
34
- "gitHead": "0b2e301e066ed1745f29966e05bca8531c3487f6",
33
+ "gitHead": "fb655eb1dbbde28cb1b843f13aad21afcfcece40",
35
34
  "devDependencies": {
36
35
  "@babel/core": "^7.12.0"
37
36
  }
package/props/create.js CHANGED
@@ -43,10 +43,12 @@ export const syncProps = (props, element) => {
43
43
 
44
44
  export const createProps = function (element, parent, cached) {
45
45
  const propsStack = cached || createPropsStack(element, parent)
46
- const { __ref } = element
46
+ const { __ref: ref } = element
47
+
48
+ if (!ref.__if) return
47
49
 
48
50
  if (propsStack.length) {
49
- __ref.__props = propsStack
51
+ ref.__props = propsStack
50
52
  syncProps(propsStack, element)
51
53
  element.props.update = update
52
54
  }
@@ -54,6 +54,9 @@ export const applyKeyComponentAsExtend = (element, parent, key) => {
54
54
 
55
55
  export const applyComponentFromContext = (element, parent, options) => {
56
56
  const { context } = element
57
+
58
+ if (!context || !context.components) return
59
+
57
60
  const { components } = context
58
61
  const { extend } = element
59
62
  const execExtend = exec(extend, element)