@trintel/zooy 1.0.1-beta.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/chunks/button-B1jzfT-Z.js +272 -0
- package/dist/chunks/button-C-oX8EmF.js +66 -0
- package/dist/chunks/{button-skeleton-BcyctpC3.js → button-skeleton-CK3BHdja.js} +1 -1
- package/dist/chunks/{button-skeleton-DEmHtnd8.js → button-skeleton-DoCp6sBb.js} +5 -5
- package/dist/chunks/checkbox-CgFjYxQ_.js +201 -0
- package/dist/chunks/checkbox-t3G-H1NN.js +40 -0
- package/dist/chunks/{class-map-Dt10N9TS.js → class-map-D6tjF27Y.js} +1 -1
- package/dist/chunks/{class-map-emHvptF6.js → class-map-FWQBIzSx.js} +1 -1
- package/dist/chunks/collection-helpers-Bk68Vaau.js +7 -0
- package/dist/chunks/collection-helpers-afBvMQaC.js +1 -0
- package/dist/chunks/content-switcher-item-CedjjtvP.js +351 -0
- package/dist/chunks/content-switcher-item-c4WBWz31.js +27 -0
- package/dist/chunks/defs-C88lSWuJ.js +1 -0
- package/dist/chunks/defs-Do0OvCKd.js +1165 -0
- package/dist/chunks/dropdown-item-C0SHr4st.js +69 -0
- package/dist/chunks/dropdown-item-Dh5IEXDr.js +621 -0
- package/dist/chunks/{focus-Dty12qxz.js → focus-B3iymVyL.js} +1 -1
- package/dist/chunks/{focus-Cyj1QfBL.js → focus-WnKGH_xB.js} +1 -1
- package/dist/chunks/{icon-loader-C2EqV5wJ.js → icon-loader-CJxyg-lp.js} +1 -1
- package/dist/chunks/{icon-loader-DS-X84Yz.js → icon-loader-ChKeNR4s.js} +1 -1
- package/dist/chunks/{icon-loader-utils-BIiU-zGK.js → icon-loader-utils-BwViqIXz.js} +1 -1
- package/dist/chunks/{icon-loader-utils-B6kq3DHp.js → icon-loader-utils-DK8DViXt.js} +1 -1
- package/dist/chunks/{if-defined-CFTJFEK6.js → if-defined-DYWhlnlE.js} +1 -1
- package/dist/chunks/{if-defined--xXVpdta.js → if-defined-eJcDYClo.js} +1 -1
- package/dist/chunks/{if-non-empty-0zvrDGPr.js → if-non-empty-COTeEFkK.js} +1 -1
- package/dist/chunks/if-non-empty-CxMysAQW.js +1 -0
- package/dist/chunks/index-0AElqkkj.js +12 -0
- package/dist/chunks/{index-DEcgB0oH.js → index-4WNeLsiw.js} +4 -4
- package/dist/chunks/{index-C3LD0iwa.js → index-4XJJobHw.js} +12 -12
- package/dist/chunks/index-7cXLLw89.js +881 -0
- package/dist/chunks/index-9fmHblh5.js +121 -0
- package/dist/chunks/{index-DocEKbBo.js → index-B0nToMRj.js} +5 -5
- package/dist/chunks/index-B4SxU_Hu.js +87 -0
- package/dist/chunks/index-B5DpS-cb.js +2 -0
- package/dist/chunks/{index-D1PpRn2p.js → index-B5GB0rQW.js} +40 -31
- package/dist/chunks/index-B8Ze9ISK.js +17 -0
- package/dist/chunks/index-BAAA4wkE.js +45 -0
- package/dist/chunks/index-BBWp83R-.js +160 -0
- package/dist/chunks/index-BBap1uCI.js +1 -0
- package/dist/chunks/index-BGGDxbLL.js +368 -0
- package/dist/chunks/index-BMquNDkd.js +381 -0
- package/dist/chunks/{index-RlFlo7pl.js → index-BQnyeVHX.js} +1 -1
- package/dist/chunks/index-BRnzFxjk.js +25 -0
- package/dist/chunks/index-BbJQIwkY.js +452 -0
- package/dist/chunks/{index-DQZqjZ8k.js → index-Bb_1S0pr.js} +7 -7
- package/dist/chunks/index-BeMnerDj.js +111 -0
- package/dist/chunks/index-Bff6B9vY.js +254 -0
- package/dist/chunks/index-Bi9WliCA.js +683 -0
- package/dist/chunks/{index-DXoeeipa.js → index-Bls8zdHV.js} +6 -6
- package/dist/chunks/index-Bo2QmpPO.js +1 -0
- package/dist/chunks/index-BseD7Jzt.js +75 -0
- package/dist/chunks/index-Bt7v-zqV.js +77 -0
- package/dist/chunks/index-Bunat0DP.js +337 -0
- package/dist/chunks/index-BvdNKhJw.js +19 -0
- package/dist/chunks/index-BwFE4R87.js +30 -0
- package/dist/chunks/index-BwRxBdeg.js +158 -0
- package/dist/chunks/{index-cMdyiXPa.js → index-Bymsj9gH.js} +1 -1
- package/dist/chunks/{index-CZwmnbDv.js → index-C-pfDP7B.js} +1 -1
- package/dist/chunks/{index-C6SudlSp.js → index-C2oV5vU3.js} +1 -1
- package/dist/chunks/index-C3n83pM3.js +103 -0
- package/dist/chunks/index-C572_UKV.js +22 -0
- package/dist/chunks/index-C6bOvXSf.js +129 -0
- package/dist/chunks/{index-BKsBoGOO.js → index-CBICHiFD.js} +147 -135
- package/dist/chunks/index-CEy6bu7P.js +79 -0
- package/dist/chunks/{index-Dl6HFhg1.js → index-CFqKkC5Z.js} +1 -1
- package/dist/chunks/{index-h66Bp4Cx.js → index-CIZ3Gnmm.js} +1 -1
- package/dist/chunks/index-CIiIAqrQ.js +414 -0
- package/dist/chunks/index-CJdEJ8pY.js +15 -0
- package/dist/chunks/index-CKYRBtLC.js +79 -0
- package/dist/chunks/index-CQl4NaPS.js +65 -0
- package/dist/chunks/index-CR3DrmQi.js +235 -0
- package/dist/chunks/index-CTsGb3mD.js +364 -0
- package/dist/chunks/{index-C_Xg4nHN.js → index-CV7TVQ4T.js} +7 -7
- package/dist/chunks/index-CWlg_Hu2.js +150 -0
- package/dist/chunks/{index-Df3VILTD.js → index-CYIcfuAW.js} +4 -4
- package/dist/chunks/{index-Ci2M9li9.js → index-CkxGsCJy.js} +181 -182
- package/dist/chunks/index-ClE0uX_c.js +27 -0
- package/dist/chunks/index-Cnsy7Qk3.js +511 -0
- package/dist/chunks/index-CoAT1iC6.js +12 -0
- package/dist/chunks/index-Cp3P3KaW.js +45 -0
- package/dist/chunks/index-CqQZpHti.js +3 -0
- package/dist/chunks/{index-B1YLd9rD.js → index-CsjJntyD.js} +1 -1
- package/dist/chunks/{index-B3EmHaO7.js → index-Ctna95NT.js} +5 -5
- package/dist/chunks/index-Cu1u3Mjn.js +150 -0
- package/dist/chunks/{index-CArtDXbg.js → index-Cv6qE9qP.js} +1 -1
- package/dist/chunks/index-Cwb1pbm9.js +252 -0
- package/dist/chunks/{index-CYpHcMws.js → index-CzAwJhyQ.js} +4 -4
- package/dist/chunks/index-D8LE8G2j.js +81 -0
- package/dist/chunks/{index-1G2UuijG.js → index-D9sRIKMQ.js} +9 -9
- package/dist/chunks/index-DBsASlZI.js +15 -0
- package/dist/chunks/{index-LR7m5odx.js → index-DGw1TVFB.js} +3 -3
- package/dist/chunks/{index-Clei4V9i.js → index-DIsXKJDH.js} +1 -1
- package/dist/chunks/{index-BJHILyIN.js → index-DNWjc2SJ.js} +3 -3
- package/dist/chunks/index-DSOPjl5x.js +563 -0
- package/dist/chunks/index-DUtoSCTU.js +455 -0
- package/dist/chunks/index-DWjrCygZ.js +49 -0
- package/dist/chunks/{index-Cl1_9l1N.js → index-DYvD9xjl.js} +1 -1
- package/dist/chunks/{index-CYg05Ph9.js → index-DZabSr3s.js} +4 -4
- package/dist/chunks/{index-BhJiw5Wx.js → index-DbAeG1nY.js} +1 -1
- package/dist/chunks/index-Dc51G1mo.js +26 -0
- package/dist/chunks/index-Dd9iSSXa.js +260 -0
- package/dist/chunks/{index-BQNhvN2i.js → index-DfFx1Jz3.js} +4 -4
- package/dist/chunks/index-Dh4LYLg5.js +1604 -0
- package/dist/chunks/index-Dk3tlz8Q.js +15 -0
- package/dist/chunks/index-Do1DszoZ.js +1 -0
- package/dist/chunks/index-DrDKdYFJ.js +58 -0
- package/dist/chunks/{index-CmA3uuMd.js → index-DyO3Wdy_.js} +1 -1
- package/dist/chunks/index-DyyLrVDY.js +188 -0
- package/dist/chunks/{index-DkUS58Ay.js → index-GDVDUQtg.js} +14 -14
- package/dist/chunks/index-GbWz6fuF.js +243 -0
- package/dist/chunks/index-JWULDURW.js +89 -0
- package/dist/chunks/index-MgWriQfr.js +35 -0
- package/dist/chunks/index-OgL1A9Rm.js +42 -0
- package/dist/chunks/{index-BG3BMHhy.js → index-QzojJs5M.js} +3 -3
- package/dist/chunks/index-TJL02uup.js +291 -0
- package/dist/chunks/index-Z4ar01y-.js +259 -0
- package/dist/chunks/{index-TCPPpE9b.js → index-_xRytR0j.js} +1 -1
- package/dist/chunks/index-cuMoh7qn.js +1 -0
- package/dist/chunks/index-du3RQU31.js +62 -0
- package/dist/chunks/{index-CZ2kGMvF.js → index-hH_m653R.js} +6 -6
- package/dist/chunks/{index-Bd60xpxv.js → index-hn76Yo-L.js} +1 -1
- package/dist/chunks/index-i4heE-wx.js +71 -0
- package/dist/chunks/index-i9jyrFc9.js +19 -0
- package/dist/chunks/index-lFqOe0IJ.js +46 -0
- package/dist/chunks/index-pS6-humH.js +74 -0
- package/dist/chunks/index-pc36PiDY.js +57 -0
- package/dist/chunks/index-qgl9W8eF.js +52 -0
- package/dist/chunks/{index-CKBFfWOV.js → index-uwN33H1P.js} +7 -7
- package/dist/chunks/index-uxZPrL2m.js +406 -0
- package/dist/chunks/index-yzFU-E6F.js +22 -0
- package/dist/chunks/{loading-icon-Bw73Z2Lq.js → loading-icon-CPvmJvpZ.js} +1 -1
- package/dist/chunks/{loading-icon-D7mJr3sa.js → loading-icon-DdwpAk8-.js} +2 -2
- package/dist/chunks/{main-DTOZMPON.js → main-BGOPab-5.js} +1489 -1129
- package/dist/chunks/main-Bx21zlkN.js +65 -0
- package/dist/chunks/{property-Coy6Dag6.js → property-BkjBVRuu.js} +1 -1
- package/dist/chunks/{property-C5teVlku.js → property-DAFv3PCb.js} +1 -1
- package/dist/chunks/register-BCEOkbXG.js +1583 -0
- package/dist/chunks/{register-CHuMnx--.js → register-Bkr1UKav.js} +1 -1
- package/dist/chunks/{register-BO2Fr57T.js → register-DTXmg-gw.js} +1 -1
- package/dist/chunks/register-D_CXtGy1.js +1 -0
- package/dist/chunks/search-DDFN8-Mz.js +30 -0
- package/dist/chunks/search-npG8ywjx.js +240 -0
- package/dist/chunks/select-CFy3MvH6.js +76 -0
- package/dist/chunks/select-DkCpQORs.js +357 -0
- package/dist/chunks/{settings-NO9fjW0P.js → settings-Bgpv8zuU.js} +2 -0
- package/dist/chunks/{settings-Dy9UPb4i.js → settings-jvP7vP60.js} +2 -0
- package/dist/chunks/{state-BFc9dfyj.js → state-BdgD82MZ.js} +1 -1
- package/dist/chunks/{state-C2XTwLOv.js → state-uF7CZaP5.js} +1 -1
- package/dist/chunks/text-input-BUdM-ojg.js +68 -0
- package/dist/chunks/text-input-DVdkm07X.js +372 -0
- package/dist/chunks/tooltip-content-BXcBmMsV.js +3 -0
- package/dist/chunks/tooltip-content-CWRE_NqH.js +135 -0
- package/dist/chunks/{unsafe-html-9YCxB3h1.js → unsafe-html-Bg0eM3hS.js} +1 -1
- package/dist/chunks/{unsafe-html-H7RRvoR7.js → unsafe-html-CpAqmPyx.js} +1 -1
- package/dist/zooy.cjs.js +1 -1
- package/dist/zooy.es.js +10 -10
- package/package.json +2 -2
- package/src/sass/carbon.scss +41 -0
- package/src/sass/panels.scss +263 -377
- package/src/sass/split.scss +0 -13
- package/dist/chunks/button-CgQW6Alg.js +0 -272
- package/dist/chunks/button-CnwdjMNF.js +0 -66
- package/dist/chunks/checkbox-Bt024Adv.js +0 -40
- package/dist/chunks/checkbox-D2LeqAn8.js +0 -201
- package/dist/chunks/collection-helpers-BwUB2CEz.js +0 -8
- package/dist/chunks/collection-helpers-CYLIiyii.js +0 -1
- package/dist/chunks/content-switcher-item-D6gOZCuS.js +0 -351
- package/dist/chunks/content-switcher-item-Dtv8UD1x.js +0 -27
- package/dist/chunks/defs-DMmigODC.js +0 -1077
- package/dist/chunks/defs-DPD20sPK.js +0 -1
- package/dist/chunks/dropdown-item-BDRUe-IF.js +0 -621
- package/dist/chunks/dropdown-item-DNLmqxnr.js +0 -69
- package/dist/chunks/if-non-empty-BIwvmklX.js +0 -1
- package/dist/chunks/index-21j_5emj.js +0 -35
- package/dist/chunks/index-82K_ozYZ.js +0 -455
- package/dist/chunks/index-B4JPT-gj.js +0 -683
- package/dist/chunks/index-B5-56fkV.js +0 -62
- package/dist/chunks/index-B612bWya.js +0 -58
- package/dist/chunks/index-B8nOkbPA.js +0 -77
- package/dist/chunks/index-BAEdnwkZ.js +0 -25
- package/dist/chunks/index-BAMMtRO9.js +0 -214
- package/dist/chunks/index-BC-p6lrw.js +0 -337
- package/dist/chunks/index-BEOc7JG-.js +0 -16
- package/dist/chunks/index-BHWaezgU.js +0 -259
- package/dist/chunks/index-BNjgzCq_.js +0 -1
- package/dist/chunks/index-BTND2b3S.js +0 -19
- package/dist/chunks/index-BZmOT6Xm.js +0 -89
- package/dist/chunks/index-B_C9vt_w.js +0 -30
- package/dist/chunks/index-B_JMGygD.js +0 -188
- package/dist/chunks/index-Bl6sE0-K.js +0 -1
- package/dist/chunks/index-BmvLxuoI.js +0 -16
- package/dist/chunks/index-BwMEAhRr.js +0 -2
- package/dist/chunks/index-BwOJ4JFm.js +0 -1604
- package/dist/chunks/index-BzmpjZ1o.js +0 -26
- package/dist/chunks/index-C06cFvgb.js +0 -406
- package/dist/chunks/index-C4JzGVcF.js +0 -49
- package/dist/chunks/index-C5nYdcCH.js +0 -875
- package/dist/chunks/index-C6WHuZdF.js +0 -79
- package/dist/chunks/index-C8YWVLB0.js +0 -128
- package/dist/chunks/index-C8miW4lw.js +0 -364
- package/dist/chunks/index-CDNshf0_.js +0 -57
- package/dist/chunks/index-CFYfFa1Z.js +0 -235
- package/dist/chunks/index-CJZtiqY-.js +0 -22
- package/dist/chunks/index-CMD0FIe-.js +0 -41
- package/dist/chunks/index-COcNpxlj.js +0 -87
- package/dist/chunks/index-CUTw26ex.js +0 -368
- package/dist/chunks/index-CUd_43Fv.js +0 -414
- package/dist/chunks/index-CXgbBzE5.js +0 -252
- package/dist/chunks/index-C_S3O2rJ.js +0 -79
- package/dist/chunks/index-CbuopDOc.js +0 -1
- package/dist/chunks/index-CcxiTkam.js +0 -150
- package/dist/chunks/index-Ce9jg1n7.js +0 -15
- package/dist/chunks/index-CfLbYyk0.js +0 -3
- package/dist/chunks/index-CkMd-UJg.js +0 -52
- package/dist/chunks/index-Co5m8M3y.js +0 -12
- package/dist/chunks/index-CoPuejcu.js +0 -511
- package/dist/chunks/index-Cq6Vdh__.js +0 -215
- package/dist/chunks/index-Cwe1NunF.js +0 -46
- package/dist/chunks/index-D1OTs_P5.js +0 -1
- package/dist/chunks/index-D3ldTviC.js +0 -150
- package/dist/chunks/index-DBvXH68A.js +0 -26
- package/dist/chunks/index-DC7qmnoW.js +0 -74
- package/dist/chunks/index-DDRkmmQp.js +0 -156
- package/dist/chunks/index-DH9eR0DH.js +0 -32
- package/dist/chunks/index-DLUPGsWM.js +0 -71
- package/dist/chunks/index-D_pgjOiX.js +0 -81
- package/dist/chunks/index-DktSeVhc.js +0 -563
- package/dist/chunks/index-Dqe5xXlT.js +0 -160
- package/dist/chunks/index-DuGskRLI.js +0 -243
- package/dist/chunks/index-DyoG-yF-.js +0 -75
- package/dist/chunks/index-E_bjKqnf.js +0 -15
- package/dist/chunks/index-GRYR4d36.js +0 -394
- package/dist/chunks/index-H-w5fBQG.js +0 -65
- package/dist/chunks/index-HvLIPR2y.js +0 -291
- package/dist/chunks/index-OhwD9m-A.js +0 -12
- package/dist/chunks/index-XTPnXw_W.js +0 -45
- package/dist/chunks/index-ZyhwV5v-.js +0 -452
- package/dist/chunks/index-cFX6zBu4.js +0 -19
- package/dist/chunks/index-fghrBFfu.js +0 -103
- package/dist/chunks/index-wTRaGtNG.js +0 -45
- package/dist/chunks/index-wigDmvr8.js +0 -121
- package/dist/chunks/index-y_a1ZQAA.js +0 -111
- package/dist/chunks/main-A63e59aD.js +0 -67
- package/dist/chunks/register-B533U9U9.js +0 -1
- package/dist/chunks/register-ClkXTZwT.js +0 -1383
- package/dist/chunks/search-CsRC23Cp.js +0 -240
- package/dist/chunks/search-DsyFfaxl.js +0 -30
- package/dist/chunks/select-BoaR85ix.js +0 -76
- package/dist/chunks/select-CKe8zwIo.js +0 -357
- package/dist/chunks/text-input-BuK8MjZG.js +0 -68
- package/dist/chunks/text-input-D2BsjPTx.js +0 -372
- package/dist/chunks/tooltip-content-B6aAm7Zu.js +0 -3
- package/dist/chunks/tooltip-content-DXrPA6JW.js +0 -135
|
@@ -3,36 +3,38 @@ const numericString = "0123456789".split("");
|
|
|
3
3
|
const alphaLower = "abcdefghijklmnopqrstuvwxyz".split(""), alphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
4
4
|
[...alphaLower, ...alphaUpper, ...numericString];
|
|
5
5
|
(/* @__PURE__ */ new Map()).set("true", !0).set("false", !1);
|
|
6
|
-
const compose = (...O) => (...
|
|
6
|
+
const compose = (...O) => (...w) => O.reduce((D, U) => (F) => D(U(F)))(...w), identity = (O) => O, whatType = (O) => typeof O, isDef = (O) => O !== void 0, isUndefined = (O) => O === void 0, isDefAndNotNull = (O) => O != null, isString = (O) => whatType(O) === "string", isNumber = (O) => whatType(O) === "number" && !Number.isNaN(
|
|
7
7
|
/** @type number */
|
|
8
8
|
O
|
|
9
|
-
), isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((
|
|
10
|
-
compose(toLowerCase, toString);
|
|
9
|
+
), isObject = (O) => (O && typeof O == "object" && !(O instanceof Array) && !(O instanceof Set) && !(O instanceof Map) && !(O instanceof Date)) === !0, isArray = (O) => O instanceof Array, reverse = (O) => Array.from(O).reduce((w, D) => [D, ...w], []), toLowerCase = (O) => O.toLowerCase(), toString$1 = (O) => O + "", toNumber = (O) => +O;
|
|
10
|
+
compose(toLowerCase, toString$1);
|
|
11
11
|
const makeRandomString = () => {
|
|
12
12
|
let O = 2147483648;
|
|
13
13
|
return Math.floor(Math.random() * O).toString(36) + Math.abs(Math.floor(Math.random() * O) ^ Date.now()).toString(36);
|
|
14
|
-
}, stripLeadingChar = (O) => (
|
|
14
|
+
}, stripLeadingChar = (O) => (w) => w.startsWith(O) ? w.slice(O.length) : w, join = (O) => (w) => w.join(O);
|
|
15
15
|
compose(join(""), reverse);
|
|
16
|
-
const pathOr = (O,
|
|
17
|
-
const U =
|
|
16
|
+
const pathOr = (O, w) => (D) => {
|
|
17
|
+
const U = w.reduce((F, q) => {
|
|
18
18
|
try {
|
|
19
19
|
return F[maybeNumber(q)];
|
|
20
20
|
} catch {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
},
|
|
23
|
+
}, D);
|
|
24
24
|
return U === void 0 ? O : U;
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
}, objToPaths = (O, w = [], D = []) => (Object.entries(O).forEach(([U, F]) => {
|
|
26
|
+
isObject(F) ? objToPaths(F, [...w, U], D) : D.push([[...w, U], F]);
|
|
27
|
+
}), D), randomId = (O) => {
|
|
28
|
+
const w = makeRandomString();
|
|
29
|
+
return O ? w.substr(0, O) : w;
|
|
28
30
|
}, maybeNumber = (O) => {
|
|
29
31
|
if (O === null || whatType(O) === "string" && O.length > 1 && O.startsWith("0") && !O.startsWith("0."))
|
|
30
32
|
return O;
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
+
const w = 1 * O;
|
|
34
|
+
return w > Number.MAX_SAFE_INTEGER || Number.isNaN(w) ? O : w;
|
|
33
35
|
};
|
|
34
|
-
compose(toNumber, join(""), reverse, toString);
|
|
35
|
-
class
|
|
36
|
+
compose(toNumber, join(""), reverse, toString$1);
|
|
37
|
+
class Evt extends EventTarget {
|
|
36
38
|
/**
|
|
37
39
|
* Set this to true to get some debug in the console.
|
|
38
40
|
* @type {boolean}
|
|
@@ -46,7 +48,7 @@ class EVT extends EventTarget {
|
|
|
46
48
|
*/
|
|
47
49
|
#e = !1;
|
|
48
50
|
/**
|
|
49
|
-
* A map of listener targets to an object of event
|
|
51
|
+
* A map of listener targets to an object of zoo-event functions
|
|
50
52
|
* When adding a listener, immediately also create the un-listen functions
|
|
51
53
|
* and store those in an object keyed with the event.
|
|
52
54
|
* Store these objects against the target in a map
|
|
@@ -75,8 +77,8 @@ class EVT extends EventTarget {
|
|
|
75
77
|
* @param {*} data The data to attach to the event's detail property
|
|
76
78
|
* @return {!CustomEvent} A new CustomEvent instance
|
|
77
79
|
*/
|
|
78
|
-
static makeEvent(
|
|
79
|
-
return new CustomEvent(
|
|
80
|
+
static makeEvent(w, D) {
|
|
81
|
+
return new CustomEvent(w, { detail: D });
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
84
|
* Sets debug mode for this component. When enabled, debug messages
|
|
@@ -84,10 +86,10 @@ class EVT extends EventTarget {
|
|
|
84
86
|
* @param {boolean} bool True to enable debug mode, false to disable
|
|
85
87
|
* @throws {Error} If the value is not a boolean
|
|
86
88
|
*/
|
|
87
|
-
set debugMode(
|
|
88
|
-
if (typeof
|
|
89
|
+
set debugMode(w) {
|
|
90
|
+
if (typeof w != "boolean")
|
|
89
91
|
throw new Error("This must be a boolean");
|
|
90
|
-
this.#t =
|
|
92
|
+
this.#t = w;
|
|
91
93
|
}
|
|
92
94
|
get debugMode() {
|
|
93
95
|
return this.#t;
|
|
@@ -117,63 +119,63 @@ class EVT extends EventTarget {
|
|
|
117
119
|
* Automatically prepends the constructor name to the output.
|
|
118
120
|
* @param {...*} s Arguments to log
|
|
119
121
|
*/
|
|
120
|
-
debugMe(...
|
|
121
|
-
this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...
|
|
122
|
+
debugMe(...w) {
|
|
123
|
+
this.#t && console.log.apply(null, [this.constructor.name, "DEBUG:", ...w]);
|
|
122
124
|
}
|
|
123
125
|
//--[ Listeners and Listening ]--
|
|
124
126
|
/**
|
|
125
|
-
* @param {!EventTarget|!
|
|
127
|
+
* @param {!EventTarget|!Evt} comp
|
|
126
128
|
*/
|
|
127
|
-
isListenedToBy(
|
|
128
|
-
this.#r.add(
|
|
129
|
+
isListenedToBy(w) {
|
|
130
|
+
this.#r.add(w);
|
|
129
131
|
}
|
|
130
132
|
/**
|
|
131
133
|
* WARNING! DO not use options={passive: true} here. It disallows us to
|
|
132
134
|
* use preventDefault when we intercept the form, and that leads to a
|
|
133
135
|
* general inability to POST forms.
|
|
134
136
|
*
|
|
135
|
-
* @param {!EventTarget|!
|
|
137
|
+
* @param {!EventTarget|!Evt|!Node} target
|
|
136
138
|
* @param {string} event
|
|
137
139
|
* @param {!Function} action
|
|
138
140
|
* @param {boolean|!Object} options
|
|
139
141
|
*/
|
|
140
|
-
listen(
|
|
141
|
-
|
|
142
|
-
const q = this.listeningTo.get(
|
|
143
|
-
q[
|
|
142
|
+
listen(w, D, U, F = !1) {
|
|
143
|
+
w.addEventListener(D, U, F);
|
|
144
|
+
const q = this.listeningTo.get(w) || {};
|
|
145
|
+
q[D] = () => w.removeEventListener(D, U, F), this.listeningTo.set(w, q), isDef(w.isListenedToBy) && w.isListenedToBy(this);
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
146
148
|
* Remove self from all components tt are listening to me.
|
|
147
149
|
*/
|
|
148
150
|
stopBeingListenedTo() {
|
|
149
|
-
for (const
|
|
150
|
-
|
|
151
|
+
for (const w of this.isObservedBy)
|
|
152
|
+
w.stopListeningTo(this), this.isObservedBy.delete(w);
|
|
151
153
|
}
|
|
152
154
|
/**
|
|
153
155
|
* Stop listening to all events on target.
|
|
154
|
-
* @param {!EventTarget|!
|
|
156
|
+
* @param {!EventTarget|!Evt|!Node|undefined} target
|
|
155
157
|
* @param {string=} opt_event
|
|
156
158
|
*/
|
|
157
|
-
stopListeningTo(
|
|
158
|
-
|
|
159
|
-
U ===
|
|
160
|
-
}), Object.keys(this.listeningTo.get(
|
|
159
|
+
stopListeningTo(w, D) {
|
|
160
|
+
w && this.listeningTo.has(w) && (isDef(w.isObservedBy) && w.isObservedBy.delete(this), isDef(D) ? (Object.entries(this.listeningTo.get(w)).forEach(([U, F]) => {
|
|
161
|
+
U === D && F();
|
|
162
|
+
}), Object.keys(this.listeningTo.get(w)).length || this.listeningTo.delete(w)) : (Object.values(this.listeningTo.get(w)).forEach((U) => U()), this.listeningTo.delete(w)));
|
|
161
163
|
}
|
|
162
164
|
/**
|
|
163
165
|
* Removes all the event listeners that is managed by this
|
|
164
166
|
* component.
|
|
165
167
|
*/
|
|
166
168
|
removeAllListener() {
|
|
167
|
-
for (const
|
|
168
|
-
this.stopListeningTo(
|
|
169
|
+
for (const w of this.listeningTo.keys())
|
|
170
|
+
this.stopListeningTo(w);
|
|
169
171
|
}
|
|
170
172
|
/**
|
|
171
173
|
* Clears all active intervals created by this component.
|
|
172
174
|
* Called automatically during disposal to prevent memory leaks.
|
|
173
175
|
*/
|
|
174
176
|
clearAllIntervals() {
|
|
175
|
-
for (const
|
|
176
|
-
clearInterval(
|
|
177
|
+
for (const w of this.activeIntervals)
|
|
178
|
+
clearInterval(w), this.activeIntervals.delete(w);
|
|
177
179
|
}
|
|
178
180
|
/**
|
|
179
181
|
* Executes a function repeatedly at a specified interval.
|
|
@@ -181,8 +183,8 @@ class EVT extends EventTarget {
|
|
|
181
183
|
* @param {!Function} f The function to execute on each interval
|
|
182
184
|
* @param {number} interval The interval in milliseconds
|
|
183
185
|
*/
|
|
184
|
-
doOnBeat(
|
|
185
|
-
const U = setInterval(
|
|
186
|
+
doOnBeat(w, D) {
|
|
187
|
+
const U = setInterval(w, D);
|
|
186
188
|
this.activeIntervals.add(U);
|
|
187
189
|
}
|
|
188
190
|
/**
|
|
@@ -205,8 +207,8 @@ class EVT extends EventTarget {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
class ZooyEventData {
|
|
208
|
-
constructor(
|
|
209
|
-
this.value_ =
|
|
210
|
+
constructor(w, D) {
|
|
211
|
+
this.value_ = w, this.data_ = D || {};
|
|
210
212
|
}
|
|
211
213
|
getValue() {
|
|
212
214
|
return this.value_;
|
|
@@ -237,21 +239,21 @@ const UiEventType = {
|
|
|
237
239
|
FORM_SUBMIT_SUCCESS: randomId()
|
|
238
240
|
};
|
|
239
241
|
var EN_US = ["second", "minute", "hour", "day", "week", "month", "year"];
|
|
240
|
-
function en_US(O,
|
|
241
|
-
if (
|
|
242
|
+
function en_US(O, w) {
|
|
243
|
+
if (w === 0)
|
|
242
244
|
return ["just now", "right now"];
|
|
243
|
-
var
|
|
244
|
-
return O > 1 && (
|
|
245
|
+
var D = EN_US[Math.floor(w / 2)];
|
|
246
|
+
return O > 1 && (D += "s"), [O + " " + D + " ago", "in " + O + " " + D];
|
|
245
247
|
}
|
|
246
248
|
var ZH_CN = ["秒", "分钟", "小时", "天", "周", "个月", "年"];
|
|
247
|
-
function zh_CN(O,
|
|
248
|
-
if (
|
|
249
|
+
function zh_CN(O, w) {
|
|
250
|
+
if (w === 0)
|
|
249
251
|
return ["刚刚", "片刻后"];
|
|
250
|
-
var
|
|
251
|
-
return [O + " " +
|
|
252
|
+
var D = ZH_CN[~~(w / 2)];
|
|
253
|
+
return [O + " " + D + "前", O + " " + D + "后"];
|
|
252
254
|
}
|
|
253
|
-
var Locales = {}, register = function(O,
|
|
254
|
-
Locales[O] =
|
|
255
|
+
var Locales = {}, register = function(O, w) {
|
|
256
|
+
Locales[O] = w;
|
|
255
257
|
}, getLocale = function(O) {
|
|
256
258
|
return Locales[O] || Locales.en_US;
|
|
257
259
|
}, SEC_ARRAY = [
|
|
@@ -265,20 +267,20 @@ var Locales = {}, register = function(O, D) {
|
|
|
265
267
|
function toDate(O) {
|
|
266
268
|
return O instanceof Date ? O : !isNaN(O) || /^\d+$/.test(O) ? new Date(parseInt(O)) : (O = (O || "").trim().replace(/\.\d+/, "").replace(/-/, "/").replace(/-/, "/").replace(/(\d)T(\d)/, "$1 $2").replace(/Z/, " UTC").replace(/([+-]\d\d):?(\d\d)/, " $1$2"), new Date(O));
|
|
267
269
|
}
|
|
268
|
-
function formatDiff(O,
|
|
269
|
-
var
|
|
270
|
+
function formatDiff(O, w) {
|
|
271
|
+
var D = O < 0 ? 1 : 0;
|
|
270
272
|
O = Math.abs(O);
|
|
271
273
|
for (var U = O, F = 0; O >= SEC_ARRAY[F] && F < SEC_ARRAY.length; F++)
|
|
272
274
|
O /= SEC_ARRAY[F];
|
|
273
|
-
return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1),
|
|
275
|
+
return O = Math.floor(O), F *= 2, O > (F === 0 ? 9 : 1) && (F += 1), w(O, F, U)[D].replace("%s", O.toString());
|
|
274
276
|
}
|
|
275
|
-
function diffSec(O,
|
|
276
|
-
var
|
|
277
|
-
return (+
|
|
277
|
+
function diffSec(O, w) {
|
|
278
|
+
var D = /* @__PURE__ */ new Date();
|
|
279
|
+
return (+D - +toDate(O)) / 1e3;
|
|
278
280
|
}
|
|
279
|
-
var format = function(O,
|
|
281
|
+
var format = function(O, w, D) {
|
|
280
282
|
var U = diffSec(O);
|
|
281
|
-
return formatDiff(U, getLocale(
|
|
283
|
+
return formatDiff(U, getLocale(w));
|
|
282
284
|
};
|
|
283
285
|
register("en_US", en_US);
|
|
284
286
|
register("zh_CN", zh_CN);
|
|
@@ -288,26 +290,26 @@ const getInputChecked_ = function(O) {
|
|
|
288
290
|
O.value
|
|
289
291
|
) : null;
|
|
290
292
|
}, getSelectSingle_ = function(O) {
|
|
291
|
-
const
|
|
293
|
+
const w = (
|
|
292
294
|
/** @type {!HTMLSelectElement} */
|
|
293
295
|
O.selectedIndex
|
|
294
296
|
);
|
|
295
|
-
return
|
|
297
|
+
return w >= 0 ? (
|
|
296
298
|
/** @type {!HTMLSelectElement} */
|
|
297
|
-
O.options[
|
|
299
|
+
O.options[w].value
|
|
298
300
|
) : null;
|
|
299
301
|
}, getSelectMultiple_ = function(O) {
|
|
300
|
-
const
|
|
301
|
-
for (let
|
|
302
|
+
const w = [];
|
|
303
|
+
for (let D, U = 0; D = /** @type {!HTMLSelectElement} */
|
|
302
304
|
O.options[U]; U++)
|
|
303
|
-
|
|
304
|
-
return
|
|
305
|
+
D.selected && w.push(D.value);
|
|
306
|
+
return w.length ? w : null;
|
|
305
307
|
}, getValue = function(O) {
|
|
306
|
-
const
|
|
308
|
+
const w = (
|
|
307
309
|
/** @type {!HTMLInputElement} */
|
|
308
310
|
O.type
|
|
309
311
|
);
|
|
310
|
-
switch (isString(
|
|
312
|
+
switch (isString(w) && w.toLowerCase()) {
|
|
311
313
|
case "checkbox":
|
|
312
314
|
case "radio":
|
|
313
315
|
return getInputChecked_(O);
|
|
@@ -318,44 +320,44 @@ const getInputChecked_ = function(O) {
|
|
|
318
320
|
default:
|
|
319
321
|
return O.value !== null && O.value !== void 0 ? O.value : null;
|
|
320
322
|
}
|
|
321
|
-
}, formToJSON = (O) => [...O].reduce((
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
}, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O,
|
|
325
|
-
|
|
326
|
-
}, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((
|
|
327
|
-
const
|
|
328
|
-
return
|
|
323
|
+
}, formToJSON = (O) => [...O].reduce((w, D) => (w[D.name] = D.value, w), {}), replaceNode = (O, w) => {
|
|
324
|
+
const D = w.parentNode;
|
|
325
|
+
D && D.replaceChild(O, w);
|
|
326
|
+
}, removeNode = (O) => O && O.parentNode ? O.parentNode.removeChild(O) : null, insertSiblingAfter = (O, w) => {
|
|
327
|
+
w.parentNode && w.parentNode.insertBefore(O, w.nextSibling);
|
|
328
|
+
}, isInPage = (O) => O === document.body ? !1 : document.body.contains(O), getPos = (O) => [O.offsetLeft, O.offsetTop], randomColour = (O) => [1, 2, 3].map(() => Math.floor(Math.random() * 256) + 1).reduce((w, D) => `${w}${D},`, "rgba(") + `${O || 0.5}`, totalWidth = (O) => {
|
|
329
|
+
const w = window.getComputedStyle(O), D = O.offsetWidth, U = parseFloat(w.marginLeft) + parseFloat(w.marginRight), F = parseFloat(w.paddingLeft) + parseFloat(w.paddingRight), q = parseFloat(w.borderLeftWidth) + parseFloat(w.borderRightWidth);
|
|
330
|
+
return D + U - F + q;
|
|
329
331
|
}, totalHeight = (O) => {
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
+
const w = window.getComputedStyle(O), D = O.offsetHeight, U = parseFloat(w.marginTop) + parseFloat(w.marginBottom), F = parseFloat(w.paddingTop) + parseFloat(w.paddingBottom), q = parseFloat(w.borderTopWidth) + parseFloat(w.borderBottomWidth);
|
|
333
|
+
return D + U - F + q;
|
|
332
334
|
}, evalScripts = (comp) => (arr) => {
|
|
333
335
|
arr && Array.from(arr).forEach((s) => {
|
|
334
336
|
(function() {
|
|
335
337
|
eval(s.text);
|
|
336
338
|
}).bind(comp)();
|
|
337
339
|
});
|
|
338
|
-
}, evalModules = (O) => (
|
|
339
|
-
|
|
340
|
+
}, evalModules = (O) => (w) => {
|
|
341
|
+
w && Array.from(w).forEach((D) => {
|
|
340
342
|
(function() {
|
|
341
343
|
const U = document.createElement("script");
|
|
342
|
-
U.type = "module", U.textContent =
|
|
343
|
-
const F = O.getElement(), q = getElDataMap(
|
|
344
|
+
U.type = "module", U.textContent = D.textContent;
|
|
345
|
+
const F = O.getElement(), q = getElDataMap(D).zv_comp_access;
|
|
344
346
|
q && (F.zvComponent = O, F.classList.add(q)), F.appendChild(U);
|
|
345
347
|
}).bind(O)();
|
|
346
348
|
});
|
|
347
349
|
}, splitScripts = (O) => {
|
|
348
|
-
const
|
|
350
|
+
const D = new DOMParser().parseFromString(O, "text/html");
|
|
349
351
|
return {
|
|
350
|
-
html:
|
|
351
|
-
scripts:
|
|
352
|
-
modules:
|
|
352
|
+
html: D.body.firstElementChild,
|
|
353
|
+
scripts: D.querySelectorAll('script:not([type="module"])'),
|
|
354
|
+
modules: D.querySelectorAll('script[type="module"]')
|
|
353
355
|
};
|
|
354
|
-
}, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O,
|
|
355
|
-
|
|
356
|
-
}, toggleClass = (O,
|
|
357
|
-
const
|
|
358
|
-
return enableClass(O,
|
|
356
|
+
}, handleTemplateProm = (O) => Promise.resolve(splitScripts(O)), enableClass = (O, w, D) => {
|
|
357
|
+
D ? O.classList.add(w) : O.classList.remove(w);
|
|
358
|
+
}, toggleClass = (O, w) => {
|
|
359
|
+
const D = !Array.from(O.classList).includes(w);
|
|
360
|
+
return enableClass(O, w, D), D;
|
|
359
361
|
}, getElDataMap = (O) => O ? Object.assign({}, O.dataset || {}) : {}, dtFormatter = {
|
|
360
362
|
year: "numeric",
|
|
361
363
|
month: "short",
|
|
@@ -377,13 +379,13 @@ const getInputChecked_ = function(O) {
|
|
|
377
379
|
// hour12: false
|
|
378
380
|
hourCycle: "h23"
|
|
379
381
|
}), dateToZooyStdTimeString = (O) => {
|
|
380
|
-
const [{ value:
|
|
381
|
-
return `${
|
|
382
|
-
}, parseMomentAgo = (O,
|
|
382
|
+
const [{ value: w }, , { value: D }, , { value: U }, , { value: F }, , { value: q }, , { value: W }, ,] = dtf.formatToParts(O);
|
|
383
|
+
return `${D} ${w} ${U} ${F}:${q}:${W}`;
|
|
384
|
+
}, parseMomentAgo = (O, w = "both", D = void 0) => {
|
|
383
385
|
let U = O;
|
|
384
|
-
isNumber(U) && U < 9466848e5 ? U = U * 1e3 :
|
|
386
|
+
isNumber(U) && U < 9466848e5 ? U = U * 1e3 : D && (U = U + D);
|
|
385
387
|
const F = new Date(U), q = format(F), W = dateToZooyStdTimeString(F);
|
|
386
|
-
switch (
|
|
388
|
+
switch (w) {
|
|
387
389
|
case "time|ago":
|
|
388
390
|
return `${W}|${q}`;
|
|
389
391
|
case "ago":
|
|
@@ -397,35 +399,35 @@ const getInputChecked_ = function(O) {
|
|
|
397
399
|
return `${q} (${W})`;
|
|
398
400
|
}
|
|
399
401
|
}, parseObfuscated = (O) => {
|
|
400
|
-
const
|
|
401
|
-
return ((F) => F.split("").map((q, W) =>
|
|
402
|
-
}, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O,
|
|
403
|
-
const U = toNumber(
|
|
402
|
+
const D = ((F) => (q) => q < F.length - 4)(O);
|
|
403
|
+
return ((F) => F.split("").map((q, W) => D(W) ? "*" : q).join(""))(O);
|
|
404
|
+
}, parseMap = (/* @__PURE__ */ new Map()).set(void 0, (O, w, D) => identity(O)).set("", (O, w, D) => identity(O)).set("class_update_only", (O, w, D) => identity(O)).set("frac_100", (O, w, D) => Math.round(O * 100 * 100) / 100).set("date_and_time", (O, w, D) => new Date(O).toLocaleString(void 0, dtFormatter)).set("date", (O, w, D) => new Date(O).toLocaleString(void 0, dFormatter)).set("moment_ago", (O, w, D) => parseMomentAgo(O, "both", D.zdd_date_tz || void 0)).set("moment_ago_only", (O, w, D) => parseMomentAgo(O, "ago", D.zdd_date_tz || void 0)).set("moment_ago_datetime", (O, w, D) => parseMomentAgo(O, "datetime", D.zdd_date_tz || void 0)).set("pretty-json", (O, w, D) => JSON.stringify(O, null, 4)).set("obfuscated", (O, w, D) => parseObfuscated(O)).set("linear-progress", (O, w, D) => {
|
|
405
|
+
const U = toNumber(D.zpmax), F = w.linProg;
|
|
404
406
|
return U && F && (F.progress = O / U, O = void 0), O;
|
|
405
407
|
}), parseDataPropKvDef = (O) => O.trim().split(",").map((U) => U.trim()).map((U) => {
|
|
406
408
|
const [F, q] = U.split(":").map((W) => W.trim());
|
|
407
409
|
return [F, q];
|
|
408
|
-
}).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O,
|
|
409
|
-
const
|
|
410
|
+
}).filter(([U, F]) => U !== "" && F !== ""), parseDataProps = (O, w) => {
|
|
411
|
+
const D = getElDataMap(O);
|
|
410
412
|
delete O.dataset.zoodatapropkv;
|
|
411
|
-
const U =
|
|
413
|
+
const U = D.zoodatapropkv || "";
|
|
412
414
|
return parseDataPropKvDef(U).forEach(([q, W]) => {
|
|
413
|
-
O.dataset[q] = pathOr(void 0, W.split("."))(
|
|
415
|
+
O.dataset[q] = pathOr(void 0, W.split("."))(w);
|
|
414
416
|
}), O;
|
|
415
|
-
}, mapDataToEls = (O,
|
|
416
|
-
if (!
|
|
417
|
+
}, mapDataToEls = (O, w, D = /* @__PURE__ */ new Map(), U = void 0) => {
|
|
418
|
+
if (!w)
|
|
417
419
|
return;
|
|
418
|
-
const F = new Map([...parseMap, ...
|
|
420
|
+
const F = new Map([...parseMap, ...D]);
|
|
419
421
|
[...O.querySelectorAll("[data-zdd],[data-zdd_class_update],[data-zdd_template_loop_index]")].forEach((q) => {
|
|
420
|
-
const W = getElDataMap(q),
|
|
421
|
-
let
|
|
422
|
-
if (isDefAndNotNull(
|
|
423
|
-
const [
|
|
422
|
+
const W = getElDataMap(q), Y = W.zdd || "", G = W.zdd_parse_as, Z = W.zdd_render_effect || "", Q = W.zdd_class_update, tt = W.zdd_template_loop_index, J = W.zdd_units || "";
|
|
423
|
+
let X = pathOr(void 0, Y.split("."))(w);
|
|
424
|
+
if (isDefAndNotNull(X) && (X = F.has(G) ? F.get(G)(X, q, W) : X), tt && isNumber(U) && (console.log("loopIndex: ", tt, " opt_loopIndex: ", U), tt === "zero_indexed" ? q.innerHTML = U : tt === "one_indexed" ? q.innerHTML = U + 1 : q.innerHTML = U), Q) {
|
|
425
|
+
const [K, et, st] = Q.split(":"), rt = pathOr(void 0, K.split("."))(w);
|
|
424
426
|
if (isDefAndNotNull(rt))
|
|
425
427
|
switch (et) {
|
|
426
428
|
case "swap": {
|
|
427
|
-
const nt = /\{}/gi, ot = st.replace(nt, ""),
|
|
428
|
-
q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(
|
|
429
|
+
const nt = /\{}/gi, ot = st.replace(nt, ""), ct = st.replace(nt, rt);
|
|
430
|
+
q.classList.remove(...[...q.classList].filter((ht) => ht.includes(ot))), q.classList.add(ct);
|
|
429
431
|
break;
|
|
430
432
|
}
|
|
431
433
|
case "remove_on_data":
|
|
@@ -433,32 +435,32 @@ const getInputChecked_ = function(O) {
|
|
|
433
435
|
break;
|
|
434
436
|
case "choice_map":
|
|
435
437
|
st.split("|").filter((nt) => nt !== "").forEach((nt) => {
|
|
436
|
-
const [ot,
|
|
437
|
-
ot === rt + "" ? q.classList.add.apply(q.classList,
|
|
438
|
+
const [ot, ct] = nt.split(">");
|
|
439
|
+
ot === rt + "" ? q.classList.add.apply(q.classList, ct.split(".")) : q.classList.remove.apply(q.classList, ct.split("."));
|
|
438
440
|
});
|
|
439
441
|
break;
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
|
-
if (G === "templated-array" && isArray(
|
|
443
|
-
if (
|
|
444
|
+
if (G === "templated-array" && isArray(X))
|
|
445
|
+
if (X.length === 0)
|
|
444
446
|
q.classList.add("display__none");
|
|
445
447
|
else {
|
|
446
|
-
q.classList.remove("display__none"),
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
const rt =
|
|
448
|
+
q.classList.remove("display__none"), X = X || [];
|
|
449
|
+
const K = q.firstElementChild;
|
|
450
|
+
K.classList.remove("display__none"), q.replaceChildren(...X.map((et, st) => {
|
|
451
|
+
const rt = K.cloneNode(!0), nt = parseDataProps(rt, et);
|
|
450
452
|
return mapDataToEls(nt, et, void 0, st), nt;
|
|
451
453
|
}));
|
|
452
454
|
}
|
|
453
|
-
else if (isDefAndNotNull(
|
|
454
|
-
if (
|
|
455
|
-
let
|
|
456
|
-
const et =
|
|
457
|
-
|
|
455
|
+
else if (isDefAndNotNull(X))
|
|
456
|
+
if (Z === "typewriter") {
|
|
457
|
+
let K = 0;
|
|
458
|
+
const et = X + J, st = 5, rt = () => {
|
|
459
|
+
K < et.length && (q.innerHTML += et.charAt(K), K++, setTimeout(rt, st));
|
|
458
460
|
};
|
|
459
461
|
q.innerHTML = "", rt();
|
|
460
462
|
} else
|
|
461
|
-
q.innerHTML =
|
|
463
|
+
q.innerHTML = X + J;
|
|
462
464
|
});
|
|
463
465
|
}, domUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
464
466
|
__proto__: null,
|
|
@@ -515,18 +517,18 @@ class ComponentLibraryRegistry {
|
|
|
515
517
|
* config: { version: '2.0' }
|
|
516
518
|
* });
|
|
517
519
|
*/
|
|
518
|
-
static register(
|
|
519
|
-
if (!
|
|
520
|
-
throw new Error(`Component library '${
|
|
521
|
-
this.#t.set(
|
|
522
|
-
...
|
|
520
|
+
static register(w, D) {
|
|
521
|
+
if (!D.render)
|
|
522
|
+
throw new Error(`Component library '${w}' must provide a render function`);
|
|
523
|
+
this.#t.set(w, {
|
|
524
|
+
...D,
|
|
523
525
|
// Preserve all library properties (utils, helpers, etc.)
|
|
524
|
-
dispose:
|
|
526
|
+
dispose: D.dispose || null,
|
|
525
527
|
// Optional disposal function
|
|
526
528
|
cache: /* @__PURE__ */ new Map(),
|
|
527
529
|
// Each library gets its own import cache
|
|
528
|
-
config:
|
|
529
|
-
}), console.debug(`[ComponentLibraryRegistry] Registered: ${
|
|
530
|
+
config: D.config || {}
|
|
531
|
+
}), console.debug(`[ComponentLibraryRegistry] Registered: ${w}`);
|
|
530
532
|
}
|
|
531
533
|
/**
|
|
532
534
|
* Gets a registered component library by name.
|
|
@@ -535,14 +537,14 @@ class ComponentLibraryRegistry {
|
|
|
535
537
|
* @returns {Object} Library object with render, cache, config
|
|
536
538
|
* @throws {Error} If library is not registered
|
|
537
539
|
*/
|
|
538
|
-
static get(
|
|
539
|
-
if (!this.#t.has(
|
|
540
|
-
const
|
|
540
|
+
static get(w) {
|
|
541
|
+
if (!this.#t.has(w)) {
|
|
542
|
+
const D = Array.from(this.#t.keys()).join(", ");
|
|
541
543
|
throw new Error(
|
|
542
|
-
`Component library '${
|
|
544
|
+
`Component library '${w}' is not registered. Available: ${D || "none"}`
|
|
543
545
|
);
|
|
544
546
|
}
|
|
545
|
-
return this.#t.get(
|
|
547
|
+
return this.#t.get(w);
|
|
546
548
|
}
|
|
547
549
|
/**
|
|
548
550
|
* Checks if a component library is registered.
|
|
@@ -550,8 +552,8 @@ class ComponentLibraryRegistry {
|
|
|
550
552
|
* @param {string} name - Library identifier
|
|
551
553
|
* @returns {boolean} True if registered
|
|
552
554
|
*/
|
|
553
|
-
static has(
|
|
554
|
-
return this.#t.has(
|
|
555
|
+
static has(w) {
|
|
556
|
+
return this.#t.has(w);
|
|
555
557
|
}
|
|
556
558
|
/**
|
|
557
559
|
* Gets all registered library names.
|
|
@@ -568,21 +570,21 @@ class ComponentLibraryRegistry {
|
|
|
568
570
|
* @returns {Object} Map of library name → cache stats
|
|
569
571
|
*/
|
|
570
572
|
static getCacheStats() {
|
|
571
|
-
const
|
|
572
|
-
for (const [
|
|
573
|
-
D
|
|
573
|
+
const w = {};
|
|
574
|
+
for (const [D, U] of this.#t.entries())
|
|
575
|
+
w[D] = {
|
|
574
576
|
cacheSize: U.cache.size,
|
|
575
577
|
config: U.config
|
|
576
578
|
};
|
|
577
|
-
return
|
|
579
|
+
return w;
|
|
578
580
|
}
|
|
579
581
|
/**
|
|
580
582
|
* Clears import caches for all component libraries.
|
|
581
583
|
* Useful for development/hot-reload scenarios.
|
|
582
584
|
*/
|
|
583
585
|
static clearAllCaches() {
|
|
584
|
-
for (const [
|
|
585
|
-
|
|
586
|
+
for (const [w, D] of this.#t.entries())
|
|
587
|
+
D.cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
586
588
|
}
|
|
587
589
|
/**
|
|
588
590
|
* Clears cache for a specific library.
|
|
@@ -590,8 +592,8 @@ class ComponentLibraryRegistry {
|
|
|
590
592
|
* @param {string} name - Library identifier
|
|
591
593
|
* @throws {Error} If library is not registered
|
|
592
594
|
*/
|
|
593
|
-
static clearCache(
|
|
594
|
-
this.get(
|
|
595
|
+
static clearCache(w) {
|
|
596
|
+
this.get(w).cache.clear(), console.debug(`[ComponentLibraryRegistry] Cleared cache for: ${w}`);
|
|
595
597
|
}
|
|
596
598
|
/**
|
|
597
599
|
* Unregisters a component library (primarily for testing).
|
|
@@ -599,8 +601,8 @@ class ComponentLibraryRegistry {
|
|
|
599
601
|
* @param {string} name - Library identifier
|
|
600
602
|
* @returns {boolean} True if library was unregistered, false if not found
|
|
601
603
|
*/
|
|
602
|
-
static unregister(
|
|
603
|
-
return this.#t.delete(
|
|
604
|
+
static unregister(w) {
|
|
605
|
+
return this.#t.delete(w);
|
|
604
606
|
}
|
|
605
607
|
/**
|
|
606
608
|
* Unregisters all component libraries (primarily for testing).
|
|
@@ -652,7 +654,7 @@ const ComponentError = {
|
|
|
652
654
|
*/
|
|
653
655
|
STATE_INVALID: "Invalid component state"
|
|
654
656
|
};
|
|
655
|
-
class Component extends
|
|
657
|
+
class Component extends Evt {
|
|
656
658
|
//--[ Static ]--
|
|
657
659
|
/**
|
|
658
660
|
* Returns the component event type code used for dispatching component events.
|
|
@@ -694,8 +696,8 @@ class Component extends EVT {
|
|
|
694
696
|
/**
|
|
695
697
|
* @param {Element|undefined} e
|
|
696
698
|
*/
|
|
697
|
-
set target(
|
|
698
|
-
this.#n =
|
|
699
|
+
set target(w) {
|
|
700
|
+
this.#n = w;
|
|
699
701
|
}
|
|
700
702
|
/**
|
|
701
703
|
* @returns {Element|undefined}
|
|
@@ -707,8 +709,8 @@ class Component extends EVT {
|
|
|
707
709
|
* Sets the model associated with the UI component.
|
|
708
710
|
* @param {*} m
|
|
709
711
|
*/
|
|
710
|
-
set model(
|
|
711
|
-
this.#r =
|
|
712
|
+
set model(w) {
|
|
713
|
+
this.#r = w;
|
|
712
714
|
}
|
|
713
715
|
/**
|
|
714
716
|
* Returns the model associated with the UI component.
|
|
@@ -720,8 +722,8 @@ class Component extends EVT {
|
|
|
720
722
|
/**
|
|
721
723
|
* @param {boolean} bool
|
|
722
724
|
*/
|
|
723
|
-
set isInDocument(
|
|
724
|
-
this.#e =
|
|
725
|
+
set isInDocument(w) {
|
|
726
|
+
this.#e = w;
|
|
725
727
|
}
|
|
726
728
|
/**
|
|
727
729
|
* @return {boolean}
|
|
@@ -733,16 +735,16 @@ class Component extends EVT {
|
|
|
733
735
|
* A function that makes a DOM element.
|
|
734
736
|
* @param {!function():(!HTMLElement|!Element|!DocumentFragment)} func
|
|
735
737
|
*/
|
|
736
|
-
set domFunc(
|
|
737
|
-
this.#t =
|
|
738
|
+
set domFunc(w) {
|
|
739
|
+
this.#t = w;
|
|
738
740
|
}
|
|
739
741
|
/**
|
|
740
742
|
* @param {!Function} func A callback guaranteed to fire after the panels is
|
|
741
743
|
* ready, and in the document, but before the
|
|
742
744
|
* {@code UiEventType.READY} event is fired.
|
|
743
745
|
*/
|
|
744
|
-
set readyFunc(
|
|
745
|
-
this.#a =
|
|
746
|
+
set readyFunc(w) {
|
|
747
|
+
this.#a = w;
|
|
746
748
|
}
|
|
747
749
|
//--[ DOM Management ]--
|
|
748
750
|
/**
|
|
@@ -751,8 +753,8 @@ class Component extends EVT {
|
|
|
751
753
|
* @param {!Node} frag The DOM node to set as this component's element
|
|
752
754
|
* @private
|
|
753
755
|
*/
|
|
754
|
-
setElementInternal_(
|
|
755
|
-
this.#s =
|
|
756
|
+
setElementInternal_(w) {
|
|
757
|
+
this.#s = w;
|
|
756
758
|
}
|
|
757
759
|
/**
|
|
758
760
|
* Gets the component's element.
|
|
@@ -794,8 +796,8 @@ class Component extends EVT {
|
|
|
794
796
|
* @param {Element=} opt_parentElement Optional parent element to render the
|
|
795
797
|
* component into.
|
|
796
798
|
*/
|
|
797
|
-
render(
|
|
798
|
-
this.render_(
|
|
799
|
+
render(w) {
|
|
800
|
+
this.render_(w);
|
|
799
801
|
}
|
|
800
802
|
/**
|
|
801
803
|
* Renders the component. If a parent element is supplied, the component's
|
|
@@ -813,28 +815,28 @@ class Component extends EVT {
|
|
|
813
815
|
* component into.
|
|
814
816
|
* @private
|
|
815
817
|
*/
|
|
816
|
-
render_(
|
|
818
|
+
render_(w) {
|
|
817
819
|
if (this.disposed)
|
|
818
820
|
throw new Error(ComponentError.ALREADY_DISPOSED);
|
|
819
821
|
if (this.isInDocument)
|
|
820
822
|
throw new Error(ComponentError.ALREADY_RENDERED);
|
|
821
823
|
this.#s || this.createDom();
|
|
822
|
-
const
|
|
824
|
+
const D = (
|
|
823
825
|
/** @type {!Node} */
|
|
824
826
|
this.#s
|
|
825
827
|
);
|
|
826
|
-
|
|
828
|
+
w && (this.#n = w), this.placeholderDom && removeNode(this.placeholderDom), this.#n ? isInPage(D) || this.#n.insertBefore(D, null) : isInPage(
|
|
827
829
|
/** @type {!Node} */
|
|
828
|
-
|
|
829
|
-
) || document.body.appendChild(
|
|
830
|
+
D
|
|
831
|
+
) || document.body.appendChild(D), (!this.#i || this.#i.isInDocument) && this.enterDocument();
|
|
830
832
|
}
|
|
831
833
|
//--[ Life-cycle ]--
|
|
832
834
|
/**
|
|
833
835
|
* @param {Node} el
|
|
834
836
|
* @param {Node} targetParent
|
|
835
837
|
*/
|
|
836
|
-
hoist(
|
|
837
|
-
|
|
838
|
+
hoist(w, D = void 0) {
|
|
839
|
+
D || (D = document.querySelector("body")), D.appendChild(w), this.outOfTreeElements.push(w);
|
|
838
840
|
}
|
|
839
841
|
/**
|
|
840
842
|
* Executes the beforeReady callback function if one was set.
|
|
@@ -852,8 +854,8 @@ class Component extends EVT {
|
|
|
852
854
|
* children.
|
|
853
855
|
*/
|
|
854
856
|
enterDocument() {
|
|
855
|
-
this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((
|
|
856
|
-
!
|
|
857
|
+
this.disposed ? removeNode(this.getElement()) : (this.isInDocument = !0, [...this.#o.values()].forEach((w) => {
|
|
858
|
+
!w.isInDocument && w.getElement() && w.enterDocument();
|
|
857
859
|
}), this.executeBeforeReady(), this.dispatchCompEvent(UiEventType.READY));
|
|
858
860
|
}
|
|
859
861
|
/**
|
|
@@ -868,8 +870,8 @@ class Component extends EVT {
|
|
|
868
870
|
* method has been called.
|
|
869
871
|
*/
|
|
870
872
|
exitDocument() {
|
|
871
|
-
[...this.#o.values()].forEach((
|
|
872
|
-
|
|
873
|
+
[...this.#o.values()].forEach((w) => {
|
|
874
|
+
w.isInDocument && w.exitDocument();
|
|
873
875
|
}), this.stopBeingListenedTo(), this.removeAllListener(), this.isInDocument = !1, removeNode(this.getElement()), this.placeholderDom && removeNode(this.placeholderDom);
|
|
874
876
|
}
|
|
875
877
|
/**
|
|
@@ -880,7 +882,7 @@ class Component extends EVT {
|
|
|
880
882
|
* @protected
|
|
881
883
|
*/
|
|
882
884
|
disposeInternal() {
|
|
883
|
-
this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((
|
|
885
|
+
this.isInDocument && this.exitDocument(), this.#o && [...this.#o.values()].forEach((w) => w.disposeInternal()), this.outOfTreeElements.forEach(removeNode), this.#s && removeNode(this.#s), this.placeholderDom && removeNode(this.placeholderDom), this.#o = null, this.#s = void 0, this.#r = null, this.#i = null, super.disposeInternal();
|
|
884
886
|
}
|
|
885
887
|
/**
|
|
886
888
|
* Disposes of the component and performs cleanup. Aborts any pending async
|
|
@@ -890,14 +892,14 @@ class Component extends EVT {
|
|
|
890
892
|
*/
|
|
891
893
|
dispose() {
|
|
892
894
|
this.abortController && this.abortController.abort();
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
for (const
|
|
895
|
+
const w = this.getElement();
|
|
896
|
+
if (w)
|
|
897
|
+
for (const D of ComponentLibraryRegistry.getRegisteredLibraries())
|
|
896
898
|
try {
|
|
897
|
-
const U = ComponentLibraryRegistry.get(
|
|
898
|
-
U.dispose && U.dispose(
|
|
899
|
+
const U = ComponentLibraryRegistry.get(D);
|
|
900
|
+
U.dispose && U.dispose(w);
|
|
899
901
|
} catch (U) {
|
|
900
|
-
console.debug(`[${
|
|
902
|
+
console.debug(`[${D}] Cleanup error during component disposal (non-critical):`, U);
|
|
901
903
|
}
|
|
902
904
|
super.dispose();
|
|
903
905
|
}
|
|
@@ -918,8 +920,8 @@ class Component extends EVT {
|
|
|
918
920
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
919
921
|
* if any of the handlers returns false this will also return false.
|
|
920
922
|
*/
|
|
921
|
-
dispatchCompEvent(
|
|
922
|
-
const U = new ZooyEventData(
|
|
923
|
+
dispatchCompEvent(w, D) {
|
|
924
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.COMP, U);
|
|
923
925
|
return this.dispatchEvent(F);
|
|
924
926
|
}
|
|
925
927
|
}
|
|
@@ -951,45 +953,45 @@ const EV = {
|
|
|
951
953
|
DROP: "drop",
|
|
952
954
|
// Transitions
|
|
953
955
|
TRANSITIONEND: "transitionend"
|
|
954
|
-
}, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O,
|
|
956
|
+
}, touchEvents = [EV.TOUCHMOVE, EV.TOUCHSTART, EV.TOUCHEND], isTouchEvent = (O) => touchEvents.includes(O.type), normalizeEvent = (O) => (isTouchEvent(O) && (O.clientX = O.targetTouches[0].clientX, O.clientY = O.targetTouches[0].clientY), O), dragStartListener = (O, w, D, U) => (F) => {
|
|
955
957
|
F.preventDefault();
|
|
956
958
|
const q = normalizeEvent(F), W = (
|
|
957
959
|
/** @type {!HTMLElement} */
|
|
958
960
|
q.currentTarget
|
|
959
|
-
), [
|
|
960
|
-
let
|
|
961
|
-
["x", "ew"].includes(U) ?
|
|
961
|
+
), [Y, G] = getPos(W), Z = q.clientX - Y, Q = q.clientY - G, tt = O(Y, G, Z, Q, W), J = D(Y, G, Z, Q, W), X = w(Y, G, Z, Q, W);
|
|
962
|
+
let K = freeMoveListener(X, W, Z, Q);
|
|
963
|
+
["x", "ew"].includes(U) ? K = xMoveOnlyListener(X, W, Z) : ["y", "ns"].includes(U) && (K = yMoveOnlyListener(X, W, Z, Q));
|
|
962
964
|
let et = !1;
|
|
963
965
|
const st = (nt) => {
|
|
964
|
-
et = !0,
|
|
966
|
+
et = !0, K(nt);
|
|
965
967
|
}, rt = (nt) => {
|
|
966
968
|
document.removeEventListener(EV.MOUSEMOVE, st, !0), document.removeEventListener(EV.TOUCHMOVE, st, !0), document.removeEventListener(EV.MOUSEUP, rt, !0), document.removeEventListener(EV.TOUCHEND, rt, !0), et && J(nt);
|
|
967
969
|
};
|
|
968
970
|
return document.addEventListener(EV.MOUSEUP, rt, !0), document.addEventListener(EV.TOUCHEND, rt, !0), document.addEventListener(EV.MOUSEMOVE, st, !0), document.addEventListener(EV.TOUCHMOVE, st, !0), tt(F), rt;
|
|
969
|
-
}, freeMoveListener = (O,
|
|
971
|
+
}, freeMoveListener = (O, w, D, U) => (F) => {
|
|
970
972
|
F.preventDefault();
|
|
971
973
|
const q = normalizeEvent(F);
|
|
972
|
-
|
|
973
|
-
}, xMoveOnlyListener = (O,
|
|
974
|
+
w.style.left = `${q.clientX - D}px`, w.style.top = `${q.clientY - U}px`, O(q);
|
|
975
|
+
}, xMoveOnlyListener = (O, w, D, U) => (F) => {
|
|
974
976
|
F.preventDefault();
|
|
975
977
|
const q = normalizeEvent(F);
|
|
976
|
-
|
|
977
|
-
}, yMoveOnlyListener = (O,
|
|
978
|
+
w.style.left = `${q.clientX - D}px`, O(q);
|
|
979
|
+
}, yMoveOnlyListener = (O, w, D, U) => (F) => {
|
|
978
980
|
F.preventDefault();
|
|
979
981
|
const q = normalizeEvent(F);
|
|
980
|
-
|
|
981
|
-
}, makeEmitter = (O,
|
|
982
|
-
O.dispatchCompEvent(
|
|
982
|
+
w.style.top = `${q.clientY - U}px`, O(q);
|
|
983
|
+
}, makeEmitter = (O, w) => (D, U, F, q, W) => (Y) => {
|
|
984
|
+
O.dispatchCompEvent(w, {
|
|
983
985
|
component: O,
|
|
984
|
-
browserEvent:
|
|
985
|
-
left:
|
|
986
|
+
browserEvent: Y,
|
|
987
|
+
left: D,
|
|
986
988
|
top: U,
|
|
987
|
-
clientX:
|
|
988
|
-
clientY:
|
|
989
|
+
clientX: Y.clientX,
|
|
990
|
+
clientY: Y.clientY,
|
|
989
991
|
xOrg: F,
|
|
990
992
|
yOrg: q,
|
|
991
|
-
deltaX:
|
|
992
|
-
deltaY:
|
|
993
|
+
deltaX: Y.clientX - F - D,
|
|
994
|
+
deltaY: Y.clientY - q - U,
|
|
993
995
|
target: W
|
|
994
996
|
});
|
|
995
997
|
};
|
|
@@ -1002,15 +1004,15 @@ class Dragger extends Component {
|
|
|
1002
1004
|
* @param {string} freedom Restrict the directions in which the
|
|
1003
1005
|
* dragger can be moved.
|
|
1004
1006
|
*/
|
|
1005
|
-
constructor(
|
|
1006
|
-
super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(
|
|
1007
|
+
constructor(w = "xy") {
|
|
1008
|
+
super(), this.#t = ["x", "y", "xy", "ew", "ns"].includes(w.toLowerCase()) ? w.toLowerCase() : "xy", this.#e = void 0, this.#s = !0, this.#r = (D) => null;
|
|
1007
1009
|
}
|
|
1008
1010
|
/**
|
|
1009
1011
|
* Cancels the current drag operation in progress, if any.
|
|
1010
1012
|
* @param {!Event} event The event that triggered the cancel
|
|
1011
1013
|
*/
|
|
1012
|
-
cancelDrag(
|
|
1013
|
-
this.#r(
|
|
1014
|
+
cancelDrag(w) {
|
|
1015
|
+
this.#r(w);
|
|
1014
1016
|
}
|
|
1015
1017
|
//--[ Getters and Setters ]--
|
|
1016
1018
|
/**
|
|
@@ -1019,8 +1021,8 @@ class Dragger extends Component {
|
|
|
1019
1021
|
* Anything else will be considered free movement
|
|
1020
1022
|
* @param {string} axis
|
|
1021
1023
|
*/
|
|
1022
|
-
set moveFreedom(
|
|
1023
|
-
this.#t =
|
|
1024
|
+
set moveFreedom(w) {
|
|
1025
|
+
this.#t = w, this.#s || (this.lock(), this.unlock());
|
|
1024
1026
|
}
|
|
1025
1027
|
/**
|
|
1026
1028
|
* Get the direction in which this component can move.
|
|
@@ -1041,18 +1043,18 @@ class Dragger extends Component {
|
|
|
1041
1043
|
* Make the component draggable
|
|
1042
1044
|
*/
|
|
1043
1045
|
unlock() {
|
|
1044
|
-
const
|
|
1045
|
-
this.#r =
|
|
1046
|
+
const w = (D) => (U) => {
|
|
1047
|
+
this.#r = D(U);
|
|
1046
1048
|
};
|
|
1047
1049
|
if (this.isInDocument && this.#s) {
|
|
1048
|
-
const
|
|
1050
|
+
const D = makeEmitter(this, UiEventType.COMP_DRAG_MOVE), U = makeEmitter(this, UiEventType.COMP_DRAG_START), F = makeEmitter(this, UiEventType.COMP_DRAG_END), q = dragStartListener(
|
|
1049
1051
|
U,
|
|
1050
|
-
|
|
1052
|
+
D,
|
|
1051
1053
|
F,
|
|
1052
1054
|
this.#t
|
|
1053
1055
|
);
|
|
1054
1056
|
this.#s = !1, this.#e = /** @type {!Node} */
|
|
1055
|
-
this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN,
|
|
1057
|
+
this.#e || this.getElement(), this.listen(this.#e, EV.MOUSEDOWN, w(q)), this.listen(this.#e, EV.TOUCHSTART, q), this.#e.classList.remove("locked");
|
|
1056
1058
|
}
|
|
1057
1059
|
}
|
|
1058
1060
|
/**
|
|
@@ -1071,54 +1073,51 @@ const splitRe_ = new RegExp(
|
|
|
1071
1073
|
}, split = (O) => (
|
|
1072
1074
|
/** @type {!Array<string|undefined>} */
|
|
1073
1075
|
O.match(splitRe_)
|
|
1074
|
-
), decodeOrEmpty_ = (O,
|
|
1075
|
-
(
|
|
1076
|
-
).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((
|
|
1077
|
-
const [U, F] =
|
|
1078
|
-
return isValidValue(U) && isValidValue(F) &&
|
|
1076
|
+
), decodeOrEmpty_ = (O, w) => O ? decodeURI(O.replace(/%25/g, "%2525")) : "", getPath = (O) => decodeOrEmpty_(split(O)[ComponentIndex.PATH]), getQueryData = (O) => decodeOrEmpty_(split(O)[ComponentIndex.QUERY_DATA]), objectToUrlParms = (O) => [...Object.entries(O)].map(
|
|
1077
|
+
(w) => `${w[0]}=${w[1]}`
|
|
1078
|
+
).join("&"), isValidValue = (O) => O != null && O !== "", queryDataToMap = (O) => O.split("&").reduce((w, D) => {
|
|
1079
|
+
const [U, F] = D.split("=");
|
|
1080
|
+
return isValidValue(U) && isValidValue(F) && w.set(U, F), w;
|
|
1079
1081
|
}, /* @__PURE__ */ new Map()), uriUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1080
1082
|
__proto__: null,
|
|
1081
1083
|
getPath,
|
|
1082
1084
|
getQueryData,
|
|
1083
1085
|
objectToUrlParms,
|
|
1084
1086
|
queryDataToMap
|
|
1085
|
-
}, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((
|
|
1086
|
-
let
|
|
1087
|
+
}, Symbol.toStringTag, { value: "Module" })), stripLeadingSpace = stripLeadingChar(" "), stripLeadingSlash = stripLeadingChar("/"), getCookieByName = (O) => document.cookie.split(";").map((w) => w.split("=")).reduce((w, D) => w.set(stripLeadingSpace(D[0]), D[1]), /* @__PURE__ */ new Map()).get(O), spinner = (O) => {
|
|
1088
|
+
let w = 0, D;
|
|
1087
1089
|
const U = (F) => {
|
|
1088
1090
|
const q = F > 0;
|
|
1089
|
-
return q ?
|
|
1091
|
+
return q ? w += 1 : w -= 1, q ? w === 1 : w === 0;
|
|
1090
1092
|
};
|
|
1091
1093
|
return (F) => {
|
|
1092
|
-
|
|
1094
|
+
D = D || document.getElementById(O), D && U(F) && D.classList.toggle("viz", w > 0);
|
|
1093
1095
|
};
|
|
1094
|
-
}, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (
|
|
1095
|
-
if (
|
|
1096
|
-
const
|
|
1097
|
-
O.setIsRedirected(!0,
|
|
1098
|
-
}
|
|
1099
|
-
return checkStatus(
|
|
1100
|
-
}, getJson = (O) => O.
|
|
1101
|
-
(
|
|
1102
|
-
(
|
|
1103
|
-
),
|
|
1104
|
-
(D) => Promise.resolve(D),
|
|
1105
|
-
(D) => Promise.reject(new Error(`Could not get text from response: ${D}`))
|
|
1106
|
-
), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, D, w = "POST", U = void 0) => {
|
|
1096
|
+
}, spin = spinner("the_loader"), startSpin = () => Promise.resolve(spin(1)), stopSpin = (O) => (spin(0), Promise.resolve(O)), checkStatus = (O) => O.ok ? Promise.resolve(O) : Promise.reject(new Error(`${O.url} ${O.status} (${O.statusText})`)), checkStatusTwo = (O) => (w) => {
|
|
1097
|
+
if (w.type === "opaqueredirect" || w.redirected) {
|
|
1098
|
+
const D = stripLeadingSlash(getPath(w.url));
|
|
1099
|
+
O.setIsRedirected(!0, D), console.log("Redirect detected", D);
|
|
1100
|
+
}
|
|
1101
|
+
return checkStatus(w);
|
|
1102
|
+
}, getJson = (O) => O.json(), getText = (O) => O.text().then(
|
|
1103
|
+
(w) => Promise.resolve(w),
|
|
1104
|
+
(w) => Promise.reject(new Error(`Could not get text from response: ${w}`))
|
|
1105
|
+
), getTextOrJson = (O) => O.headers.get("Content-Type") === "application/json" ? getJson(O) : getText(O), jsonInit = (O, w, D = "POST", U = void 0) => {
|
|
1107
1106
|
const F = new Headers();
|
|
1108
1107
|
F.append("Content-type", "application/json"), F.append("X-Requested-With", "XMLHttpRequest"), O && O !== "" && F.append("Authorization", `Bearer ${O}`);
|
|
1109
1108
|
const q = {
|
|
1110
1109
|
cache: "no-cache",
|
|
1111
|
-
method:
|
|
1110
|
+
method: D,
|
|
1112
1111
|
headers: F,
|
|
1113
1112
|
credentials: "include",
|
|
1114
|
-
body: JSON.stringify(
|
|
1113
|
+
body: JSON.stringify(w)
|
|
1115
1114
|
};
|
|
1116
1115
|
return U && (q.signal = U), q;
|
|
1117
|
-
}, basicPutPostPatchInit = (O,
|
|
1116
|
+
}, basicPutPostPatchInit = (O, w, D = !1, U = void 0) => {
|
|
1118
1117
|
const F = new Headers();
|
|
1119
|
-
if (
|
|
1118
|
+
if (w && w !== "" && F.append("Authorization", `Bearer ${w}`), F.append("X-Requested-With", "XMLHttpRequest"), D) {
|
|
1120
1119
|
const W = getCookieByName("csrftoken");
|
|
1121
|
-
W &&
|
|
1120
|
+
W && D && F.append("X-CSRFToken", W);
|
|
1122
1121
|
}
|
|
1123
1122
|
const q = {
|
|
1124
1123
|
cache: "no-cache",
|
|
@@ -1129,28 +1128,28 @@ const splitRe_ = new RegExp(
|
|
|
1129
1128
|
credentials: "include"
|
|
1130
1129
|
};
|
|
1131
1130
|
return U && (q.signal = U), q;
|
|
1132
|
-
}, formPostInit = (O,
|
|
1133
|
-
const F = basicPutPostPatchInit("POST", O, !1,
|
|
1134
|
-
return F.body = new FormData(
|
|
1135
|
-
}, basicGetInit = (O,
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1131
|
+
}, formPostInit = (O, w, D = void 0) => {
|
|
1132
|
+
const F = basicPutPostPatchInit("POST", O, !1, D);
|
|
1133
|
+
return F.body = new FormData(w.formEl), F;
|
|
1134
|
+
}, basicGetInit = (O, w = void 0) => {
|
|
1135
|
+
const D = new Headers();
|
|
1136
|
+
D.append("Authorization", `Bearer ${O}`), D.append("X-Requested-With", "XMLHttpRequest");
|
|
1138
1137
|
const U = {
|
|
1139
1138
|
cache: "no-cache",
|
|
1140
|
-
headers:
|
|
1139
|
+
headers: D,
|
|
1141
1140
|
credentials: "include"
|
|
1142
1141
|
};
|
|
1143
|
-
return
|
|
1144
|
-
}, putPostPatchNobody = (O,
|
|
1145
|
-
const
|
|
1146
|
-
return fetch(
|
|
1147
|
-
}, genCatchClause = (O,
|
|
1142
|
+
return w && (U.signal = w), U;
|
|
1143
|
+
}, putPostPatchNobody = (O, w) => {
|
|
1144
|
+
const D = new Request(O);
|
|
1145
|
+
return fetch(D, w).then(checkStatus).then(getText);
|
|
1146
|
+
}, genCatchClause = (O, w = void 0) => (D) => (stopSpin("").then(identity), D.name === "AbortError" ? console.info(O, "ABORTED!") : console.error(O, D), w);
|
|
1148
1147
|
class UserManager {
|
|
1149
1148
|
/**
|
|
1150
1149
|
* @param {!Object=} opt_data
|
|
1151
1150
|
*/
|
|
1152
|
-
constructor(
|
|
1153
|
-
this.user_ = {}, this.jwt = "",
|
|
1151
|
+
constructor(w) {
|
|
1152
|
+
this.user_ = {}, this.jwt = "", w && this.updateProfileFromJwt(w).then(() => {
|
|
1154
1153
|
});
|
|
1155
1154
|
}
|
|
1156
1155
|
/**
|
|
@@ -1159,20 +1158,20 @@ class UserManager {
|
|
|
1159
1158
|
* @return {Promise}
|
|
1160
1159
|
* @private
|
|
1161
1160
|
*/
|
|
1162
|
-
updateProfileFromJwt(
|
|
1163
|
-
return
|
|
1161
|
+
updateProfileFromJwt(w, D = !1) {
|
|
1162
|
+
return D && this.jwt !== "" ? Promise.resolve("User Profile Already exists") : w.non_field_errors ? Promise.reject(new Error(`JWT ${w.non_field_errors}`)) : (this.updateToken(w.token), this.updateProfile(w.user), Promise.resolve("User Profile Updated"));
|
|
1164
1163
|
}
|
|
1165
1164
|
/**
|
|
1166
1165
|
* @param {UserLikeType} data
|
|
1167
1166
|
*/
|
|
1168
|
-
updateProfile(
|
|
1169
|
-
this.user_ =
|
|
1167
|
+
updateProfile(w) {
|
|
1168
|
+
this.user_ = w;
|
|
1170
1169
|
}
|
|
1171
1170
|
/**
|
|
1172
1171
|
* @param {string} t
|
|
1173
1172
|
*/
|
|
1174
|
-
updateToken(
|
|
1175
|
-
this.jwt =
|
|
1173
|
+
updateToken(w) {
|
|
1174
|
+
this.jwt = w;
|
|
1176
1175
|
}
|
|
1177
1176
|
/**
|
|
1178
1177
|
* @return {number|undefined}
|
|
@@ -1196,21 +1195,21 @@ class UserManager {
|
|
|
1196
1195
|
* @return {string|undefined}
|
|
1197
1196
|
*/
|
|
1198
1197
|
get salutation() {
|
|
1199
|
-
let
|
|
1200
|
-
const
|
|
1201
|
-
return
|
|
1198
|
+
let w = this.name;
|
|
1199
|
+
const D = this.surname;
|
|
1200
|
+
return D && (w = w + " " + D), w;
|
|
1202
1201
|
}
|
|
1203
1202
|
/**
|
|
1204
1203
|
* @param {FormPanel} formPanel
|
|
1205
1204
|
* @return {Promise}
|
|
1206
1205
|
*/
|
|
1207
|
-
formSubmit(
|
|
1208
|
-
const
|
|
1209
|
-
return startSpin().then(() => fetch(
|
|
1206
|
+
formSubmit(w) {
|
|
1207
|
+
const D = new Request(w.uri.toString()), U = w.processSubmitReply.bind(w), F = genCatchClause("Form submit error");
|
|
1208
|
+
return startSpin().then(() => fetch(D, formPostInit(
|
|
1210
1209
|
this.jwt,
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
))).then(checkStatusTwo(
|
|
1210
|
+
w,
|
|
1211
|
+
w.abortController.signal
|
|
1212
|
+
))).then(checkStatusTwo(w)).then(stopSpin).then(getTextOrJson).then(U).catch(F);
|
|
1214
1213
|
}
|
|
1215
1214
|
/**
|
|
1216
1215
|
* @param {string} uri
|
|
@@ -1218,23 +1217,23 @@ class UserManager {
|
|
|
1218
1217
|
* @param {AbortSignal|undefined} signal
|
|
1219
1218
|
* @return {Promise}
|
|
1220
1219
|
*/
|
|
1221
|
-
putNoBody(
|
|
1220
|
+
putNoBody(w, D = void 0, U = !1) {
|
|
1222
1221
|
const F = genCatchClause("putNobody error"), q = basicPutPostPatchInit(
|
|
1223
1222
|
"PUT",
|
|
1224
1223
|
this.jwt,
|
|
1225
1224
|
U,
|
|
1226
|
-
|
|
1225
|
+
D
|
|
1227
1226
|
);
|
|
1228
|
-
return putPostPatchNobody(
|
|
1227
|
+
return putPostPatchNobody(w, q).catch(F);
|
|
1229
1228
|
}
|
|
1230
1229
|
/**
|
|
1231
1230
|
* @param {string} uri
|
|
1232
1231
|
* @param {AbortSignal|undefined} signal
|
|
1233
1232
|
* @return {Promise}
|
|
1234
1233
|
*/
|
|
1235
|
-
fetch(
|
|
1236
|
-
const U = new Request(
|
|
1237
|
-
return startSpin().then(() => fetch(U, basicGetInit(this.jwt,
|
|
1234
|
+
fetch(w, D = void 0) {
|
|
1235
|
+
const U = new Request(w.toString()), F = genCatchClause(`UMan Text GET Fetch: ${w}`);
|
|
1236
|
+
return startSpin().then(() => fetch(U, basicGetInit(this.jwt, D))).then(checkStatus).then(stopSpin).then(getText).catch(F);
|
|
1238
1237
|
}
|
|
1239
1238
|
/**
|
|
1240
1239
|
* Use this if you want to directly get a parsed template that does not go
|
|
@@ -1243,18 +1242,25 @@ class UserManager {
|
|
|
1243
1242
|
* @param {AbortSignal|undefined} signal
|
|
1244
1243
|
* @return {Promise}
|
|
1245
1244
|
*/
|
|
1246
|
-
fetchAndSplit(
|
|
1247
|
-
const U = genCatchClause(`fetchAndSplit: ${
|
|
1248
|
-
return this.fetch(
|
|
1245
|
+
fetchAndSplit(w, D = void 0) {
|
|
1246
|
+
const U = genCatchClause(`fetchAndSplit: ${w}`);
|
|
1247
|
+
return this.fetch(w, D).then(handleTemplateProm).catch(U);
|
|
1249
1248
|
}
|
|
1250
1249
|
/**
|
|
1251
1250
|
* @param {string} uri
|
|
1252
1251
|
* @param {AbortSignal|undefined} signal
|
|
1253
1252
|
* @return {Promise}
|
|
1254
1253
|
*/
|
|
1255
|
-
fetchJson(
|
|
1256
|
-
const U = new Request(
|
|
1257
|
-
|
|
1254
|
+
async fetchJson(w, D = void 0) {
|
|
1255
|
+
const U = new Request(w.toString()), F = genCatchClause(`fetchJson: ${w}`, {}), q = basicGetInit(this.jwt, D);
|
|
1256
|
+
await startSpin();
|
|
1257
|
+
let W = {};
|
|
1258
|
+
try {
|
|
1259
|
+
W = await (await fetch(U, q)).json();
|
|
1260
|
+
} catch (Y) {
|
|
1261
|
+
return F(Y);
|
|
1262
|
+
}
|
|
1263
|
+
return await stopSpin(), W;
|
|
1258
1264
|
}
|
|
1259
1265
|
/**
|
|
1260
1266
|
* @param {string} uri
|
|
@@ -1262,8 +1268,8 @@ class UserManager {
|
|
|
1262
1268
|
* @param {AbortSignal|undefined} signal
|
|
1263
1269
|
* @return {Promise}
|
|
1264
1270
|
*/
|
|
1265
|
-
patchJson(
|
|
1266
|
-
const F = new Request(
|
|
1271
|
+
patchJson(w, D, U = void 0) {
|
|
1272
|
+
const F = new Request(w.toString()), q = genCatchClause(`patchJson: ${w}`), W = jsonInit(this.jwt, D, "PATCH", U);
|
|
1267
1273
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1268
1274
|
}
|
|
1269
1275
|
/**
|
|
@@ -1272,8 +1278,8 @@ class UserManager {
|
|
|
1272
1278
|
* @param {AbortSignal|undefined} signal
|
|
1273
1279
|
* @return {Promise}
|
|
1274
1280
|
*/
|
|
1275
|
-
postJson(
|
|
1276
|
-
const F = new Request(
|
|
1281
|
+
postJson(w, D, U = void 0) {
|
|
1282
|
+
const F = new Request(w.toString()), q = genCatchClause(`postJson: ${w}`), W = jsonInit(this.jwt, D, "POST", U);
|
|
1277
1283
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1278
1284
|
}
|
|
1279
1285
|
/**
|
|
@@ -1282,8 +1288,8 @@ class UserManager {
|
|
|
1282
1288
|
* @param {AbortSignal|undefined} signal
|
|
1283
1289
|
* @return {Promise}
|
|
1284
1290
|
*/
|
|
1285
|
-
putJson(
|
|
1286
|
-
const F = new Request(
|
|
1291
|
+
putJson(w, D, U = void 0) {
|
|
1292
|
+
const F = new Request(w.toString()), q = genCatchClause(`putJson: ${w}`), W = jsonInit(this.jwt, D, "PUT", U);
|
|
1287
1293
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1288
1294
|
}
|
|
1289
1295
|
/**
|
|
@@ -1292,8 +1298,8 @@ class UserManager {
|
|
|
1292
1298
|
* @param {AbortSignal|undefined} signal
|
|
1293
1299
|
* @return {Promise}
|
|
1294
1300
|
*/
|
|
1295
|
-
delJson(
|
|
1296
|
-
const F = new Request(
|
|
1301
|
+
delJson(w, D, U = void 0) {
|
|
1302
|
+
const F = new Request(w.toString()), q = genCatchClause(`delJson: ${w}`), W = jsonInit(this.jwt, D, "DELETE", U);
|
|
1297
1303
|
return fetch(F, W).then(checkStatus).then(getJson).catch(q);
|
|
1298
1304
|
}
|
|
1299
1305
|
}
|
|
@@ -1316,8 +1322,8 @@ class Panel extends Component {
|
|
|
1316
1322
|
* Creates a new Panel instance.
|
|
1317
1323
|
* @param {string=} uri Optional URI for fetching panel content
|
|
1318
1324
|
*/
|
|
1319
|
-
constructor(
|
|
1320
|
-
super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "",
|
|
1325
|
+
constructor(w) {
|
|
1326
|
+
super(), this.qParamMap_ = /* @__PURE__ */ new Map(), this.uri_ = "", w && this.parseUri(w), this.evalScripts = evalScripts(this), this.evalModules = evalModules(this), this.redirected = !1, this.responseObject = { html: null, scripts: null }, this.user_ = void 0, "AbortController" in window ? this.abortController = new AbortController() : this.abortController = {
|
|
1321
1327
|
signal: void 0,
|
|
1322
1328
|
abort: () => {
|
|
1323
1329
|
}
|
|
@@ -1325,14 +1331,14 @@ class Panel extends Component {
|
|
|
1325
1331
|
}
|
|
1326
1332
|
//--[ Getters and Setters ]--
|
|
1327
1333
|
get uri() {
|
|
1328
|
-
const
|
|
1329
|
-
return this.uri_ +
|
|
1334
|
+
const w = this.qParamMap_.size > 0 ? "?" + objectToUrlParms(Object.fromEntries(this.qParamMap_)) : "";
|
|
1335
|
+
return this.uri_ + w;
|
|
1330
1336
|
}
|
|
1331
1337
|
/**
|
|
1332
1338
|
* @param {!UserManager} user
|
|
1333
1339
|
*/
|
|
1334
|
-
set user(
|
|
1335
|
-
this.user_ =
|
|
1340
|
+
set user(w) {
|
|
1341
|
+
this.user_ = w;
|
|
1336
1342
|
}
|
|
1337
1343
|
/**
|
|
1338
1344
|
* @return {!UserManager}
|
|
@@ -1345,23 +1351,23 @@ class Panel extends Component {
|
|
|
1345
1351
|
* internal URI and query parameter map.
|
|
1346
1352
|
* @param {string} uri The URI to parse
|
|
1347
1353
|
*/
|
|
1348
|
-
parseUri(
|
|
1349
|
-
this.uri_ = getPath(
|
|
1354
|
+
parseUri(w) {
|
|
1355
|
+
this.uri_ = getPath(w), this.qParamMap_ = queryDataToMap(getQueryData(w));
|
|
1350
1356
|
}
|
|
1351
1357
|
/**
|
|
1352
1358
|
* Adds or updates a query parameter in the panel's query parameter map.
|
|
1353
1359
|
* @param {string} k The parameter key
|
|
1354
1360
|
* @param {string} v The parameter value
|
|
1355
1361
|
*/
|
|
1356
|
-
addToQParams(
|
|
1357
|
-
this.qParamMap_.set(
|
|
1362
|
+
addToQParams(w, D) {
|
|
1363
|
+
this.qParamMap_.set(w, D);
|
|
1358
1364
|
}
|
|
1359
1365
|
/**
|
|
1360
1366
|
* Removes a query parameter from the panel's query parameter map.
|
|
1361
1367
|
* @param {string} k The parameter key to remove
|
|
1362
1368
|
*/
|
|
1363
|
-
removeFromQParams(
|
|
1364
|
-
this.qParamMap_.delete(
|
|
1369
|
+
removeFromQParams(w) {
|
|
1370
|
+
this.qParamMap_.delete(w);
|
|
1365
1371
|
}
|
|
1366
1372
|
/**
|
|
1367
1373
|
* Clears all query parameters from the panel's query parameter map.
|
|
@@ -1379,8 +1385,8 @@ class Panel extends Component {
|
|
|
1379
1385
|
* const tables = this.getCarbonComponents('cds-table');
|
|
1380
1386
|
* const buttons = this.getCarbonComponents('cds-button');
|
|
1381
1387
|
*/
|
|
1382
|
-
getCarbonComponents(
|
|
1383
|
-
return this.carbonComponents?.get(
|
|
1388
|
+
getCarbonComponents(w) {
|
|
1389
|
+
return this.carbonComponents?.get(w) || [];
|
|
1384
1390
|
}
|
|
1385
1391
|
/**
|
|
1386
1392
|
* Gets a single Carbon component by its ID.
|
|
@@ -1390,10 +1396,10 @@ class Panel extends Component {
|
|
|
1390
1396
|
* @example
|
|
1391
1397
|
* const table = this.getCarbonComponentById('companies-table');
|
|
1392
1398
|
*/
|
|
1393
|
-
getCarbonComponentById(
|
|
1399
|
+
getCarbonComponentById(w) {
|
|
1394
1400
|
if (this.carbonComponents)
|
|
1395
|
-
for (const
|
|
1396
|
-
const U =
|
|
1401
|
+
for (const D of this.carbonComponents.values()) {
|
|
1402
|
+
const U = D.find((F) => F.id === w);
|
|
1397
1403
|
if (U)
|
|
1398
1404
|
return U;
|
|
1399
1405
|
}
|
|
@@ -1403,8 +1409,8 @@ class Panel extends Component {
|
|
|
1403
1409
|
* Temporarily render placeholder DOM
|
|
1404
1410
|
* @param {Node!} placeholder
|
|
1405
1411
|
*/
|
|
1406
|
-
renderPlaceHolder(
|
|
1407
|
-
this.target && (this.placeholderDom =
|
|
1412
|
+
renderPlaceHolder(w) {
|
|
1413
|
+
this.target && (this.placeholderDom = w, this.target.insertBefore(this.placeholderDom, null));
|
|
1408
1414
|
}
|
|
1409
1415
|
/**
|
|
1410
1416
|
* Expects HTML data from a call to the back.
|
|
@@ -1414,9 +1420,9 @@ class Panel extends Component {
|
|
|
1414
1420
|
* panel stays in place on the DOM for the duration of the fetch call.
|
|
1415
1421
|
* @return {Promise} Returns a promise with this panel as value.
|
|
1416
1422
|
*/
|
|
1417
|
-
renderWithTemplate(
|
|
1418
|
-
const
|
|
1419
|
-
return
|
|
1423
|
+
renderWithTemplate(w) {
|
|
1424
|
+
const D = this.user;
|
|
1425
|
+
return D ? D.fetch(this.uri, this.abortController.signal).then((U) => (this.assertCanRenderAsync(), w && w(this), this.onRenderWithTemplateReply(U).catch((F) => {
|
|
1420
1426
|
F.message !== Component.compErrors().ALREADY_DISPOSED && console.error("RenderWithTemplate Err:", F);
|
|
1421
1427
|
}), this)).catch((U) => {
|
|
1422
1428
|
throw console.error("Panel.renderWithTemplate fetch failed:", U), U;
|
|
@@ -1427,8 +1433,8 @@ class Panel extends Component {
|
|
|
1427
1433
|
* @private
|
|
1428
1434
|
* @return {Promise}
|
|
1429
1435
|
*/
|
|
1430
|
-
onRenderWithTemplateReply(
|
|
1431
|
-
return this.responseObject = splitScripts(
|
|
1436
|
+
onRenderWithTemplateReply(w) {
|
|
1437
|
+
return this.responseObject = splitScripts(w), this.domFunc = () => (
|
|
1432
1438
|
/** @type {!Element} */
|
|
1433
1439
|
this.responseObject.html
|
|
1434
1440
|
), this.render(), Promise.resolve(this);
|
|
@@ -1450,20 +1456,20 @@ class Panel extends Component {
|
|
|
1450
1456
|
* @param content
|
|
1451
1457
|
* @param qs
|
|
1452
1458
|
*/
|
|
1453
|
-
onReplacePartialDom(
|
|
1459
|
+
onReplacePartialDom(w, D) {
|
|
1454
1460
|
const U = this.getElement();
|
|
1455
1461
|
if (isUndefined(U))
|
|
1456
1462
|
return;
|
|
1457
|
-
const F =
|
|
1458
|
-
if (
|
|
1459
|
-
[...U.querySelectorAll(
|
|
1463
|
+
const F = w.html;
|
|
1464
|
+
if (D.startsWith("."))
|
|
1465
|
+
[...U.querySelectorAll(D)].filter((q) => isDefAndNotNull(q.id)).map((q) => [q, F.querySelector(`#${q.id}`)]).filter(([q, W]) => isDefAndNotNull(W)).forEach(([q, W]) => {
|
|
1460
1466
|
q.parentNode.replaceChild(W, q), this.parseContent(W);
|
|
1461
1467
|
});
|
|
1462
|
-
else if (
|
|
1463
|
-
const q = F.querySelector(
|
|
1468
|
+
else if (D.startsWith("#")) {
|
|
1469
|
+
const q = F.querySelector(D), W = U.querySelector(D);
|
|
1464
1470
|
W.parentNode.replaceChild(q, W), this.parseContent(q);
|
|
1465
1471
|
}
|
|
1466
|
-
this.evalScripts(
|
|
1472
|
+
this.evalScripts(w.scripts), this.evalModules(w.modules);
|
|
1467
1473
|
}
|
|
1468
1474
|
//--[ JSON Render ]-----
|
|
1469
1475
|
/**
|
|
@@ -1472,9 +1478,9 @@ class Panel extends Component {
|
|
|
1472
1478
|
* @param {function(Object, !Panel)} opt_callback The callback function
|
|
1473
1479
|
* that will receive the reply event.
|
|
1474
1480
|
*/
|
|
1475
|
-
renderWithJSON(
|
|
1481
|
+
renderWithJSON(w) {
|
|
1476
1482
|
return this.user ? this.user.fetchJson(this.uri_, this.abortController.signal).then((U) => {
|
|
1477
|
-
this.assertCanRenderAsync(),
|
|
1483
|
+
this.assertCanRenderAsync(), w && w(U, this), this.onRenderWithJSON(U).then(identity);
|
|
1478
1484
|
}).catch((U) => {
|
|
1479
1485
|
throw console.error("Panel.renderWithJSON fetch failed:", U), U;
|
|
1480
1486
|
}) : Promise.reject(new Error("No UserManager instance available for Panel.renderWithJSON()"));
|
|
@@ -1485,7 +1491,7 @@ class Panel extends Component {
|
|
|
1485
1491
|
* that will receive the reply event.
|
|
1486
1492
|
* @return {Promise}
|
|
1487
1493
|
*/
|
|
1488
|
-
onRenderWithJSON(
|
|
1494
|
+
onRenderWithJSON(w) {
|
|
1489
1495
|
return Promise.resolve(this);
|
|
1490
1496
|
}
|
|
1491
1497
|
/**
|
|
@@ -1493,7 +1499,7 @@ class Panel extends Component {
|
|
|
1493
1499
|
* @param {Object} _elDataMap
|
|
1494
1500
|
* @param {Object} _json
|
|
1495
1501
|
*/
|
|
1496
|
-
onAsyncJsonReply(
|
|
1502
|
+
onAsyncJsonReply(w, D, U) {
|
|
1497
1503
|
}
|
|
1498
1504
|
/**
|
|
1499
1505
|
* Called on each async HTML response, after the content is in the DOM
|
|
@@ -1501,122 +1507,122 @@ class Panel extends Component {
|
|
|
1501
1507
|
* @param {Element} _el
|
|
1502
1508
|
* @param {Object} _elDataMap
|
|
1503
1509
|
*/
|
|
1504
|
-
onAsyncHtmlReply(
|
|
1510
|
+
onAsyncHtmlReply(w, D) {
|
|
1505
1511
|
}
|
|
1506
1512
|
/**
|
|
1507
1513
|
* Hook method called when the view broadcasts data to all its panels.
|
|
1508
1514
|
* Override this method to handle broadcasted data in subclasses.
|
|
1509
1515
|
* @param {*} _data The data broadcast from the view
|
|
1510
1516
|
*/
|
|
1511
|
-
onViewDataBroadcast(
|
|
1517
|
+
onViewDataBroadcast(w) {
|
|
1512
1518
|
}
|
|
1513
1519
|
//--[ JSON Render ]-----
|
|
1514
1520
|
/**
|
|
1515
1521
|
* @param {Element} panel
|
|
1516
1522
|
*/
|
|
1517
|
-
parseContent(
|
|
1518
|
-
if (this.debugMe("Enable interactions. Panel:",
|
|
1523
|
+
parseContent(w) {
|
|
1524
|
+
if (this.debugMe("Enable interactions. Panel:", w), typeof window.customElements < "u" && ComponentLibraryRegistry.has("carbon")) {
|
|
1519
1525
|
const J = ComponentLibraryRegistry.get("carbon");
|
|
1520
|
-
J.render.call(this,
|
|
1526
|
+
J.render.call(this, w, J.cache).catch((X) => console.error("[Zooy] Carbon initialization failed:", X));
|
|
1521
1527
|
}
|
|
1522
1528
|
if (ComponentLibraryRegistry.has("mdc")) {
|
|
1523
1529
|
const J = ComponentLibraryRegistry.get("mdc");
|
|
1524
|
-
J.render.call(this,
|
|
1530
|
+
J.render.call(this, w, J.cache);
|
|
1525
1531
|
}
|
|
1526
|
-
|
|
1527
|
-
J.target ===
|
|
1528
|
-
}), [...
|
|
1532
|
+
w.classList.contains("zoo__modal-base") && w.classList.contains("close_on_click") && this.listen(w, EV.CLICK, (J) => {
|
|
1533
|
+
J.target === w && this.dispatchPanelEvent("destroy_me");
|
|
1534
|
+
}), [...w.querySelectorAll(
|
|
1529
1535
|
".zoo__button:not(.external):not(.mdc-data-table__row)"
|
|
1530
1536
|
)].forEach((J) => {
|
|
1531
|
-
this.listen(J, EV.CLICK, (
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1537
|
+
this.listen(J, EV.CLICK, (X) => {
|
|
1538
|
+
X.stopPropagation();
|
|
1539
|
+
const K = X.currentTarget, et = getElDataMap(K);
|
|
1534
1540
|
this.dispatchPanelEvent(et.zv, Object.assign({
|
|
1535
|
-
orgEvt:
|
|
1536
|
-
trigger:
|
|
1537
|
-
href:
|
|
1541
|
+
orgEvt: X,
|
|
1542
|
+
trigger: K,
|
|
1543
|
+
href: K.href || et.href
|
|
1538
1544
|
}, et));
|
|
1539
1545
|
});
|
|
1540
|
-
}), [...
|
|
1541
|
-
this.listen(J, EV.CLICK, (
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
const et = getElDataMap(
|
|
1546
|
+
}), [...w.querySelectorAll("[href]:not(.external)")].forEach((J) => {
|
|
1547
|
+
this.listen(J, EV.CLICK, (X) => {
|
|
1548
|
+
const K = X.currentTarget;
|
|
1549
|
+
X.preventDefault(), X.stopPropagation();
|
|
1550
|
+
const et = getElDataMap(K), st = et.zv || "href";
|
|
1545
1551
|
this.dispatchPanelEvent(st, Object.assign({
|
|
1546
|
-
orgEvt:
|
|
1547
|
-
trigger:
|
|
1548
|
-
href:
|
|
1552
|
+
orgEvt: X,
|
|
1553
|
+
trigger: X.target,
|
|
1554
|
+
href: K.href || et.href
|
|
1549
1555
|
}, et));
|
|
1550
1556
|
});
|
|
1551
|
-
}), [...
|
|
1552
|
-
J.noValidate = !0, this.listen(J, EV.SUBMIT, (
|
|
1553
|
-
|
|
1554
|
-
const
|
|
1555
|
-
this.dispatchPanelEvent(
|
|
1556
|
-
orgEvt:
|
|
1557
|
-
trigger:
|
|
1557
|
+
}), [...w.querySelectorAll("form.intercept_submit")].forEach((J) => {
|
|
1558
|
+
J.noValidate = !0, this.listen(J, EV.SUBMIT, (X) => {
|
|
1559
|
+
X.preventDefault(), X.stopPropagation();
|
|
1560
|
+
const K = getElDataMap(J), et = formToJSON(J.elements);
|
|
1561
|
+
this.dispatchPanelEvent(K.zv, Object.assign({
|
|
1562
|
+
orgEvt: X,
|
|
1563
|
+
trigger: X.target,
|
|
1558
1564
|
formData: et,
|
|
1559
|
-
href:
|
|
1560
|
-
},
|
|
1565
|
+
href: K.href
|
|
1566
|
+
}, K));
|
|
1561
1567
|
});
|
|
1562
|
-
}), [...
|
|
1568
|
+
}), [...w.querySelectorAll(".zoo__toggle_class_driver")].forEach(
|
|
1563
1569
|
(J) => {
|
|
1564
|
-
const
|
|
1570
|
+
const X = getElDataMap(J), K = X.toggle_class_target_id, et = X.toggle_class, st = w.querySelector(`#${K}`);
|
|
1565
1571
|
st && et && J.addEventListener(EV.CLICK, (rt) => {
|
|
1566
1572
|
rt.stopPropagation(), st.classList.toggle(et);
|
|
1567
1573
|
});
|
|
1568
1574
|
}
|
|
1569
1575
|
);
|
|
1570
|
-
const
|
|
1576
|
+
const D = Array.from(w.querySelectorAll(".folder_drop_zone")), U = Array.from(w.querySelectorAll("[draggable]")), F = (J) => {
|
|
1571
1577
|
J.preventDefault(), J.target.classList.add("drag_over");
|
|
1572
1578
|
}, q = (J) => {
|
|
1573
1579
|
J.preventDefault();
|
|
1574
1580
|
}, W = (J) => {
|
|
1575
1581
|
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1576
|
-
},
|
|
1582
|
+
}, Y = (J) => {
|
|
1577
1583
|
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1578
1584
|
}, G = (J) => {
|
|
1579
1585
|
J.preventDefault(), J.target.classList.remove("drag_over");
|
|
1580
|
-
},
|
|
1586
|
+
}, Z = (J) => {
|
|
1581
1587
|
J.dataTransfer.dropEffect = "move";
|
|
1582
|
-
const
|
|
1583
|
-
J.dataTransfer.setData("text/plain", JSON.stringify(
|
|
1588
|
+
const X = getElDataMap(J.target);
|
|
1589
|
+
J.dataTransfer.setData("text/plain", JSON.stringify(X)), J.target.classList.add("drag_in_progress");
|
|
1584
1590
|
}, Q = (J) => {
|
|
1585
1591
|
J.target.classList.remove("drag_in_progress");
|
|
1586
1592
|
}, tt = (J) => {
|
|
1587
1593
|
G(J), J.stopPropagation();
|
|
1588
|
-
const
|
|
1594
|
+
const X = JSON.parse(J.dataTransfer.getData("text/plain")), K = getElDataMap(J.target);
|
|
1589
1595
|
return this.dispatchPanelEvent("drop_on", {
|
|
1590
|
-
custom: { on:
|
|
1596
|
+
custom: { on: K, from: X }
|
|
1591
1597
|
}), !1;
|
|
1592
1598
|
};
|
|
1593
|
-
|
|
1594
|
-
this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT,
|
|
1599
|
+
D.forEach((J) => {
|
|
1600
|
+
this.listen(J, EV.DRAGOVER, q), this.listen(J, EV.DRAGENTER, F), this.listen(J, EV.DRAGEXIT, Y), this.listen(J, EV.DRAGLEAVE, W), this.listen(J, EV.DROP, tt);
|
|
1595
1601
|
}), U.forEach((J) => {
|
|
1596
|
-
this.listen(J, EV.DRAGSTART,
|
|
1597
|
-
}), [...
|
|
1598
|
-
const
|
|
1599
|
-
this.user.fetchJson(
|
|
1600
|
-
const st =
|
|
1602
|
+
this.listen(J, EV.DRAGSTART, Z), this.listen(J, EV.DRAGEND, Q);
|
|
1603
|
+
}), [...w.querySelectorAll(".zoo_async_json")].forEach((J) => {
|
|
1604
|
+
const X = getElDataMap(J), K = X.href, et = this.onAsyncJsonReply.bind(this, J, X);
|
|
1605
|
+
this.user.fetchJson(K, this.abortController.signal).then(et);
|
|
1606
|
+
const st = X.z_json_reusable;
|
|
1601
1607
|
st && (this.jsonCallFuncs = this.jsonCallFuncs || {}, this.jsonCallFuncs[st] = () => {
|
|
1602
|
-
this.user.fetchJson(
|
|
1608
|
+
this.user.fetchJson(K, this.abortController.signal).then(et);
|
|
1603
1609
|
});
|
|
1604
|
-
const rt = toNumber(
|
|
1610
|
+
const rt = toNumber(X.z_interval);
|
|
1605
1611
|
isNumber(rt) && this.doOnBeat(() => {
|
|
1606
|
-
this.user.fetchJson(
|
|
1612
|
+
this.user.fetchJson(K, this.abortController.signal).then(et);
|
|
1607
1613
|
}, rt * 60 * 1e3);
|
|
1608
|
-
}), [...
|
|
1614
|
+
}), [...w.querySelectorAll(".zoo_async_html")].forEach(
|
|
1609
1615
|
/**
|
|
1610
1616
|
* @param {Element} el
|
|
1611
1617
|
*/
|
|
1612
1618
|
(J) => {
|
|
1613
|
-
const
|
|
1614
|
-
this.user.fetchAndSplit(
|
|
1615
|
-
J.appendChild(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules), this.onAsyncHtmlReply(J,
|
|
1619
|
+
const X = getElDataMap(J), K = X.href;
|
|
1620
|
+
this.user.fetchAndSplit(K, this.abortController.signal).then((st) => {
|
|
1621
|
+
J.appendChild(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules), this.onAsyncHtmlReply(J, X);
|
|
1616
1622
|
});
|
|
1617
|
-
const et = toNumber(
|
|
1623
|
+
const et = toNumber(X.z_interval);
|
|
1618
1624
|
isNumber(et) && this.doOnBeat(() => {
|
|
1619
|
-
this.user.fetchAndSplit(
|
|
1625
|
+
this.user.fetchAndSplit(K, this.abortController.signal).then((st) => {
|
|
1620
1626
|
J.replaceChildren(st.html), this.parseContent(J), this.evalScripts(st.scripts), this.evalModules(st.modules);
|
|
1621
1627
|
});
|
|
1622
1628
|
}, et * 60 * 1e3);
|
|
@@ -1630,8 +1636,8 @@ class Panel extends Component {
|
|
|
1630
1636
|
* the READY event.
|
|
1631
1637
|
*/
|
|
1632
1638
|
enterDocument() {
|
|
1633
|
-
const
|
|
1634
|
-
this.parseContent(
|
|
1639
|
+
const w = this.getElement();
|
|
1640
|
+
this.parseContent(w), this.evalScripts(this.responseObject.scripts), this.evalModules(this.responseObject.modules), super.enterDocument();
|
|
1635
1641
|
}
|
|
1636
1642
|
/**
|
|
1637
1643
|
* @inheritDoc
|
|
@@ -1645,8 +1651,8 @@ class Panel extends Component {
|
|
|
1645
1651
|
* @param {boolean} bool
|
|
1646
1652
|
* @param {?string} url
|
|
1647
1653
|
*/
|
|
1648
|
-
setIsRedirected(
|
|
1649
|
-
this.redirected =
|
|
1654
|
+
setIsRedirected(w, D) {
|
|
1655
|
+
this.redirected = w, this.redirected && D && (this.uri_ = D);
|
|
1650
1656
|
}
|
|
1651
1657
|
//--[ Built in events ]--
|
|
1652
1658
|
/**
|
|
@@ -1665,9 +1671,11 @@ class Panel extends Component {
|
|
|
1665
1671
|
* @return {boolean} If anyone called preventDefault on the event object
|
|
1666
1672
|
* or if any of the handlers returns false this will also return false.
|
|
1667
1673
|
*/
|
|
1668
|
-
dispatchPanelEvent(
|
|
1669
|
-
const U = new ZooyEventData(
|
|
1670
|
-
return this.debugMe(
|
|
1674
|
+
dispatchPanelEvent(w, D) {
|
|
1675
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.PANEL, U);
|
|
1676
|
+
return this.debugMe(`PANEL EVENT FIRED:
|
|
1677
|
+
value:${w}
|
|
1678
|
+
data:${D}`), this.dispatchEvent(F);
|
|
1671
1679
|
}
|
|
1672
1680
|
}
|
|
1673
1681
|
class FormPanel extends Panel {
|
|
@@ -1688,8 +1696,8 @@ class FormPanel extends Panel {
|
|
|
1688
1696
|
* @param {string=} uri Optional URI for fetching form content
|
|
1689
1697
|
* @param {boolean} intercept If false, we do not try and intercept the forms
|
|
1690
1698
|
*/
|
|
1691
|
-
constructor(
|
|
1692
|
-
super(
|
|
1699
|
+
constructor(w, D = !0) {
|
|
1700
|
+
super(w), this.#s = D, this.debugMode = !0, this.onSubmitSucFunc = (U, F) => null;
|
|
1693
1701
|
}
|
|
1694
1702
|
/**
|
|
1695
1703
|
* Gets the form element managed by this panel.
|
|
@@ -1717,13 +1725,13 @@ class FormPanel extends Panel {
|
|
|
1717
1725
|
* @param {string=} string The id of the form we want to sterilise.
|
|
1718
1726
|
* @return {?HTMLFormElement}
|
|
1719
1727
|
*/
|
|
1720
|
-
getFormFromId(
|
|
1721
|
-
let
|
|
1722
|
-
return
|
|
1728
|
+
getFormFromId(w) {
|
|
1729
|
+
let D = null, U = this.getElement().querySelector("form");
|
|
1730
|
+
return w && (U = document.getElementById(
|
|
1723
1731
|
/** @type {string} */
|
|
1724
|
-
|
|
1725
|
-
) || U), U && U.tagName.toLowerCase() === "form" && (
|
|
1726
|
-
U),
|
|
1732
|
+
w
|
|
1733
|
+
) || U), U && U.tagName.toLowerCase() === "form" && (D = /** @type {HTMLFormElement} */
|
|
1734
|
+
U), D;
|
|
1727
1735
|
}
|
|
1728
1736
|
//--[ Field Validation Methods ]--
|
|
1729
1737
|
/**
|
|
@@ -1732,17 +1740,17 @@ class FormPanel extends Panel {
|
|
|
1732
1740
|
* @private
|
|
1733
1741
|
*/
|
|
1734
1742
|
#r() {
|
|
1735
|
-
this.#t && (this.listen(this.#t, EV.CHANGE, (
|
|
1736
|
-
this.#o(
|
|
1737
|
-
}, { passive: !0 }), this.listen(this.#t, EV.INPUT, (
|
|
1738
|
-
this.clearAllValidationErrors(), this.#o(
|
|
1739
|
-
}), this.listen(this.#t, EV.INVALID, (
|
|
1740
|
-
|
|
1741
|
-
const
|
|
1743
|
+
this.#t && (this.listen(this.#t, EV.CHANGE, (w) => {
|
|
1744
|
+
this.#o(w);
|
|
1745
|
+
}, { passive: !0 }), this.listen(this.#t, EV.INPUT, (w) => {
|
|
1746
|
+
this.clearAllValidationErrors(), this.#o(w);
|
|
1747
|
+
}), this.listen(this.#t, EV.INVALID, (w) => {
|
|
1748
|
+
w.preventDefault();
|
|
1749
|
+
const D = (
|
|
1742
1750
|
/** @type {HTMLInputElement} */
|
|
1743
|
-
|
|
1751
|
+
w.target
|
|
1744
1752
|
);
|
|
1745
|
-
this.#i(
|
|
1753
|
+
this.#i(D), this.displayFieldError(D);
|
|
1746
1754
|
}, { passive: !0 }));
|
|
1747
1755
|
}
|
|
1748
1756
|
/**
|
|
@@ -1751,8 +1759,8 @@ class FormPanel extends Panel {
|
|
|
1751
1759
|
* @return {boolean} True if all fields are valid, false otherwise
|
|
1752
1760
|
*/
|
|
1753
1761
|
checkAllFields() {
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1762
|
+
const w = [...this.#t.elements].map((D) => [this.#n(D), D]).filter((D) => !D[0]);
|
|
1763
|
+
return w.forEach((D) => this.displayFieldError(D[1])), w.length === 0;
|
|
1756
1764
|
}
|
|
1757
1765
|
/**
|
|
1758
1766
|
* Clear all existing validation errors
|
|
@@ -1767,9 +1775,9 @@ class FormPanel extends Panel {
|
|
|
1767
1775
|
* @param {string} _css A CSS class name to add to the alert div.
|
|
1768
1776
|
* @private
|
|
1769
1777
|
*/
|
|
1770
|
-
displayAlert_(
|
|
1771
|
-
const F = document.getElementById(`${
|
|
1772
|
-
F.textContent =
|
|
1778
|
+
displayAlert_(w, D, U) {
|
|
1779
|
+
const F = document.getElementById(`${w.id}-helper-text`) || document.createElement("p");
|
|
1780
|
+
F.textContent = D, this.#e.set(w, F);
|
|
1773
1781
|
}
|
|
1774
1782
|
/**
|
|
1775
1783
|
* Check validation for a single field
|
|
@@ -1777,53 +1785,53 @@ class FormPanel extends Panel {
|
|
|
1777
1785
|
* @return {boolean} True if field is valid
|
|
1778
1786
|
* @private
|
|
1779
1787
|
*/
|
|
1780
|
-
#n(
|
|
1781
|
-
this.#i(
|
|
1782
|
-
let
|
|
1783
|
-
return
|
|
1788
|
+
#n(w) {
|
|
1789
|
+
this.#i(w);
|
|
1790
|
+
let D = !w.willValidate;
|
|
1791
|
+
return w.willValidate && (D = w.checkValidity()), D;
|
|
1784
1792
|
}
|
|
1785
1793
|
/**
|
|
1786
1794
|
* Clear alert for a single field
|
|
1787
1795
|
* @param {HTMLInputElement} field
|
|
1788
1796
|
* @private
|
|
1789
1797
|
*/
|
|
1790
|
-
#i(
|
|
1791
|
-
|
|
1798
|
+
#i(w) {
|
|
1799
|
+
w.classList.remove("error"), this.#e.has(w) && (this.#e.get(w).textContent = ""), this.#e.delete(w);
|
|
1792
1800
|
}
|
|
1793
1801
|
/**
|
|
1794
1802
|
* Display the given error message on the given form field.
|
|
1795
1803
|
* @param {HTMLInputElement} field
|
|
1796
1804
|
* @param {string=} opt_msg
|
|
1797
1805
|
*/
|
|
1798
|
-
displayFieldError(
|
|
1799
|
-
const U =
|
|
1800
|
-
|
|
1806
|
+
displayFieldError(w, D) {
|
|
1807
|
+
const U = D || w.validationMessage;
|
|
1808
|
+
w.classList.add("error"), this.displayAlert_(w, U, "alert-error");
|
|
1801
1809
|
}
|
|
1802
1810
|
/**
|
|
1803
1811
|
* Display the given success message on the given form field.
|
|
1804
1812
|
* @param {HTMLInputElement} field
|
|
1805
1813
|
* @param {string} message
|
|
1806
1814
|
*/
|
|
1807
|
-
displayFieldSuccess(
|
|
1808
|
-
this.displayAlert_(
|
|
1815
|
+
displayFieldSuccess(w, D) {
|
|
1816
|
+
this.displayAlert_(w, D, "alert-success");
|
|
1809
1817
|
}
|
|
1810
1818
|
/**
|
|
1811
1819
|
* Display the given information message on the given form field.
|
|
1812
1820
|
* @param {HTMLInputElement} field
|
|
1813
1821
|
* @param {string} message
|
|
1814
1822
|
*/
|
|
1815
|
-
displayFieldInfo(
|
|
1816
|
-
this.displayAlert_(
|
|
1823
|
+
displayFieldInfo(w, D) {
|
|
1824
|
+
this.displayAlert_(w, D, "alert-info");
|
|
1817
1825
|
}
|
|
1818
1826
|
/**
|
|
1819
1827
|
* Validate field on change event
|
|
1820
1828
|
* @param {Event} e
|
|
1821
1829
|
* @private
|
|
1822
1830
|
*/
|
|
1823
|
-
#o(
|
|
1831
|
+
#o(w) {
|
|
1824
1832
|
this.#n(
|
|
1825
1833
|
/** @type {HTMLInputElement} */
|
|
1826
|
-
|
|
1834
|
+
w.target
|
|
1827
1835
|
);
|
|
1828
1836
|
}
|
|
1829
1837
|
/**
|
|
@@ -1837,22 +1845,22 @@ class FormPanel extends Panel {
|
|
|
1837
1845
|
* @param {HTMLFormElement} form The form we want to sterilise.
|
|
1838
1846
|
* @return {HTMLFormElement}
|
|
1839
1847
|
*/
|
|
1840
|
-
#a(
|
|
1841
|
-
if (
|
|
1842
|
-
|
|
1843
|
-
const
|
|
1844
|
-
this.listen(
|
|
1845
|
-
U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() &&
|
|
1848
|
+
#a(w) {
|
|
1849
|
+
if (w && this.#s) {
|
|
1850
|
+
w.noValidate = !0;
|
|
1851
|
+
const D = this.user;
|
|
1852
|
+
this.listen(w, EV.SUBMIT, (U) => {
|
|
1853
|
+
U.preventDefault(), this.debugMe("Intercepted from SUBMIT"), this.checkAllFields() && D && D.formSubmit(this);
|
|
1846
1854
|
});
|
|
1847
1855
|
}
|
|
1848
|
-
return
|
|
1856
|
+
return w;
|
|
1849
1857
|
}
|
|
1850
1858
|
//--[ Round Trip ]--
|
|
1851
1859
|
/**
|
|
1852
1860
|
* @param {function(!FormPanel, (string|!ServerFormSuccessJsonType)=): (?|null|Promise<?>)} func
|
|
1853
1861
|
*/
|
|
1854
|
-
onSubmitSuccess(
|
|
1855
|
-
this.onSubmitSucFunc =
|
|
1862
|
+
onSubmitSuccess(w) {
|
|
1863
|
+
this.onSubmitSucFunc = w;
|
|
1856
1864
|
}
|
|
1857
1865
|
/**
|
|
1858
1866
|
* Given a 'fetch' reply, replace the form.
|
|
@@ -1860,18 +1868,18 @@ class FormPanel extends Panel {
|
|
|
1860
1868
|
* and re-reads the scripts.
|
|
1861
1869
|
* @param {string} reply
|
|
1862
1870
|
*/
|
|
1863
|
-
replaceForm(
|
|
1864
|
-
if (this.responseObject = splitScripts(
|
|
1871
|
+
replaceForm(w) {
|
|
1872
|
+
if (this.responseObject = splitScripts(w), this.responseObject.html) {
|
|
1865
1873
|
if (this.redirected) {
|
|
1866
1874
|
this.removeAllListener();
|
|
1867
|
-
const
|
|
1868
|
-
this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(),
|
|
1875
|
+
const D = this.getElement(), U = D.parentNode;
|
|
1876
|
+
this.setElementInternal_(this.responseObject.html), U.replaceChild(this.getElement(), D);
|
|
1869
1877
|
} else {
|
|
1870
|
-
const
|
|
1878
|
+
const D = (
|
|
1871
1879
|
/** @type {!Element} */
|
|
1872
1880
|
this.responseObject.html.querySelector("form")
|
|
1873
1881
|
);
|
|
1874
|
-
|
|
1882
|
+
D && replaceNode(D, this.#t);
|
|
1875
1883
|
const U = (
|
|
1876
1884
|
/** @type {!Element} */
|
|
1877
1885
|
this.responseObject.html.querySelector('button[type="submit"]')
|
|
@@ -1889,8 +1897,8 @@ class FormPanel extends Panel {
|
|
|
1889
1897
|
* @return {Promise} Returns a promise with this panel as value.
|
|
1890
1898
|
*/
|
|
1891
1899
|
refreshFromFromServer() {
|
|
1892
|
-
const
|
|
1893
|
-
return
|
|
1900
|
+
const w = this.user, D = this.uri;
|
|
1901
|
+
return w ? w.fetch(D, this.abortController.signal).then(
|
|
1894
1902
|
(U) => this.replaceForm(U)
|
|
1895
1903
|
) : Promise.reject(new Error("No UserManager instance available for FormPanel.refreshFromFromServer()"));
|
|
1896
1904
|
}
|
|
@@ -1898,33 +1906,33 @@ class FormPanel extends Panel {
|
|
|
1898
1906
|
* @param {string} reply
|
|
1899
1907
|
* @return {Promise}
|
|
1900
1908
|
*/
|
|
1901
|
-
processSubmitReply(
|
|
1909
|
+
processSubmitReply(w) {
|
|
1902
1910
|
this.clearAllValidationErrors();
|
|
1903
|
-
let
|
|
1904
|
-
if (whatType(
|
|
1911
|
+
let D = !1;
|
|
1912
|
+
if (whatType(w) === "object" && w.success)
|
|
1905
1913
|
return Promise.resolve(this).then(() => {
|
|
1906
|
-
this.onSubmitSucFunc(this,
|
|
1914
|
+
this.onSubmitSucFunc(this, w), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1907
1915
|
});
|
|
1908
|
-
if (
|
|
1916
|
+
if (w === "success" ? (this.debugMe(`
|
|
1909
1917
|
1.REDIRECTED: ${this.redirected}
|
|
1910
|
-
REPLY: ${
|
|
1918
|
+
REPLY: ${w}`), D = !0) : w === `redirected_success
|
|
1911
1919
|
` ? (this.debugMe(`
|
|
1912
1920
|
2.REDIRECTED: ${this.redirected}
|
|
1913
|
-
REPLY: ${
|
|
1921
|
+
REPLY: ${w}`), D = !0, this.redirected = !1) : (this.debugMe(`
|
|
1914
1922
|
3.REDIRECTED: ${this.redirected}
|
|
1915
|
-
REPLY: Some form HTML`), this.replaceForm(
|
|
1923
|
+
REPLY: Some form HTML`), this.replaceForm(w)), D && this.redirected)
|
|
1916
1924
|
return this.debugMe(`
|
|
1917
1925
|
4.REDIRECTED: ${this.redirected}
|
|
1918
|
-
SUCCESS: ${
|
|
1919
|
-
if (
|
|
1926
|
+
SUCCESS: ${D}`), this.redirected = !1, Promise.resolve(this);
|
|
1927
|
+
if (D)
|
|
1920
1928
|
return this.debugMe(`
|
|
1921
1929
|
5.REDIRECTED: ${this.redirected}
|
|
1922
|
-
SUCCESS: ${
|
|
1930
|
+
SUCCESS: ${D}`), Promise.resolve(this).then(() => {
|
|
1923
1931
|
this.onSubmitSucFunc(this), this.dispatchCompEvent(UiEventType.FORM_SUBMIT_SUCCESS);
|
|
1924
1932
|
});
|
|
1925
1933
|
this.debugMe(`
|
|
1926
1934
|
6.REDIRECTED: ${this.redirected}
|
|
1927
|
-
SUCCESS: ${
|
|
1935
|
+
SUCCESS: ${D}`);
|
|
1928
1936
|
}
|
|
1929
1937
|
}
|
|
1930
1938
|
class Split extends Component {
|
|
@@ -1947,38 +1955,38 @@ class Split extends Component {
|
|
|
1947
1955
|
* @return {!Array<!Array<string, !Object>>} Array of [nestName, nestConfig] pairs
|
|
1948
1956
|
*/
|
|
1949
1957
|
get nests() {
|
|
1950
|
-
return [...this.nestMap_.entries()].filter(([
|
|
1958
|
+
return [...this.nestMap_.entries()].filter(([w, { nestEl: D }]) => D);
|
|
1951
1959
|
}
|
|
1952
1960
|
/**
|
|
1953
1961
|
* Gets the nest element for a given nest name.
|
|
1954
1962
|
* @param {string} nestName The nest name to look up
|
|
1955
1963
|
* @return {!Element | undefined} The nest element, or undefined if not found
|
|
1956
1964
|
*/
|
|
1957
|
-
getNest(
|
|
1958
|
-
return this.nestMap_.get(
|
|
1965
|
+
getNest(w) {
|
|
1966
|
+
return this.nestMap_.get(w)?.nestEl;
|
|
1959
1967
|
}
|
|
1960
1968
|
/**
|
|
1961
1969
|
* Returns the names of all nests that haven't been further split.
|
|
1962
1970
|
* @return {!Array<string>} Array of nest names
|
|
1963
1971
|
*/
|
|
1964
1972
|
get nestNames() {
|
|
1965
|
-
return [...this.nestMap_.entries()].filter(([
|
|
1973
|
+
return [...this.nestMap_.entries()].filter(([w, D]) => !this.splitNests_.has(D)).map(([w]) => w);
|
|
1966
1974
|
}
|
|
1967
1975
|
/**
|
|
1968
1976
|
* Closes and locks all nests in this split component.
|
|
1969
1977
|
* @param {!Function=} callback Callback to execute after each nest closes
|
|
1970
1978
|
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1971
1979
|
*/
|
|
1972
|
-
closeAndLockAll(
|
|
1973
|
-
this.nestNames.forEach((U) => this.closeAndLock(U,
|
|
1980
|
+
closeAndLockAll(w = identity, D = !1) {
|
|
1981
|
+
this.nestNames.forEach((U) => this.closeAndLock(U, w, D));
|
|
1974
1982
|
}
|
|
1975
1983
|
/**
|
|
1976
1984
|
* Opens and unlocks all nests in this split component.
|
|
1977
1985
|
* @param {!Function=} callback Callback to execute after each nest opens
|
|
1978
1986
|
* @param {boolean=} opt_skipAni If true, skips animation
|
|
1979
1987
|
*/
|
|
1980
|
-
openAndUnlockAll(
|
|
1981
|
-
this.nestNames.forEach((U) => this.openAndUnlock(U,
|
|
1988
|
+
openAndUnlockAll(w = identity, D = !1) {
|
|
1989
|
+
this.nestNames.forEach((U) => this.openAndUnlock(U, w, D));
|
|
1982
1990
|
}
|
|
1983
1991
|
// ---------------------------------------------------------------------------
|
|
1984
1992
|
/**
|
|
@@ -1989,9 +1997,9 @@ class Split extends Component {
|
|
|
1989
1997
|
* is vai the nest name - for consistency with the rest of the API.
|
|
1990
1998
|
* @param {string} nestName Nest name
|
|
1991
1999
|
*/
|
|
1992
|
-
lock(
|
|
1993
|
-
const { dragEl:
|
|
1994
|
-
|
|
2000
|
+
lock(w) {
|
|
2001
|
+
const { dragEl: D } = this.nestMap_.get(w);
|
|
2002
|
+
D.classList.add("locked");
|
|
1995
2003
|
}
|
|
1996
2004
|
/**
|
|
1997
2005
|
* The reverse of a lock. Removes the classes added by <@code>lock</> and
|
|
@@ -2000,9 +2008,9 @@ class Split extends Component {
|
|
|
2000
2008
|
* is vai the nest name - for consistency with the rest of the API.
|
|
2001
2009
|
* @param {string} nestName Nest name
|
|
2002
2010
|
*/
|
|
2003
|
-
unlock(
|
|
2004
|
-
const { dragEl:
|
|
2005
|
-
|
|
2011
|
+
unlock(w) {
|
|
2012
|
+
const { dragEl: D } = this.nestMap_.get(w);
|
|
2013
|
+
D.classList.remove("locked");
|
|
2006
2014
|
}
|
|
2007
2015
|
/**
|
|
2008
2016
|
* Resize a nest.
|
|
@@ -2013,11 +2021,11 @@ class Split extends Component {
|
|
|
2013
2021
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2014
2022
|
* simply affected directly.
|
|
2015
2023
|
*/
|
|
2016
|
-
resize(
|
|
2017
|
-
const { sizeNow: q, nestEl: W, canResize:
|
|
2018
|
-
|
|
2019
|
-
W.classList.remove("animated"), this.nestMap_.get(
|
|
2020
|
-
}), W.style.flexBasis = `${
|
|
2024
|
+
resize(w, D, U = identity, F = !1) {
|
|
2025
|
+
const { sizeNow: q, nestEl: W, canResize: Y } = this.nestMap_.get(w);
|
|
2026
|
+
Y && (F || q === D ? (W.classList.remove("animated"), W.style.flexBasis = `${D}px`, this.nestMap_.get(w).sizeNow = D, U()) : (W.classList.add("animated"), this.nestCallbackMap_.set(w, () => {
|
|
2027
|
+
W.classList.remove("animated"), this.nestMap_.get(w).sizeNow = D, U();
|
|
2028
|
+
}), W.style.flexBasis = `${D}px`));
|
|
2021
2029
|
}
|
|
2022
2030
|
/**
|
|
2023
2031
|
* Close the nest and lock it. See <@code>lock</>
|
|
@@ -2027,23 +2035,23 @@ class Split extends Component {
|
|
|
2027
2035
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2028
2036
|
* simply affected directly.
|
|
2029
2037
|
*/
|
|
2030
|
-
closeAndLock(
|
|
2031
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(
|
|
2038
|
+
closeAndLock(w, D = identity, U = !1) {
|
|
2039
|
+
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2032
2040
|
if (!W)
|
|
2033
2041
|
return;
|
|
2034
|
-
const
|
|
2035
|
-
q.classList.add("locked", "closed"), F.classList.add("closed"),
|
|
2042
|
+
const Y = () => {
|
|
2043
|
+
q.classList.add("locked", "closed"), F.classList.add("closed"), D();
|
|
2036
2044
|
};
|
|
2037
|
-
this.resize(
|
|
2045
|
+
this.resize(w, 0, Y, U);
|
|
2038
2046
|
}
|
|
2039
|
-
closeAndUnlock(
|
|
2040
|
-
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(
|
|
2047
|
+
closeAndUnlock(w, D = identity, U = !1) {
|
|
2048
|
+
const { nestEl: F, dragEl: q, canResize: W } = this.nestMap_.get(w);
|
|
2041
2049
|
if (!W)
|
|
2042
2050
|
return;
|
|
2043
|
-
const
|
|
2044
|
-
F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"),
|
|
2051
|
+
const Y = () => {
|
|
2052
|
+
F.classList.remove("closed"), q.classList.remove("closed", "locked"), q.classList.add("collapsed"), D();
|
|
2045
2053
|
};
|
|
2046
|
-
this.resize(
|
|
2054
|
+
this.resize(w, 0, Y, U);
|
|
2047
2055
|
}
|
|
2048
2056
|
/**
|
|
2049
2057
|
* Open a closed and locked nest. Simply a convenience method to combine
|
|
@@ -2055,19 +2063,19 @@ class Split extends Component {
|
|
|
2055
2063
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2056
2064
|
* simply affected directly.
|
|
2057
2065
|
*/
|
|
2058
|
-
openAndUnlock(
|
|
2066
|
+
openAndUnlock(w, D, U, F = !1) {
|
|
2059
2067
|
const {
|
|
2060
2068
|
nestEl: q,
|
|
2061
2069
|
dragEl: W,
|
|
2062
|
-
defSize:
|
|
2070
|
+
defSize: Y,
|
|
2063
2071
|
lastSize: G,
|
|
2064
|
-
canResize:
|
|
2065
|
-
} = this.nestMap_.get(
|
|
2066
|
-
if (!
|
|
2072
|
+
canResize: Z
|
|
2073
|
+
} = this.nestMap_.get(w);
|
|
2074
|
+
if (!Z)
|
|
2067
2075
|
return;
|
|
2068
|
-
const Q =
|
|
2076
|
+
const Q = D || G || Y;
|
|
2069
2077
|
q.classList.remove("closed"), W.classList.remove("closed", "locked", "collapsed"), setTimeout(() => {
|
|
2070
|
-
this.resize(
|
|
2078
|
+
this.resize(w, Q, U, F);
|
|
2071
2079
|
}, 50);
|
|
2072
2080
|
}
|
|
2073
2081
|
/**
|
|
@@ -2079,19 +2087,19 @@ class Split extends Component {
|
|
|
2079
2087
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2080
2088
|
* simply affected directly.
|
|
2081
2089
|
*/
|
|
2082
|
-
openAndLock(
|
|
2090
|
+
openAndLock(w, D, U, F = !1) {
|
|
2083
2091
|
const {
|
|
2084
2092
|
nestEl: q,
|
|
2085
2093
|
dragEl: W,
|
|
2086
|
-
defSize:
|
|
2094
|
+
defSize: Y,
|
|
2087
2095
|
lastSize: G,
|
|
2088
|
-
canResize:
|
|
2089
|
-
} = this.nestMap_.get(
|
|
2090
|
-
if (!
|
|
2096
|
+
canResize: Z
|
|
2097
|
+
} = this.nestMap_.get(w);
|
|
2098
|
+
if (!Z)
|
|
2091
2099
|
return;
|
|
2092
|
-
const Q =
|
|
2100
|
+
const Q = D || G || Y;
|
|
2093
2101
|
q.classList.remove("closed"), W.classList.remove("closed", "collapsed"), setTimeout(() => {
|
|
2094
|
-
this.resize(
|
|
2102
|
+
this.resize(w, Q, U, F);
|
|
2095
2103
|
}, 50);
|
|
2096
2104
|
}
|
|
2097
2105
|
/**
|
|
@@ -2103,15 +2111,15 @@ class Split extends Component {
|
|
|
2103
2111
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2104
2112
|
* simply affected directly.
|
|
2105
2113
|
*/
|
|
2106
|
-
close(
|
|
2107
|
-
const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(
|
|
2114
|
+
close(w, D = identity, U = !1) {
|
|
2115
|
+
const { dragEl: F, canResize: q, nestEl: W } = this.nestMap_.get(w);
|
|
2108
2116
|
if (!q)
|
|
2109
2117
|
return;
|
|
2110
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName:
|
|
2111
|
-
const
|
|
2112
|
-
F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName:
|
|
2118
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_CLOSE, { nestName: w, nestEl: W });
|
|
2119
|
+
const Y = () => {
|
|
2120
|
+
F.classList.add("collapsed"), this.dispatchSplitEvent(UiEventType.SPLIT_DID_CLOSE, { nestName: w, nestEl: W }), D();
|
|
2113
2121
|
};
|
|
2114
|
-
this.resize(
|
|
2122
|
+
this.resize(w, 0, Y, U);
|
|
2115
2123
|
}
|
|
2116
2124
|
/**
|
|
2117
2125
|
* Open the nest ignoring its current locked state.
|
|
@@ -2121,15 +2129,15 @@ class Split extends Component {
|
|
|
2121
2129
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2122
2130
|
* simply affected directly.
|
|
2123
2131
|
*/
|
|
2124
|
-
open(
|
|
2125
|
-
const { defSize: F, lastSize: q, dragEl: W, canResize:
|
|
2126
|
-
if (!
|
|
2132
|
+
open(w, D = identity, U = !1) {
|
|
2133
|
+
const { defSize: F, lastSize: q, dragEl: W, canResize: Y, nestEl: G } = this.nestMap_.get(w);
|
|
2134
|
+
if (!Y)
|
|
2127
2135
|
return;
|
|
2128
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName:
|
|
2129
|
-
const
|
|
2130
|
-
this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName:
|
|
2136
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_WILL_OPEN, { nestName: w, nestEl: G }), W.classList.remove("collapsed", "closed");
|
|
2137
|
+
const Z = q || F, Q = () => {
|
|
2138
|
+
this.dispatchSplitEvent(UiEventType.SPLIT_DID_OPEN, { nestName: w, nestEl: G }), D();
|
|
2131
2139
|
};
|
|
2132
|
-
this.resize(
|
|
2140
|
+
this.resize(w, Z, Q, U);
|
|
2133
2141
|
}
|
|
2134
2142
|
/**
|
|
2135
2143
|
* Close the nest ignoring its current locked state.
|
|
@@ -2139,8 +2147,8 @@ class Split extends Component {
|
|
|
2139
2147
|
* @param {boolean?} opt_skipAni When true, the resize won't be animated, but
|
|
2140
2148
|
* simply affected directly.
|
|
2141
2149
|
*/
|
|
2142
|
-
toggle(
|
|
2143
|
-
this.nestMap_.get(
|
|
2150
|
+
toggle(w, D, U = !1) {
|
|
2151
|
+
this.nestMap_.get(w).sizeNow === 0 ? this.open(w, D, U) : this.close(w, D, U);
|
|
2144
2152
|
}
|
|
2145
2153
|
//----------------------------------------------------------------------------
|
|
2146
2154
|
/**
|
|
@@ -2177,34 +2185,34 @@ class Split extends Component {
|
|
|
2177
2185
|
* @param {?Array<string>} classArrDragger Extra classes for the dragger element
|
|
2178
2186
|
* @param {?Array<string>} classArrGrabber Extra classes for the grabber element
|
|
2179
2187
|
*/
|
|
2180
|
-
addSplit(
|
|
2181
|
-
const Q =
|
|
2188
|
+
addSplit(w = void 0, D = "EW", U = 100, F = 100, q = [], W = [], Y = [], G = [], Z = []) {
|
|
2189
|
+
const Q = w || this.getElement();
|
|
2182
2190
|
if (this.splitNests_.has(Q))
|
|
2183
2191
|
return ["Already used!", Q];
|
|
2184
|
-
convertElToSplit(Q,
|
|
2192
|
+
convertElToSplit(Q, D), this.splitNests_.add(Q);
|
|
2185
2193
|
let tt = "";
|
|
2186
|
-
if (
|
|
2187
|
-
const it = [...this.nestMap_.entries()].find(([at, { nestEl:
|
|
2194
|
+
if (w) {
|
|
2195
|
+
const it = [...this.nestMap_.entries()].find(([at, { nestEl: lt }]) => lt === w);
|
|
2188
2196
|
if (it)
|
|
2189
2197
|
tt = it[0];
|
|
2190
2198
|
else
|
|
2191
|
-
return ["Element not managed by this component",
|
|
2199
|
+
return ["Element not managed by this component", w];
|
|
2192
2200
|
}
|
|
2193
|
-
const J = `${tt}A`,
|
|
2194
|
-
|
|
2201
|
+
const J = `${tt}A`, X = makeOuterNest(U, ["zoo_nest__A", J, ...q]), K = new Dragger(D);
|
|
2202
|
+
K.domFunc = makeDraggerEl([`zoo_drag_${J}`, ...G], Z), K.render(Q), this.nestMap_.set(J, {
|
|
2195
2203
|
side: "A",
|
|
2196
|
-
nestEl:
|
|
2197
|
-
dragger:
|
|
2198
|
-
dragEl:
|
|
2204
|
+
nestEl: X,
|
|
2205
|
+
dragger: K,
|
|
2206
|
+
dragEl: K.getElement(),
|
|
2199
2207
|
defSize: U,
|
|
2200
2208
|
sizeNow: -1,
|
|
2201
2209
|
canResize: !0
|
|
2202
2210
|
});
|
|
2203
2211
|
const et = `${tt}B`, st = makeInnerNest(["zoo_nest__B", et, ...W]);
|
|
2204
2212
|
this.nestMap_.set(et, { nestEl: st, canResize: !1 });
|
|
2205
|
-
const rt = `${tt}C`, nt = new Dragger(
|
|
2206
|
-
nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G],
|
|
2207
|
-
const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...
|
|
2213
|
+
const rt = `${tt}C`, nt = new Dragger(D);
|
|
2214
|
+
nt.domFunc = makeDraggerEl([`zoo_drag_${rt}`, ...G], Z), nt.render(Q);
|
|
2215
|
+
const ot = makeOuterNest(F, ["zoo_nest__C", rt, ...Y]);
|
|
2208
2216
|
this.nestMap_.set(rt, {
|
|
2209
2217
|
side: "C",
|
|
2210
2218
|
nestEl: ot,
|
|
@@ -2213,29 +2221,29 @@ class Split extends Component {
|
|
|
2213
2221
|
defSize: F,
|
|
2214
2222
|
sizeNow: -1,
|
|
2215
2223
|
canResize: !0
|
|
2216
|
-
}), [
|
|
2217
|
-
let
|
|
2218
|
-
const ht = (it, at,
|
|
2219
|
-
let
|
|
2220
|
-
const
|
|
2224
|
+
}), [X, K.getElement(), st, nt.getElement(), ot].forEach((it) => Q.appendChild(it));
|
|
2225
|
+
let ct = 0;
|
|
2226
|
+
const ht = (it, at, lt, gt) => {
|
|
2227
|
+
let ut;
|
|
2228
|
+
const dt = it === "NS" ? "height" : "width", mt = it === "NS" ? "deltaY" : "deltaX";
|
|
2221
2229
|
return (pt) => {
|
|
2222
2230
|
switch (pt.detail.value_) {
|
|
2223
2231
|
case UiEventType.COMP_DRAG_START:
|
|
2224
|
-
|
|
2232
|
+
ut = at.getBoundingClientRect()[dt], ct = st.getBoundingClientRect()[dt] + ut, this.nestMap_.get(lt).dragEl.classList.remove("collapsed");
|
|
2225
2233
|
break;
|
|
2226
2234
|
case UiEventType.COMP_DRAG_MOVE: {
|
|
2227
|
-
const
|
|
2228
|
-
this.nestMap_.get(
|
|
2235
|
+
const ft = Math.min(ct, ut + gt * pt.detail.data_[mt]);
|
|
2236
|
+
this.nestMap_.get(lt).lastSize = ft, at.style.flexBasis = ft + "px";
|
|
2229
2237
|
break;
|
|
2230
2238
|
}
|
|
2231
2239
|
case UiEventType.COMP_DRAG_END:
|
|
2232
|
-
this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(
|
|
2240
|
+
this.dispatchSplitEvent(UiEventType.COMP_DRAG_END, this.nestMap_.get(lt));
|
|
2233
2241
|
break;
|
|
2234
2242
|
}
|
|
2235
2243
|
};
|
|
2236
2244
|
};
|
|
2237
|
-
this.listen(
|
|
2238
|
-
if (it.propertyName === "flex-basis" && it.target ===
|
|
2245
|
+
this.listen(K, Component.compEventCode(), ht(D, X, J, 1)), this.listen(nt, Component.compEventCode(), ht(D, ot, rt, -1)), this.listen(K.getElement(), EV.DBLCLICK, () => this.toggle(J)), this.listen(nt.getElement(), EV.DBLCLICK, () => this.toggle(rt)), this.listen(K.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(J)), this.listen(nt.getElement().querySelector(".zoo_grabber"), EV.CLICK, () => this.toggle(rt)), this.listen(X, EV.TRANSITIONEND, (it) => {
|
|
2246
|
+
if (it.propertyName === "flex-basis" && it.target === X) {
|
|
2239
2247
|
const at = this.nestCallbackMap_.get(J);
|
|
2240
2248
|
this.nestCallbackMap_.delete(J), at && at(), this.dispatchSplitEvent(UiEventType.SPLIT_TRANSITION_END, this.nestMap_.get(J));
|
|
2241
2249
|
}
|
|
@@ -2256,51 +2264,51 @@ class Split extends Component {
|
|
|
2256
2264
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2257
2265
|
* if any of the handlers returns false this will also return false.
|
|
2258
2266
|
*/
|
|
2259
|
-
dispatchSplitEvent(
|
|
2260
|
-
const U = new ZooyEventData(
|
|
2267
|
+
dispatchSplitEvent(w, D) {
|
|
2268
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.SPLIT, U);
|
|
2261
2269
|
return this.dispatchEvent(F);
|
|
2262
2270
|
}
|
|
2263
2271
|
}
|
|
2264
|
-
const convertElToSplit = (O,
|
|
2265
|
-
const w = document.createElement("div");
|
|
2266
|
-
return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__outer", ...D), w.style.flexBasis = O + "px", w;
|
|
2267
|
-
}, makeInnerNest = (O = []) => {
|
|
2272
|
+
const convertElToSplit = (O, w) => (O.classList.add("zoo_split", `zoo_split__${w.toLowerCase()}`), O), makeOuterNest = (O, w = []) => {
|
|
2268
2273
|
const D = document.createElement("div");
|
|
2269
|
-
return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "
|
|
2270
|
-
},
|
|
2274
|
+
return D.setAttribute("id", randomId(7)), D.classList.add("zoo_nest", "zoo_nest__outer", ...w), D.style.flexBasis = O + "px", D;
|
|
2275
|
+
}, makeInnerNest = (O = []) => {
|
|
2271
2276
|
const w = document.createElement("div");
|
|
2272
|
-
w.setAttribute("id", randomId(7)), w.classList.add("
|
|
2277
|
+
return w.setAttribute("id", randomId(7)), w.classList.add("zoo_nest", "zoo_nest__inner", ...O), w;
|
|
2278
|
+
}, makeDraggerEl = (O = [], w = []) => () => {
|
|
2279
|
+
const D = document.createElement("div");
|
|
2280
|
+
D.setAttribute("id", randomId(7)), D.classList.add("zoo_dragger", ...O);
|
|
2273
2281
|
const U = document.createElement("div");
|
|
2274
|
-
return U.classList.add("zoo_grabber", ...
|
|
2282
|
+
return U.classList.add("zoo_grabber", ...w), D.appendChild(U), D;
|
|
2275
2283
|
}, needsToScroll = (O) => {
|
|
2276
|
-
const
|
|
2277
|
-
return (U) => U.getBoundingClientRect().bottom >
|
|
2278
|
-
}, treeNodeSelect = (O) => (
|
|
2279
|
-
const
|
|
2284
|
+
const D = O.getBoundingClientRect().bottom;
|
|
2285
|
+
return (U) => U.getBoundingClientRect().bottom > D;
|
|
2286
|
+
}, treeNodeSelect = (O) => (w) => {
|
|
2287
|
+
const D = O.getElement().querySelector(".zv_tree_container"), U = needsToScroll(D), F = O.getElement().querySelectorAll(".tree-node");
|
|
2280
2288
|
let q;
|
|
2281
2289
|
[...F].forEach((W) => {
|
|
2282
|
-
enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${
|
|
2290
|
+
enableClass(W, "mdc-deprecated-list-item--activated", W.id === `tree-node_${w}`), W.id === `tree-node_${w}` && (q = W);
|
|
2283
2291
|
}), q && U(q) && q.scrollIntoView(!1);
|
|
2284
|
-
}, toggleTree = (O,
|
|
2285
|
-
const
|
|
2292
|
+
}, toggleTree = (O, w) => {
|
|
2293
|
+
const D = w.getElement().querySelector(".children"), U = (
|
|
2286
2294
|
/**@type {boolean} */
|
|
2287
2295
|
O.isOn
|
|
2288
|
-
), F =
|
|
2296
|
+
), F = w.getElement().querySelectorAll(".children"), q = w.getElement().querySelectorAll(".zoo__reveal_icon");
|
|
2289
2297
|
[...F].forEach((W) => enableClass(
|
|
2290
2298
|
W,
|
|
2291
2299
|
"zoo__tree-children__hidden",
|
|
2292
|
-
W !==
|
|
2300
|
+
W !== D && !U
|
|
2293
2301
|
)), [...q].forEach((W) => enableClass(
|
|
2294
2302
|
W,
|
|
2295
2303
|
"zoo__icon_rotated",
|
|
2296
|
-
W !==
|
|
2304
|
+
W !== D && !U
|
|
2297
2305
|
));
|
|
2298
|
-
}, toggleTreeChildren = (O,
|
|
2299
|
-
const
|
|
2300
|
-
toggleClass(F, "zoo__tree-children__hidden"), toggleClass(
|
|
2301
|
-
}, _openTreeFromNodeUp = (O,
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2306
|
+
}, toggleTreeChildren = (O, w) => {
|
|
2307
|
+
const D = w.trigger, U = D.getAttribute("data-child-id"), F = O.getElement().querySelector(`#${U}`);
|
|
2308
|
+
toggleClass(F, "zoo__tree-children__hidden"), toggleClass(D, "zoo__icon_rotated");
|
|
2309
|
+
}, _openTreeFromNodeUp = (O, w) => {
|
|
2310
|
+
const D = w.parentElement;
|
|
2311
|
+
D.classList.contains("children") && (enableClass(D, "zoo__tree-children__hidden", !1), _openTreeFromNodeUp(O, D));
|
|
2304
2312
|
}, treeUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2305
2313
|
__proto__: null,
|
|
2306
2314
|
_openTreeFromNodeUp,
|
|
@@ -2315,8 +2323,8 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2315
2323
|
* @param {Object} eventData - Event data with isOn boolean
|
|
2316
2324
|
* @param {Panel} ePanel - The panel containing the tree
|
|
2317
2325
|
*/
|
|
2318
|
-
toggle_tree: function(O,
|
|
2319
|
-
toggleTree(O,
|
|
2326
|
+
toggle_tree: function(O, w) {
|
|
2327
|
+
toggleTree(O, w);
|
|
2320
2328
|
},
|
|
2321
2329
|
/**
|
|
2322
2330
|
* Toggle children visibility for a specific tree node.
|
|
@@ -2324,8 +2332,8 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2324
2332
|
* @param {Object} eventData - Event data with trigger element
|
|
2325
2333
|
* @param {Panel} ePanel - The panel containing the tree
|
|
2326
2334
|
*/
|
|
2327
|
-
"tree_toggle-children": function(O,
|
|
2328
|
-
toggleTreeChildren(
|
|
2335
|
+
"tree_toggle-children": function(O, w) {
|
|
2336
|
+
toggleTreeChildren(w, O);
|
|
2329
2337
|
}
|
|
2330
2338
|
}, SearchHandlers = {
|
|
2331
2339
|
/**
|
|
@@ -2335,15 +2343,15 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2335
2343
|
* @param {Object} eventData - Event data with href, formData.q, and targetval
|
|
2336
2344
|
* @param {Panel} ePanel - The panel to update
|
|
2337
2345
|
*/
|
|
2338
|
-
search: function(O,
|
|
2339
|
-
let
|
|
2346
|
+
search: function(O, w) {
|
|
2347
|
+
let D = `${O.href}`;
|
|
2340
2348
|
const U = O.formData.q, F = O.targetval;
|
|
2341
|
-
if (U !== "" && (
|
|
2349
|
+
if (U !== "" && (D = `${D}?q=${U}`), F !== "") {
|
|
2342
2350
|
let q = F;
|
|
2343
|
-
F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")),
|
|
2351
|
+
F.includes("page=") && (q = F.split("&").filter((W) => !W.includes("page=")).join("&")), D = U !== "" ? `${D}&${q}` : `${D}?${q}`;
|
|
2344
2352
|
}
|
|
2345
|
-
this.user.fetchAndSplit(
|
|
2346
|
-
(q) =>
|
|
2353
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2354
|
+
(q) => w.onReplacePartialDom(q, O.zvptarget)
|
|
2347
2355
|
);
|
|
2348
2356
|
},
|
|
2349
2357
|
/**
|
|
@@ -2353,9 +2361,9 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2353
2361
|
* @param {Object} eventData - Event data with trigger element
|
|
2354
2362
|
* @param {Panel} ePanel - The panel to update
|
|
2355
2363
|
*/
|
|
2356
|
-
reset_search: function(O,
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2364
|
+
reset_search: function(O, w) {
|
|
2365
|
+
const D = O.trigger.closest("form");
|
|
2366
|
+
w.removeFromQParams("q"), D.elements.q.value = "", D.dispatchEvent(new Event("submit"));
|
|
2359
2367
|
}
|
|
2360
2368
|
}, QueryParamHandlers = {
|
|
2361
2369
|
/**
|
|
@@ -2364,10 +2372,10 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2364
2372
|
* @param {Object} eventData - Event data with href and targetval for pagination
|
|
2365
2373
|
* @param {Panel} ePanel - The panel to update
|
|
2366
2374
|
*/
|
|
2367
|
-
paginate: function(O,
|
|
2368
|
-
const
|
|
2369
|
-
this.user.fetchAndSplit(
|
|
2370
|
-
(U) =>
|
|
2375
|
+
paginate: function(O, w) {
|
|
2376
|
+
const D = `${O.href}?${O.targetval}`;
|
|
2377
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2378
|
+
(U) => w.onReplacePartialDom(U, O.zvptarget)
|
|
2371
2379
|
);
|
|
2372
2380
|
},
|
|
2373
2381
|
/**
|
|
@@ -2376,10 +2384,10 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2376
2384
|
* @param {Object} eventData - Event data with href and targetval for filtering
|
|
2377
2385
|
* @param {Panel} ePanel - The panel to update
|
|
2378
2386
|
*/
|
|
2379
|
-
list_filter: function(O,
|
|
2380
|
-
const
|
|
2381
|
-
this.user.fetchAndSplit(
|
|
2382
|
-
(U) =>
|
|
2387
|
+
list_filter: function(O, w) {
|
|
2388
|
+
const D = `${O.href}?${O.targetval}`;
|
|
2389
|
+
this.user.fetchAndSplit(D, w.abortController.signal).then(
|
|
2390
|
+
(U) => w.onReplacePartialDom(U, O.zvptarget)
|
|
2383
2391
|
);
|
|
2384
2392
|
}
|
|
2385
2393
|
}, handlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -2388,7 +2396,7 @@ const convertElToSplit = (O, D) => (O.classList.add("zoo_split", `zoo_split__${D
|
|
|
2388
2396
|
QueryParamHandlers,
|
|
2389
2397
|
SearchHandlers
|
|
2390
2398
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2391
|
-
class View extends
|
|
2399
|
+
class View extends Evt {
|
|
2392
2400
|
#t = void 0;
|
|
2393
2401
|
#e = void 0;
|
|
2394
2402
|
//--[ Static ]--
|
|
@@ -2406,21 +2414,21 @@ class View extends EVT {
|
|
|
2406
2414
|
constructor() {
|
|
2407
2415
|
super(), this.panelMap = /* @__PURE__ */ new Map(), this.user_ = void 0, this.split_ = void 0, this.panelEventMap_ = this.initPanelEventsInternal_(), this.switchViewMap_ = /* @__PURE__ */ new Map(), this.metaData_ = /* @__PURE__ */ new Map();
|
|
2408
2416
|
}
|
|
2409
|
-
set recordHistory(
|
|
2410
|
-
this.#e =
|
|
2417
|
+
set recordHistory(w) {
|
|
2418
|
+
this.#e = w;
|
|
2411
2419
|
}
|
|
2412
2420
|
get recordHistory() {
|
|
2413
2421
|
return this.#e;
|
|
2414
2422
|
}
|
|
2415
|
-
set registerViewConstructor(
|
|
2416
|
-
this.#t =
|
|
2423
|
+
set registerViewConstructor(w) {
|
|
2424
|
+
this.#t = w;
|
|
2417
2425
|
}
|
|
2418
2426
|
get registerViewConstructor() {
|
|
2419
2427
|
return this.#t;
|
|
2420
2428
|
}
|
|
2421
|
-
set split(
|
|
2422
|
-
this.split_ =
|
|
2423
|
-
const U =
|
|
2429
|
+
set split(w) {
|
|
2430
|
+
this.split_ = w, this.listen(this.split_, UiEventType.SPLIT, (D) => {
|
|
2431
|
+
const U = D.detail.getValue(), F = D.detail.getData();
|
|
2424
2432
|
switch (U) {
|
|
2425
2433
|
case UiEventType.SPLIT_WILL_OPEN:
|
|
2426
2434
|
this.onSplitWillOpen(F);
|
|
@@ -2447,8 +2455,8 @@ class View extends EVT {
|
|
|
2447
2455
|
/**
|
|
2448
2456
|
* @param {!UserManager} user
|
|
2449
2457
|
*/
|
|
2450
|
-
set user(
|
|
2451
|
-
this.user_ =
|
|
2458
|
+
set user(w) {
|
|
2459
|
+
this.user_ = w, this.panelMap.forEach((D) => D.user = w);
|
|
2452
2460
|
}
|
|
2453
2461
|
/**
|
|
2454
2462
|
* @return {!UserManager}
|
|
@@ -2491,44 +2499,44 @@ class View extends EVT {
|
|
|
2491
2499
|
* @inheritDoc
|
|
2492
2500
|
*/
|
|
2493
2501
|
dispose() {
|
|
2494
|
-
[...this.panelMap.values()].forEach((
|
|
2502
|
+
[...this.panelMap.values()].forEach((w) => w.dispose()), super.dispose();
|
|
2495
2503
|
}
|
|
2496
2504
|
/**
|
|
2497
2505
|
* Add a panel as a child of the view.
|
|
2498
2506
|
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2499
2507
|
* @param {!Panel} panel The panel itself.
|
|
2500
2508
|
*/
|
|
2501
|
-
addPanelToView(
|
|
2502
|
-
|
|
2509
|
+
addPanelToView(w, D) {
|
|
2510
|
+
D.user = this.user, this.removePanelByName(w), this.panelMap.set(w, D), this.listen(D, Panel.panelEventCode(), this.onPanelEvent.bind(this));
|
|
2503
2511
|
}
|
|
2504
2512
|
/**
|
|
2505
2513
|
* Remove a panel from the view by name.
|
|
2506
2514
|
* @param {string} name The name of the panel - used as a key in the panel map.
|
|
2507
2515
|
*/
|
|
2508
|
-
removePanelByName(
|
|
2509
|
-
this.panelMap.has(
|
|
2516
|
+
removePanelByName(w) {
|
|
2517
|
+
this.panelMap.has(w) && this.panelMap.get(w).dispose();
|
|
2510
2518
|
}
|
|
2511
2519
|
/**
|
|
2512
2520
|
* @param {Panel} panel
|
|
2513
2521
|
*/
|
|
2514
|
-
removePanel(
|
|
2515
|
-
const [
|
|
2516
|
-
|
|
2522
|
+
removePanel(w) {
|
|
2523
|
+
const [D, U] = [...this.panelMap.entries()].find(([F, q]) => q === w);
|
|
2524
|
+
D && U && (U.dispose(), this.panelMap.delete(D));
|
|
2517
2525
|
}
|
|
2518
2526
|
/**
|
|
2519
2527
|
* @param {string} name
|
|
2520
2528
|
* @return {Panel|undefined}
|
|
2521
2529
|
*/
|
|
2522
|
-
getPanelByName(
|
|
2523
|
-
return this.panelMap.get(
|
|
2530
|
+
getPanelByName(w) {
|
|
2531
|
+
return this.panelMap.get(w);
|
|
2524
2532
|
}
|
|
2525
2533
|
/**
|
|
2526
2534
|
* Broadcasts data to all panels in this view. Each panel receives the data
|
|
2527
2535
|
* via its onViewDataBroadcast method.
|
|
2528
2536
|
* @param {*} data The data to broadcast to all panels
|
|
2529
2537
|
*/
|
|
2530
|
-
broadcastToPanels(
|
|
2531
|
-
[...this.panelMap.values()].forEach((
|
|
2538
|
+
broadcastToPanels(w) {
|
|
2539
|
+
[...this.panelMap.values()].forEach((D) => D.onViewDataBroadcast(w));
|
|
2532
2540
|
}
|
|
2533
2541
|
/**
|
|
2534
2542
|
* Initializes the internal panel event map with default event handlers.
|
|
@@ -2542,19 +2550,19 @@ class View extends EVT {
|
|
|
2542
2550
|
* @private
|
|
2543
2551
|
*/
|
|
2544
2552
|
initPanelEventsInternal_() {
|
|
2545
|
-
const
|
|
2546
|
-
return
|
|
2553
|
+
const w = /* @__PURE__ */ new Map();
|
|
2554
|
+
return w.set("destroy_me", (D, U) => {
|
|
2547
2555
|
this.removePanel(U);
|
|
2548
|
-
}),
|
|
2549
|
-
this.debugMe("switch_view received: eventData",
|
|
2550
|
-
const F =
|
|
2551
|
-
this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(
|
|
2556
|
+
}), w.set("switch_view", (D, U) => {
|
|
2557
|
+
this.debugMe("switch_view received: eventData", D);
|
|
2558
|
+
const F = D.view;
|
|
2559
|
+
this.switchViewMap_.has(F) ? this.switchViewMap_.get(F)(D, U) : this.debugMe("NO VIEW FOUND FOR:", F, this.switchViewMap_);
|
|
2552
2560
|
}), Object.entries({
|
|
2553
2561
|
...SearchHandlers,
|
|
2554
2562
|
...QueryParamHandlers
|
|
2555
|
-
}).forEach(([
|
|
2556
|
-
|
|
2557
|
-
}),
|
|
2563
|
+
}).forEach(([D, U]) => {
|
|
2564
|
+
w.set(D, U.bind(this));
|
|
2565
|
+
}), w;
|
|
2558
2566
|
}
|
|
2559
2567
|
/**
|
|
2560
2568
|
* Maps a panel event name to a handler function. Allows dynamic registration
|
|
@@ -2562,8 +2570,8 @@ class View extends EVT {
|
|
|
2562
2570
|
* @param {string} s The event name to map
|
|
2563
2571
|
* @param {!Function} func The handler function that receives (eventData, ePanel)
|
|
2564
2572
|
*/
|
|
2565
|
-
mapPanEv(
|
|
2566
|
-
this.panelEventMap_.set(
|
|
2573
|
+
mapPanEv(w, D) {
|
|
2574
|
+
this.panelEventMap_.set(w, D);
|
|
2567
2575
|
}
|
|
2568
2576
|
/**
|
|
2569
2577
|
* A map of string to function where the function receives an object and
|
|
@@ -2572,22 +2580,28 @@ class View extends EVT {
|
|
|
2572
2580
|
* @param {function(
|
|
2573
2581
|
* {view:string, pk:string, emit:string, href:string}, Panel):?} func
|
|
2574
2582
|
*/
|
|
2575
|
-
mapSwitchView(
|
|
2576
|
-
this.switchViewMap_.set(
|
|
2583
|
+
mapSwitchView(w, D) {
|
|
2584
|
+
this.switchViewMap_.set(w, D);
|
|
2577
2585
|
}
|
|
2578
2586
|
/**
|
|
2579
2587
|
* @param {!CustomEvent} e
|
|
2580
2588
|
*/
|
|
2581
|
-
onPanelEvent(
|
|
2582
|
-
|
|
2589
|
+
onPanelEvent(w) {
|
|
2590
|
+
let D = w.detail.getValue();
|
|
2591
|
+
const U = w.detail.getData();
|
|
2592
|
+
D.startsWith("switch_view:") && (U.view = D.split(":")[1], D = "switch_view");
|
|
2593
|
+
const F = (
|
|
2583
2594
|
/** @type {Panel} */
|
|
2584
|
-
|
|
2595
|
+
w.target
|
|
2585
2596
|
);
|
|
2586
|
-
this.panelEventMap_.has(
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2597
|
+
this.panelEventMap_.has(D) ? this.panelEventMap_.get(D)(U, F) : this.debugMe(`NO EVENT MATCH - This usually you are missing
|
|
2598
|
+
a "mapPanEv(${D} ..." statement in your panel JS
|
|
2599
|
+
or you have a "event='${D}'" attribute in your panel HTML`, {
|
|
2600
|
+
event: w,
|
|
2601
|
+
eventValue: D,
|
|
2602
|
+
eventData: U,
|
|
2603
|
+
panel: F.constructor.name
|
|
2604
|
+
});
|
|
2591
2605
|
}
|
|
2592
2606
|
//--[ Split Events ]--
|
|
2593
2607
|
/**
|
|
@@ -2595,28 +2609,28 @@ class View extends EVT {
|
|
|
2595
2609
|
*
|
|
2596
2610
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2597
2611
|
*/
|
|
2598
|
-
onSplitWillOpen(
|
|
2612
|
+
onSplitWillOpen(w) {
|
|
2599
2613
|
}
|
|
2600
2614
|
/**
|
|
2601
2615
|
* Triggered before a split will close.
|
|
2602
2616
|
*
|
|
2603
2617
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2604
2618
|
*/
|
|
2605
|
-
onSplitWillClose(
|
|
2619
|
+
onSplitWillClose(w) {
|
|
2606
2620
|
}
|
|
2607
2621
|
/**
|
|
2608
2622
|
* Triggered after a split closed.
|
|
2609
2623
|
*
|
|
2610
2624
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2611
2625
|
*/
|
|
2612
|
-
onSplitDidClose(
|
|
2626
|
+
onSplitDidClose(w) {
|
|
2613
2627
|
}
|
|
2614
2628
|
/**
|
|
2615
2629
|
* Triggered after a split opened.
|
|
2616
2630
|
*
|
|
2617
2631
|
* @param {{nestName: !string, nestEl:!HTMLElement}} _data
|
|
2618
2632
|
*/
|
|
2619
|
-
onSplitDidOpen(
|
|
2633
|
+
onSplitDidOpen(w) {
|
|
2620
2634
|
}
|
|
2621
2635
|
//--[ Built in events ]--
|
|
2622
2636
|
/**
|
|
@@ -2635,8 +2649,8 @@ class View extends EVT {
|
|
|
2635
2649
|
* @return {boolean} If anyone called preventDefault on the event object (or
|
|
2636
2650
|
* if any of the handlers returns false this will also return false.
|
|
2637
2651
|
*/
|
|
2638
|
-
dispatchViewEvent(
|
|
2639
|
-
const U = new ZooyEventData(
|
|
2652
|
+
dispatchViewEvent(w, D) {
|
|
2653
|
+
const U = new ZooyEventData(w, D), F = Evt.makeEvent(UiEventType.VIEW, U);
|
|
2640
2654
|
return this.dispatchEvent(F);
|
|
2641
2655
|
}
|
|
2642
2656
|
//--[ Meta Data ]--
|
|
@@ -2653,27 +2667,27 @@ class View extends EVT {
|
|
|
2653
2667
|
* @param {*} v The metadata value
|
|
2654
2668
|
* @return {!Map<string, *>} The updated metadata map
|
|
2655
2669
|
*/
|
|
2656
|
-
setMetaData(
|
|
2657
|
-
return this.metaData_.set(
|
|
2670
|
+
setMetaData(w, D) {
|
|
2671
|
+
return this.metaData_.set(w, D), this.metaData;
|
|
2658
2672
|
}
|
|
2659
2673
|
/**
|
|
2660
2674
|
* Retrieves a metadata value by key.
|
|
2661
2675
|
* @param {string} k The metadata key
|
|
2662
2676
|
* @return {*} The metadata value, or undefined if not found
|
|
2663
2677
|
*/
|
|
2664
|
-
getMetaData(
|
|
2665
|
-
return this.metaData_.get(
|
|
2678
|
+
getMetaData(w) {
|
|
2679
|
+
return this.metaData_.get(w);
|
|
2666
2680
|
}
|
|
2667
2681
|
/**
|
|
2668
2682
|
* Checks if a metadata key exists.
|
|
2669
2683
|
* @param {string} k The metadata key
|
|
2670
2684
|
* @return {boolean} True if the key exists, false otherwise
|
|
2671
2685
|
*/
|
|
2672
|
-
hasMetaData(
|
|
2673
|
-
return this.metaData_.has(
|
|
2686
|
+
hasMetaData(w) {
|
|
2687
|
+
return this.metaData_.has(w);
|
|
2674
2688
|
}
|
|
2675
2689
|
}
|
|
2676
|
-
class Conductor extends
|
|
2690
|
+
class Conductor extends Evt {
|
|
2677
2691
|
#t = /* @__PURE__ */ new Map();
|
|
2678
2692
|
#e = null;
|
|
2679
2693
|
/**
|
|
@@ -2688,12 +2702,12 @@ class Conductor extends EVT {
|
|
|
2688
2702
|
* and initializes view event handling.
|
|
2689
2703
|
*/
|
|
2690
2704
|
constructor() {
|
|
2691
|
-
super(), this.#n = this.#i(), window.addEventListener("popstate", (
|
|
2692
|
-
|
|
2705
|
+
super(), this.#n = this.#i(), window.addEventListener("popstate", (w) => {
|
|
2706
|
+
w.state !== null && this.navTo(w.state);
|
|
2693
2707
|
});
|
|
2694
2708
|
}
|
|
2695
|
-
set split(
|
|
2696
|
-
this.#r =
|
|
2709
|
+
set split(w) {
|
|
2710
|
+
this.#r = w;
|
|
2697
2711
|
}
|
|
2698
2712
|
get split() {
|
|
2699
2713
|
if (!this.#r)
|
|
@@ -2703,8 +2717,8 @@ class Conductor extends EVT {
|
|
|
2703
2717
|
/**
|
|
2704
2718
|
* @param {!UserManager} user
|
|
2705
2719
|
*/
|
|
2706
|
-
set user(
|
|
2707
|
-
this.#s =
|
|
2720
|
+
set user(w) {
|
|
2721
|
+
this.#s = w, this.#e && (this.#e.user = this.user);
|
|
2708
2722
|
}
|
|
2709
2723
|
/**
|
|
2710
2724
|
* @return {!UserManager}
|
|
@@ -2719,11 +2733,11 @@ class Conductor extends EVT {
|
|
|
2719
2733
|
* @private
|
|
2720
2734
|
*/
|
|
2721
2735
|
#i() {
|
|
2722
|
-
return (/* @__PURE__ */ new Map()).set("switch_view", (
|
|
2723
|
-
if (this.#t.has(
|
|
2724
|
-
const U = this.#t.get(
|
|
2725
|
-
|
|
2726
|
-
|
|
2736
|
+
return (/* @__PURE__ */ new Map()).set("switch_view", (w, D) => {
|
|
2737
|
+
if (this.#t.has(w.view)) {
|
|
2738
|
+
const U = this.#t.get(w.view)(
|
|
2739
|
+
w.pk || w.recordId,
|
|
2740
|
+
w
|
|
2727
2741
|
);
|
|
2728
2742
|
this.switchView(U);
|
|
2729
2743
|
}
|
|
@@ -2735,8 +2749,8 @@ class Conductor extends EVT {
|
|
|
2735
2749
|
* @param {string} s The event name to map
|
|
2736
2750
|
* @param {!Function} func The handler function that receives (eventData, eView)
|
|
2737
2751
|
*/
|
|
2738
|
-
mapViewEv(
|
|
2739
|
-
this.#n.set(
|
|
2752
|
+
mapViewEv(w, D) {
|
|
2753
|
+
this.#n.set(w, D);
|
|
2740
2754
|
}
|
|
2741
2755
|
/**
|
|
2742
2756
|
* Registers a view constructor function that can be used to create instances
|
|
@@ -2744,39 +2758,39 @@ class Conductor extends EVT {
|
|
|
2744
2758
|
* @param {string} s The view type identifier
|
|
2745
2759
|
* @param {!Function} f Constructor function that receives (pk, data) and returns a View
|
|
2746
2760
|
*/
|
|
2747
|
-
registerViewConstructor(
|
|
2748
|
-
this.#t.set(
|
|
2761
|
+
registerViewConstructor(w, D) {
|
|
2762
|
+
this.#t.set(w, D);
|
|
2749
2763
|
}
|
|
2750
2764
|
/**
|
|
2751
2765
|
* @param {!CustomEvent} e Event object.
|
|
2752
2766
|
*/
|
|
2753
|
-
onViewEvent(
|
|
2754
|
-
const
|
|
2767
|
+
onViewEvent(w) {
|
|
2768
|
+
const D = w.detail.getValue(), U = w.detail.getData(), F = (
|
|
2755
2769
|
/** @type {Panel} */
|
|
2756
|
-
|
|
2770
|
+
w.target
|
|
2757
2771
|
);
|
|
2758
|
-
this.#n.has(
|
|
2772
|
+
this.#n.has(D) ? this.#n.get(D)(U, F) : console.warn("Unhandled VIEW Event:", w, D, U, F);
|
|
2759
2773
|
}
|
|
2760
2774
|
/**
|
|
2761
2775
|
* Make the given view active.
|
|
2762
2776
|
* @param {!View} view
|
|
2763
2777
|
*/
|
|
2764
|
-
setActiveView(
|
|
2765
|
-
this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e =
|
|
2778
|
+
setActiveView(w) {
|
|
2779
|
+
this.#e && (this.stopListeningTo(this.#e), this.#e.dispose(), this.#e = null), this.#e = w, this.#e.render();
|
|
2766
2780
|
}
|
|
2767
2781
|
/**
|
|
2768
2782
|
* @param {!View} view
|
|
2769
2783
|
* @returns {!View}
|
|
2770
2784
|
*/
|
|
2771
|
-
initView(
|
|
2772
|
-
return
|
|
2785
|
+
initView(w) {
|
|
2786
|
+
return w.user = this.user, w.split = this.split, w.recordHistory = this.recordHistory.bind(this), w.registerViewConstructor = this.registerViewConstructor.bind(this), this.listen(w, View.viewEventCode(), this.onViewEvent.bind(this)), w;
|
|
2773
2787
|
}
|
|
2774
2788
|
//--[ Views Utilities ]--
|
|
2775
2789
|
/**
|
|
2776
2790
|
* @param {!View} view The view we want active.
|
|
2777
2791
|
*/
|
|
2778
|
-
switchView(
|
|
2779
|
-
this.setActiveView(this.initView(
|
|
2792
|
+
switchView(w) {
|
|
2793
|
+
this.setActiveView(this.initView(w));
|
|
2780
2794
|
}
|
|
2781
2795
|
//--[ History and Navigation ]--
|
|
2782
2796
|
/**
|
|
@@ -2785,8 +2799,8 @@ class Conductor extends EVT {
|
|
|
2785
2799
|
* item.history is true.
|
|
2786
2800
|
* @param {!Object} item The history item containing view state
|
|
2787
2801
|
*/
|
|
2788
|
-
recordHistory(
|
|
2789
|
-
this.debugMe("HISTORY",
|
|
2802
|
+
recordHistory(w) {
|
|
2803
|
+
this.debugMe("HISTORY", w), w.init ? history.replaceState(w, "", document.location.href) : w.history || history.pushState(w, "", null);
|
|
2790
2804
|
}
|
|
2791
2805
|
/**
|
|
2792
2806
|
* Navigates to a specific view based on the history item. Attempts to use
|
|
@@ -2794,256 +2808,600 @@ class Conductor extends EVT {
|
|
|
2794
2808
|
* constructors if needed.
|
|
2795
2809
|
* @param {!Object} item History item containing {view, pk, ...} properties
|
|
2796
2810
|
*/
|
|
2797
|
-
navTo = (
|
|
2798
|
-
|
|
2799
|
-
const
|
|
2800
|
-
if (U.switchViewMap_.has(
|
|
2801
|
-
this.debugMe("NAV:VIEW:MAP",
|
|
2802
|
-
else if (this.#t.has(
|
|
2803
|
-
const F = this.#t.get(
|
|
2804
|
-
this.debugMe("NAV:NEW:VIEW",
|
|
2811
|
+
navTo = (w) => {
|
|
2812
|
+
w.history = !0;
|
|
2813
|
+
const D = w.view, U = this.#e;
|
|
2814
|
+
if (U.switchViewMap_.has(D))
|
|
2815
|
+
this.debugMe("NAV:VIEW:MAP", w), U.switchViewMap_.get(D)(w);
|
|
2816
|
+
else if (this.#t.has(D)) {
|
|
2817
|
+
const F = this.#t.get(D)(w.pk, w);
|
|
2818
|
+
this.debugMe("NAV:NEW:VIEW", w), this.switchView(F);
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
function _isPlaceholder(O) {
|
|
2823
|
+
return O != null && typeof O == "object" && O["@@functional/placeholder"] === !0;
|
|
2824
|
+
}
|
|
2825
|
+
function _curry1(O) {
|
|
2826
|
+
return function w(D) {
|
|
2827
|
+
return arguments.length === 0 || _isPlaceholder(D) ? w : O.apply(this, arguments);
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
function _curry2(O) {
|
|
2831
|
+
return function w(D, U) {
|
|
2832
|
+
switch (arguments.length) {
|
|
2833
|
+
case 0:
|
|
2834
|
+
return w;
|
|
2835
|
+
case 1:
|
|
2836
|
+
return _isPlaceholder(D) ? w : _curry1(function(F) {
|
|
2837
|
+
return O(D, F);
|
|
2838
|
+
});
|
|
2839
|
+
default:
|
|
2840
|
+
return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry1(function(F) {
|
|
2841
|
+
return O(F, U);
|
|
2842
|
+
}) : _isPlaceholder(U) ? _curry1(function(F) {
|
|
2843
|
+
return O(D, F);
|
|
2844
|
+
}) : O(D, U);
|
|
2845
|
+
}
|
|
2846
|
+
};
|
|
2847
|
+
}
|
|
2848
|
+
function _concat(O, w) {
|
|
2849
|
+
O = O || [], w = w || [];
|
|
2850
|
+
var D, U = O.length, F = w.length, q = [];
|
|
2851
|
+
for (D = 0; D < U; )
|
|
2852
|
+
q[q.length] = O[D], D += 1;
|
|
2853
|
+
for (D = 0; D < F; )
|
|
2854
|
+
q[q.length] = w[D], D += 1;
|
|
2855
|
+
return q;
|
|
2856
|
+
}
|
|
2857
|
+
function _arity(O, w) {
|
|
2858
|
+
switch (O) {
|
|
2859
|
+
case 0:
|
|
2860
|
+
return function() {
|
|
2861
|
+
return w.apply(this, arguments);
|
|
2862
|
+
};
|
|
2863
|
+
case 1:
|
|
2864
|
+
return function(D) {
|
|
2865
|
+
return w.apply(this, arguments);
|
|
2866
|
+
};
|
|
2867
|
+
case 2:
|
|
2868
|
+
return function(D, U) {
|
|
2869
|
+
return w.apply(this, arguments);
|
|
2870
|
+
};
|
|
2871
|
+
case 3:
|
|
2872
|
+
return function(D, U, F) {
|
|
2873
|
+
return w.apply(this, arguments);
|
|
2874
|
+
};
|
|
2875
|
+
case 4:
|
|
2876
|
+
return function(D, U, F, q) {
|
|
2877
|
+
return w.apply(this, arguments);
|
|
2878
|
+
};
|
|
2879
|
+
case 5:
|
|
2880
|
+
return function(D, U, F, q, W) {
|
|
2881
|
+
return w.apply(this, arguments);
|
|
2882
|
+
};
|
|
2883
|
+
case 6:
|
|
2884
|
+
return function(D, U, F, q, W, Y) {
|
|
2885
|
+
return w.apply(this, arguments);
|
|
2886
|
+
};
|
|
2887
|
+
case 7:
|
|
2888
|
+
return function(D, U, F, q, W, Y, G) {
|
|
2889
|
+
return w.apply(this, arguments);
|
|
2890
|
+
};
|
|
2891
|
+
case 8:
|
|
2892
|
+
return function(D, U, F, q, W, Y, G, Z) {
|
|
2893
|
+
return w.apply(this, arguments);
|
|
2894
|
+
};
|
|
2895
|
+
case 9:
|
|
2896
|
+
return function(D, U, F, q, W, Y, G, Z, Q) {
|
|
2897
|
+
return w.apply(this, arguments);
|
|
2898
|
+
};
|
|
2899
|
+
case 10:
|
|
2900
|
+
return function(D, U, F, q, W, Y, G, Z, Q, tt) {
|
|
2901
|
+
return w.apply(this, arguments);
|
|
2902
|
+
};
|
|
2903
|
+
default:
|
|
2904
|
+
throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
function _curryN(O, w, D) {
|
|
2908
|
+
return function() {
|
|
2909
|
+
for (var U = [], F = 0, q = O, W = 0, Y = !1; W < w.length || F < arguments.length; ) {
|
|
2910
|
+
var G;
|
|
2911
|
+
W < w.length && (!_isPlaceholder(w[W]) || F >= arguments.length) ? G = w[W] : (G = arguments[F], F += 1), U[W] = G, _isPlaceholder(G) ? Y = !0 : q -= 1, W += 1;
|
|
2805
2912
|
}
|
|
2913
|
+
return !Y && q <= 0 ? D.apply(this, U) : _arity(Math.max(0, q), _curryN(O, U, D));
|
|
2806
2914
|
};
|
|
2807
2915
|
}
|
|
2916
|
+
var curryN = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
2917
|
+
return w === 1 ? _curry1(D) : _arity(w, _curryN(w, [], D));
|
|
2918
|
+
});
|
|
2919
|
+
function _curry3(O) {
|
|
2920
|
+
return function w(D, U, F) {
|
|
2921
|
+
switch (arguments.length) {
|
|
2922
|
+
case 0:
|
|
2923
|
+
return w;
|
|
2924
|
+
case 1:
|
|
2925
|
+
return _isPlaceholder(D) ? w : _curry2(function(q, W) {
|
|
2926
|
+
return O(D, q, W);
|
|
2927
|
+
});
|
|
2928
|
+
case 2:
|
|
2929
|
+
return _isPlaceholder(D) && _isPlaceholder(U) ? w : _isPlaceholder(D) ? _curry2(function(q, W) {
|
|
2930
|
+
return O(q, U, W);
|
|
2931
|
+
}) : _isPlaceholder(U) ? _curry2(function(q, W) {
|
|
2932
|
+
return O(D, q, W);
|
|
2933
|
+
}) : _curry1(function(q) {
|
|
2934
|
+
return O(D, U, q);
|
|
2935
|
+
});
|
|
2936
|
+
default:
|
|
2937
|
+
return _isPlaceholder(D) && _isPlaceholder(U) && _isPlaceholder(F) ? w : _isPlaceholder(D) && _isPlaceholder(U) ? _curry2(function(q, W) {
|
|
2938
|
+
return O(q, W, F);
|
|
2939
|
+
}) : _isPlaceholder(D) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2940
|
+
return O(q, U, W);
|
|
2941
|
+
}) : _isPlaceholder(U) && _isPlaceholder(F) ? _curry2(function(q, W) {
|
|
2942
|
+
return O(D, q, W);
|
|
2943
|
+
}) : _isPlaceholder(D) ? _curry1(function(q) {
|
|
2944
|
+
return O(q, U, F);
|
|
2945
|
+
}) : _isPlaceholder(U) ? _curry1(function(q) {
|
|
2946
|
+
return O(D, q, F);
|
|
2947
|
+
}) : _isPlaceholder(F) ? _curry1(function(q) {
|
|
2948
|
+
return O(D, U, q);
|
|
2949
|
+
}) : O(D, U, F);
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
const _isArray = Array.isArray || function O(w) {
|
|
2954
|
+
return w != null && w.length >= 0 && Object.prototype.toString.call(w) === "[object Array]";
|
|
2955
|
+
};
|
|
2956
|
+
function _isTransformer(O) {
|
|
2957
|
+
return O != null && typeof O["@@transducer/step"] == "function";
|
|
2958
|
+
}
|
|
2959
|
+
function _dispatchable(O, w, D) {
|
|
2960
|
+
return function() {
|
|
2961
|
+
if (arguments.length === 0)
|
|
2962
|
+
return D();
|
|
2963
|
+
var U = arguments[arguments.length - 1];
|
|
2964
|
+
if (!_isArray(U)) {
|
|
2965
|
+
for (var F = 0; F < O.length; ) {
|
|
2966
|
+
if (typeof U[O[F]] == "function")
|
|
2967
|
+
return U[O[F]].apply(U, Array.prototype.slice.call(arguments, 0, -1));
|
|
2968
|
+
F += 1;
|
|
2969
|
+
}
|
|
2970
|
+
if (_isTransformer(U)) {
|
|
2971
|
+
var q = w.apply(null, Array.prototype.slice.call(arguments, 0, -1));
|
|
2972
|
+
return q(U);
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return D.apply(this, arguments);
|
|
2976
|
+
};
|
|
2977
|
+
}
|
|
2978
|
+
const _xfBase = {
|
|
2979
|
+
init: function() {
|
|
2980
|
+
return this.xf["@@transducer/init"]();
|
|
2981
|
+
},
|
|
2982
|
+
result: function(O) {
|
|
2983
|
+
return this.xf["@@transducer/result"](O);
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
function _has(O, w) {
|
|
2987
|
+
return Object.prototype.hasOwnProperty.call(w, O);
|
|
2988
|
+
}
|
|
2989
|
+
var toString = Object.prototype.toString, _isArguments = /* @__PURE__ */ (function() {
|
|
2990
|
+
return toString.call(arguments) === "[object Arguments]" ? function(w) {
|
|
2991
|
+
return toString.call(w) === "[object Arguments]";
|
|
2992
|
+
} : function(w) {
|
|
2993
|
+
return _has("callee", w);
|
|
2994
|
+
};
|
|
2995
|
+
})(), hasEnumBug = !/* @__PURE__ */ {
|
|
2996
|
+
toString: null
|
|
2997
|
+
}.propertyIsEnumerable("toString"), nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"], hasArgsEnumBug = /* @__PURE__ */ (function() {
|
|
2998
|
+
return arguments.propertyIsEnumerable("length");
|
|
2999
|
+
})(), contains = function O(w, D) {
|
|
3000
|
+
for (var U = 0; U < w.length; ) {
|
|
3001
|
+
if (w[U] === D)
|
|
3002
|
+
return !0;
|
|
3003
|
+
U += 1;
|
|
3004
|
+
}
|
|
3005
|
+
return !1;
|
|
3006
|
+
}, keys = /* @__PURE__ */ _curry1(typeof Object.keys == "function" && !hasArgsEnumBug ? function O(w) {
|
|
3007
|
+
return Object(w) !== w ? [] : Object.keys(w);
|
|
3008
|
+
} : function O(w) {
|
|
3009
|
+
if (Object(w) !== w)
|
|
3010
|
+
return [];
|
|
3011
|
+
var D, U, F = [], q = hasArgsEnumBug && _isArguments(w);
|
|
3012
|
+
for (D in w)
|
|
3013
|
+
_has(D, w) && (!q || D !== "length") && (F[F.length] = D);
|
|
3014
|
+
if (hasEnumBug)
|
|
3015
|
+
for (U = nonEnumerableProps.length - 1; U >= 0; )
|
|
3016
|
+
D = nonEnumerableProps[U], _has(D, w) && !contains(F, D) && (F[F.length] = D), U -= 1;
|
|
3017
|
+
return F;
|
|
3018
|
+
});
|
|
3019
|
+
function _map(O, w) {
|
|
3020
|
+
for (var D = 0, U = w.length, F = Array(U); D < U; )
|
|
3021
|
+
F[D] = O(w[D]), D += 1;
|
|
3022
|
+
return F;
|
|
3023
|
+
}
|
|
3024
|
+
function _arrayReduce(O, w, D) {
|
|
3025
|
+
for (var U = 0, F = D.length; U < F; )
|
|
3026
|
+
w = O(w, D[U]), U += 1;
|
|
3027
|
+
return w;
|
|
3028
|
+
}
|
|
3029
|
+
var XMap = /* @__PURE__ */ (function() {
|
|
3030
|
+
function O(w, D) {
|
|
3031
|
+
this.xf = D, this.f = w;
|
|
3032
|
+
}
|
|
3033
|
+
return O.prototype["@@transducer/init"] = _xfBase.init, O.prototype["@@transducer/result"] = _xfBase.result, O.prototype["@@transducer/step"] = function(w, D) {
|
|
3034
|
+
return this.xf["@@transducer/step"](w, this.f(D));
|
|
3035
|
+
}, O;
|
|
3036
|
+
})(), _xmap = function O(w) {
|
|
3037
|
+
return function(D) {
|
|
3038
|
+
return new XMap(w, D);
|
|
3039
|
+
};
|
|
3040
|
+
}, map = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], _xmap, function O(w, D) {
|
|
3041
|
+
switch (Object.prototype.toString.call(D)) {
|
|
3042
|
+
case "[object Function]":
|
|
3043
|
+
return curryN(D.length, function() {
|
|
3044
|
+
return w.call(this, D.apply(this, arguments));
|
|
3045
|
+
});
|
|
3046
|
+
case "[object Object]":
|
|
3047
|
+
return _arrayReduce(function(U, F) {
|
|
3048
|
+
return U[F] = w(D[F]), U;
|
|
3049
|
+
}, {}, keys(D));
|
|
3050
|
+
default:
|
|
3051
|
+
return _map(w, D);
|
|
3052
|
+
}
|
|
3053
|
+
}));
|
|
3054
|
+
const _isInteger = Number.isInteger || function O(w) {
|
|
3055
|
+
return w << 0 === w;
|
|
3056
|
+
};
|
|
3057
|
+
function _nth(O, w) {
|
|
3058
|
+
var D = O < 0 ? w.length + O : O;
|
|
3059
|
+
return w[D];
|
|
3060
|
+
}
|
|
3061
|
+
function _prop(O, w) {
|
|
3062
|
+
if (w != null)
|
|
3063
|
+
return _isInteger(O) ? _nth(O, w) : w[O];
|
|
3064
|
+
}
|
|
3065
|
+
function _isString(O) {
|
|
3066
|
+
return Object.prototype.toString.call(O) === "[object String]";
|
|
3067
|
+
}
|
|
3068
|
+
var _isArrayLike = /* @__PURE__ */ _curry1(function O(w) {
|
|
3069
|
+
return _isArray(w) ? !0 : !w || typeof w != "object" || _isString(w) ? !1 : w.length === 0 ? !0 : w.length > 0 ? w.hasOwnProperty(0) && w.hasOwnProperty(w.length - 1) : !1;
|
|
3070
|
+
}), symIterator = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
|
|
3071
|
+
function _createReduce(O, w, D) {
|
|
3072
|
+
return function(F, q, W) {
|
|
3073
|
+
if (_isArrayLike(W))
|
|
3074
|
+
return O(F, q, W);
|
|
3075
|
+
if (W == null)
|
|
3076
|
+
return q;
|
|
3077
|
+
if (typeof W["fantasy-land/reduce"] == "function")
|
|
3078
|
+
return w(F, q, W, "fantasy-land/reduce");
|
|
3079
|
+
if (W[symIterator] != null)
|
|
3080
|
+
return D(F, q, W[symIterator]());
|
|
3081
|
+
if (typeof W.next == "function")
|
|
3082
|
+
return D(F, q, W);
|
|
3083
|
+
if (typeof W.reduce == "function")
|
|
3084
|
+
return w(F, q, W, "reduce");
|
|
3085
|
+
throw new TypeError("reduce: list must be array or iterable");
|
|
3086
|
+
};
|
|
3087
|
+
}
|
|
3088
|
+
var and = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3089
|
+
return w && D;
|
|
3090
|
+
});
|
|
3091
|
+
function _iterableReduce(O, w, D) {
|
|
3092
|
+
for (var U = D.next(); !U.done; )
|
|
3093
|
+
w = O(w, U.value), U = D.next();
|
|
3094
|
+
return w;
|
|
3095
|
+
}
|
|
3096
|
+
function _methodReduce(O, w, D, U) {
|
|
3097
|
+
return D[U](O, w);
|
|
3098
|
+
}
|
|
3099
|
+
var _reduce = /* @__PURE__ */ _createReduce(_arrayReduce, _methodReduce, _iterableReduce), ap = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3100
|
+
return typeof D["fantasy-land/ap"] == "function" ? D["fantasy-land/ap"](w) : typeof w.ap == "function" ? w.ap(D) : typeof w == "function" ? function(U) {
|
|
3101
|
+
return w(U)(D(U));
|
|
3102
|
+
} : _reduce(function(U, F) {
|
|
3103
|
+
return _concat(U, map(F, D));
|
|
3104
|
+
}, [], w);
|
|
3105
|
+
});
|
|
3106
|
+
function _assoc(O, w, D) {
|
|
3107
|
+
if (_isInteger(O) && _isArray(D)) {
|
|
3108
|
+
var U = O < 0 ? D.length + O : O, F = [].concat(D);
|
|
3109
|
+
return F[U] = w, F;
|
|
3110
|
+
}
|
|
3111
|
+
var q = {};
|
|
3112
|
+
for (var W in D)
|
|
3113
|
+
q[W] = D[W];
|
|
3114
|
+
return q[O] = w, q;
|
|
3115
|
+
}
|
|
3116
|
+
var isNil = /* @__PURE__ */ _curry1(function O(w) {
|
|
3117
|
+
return w == null;
|
|
3118
|
+
}), assocPath = /* @__PURE__ */ _curry3(function O(w, D, U) {
|
|
3119
|
+
if (w.length === 0)
|
|
3120
|
+
return D;
|
|
3121
|
+
var F = w[0];
|
|
3122
|
+
if (w.length > 1) {
|
|
3123
|
+
var q = _prop(F, U);
|
|
3124
|
+
(isNil(q) || typeof q != "object") && (q = _isInteger(w[1]) ? [] : {}), D = O(Array.prototype.slice.call(w, 1), D, q);
|
|
3125
|
+
}
|
|
3126
|
+
return _assoc(F, D, U);
|
|
3127
|
+
});
|
|
3128
|
+
function _isFunction(O) {
|
|
3129
|
+
var w = Object.prototype.toString.call(O);
|
|
3130
|
+
return w === "[object Function]" || w === "[object AsyncFunction]" || w === "[object GeneratorFunction]" || w === "[object AsyncGeneratorFunction]";
|
|
3131
|
+
}
|
|
3132
|
+
var liftN = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3133
|
+
var U = curryN(w, D);
|
|
3134
|
+
return curryN(w, function() {
|
|
3135
|
+
return _arrayReduce(ap, map(U, arguments[0]), Array.prototype.slice.call(arguments, 1));
|
|
3136
|
+
});
|
|
3137
|
+
}), lift = /* @__PURE__ */ _curry1(function O(w) {
|
|
3138
|
+
return liftN(w.length, w);
|
|
3139
|
+
}), both = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3140
|
+
return _isFunction(w) ? function() {
|
|
3141
|
+
return w.apply(this, arguments) && D.apply(this, arguments);
|
|
3142
|
+
} : lift(and)(w, D);
|
|
3143
|
+
}), hasPath = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3144
|
+
if (w.length === 0 || isNil(D))
|
|
3145
|
+
return !1;
|
|
3146
|
+
for (var U = D, F = 0; F < w.length; )
|
|
3147
|
+
if (!isNil(U) && _has(w[F], U))
|
|
3148
|
+
U = U[w[F]], F += 1;
|
|
3149
|
+
else
|
|
3150
|
+
return !1;
|
|
3151
|
+
return !0;
|
|
3152
|
+
}), has = /* @__PURE__ */ _curry2(function O(w, D) {
|
|
3153
|
+
return hasPath([w], D);
|
|
3154
|
+
});
|
|
3155
|
+
function _path(O, w) {
|
|
3156
|
+
for (var D = w, U = 0; U < O.length; U += 1) {
|
|
3157
|
+
if (D == null)
|
|
3158
|
+
return;
|
|
3159
|
+
var F = O[U];
|
|
3160
|
+
_isInteger(F) ? D = _nth(F, D) : D = D[F];
|
|
3161
|
+
}
|
|
3162
|
+
return D;
|
|
3163
|
+
}
|
|
3164
|
+
var path = /* @__PURE__ */ _curry2(_path);
|
|
2808
3165
|
const DEFAULT_FORMATTERS = {
|
|
2809
3166
|
/**
|
|
2810
3167
|
* Format as JSON (useful for debugging)
|
|
2811
3168
|
*/
|
|
2812
|
-
json: (O) => JSON.stringify(O, null, 2)
|
|
3169
|
+
json: (O) => JSON.stringify(O, null, 2),
|
|
3170
|
+
/**
|
|
3171
|
+
* Format date as "DD MMM YY HH:mm:ss" (e.g., "10 Nov 25 11:27:49")
|
|
3172
|
+
* Accepts ISO date strings, timestamps, or Date objects.
|
|
3173
|
+
* Returns empty string for null/undefined values.
|
|
3174
|
+
*/
|
|
3175
|
+
date: (O) => {
|
|
3176
|
+
if (!O) return "";
|
|
3177
|
+
const w = O instanceof Date ? O : new Date(O);
|
|
3178
|
+
return isNaN(w.getTime()) ? (console.warn("[Binder] Invalid date value:", O), "") : dateToZooyStdTimeString(w);
|
|
3179
|
+
}
|
|
2813
3180
|
};
|
|
2814
|
-
class
|
|
3181
|
+
class Binder {
|
|
2815
3182
|
#t;
|
|
2816
3183
|
#e;
|
|
2817
3184
|
#s;
|
|
2818
|
-
#r =
|
|
3185
|
+
#r = null;
|
|
2819
3186
|
#n;
|
|
2820
|
-
#i;
|
|
2821
|
-
#o;
|
|
2822
3187
|
/**
|
|
2823
|
-
* Creates a new
|
|
3188
|
+
* Creates a new Binder instance.
|
|
2824
3189
|
*
|
|
2825
|
-
* @param {
|
|
2826
|
-
* @param {string}
|
|
2827
|
-
* @param {
|
|
2828
|
-
* @param
|
|
2829
|
-
* @param {string} [options.
|
|
2830
|
-
* @param {Function} [options.fetchFn] - Custom fetch function (for authentication, etc.)
|
|
3190
|
+
* @param {zooy.Panel} panel
|
|
3191
|
+
* @param {string} url - API endpoint URL
|
|
3192
|
+
* @param {Element} rootEl - Root element to walk for bindings
|
|
3193
|
+
* @param options
|
|
3194
|
+
* @param {Object<string, string|number>} [options.urlParams] - Configuration options
|
|
2831
3195
|
* @param {Object<string, Function>} [options.formatters] - Custom formatters
|
|
2832
|
-
* @throws {Error} If
|
|
3196
|
+
* @throws {Error} If url or rootEl is missing/invalid
|
|
2833
3197
|
*/
|
|
2834
|
-
constructor(D = {}) {
|
|
2835
|
-
if (!D
|
|
2836
|
-
throw new Error("
|
|
2837
|
-
if (!
|
|
2838
|
-
throw new Error("
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
3198
|
+
constructor(w, D, U, F = {}) {
|
|
3199
|
+
if (!D)
|
|
3200
|
+
throw new Error("Binder requires a URL");
|
|
3201
|
+
if (!U || !(U instanceof Element))
|
|
3202
|
+
throw new Error("Binder requires a valid rootEl Element");
|
|
3203
|
+
this.#t = w, this.#e = new URL(D, window.location.origin), this.#s = U, this.#n = { ...DEFAULT_FORMATTERS, ...F.formatters }, F.urlParams && this.#i(F.urlParams);
|
|
3204
|
+
}
|
|
3205
|
+
get url() {
|
|
3206
|
+
return this.#e;
|
|
3207
|
+
}
|
|
3208
|
+
get data() {
|
|
3209
|
+
return this.#r;
|
|
3210
|
+
}
|
|
3211
|
+
get limit() {
|
|
3212
|
+
return parseInt(this.#e.searchParams.get("limit") || "0", 10);
|
|
3213
|
+
}
|
|
3214
|
+
get offset() {
|
|
3215
|
+
return parseInt(this.#e.searchParams.get("offset") || "0", 10);
|
|
3216
|
+
}
|
|
3217
|
+
get isPaginated() {
|
|
3218
|
+
return both(has("count"), has("results"))(this.#r);
|
|
3219
|
+
}
|
|
3220
|
+
#i(w) {
|
|
3221
|
+
return Object.entries(w).forEach(([D, U]) => {
|
|
3222
|
+
if (U == null || U === "") {
|
|
3223
|
+
this.#e.searchParams.delete(D);
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
if (Array.isArray(U)) {
|
|
3227
|
+
this.#e.searchParams.set(D, U.join(","));
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
this.#e.searchParams.set(D, U);
|
|
3231
|
+
}), this.#e;
|
|
2842
3232
|
}
|
|
2843
3233
|
/**
|
|
2844
|
-
*
|
|
2845
|
-
*
|
|
3234
|
+
* Fetches data from the configured URL with optional query parameters.
|
|
3235
|
+
* Data is automatically bound to the DOM via setData() after fetch completes.
|
|
2846
3236
|
*
|
|
2847
|
-
* @param {Object} [
|
|
2848
|
-
* @return {Promise<
|
|
2849
|
-
* @throws {Error} If fetch fails or
|
|
2850
|
-
*/
|
|
2851
|
-
async
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
Object.entries(D).forEach(([q, W]) => {
|
|
2858
|
-
isDefAndNotNull(W) && w.searchParams.set(q, W);
|
|
2859
|
-
});
|
|
2860
|
-
const U = await this.#o(w.toString()), F = U instanceof Response ? U.ok ? await U.json() : Promise.reject(new Error(`HTTP ${U.status}: ${U.statusText}`)) : U;
|
|
2861
|
-
if (this.#r = this.#u(F), !Array.isArray(this.#r))
|
|
2862
|
-
throw new Error("Extracted data is not an array");
|
|
2863
|
-
return this.render(), this.#c("data-loaded", { data: this.#r }), this.#r;
|
|
2864
|
-
} catch (w) {
|
|
2865
|
-
throw this.#c("data-error", { error: w }), w;
|
|
2866
|
-
}
|
|
3237
|
+
* @param {Object} [urlParams={}] - Query parameters to append to URL (e.g., {limit: 25, offset: 0, ordering: 'name'})
|
|
3238
|
+
* @return {Promise<void>}
|
|
3239
|
+
* @throws {Error} If fetch fails or response is invalid
|
|
3240
|
+
*/
|
|
3241
|
+
async fetchData(w = {}) {
|
|
3242
|
+
const D = await this.#t.user.fetchJson(
|
|
3243
|
+
this.#i(w).toString(),
|
|
3244
|
+
this.#t.abortController.signal
|
|
3245
|
+
);
|
|
3246
|
+
this.setData(D);
|
|
2867
3247
|
}
|
|
2868
3248
|
/**
|
|
2869
3249
|
* Sets data directly without fetching from URL.
|
|
2870
|
-
*
|
|
3250
|
+
* This is the convergence point for all data updates (from fetchData() or external sources).
|
|
2871
3251
|
*
|
|
2872
|
-
*
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
}
|
|
2877
|
-
/**
|
|
2878
|
-
* Gets the current data array.
|
|
3252
|
+
* Behavior:
|
|
3253
|
+
* - Stores full JSON object (not just arrays)
|
|
3254
|
+
* - Calls render() to update the DOM
|
|
3255
|
+
* - render() extracts appropriate slices for each consumer
|
|
2879
3256
|
*
|
|
2880
|
-
* @
|
|
3257
|
+
* @param {Object} data - Full JSON response object
|
|
2881
3258
|
*/
|
|
2882
|
-
|
|
2883
|
-
|
|
3259
|
+
setData(w) {
|
|
3260
|
+
this.#r = w, this.render();
|
|
2884
3261
|
}
|
|
2885
3262
|
/**
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
3263
|
+
* Renders data by walking the rootEl element and processing all bindings.
|
|
3264
|
+
*
|
|
3265
|
+
* Supports two binding patterns:
|
|
3266
|
+
* 1. Simple property binding - Direct zoo-bind attributes on elements (no templates)
|
|
3267
|
+
* 2. Template rendering - Elements with zoo-template duplicate for arrays
|
|
3268
|
+
*
|
|
3269
|
+
* Algorithm:
|
|
3270
|
+
* 1. Process simple bindings (zoo-bind, zoo-bind-attr outside template consumers)
|
|
3271
|
+
* 2. Process template consumers (elements with zoo-template attribute)
|
|
3272
|
+
* - Get template ID and optional zoo-template-bind
|
|
3273
|
+
* - Extract data slice using Ramda's R.path()
|
|
3274
|
+
* - Clear consumer and clone template for each item
|
|
3275
|
+
*
|
|
3276
|
+
* Multiple consumers can exist in the same rootEl, each rendering different slices
|
|
3277
|
+
* of the same JSON response (e.g., results, metadata, alerts).
|
|
2888
3278
|
*/
|
|
2889
3279
|
render() {
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
/**
|
|
2896
|
-
* Disposes of this DataBinder instance.
|
|
2897
|
-
* Clears data and container.
|
|
2898
|
-
*/
|
|
2899
|
-
dispose() {
|
|
2900
|
-
this.#r = [], this.#s.innerHTML = "", this.#e = null, this.#s = null;
|
|
3280
|
+
if (!isDefAndNotNull(this.#r)) {
|
|
3281
|
+
console.warn("[Binder] No data to render");
|
|
3282
|
+
return;
|
|
3283
|
+
}
|
|
3284
|
+
this.#o(this.#s, this.#r, 0), this.#a();
|
|
2901
3285
|
}
|
|
2902
3286
|
/**
|
|
2903
|
-
* Renders
|
|
3287
|
+
* Renders simple property bindings directly to existing elements.
|
|
3288
|
+
* Processes zoo-bind-attr, zoo-bind, and conditional rendering attributes.
|
|
2904
3289
|
*
|
|
2905
|
-
*
|
|
2906
|
-
*
|
|
2907
|
-
* @return {DocumentFragment} Rendered template clone
|
|
2908
|
-
* @private
|
|
2909
|
-
*/
|
|
2910
|
-
#a(D, w) {
|
|
2911
|
-
const U = this.#e.content.cloneNode(!0);
|
|
2912
|
-
return this.#d(U, D, w), U.querySelectorAll("[data-bind]").forEach((F) => {
|
|
2913
|
-
this.#h(F, D, w);
|
|
2914
|
-
}), U.querySelectorAll("[data-show-if]").forEach((F) => {
|
|
2915
|
-
const q = F.getAttribute("data-show-if");
|
|
2916
|
-
this.#l(D, q, w) || F.remove();
|
|
2917
|
-
}), U.querySelectorAll("[data-hide-if]").forEach((F) => {
|
|
2918
|
-
const q = F.getAttribute("data-hide-if");
|
|
2919
|
-
this.#l(D, q, w) && F.remove();
|
|
2920
|
-
}), U.querySelectorAll("[data-bind]").forEach((F) => {
|
|
2921
|
-
F.removeAttribute("data-bind"), F.removeAttribute("data-format");
|
|
2922
|
-
}), U.querySelectorAll("[data-bind-attr]").forEach((F) => {
|
|
2923
|
-
F.removeAttribute("data-bind-attr");
|
|
2924
|
-
}), U.querySelectorAll("[data-show-if]").forEach((F) => {
|
|
2925
|
-
F.removeAttribute("data-show-if");
|
|
2926
|
-
}), U.querySelectorAll("[data-hide-if]").forEach((F) => {
|
|
2927
|
-
F.removeAttribute("data-hide-if");
|
|
2928
|
-
}), U;
|
|
2929
|
-
}
|
|
2930
|
-
/**
|
|
2931
|
-
* Binds data to element content.
|
|
3290
|
+
* This method is reusable and can be called with different elements and data objects.
|
|
3291
|
+
* Used for both rootEl-level simple bindings and template item rendering.
|
|
2932
3292
|
*
|
|
2933
|
-
* @param {Element}
|
|
2934
|
-
* @param {Object}
|
|
2935
|
-
* @param {number} index -
|
|
3293
|
+
* @param {Element|DocumentFragment} element - Root element to search for bindings
|
|
3294
|
+
* @param {Object} data - Data object to bind
|
|
3295
|
+
* @param {number} [index=0] - Current index (for $index and $index1 special variables)
|
|
3296
|
+
* @param {Object} [options={}] - Rendering options
|
|
3297
|
+
* @param {boolean} [options.removeOnCondition=false] - Remove elements on failed conditions (vs hiding with display:none)
|
|
3298
|
+
* @param {boolean} [options.removeAttributes=false] - Remove binding attributes after processing (vs keeping for re-render)
|
|
2936
3299
|
* @private
|
|
2937
3300
|
*/
|
|
2938
|
-
#
|
|
2939
|
-
const
|
|
2940
|
-
|
|
2941
|
-
|
|
3301
|
+
#o(w, D, U = 0, F = {}) {
|
|
3302
|
+
const q = F.removeAttributes ?? !1;
|
|
3303
|
+
w.querySelectorAll("[zoo-bind-attr]").forEach((W) => {
|
|
3304
|
+
if (W.closest("[zoo-template]")) return;
|
|
3305
|
+
W.getAttribute("zoo-bind-attr").split(",").forEach((G) => {
|
|
3306
|
+
const [Z, Q] = G.split(":").map((J) => J.trim()), tt = this.#c(D, Q, U);
|
|
3307
|
+
isDefAndNotNull(tt) && W.setAttribute(Z, tt);
|
|
3308
|
+
}), q && W.removeAttribute("zoo-bind-attr");
|
|
3309
|
+
}), w.querySelectorAll("[zoo-bind]").forEach((W) => {
|
|
3310
|
+
if (W.closest("[zoo-template]")) return;
|
|
3311
|
+
const Y = W.getAttribute("zoo-bind"), G = W.getAttribute("zoo-bind-format");
|
|
3312
|
+
let Z = this.#c(D, Y, U);
|
|
3313
|
+
G && this.#n[G] && (Z = this.#n[G](Z, D)), W.textContent = Z ?? "", q && (W.removeAttribute("zoo-bind"), W.removeAttribute("zoo-bind-format"));
|
|
3314
|
+
});
|
|
2942
3315
|
}
|
|
2943
3316
|
/**
|
|
2944
|
-
*
|
|
2945
|
-
* Supports syntax: data-bind-attr="attr1:path1, attr2:path2"
|
|
3317
|
+
* Renders template consumers by duplicating templates for array data.
|
|
2946
3318
|
*
|
|
2947
|
-
* @param {DocumentFragment} clone - Template clone
|
|
2948
|
-
* @param {Object} item - Data object
|
|
2949
|
-
* @param {number} index - Item index
|
|
2950
3319
|
* @private
|
|
2951
3320
|
*/
|
|
2952
|
-
#
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3321
|
+
#a() {
|
|
3322
|
+
this.#s.querySelectorAll("[zoo-template]").forEach((D) => {
|
|
3323
|
+
const U = D.getAttribute("zoo-template"), F = D.getAttribute("zoo-template-bind");
|
|
3324
|
+
if (!U) {
|
|
3325
|
+
console.warn("[Binder] Consumer missing template ID", D);
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
const q = this.#s.querySelector(`#${U}`);
|
|
3329
|
+
if (!q || q.tagName !== "TEMPLATE") {
|
|
3330
|
+
console.error(`[DataBinder] Template not found or invalid: ${U}`);
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
const W = F ? path(F.split("."), this.#r) : this.#r;
|
|
3334
|
+
if (!W) {
|
|
3335
|
+
console.warn(`[DataBinder] Data slice is undefined. Path: ${F}. Skipping render for this consumer.`);
|
|
3336
|
+
return;
|
|
3337
|
+
}
|
|
3338
|
+
if (!Array.isArray(W)) {
|
|
3339
|
+
console.error(`[DataBinder] Data slice is not an array. Path: ${F}`, W);
|
|
3340
|
+
return;
|
|
3341
|
+
}
|
|
3342
|
+
D.innerHTML = "", W.forEach((Y, G) => {
|
|
3343
|
+
const Z = this.#l(q, Y, G);
|
|
3344
|
+
D.appendChild(Z);
|
|
2960
3345
|
});
|
|
2961
3346
|
});
|
|
2962
3347
|
}
|
|
2963
3348
|
/**
|
|
2964
|
-
*
|
|
2965
|
-
*
|
|
3349
|
+
* Renders a single item from a template.
|
|
3350
|
+
* Uses the unified rendering method with options for template-specific behavior.
|
|
2966
3351
|
*
|
|
2967
|
-
* @param {
|
|
2968
|
-
* @param {
|
|
2969
|
-
* @param {number} index - Item index
|
|
2970
|
-
* @return {
|
|
3352
|
+
* @param {HTMLTemplateElement} template - Template element
|
|
3353
|
+
* @param {Object} item - Data object
|
|
3354
|
+
* @param {number} index - Item index in array
|
|
3355
|
+
* @return {DocumentFragment} Rendered template clone
|
|
2971
3356
|
* @private
|
|
2972
3357
|
*/
|
|
2973
|
-
#l(
|
|
2974
|
-
|
|
3358
|
+
#l(w, D, U) {
|
|
3359
|
+
const F = w.content.cloneNode(!0);
|
|
3360
|
+
return this.#o(F, D, U, {
|
|
3361
|
+
removeAttributes: !0
|
|
3362
|
+
}), F;
|
|
2975
3363
|
}
|
|
2976
3364
|
/**
|
|
2977
|
-
*
|
|
2978
|
-
* Tries common patterns: json.rows, json.data, json.items, or json itself.
|
|
3365
|
+
* Gets a value from an object using dot notation.
|
|
2979
3366
|
*
|
|
2980
|
-
*
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
return this.#i ? this.#i.split(".").reduce((w, U) => w?.[U], D) : D.rows ? D.rows : D.data ? D.data : D.items ? D.items : Array.isArray(D) ? D : (console.warn("DataBinder: Could not extract data array from response", D), []);
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* Dispatches a custom event on the container.
|
|
3367
|
+
* Special Variables:
|
|
3368
|
+
* - $index: 0-based row number (within current page)
|
|
3369
|
+
* - $index1: 1-based row number (within current page)
|
|
3370
|
+
* - $index__paged: 0-based row number (accounts for pagination offset)
|
|
3371
|
+
* - $index1__paged: 1-based row number (accounts for pagination offset)
|
|
2989
3372
|
*
|
|
2990
|
-
* @param {
|
|
2991
|
-
* @param {
|
|
3373
|
+
* @param {Object} obj - Object to query
|
|
3374
|
+
* @param {string} pathString - Dot-separated path (e.g., "profile.name") or special variable ($index, $index1, $index__paged, $index1__paged)
|
|
3375
|
+
* @param {number} index - Item index in current data array (0-based)
|
|
3376
|
+
* @return {*} The value, or undefined if not found
|
|
2992
3377
|
* @private
|
|
2993
3378
|
*/
|
|
2994
|
-
#c(D,
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3379
|
+
#c(w, D, U) {
|
|
3380
|
+
const F = {
|
|
3381
|
+
$index: () => U,
|
|
3382
|
+
$index__paged: () => this.offset + U,
|
|
3383
|
+
$index1: () => U + 1,
|
|
3384
|
+
$index1__paged: () => this.offset + U + 1
|
|
3385
|
+
};
|
|
3386
|
+
return F[D] ? F[D]() : path(D.split("."), w);
|
|
2999
3387
|
}
|
|
3000
3388
|
}
|
|
3001
|
-
const
|
|
3002
|
-
// Event attributes
|
|
3003
|
-
"event",
|
|
3004
|
-
"change-event",
|
|
3005
|
-
"open-event",
|
|
3006
|
-
"close-event",
|
|
3007
|
-
"primary-event",
|
|
3008
|
-
// Data/Record identification
|
|
3009
|
-
"record-id",
|
|
3010
|
-
"record-type",
|
|
3011
|
-
// URLs/Endpoints
|
|
3012
|
-
"endpoint",
|
|
3013
|
-
"url",
|
|
3014
|
-
// Actions/Operations
|
|
3015
|
-
"action",
|
|
3016
|
-
"method",
|
|
3017
|
-
// Targeting
|
|
3018
|
-
"target"
|
|
3019
|
-
], ATTRIBUTE_TO_PROPERTY = {
|
|
3389
|
+
const SEMANTIC_ATTRS = new Map(Object.entries({
|
|
3020
3390
|
event: "event",
|
|
3021
|
-
"change-event": "changeEvent",
|
|
3022
|
-
"open-event": "openEvent",
|
|
3023
|
-
"close-event": "closeEvent",
|
|
3024
|
-
"primary-event": "primaryEvent",
|
|
3025
|
-
"record-id": "recordId",
|
|
3026
|
-
"record-type": "recordType",
|
|
3027
3391
|
endpoint: "endpoint",
|
|
3392
|
+
href: "href",
|
|
3028
3393
|
url: "url",
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
}), Array.from(O.attributes).forEach((w) => {
|
|
3041
|
-
if (w.name.startsWith("data-")) {
|
|
3042
|
-
const U = w.name.slice(5).replace(/-([a-z])/g, (F, q) => q.toUpperCase());
|
|
3043
|
-
D[U] = w.value;
|
|
3044
|
-
}
|
|
3045
|
-
}), D;
|
|
3046
|
-
}, getEventName = (O) => O.getAttribute("event"), getEventAttribute = (O, D, w = "event") => O.getAttribute(D) || O.getAttribute(w);
|
|
3394
|
+
target: "target",
|
|
3395
|
+
"record-id": "recordId",
|
|
3396
|
+
"zoo-sort-field": "sortField",
|
|
3397
|
+
"zoo-view": "view"
|
|
3398
|
+
})), getSemanticAttributes = (O) => {
|
|
3399
|
+
let w = {};
|
|
3400
|
+
return Array.from(O.attributes).forEach((D) => {
|
|
3401
|
+
const U = D.name, F = D.value;
|
|
3402
|
+
SEMANTIC_ATTRS.has(U) ? w[SEMANTIC_ATTRS.get(U)] = F : (U.startsWith("data-") || U.startsWith("zoo-")) && (w = assocPath(U.split("-"), F, w));
|
|
3403
|
+
}), w;
|
|
3404
|
+
}, getEventAttribute = (O, w, D = "event") => O.getAttribute(w) || O.getAttribute(D);
|
|
3047
3405
|
/**
|
|
3048
3406
|
* @license
|
|
3049
3407
|
* Copyright 2019 Google LLC
|
|
@@ -3051,48 +3409,48 @@ const SEMANTIC_ATTRIBUTES = [
|
|
|
3051
3409
|
*/
|
|
3052
3410
|
const t$1 = globalThis, e$2 = t$1.ShadowRoot && (t$1.ShadyCSS === void 0 || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$3 = /* @__PURE__ */ new WeakMap();
|
|
3053
3411
|
let n$2 = class {
|
|
3054
|
-
constructor(
|
|
3412
|
+
constructor(w, D, U) {
|
|
3055
3413
|
if (this._$cssResult$ = !0, U !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
3056
|
-
this.cssText =
|
|
3414
|
+
this.cssText = w, this.t = D;
|
|
3057
3415
|
}
|
|
3058
3416
|
get styleSheet() {
|
|
3059
|
-
let
|
|
3060
|
-
const
|
|
3061
|
-
if (e$2 &&
|
|
3062
|
-
const U =
|
|
3063
|
-
U && (
|
|
3417
|
+
let w = this.o;
|
|
3418
|
+
const D = this.t;
|
|
3419
|
+
if (e$2 && w === void 0) {
|
|
3420
|
+
const U = D !== void 0 && D.length === 1;
|
|
3421
|
+
U && (w = o$3.get(D)), w === void 0 && ((this.o = w = new CSSStyleSheet()).replaceSync(this.cssText), U && o$3.set(D, w));
|
|
3064
3422
|
}
|
|
3065
|
-
return
|
|
3423
|
+
return w;
|
|
3066
3424
|
}
|
|
3067
3425
|
toString() {
|
|
3068
3426
|
return this.cssText;
|
|
3069
3427
|
}
|
|
3070
3428
|
};
|
|
3071
|
-
const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...
|
|
3072
|
-
const
|
|
3429
|
+
const r$2 = (O) => new n$2(typeof O == "string" ? O : O + "", void 0, s$2), i$3 = (O, ...w) => {
|
|
3430
|
+
const D = O.length === 1 ? O[0] : w.reduce(((U, F, q) => U + ((W) => {
|
|
3073
3431
|
if (W._$cssResult$ === !0) return W.cssText;
|
|
3074
3432
|
if (typeof W == "number") return W;
|
|
3075
3433
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + W + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
3076
3434
|
})(F) + O[q + 1]), O[0]);
|
|
3077
|
-
return new n$2(
|
|
3078
|
-
}, S$1 = (O,
|
|
3079
|
-
if (e$2) O.adoptedStyleSheets =
|
|
3080
|
-
else for (const
|
|
3435
|
+
return new n$2(D, O, s$2);
|
|
3436
|
+
}, S$1 = (O, w) => {
|
|
3437
|
+
if (e$2) O.adoptedStyleSheets = w.map(((D) => D instanceof CSSStyleSheet ? D : D.styleSheet));
|
|
3438
|
+
else for (const D of w) {
|
|
3081
3439
|
const U = document.createElement("style"), F = t$1.litNonce;
|
|
3082
|
-
F !== void 0 && U.setAttribute("nonce", F), U.textContent =
|
|
3440
|
+
F !== void 0 && U.setAttribute("nonce", F), U.textContent = D.cssText, O.appendChild(U);
|
|
3083
3441
|
}
|
|
3084
|
-
}, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((
|
|
3085
|
-
let
|
|
3086
|
-
for (const U of
|
|
3087
|
-
return r$2(
|
|
3442
|
+
}, c$2 = e$2 ? (O) => O : (O) => O instanceof CSSStyleSheet ? ((w) => {
|
|
3443
|
+
let D = "";
|
|
3444
|
+
for (const U of w.cssRules) D += U.cssText;
|
|
3445
|
+
return r$2(D);
|
|
3088
3446
|
})(O) : O;
|
|
3089
3447
|
/**
|
|
3090
3448
|
* @license
|
|
3091
3449
|
* Copyright 2017 Google LLC
|
|
3092
3450
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3093
3451
|
*/
|
|
3094
|
-
const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$1, getOwnPropertySymbols: o$2, getPrototypeOf: n$1 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (O,
|
|
3095
|
-
switch (
|
|
3452
|
+
const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$1, getOwnPropertySymbols: o$2, getPrototypeOf: n$1 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (O, w) => O, u$1 = { toAttribute(O, w) {
|
|
3453
|
+
switch (w) {
|
|
3096
3454
|
case Boolean:
|
|
3097
3455
|
O = O ? l$1 : null;
|
|
3098
3456
|
break;
|
|
@@ -3101,156 +3459,156 @@ const { is: i$2, defineProperty: e$1, getOwnPropertyDescriptor: h$1, getOwnPrope
|
|
|
3101
3459
|
O = O == null ? O : JSON.stringify(O);
|
|
3102
3460
|
}
|
|
3103
3461
|
return O;
|
|
3104
|
-
}, fromAttribute(O,
|
|
3105
|
-
let
|
|
3106
|
-
switch (
|
|
3462
|
+
}, fromAttribute(O, w) {
|
|
3463
|
+
let D = O;
|
|
3464
|
+
switch (w) {
|
|
3107
3465
|
case Boolean:
|
|
3108
|
-
|
|
3466
|
+
D = O !== null;
|
|
3109
3467
|
break;
|
|
3110
3468
|
case Number:
|
|
3111
|
-
|
|
3469
|
+
D = O === null ? null : Number(O);
|
|
3112
3470
|
break;
|
|
3113
3471
|
case Object:
|
|
3114
3472
|
case Array:
|
|
3115
3473
|
try {
|
|
3116
|
-
|
|
3474
|
+
D = JSON.parse(O);
|
|
3117
3475
|
} catch {
|
|
3118
|
-
|
|
3476
|
+
D = null;
|
|
3119
3477
|
}
|
|
3120
3478
|
}
|
|
3121
|
-
return
|
|
3122
|
-
} }, f$1 = (O,
|
|
3479
|
+
return D;
|
|
3480
|
+
} }, f$1 = (O, w) => !i$2(O, w), b$1 = { attribute: !0, type: String, converter: u$1, reflect: !1, useDefault: !1, hasChanged: f$1 };
|
|
3123
3481
|
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
3124
3482
|
let y$1 = class extends HTMLElement {
|
|
3125
|
-
static addInitializer(
|
|
3126
|
-
this._$Ei(), (this.l ??= []).push(
|
|
3483
|
+
static addInitializer(w) {
|
|
3484
|
+
this._$Ei(), (this.l ??= []).push(w);
|
|
3127
3485
|
}
|
|
3128
3486
|
static get observedAttributes() {
|
|
3129
3487
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
3130
3488
|
}
|
|
3131
|
-
static createProperty(
|
|
3132
|
-
if (
|
|
3133
|
-
const U = Symbol(), F = this.getPropertyDescriptor(
|
|
3134
|
-
F !== void 0 && e$1(this.prototype,
|
|
3489
|
+
static createProperty(w, D = b$1) {
|
|
3490
|
+
if (D.state && (D.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(w) && ((D = Object.create(D)).wrapped = !0), this.elementProperties.set(w, D), !D.noAccessor) {
|
|
3491
|
+
const U = Symbol(), F = this.getPropertyDescriptor(w, U, D);
|
|
3492
|
+
F !== void 0 && e$1(this.prototype, w, F);
|
|
3135
3493
|
}
|
|
3136
3494
|
}
|
|
3137
|
-
static getPropertyDescriptor(
|
|
3138
|
-
const { get: F, set: q } = h$1(this.prototype,
|
|
3139
|
-
return this[
|
|
3495
|
+
static getPropertyDescriptor(w, D, U) {
|
|
3496
|
+
const { get: F, set: q } = h$1(this.prototype, w) ?? { get() {
|
|
3497
|
+
return this[D];
|
|
3140
3498
|
}, set(W) {
|
|
3141
|
-
this[
|
|
3499
|
+
this[D] = W;
|
|
3142
3500
|
} };
|
|
3143
3501
|
return { get: F, set(W) {
|
|
3144
|
-
const
|
|
3145
|
-
q?.call(this, W), this.requestUpdate(
|
|
3502
|
+
const Y = F?.call(this);
|
|
3503
|
+
q?.call(this, W), this.requestUpdate(w, Y, U);
|
|
3146
3504
|
}, configurable: !0, enumerable: !0 };
|
|
3147
3505
|
}
|
|
3148
|
-
static getPropertyOptions(
|
|
3149
|
-
return this.elementProperties.get(
|
|
3506
|
+
static getPropertyOptions(w) {
|
|
3507
|
+
return this.elementProperties.get(w) ?? b$1;
|
|
3150
3508
|
}
|
|
3151
3509
|
static _$Ei() {
|
|
3152
3510
|
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
3153
|
-
const
|
|
3154
|
-
|
|
3511
|
+
const w = n$1(this);
|
|
3512
|
+
w.finalize(), w.l !== void 0 && (this.l = [...w.l]), this.elementProperties = new Map(w.elementProperties);
|
|
3155
3513
|
}
|
|
3156
3514
|
static finalize() {
|
|
3157
3515
|
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
3158
3516
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
3159
|
-
const
|
|
3160
|
-
for (const F of U) this.createProperty(F,
|
|
3517
|
+
const D = this.properties, U = [...r$1(D), ...o$2(D)];
|
|
3518
|
+
for (const F of U) this.createProperty(F, D[F]);
|
|
3161
3519
|
}
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3164
|
-
const
|
|
3165
|
-
if (
|
|
3520
|
+
const w = this[Symbol.metadata];
|
|
3521
|
+
if (w !== null) {
|
|
3522
|
+
const D = litPropertyMetadata.get(w);
|
|
3523
|
+
if (D !== void 0) for (const [U, F] of D) this.elementProperties.set(U, F);
|
|
3166
3524
|
}
|
|
3167
3525
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
3168
|
-
for (const [
|
|
3169
|
-
const F = this._$Eu(
|
|
3170
|
-
F !== void 0 && this._$Eh.set(F,
|
|
3526
|
+
for (const [D, U] of this.elementProperties) {
|
|
3527
|
+
const F = this._$Eu(D, U);
|
|
3528
|
+
F !== void 0 && this._$Eh.set(F, D);
|
|
3171
3529
|
}
|
|
3172
3530
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
3173
3531
|
}
|
|
3174
|
-
static finalizeStyles(
|
|
3175
|
-
const
|
|
3176
|
-
if (Array.isArray(
|
|
3177
|
-
const U = new Set(
|
|
3178
|
-
for (const F of U)
|
|
3179
|
-
} else
|
|
3180
|
-
return
|
|
3532
|
+
static finalizeStyles(w) {
|
|
3533
|
+
const D = [];
|
|
3534
|
+
if (Array.isArray(w)) {
|
|
3535
|
+
const U = new Set(w.flat(1 / 0).reverse());
|
|
3536
|
+
for (const F of U) D.unshift(c$2(F));
|
|
3537
|
+
} else w !== void 0 && D.push(c$2(w));
|
|
3538
|
+
return D;
|
|
3181
3539
|
}
|
|
3182
|
-
static _$Eu(
|
|
3183
|
-
const U =
|
|
3184
|
-
return U === !1 ? void 0 : typeof U == "string" ? U : typeof
|
|
3540
|
+
static _$Eu(w, D) {
|
|
3541
|
+
const U = D.attribute;
|
|
3542
|
+
return U === !1 ? void 0 : typeof U == "string" ? U : typeof w == "string" ? w.toLowerCase() : void 0;
|
|
3185
3543
|
}
|
|
3186
3544
|
constructor() {
|
|
3187
3545
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
3188
3546
|
}
|
|
3189
3547
|
_$Ev() {
|
|
3190
|
-
this._$ES = new Promise(((
|
|
3548
|
+
this._$ES = new Promise(((w) => this.enableUpdating = w)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((w) => w(this)));
|
|
3191
3549
|
}
|
|
3192
|
-
addController(
|
|
3193
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(
|
|
3550
|
+
addController(w) {
|
|
3551
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(w), this.renderRoot !== void 0 && this.isConnected && w.hostConnected?.();
|
|
3194
3552
|
}
|
|
3195
|
-
removeController(
|
|
3196
|
-
this._$EO?.delete(
|
|
3553
|
+
removeController(w) {
|
|
3554
|
+
this._$EO?.delete(w);
|
|
3197
3555
|
}
|
|
3198
3556
|
_$E_() {
|
|
3199
|
-
const
|
|
3200
|
-
for (const U of
|
|
3201
|
-
|
|
3557
|
+
const w = /* @__PURE__ */ new Map(), D = this.constructor.elementProperties;
|
|
3558
|
+
for (const U of D.keys()) this.hasOwnProperty(U) && (w.set(U, this[U]), delete this[U]);
|
|
3559
|
+
w.size > 0 && (this._$Ep = w);
|
|
3202
3560
|
}
|
|
3203
3561
|
createRenderRoot() {
|
|
3204
|
-
const
|
|
3205
|
-
return S$1(
|
|
3562
|
+
const w = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
3563
|
+
return S$1(w, this.constructor.elementStyles), w;
|
|
3206
3564
|
}
|
|
3207
3565
|
connectedCallback() {
|
|
3208
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((
|
|
3566
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((w) => w.hostConnected?.()));
|
|
3209
3567
|
}
|
|
3210
|
-
enableUpdating(
|
|
3568
|
+
enableUpdating(w) {
|
|
3211
3569
|
}
|
|
3212
3570
|
disconnectedCallback() {
|
|
3213
|
-
this._$EO?.forEach(((
|
|
3571
|
+
this._$EO?.forEach(((w) => w.hostDisconnected?.()));
|
|
3214
3572
|
}
|
|
3215
|
-
attributeChangedCallback(
|
|
3216
|
-
this._$AK(
|
|
3573
|
+
attributeChangedCallback(w, D, U) {
|
|
3574
|
+
this._$AK(w, U);
|
|
3217
3575
|
}
|
|
3218
|
-
_$ET(
|
|
3219
|
-
const U = this.constructor.elementProperties.get(
|
|
3576
|
+
_$ET(w, D) {
|
|
3577
|
+
const U = this.constructor.elementProperties.get(w), F = this.constructor._$Eu(w, U);
|
|
3220
3578
|
if (F !== void 0 && U.reflect === !0) {
|
|
3221
|
-
const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(
|
|
3222
|
-
this._$Em =
|
|
3579
|
+
const q = (U.converter?.toAttribute !== void 0 ? U.converter : u$1).toAttribute(D, U.type);
|
|
3580
|
+
this._$Em = w, q == null ? this.removeAttribute(F) : this.setAttribute(F, q), this._$Em = null;
|
|
3223
3581
|
}
|
|
3224
3582
|
}
|
|
3225
|
-
_$AK(
|
|
3226
|
-
const U = this.constructor, F = U._$Eh.get(
|
|
3583
|
+
_$AK(w, D) {
|
|
3584
|
+
const U = this.constructor, F = U._$Eh.get(w);
|
|
3227
3585
|
if (F !== void 0 && this._$Em !== F) {
|
|
3228
3586
|
const q = U.getPropertyOptions(F), W = typeof q.converter == "function" ? { fromAttribute: q.converter } : q.converter?.fromAttribute !== void 0 ? q.converter : u$1;
|
|
3229
3587
|
this._$Em = F;
|
|
3230
|
-
const
|
|
3231
|
-
this[F] =
|
|
3588
|
+
const Y = W.fromAttribute(D, q.type);
|
|
3589
|
+
this[F] = Y ?? this._$Ej?.get(F) ?? Y, this._$Em = null;
|
|
3232
3590
|
}
|
|
3233
3591
|
}
|
|
3234
|
-
requestUpdate(
|
|
3235
|
-
if (
|
|
3236
|
-
const F = this.constructor, q = this[
|
|
3237
|
-
if (U ??= F.getPropertyOptions(
|
|
3238
|
-
this.C(
|
|
3592
|
+
requestUpdate(w, D, U) {
|
|
3593
|
+
if (w !== void 0) {
|
|
3594
|
+
const F = this.constructor, q = this[w];
|
|
3595
|
+
if (U ??= F.getPropertyOptions(w), !((U.hasChanged ?? f$1)(q, D) || U.useDefault && U.reflect && q === this._$Ej?.get(w) && !this.hasAttribute(F._$Eu(w, U)))) return;
|
|
3596
|
+
this.C(w, D, U);
|
|
3239
3597
|
}
|
|
3240
3598
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
3241
3599
|
}
|
|
3242
|
-
C(
|
|
3243
|
-
U && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(
|
|
3600
|
+
C(w, D, { useDefault: U, reflect: F, wrapped: q }, W) {
|
|
3601
|
+
U && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(w) && (this._$Ej.set(w, W ?? D ?? this[w]), q !== !0 || W !== void 0) || (this._$AL.has(w) || (this.hasUpdated || U || (D = void 0), this._$AL.set(w, D)), F === !0 && this._$Em !== w && (this._$Eq ??= /* @__PURE__ */ new Set()).add(w));
|
|
3244
3602
|
}
|
|
3245
3603
|
async _$EP() {
|
|
3246
3604
|
this.isUpdatePending = !0;
|
|
3247
3605
|
try {
|
|
3248
3606
|
await this._$ES;
|
|
3249
|
-
} catch (
|
|
3250
|
-
Promise.reject(
|
|
3607
|
+
} catch (D) {
|
|
3608
|
+
Promise.reject(D);
|
|
3251
3609
|
}
|
|
3252
|
-
const
|
|
3253
|
-
return
|
|
3610
|
+
const w = this.scheduleUpdate();
|
|
3611
|
+
return w != null && await w, !this.isUpdatePending;
|
|
3254
3612
|
}
|
|
3255
3613
|
scheduleUpdate() {
|
|
3256
3614
|
return this.performUpdate();
|
|
@@ -3264,23 +3622,23 @@ let y$1 = class extends HTMLElement {
|
|
|
3264
3622
|
}
|
|
3265
3623
|
const U = this.constructor.elementProperties;
|
|
3266
3624
|
if (U.size > 0) for (const [F, q] of U) {
|
|
3267
|
-
const { wrapped: W } = q,
|
|
3268
|
-
W !== !0 || this._$AL.has(F) ||
|
|
3625
|
+
const { wrapped: W } = q, Y = this[F];
|
|
3626
|
+
W !== !0 || this._$AL.has(F) || Y === void 0 || this.C(F, void 0, q, Y);
|
|
3269
3627
|
}
|
|
3270
3628
|
}
|
|
3271
|
-
let
|
|
3272
|
-
const
|
|
3629
|
+
let w = !1;
|
|
3630
|
+
const D = this._$AL;
|
|
3273
3631
|
try {
|
|
3274
|
-
|
|
3632
|
+
w = this.shouldUpdate(D), w ? (this.willUpdate(D), this._$EO?.forEach(((U) => U.hostUpdate?.())), this.update(D)) : this._$EM();
|
|
3275
3633
|
} catch (U) {
|
|
3276
|
-
throw
|
|
3634
|
+
throw w = !1, this._$EM(), U;
|
|
3277
3635
|
}
|
|
3278
|
-
|
|
3636
|
+
w && this._$AE(D);
|
|
3279
3637
|
}
|
|
3280
|
-
willUpdate(
|
|
3638
|
+
willUpdate(w) {
|
|
3281
3639
|
}
|
|
3282
|
-
_$AE(
|
|
3283
|
-
this._$EO?.forEach(((
|
|
3640
|
+
_$AE(w) {
|
|
3641
|
+
this._$EO?.forEach(((D) => D.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(w)), this.updated(w);
|
|
3284
3642
|
}
|
|
3285
3643
|
_$EM() {
|
|
3286
3644
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -3291,15 +3649,15 @@ let y$1 = class extends HTMLElement {
|
|
|
3291
3649
|
getUpdateComplete() {
|
|
3292
3650
|
return this._$ES;
|
|
3293
3651
|
}
|
|
3294
|
-
shouldUpdate(
|
|
3652
|
+
shouldUpdate(w) {
|
|
3295
3653
|
return !0;
|
|
3296
3654
|
}
|
|
3297
|
-
update(
|
|
3298
|
-
this._$Eq &&= this._$Eq.forEach(((
|
|
3655
|
+
update(w) {
|
|
3656
|
+
this._$Eq &&= this._$Eq.forEach(((D) => this._$ET(D, this[D]))), this._$EM();
|
|
3299
3657
|
}
|
|
3300
|
-
updated(
|
|
3658
|
+
updated(w) {
|
|
3301
3659
|
}
|
|
3302
|
-
firstUpdated(
|
|
3660
|
+
firstUpdated(w) {
|
|
3303
3661
|
}
|
|
3304
3662
|
};
|
|
3305
3663
|
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
@@ -3310,44 +3668,44 @@ y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("eleme
|
|
|
3310
3668
|
*/
|
|
3311
3669
|
const t = globalThis, i$1 = t.trustedTypes, s$1 = i$1 ? i$1.createPolicy("lit-html", { createHTML: (O) => O }) : void 0, e = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (O) => O === null || typeof O != "object" && typeof O != "function", a = Array.isArray, u = (O) => a(O) || typeof O?.[Symbol.iterator] == "function", d = `[
|
|
3312
3670
|
\f\r]`, f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
3313
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (
|
|
3314
|
-
function P(O,
|
|
3671
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (O) => (w, ...D) => ({ _$litType$: O, strings: w, values: D }), x = y(1), b = y(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
|
|
3672
|
+
function P(O, w) {
|
|
3315
3673
|
if (!a(O) || !O.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
3316
|
-
return s$1 !== void 0 ? s$1.createHTML(
|
|
3674
|
+
return s$1 !== void 0 ? s$1.createHTML(w) : w;
|
|
3317
3675
|
}
|
|
3318
|
-
const V = (O,
|
|
3319
|
-
const
|
|
3320
|
-
let F, q =
|
|
3321
|
-
for (let
|
|
3322
|
-
const G = O[
|
|
3323
|
-
let
|
|
3324
|
-
for (; J < G.length && (W.lastIndex = J, Q = W.exec(G), Q !== null); ) J = W.lastIndex, W === f ? Q[1] === "!--" ? W = v : Q[1] !== void 0 ? W = _ : Q[2] !== void 0 ? ($.test(Q[2]) && (F = RegExp("</" + Q[2], "g")), W = m) : Q[3] !== void 0 && (W = m) : W === m ? Q[0] === ">" ? (W = F ?? f, tt = -1) : Q[1] === void 0 ? tt = -2 : (tt = W.lastIndex - Q[2].length,
|
|
3325
|
-
const
|
|
3326
|
-
q += W === f ? G + n : tt >= 0 ? (U.push(
|
|
3327
|
-
}
|
|
3328
|
-
return [P(O, q + (O[
|
|
3676
|
+
const V = (O, w) => {
|
|
3677
|
+
const D = O.length - 1, U = [];
|
|
3678
|
+
let F, q = w === 2 ? "<svg>" : w === 3 ? "<math>" : "", W = f;
|
|
3679
|
+
for (let Y = 0; Y < D; Y++) {
|
|
3680
|
+
const G = O[Y];
|
|
3681
|
+
let Z, Q, tt = -1, J = 0;
|
|
3682
|
+
for (; J < G.length && (W.lastIndex = J, Q = W.exec(G), Q !== null); ) J = W.lastIndex, W === f ? Q[1] === "!--" ? W = v : Q[1] !== void 0 ? W = _ : Q[2] !== void 0 ? ($.test(Q[2]) && (F = RegExp("</" + Q[2], "g")), W = m) : Q[3] !== void 0 && (W = m) : W === m ? Q[0] === ">" ? (W = F ?? f, tt = -1) : Q[1] === void 0 ? tt = -2 : (tt = W.lastIndex - Q[2].length, Z = Q[1], W = Q[3] === void 0 ? m : Q[3] === '"' ? g : p) : W === g || W === p ? W = m : W === v || W === _ ? W = f : (W = m, F = void 0);
|
|
3683
|
+
const X = W === m && O[Y + 1].startsWith("/>") ? " " : "";
|
|
3684
|
+
q += W === f ? G + n : tt >= 0 ? (U.push(Z), G.slice(0, tt) + e + G.slice(tt) + h + X) : G + h + (tt === -2 ? Y : X);
|
|
3685
|
+
}
|
|
3686
|
+
return [P(O, q + (O[D] || "<?>") + (w === 2 ? "</svg>" : w === 3 ? "</math>" : "")), U];
|
|
3329
3687
|
};
|
|
3330
3688
|
class N {
|
|
3331
|
-
constructor({ strings:
|
|
3689
|
+
constructor({ strings: w, _$litType$: D }, U) {
|
|
3332
3690
|
let F;
|
|
3333
3691
|
this.parts = [];
|
|
3334
3692
|
let q = 0, W = 0;
|
|
3335
|
-
const
|
|
3336
|
-
if (this.el = N.createElement(
|
|
3693
|
+
const Y = w.length - 1, G = this.parts, [Z, Q] = V(w, D);
|
|
3694
|
+
if (this.el = N.createElement(Z, U), C.currentNode = this.el.content, D === 2 || D === 3) {
|
|
3337
3695
|
const tt = this.el.content.firstChild;
|
|
3338
3696
|
tt.replaceWith(...tt.childNodes);
|
|
3339
3697
|
}
|
|
3340
|
-
for (; (F = C.nextNode()) !== null && G.length <
|
|
3698
|
+
for (; (F = C.nextNode()) !== null && G.length < Y; ) {
|
|
3341
3699
|
if (F.nodeType === 1) {
|
|
3342
3700
|
if (F.hasAttributes()) for (const tt of F.getAttributeNames()) if (tt.endsWith(e)) {
|
|
3343
|
-
const J = Q[W++],
|
|
3344
|
-
G.push({ type: 1, index: q, name:
|
|
3701
|
+
const J = Q[W++], X = F.getAttribute(tt).split(h), K = /([.?@])?(.*)/.exec(J);
|
|
3702
|
+
G.push({ type: 1, index: q, name: K[2], strings: X, ctor: K[1] === "." ? H : K[1] === "?" ? I : K[1] === "@" ? L : k }), F.removeAttribute(tt);
|
|
3345
3703
|
} else tt.startsWith(h) && (G.push({ type: 6, index: q }), F.removeAttribute(tt));
|
|
3346
3704
|
if ($.test(F.tagName)) {
|
|
3347
3705
|
const tt = F.textContent.split(h), J = tt.length - 1;
|
|
3348
3706
|
if (J > 0) {
|
|
3349
3707
|
F.textContent = i$1 ? i$1.emptyScript : "";
|
|
3350
|
-
for (let
|
|
3708
|
+
for (let X = 0; X < J; X++) F.append(tt[X], l()), C.nextNode(), G.push({ type: 2, index: ++q });
|
|
3351
3709
|
F.append(tt[J], l());
|
|
3352
3710
|
}
|
|
3353
3711
|
}
|
|
@@ -3359,20 +3717,20 @@ class N {
|
|
|
3359
3717
|
q++;
|
|
3360
3718
|
}
|
|
3361
3719
|
}
|
|
3362
|
-
static createElement(
|
|
3720
|
+
static createElement(w, D) {
|
|
3363
3721
|
const U = r.createElement("template");
|
|
3364
|
-
return U.innerHTML =
|
|
3722
|
+
return U.innerHTML = w, U;
|
|
3365
3723
|
}
|
|
3366
3724
|
}
|
|
3367
|
-
function S(O,
|
|
3368
|
-
if (
|
|
3369
|
-
let F = U !== void 0 ?
|
|
3370
|
-
const q = c(
|
|
3371
|
-
return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O,
|
|
3725
|
+
function S(O, w, D = O, U) {
|
|
3726
|
+
if (w === T) return w;
|
|
3727
|
+
let F = U !== void 0 ? D._$Co?.[U] : D._$Cl;
|
|
3728
|
+
const q = c(w) ? void 0 : w._$litDirective$;
|
|
3729
|
+
return F?.constructor !== q && (F?._$AO?.(!1), q === void 0 ? F = void 0 : (F = new q(O), F._$AT(O, D, U)), U !== void 0 ? (D._$Co ??= [])[U] = F : D._$Cl = F), F !== void 0 && (w = S(O, F._$AS(O, w.values), F, U)), w;
|
|
3372
3730
|
}
|
|
3373
3731
|
class M {
|
|
3374
|
-
constructor(
|
|
3375
|
-
this._$AV = [], this._$AN = void 0, this._$AD =
|
|
3732
|
+
constructor(w, D) {
|
|
3733
|
+
this._$AV = [], this._$AN = void 0, this._$AD = w, this._$AM = D;
|
|
3376
3734
|
}
|
|
3377
3735
|
get parentNode() {
|
|
3378
3736
|
return this._$AM.parentNode;
|
|
@@ -3380,35 +3738,35 @@ class M {
|
|
|
3380
3738
|
get _$AU() {
|
|
3381
3739
|
return this._$AM._$AU;
|
|
3382
3740
|
}
|
|
3383
|
-
u(
|
|
3384
|
-
const { el: { content:
|
|
3741
|
+
u(w) {
|
|
3742
|
+
const { el: { content: D }, parts: U } = this._$AD, F = (w?.creationScope ?? r).importNode(D, !0);
|
|
3385
3743
|
C.currentNode = F;
|
|
3386
|
-
let q = C.nextNode(), W = 0,
|
|
3744
|
+
let q = C.nextNode(), W = 0, Y = 0, G = U[0];
|
|
3387
3745
|
for (; G !== void 0; ) {
|
|
3388
3746
|
if (W === G.index) {
|
|
3389
|
-
let
|
|
3390
|
-
G.type === 2 ?
|
|
3747
|
+
let Z;
|
|
3748
|
+
G.type === 2 ? Z = new R(q, q.nextSibling, this, w) : G.type === 1 ? Z = new G.ctor(q, G.name, G.strings, this, w) : G.type === 6 && (Z = new z(q, this, w)), this._$AV.push(Z), G = U[++Y];
|
|
3391
3749
|
}
|
|
3392
3750
|
W !== G?.index && (q = C.nextNode(), W++);
|
|
3393
3751
|
}
|
|
3394
3752
|
return C.currentNode = r, F;
|
|
3395
3753
|
}
|
|
3396
|
-
p(
|
|
3397
|
-
let
|
|
3398
|
-
for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(
|
|
3754
|
+
p(w) {
|
|
3755
|
+
let D = 0;
|
|
3756
|
+
for (const U of this._$AV) U !== void 0 && (U.strings !== void 0 ? (U._$AI(w, U, D), D += U.strings.length - 2) : U._$AI(w[D])), D++;
|
|
3399
3757
|
}
|
|
3400
3758
|
}
|
|
3401
3759
|
class R {
|
|
3402
3760
|
get _$AU() {
|
|
3403
3761
|
return this._$AM?._$AU ?? this._$Cv;
|
|
3404
3762
|
}
|
|
3405
|
-
constructor(
|
|
3406
|
-
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA =
|
|
3763
|
+
constructor(w, D, U, F) {
|
|
3764
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = w, this._$AB = D, this._$AM = U, this.options = F, this._$Cv = F?.isConnected ?? !0;
|
|
3407
3765
|
}
|
|
3408
3766
|
get parentNode() {
|
|
3409
|
-
let
|
|
3410
|
-
const
|
|
3411
|
-
return
|
|
3767
|
+
let w = this._$AA.parentNode;
|
|
3768
|
+
const D = this._$AM;
|
|
3769
|
+
return D !== void 0 && w?.nodeType === 11 && (w = D.parentNode), w;
|
|
3412
3770
|
}
|
|
3413
3771
|
get startNode() {
|
|
3414
3772
|
return this._$AA;
|
|
@@ -3416,45 +3774,45 @@ class R {
|
|
|
3416
3774
|
get endNode() {
|
|
3417
3775
|
return this._$AB;
|
|
3418
3776
|
}
|
|
3419
|
-
_$AI(
|
|
3420
|
-
|
|
3777
|
+
_$AI(w, D = this) {
|
|
3778
|
+
w = S(this, w, D), c(w) ? w === E || w == null || w === "" ? (this._$AH !== E && this._$AR(), this._$AH = E) : w !== this._$AH && w !== T && this._(w) : w._$litType$ !== void 0 ? this.$(w) : w.nodeType !== void 0 ? this.T(w) : u(w) ? this.k(w) : this._(w);
|
|
3421
3779
|
}
|
|
3422
|
-
O(
|
|
3423
|
-
return this._$AA.parentNode.insertBefore(
|
|
3780
|
+
O(w) {
|
|
3781
|
+
return this._$AA.parentNode.insertBefore(w, this._$AB);
|
|
3424
3782
|
}
|
|
3425
|
-
T(
|
|
3426
|
-
this._$AH !==
|
|
3783
|
+
T(w) {
|
|
3784
|
+
this._$AH !== w && (this._$AR(), this._$AH = this.O(w));
|
|
3427
3785
|
}
|
|
3428
|
-
_(
|
|
3429
|
-
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data =
|
|
3786
|
+
_(w) {
|
|
3787
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = w : this.T(r.createTextNode(w)), this._$AH = w;
|
|
3430
3788
|
}
|
|
3431
|
-
$(
|
|
3432
|
-
const { values:
|
|
3433
|
-
if (this._$AH?._$AD === F) this._$AH.p(
|
|
3789
|
+
$(w) {
|
|
3790
|
+
const { values: D, _$litType$: U } = w, F = typeof U == "number" ? this._$AC(w) : (U.el === void 0 && (U.el = N.createElement(P(U.h, U.h[0]), this.options)), U);
|
|
3791
|
+
if (this._$AH?._$AD === F) this._$AH.p(D);
|
|
3434
3792
|
else {
|
|
3435
3793
|
const q = new M(F, this), W = q.u(this.options);
|
|
3436
|
-
q.p(
|
|
3794
|
+
q.p(D), this.T(W), this._$AH = q;
|
|
3437
3795
|
}
|
|
3438
3796
|
}
|
|
3439
|
-
_$AC(
|
|
3440
|
-
let
|
|
3441
|
-
return
|
|
3797
|
+
_$AC(w) {
|
|
3798
|
+
let D = A.get(w.strings);
|
|
3799
|
+
return D === void 0 && A.set(w.strings, D = new N(w)), D;
|
|
3442
3800
|
}
|
|
3443
|
-
k(
|
|
3801
|
+
k(w) {
|
|
3444
3802
|
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
3445
|
-
const
|
|
3803
|
+
const D = this._$AH;
|
|
3446
3804
|
let U, F = 0;
|
|
3447
|
-
for (const q of
|
|
3448
|
-
F <
|
|
3805
|
+
for (const q of w) F === D.length ? D.push(U = new R(this.O(l()), this.O(l()), this, this.options)) : U = D[F], U._$AI(q), F++;
|
|
3806
|
+
F < D.length && (this._$AR(U && U._$AB.nextSibling, F), D.length = F);
|
|
3449
3807
|
}
|
|
3450
|
-
_$AR(
|
|
3451
|
-
for (this._$AP?.(!1, !0,
|
|
3452
|
-
const U =
|
|
3453
|
-
|
|
3808
|
+
_$AR(w = this._$AA.nextSibling, D) {
|
|
3809
|
+
for (this._$AP?.(!1, !0, D); w !== this._$AB; ) {
|
|
3810
|
+
const U = w.nextSibling;
|
|
3811
|
+
w.remove(), w = U;
|
|
3454
3812
|
}
|
|
3455
3813
|
}
|
|
3456
|
-
setConnected(
|
|
3457
|
-
this._$AM === void 0 && (this._$Cv =
|
|
3814
|
+
setConnected(w) {
|
|
3815
|
+
this._$AM === void 0 && (this._$Cv = w, this._$AP?.(w));
|
|
3458
3816
|
}
|
|
3459
3817
|
}
|
|
3460
3818
|
class k {
|
|
@@ -3464,72 +3822,72 @@ class k {
|
|
|
3464
3822
|
get _$AU() {
|
|
3465
3823
|
return this._$AM._$AU;
|
|
3466
3824
|
}
|
|
3467
|
-
constructor(
|
|
3468
|
-
this.type = 1, this._$AH = E, this._$AN = void 0, this.element =
|
|
3825
|
+
constructor(w, D, U, F, q) {
|
|
3826
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = w, this.name = D, this._$AM = F, this.options = q, U.length > 2 || U[0] !== "" || U[1] !== "" ? (this._$AH = Array(U.length - 1).fill(new String()), this.strings = U) : this._$AH = E;
|
|
3469
3827
|
}
|
|
3470
|
-
_$AI(
|
|
3828
|
+
_$AI(w, D = this, U, F) {
|
|
3471
3829
|
const q = this.strings;
|
|
3472
3830
|
let W = !1;
|
|
3473
|
-
if (q === void 0)
|
|
3831
|
+
if (q === void 0) w = S(this, w, D, 0), W = !c(w) || w !== this._$AH && w !== T, W && (this._$AH = w);
|
|
3474
3832
|
else {
|
|
3475
|
-
const
|
|
3476
|
-
let G,
|
|
3477
|
-
for (
|
|
3833
|
+
const Y = w;
|
|
3834
|
+
let G, Z;
|
|
3835
|
+
for (w = q[0], G = 0; G < q.length - 1; G++) Z = S(this, Y[U + G], D, G), Z === T && (Z = this._$AH[G]), W ||= !c(Z) || Z !== this._$AH[G], Z === E ? w = E : w !== E && (w += (Z ?? "") + q[G + 1]), this._$AH[G] = Z;
|
|
3478
3836
|
}
|
|
3479
|
-
W && !F && this.j(
|
|
3837
|
+
W && !F && this.j(w);
|
|
3480
3838
|
}
|
|
3481
|
-
j(
|
|
3482
|
-
|
|
3839
|
+
j(w) {
|
|
3840
|
+
w === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, w ?? "");
|
|
3483
3841
|
}
|
|
3484
3842
|
}
|
|
3485
3843
|
class H extends k {
|
|
3486
3844
|
constructor() {
|
|
3487
3845
|
super(...arguments), this.type = 3;
|
|
3488
3846
|
}
|
|
3489
|
-
j(
|
|
3490
|
-
this.element[this.name] =
|
|
3847
|
+
j(w) {
|
|
3848
|
+
this.element[this.name] = w === E ? void 0 : w;
|
|
3491
3849
|
}
|
|
3492
3850
|
}
|
|
3493
3851
|
class I extends k {
|
|
3494
3852
|
constructor() {
|
|
3495
3853
|
super(...arguments), this.type = 4;
|
|
3496
3854
|
}
|
|
3497
|
-
j(
|
|
3498
|
-
this.element.toggleAttribute(this.name, !!
|
|
3855
|
+
j(w) {
|
|
3856
|
+
this.element.toggleAttribute(this.name, !!w && w !== E);
|
|
3499
3857
|
}
|
|
3500
3858
|
}
|
|
3501
3859
|
class L extends k {
|
|
3502
|
-
constructor(
|
|
3503
|
-
super(
|
|
3860
|
+
constructor(w, D, U, F, q) {
|
|
3861
|
+
super(w, D, U, F, q), this.type = 5;
|
|
3504
3862
|
}
|
|
3505
|
-
_$AI(
|
|
3506
|
-
if ((
|
|
3507
|
-
const U = this._$AH, F =
|
|
3508
|
-
F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this,
|
|
3863
|
+
_$AI(w, D = this) {
|
|
3864
|
+
if ((w = S(this, w, D, 0) ?? E) === T) return;
|
|
3865
|
+
const U = this._$AH, F = w === E && U !== E || w.capture !== U.capture || w.once !== U.once || w.passive !== U.passive, q = w !== E && (U === E || F);
|
|
3866
|
+
F && this.element.removeEventListener(this.name, this, U), q && this.element.addEventListener(this.name, this, w), this._$AH = w;
|
|
3509
3867
|
}
|
|
3510
|
-
handleEvent(
|
|
3511
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element,
|
|
3868
|
+
handleEvent(w) {
|
|
3869
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, w) : this._$AH.handleEvent(w);
|
|
3512
3870
|
}
|
|
3513
3871
|
}
|
|
3514
3872
|
class z {
|
|
3515
|
-
constructor(
|
|
3516
|
-
this.element =
|
|
3873
|
+
constructor(w, D, U) {
|
|
3874
|
+
this.element = w, this.type = 6, this._$AN = void 0, this._$AM = D, this.options = U;
|
|
3517
3875
|
}
|
|
3518
3876
|
get _$AU() {
|
|
3519
3877
|
return this._$AM._$AU;
|
|
3520
3878
|
}
|
|
3521
|
-
_$AI(
|
|
3522
|
-
S(this,
|
|
3879
|
+
_$AI(w) {
|
|
3880
|
+
S(this, w);
|
|
3523
3881
|
}
|
|
3524
3882
|
}
|
|
3525
3883
|
const j = t.litHtmlPolyfillSupport;
|
|
3526
3884
|
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
3527
|
-
const B = (O,
|
|
3528
|
-
const U =
|
|
3885
|
+
const B = (O, w, D) => {
|
|
3886
|
+
const U = D?.renderBefore ?? w;
|
|
3529
3887
|
let F = U._$litPart$;
|
|
3530
3888
|
if (F === void 0) {
|
|
3531
|
-
const q =
|
|
3532
|
-
U._$litPart$ = F = new R(
|
|
3889
|
+
const q = D?.renderBefore ?? null;
|
|
3890
|
+
U._$litPart$ = F = new R(w.insertBefore(l(), q), q, void 0, D ?? {});
|
|
3533
3891
|
}
|
|
3534
3892
|
return F._$AI(O), F;
|
|
3535
3893
|
};
|
|
@@ -3544,12 +3902,12 @@ class i extends y$1 {
|
|
|
3544
3902
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
3545
3903
|
}
|
|
3546
3904
|
createRenderRoot() {
|
|
3547
|
-
const
|
|
3548
|
-
return this.renderOptions.renderBefore ??=
|
|
3905
|
+
const w = super.createRenderRoot();
|
|
3906
|
+
return this.renderOptions.renderBefore ??= w.firstChild, w;
|
|
3549
3907
|
}
|
|
3550
|
-
update(
|
|
3551
|
-
const
|
|
3552
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(
|
|
3908
|
+
update(w) {
|
|
3909
|
+
const D = this.render();
|
|
3910
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(w), this._$Do = B(D, this.renderRoot, this.renderOptions);
|
|
3553
3911
|
}
|
|
3554
3912
|
connectedCallback() {
|
|
3555
3913
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -3567,38 +3925,38 @@ o?.({ LitElement: i });
|
|
|
3567
3925
|
(s.litElementVersions ??= []).push("4.2.1");
|
|
3568
3926
|
class ZooTag extends i {
|
|
3569
3927
|
static properties = {
|
|
3570
|
-
token: { type: String }
|
|
3928
|
+
token: { type: String },
|
|
3929
|
+
prefix: { type: String },
|
|
3930
|
+
postfix: { type: String }
|
|
3571
3931
|
};
|
|
3572
3932
|
static styles = i$3`
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3933
|
+
:host {
|
|
3934
|
+
display: inline-block;
|
|
3935
|
+
}
|
|
3576
3936
|
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
box-sizing: border-box;
|
|
3592
|
-
}
|
|
3937
|
+
.tag {
|
|
3938
|
+
text-align: center;
|
|
3939
|
+
display: inline-flex;
|
|
3940
|
+
align-items: center;
|
|
3941
|
+
justify-content: center;
|
|
3942
|
+
line-height: initial;
|
|
3943
|
+
width: max-content;
|
|
3944
|
+
padding: .2em 1em;
|
|
3945
|
+
border-radius: 1em;
|
|
3946
|
+
font-size: var(--zoo-theme-chips-font-size, 0.75rem);
|
|
3947
|
+
white-space: nowrap;
|
|
3948
|
+
word-break: break-word;
|
|
3949
|
+
box-sizing: border-box;
|
|
3950
|
+
}
|
|
3593
3951
|
`;
|
|
3594
3952
|
render() {
|
|
3595
|
-
const D = this.token ?? "default"
|
|
3953
|
+
const w = this.prefix ?? "", D = this.token ?? "default", U = this.postfix ?? "", F = `${w}${D}${U}`;
|
|
3596
3954
|
return x`
|
|
3597
3955
|
<span
|
|
3598
3956
|
class="tag"
|
|
3599
3957
|
style="
|
|
3600
|
-
background-color: var(--zoo-tag-${
|
|
3601
|
-
color: var(--zoo-tag-${
|
|
3958
|
+
background-color: var(--zoo-tag-${F}-bg, var(--zoo-tag-default-bg, #9e9e9e));
|
|
3959
|
+
color: var(--zoo-tag-${F}-fg, var(--zoo-tag-default-fg, #ffffff));
|
|
3602
3960
|
"
|
|
3603
3961
|
>
|
|
3604
3962
|
<slot></slot>
|
|
@@ -3609,22 +3967,20 @@ class ZooTag extends i {
|
|
|
3609
3967
|
customElements.get("zoo-tag") || customElements.define("zoo-tag", ZooTag);
|
|
3610
3968
|
const zoo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3611
3969
|
__proto__: null,
|
|
3612
|
-
SEMANTIC_ATTRIBUTES,
|
|
3613
3970
|
ZooTag,
|
|
3614
3971
|
getEventAttribute,
|
|
3615
|
-
getEventName,
|
|
3616
3972
|
getSemanticAttributes
|
|
3617
3973
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3618
3974
|
async function registerCarbonLibrary() {
|
|
3619
|
-
const { registerCarbonLibrary: O } = await import("./register-
|
|
3975
|
+
const { registerCarbonLibrary: O } = await import("./register-BCEOkbXG.js");
|
|
3620
3976
|
return O();
|
|
3621
3977
|
}
|
|
3622
3978
|
async function registerMdcLibrary() {
|
|
3623
|
-
const { registerMdcLibrary: O } = await import("./register-
|
|
3979
|
+
const { registerMdcLibrary: O } = await import("./register-Bkr1UKav.js");
|
|
3624
3980
|
return O();
|
|
3625
3981
|
}
|
|
3626
3982
|
const zooy = {
|
|
3627
|
-
|
|
3983
|
+
Evt,
|
|
3628
3984
|
Component,
|
|
3629
3985
|
Dragger,
|
|
3630
3986
|
Panel,
|
|
@@ -3633,7 +3989,7 @@ const zooy = {
|
|
|
3633
3989
|
UserManager,
|
|
3634
3990
|
View,
|
|
3635
3991
|
Conductor,
|
|
3636
|
-
DataBinder,
|
|
3992
|
+
DataBinder: Binder,
|
|
3637
3993
|
UiEventType,
|
|
3638
3994
|
domUtils,
|
|
3639
3995
|
uriUtils,
|
|
@@ -3644,9 +4000,10 @@ const zooy = {
|
|
|
3644
4000
|
zoo
|
|
3645
4001
|
};
|
|
3646
4002
|
export {
|
|
3647
|
-
|
|
4003
|
+
zoo as A,
|
|
4004
|
+
Binder as B,
|
|
3648
4005
|
ComponentLibraryRegistry as C,
|
|
3649
|
-
|
|
4006
|
+
Dragger as D,
|
|
3650
4007
|
E,
|
|
3651
4008
|
FormPanel as F,
|
|
3652
4009
|
Panel as P,
|
|
@@ -3654,28 +4011,31 @@ export {
|
|
|
3654
4011
|
T,
|
|
3655
4012
|
UserManager as U,
|
|
3656
4013
|
View as V,
|
|
4014
|
+
_curry2 as _,
|
|
3657
4015
|
i$3 as a,
|
|
3658
4016
|
b,
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
4017
|
+
isDefAndNotNull as c,
|
|
4018
|
+
getEventAttribute as d,
|
|
4019
|
+
B as e,
|
|
3662
4020
|
f$1 as f,
|
|
3663
4021
|
getSemanticAttributes as g,
|
|
3664
|
-
|
|
4022
|
+
hasPath as h,
|
|
3665
4023
|
i,
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
4024
|
+
getElDataMap as j,
|
|
4025
|
+
treeUtils as k,
|
|
4026
|
+
registerMdcLibrary as l,
|
|
4027
|
+
Evt as m,
|
|
4028
|
+
Component as n,
|
|
4029
|
+
objToPaths as o,
|
|
4030
|
+
path as p,
|
|
4031
|
+
UiEventType as q,
|
|
3674
4032
|
registerCarbonLibrary as r,
|
|
3675
|
-
|
|
4033
|
+
Conductor as s,
|
|
3676
4034
|
toLowerCase as t,
|
|
3677
4035
|
u$1 as u,
|
|
3678
|
-
|
|
4036
|
+
domUtils as v,
|
|
4037
|
+
uriUtils as w,
|
|
3679
4038
|
x,
|
|
4039
|
+
handlers as y,
|
|
3680
4040
|
zooy as z
|
|
3681
4041
|
};
|