@githubnext/blocks-runtime
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -98,3 +98,2 @@ "use strict"; | ||
var elements = []; | ||
var root = import_client.default.createRoot(document.getElementById("root")); | ||
var findBlockBundleName = (bundle) => { | ||
@@ -166,2 +165,3 @@ let blockBundleName; | ||
}; | ||
var root; | ||
var makeReactSetBlockProps = () => { | ||
@@ -207,2 +207,5 @@ const Block = window.BlockBundle({ | ||
}; | ||
if (!root) { | ||
root = import_client.default.createRoot(document.getElementById("root")); | ||
} | ||
root.render( | ||
@@ -271,4 +274,21 @@ import_react.default.createElement( | ||
} | ||
if (bundle === null) { | ||
} else if (!setBlockProps) { | ||
const root2 = document.getElementById("root"); | ||
if (root2.children.length === 1 && (root2.children[0].id === "__loading__" || root2.children[0].id === "__not_found__")) { | ||
root2.removeChild(root2.children[0]); | ||
} | ||
if (bundle === null || !setBlockProps) { | ||
const div = document.createElement("div"); | ||
div.id = bundle == null ? "__not_found__" : "__loading__"; | ||
div.style.width = "100%"; | ||
div.style.height = "100%"; | ||
div.style.display = "flex"; | ||
div.style.alignItems = "center"; | ||
div.style.justifyContent = "center"; | ||
div.style.color = "#ddd"; | ||
div.style.fontStyle = "italic"; | ||
const text = document.createTextNode( | ||
bundle === null ? "Block not found" : "Loading..." | ||
); | ||
div.appendChild(text); | ||
root2.appendChild(div); | ||
} else { | ||
@@ -275,0 +295,0 @@ const wrappedSetBlockProps = (props2) => { |
{ | ||
"name": "@githubnext/blocks-runtime", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
20326
626