slicejs-cli 1.0.45 → 1.0.47

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 (76) hide show
  1. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +109 -37
  2. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +15 -15
  3. package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +50 -0
  4. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +81 -83
  5. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +47 -10
  6. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +7 -3
  7. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +114 -41
  8. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +11 -11
  9. package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +32 -28
  10. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +44 -0
  11. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +5 -0
  12. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +39 -0
  13. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +63 -0
  14. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +7 -0
  15. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +110 -0
  16. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +87 -0
  17. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +8 -0
  18. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +87 -0
  19. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +97 -0
  20. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +18 -0
  21. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +86 -0
  22. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +505 -0
  23. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +1 -0
  24. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +95 -0
  25. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
  26. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +550 -0
  27. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +502 -0
  28. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +1470 -0
  29. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +1035 -0
  30. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
  31. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
  32. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
  33. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +87 -0
  34. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +4 -0
  35. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +210 -0
  36. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +56 -0
  37. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +83 -0
  38. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +39 -0
  39. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +30 -0
  40. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +6 -0
  41. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +39 -0
  42. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +91 -0
  43. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +8 -0
  44. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +210 -0
  45. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +76 -0
  46. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +8 -0
  47. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +109 -0
  48. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +34 -0
  49. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +7 -0
  50. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +33 -0
  51. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +34 -0
  52. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +43 -0
  53. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +39 -0
  54. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +110 -0
  55. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +12 -0
  56. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +65 -0
  57. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +163 -0
  58. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +15 -0
  59. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +48 -0
  60. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +56 -0
  61. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +6 -0
  62. package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +119 -0
  63. package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +22 -11
  64. package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +169 -147
  65. package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +10 -0
  66. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +33 -9
  67. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +27 -10
  68. package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +27 -12
  69. package/PROJECT_TEMPLATES/Basic/Slice/package.json +12 -0
  70. package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +9 -1
  71. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +9 -13
  72. package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +381 -9
  73. package/commands/createComponent/createComponent.js +4 -1
  74. package/commands/deleteComponent/deleteComponent.js +7 -1
  75. package/commands/listComponents/listComponents.js +12 -3
  76. package/package.json +1 -1
