smoothly 0.2.8 → 0.2.11

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.
Files changed (70) hide show
  1. package/dist/cjs/{Trigger-cf376531.js → Trigger-3443997e.js} +92 -55
  2. package/dist/cjs/{Notice-839702d8.js → index-2a011313.js} +381 -5
  3. package/dist/cjs/{index-1c61bdd3.js → index-3efe2a41.js} +18 -11
  4. package/dist/cjs/index.cjs.js +11 -374
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/cjs/{smoothly-accordion_51.cjs.entry.js → smoothly-accordion_50.cjs.entry.js} +522 -13123
  7. package/dist/cjs/smoothly-google-font.cjs.entry.js +1 -1
  8. package/dist/cjs/smoothly-radio-group.cjs.entry.js +1 -1
  9. package/dist/cjs/smoothly-reorder.cjs.entry.js +1 -1
  10. package/dist/cjs/smoothly-svg.cjs.entry.js +41 -0
  11. package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +2 -2
  12. package/dist/cjs/smoothly-trigger-source.cjs.entry.js +2 -2
  13. package/dist/cjs/smoothly.cjs.js +3 -3
  14. package/dist/collection/collection-manifest.json +1 -1
  15. package/dist/collection/components/App.js +9 -4
  16. package/dist/collection/components/app-demo/index.js +10 -0
  17. package/dist/collection/components/display/index.js +27 -2
  18. package/dist/collection/components/display-date-time/index.js +3 -0
  19. package/dist/collection/components/display-demo/index.js +16 -12
  20. package/dist/collection/components/input-date/index.js +18 -1
  21. package/dist/collection/components/input-demo/index.js +3 -1
  22. package/dist/collection/components/room/index.js +7 -3
  23. package/dist/collection/components/submit/Data.js +12 -0
  24. package/dist/collection/components/submit/index.js +10 -4
  25. package/dist/collection/index.js +1 -1
  26. package/dist/collection/{demo → model}/Listenable.js +11 -6
  27. package/dist/custom-elements/index.js +566 -13090
  28. package/dist/esm/{Trigger-365408f0.js → Trigger-327e506e.js} +92 -55
  29. package/dist/esm/{Notice-608b552c.js → index-1d438ba2.js} +381 -6
  30. package/dist/esm/{index-a3737440.js → index-4d9efff8.js} +18 -11
  31. package/dist/esm/index.js +5 -375
  32. package/dist/esm/loader.js +3 -3
  33. package/dist/esm/{smoothly-accordion_51.entry.js → smoothly-accordion_50.entry.js} +522 -13122
  34. package/dist/esm/smoothly-google-font.entry.js +1 -1
  35. package/dist/esm/smoothly-radio-group.entry.js +1 -1
  36. package/dist/esm/smoothly-reorder.entry.js +1 -1
  37. package/dist/esm/smoothly-svg.entry.js +37 -0
  38. package/dist/esm/smoothly-trigger-sink.entry.js +2 -2
  39. package/dist/esm/smoothly-trigger-source.entry.js +2 -2
  40. package/dist/esm/smoothly.js +3 -3
  41. package/dist/smoothly/index.esm.js +1 -1
  42. package/dist/smoothly/p-191ee4b8.js +2 -0
  43. package/dist/smoothly/p-76e88859.js +1 -0
  44. package/dist/smoothly/{p-0215b4da.entry.js → p-7a5eda51.entry.js} +1 -1
  45. package/dist/smoothly/p-8aefcb54.entry.js +1 -0
  46. package/dist/smoothly/{p-eec1c703.entry.js → p-8e4e941e.entry.js} +1 -1
  47. package/dist/smoothly/{p-993534fa.entry.js → p-919ae3e8.entry.js} +1 -1
  48. package/dist/smoothly/p-956089d5.entry.js +1 -0
  49. package/dist/smoothly/{p-6f009ac9.entry.js → p-9bc77fba.entry.js} +1 -1
  50. package/dist/smoothly/p-b1c579b3.js +1 -0
  51. package/dist/smoothly/{p-8ae38136.entry.js → p-d5d4832d.entry.js} +1 -1
  52. package/dist/smoothly/smoothly.esm.js +1 -1
  53. package/dist/types/components/App.d.ts +1 -0
  54. package/dist/types/components/display/index.d.ts +2 -1
  55. package/dist/types/components/display-date-time/index.d.ts +3 -1
  56. package/dist/types/components/input-date/index.d.ts +1 -0
  57. package/dist/types/components/room/index.d.ts +1 -1
  58. package/dist/types/components/submit/Data.d.ts +7 -0
  59. package/dist/types/components/submit/index.d.ts +2 -3
  60. package/dist/types/components.d.ts +153 -44
  61. package/dist/types/index.d.ts +1 -1
  62. package/dist/types/model/Listenable.d.ts +10 -0
  63. package/package.json +14 -37
  64. package/dist/collection/demo/State.js +0 -40
  65. package/dist/smoothly/p-0cba3e3d.js +0 -1
  66. package/dist/smoothly/p-6ca0d36c.js +0 -1
  67. package/dist/smoothly/p-7a30d9b8.js +0 -1
  68. package/dist/smoothly/p-9d825b5a.entry.js +0 -1
  69. package/dist/types/demo/Listenable.d.ts +0 -6
  70. package/dist/types/demo/State.d.ts +0 -8
