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.
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/FetchManager/FetchManager.js +109 -37
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/Translator.js +15 -15
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Service/Translator/messages.json +50 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Controller/Controller.js +81 -83
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.css +47 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.html +7 -3
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Debugger/Debugger.js +114 -41
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/Logger/Logger.js +11 -11
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Structural/StylesManager/StylesManager.js +32 -28
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.css +44 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.html +5 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Button/Button.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.css +63 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.html +7 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Card/Card.js +110 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.css +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Checkbox/Checkbox.js +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.css +97 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.html +18 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/CodeValidator/CodeValidator.js +86 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.css +505 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.html +1 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/Icon.js +95 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.eot +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.json +550 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.styl +502 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.svg +1470 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.symbol.svg +1035 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.ttf +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Icon/slc.woff2 +0 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.css +87 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.html +4 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Input/Input.js +210 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.css +56 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.html +83 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Loading/Loading.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.css +30 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.html +6 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Navbar/Navbar.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.css +91 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Select/Select.js +210 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.css +76 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.html +8 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Switch/Switch.js +109 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.css +34 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.html +7 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester/Tester.js +33 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.css +34 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.html +43 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/Tester2/Tester2.js +39 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.css +110 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.html +12 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/ToastAlert/ToastAlert.js +65 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.css +163 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.html +15 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/complexNavbar/complexNavbar.js +48 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.css +56 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.html +6 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/Visual/imageCarousel/img-carousel.js +119 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Components/components.js +22 -11
- package/PROJECT_TEMPLATES/Basic/Slice/Slice.js +169 -147
- package/PROJECT_TEMPLATES/Basic/Slice/Styles/sliceStyles.css +10 -0
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Dark.css +33 -9
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Light.css +27 -10
- package/PROJECT_TEMPLATES/Basic/Slice/Themes/Slice.css +27 -12
- package/PROJECT_TEMPLATES/Basic/Slice/package.json +12 -0
- package/PROJECT_TEMPLATES/Basic/Slice/sliceConfig.json +9 -1
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.html +9 -13
- package/PROJECT_TEMPLATES/Basic/src/Views/LandingPage/index.js +381 -9
- package/commands/createComponent/createComponent.js +4 -1
- package/commands/deleteComponent/deleteComponent.js +7 -1
- package/commands/listComponents/listComponents.js +12 -3
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
.slice_checkbox input {
|
|
2
|
+
position: absolute;
|
|
3
|
+
opacity: 0;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
height: 0;
|
|
6
|
+
width: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.slice_checkbox_container {
|
|
10
|
+
width: fit-content;
|
|
11
|
+
}
|
|
12
|
+
.slice_checkbox {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
user-select: none;
|
|
16
|
+
margin-top: 25px;
|
|
17
|
+
margin-bottom: 25px;
|
|
18
|
+
position: relative;
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
.checkbox_label {
|
|
22
|
+
margin: 5px;
|
|
23
|
+
font-family: var(--font-family);
|
|
24
|
+
color: var(--font-primary-color);
|
|
25
|
+
}
|
|
26
|
+
.checkmark {
|
|
27
|
+
position: relative;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
height: 1.3em;
|
|
31
|
+
width: 1.3em;
|
|
32
|
+
background-color: var(--secondary-background-color);
|
|
33
|
+
border: var(--slice-border) solid var(--primary-color);
|
|
34
|
+
transition: all 0.3s;
|
|
35
|
+
border-radius: var(--border-radius-slice);
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
.slice_checkbox input:checked ~ .checkmark {
|
|
39
|
+
border: var(--slice-border) solid var(--success-color);
|
|
40
|
+
background-color: var(--success-color);
|
|
41
|
+
animation: pop 0.5s;
|
|
42
|
+
animation-direction: alternate;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.checkmark:after {
|
|
46
|
+
content: "";
|
|
47
|
+
position: absolute;
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.slice_checkbox input:checked ~ .checkmark:after {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.slice_checkbox .checkmark:after {
|
|
56
|
+
left: 0.45em;
|
|
57
|
+
top: 0.25em;
|
|
58
|
+
width: 0.25em;
|
|
59
|
+
height: 0.5em;
|
|
60
|
+
border: solid white;
|
|
61
|
+
border-width: 0 0.15em 0.15em 0;
|
|
62
|
+
transform: rotate(45deg);
|
|
63
|
+
}
|
|
64
|
+
.disabled {
|
|
65
|
+
border-color: var(--disabled-color);
|
|
66
|
+
background-color: var(--primary-color-shade);
|
|
67
|
+
color: var(--disabled-color);
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
}
|
|
70
|
+
@keyframes pop {
|
|
71
|
+
0% {
|
|
72
|
+
transform: scale(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
50% {
|
|
76
|
+
transform: scale(0.9);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
100% {
|
|
80
|
+
transform: scale(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.checkbox_label {
|
|
84
|
+
margin-left: 5px;
|
|
85
|
+
font-family: var(--font-family);
|
|
86
|
+
color: var(--font-primary-color);
|
|
87
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export default class Checkbox extends HTMLElement {
|
|
2
|
+
constructor(props) {
|
|
3
|
+
super();
|
|
4
|
+
slice.attachTemplate(this);
|
|
5
|
+
this.$checkbox = this.querySelector(".slice_checkbox");
|
|
6
|
+
this.$checkmark = this.querySelector(".checkmark");
|
|
7
|
+
|
|
8
|
+
slice.controller.setComponentProps(this, props);
|
|
9
|
+
this.debuggerProps = ["checked", "disabled", "customColor", "position"];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
init() {
|
|
13
|
+
if (this._checked === undefined) {
|
|
14
|
+
this.checked = false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if(!this.disabled){
|
|
18
|
+
this._disabled=false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get checked() {
|
|
24
|
+
return this._checked;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
set checked(value) {
|
|
28
|
+
this._checked = value;
|
|
29
|
+
this.querySelector("input").checked = value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get label() {
|
|
33
|
+
return this._label;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set label(value) {
|
|
37
|
+
this._label = value;
|
|
38
|
+
if (this.querySelector(".checkbox_label")) {
|
|
39
|
+
this.querySelector(".checkbox_label").textContent = value;
|
|
40
|
+
} else {
|
|
41
|
+
const label = document.createElement("label");
|
|
42
|
+
label.classList.add("checkbox_label");
|
|
43
|
+
label.textContent = value;
|
|
44
|
+
this.$checkbox.appendChild(label);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get customColor() {
|
|
49
|
+
return this._customColor;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set customColor(value) {
|
|
53
|
+
this._customColor = value;
|
|
54
|
+
this.style = `--success-color: ${value};`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get position() {
|
|
58
|
+
return this._position;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set position(value) {
|
|
62
|
+
if (value === "left") {
|
|
63
|
+
this.$checkbox.style = ` flex-direction: row-reverse;`;
|
|
64
|
+
}
|
|
65
|
+
if (value === "right") {
|
|
66
|
+
this.$checkbox.style = `flex-direction: row;`;
|
|
67
|
+
}
|
|
68
|
+
if (value === "top") {
|
|
69
|
+
this.$checkbox.style = `flex-direction: column-reverse;`;
|
|
70
|
+
}
|
|
71
|
+
if (value === "bottom") {
|
|
72
|
+
this.$checkbox.style = `flex-direction: column;`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get disabled() {
|
|
77
|
+
return this._disabled;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
set disabled(value) {
|
|
81
|
+
this._disabled = value;
|
|
82
|
+
this.querySelector("input").disabled = value;
|
|
83
|
+
this.$checkmark.classList.add("disabled");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
customElements.define("slice-checkbox", Checkbox);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* Import Google font - Poppins */
|
|
2
|
+
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap");
|
|
3
|
+
* {
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-family: "Poppins", sans-serif;
|
|
8
|
+
}
|
|
9
|
+
body {
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
background: #4070f4;
|
|
15
|
+
}
|
|
16
|
+
:where(.container, form, .input-field, header) {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
.container {
|
|
23
|
+
background: #fff;
|
|
24
|
+
padding: 30px 65px;
|
|
25
|
+
border-radius: 12px;
|
|
26
|
+
row-gap: 20px;
|
|
27
|
+
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
|
|
28
|
+
z-index: 15000;
|
|
29
|
+
position: fixed;
|
|
30
|
+
}
|
|
31
|
+
.container header {
|
|
32
|
+
height: 65px;
|
|
33
|
+
width: 65px;
|
|
34
|
+
background: #4070f4;
|
|
35
|
+
color: #fff;
|
|
36
|
+
font-size: 2.5rem;
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
}
|
|
39
|
+
.container h4 {
|
|
40
|
+
font-size: 1.25rem;
|
|
41
|
+
color: #333;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
}
|
|
44
|
+
form .input-field {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
column-gap: 10px;
|
|
47
|
+
}
|
|
48
|
+
.input-field input {
|
|
49
|
+
height: 45px;
|
|
50
|
+
width: 42px;
|
|
51
|
+
border-radius: 6px;
|
|
52
|
+
outline: none;
|
|
53
|
+
font-size: 1.125rem;
|
|
54
|
+
text-align: center;
|
|
55
|
+
border: 1px solid #ddd;
|
|
56
|
+
}
|
|
57
|
+
.input-field input:focus {
|
|
58
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
|
|
59
|
+
}
|
|
60
|
+
.input-field input::-webkit-inner-spin-button,
|
|
61
|
+
.input-field input::-webkit-outer-spin-button {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
form button {
|
|
65
|
+
margin-top: 25px;
|
|
66
|
+
width: 100%;
|
|
67
|
+
color: #fff;
|
|
68
|
+
font-size: 1rem;
|
|
69
|
+
border: none;
|
|
70
|
+
padding: 9px 0;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
border-radius: 6px;
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
background: #6e93f7;
|
|
75
|
+
transition: all 0.2s ease;
|
|
76
|
+
}
|
|
77
|
+
form button.active {
|
|
78
|
+
background: #4070f4;
|
|
79
|
+
pointer-events: auto;
|
|
80
|
+
}
|
|
81
|
+
form button:hover {
|
|
82
|
+
background: #0e4bf1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.center-screen {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 50%;
|
|
88
|
+
left: 50%;
|
|
89
|
+
margin-right: -50%;
|
|
90
|
+
transform: translate(-50%, -50%);
|
|
91
|
+
z-index: 100000;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.container::backdrop{
|
|
95
|
+
background-color: black;
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<link rel="stylesheet" href="./Slice/css/CodeValidator.css">
|
|
2
|
+
<div class="container center-screen">
|
|
3
|
+
<header>
|
|
4
|
+
<i class="bx bxs-check-shield"></i>
|
|
5
|
+
</header>
|
|
6
|
+
<h4>Enter OTP Code</h4>
|
|
7
|
+
<form action="#">
|
|
8
|
+
<div class="input-field">
|
|
9
|
+
<input type="number" />
|
|
10
|
+
<input type="number" disabled />
|
|
11
|
+
<input type="number" disabled />
|
|
12
|
+
<input type="number" disabled />
|
|
13
|
+
<input type="number" disabled />
|
|
14
|
+
<input type="number" disabled />
|
|
15
|
+
</div>
|
|
16
|
+
<button>Verify OTP</button>
|
|
17
|
+
</form>
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export default class Button extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
slice.controller
|
|
5
|
+
.loadTemplate("./Slice/templates/codeValidator.html")
|
|
6
|
+
.then((template) => {
|
|
7
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
8
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
9
|
+
|
|
10
|
+
const inputs = this.shadowRoot.querySelectorAll("input"),
|
|
11
|
+
button = this.shadowRoot.querySelector("button");
|
|
12
|
+
|
|
13
|
+
// iterate over all inputs
|
|
14
|
+
inputs.forEach((input, index1) => {
|
|
15
|
+
input.addEventListener("keyup", (e) => {
|
|
16
|
+
// This code gets the current input element and stores it in the currentInput variable
|
|
17
|
+
// This code gets the next sibling element of the current input element and stores it in the nextInput variable
|
|
18
|
+
// This code gets the previous sibling element of the current input element and stores it in the prevInput variable
|
|
19
|
+
const currentInput = input,
|
|
20
|
+
nextInput = input.nextElementSibling,
|
|
21
|
+
prevInput = input.previousElementSibling;
|
|
22
|
+
|
|
23
|
+
// if the value has more than one character then clear it
|
|
24
|
+
if (currentInput.value.length > 1) {
|
|
25
|
+
currentInput.value = "";
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// if the next input is disabled and the current value is not empty
|
|
29
|
+
// enable the next input and focus on it
|
|
30
|
+
if (
|
|
31
|
+
nextInput &&
|
|
32
|
+
nextInput.hasAttribute("disabled") &&
|
|
33
|
+
currentInput.value !== ""
|
|
34
|
+
) {
|
|
35
|
+
nextInput.removeAttribute("disabled");
|
|
36
|
+
nextInput.focus();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// if the backspace key is pressed
|
|
40
|
+
if (e.key === "Backspace") {
|
|
41
|
+
// iterate over all inputs again
|
|
42
|
+
inputs.forEach((input, index2) => {
|
|
43
|
+
// if the index1 of the current input is less than or equal to the index2 of the input in the outer loop
|
|
44
|
+
// and the previous element exists, set the disabled attribute on the input and focus on the previous element
|
|
45
|
+
if (index1 <= index2 && prevInput) {
|
|
46
|
+
input.setAttribute("disabled", true);
|
|
47
|
+
input.value = "";
|
|
48
|
+
prevInput.focus();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//if the fourth input( which index number is 3) is not empty and has not disable attribute then
|
|
53
|
+
//add active class if not then remove the active class.
|
|
54
|
+
if (!inputs[5].disabled && inputs[5].value !== "") {
|
|
55
|
+
button.classList.add("active");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
button.classList.remove("active");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
//focus the first input which index is 0 on window load
|
|
63
|
+
window.addEventListener("load", () => inputs[0].focus());
|
|
64
|
+
|
|
65
|
+
slice.controller.registerComponent(this);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
show() {
|
|
70
|
+
document.body.appendChild(this);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getSubmitButton() {
|
|
74
|
+
return this.shadowRoot.querySelector("button");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getCode() {
|
|
78
|
+
let code = "";
|
|
79
|
+
const inputs = this.shadowRoot.querySelectorAll("input");
|
|
80
|
+
inputs.forEach((input) => {
|
|
81
|
+
code += input.value;
|
|
82
|
+
});
|
|
83
|
+
return code;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
window.customElements.define("my-button", Button);
|