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
export default class ElementBase extends HTMLElement { | |
constructor() { | |
super() | |
const name = this.tagName.toLowerCase() | |
const template = document.getElementById(`${name}-template`) | |
if (template) { | |
this.replaceChildren(template.content.cloneNode(true)) | |
} | |
} | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<template id="a"> | |
<style> | |
slot { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Single File Web Component</title> | |
</head> | |
<body> | |
<template id=single-file> | |
<style> | |
h1 { |
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
// Function name would be the page name | |
export async function Main(html, data) { | |
return html`<my-custom-element todos="${data.todos}"></my-custom-element>` | |
} |
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
<html> | |
<head></head> | |
<body> | |
<template id=my-paragraph-template> | |
<p> | |
<slot name="my-text"> | |
My default text | |
</slot> | |
</p> | |
</template> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<template id=begin-page-template> | |
<h1>Begin Page</h1> | |
<begin-content> |
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
import html from 'https://registry.begin.com/html' | |
export default function Login(state={}) { | |
return html` | |
<my-page> | |
<my-form> | |
<my-input></my-input> | |
<my-button>Submit</my-button> | |
</my-form> | |
</my-page> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<main> | |
<color-scale> | |
<form |
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
module.exports = function(hljs) { | |
const LITERALS = [ | |
'true', | |
'false', | |
'null' | |
].join(' ') | |
const BUILTIN = { | |
className: 'built_in', | |
begin: '^@.*' | |
} |
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
/* Hemisu Dark */ | |
.hljs { | |
display: block; | |
overflow-x: auto; | |
padding: 0.5em; | |
background: #282a36; | |
} | |
.hljs-comment, | |
.hljs-meta { |