@domql/element 2.5.187 → 2.5.190

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
@@ -22,7 +22,7 @@ import {
22
22
  addChildrenIfNotInOriginal
23
23
  } from '@domql/utils'
24
24
 
25
- import { triggerEventOn } from '@domql/event'
25
+ import { applyAnimationFrame, triggerEventOn } from '@domql/event'
26
26
  import { assignNode } from '@domql/render'
27
27
  import { createState } from '@domql/state'
28
28
 
@@ -222,14 +222,20 @@ const renderElement = async (element, parent, options, attachOptions) => {
222
222
 
223
223
  const { __ref: ref, key } = element
224
224
 
225
- // CREATE a real NODE
226
- try {
225
+ const createNestedChild = async () => {
227
226
  const isInfiniteLoopDetected = detectInfiniteLoop(ref.path)
228
227
  if (ref.__uniqId || isInfiniteLoopDetected) return
229
228
  await createNode(element, options)
230
229
  ref.__uniqId = Math.random()
231
- } catch (e) {
232
- if (ENV === 'test' || ENV === 'development') {
230
+ }
231
+
232
+ // CREATE a real NODE
233
+ if (ENV === 'test' || ENV === 'development') {
234
+ await createNestedChild()
235
+ } else {
236
+ try {
237
+ await createNestedChild()
238
+ } catch (e) {
233
239
  const path = ref.path
234
240
  if (path.includes('ComponentsGrid')) path.splice(0, path.indexOf('ComponentsGrid') + 2)
235
241
  if (path.includes('demoComponent')) path.splice(0, path.indexOf('demoComponent') + 1)
@@ -250,6 +256,9 @@ const renderElement = async (element, parent, options, attachOptions) => {
250
256
  // assign NODE
251
257
  assignNode(element, parent, key, attachOptions)
252
258
 
259
+ // apply events
260
+ applyAnimationFrame(element, options)
261
+
253
262
  // run `on.renderRouter`
254
263
  await triggerEventOn('renderRouter', element, options)
255
264
 
@@ -178,14 +178,19 @@ const renderElement = async (element, parent, options, attachOptions) => {
178
178
  }
179
179
  visitedElements.set(element, true);
180
180
  const { __ref: ref, key } = element;
181
- try {
181
+ const createNestedChild = async () => {
182
182
  const isInfiniteLoopDetected = (0, import_utils.detectInfiniteLoop)(ref.path);
183
183
  if (ref.__uniqId || isInfiniteLoopDetected)
184
184
  return;
185
185
  await (0, import_node.default)(element, options);
186
186
  ref.__uniqId = Math.random();
187
- } catch (e) {
188
- if (ENV === "test" || ENV === "development") {
187
+ };
188
+ if (ENV === "test" || ENV === "development") {
189
+ await createNestedChild();
190
+ } else {
191
+ try {
192
+ await createNestedChild();
193
+ } catch (e) {
189
194
  const path = ref.path;
190
195
  if (path.includes("ComponentsGrid"))
191
196
  path.splice(0, path.indexOf("ComponentsGrid") + 2);
@@ -206,6 +211,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
206
211
  return element;
207
212
  }
208
213
  (0, import_render.assignNode)(element, parent, key, attachOptions);
214
+ (0, import_event.applyAnimationFrame)(element, options);
209
215
  await (0, import_event.triggerEventOn)("renderRouter", element, options);
210
216
  await (0, import_event.triggerEventOn)("render", element, options);
211
217
  await (0, import_event.triggerEventOn)("done", element, options);
@@ -48,7 +48,7 @@ const REGISTRY = {
48
48
  style: import_style.default,
49
49
  text: import_text.default,
50
50
  html: import_html.default,
51
- setContent: import_content.default,
51
+ content: import_content.default,
52
52
  data: import_data.default,
53
53
  class: import_classList.classList,
54
54
  state: import_state.default,
package/dist/cjs/node.js CHANGED
@@ -65,7 +65,6 @@ const createNode = async (element, options) => {
65
65
  (0, import_iterate.throughInitialExec)(element);
66
66
  if (element.tag !== "string" && element.tag !== "fragment") {
67
67
  (0, import_propEvents.propagateEventsFromProps)(element);
68
- (0, import_event.applyAnimationFrame)(element, options);
69
68
  if (isNewNode && (0, import_utils.isObject)(element.on)) {
70
69
  (0, import_event.applyEventsOnNode)(element, options);
71
70
  }
package/dist/cjs/set.js CHANGED
@@ -73,15 +73,16 @@ const set = function(params, options = {}, el) {
73
73
  return;
74
74
  }
75
75
  if (params) {
76
- let { childExtend, childProps, props } = params;
77
- if (!childExtend && element.childExtend)
76
+ let { childExtend, props } = params;
77
+ if (!props)
78
+ props = params.props = {};
79
+ if (!childExtend && element.childExtend) {
78
80
  params.childExtend = element.childExtend;
79
- if (!childProps && element.childProps)
80
- params.childProps = element.childProps;
81
+ props.ignoreChildExtend = true;
82
+ }
81
83
  if (!(props == null ? void 0 : props.childProps) && ((_a = element.props) == null ? void 0 : _a.childProps)) {
82
- if (!props)
83
- props = params.props = {};
84
84
  props.childProps = element.props.childProps;
85
+ props.ignoreChildProps = true;
85
86
  }
86
87
  if (lazyLoad) {
87
88
  window.requestAnimationFrame(() => resetElement(params, element, options));
@@ -18,7 +18,7 @@ import {
18
18
  detectInfiniteLoop,
19
19
  addChildrenIfNotInOriginal
20
20
  } from "@domql/utils";
21
- import { triggerEventOn } from "@domql/event";
21
+ import { applyAnimationFrame, triggerEventOn } from "@domql/event";
22
22
  import { assignNode } from "@domql/render";
23
23
  import { createState } from "@domql/state";
24
24
  import { isMethod } from "./methods/index.js";
@@ -164,14 +164,19 @@ const renderElement = async (element, parent, options, attachOptions) => {
164
164
  }
165
165
  visitedElements.set(element, true);
166
166
  const { __ref: ref, key } = element;
167
- try {
167
+ const createNestedChild = async () => {
168
168
  const isInfiniteLoopDetected = detectInfiniteLoop(ref.path);
169
169
  if (ref.__uniqId || isInfiniteLoopDetected)
170
170
  return;
171
171
  await createNode(element, options);
172
172
  ref.__uniqId = Math.random();
173
- } catch (e) {
174
- if (ENV === "test" || ENV === "development") {
173
+ };
174
+ if (ENV === "test" || ENV === "development") {
175
+ await createNestedChild();
176
+ } else {
177
+ try {
178
+ await createNestedChild();
179
+ } catch (e) {
175
180
  const path = ref.path;
176
181
  if (path.includes("ComponentsGrid"))
177
182
  path.splice(0, path.indexOf("ComponentsGrid") + 2);
@@ -192,6 +197,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
192
197
  return element;
193
198
  }
194
199
  assignNode(element, parent, key, attachOptions);
200
+ applyAnimationFrame(element, options);
195
201
  await triggerEventOn("renderRouter", element, options);
196
202
  await triggerEventOn("render", element, options);
197
203
  await triggerEventOn("done", element, options);
@@ -1,6 +1,6 @@
1
1
  import attr from "./attr.js";
2
2
  import { classList } from "./classList.js";
3
- import setContent from "./content.js";
3
+ import content from "./content.js";
4
4
  import data from "./data.js";
5
5
  import html from "./html.js";
6
6
  import scope from "./scope.js";
@@ -12,7 +12,7 @@ const REGISTRY = {
12
12
  style,
13
13
  text,
14
14
  html,
15
- setContent,
15
+ content,
16
16
  data,
17
17
  class: classList,
18
18
  state,
package/dist/esm/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { exec, isFunction, isObject, isUndefined, isVariant } from "@domql/utils";
2
- import { applyEventsOnNode, triggerEventOn, applyAnimationFrame } from "@domql/event";
2
+ import { applyEventsOnNode, triggerEventOn } from "@domql/event";
3
3
  import { cacheNode } from "@domql/render";
4
4
  import { isMethod } from "./methods/index.js";
5
5
  import create from "./create.js";
@@ -35,7 +35,6 @@ const createNode = async (element, options) => {
35
35
  throughInitialExec(element);
36
36
  if (element.tag !== "string" && element.tag !== "fragment") {
37
37
  propagateEventsFromProps(element);
38
- applyAnimationFrame(element, options);
39
38
  if (isNewNode && isObject(element.on)) {
40
39
  applyEventsOnNode(element, options);
41
40
  }
package/dist/esm/set.js CHANGED
@@ -47,15 +47,16 @@ const set = function(params, options = {}, el) {
47
47
  return;
48
48
  }
49
49
  if (params) {
50
- let { childExtend, childProps, props } = params;
51
- if (!childExtend && element.childExtend)
50
+ let { childExtend, props } = params;
51
+ if (!props)
52
+ props = params.props = {};
53
+ if (!childExtend && element.childExtend) {
52
54
  params.childExtend = element.childExtend;
53
- if (!childProps && element.childProps)
54
- params.childProps = element.childProps;
55
+ props.ignoreChildExtend = true;
56
+ }
55
57
  if (!(props == null ? void 0 : props.childProps) && ((_a = element.props) == null ? void 0 : _a.childProps)) {
56
- if (!props)
57
- props = params.props = {};
58
58
  props.childProps = element.props.childProps;
59
+ props.ignoreChildProps = true;
59
60
  }
60
61
  if (lazyLoad) {
61
62
  window.requestAnimationFrame(() => resetElement(params, element, options));
@@ -2,7 +2,7 @@
2
2
 
3
3
  import attr from './attr.js'
4
4
  import { classList } from './classList.js'
5
- import setContent from './content.js'
5
+ import content from './content.js'
6
6
  import data from './data.js'
7
7
  import html from './html.js'
8
8
  import scope from './scope.js'
@@ -15,7 +15,7 @@ export const REGISTRY = {
15
15
  style,
16
16
  text,
17
17
  html,
18
- setContent,
18
+ content,
19
19
  data,
20
20
  class: classList,
21
21
  state,
package/node.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { exec, isFunction, isObject, isUndefined, isVariant } from '@domql/utils'
4
- import { applyEventsOnNode, triggerEventOn, applyAnimationFrame } from '@domql/event'
4
+ import { applyEventsOnNode, triggerEventOn } from '@domql/event'
5
5
  import { cacheNode } from '@domql/render'
6
6
  import { isMethod } from './methods/index.js'
7
7
 
@@ -37,7 +37,6 @@ export const createNode = async (element, options) => {
37
37
  // trigger `on.attachNode`
38
38
  triggerEventOn('attachNode', element, options)
39
39
  }
40
-
41
40
  // node.dataset // .key = element.key
42
41
 
43
42
  if (ENV === 'test' || ENV === 'development' || options.alowRefReference) {
@@ -57,9 +56,6 @@ export const createNode = async (element, options) => {
57
56
  if (element.tag !== 'string' && element.tag !== 'fragment') {
58
57
  propagateEventsFromProps(element)
59
58
 
60
- // apply events
61
- applyAnimationFrame(element, options)
62
-
63
59
  if (isNewNode && isObject(element.on)) {
64
60
  applyEventsOnNode(element, options)
65
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.187",
3
+ "version": "2.5.190",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -27,12 +27,12 @@
27
27
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.5.187",
31
- "@domql/render": "^2.5.187",
32
- "@domql/state": "^2.5.187",
30
+ "@domql/event": "^2.5.190",
31
+ "@domql/render": "^2.5.190",
32
+ "@domql/state": "^2.5.190",
33
33
  "@domql/utils": "^2.5.187"
34
34
  },
35
- "gitHead": "c150bfbbdd51b19d25c93f10334d54175cea9d1d",
35
+ "gitHead": "c4e06a81317c6d43c070d9ad93bbaeba24b3bb3b",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.12.0"
38
38
  }
package/set.js CHANGED
@@ -51,12 +51,15 @@ export const set = function (params, options = {}, el) {
51
51
  }
52
52
 
53
53
  if (params) {
54
- let { childExtend, childProps, props } = params
55
- if (!childExtend && element.childExtend) params.childExtend = element.childExtend
56
- if (!childProps && element.childProps) params.childProps = element.childProps
54
+ let { childExtend, props } = params
55
+ if (!props) props = params.props = {}
56
+ if (!childExtend && element.childExtend) {
57
+ params.childExtend = element.childExtend
58
+ props.ignoreChildExtend = true
59
+ }
57
60
  if (!props?.childProps && element.props?.childProps) {
58
- if (!props) props = params.props = {}
59
61
  props.childProps = element.props.childProps
62
+ props.ignoreChildProps = true
60
63
  }
61
64
 
62
65
  if (lazyLoad) {