@domql/element 2.5.62 → 2.5.65

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
@@ -152,7 +152,7 @@ const createBasedOnType = (element, parent, key, options) => {
152
152
  const redefineElement = (element, parent, key, options) => {
153
153
  const elementWrapper = createBasedOnType(element, parent, key, options)
154
154
 
155
- if (options.syntaxv3 || element.props?.syntaxv3 || parent?.props?.syntaxv3) {
155
+ if (options.syntaxv3 || (element.props && element.props.syntaxv3) || (parent && parent.props && parent.props.syntaxv3) /* kalduna guard */) {
156
156
  element.props.syntaxv3 = true
157
157
  return createValidDomqlObjectFromSugar(element, parent, key, options)
158
158
  } else if (checkIfKeyIsComponent(key)) {
@@ -234,6 +234,9 @@ const renderElement = (element, parent, options, attachOptions) => {
234
234
 
235
235
  // run `on.render`
236
236
  triggerEventOn('render', element, options)
237
+
238
+ // run `on.done`
239
+ triggerEventOn('done', element, options)
237
240
  }
238
241
 
239
242
  const checkIfPrimitive = (element) => is(element)('string', 'number')
@@ -260,7 +263,7 @@ const applyContext = (element, parent, options) => {
260
263
  const createScope = (element, parent) => {
261
264
  const { __ref: ref } = element
262
265
  // If the element doesn't have a scope, initialize it using the parent's scope or the root's scope.
263
- if (!element.scope) element.scope = parent.scope || ref.__root.scope || {}
266
+ if (!element.scope) element.scope = parent.scope || ref.root.scope || {}
264
267
  }
265
268
 
266
269
  const createIfConditionFlag = (element, parent) => {
@@ -300,7 +303,7 @@ const addCaching = (element, parent) => {
300
303
 
301
304
  // Add _root element property
302
305
  const hasRoot = parent && parent.key === ':root'
303
- if (!ref.__root) ref.__root = hasRoot ? element : parentRef.__root
306
+ if (!ref.root) ref.root = hasRoot ? element : parentRef.root
304
307
 
305
308
  // set the PATH array
306
309
  if (ENV === 'test' || ENV === 'development') {
@@ -338,9 +341,9 @@ const onlyResolveExtends = (element, parent, key, options) => {
338
341
  // enable CHANGES storing
339
342
  if (!ref.__children) ref.__children = []
340
343
 
341
- // Add __root element property
344
+ // Add root element property
342
345
  // const hasRoot = parent && parent.key === ':root'
343
- // if (!ref.__root) ref.__root = hasRoot ? element : parentRef.__root
346
+ // if (!ref.root) ref.root = hasRoot ? element : parentRef.root
344
347
 
345
348
  addMethods(element, parent)
346
349
 
@@ -115,9 +115,8 @@ const createBasedOnType = (element, parent, key, options) => {
115
115
  return element;
116
116
  };
117
117
  const redefineElement = (element, parent, key, options) => {
118
- var _a, _b;
119
118
  const elementWrapper = createBasedOnType(element, parent, key, options);
120
- if (options.syntaxv3 || ((_a = element.props) == null ? void 0 : _a.syntaxv3) || ((_b = parent == null ? void 0 : parent.props) == null ? void 0 : _b.syntaxv3)) {
119
+ if (options.syntaxv3 || element.props && element.props.syntaxv3 || parent && parent.props && parent.props.syntaxv3) {
121
120
  element.props.syntaxv3 = true;
122
121
  return (0, import_component.createValidDomqlObjectFromSugar)(element, parent, key, options);
123
122
  } else if ((0, import_component.checkIfKeyIsComponent)(key)) {
@@ -180,6 +179,7 @@ const renderElement = (element, parent, options, attachOptions) => {
180
179
  (0, import_render.assignNode)(element, parent, key, attachOptions);
181
180
  (0, import_event.triggerEventOn)("renderRouter", element, options);
182
181
  (0, import_event.triggerEventOn)("render", element, options);
182
+ (0, import_event.triggerEventOn)("done", element, options);
183
183
  };
184
184
  const checkIfPrimitive = (element) => (0, import_utils.is)(element)("string", "number");
185
185
  const applyValueAsText = (element, parent, key) => {
@@ -201,7 +201,7 @@ const applyContext = (element, parent, options) => {
201
201
  const createScope = (element, parent) => {
202
202
  const { __ref: ref } = element;
203
203
  if (!element.scope)
204
- element.scope = parent.scope || ref.__root.scope || {};
204
+ element.scope = parent.scope || ref.root.scope || {};
205
205
  };
206
206
  const createIfConditionFlag = (element, parent) => {
207
207
  const { __ref: ref } = element;
@@ -232,8 +232,8 @@ const addCaching = (element, parent) => {
232
232
  if (!ref.__children)
233
233
  ref.__children = [];
234
234
  const hasRoot = parent && parent.key === ":root";
235
- if (!ref.__root)
236
- ref.__root = hasRoot ? element : parentRef.__root;
235
+ if (!ref.root)
236
+ ref.root = hasRoot ? element : parentRef.root;
237
237
  if (ENV === "test" || ENV === "development") {
238
238
  if (!parentRef)
239
239
  parentRef = parent.ref = {};
@@ -93,8 +93,8 @@ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
93
93
  return newElem;
94
94
  };
95
95
  const extendizeByKey = (element, parent, key) => {
96
- const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element;
97
- const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr;
96
+ const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
97
+ const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
98
98
  const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
99
99
  const isExtendKeyComponent = context && context.components[extendFromKey];
100
100
  if (element === isExtendKeyComponent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.62",
3
+ "version": "2.5.65",
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": "005657169525f7aaa256f4e62d6a4688d6e2046a",
34
+ "gitHead": "473e5569815c8e062b8e584549889557330c249a",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -66,8 +66,8 @@ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
66
66
  }
67
67
 
68
68
  export const extendizeByKey = (element, parent, key) => {
69
- const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element
70
- const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr
69
+ const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element
70
+ const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data
71
71
 
72
72
  const extendFromKey = key.includes('+')
73
73
  ? key.split('+') // get array of componentKeys
@@ -46,9 +46,9 @@ export const onlyResolveExtends = (element, parent, key, options) => {
46
46
  // enable CHANGES storing
47
47
  if (!ref.__children) ref.__children = []
48
48
 
49
- // Add __root element property
49
+ // Add root element property
50
50
  // const hasRoot = parent && parent.key === ':root'
51
- // if (!ref.__root) ref.__root = hasRoot ? element : parentRef.__root
51
+ // if (!ref.root) ref.root = hasRoot ? element : parentRef.root
52
52
  }
53
53
 
54
54
  addMethods(element, parent)