Upload folder using huggingface_hub
Browse filesFiles changed (17)
- 6.3.1/atoms/package.jsonAdded+34
- 6.3.1/atoms/src/Block.svelteAdded+253
- 6.3.1/atoms/src/BlockLabel.svelteAdded+90
- 6.3.1/atoms/src/BlockTitle.svelteAdded+63
- 6.3.1/atoms/src/CustomButton.svelteAdded+45
- 6.3.1/atoms/src/DownloadLink.svelteAdded+37
- 6.3.1/atoms/src/Empty.svelteAdded+63
- 6.3.1/atoms/src/FullscreenButton.svelteAdded+25
- 6.3.1/atoms/src/IconButton.svelteAdded+139
- 6.3.1/atoms/src/IconButtonWrapper.svelteAdded+105
- 6.3.1/atoms/src/Info.svelteAdded+22
- 6.3.1/atoms/src/SelectSource.svelteAdded+94
- 6.3.1/atoms/src/ShareButton.svelteAdded+39
- 6.3.1/atoms/src/Toolbar.svelteAdded+28
- 6.3.1/atoms/src/UploadText.svelteAdded+102
- 6.3.1/atoms/src/index.tsAdded+16
- 6.3.1/atoms/src/utils/parse_placeholder.tsAdded+27
12345678910111213141516171819202122232425262728293031323334{ "name": "@gradio/atoms", "version": "0.20.0", "description": "Gradio UI packages", "type": "module", "main": "src/index.ts", "author": "", "license": "ISC", "dependencies": { "@gradio/icons": "workspace:^", "@gradio/markdown-code": "workspace:^", "@gradio/utils": "workspace:^" }, "peerDependencies": { "svelte": "^5.43.4" }, "exports": { ".": { "gradio": "./src/index.ts", "svelte": "./dist/src/index.js", "types": "./dist/src/index.d.ts" }, "./package.json": "./package.json" }, "main_changeset": true, "repository": { "type": "git", "url": "git+https://github.com/gradio-app/gradio.git", "directory": "js/atoms" }, "scripts": { "sv-package": "svelte-package --input=. --tsconfig=../../tsconfig.json" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253<script lang="ts"> export let height: number | string | undefined = undefined; export let min_height: number | string | undefined = undefined; export let max_height: number | string | undefined = undefined; export let width: number | string | undefined = undefined; export let elem_id = ""; export let elem_classes: string[] = []; export let variant: "solid" | "dashed" | "none" = "solid"; export let border_mode: "base" | "focus" | "contrast" = "base"; export let padding = true; export let type: "normal" | "fieldset" = "normal"; export let test_id: string | undefined = undefined; export let explicit_call = false; export let container = true; export let visible: boolean | "hidden" = true; export let allow_overflow = true; export let overflow_behavior: "visible" | "auto" = "auto"; export let scale: number | null = null; export let min_width = 0; export let flex = false; export let resizable = false; export let rtl = false; export let fullscreen = false; let old_fullscreen = fullscreen;
let element: HTMLElement;
let tag = type === "fieldset" ? "fieldset" : "div";
let placeholder_height = 0; let placeholder_width = 0; let preexpansionBoundingRect: DOMRect | null = null;
function handleKeydown(event: KeyboardEvent): void { if (fullscreen && event.key === "Escape") { fullscreen = false; } }
$: if (fullscreen !== old_fullscreen) { old_fullscreen = fullscreen; if (fullscreen) { preexpansionBoundingRect = element.getBoundingClientRect(); placeholder_height = element.offsetHeight; placeholder_width = element.offsetWidth; window.addEventListener("keydown", handleKeydown); } else { preexpansionBoundingRect = null; window.removeEventListener("keydown", handleKeydown); } }
const get_dimension = ( dimension_value: string | number | undefined ): string | undefined => { if (dimension_value === undefined) { return undefined; } if (typeof dimension_value === "number") { return dimension_value + "px"; } else if (typeof dimension_value === "string") { return dimension_value; } };
$: if (!visible) { flex = false; }
const resize = (e: MouseEvent): void => { let prevY = e.clientY; const onMouseMove = (e: MouseEvent): void => { const dy: number = e.clientY - prevY; prevY = e.clientY; element.style.height = `${element.offsetHeight + dy}px`; }; const onMouseUp = (): void => { window.removeEventListener("mousemove", onMouseMove); window.removeEventListener("mouseup", onMouseUp); }; window.addEventListener("mousemove", onMouseMove); window.addEventListener("mouseup", onMouseUp); }; // When visible is False, we need to remove the component from the page // We can remove it by either modifying the AppTree in Blocks or by hiding the component here // We do it here because if visible is updated via an event, only the local state will be updated // and we would have to flow the state back up to modify the AppTree</script>
{#if visible === true || visible === "hidden"} <svelte:element this={tag} bind:this={element} data-testid={test_id} id={elem_id} class:hidden={visible === "hidden"} class="block {elem_classes?.join(' ') || ''}" class:padded={padding} class:flex class:border_focus={border_mode === "focus"} class:border_contrast={border_mode === "contrast"} class:hide-container={!explicit_call && !container} style:height={fullscreen ? undefined : get_dimension(height)} style:min-height={fullscreen ? undefined : get_dimension(min_height)} style:max-height={fullscreen ? undefined : get_dimension(max_height)} class:fullscreen class:animating={fullscreen && preexpansionBoundingRect !== null} style:--start-top={preexpansionBoundingRect ? `${preexpansionBoundingRect.top}px` : "0px"} style:--start-left={preexpansionBoundingRect ? `${preexpansionBoundingRect.left}px` : "0px"} style:--start-width={preexpansionBoundingRect ? `${preexpansionBoundingRect.width}px` : "0px"} style:--start-height={preexpansionBoundingRect ? `${preexpansionBoundingRect.height}px` : "0px"} style:width={fullscreen ? undefined : typeof width === "number" ? `calc(min(${width}px, 100%))` : get_dimension(width)} style:border-style={variant} style:overflow={allow_overflow ? overflow_behavior : "hidden"} style:flex-grow={scale} style:min-width={`calc(min(${min_width}px, 100%))`} style:border-width="var(--block-border-width)" class:auto-margin={scale === null} dir={rtl ? "rtl" : "ltr"} > <slot /> {#if resizable} <!-- svelte-ignore a11y-no-static-element-interactions --> <svg class="resize-handle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" on:mousedown={resize} > <line x1="1" y1="9" x2="9" y2="1" stroke="gray" stroke-width="0.5" /> <line x1="5" y1="9" x2="9" y2="5" stroke="gray" stroke-width="0.5" /> </svg> {/if} </svelte:element> {#if fullscreen} <div class="placeholder" style:height={placeholder_height + "px"} style:width={placeholder_width + "px"} ></div> {/if}{/if}
<style> .block { position: relative; margin: 0; box-shadow: var(--block-shadow); border-width: var(--block-border-width); border-color: var(--block-border-color); border-radius: var(--block-radius); background: var(--block-background-fill); width: 100%; line-height: var(--line-sm); } .block.fullscreen { border-radius: 0; }
.auto-margin { margin-left: auto; margin-right: auto; }
.block.border_focus { border-color: var(--color-accent); }
.block.border_contrast { border-color: var(--body-text-color); }
.padded { padding: var(--block-padding); }
.hidden { display: none; }
.flex { display: flex; flex-direction: column; } .hide-container:not(.fullscreen) { margin: 0; box-shadow: none; --block-border-width: 0; background: transparent; padding: 0; overflow: visible; } .resize-handle { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; fill: var(--block-border-color); cursor: nwse-resize; } .fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; overflow: auto; }
.animating { animation: pop-out 0.1s ease-out forwards; }
@keyframes pop-out { 0% { position: fixed; top: var(--start-top); left: var(--start-left); width: var(--start-width); height: var(--start-height); z-index: 100; } 100% { position: fixed; top: 0vh; left: 0vw; width: 100vw; height: 100vh; z-index: 1000; } }
.placeholder { border-radius: var(--block-radius); border-width: var(--block-border-width); border-color: var(--block-border-color); border-style: dashed; }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990<script lang="ts"> export let label: string | null = null; export let Icon: any; export let show_label = true; export let disable = false; export let float = true; export let rtl = false;</script>
<label for="" class:hide={!show_label} class:sr-only={!show_label} class:float class:hide-label={disable} data-testid="block-label" dir={rtl ? "rtl" : "ltr"}> <span> <Icon /> </span> {label}</label>
<style> label { display: inline-flex; align-items: center; z-index: var(--layer-2); box-shadow: var(--block-label-shadow); border: var(--block-label-border-width) solid var(--block-label-border-color); border-top: none; border-left: none; border-radius: var(--block-label-radius); background: var(--block-label-background-fill); padding: var(--block-label-padding); pointer-events: none; color: var(--block-label-text-color); font-weight: var(--block-label-text-weight); font-size: var(--block-label-text-size); line-height: var(--line-sm); } :global(.gr-group) label { border-top-left-radius: 0; }
label.float { position: absolute; top: var(--block-label-margin); left: var(--block-label-margin); } label:not(.float) { position: static; margin-top: var(--block-label-margin); margin-left: var(--block-label-margin); }
.hide { display: none; }
span { opacity: 0.8; margin-right: var(--size-2); width: calc(var(--block-label-text-size) - 1px); height: calc(var(--block-label-text-size) - 1px); } .hide-label { box-shadow: none; border-width: 0; background: transparent; overflow: visible; }
label[dir="rtl"] { border: var(--block-label-border-width) solid var(--block-label-border-color); border-top: none; border-right: none; border-bottom-left-radius: var(--block-radius); border-bottom-right-radius: var(--block-label-radius); border-top-left-radius: var(--block-label-radius); }
label[dir="rtl"] span { margin-left: var(--size-2); margin-right: 0; }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263<script lang="ts"> import { default as Info } from "./Info.svelte"; export let show_label = true; export let info: string | undefined = undefined; export let rtl = false;</script>
<span class:hide={!show_label} class:has-info={info != null} class:sr-only={!show_label} data-testid="block-info" dir={rtl ? "rtl" : "ltr"}> <slot /></span>{#if info} <Info {info} />{/if}
<style> span.has-info { margin-bottom: var(--spacing-xs); } span:not(.has-info) { margin-bottom: var(--spacing-lg); } span { display: inline-block; position: relative; z-index: var(--layer-4); border: solid var(--block-title-border-width) var(--block-title-border-color); border-radius: var(--block-title-radius); background: var(--block-title-background-fill); padding: var(--block-title-padding); color: var(--block-title-text-color); font-weight: var(--block-title-text-weight); font-size: var(--block-title-text-size); line-height: var(--line-sm); }
span[dir="rtl"] { display: block; }
.hide { margin: 0; height: 0; }
.sr-only { clip: rect(0, 0, 0, 0); position: absolute; margin: -1px; border-width: 0; padding: 0; width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445<script lang="ts"> import type { CustomButton } from "@gradio/utils";
export let button: CustomButton; export let on_click: (id: number) => void;</script>
<button class="custom-button" on:click={() => on_click(button.id)} title={button.value || ""} aria-label={button.value || "Custom action"}> {#if button.value} <span class="custom-button-label">{button.value}</span> {/if}</button>
<style> .custom-button { display: flex; align-items: center; justify-content: center; gap: var(--size-1); height: var(--size-6); padding: var(--size-1) var(--size-2); border: none; border-radius: var(--radius-sm); background: transparent; color: var(--block-title-text-color); cursor: pointer; transition: all 0.2s; font-size: var(--text-sm); margin-left: var(--size-1); }
.custom-button:hover { background: var(--background-fill-secondary); color: var(--body-text-color); }
.custom-button-label { white-space: nowrap; }</style>12345678910111213141516171819202122232425262728293031323334353637<script lang="ts"> import type { HTMLAnchorAttributes } from "svelte/elements"; import { createEventDispatcher } from "svelte";
interface DownloadLinkAttributes extends Omit<HTMLAnchorAttributes, "target"> { download: NonNullable<HTMLAnchorAttributes["download"]>; } type $$Props = DownloadLinkAttributes;
export let href: DownloadLinkAttributes["href"] = undefined; export let download: DownloadLinkAttributes["download"];
const dispatch = createEventDispatcher();</script>
<a style:position="relative" class="download-link" {href} target={typeof window !== "undefined" && window.__is_colab__ ? "_blank" : null} rel="noopener noreferrer" {download} {...$$restProps} on:click={dispatch.bind(null, "click")}> <slot /></a>
<style> .unstyled-link { all: unset; cursor: pointer; }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263<script lang="ts"> export let size: "small" | "large" = "small"; export let unpadded_box = false;
let el: HTMLDivElement; $: parent_height = compare_el_to_parent(el);
function compare_el_to_parent(el: HTMLDivElement): boolean { if (!el) return false;
const { height: el_height } = el.getBoundingClientRect(); const { height: parent_height } = el.parentElement?.getBoundingClientRect() || { height: el_height };
return el_height > parent_height + 2; }</script>
<div class="empty" class:small={size === "small"} class:large={size === "large"} class:unpadded_box bind:this={el} class:small_parent={parent_height} aria-label="Empty value"> <div class="icon"> <slot /> </div></div>
<style> .empty { display: flex; justify-content: center; align-items: center; margin-top: calc(0px - var(--size-6)); height: var(--size-full); }
.icon { opacity: 0.5; height: var(--size-5); color: var(--body-text-color); }
.small { min-height: calc(var(--size-32) - 20px); }
.large { min-height: calc(var(--size-64) - 20px); }
.unpadded_box { margin-top: 0; }
.small_parent { min-height: 100% !important; }</style>12345678910111213141516171819202122232425<script lang="ts"> import { createEventDispatcher } from "svelte"; import { IconButton } from "@gradio/atoms"; import { Maximize, Minimize } from "@gradio/icons";
const dispatch = createEventDispatcher<{ fullscreen: boolean; }>();
export let fullscreen;</script>
{#if fullscreen} <IconButton Icon={Minimize} label="Exit fullscreen mode" on:click={() => dispatch("fullscreen", false)} />{:else} <IconButton Icon={Maximize} label="Fullscreen" on:click={() => dispatch("fullscreen", true)} />{/if}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139<script lang="ts"> import { type Component } from "svelte"; export let Icon: Component; export let label = ""; export let show_label = false; export let pending = false; export let size: "x-small" | "small" | "large" | "medium" = "small"; export let padded = true; export let highlight = false; export let disabled = false; export let hasPopup = false; export let color = "var(--block-label-text-color)"; export let transparent = false; export let background = "var(--block-background-fill)"; export let border = "transparent"; $: _color = highlight ? "var(--color-accent)" : color;</script>
<button class="icon-button" {disabled} on:click aria-label={label} aria-haspopup={hasPopup} title={label} class:pending class:padded class:highlight class:transparent style:--border-color={border} style:color={!disabled && _color ? _color : "var(--block-label-text-color)"} style:--bg-color={!disabled ? background : "auto"}> {#if show_label}<span>{label}</span>{/if} <div class:x-small={size === "x-small"} class:small={size === "small"} class:large={size === "large"} class:medium={size === "medium"} > <svelte:component this={Icon} /> <slot /> </div></button>
<style> button { display: flex; justify-content: center; align-items: center; gap: 1px; z-index: var(--layer-2); border-radius: var(--radius-xs); color: var(--block-label-text-color); border: 1px solid var(--border-color); padding: var(--spacing-xxs); }
button:hover { background-color: var(--background-fill-secondary); }
button[disabled] { opacity: 0.5; box-shadow: none; }
button[disabled]:hover { cursor: not-allowed; }
.padded { background: var(--bg-color); }
button:hover, button.highlight { cursor: pointer; color: var(--color-accent); }
.padded:hover { color: var(--block-label-text-color); }
span { padding: 0px 1px; font-size: 10px; }
div { display: flex; align-items: center; justify-content: center; transition: filter 0.2s ease-in-out; }
.x-small { width: 10px; height: 10px; }
.small { width: 14px; height: 14px; }
.medium { width: 20px; height: 20px; }
.large { width: 22px; height: 22px; }
.pending { animation: flash 0.5s infinite; }
@keyframes flash { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
.transparent { background: transparent; border: none; box-shadow: none; }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105<script lang="ts"> import CustomButton from "./CustomButton.svelte"; import type { CustomButton as CustomButtonType } from "@gradio/utils";
export let top_panel = true; export let display_top_corner = false; export let show_background = true; export let buttons: (string | CustomButtonType)[] | null = null; export let on_custom_button_click: ((id: number) => void) | null = null;</script>
<div class={`icon-button-wrapper ${top_panel ? "top-panel" : ""} ${display_top_corner ? "display-top-corner" : "hide-top-corner"} ${!show_background ? "no-background" : ""}`}> <slot></slot> {#if buttons} {#each buttons as btn} {#if typeof btn !== "string"} <CustomButton button={btn} on_click={(id) => { if (on_custom_button_click) { on_custom_button_click(id); } }} /> {/if} {/each} {/if}</div>
<style> .icon-button-wrapper { display: flex; flex-direction: row; align-items: center; justify-content: center; z-index: var(--layer-2); gap: var(--spacing-sm); box-shadow: var(--shadow-drop); border: 1px solid var(--border-color-primary); background: var(--block-background-fill); padding: var(--spacing-xxs); }
.icon-button-wrapper.hide-top-corner { border-top: none; border-right: none; border-radius: var(--block-label-right-radius); }
.icon-button-wrapper.display-top-corner { border-radius: var(--radius-sm) 0 0 var(--radius-sm); top: var(--spacing-sm); right: -1px; }
.icon-button-wrapper:not(.top-panel) { border: 1px solid var(--border-color-primary); border-radius: var(--radius-sm); }
.top-panel { position: absolute; top: var(--block-label-margin); right: var(--block-label-margin); margin: 0; }
.icon-button-wrapper :global(button) { margin: var(--spacing-xxs); border-radius: var(--radius-xs); position: relative; }
.icon-button-wrapper :global(a.download-link:not(:last-child)), .icon-button-wrapper :global(button:not(:last-child)) { margin-right: var(--spacing-xxs); }
.icon-button-wrapper :global(a.download-link:not(:last-child):not(.no-border *)::after), .icon-button-wrapper :global(button:not(:last-child):not(.no-border *)::after) { content: ""; position: absolute; right: -4.5px; top: 15%; height: 70%; width: 1px; background-color: var(--border-color-primary); }
.icon-button-wrapper :global(> *) { height: 100%; }
.icon-button-wrapper.no-background { box-shadow: none; border: none; background: none; padding: 0; z-index: var(--layer-1); }</style>12345678910111213141516171819202122<script lang="ts"> import { MarkdownCode as Markdown } from "@gradio/markdown-code"; export let info: string;</script>
<div> <Markdown message={info} sanitize_html={true} /></div>
<style> div > :global(.md.prose) { font-weight: var(--block-info-text-weight); font-size: var(--block-info-text-size); line-height: var(--line-sm); } div > :global(.md.prose *) { color: var(--block-info-text-color); } div { margin-bottom: var(--spacing-md); }</style>12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394<script lang="ts"> import { Microphone, Upload, Webcam, ImagePaste } from "@gradio/icons";
type source_types = "upload" | "microphone" | "webcam" | "clipboard" | null;
export let sources: Partial<source_types>[]; export let active_source: Partial<source_types>; export let handle_clear: () => void = () => {}; export let handle_select: ( source_type: Partial<source_types> ) => void = () => {};
$: unique_sources = [...new Set(sources)];
async function handle_select_source( source: Partial<source_types> ): Promise<void> { handle_clear(); active_source = source; handle_select(source); }</script>
{#if unique_sources.length > 1} <span class="source-selection" data-testid="source-select"> {#if sources.includes("upload")} <button class="icon" class:selected={active_source === "upload" || !active_source} aria-label="Upload file" on:click={() => handle_select_source("upload")}><Upload /></button > {/if}
{#if sources.includes("microphone")} <button class="icon" class:selected={active_source === "microphone"} aria-label="Record audio" on:click={() => handle_select_source("microphone")} ><Microphone /></button > {/if}
{#if sources.includes("webcam")} <button class="icon" class:selected={active_source === "webcam"} aria-label="Capture from camera" on:click={() => handle_select_source("webcam")}><Webcam /></button > {/if} {#if sources.includes("clipboard")} <button class="icon" class:selected={active_source === "clipboard"} aria-label="Paste from clipboard" on:click={() => handle_select_source("clipboard")} ><ImagePaste /></button > {/if} </span>{/if}
<style> .source-selection { display: flex; align-items: center; justify-content: center; border-top: 1px solid var(--border-color-primary); width: 100%; margin-left: auto; margin-right: auto; height: var(--size-10); }
.icon { width: 22px; height: 22px; margin: var(--spacing-lg) var(--spacing-xs); padding: var(--spacing-xs); color: var(--neutral-400); border-radius: var(--radius-md); }
.selected { color: var(--color-accent); }
.icon:hover, .icon:focus { color: var(--color-accent); }</style>123456789101112131415161718192021222324252627282930313233343536373839<script lang="ts"> import IconButton from "./IconButton.svelte"; import { Community } from "@gradio/icons"; import { createEventDispatcher } from "svelte"; import type { ShareData } from "@gradio/utils"; import { ShareError } from "@gradio/utils"; import type { I18nFormatter } from "@gradio/utils";
const dispatch = createEventDispatcher<{ share: ShareData; error: string; }>();
export let formatter: (arg0: any) => Promise<string>; export let value: any; export let i18n: I18nFormatter; let pending = false;</script>
<IconButton Icon={Community} label={i18n("common.share")} {pending} on:click={async () => { try { pending = true; const formatted = await formatter(value); dispatch("share", { description: formatted }); } catch (e) { console.error(e); let message = e instanceof ShareError ? e.message : "Share failed."; dispatch("error", message); } finally { pending = false; } }}/>12345678910111213141516171819202122232425262728<script lang="ts"> export let show_border = false;</script>
<div class:show_border> <slot /></div>
<style> div { border-top: 1px solid transparent; display: flex; max-height: 100%; justify-content: center; align-items: center; gap: var(--spacing-sm); height: auto; align-items: flex-end; color: var(--block-label-text-color); flex-shrink: 0; }
.show_border { border-top: 1px solid var(--block-border-color); margin-top: var(--spacing-xxl); box-shadow: var(--shadow-drop); }</style>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102<script lang="ts"> import type { I18nFormatter } from "@gradio/utils"; import { Upload as UploadIcon, ImagePaste } from "@gradio/icons"; import { inject } from "./utils/parse_placeholder";
export let type: | "video" | "image" | "audio" | "file" | "csv" | "clipboard" | "gallery" = "file"; export let i18n: I18nFormatter; export let message: string | undefined = undefined; export let mode: "full" | "short" = "full"; export let hovered = false; export let placeholder: string | undefined = undefined;
const defs = { image: "upload_text.drop_image", video: "upload_text.drop_video", audio: "upload_text.drop_audio", file: "upload_text.drop_file", csv: "upload_text.drop_csv", gallery: "upload_text.drop_gallery", clipboard: "upload_text.paste_clipboard" };
$: [heading, paragraph] = placeholder ? inject(placeholder) : [false, false];</script>
<div class="wrap"> <span class="icon-wrap" class:hovered> {#if type === "clipboard"} <ImagePaste /> {:else} <UploadIcon /> {/if} </span>
{#if heading || paragraph} {#if heading} <h2>{heading}</h2> {/if} {#if paragraph} <p>{paragraph}</p> {/if} {:else} {i18n(defs[type] || defs.file)}
{#if mode !== "short"} <span class="or">- {i18n("common.or")} -</span> {message || i18n("upload_text.click_to_upload")} {/if} {/if}</div>
<style> h2 { font-size: var(--text-xl) !important; }
p, h2 { white-space: pre-line; }
.wrap { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: var(--size-60); color: var(--block-label-text-color); line-height: var(--line-md); height: 100%; padding-top: var(--size-3); text-align: center; margin: auto var(--spacing-lg); }
.or { color: var(--body-text-color-subdued); display: flex; }
.icon-wrap { width: 30px; margin-bottom: var(--spacing-lg); }
@media (--screen-md) { .wrap { font-size: var(--text-lg); } }
.hovered { color: var(--color-accent); }</style>12345678910111213141516export { default as Block } from "./Block.svelte";export { default as BlockTitle } from "./BlockTitle.svelte";export { default as BlockLabel } from "./BlockLabel.svelte";export { default as DownloadLink } from "./DownloadLink.svelte";export { default as IconButton } from "./IconButton.svelte";export { default as Empty } from "./Empty.svelte";export { default as Info } from "./Info.svelte";export { default as ShareButton } from "./ShareButton.svelte";export { default as UploadText } from "./UploadText.svelte";export { default as Toolbar } from "./Toolbar.svelte";export { default as SelectSource } from "./SelectSource.svelte";export { default as IconButtonWrapper } from "./IconButtonWrapper.svelte";export { default as FullscreenButton } from "./FullscreenButton.svelte";export { default as CustomButton } from "./CustomButton.svelte";
export const BLOCK_KEY = {};123456789101112131415161718192021222324252627const RE_HEADING = /^(#\s*)(.+)$/m;
export function inject(text: string): [string | false, string | false] { const trimmed_text = text.trim();
const heading_match = trimmed_text.match(RE_HEADING); if (!heading_match) { return [false, trimmed_text || false]; }
const [full_match, , heading_content] = heading_match; const _heading = heading_content.trim();
if (trimmed_text === full_match) { return [_heading, false]; }
const heading_end_index = heading_match.index !== undefined ? heading_match.index + full_match.length : 0; const remaining_text = trimmed_text.substring(heading_end_index).trim();
const _paragraph = remaining_text || false;
return [_heading, _paragraph];}6.3.1/atoms/package.jsonAdded+34
6.3.1/atoms/src/Block.svelteAdded+253
6.3.1/atoms/src/BlockLabel.svelteAdded+90
6.3.1/atoms/src/BlockTitle.svelteAdded+63
6.3.1/atoms/src/CustomButton.svelteAdded+45
6.3.1/atoms/src/DownloadLink.svelteAdded+37
6.3.1/atoms/src/Empty.svelteAdded+63
6.3.1/atoms/src/FullscreenButton.svelteAdded+25
6.3.1/atoms/src/IconButton.svelteAdded+139
6.3.1/atoms/src/IconButtonWrapper.svelteAdded+105
6.3.1/atoms/src/Info.svelteAdded+22
6.3.1/atoms/src/SelectSource.svelteAdded+94
6.3.1/atoms/src/ShareButton.svelteAdded+39
6.3.1/atoms/src/Toolbar.svelteAdded+28
6.3.1/atoms/src/UploadText.svelteAdded+102
6.3.1/atoms/src/index.tsAdded+16
6.3.1/atoms/src/utils/parse_placeholder.tsAdded+27