@domql/element 2.5.16 → 2.5.17

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/create.js CHANGED
@@ -64,8 +64,10 @@ const create = (element, parent, key, options = OPTIONS.create || {}) => {
64
64
 
65
65
  applyComponentFromContext(element, parent, options)
66
66
 
67
- // create EXTEND inheritance
68
- applyExtend(element, parent, options)
67
+ if (!ref.__skipCreate) {
68
+ // create EXTEND inheritance
69
+ applyExtend(element, parent, options)
70
+ }
69
71
 
70
72
  // create and assign a KEY
71
73
  element.key = key
@@ -287,20 +289,13 @@ const addCaching = (element, parent) => {
287
289
  }
288
290
 
289
291
  const onlyResolveExtends = (element, parent, key, options) => {
290
- const { __ref } = element
291
- element.tag = detectTag(element)
292
-
293
- // if (!element.props) element.props = {}
294
-
295
- // Copy-paste of addCaching()
296
- {
297
- const { __ref: ref } = element
298
- const { __ref: parentRef } = parent // eslint-disable-line
292
+ const { __ref: ref } = element
293
+ if (!ref.__skipCreate) {
294
+ element.tag = detectTag(element)
299
295
 
300
- // enable TRANSFORM in data
301
- // TODO: do we need this at all?
302
- // if (!element.transform) element.transform = {}
296
+ // if (!element.props) element.props = {}
303
297
 
298
+ // Copy-paste of addCaching()
304
299
  // enable CACHING
305
300
  if (!ref.__cached) ref.__cached = {}
306
301
  if (!ref.__defineCache) ref.__defineCache = {}
@@ -324,29 +319,28 @@ const onlyResolveExtends = (element, parent, key, options) => {
324
319
  // Add __root element property
325
320
  // const hasRoot = parent && parent.key === ':root'
326
321
  // if (!ref.__root) ref.__root = hasRoot ? element : parentRef.__root
327
- }
328
322
 
329
- addMethods(element, parent)
323
+ addMethods(element, parent)
330
324
 
331
- createState(element, parent)
325
+ createState(element, parent)
332
326
 
333
- // Borrowed from createIfConditionFlag()
334
- const ref = __ref
335
- if (isFunction(element.if)) {
336
- const ifPassed = element.if(element, element.state)
337
- if (!ifPassed) {
338
- // const ifFragment = cacheNode({ tag: 'fragment' })
339
- // ref.__ifFragment = appendNode(ifFragment, parent.node)
340
- delete ref.__if
327
+ // Borrowed from createIfConditionFlag()
328
+ if (isFunction(element.if)) {
329
+ const ifPassed = element.if(element, element.state)
330
+ if (!ifPassed) {
331
+ // const ifFragment = cacheNode({ tag: 'fragment' })
332
+ // ref.__ifFragment = appendNode(ifFragment, parent.node)
333
+ delete ref.__if
334
+ } else ref.__if = true
341
335
  } else ref.__if = true
342
- } else ref.__if = true
343
- /// ///
336
+ /// ///
344
337
 
345
- if (element.node && ref.__if) { parent[key || element.key] = element } // Borrowed from assignNode()
338
+ if (element.node && ref.__if) { parent[key || element.key] = element } // Borrowed from assignNode()
346
339
 
347
- createProps(element, parent)
348
- if (!element.props) element.props = {}
349
- applyVariant(element, parent)
340
+ createProps(element, parent)
341
+ if (!element.props) element.props = {}
342
+ applyVariant(element, parent)
343
+ }
350
344
 
351
345
  if (element.tag !== 'string' && element.tag !== 'fragment') {
352
346
  throughInitialDefine(element)
@@ -365,7 +359,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
365
359
  element.context.define[k]
366
360
  const optionsHasDefine = options.define && options.define[k]
367
361
 
368
- if (registry[k] && !optionsHasDefine) {
362
+ if (!ref.__skipCreate && registry[k] && !optionsHasDefine) {
369
363
  continue
370
364
  } else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
371
365
  create(exec(element[k], element), element, k, options)
@@ -60,7 +60,9 @@ const create = (element, parent, key, options = import_options.default.create ||
60
60
  ref.__initialProps = (0, import_utils.deepClone)(element.props, []);
61
61
  applyContext(element, parent, options);
62
62
  (0, import_component.applyComponentFromContext)(element, parent, options);
63
- (0, import_extend.applyExtend)(element, parent, options);
63
+ if (!ref.__skipCreate) {
64
+ (0, import_extend.applyExtend)(element, parent, options);
65
+ }
64
66
  element.key = key;
65
67
  if (options.onlyResolveExtends) {
66
68
  return onlyResolveExtends(element, parent, key, options);
@@ -226,46 +228,43 @@ const addCaching = (element, parent) => {
226
228
  }
227
229
  };
228
230
  const onlyResolveExtends = (element, parent, key, options) => {
229
- const { __ref } = element;
230
- element.tag = (0, import_render.detectTag)(element);
231
- {
232
- const { __ref: ref2 } = element;
233
- const { __ref: parentRef } = parent;
234
- if (!ref2.__cached)
235
- ref2.__cached = {};
236
- if (!ref2.__defineCache)
237
- ref2.__defineCache = {};
238
- if (!ref2.__exec)
239
- ref2.__exec = {};
240
- if (!ref2.__class)
241
- ref2.__class = {};
242
- if (!ref2.__classNames)
243
- ref2.__classNames = {};
244
- if (!ref2.__attr)
245
- ref2.__attr = {};
246
- if (!ref2.__changes)
247
- ref2.__changes = [];
248
- if (!ref2.__children)
249
- ref2.__children = [];
250
- }
251
- (0, import_set.addMethods)(element, parent);
252
- (0, import_state.createState)(element, parent);
253
- const ref = __ref;
254
- if ((0, import_utils.isFunction)(element.if)) {
255
- const ifPassed = element.if(element, element.state);
256
- if (!ifPassed) {
257
- delete ref.__if;
231
+ const { __ref: ref } = element;
232
+ if (!ref.__skipCreate) {
233
+ element.tag = (0, import_render.detectTag)(element);
234
+ if (!ref.__cached)
235
+ ref.__cached = {};
236
+ if (!ref.__defineCache)
237
+ ref.__defineCache = {};
238
+ if (!ref.__exec)
239
+ ref.__exec = {};
240
+ if (!ref.__class)
241
+ ref.__class = {};
242
+ if (!ref.__classNames)
243
+ ref.__classNames = {};
244
+ if (!ref.__attr)
245
+ ref.__attr = {};
246
+ if (!ref.__changes)
247
+ ref.__changes = [];
248
+ if (!ref.__children)
249
+ ref.__children = [];
250
+ (0, import_set.addMethods)(element, parent);
251
+ (0, import_state.createState)(element, parent);
252
+ if ((0, import_utils.isFunction)(element.if)) {
253
+ const ifPassed = element.if(element, element.state);
254
+ if (!ifPassed) {
255
+ delete ref.__if;
256
+ } else
257
+ ref.__if = true;
258
258
  } else
259
259
  ref.__if = true;
260
- } else
261
- ref.__if = true;
262
- if (element.node && ref.__if) {
263
- parent[key || element.key] = element;
260
+ if (element.node && ref.__if) {
261
+ parent[key || element.key] = element;
262
+ }
263
+ (0, import_props.createProps)(element, parent);
264
+ if (!element.props)
265
+ element.props = {};
266
+ (0, import_component.applyVariant)(element, parent);
264
267
  }
265
- (0, import_props.createProps)(element, parent);
266
- if (!element.props)
267
- element.props = {};
268
- (0, import_component.applyVariant)(element, parent);
269
268
  if (element.tag !== "string" && element.tag !== "fragment") {
270
269
  (0, import_iterate.throughInitialDefine)(element);
271
270
  (0, import_iterate.throughInitialExec)(element);
@@ -275,7 +274,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
275
274
  const hasDefine = element.define && element.define[k];
276
275
  const contextHasDefine = element.context && element.context.define && element.context.define[k];
277
276
  const optionsHasDefine = options.define && options.define[k];
278
- if (import_mixins.registry[k] && !optionsHasDefine) {
277
+ if (!ref.__skipCreate && import_mixins.registry[k] && !optionsHasDefine) {
279
278
  continue;
280
279
  } else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
281
280
  create((0, import_utils.exec)(element[k], element), element, k, options);
@@ -124,8 +124,6 @@ const cloneAndMergeArrayExtend = (stack) => {
124
124
  const fallbackStringExtend = (extend, context, options) => {
125
125
  const COMPONENTS = context && context.components || options.components;
126
126
  if ((0, import_utils.isString)(extend)) {
127
- console.log("extend", extend);
128
- console.log(COMPONENTS[extend]);
129
127
  if (COMPONENTS && COMPONENTS[extend]) {
130
128
  return COMPONENTS[extend];
131
129
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.16",
3
+ "version": "2.5.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -31,7 +31,7 @@
31
31
  "@domql/state": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "2987c1965a4cab0258feb592d273d519260f5461",
34
+ "gitHead": "b08d17a7f2bf1a70714ab9f1718cbf98862becf0",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -92,8 +92,6 @@ export const cloneAndMergeArrayExtend = stack => {
92
92
  export const fallbackStringExtend = (extend, context, options) => {
93
93
  const COMPONENTS = (context && context.components) || options.components
94
94
  if (isString(extend)) {
95
- console.log('extend', extend)
96
- console.log(COMPONENTS[extend])
97
95
  if (COMPONENTS && COMPONENTS[extend]) {
98
96
  return COMPONENTS[extend]
99
97
  } else {