@design-edito/tools 0.2.30 → 0.2.35
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/agnostic/arrays/index.js +4 -4
- package/agnostic/colors/index.js +10 -10
- package/agnostic/css/index.js +5 -5
- package/agnostic/css/styles-set/index.js +3 -3
- package/agnostic/html/hyper-json/cast/index.js +5 -4
- package/agnostic/html/hyper-json/index.js +6 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.d.ts +2 -3
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.js +9 -10
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +5 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +5 -4
- package/agnostic/html/hyper-json/tree/index.js +5 -4
- package/agnostic/html/hyper-json/utils/index.js +5 -4
- package/agnostic/html/index.js +8 -7
- package/agnostic/index.js +45 -45
- package/agnostic/misc/index.js +12 -12
- package/agnostic/misc/lorem-ipsum/index.js +7 -7
- package/agnostic/objects/index.js +6 -6
- package/agnostic/optim/index.js +2 -2
- package/agnostic/random/index.js +2 -2
- package/agnostic/strings/index.js +4 -4
- package/chunks/{chunk-5EDT4OIT.js → chunk-22TZQ2Y3.js} +1 -1
- package/chunks/{chunk-JJNO7JMG.js → chunk-3QNQZCIQ.js} +129 -146
- package/chunks/{chunk-IITZAB23.js → chunk-4NP5VB4R.js} +22 -22
- package/chunks/{chunk-7YMA54J2.js → chunk-AJJ6HJJP.js} +1 -1
- package/chunks/{chunk-AR7P6OF2.js → chunk-ALNOBFBI.js} +5 -5
- package/chunks/{chunk-7B7JP3CE.js → chunk-DNVXXILZ.js} +4 -4
- package/chunks/{chunk-CETXQIKG.js → chunk-DZIL3PKQ.js} +2 -2
- package/chunks/{chunk-QLXY57GL.js → chunk-FUWQGDED.js} +4 -4
- package/chunks/{chunk-TDHN4EQG.js → chunk-GIPEJSLA.js} +2 -2
- package/chunks/{chunk-RGNGA6RE.js → chunk-IKZEALBM.js} +1 -1
- package/chunks/{chunk-7QOFWH7A.js → chunk-JZADBXY6.js} +1 -1
- package/chunks/{chunk-B7J4OIAB.js → chunk-KAPF3NFM.js} +2 -2
- package/chunks/{chunk-KURXDZ55.js → chunk-OBOXISER.js} +2 -2
- package/chunks/{chunk-B4NUIZ4A.js → chunk-RQIUCX5W.js} +12 -12
- package/chunks/{chunk-U4ORVPZC.js → chunk-STW5RKR7.js} +1 -1
- package/chunks/{chunk-CWHEFT5K.js → chunk-YRGB7BKW.js} +1 -1
- package/node/@aws-s3/index.js +10 -10
- package/node/@aws-s3/storage/directory/index.js +5 -5
- package/node/@aws-s3/storage/file/index.js +7 -7
- package/node/@aws-s3/storage/index.js +9 -9
- package/node/@google-cloud/index.js +13 -13
- package/node/@google-cloud/storage/bucket/index.js +4 -4
- package/node/@google-cloud/storage/directory/index.js +5 -5
- package/node/@google-cloud/storage/file/index.js +12 -12
- package/node/@google-cloud/storage/index.js +14 -14
- package/node/cloud-storage/index.js +42 -42
- package/node/cloud-storage/operations/copy-dir/index.js +2 -2
- package/node/cloud-storage/operations/copy-file/index.js +2 -2
- package/node/cloud-storage/operations/download-file/index.js +2 -2
- package/node/cloud-storage/operations/exists-file/index.js +2 -2
- package/node/cloud-storage/operations/index.js +52 -52
- package/node/cloud-storage/operations/list-dir/index.js +2 -2
- package/node/cloud-storage/operations/move-dir/index.js +2 -2
- package/node/cloud-storage/operations/move-file/index.js +2 -2
- package/node/cloud-storage/operations/remove-dir/index.js +2 -2
- package/node/cloud-storage/operations/remove-file/index.js +2 -2
- package/node/cloud-storage/operations/stat-file/index.js +2 -2
- package/node/cloud-storage/operations/upload-file/index.js +2 -2
- package/node/files/index.js +2 -2
- package/node/ftps/directory/index.js +5 -5
- package/node/ftps/file/index.js +7 -7
- package/node/ftps/index.js +9 -9
- package/node/images/create/index.js +4 -4
- package/node/images/format/index.js +4 -4
- package/node/images/index.js +12 -12
- package/node/images/metadata/index.js +4 -4
- package/node/images/transform/index.js +11 -11
- package/node/images/transform/operations/extend/index.js +4 -4
- package/node/images/transform/operations/flatten/index.js +4 -4
- package/node/images/transform/operations/overlay/index.js +4 -4
- package/node/images/transform/operations/resize/index.js +4 -4
- package/node/images/transform/operations/rotate/index.js +4 -4
- package/node/images/utils/index.js +4 -4
- package/node/index.js +86 -86
- package/node/sftp/directory/index.js +5 -5
- package/node/sftp/file/index.js +7 -7
- package/node/sftp/index.js +9 -9
- package/package.json +3 -1
- package/chunks/{chunk-CKENYYWH.js → chunk-26T64AEI.js} +4 -4
- package/chunks/{chunk-AZ4MJXUR.js → chunk-73SQU3NQ.js} +9 -9
- package/chunks/{chunk-EYC3K2XK.js → chunk-A3EVZT6I.js} +11 -11
- package/chunks/{chunk-ILJ4JFBY.js → chunk-AL7ESVX4.js} +3 -3
- package/chunks/{chunk-6RLNUMTZ.js → chunk-ALAGBHFV.js} +3 -3
- package/chunks/{chunk-6F6DZTWX.js → chunk-BDGFY3GP.js} +3 -3
- package/chunks/{chunk-6YQGM6N6.js → chunk-CMAS4BKV.js} +3 -3
- package/chunks/{chunk-SVA7LOGY.js → chunk-G2SCEXXK.js} +19 -19
- package/chunks/{chunk-CDWXM5CV.js → chunk-GL42Q643.js} +3 -3
- package/chunks/{chunk-LYEZ5IRT.js → chunk-HDIB7EXM.js} +6 -6
- package/chunks/{chunk-MFJZS4CY.js → chunk-HYUALSEP.js} +3 -3
- package/chunks/{chunk-XXRTRR5D.js → chunk-KVZLVTMX.js} +6 -6
- package/chunks/{chunk-QTF7LWGT.js → chunk-KWQ4K4GN.js} +4 -4
- package/chunks/{chunk-EZ22Z22X.js → chunk-MV473S2C.js} +4 -4
- package/chunks/{chunk-LRVADTRM.js → chunk-MVYH3CSJ.js} +3 -3
- package/chunks/{chunk-ZH3QMMVD.js → chunk-N4JGLSGA.js} +4 -4
- package/chunks/{chunk-4S7EBSJA.js → chunk-OC4VIF3N.js} +3 -3
- package/chunks/{chunk-TEUD5ZTM.js → chunk-PUMFAJ3M.js} +9 -9
- package/chunks/{chunk-WRRGMVRR.js → chunk-QKE2IYT5.js} +3 -3
- package/chunks/{chunk-KQENQXZ3.js → chunk-R4DZKWSR.js} +3 -3
- package/chunks/{chunk-OVG5RGI3.js → chunk-S32K7POB.js} +4 -4
- package/chunks/{chunk-NBCX6DDO.js → chunk-SABB7UCL.js} +6 -6
- package/chunks/{chunk-UEAMPAHK.js → chunk-UXEKCYL7.js} +3 -3
- package/chunks/{chunk-33LF74BE.js → chunk-X53BGT33.js} +3 -3
- package/chunks/{chunk-WK5Y34IN.js → chunk-XBA26Z7E.js} +3 -3
- package/chunks/{chunk-BHDVARLW.js → chunk-XR2LNUGW.js} +3 -3
- package/chunks/{chunk-66S3WWJV.js → chunk-XWNINAUS.js} +6 -6
- package/chunks/{chunk-OUDBOP46.js → chunk-ZUOQTT7I.js} +8 -8
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
nullFunc
|
|
3
3
|
} from "./chunk-QAVYONH6.js";
|
|
4
|
-
import {
|
|
5
|
-
any
|
|
6
|
-
} from "./chunk-FHLCPVND.js";
|
|
7
4
|
import {
|
|
8
5
|
array
|
|
9
6
|
} from "./chunk-QAQZEKIF.js";
|
|
7
|
+
import {
|
|
8
|
+
any
|
|
9
|
+
} from "./chunk-FHLCPVND.js";
|
|
10
10
|
import {
|
|
11
11
|
Serialize
|
|
12
12
|
} from "./chunk-SXRWMH3U.js";
|
|
@@ -25,25 +25,28 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
insertNode
|
|
27
27
|
} from "./chunk-XA4HVHJ4.js";
|
|
28
|
+
import {
|
|
29
|
+
recordMap
|
|
30
|
+
} from "./chunk-XNF5MLCQ.js";
|
|
28
31
|
import {
|
|
29
32
|
isInEnum
|
|
30
33
|
} from "./chunk-E6MSDKON.js";
|
|
31
34
|
import {
|
|
32
35
|
isRecord
|
|
33
36
|
} from "./chunk-YDIBNEGA.js";
|
|
34
|
-
import {
|
|
35
|
-
recordMap
|
|
36
|
-
} from "./chunk-XNF5MLCQ.js";
|
|
37
37
|
import {
|
|
38
38
|
trimEnd,
|
|
39
39
|
trimStart
|
|
40
40
|
} from "./chunk-6XL25OZX.js";
|
|
41
|
+
import {
|
|
42
|
+
replaceAll
|
|
43
|
+
} from "./chunk-ZTDVUXPR.js";
|
|
41
44
|
import {
|
|
42
45
|
Outcome
|
|
43
46
|
} from "./chunk-JMU5PDBD.js";
|
|
44
47
|
import {
|
|
45
|
-
|
|
46
|
-
} from "./chunk-
|
|
48
|
+
isNonNullObject
|
|
49
|
+
} from "./chunk-HQLRJ7XW.js";
|
|
47
50
|
import {
|
|
48
51
|
Window
|
|
49
52
|
} from "./chunk-RLJOYG64.js";
|
|
@@ -91,14 +94,14 @@ var Cast;
|
|
|
91
94
|
return `{${Object.entries(input).map(([key, val]) => `${key}:"${(0, Cast2.toString)(val)}"`).join(",")}}`;
|
|
92
95
|
};
|
|
93
96
|
Cast2.toText = (input) => {
|
|
94
|
-
const { Text: Text2, document
|
|
97
|
+
const { Text: Text2, document } = Window.get();
|
|
95
98
|
if (input instanceof Text2) return input.cloneNode(true);
|
|
96
|
-
return
|
|
99
|
+
return document.createTextNode((0, Cast2.toString)(input));
|
|
97
100
|
};
|
|
98
101
|
Cast2.toElement = (input, tagName) => {
|
|
99
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
102
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
100
103
|
if (input instanceof Element2) return input.cloneNode(true);
|
|
101
|
-
const returned =
|
|
104
|
+
const returned = document.createElement(tagName ?? "div");
|
|
102
105
|
if (input instanceof Text2) {
|
|
103
106
|
returned.append(input.cloneNode(true));
|
|
104
107
|
return returned;
|
|
@@ -113,8 +116,8 @@ var Cast;
|
|
|
113
116
|
return returned;
|
|
114
117
|
};
|
|
115
118
|
Cast2.toNodeList = (input) => {
|
|
116
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
117
|
-
const parentDiv =
|
|
119
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
120
|
+
const parentDiv = document.createElement("div");
|
|
118
121
|
if (input instanceof NodeList2) {
|
|
119
122
|
parentDiv.append(...Array.from(input).map((i) => i.cloneNode(true)));
|
|
120
123
|
return parentDiv.childNodes;
|
|
@@ -162,8 +165,8 @@ var element = SmartTags.makeSmartTag({
|
|
|
162
165
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text", "element", "nodelist"),
|
|
163
166
|
func: (main, args) => {
|
|
164
167
|
const tagName = Cast.toString(main).trim().toLowerCase();
|
|
165
|
-
const { document
|
|
166
|
-
const elt =
|
|
168
|
+
const { document, NodeList: NodeList2 } = Window.get();
|
|
169
|
+
const elt = document.createElement(tagName);
|
|
167
170
|
for (const argVal of args) {
|
|
168
171
|
if (argVal instanceof NodeList2) elt.append(...Array.from(argVal));
|
|
169
172
|
else if (argVal instanceof Element) elt.append(argVal);
|
|
@@ -215,7 +218,7 @@ var guess = SmartTags.makeSmartTag({
|
|
|
215
218
|
const { makeSuccess } = Outcome;
|
|
216
219
|
let coalesced = main;
|
|
217
220
|
for (const arg of args) coalesced = Utils.coalesceValues(coalesced, 0, arg);
|
|
218
|
-
const { Text: Text2, Element: Element2, document
|
|
221
|
+
const { Text: Text2, Element: Element2, document } = Window.get();
|
|
219
222
|
if (typeof coalesced !== "string" && !(coalesced instanceof Text2)) return makeSuccess(coalesced);
|
|
220
223
|
const strCoalesced = Cast.toString(coalesced);
|
|
221
224
|
if (strCoalesced.trim().toLowerCase() === "true") return makeSuccess(true);
|
|
@@ -230,7 +233,7 @@ var guess = SmartTags.makeSmartTag({
|
|
|
230
233
|
if (recordChecked.success) return makeSuccess(recordChecked.payload);
|
|
231
234
|
} catch (err) {
|
|
232
235
|
}
|
|
233
|
-
const div =
|
|
236
|
+
const div = document.createElement("div");
|
|
234
237
|
div.innerHTML = strCoalesced;
|
|
235
238
|
const divChildren = div.childNodes;
|
|
236
239
|
if (divChildren.length === 0) return makeSuccess(coalesced);
|
|
@@ -254,8 +257,8 @@ var nodelist = SmartTags.makeSmartTag({
|
|
|
254
257
|
mainValueCheck: (m) => Outcome.makeSuccess(m),
|
|
255
258
|
argsValueCheck: (a) => Outcome.makeSuccess(a),
|
|
256
259
|
func: (main, args) => {
|
|
257
|
-
const { document
|
|
258
|
-
const returnedParent =
|
|
260
|
+
const { document } = Window.get();
|
|
261
|
+
const returnedParent = document.createDocumentFragment();
|
|
259
262
|
returnedParent.append(
|
|
260
263
|
...Array.from(Cast.toNodeList(main)),
|
|
261
264
|
...Array.from(Cast.toNodeList(args))
|
|
@@ -383,7 +386,7 @@ var addclass = SmartTags.makeSmartTag({
|
|
|
383
386
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
|
|
384
387
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
385
388
|
func: (main, args) => {
|
|
386
|
-
const { Element: Element2 } = Window.get();
|
|
389
|
+
const { Element: Element2, document } = Window.get();
|
|
387
390
|
if (main instanceof Element2) {
|
|
388
391
|
main.classList.add(...args.map((arg) => Cast.toString(arg)));
|
|
389
392
|
return Outcome.makeSuccess(main);
|
|
@@ -425,14 +428,14 @@ var append = SmartTags.makeSmartTag({
|
|
|
425
428
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text", "nodelist", "element", "array"),
|
|
426
429
|
func: (main, args) => {
|
|
427
430
|
const { makeSuccess } = Outcome;
|
|
428
|
-
const { Text: Text2, Element: Element2, NodeList: NodeList2, document
|
|
431
|
+
const { Text: Text2, Element: Element2, NodeList: NodeList2, document } = Window.get();
|
|
429
432
|
if (Array.isArray(main)) return makeSuccess([...main, ...args]);
|
|
430
433
|
if (main instanceof Element2) {
|
|
431
434
|
main.append(...Array.from(Cast.toNodeList(args)));
|
|
432
435
|
return makeSuccess(main);
|
|
433
436
|
}
|
|
434
437
|
if (main instanceof NodeList2) {
|
|
435
|
-
const frag =
|
|
438
|
+
const frag = document.createDocumentFragment();
|
|
436
439
|
frag.append(
|
|
437
440
|
...Array.from(main),
|
|
438
441
|
...Array.from(Cast.toNodeList(args))
|
|
@@ -685,23 +688,53 @@ function deepGetProperty(record2, pathString) {
|
|
|
685
688
|
var textItemSymbol = "%%-hyperjson-text-%%";
|
|
686
689
|
var nodelistItemSymbol = "%%-hyperjson-nodelist-%%";
|
|
687
690
|
var elementItemSymbol = "%%-hyperjson-element-%%";
|
|
688
|
-
function
|
|
691
|
+
function stringify(val) {
|
|
692
|
+
const { Text: Text2, Element: Element2, NodeList: NodeList2 } = Window.get();
|
|
689
693
|
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean" || val === null) return JSON.stringify(val);
|
|
690
|
-
if (val instanceof
|
|
691
|
-
if (val instanceof
|
|
692
|
-
if (val instanceof
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
return JSON.stringify(`${nodelistItemSymbol}${wrapperdiv.innerHTML}`);
|
|
694
|
+
if (val instanceof Text2) return JSON.stringify(`${textItemSymbol}${val.textContent}`);
|
|
695
|
+
if (val instanceof Element2) return JSON.stringify(`${elementItemSymbol}${val.outerHTML}`);
|
|
696
|
+
if (val instanceof NodeList2) {
|
|
697
|
+
const stringifiedItems = JSON.stringify(Array.from(val).map(stringify));
|
|
698
|
+
return JSON.stringify(`${nodelistItemSymbol}${stringifiedItems}`);
|
|
696
699
|
}
|
|
697
|
-
if (val instanceof Method) return JSON.stringify(`[Method object: ${val.transformer.name}`);
|
|
698
|
-
if (Array.isArray(val)) return JSON.stringify(val.map(
|
|
700
|
+
if (val instanceof Method) return JSON.stringify(`[Method object: ${val.transformer.name}]`);
|
|
701
|
+
if (Array.isArray(val)) return JSON.stringify(val.map(stringify));
|
|
699
702
|
return JSON.stringify(
|
|
700
|
-
Object.entries(val).reduce((acc, [key, val2]) => {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
+
Object.entries(val).reduce((acc, [key, val2]) => ({
|
|
704
|
+
...acc,
|
|
705
|
+
[key]: stringify(val2)
|
|
706
|
+
}), {})
|
|
703
707
|
);
|
|
704
708
|
}
|
|
709
|
+
function parse(val) {
|
|
710
|
+
const { document } = Window.get();
|
|
711
|
+
const jsonParsed = JSON.parse(val);
|
|
712
|
+
if (typeof jsonParsed === "number" || typeof jsonParsed === "boolean" || jsonParsed === null) return jsonParsed;
|
|
713
|
+
if (Array.isArray(jsonParsed)) return jsonParsed.map((e) => typeof e === "string" ? parse(e) : e);
|
|
714
|
+
if (isNonNullObject(jsonParsed)) return Object.entries(jsonParsed).reduce((acc, [key, val2]) => ({
|
|
715
|
+
...acc,
|
|
716
|
+
[key]: typeof val2 === "string" ? parse(val2) : val2
|
|
717
|
+
}), {});
|
|
718
|
+
if (jsonParsed.startsWith(textItemSymbol)) return document.createTextNode(jsonParsed.slice(textItemSymbol.length));
|
|
719
|
+
if (jsonParsed.startsWith(elementItemSymbol)) {
|
|
720
|
+
const wrapperDiv = document.createElement("div");
|
|
721
|
+
wrapperDiv.innerHTML = jsonParsed.slice(elementItemSymbol.length);
|
|
722
|
+
return wrapperDiv.firstChild;
|
|
723
|
+
}
|
|
724
|
+
if (jsonParsed.startsWith(nodelistItemSymbol)) {
|
|
725
|
+
const stringifiedItems = jsonParsed.slice(nodelistItemSymbol.length);
|
|
726
|
+
const jsonParsedItems = JSON.parse(stringifiedItems);
|
|
727
|
+
const hjParsedItems = jsonParsedItems.map((e) => typeof e === "string" ? parse(e) : e);
|
|
728
|
+
const wrapperDiv = document.createElement("div");
|
|
729
|
+
hjParsedItems.forEach((item) => {
|
|
730
|
+
if (typeof item === "number" || typeof item === "boolean" || item === null) return wrapperDiv.append(`${item}`);
|
|
731
|
+
if (typeof item === "string" || item instanceof Text || item instanceof Element) return wrapperDiv.append(item);
|
|
732
|
+
if (item instanceof NodeList) return wrapperDiv.append(...Array.from(item));
|
|
733
|
+
});
|
|
734
|
+
return wrapperDiv.childNodes;
|
|
735
|
+
}
|
|
736
|
+
return jsonParsed;
|
|
737
|
+
}
|
|
705
738
|
var hjstringify = SmartTags.makeSmartTag({
|
|
706
739
|
name: "hjstringify",
|
|
707
740
|
defaultMode: "coalescion",
|
|
@@ -709,73 +742,12 @@ var hjstringify = SmartTags.makeSmartTag({
|
|
|
709
742
|
mainValueCheck: (m) => Outcome.makeSuccess(m),
|
|
710
743
|
argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
|
|
711
744
|
func: (main) => {
|
|
712
|
-
const stringified =
|
|
745
|
+
const stringified = stringify(main);
|
|
713
746
|
return Outcome.makeSuccess(stringified);
|
|
714
747
|
}
|
|
715
748
|
});
|
|
716
749
|
|
|
717
750
|
// src/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.ts
|
|
718
|
-
function isJson(value) {
|
|
719
|
-
if (value === void 0) return false;
|
|
720
|
-
if (typeof value === "string") return true;
|
|
721
|
-
if (typeof value === "number") return true;
|
|
722
|
-
if (typeof value === "boolean") return true;
|
|
723
|
-
if (value === null) return true;
|
|
724
|
-
if (Array.isArray(value)) return value.every(isJson);
|
|
725
|
-
return Object.entries(value).every(([name, val]) => {
|
|
726
|
-
if (typeof name !== "string") return false;
|
|
727
|
-
return isJson(val);
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
function parse(val) {
|
|
731
|
-
const strInput = Cast.toString(val);
|
|
732
|
-
try {
|
|
733
|
-
const jsonParsed = JSON.parse(strInput);
|
|
734
|
-
if (!isJson(jsonParsed)) return new Error(`Invalid JSON.parse output from ${strInput}`);
|
|
735
|
-
return jsonParsed;
|
|
736
|
-
} catch (err) {
|
|
737
|
-
if (err instanceof Error) return err;
|
|
738
|
-
const errStr = unknownToString(err);
|
|
739
|
-
return new Error(errStr);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
function unescapeHyperJsonString(val) {
|
|
743
|
-
if (val.startsWith(textItemSymbol)) {
|
|
744
|
-
const trimmed = val.slice(textItemSymbol.length);
|
|
745
|
-
const textItem = document.createTextNode(trimmed);
|
|
746
|
-
return textItem;
|
|
747
|
-
}
|
|
748
|
-
if (val.startsWith(elementItemSymbol)) {
|
|
749
|
-
const trimmed = val.slice(elementItemSymbol.length);
|
|
750
|
-
const div = document.createElement("div");
|
|
751
|
-
div.innerHTML = trimmed;
|
|
752
|
-
const firstChild = div.firstChild;
|
|
753
|
-
if (firstChild instanceof Element) return firstChild;
|
|
754
|
-
return trimmed;
|
|
755
|
-
}
|
|
756
|
-
if (val.startsWith(nodelistItemSymbol)) {
|
|
757
|
-
const trimmed = val.slice(nodelistItemSymbol.length);
|
|
758
|
-
const div = document.createElement("div");
|
|
759
|
-
div.innerHTML = trimmed;
|
|
760
|
-
const childNodesArr = Array.from(div.childNodes);
|
|
761
|
-
const frag = document.createDocumentFragment();
|
|
762
|
-
Array.from(childNodesArr).forEach((childNode) => {
|
|
763
|
-
if (childNode instanceof Text) frag.append(childNode);
|
|
764
|
-
else if (childNode instanceof Element) frag.append(childNode);
|
|
765
|
-
});
|
|
766
|
-
return frag.childNodes;
|
|
767
|
-
}
|
|
768
|
-
return val;
|
|
769
|
-
}
|
|
770
|
-
function unescapeHyperJson(val) {
|
|
771
|
-
if (typeof val === "number" || typeof val === "boolean" || val === null) return val;
|
|
772
|
-
if (typeof val === "string") return unescapeHyperJsonString(val);
|
|
773
|
-
if (Array.isArray(val)) return val.map(unescapeHyperJson);
|
|
774
|
-
return Object.entries(val).reduce((acc, [currKey, currVal]) => ({
|
|
775
|
-
...acc,
|
|
776
|
-
[currKey]: unescapeHyperJson(currVal)
|
|
777
|
-
}), {});
|
|
778
|
-
}
|
|
779
751
|
var hjparse = SmartTags.makeSmartTag({
|
|
780
752
|
name: "hjparse",
|
|
781
753
|
defaultMode: "coalescion",
|
|
@@ -783,13 +755,13 @@ var hjparse = SmartTags.makeSmartTag({
|
|
|
783
755
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
|
|
784
756
|
argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
|
|
785
757
|
func: (main) => {
|
|
786
|
-
const parsed = parse(main);
|
|
787
|
-
if (parsed instanceof Error) return Outcome.makeFailure({ details: parsed });
|
|
788
758
|
try {
|
|
789
|
-
const
|
|
790
|
-
return Outcome.makeSuccess(
|
|
759
|
+
const parsed = parse(`${main}`);
|
|
760
|
+
return Outcome.makeSuccess(parsed);
|
|
791
761
|
} catch (err) {
|
|
792
|
-
return Outcome.makeFailure({
|
|
762
|
+
return Outcome.makeFailure({
|
|
763
|
+
details: unknownToString(err)
|
|
764
|
+
});
|
|
793
765
|
}
|
|
794
766
|
}
|
|
795
767
|
});
|
|
@@ -1136,11 +1108,11 @@ var removeattribute = SmartTags.makeSmartTag({
|
|
|
1136
1108
|
func: (main, args) => {
|
|
1137
1109
|
const argsStr = args.map((e) => Cast.toString(e));
|
|
1138
1110
|
const [name] = argsStr;
|
|
1139
|
-
const { NodeList: NodeList2 } = Window.get();
|
|
1111
|
+
const { Element: Element2, NodeList: NodeList2, document } = Window.get();
|
|
1140
1112
|
if (main instanceof NodeList2) {
|
|
1141
1113
|
const children = Array.from(main).map((child) => {
|
|
1142
1114
|
const cloned = Utils.clone(child);
|
|
1143
|
-
if (cloned instanceof
|
|
1115
|
+
if (cloned instanceof Element2) cloned.removeAttribute(name);
|
|
1144
1116
|
return cloned;
|
|
1145
1117
|
});
|
|
1146
1118
|
const frag = document.createDocumentFragment();
|
|
@@ -1165,7 +1137,7 @@ var removeclass = SmartTags.makeSmartTag({
|
|
|
1165
1137
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
|
|
1166
1138
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1167
1139
|
func: (main, args) => {
|
|
1168
|
-
const { Element: Element2 } = Window.get();
|
|
1140
|
+
const { Element: Element2, document } = Window.get();
|
|
1169
1141
|
if (main instanceof Element2) {
|
|
1170
1142
|
main.classList.remove(...args.map((arg) => Cast.toString(arg)));
|
|
1171
1143
|
return Outcome.makeSuccess(main);
|
|
@@ -1267,15 +1239,16 @@ var select = SmartTags.makeSmartTag({
|
|
|
1267
1239
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "nodelist", "element"),
|
|
1268
1240
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1269
1241
|
func: (main, args) => {
|
|
1242
|
+
const { document, Element: Element2 } = Window.get();
|
|
1270
1243
|
const selectedFragment = document.createDocumentFragment();
|
|
1271
|
-
if (main instanceof
|
|
1244
|
+
if (main instanceof Element2) {
|
|
1272
1245
|
for (const arg of args) {
|
|
1273
1246
|
const selector = Cast.toString(arg);
|
|
1274
1247
|
const found = main.querySelectorAll(selector);
|
|
1275
1248
|
selectedFragment.append(...Array.from(found));
|
|
1276
1249
|
}
|
|
1277
1250
|
} else {
|
|
1278
|
-
const divWrapper =
|
|
1251
|
+
const divWrapper = document.createElement("div");
|
|
1279
1252
|
divWrapper.append(...Array.from(main));
|
|
1280
1253
|
for (const arg of args) {
|
|
1281
1254
|
const selector = Cast.toString(arg);
|
|
@@ -1336,8 +1309,8 @@ var setattribute = SmartTags.makeSmartTag({
|
|
|
1336
1309
|
func: (main, args) => {
|
|
1337
1310
|
const argsStr = args.map((e) => Cast.toString(e));
|
|
1338
1311
|
const [name, value = ""] = argsStr;
|
|
1339
|
-
|
|
1340
|
-
|
|
1312
|
+
if (main instanceof NodeList) {
|
|
1313
|
+
const { document } = Window.get();
|
|
1341
1314
|
const children = Array.from(main).map((child) => {
|
|
1342
1315
|
const cloned = Utils.clone(child);
|
|
1343
1316
|
if (cloned instanceof Element) cloned.setAttribute(name, value);
|
|
@@ -1561,7 +1534,7 @@ var toggleclass = SmartTags.makeSmartTag({
|
|
|
1561
1534
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
|
|
1562
1535
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1563
1536
|
func: (main, args) => {
|
|
1564
|
-
const { Element: Element2 } = Window.get();
|
|
1537
|
+
const { Element: Element2, document } = Window.get();
|
|
1565
1538
|
if (main instanceof Element2) {
|
|
1566
1539
|
args.forEach((arg) => main.classList.toggle(Cast.toString(arg)));
|
|
1567
1540
|
return Outcome.makeSuccess(main);
|
|
@@ -1776,7 +1749,7 @@ var Tree;
|
|
|
1776
1749
|
return new Tree2(merged, null, null, options);
|
|
1777
1750
|
}
|
|
1778
1751
|
constructor(node, parent, pathFromParent, options) {
|
|
1779
|
-
const { Element: Element2, Text: Text2, document
|
|
1752
|
+
const { Element: Element2, Text: Text2, document } = Window.get();
|
|
1780
1753
|
this.resolve = this.resolve.bind(this);
|
|
1781
1754
|
this.setVariable = this.setVariable.bind(this);
|
|
1782
1755
|
this.getVariable = this.getVariable.bind(this);
|
|
@@ -1932,7 +1905,7 @@ var Tree;
|
|
|
1932
1905
|
if (lastReducedItem instanceof Element2) return [...reduced, child];
|
|
1933
1906
|
const lastReducedTrimmed = trimEnd(lastReducedItem.textContent ?? "");
|
|
1934
1907
|
const childTrimmed = trimStart(child.textContent ?? "");
|
|
1935
|
-
const merged =
|
|
1908
|
+
const merged = document.createTextNode(`${lastReducedTrimmed}${childTrimmed}`);
|
|
1936
1909
|
const returned = [...reduced];
|
|
1937
1910
|
returned.pop();
|
|
1938
1911
|
returned.push(merged);
|
|
@@ -1945,7 +1918,7 @@ var Tree;
|
|
|
1945
1918
|
if (childNode instanceof Text2) {
|
|
1946
1919
|
const rawTextContent = childNode.textContent ?? "";
|
|
1947
1920
|
const textContent = rawTextContent.replace(/^\s*\n+\s*/, "").replace(/\s*\n+\s*$/, "");
|
|
1948
|
-
const returnedChildNode =
|
|
1921
|
+
const returnedChildNode = document.createTextNode(textContent);
|
|
1949
1922
|
mutableSubtrees.set(
|
|
1950
1923
|
positionnedChildrenCount,
|
|
1951
1924
|
new Tree2(returnedChildNode, this, positionnedChildrenCount, this.options)
|
|
@@ -2091,11 +2064,11 @@ var Tree;
|
|
|
2091
2064
|
var Utils;
|
|
2092
2065
|
((Utils2) => {
|
|
2093
2066
|
function clone2(value) {
|
|
2094
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
2067
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
2095
2068
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) return value;
|
|
2096
2069
|
if (value instanceof Text2) return value.cloneNode(true);
|
|
2097
2070
|
if (value instanceof NodeList2) {
|
|
2098
|
-
const frag =
|
|
2071
|
+
const frag = document.createDocumentFragment();
|
|
2099
2072
|
const nodes = Array.from(value).map((e) => e.cloneNode(true));
|
|
2100
2073
|
frag.append(...nodes);
|
|
2101
2074
|
return frag.childNodes;
|
|
@@ -2109,7 +2082,7 @@ var Utils;
|
|
|
2109
2082
|
}
|
|
2110
2083
|
Utils2.clone = clone2;
|
|
2111
2084
|
function coalesceValues(currentValue, subpath, subvalue) {
|
|
2112
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
2085
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
2113
2086
|
let actualSubvalue = subvalue;
|
|
2114
2087
|
if (actualSubvalue instanceof Transformer) {
|
|
2115
2088
|
const transformer = actualSubvalue;
|
|
@@ -2135,27 +2108,27 @@ var Utils;
|
|
|
2135
2108
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return `${currentValue}${actualSubvalue}`;
|
|
2136
2109
|
if (actualSubvalue instanceof Text2) return `${currentValue}${actualSubvalue.textContent}`;
|
|
2137
2110
|
if (actualSubvalue instanceof Element2) {
|
|
2138
|
-
const frag =
|
|
2111
|
+
const frag = document.createDocumentFragment();
|
|
2139
2112
|
frag.append(currentValue, Utils2.clone(actualSubvalue));
|
|
2140
2113
|
return frag.childNodes;
|
|
2141
2114
|
}
|
|
2142
2115
|
if (actualSubvalue instanceof NodeList2) {
|
|
2143
|
-
const frag =
|
|
2116
|
+
const frag = document.createDocumentFragment();
|
|
2144
2117
|
frag.append(currentValue, ...Array.from(Utils2.clone(actualSubvalue)));
|
|
2145
2118
|
return frag.childNodes;
|
|
2146
2119
|
}
|
|
2147
2120
|
return actualSubvalue;
|
|
2148
2121
|
}
|
|
2149
2122
|
if (currentValue instanceof Text2) {
|
|
2150
|
-
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return
|
|
2151
|
-
if (actualSubvalue instanceof Text2) return
|
|
2123
|
+
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return document.createTextNode(`${currentValue.textContent}${actualSubvalue}`);
|
|
2124
|
+
if (actualSubvalue instanceof Text2) return document.createTextNode(`${currentValue.textContent}${actualSubvalue.textContent}`);
|
|
2152
2125
|
if (actualSubvalue instanceof Element2) {
|
|
2153
|
-
const frag =
|
|
2126
|
+
const frag = document.createDocumentFragment();
|
|
2154
2127
|
frag.append(clone2(currentValue), clone2(actualSubvalue));
|
|
2155
2128
|
return frag.childNodes;
|
|
2156
2129
|
}
|
|
2157
2130
|
if (actualSubvalue instanceof NodeList2) {
|
|
2158
|
-
const frag =
|
|
2131
|
+
const frag = document.createDocumentFragment();
|
|
2159
2132
|
frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
|
|
2160
2133
|
return frag.childNodes;
|
|
2161
2134
|
}
|
|
@@ -2163,17 +2136,17 @@ var Utils;
|
|
|
2163
2136
|
}
|
|
2164
2137
|
if (currentValue instanceof Element2) {
|
|
2165
2138
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
|
|
2166
|
-
const frag =
|
|
2139
|
+
const frag = document.createDocumentFragment();
|
|
2167
2140
|
frag.append(clone2(currentValue), `${actualSubvalue}`);
|
|
2168
2141
|
return frag.childNodes;
|
|
2169
2142
|
}
|
|
2170
2143
|
if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
|
|
2171
|
-
const frag =
|
|
2144
|
+
const frag = document.createDocumentFragment();
|
|
2172
2145
|
frag.append(clone2(currentValue), clone2(actualSubvalue));
|
|
2173
2146
|
return frag.childNodes;
|
|
2174
2147
|
}
|
|
2175
2148
|
if (actualSubvalue instanceof NodeList2) {
|
|
2176
|
-
const frag =
|
|
2149
|
+
const frag = document.createDocumentFragment();
|
|
2177
2150
|
frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
|
|
2178
2151
|
return frag.childNodes;
|
|
2179
2152
|
}
|
|
@@ -2181,17 +2154,17 @@ var Utils;
|
|
|
2181
2154
|
}
|
|
2182
2155
|
if (currentValue instanceof NodeList2) {
|
|
2183
2156
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
|
|
2184
|
-
const frag =
|
|
2157
|
+
const frag = document.createDocumentFragment();
|
|
2185
2158
|
frag.append(...Array.from(clone2(currentValue)), `${actualSubvalue}`);
|
|
2186
2159
|
return frag.childNodes;
|
|
2187
2160
|
}
|
|
2188
2161
|
if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
|
|
2189
|
-
const frag =
|
|
2162
|
+
const frag = document.createDocumentFragment();
|
|
2190
2163
|
frag.append(...Array.from(clone2(currentValue)), clone2(actualSubvalue));
|
|
2191
2164
|
return frag.childNodes;
|
|
2192
2165
|
}
|
|
2193
2166
|
if (actualSubvalue instanceof NodeList2) {
|
|
2194
|
-
const frag =
|
|
2167
|
+
const frag = document.createDocumentFragment();
|
|
2195
2168
|
frag.append(...Array.from(clone2(currentValue)), ...Array.from(clone2(actualSubvalue)));
|
|
2196
2169
|
return frag.childNodes;
|
|
2197
2170
|
}
|
|
@@ -2205,32 +2178,32 @@ var Utils;
|
|
|
2205
2178
|
}
|
|
2206
2179
|
Utils2.coalesceValues = coalesceValues;
|
|
2207
2180
|
Utils2.toHyperJson = (value) => {
|
|
2208
|
-
const { document
|
|
2181
|
+
const { document, Element: Element2, Text: Text2, NodeList: NodeList2 } = Window.get();
|
|
2209
2182
|
if (value instanceof Text2) {
|
|
2210
|
-
const elt2 =
|
|
2183
|
+
const elt2 = document.createElement("text");
|
|
2211
2184
|
elt2.innerHTML = value.textContent ?? "";
|
|
2212
2185
|
return elt2;
|
|
2213
2186
|
}
|
|
2214
2187
|
if (value instanceof Element2) return value.cloneNode(true);
|
|
2215
2188
|
if (value instanceof NodeList2) {
|
|
2216
|
-
const elt2 =
|
|
2189
|
+
const elt2 = document.createElement("nodelist");
|
|
2217
2190
|
elt2.append(...Array.from(value).map((e) => e.cloneNode(true)));
|
|
2218
2191
|
return elt2;
|
|
2219
2192
|
}
|
|
2220
|
-
if (value === null) return
|
|
2193
|
+
if (value === null) return document.createElement("null");
|
|
2221
2194
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
2222
|
-
const elt2 =
|
|
2195
|
+
const elt2 = document.createElement(typeof value);
|
|
2223
2196
|
elt2.innerHTML = `${value}`;
|
|
2224
2197
|
return elt2;
|
|
2225
2198
|
}
|
|
2226
2199
|
if (Array.isArray(value)) {
|
|
2227
|
-
const elt2 =
|
|
2200
|
+
const elt2 = document.createElement("array");
|
|
2228
2201
|
elt2.append(...value.map((e) => (0, Utils2.toHyperJson)(e)));
|
|
2229
2202
|
return elt2;
|
|
2230
2203
|
}
|
|
2231
2204
|
if (value instanceof Transformer) return clone2(value.sourceTree.node);
|
|
2232
2205
|
if (value instanceof Method) return clone2(value.transformer.sourceTree.node);
|
|
2233
|
-
const elt =
|
|
2206
|
+
const elt = document.createElement("record");
|
|
2234
2207
|
Object.entries(value).forEach(([key, val]) => {
|
|
2235
2208
|
const hjVal = (0, Utils2.toHyperJson)(val);
|
|
2236
2209
|
if (hjVal instanceof Text2) return;
|
|
@@ -2316,13 +2289,13 @@ var Utils;
|
|
|
2316
2289
|
let Tree2;
|
|
2317
2290
|
((Tree3) => {
|
|
2318
2291
|
function mergeNodes(nodes) {
|
|
2292
|
+
const { document, Text: Text2, Element: Element2 } = Window.get();
|
|
2319
2293
|
const clones = nodes.map((node) => node.cloneNode(true));
|
|
2320
2294
|
const allChildren = [];
|
|
2321
2295
|
clones.forEach((node) => {
|
|
2322
2296
|
const actionAttribute = node.getAttribute(Tree.Tree.actionAttribute)?.trim().toLowerCase();
|
|
2323
2297
|
const actionAttrIsValid = isInEnum(Types.Tree.Merge.Action, actionAttribute ?? "");
|
|
2324
2298
|
const nodeAction = actionAttrIsValid ? actionAttribute : Types.Tree.Merge.Action.APPEND;
|
|
2325
|
-
const { Element: Element2, Text: Text2 } = Window.get();
|
|
2326
2299
|
const children = Array.from(node.childNodes).filter((child) => child instanceof Text2 || child instanceof Element2).map((child) => {
|
|
2327
2300
|
if (child instanceof Text2) return { node: child, key: void 0 };
|
|
2328
2301
|
const childKey = child.getAttribute(Tree.Tree.keyAttribute) ?? void 0;
|
|
@@ -2360,14 +2333,14 @@ var Utils;
|
|
|
2360
2333
|
}
|
|
2361
2334
|
Tree3.mergeNodes = mergeNodes;
|
|
2362
2335
|
function getInitialValueFromTypeName(name) {
|
|
2363
|
-
const { document
|
|
2336
|
+
const { document } = Window.get();
|
|
2364
2337
|
if (name === "null") return null;
|
|
2365
2338
|
if (name === "boolean") return false;
|
|
2366
2339
|
if (name === "number") return 0;
|
|
2367
2340
|
if (name === "string") return "";
|
|
2368
|
-
if (name === "text") return
|
|
2369
|
-
if (name === "nodelist") return
|
|
2370
|
-
if (name === "element") return
|
|
2341
|
+
if (name === "text") return document.createTextNode("");
|
|
2342
|
+
if (name === "nodelist") return document.createDocumentFragment().childNodes;
|
|
2343
|
+
if (name === "element") return document.createElement("div");
|
|
2371
2344
|
if (name === "array") return [];
|
|
2372
2345
|
if (name === "record") return {};
|
|
2373
2346
|
throw new Error(`Unknown value type name: ${name}`);
|
|
@@ -2488,9 +2461,20 @@ var Utils;
|
|
|
2488
2461
|
found: `length: ${args.length}`
|
|
2489
2462
|
});
|
|
2490
2463
|
};
|
|
2491
|
-
SmartTags3.makeMainValueError = (expected, found, details) => ({
|
|
2492
|
-
|
|
2493
|
-
|
|
2464
|
+
SmartTags3.makeMainValueError = (expected, found, details) => ({
|
|
2465
|
+
expected,
|
|
2466
|
+
found,
|
|
2467
|
+
details
|
|
2468
|
+
});
|
|
2469
|
+
SmartTags3.makeArgsValueError = (expected, found, position, details) => ({
|
|
2470
|
+
expected,
|
|
2471
|
+
found,
|
|
2472
|
+
position,
|
|
2473
|
+
details
|
|
2474
|
+
});
|
|
2475
|
+
SmartTags3.makeTransformationError = (details) => ({
|
|
2476
|
+
details
|
|
2477
|
+
});
|
|
2494
2478
|
})(SmartTags2 = Utils2.SmartTags || (Utils2.SmartTags = {}));
|
|
2495
2479
|
})(Utils || (Utils = {}));
|
|
2496
2480
|
|
|
@@ -2530,9 +2514,8 @@ export {
|
|
|
2530
2514
|
getproperties,
|
|
2531
2515
|
getproperty,
|
|
2532
2516
|
deepGetProperty,
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
elementItemSymbol,
|
|
2517
|
+
stringify,
|
|
2518
|
+
parse,
|
|
2536
2519
|
hjstringify,
|
|
2537
2520
|
hjparse,
|
|
2538
2521
|
ifFunc,
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
remove_file_exports
|
|
3
|
-
} from "./chunk-6RLNUMTZ.js";
|
|
4
|
-
import {
|
|
5
|
-
stat_file_exports
|
|
6
|
-
} from "./chunk-BHDVARLW.js";
|
|
7
|
-
import {
|
|
8
|
-
upload_file_exports
|
|
9
|
-
} from "./chunk-WK5Y34IN.js";
|
|
10
1
|
import {
|
|
11
2
|
copy_file_exports
|
|
12
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BDGFY3GP.js";
|
|
13
4
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
5
|
+
remove_file_exports
|
|
6
|
+
} from "./chunk-ALAGBHFV.js";
|
|
16
7
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
8
|
+
move_file_exports
|
|
9
|
+
} from "./chunk-OC4VIF3N.js";
|
|
19
10
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
11
|
+
remove_dir_exports
|
|
12
|
+
} from "./chunk-GL42Q643.js";
|
|
22
13
|
import {
|
|
23
14
|
list_dir_exports
|
|
24
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QKE2IYT5.js";
|
|
25
16
|
import {
|
|
26
17
|
move_dir_exports
|
|
27
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MVYH3CSJ.js";
|
|
28
19
|
import {
|
|
29
|
-
|
|
30
|
-
} from "./chunk-
|
|
20
|
+
stat_file_exports
|
|
21
|
+
} from "./chunk-XR2LNUGW.js";
|
|
31
22
|
import {
|
|
32
|
-
|
|
33
|
-
} from "./chunk-
|
|
23
|
+
upload_file_exports
|
|
24
|
+
} from "./chunk-XBA26Z7E.js";
|
|
25
|
+
import {
|
|
26
|
+
copy_dir_exports
|
|
27
|
+
} from "./chunk-R4DZKWSR.js";
|
|
28
|
+
import {
|
|
29
|
+
download_file_exports
|
|
30
|
+
} from "./chunk-X53BGT33.js";
|
|
31
|
+
import {
|
|
32
|
+
exists_file_exports
|
|
33
|
+
} from "./chunk-AL7ESVX4.js";
|
|
34
34
|
import {
|
|
35
35
|
__export
|
|
36
36
|
} from "./chunk-WSFCRVEQ.js";
|