zextra
Version:
***Zextra*** stands for "Ziko Extra" is an extension package that enhances [ZikoJS](https://github.com/zakarialaoui10/ziko.js) by providing additional utilities and UI elements. It expands ZikoJS with extra features, making it easier to work with custom U
36 lines • 1.07 kB
JavaScript
import ZikoSvgElement from "../ZikoSvgElement.js";
import { Flex } from "ziko"
class ZikoSvgForeignObject extends ZikoSvgElement{
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
super("foreignObject")
this.items=[];
this.element=document?.createElementNS(
"http://www.w3.org/2000/svg",
"foreignObject",
);
this.container=Flex().setTarget(this.element).vertical(0,0).size("auto","auto");
this.container.st.scaleY(-1);
this.posX(x).posY(y).width(w).height(h);
}
width(w){
this.element.etAttribute("width",w)
return this;
}
height(h){
this.element.etAttribute("height",h)
return this;
}
add(...ZikoUIElement){
this.container.append(...ZikoUIElement);
return this;
}
remove(...ZikoUIElement){
this.container.append(...ZikoUIElement);
return this;
}
}
const svgObject=(x, y, w, h)=>new ZikoSvgForeignObject(x, y, w, h);
export {
svgObject,
ZikoSvgForeignObject
}