smoothly 0.2.10 → 0.3.0

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 (50) hide show
  1. package/dist/cjs/{Notice-a540b9fb.js → index-2a011313.js} +380 -4
  2. package/dist/cjs/index.cjs.js +9 -372
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{smoothly-accordion_51.cjs.entry.js → smoothly-accordion_50.cjs.entry.js} +127 -135
  5. package/dist/cjs/smoothly-svg.cjs.entry.js +41 -0
  6. package/dist/cjs/smoothly.cjs.js +1 -1
  7. package/dist/collection/components/App.js +9 -4
  8. package/dist/collection/components/app-demo/index.js +20 -10
  9. package/dist/collection/components/display-demo/index.js +16 -12
  10. package/dist/collection/components/input-date/index.js +18 -1
  11. package/dist/collection/components/input-demo/index.js +3 -1
  12. package/dist/collection/components/menu-options/index.js +31 -10
  13. package/dist/collection/components/option/index.js +81 -6
  14. package/dist/collection/components/option/style.css +31 -35
  15. package/dist/collection/components/picker/index.js +26 -21
  16. package/dist/collection/components/room/index.js +7 -3
  17. package/dist/collection/components/select-demo/index.js +4 -4
  18. package/dist/collection/components/skeleton/index.js +1 -1
  19. package/dist/collection/components/submit/Data.js +12 -0
  20. package/dist/collection/components/submit/index.js +10 -4
  21. package/dist/collection/index.js +1 -1
  22. package/dist/collection/model/{OptionType.js → Option.js} +0 -0
  23. package/dist/custom-elements/index.js +75 -43
  24. package/dist/esm/{Notice-4d3fbaaf.js → index-1d438ba2.js} +380 -5
  25. package/dist/esm/index.js +2 -372
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/{smoothly-accordion_51.entry.js → smoothly-accordion_50.entry.js} +127 -134
  28. package/dist/esm/smoothly-svg.entry.js +37 -0
  29. package/dist/esm/smoothly.js +1 -1
  30. package/dist/smoothly/index.esm.js +1 -1
  31. package/dist/smoothly/p-71443887.entry.js +1 -0
  32. package/dist/smoothly/p-76e88859.js +1 -0
  33. package/dist/smoothly/p-8aefcb54.entry.js +1 -0
  34. package/dist/smoothly/smoothly.esm.js +1 -1
  35. package/dist/types/components/App.d.ts +1 -0
  36. package/dist/types/components/input-date/index.d.ts +1 -0
  37. package/dist/types/components/menu-options/index.d.ts +10 -6
  38. package/dist/types/components/option/index.d.ts +7 -0
  39. package/dist/types/components/picker/index.d.ts +11 -10
  40. package/dist/types/components/room/index.d.ts +1 -1
  41. package/dist/types/components/submit/Data.d.ts +7 -0
  42. package/dist/types/components/submit/index.d.ts +2 -3
  43. package/dist/types/components.d.ts +26 -14
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/model/Option.d.ts +7 -0
  46. package/dist/types/model/index.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/dist/smoothly/p-d8a81a07.js +0 -1
  49. package/dist/smoothly/p-fbcf1356.entry.js +0 -1
  50. package/dist/types/model/OptionType.d.ts +0 -8
@@ -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 };