mirror of
https://github.com/MercuryWorkshop/dreamlandjs.git
synced 2025-05-16 23:50:00 -04:00
rework <slot/>
This commit is contained in:
parent
b424342d64
commit
3cd8372c08
3 changed files with 4 additions and 5 deletions
1
AliceJS.d.ts
vendored
1
AliceJS.d.ts
vendored
|
@ -33,4 +33,5 @@ interface Element {
|
||||||
type DLComponent<T> = {
|
type DLComponent<T> = {
|
||||||
css: DLCSS,
|
css: DLCSS,
|
||||||
root: Element,
|
root: Element,
|
||||||
|
children: Element[],
|
||||||
} & T;
|
} & T;
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
(()=>{Object.assign(window,{css:f,rule:d,styled:{new:f,rule:d}});function u(t,o){let r=document.implementation.createHTMLDocument(""),n=document.createElement("style");r.body.appendChild(n);let s="";n.textContent=o;for(let e of n.sheet.cssRules)e.selectorText=e.selectorText.includes("self")?`.${t}.self${e.selectorText.replace("self","")}`:`.${t} ${e.selectorText}`,s+=`${e.cssText}
|
|
||||||
`;return s}function p(t,o,r){let n=`dream-${Array(16).fill(0).map(()=>Math.floor(Math.random()*16).toString(16)).join("")}`,s=document.createElement("style");document.head.appendChild(s);let e=[];for(let c in t)if(e.push(t[c]),o[c]){let i=o[c];if(isAJSReferences(i)){let m=e.length,a;handle(i,x=>{e[m]=String(x);let l=e.join("");l!=a&&(r?s.textContent=u(n,l):s.textContent=`.${n} { ${l}; }`),a=l})}else e.push(String(i))}return r?s.textContent=u(n,e.join("")):s.textContent=`.${n} { ${e.join("")}; }`,n}function d(t,...o){return p(t,o,!1)}function f(t,...o){return p(t,o,!0)}})();
|
|
6
js.js
6
js.js
|
@ -165,12 +165,12 @@ export function h(type, props, ...children) {
|
||||||
}
|
}
|
||||||
Object.assign(newthis, props);
|
Object.assign(newthis, props);
|
||||||
|
|
||||||
let slot = [];
|
newthis.children = [];
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
JSXAddChild(child, slot.push.bind(slot));
|
JSXAddChild(child, newthis.children.push.bind(slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
let elm = type.apply(newthis, [slot]);
|
let elm = type.apply(newthis);
|
||||||
elm.$ = newthis;
|
elm.$ = newthis;
|
||||||
newthis.root = elm;
|
newthis.root = elm;
|
||||||
if (newthis.css) {
|
if (newthis.css) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue