diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a1f10c73..e060794a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,8 +3,7 @@ name: publish on: push: branches: - # - main - - disabled + - main env: CI: true @@ -17,35 +16,45 @@ jobs: timeout-minutes: 15 runs-on: ubuntu-latest steps: + - name: Get the Last Commit Message + run: | + echo "COMMIT_MESSAGE=$(git log --format=%s -n 1)" >> $GITHUB_ENV - name: Checkout Code Repository + if: env.COMMIT_MESSAGE == 'chore: update versions' uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python 3.12 + if: env.COMMIT_MESSAGE == 'chore: update versions' uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install Python Dependencies + if: env.COMMIT_MESSAGE == 'chore: update versions' run: pip install gradio twine build - name: Setup Node.js + if: env.COMMIT_MESSAGE == 'chore: update versions' uses: actions/setup-node@v3 with: node-version: 20 - name: Install Pnpm + if: env.COMMIT_MESSAGE == 'chore: update versions' run: npm i pnpm@latest -g - name: Install Node Dependencies + if: env.COMMIT_MESSAGE == 'chore: update versions' run: pnpm install - - name: Create Release Pull Request to Update Versions - id: changesets - uses: changesets/action@v1 - with: - version: pnpm run ci:version - title: 'chore: update versions' - commit: 'chore: update versions' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Create Release Pull Request to Update Versions + # id: changesets + # uses: changesets/action@v1 + # with: + # version: pnpm run ci:version + # title: 'chore: update versions' + # commit: 'chore: update versions' + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Packages and Publish to PyPI - if: steps.changesets.outputs.hasChangesets != 'true' + # if: steps.changesets.outputs.hasChangesets != 'true' + if: env.COMMIT_MESSAGE == 'chore: update versions' id: publish run: pnpm run ci:publish env: diff --git a/frontend/antd/result/result.tsx b/frontend/antd/result/result.tsx index e2ea9c5a..ab060985 100644 --- a/frontend/antd/result/result.tsx +++ b/frontend/antd/result/result.tsx @@ -1,22 +1,31 @@ import { sveltify } from '@svelte-preprocess-react'; import { ReactSlot } from '@svelte-preprocess-react/react-slot'; import React from 'react'; +import { useTargets } from '@utils/hooks/useTargets'; import { type GetProps, Result as AResult } from 'antd'; export const Result = sveltify< GetProps, ['extra', 'icon', 'subTitle', 'title'] ->(({ slots, ...props }) => { +>(({ slots, children, ...props }) => { + const targets = useTargets(children); return ( - : props.extra} - icon={slots.icon ? : props.icon} - subTitle={ - slots.subTitle ? : props.subTitle - } - title={slots.title ? : props.title} - /> + <> +
+ {targets.length > 0 ? null : children} +
+ : props.extra} + icon={slots.icon ? : props.icon} + subTitle={ + slots.subTitle ? : props.subTitle + } + title={slots.title ? : props.title} + > + {targets.length > 0 ? children : null} + + ); }); diff --git a/frontend/base/application/Application.svelte b/frontend/base/application/Application.svelte index 304e19da..fd063732 100644 --- a/frontend/base/application/Application.svelte +++ b/frontend/base/application/Application.svelte @@ -22,6 +22,7 @@ bind_mount_event?: boolean; bind_resize_event?: boolean; bind_unmount_event?: boolean; + bind_custom_event?: boolean; } = {}; export let gradio: Gradio<{ custom: any; @@ -29,8 +30,9 @@ resize: ApplicationPageData; unmount: ApplicationPageData; }>; + export let attached_events: string[] = []; export let visible = true; - + let container: HTMLDivElement; function get_data(): ApplicationPageData { return { theme: gradio.theme, @@ -69,31 +71,33 @@ function on_mount() { value = get_data(); - if (_internal.bind_mount_event) { + if (_internal.bind_mount_event || attached_events.includes('mount')) { gradio.dispatch('mount', get_data()); } } const on_resize = wrap_event(() => { value = get_data(); - if (_internal.bind_resize_event) { + if (_internal.bind_resize_event || attached_events.includes('resize')) { gradio.dispatch('resize', get_data()); } }, 500); const on_before_unload = wrap_event(() => { value = get_data(); - if (_internal.bind_unmount_event) { + if (_internal.bind_unmount_event || attached_events.includes('unmount')) { gradio.dispatch('unmount', get_data()); } }); window.ms_globals.dispatch = (...args) => { gradio.dispatch('custom', args); }; + onMount(() => { requestAnimationFrame(() => { on_mount(); }); + window.addEventListener('resize', on_resize); window.addEventListener('beforeunload', on_before_unload); }); @@ -105,7 +109,7 @@ {#if visible} -
+
{/if}