add zstack , allow render for svgs
This commit is contained in:
@@ -194,4 +194,6 @@ window.testSuites.push( class testParse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disallow addEventListener inside of render
|
||||||
|
|
||||||
})
|
})
|
||||||
59
index.js
59
index.js
@@ -120,23 +120,6 @@ window.quillStyles.update = function(tag, string) {
|
|||||||
sheet.insertRule(`${tag} { ${string} }`, sheet.cssRules.length);
|
sheet.insertRule(`${tag} { ${string} }`, sheet.cssRules.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STRING TRANSLATORS */
|
|
||||||
|
|
||||||
window.html = function html(htmlString) {
|
|
||||||
let container = document.createElement('div');
|
|
||||||
container.innerHTML = htmlString;
|
|
||||||
|
|
||||||
if (container.children.length === 1) {
|
|
||||||
return container.children[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
let fragment = document.createDocumentFragment();
|
|
||||||
while (container.firstChild) {
|
|
||||||
fragment.appendChild(container.firstChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fragment;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* COMPATIBILITY */
|
/* COMPATIBILITY */
|
||||||
|
|
||||||
@@ -503,6 +486,24 @@ window.Registry = class Registry {
|
|||||||
|
|
||||||
/* DEFAULT WRAPPERS */
|
/* DEFAULT WRAPPERS */
|
||||||
|
|
||||||
|
window.html = function html(htmlString) {
|
||||||
|
let container = document.createElement('div');
|
||||||
|
container.innerHTML = htmlString;
|
||||||
|
|
||||||
|
if (container.children.length === 1) {
|
||||||
|
Registry.render(container.children[0])
|
||||||
|
return container.children[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let fragment = document.createDocumentFragment();
|
||||||
|
while (container.firstChild) {
|
||||||
|
fragment.appendChild(container.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
Registry.render(fragment)
|
||||||
|
return fragment;
|
||||||
|
};
|
||||||
|
|
||||||
window.a = function a({ href, name=href } = {}) {
|
window.a = function a({ href, name=href } = {}) {
|
||||||
let link = document.createElement("a")
|
let link = document.createElement("a")
|
||||||
link.setAttribute('href', href);
|
link.setAttribute('href', href);
|
||||||
@@ -577,6 +578,14 @@ window.HStack = function (cb = () => {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.ZStack = function (cb = () => {}) {
|
||||||
|
let nowRendering = window.rendering.last()
|
||||||
|
if(nowRendering.innerHTML === "") {
|
||||||
|
cb()
|
||||||
|
return nowRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* SHAPES */
|
/* SHAPES */
|
||||||
|
|
||||||
window.Circle = function(text = "") {
|
window.Circle = function(text = "") {
|
||||||
@@ -604,20 +613,6 @@ window.Triangle = function() {
|
|||||||
return div
|
return div
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Button = function(content = "") {
|
|
||||||
let div = document.createElement("div");
|
|
||||||
div.innerHTML = content;
|
|
||||||
div.style.color = "white";
|
|
||||||
div.style.textAlign = "center";
|
|
||||||
div.style.display = "flex";
|
|
||||||
div.style.alignItems = "center";
|
|
||||||
div.style.justifyContent = "center";
|
|
||||||
div.style.cursor = "pointer";
|
|
||||||
|
|
||||||
Registry.render(div);
|
|
||||||
return div;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PROTOTYPE FUNCTIONS */
|
/* PROTOTYPE FUNCTIONS */
|
||||||
|
|
||||||
Array.prototype.last = function() {
|
Array.prototype.last = function() {
|
||||||
@@ -648,7 +643,7 @@ HTMLElement.prototype.endingTag = function() {
|
|||||||
return `</${tag}>`;
|
return `</${tag}>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLElement.prototype.render = function (...els) {
|
Element.prototype.render = function (...els) {
|
||||||
if(els.length > 0) {
|
if(els.length > 0) {
|
||||||
this.innerHTML = ""
|
this.innerHTML = ""
|
||||||
els.forEach((el) => {
|
els.forEach((el) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user