@design-edito/tools 0.2.29 → 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 +5 -5
- package/agnostic/colors/channels/index.js +4 -4
- package/agnostic/colors/contrast/index.js +5 -5
- package/agnostic/colors/convert/index.js +3 -3
- package/agnostic/colors/distance/index.js +4 -4
- package/agnostic/colors/grayscale/index.js +4 -4
- package/agnostic/colors/index.js +17 -17
- package/agnostic/colors/invert/index.js +4 -4
- package/agnostic/colors/lerp/index.js +4 -4
- package/agnostic/colors/luminance/index.js +4 -4
- package/agnostic/colors/palette/index.js +6 -6
- package/agnostic/colors/rotate/index.js +5 -5
- package/agnostic/colors/tidy/index.js +3 -3
- package/agnostic/css/index.js +6 -6
- 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 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.js +9 -12
- 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 +9 -8
- package/agnostic/index.js +55 -55
- package/agnostic/misc/index.js +12 -12
- package/agnostic/misc/lorem-ipsum/index.js +8 -8
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/index.js +4 -4
- package/agnostic/random/index.js +2 -2
- package/agnostic/strings/index.js +3 -3
- package/chunks/{chunk-NDNF2ACF.js → chunk-22TZQ2Y3.js} +1 -1
- package/chunks/{chunk-QQC3JHRJ.js → chunk-3LCD73SB.js} +1 -1
- package/chunks/{chunk-JEGI4KJI.js → chunk-3QNQZCIQ.js} +129 -151
- package/chunks/{chunk-VPCSCCCL.js → chunk-5CTAKAIP.js} +2 -2
- package/chunks/{chunk-VTSF7GZC.js → chunk-AJJ6HJJP.js} +1 -1
- package/chunks/{chunk-IAYKSX27.js → chunk-ALNOBFBI.js} +3 -3
- package/chunks/{chunk-OPLBIC4C.js → chunk-CLLJV343.js} +1 -1
- package/chunks/{chunk-QCE65XN6.js → chunk-D5CCWCEI.js} +1 -1
- package/chunks/{chunk-HTCTWKY7.js → chunk-DKITT7OT.js} +4 -4
- package/chunks/{chunk-KNXO2CDI.js → chunk-DNVXXILZ.js} +4 -4
- package/chunks/{chunk-43T4F2R5.js → chunk-DZIL3PKQ.js} +2 -2
- package/chunks/{chunk-PYKBU4NU.js → chunk-EGBJXHCW.js} +1 -1
- package/chunks/{chunk-CDIBSSJU.js → chunk-FUWQGDED.js} +7 -7
- package/chunks/{chunk-YYFIH526.js → chunk-G2SCEXXK.js} +20 -20
- package/chunks/{chunk-LMHJDTNO.js → chunk-GIPEJSLA.js} +2 -2
- package/chunks/{chunk-H7FZBOOI.js → chunk-IKZEALBM.js} +1 -1
- package/chunks/{chunk-5MDJL4HI.js → chunk-JZADBXY6.js} +6 -6
- package/chunks/{chunk-6EGJGM2F.js → chunk-KAPF3NFM.js} +2 -2
- package/chunks/{chunk-3RQEGKXW.js → chunk-L7PIZQFC.js} +1 -1
- package/chunks/{chunk-Y37OW2R5.js → chunk-MFIGSRSO.js} +1 -1
- package/chunks/{chunk-GPC6UDDY.js → chunk-NCYE5WML.js} +4 -4
- package/chunks/{chunk-WX7R34DF.js → chunk-OBOXISER.js} +2 -2
- package/chunks/{chunk-3PH2XFJR.js → chunk-P5JJOC5K.js} +1 -1
- package/chunks/{chunk-YELBRNKX.js → chunk-PUMFAJ3M.js} +14 -14
- package/chunks/{chunk-EIQ5IQKU.js → chunk-PVRYR5KX.js} +1 -1
- package/chunks/{chunk-ZIJLQD6J.js → chunk-QWNWZBIO.js} +1 -1
- package/chunks/{chunk-XQWTMJRC.js → chunk-RQIUCX5W.js} +12 -12
- package/chunks/{chunk-V7VAAA4C.js → chunk-STPN5KZL.js} +1 -1
- package/chunks/{chunk-Y6IIXPKF.js → chunk-STW5RKR7.js} +1 -1
- package/chunks/{chunk-UTGGIUR3.js → chunk-WSC3WODJ.js} +1 -1
- package/chunks/{chunk-MKL533IV.js → chunk-XPGAVZGK.js} +1 -1
- package/chunks/{chunk-GRECFK66.js → chunk-YRGB7BKW.js} +1 -1
- package/chunks/{chunk-H6T4IO4Z.js → chunk-YVKM7N55.js} +1 -1
- package/chunks/{chunk-KL6DNUKC.js → chunk-YXLHZ2KW.js} +2 -2
- package/chunks/{chunk-3ZJNGC4R.js → chunk-ZLBSI4TR.js} +1 -1
- package/node/@aws-s3/index.js +10 -10
- package/node/@aws-s3/storage/directory/index.js +8 -8
- package/node/@aws-s3/storage/file/index.js +9 -9
- package/node/@aws-s3/storage/index.js +9 -9
- package/node/@google-cloud/index.js +14 -14
- package/node/@google-cloud/storage/bucket/index.js +5 -5
- package/node/@google-cloud/storage/directory/index.js +8 -8
- package/node/@google-cloud/storage/file/index.js +16 -16
- package/node/@google-cloud/storage/index.js +13 -13
- package/node/cloud-storage/index.js +32 -32
- package/node/cloud-storage/operations/index.js +42 -42
- package/node/files/index.js +2 -2
- package/node/ftps/directory/index.js +8 -8
- package/node/ftps/file/index.js +9 -9
- package/node/ftps/index.js +9 -9
- package/node/images/create/index.js +15 -15
- package/node/images/format/index.js +15 -15
- package/node/images/index.js +28 -28
- package/node/images/metadata/index.js +15 -15
- package/node/images/transform/index.js +22 -22
- package/node/images/transform/operations/extend/index.js +15 -15
- package/node/images/transform/operations/flatten/index.js +15 -15
- package/node/images/transform/operations/overlay/index.js +15 -15
- package/node/images/transform/operations/resize/index.js +15 -15
- package/node/images/transform/operations/rotate/index.js +15 -15
- package/node/images/utils/index.js +14 -14
- package/node/index.js +92 -92
- package/node/sftp/directory/index.js +8 -8
- package/node/sftp/file/index.js +9 -9
- package/node/sftp/index.js +9 -9
- package/package.json +3 -1
- package/chunks/{chunk-HJARCTOH.js → chunk-26T64AEI.js} +7 -7
- package/chunks/{chunk-JMBBYLCU.js → chunk-4NP5VB4R.js} +17 -17
- package/chunks/{chunk-3ICXQ5XJ.js → chunk-73SQU3NQ.js} +6 -6
- package/chunks/{chunk-AGUMKZWZ.js → chunk-A3EVZT6I.js} +15 -15
- package/chunks/{chunk-SNGK2CF5.js → chunk-FNQAF6CQ.js} +6 -6
- package/chunks/{chunk-JTF3SVLS.js → chunk-HDIB7EXM.js} +8 -8
- package/chunks/{chunk-QHAB6XYD.js → chunk-HYUALSEP.js} +3 -3
- package/chunks/{chunk-O7D235HS.js → chunk-KVZLVTMX.js} +8 -8
- package/chunks/{chunk-42B5RQDS.js → chunk-KWQ4K4GN.js} +7 -7
- package/chunks/{chunk-MUOULXIW.js → chunk-MV473S2C.js} +7 -7
- package/chunks/{chunk-2WIWINVL.js → chunk-N4JGLSGA.js} +7 -7
- package/chunks/{chunk-DCKTGQOX.js → chunk-S32K7POB.js} +4 -4
- package/chunks/{chunk-PQJL7SYS.js → chunk-SABB7UCL.js} +7 -7
- package/chunks/{chunk-EWCTVB6Q.js → chunk-UKD6DFES.js} +6 -6
- package/chunks/{chunk-OMTDHKJI.js → chunk-UXEKCYL7.js} +4 -4
- package/chunks/{chunk-5RBXVRM5.js → chunk-XWNINAUS.js} +8 -8
- package/chunks/{chunk-45E3E4KW.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))
|
|
@@ -684,26 +687,54 @@ function deepGetProperty(record2, pathString) {
|
|
|
684
687
|
// src/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.ts
|
|
685
688
|
var textItemSymbol = "%%-hyperjson-text-%%";
|
|
686
689
|
var nodelistItemSymbol = "%%-hyperjson-nodelist-%%";
|
|
687
|
-
var nodelistItemSplitterSymbol = "%%-hyperjson-nodelist-splitter-%%";
|
|
688
690
|
var elementItemSymbol = "%%-hyperjson-element-%%";
|
|
689
|
-
function
|
|
691
|
+
function stringify(val) {
|
|
692
|
+
const { Text: Text2, Element: Element2, NodeList: NodeList2 } = Window.get();
|
|
690
693
|
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean" || val === null) return JSON.stringify(val);
|
|
691
|
-
if (val instanceof
|
|
692
|
-
if (val instanceof
|
|
693
|
-
if (val instanceof
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
const strItemsArray = JSON.stringify(strItems);
|
|
697
|
-
return JSON.stringify(`${nodelistItemSymbol}${strItemsArray}`);
|
|
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}`);
|
|
698
699
|
}
|
|
699
|
-
if (val instanceof Method) return `[Method object: ${val.transformer.name}
|
|
700
|
-
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));
|
|
701
702
|
return JSON.stringify(
|
|
702
|
-
Object.entries(val).reduce((acc, [key, val2]) => {
|
|
703
|
-
|
|
704
|
-
|
|
703
|
+
Object.entries(val).reduce((acc, [key, val2]) => ({
|
|
704
|
+
...acc,
|
|
705
|
+
[key]: stringify(val2)
|
|
706
|
+
}), {})
|
|
705
707
|
);
|
|
706
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
|
+
}
|
|
707
738
|
var hjstringify = SmartTags.makeSmartTag({
|
|
708
739
|
name: "hjstringify",
|
|
709
740
|
defaultMode: "coalescion",
|
|
@@ -711,75 +742,12 @@ var hjstringify = SmartTags.makeSmartTag({
|
|
|
711
742
|
mainValueCheck: (m) => Outcome.makeSuccess(m),
|
|
712
743
|
argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
|
|
713
744
|
func: (main) => {
|
|
714
|
-
const stringified =
|
|
745
|
+
const stringified = stringify(main);
|
|
715
746
|
return Outcome.makeSuccess(stringified);
|
|
716
747
|
}
|
|
717
748
|
});
|
|
718
749
|
|
|
719
750
|
// src/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.ts
|
|
720
|
-
function isJson(value) {
|
|
721
|
-
if (value === void 0) return false;
|
|
722
|
-
if (typeof value === "string") return true;
|
|
723
|
-
if (typeof value === "number") return true;
|
|
724
|
-
if (typeof value === "boolean") return true;
|
|
725
|
-
if (value === null) return true;
|
|
726
|
-
if (Array.isArray(value)) return value.every(isJson);
|
|
727
|
-
return Object.entries(value).every(([name, val]) => {
|
|
728
|
-
if (typeof name !== "string") return false;
|
|
729
|
-
return isJson(val);
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
function parse(val) {
|
|
733
|
-
const strInput = Cast.toString(val);
|
|
734
|
-
try {
|
|
735
|
-
const jsonParsed = JSON.parse(strInput);
|
|
736
|
-
if (!isJson(jsonParsed)) return new Error(`Invalid JSON.parse output from ${strInput}`);
|
|
737
|
-
return jsonParsed;
|
|
738
|
-
} catch (err) {
|
|
739
|
-
if (err instanceof Error) return err;
|
|
740
|
-
const errStr = unknownToString(err);
|
|
741
|
-
return new Error(errStr);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
function unescapeHyperJsonString(val) {
|
|
745
|
-
if (val.startsWith(textItemSymbol)) {
|
|
746
|
-
const trimmed = val.slice(textItemSymbol.length);
|
|
747
|
-
const textItem = document.createTextNode(trimmed);
|
|
748
|
-
return textItem;
|
|
749
|
-
}
|
|
750
|
-
if (val.startsWith(elementItemSymbol)) {
|
|
751
|
-
const trimmed = val.slice(elementItemSymbol.length);
|
|
752
|
-
const div = document.createElement("div");
|
|
753
|
-
div.innerHTML = trimmed;
|
|
754
|
-
const firstChild = div.firstChild;
|
|
755
|
-
if (firstChild instanceof Element) return firstChild;
|
|
756
|
-
return trimmed;
|
|
757
|
-
}
|
|
758
|
-
if (val.startsWith(nodelistItemSymbol)) {
|
|
759
|
-
const trimmed = val.slice(nodelistItemSymbol.length);
|
|
760
|
-
const parsedItemsArr = JSON.parse(trimmed);
|
|
761
|
-
if (!Array.isArray(parsedItemsArr)) throw new Error(`Stringified nodelist expected to contain a stringified JSON array. Found ${unknownToString(parsedItemsArr)}`);
|
|
762
|
-
const parsedOnlyHasStrings = parsedItemsArr.every((item) => typeof item === "string");
|
|
763
|
-
if (!parsedOnlyHasStrings) throw new Error(`Stringified nodelist expected to contain a stringified JSON array OF STRINGS. Found ${unknownToString(parsedItemsArr)}`);
|
|
764
|
-
const unescapedItems = parsedItemsArr.map(unescapeHyperJsonString);
|
|
765
|
-
const div = document.createElement("div");
|
|
766
|
-
unescapedItems.forEach((item) => {
|
|
767
|
-
if (item instanceof NodeList) div.append(...Array.from(item));
|
|
768
|
-
else div.append(item);
|
|
769
|
-
});
|
|
770
|
-
return div.childNodes;
|
|
771
|
-
}
|
|
772
|
-
return val;
|
|
773
|
-
}
|
|
774
|
-
function unescapeHyperJson(val) {
|
|
775
|
-
if (typeof val === "number" || typeof val === "boolean" || val === null) return val;
|
|
776
|
-
if (typeof val === "string") return unescapeHyperJsonString(val);
|
|
777
|
-
if (Array.isArray(val)) return val.map(unescapeHyperJson);
|
|
778
|
-
return Object.entries(val).reduce((acc, [currKey, currVal]) => ({
|
|
779
|
-
...acc,
|
|
780
|
-
[currKey]: unescapeHyperJson(currVal)
|
|
781
|
-
}), {});
|
|
782
|
-
}
|
|
783
751
|
var hjparse = SmartTags.makeSmartTag({
|
|
784
752
|
name: "hjparse",
|
|
785
753
|
defaultMode: "coalescion",
|
|
@@ -787,13 +755,13 @@ var hjparse = SmartTags.makeSmartTag({
|
|
|
787
755
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
|
|
788
756
|
argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
|
|
789
757
|
func: (main) => {
|
|
790
|
-
const parsed = parse(main);
|
|
791
|
-
if (parsed instanceof Error) return Outcome.makeFailure({ details: parsed });
|
|
792
758
|
try {
|
|
793
|
-
const
|
|
794
|
-
return Outcome.makeSuccess(
|
|
759
|
+
const parsed = parse(`${main}`);
|
|
760
|
+
return Outcome.makeSuccess(parsed);
|
|
795
761
|
} catch (err) {
|
|
796
|
-
return Outcome.makeFailure({
|
|
762
|
+
return Outcome.makeFailure({
|
|
763
|
+
details: unknownToString(err)
|
|
764
|
+
});
|
|
797
765
|
}
|
|
798
766
|
}
|
|
799
767
|
});
|
|
@@ -1140,11 +1108,11 @@ var removeattribute = SmartTags.makeSmartTag({
|
|
|
1140
1108
|
func: (main, args) => {
|
|
1141
1109
|
const argsStr = args.map((e) => Cast.toString(e));
|
|
1142
1110
|
const [name] = argsStr;
|
|
1143
|
-
const { NodeList: NodeList2 } = Window.get();
|
|
1111
|
+
const { Element: Element2, NodeList: NodeList2, document } = Window.get();
|
|
1144
1112
|
if (main instanceof NodeList2) {
|
|
1145
1113
|
const children = Array.from(main).map((child) => {
|
|
1146
1114
|
const cloned = Utils.clone(child);
|
|
1147
|
-
if (cloned instanceof
|
|
1115
|
+
if (cloned instanceof Element2) cloned.removeAttribute(name);
|
|
1148
1116
|
return cloned;
|
|
1149
1117
|
});
|
|
1150
1118
|
const frag = document.createDocumentFragment();
|
|
@@ -1169,7 +1137,7 @@ var removeclass = SmartTags.makeSmartTag({
|
|
|
1169
1137
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
|
|
1170
1138
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1171
1139
|
func: (main, args) => {
|
|
1172
|
-
const { Element: Element2 } = Window.get();
|
|
1140
|
+
const { Element: Element2, document } = Window.get();
|
|
1173
1141
|
if (main instanceof Element2) {
|
|
1174
1142
|
main.classList.remove(...args.map((arg) => Cast.toString(arg)));
|
|
1175
1143
|
return Outcome.makeSuccess(main);
|
|
@@ -1271,15 +1239,16 @@ var select = SmartTags.makeSmartTag({
|
|
|
1271
1239
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "nodelist", "element"),
|
|
1272
1240
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1273
1241
|
func: (main, args) => {
|
|
1242
|
+
const { document, Element: Element2 } = Window.get();
|
|
1274
1243
|
const selectedFragment = document.createDocumentFragment();
|
|
1275
|
-
if (main instanceof
|
|
1244
|
+
if (main instanceof Element2) {
|
|
1276
1245
|
for (const arg of args) {
|
|
1277
1246
|
const selector = Cast.toString(arg);
|
|
1278
1247
|
const found = main.querySelectorAll(selector);
|
|
1279
1248
|
selectedFragment.append(...Array.from(found));
|
|
1280
1249
|
}
|
|
1281
1250
|
} else {
|
|
1282
|
-
const divWrapper =
|
|
1251
|
+
const divWrapper = document.createElement("div");
|
|
1283
1252
|
divWrapper.append(...Array.from(main));
|
|
1284
1253
|
for (const arg of args) {
|
|
1285
1254
|
const selector = Cast.toString(arg);
|
|
@@ -1340,8 +1309,8 @@ var setattribute = SmartTags.makeSmartTag({
|
|
|
1340
1309
|
func: (main, args) => {
|
|
1341
1310
|
const argsStr = args.map((e) => Cast.toString(e));
|
|
1342
1311
|
const [name, value = ""] = argsStr;
|
|
1343
|
-
|
|
1344
|
-
|
|
1312
|
+
if (main instanceof NodeList) {
|
|
1313
|
+
const { document } = Window.get();
|
|
1345
1314
|
const children = Array.from(main).map((child) => {
|
|
1346
1315
|
const cloned = Utils.clone(child);
|
|
1347
1316
|
if (cloned instanceof Element) cloned.setAttribute(name, value);
|
|
@@ -1565,7 +1534,7 @@ var toggleclass = SmartTags.makeSmartTag({
|
|
|
1565
1534
|
mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
|
|
1566
1535
|
argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
|
|
1567
1536
|
func: (main, args) => {
|
|
1568
|
-
const { Element: Element2 } = Window.get();
|
|
1537
|
+
const { Element: Element2, document } = Window.get();
|
|
1569
1538
|
if (main instanceof Element2) {
|
|
1570
1539
|
args.forEach((arg) => main.classList.toggle(Cast.toString(arg)));
|
|
1571
1540
|
return Outcome.makeSuccess(main);
|
|
@@ -1780,7 +1749,7 @@ var Tree;
|
|
|
1780
1749
|
return new Tree2(merged, null, null, options);
|
|
1781
1750
|
}
|
|
1782
1751
|
constructor(node, parent, pathFromParent, options) {
|
|
1783
|
-
const { Element: Element2, Text: Text2, document
|
|
1752
|
+
const { Element: Element2, Text: Text2, document } = Window.get();
|
|
1784
1753
|
this.resolve = this.resolve.bind(this);
|
|
1785
1754
|
this.setVariable = this.setVariable.bind(this);
|
|
1786
1755
|
this.getVariable = this.getVariable.bind(this);
|
|
@@ -1936,7 +1905,7 @@ var Tree;
|
|
|
1936
1905
|
if (lastReducedItem instanceof Element2) return [...reduced, child];
|
|
1937
1906
|
const lastReducedTrimmed = trimEnd(lastReducedItem.textContent ?? "");
|
|
1938
1907
|
const childTrimmed = trimStart(child.textContent ?? "");
|
|
1939
|
-
const merged =
|
|
1908
|
+
const merged = document.createTextNode(`${lastReducedTrimmed}${childTrimmed}`);
|
|
1940
1909
|
const returned = [...reduced];
|
|
1941
1910
|
returned.pop();
|
|
1942
1911
|
returned.push(merged);
|
|
@@ -1949,7 +1918,7 @@ var Tree;
|
|
|
1949
1918
|
if (childNode instanceof Text2) {
|
|
1950
1919
|
const rawTextContent = childNode.textContent ?? "";
|
|
1951
1920
|
const textContent = rawTextContent.replace(/^\s*\n+\s*/, "").replace(/\s*\n+\s*$/, "");
|
|
1952
|
-
const returnedChildNode =
|
|
1921
|
+
const returnedChildNode = document.createTextNode(textContent);
|
|
1953
1922
|
mutableSubtrees.set(
|
|
1954
1923
|
positionnedChildrenCount,
|
|
1955
1924
|
new Tree2(returnedChildNode, this, positionnedChildrenCount, this.options)
|
|
@@ -2095,11 +2064,11 @@ var Tree;
|
|
|
2095
2064
|
var Utils;
|
|
2096
2065
|
((Utils2) => {
|
|
2097
2066
|
function clone2(value) {
|
|
2098
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
2067
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
2099
2068
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) return value;
|
|
2100
2069
|
if (value instanceof Text2) return value.cloneNode(true);
|
|
2101
2070
|
if (value instanceof NodeList2) {
|
|
2102
|
-
const frag =
|
|
2071
|
+
const frag = document.createDocumentFragment();
|
|
2103
2072
|
const nodes = Array.from(value).map((e) => e.cloneNode(true));
|
|
2104
2073
|
frag.append(...nodes);
|
|
2105
2074
|
return frag.childNodes;
|
|
@@ -2113,7 +2082,7 @@ var Utils;
|
|
|
2113
2082
|
}
|
|
2114
2083
|
Utils2.clone = clone2;
|
|
2115
2084
|
function coalesceValues(currentValue, subpath, subvalue) {
|
|
2116
|
-
const { Element: Element2, Text: Text2, NodeList: NodeList2, document
|
|
2085
|
+
const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
|
|
2117
2086
|
let actualSubvalue = subvalue;
|
|
2118
2087
|
if (actualSubvalue instanceof Transformer) {
|
|
2119
2088
|
const transformer = actualSubvalue;
|
|
@@ -2139,27 +2108,27 @@ var Utils;
|
|
|
2139
2108
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return `${currentValue}${actualSubvalue}`;
|
|
2140
2109
|
if (actualSubvalue instanceof Text2) return `${currentValue}${actualSubvalue.textContent}`;
|
|
2141
2110
|
if (actualSubvalue instanceof Element2) {
|
|
2142
|
-
const frag =
|
|
2111
|
+
const frag = document.createDocumentFragment();
|
|
2143
2112
|
frag.append(currentValue, Utils2.clone(actualSubvalue));
|
|
2144
2113
|
return frag.childNodes;
|
|
2145
2114
|
}
|
|
2146
2115
|
if (actualSubvalue instanceof NodeList2) {
|
|
2147
|
-
const frag =
|
|
2116
|
+
const frag = document.createDocumentFragment();
|
|
2148
2117
|
frag.append(currentValue, ...Array.from(Utils2.clone(actualSubvalue)));
|
|
2149
2118
|
return frag.childNodes;
|
|
2150
2119
|
}
|
|
2151
2120
|
return actualSubvalue;
|
|
2152
2121
|
}
|
|
2153
2122
|
if (currentValue instanceof Text2) {
|
|
2154
|
-
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return
|
|
2155
|
-
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}`);
|
|
2156
2125
|
if (actualSubvalue instanceof Element2) {
|
|
2157
|
-
const frag =
|
|
2126
|
+
const frag = document.createDocumentFragment();
|
|
2158
2127
|
frag.append(clone2(currentValue), clone2(actualSubvalue));
|
|
2159
2128
|
return frag.childNodes;
|
|
2160
2129
|
}
|
|
2161
2130
|
if (actualSubvalue instanceof NodeList2) {
|
|
2162
|
-
const frag =
|
|
2131
|
+
const frag = document.createDocumentFragment();
|
|
2163
2132
|
frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
|
|
2164
2133
|
return frag.childNodes;
|
|
2165
2134
|
}
|
|
@@ -2167,17 +2136,17 @@ var Utils;
|
|
|
2167
2136
|
}
|
|
2168
2137
|
if (currentValue instanceof Element2) {
|
|
2169
2138
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
|
|
2170
|
-
const frag =
|
|
2139
|
+
const frag = document.createDocumentFragment();
|
|
2171
2140
|
frag.append(clone2(currentValue), `${actualSubvalue}`);
|
|
2172
2141
|
return frag.childNodes;
|
|
2173
2142
|
}
|
|
2174
2143
|
if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
|
|
2175
|
-
const frag =
|
|
2144
|
+
const frag = document.createDocumentFragment();
|
|
2176
2145
|
frag.append(clone2(currentValue), clone2(actualSubvalue));
|
|
2177
2146
|
return frag.childNodes;
|
|
2178
2147
|
}
|
|
2179
2148
|
if (actualSubvalue instanceof NodeList2) {
|
|
2180
|
-
const frag =
|
|
2149
|
+
const frag = document.createDocumentFragment();
|
|
2181
2150
|
frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
|
|
2182
2151
|
return frag.childNodes;
|
|
2183
2152
|
}
|
|
@@ -2185,17 +2154,17 @@ var Utils;
|
|
|
2185
2154
|
}
|
|
2186
2155
|
if (currentValue instanceof NodeList2) {
|
|
2187
2156
|
if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
|
|
2188
|
-
const frag =
|
|
2157
|
+
const frag = document.createDocumentFragment();
|
|
2189
2158
|
frag.append(...Array.from(clone2(currentValue)), `${actualSubvalue}`);
|
|
2190
2159
|
return frag.childNodes;
|
|
2191
2160
|
}
|
|
2192
2161
|
if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
|
|
2193
|
-
const frag =
|
|
2162
|
+
const frag = document.createDocumentFragment();
|
|
2194
2163
|
frag.append(...Array.from(clone2(currentValue)), clone2(actualSubvalue));
|
|
2195
2164
|
return frag.childNodes;
|
|
2196
2165
|
}
|
|
2197
2166
|
if (actualSubvalue instanceof NodeList2) {
|
|
2198
|
-
const frag =
|
|
2167
|
+
const frag = document.createDocumentFragment();
|
|
2199
2168
|
frag.append(...Array.from(clone2(currentValue)), ...Array.from(clone2(actualSubvalue)));
|
|
2200
2169
|
return frag.childNodes;
|
|
2201
2170
|
}
|
|
@@ -2209,32 +2178,32 @@ var Utils;
|
|
|
2209
2178
|
}
|
|
2210
2179
|
Utils2.coalesceValues = coalesceValues;
|
|
2211
2180
|
Utils2.toHyperJson = (value) => {
|
|
2212
|
-
const { document
|
|
2181
|
+
const { document, Element: Element2, Text: Text2, NodeList: NodeList2 } = Window.get();
|
|
2213
2182
|
if (value instanceof Text2) {
|
|
2214
|
-
const elt2 =
|
|
2183
|
+
const elt2 = document.createElement("text");
|
|
2215
2184
|
elt2.innerHTML = value.textContent ?? "";
|
|
2216
2185
|
return elt2;
|
|
2217
2186
|
}
|
|
2218
2187
|
if (value instanceof Element2) return value.cloneNode(true);
|
|
2219
2188
|
if (value instanceof NodeList2) {
|
|
2220
|
-
const elt2 =
|
|
2189
|
+
const elt2 = document.createElement("nodelist");
|
|
2221
2190
|
elt2.append(...Array.from(value).map((e) => e.cloneNode(true)));
|
|
2222
2191
|
return elt2;
|
|
2223
2192
|
}
|
|
2224
|
-
if (value === null) return
|
|
2193
|
+
if (value === null) return document.createElement("null");
|
|
2225
2194
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
2226
|
-
const elt2 =
|
|
2195
|
+
const elt2 = document.createElement(typeof value);
|
|
2227
2196
|
elt2.innerHTML = `${value}`;
|
|
2228
2197
|
return elt2;
|
|
2229
2198
|
}
|
|
2230
2199
|
if (Array.isArray(value)) {
|
|
2231
|
-
const elt2 =
|
|
2200
|
+
const elt2 = document.createElement("array");
|
|
2232
2201
|
elt2.append(...value.map((e) => (0, Utils2.toHyperJson)(e)));
|
|
2233
2202
|
return elt2;
|
|
2234
2203
|
}
|
|
2235
2204
|
if (value instanceof Transformer) return clone2(value.sourceTree.node);
|
|
2236
2205
|
if (value instanceof Method) return clone2(value.transformer.sourceTree.node);
|
|
2237
|
-
const elt =
|
|
2206
|
+
const elt = document.createElement("record");
|
|
2238
2207
|
Object.entries(value).forEach(([key, val]) => {
|
|
2239
2208
|
const hjVal = (0, Utils2.toHyperJson)(val);
|
|
2240
2209
|
if (hjVal instanceof Text2) return;
|
|
@@ -2320,13 +2289,13 @@ var Utils;
|
|
|
2320
2289
|
let Tree2;
|
|
2321
2290
|
((Tree3) => {
|
|
2322
2291
|
function mergeNodes(nodes) {
|
|
2292
|
+
const { document, Text: Text2, Element: Element2 } = Window.get();
|
|
2323
2293
|
const clones = nodes.map((node) => node.cloneNode(true));
|
|
2324
2294
|
const allChildren = [];
|
|
2325
2295
|
clones.forEach((node) => {
|
|
2326
2296
|
const actionAttribute = node.getAttribute(Tree.Tree.actionAttribute)?.trim().toLowerCase();
|
|
2327
2297
|
const actionAttrIsValid = isInEnum(Types.Tree.Merge.Action, actionAttribute ?? "");
|
|
2328
2298
|
const nodeAction = actionAttrIsValid ? actionAttribute : Types.Tree.Merge.Action.APPEND;
|
|
2329
|
-
const { Element: Element2, Text: Text2 } = Window.get();
|
|
2330
2299
|
const children = Array.from(node.childNodes).filter((child) => child instanceof Text2 || child instanceof Element2).map((child) => {
|
|
2331
2300
|
if (child instanceof Text2) return { node: child, key: void 0 };
|
|
2332
2301
|
const childKey = child.getAttribute(Tree.Tree.keyAttribute) ?? void 0;
|
|
@@ -2364,14 +2333,14 @@ var Utils;
|
|
|
2364
2333
|
}
|
|
2365
2334
|
Tree3.mergeNodes = mergeNodes;
|
|
2366
2335
|
function getInitialValueFromTypeName(name) {
|
|
2367
|
-
const { document
|
|
2336
|
+
const { document } = Window.get();
|
|
2368
2337
|
if (name === "null") return null;
|
|
2369
2338
|
if (name === "boolean") return false;
|
|
2370
2339
|
if (name === "number") return 0;
|
|
2371
2340
|
if (name === "string") return "";
|
|
2372
|
-
if (name === "text") return
|
|
2373
|
-
if (name === "nodelist") return
|
|
2374
|
-
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");
|
|
2375
2344
|
if (name === "array") return [];
|
|
2376
2345
|
if (name === "record") return {};
|
|
2377
2346
|
throw new Error(`Unknown value type name: ${name}`);
|
|
@@ -2492,9 +2461,20 @@ var Utils;
|
|
|
2492
2461
|
found: `length: ${args.length}`
|
|
2493
2462
|
});
|
|
2494
2463
|
};
|
|
2495
|
-
SmartTags3.makeMainValueError = (expected, found, details) => ({
|
|
2496
|
-
|
|
2497
|
-
|
|
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
|
+
});
|
|
2498
2478
|
})(SmartTags2 = Utils2.SmartTags || (Utils2.SmartTags = {}));
|
|
2499
2479
|
})(Utils || (Utils = {}));
|
|
2500
2480
|
|
|
@@ -2534,10 +2514,8 @@ export {
|
|
|
2534
2514
|
getproperties,
|
|
2535
2515
|
getproperty,
|
|
2536
2516
|
deepGetProperty,
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
nodelistItemSplitterSymbol,
|
|
2540
|
-
elementItemSymbol,
|
|
2517
|
+
stringify,
|
|
2518
|
+
parse,
|
|
2541
2519
|
hjstringify,
|
|
2542
2520
|
hjparse,
|
|
2543
2521
|
ifFunc,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
file_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A3EVZT6I.js";
|
|
4
4
|
import {
|
|
5
5
|
bucket_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UXEKCYL7.js";
|
|
7
7
|
import {
|
|
8
8
|
directory_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-26T64AEI.js";
|
|
10
10
|
import {
|
|
11
11
|
__export
|
|
12
12
|
} from "./chunk-WSFCRVEQ.js";
|