@domql/element 2.29.38 → 2.29.40

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/dist/cjs/node.js CHANGED
@@ -35,6 +35,9 @@ var import_env = require("@domql/utils/env.js");
35
35
  const createNode = async (element, options) => {
36
36
  let { node, tag, __ref: ref } = element;
37
37
  let isNewNode;
38
+ if (options.routerContentElement && options.lastElement) {
39
+ if (options.routerContentElement !== options.lastElement.content) return;
40
+ }
38
41
  if (!node) {
39
42
  isNewNode = true;
40
43
  if (!ref.__if) return element;
package/dist/cjs/set.js CHANGED
@@ -31,7 +31,7 @@ var import_mixins = require("./mixins/index.js");
31
31
  var import_content = require("./mixins/content.js");
32
32
  var import_event = require("@domql/event");
33
33
  const resetElement = async (params, element, options) => {
34
- if (!options.preventRemove) await (0, import_content.removeContent)(element, options);
34
+ if (!options.preventRemove) (0, import_content.removeContent)(element, options);
35
35
  const { __ref: ref } = element;
36
36
  if (params instanceof Promise) console.log(params, params instanceof Promise);
37
37
  await (0, import_create.create)(params, element, ref.contentElementKey || "content", {
@@ -51,9 +51,14 @@ const reset = async (options) => {
51
51
  });
52
52
  };
53
53
  const set = async function(params, options = {}, el) {
54
- var _a;
54
+ var _a, _b;
55
55
  const element = el || this;
56
56
  const { __ref: ref } = element;
57
+ if (options.preventContentUpdate || ((_a = options.preventUpdate) == null ? void 0 : _a.includes("content")))
58
+ return;
59
+ if (options.routerContentElement && options.lastElement) {
60
+ if (options.routerContentElement !== options.lastElement.content) return;
61
+ }
57
62
  const content = (0, import_utils.setContentKey)(element, options);
58
63
  const __contentRef = content && content.__ref;
59
64
  const lazyLoad = element.props && element.props.lazyLoad;
@@ -81,7 +86,7 @@ const set = async function(params, options = {}, el) {
81
86
  params.childExtend = element.childExtend;
82
87
  props.ignoreChildExtend = true;
83
88
  }
84
- if (!(props == null ? void 0 : props.childProps) && ((_a = element.props) == null ? void 0 : _a.childProps)) {
89
+ if (!(props == null ? void 0 : props.childProps) && ((_b = element.props) == null ? void 0 : _b.childProps)) {
85
90
  props.childProps = element.props.childProps;
86
91
  props.ignoreChildProps = true;
87
92
  }
package/dist/esm/node.js CHANGED
@@ -21,6 +21,9 @@ import { isNotProduction } from "@domql/utils/env.js";
21
21
  const createNode = async (element, options) => {
22
22
  let { node, tag, __ref: ref } = element;
23
23
  let isNewNode;
24
+ if (options.routerContentElement && options.lastElement) {
25
+ if (options.routerContentElement !== options.lastElement.content) return;
26
+ }
24
27
  if (!node) {
25
28
  isNewNode = true;
26
29
  if (!ref.__if) return element;
package/dist/esm/set.js CHANGED
@@ -5,7 +5,7 @@ import { registry } from "./mixins/index.js";
5
5
  import { removeContent } from "./mixins/content.js";
6
6
  import { triggerEventOn, triggerEventOnUpdate } from "@domql/event";
7
7
  const resetElement = async (params, element, options) => {
8
- if (!options.preventRemove) await removeContent(element, options);
8
+ if (!options.preventRemove) removeContent(element, options);
9
9
  const { __ref: ref } = element;
10
10
  if (params instanceof Promise) console.log(params, params instanceof Promise);
11
11
  await create(params, element, ref.contentElementKey || "content", {
@@ -25,9 +25,14 @@ const reset = async (options) => {
25
25
  });
26
26
  };
27
27
  const set = async function(params, options = {}, el) {
28
- var _a;
28
+ var _a, _b;
29
29
  const element = el || this;
30
30
  const { __ref: ref } = element;
31
+ if (options.preventContentUpdate || ((_a = options.preventUpdate) == null ? void 0 : _a.includes("content")))
32
+ return;
33
+ if (options.routerContentElement && options.lastElement) {
34
+ if (options.routerContentElement !== options.lastElement.content) return;
35
+ }
31
36
  const content = setContentKey(element, options);
32
37
  const __contentRef = content && content.__ref;
33
38
  const lazyLoad = element.props && element.props.lazyLoad;
@@ -55,7 +60,7 @@ const set = async function(params, options = {}, el) {
55
60
  params.childExtend = element.childExtend;
56
61
  props.ignoreChildExtend = true;
57
62
  }
58
- if (!(props == null ? void 0 : props.childProps) && ((_a = element.props) == null ? void 0 : _a.childProps)) {
63
+ if (!(props == null ? void 0 : props.childProps) && ((_b = element.props) == null ? void 0 : _b.childProps)) {
59
64
  props.childProps = element.props.childProps;
60
65
  props.ignoreChildProps = true;
61
66
  }
package/mixins/content.js CHANGED
@@ -17,6 +17,7 @@ export const updateContent = async function (params, options) {
17
17
  export const removeContent = function (el, opts = {}) {
18
18
  const element = el || this
19
19
  const { __ref: ref } = element
20
+ // console.warn('removing content', ref.path)
20
21
  const contentElementKey = setContentKey(element, opts)
21
22
 
22
23
  if (opts.contentElementKey !== 'content') opts.contentElementKey = 'content'
package/node.js CHANGED
@@ -29,6 +29,11 @@ export const createNode = async (element, options) => {
29
29
 
30
30
  let isNewNode
31
31
 
32
+ // handle content duplication bug with delayed rendering
33
+ if (options.routerContentElement && options.lastElement) {
34
+ if (options.routerContentElement !== options.lastElement.content) return
35
+ }
36
+
32
37
  if (!node) {
33
38
  isNewNode = true
34
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.29.38",
3
+ "version": "2.29.40",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -27,12 +27,12 @@
27
27
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.29.38",
31
- "@domql/render": "^2.29.38",
32
- "@domql/state": "^2.29.38",
33
- "@domql/utils": "^2.29.38"
30
+ "@domql/event": "^2.29.40",
31
+ "@domql/render": "^2.29.40",
32
+ "@domql/state": "^2.29.40",
33
+ "@domql/utils": "^2.29.40"
34
34
  },
35
- "gitHead": "3384cf7d920f77cf693d9145edc0b3ad9ecf3f33",
35
+ "gitHead": "8095929229562388221836b361480f3ecc22b20f",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.27.1"
38
38
  }
package/set.js CHANGED
@@ -9,8 +9,9 @@ import { removeContent } from './mixins/content.js'
9
9
  import { triggerEventOn, triggerEventOnUpdate } from '@domql/event'
10
10
 
11
11
  export const resetElement = async (params, element, options) => {
12
- if (!options.preventRemove) await removeContent(element, options)
12
+ if (!options.preventRemove) removeContent(element, options)
13
13
  const { __ref: ref } = element
14
+ // console.warn('resetting content', ref.path)
14
15
  if (params instanceof Promise) console.log(params, params instanceof Promise)
15
16
  await create(params, element, ref.contentElementKey || 'content', {
16
17
  ignoreChildExtend: true,
@@ -34,6 +35,16 @@ export const set = async function (params, options = {}, el) {
34
35
  const element = el || this
35
36
  const { __ref: ref } = element
36
37
 
38
+ if (
39
+ options.preventContentUpdate ||
40
+ options.preventUpdate?.includes('content')
41
+ )
42
+ return
43
+
44
+ if (options.routerContentElement && options.lastElement) {
45
+ if (options.routerContentElement !== options.lastElement.content) return
46
+ }
47
+
37
48
  const content = setContentKey(element, options)
38
49
  const __contentRef = content && content.__ref
39
50
  const lazyLoad = element.props && element.props.lazyLoad
@@ -73,6 +84,8 @@ export const set = async function (params, options = {}, el) {
73
84
  props.ignoreChildProps = true
74
85
  }
75
86
 
87
+ // console.warn('setting content', ref.path)
88
+
76
89
  if (lazyLoad) {
77
90
  window.requestAnimationFrame(async () => {
78
91
  await resetElement(params, element, options)