|
|
@ -484,6 +484,68 @@ export default function dom(
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lightDom){
|
|
|
|
|
|
|
|
declaration.body.body.push({
|
|
|
|
|
|
|
|
type: 'MethodDefinition',
|
|
|
|
|
|
|
|
kind: 'method',
|
|
|
|
|
|
|
|
static: false,
|
|
|
|
|
|
|
|
computed: false,
|
|
|
|
|
|
|
|
key: { type: 'Identifier', name: '_copycontent' },
|
|
|
|
|
|
|
|
value: x`function() {
|
|
|
|
|
|
|
|
if(this.children){
|
|
|
|
|
|
|
|
this._content = Array.from(this.childNodes)
|
|
|
|
|
|
|
|
while (this.firstChild) {
|
|
|
|
|
|
|
|
this.removeChild(this.firstChild)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}` as FunctionExpression
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
declaration.body.body.push({
|
|
|
|
|
|
|
|
type: 'MethodDefinition',
|
|
|
|
|
|
|
|
kind: 'method',
|
|
|
|
|
|
|
|
static: false,
|
|
|
|
|
|
|
|
computed: false,
|
|
|
|
|
|
|
|
key: { type: 'Identifier', name: '_slotcontent' },
|
|
|
|
|
|
|
|
value: x`function() {
|
|
|
|
|
|
|
|
if(this.slotting) return; // prevent running in parallel
|
|
|
|
|
|
|
|
this.slotting = true;
|
|
|
|
|
|
|
|
if(this._content){
|
|
|
|
|
|
|
|
let namedslots = Array.from(this.querySelectorAll("slot[name]"))
|
|
|
|
|
|
|
|
let defaultslot = this.querySelector("slot:not([name])")
|
|
|
|
|
|
|
|
let named = {}
|
|
|
|
|
|
|
|
if(!namedslots.length && !defaultslot) return(this.slotting=false);
|
|
|
|
|
|
|
|
let slotted = []
|
|
|
|
|
|
|
|
this._content.filter((node)=> node.slot ).forEach((node)=> named[node.slot] = node )
|
|
|
|
|
|
|
|
namedslots.forEach(slot =>{
|
|
|
|
|
|
|
|
this._content.forEach(node =>{ //append all named slots
|
|
|
|
|
|
|
|
if(named[node.slot] && slot.getAttribute("name") == node.slot){
|
|
|
|
|
|
|
|
if(!slot.hasAttribute("hasupdated")){
|
|
|
|
|
|
|
|
slot.appendChild(named[node.slot]);
|
|
|
|
|
|
|
|
slot.setAttribute("hasupdated","")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
slotted.push(node)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if(!defaultslot) return(this.slotting=false);
|
|
|
|
|
|
|
|
// put what evers left info default slot
|
|
|
|
|
|
|
|
this._content
|
|
|
|
|
|
|
|
.filter(node => slotted.indexOf(node)==-1)
|
|
|
|
|
|
|
|
.forEach(node => {
|
|
|
|
|
|
|
|
if(!defaultslot.hasAttribute("hasupdated")){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defaultslot.appendChild(node)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
defaultslot.setAttribute("hasupdated","")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.slotting = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}` as FunctionExpression
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
declaration.body.body.push(...accessors);
|
|
|
|
declaration.body.body.push(...accessors);
|
|
|
|
|
|
|
|
|
|
|
|
body.push(declaration);
|
|
|
|
body.push(declaration);
|
|
|
|