mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-25 01:39:37 +01:00
Compare commits
No commits in common. "4014e79740b1529e62b39d764e1dd5490a750d58" and "f1983dcd38821cb4eca8fe4ae587eba5ea521cff" have entirely different histories.
4014e79740
...
f1983dcd38
717
dist/dde-with-observables.js
vendored
717
dist/dde-with-observables.js
vendored
File diff suppressed because one or more lines are too long
488
dist/dde.js
vendored
488
dist/dde.js
vendored
File diff suppressed because one or more lines are too long
695
dist/esm-with-observables.js
vendored
695
dist/esm-with-observables.js
vendored
File diff suppressed because one or more lines are too long
469
dist/esm.js
vendored
469
dist/esm.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,4 +31,4 @@ import { lifecyclesToEvents } from "deka-dom-el";
|
|||||||
set customAttribute(value){ this.setAttribute("custom-attribute", value); }
|
set customAttribute(value){ this.setAttribute("custom-attribute", value); }
|
||||||
}
|
}
|
||||||
customElements.define(CustomHTMLElement.tagName, CustomHTMLElement);
|
customElements.define(CustomHTMLElement.tagName, CustomHTMLElement);
|
||||||
</code></div><p><a href="https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4" title="Ideas and tips from WebReflection">Handy Custom Elements' Patterns</a></p><div class="notice"><!--<dde:mark type="component" name="mnemonic" host="parentElement" ssr/>--><h3 id="h-mnemonic"><!--<dde:mark type="component" name="h3" host="parentElement" ssr/>--><a href="#h-mnemonic" tabindex="-1">#</a> Mnemonic</h3><ul><li><code>customElementRender(<custom-element>, <render-function>[, <properties>])</code> — use function to render DOM structure for given <custom-element></li><li><code>customElementWithDDE(<custom-element>)</code> — register <custom-element> to DDE library, see also `lifecyclesToEvents`, can be also used as decorator</li><li><code>observedAttributes(<custom-element>)</code> — returns record of observed attributes (keys uses camelCase)</li><li><code>O.observedAttributes(<custom-element>)</code> — returns record of observed attributes (keys uses camelCase and values are observables)</li><li><code>lifecyclesToEvents(<class-declaration>)</code> — convert lifecycle methods to events, can be also used as decorator</li></ul></div><div class="prevNext"><!--<dde:mark type="component" name="prevNext" host="parentElement" ssr/>--><a rel="prev" href="p05-scopes" title="Organizing UI into components"><!--<dde:mark type="component" name="pageLink" host="parentElement" ssr/>-->Scopes and components (previous)</a><!--<dde:mark type="component" name="pageLink" host="this" ssr/>--></div></main></body></html>
|
</code></div><p><a href="https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4" title="Ideas and tips from WebReflection">Handy Custom Elements' Patterns</a></p><div class="notice"><!--<dde:mark type="component" name="mnemonic" host="parentElement" ssr/>--><h3 id="h-mnemonic"><!--<dde:mark type="component" name="h3" host="parentElement" ssr/>--><a href="#h-mnemonic" tabindex="-1">#</a> Mnemonic</h3><ul><li><code>customElementRender(<custom-element>, <render-function>[, <properties>])</code> — use function to render DOM structure for given <custom-element></li><li><code>customElementWithDDE(<custom-element>)</code> — register <custom-element> to DDE library, see also `lifecycleToEvents`, can be also used as decorator</li><li><code>observedAttributes(<custom-element>)</code> — returns record of observed attributes (keys uses camelCase)</li><li><code>O.observedAttributes(<custom-element>)</code> — returns record of observed attributes (keys uses camelCase and values are observables)</li><li><code>lifecycleToEvents(<class-declaration>)</code> — convert lifecycle methods to events, can be also used as decorator</li></ul></div><div class="prevNext"><!--<dde:mark type="component" name="prevNext" host="parentElement" ssr/>--><a rel="prev" href="p05-scopes" title="Organizing UI into components"><!--<dde:mark type="component" name="pageLink" host="parentElement" ssr/>-->Scopes and components (previous)</a><!--<dde:mark type="component" name="pageLink" host="this" ssr/>--></div></main></body></html>
|
||||||
|
@ -12,10 +12,7 @@ ${host}{
|
|||||||
background: #212121 !important;
|
background: #212121 !important;
|
||||||
border: 1px solid white;
|
border: 1px solid white;
|
||||||
}
|
}
|
||||||
`;
|
`
|
||||||
|
|
||||||
const dde_content= s.cat(new URL("../../dist/esm-with-observables.js", import.meta.url)).toString();
|
|
||||||
|
|
||||||
import { el } from "deka-dom-el";
|
import { el } from "deka-dom-el";
|
||||||
import { code } from "./code.html.js";
|
import { code } from "./code.html.js";
|
||||||
import { relative } from "node:path";
|
import { relative } from "node:path";
|
||||||
@ -29,7 +26,7 @@ import { relative } from "node:path";
|
|||||||
export function example({ src, language= "js", page_id }){
|
export function example({ src, language= "js", page_id }){
|
||||||
registerClientPart(page_id);
|
registerClientPart(page_id);
|
||||||
const content= s.cat(src).toString()
|
const content= s.cat(src).toString()
|
||||||
.replaceAll(/ from "deka-dom-el(\/observables)?";/g, ' from "./esm-with-observables.js";');
|
.replaceAll(/ from "deka-dom-el(\/observables)?";/g, ' from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-observables.js";');
|
||||||
const id= "code-example-"+generateCodeId(src);
|
const id= "code-example-"+generateCodeId(src);
|
||||||
return el().append(
|
return el().append(
|
||||||
el(code, { id, content, language, className: example.name }),
|
el(code, { id, content, language, className: example.name }),
|
||||||
@ -38,7 +35,7 @@ export function example({ src, language= "js", page_id }){
|
|||||||
}
|
}
|
||||||
function elCode({ id, content, extension: name }){
|
function elCode({ id, content, extension: name }){
|
||||||
const options= JSON.stringify({
|
const options= JSON.stringify({
|
||||||
files: [{ name, content }, { name: "esm-with-observables.js", content: dde_content }],
|
files: [{ name, content }],
|
||||||
toolbar: false
|
toolbar: false
|
||||||
});
|
});
|
||||||
return el("script", `Flems(document.getElementById("${id}"), JSON.parse(${JSON.stringify(options)}));`);
|
return el("script", `Flems(document.getElementById("${id}"), JSON.parse(${JSON.stringify(options)}));`);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { el, empty, on } from "deka-dom-el";
|
import { el, empty } from "deka-dom-el";
|
||||||
document.body.append(
|
document.body.append(
|
||||||
el(component),
|
el(component),
|
||||||
el("button", {
|
el("button", {
|
||||||
@ -7,6 +7,7 @@ document.body.append(
|
|||||||
type: "button"
|
type: "button"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
import { on } from "deka-dom-el";
|
||||||
import { O } from "deka-dom-el/observables";
|
import { O } from "deka-dom-el/observables";
|
||||||
function component(){
|
function component(){
|
||||||
const textContent= O("Click to change text.");
|
const textContent= O("Click to change text.");
|
||||||
|
Loading…
Reference in New Issue
Block a user