mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-31 12:20:26 +08:00
Combines 2 PRs for testing (#1540)
* mount custom css to the web component (#1536) * set configurable min height prior to loading (#1532) * set configurable minheight prio to loading * formatting Co-authored-by: Abubakar Abid <abubakar@huggingface.co> * release beta version for testing (#1541) Co-authored-by: pngwn <hello@pngwn.io>
This commit is contained in:
parent
00e4b1436f
commit
cf027b68f4
@ -1 +1 @@
|
||||
3.0.10b16
|
||||
3.0.13b13
|
||||
|
@ -20,7 +20,46 @@
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<gradio-app space="nateraw/animegan-v2-for-videos"></gradio-app>
|
||||
<gradio-app space="gradio/Echocardiogram-Segmentation"></gradio-app>
|
||||
<h1>Hello title</h1>
|
||||
<h2>hello subtitle</h2>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<gradio-app
|
||||
space="nateraw/animegan-v2-for-videos"
|
||||
initial_height="800px"
|
||||
></gradio-app>
|
||||
<h2>hello subtitle</h2>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<p>
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text. Hello text. Hello text. Hello text. Hello text.
|
||||
Hello text. Hello text.
|
||||
</p>
|
||||
<gradio-app
|
||||
space="gradio/Echocardiogram-Segmentation"
|
||||
initial_height="400px"
|
||||
></gradio-app>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -102,16 +102,21 @@ async function get_config(space_id: string | null) {
|
||||
}
|
||||
}
|
||||
|
||||
function mount_css(
|
||||
url: string,
|
||||
function mount_custom_css(
|
||||
target: ShadowRoot | HTMLElement,
|
||||
css_string?: string
|
||||
): Promise<void> {
|
||||
) {
|
||||
if (css_string) {
|
||||
let style = document.createElement("style");
|
||||
style.innerHTML = css_string;
|
||||
target.appendChild(style);
|
||||
}
|
||||
}
|
||||
|
||||
function mount_css(
|
||||
url: string,
|
||||
target: ShadowRoot | HTMLElement
|
||||
): Promise<void> {
|
||||
if (BUILD_MODE === "dev") Promise.resolve();
|
||||
|
||||
const link = document.createElement("link");
|
||||
@ -137,6 +142,8 @@ async function handle_config(
|
||||
mount_css(ENTRY_CSS, target)
|
||||
]);
|
||||
|
||||
mount_custom_css(target, config.css);
|
||||
|
||||
if (config.dev_mode) {
|
||||
reload_check(config.root);
|
||||
}
|
||||
@ -219,6 +226,8 @@ function create_custom_element() {
|
||||
|
||||
async connectedCallback() {
|
||||
const space = this.getAttribute("space");
|
||||
const initial_height = this.getAttribute("initial_height");
|
||||
this.wrapper.style.minHeight = initial_height || "300px";
|
||||
|
||||
const config = await handle_config(this.root, space);
|
||||
mount_app(config, this.root, this.wrapper, this._id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user