@symbo.ls/utils 2.11.512 → 3.0.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/dist/cjs/date.js +1 -2
- package/dist/cjs/detectHeight.js +1 -2
- package/dist/cjs/index.js +86 -24
- package/dist/cjs/load.js +1 -2
- package/dist/cjs/scaling.js +76 -7
- package/package.json +3 -3
package/dist/cjs/date.js
CHANGED
|
@@ -24,8 +24,7 @@ __export(date_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(date_exports);
|
|
26
26
|
var formatDate = (timestamp) => {
|
|
27
|
-
if (!timestamp)
|
|
28
|
-
return "";
|
|
27
|
+
if (!timestamp) return "";
|
|
29
28
|
const d = new Date(timestamp);
|
|
30
29
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
31
30
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
package/dist/cjs/detectHeight.js
CHANGED
|
@@ -33,8 +33,7 @@ var detectHeightOnInit = (element, state) => {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
if (state.active) {
|
|
36
|
-
if (props.height === "auto")
|
|
37
|
-
return;
|
|
36
|
+
if (props.height === "auto") return;
|
|
38
37
|
element.update({
|
|
39
38
|
props: { height: state.clientHeight }
|
|
40
39
|
}, { preventBeforeUpdateListener: true, preventChildrenUpdate: true });
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.js
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
arrayzeValue: () => arrayzeValue,
|
|
24
24
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
25
25
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -40,23 +40,93 @@ __export(src_exports, {
|
|
|
40
40
|
toTitleCase: () => toTitleCase,
|
|
41
41
|
toggleFullscreen: () => toggleFullscreen
|
|
42
42
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
46
46
|
var window2 = globalThis;
|
|
47
47
|
var document2 = window2.document;
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// ../../node_modules/@domql/utils/types.js
|
|
50
50
|
var isObject = (arg) => {
|
|
51
|
-
if (arg === null)
|
|
52
|
-
return false;
|
|
51
|
+
if (arg === null) return false;
|
|
53
52
|
return typeof arg === "object" && arg.constructor === Object;
|
|
54
53
|
};
|
|
55
54
|
var isString = (arg) => typeof arg === "string";
|
|
56
55
|
var isNumber = (arg) => typeof arg === "number";
|
|
57
56
|
var isArray = (arg) => Array.isArray(arg);
|
|
58
57
|
|
|
59
|
-
//
|
|
58
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
59
|
+
var STATE_METHODS = [
|
|
60
|
+
"update",
|
|
61
|
+
"parse",
|
|
62
|
+
"clean",
|
|
63
|
+
"create",
|
|
64
|
+
"destroy",
|
|
65
|
+
"add",
|
|
66
|
+
"toggle",
|
|
67
|
+
"remove",
|
|
68
|
+
"apply",
|
|
69
|
+
"set",
|
|
70
|
+
"reset",
|
|
71
|
+
"replace",
|
|
72
|
+
"quietReplace",
|
|
73
|
+
"quietUpdate",
|
|
74
|
+
"applyReplace",
|
|
75
|
+
"applyFunction",
|
|
76
|
+
"keys",
|
|
77
|
+
"values",
|
|
78
|
+
"ref",
|
|
79
|
+
"rootUpdate",
|
|
80
|
+
"parentUpdate",
|
|
81
|
+
"parent",
|
|
82
|
+
"__element",
|
|
83
|
+
"__depends",
|
|
84
|
+
"__ref",
|
|
85
|
+
"__children",
|
|
86
|
+
"root",
|
|
87
|
+
"setByPath",
|
|
88
|
+
"setPathCollection",
|
|
89
|
+
"removeByPath",
|
|
90
|
+
"removePathCollection",
|
|
91
|
+
"getByPath"
|
|
92
|
+
];
|
|
93
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
94
|
+
var METHODS = [
|
|
95
|
+
"set",
|
|
96
|
+
"reset",
|
|
97
|
+
"update",
|
|
98
|
+
"remove",
|
|
99
|
+
"updateContent",
|
|
100
|
+
"removeContent",
|
|
101
|
+
"lookup",
|
|
102
|
+
"lookdown",
|
|
103
|
+
"lookdownAll",
|
|
104
|
+
"getRef",
|
|
105
|
+
"getPath",
|
|
106
|
+
"setNodeStyles",
|
|
107
|
+
"spotByPath",
|
|
108
|
+
"keys",
|
|
109
|
+
"parse",
|
|
110
|
+
"setProps",
|
|
111
|
+
"parseDeep",
|
|
112
|
+
"variables",
|
|
113
|
+
"if",
|
|
114
|
+
"log",
|
|
115
|
+
"verbose",
|
|
116
|
+
"warn",
|
|
117
|
+
"error",
|
|
118
|
+
"call",
|
|
119
|
+
"nextElement",
|
|
120
|
+
"previousElement"
|
|
121
|
+
];
|
|
122
|
+
var METHODS_EXL = [
|
|
123
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
124
|
+
...METHODS,
|
|
125
|
+
...STATE_METHODS,
|
|
126
|
+
...PROPS_METHODS
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
60
130
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
61
131
|
|
|
62
132
|
// src/browser.js
|
|
@@ -80,15 +150,13 @@ var findClosestNumber = (number, arr) => {
|
|
|
80
150
|
};
|
|
81
151
|
var findClosestNumberInFactory = (val, factory) => {
|
|
82
152
|
val = parseFloat(val);
|
|
83
|
-
if (isObject(factory))
|
|
84
|
-
factory = Object.values(factory);
|
|
153
|
+
if (isObject(factory)) factory = Object.values(factory);
|
|
85
154
|
return findClosestNumber(val, factory);
|
|
86
155
|
};
|
|
87
156
|
|
|
88
157
|
// src/date.js
|
|
89
158
|
var formatDate = (timestamp) => {
|
|
90
|
-
if (!timestamp)
|
|
91
|
-
return "";
|
|
159
|
+
if (!timestamp) return "";
|
|
92
160
|
const d = new Date(timestamp);
|
|
93
161
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
94
162
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -159,8 +227,7 @@ var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "t
|
|
|
159
227
|
scriptEle.type = type;
|
|
160
228
|
scriptEle.text = xhr.responseText;
|
|
161
229
|
doc.body.appendChild(scriptEle);
|
|
162
|
-
if (typeof fallback === "function")
|
|
163
|
-
fallback();
|
|
230
|
+
if (typeof fallback === "function") fallback();
|
|
164
231
|
} else {
|
|
165
232
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
166
233
|
}
|
|
@@ -232,18 +299,13 @@ var toTitleCase = (str) => str && str.replace(
|
|
|
232
299
|
);
|
|
233
300
|
var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
234
301
|
var toDescriptionCase = (str = "") => {
|
|
235
|
-
if (typeof str !== "string")
|
|
236
|
-
return;
|
|
302
|
+
if (typeof str !== "string") return;
|
|
237
303
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
238
304
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
239
305
|
};
|
|
240
306
|
var arrayzeValue = (val) => {
|
|
241
|
-
if (isArray(val))
|
|
242
|
-
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
if (isObject(val))
|
|
246
|
-
return Object.values(val);
|
|
247
|
-
if (isNumber(val))
|
|
248
|
-
return [val];
|
|
307
|
+
if (isArray(val)) return val;
|
|
308
|
+
if (isString(val)) return val.split(" ");
|
|
309
|
+
if (isObject(val)) return Object.values(val);
|
|
310
|
+
if (isNumber(val)) return [val];
|
|
249
311
|
};
|
package/dist/cjs/load.js
CHANGED
|
@@ -80,8 +80,7 @@ var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "t
|
|
|
80
80
|
scriptEle.type = type;
|
|
81
81
|
scriptEle.text = xhr.responseText;
|
|
82
82
|
doc.body.appendChild(scriptEle);
|
|
83
|
-
if (typeof fallback === "function")
|
|
84
|
-
fallback();
|
|
83
|
+
if (typeof fallback === "function") fallback();
|
|
85
84
|
} else {
|
|
86
85
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
87
86
|
}
|
package/dist/cjs/scaling.js
CHANGED
|
@@ -25,19 +25,89 @@ __export(scaling_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(scaling_exports);
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
29
29
|
var window2 = globalThis;
|
|
30
30
|
var document2 = window2.document;
|
|
31
31
|
|
|
32
|
-
//
|
|
32
|
+
// ../../node_modules/@domql/utils/types.js
|
|
33
33
|
var isObject = (arg) => {
|
|
34
|
-
if (arg === null)
|
|
35
|
-
return false;
|
|
34
|
+
if (arg === null) return false;
|
|
36
35
|
return typeof arg === "object" && arg.constructor === Object;
|
|
37
36
|
};
|
|
38
37
|
var isArray = (arg) => Array.isArray(arg);
|
|
39
38
|
|
|
40
|
-
//
|
|
39
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
40
|
+
var STATE_METHODS = [
|
|
41
|
+
"update",
|
|
42
|
+
"parse",
|
|
43
|
+
"clean",
|
|
44
|
+
"create",
|
|
45
|
+
"destroy",
|
|
46
|
+
"add",
|
|
47
|
+
"toggle",
|
|
48
|
+
"remove",
|
|
49
|
+
"apply",
|
|
50
|
+
"set",
|
|
51
|
+
"reset",
|
|
52
|
+
"replace",
|
|
53
|
+
"quietReplace",
|
|
54
|
+
"quietUpdate",
|
|
55
|
+
"applyReplace",
|
|
56
|
+
"applyFunction",
|
|
57
|
+
"keys",
|
|
58
|
+
"values",
|
|
59
|
+
"ref",
|
|
60
|
+
"rootUpdate",
|
|
61
|
+
"parentUpdate",
|
|
62
|
+
"parent",
|
|
63
|
+
"__element",
|
|
64
|
+
"__depends",
|
|
65
|
+
"__ref",
|
|
66
|
+
"__children",
|
|
67
|
+
"root",
|
|
68
|
+
"setByPath",
|
|
69
|
+
"setPathCollection",
|
|
70
|
+
"removeByPath",
|
|
71
|
+
"removePathCollection",
|
|
72
|
+
"getByPath"
|
|
73
|
+
];
|
|
74
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
75
|
+
var METHODS = [
|
|
76
|
+
"set",
|
|
77
|
+
"reset",
|
|
78
|
+
"update",
|
|
79
|
+
"remove",
|
|
80
|
+
"updateContent",
|
|
81
|
+
"removeContent",
|
|
82
|
+
"lookup",
|
|
83
|
+
"lookdown",
|
|
84
|
+
"lookdownAll",
|
|
85
|
+
"getRef",
|
|
86
|
+
"getPath",
|
|
87
|
+
"setNodeStyles",
|
|
88
|
+
"spotByPath",
|
|
89
|
+
"keys",
|
|
90
|
+
"parse",
|
|
91
|
+
"setProps",
|
|
92
|
+
"parseDeep",
|
|
93
|
+
"variables",
|
|
94
|
+
"if",
|
|
95
|
+
"log",
|
|
96
|
+
"verbose",
|
|
97
|
+
"warn",
|
|
98
|
+
"error",
|
|
99
|
+
"call",
|
|
100
|
+
"nextElement",
|
|
101
|
+
"previousElement"
|
|
102
|
+
];
|
|
103
|
+
var METHODS_EXL = [
|
|
104
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
105
|
+
...METHODS,
|
|
106
|
+
...STATE_METHODS,
|
|
107
|
+
...PROPS_METHODS
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
41
111
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
42
112
|
|
|
43
113
|
// src/scaling.js
|
|
@@ -48,7 +118,6 @@ var findClosestNumber = (number, arr) => {
|
|
|
48
118
|
};
|
|
49
119
|
var findClosestNumberInFactory = (val, factory) => {
|
|
50
120
|
val = parseFloat(val);
|
|
51
|
-
if (isObject(factory))
|
|
52
|
-
factory = Object.values(factory);
|
|
121
|
+
if (isObject(factory)) factory = Object.values(factory);
|
|
53
122
|
return findClosestNumber(val, factory);
|
|
54
123
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@domql/utils": "^
|
|
27
|
+
"@domql/utils": "^3.0.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "c4dacc88fa3a65574680d11e320307dd2a22e6e9"
|
|
30
30
|
}
|