@domql/element 2.27.11 → 2.27.16

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
@@ -42,8 +42,6 @@ import {
42
42
  } from './utils/component.js'
43
43
  import { isNotProduction } from '@domql/utils/env.js'
44
44
 
45
- const ENV = process.env.NODE_ENV
46
-
47
45
  /**
48
46
  * Creating a domQL element using passed parameters
49
47
  */
@@ -136,7 +134,7 @@ export const create = async (
136
134
  const createBasedOnType = (element, parent, key, options) => {
137
135
  // if ELEMENT is not given
138
136
  if (element === undefined) {
139
- if (isNotProduction(ENV)) {
137
+ if (isNotProduction()) {
140
138
  console.warn(
141
139
  key,
142
140
  'element is undefined in',
@@ -146,7 +144,7 @@ const createBasedOnType = (element, parent, key, options) => {
146
144
  return {}
147
145
  }
148
146
  if (isString(key) && key.slice(0, 2 === '__')) {
149
- if (isNotProduction(ENV)) {
147
+ if (isNotProduction()) {
150
148
  console.warn(key, 'seems like to be in __ref')
151
149
  }
152
150
  }
@@ -227,7 +225,7 @@ const addElementIntoParentChildren = (element, parent) => {
227
225
  const visitedElements = new WeakMap()
228
226
  const renderElement = async (element, parent, options, attachOptions) => {
229
227
  if (visitedElements.has(element)) {
230
- if (isNotProduction(ENV))
228
+ if (isNotProduction())
231
229
  console.warn('Cyclic rendering detected:', element.__ref.path)
232
230
  }
233
231
 
@@ -243,7 +241,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
243
241
  }
244
242
 
245
243
  // CREATE a real NODE
246
- if (isNotProduction(ENV)) {
244
+ if (isNotProduction()) {
247
245
  await createNestedChild()
248
246
  } else {
249
247
  try {
@@ -381,7 +379,7 @@ const addCaching = (element, parent) => {
381
379
  if (!ref.root) ref.root = hasRoot ? element : parentRef.root
382
380
 
383
381
  // set the PATH array
384
- // if (isNotProduction(ENV)) {
382
+ // if (isNotProduction()) {
385
383
  if (!parentRef) parentRef = parent.ref = {}
386
384
  if (!parentRef.path) parentRef.path = []
387
385
  ref.path = parentRef.path.concat(element.key)
@@ -38,7 +38,6 @@ var import_iterate = require("./iterate.js");
38
38
  var import_options = require("./cache/options.js");
39
39
  var import_component = require("./utils/component.js");
40
40
  var import_env = require("@domql/utils/env.js");
41
- const ENV = "development";
42
41
  const create = async (element, parent, key, options = import_options.OPTIONS.create || {}, attachOptions) => {
43
42
  cacheOptions(element, options);
44
43
  if (checkIfPrimitive(element)) {
@@ -86,7 +85,7 @@ const create = async (element, parent, key, options = import_options.OPTIONS.cre
86
85
  };
87
86
  const createBasedOnType = (element, parent, key, options) => {
88
87
  if (element === void 0) {
89
- if ((0, import_env.isNotProduction)(ENV)) {
88
+ if ((0, import_env.isNotProduction)()) {
90
89
  console.warn(
91
90
  key,
92
91
  "element is undefined in",
@@ -96,7 +95,7 @@ const createBasedOnType = (element, parent, key, options) => {
96
95
  return {};
97
96
  }
98
97
  if ((0, import_utils.isString)(key) && key.slice(0, false)) {
99
- if ((0, import_env.isNotProduction)(ENV)) {
98
+ if ((0, import_env.isNotProduction)()) {
100
99
  console.warn(key, "seems like to be in __ref");
101
100
  }
102
101
  }
@@ -158,7 +157,7 @@ const visitedElements = /* @__PURE__ */ new WeakMap();
158
157
  const renderElement = async (element, parent, options, attachOptions) => {
159
158
  var _a, _b, _c, _d;
160
159
  if (visitedElements.has(element)) {
161
- if ((0, import_env.isNotProduction)(ENV))
160
+ if ((0, import_env.isNotProduction)())
162
161
  console.warn("Cyclic rendering detected:", element.__ref.path);
163
162
  }
164
163
  visitedElements.set(element, true);
@@ -169,7 +168,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
169
168
  await (0, import_node.createNode)(element, options);
170
169
  ref.__uniqId = Math.random();
171
170
  };
172
- if ((0, import_env.isNotProduction)(ENV)) {
171
+ if ((0, import_env.isNotProduction)()) {
173
172
  await createNestedChild();
174
173
  } else {
175
174
  try {
@@ -23,7 +23,6 @@ __export(extend_exports, {
23
23
  module.exports = __toCommonJS(extend_exports);
24
24
  var import_utils = require("@domql/utils");
25
25
  var import_utils2 = require("./utils/index.js");
26
- const ENV = "development";
27
26
  let mainExtend;
28
27
  const applyExtend = (element, parent, options = {}) => {
29
28
  if ((0, import_utils.isFunction)(element)) element = (0, import_utils.exec)(element, parent);
@@ -33,7 +32,7 @@ const applyExtend = (element, parent, options = {}) => {
33
32
  const context = element.context || parent.context;
34
33
  extend = (0, import_utils2.fallbackStringExtend)(extend, context, options, variant);
35
34
  const extendStack = (0, import_utils2.getExtendStack)(extend, context);
36
- if ((0, import_utils.isProduction)(ENV)) delete element.extend;
35
+ if ((0, import_utils.isProduction)()) delete element.extend;
37
36
  let childExtendStack = [];
38
37
  if (parent) {
39
38
  element.parent = parent;
@@ -48,7 +48,6 @@ var import_event = require("@domql/event");
48
48
  var import_utils = require("@domql/utils");
49
49
  var import_tree = require("../tree.js");
50
50
  var import_mixins = require("../mixins/index.js");
51
- const ENV = "development";
52
51
  function spotByPath(path) {
53
52
  const element = this;
54
53
  const arr = [].concat(path);
@@ -207,7 +206,7 @@ function parseDeep(excl = []) {
207
206
  return obj;
208
207
  }
209
208
  function verbose(element, ...args) {
210
- if ((0, import_utils.isProduction)(ENV)) return;
209
+ if ((0, import_utils.isProduction)()) return;
211
210
  const parent = this;
212
211
  const { __ref: ref } = parent;
213
212
  console.groupCollapsed(parent.key);
@@ -224,18 +223,18 @@ function verbose(element, ...args) {
224
223
  return parent;
225
224
  }
226
225
  function log(...params) {
227
- if ((0, import_utils.isNotProduction)(ENV)) {
226
+ if ((0, import_utils.isNotProduction)()) {
228
227
  console.log(...params);
229
228
  }
230
229
  }
231
230
  function warn(...params) {
232
- if ((0, import_utils.isNotProduction)(ENV)) {
231
+ if ((0, import_utils.isNotProduction)()) {
233
232
  console.warn(...params);
234
233
  }
235
234
  }
236
235
  function error(...params) {
237
236
  var _a, _b;
238
- if ((0, import_utils.isNotProduction)(ENV)) {
237
+ if ((0, import_utils.isNotProduction)()) {
239
238
  if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger) debugger;
240
239
  if ((_b = params[params.length - 1]) == null ? void 0 : _b.verbose) verbose.call(this, ...params);
241
240
  console.error(...params, this);
package/dist/cjs/node.js CHANGED
@@ -32,7 +32,6 @@ var import_mixins = require("./mixins/index.js");
32
32
  var import_applyParam = require("./utils/applyParam.js");
33
33
  var import_propEvents = require("./utils/propEvents.js");
34
34
  var import_env = require("@domql/utils/env.js");
35
- const ENV = "development";
36
35
  const createNode = async (element, options) => {
37
36
  let { node, tag, __ref: ref } = element;
38
37
  let isNewNode;
@@ -44,7 +43,7 @@ const createNode = async (element, options) => {
44
43
  } else node = element.node = (0, import_render.cacheNode)(element);
45
44
  await (0, import_event.triggerEventOn)("attachNode", element, options);
46
45
  }
47
- if ((0, import_env.isNotProduction)(ENV) || options.alowRefReference) {
46
+ if ((0, import_env.isNotProduction)() || options.alowRefReference) {
48
47
  node.ref = element;
49
48
  if ((0, import_utils.isFunction)(node.setAttribute)) node.setAttribute("key", element.key);
50
49
  }
@@ -36,7 +36,6 @@ __export(extendUtils_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(extendUtils_exports);
38
38
  var import_utils = require("@domql/utils");
39
- const ENV = "development";
40
39
  const generateHash = () => Math.random().toString(36).substring(2);
41
40
  const extendStackRegistry = {};
42
41
  const extendCachedRegistry = {};
@@ -110,7 +109,7 @@ const fallbackStringExtend = (extend, context, options = {}, variant) => {
110
109
  if (componentExists) return componentExists;
111
110
  else if (pageExists) return pageExists;
112
111
  else {
113
- if (options.verbose && (0, import_utils.isNotProduction)(ENV)) {
112
+ if (options.verbose && (0, import_utils.isNotProduction)()) {
114
113
  console.warn("Extend is string but component was not found:", extend);
115
114
  }
116
115
  return {};
@@ -34,7 +34,6 @@ import {
34
34
  createValidDomqlObjectFromSugar
35
35
  } from "./utils/component.js";
36
36
  import { isNotProduction } from "@domql/utils/env.js";
37
- const ENV = "development";
38
37
  const create = async (element, parent, key, options = OPTIONS.create || {}, attachOptions) => {
39
38
  cacheOptions(element, options);
40
39
  if (checkIfPrimitive(element)) {
@@ -82,7 +81,7 @@ const create = async (element, parent, key, options = OPTIONS.create || {}, atta
82
81
  };
83
82
  const createBasedOnType = (element, parent, key, options) => {
84
83
  if (element === void 0) {
85
- if (isNotProduction(ENV)) {
84
+ if (isNotProduction()) {
86
85
  console.warn(
87
86
  key,
88
87
  "element is undefined in",
@@ -92,7 +91,7 @@ const createBasedOnType = (element, parent, key, options) => {
92
91
  return {};
93
92
  }
94
93
  if (isString(key) && key.slice(0, false)) {
95
- if (isNotProduction(ENV)) {
94
+ if (isNotProduction()) {
96
95
  console.warn(key, "seems like to be in __ref");
97
96
  }
98
97
  }
@@ -154,7 +153,7 @@ const visitedElements = /* @__PURE__ */ new WeakMap();
154
153
  const renderElement = async (element, parent, options, attachOptions) => {
155
154
  var _a, _b, _c, _d;
156
155
  if (visitedElements.has(element)) {
157
- if (isNotProduction(ENV))
156
+ if (isNotProduction())
158
157
  console.warn("Cyclic rendering detected:", element.__ref.path);
159
158
  }
160
159
  visitedElements.set(element, true);
@@ -165,7 +164,7 @@ const renderElement = async (element, parent, options, attachOptions) => {
165
164
  await createNode(element, options);
166
165
  ref.__uniqId = Math.random();
167
166
  };
168
- if (isNotProduction(ENV)) {
167
+ if (isNotProduction()) {
169
168
  await createNestedChild();
170
169
  } else {
171
170
  try {
@@ -6,7 +6,6 @@ import {
6
6
  deepMergeExtend,
7
7
  fallbackStringExtend
8
8
  } from "./utils/index.js";
9
- const ENV = "development";
10
9
  let mainExtend;
11
10
  const applyExtend = (element, parent, options = {}) => {
12
11
  if (isFunction(element)) element = exec(element, parent);
@@ -16,7 +15,7 @@ const applyExtend = (element, parent, options = {}) => {
16
15
  const context = element.context || parent.context;
17
16
  extend = fallbackStringExtend(extend, context, options, variant);
18
17
  const extendStack = getExtendStack(extend, context);
19
- if (isProduction(ENV)) delete element.extend;
18
+ if (isProduction()) delete element.extend;
20
19
  let childExtendStack = [];
21
20
  if (parent) {
22
21
  element.parent = parent;
@@ -11,7 +11,6 @@ import {
11
11
  } from "@domql/utils";
12
12
  import { TREE } from "../tree.js";
13
13
  import { parseFilters, REGISTRY } from "../mixins/index.js";
14
- const ENV = "development";
15
14
  function spotByPath(path) {
16
15
  const element = this;
17
16
  const arr = [].concat(path);
@@ -170,7 +169,7 @@ function parseDeep(excl = []) {
170
169
  return obj;
171
170
  }
172
171
  function verbose(element, ...args) {
173
- if (isProduction(ENV)) return;
172
+ if (isProduction()) return;
174
173
  const parent = this;
175
174
  const { __ref: ref } = parent;
176
175
  console.groupCollapsed(parent.key);
@@ -187,18 +186,18 @@ function verbose(element, ...args) {
187
186
  return parent;
188
187
  }
189
188
  function log(...params) {
190
- if (isNotProduction(ENV)) {
189
+ if (isNotProduction()) {
191
190
  console.log(...params);
192
191
  }
193
192
  }
194
193
  function warn(...params) {
195
- if (isNotProduction(ENV)) {
194
+ if (isNotProduction()) {
196
195
  console.warn(...params);
197
196
  }
198
197
  }
199
198
  function error(...params) {
200
199
  var _a, _b;
201
- if (isNotProduction(ENV)) {
200
+ if (isNotProduction()) {
202
201
  if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger) debugger;
203
202
  if ((_b = params[params.length - 1]) == null ? void 0 : _b.verbose) verbose.call(this, ...params);
204
203
  console.error(...params, this);
package/dist/esm/node.js CHANGED
@@ -18,7 +18,6 @@ import { REGISTRY } from "./mixins/index.js";
18
18
  import { applyParam } from "./utils/applyParam.js";
19
19
  import { propagateEventsFromProps } from "./utils/propEvents.js";
20
20
  import { isNotProduction } from "@domql/utils/env.js";
21
- const ENV = "development";
22
21
  const createNode = async (element, options) => {
23
22
  let { node, tag, __ref: ref } = element;
24
23
  let isNewNode;
@@ -30,7 +29,7 @@ const createNode = async (element, options) => {
30
29
  } else node = element.node = cacheNode(element);
31
30
  await triggerEventOn("attachNode", element, options);
32
31
  }
33
- if (isNotProduction(ENV) || options.alowRefReference) {
32
+ if (isNotProduction() || options.alowRefReference) {
34
33
  node.ref = element;
35
34
  if (isFunction(node.setAttribute)) node.setAttribute("key", element.key);
36
35
  }
@@ -6,7 +6,6 @@ import {
6
6
  deepClone,
7
7
  isNotProduction
8
8
  } from "@domql/utils";
9
- const ENV = "development";
10
9
  const generateHash = () => Math.random().toString(36).substring(2);
11
10
  const extendStackRegistry = {};
12
11
  const extendCachedRegistry = {};
@@ -80,7 +79,7 @@ const fallbackStringExtend = (extend, context, options = {}, variant) => {
80
79
  if (componentExists) return componentExists;
81
80
  else if (pageExists) return pageExists;
82
81
  else {
83
- if (options.verbose && isNotProduction(ENV)) {
82
+ if (options.verbose && isNotProduction()) {
84
83
  console.warn("Extend is string but component was not found:", extend);
85
84
  }
86
85
  return {};
package/extend.js CHANGED
@@ -9,8 +9,6 @@ import {
9
9
  fallbackStringExtend
10
10
  } from './utils/index.js'
11
11
 
12
- const ENV = process.env.NODE_ENV
13
-
14
12
  let mainExtend
15
13
 
16
14
  /**
@@ -29,7 +27,7 @@ export const applyExtend = (element, parent, options = {}) => {
29
27
 
30
28
  const extendStack = getExtendStack(extend, context)
31
29
 
32
- if (isProduction(ENV)) delete element.extend
30
+ if (isProduction()) delete element.extend
33
31
 
34
32
  let childExtendStack = []
35
33
  if (parent) {
package/methods/index.js CHANGED
@@ -13,7 +13,6 @@ import {
13
13
  } from '@domql/utils'
14
14
  import { TREE } from '../tree.js'
15
15
  import { parseFilters, REGISTRY } from '../mixins/index.js'
16
- const ENV = process.env.NODE_ENV
17
16
 
18
17
  // TODO: update these files
19
18
  export function spotByPath (path) {
@@ -212,7 +211,7 @@ export function parseDeep (excl = []) {
212
211
  }
213
212
 
214
213
  export function verbose (element, ...args) {
215
- if (isProduction(ENV)) return
214
+ if (isProduction()) return
216
215
 
217
216
  const parent = this
218
217
  const { __ref: ref } = parent
@@ -230,19 +229,19 @@ export function verbose (element, ...args) {
230
229
  }
231
230
 
232
231
  export function log (...params) {
233
- if (isNotProduction(ENV)) {
232
+ if (isNotProduction()) {
234
233
  console.log(...params)
235
234
  }
236
235
  }
237
236
 
238
237
  export function warn (...params) {
239
- if (isNotProduction(ENV)) {
238
+ if (isNotProduction()) {
240
239
  console.warn(...params)
241
240
  }
242
241
  }
243
242
 
244
243
  export function error (...params) {
245
- if (isNotProduction(ENV)) {
244
+ if (isNotProduction()) {
246
245
  if (params[params.length - 1]?.debugger) debugger // eslint-disable-line
247
246
  if (params[params.length - 1]?.verbose) verbose.call(this, ...params)
248
247
  console.error(...params, this)
package/node.js CHANGED
@@ -23,8 +23,6 @@ import { propagateEventsFromProps } from './utils/propEvents.js'
23
23
  import { isNotProduction } from '@domql/utils/env.js'
24
24
  // import { defineSetter } from './methods'
25
25
 
26
- const ENV = process.env.NODE_ENV
27
-
28
26
  export const createNode = async (element, options) => {
29
27
  // create and assign a node
30
28
  let { node, tag, __ref: ref } = element
@@ -45,7 +43,7 @@ export const createNode = async (element, options) => {
45
43
  }
46
44
  // node.dataset // .key = element.key
47
45
 
48
- if (isNotProduction(ENV) || options.alowRefReference) {
46
+ if (isNotProduction() || options.alowRefReference) {
49
47
  node.ref = element
50
48
  if (isFunction(node.setAttribute)) node.setAttribute('key', element.key)
51
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.27.11",
3
+ "version": "2.27.16",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -21,18 +21,18 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
24
- "build:esm": "cross-env NODE_ENV=$NODE_ENV npx esbuild *.js **/*.js --target=es2019 --format=esm --outdir=dist/esm",
25
- "build:cjs": "cross-env NODE_ENV=$NODE_ENV npx esbuild *.js **/*.js --target=node16 --format=cjs --outdir=dist/cjs",
24
+ "build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js **/*.js --target=es2019 --format=esm --outdir=dist/esm",
25
+ "build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js **/*.js --target=node16 --format=cjs --outdir=dist/cjs",
26
26
  "build": "npx rimraf -I dist; npm run build:cjs; npm run build:esm",
27
27
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.27.11",
31
- "@domql/render": "^2.27.11",
32
- "@domql/state": "^2.27.11",
33
- "@domql/utils": "^2.27.11"
30
+ "@domql/event": "^2.27.16",
31
+ "@domql/render": "^2.27.16",
32
+ "@domql/state": "^2.27.16",
33
+ "@domql/utils": "^2.27.16"
34
34
  },
35
- "gitHead": "0189e4620f901c763754d06de65bcf6075c05618",
35
+ "gitHead": "aa562640d37f34a66e567c177be8f6ab6b41eccc",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.26.0"
38
38
  }
@@ -8,7 +8,6 @@ import {
8
8
  deepClone,
9
9
  isNotProduction
10
10
  } from '@domql/utils'
11
- const ENV = process.env.NODE_ENV
12
11
 
13
12
  export const generateHash = () => Math.random().toString(36).substring(2)
14
13
 
@@ -104,7 +103,7 @@ export const fallbackStringExtend = (
104
103
  if (componentExists) return componentExists
105
104
  else if (pageExists) return pageExists
106
105
  else {
107
- if (options.verbose && isNotProduction(ENV)) {
106
+ if (options.verbose && isNotProduction()) {
108
107
  console.warn('Extend is string but component was not found:', extend)
109
108
  }
110
109
  return {}