@domql/utils 2.5.179 → 2.5.184

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/array.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import { deepClone, deepMerge } from './object'
4
- import { isArray, isNumber, isString } from './types'
3
+ import { deepClone, deepMerge } from './object.js'
4
+ import { isArray, isNumber, isString } from './types.js'
5
5
 
6
6
  export const arrayContainsOtherArray = (arr1, arr2) => {
7
7
  return arr2.every(val => arr1.includes(val))
package/component.js CHANGED
@@ -1,14 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import {
4
- deepClone,
5
- exec,
6
- isArray,
7
- isFunction,
8
- isObject,
9
- isString,
10
- joinArrays
11
- } from '.'
3
+ import { joinArrays } from './array.js'
4
+ import { deepClone, exec } from './object.js'
5
+ import { isArray, isFunction, isObject, isString } from './types.js'
6
+
12
7
  const ENV = process.env.NODE_ENV
13
8
 
14
9
  export const checkIfKeyIsComponent = (key) => {
package/cookie.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import { isUndefined } from './types'
4
- import { document } from '@domql/utils'
3
+ import { isUndefined } from './types.js'
4
+ import { document } from './globals.js'
5
5
 
6
6
  export const isMobile = (() => typeof navigator === 'undefined'
7
7
  ? false
package/dist/cjs/array.js CHANGED
@@ -37,8 +37,8 @@ __export(array_exports, {
37
37
  swapItemsInArray: () => swapItemsInArray
38
38
  });
39
39
  module.exports = __toCommonJS(array_exports);
40
- var import_object = require("./object");
41
- var import_types = require("./types");
40
+ var import_object = require("./object.js");
41
+ var import_types = require("./types.js");
42
42
  const arrayContainsOtherArray = (arr1, arr2) => {
43
43
  return arr2.every((val) => arr1.includes(val));
44
44
  };
@@ -35,17 +35,19 @@ __export(component_exports, {
35
35
  setContentKey: () => setContentKey
36
36
  });
37
37
  module.exports = __toCommonJS(component_exports);
38
- var import__ = require(".");
38
+ var import_array = require("./array.js");
39
+ var import_object = require("./object.js");
40
+ var import_types = require("./types.js");
39
41
  const ENV = "development";
40
42
  const checkIfKeyIsComponent = (key) => {
41
- const isFirstKeyString = (0, import__.isString)(key);
43
+ const isFirstKeyString = (0, import_types.isString)(key);
42
44
  if (!isFirstKeyString)
43
45
  return;
44
46
  const firstCharKey = key.slice(0, 1);
45
47
  return /^[A-Z]*$/.test(firstCharKey);
46
48
  };
47
49
  const checkIfKeyIsProperty = (key) => {
48
- const isFirstKeyString = (0, import__.isString)(key);
50
+ const isFirstKeyString = (0, import_types.isString)(key);
49
51
  if (!isFirstKeyString)
50
52
  return;
51
53
  const firstCharKey = key.slice(0, 1);
@@ -55,9 +57,9 @@ const addAdditionalExtend = (newExtend, element) => {
55
57
  if (!newExtend)
56
58
  return element;
57
59
  const { extend: elementExtend } = element;
58
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
59
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
60
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
60
+ const originalArray = (0, import_types.isArray)(elementExtend) ? elementExtend : [elementExtend];
61
+ const receivedArray = (0, import_types.isArray)(newExtend) ? newExtend : [newExtend];
62
+ const extend = (0, import_array.joinArrays)(receivedArray, originalArray);
61
63
  return { ...element, extend };
62
64
  };
63
65
  const checkIfSugar = (element, parent, key) => {
@@ -127,11 +129,11 @@ const extendizeByKey = (element, parent, key) => {
127
129
  };
128
130
  } else if (extend) {
129
131
  return addAdditionalExtend(extendFromKey, element);
130
- } else if ((0, import__.isFunction)(element)) {
132
+ } else if ((0, import_types.isFunction)(element)) {
131
133
  return {
132
134
  extend: extendFromKey,
133
135
  tag,
134
- props: { ...(0, import__.exec)(element, parent) }
136
+ props: { ...(0, import_object.exec)(element, parent) }
135
137
  };
136
138
  }
137
139
  };
@@ -155,7 +157,7 @@ const addChildrenIfNotInOriginal = (element, parent, key) => {
155
157
  if (newChild === null)
156
158
  assignChild(null);
157
159
  else if (!childElem)
158
- assignChild((0, import__.deepClone)(newChild));
160
+ assignChild((0, import_object.deepClone)(newChild));
159
161
  else {
160
162
  const isSugarChildElem = checkIfSugar(childElem, parent, key);
161
163
  if (isSugarChildElem)
@@ -176,8 +178,8 @@ const applyComponentFromContext = (element, parent, options) => {
176
178
  return;
177
179
  const { components } = context;
178
180
  const { extend } = element;
179
- const execExtend = (0, import__.exec)(extend, element);
180
- if ((0, import__.isString)(execExtend)) {
181
+ const execExtend = (0, import_object.exec)(extend, element);
182
+ if ((0, import_types.isString)(execExtend)) {
181
183
  const componentExists = components[execExtend] || components["smbls." + execExtend];
182
184
  if (componentExists)
183
185
  element.extend = componentExists;
@@ -191,14 +193,14 @@ const applyComponentFromContext = (element, parent, options) => {
191
193
  }
192
194
  };
193
195
  const isVariant = (param) => {
194
- if (!(0, import__.isString)(param))
196
+ if (!(0, import_types.isString)(param))
195
197
  return;
196
198
  const firstCharKey = param.slice(0, 1);
197
199
  return firstCharKey === ".";
198
200
  };
199
201
  const hasVariantProp = (element) => {
200
202
  const { props } = element;
201
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
203
+ if ((0, import_types.isObject)(props) && (0, import_types.isString)(props.variant))
202
204
  return true;
203
205
  };
204
206
  const getChildrenComponentsByKey = (key, el) => {
@@ -206,14 +208,14 @@ const getChildrenComponentsByKey = (key, el) => {
206
208
  return el;
207
209
  }
208
210
  if (el.extend) {
209
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
210
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
211
+ const foundString = (0, import_types.isString)(el.extend) && el.extend === key;
212
+ const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
211
213
  if (foundString || foundInArray)
212
214
  return el;
213
215
  }
214
216
  if (el.parent && el.parent.childExtend) {
215
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
216
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
217
+ const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
218
+ const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
217
219
  if (foundString || foundInArray)
218
220
  return el;
219
221
  }
@@ -26,22 +26,22 @@ __export(cookie_exports, {
26
26
  setLocalStorage: () => setLocalStorage
27
27
  });
28
28
  module.exports = __toCommonJS(cookie_exports);
29
- var import_types = require("./types");
30
- var import_utils = require("@domql/utils");
29
+ var import_types = require("./types.js");
30
+ var import_globals = require("./globals.js");
31
31
  const isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
32
32
  const setCookie = (cname, cvalue, exdays = 365) => {
33
- if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie))
33
+ if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
34
34
  return;
35
35
  const d = /* @__PURE__ */ new Date();
36
36
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
37
37
  const expires = `expires=${d.toUTCString()}`;
38
- import_utils.document.cookie = `${cname}=${cvalue};${expires};path=/`;
38
+ import_globals.document.cookie = `${cname}=${cvalue};${expires};path=/`;
39
39
  };
40
40
  const getCookie = (cname) => {
41
- if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie))
41
+ if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
42
42
  return;
43
43
  const name = `${cname}=`;
44
- const decodedCookie = decodeURIComponent(import_utils.document.cookie);
44
+ const decodedCookie = decodeURIComponent(import_globals.document.cookie);
45
45
  const ca = decodedCookie.split(";");
46
46
  for (let i = 0; i < ca.length; i++) {
47
47
  let c = ca[i];
@@ -53,9 +53,9 @@ const getCookie = (cname) => {
53
53
  return "";
54
54
  };
55
55
  const removeCookie = (cname) => {
56
- if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie))
56
+ if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
57
57
  return;
58
- import_utils.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
58
+ import_globals.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
59
59
  };
60
60
  function getLocalStorage(key) {
61
61
  let savedJSON;
package/dist/cjs/node.js CHANGED
@@ -23,7 +23,7 @@ __export(node_exports, {
23
23
  isNode: () => isNode
24
24
  });
25
25
  module.exports = __toCommonJS(node_exports);
26
- var import_globals = require("./globals");
26
+ var import_globals = require("./globals.js");
27
27
  const isNode = (obj) => {
28
28
  return (typeof Node === "object" ? obj instanceof import_globals.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
29
29
  };
package/dist/cjs/types.js CHANGED
@@ -34,7 +34,7 @@ __export(types_exports, {
34
34
  isUndefined: () => isUndefined
35
35
  });
36
36
  module.exports = __toCommonJS(types_exports);
37
- var import_node = require("./node");
37
+ var import_node = require("./node.js");
38
38
  const isObject = (arg) => {
39
39
  if (arg === null)
40
40
  return false;
package/dist/esm/array.js CHANGED
@@ -1,5 +1,5 @@
1
- import { deepClone, deepMerge } from "./object";
2
- import { isArray, isNumber, isString } from "./types";
1
+ import { deepClone, deepMerge } from "./object.js";
2
+ import { isArray, isNumber, isString } from "./types.js";
3
3
  const arrayContainsOtherArray = (arr1, arr2) => {
4
4
  return arr2.every((val) => arr1.includes(val));
5
5
  };
@@ -17,15 +17,9 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import {
21
- deepClone,
22
- exec,
23
- isArray,
24
- isFunction,
25
- isObject,
26
- isString,
27
- joinArrays
28
- } from ".";
20
+ import { joinArrays } from "./array.js";
21
+ import { deepClone, exec } from "./object.js";
22
+ import { isArray, isFunction, isObject, isString } from "./types.js";
29
23
  const ENV = "development";
30
24
  const checkIfKeyIsComponent = (key) => {
31
25
  const isFirstKeyString = isString(key);
@@ -1,5 +1,5 @@
1
- import { isUndefined } from "./types";
2
- import { document } from "@domql/utils";
1
+ import { isUndefined } from "./types.js";
2
+ import { document } from "./globals.js";
3
3
  const isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
4
4
  const setCookie = (cname, cvalue, exdays = 365) => {
5
5
  if (isUndefined(document) || isUndefined(document.cookie))
package/dist/esm/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { window } from "./globals";
1
+ import { window } from "./globals.js";
2
2
  const isNode = (obj) => {
3
3
  return (typeof Node === "object" ? obj instanceof window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
4
4
  };
package/dist/esm/types.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isHtmlElement, isNode } from "./node";
1
+ import { isHtmlElement, isNode } from "./node.js";
2
2
  const isObject = (arg) => {
3
3
  if (arg === null)
4
4
  return false;
package/node.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { window } from './globals'
3
+ import { window } from './globals.js'
4
4
 
5
5
  export const isNode = (obj) => {
6
6
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.5.179",
3
+ "version": "2.5.184",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -8,7 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "kalduna": "./dist/esm/index.js",
11
- "default": "./dist/cjs/index.js",
11
+ "default": "./dist/esm/index.js",
12
12
  "import": "./dist/esm/index.js",
13
13
  "require": "./dist/cjs/index.js"
14
14
  }
@@ -25,7 +25,7 @@
25
25
  "build": "npm run build:cjs; npm run build:esm",
26
26
  "prepublish": "rimraf -I dist; npm run build; npm run copy:package:cjs"
27
27
  },
28
- "gitHead": "6dd81dc7848b03bd9bf564dbc82cd95af713ae21",
28
+ "gitHead": "d8fb0c7460a5bed587290d7c88c0f4ca291794e8",
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.12.0"
31
31
  }
package/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { isHtmlElement, isNode } from './node'
3
+ import { isHtmlElement, isNode } from './node.js'
4
4
 
5
5
  export const isObject = arg => {
6
6
  if (arg === null) return false