Skip to content

Commit e7d9a74

Browse files
committed
Code formatting
1 parent ea6074b commit e7d9a74

File tree

20 files changed

+341
-345
lines changed

20 files changed

+341
-345
lines changed

src/animations.js

Lines changed: 82 additions & 82 deletions
Large diffs are not rendered by default.

src/base-element.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,15 @@ export class BaseElement {
120120
data = content;
121121
} else if (content.includes('http')) {
122122
data = {
123-
url: content
123+
url: content,
124124
};
125125
} else {
126126
data = {
127-
text: content
127+
text: content,
128128
};
129129
}
130130
if (navigator.share && navigator.canShare(data)) {
131-
navigator.share(data)
132-
.then(() => console.log('[javascript-ui] Content was shared'))
133-
.catch((error) => console.log('[javascript-ui] Error sharing content', error));
131+
navigator.share(data).then(() => console.log('[javascript-ui] Content was shared')).catch((error) => console.log('[javascript-ui] Error sharing content', error));
134132
} else {
135133
console.error('[javascript-ui] Unable to share!');
136134
}

src/components/Model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) 2023 Brandon Jordan
33
*/
44

5-
import {Element} from "../element.js";
6-
import {render} from "../main.js";
5+
import {Element} from '../element.js';
6+
import {render} from '../main.js';
77

88
export function Model(store, callback) {
99
return new ModelElement(store, callback);

src/element.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class Element extends Events {
1919
} else if ((value) === false) {
2020
this.hide();
2121
}
22-
})
22+
});
2323
}
2424

2525
model(store, callback = null) {
@@ -68,9 +68,7 @@ export class Element extends Events {
6868
const type = 'text/plain';
6969
const blob = new Blob([text], {type});
7070
const data = [new ClipboardItem({[type]: blob})];
71-
navigator.clipboard.write(data)
72-
.then(() => console.log('[javascript-ui] Content was copied'))
73-
.catch((error) => console.log('[javascript-ui] Error copying content', error));
71+
navigator.clipboard.write(data).then(() => console.log('[javascript-ui] Content was copied')).catch((error) => console.log('[javascript-ui] Error copying content', error));
7472
});
7573
}
7674
return this;

src/elements/Button.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function Button(text) {
8-
return new ButtonTag('button', text);
8+
return new ButtonTag('button', text);
99
}
1010

1111
export function SubmitButton(text) {
12-
return new ButtonTag('submit', text);
12+
return new ButtonTag('submit', text);
1313
}
1414

1515
export function ResetButton(text) {
16-
return new ButtonTag('reset', text);
16+
return new ButtonTag('reset', text);
1717
}
1818

1919
class ButtonTag extends Element {
20-
constructor(type, text) {
21-
const element = document.createElement('button');
22-
super(element);
23-
this.element = element;
24-
if (type) {
25-
this.element.type = type;
26-
}
27-
if (text) {
28-
this.element.innerText = text;
29-
}
30-
}
20+
constructor(type, text) {
21+
const element = document.createElement('button');
22+
super(element);
23+
this.element = element;
24+
if (type) {
25+
this.element.type = type;
26+
}
27+
if (text) {
28+
this.element.innerText = text;
29+
}
30+
}
3131
}

src/elements/Canvas.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function Canvas() {
8-
return new CanvasTag();
8+
return new CanvasTag();
99
}
1010

1111
class CanvasTag extends Element {
12-
constructor() {
13-
const element = document.createElement('canvas');
14-
super(element);
15-
this.element = element;
16-
}
12+
constructor() {
13+
const element = document.createElement('canvas');
14+
super(element);
15+
this.element = element;
16+
}
1717

18-
context(id = '2d') {
19-
return this.element.getContext(id);
20-
}
18+
context(id = '2d') {
19+
return this.element.getContext(id);
20+
}
2121
}

src/elements/CheckBoxGroup.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function CheckBoxGroup(options) {
8-
return new InputCheckboxGroup(options);
8+
return new InputCheckboxGroup(options);
99
}
1010

1111
class InputCheckboxGroup extends Element {
12-
constructor(options) {
13-
const element = new DocumentFragment();
14-
for (let option in options) {
15-
const checkbox = document.createElement('input');
16-
checkbox.type = 'checkbox';
17-
checkbox.id = option;
18-
checkbox.name = option;
19-
element.append(checkbox);
20-
const label = document.createElement('label');
21-
label.innerText = options[option];
22-
label.setAttribute('for', option);
23-
element.append(label);
24-
}
25-
super(element);
26-
this.element = element;
27-
}
12+
constructor(options) {
13+
const element = new DocumentFragment();
14+
for (let option in options) {
15+
const checkbox = document.createElement('input');
16+
checkbox.type = 'checkbox';
17+
checkbox.id = option;
18+
checkbox.name = option;
19+
element.append(checkbox);
20+
const label = document.createElement('label');
21+
label.innerText = options[option];
22+
label.setAttribute('for', option);
23+
element.append(label);
24+
}
25+
super(element);
26+
this.element = element;
27+
}
2828
}

