-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding CustomElements and removing some of the default one
- Loading branch information
1 parent
3e7f0b1
commit 1e8c365
Showing
20 changed files
with
130 additions
and
1,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export class ACritic extends HTMLElement { | ||
|
||
#root: ShadowRoot; | ||
|
||
static get observedAttributes() { | ||
return ['name', 'persona']; | ||
} | ||
|
||
attributeChangedCallback(name: string, oldValue: string, newValue: string) { | ||
this.#root.querySelector(`#${name}`)?.setAttribute('value', newValue); | ||
} | ||
|
||
get name() { | ||
return this.getAttribute('name'); | ||
} | ||
|
||
set name(value) { | ||
if (value) { | ||
this.setAttribute('name', value); | ||
} | ||
else { | ||
this.removeAttribute('name'); | ||
} | ||
} | ||
|
||
get persona() { | ||
return this.getAttribute('persona'); | ||
} | ||
|
||
set persona(value) { | ||
if (value) { | ||
this.setAttribute('persona', value); | ||
} | ||
else { | ||
this.removeAttribute('persona'); | ||
} | ||
} | ||
|
||
constructor() { | ||
super(); | ||
this.#root = this.attachShadow({ mode: "open" }); | ||
this.#root.innerHTML = ` | ||
<style> | ||
:host { | ||
display: block; | ||
padding: 10px; | ||
} | ||
</style> | ||
<div> | ||
<input type=text id="name" value="${this.name}"> | ||
<input type=text id="persona" value="${this.persona}"> | ||
</div> | ||
<slot></slot> | ||
`; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.