dynamic-html-helpers 1.5.5 → 1.5.6
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.
|
@@ -224,40 +224,110 @@ var HTMLHelpers = (() => {
|
|
|
224
224
|
function yt() {
|
|
225
225
|
return ["::backdrop{background-color:grey;opacity:0.2;}", `#jqxPopup{overflow:hidden;background-color:transparent;outline:none;border:none;inset:0;animation:fade-out 0.5s ease-out;&[open]{display:flex;align-items:center;justify-content:center;animation:fade-in 0.5s ease;}#jqxPopupContent{background-color:white;border:solid 1px #eee;box-shadow:1px 2px 8px #999;border-radius:4px;padding:12px;vertical-align:middle;max-height:40vh;max-width:50vw;overflow:auto;margin:0 auto;div:not(#closeHandleIcon){clear:both;}@media (width <= 640px){max-width:80vw;max-height:60vh;}#closeHandleIcon{cursor:pointer;width:24px;height:24px;display:inline;position:absolute;top:4px;right:4px;justify-content:right;background-image:url("data:image/svg+xml;utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Layer_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20128%20128%22%20style%3D%22enable-background%3Anew%200%200%20128%20128%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Crect%20x%3D%22-368%22%20y%3D%226%22%20style%3D%22display%3Anone%3Bfill%3A%23E0E0E0%3B%22%20width%3D%22866%22%20height%3D%221018%22%2F%3E%3Ccircle%20style%3D%22fill%3A%23FFFFFF%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2248%22%2F%3E%3Ccircle%20style%3D%22fill%3A%238CCFB9%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2239%22%2F%3E%3Ccircle%20style%3D%22fill%3Anone%3Bstroke%3A%23444B54%3Bstroke-width%3A6%3Bstroke-miterlimit%3A10%3B%22%20cx%3D%2264%22%20cy%3D%2264%22%20r%3D%2248%22%2F%3E%3Cpolyline%20style%3D%22fill%3Anone%3Bstroke%3A%23FFFFFF%3Bstroke-width%3A6%3Bstroke-linecap%3Around%3Bstroke-miterlimit%3A10%3B%22%20points%3D%2242%2C69%2055.55%2C81%20%20%2086%2C46%20%22%2F%3E%3C%2Fsvg%3E");@media (width <= 640px){background-image:none;position:relative;margin:-15px -15px 4px 0;float:right;vertical-align:middle;border:1px solid #AAA;padding:2px;border-radius:50%;width:12px;height:12px;font-size:12px;line-height:12px;font-weight:bold;text-align:center;&:after{content:'\\2714';color:green;}}}.warn{display:none;text-align:center;color:red;border-top:1px solid #999;margin-top:1em;padding-top:3px;animation:warn-fade-out 0.2s ease-out;}.warn.active{opacity:1;display:block;animation:warn-fade-in 0.2s ease-in;}}}`, "@keyframes fade-in{0%{opacity:0;transform:scale(0, 0);display:none;}100%{opacity:1;transform:scale(1, 1);display:flex;}}", "@keyframes fade-out{0%{opacity:1;transform:scale(1, 1);display:flex;}100%{opacity:0;transform:scale(0, 0);display:none;}}", "@keyframes warn-fade-in{0%{opacity:0;transform:scale(0, 0);display:none;}100%{opacity:1;transform:scale(1,1 );display:block;}}", "@keyframes warn-fade-out{0%{opacity:1;transform:scale(1, 1);display:block;}100%{opacity:0;transform:scale(0, 0);display:none;}}"];
|
|
226
226
|
}
|
|
227
|
+
var J = ht();
|
|
228
|
+
var bt = wt();
|
|
227
229
|
var Me = { html: "innerHTML", text: "textContent", class: "className" };
|
|
228
|
-
|
|
230
|
+
function ht() {
|
|
231
|
+
let t = new Intl.Collator("en", { sensitivity: "base" }), e = (o) => typeof o?.constructor == "function" ? o?.name || o?.constructor?.name : typeof o == "string" ? o : typeof o, r = (o) => [null, void 0, 1 / 0, NaN].some((i) => i === o);
|
|
232
|
+
function n(o, i) {
|
|
233
|
+
switch (true) {
|
|
234
|
+
case (i !== o && (r(o) || i === Number && (Number.isNaN(o) || !Number.isFinite(o)))):
|
|
235
|
+
return false;
|
|
236
|
+
default:
|
|
237
|
+
let [a, b] = [e(o), e(i)];
|
|
238
|
+
return o?.[Symbol.proxy] === i || i === o?.name || t.compare(a, b) === 0 || t.compare(o.constructor?.name, i?.name) === 0 || o.constructor?.name === i || a === i || t.compare(Object.prototype.toString.call(o), `[object ${b}]`) === 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return function(i, ...a) {
|
|
242
|
+
if (Array.isArray(a) && a.length > 1) {
|
|
243
|
+
for (let b of a) if (n(i, b)) return true;
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
return n(i, a?.[0]);
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function St([t, ...e]) {
|
|
250
|
+
return `${t.toUpperCase()}${e.join("")}`;
|
|
251
|
+
}
|
|
252
|
+
function xt(t) {
|
|
253
|
+
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/^-|-$/, "");
|
|
254
|
+
}
|
|
255
|
+
function Et(t) {
|
|
256
|
+
return J(t, String) ? t.toLowerCase().split("-").map((e, r) => r && `${St(e)}` || e).join("") : t;
|
|
257
|
+
}
|
|
258
|
+
function wt() {
|
|
259
|
+
let t = (e) => {
|
|
260
|
+
};
|
|
261
|
+
return function({ trial: e, whenError: r = t } = {}) {
|
|
262
|
+
try {
|
|
263
|
+
return e();
|
|
264
|
+
} catch (n) {
|
|
265
|
+
return r(n);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function vt(t) {
|
|
270
|
+
return Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(t)));
|
|
271
|
+
}
|
|
272
|
+
function Lt(t) {
|
|
273
|
+
if (Object.keys(t).length < 1) return { assignable: {}, specials: [...Array(3)] };
|
|
274
|
+
let e = Ft(t);
|
|
275
|
+
return Object.keys(t).forEach((r) => {
|
|
276
|
+
let n = r.toLowerCase();
|
|
277
|
+
n in Me && (t[Me[n]] = t[r]) && delete t[r];
|
|
278
|
+
}), { assignable: t, specials: e };
|
|
279
|
+
}
|
|
280
|
+
function Ft(t) {
|
|
281
|
+
if (t = J(t, Object) && t || void 0, !t) return Array(3);
|
|
282
|
+
let e = Object.entries(t.data ?? {}), r = Object.entries(t.attributes ?? {}), n = t.class?.split(/[ ,]/).map((o) => o.trim()).filter((o) => o.length > 1);
|
|
283
|
+
return delete t.data, delete t.attributes, delete t.class, [e, r, n];
|
|
284
|
+
}
|
|
285
|
+
function At(t) {
|
|
286
|
+
return t?.constructor === Comment ? t?.textContent : String(t);
|
|
287
|
+
}
|
|
288
|
+
function ge(t) {
|
|
289
|
+
return /comment/i.test(t);
|
|
290
|
+
}
|
|
291
|
+
function De(t, e) {
|
|
292
|
+
return !ge(e) && J(t, String) && /<.*>|&[#|0-9a-z]+[^;];/i.test(t);
|
|
293
|
+
}
|
|
294
|
+
function $t(t) {
|
|
295
|
+
return t = t.toLowerCase(), typeof t == "string" && t.length > 0 && /^[a-z]/.test(t) && /^[a-z0-9-]+$/gi.test(t);
|
|
296
|
+
}
|
|
297
|
+
function Tt(t, e, r) {
|
|
298
|
+
return $t(t) && (t in e || !J(r(t), HTMLUnknownElement));
|
|
299
|
+
}
|
|
229
300
|
var Y = Object.create(null, {});
|
|
230
301
|
var G = Object.create(null, {});
|
|
231
|
-
var
|
|
232
|
-
var De = (t) => {
|
|
302
|
+
var Ie = (t) => {
|
|
233
303
|
console.error(`tinyDOM error: "${t}" is not a valid HTML tag`);
|
|
234
304
|
};
|
|
235
|
-
var j =
|
|
236
|
-
function
|
|
237
|
-
return Object.seal(new Proxy(Y,
|
|
305
|
+
var j = Ct();
|
|
306
|
+
function Ct() {
|
|
307
|
+
return Object.seal(new Proxy(Y, Je()));
|
|
238
308
|
}
|
|
239
|
-
function
|
|
309
|
+
function Je() {
|
|
240
310
|
return { get(t, e) {
|
|
241
311
|
let r = String(e);
|
|
242
312
|
switch (true) {
|
|
243
313
|
case r in t:
|
|
244
314
|
return t[r];
|
|
245
|
-
case Tt(r):
|
|
315
|
+
case Tt(r, G, X):
|
|
246
316
|
return Oe({ tag: r, key: e });
|
|
247
317
|
default:
|
|
248
318
|
return Oe({ tag: r, key: e, isError: true });
|
|
249
319
|
}
|
|
250
320
|
}, set(t, e, r) {
|
|
251
|
-
return e === "setError" && typeof r == "function" && (
|
|
321
|
+
return e === "setError" && typeof r == "function" && (Ie = r), true;
|
|
252
322
|
}, enumerable: false, configurable: false };
|
|
253
323
|
}
|
|
254
324
|
function Oe({ tag: t, key: e, custom: r, debug: n = false, isError: o = false } = {}) {
|
|
255
|
-
let i =
|
|
325
|
+
let i = vt(Y);
|
|
256
326
|
if (o) return Object.defineProperty(i, t, { get() {
|
|
257
|
-
return (a) =>
|
|
327
|
+
return (a) => Ie(e) ?? "";
|
|
258
328
|
} }), Pe(i, t);
|
|
259
329
|
if (t.includes("-")) {
|
|
260
|
-
let [a, b] = t.includes("-") ? [t,
|
|
330
|
+
let [a, b] = t.includes("-") ? [t, Et(t)] : [xt(t), t];
|
|
261
331
|
G[a] = a, G[b] = a, r = b;
|
|
262
332
|
}
|
|
263
333
|
return r && Object.defineProperty(i, r, { get() {
|
|
@@ -267,107 +337,41 @@ var HTMLHelpers = (() => {
|
|
|
267
337
|
} }), Pe(i, t);
|
|
268
338
|
}
|
|
269
339
|
function Pe(t, e) {
|
|
270
|
-
return Y = Object.seal(new Proxy(t,
|
|
271
|
-
}
|
|
272
|
-
function St() {
|
|
273
|
-
return Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(Y)));
|
|
340
|
+
return Y = Object.seal(new Proxy(t, Je())), Y[e];
|
|
274
341
|
}
|
|
275
|
-
function
|
|
276
|
-
return e = e?.isJQx && e.node || (J(e, Number) ? String(e) : e), bt({ trial: (n) =>
|
|
342
|
+
function Nt(t, e, r) {
|
|
343
|
+
return e = e?.isJQx && e.node || (J(e, Number) ? String(e) : e), bt({ trial: (n) => De(e) ? t.insertAdjacentHTML("beforeend", e) : t.append(e), whenError: (n) => console.info(`${r} not created, reason
|
|
277
344
|
`, n) });
|
|
278
345
|
}
|
|
279
|
-
function
|
|
280
|
-
let n =
|
|
281
|
-
return r?.forEach((o) =>
|
|
346
|
+
function Ht(t, e, ...r) {
|
|
347
|
+
let n = Mt(e, t);
|
|
348
|
+
return r?.forEach((o) => Nt(n, o, t)), n;
|
|
282
349
|
}
|
|
283
|
-
function
|
|
284
|
-
switch (t = ge(e) ?
|
|
350
|
+
function Mt(t, e) {
|
|
351
|
+
switch (t = ge(e) ? At(t) : t?.isJQx ? t.node : t, true) {
|
|
285
352
|
case J(t, String):
|
|
286
|
-
return X(e,
|
|
353
|
+
return X(e, De(t, e) ? { html: t } : { text: t });
|
|
287
354
|
case t instanceof Node:
|
|
288
|
-
return
|
|
355
|
+
return Ot(e, t);
|
|
289
356
|
default:
|
|
290
357
|
return X(e, t);
|
|
291
358
|
}
|
|
292
359
|
}
|
|
293
|
-
function
|
|
360
|
+
function Ot(t, e) {
|
|
294
361
|
let r = X(t);
|
|
295
362
|
return r.append(e), r;
|
|
296
363
|
}
|
|
297
|
-
function
|
|
298
|
-
if (Object.keys(t).length < 1) return { assignable: {}, specials: [...Array(3)] };
|
|
299
|
-
let e = Ft(t);
|
|
300
|
-
return Object.keys(t).forEach((r) => {
|
|
301
|
-
let n = r.toLowerCase();
|
|
302
|
-
n in Me && (t[Me[n]] = t[r]) && delete t[r];
|
|
303
|
-
}), { assignable: t, specials: e };
|
|
304
|
-
}
|
|
305
|
-
function Ft(t) {
|
|
306
|
-
if (t = J(t, Object) && t || void 0, !t) return Array(3);
|
|
307
|
-
let e = Object.entries(t.data ?? {}), r = Object.entries(t.attributes ?? {}), n = t.class?.split(/[ ,]/).map((o) => o.trim()).filter((o) => o.length > 1);
|
|
308
|
-
return delete t.data, delete t.attributes, delete t.class, [e, r, n];
|
|
309
|
-
}
|
|
310
|
-
function At(t, e) {
|
|
364
|
+
function Pt(t, e) {
|
|
311
365
|
let [r, n, o] = t;
|
|
312
366
|
r?.length && r.forEach(([i, a]) => e.dataset[i] = a), n?.length && n.forEach(([i, a]) => e.setAttribute(i, a)), o?.forEach((i) => e.classList.add(i));
|
|
313
367
|
}
|
|
314
368
|
function X(t, e) {
|
|
315
369
|
e = e || {};
|
|
316
370
|
let { assignable: r, specials: n } = Lt(e), o = Object.assign(ge(t) ? new Comment() : document.createElement(t), r);
|
|
317
|
-
return
|
|
318
|
-
}
|
|
319
|
-
function $t(t) {
|
|
320
|
-
return t?.constructor === Comment ? t?.textContent : String(t);
|
|
321
|
-
}
|
|
322
|
-
function Je(t, e) {
|
|
323
|
-
return !ge(e) && J(t, String) && /<.*>|&[#|0-9a-z]+[^;];/i.test(t);
|
|
324
|
-
}
|
|
325
|
-
function ge(t) {
|
|
326
|
-
return /comment/i.test(t);
|
|
327
|
-
}
|
|
328
|
-
function Tt(t) {
|
|
329
|
-
return Ct(t) && (t in G || !J(X(t), HTMLUnknownElement));
|
|
330
|
-
}
|
|
331
|
-
function Ct(t) {
|
|
332
|
-
return t = t.toLowerCase(), typeof t == "string" && t.length > 0 && /^[a-z]/.test(t) && /^[a-z0-9-]+$/gi.test(t);
|
|
371
|
+
return Pt(n, o), o;
|
|
333
372
|
}
|
|
334
373
|
function Re(t) {
|
|
335
|
-
return t = G[t] ?? t, (e, ...r) =>
|
|
336
|
-
}
|
|
337
|
-
function Nt([t, ...e]) {
|
|
338
|
-
return `${t.toUpperCase()}${e.join("")}`;
|
|
339
|
-
}
|
|
340
|
-
function Ht(t) {
|
|
341
|
-
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/^-|-$/, "");
|
|
342
|
-
}
|
|
343
|
-
function Mt(t) {
|
|
344
|
-
return J(t, String) ? t.toLowerCase().split("-").map((e, r) => r && `${Nt(e)}` || e).join("") : t;
|
|
345
|
-
}
|
|
346
|
-
function Ot() {
|
|
347
|
-
let t = (e) => {
|
|
348
|
-
};
|
|
349
|
-
return function({ trial: e, whenError: r = t } = {}) {
|
|
350
|
-
try {
|
|
351
|
-
return e();
|
|
352
|
-
} catch (n) {
|
|
353
|
-
return r(n);
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
function Pt() {
|
|
358
|
-
let t = new Intl.Collator("en", { sensitivity: "base" }), e = (o) => typeof o?.constructor == "function" ? o?.name || o?.constructor?.name : typeof o == "string" ? o : typeof o, r = (o) => [null, void 0, 1 / 0, NaN].some((i) => i === o);
|
|
359
|
-
function n(o, i) {
|
|
360
|
-
if (i !== o && (r(o) || i === Number && (Number.isNaN(o) || !Number.isFinite(o)))) return false;
|
|
361
|
-
let [a, b] = [e(o), e(i)];
|
|
362
|
-
return o?.[Symbol.proxy] === i || i === o?.name || t.compare(a, b) === 0 || t.compare(o.constructor?.name, i?.name) === 0 || o.constructor?.name === i || a === i || t.compare(Object.prototype.toString.call(o), `[object ${b}]`) === 0;
|
|
363
|
-
}
|
|
364
|
-
return function(i, ...a) {
|
|
365
|
-
if (Array.isArray(a) && a.length > 1) {
|
|
366
|
-
for (let b of a) if (n(i, b)) return true;
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
return n(i, a?.[0]);
|
|
370
|
-
};
|
|
374
|
+
return t = G[t] ?? t, (e, ...r) => Ht(t, e, ...r);
|
|
371
375
|
}
|
|
372
376
|
var k = Rt;
|
|
373
377
|
function Rt({ styleSheet: t, createWithId: e } = {}) {
|