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