@symbo.ls/utils 3.14.0 → 3.14.2
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/README.md +2 -2
- package/assets.js +117 -0
- package/cookie.js +20 -13
- package/index.js +1 -0
- package/methods.js +51 -3
- package/object.js +36 -2
- package/package.json +1 -1
- package/dist/cjs/array.js +0 -168
- package/dist/cjs/browser.js +0 -34
- package/dist/cjs/cache.js +0 -26
- package/dist/cjs/cdn.js +0 -85
- package/dist/cjs/component.js +0 -45
- package/dist/cjs/cookie.js +0 -75
- package/dist/cjs/date.js +0 -31
- package/dist/cjs/detectHeight.js +0 -62
- package/dist/cjs/element.js +0 -136
- package/dist/cjs/env.js +0 -43
- package/dist/cjs/events.js +0 -39
- package/dist/cjs/extends.js +0 -434
- package/dist/cjs/fibonacci.js +0 -30
- package/dist/cjs/files.js +0 -24
- package/dist/cjs/function.js +0 -114
- package/dist/cjs/globals.js +0 -30
- package/dist/cjs/if.js +0 -48
- package/dist/cjs/index.js +0 -54
- package/dist/cjs/key.js +0 -38
- package/dist/cjs/keys.js +0 -201
- package/dist/cjs/load.js +0 -171
- package/dist/cjs/log.js +0 -34
- package/dist/cjs/metadata.js +0 -310
- package/dist/cjs/methods.js +0 -599
- package/dist/cjs/node.js +0 -35
- package/dist/cjs/object.js +0 -634
- package/dist/cjs/projectKeys.js +0 -35
- package/dist/cjs/props.js +0 -282
- package/dist/cjs/scaling.js +0 -35
- package/dist/cjs/scope.js +0 -44
- package/dist/cjs/sharedLibraries.js +0 -146
- package/dist/cjs/state.js +0 -173
- package/dist/cjs/string-extra.js +0 -72
- package/dist/cjs/string.js +0 -183
- package/dist/cjs/style.js +0 -40
- package/dist/cjs/tags.js +0 -220
- package/dist/cjs/triggerEvent.js +0 -112
- package/dist/cjs/types.js +0 -74
- package/dist/cjs/update.js +0 -42
- package/dist/esm/array.js +0 -148
- package/dist/esm/browser.js +0 -14
- package/dist/esm/cache.js +0 -6
- package/dist/esm/cdn.js +0 -65
- package/dist/esm/component.js +0 -25
- package/dist/esm/cookie.js +0 -55
- package/dist/esm/date.js +0 -11
- package/dist/esm/detectHeight.js +0 -42
- package/dist/esm/element.js +0 -116
- package/dist/esm/env.js +0 -23
- package/dist/esm/events.js +0 -19
- package/dist/esm/extends.js +0 -414
- package/dist/esm/fibonacci.js +0 -10
- package/dist/esm/files.js +0 -4
- package/dist/esm/function.js +0 -94
- package/dist/esm/globals.js +0 -10
- package/dist/esm/if.js +0 -28
- package/dist/esm/index.js +0 -37
- package/dist/esm/key.js +0 -18
- package/dist/esm/keys.js +0 -181
- package/dist/esm/load.js +0 -151
- package/dist/esm/log.js +0 -14
- package/dist/esm/metadata.js +0 -290
- package/dist/esm/methods.js +0 -569
- package/dist/esm/node.js +0 -15
- package/dist/esm/object.js +0 -621
- package/dist/esm/projectKeys.js +0 -16
- package/dist/esm/props.js +0 -262
- package/dist/esm/scaling.js +0 -15
- package/dist/esm/scope.js +0 -24
- package/dist/esm/sharedLibraries.js +0 -126
- package/dist/esm/state.js +0 -163
- package/dist/esm/string-extra.js +0 -52
- package/dist/esm/string.js +0 -163
- package/dist/esm/style.js +0 -20
- package/dist/esm/tags.js +0 -200
- package/dist/esm/triggerEvent.js +0 -92
- package/dist/esm/types.js +0 -54
- package/dist/esm/update.js +0 -22
- package/dist/iife/index.js +0 -5818
package/dist/cjs/component.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var component_exports = {};
|
|
20
|
-
__export(component_exports, {
|
|
21
|
-
getCapitalCaseKeys: () => getCapitalCaseKeys,
|
|
22
|
-
getSpreadChildren: () => getSpreadChildren,
|
|
23
|
-
isContextComponent: () => isContextComponent,
|
|
24
|
-
matchesComponentNaming: () => matchesComponentNaming
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(component_exports);
|
|
27
|
-
var import_extends = require("./extends.js");
|
|
28
|
-
var import_types = require("./types.js");
|
|
29
|
-
const matchesComponentNaming = (key) => {
|
|
30
|
-
if (!(0, import_types.isString)(key) || !key.length) return false;
|
|
31
|
-
const code = key.charCodeAt(0);
|
|
32
|
-
return code >= 65 && code <= 90;
|
|
33
|
-
};
|
|
34
|
-
function getCapitalCaseKeys(obj) {
|
|
35
|
-
return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
|
|
36
|
-
}
|
|
37
|
-
function getSpreadChildren(obj) {
|
|
38
|
-
return Object.keys(obj).filter((key) => /^\d+$/.test(key));
|
|
39
|
-
}
|
|
40
|
-
function isContextComponent(element, parent, passedKey) {
|
|
41
|
-
const { context } = parent || {};
|
|
42
|
-
const [extendsKey] = (0, import_extends.createExtendsFromKeys)(passedKey);
|
|
43
|
-
const key = passedKey || extendsKey;
|
|
44
|
-
return context?.components?.[key] || context?.pages?.[key];
|
|
45
|
-
}
|
package/dist/cjs/cookie.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cookie_exports = {};
|
|
20
|
-
__export(cookie_exports, {
|
|
21
|
-
getCookie: () => getCookie,
|
|
22
|
-
getLocalStorage: () => getLocalStorage,
|
|
23
|
-
isMobile: () => isMobile,
|
|
24
|
-
removeCookie: () => removeCookie,
|
|
25
|
-
setCookie: () => setCookie,
|
|
26
|
-
setLocalStorage: () => setLocalStorage
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(cookie_exports);
|
|
29
|
-
var import_types = require("./types.js");
|
|
30
|
-
var import_globals = require("./globals.js");
|
|
31
|
-
const isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
32
|
-
const setCookie = (cname, cvalue, exdays = 365) => {
|
|
33
|
-
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
|
|
34
|
-
const d = /* @__PURE__ */ new Date();
|
|
35
|
-
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
|
|
36
|
-
const expires = `expires=${d.toUTCString()}`;
|
|
37
|
-
import_globals.document.cookie = `${cname}=${cvalue};${expires};path=/`;
|
|
38
|
-
};
|
|
39
|
-
const getCookie = (cname) => {
|
|
40
|
-
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
|
|
41
|
-
const name = `${cname}=`;
|
|
42
|
-
const decodedCookie = decodeURIComponent(import_globals.document.cookie);
|
|
43
|
-
const ca = decodedCookie.split(";");
|
|
44
|
-
for (let i = 0; i < ca.length; i++) {
|
|
45
|
-
let c = ca[i];
|
|
46
|
-
while (c.charAt(0) === " ") c = c.substring(1);
|
|
47
|
-
if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
|
|
48
|
-
}
|
|
49
|
-
return "";
|
|
50
|
-
};
|
|
51
|
-
const removeCookie = (cname) => {
|
|
52
|
-
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
|
|
53
|
-
import_globals.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
54
|
-
};
|
|
55
|
-
function getLocalStorage(key) {
|
|
56
|
-
if (!window.localStorage) {
|
|
57
|
-
return void 0;
|
|
58
|
-
}
|
|
59
|
-
const item = window.localStorage.getItem(key);
|
|
60
|
-
if (item === null) {
|
|
61
|
-
return void 0;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
return JSON.parse(item);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function setLocalStorage(key, data) {
|
|
70
|
-
if (!window.localStorage || data === void 0 || data === null) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const value = typeof data === "object" ? JSON.stringify(data) : data;
|
|
74
|
-
window.localStorage.setItem(key, value);
|
|
75
|
-
}
|
package/dist/cjs/date.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var date_exports = {};
|
|
20
|
-
__export(date_exports, {
|
|
21
|
-
formatDate: () => formatDate
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(date_exports);
|
|
24
|
-
const formatDate = (timestamp) => {
|
|
25
|
-
if (!timestamp) return "";
|
|
26
|
-
const d = new Date(timestamp);
|
|
27
|
-
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
28
|
-
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
29
|
-
const da = new Intl.DateTimeFormat("en", { day: "2-digit" }).format(d);
|
|
30
|
-
return `${da} ${mo}, ${ye}`;
|
|
31
|
-
};
|
package/dist/cjs/detectHeight.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var detectHeight_exports = {};
|
|
20
|
-
__export(detectHeight_exports, {
|
|
21
|
-
detectHeightOnInit: () => detectHeightOnInit
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(detectHeight_exports);
|
|
24
|
-
const detectHeightOnInit = (element, state) => {
|
|
25
|
-
const heightTimeout = setTimeout(() => {
|
|
26
|
-
const { props } = element;
|
|
27
|
-
if (!state.clientHeight) {
|
|
28
|
-
const {
|
|
29
|
-
node: { clientHeight }
|
|
30
|
-
} = element;
|
|
31
|
-
if (clientHeight) {
|
|
32
|
-
state.clientHeight = clientHeight;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (state.active) {
|
|
36
|
-
if (props.height === "auto") return;
|
|
37
|
-
element.update(
|
|
38
|
-
{
|
|
39
|
-
height: state.clientHeight
|
|
40
|
-
},
|
|
41
|
-
{ preventBeforeUpdateListener: true, preventChildrenUpdate: true }
|
|
42
|
-
);
|
|
43
|
-
const setAutoTimeout = setTimeout(() => {
|
|
44
|
-
element.update(
|
|
45
|
-
{
|
|
46
|
-
height: "auto"
|
|
47
|
-
},
|
|
48
|
-
{ preventBeforeUpdateListener: true, preventChildrenUpdate: true }
|
|
49
|
-
);
|
|
50
|
-
clearTimeout(setAutoTimeout);
|
|
51
|
-
}, 450);
|
|
52
|
-
} else {
|
|
53
|
-
element.update(
|
|
54
|
-
{
|
|
55
|
-
height: "0"
|
|
56
|
-
},
|
|
57
|
-
{ preventBeforeUpdateListener: true, preventChildrenUpdate: true }
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
clearTimeout(heightTimeout);
|
|
61
|
-
});
|
|
62
|
-
};
|
package/dist/cjs/element.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var element_exports = {};
|
|
20
|
-
__export(element_exports, {
|
|
21
|
-
addCaching: () => addCaching,
|
|
22
|
-
addContext: () => addContext,
|
|
23
|
-
addRef: () => addRef,
|
|
24
|
-
createBasedOnType: () => createBasedOnType,
|
|
25
|
-
createElement: () => createElement,
|
|
26
|
-
createParent: () => createParent,
|
|
27
|
-
createPath: () => createPath,
|
|
28
|
-
createRoot: () => createRoot,
|
|
29
|
-
returnValueAsText: () => returnValueAsText
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(element_exports);
|
|
32
|
-
var import_extends = require("./extends.js");
|
|
33
|
-
var import_key = require("./key.js");
|
|
34
|
-
var import_node = require("./node.js");
|
|
35
|
-
var import_props = require("./props.js");
|
|
36
|
-
var import_tags = require("./tags.js");
|
|
37
|
-
var import_types = require("./types.js");
|
|
38
|
-
const ENV = process.env.NODE_ENV;
|
|
39
|
-
const returnValueAsText = (element, parent, key) => {
|
|
40
|
-
const childExtendsTag = parent.childExtends && parent.childExtends.tag;
|
|
41
|
-
const childPropsTag = parent.childProps && parent.childProps.tag;
|
|
42
|
-
const isKeyValidHTMLTag = import_tags.HTML_TAGS.body.has(key) && key;
|
|
43
|
-
return {
|
|
44
|
-
text: element,
|
|
45
|
-
tag: childExtendsTag || childPropsTag || isKeyValidHTMLTag || "string"
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const createBasedOnType = (element, parent, key) => {
|
|
49
|
-
if (element === void 0) {
|
|
50
|
-
if (ENV === "test" || ENV === "development") {
|
|
51
|
-
console.warn(
|
|
52
|
-
key,
|
|
53
|
-
"element is undefined in",
|
|
54
|
-
parent?.__ref?.path
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
if (element === null) return;
|
|
60
|
-
if (element === true) return {};
|
|
61
|
-
if ((0, import_types.is)(element)("string", "number")) {
|
|
62
|
-
return returnValueAsText(element, parent, key);
|
|
63
|
-
}
|
|
64
|
-
if ((0, import_types.isFunction)(element)) {
|
|
65
|
-
return { props: element };
|
|
66
|
-
}
|
|
67
|
-
return element;
|
|
68
|
-
};
|
|
69
|
-
const addRef = (element, parent) => {
|
|
70
|
-
const ref = {};
|
|
71
|
-
ref.origin = element;
|
|
72
|
-
ref.parent = parent;
|
|
73
|
-
return ref;
|
|
74
|
-
};
|
|
75
|
-
const createParent = (element, parent, key, options, root) => {
|
|
76
|
-
if (!parent) return root;
|
|
77
|
-
if ((0, import_node.isNode)(parent)) {
|
|
78
|
-
const parentNodeWrapper = { key: ":root", node: parent };
|
|
79
|
-
root[`${key}_parent`] = parentNodeWrapper;
|
|
80
|
-
return parentNodeWrapper;
|
|
81
|
-
}
|
|
82
|
-
return parent;
|
|
83
|
-
};
|
|
84
|
-
const createRoot = (element, parent) => {
|
|
85
|
-
const { __ref: ref } = element;
|
|
86
|
-
const { __ref: parentRef } = parent;
|
|
87
|
-
const hasRoot = parent && parent.key === ":root";
|
|
88
|
-
if (!ref?.root) {
|
|
89
|
-
ref.root = hasRoot ? element : parentRef?.root;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const createPath = (element, parent, key) => {
|
|
93
|
-
let { __ref: parentRef } = parent;
|
|
94
|
-
if (!parentRef) parentRef = parent.ref = {};
|
|
95
|
-
if (!parentRef.path) parentRef.path = [];
|
|
96
|
-
return parentRef.path.concat(key);
|
|
97
|
-
};
|
|
98
|
-
const addContext = (element, parent, key, options, root) => {
|
|
99
|
-
const forcedOptionsContext = options.context && !root.context && !element.context;
|
|
100
|
-
if (forcedOptionsContext) root.context = options.context;
|
|
101
|
-
return options.context || parent.context || root.context || element.context;
|
|
102
|
-
};
|
|
103
|
-
const addCaching = (element, parent, key) => {
|
|
104
|
-
const ref = addRef(element, parent);
|
|
105
|
-
element.__ref = ref;
|
|
106
|
-
if (!ref.__defineCache) ref.__defineCache = {};
|
|
107
|
-
if (!ref.__exec) ref.__exec = {};
|
|
108
|
-
if (!ref.__execProps) ref.__execProps = {};
|
|
109
|
-
if (!ref.__class) ref.__class = {};
|
|
110
|
-
if (!ref.__classNames) ref.__classNames = {};
|
|
111
|
-
if (!ref.__attr) ref.__attr = {};
|
|
112
|
-
if (!ref.__changes) ref.__changes = [];
|
|
113
|
-
if (!ref.__children) ref.__children = [];
|
|
114
|
-
ref.__extends = (0, import_extends.createExtends)(element, parent, key);
|
|
115
|
-
ref.path = createPath(element, parent, key);
|
|
116
|
-
return ref;
|
|
117
|
-
};
|
|
118
|
-
const createElement = (passedProps, parentEl, passedKey, opts, root) => {
|
|
119
|
-
const hashed = passedProps?.__hash;
|
|
120
|
-
const element = hashed ? { extends: [passedProps] } : createBasedOnType(passedProps, parentEl, passedKey);
|
|
121
|
-
if (!element) return;
|
|
122
|
-
const parent = createParent(element, parentEl, passedKey, opts, root);
|
|
123
|
-
const key = (0, import_key.createKey)(element, parent, passedKey);
|
|
124
|
-
addCaching(element, parent, key);
|
|
125
|
-
const props = (0, import_props.createProps)(element, parent, key);
|
|
126
|
-
const context = addContext(element, parent, key, opts, root);
|
|
127
|
-
const on = element.on || {};
|
|
128
|
-
return {
|
|
129
|
-
...element,
|
|
130
|
-
key,
|
|
131
|
-
props,
|
|
132
|
-
parent,
|
|
133
|
-
context,
|
|
134
|
-
on
|
|
135
|
-
};
|
|
136
|
-
};
|
package/dist/cjs/env.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var env_exports = {};
|
|
20
|
-
__export(env_exports, {
|
|
21
|
-
ENV: () => ENV,
|
|
22
|
-
NODE_ENV: () => NODE_ENV,
|
|
23
|
-
getNev: () => getNev,
|
|
24
|
-
isDevelopment: () => isDevelopment,
|
|
25
|
-
isLocal: () => isLocal,
|
|
26
|
-
isNotProduction: () => isNotProduction,
|
|
27
|
-
isProduction: () => isProduction,
|
|
28
|
-
isStaging: () => isStaging,
|
|
29
|
-
isTest: () => isTest,
|
|
30
|
-
isTesting: () => isTesting
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(env_exports);
|
|
33
|
-
// @preserve-env
|
|
34
|
-
const NODE_ENV = process.env.NODE_ENV;
|
|
35
|
-
const ENV = NODE_ENV;
|
|
36
|
-
const isProduction = (env = NODE_ENV) => env === "production";
|
|
37
|
-
const isTest = (env = NODE_ENV) => env === "testing" || env === "test";
|
|
38
|
-
const isTesting = isTest;
|
|
39
|
-
const isStaging = (env = NODE_ENV) => env === "staging";
|
|
40
|
-
const isLocal = (env = NODE_ENV) => env === "local";
|
|
41
|
-
const isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev" || env === "local";
|
|
42
|
-
const getNev = (key, env = NODE_ENV) => env[key];
|
|
43
|
-
const isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
package/dist/cjs/events.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var events_exports = {};
|
|
20
|
-
__export(events_exports, {
|
|
21
|
-
addEventFromProps: () => addEventFromProps
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(events_exports);
|
|
24
|
-
var import_string = require("./string.js");
|
|
25
|
-
var import_types = require("./types.js");
|
|
26
|
-
function addEventFromProps(key, obj) {
|
|
27
|
-
const { props, on } = obj;
|
|
28
|
-
const eventName = (0, import_string.lowercaseFirstLetter)(key.split("on")[1]);
|
|
29
|
-
const origEvent = on[eventName];
|
|
30
|
-
const funcFromProps = props[key];
|
|
31
|
-
if ((0, import_types.isFunction)(origEvent)) {
|
|
32
|
-
on[eventName] = (...args) => {
|
|
33
|
-
const originalEventRetunrs = origEvent(...args);
|
|
34
|
-
if (originalEventRetunrs !== false) {
|
|
35
|
-
if ((0, import_types.isFunction)(funcFromProps)) return funcFromProps(...args);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
} else on[eventName] = funcFromProps;
|
|
39
|
-
}
|