@@ -0,0 +1,110 @@
1
+ /* Import Google font - Poppins */
2
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');
3
+ * {
4
+ margin: 0;
5
+ padding: 0;
6
+ box-sizing: border-box;
7
+ font-family: 'Poppins', sans-serif;
8
+ }
9
+
10
+ .notifications {
11
+ position: fixed;
12
+ top: 80px;
13
+ right: 20px;
14
+ }
15
+ .notifications :where(.toast, .column) {
16
+ display: flex;
17
+ align-items: center;
18
+ }
19
+ .notifications .toast {
20
+ width: 400px;
21
+ position: relative;
22
+ overflow: hidden;
23
+ list-style: none;
24
+ border-radius: 4px;
25
+ padding: 16px 17px;
26
+ margin-bottom: 10px;
27
+ background: #ffffff;
28
+ justify-content: space-between;
29
+ animation: show_toast 0.3s ease forwards;
30
+ z-index: 100000;
31
+
32
+ }
33
+ @keyframes show_toast {
34
+ 0% {
35
+ transform: translateX(100%);
36
+ }
37
+ 40% {
38
+ transform: translateX(-5%);
39
+ }
40
+ 80% {
41
+ transform: translateX(0%);
42
+ }
43
+ 100% {
44
+ transform: translateX(-10px);
45
+ }
46
+ }
47
+ .notifications .toast.hide {
48
+ animation: hide_toast 0.3s ease forwards;
49
+ }
50
+ @keyframes hide_toast {
51
+ 0% {
52
+ transform: translateX(-10px);
53
+ }
54
+ 40% {
55
+ transform: translateX(0%);
56
+ }
57
+ 80% {
58
+ transform: translateX(-5%);
59
+ }
60
+ 100% {
61
+ transform: translateX(calc(100% + 20px));
62
+ }
63
+ }
64
+ .toast::before {
65
+ position: absolute;
66
+ content: "";
67
+ height: 3px;
68
+ width: 100%;
69
+ bottom: 0px;
70
+ left: 0px;
71
+ animation: progress 5s linear forwards;
72
+ }
73
+
74
+ @keyframes progress {
75
+ 100% {
76
+ width: 0%;
77
+ }
78
+ }
79
+ .toast::before {
80
+ background: black;
81
+ }
82
+
83
+
84
+ .toast .column i {
85
+ font-size: 1.75rem;
86
+ }
87
+
88
+ .toast .column span {
89
+ font-size: 1.07rem;
90
+ margin-left: 12px;
91
+ }
92
+ .toast i:last-child {
93
+ color: #aeb0d7;
94
+ cursor: pointer;
95
+ }
96
+ .toast i:last-child:hover {
97
+ color: #34495E;
98
+ }
99
+
100
+ @media screen and (max-width: 530px) {
101
+ .notifications {
102
+ width: 95%;
103
+ }
104
+ .notifications .toast {
105
+ width: 100%;
106
+ font-size: 1rem;
107
+ margin-left: 20px;
108
+ }
109
+
110
+ }
@@ -0,0 +1,12 @@
1
+ <link rel="stylesheet" href="./Slice/css/ToastAlert.css">
2
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" rel="stylesheet" type='text/css'>
3
+
4
+ <ul id="notifications" class="notifications">
5
+ <li class="toast">
6
+ <div class="column">
7
+ <i id="addIcon" class="fa-solid"></i>
8
+ <span id="textSpan"></span>
9
+ </div>
10
+ <i id="closeBtn" class="fa-solid fa-xmark"></i>`;
11
+ </li>
12
+ </ul>
@@ -0,0 +1,65 @@
1
+ export default class ToastAlert extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ slice.controller
5
+ .loadTemplate("./Slice/templates/ToastAlert.html")
6
+ .then((template) => {
7
+ this.shadow = this.attachShadow({ mode: "open" });
8
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
9
+
10
+ if (this.props != undefined) {
11
+ if (this.props.color != undefined) {
12
+ this.color = this.props.color;
13
+ this.shadowRoot.innerHTML += `<style>
14
+ .toast::before {background: ${this.color}; }
15
+ .toast .column i {color: ${this.color}; }
16
+ </style>`;
17
+ }
18
+ if (this.props.text != undefined) {
19
+ this.text = this.props.text;
20
+ const textSpan = this.shadowRoot.getElementById("textSpan");
21
+ textSpan.innerHTML = this.text;
22
+ }
23
+ if (this.props.icon != undefined) {
24
+ this.icon = this.props.icon;
25
+ const addIcon = this.shadowRoot.getElementById("addIcon");
26
+ addIcon.classList.add(toastDetails[this.icon].icon);
27
+ }
28
+ }
29
+ const closeBtn = this.shadowRoot.getElementById("closeBtn");
30
+ closeBtn.addEventListener("click", () => {
31
+ this.remove();
32
+ });
33
+
34
+ slice.controller.registerComponent(this);
35
+ });
36
+ }
37
+
38
+ show() {
39
+ document.body.appendChild(this);
40
+ setTimeout(() => this.remove(), 5000);
41
+ }
42
+ }
43
+
44
+ // Object containing details for different types of toasts
45
+ const toastDetails = {
46
+ timer: 5000,
47
+ success: {
48
+ icon: "fa-circle-check",
49
+ text: "Success: This is a success toast.",
50
+ },
51
+ error: {
52
+ icon: "fa-circle-xmark",
53
+ text: "Error: This is an error toast.",
54
+ },
55
+ warning: {
56
+ icon: "fa-triangle-exclamation",
57
+ text: "Warning: This is a warning toast.",
58
+ },
59
+ info: {
60
+ icon: "fa-circle-info",
61
+ text: "Info: This is an information toast.",
62
+ },
63
+ };
64
+
65
+ customElements.define("toast-alert", ToastAlert);
@@ -0,0 +1,163 @@
1
+ #complexNavbar{
2
+ --bg-color: #2B3467;
3
+ --text-color: #fff;
4
+ --main-color: #EB455F;
5
+ }
6
+
7
+
8
+ * {
9
+
10
+ padding: 0;
11
+ margin: 0;
12
+ font-family: 'Poppins', sans-serif;
13
+ list-style: none;
14
+ text-decoration: none;
15
+ }
16
+
17
+
18
+ header {
19
+ position: fixed;
20
+ width: 100%;
21
+ top: 0;
22
+ left: 50%;
23
+ transform: translateX(-50%);
24
+ z-index: 1000;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: space-around;
28
+ background: var(--bg-color);
29
+ padding: 28px 12%;
30
+ transition: all .50s ease;
31
+ }
32
+
33
+ .logo {
34
+ display: flex;
35
+ align-items: center;
36
+ }
37
+
38
+ .logo i {
39
+ color: var(--main-color);
40
+ font-size: 28px;
41
+ margin-right: 3px;
42
+ }
43
+
44
+ .logo span {
45
+ color: var(--text-color);
46
+ font-size: 1.7rem;
47
+ font-weight: 600;
48
+ }
49
+
50
+ .navbar {
51
+ display: flex;
52
+ }
53
+
54
+ .navbar a {
55
+ color: var(--text-color);
56
+ font-size: 1.1rem;
57
+ font-weight: 500;
58
+ padding: 5px 0;
59
+ margin: 0px 30px;
60
+ transition: all .50s ease;
61
+ }
62
+
63
+ .navbar a:hover {
64
+ color: var(--main-color)
65
+ }
66
+
67
+ .navbar a.active {
68
+ color: var(--main-color)
69
+ }
70
+
71
+ .main {
72
+ display: flex;
73
+ align-items: center;
74
+ }
75
+
76
+ .main a {
77
+ margin-right: 25px;
78
+ margin-left: 10px;
79
+ color: var(--text-color);
80
+ font-size: 1.1rem;
81
+ font-weight: 500;
82
+ transition: all .50s ease;
83
+ }
84
+
85
+ .user {
86
+ display: flex;
87
+ align-items: center;
88
+ }
89
+
90
+ .user i {
91
+ color: var(--main-color);
92
+ font-size: 28px;
93
+ margin-right: 7px;
94
+ }
95
+
96
+ .main a:hover {
97
+ color: var(--main-color)
98
+ }
99
+
100
+ #menu-icon {
101
+ font-size: 35px;
102
+ color: var(--text-color);
103
+ cursor: pointer;
104
+ z-index: 10001;
105
+ display: none;
106
+ }
107
+
108
+ @media (max-width: 1280px) {
109
+ header {
110
+ padding: 14px 2%;
111
+ transition: .2s;
112
+ }
113
+
114
+ .navbar a {
115
+ padding: 5px 0;
116
+ margin: 0px 20px;
117
+
118
+ }
119
+ }
120
+
121
+ @media(max-width:1090px) {
122
+ #menu-icon {
123
+ display: block;
124
+ }
125
+
126
+
127
+
128
+ .navbar {
129
+ position: absolute;
130
+ top: 100%;
131
+ right: -100%;
132
+ width: 270px;
133
+ height: 29vh;
134
+ background: var(--main-color);
135
+ flex-direction: column;
136
+ justify-content: flex-start;
137
+ text-align: center;
138
+ justify-items: center;
139
+ justify-self: center;
140
+ border-radius: 10px;
141
+ transition: all .50s ease;
142
+ }
143
+
144
+ .navbar a {
145
+ display: block;
146
+ margin: 12px 0;
147
+ padding: 0px 25px;
148
+ transition: all .50s ease;
149
+ }
150
+
151
+ .navbar a:hover {
152
+ color: var(--text-color);
153
+ transform: translateY(5px);
154
+ }
155
+
156
+ .navbar a.active {
157
+ color: var(--text-color)
158
+ }
159
+
160
+ .navbar.open {
161
+ right: 2%;
162
+ }
163
+ }
@@ -0,0 +1,15 @@
1
+ <div id="complexNavbar">
2
+ <link rel=" stylesheet" href="./Slice/Components/complexNavbar/complexNavbar.css" type="text/css">
3
+ <header>
4
+ <a href="#" id="logoLink" class="logo"> <i class="fa fa-home"></i> <span id="logo"></span></a>
5
+ <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css" rel="stylesheet" type='text/css'>
6
+ <ul class="navbar"> </ul>
7
+ <div class="main">
8
+ <a href="" id ="sign-in" class="user"><i class="fa fa-user"></i> Sign In</a>
9
+ <div > <i id="menu-icon" class="fa fa-navicon" ></i></div>
10
+ </div>
11
+
12
+ </header>
13
+ </div>
14
+
15
+
@@ -0,0 +1,48 @@
1
+ export default class complexNavbar extends HTMLElement {
2
+ constructor(props) {
3
+ super();
4
+ slice.controller.loadTemplate(this);
5
+ let menu = this.shadowRoot.querySelector("#menu-icon");
6
+ let navbar = this.shadowRoot.querySelector(".navbar");
7
+
8
+ menu.addEventListener("click", () => {
9
+ navbar.classList.toggle("open");
10
+ menu.classList.toggle("fa-navicon");
11
+ menu.classList.toggle("fa-close");
12
+ });
13
+
14
+ if (props != undefined) {
15
+ if (props.id != undefined) {
16
+ this.id = props.id;
17
+ }
18
+
19
+ let logoLink = this.shadowRoot.getElementById("logoLink");
20
+ if (props.logoLink != undefined) {
21
+ logoLink.href = props.logoLink;
22
+ }
23
+
24
+ let sign = this.shadowRoot.querySelector("#sign-in");
25
+ if (props.sign != undefined) {
26
+ sign.href = props.sign;
27
+ } else {
28
+ sign.style.display = "none";
29
+ }
30
+
31
+ let logo = this.shadowRoot.querySelector("#logo");
32
+ logo.innerHTML = props.logo;
33
+
34
+ let titleContainer = this.shadowRoot.querySelector(".navbar");
35
+ for (let i = 0; i < props.sections.length; i++) {
36
+ let prop = props.sections[i];
37
+ titleContainer.innerHTML += `<li><a id=${prop.id} href="${prop.link}">${prop.text}</a></li>`;
38
+ }
39
+ }
40
+ slice.controller.registerComponent(this);
41
+ }
42
+
43
+ getElement(id) {
44
+ return this.shadowRoot.getElementById(id);
45
+ }
46
+ }
47
+
48
+ window.customElements.define("complex-navbar", complexNavbar);
@@ -0,0 +1,56 @@
1
+ .slider {
2
+ height: 300px;
3
+ aspect-ratio: 16/9;
4
+ position: relative;
5
+ overflow: hidden; /* <=== */
6
+ border-radius: 10px;
7
+ }
8
+
9
+ .slider .slide {
10
+ width: 100%;
11
+ height: 100%;
12
+ position: absolute;
13
+ transition: all 0.5s;
14
+ }
15
+
16
+ .slide img {
17
+ width: 100%;
18
+ height: 100%;
19
+ object-fit: cover;
20
+ }
21
+
22
+ .btn {
23
+ position: absolute;
24
+ width: 10px;
25
+ height: 10px;
26
+ padding: 10px;
27
+ border: none;
28
+ border-radius: 50%;
29
+ z-index: 10;
30
+ cursor: pointer;
31
+ line-height: 0.6;
32
+ font-weight: bold;
33
+ background-color: #fff;
34
+ font-size: 18px;
35
+ }
36
+
37
+ .btn:active {
38
+ transform: scale(1.1);
39
+ }
40
+
41
+ .btn-prev {
42
+ top: 45%;
43
+ left: 2%;
44
+ }
45
+
46
+ .btn-next {
47
+ top: 45%;
48
+ right: 2%;
49
+ }
50
+
51
+ @media only screen and (max-width: 600px) {
52
+ .slider {
53
+ aspect-ratio: 3/4;
54
+
55
+ }
56
+ }
@@ -0,0 +1,6 @@
1
+ <link rel="stylesheet" href="./Slice/css/img-carousel.css">
2
+ <div id="slider" class="slider">
3
+ <div id="prev" class="btn btn-prev"><</div>
4
+ <div id="next" class="btn btn-next">></div>
5
+ </div>
6
+
@@ -0,0 +1,119 @@
1
+ export default class ImgCarousel extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+
5
+ this.jumpInterval = 1500;
6
+ this.images = [];
7
+ this.slides = [];
8
+ this.currentImage = 0;
9
+ this.maxImage = 0;
10
+
11
+ slice.controller
12
+ .loadTemplate("./Slice/templates/img-carousel.html")
13
+ .then((template) => {
14
+ this.shadow = this.attachShadow({ mode: "open" });
15
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
16
+ const nextBtn = this.shadowRoot.getElementById("next");
17
+ const prevBtn = this.shadowRoot.getElementById("prev");
18
+ nextBtn.addEventListener("click", (e) => this.moveNext());
19
+ prevBtn.addEventListener("click", (e) => this.movePrev());
20
+ const slider = this.shadowRoot.getElementById("slider");
21
+
22
+ if (this.props != undefined) {
23
+ if (this.props.id != undefined) {
24
+ this.id = this.props.id;
25
+ }
26
+ this.images = this.props.images;
27
+ this.maxImage = this.images.length - 1;
28
+ this.create();
29
+ if (this.props.ratio != undefined) {
30
+ this.changeStyles({ "aspect-ratio": this.props.ratio });
31
+ }
32
+ if (this.props.jumpInterval != undefined) {
33
+ this.jumpInterval = this.props.jumpInterval * 1000;
34
+ }
35
+ if (this.props.height != undefined) {
36
+ this.changeStyles({ height: this.props.height });
37
+ }
38
+ if (this.props.motion != undefined) {
39
+ if (this.props.motion == "fw") {
40
+ this.autoMoveNext();
41
+ } else {
42
+ this.autoMovePrev();
43
+ }
44
+ }
45
+ slice.controller.registerComponent(this);
46
+ }
47
+ });
48
+ }
49
+
50
+ connectedCallback() {}
51
+
52
+ changeStyles(styles) {
53
+ let slider = this.shadowRoot.getElementById("slider");
54
+ Object.keys(styles).forEach((property) => {
55
+ slider.style[property] = styles[property];
56
+ });
57
+ }
58
+
59
+ autoMovePrev() {
60
+ setInterval(
61
+ function () {
62
+ this.movePrev().bind(this);
63
+ }.bind(this),
64
+ this.jumpInterval
65
+ );
66
+ }
67
+
68
+ autoMoveNext() {
69
+ setInterval(
70
+ function () {
71
+ this.moveNext().bind(this);
72
+ }.bind(this),
73
+ this.jumpInterval
74
+ );
75
+ }
76
+
77
+ moveNext() {
78
+ if (this.currentImage === this.maxImage) {
79
+ this.currentImage = 0;
80
+ } else {
81
+ this.currentImage++;
82
+ }
83
+
84
+ this.slides.forEach((slide, idx) => {
85
+ slide.style.transform = `translateX(${100 * (idx - this.currentImage)}%)`;
86
+ });
87
+ }
88
+
89
+ movePrev() {
90
+ if (this.currentImage === 0) {
91
+ this.currentImage = this.maxImage;
92
+ } else {
93
+ this.currentImage--;
94
+ }
95
+
96
+ this.slides.forEach((slide, idx) => {
97
+ slide.style.transform = `translateX(${100 * (idx - this.currentImage)}%)`;
98
+ });
99
+ }
100
+
101
+ create() {
102
+ this.images.forEach((img, idx) => {
103
+ let slider = this.shadow.querySelector(".slider");
104
+
105
+ let slide = document.createElement("div");
106
+ slide.classList.add("slide");
107
+ slide.style.transform = `translateX(${idx * 100}%)`;
108
+
109
+ let image = document.createElement("img");
110
+ image.src = img;
111
+
112
+ slide.appendChild(image);
113
+ slider.appendChild(slide);
114
+ this.slides.push(slide);
115
+ });
116
+ }
117
+ }
118
+
119
+ customElements.define("img-carousel", ImgCarousel);
@@ -1,12 +1,23 @@
1
1
  const components = {
2
- "TestComponent": "Visual",
3
- "FetchManager": "Service",
4
- "IndexedDbManager": "Service",
5
- "LocalStorageManager": "Service",
6
- "Translator": "Service",
7
- "TestProvider": "Provider",
8
- "Controller": "Structural",
9
- "Debugger": "Structural",
10
- "Logger": "Structural",
11
- "StylesManager": "Structural"
12
- }; export default components;
2
+ Tester: "Visual",
3
+ Button: "Visual",
4
+ Input: "Visual",
5
+ Checkbox: "Visual",
6
+ Select: "Visual",
7
+ Switch: "Visual",
8
+ TestComponent: "Visual",
9
+ FetchManager: "Service",
10
+ IndexedDbManager: "Service",
11
+ LocalStorageManager: "Service",
12
+ Translator: "Service",
13
+ TestProvider: "Provider",
14
+ Controller: "Structural",
15
+ Debugger: "Structural",
16
+ Logger: "Structural",
17
+ StylesManager: "Structural",
18
+ Icon: "Visual",
19
+ Loading: "Visual",
20
+ Card: "Visual",
21
+ NavBar: "Visual",
22
+ };
23
+ export default components;