@woodger/antd 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/affix/Affix.svelte +5 -2
- package/dist/alert/Alert.svelte +5 -2
- package/dist/anchor/Anchor.svelte +5 -2
- package/dist/auto-complete/AutoComplete.svelte +3 -2
- package/dist/avatar/Avatar.svelte +3 -2
- package/dist/avatar/AvatarGroup.svelte +3 -1
- package/dist/avatar/avatar.component.d.ts +7 -0
- package/dist/avatar/avatar.component.js +4 -0
- package/dist/badge/Badge.svelte +3 -2
- package/dist/badge/BadgeRibbon.svelte +3 -2
- package/dist/badge/badge.component.d.ts +7 -0
- package/dist/badge/badge.component.js +4 -0
- package/dist/border-beam/BorderBeam.svelte +5 -3
- package/dist/breadcrumb/Breadcrumb.svelte +5 -2
- package/dist/button/Button.svelte +7 -4
- package/dist/calendar/CalendarCore.svelte +3 -1
- package/dist/calendar/calendar.component.d.ts +7 -0
- package/dist/calendar/calendar.component.js +4 -0
- package/dist/card/Card.svelte +6 -3
- package/dist/card/card.component.d.ts +9 -0
- package/dist/card/card.component.js +5 -0
- package/dist/carousel/Carousel.svelte +6 -3
- package/dist/cascader/CascaderCore.svelte +8 -2
- package/dist/cascader/cascader.component.d.ts +11 -0
- package/dist/cascader/cascader.component.js +9 -0
- package/dist/cascader/cascader.types.d.ts +8 -0
- package/dist/checkbox/Checkbox.svelte +9 -4
- package/dist/checkbox/CheckboxGroup.svelte +6 -3
- package/dist/checkbox/checkbox-group.types.d.ts +2 -0
- package/dist/checkbox/checkbox.component.d.ts +7 -0
- package/dist/checkbox/checkbox.component.js +4 -0
- package/dist/collapse/Collapse.svelte +5 -2
- package/dist/collapse/collapse.engine.d.ts +1 -1
- package/dist/color-picker/ColorPicker.svelte +6 -3
- package/dist/color-picker/ColorPickerPresets.svelte +5 -3
- package/dist/component-refs.types.d.ts +45 -0
- package/dist/component-refs.types.js +1 -0
- package/dist/component.types.d.ts +13 -0
- package/dist/component.types.js +1 -0
- package/dist/config-provider/ConfigProvider.svelte +18 -6
- package/dist/config-provider/ConfigProvider.svelte.d.ts +2 -0
- package/dist/config-provider/config-context.d.ts +7 -0
- package/dist/config-provider/config-context.js +1 -0
- package/dist/config-provider/config-provider.component.d.ts +6 -0
- package/dist/config-provider/config-provider.component.js +10 -1
- package/dist/descriptions/Descriptions.svelte +6 -4
- package/dist/dialog/dialog-container.model.svelte.d.ts +1 -1
- package/dist/dialog/dialog-container.model.svelte.js +14 -2
- package/dist/dialog/dialog-focus.dom.d.ts +3 -1
- package/dist/dialog/dialog-focus.dom.js +8 -7
- package/dist/divider/Divider.svelte +5 -2
- package/dist/drawer/Drawer.svelte +3 -2
- package/dist/dropdown/Dropdown.svelte +9 -5
- package/dist/empty/Empty.svelte +5 -2
- package/dist/flex/Flex.svelte +5 -2
- package/dist/float-button/FloatButton.svelte +6 -3
- package/dist/float-button/FloatButtonGroup.svelte +6 -3
- package/dist/float-button/float-button.component.d.ts +9 -0
- package/dist/float-button/float-button.component.js +5 -0
- package/dist/form/Form.svelte +237 -42
- package/dist/form/Form.svelte.d.ts +4 -4
- package/dist/form/FormErrorList.svelte +19 -69
- package/dist/form/FormItem.svelte +271 -62
- package/dist/form/FormItem.svelte.d.ts +31 -5
- package/dist/form/FormItemControlBinding.svelte +68 -0
- package/dist/form/FormItemControlBinding.svelte.d.ts +10 -0
- package/dist/form/FormItemMessages.svelte +142 -0
- package/dist/form/FormItemMessages.svelte.d.ts +23 -0
- package/dist/form/FormList.svelte +49 -4
- package/dist/form/FormMessageMotion.svelte +133 -0
- package/dist/form/FormMessageMotion.svelte.d.ts +18 -0
- package/dist/form/FormProvider.svelte +9 -0
- package/dist/form/FormProvider.svelte.d.ts +4 -0
- package/dist/form/form-context.d.ts +24 -6
- package/dist/form/form-context.js +18 -0
- package/dist/form/form-control.engine.d.ts +2 -0
- package/dist/form/form-control.engine.js +13 -0
- package/dist/form/form-error-list-state.svelte.d.ts +21 -0
- package/dist/form/form-error-list-state.svelte.js +77 -0
- package/dist/form/form-error-list.engine.js +3 -1
- package/dist/form/form-error-list.types.d.ts +3 -2
- package/dist/form/form-field.dom.js +27 -4
- package/dist/form/form-internal.d.ts +32 -8
- package/dist/form/form-internal.js +2 -0
- package/dist/form/form-item-status.d.ts +2 -1
- package/dist/form/form-item-status.js +3 -1
- package/dist/form/form-list-context.d.ts +4 -0
- package/dist/form/form-list-context.js +3 -0
- package/dist/form/form-list.types.d.ts +5 -2
- package/dist/form/form-no-style.engine.d.ts +6 -5
- package/dist/form/form-provider-context.d.ts +13 -0
- package/dist/form/form-provider-context.js +74 -0
- package/dist/form/form-ref.engine.d.ts +5 -0
- package/dist/form/form-ref.engine.js +43 -0
- package/dist/form/form-store.engine.d.ts +3 -1
- package/dist/form/form-store.engine.js +25 -3
- package/dist/form/form-update.engine.d.ts +29 -0
- package/dist/form/form-update.engine.js +40 -0
- package/dist/form/form-watch.svelte.d.ts +25 -0
- package/dist/form/form-watch.svelte.js +56 -0
- package/dist/form/form.component.d.ts +28 -0
- package/dist/form/form.component.js +25 -0
- package/dist/form/form.model.svelte.d.ts +25 -3
- package/dist/form/form.model.svelte.js +728 -179
- package/dist/form/form.types.d.ts +117 -11
- package/dist/form/validation-message.engine.d.ts +17 -3
- package/dist/form/validation-message.engine.js +39 -2
- package/dist/form/validation-messages.types.d.ts +11 -0
- package/dist/form/validation-nested.engine.d.ts +5 -4
- package/dist/form/validation.engine.d.ts +8 -6
- package/dist/form/validation.engine.js +2 -2
- package/dist/grid/Col.svelte +4 -6
- package/dist/grid/Row.svelte +7 -4
- package/dist/grid/grid.svelte.d.ts +7 -0
- package/dist/grid/grid.svelte.js +30 -0
- package/dist/image/Image.svelte +147 -58
- package/dist/image/ImagePreview.svelte +280 -137
- package/dist/image/ImagePreview.svelte.d.ts +10 -2
- package/dist/image/ImagePreviewGroup.svelte +40 -7
- package/dist/image/ImagePreviewIcons.svelte +18 -0
- package/dist/image/ImagePreviewIcons.svelte.d.ts +29 -0
- package/dist/image/ImageProgress.svelte +84 -0
- package/dist/image/ImageProgress.svelte.d.ts +13 -0
- package/dist/image/image-group-context.d.ts +2 -1
- package/dist/image/image-prefix.engine.js +4 -0
- package/dist/image/image-preview-group.types.d.ts +8 -8
- package/dist/image/image-preview-motion.dom.d.ts +16 -0
- package/dist/image/image-preview-motion.dom.js +72 -0
- package/dist/image/image-semantic.engine.d.ts +39 -0
- package/dist/image/image-semantic.engine.js +61 -0
- package/dist/image/image.component.d.ts +7 -0
- package/dist/image/image.component.js +4 -0
- package/dist/image/image.types.d.ts +84 -11
- package/dist/index.d.ts +51 -41
- package/dist/index.js +24 -19
- package/dist/input/Input.svelte +6 -3
- package/dist/input/InputOTP.svelte +5 -2
- package/dist/input/InputPassword.svelte +5 -1
- package/dist/input/InputSearch.svelte +6 -3
- package/dist/input/TextArea.svelte +6 -3
- package/dist/input/input.component.d.ts +13 -0
- package/dist/input/input.component.js +12 -0
- package/dist/input-number/InputNumberControl.svelte +5 -2
- package/dist/layout/Layout.svelte +5 -2
- package/dist/layout/LayoutPart.svelte +7 -2
- package/dist/layout/LayoutSider.svelte +5 -2
- package/dist/layout/layout.component.d.ts +13 -0
- package/dist/layout/layout.component.js +7 -0
- package/dist/listy/Listy.svelte +3 -2
- package/dist/masonry/Masonry.svelte +5 -3
- package/dist/mentions/Mentions.svelte +3 -2
- package/dist/mentions/mentions.component.d.ts +7 -0
- package/dist/mentions/mentions.component.js +4 -0
- package/dist/menu/Menu.svelte +7 -2
- package/dist/message/MessageHolder.svelte +3 -1
- package/dist/modal/Modal.svelte +112 -14
- package/dist/modal/ModalFooterScope.svelte +15 -0
- package/dist/modal/ModalFooterScope.svelte.d.ts +7 -0
- package/dist/modal/modal-layout.engine.d.ts +1 -1
- package/dist/modal/modal-layout.engine.js +20 -3
- package/dist/modal/modal-motion.dom.d.ts +1 -0
- package/dist/modal/modal-motion.dom.js +21 -5
- package/dist/modal/modal-named-motion.dom.d.ts +1 -1
- package/dist/modal/modal-named-motion.dom.js +1 -2
- package/dist/modal/modal-semantic.engine.d.ts +1 -1
- package/dist/modal/modal.types.d.ts +3 -1
- package/dist/notification/NotificationHolder.svelte +3 -1
- package/dist/pagination/Pagination.svelte +3 -2
- package/dist/picker/DatePicker.svelte.d.ts +1 -1
- package/dist/picker/RangePickerCore.svelte +3 -1
- package/dist/picker/SinglePicker.svelte +3 -1
- package/dist/picker/picker-popup.model.svelte.d.ts +3 -1
- package/dist/picker/time-picker.component.d.ts +4 -1
- package/dist/picker/time-picker.component.js +3 -1
- package/dist/popconfirm/Popconfirm.svelte +6 -1
- package/dist/popconfirm/popconfirm.types.d.ts +2 -0
- package/dist/popover/Popover.svelte +31 -13
- package/dist/popover/popover.types.d.ts +2 -0
- package/dist/popup/popup-container.model.svelte.d.ts +4 -1
- package/dist/popup/popup-container.model.svelte.js +7 -2
- package/dist/popup/popup-geometry.dom.d.ts +8 -0
- package/dist/popup/popup-geometry.dom.js +29 -0
- package/dist/popup/popup.dom.d.ts +3 -0
- package/dist/popup/popup.dom.js +3 -1
- package/dist/progress/Progress.svelte +5 -2
- package/dist/progress/progress-circle.engine.d.ts +1 -1
- package/dist/qr-code/QRCode.svelte +5 -3
- package/dist/radio/Radio.svelte +9 -4
- package/dist/radio/RadioGroup.svelte +6 -3
- package/dist/radio/radio.component.d.ts +9 -0
- package/dist/radio/radio.component.js +5 -0
- package/dist/rate/Rate.svelte +3 -2
- package/dist/result/Result.svelte +5 -2
- package/dist/segmented/Segmented.svelte +5 -2
- package/dist/select/Select.svelte +3 -2
- package/dist/select/select-style.engine.d.ts +1 -1
- package/dist/skeleton/Skeleton.svelte +5 -2
- package/dist/skeleton/SkeletonElement.svelte +5 -2
- package/dist/slider/SliderRange.svelte +9 -41
- package/dist/slider/SliderSingle.svelte +35 -30
- package/dist/slider/SliderTooltip.svelte +224 -0
- package/dist/slider/SliderTooltip.svelte.d.ts +17 -0
- package/dist/space/Space.svelte +6 -3
- package/dist/space/SpaceAddon.svelte +6 -3
- package/dist/space/SpaceCompact.svelte +5 -2
- package/dist/space/space.component.d.ts +9 -0
- package/dist/space/space.component.js +5 -0
- package/dist/spin/Spin.svelte +5 -2
- package/dist/splitter/Splitter.svelte +6 -3
- package/dist/splitter/SplitterArrow.svelte.d.ts +1 -1
- package/dist/statistic/Statistic.svelte +5 -3
- package/dist/statistic/statistic.component.d.ts +7 -0
- package/dist/statistic/statistic.component.js +4 -0
- package/dist/steps/Steps.svelte +5 -2
- package/dist/styles.css +1 -0
- package/dist/styles.css.d.ts +1 -0
- package/dist/switch/Switch.svelte +5 -2
- package/dist/table/Table.svelte +3 -2
- package/dist/table/table-cell.engine.d.ts +6 -6
- package/dist/table/table.types.d.ts +2 -0
- package/dist/tabs/Tabs.svelte +6 -4
- package/dist/tag/CheckableTag.svelte +3 -1
- package/dist/tag/CheckableTagGroup.svelte +3 -1
- package/dist/tag/Tag.svelte +3 -1
- package/dist/tag/tag.component.d.ts +10 -0
- package/dist/tag/tag.component.js +5 -0
- package/dist/theme/theme-context.svelte.d.ts +2 -0
- package/dist/theme/theme-context.svelte.js +6 -1
- package/dist/timeline/Timeline.svelte +5 -2
- package/dist/tooltip/Tooltip.svelte +16 -7
- package/dist/tooltip/TooltipPopup.svelte +22 -6
- package/dist/tooltip/tooltip-popup.types.d.ts +6 -0
- package/dist/tooltip/tooltip.types.d.ts +16 -0
- package/dist/tour/Tour.svelte +3 -1
- package/dist/transfer/Transfer.svelte +3 -1
- package/dist/transfer/TransferCheckbox.svelte +3 -1
- package/dist/transfer/TransferPagination.svelte +3 -1
- package/dist/tree/Tree.svelte +3 -2
- package/dist/tree/tree.component.d.ts +10 -0
- package/dist/tree/tree.component.js +5 -0
- package/dist/tree-select/TreeSelectControl.svelte +5 -4
- package/dist/types.d.ts +2 -2
- package/dist/typography/TypographyEditable.svelte +5 -2
- package/dist/typography/TypographyElement.svelte +6 -3
- package/dist/typography/TypographyTooltip.svelte +19 -8
- package/dist/typography/typography.component.d.ts +13 -0
- package/dist/typography/typography.component.js +7 -0
- package/dist/upload/Upload.svelte +44 -4
- package/dist/upload/Upload.svelte.d.ts +1 -1
- package/dist/upload/UploadDragger.svelte +3 -2
- package/dist/upload/UploadDragger.svelte.d.ts +4 -4
- package/dist/upload/UploadList.svelte.d.ts +1 -1
- package/dist/upload/UploadListItem.svelte +52 -11
- package/dist/upload/upload.component.d.ts +9 -0
- package/dist/upload/upload.component.js +5 -0
- package/dist/upload/upload.engine.d.ts +8 -2
- package/dist/upload/upload.engine.js +80 -4
- package/dist/upload/upload.types.d.ts +2 -1
- package/dist/vendor/compute-scroll-into-view.d.ts +3 -1
- package/dist/vendor/compute-scroll-into-view.js +3 -2
- package/dist/vendor/dropdown-motion.css +105 -0
- package/dist/vendor/image-prefix.css.js +3 -3
- package/dist/vendor/image.css +16 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/package.json +15 -4
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
7
7
|
import { connectComponentTheme } from '../theme/theme-component.dom';
|
|
8
8
|
import { provideZIndex, useZIndex } from '../popup/z-index-context.svelte';
|
|
9
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
9
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
10
10
|
import { useForm, useFormField } from '../form/form-context';
|
|
11
11
|
import { useCompact } from '../space/space-compact-context';
|
|
12
12
|
import { compactClasses } from '../space/space-compact.engine';
|
|
@@ -73,8 +73,11 @@
|
|
|
73
73
|
let prefixCls = $derived(config.getPrefixCls('color-picker', props.prefixCls));
|
|
74
74
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
75
75
|
let popoverPrefix = $derived(config.getPrefixCls('popover'));
|
|
76
|
-
|
|
77
|
-
let
|
|
76
|
+
const runtimeStyles = useRuntimeStyles();
|
|
77
|
+
let prefixCss = $derived(runtimeStyles && getColorPickerPrefixCss(prefixCls, rootPrefix));
|
|
78
|
+
let popoverCss = $derived(
|
|
79
|
+
runtimeStyles && getOverlayPrefixCss('popover', popoverPrefix, popoverTemplate)
|
|
80
|
+
);
|
|
78
81
|
let size = $derived(props.size ?? compact?.size ?? config.componentSize);
|
|
79
82
|
let arrow = $derived(props.arrow ?? config.colorPicker?.arrow ?? true);
|
|
80
83
|
let locale = $derived({ ...colorPickerRuRU, ...config.locale.colorPicker });
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { useConfig } from '../config-provider/config-context';
|
|
4
4
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
5
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
5
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
6
6
|
import { generateColor, isBrightColor } from './color-picker.engine';
|
|
7
7
|
import { toggleCollapseKey } from '../collapse/collapse.engine';
|
|
8
8
|
import { colorPickerRuRU } from './color-picker.locale';
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
const designTheme = useDesignTokenContext();
|
|
25
25
|
const id = $props.id();
|
|
26
26
|
let collapsePrefix = $derived(config.getPrefixCls('collapse'));
|
|
27
|
-
|
|
27
|
+
const runtimeStyles = useRuntimeStyles();
|
|
28
|
+
const hasCustomCollapsePrefix = $derived(collapsePrefix !== 'ant-collapse');
|
|
29
|
+
let collapseCss = $derived(runtimeStyles && getCollapsePrefixCss(collapsePrefix));
|
|
28
30
|
let opened = $state(untrack(() => presets.flatMap((preset, index) =>
|
|
29
31
|
preset.defaultOpen === false ? [] : [`panel-${preset.key ?? index}`])));
|
|
30
32
|
let locale = $derived({ ...colorPickerRuRU, ...config.locale.colorPicker });
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
<div class={[collapsePrefix, 'ant-collapse-css-var', `${collapsePrefix}-ghost`,
|
|
66
68
|
`${collapsePrefix}-icon-placement-start`,
|
|
67
69
|
collapseTheme.className, config.direction === 'rtl' && `${collapsePrefix}-rtl`]}
|
|
68
|
-
data-ant-collapse-prefix={
|
|
70
|
+
data-ant-collapse-prefix={hasCustomCollapsePrefix ? collapsePrefix : undefined}
|
|
69
71
|
style={collapseTheme.style}>
|
|
70
72
|
{#each presets as preset, index (preset.key ?? index)}
|
|
71
73
|
{@const key = `panel-${preset.key ?? index}`}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type Affix from './affix/Affix.svelte';
|
|
2
|
+
import type AvatarGroup from './avatar/AvatarGroup.svelte';
|
|
3
|
+
import type BadgeRibbon from './badge/BadgeRibbon.svelte';
|
|
4
|
+
import type Breadcrumb from './breadcrumb/Breadcrumb.svelte';
|
|
5
|
+
import type CardGrid from './card/CardGrid.svelte';
|
|
6
|
+
import type CardMeta from './card/CardMeta.svelte';
|
|
7
|
+
import type Cascader from './cascader/Cascader.svelte';
|
|
8
|
+
import type { GetRef } from './component.types';
|
|
9
|
+
import type Descriptions from './descriptions/Descriptions.svelte';
|
|
10
|
+
import type Divider from './divider/Divider.svelte';
|
|
11
|
+
import type FloatButton from './float-button/FloatButton.svelte';
|
|
12
|
+
import type FloatButtonGroup from './float-button/FloatButtonGroup.svelte';
|
|
13
|
+
import type Input from './input/Input.svelte';
|
|
14
|
+
import type Masonry from './masonry/Masonry.svelte';
|
|
15
|
+
import type Mentions from './mentions/Mentions.svelte';
|
|
16
|
+
import type Menu from './menu/Menu.svelte';
|
|
17
|
+
import type QRCode from './qr-code/QRCode.svelte';
|
|
18
|
+
import type Splitter from './splitter/Splitter.svelte';
|
|
19
|
+
import type Statistic from './statistic/Statistic.svelte';
|
|
20
|
+
import type Tabs from './tabs/Tabs.svelte';
|
|
21
|
+
import type Transfer from './transfer/Transfer.svelte';
|
|
22
|
+
import type Watermark from './watermark/Watermark.svelte';
|
|
23
|
+
export type AffixRef = GetRef<typeof Affix>;
|
|
24
|
+
export type AvatarGroupRef = GetRef<typeof AvatarGroup>;
|
|
25
|
+
export type BreadcrumbRef = GetRef<typeof Breadcrumb>;
|
|
26
|
+
export type CardGridRef = GetRef<typeof CardGrid>;
|
|
27
|
+
export type CardMetaRef = GetRef<typeof CardMeta>;
|
|
28
|
+
export type CascaderRef = GetRef<typeof Cascader>;
|
|
29
|
+
export type DescriptionsRef = GetRef<typeof Descriptions>;
|
|
30
|
+
export type DividerRef = GetRef<typeof Divider>;
|
|
31
|
+
export type FloatButtonGroupRef = GetRef<typeof FloatButtonGroup>;
|
|
32
|
+
export type FloatButtonRef = GetRef<typeof FloatButton>;
|
|
33
|
+
/** The Input methods exposed by bind:this. Its DOM bindings are separate. */
|
|
34
|
+
export type InputRef = GetRef<typeof Input>;
|
|
35
|
+
export type MasonryRef = GetRef<typeof Masonry>;
|
|
36
|
+
export type MentionsRef = GetRef<typeof Mentions>;
|
|
37
|
+
/** Call focus and findItem on the component handle. Read the list through bind:nativeElement. */
|
|
38
|
+
export type MenuRef = GetRef<typeof Menu>;
|
|
39
|
+
export type QRCodeRef = GetRef<typeof QRCode>;
|
|
40
|
+
export type RibbonRef = GetRef<typeof BadgeRibbon>;
|
|
41
|
+
export type SplitterRef = GetRef<typeof Splitter>;
|
|
42
|
+
export type StatisticRef = GetRef<typeof Statistic>;
|
|
43
|
+
export type TabsRef = GetRef<typeof Tabs>;
|
|
44
|
+
export type TransferRef = GetRef<typeof Transfer>;
|
|
45
|
+
export type WatermarkRef = GetRef<typeof Watermark>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Component, ComponentProps, createContext } from 'svelte';
|
|
2
|
+
type Svelte5Component = Component<any, any>;
|
|
3
|
+
type SvelteContext<Value> = Readonly<ReturnType<typeof createContext<Value>>>;
|
|
4
|
+
/** Extracts Svelte component props or a createContext payload. Preserves a plain props object. */
|
|
5
|
+
export type GetProps<T extends object> = T extends SvelteContext<infer Value> ? Value : T extends Svelte5Component ? ComponentProps<T> : T;
|
|
6
|
+
/** Extracts a non-nullable prop, or the return type of its callable members in Return mode. */
|
|
7
|
+
export type GetProp<T extends object, PropName extends keyof GetProps<T>, Mode extends 'Default' | 'Return' = 'Default'> = Mode extends 'Return' ? ReturnType<Extract<NonNullable<GetProps<T>[PropName]>, (...args: never[]) => unknown>> : NonNullable<GetProps<T>[PropName]>;
|
|
8
|
+
type PublicComponentExports<T extends Svelte5Component> = Omit<ReturnType<T>, '$on' | '$set'>;
|
|
9
|
+
type NativeElement<Props> = 'nativeElement' extends keyof Props ? NonNullable<Props['nativeElement']> : never;
|
|
10
|
+
type ComponentRef<T extends Svelte5Component, Props = ComponentProps<T>, Exports = PublicComponentExports<T>> = 'ref' extends keyof Props ? NonNullable<Props['ref']> : keyof Exports extends never ? NativeElement<Props> : Exports;
|
|
11
|
+
/** Resolves bind:ref, then bind:this exports, then the bound nativeElement. */
|
|
12
|
+
export type GetRef<T extends Svelte5Component> = T extends Svelte5Component ? ComponentRef<T> : never;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import type { BadgeConfig } from '../badge/badge.types';
|
|
25
25
|
import type { TagConfig } from '../tag/tag.types';
|
|
26
26
|
import type { AvatarConfig } from '../avatar/avatar.types';
|
|
27
|
+
import type { ImageConfig } from '../image/image.types';
|
|
27
28
|
import type { TooltipConfig } from '../tooltip/tooltip.types';
|
|
28
29
|
import type { PopoverConfig } from '../popover/popover.types';
|
|
29
30
|
import type { PopconfirmConfig } from '../popconfirm/popconfirm.types';
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
import type { TextAreaConfig } from '../input/textarea.types';
|
|
76
77
|
import type { Snippet } from 'svelte';
|
|
77
78
|
import { provideConfig, useConfig, type ConfigContext } from './config-context';
|
|
78
|
-
import { provideDesignTokens,
|
|
79
|
+
import { provideDesignTokens, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
79
80
|
import { getGridMediaCss, getGridMediaScope } from '../grid/grid-style.engine';
|
|
80
81
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
81
82
|
import type { ComponentSize, CSPConfig, Variant, Locale, ThemeConfig } from '../types';
|
|
@@ -130,6 +131,7 @@
|
|
|
130
131
|
badge?: BadgeConfig;
|
|
131
132
|
tag?: TagConfig;
|
|
132
133
|
avatar?: AvatarConfig;
|
|
134
|
+
image?: ImageConfig;
|
|
133
135
|
tooltip?: TooltipConfig;
|
|
134
136
|
popover?: PopoverConfig;
|
|
135
137
|
popconfirm?: PopconfirmConfig;
|
|
@@ -246,6 +248,7 @@
|
|
|
246
248
|
badge,
|
|
247
249
|
tag,
|
|
248
250
|
avatar,
|
|
251
|
+
image,
|
|
249
252
|
tooltip,
|
|
250
253
|
popover,
|
|
251
254
|
popconfirm,
|
|
@@ -312,7 +315,6 @@
|
|
|
312
315
|
}: ConfigProviderProps = $props();
|
|
313
316
|
|
|
314
317
|
const parent = useConfig();
|
|
315
|
-
const parentDesignTokens = useDesignTokenContext();
|
|
316
318
|
const themeId = $props.id();
|
|
317
319
|
let element = $state<HTMLDivElement>();
|
|
318
320
|
function getPrefixCls(suffix?: string, custom?: string) {
|
|
@@ -328,11 +330,12 @@
|
|
|
328
330
|
() => element,
|
|
329
331
|
() => getPrefixCls()
|
|
330
332
|
);
|
|
331
|
-
|
|
333
|
+
const runtimeStyles = useRuntimeStyles();
|
|
334
|
+
let requestedGridMediaScope = $derived(designTokens.enabled
|
|
332
335
|
? getGridMediaScope(designTokens.state.token) : undefined);
|
|
333
|
-
let
|
|
334
|
-
?
|
|
335
|
-
let gridMediaCss = $derived(gridMediaScope && gridMediaScope !==
|
|
336
|
+
let gridMediaScope = $derived(runtimeStyles || requestedGridMediaScope === parent.gridMediaScope
|
|
337
|
+
? requestedGridMediaScope : undefined);
|
|
338
|
+
let gridMediaCss = $derived(gridMediaScope && gridMediaScope !== parent.gridMediaScope
|
|
336
339
|
? getGridMediaCss(designTokens.state.token) : undefined);
|
|
337
340
|
let providerLocale = $derived(resolveProviderLocale(locale));
|
|
338
341
|
$effect(() => {
|
|
@@ -420,6 +423,9 @@
|
|
|
420
423
|
get avatar() {
|
|
421
424
|
return avatar ?? parent.avatar;
|
|
422
425
|
},
|
|
426
|
+
get image() {
|
|
427
|
+
return image ?? parent.image;
|
|
428
|
+
},
|
|
423
429
|
get tooltip() {
|
|
424
430
|
return tooltip ?? parent.tooltip;
|
|
425
431
|
},
|
|
@@ -600,6 +606,9 @@
|
|
|
600
606
|
get explicitComponentSize() {
|
|
601
607
|
return componentSize ?? parent.explicitComponentSize;
|
|
602
608
|
},
|
|
609
|
+
get configuredComponentDisabled() {
|
|
610
|
+
return componentDisabled ?? parent.configuredComponentDisabled;
|
|
611
|
+
},
|
|
603
612
|
get componentDisabled() {
|
|
604
613
|
return componentDisabled ?? parent.componentDisabled;
|
|
605
614
|
},
|
|
@@ -609,6 +618,9 @@
|
|
|
609
618
|
get theme() {
|
|
610
619
|
return designTokens.config;
|
|
611
620
|
},
|
|
621
|
+
get gridMediaScope() {
|
|
622
|
+
return gridMediaScope;
|
|
623
|
+
},
|
|
612
624
|
get themeStyle() {
|
|
613
625
|
return designTokens.style;
|
|
614
626
|
},
|
|
@@ -23,6 +23,7 @@ import type { BadgeRibbonConfig } from '../badge/badge-ribbon.types';
|
|
|
23
23
|
import type { BadgeConfig } from '../badge/badge.types';
|
|
24
24
|
import type { TagConfig } from '../tag/tag.types';
|
|
25
25
|
import type { AvatarConfig } from '../avatar/avatar.types';
|
|
26
|
+
import type { ImageConfig } from '../image/image.types';
|
|
26
27
|
import type { TooltipConfig } from '../tooltip/tooltip.types';
|
|
27
28
|
import type { PopoverConfig } from '../popover/popover.types';
|
|
28
29
|
import type { PopconfirmConfig } from '../popconfirm/popconfirm.types';
|
|
@@ -122,6 +123,7 @@ export interface ConfigProviderProps {
|
|
|
122
123
|
badge?: BadgeConfig;
|
|
123
124
|
tag?: TagConfig;
|
|
124
125
|
avatar?: AvatarConfig;
|
|
126
|
+
image?: ImageConfig;
|
|
125
127
|
tooltip?: TooltipConfig;
|
|
126
128
|
popover?: PopoverConfig;
|
|
127
129
|
popconfirm?: PopconfirmConfig;
|
|
@@ -23,6 +23,7 @@ import type { BadgeRibbonConfig } from '../badge/badge-ribbon.types';
|
|
|
23
23
|
import type { BadgeConfig } from '../badge/badge.types';
|
|
24
24
|
import type { TagConfig } from '../tag/tag.types';
|
|
25
25
|
import type { AvatarConfig } from '../avatar/avatar.types';
|
|
26
|
+
import type { ImageConfig } from '../image/image.types';
|
|
26
27
|
import type { TooltipConfig } from '../tooltip/tooltip.types';
|
|
27
28
|
import type { PopoverConfig } from '../popover/popover.types';
|
|
28
29
|
import type { PopconfirmConfig } from '../popconfirm/popconfirm.types';
|
|
@@ -84,6 +85,8 @@ export interface ConfigContext {
|
|
|
84
85
|
readonly timeline?: TimelineConfig;
|
|
85
86
|
readonly steps?: StepsConfig;
|
|
86
87
|
readonly layout?: LayoutConfig;
|
|
88
|
+
/** Scope of the registered Grid media rules for the current theme. */
|
|
89
|
+
readonly gridMediaScope?: string;
|
|
87
90
|
readonly select?: SelectConfig;
|
|
88
91
|
readonly treeSelect?: TreeSelectConfig;
|
|
89
92
|
readonly tree?: TreeConfig;
|
|
@@ -101,6 +104,7 @@ export interface ConfigContext {
|
|
|
101
104
|
readonly badge?: BadgeConfig;
|
|
102
105
|
readonly tag?: TagConfig;
|
|
103
106
|
readonly avatar?: AvatarConfig;
|
|
107
|
+
readonly image?: ImageConfig;
|
|
104
108
|
readonly tooltip?: TooltipConfig;
|
|
105
109
|
readonly popover?: PopoverConfig;
|
|
106
110
|
readonly popconfirm?: PopconfirmConfig;
|
|
@@ -160,7 +164,10 @@ export interface ConfigContext {
|
|
|
160
164
|
readonly floatButton?: FloatButtonConfig;
|
|
161
165
|
readonly floatButtonGroup?: FloatButtonGroupConfig;
|
|
162
166
|
readonly componentSize: ComponentSize;
|
|
167
|
+
/** Size configured in the current scope, before controls apply their own defaults. */
|
|
163
168
|
readonly explicitComponentSize?: ComponentSize;
|
|
169
|
+
/** The setting exposed by useConfig, independent of temporary submission blocking. */
|
|
170
|
+
readonly configuredComponentDisabled: boolean;
|
|
164
171
|
readonly componentDisabled: boolean;
|
|
165
172
|
readonly direction: 'ltr' | 'rtl';
|
|
166
173
|
readonly theme: ResolvedThemeConfig;
|
|
@@ -5,6 +5,7 @@ const defaultConfig = {
|
|
|
5
5
|
getPrefixCls: (suffix, custom) => custom || (suffix ? `ant-${suffix}` : 'ant'),
|
|
6
6
|
iconPrefixCls: 'anticon',
|
|
7
7
|
componentSize: 'medium',
|
|
8
|
+
configuredComponentDisabled: false,
|
|
8
9
|
componentDisabled: false,
|
|
9
10
|
direction: 'ltr',
|
|
10
11
|
theme: { mode: 'light', primary: 'blue', compact: false },
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { configureGlobal } from './config-provider-global';
|
|
2
|
+
/** Reads the nearest configured size and disabled state during component initialization. */
|
|
3
|
+
declare function useConfig(): {
|
|
4
|
+
readonly componentDisabled: boolean;
|
|
5
|
+
readonly componentSize: import("..").ComponentSize | undefined;
|
|
6
|
+
};
|
|
2
7
|
declare const _default: import("svelte").Component<import("./ConfigProvider.svelte").ConfigProviderProps, {}, ""> & {
|
|
3
8
|
config: typeof configureGlobal;
|
|
9
|
+
useConfig: typeof useConfig;
|
|
4
10
|
};
|
|
5
11
|
export default _default;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import ConfigProvider from './ConfigProvider.svelte';
|
|
2
|
+
import { useConfig as useConfigContext } from './config-context';
|
|
2
3
|
import { configureGlobal } from './config-provider-global';
|
|
3
|
-
|
|
4
|
+
/** Reads the nearest configured size and disabled state during component initialization. */
|
|
5
|
+
function useConfig() {
|
|
6
|
+
const context = useConfigContext();
|
|
7
|
+
return {
|
|
8
|
+
get componentDisabled() { return context.configuredComponentDisabled; },
|
|
9
|
+
get componentSize() { return context.explicitComponentSize; }
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export default Object.assign(ConfigProvider, { config: configureGlobal, useConfig });
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { useConfig } from '../config-provider/config-context';
|
|
4
4
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
5
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
5
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
6
6
|
import { getGridMediaQueries } from '../grid/grid.engine';
|
|
7
7
|
import { getDescriptionsPrefixCss } from './descriptions-prefix.engine';
|
|
8
8
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
const componentTheme = useComponentTheme('Descriptions');
|
|
35
35
|
let prefixCls = $derived(config.getPrefixCls('descriptions', customizePrefixCls));
|
|
36
36
|
let rootPrefixCls = $derived(config.getPrefixCls());
|
|
37
|
-
|
|
37
|
+
const runtimeStyles = useRuntimeStyles();
|
|
38
|
+
const hasCustomPrefix = $derived(prefixCls !== 'ant-descriptions' || rootPrefixCls !== 'ant');
|
|
39
|
+
let prefixCss = $derived(runtimeStyles && getDescriptionsPrefixCss(prefixCls, rootPrefixCls));
|
|
38
40
|
const breakpoint = createBreakpoint();
|
|
39
41
|
const designTokens = useDesignTokenContext();
|
|
40
42
|
let mediaQueries = $derived(designTokens.enabled
|
|
@@ -75,8 +77,8 @@
|
|
|
75
77
|
{#if typeof node === 'function'}{@render node()}{:else if node !== true && node !== false}{node ?? ''}{/if}
|
|
76
78
|
{/snippet}
|
|
77
79
|
{#if prefixCss}<ThemeScopeStyle css={prefixCss} scope={`descriptions-prefix:${prefixCls}:${rootPrefixCls}`} />{/if}<div {...rest} bind:this={nativeElement} dir={config.direction}
|
|
78
|
-
data-ant-descriptions-prefix={
|
|
79
|
-
data-ant-descriptions-global={
|
|
80
|
+
data-ant-descriptions-prefix={hasCustomPrefix ? prefixCls : undefined}
|
|
81
|
+
data-ant-descriptions-global={hasCustomPrefix ? rootPrefixCls : undefined}
|
|
80
82
|
class={[
|
|
81
83
|
prefixCls,
|
|
82
84
|
'ant-descriptions-css-var',
|
|
@@ -41,8 +41,11 @@ export function createDialogContainer(getOptions) {
|
|
|
41
41
|
else {
|
|
42
42
|
next = (typeof choice === 'function' ? choice() : choice) ?? document.body;
|
|
43
43
|
}
|
|
44
|
-
if (initialized && next !== target)
|
|
44
|
+
if (initialized && next !== untrack(() => target)) {
|
|
45
|
+
// Visibility effects must wait for the new keyed attachment.
|
|
46
|
+
connected = false;
|
|
45
47
|
revision = ++currentRevision;
|
|
48
|
+
}
|
|
46
49
|
initialized = true;
|
|
47
50
|
target = next;
|
|
48
51
|
});
|
|
@@ -55,6 +58,7 @@ export function createDialogContainer(getOptions) {
|
|
|
55
58
|
function attach(node) {
|
|
56
59
|
const container = target;
|
|
57
60
|
return untrack(() => {
|
|
61
|
+
const component = getOptions().component;
|
|
58
62
|
const nodeRevision = currentRevision;
|
|
59
63
|
activeNode = node;
|
|
60
64
|
const document = node.ownerDocument;
|
|
@@ -77,6 +81,7 @@ export function createDialogContainer(getOptions) {
|
|
|
77
81
|
marker,
|
|
78
82
|
autoLock: false,
|
|
79
83
|
prepareOrigin: staticHost ? connectStaticOrigin : undefined,
|
|
84
|
+
preservePointerEvents: component === 'image',
|
|
80
85
|
// Cleanup of the old keyed panel leaves the DOM being removed out of the original branch.
|
|
81
86
|
get restoreOnDestroy() { return node.isConnected && nodeRevision === currentRevision; },
|
|
82
87
|
get preserveVariables() {
|
|
@@ -98,6 +103,11 @@ export function createDialogContainer(getOptions) {
|
|
|
98
103
|
if (container) {
|
|
99
104
|
explicitPortal = attachPortal(container);
|
|
100
105
|
}
|
|
106
|
+
else if (container === undefined && component === 'image') {
|
|
107
|
+
// Move the preview before showModal and keep nested viewers in their host dialog.
|
|
108
|
+
const destination = origin.closest('dialog') ?? document.body;
|
|
109
|
+
explicitPortal = attachPortal(destination);
|
|
110
|
+
}
|
|
101
111
|
else if (container === undefined) {
|
|
102
112
|
$effect(() => {
|
|
103
113
|
if (portalByDefault) {
|
|
@@ -112,7 +122,9 @@ export function createDialogContainer(getOptions) {
|
|
|
112
122
|
function sync() {
|
|
113
123
|
const nonce = config.csp?.nonce;
|
|
114
124
|
// The hidden static root is required for CSSOM. The dialog can appear after it is moved.
|
|
115
|
-
|
|
125
|
+
if (activeNode === node && nodeRevision === currentRevision) {
|
|
126
|
+
connected = node.isConnected && !node.closest('[data-ant-modal-static-host]');
|
|
127
|
+
}
|
|
116
128
|
// Document :has() cannot see a modal in a ShadowRoot. Native modality still applies.
|
|
117
129
|
const shadowModal = node.isConnected && node.open
|
|
118
130
|
&& !node.hasAttribute('data-ant-dialog-unlocked')
|
|
@@ -4,9 +4,11 @@ interface DialogFocusOptions {
|
|
|
4
4
|
restoreFocus: boolean;
|
|
5
5
|
autoFocus: boolean;
|
|
6
6
|
}
|
|
7
|
+
/** Finds the current focus even inside a ShadowRoot that hosts a portaled panel. */
|
|
8
|
+
export declare function getDialogActiveElement(document: Document): Element | null;
|
|
7
9
|
/** Manages dialog visibility, keyboard input, and focus restoration independently of animation. */
|
|
8
10
|
export declare function connectDialogFocus(dialog: HTMLDialogElement, getInteraction: () => DialogFocusOptions, getInitialFocus?: (controls: HTMLElement[]) => HTMLElement | undefined): {
|
|
9
|
-
open: () =>
|
|
11
|
+
open: (previousOpener?: HTMLElement) => HTMLElement | undefined;
|
|
10
12
|
sync: () => void;
|
|
11
13
|
close: () => (() => void) | undefined;
|
|
12
14
|
ownsNativeLayer: () => boolean;
|
|
@@ -10,7 +10,7 @@ const tabbableSelector = [
|
|
|
10
10
|
'[tabindex]', '[contenteditable]', 'audio[controls]', 'video[controls]'
|
|
11
11
|
].join(',');
|
|
12
12
|
/** Finds the current focus even inside a ShadowRoot that hosts a portaled panel. */
|
|
13
|
-
function
|
|
13
|
+
export function getDialogActiveElement(document) {
|
|
14
14
|
let element = document.activeElement;
|
|
15
15
|
while (element?.shadowRoot?.activeElement) {
|
|
16
16
|
element = element.shadowRoot.activeElement;
|
|
@@ -63,7 +63,7 @@ export function connectDialogFocus(dialog, getInteraction, getInitialFocus) {
|
|
|
63
63
|
}
|
|
64
64
|
/** Restores focus after the dialog actually exits, including programmatic focus(). */
|
|
65
65
|
function keepFocus() {
|
|
66
|
-
const target =
|
|
66
|
+
const target = getDialogActiveElement(document);
|
|
67
67
|
if (!getInteraction().trap || !canManage(target)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
@@ -93,7 +93,7 @@ export function connectDialogFocus(dialog, getInteraction, getInitialFocus) {
|
|
|
93
93
|
function handleKeydown(event) {
|
|
94
94
|
if (event.defaultPrevented || event.isComposing)
|
|
95
95
|
return;
|
|
96
|
-
const focused =
|
|
96
|
+
const focused = getDialogActiveElement(document);
|
|
97
97
|
if (!canManage(focused))
|
|
98
98
|
return;
|
|
99
99
|
if (event.key === 'Escape') {
|
|
@@ -123,9 +123,9 @@ export function connectDialogFocus(dialog, getInteraction, getInitialFocus) {
|
|
|
123
123
|
view.addEventListener('keydown', handleKeydown);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
/**
|
|
127
|
-
function open() {
|
|
128
|
-
const current =
|
|
126
|
+
/** Captures the opener before moving focus, or uses the opener of the same portaled session. */
|
|
127
|
+
function open(previousOpener) {
|
|
128
|
+
const current = previousOpener ?? getDialogActiveElement(document);
|
|
129
129
|
opener = current instanceof view.HTMLElement ? current : undefined;
|
|
130
130
|
stack.push(dialog);
|
|
131
131
|
const interaction = getInteraction();
|
|
@@ -135,6 +135,7 @@ export function connectDialogFocus(dialog, getInteraction, getInitialFocus) {
|
|
|
135
135
|
target.focus({ preventScroll: true });
|
|
136
136
|
}
|
|
137
137
|
keepFocus();
|
|
138
|
+
return opener;
|
|
138
139
|
}
|
|
139
140
|
/** showModal raises the dialog when switching modes while preserving the logical focus stack. */
|
|
140
141
|
function ownsNativeLayer() {
|
|
@@ -158,7 +159,7 @@ export function connectDialogFocus(dialog, getInteraction, getInitialFocus) {
|
|
|
158
159
|
const interaction = getInteraction();
|
|
159
160
|
const matchesMode = dialog.matches(':modal') === interaction.native;
|
|
160
161
|
if (native !== interaction.native || !matchesMode) {
|
|
161
|
-
const previous =
|
|
162
|
+
const previous = getDialogActiveElement(document);
|
|
162
163
|
const preserve = previous instanceof view.HTMLElement
|
|
163
164
|
&& (isPopupFocusWithin(dialog, previous) || !interaction.native);
|
|
164
165
|
stopListening();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useConfig } from '../config-provider/config-context';
|
|
3
3
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
4
4
|
import { getDividerPrefixCss } from './divider-prefix.engine';
|
|
5
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
5
6
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
6
7
|
import type { DividerProps, DividerOrientation, DividerSemanticInfo } from './divider.types';
|
|
7
8
|
|
|
@@ -26,7 +27,9 @@
|
|
|
26
27
|
const config = useConfig();
|
|
27
28
|
const componentTheme = useComponentTheme('Divider');
|
|
28
29
|
let prefix = $derived(config.getPrefixCls('divider', prefixCls));
|
|
29
|
-
|
|
30
|
+
const runtimeStyles = useRuntimeStyles();
|
|
31
|
+
const hasCustomPrefix = $derived(prefix !== 'ant-divider');
|
|
32
|
+
let prefixCss = $derived(runtimeStyles && getDividerPrefixCss(prefix));
|
|
30
33
|
let direction = $derived<DividerOrientation>(
|
|
31
34
|
orientation === 'horizontal' || orientation === 'vertical'
|
|
32
35
|
? orientation : typeof vertical === 'boolean'
|
|
@@ -92,7 +95,7 @@
|
|
|
92
95
|
bind:this={nativeElement}
|
|
93
96
|
role="separator"
|
|
94
97
|
aria-orientation={direction}
|
|
95
|
-
data-ant-divider-prefix={
|
|
98
|
+
data-ant-divider-prefix={hasCustomPrefix ? prefix : undefined}
|
|
96
99
|
dir={config.direction}
|
|
97
100
|
class={[
|
|
98
101
|
prefix,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { useConfig } from '../config-provider/config-context';
|
|
10
10
|
import { isolateFormItemStyle } from '../form/form-item-status';
|
|
11
11
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
12
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
12
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
13
13
|
import { provideZIndex, useZIndex } from '../popup/z-index-context.svelte';
|
|
14
14
|
import { useWatermarkPanel } from '../watermark/watermark-context';
|
|
15
15
|
import { createDrawerDialog, type DrawerTransitionOptions } from './drawer.dom';
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
isolateFormItemStyle();
|
|
69
69
|
const interaction = $derived(resolveDrawerInteraction(mask, focusable, autoFocus, config.drawer));
|
|
70
70
|
let componentPrefix = $derived(config.getPrefixCls('drawer', customizePrefixCls));
|
|
71
|
-
|
|
71
|
+
const runtimeStyles = useRuntimeStyles();
|
|
72
|
+
let prefixCss = $derived(runtimeStyles && getDrawerPrefixCss(componentPrefix));
|
|
72
73
|
const componentTheme = useComponentTheme('Drawer');
|
|
73
74
|
const designTheme = useDesignTokenContext();
|
|
74
75
|
const transitionOptions = $derived({
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { connectInlineStyle } from '../style/inline-style.dom';
|
|
20
20
|
import { serializeInlineStyleLayers } from '../style/inline-style.engine';
|
|
21
21
|
import { getInlineZIndex, provideZIndex, useZIndex } from '../popup/z-index-context.svelte';
|
|
22
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
22
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
23
23
|
import { getTooltipDelay, type TooltipPosition } from '../tooltip/tooltip.engine';
|
|
24
24
|
import {
|
|
25
25
|
dropdownSemantics, getDropdownMatch, getDropdownMotionName, isDropdownMenuKey
|
|
@@ -70,7 +70,10 @@
|
|
|
70
70
|
let componentPrefix = $derived(config.getPrefixCls('dropdown', customizePrefixCls));
|
|
71
71
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
72
72
|
const menuPrefix = $derived(menu?.prefixCls || `${componentPrefix}-menu`);
|
|
73
|
-
|
|
73
|
+
const runtimeStyles = useRuntimeStyles();
|
|
74
|
+
let prefixCss = $derived(
|
|
75
|
+
runtimeStyles && getDropdownPrefixCss(componentPrefix, rootPrefix, menuPrefix)
|
|
76
|
+
);
|
|
74
77
|
const requestedPlacement = $derived(
|
|
75
78
|
placement ?? (config.direction === 'rtl' ? 'bottomRight' : 'bottomLeft')
|
|
76
79
|
);
|
|
@@ -141,7 +144,7 @@
|
|
|
141
144
|
const retain = $derived(Boolean(forceRender || visited && !destroyOnHidden));
|
|
142
145
|
const renderRequested = $derived(visible || retain);
|
|
143
146
|
const motionName = $derived(transitionName ?? getDropdownMotionName(rootPrefix, requestedPlacement));
|
|
144
|
-
const motionCss = $derived(getDropdownMotionCss(componentPrefix, rootPrefix));
|
|
147
|
+
const motionCss = $derived(runtimeStyles && getDropdownMotionCss(componentPrefix, rootPrefix));
|
|
145
148
|
const popupMotion = useMenuMotion(() => host, () => popup, () => ({
|
|
146
149
|
motion: {
|
|
147
150
|
motionName,
|
|
@@ -917,12 +920,13 @@
|
|
|
917
920
|
{/snippet}
|
|
918
921
|
|
|
919
922
|
{#if prefixCss}<ThemeScopeStyle css={prefixCss}
|
|
920
|
-
scope={`dropdown-prefix:${componentPrefix}:${rootPrefix}${menu?.prefixCls ? `:${menuPrefix}` : ''}`} />{/if}{#if mounted}<ThemeScopeStyle css={motionCss}
|
|
923
|
+
scope={`dropdown-prefix:${componentPrefix}:${rootPrefix}${menu?.prefixCls ? `:${menuPrefix}` : ''}`} />{/if}{#if mounted && motionCss}<ThemeScopeStyle css={motionCss}
|
|
921
924
|
scope={`dropdown-motion:${componentPrefix}:${rootPrefix}`} />{/if}<span data-ant-dropdown-trigger data-ant-dropdown-prefix={componentPrefix} data-ant-dropdown-root-prefix={rootPrefix} data-ant-dropdown-menu-prefix={menuPrefix} bind:this={host} id={triggerId} role="presentation" class={[`${componentPrefix}-trigger`, className]} {style} onpointerenter={handleEnter} onpointerleave={handleLeave} ontouchstart={handleTouchStart} onclick={handleClick} oncontextmenucapture={handleContextMenu} onkeydown={handleTriggerKeydown}>{@render children()}</span>
|
|
922
925
|
<NoCompactStyle>{#if rendered}
|
|
923
926
|
<div data-ant-dropdown-popup data-ant-dropdown-prefix={componentPrefix} data-ant-dropdown-root-prefix={rootPrefix} data-ant-dropdown-menu-prefix={menuPrefix} data-ant-dropdown-source-theme={componentTheme.className ? true : undefined}
|
|
924
927
|
data-ant-dropdown-source-align={builtinPlacements ? true : undefined}
|
|
925
|
-
data-ant-dropdown-motion data-ant-dropdown-
|
|
928
|
+
data-ant-dropdown-motion data-ant-dropdown-static-motion={!runtimeStyles || undefined}
|
|
929
|
+
data-ant-dropdown-placement={actualPlacement}
|
|
926
930
|
bind:this={popup} id={popupId} popover="manual" role={customContent ? 'dialog' : 'presentation'}
|
|
927
931
|
tabindex="-1" aria-label={customContent ? ariaLabel : undefined}
|
|
928
932
|
aria-labelledby={customContent ? ariaLabelledby ?? (ariaLabel ? undefined : triggerId) : undefined}
|
package/dist/empty/Empty.svelte
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
5
5
|
import { connectFeedbackFocus } from '../feedback.dom';
|
|
6
6
|
import { getEmptyPrefixCss } from './empty-prefix.engine';
|
|
7
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
7
8
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
8
9
|
import BuiltinImage from './EmptyImage.svelte';
|
|
9
10
|
import { ruRU } from '../types';
|
|
@@ -33,7 +34,9 @@
|
|
|
33
34
|
const componentTheme = useComponentTheme('Empty');
|
|
34
35
|
let host = $state<HTMLDivElement>();
|
|
35
36
|
let prefix = $derived(config.getPrefixCls('empty', prefixCls));
|
|
36
|
-
|
|
37
|
+
const runtimeStyles = useRuntimeStyles();
|
|
38
|
+
const hasCustomPrefix = $derived(prefix !== 'ant-empty');
|
|
39
|
+
let prefixCss = $derived(runtimeStyles && getEmptyPrefixCss(prefix));
|
|
37
40
|
let mergedImage = $derived(image ?? config.empty?.image ?? 'default');
|
|
38
41
|
let strings = $derived({ ...ruRU.empty, ...config.locale.empty });
|
|
39
42
|
let content = $derived(description === undefined ? strings.description : description);
|
|
@@ -116,7 +119,7 @@
|
|
|
116
119
|
</style>
|
|
117
120
|
|
|
118
121
|
{#if prefixCss}<ThemeScopeStyle css={prefixCss} scope={`empty-prefix:${prefix}`} />{/if}<div
|
|
119
|
-
bind:this={host} {id} data-ant-empty data-ant-empty-prefix={
|
|
122
|
+
bind:this={host} {id} data-ant-empty data-ant-empty-prefix={hasCustomPrefix ? prefix : undefined}
|
|
120
123
|
role={ariaLabel || ariaLabelledby ? 'group' : undefined}
|
|
121
124
|
aria-label={ariaLabel} aria-labelledby={ariaLabelledby} aria-describedby={ariaDescribedby}
|
|
122
125
|
dir={config.direction} class={[
|
package/dist/flex/Flex.svelte
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useConfig } from '../config-provider/config-context';
|
|
3
3
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
4
4
|
import { getFlexPrefixCss } from './flex-prefix.engine';
|
|
5
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
5
6
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
6
7
|
import type { FlexComponentProps, FlexRootProps } from './flex.types';
|
|
7
8
|
|
|
@@ -25,7 +26,9 @@
|
|
|
25
26
|
const config = useConfig();
|
|
26
27
|
const componentTheme = useComponentTheme('Flex');
|
|
27
28
|
let prefix = $derived(config.getPrefixCls('flex', prefixCls));
|
|
28
|
-
|
|
29
|
+
const runtimeStyles = useRuntimeStyles();
|
|
30
|
+
const hasCustomPrefix = $derived(prefix !== 'ant-flex');
|
|
31
|
+
let prefixCss = $derived(runtimeStyles && getFlexPrefixCss(prefix));
|
|
29
32
|
let isVertical = $derived(orientation ? orientation === 'vertical'
|
|
30
33
|
: vertical ?? config.flex?.vertical ?? false);
|
|
31
34
|
let wrapping = $derived(wrap === true ? 'wrap' : wrap);
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
presetGap && `${prefix}-gap-${gap}`
|
|
59
62
|
],
|
|
60
63
|
style: rootStyle,
|
|
61
|
-
'data-ant-flex-prefix':
|
|
64
|
+
'data-ant-flex-prefix': hasCustomPrefix ? prefix : undefined
|
|
62
65
|
});
|
|
63
66
|
let Root = $derived(typeof component === 'string' ? undefined : component);
|
|
64
67
|
// Optional ref forwarding keeps the accessor out of the root's DOM spread without $bindable. TS
|