@@ -280,56 +280,83 @@ class None extends Symmetric$1 {
280
280
  }
281
281
  }
282
282
 
283
- class RSA extends Base {
284
- constructor(hash, publicKey, privateKey) {
283
+ class Rsa extends Base {
284
+ constructor(variant, publicKey, privateKey) {
285
285
  super();
286
- this.hash = hash;
287
- if (publicKey) {
288
- if (typeof publicKey == "string")
289
- publicKey = decode(publicKey);
290
- this.publicKey = crypto.subtle.importKey("spki", publicKey, { name: "RSASSA-PKCS1-v1_5", hash: { name: hash } }, false, ["verify"]);
291
- }
292
- if (privateKey) {
293
- if (typeof privateKey == "string")
294
- privateKey = decode(privateKey);
295
- this.privateKey = crypto.subtle.importKey("pkcs8", privateKey, { name: "RSASSA-PKCS1-v1_5", hash: { name: hash } }, true, ["sign"]);
296
- }
286
+ this.variant = variant;
287
+ this.publicKey = publicKey;
288
+ this.privateKey = privateKey;
289
+ }
290
+ get parameters() {
291
+ return getParameters(this.variant);
297
292
  }
298
293
  async signBinary(data) {
299
- return new Uint8Array(await crypto.subtle.sign("RSASSA-PKCS1-v1_5", await this.privateKey, data));
294
+ return this.privateKey
295
+ ? new Uint8Array(await crypto.subtle.sign(this.parameters, await this.privateKey, data))
296
+ : new Uint8Array(0);
300
297
  }
301
298
  async verifyBinary(data, signature) {
302
- return crypto.subtle.verify("RSASSA-PKCS1-v1_5", await this.publicKey, signature, data);
299
+ return !!this.publicKey && crypto.subtle.verify(this.parameters, await this.publicKey, signature, data);
303
300
  }
304
- }
305
-
306
- class RSAPSS extends Base {
307
- constructor(hash, publicKey, privateKey) {
308
- super();
309
- this.hash = hash;
310
- if (publicKey) {
311
- if (typeof publicKey == "string")
312
- publicKey = decode(publicKey);
313
- this.publicKey = crypto.subtle.importKey("spki", publicKey, { name: "RSA-PSS", hash: { name: hash } }, false, [
314
- "verify",
315
- ]);
316
- }
317
- if (privateKey) {
318
- if (typeof privateKey == "string")
319
- privateKey = decode(privateKey);
320
- this.privateKey = crypto.subtle.importKey("pkcs8", privateKey, { name: "RSA-PSS", hash: { name: hash } }, true, [
321
- "sign",
322
- "verify",
323
- ]);
324
- }
301
+ async export(type, format = "base64") {
302
+ const key = await (type == "private" ? this.privateKey : this.publicKey);
303
+ let result;
304
+ if (key)
305
+ switch (format) {
306
+ case "jwk":
307
+ result = await crypto.subtle.exportKey("jwk", key);
308
+ break;
309
+ case "buffer":
310
+ result = await crypto.subtle.exportKey(type == "private" ? "pkcs8" : "spki", key);
311
+ break;
312
+ case "base64":
313
+ {
314
+ const data = await this.export(type, "buffer");
315
+ result = data && encode(new Uint8Array(data), "standard", "=");
316
+ }
317
+ break;
318
+ case "pem":
319
+ {
320
+ const data = await this.export(type, "base64");
321
+ result =
322
+ data &&
323
+ [
324
+ `-----BEGIN ${type.toUpperCase()} KEY-----`,
325
+ ...slice(data, 64),
326
+ `-----END ${type.toUpperCase()} KEY-----`,
327
+ ].join("\n");
328
+ }
329
+ break;
330
+ }
331
+ return result;
325
332
  }
326
- async signBinary(data) {
327
- return new Uint8Array(await crypto.subtle.sign({ name: "RSA-PSS", saltLength: 128 }, await this.privateKey, data));
333
+ static import(variant, hash, publicKey, privateKey) {
334
+ return new Rsa(variant, Rsa.importHelper(variant, hash, "public", publicKey), Rsa.importHelper(variant, hash, "private", privateKey));
328
335
  }
329
- async verifyBinary(data, signature) {
330
- return crypto.subtle.verify({ name: "RSA-PSS", saltLength: 128 }, await this.publicKey, signature, data);
336
+ static importHelper(variant, hash, type, key) {
337
+ if (typeof key == "string")
338
+ key = decode(key);
339
+ return (key &&
340
+ crypto.subtle.importKey(type == "private" ? "pkcs8" : "spki", key, { name: getParameters(variant).name, hash: { name: hash } }, true, [type == "private" ? "sign" : "verify"]));
341
+ }
342
+ static generate(variant, hash, length) {
343
+ const keyPair = crypto.subtle.generateKey({
344
+ name: getParameters(variant).name,
345
+ modulusLength: length,
346
+ publicExponent: new Uint8Array([1, 0, 1]),
347
+ hash,
348
+ }, true, ["sign", "verify"]);
349
+ return new Rsa(variant, keyPair.then(value => value.publicKey), keyPair.then(value => value.privateKey));
331
350
  }
332
351
  }
352
+ function* slice(data, length) {
353
+ let start = 0;
354
+ while (start < data.length)
355
+ yield data.slice(start, (start = start + length));
356
+ }
357
+ function getParameters(variant) {
358
+ return variant == "PSS" ? { name: "RSA-PSS", saltLength: 128 } : { name: "RSASSA-PKCS1-v1_5" };
359
+ }
333
360
 
334
361
  var Signer;
335
362
  (function (Signer) {
@@ -339,30 +366,40 @@ var Signer;
339
366
  (function (Hash$1) {
340
367
  Hash$1.is = Hash.is;
341
368
  })(Signer.Hash || (Signer.Hash = {}));
342
- function create(algorithm, hash, ...keys) {
369
+ function generate(algorithm, hash, length) {
343
370
  let result;
344
371
  switch (algorithm) {
345
- case "HMAC":
346
- if (hash != undefined)
347
- result = new HMAC(hash, keys[0]);
348
- break;
349
372
  case "RSA":
350
- if (hash != undefined)
351
- result = new RSA(hash, keys[0], keys[1]);
373
+ result = Rsa.generate("SSA", hash, length);
352
374
  break;
353
375
  case "RSA-PSS":
354
- if (hash != undefined)
355
- result = new RSAPSS(hash, keys[0], keys[1]);
356
- break;
357
- case "ECDSA":
358
- if (hash != undefined)
359
- result = new ECDSA(hash, keys[0], keys[1]);
376
+ result = Rsa.generate("PSS", hash, length);
360
377
  break;
361
- case "None":
362
- result = new None();
363
378
  }
364
379
  return result;
365
380
  }
381
+ Signer.generate = generate;
382
+ function create(algorithm, hash, ...keys) {
383
+ let result;
384
+ if (hash != undefined)
385
+ switch (algorithm) {
386
+ case "HMAC":
387
+ result = new HMAC(hash, keys[0]);
388
+ break;
389
+ case "RSA":
390
+ result = Rsa.import("SSA", hash, keys[0], keys[1]);
391
+ break;
392
+ case "RSA-PSS":
393
+ result = Rsa.import("PSS", hash, keys[0], keys[1]);
394
+ break;
395
+ case "ECDSA":
396
+ result = new ECDSA(hash, keys[0], keys[1]);
397
+ break;
398
+ }
399
+ else if (algorithm == "None")
400
+ result = new None();
401
+ return result;
402
+ }
366
403
  Signer.create = create;
367
404
  })(Signer || (Signer = {}));
368
405
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-1c61bdd3.js');
3
+ const index = require('./index-3efe2a41.js');
4
4
 
5
5
  const appendToMap = (map, propName, value) => {
6
6
  const items = map.get(propName);
@@ -322,6 +322,10 @@ const DEFAULT_PARSE_URL = (url) => {
322
322
  };
323
323
 
324
324
  const Router = createRouter();
325
+ function redirect(url) {
326
+ const destination = resolve(url);
327
+ destination ? Router.push(destination) : (window.location.href = url);
328
+ }
325
329
  const App = (attributes, nodes, utils) => {
326
330
  var _a;
327
331
  const emptyNode = Object.entries(nodes[0]).reduce((r, entry) => {
@@ -337,7 +341,7 @@ const App = (attributes, nodes, utils) => {
337
341
  function childToNode(child) {
338
342
  return utils.map([emptyNode], c => (Object.assign(Object.assign({}, c), child)))[0];
339
343
  }
340
- const children = nodes.map((node, index) => (Object.assign(Object.assign({}, nodeToChild(node)), { node })));
344
+ const children = nodes.map(node => (Object.assign(Object.assign({}, nodeToChild(node)), { node })));
341
345
  return (index.h("smoothly-app", null,
342
346
  index.h("header", null,
343
347
  index.h("h1", null,
@@ -346,7 +350,7 @@ const App = (attributes, nodes, utils) => {
346
350
  index.h("ul", null, utils
347
351
  .map([
348
352
  ...children.filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.slot) == "nav-start"; }),
349
- ...children.filter(child => { var _a, _b; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.label) && ((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path); }),
353
+ ...children.filter(child => { var _a, _b, _c; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.label) && ((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path) && typeof ((_c = child.vattrs) === null || _c === void 0 ? void 0 : _c.path) == "string"; }),
350
354
  ...children.filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.slot) == "nav-end"; }),
351
355
  ].map(child => child.node), child => {
352
356
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -380,8 +384,9 @@ const App = (attributes, nodes, utils) => {
380
384
  index.h(Router.Switch, null, children
381
385
  .filter(child => { var _a; return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.path) != undefined; })
382
386
  .map(child => {
383
- var _a, _b, _c, _d, _e, _f, _g, _h;
384
- return ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.to) ? (index.h(Route, { path: (_c = resolve((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path)) !== null && _c !== void 0 ? _c : (_d = child.vattrs) === null || _d === void 0 ? void 0 : _d.path, to: (_e = child.vattrs) === null || _e === void 0 ? void 0 : _e.to })) : (index.h(Route, { path: (_g = resolve((_f = child.vattrs) === null || _f === void 0 ? void 0 : _f.path)) !== null && _g !== void 0 ? _g : (_h = child.vattrs) === null || _h === void 0 ? void 0 : _h.path }, child.node));
387
+ var _a, _b, _c, _d, _e;
388
+ const path = typeof ((_a = child.vattrs) === null || _a === void 0 ? void 0 : _a.path) == "string" ? resolve((_b = child.vattrs) === null || _b === void 0 ? void 0 : _b.path) : (_c = child.vattrs) === null || _c === void 0 ? void 0 : _c.path;
389
+ return ((_d = child.vattrs) === null || _d === void 0 ? void 0 : _d.to) ? (index.h(Route, { path: path, to: (_e = child.vattrs) === null || _e === void 0 ? void 0 : _e.to })) : (index.h(Route, { path: path }, child.node));
385
390
  })))));
386
391
  };
387
392
  function resolve(url) {
@@ -483,5 +488,376 @@ class Notice {
483
488
  }
484
489
  }
485
490
 
491
+ var Hex;
492
+ (function (Hex) {
493
+ function is(value) {
494
+ const matchArray = (typeof value == "string" && value.match(/[0-9a-fA-F]/g)) || undefined;
495
+ return (typeof value == "string" &&
496
+ value.length > 3 &&
497
+ value[0] == "#" &&
498
+ ((matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 3 || (matchArray === null || matchArray === void 0 ? void 0 : matchArray.length) == 6));
499
+ }
500
+ Hex.is = is;
501
+ })(Hex || (Hex = {}));
502
+
503
+ var Hsl;
504
+ (function (Hsl) {
505
+ function is(value) {
506
+ const values = typeof value == "string" && value.length > 11 ? value.substring(4, value.length - 1).split(",") : [];
507
+ return (typeof value == "string" &&
508
+ value.length > 11 &&
509
+ value.substr(0, 4) == "hsl(" &&
510
+ value.substr(value.length - 1, 1) == ")" &&
511
+ values.length == 3 &&
512
+ values.every((single, index) => {
513
+ var _a, _b;
514
+ let result = false;
515
+ if (index == 0)
516
+ result =
517
+ !Number.isNaN(single) &&
518
+ ((_a = single.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == single.length &&
519
+ Number(single) >= 0 &&
520
+ Number(single) <= 360;
521
+ else {
522
+ const number = single.substr(0, single.length - 1);
523
+ result =
524
+ single[single.length - 1] == "%" &&
525
+ !Number.isNaN(number) &&
526
+ ((_b = number.match(/[0-9]/g)) === null || _b === void 0 ? void 0 : _b.length) == number.length &&
527
+ Number(number) >= 0 &&
528
+ Number(number) <= 100;
529
+ }
530
+ return result;
531
+ }));
532
+ }
533
+ Hsl.is = is;
534
+ })(Hsl || (Hsl = {}));
535
+
536
+ const Names = {
537
+ aliceblue: "#f0f8ff",
538
+ antiquewhite: "#faebd7",
539
+ aqua: "#00ffff",
540
+ aquamarine: "#7fffd4",
541
+ azure: "#f0ffff",
542
+ beige: "#f5f5dc",
543
+ bisque: "#ffe4c4",
544
+ black: "#000000",
545
+ blanchedalmond: "#ffebcd",
546
+ blue: "#0000ff",
547
+ blueviolet: "#8a2be2",
548
+ brown: "#a52a2a",
549
+ burlywood: "#deb887",
550
+ cadetblue: "#5f9ea0",
551
+ chartreuse: "#7fff00",
552
+ chocolate: "#d2691e",
553
+ coral: "#ff7f50",
554
+ cornflowerblue: "#6495ed",
555
+ cornsilk: "#fff8dc",
556
+ crimson: "#dc143c",
557
+ cyan: "#00ffff",
558
+ darkblue: "#00008b",
559
+ darkcyan: "#008b8b",
560
+ darkgoldenrod: "#b8860b",
561
+ darkgray: "#a9a9a9",
562
+ darkgreen: "#006400",
563
+ darkgrey: "#a9a9a9",
564
+ darkkhaki: "#bdb76b",
565
+ darkmagenta: "#8b008b",
566
+ darkolivegreen: "#556b2f",
567
+ darkorange: "#ff8c00",
568
+ darkorchid: "#9932cc",
569
+ darkred: "#8b0000",
570
+ darksalmon: "#e9967a",
571
+ darkseagreen: "#8fbc8f",
572
+ darkslateblue: "#483d8b",
573
+ darkslategray: "#2f4f4f",
574
+ darkslategrey: "#2f4f4f",
575
+ darkturquoise: "#00ced1",
576
+ darkviolet: "#9400d3",
577
+ deeppink: "#ff1493",
578
+ deepskyblue: "#00bfff",
579
+ dimgray: "#696969",
580
+ dimgrey: "#696969",
581
+ dodgerblue: "#1e90ff",
582
+ firebrick: "#b22222",
583
+ floralwhite: "#fffaf0",
584
+ forestgreen: "#228b22",
585
+ fuchsia: "#ff00ff",
586
+ gainsboro: "#dcdcdc",
587
+ ghostwhite: "#f8f8ff",
588
+ goldenrod: "#daa520",
589
+ gold: "#ffd700",
590
+ gray: "#808080",
591
+ green: "#008000",
592
+ greenyellow: "#adff2f",
593
+ grey: "#808080",
594
+ honeydew: "#f0fff0",
595
+ hotpink: "#ff69b4",
596
+ indianred: "#cd5c5c",
597
+ indigo: "#4b0082",
598
+ ivory: "#fffff0",
599
+ khaki: "#f0e68c",
600
+ lavenderblush: "#fff0f5",
601
+ lavender: "#e6e6fa",
602
+ lawngreen: "#7cfc00",
603
+ lemonchiffon: "#fffacd",
604
+ lightblue: "#add8e6",
605
+ lightcoral: "#f08080",
606
+ lightcyan: "#e0ffff",
607
+ lightgoldenrodyellow: "#fafad2",
608
+ lightgray: "#d3d3d3",
609
+ lightgreen: "#90ee90",
610
+ lightgrey: "#d3d3d3",
611
+ lightpink: "#ffb6c1",
612
+ lightsalmon: "#ffa07a",
613
+ lightseagreen: "#20b2aa",
614
+ lightskyblue: "#87cefa",
615
+ lightslategray: "#778899",
616
+ lightslategrey: "#778899",
617
+ lightsteelblue: "#b0c4de",
618
+ lightyellow: "#ffffe0",
619
+ lime: "#00ff00",
620
+ limegreen: "#32cd32",
621
+ linen: "#faf0e6",
622
+ magenta: "#ff00ff",
623
+ maroon: "#800000",
624
+ mediumaquamarine: "#66cdaa",
625
+ mediumblue: "#0000cd",
626
+ mediumorchid: "#ba55d3",
627
+ mediumpurple: "#9370db",
628
+ mediumseagreen: "#3cb371",
629
+ mediumslateblue: "#7b68ee",
630
+ mediumspringgreen: "#00fa9a",
631
+ mediumturquoise: "#48d1cc",
632
+ mediumvioletred: "#c71585",
633
+ midnightblue: "#191970",
634
+ mintcream: "#f5fffa",
635
+ mistyrose: "#ffe4e1",
636
+ moccasin: "#ffe4b5",
637
+ navajowhite: "#ffdead",
638
+ navy: "#000080",
639
+ oldlace: "#fdf5e6",
640
+ olive: "#808000",
641
+ olivedrab: "#6b8e23",
642
+ orange: "#ffa500",
643
+ orangered: "#ff4500",
644
+ orchid: "#da70d6",
645
+ palegoldenrod: "#eee8aa",
646
+ palegreen: "#98fb98",
647
+ paleturquoise: "#afeeee",
648
+ palevioletred: "#db7093",
649
+ papayawhip: "#ffefd5",
650
+ peachpuff: "#ffdab9",
651
+ peru: "#cd853f",
652
+ pink: "#ffc0cb",
653
+ plum: "#dda0dd",
654
+ powderblue: "#b0e0e6",
655
+ purple: "#800080",
656
+ rebeccapurple: "#663399",
657
+ red: "#ff0000",
658
+ rosybrown: "#bc8f8f",
659
+ royalblue: "#4169e1",
660
+ saddlebrown: "#8b4513",
661
+ salmon: "#fa8072",
662
+ sandybrown: "#f4a460",
663
+ seagreen: "#2e8b57",
664
+ seashell: "#fff5ee",
665
+ sienna: "#a0522d",
666
+ silver: "#c0c0c0",
667
+ skyblue: "#87ceeb",
668
+ slateblue: "#6a5acd",
669
+ slategray: "#708090",
670
+ slategrey: "#708090",
671
+ snow: "#fffafa",
672
+ springgreen: "#00ff7f",
673
+ steelblue: "#4682b4",
674
+ tan: "#d2b48c",
675
+ teal: "#008080",
676
+ thistle: "#d8bfd8",
677
+ tomato: "#ff6347",
678
+ turquoise: "#40e0d0",
679
+ violet: "#ee82ee",
680
+ wheat: "#f5deb3",
681
+ white: "#ffffff",
682
+ whitesmoke: "#f5f5f5",
683
+ yellow: "#ffff00",
684
+ yellowgreen: "#9acd32",
685
+ };
686
+ var Name;
687
+ (function (Name) {
688
+ Name.types = () => Object.keys(Names);
689
+ function is(value) {
690
+ return typeof value == "string" && Name.types().includes(value.toLowerCase());
691
+ }
692
+ Name.is = is;
693
+ })(Name || (Name = {}));
694
+
695
+ var Rgb;
696
+ (function (Rgb) {
697
+ function is(value) {
698
+ const values = typeof value == "string" && value.length > 9 ? value.substring(4, value.length - 1).split(",") : [];
699
+ return (typeof value == "string" &&
700
+ value.length > 9 &&
701
+ value.substr(0, 4) == "rgb(" &&
702
+ value.substr(value.length - 1, 1) == ")" &&
703
+ values.length == 3 &&
704
+ values.every((value) => {
705
+ var _a;
706
+ return !Number.isNaN(value) &&
707
+ ((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
708
+ Number(value) >= 0 &&
709
+ Number(value) <= 255;
710
+ }));
711
+ }
712
+ Rgb.is = is;
713
+ })(Rgb || (Rgb = {}));
714
+
715
+ var CommaRgb;
716
+ (function (CommaRgb) {
717
+ function is(value) {
718
+ const values = typeof value == "string" ? value.split(",") : [];
719
+ return (values.length == 3 &&
720
+ values.every((value) => {
721
+ var _a;
722
+ return !Number.isNaN(value) &&
723
+ ((_a = value.match(/[0-9]/g)) === null || _a === void 0 ? void 0 : _a.length) == value.length &&
724
+ Number(value) >= 0 &&
725
+ Number(value) <= 255;
726
+ }));
727
+ }
728
+ CommaRgb.is = is;
729
+ function from(color) {
730
+ let result;
731
+ const colorWithoutSpace = typeof color == "string" ? color.replace(/ /g, "").toLowerCase() : undefined;
732
+ if (!colorWithoutSpace)
733
+ result = undefined;
734
+ else if (CommaRgb.is(colorWithoutSpace))
735
+ result = colorWithoutSpace;
736
+ else if (Hex.is(colorWithoutSpace))
737
+ result = fromHex(colorWithoutSpace);
738
+ else if (Rgb.is(colorWithoutSpace))
739
+ result = fromRgb(colorWithoutSpace);
740
+ else if (Name.is(colorWithoutSpace))
741
+ result = fromHex(Names[colorWithoutSpace]);
742
+ else if (Hsl.is(colorWithoutSpace))
743
+ result = fromHsl(colorWithoutSpace);
744
+ return result;
745
+ }
746
+ CommaRgb.from = from;
747
+ function fromHex(hex) {
748
+ let result = "0,0,0";
749
+ if (hex.length == 7)
750
+ result = `${parseInt(hex.substr(1, 2), 16)},${parseInt(hex.substr(3, 2), 16)},${parseInt(hex.substr(5, 2), 16)}`;
751
+ else if (hex.length == 4)
752
+ result = fromHex(`#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`);
753
+ return result;
754
+ }
755
+ CommaRgb.fromHex = fromHex;
756
+ function fromRgb(rgb) {
757
+ return rgb.substring(4, rgb.length - 1);
758
+ }
759
+ CommaRgb.fromRgb = fromRgb;
760
+ function fromHsl(hsl) {
761
+ let result = "";
762
+ let h, s, l;
763
+ let r, g, b;
764
+ const HSL = hsl
765
+ .substring(4, hsl.length - 1)
766
+ .split(",")
767
+ .map((value, index) => Number(index == 0 ? value : value.substr(0, value.length - 1)));
768
+ if (HSL.length == 3) {
769
+ h = HSL[0] / 360;
770
+ s = HSL[1] / 100;
771
+ l = HSL[2] / 100;
772
+ if (s == 0)
773
+ r = g = b = l;
774
+ else {
775
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
776
+ const p = 2 * l - q;
777
+ r = hue2rgb(p, q, h + 1 / 3);
778
+ g = hue2rgb(p, q, h);
779
+ b = hue2rgb(p, q, h - 1 / 3);
780
+ }
781
+ result = `${Math.round(255 * r)},${Math.round(255 * g)},${Math.round(255 * b)}`;
782
+ }
783
+ return result;
784
+ }
785
+ CommaRgb.fromHsl = fromHsl;
786
+ function hue2rgb(p, q, t) {
787
+ let result = p;
788
+ if (t < 0)
789
+ t += 1;
790
+ if (t > 1)
791
+ t -= 1;
792
+ if (t < 1 / 6)
793
+ result = p + (q - p) * 6 * t;
794
+ else if (t < 1 / 2)
795
+ result = q;
796
+ else if (t < 2 / 3)
797
+ result = p + (q - p) * (2 / 3 - t) * 6;
798
+ return result;
799
+ }
800
+ })(CommaRgb || (CommaRgb = {}));
801
+
802
+ var Color;
803
+ (function (Color) {
804
+ function is(value) {
805
+ return (typeof value == "string" &&
806
+ (CommaRgb.is(value) || Hex.is(value) || Hsl.is(value) || Name.is(value) || Rgb.is(value)));
807
+ }
808
+ Color.is = is;
809
+ function from(value) {
810
+ return is(value) ? value : undefined;
811
+ }
812
+ Color.from = from;
813
+ Color.Names = Names;
814
+ Color.Name = Name;
815
+ Color.CommaRgb = CommaRgb;
816
+ Color.Rgb = Rgb;
817
+ Color.Hex = Hex;
818
+ Color.Hsl = Hsl;
819
+ })(Color || (Color = {}));
820
+
821
+ function reduce(types, value) {
822
+ return types.reduce((r, c) => typeof value == "object" && value != null && typeof value[c] == "string"
823
+ ? Object.assign(Object.assign({}, r), { [c]: value[c] }) : r, {});
824
+ }
825
+ exports.Cosmetic = void 0;
826
+ (function (Cosmetic) {
827
+ Cosmetic.types = Cosmetic;
828
+ function from(value) {
829
+ let result = {};
830
+ if (typeof value == "object" && value) {
831
+ result = {
832
+ text: reduce(["background", "color"], value.text),
833
+ border: reduce(["background", "color", "style", "radius", "width"], value.border),
834
+ gap: typeof value.gap == "string" ? value.gap : undefined,
835
+ dangerColor: typeof value.dangerColor == "string"
836
+ ? value.dangerColor
837
+ : typeof value.danger_color == "string"
838
+ ? value.danger_color
839
+ : undefined,
840
+ fontFamily: typeof value.fontFamily == "string"
841
+ ? value.fontFamily
842
+ : typeof value.font_family == "string"
843
+ ? value.font_family
844
+ : undefined,
845
+ background: typeof value.background == "string" ? value.background : undefined,
846
+ };
847
+ Object.keys(result).forEach((key) => {
848
+ var _a;
849
+ if (result[key] == undefined ||
850
+ (typeof result[key] == "object" && result[key] && Object.keys((_a = result[key]) !== null && _a !== void 0 ? _a : {}).length == 0)) {
851
+ delete result[key];
852
+ }
853
+ });
854
+ }
855
+ return result;
856
+ }
857
+ Cosmetic.from = from;
858
+ Cosmetic.Color = Color;
859
+ })(exports.Cosmetic || (exports.Cosmetic = {}));
860
+
486
861
  exports.App = App;
487
862
  exports.Notice = Notice;
863
+ exports.redirect = redirect;