diff --git a/frontend/antd/anchor/Index.svelte b/frontend/antd/anchor/Index.svelte
index 61293226..fda27a02 100644
--- a/frontend/antd/anchor/Index.svelte
+++ b/frontend/antd/anchor/Index.svelte
@@ -11,8 +11,6 @@
import cls from 'classnames';
import { writable } from 'svelte/store';
- import { getItems } from './context';
-
const AwaitedAnchor = importComponent(() => import('./anchor'));
export let gradio: Gradio;
@@ -53,7 +51,6 @@
as_item,
restProps: $$restProps,
});
- const { items, default: children } = getItems(['items', 'default']);
{#if $mergedProps.visible}
@@ -66,7 +63,6 @@
{...$mergedProps.props}
{...bindEvents($mergedProps)}
slots={$slots}
- slotItems={$items.length > 0 ? $items : $children}
>
diff --git a/frontend/antd/anchor/anchor.tsx b/frontend/antd/anchor/anchor.tsx
index 860369f4..1bd4c23e 100644
--- a/frontend/antd/anchor/anchor.tsx
+++ b/frontend/antd/anchor/anchor.tsx
@@ -4,47 +4,42 @@ import { useFunction } from '@utils/hooks/useFunction';
import { renderItems } from '@utils/renderItems';
import { Anchor as AAnchor, type GetProps } from 'antd';
-import { type Item } from './context';
+import { useItems, withItemsContextProvider } from './context';
type AnchorProps = GetProps;
-export const Anchor = sveltify<
- AnchorProps & {
- slotItems: Item[];
- }
->(
- ({
- getContainer,
- getCurrentAnchor,
- children,
- items,
- slotItems,
- ...props
- }) => {
- const getContainerFunction = useFunction(getContainer);
- const getCurrentAnchorFunction = useFunction(getCurrentAnchor);
- return (
- <>
- {children}
- {
- // ["title"]
- return (
- items ||
- renderItems[number]>(
- slotItems,
- {
- clone: true,
- }
- )
- );
- }, [items, slotItems])}
- getContainer={getContainerFunction}
- getCurrentAnchor={getCurrentAnchorFunction}
- />
- >
- );
- }
+export const Anchor = sveltify(
+ withItemsContextProvider(
+ ['items', 'default'],
+ ({ getContainer, getCurrentAnchor, children, items, ...props }) => {
+ const getContainerFunction = useFunction(getContainer);
+ const getCurrentAnchorFunction = useFunction(getCurrentAnchor);
+ const { items: slotItems } = useItems<['items', 'default']>();
+ const resolvedSlotItems =
+ slotItems.items.length > 0 ? slotItems.items : slotItems.default;
+ return (
+ <>
+ {children}
+ {
+ // ["title"]
+ return (
+ items ||
+ renderItems[number]>(
+ resolvedSlotItems,
+ {
+ clone: true,
+ }
+ )
+ );
+ }, [items, resolvedSlotItems])}
+ getContainer={getContainerFunction}
+ getCurrentAnchor={getCurrentAnchorFunction}
+ />
+ >
+ );
+ }
+ )
);
export default Anchor;
diff --git a/frontend/antd/anchor/context.ts b/frontend/antd/anchor/context.ts
index 5512087d..d6ab7440 100644
--- a/frontend/antd/anchor/context.ts
+++ b/frontend/antd/anchor/context.ts
@@ -1,6 +1,6 @@
-import { createItemsContext } from '@utils/createItemsContext';
+import { createItemsContext } from '@utils/createItemsContext2';
-const { getItems, getSetItemFn } = createItemsContext('anchor');
+export const { useItems, withItemsContextProvider, ItemHandler } =
+ createItemsContext();
-export { getItems, getSetItemFn };
-export * from '@utils/createItemsContext';
+export * from '@utils/createItemsContext2';
diff --git a/frontend/antd/anchor/item/Index.svelte b/frontend/antd/anchor/item/Index.svelte
index 29f06320..2ca6c1a8 100644
--- a/frontend/antd/anchor/item/Index.svelte
+++ b/frontend/antd/anchor/item/Index.svelte
@@ -1,7 +1,10 @@
{#if $mergedProps.visible}
-
+ {#await AwaitedAnchorItem then AnchorItem}
+
+
+
+ {/await}
{/if}
-
-
diff --git a/frontend/antd/anchor/item/anchor.item.tsx b/frontend/antd/anchor/item/anchor.item.tsx
new file mode 100644
index 00000000..a3a36533
--- /dev/null
+++ b/frontend/antd/anchor/item/anchor.item.tsx
@@ -0,0 +1,23 @@
+import { sveltify } from '@svelte-preprocess-react';
+import React from 'react';
+import type { AnchorLinkItemProps } from 'antd/es/anchor/Anchor';
+
+import { ItemHandler, type ItemHandlerProps } from '../context';
+
+export const AnchorItem = sveltify(
+ (props) => {
+ return (
+ <>
+
+ {...props}
+ allowedSlots={['default']}
+ itemChildren={(items) => {
+ return items.default.length > 0 ? items.default : undefined;
+ }}
+ />
+ >
+ );
+ }
+);
+
+export default AnchorItem;
diff --git a/frontend/antd/grid/col/Index.svelte b/frontend/antd/grid/col/Index.svelte
index 733959c9..9337e142 100644
--- a/frontend/antd/grid/col/Index.svelte
+++ b/frontend/antd/grid/col/Index.svelte
@@ -68,11 +68,12 @@
itemSlotKey={$slotKey}
itemElement={$slot}
slots={{}}
- />
+ >
+
+
+
+
{/await}
-
-
-
{/if}