@domql/element 2.5.61 → 2.5.63

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)) {
@@ -215,7 +215,11 @@ const renderElement = (element, parent, options, attachOptions) => {
215
215
  const { __ref: ref, key } = element
216
216
 
217
217
  // CREATE a real NODE
218
- createNode(element, options)
218
+ try {
219
+ createNode(element, options)
220
+ } catch (e) {
221
+ if (ENV === 'test' || ENV === 'development') console.warn(e)
222
+ }
219
223
 
220
224
  if (!ref.__if) {
221
225
  parent[key || element.key] = element
@@ -230,6 +234,9 @@ const renderElement = (element, parent, options, attachOptions) => {
230
234
 
231
235
  // run `on.render`
232
236
  triggerEventOn('render', element, options)
237
+
238
+ // run `on.done`
239
+ triggerEventOn('done', element, options)
233
240
  }
234
241
 
235
242
  const checkIfPrimitive = (element) => is(element)('string', 'number')
@@ -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.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)) {
@@ -167,7 +166,12 @@ const addElementIntoParentChildren = (element, parent) => {
167
166
  };
168
167
  const renderElement = (element, parent, options, attachOptions) => {
169
168
  const { __ref: ref, key } = element;
170
- (0, import_node.default)(element, options);
169
+ try {
170
+ (0, import_node.default)(element, options);
171
+ } catch (e) {
172
+ if (ENV === "test" || ENV === "development")
173
+ console.warn(e);
174
+ }
171
175
  if (!ref.__if) {
172
176
  parent[key || element.key] = element;
173
177
  return element;
@@ -175,6 +179,7 @@ const renderElement = (element, parent, options, attachOptions) => {
175
179
  (0, import_render.assignNode)(element, parent, key, attachOptions);
176
180
  (0, import_event.triggerEventOn)("renderRouter", element, options);
177
181
  (0, import_event.triggerEventOn)("render", element, options);
182
+ (0, import_event.triggerEventOn)("done", element, options);
178
183
  };
179
184
  const checkIfPrimitive = (element) => (0, import_utils.is)(element)("string", "number");
180
185
  const applyValueAsText = (element, parent, key) => {
@@ -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.61",
3
+ "version": "2.5.63",
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": "c6aea56536fc17cf5176fed238cf77da99965ed8",
34
+ "gitHead": "318bb5d6c6b3989cc97b2a2f12c0169599786ffa",
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