1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-21 23:39:37 +01:00
deka-dom-el/examples/exports.js
Jan Andrle cd62782c7b
Replace “observable” term with “signal” (#19)
*  refact docs

to make editing (now renaming observables to signal) easier

*   use signal(s) term isntead of observable(s)

*  🔤 version + typo

* 🐛 customElement example (0→S)

* 📺 version in package-lock.json
2024-05-22 21:43:49 +02:00

31 lines
801 B
JavaScript

import * as dde_dom from "../index.js";
export * from "../index.js";
import * as dde_s from "../signals.js";
export * from "../signals.js";
Object.assign(globalThis, dde_dom, dde_s);
//import * as dde_dom from "../dist/esm-with-signals.js";
//export * from "../dist/esm-with-signals.js";
//Object.assign(globalThis, dde_dom);
export const style= createStyle();
function createStyle(){
const element= dde_dom.el("style");
const store= new WeakSet();
let host;
return {
element,
host(k, h= k.name){
if(store.has(k)) return { css: ()=> {} };
store.add(k);
host= h;
return this;
},
css(...args){
const textContent= String.raw(...args).replaceAll(":host", "."+host);
const className= host;
element.appendChild(el("#text", { textContent }));
return className;
}
};
}