src/elements/Dropdown.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function Dropdown(options) {
8-
return new DropdownGroup(options);
8+
return new DropdownGroup(options);
99
}
1010

1111
class DropdownGroup extends Element {
12-
constructor(options) {
13-
const select = document.createElement('select');
14-
for (let option in options) {
15-
if (options[option].constructor === Object) {
16-
const optgroup = document.createElement('optgroup');
17-
optgroup.label = option;
18-
for (let groupOption in options[option]) {
19-
const optionTag = document.createElement('option');
20-
optionTag.value = groupOption;
21-
optionTag.innerText = options[option][groupOption];
22-
optgroup.appendChild(optionTag);
23-
}
24-
select.appendChild(optgroup);
25-
} else {
26-
const optionTag = document.createElement('option');
27-
optionTag.value = option;
28-
optionTag.innerText = options[option];
29-
select.appendChild(optionTag);
30-
}
31-
}
32-
super(select);
33-
this.element = select;
34-
}
12+
constructor(options) {
13+
const select = document.createElement('select');
14+
for (let option in options) {
15+
if (options[option].constructor === Object) {
16+
const optgroup = document.createElement('optgroup');
17+
optgroup.label = option;
18+
for (let groupOption in options[option]) {
19+
const optionTag = document.createElement('option');
20+
optionTag.value = groupOption;
21+
optionTag.innerText = options[option][groupOption];
22+
optgroup.appendChild(optionTag);
23+
}
24+
select.appendChild(optgroup);
25+
} else {
26+
const optionTag = document.createElement('option');
27+
optionTag.value = option;
28+
optionTag.innerText = options[option];
29+
select.appendChild(optionTag);
30+
}
31+
}
32+
super(select);
33+
this.element = select;
34+
}
3535
}

src/elements/Frame.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function Frame() {
8-
return new FrameTag();
8+
return new FrameTag();
99
}
1010

1111
class FrameTag extends Element {
12-
constructor() {
13-
const element = document.createElement('iframe');
14-
super(element);
15-
this.element = element;
16-
}
12+
constructor() {
13+
const element = document.createElement('iframe');
14+
super(element);
15+
this.element = element;
16+
}
1717

18-
src(src) {
19-
return this.attribute('src', src);
20-
}
18+
src(src) {
19+
return this.attribute('src', src);
20+
}
2121

22-
allow(allows) {
23-
if (allows && Array.isArray(allows)) {
24-
allows.forEach(function (a) {
25-
this.attribute('allow' + a, '');
26-
});
27-
}
28-
return this;
29-
}
22+
allow(allows) {
23+
if (allows && Array.isArray(allows)) {
24+
allows.forEach(function(a) {
25+
this.attribute('allow' + a, '');
26+
});
27+
}
28+
return this;
29+
}
3030

31-
border(border) {
32-
return this.attribute('frameborder', border);
33-
}
31+
border(border) {
32+
return this.attribute('frameborder', border);
33+
}
3434
}

src/elements/Image.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
/*
2-
* Copyright (c) 2022 Brandon Jordan
2+
* Copyright (c) 2023 Brandon Jordan
33
*/
44

55
import {Element} from '../element.js';
66

77
export function Image(src) {
8-
return new ImageTag(src);
8+
return new ImageTag(src);
99
}
1010

1111
class ImageTag extends Element {
12-
constructor(src) {
13-
const element = document.createElement('img');
14-
super(element);
15-
this.element = element;
16-
this.element.alt = 'Image';
17-
if (src) {
18-
this.element.src = src;
19-
}
20-
}
21-
22-
src(src) {
23-
return this.attribute('src', src);
24-
}
25-
26-
caption(caption) {
27-
return this.attribute('alt', caption);
28-
}
29-
30-
crossOrigin(cors) {
31-
return this.attribute('crossOrigin', cors);
32-
}
33-
34-
decoding(decoding) {
35-
return this.attribute('decoding', decoding);
36-
}
37-
38-
lazyLoad() {
39-
return this.attribute('loading', 'lazy');
40-
}
12+
constructor(src) {
13+
const element = document.createElement('img');
14+
super(element);
15+
this.element = element;
16+
this.element.alt = 'Image';
17+
if (src) {
18+
this.element.src = src;
19+
}
20+
}
21+
22+
src(src) {
23+
return this.attribute('src', src);
24+
}
25+
26+
caption(caption) {
27+
return this.attribute('alt', caption);
28+
}
29+
30+
crossOrigin(cors) {
31+
return this.attribute('crossOrigin', cors);
32+
}
33+
34+
decoding(decoding) {
35+
return this.attribute('decoding', decoding);
36+
}
37+
38+
lazyLoad() {
39+
return this.attribute('loading', 'lazy');
40+
}
4141
}

0 commit comments

Comments
 (0)