@chenzy-design/svelte 0.1.0 → 0.2.0
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/components.json +1 -1
- package/package.json +7 -8
- package/src/_floating/use-floating.ts +0 -208
- package/src/anchor/Anchor.a11y.test.ts +0 -49
- package/src/anchor/Anchor.kbd.test.ts +0 -70
- package/src/anchor/Anchor.svelte +0 -359
- package/src/anchor/AnchorKbdFixture.svelte +0 -24
- package/src/anchor/index.ts +0 -3
- package/src/anchor/meta.ts +0 -70
- package/src/anchor/types.ts +0 -8
- package/src/autocomplete/AutoComplete.a11y.test.ts +0 -49
- package/src/autocomplete/AutoComplete.kbd.test.ts +0 -69
- package/src/autocomplete/AutoComplete.svelte +0 -706
- package/src/autocomplete/AutoCompleteKbdFixture.svelte +0 -24
- package/src/autocomplete/index.ts +0 -2
- package/src/autocomplete/meta.ts +0 -41
- package/src/avatar/Avatar.a11y.test.ts +0 -37
- package/src/avatar/Avatar.svelte +0 -315
- package/src/avatar/AvatarGroup.svelte +0 -142
- package/src/avatar/context.ts +0 -21
- package/src/avatar/index.ts +0 -10
- package/src/avatar/meta.ts +0 -73
- package/src/back-top/BackTop.a11y.test.ts +0 -40
- package/src/back-top/BackTop.svelte +0 -314
- package/src/back-top/index.ts +0 -2
- package/src/back-top/meta.ts +0 -108
- package/src/badge/Badge.a11y.test.ts +0 -35
- package/src/badge/Badge.svelte +0 -328
- package/src/badge/BadgeA11yFixture.svelte +0 -18
- package/src/badge/index.ts +0 -2
- package/src/badge/meta.ts +0 -62
- package/src/banner/Banner.a11y.test.ts +0 -48
- package/src/banner/Banner.svelte +0 -368
- package/src/banner/index.ts +0 -3
- package/src/banner/meta.ts +0 -121
- package/src/breadcrumb/Breadcrumb.a11y.test.ts +0 -35
- package/src/breadcrumb/Breadcrumb.kbd.test.ts +0 -45
- package/src/breadcrumb/Breadcrumb.svelte +0 -414
- package/src/breadcrumb/BreadcrumbKbdFixture.svelte +0 -23
- package/src/breadcrumb/Item.svelte +0 -77
- package/src/breadcrumb/context.ts +0 -27
- package/src/breadcrumb/index.ts +0 -21
- package/src/breadcrumb/meta.ts +0 -128
- package/src/breadcrumb/types.ts +0 -4
- package/src/button/Button.a11y.test.ts +0 -54
- package/src/button/Button.svelte +0 -176
- package/src/button/index.ts +0 -2
- package/src/button/meta.ts +0 -28
- package/src/calendar/Calendar.a11y.test.ts +0 -51
- package/src/calendar/Calendar.kbd.test.ts +0 -59
- package/src/calendar/Calendar.svelte +0 -1344
- package/src/calendar/CalendarKbdFixture.svelte +0 -23
- package/src/calendar/index.ts +0 -3
- package/src/calendar/meta.ts +0 -117
- package/src/card/Card.a11y.test.ts +0 -38
- package/src/card/Card.svelte +0 -341
- package/src/card/CardMeta.svelte +0 -60
- package/src/card/index.ts +0 -8
- package/src/card/meta.ts +0 -83
- package/src/carousel/Carousel.a11y.test.ts +0 -53
- package/src/carousel/Carousel.kbd.test.ts +0 -67
- package/src/carousel/Carousel.svelte +0 -806
- package/src/carousel/CarouselA11yFixture.svelte +0 -25
- package/src/carousel/CarouselKbdFixture.svelte +0 -24
- package/src/carousel/index.ts +0 -2
- package/src/carousel/meta.ts +0 -74
- package/src/cascader/Cascader.a11y.test.ts +0 -59
- package/src/cascader/Cascader.kbd.test.ts +0 -56
- package/src/cascader/Cascader.svelte +0 -1570
- package/src/cascader/CascaderKbdFixture.svelte +0 -31
- package/src/cascader/index.ts +0 -3
- package/src/cascader/meta.ts +0 -57
- package/src/cascader/types.ts +0 -9
- package/src/checkbox/Checkbox.svelte +0 -281
- package/src/checkbox/CheckboxGroup.a11y.test.ts +0 -43
- package/src/checkbox/CheckboxGroup.kbd.test.ts +0 -40
- package/src/checkbox/CheckboxGroup.svelte +0 -122
- package/src/checkbox/CheckboxGroupKbdFixture.svelte +0 -20
- package/src/checkbox/context.ts +0 -31
- package/src/checkbox/index.ts +0 -4
- package/src/checkbox/meta.ts +0 -67
- package/src/collapse/Collapse.a11y.test.ts +0 -53
- package/src/collapse/Collapse.kbd.test.ts +0 -89
- package/src/collapse/Collapse.svelte +0 -406
- package/src/collapse/CollapseA11yFixture.svelte +0 -27
- package/src/collapse/CollapseKbdFixture.svelte +0 -25
- package/src/collapse/CollapsePanel.svelte +0 -102
- package/src/collapse/context.ts +0 -54
- package/src/collapse/index.ts +0 -17
- package/src/collapse/meta.ts +0 -79
- package/src/collapse/types.ts +0 -5
- package/src/color-picker/ColorPicker.a11y.test.ts +0 -60
- package/src/color-picker/ColorPicker.kbd.test.ts +0 -73
- package/src/color-picker/ColorPicker.svelte +0 -985
- package/src/color-picker/ColorPickerKbdFixture.svelte +0 -25
- package/src/color-picker/index.ts +0 -2
- package/src/color-picker/meta.ts +0 -47
- package/src/config-provider/ConfigProvider.svelte +0 -227
- package/src/config-provider/context.ts +0 -29
- package/src/config-provider/index.ts +0 -48
- package/src/config-provider/meta.ts +0 -128
- package/src/date-picker/DatePicker.a11y.test.ts +0 -45
- package/src/date-picker/DatePicker.kbd.test.ts +0 -71
- package/src/date-picker/DatePicker.svelte +0 -1798
- package/src/date-picker/DatePickerKbdFixture.svelte +0 -26
- package/src/date-picker/RangePicker.kbd.test.ts +0 -69
- package/src/date-picker/RangePicker.svelte +0 -775
- package/src/date-picker/RangePickerKbdFixture.svelte +0 -30
- package/src/date-picker/index.ts +0 -4
- package/src/date-picker/meta.ts +0 -67
- package/src/date-picker/range-meta.ts +0 -44
- package/src/descriptions/Descriptions.a11y.test.ts +0 -33
- package/src/descriptions/Descriptions.svelte +0 -287
- package/src/descriptions/DescriptionsItem.svelte +0 -43
- package/src/descriptions/context.ts +0 -21
- package/src/descriptions/index.ts +0 -16
- package/src/descriptions/meta.ts +0 -45
- package/src/descriptions/types.ts +0 -6
- package/src/divider/Divider.a11y.test.ts +0 -23
- package/src/divider/Divider.svelte +0 -154
- package/src/divider/index.ts +0 -2
- package/src/divider/meta.ts +0 -23
- package/src/drawer/Drawer.a11y.test.ts +0 -41
- package/src/drawer/Drawer.kbd.test.ts +0 -67
- package/src/drawer/Drawer.svelte +0 -554
- package/src/drawer/DrawerKbdFixture.svelte +0 -28
- package/src/drawer/index.ts +0 -2
- package/src/drawer/meta.ts +0 -127
- package/src/dropdown/Dropdown.a11y.test.ts +0 -46
- package/src/dropdown/Dropdown.kbd.test.ts +0 -56
- package/src/dropdown/Dropdown.svelte +0 -573
- package/src/dropdown/DropdownA11yFixture.svelte +0 -24
- package/src/dropdown/DropdownDivider.svelte +0 -17
- package/src/dropdown/DropdownItem.svelte +0 -127
- package/src/dropdown/DropdownItemNode.svelte +0 -355
- package/src/dropdown/DropdownKbdFixture.svelte +0 -26
- package/src/dropdown/DropdownMenu.svelte +0 -24
- package/src/dropdown/DropdownSubMenu.svelte +0 -212
- package/src/dropdown/DropdownTitle.svelte +0 -34
- package/src/dropdown/context.ts +0 -13
- package/src/dropdown/index.ts +0 -36
- package/src/dropdown/meta.ts +0 -97
- package/src/dropdown/types.test.ts +0 -50
- package/src/dropdown/types.ts +0 -67
- package/src/empty/Empty.a11y.test.ts +0 -24
- package/src/empty/Empty.svelte +0 -304
- package/src/empty/index.ts +0 -2
- package/src/empty/meta.ts +0 -41
- package/src/form/Field.svelte +0 -492
- package/src/form/FieldArray.svelte +0 -75
- package/src/form/Form.a11y.test.ts +0 -39
- package/src/form/Form.svelte +0 -243
- package/src/form/FormA11yFixture.svelte +0 -31
- package/src/form/FormCascader.svelte +0 -82
- package/src/form/FormCheckbox.svelte +0 -83
- package/src/form/FormDatePicker.svelte +0 -80
- package/src/form/FormErrorMessage.svelte +0 -44
- package/src/form/FormInput.svelte +0 -95
- package/src/form/FormLabel.svelte +0 -46
- package/src/form/FormRadio.svelte +0 -83
- package/src/form/FormRating.svelte +0 -85
- package/src/form/FormSection.svelte +0 -45
- package/src/form/FormSelect.svelte +0 -96
- package/src/form/FormSlider.svelte +0 -95
- package/src/form/FormSlot.svelte +0 -51
- package/src/form/FormSwitch.svelte +0 -82
- package/src/form/FormTagInput.svelte +0 -79
- package/src/form/FormTreeSelect.svelte +0 -85
- package/src/form/FormUpload.svelte +0 -92
- package/src/form/context.ts +0 -47
- package/src/form/index.ts +0 -22
- package/src/form/meta.ts +0 -85
- package/src/grid/Col.svelte +0 -142
- package/src/grid/Grid.a11y.test.ts +0 -14
- package/src/grid/GridA11yFixture.svelte +0 -12
- package/src/grid/Row.svelte +0 -116
- package/src/grid/index.ts +0 -3
- package/src/grid/meta.ts +0 -72
- package/src/grid/use-breakpoint.svelte.ts +0 -48
- package/src/highlight/Highlight.a11y.test.ts +0 -25
- package/src/highlight/Highlight.svelte +0 -99
- package/src/highlight/index.ts +0 -2
- package/src/highlight/meta.ts +0 -80
- package/src/icon/Icon.svelte +0 -156
- package/src/icon/index.ts +0 -2
- package/src/icon/meta.ts +0 -41
- package/src/image/Image.a11y.test.ts +0 -30
- package/src/image/Image.svelte +0 -387
- package/src/image/ImagePreview.kbd.test.ts +0 -52
- package/src/image/ImagePreview.svelte +0 -309
- package/src/image/ImagePreviewGroup.svelte +0 -93
- package/src/image/ImagePreviewKbdFixture.svelte +0 -32
- package/src/image/context.ts +0 -26
- package/src/image/index.ts +0 -15
- package/src/image/meta.ts +0 -131
- package/src/index.ts +0 -208
- package/src/input/Input.a11y.test.ts +0 -58
- package/src/input/Input.svelte +0 -505
- package/src/input/index.ts +0 -2
- package/src/input/meta.ts +0 -40
- package/src/input-number/InputNumber.a11y.test.ts +0 -43
- package/src/input-number/InputNumber.kbd.test.ts +0 -41
- package/src/input-number/InputNumber.svelte +0 -674
- package/src/input-number/InputNumberKbdFixture.svelte +0 -15
- package/src/input-number/index.ts +0 -2
- package/src/input-number/meta.ts +0 -65
- package/src/layout/Content.svelte +0 -37
- package/src/layout/Footer.svelte +0 -49
- package/src/layout/Header.svelte +0 -46
- package/src/layout/Layout.a11y.test.ts +0 -34
- package/src/layout/Layout.svelte +0 -60
- package/src/layout/LayoutA11yFixture.svelte +0 -21
- package/src/layout/Sider.svelte +0 -207
- package/src/layout/index.ts +0 -26
- package/src/layout/meta.ts +0 -116
- package/src/list/List.a11y.test.ts +0 -69
- package/src/list/List.bench.ts +0 -26
- package/src/list/List.kbd.test.ts +0 -71
- package/src/list/List.svelte +0 -920
- package/src/list/ListA11yFixture.svelte +0 -38
- package/src/list/ListBenchFixture.svelte +0 -22
- package/src/list/ListItem.svelte +0 -175
- package/src/list/ListKbdFixture.svelte +0 -31
- package/src/list/ListMeta.svelte +0 -73
- package/src/list/context.ts +0 -39
- package/src/list/index.ts +0 -21
- package/src/list/meta.ts +0 -99
- package/src/locale-provider/LocaleProvider.svelte +0 -110
- package/src/locale-provider/context.ts +0 -22
- package/src/locale-provider/index.ts +0 -21
- package/src/locale-provider/meta.ts +0 -93
- package/src/locale-provider/use-locale.ts +0 -25
- package/src/lottie-icon/LottieIcon.svelte +0 -330
- package/src/lottie-icon/index.ts +0 -9
- package/src/lottie-icon/meta.ts +0 -162
- package/src/menu/Menu.a11y.test.ts +0 -54
- package/src/menu/Menu.kbd.test.ts +0 -69
- package/src/menu/Menu.svelte +0 -762
- package/src/menu/MenuKbdFixture.svelte +0 -22
- package/src/menu/MenuPopupNode.svelte +0 -525
- package/src/menu/index.ts +0 -4
- package/src/menu/meta.ts +0 -137
- package/src/menu/types.ts +0 -120
- package/src/meta.test.ts +0 -173
- package/src/modal/ConfirmModal.svelte +0 -173
- package/src/modal/Modal.a11y.test.ts +0 -46
- package/src/modal/Modal.kbd.test.ts +0 -65
- package/src/modal/Modal.svelte +0 -511
- package/src/modal/ModalKbdFixture.svelte +0 -24
- package/src/modal/command.svelte.ts +0 -103
- package/src/modal/index.ts +0 -30
- package/src/modal/meta.ts +0 -165
- package/src/modal/z-stack.ts +0 -26
- package/src/notification/NotificationContainer.svelte +0 -192
- package/src/notification/NotificationItem.a11y.test.ts +0 -73
- package/src/notification/NotificationItem.svelte +0 -368
- package/src/notification/index.ts +0 -9
- package/src/notification/meta.ts +0 -120
- package/src/notification/store.ts +0 -191
- package/src/overflow-list/OverflowList.a11y.test.ts +0 -46
- package/src/overflow-list/OverflowList.kbd.test.ts +0 -34
- package/src/overflow-list/OverflowList.svelte +0 -539
- package/src/overflow-list/OverflowListA11yFixture.svelte +0 -22
- package/src/overflow-list/OverflowListKbdFixture.svelte +0 -21
- package/src/overflow-list/index.ts +0 -2
- package/src/overflow-list/meta.ts +0 -138
- package/src/pagination/Pagination.a11y.test.ts +0 -62
- package/src/pagination/Pagination.kbd.test.ts +0 -66
- package/src/pagination/Pagination.svelte +0 -428
- package/src/pagination/PaginationKbdFixture.svelte +0 -15
- package/src/pagination/index.ts +0 -2
- package/src/pagination/meta.ts +0 -73
- package/src/popconfirm/Popconfirm.a11y.test.ts +0 -46
- package/src/popconfirm/Popconfirm.kbd.test.ts +0 -42
- package/src/popconfirm/Popconfirm.svelte +0 -724
- package/src/popconfirm/PopconfirmA11yFixture.svelte +0 -34
- package/src/popconfirm/PopconfirmKbdFixture.svelte +0 -17
- package/src/popconfirm/index.ts +0 -2
- package/src/popconfirm/meta.ts +0 -200
- package/src/popover/Popover.a11y.test.ts +0 -58
- package/src/popover/Popover.kbd.test.ts +0 -42
- package/src/popover/Popover.svelte +0 -643
- package/src/popover/PopoverA11yFixture.svelte +0 -35
- package/src/popover/PopoverKbdFixture.svelte +0 -18
- package/src/popover/index.ts +0 -2
- package/src/popover/meta.ts +0 -103
- package/src/progress/Progress.a11y.test.ts +0 -37
- package/src/progress/Progress.svelte +0 -423
- package/src/progress/index.ts +0 -3
- package/src/progress/meta.ts +0 -132
- package/src/radio/Radio.svelte +0 -330
- package/src/radio/RadioGroup.a11y.test.ts +0 -43
- package/src/radio/RadioGroup.kbd.test.ts +0 -75
- package/src/radio/RadioGroup.svelte +0 -199
- package/src/radio/RadioGroupKbdFixture.svelte +0 -21
- package/src/radio/context.ts +0 -42
- package/src/radio/index.ts +0 -4
- package/src/radio/meta.ts +0 -68
- package/src/rating/Rating.a11y.test.ts +0 -41
- package/src/rating/Rating.kbd.test.ts +0 -48
- package/src/rating/Rating.svelte +0 -407
- package/src/rating/RatingKbdFixture.svelte +0 -15
- package/src/rating/index.ts +0 -2
- package/src/rating/meta.ts +0 -40
- package/src/resize-observer/ResizeObserver.svelte +0 -169
- package/src/resize-observer/action.ts +0 -80
- package/src/resize-observer/index.ts +0 -9
- package/src/resize-observer/meta.ts +0 -102
- package/src/scroll-list/ScrollColumn.svelte +0 -592
- package/src/scroll-list/ScrollList.svelte +0 -257
- package/src/scroll-list/index.ts +0 -4
- package/src/scroll-list/meta.ts +0 -93
- package/src/scroll-list/types.ts +0 -18
- package/src/select/Select.a11y.test.ts +0 -59
- package/src/select/Select.kbd.test.ts +0 -59
- package/src/select/Select.svelte +0 -1155
- package/src/select/SelectKbdFixture.svelte +0 -29
- package/src/select/index.ts +0 -3
- package/src/select/meta.ts +0 -78
- package/src/select/types.ts +0 -2
- package/src/side-sheet/SideSheet.a11y.test.ts +0 -53
- package/src/side-sheet/SideSheet.kbd.test.ts +0 -63
- package/src/side-sheet/SideSheet.svelte +0 -659
- package/src/side-sheet/SideSheetKbdFixture.svelte +0 -30
- package/src/side-sheet/index.ts +0 -2
- package/src/side-sheet/meta.ts +0 -116
- package/src/skeleton/Skeleton.a11y.test.ts +0 -35
- package/src/skeleton/Skeleton.svelte +0 -131
- package/src/skeleton/SkeletonAvatar.svelte +0 -82
- package/src/skeleton/SkeletonButton.svelte +0 -90
- package/src/skeleton/SkeletonImage.svelte +0 -100
- package/src/skeleton/SkeletonParagraph.svelte +0 -103
- package/src/skeleton/SkeletonTitle.svelte +0 -74
- package/src/skeleton/context.ts +0 -11
- package/src/skeleton/index.ts +0 -8
- package/src/skeleton/meta.ts +0 -65
- package/src/slider/Slider.a11y.test.ts +0 -44
- package/src/slider/Slider.kbd.test.ts +0 -74
- package/src/slider/Slider.svelte +0 -716
- package/src/slider/SliderKbdFixture.svelte +0 -21
- package/src/slider/index.ts +0 -2
- package/src/slider/meta.ts +0 -55
- package/src/space/Space.a11y.test.ts +0 -22
- package/src/space/Space.svelte +0 -109
- package/src/space/SpaceA11yFixture.svelte +0 -17
- package/src/space/index.ts +0 -2
- package/src/space/meta.ts +0 -27
- package/src/spin/Spin.a11y.test.ts +0 -29
- package/src/spin/Spin.svelte +0 -293
- package/src/spin/SpinA11yFixture.svelte +0 -18
- package/src/spin/index.ts +0 -2
- package/src/spin/meta.ts +0 -72
- package/src/steps/Steps.a11y.test.ts +0 -39
- package/src/steps/Steps.kbd.test.ts +0 -73
- package/src/steps/Steps.svelte +0 -392
- package/src/steps/StepsKbdFixture.svelte +0 -21
- package/src/steps/index.ts +0 -3
- package/src/steps/meta.ts +0 -59
- package/src/steps/types.ts +0 -8
- package/src/switch/Switch.a11y.test.ts +0 -46
- package/src/switch/Switch.kbd.test.ts +0 -40
- package/src/switch/Switch.svelte +0 -310
- package/src/switch/SwitchKbdFixture.svelte +0 -22
- package/src/switch/index.ts +0 -2
- package/src/switch/meta.ts +0 -44
- package/src/table/Table.a11y.test.ts +0 -70
- package/src/table/Table.bench.ts +0 -51
- package/src/table/Table.kbd.test.ts +0 -94
- package/src/table/Table.svelte +0 -2327
- package/src/table/TableKbdFixture.svelte +0 -35
- package/src/table/grid-nav.test.ts +0 -173
- package/src/table/grid-nav.ts +0 -146
- package/src/table/index.ts +0 -13
- package/src/table/meta.ts +0 -121
- package/src/table/types.ts +0 -133
- package/src/tabs/TabPane.svelte +0 -92
- package/src/tabs/Tabs.a11y.test.ts +0 -47
- package/src/tabs/Tabs.kbd.test.ts +0 -74
- package/src/tabs/Tabs.svelte +0 -1128
- package/src/tabs/TabsA11yFixture.svelte +0 -20
- package/src/tabs/TabsKbdFixture.svelte +0 -25
- package/src/tabs/context.ts +0 -43
- package/src/tabs/index.ts +0 -14
- package/src/tabs/meta.ts +0 -152
- package/src/tabs/types.ts +0 -6
- package/src/tag/Tag.a11y.test.ts +0 -33
- package/src/tag/Tag.svelte +0 -366
- package/src/tag/TagA11yFixture.svelte +0 -18
- package/src/tag/index.ts +0 -2
- package/src/tag/meta.ts +0 -92
- package/src/tag-input/TagInput.a11y.test.ts +0 -41
- package/src/tag-input/TagInput.svelte +0 -544
- package/src/tag-input/index.ts +0 -2
- package/src/tag-input/meta.ts +0 -43
- package/src/tag-input/reorder.test.ts +0 -59
- package/src/tag-input/reorder.ts +0 -41
- package/src/test-utils/LocaleHarness.svelte +0 -29
- package/src/test-utils/a11y.ts +0 -108
- package/src/test-utils/kbd.ts +0 -52
- package/src/textarea/TextArea.a11y.test.ts +0 -44
- package/src/textarea/TextArea.svelte +0 -420
- package/src/textarea/index.ts +0 -2
- package/src/textarea/meta.ts +0 -104
- package/src/time-picker/TimePicker.a11y.test.ts +0 -45
- package/src/time-picker/TimePicker.kbd.test.ts +0 -70
- package/src/time-picker/TimePicker.svelte +0 -1023
- package/src/time-picker/TimePickerKbdFixture.svelte +0 -23
- package/src/time-picker/index.ts +0 -2
- package/src/time-picker/meta.ts +0 -64
- package/src/timeline/Timeline.a11y.test.ts +0 -54
- package/src/timeline/Timeline.svelte +0 -599
- package/src/timeline/TimelineItem.svelte +0 -164
- package/src/timeline/context.ts +0 -28
- package/src/timeline/index.ts +0 -16
- package/src/timeline/meta.ts +0 -129
- package/src/timeline/types.ts +0 -9
- package/src/toast/Toast.a11y.test.ts +0 -67
- package/src/toast/ToastContainer.svelte +0 -184
- package/src/toast/ToastItem.svelte +0 -247
- package/src/toast/index.ts +0 -9
- package/src/toast/live-region.ts +0 -78
- package/src/toast/meta.ts +0 -95
- package/src/toast/store.ts +0 -187
- package/src/tooltip/Tooltip.a11y.test.ts +0 -41
- package/src/tooltip/Tooltip.kbd.test.ts +0 -37
- package/src/tooltip/Tooltip.svelte +0 -416
- package/src/tooltip/TooltipA11yFixture.svelte +0 -31
- package/src/tooltip/TooltipKbdFixture.svelte +0 -16
- package/src/tooltip/index.ts +0 -2
- package/src/tooltip/meta.ts +0 -59
- package/src/tooltip/placement.ts +0 -6
- package/src/transfer/Transfer.a11y.test.ts +0 -63
- package/src/transfer/Transfer.kbd.test.ts +0 -75
- package/src/transfer/Transfer.svelte +0 -1451
- package/src/transfer/TransferKbdFixture.svelte +0 -23
- package/src/transfer/group.test.ts +0 -55
- package/src/transfer/group.ts +0 -61
- package/src/transfer/index.ts +0 -3
- package/src/transfer/meta.ts +0 -55
- package/src/transfer/reorder.test.ts +0 -52
- package/src/transfer/reorder.ts +0 -42
- package/src/transfer/tree.test.ts +0 -44
- package/src/transfer/tree.ts +0 -52
- package/src/transfer/types.ts +0 -32
- package/src/tree/Tree.a11y.test.ts +0 -63
- package/src/tree/Tree.kbd.test.ts +0 -91
- package/src/tree/Tree.svelte +0 -1500
- package/src/tree/TreeKbdFixture.svelte +0 -30
- package/src/tree/index.ts +0 -3
- package/src/tree/meta.ts +0 -152
- package/src/tree-select/TreeSelect.a11y.test.ts +0 -52
- package/src/tree-select/TreeSelect.kbd.test.ts +0 -53
- package/src/tree-select/TreeSelect.svelte +0 -1611
- package/src/tree-select/TreeSelectKbdFixture.svelte +0 -20
- package/src/tree-select/index.ts +0 -3
- package/src/tree-select/meta.ts +0 -73
- package/src/tree-select/types.ts +0 -11
- package/src/tree-select/virtual.test.ts +0 -104
- package/src/typography/Link.svelte +0 -120
- package/src/typography/Paragraph.svelte +0 -92
- package/src/typography/Text.svelte +0 -93
- package/src/typography/Title.svelte +0 -91
- package/src/typography/Typography.a11y.test.ts +0 -34
- package/src/typography/TypographyA11yFixture.svelte +0 -27
- package/src/typography/TypographyBase.svelte +0 -807
- package/src/typography/index.ts +0 -16
- package/src/typography/meta.ts +0 -158
- package/src/upload/Upload.a11y.test.ts +0 -58
- package/src/upload/Upload.svelte +0 -1094
- package/src/upload/UploadA11yFixture.svelte +0 -23
- package/src/upload/index.ts +0 -3
- package/src/upload/meta.ts +0 -64
- package/src/upload/types.ts +0 -16
- package/src/virtual-list/VirtualList.svelte +0 -401
- package/src/virtual-list/index.ts +0 -2
- package/src/virtual-list/meta.ts +0 -106
package/src/modal/meta.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Machine-readable component metadata for AI/docs consumption.
|
|
3
|
-
* Modal — see specs/components/feedback/Modal.spec.md
|
|
4
|
-
*/
|
|
5
|
-
export const meta = {
|
|
6
|
-
name: 'Modal',
|
|
7
|
-
category: 'feedback',
|
|
8
|
-
description:
|
|
9
|
-
'模态对话框:fixed 遮罩 + 面板,portal 到 body(或 getContainer)脱离父层叠上下文,role=dialog aria-modal;useFocusTrap 焦点捕获与归还、Esc/遮罩点击关闭(受 keyboard/maskClosable 控制)、useScrollLock 锁背景滚动;头/体/尾结构,ok/cancel 默认按钮可换自定义尾部,danger okType;reduced-motion 关闭过渡。受控 open 不回写,仅 onOpenChange/onCancel 通知。destroyOnClose 关闭即卸载内容、重开重建(默认 false 保留 DOM)。draggable 按住标题栏拖动面板(偏移派生 transform 叠加定位,重开重置,pointer 事件绑 window)。堆叠 z-index 由模块级计数器分配(声明式与命令式共享,后开者在上、关闭回收)。命令式工厂 Modal.confirm/info/success/warning/error(亦可解构 modal):mount 到 body 临时 host、async onOk 自动 loading、返回 { destroy, update }。',
|
|
10
|
-
exports: ['Modal', 'modal'],
|
|
11
|
-
props: [
|
|
12
|
-
{ name: 'open', type: 'boolean', default: 'undefined', desc: '受控显隐;受控时不回写' },
|
|
13
|
-
{ name: 'title', type: 'string', default: 'undefined', desc: '标题文案' },
|
|
14
|
-
{
|
|
15
|
-
name: 'titleSnippet',
|
|
16
|
-
type: 'Snippet',
|
|
17
|
-
default: 'undefined',
|
|
18
|
-
desc: '自定义标题,覆盖 title',
|
|
19
|
-
},
|
|
20
|
-
{ name: 'width', type: 'number|string', default: '448', desc: '面板宽度' },
|
|
21
|
-
{ name: 'centered', type: 'boolean', default: 'false', desc: '垂直居中(否则距顶)' },
|
|
22
|
-
{ name: 'closable', type: 'boolean', default: 'true', desc: '右上角关闭按钮' },
|
|
23
|
-
{ name: 'maskClosable', type: 'boolean', default: 'true', desc: '点遮罩关闭' },
|
|
24
|
-
{ name: 'keyboard', type: 'boolean', default: 'true', desc: 'Esc 关闭' },
|
|
25
|
-
{
|
|
26
|
-
name: 'draggable',
|
|
27
|
-
type: 'boolean',
|
|
28
|
-
default: 'false',
|
|
29
|
-
desc: '按住标题栏拖动面板(偏移叠加在定位上,重开重置);鼠标增强不影响键盘/焦点',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'confirmLoading',
|
|
33
|
-
type: 'boolean',
|
|
34
|
-
default: 'false',
|
|
35
|
-
desc: '确认按钮 loading 态',
|
|
36
|
-
},
|
|
37
|
-
{ name: 'okText', type: 'string', default: "'确定'" },
|
|
38
|
-
{ name: 'cancelText', type: 'string', default: "'取消'" },
|
|
39
|
-
{ name: 'okType', type: "'primary'|'danger'", default: "'primary'", desc: '确认按钮类型' },
|
|
40
|
-
{
|
|
41
|
-
name: 'destroyOnClose',
|
|
42
|
-
type: 'boolean',
|
|
43
|
-
default: 'false',
|
|
44
|
-
desc: '关闭即卸载内部内容({#if} 卸载),重开重建;默认保留 DOM 仅隐藏',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'getContainer',
|
|
48
|
-
type: '() => HTMLElement | null',
|
|
49
|
-
default: 'undefined',
|
|
50
|
-
desc: 'Portal 容器,缺省 document.body',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'footer',
|
|
54
|
-
type: 'Snippet<[{ ok; cancel }]>|null',
|
|
55
|
-
default: 'undefined',
|
|
56
|
-
desc: 'null 隐藏默认按钮;snippet 自定义尾部',
|
|
57
|
-
},
|
|
58
|
-
{ name: 'children', type: 'Snippet', default: 'undefined', desc: '内容主体' },
|
|
59
|
-
{ name: 'ariaLabel', type: 'string', default: 'undefined', desc: '无 title 时的 aria-label' },
|
|
60
|
-
{ name: 'onOk', type: '() => void', default: 'undefined' },
|
|
61
|
-
{ name: 'onCancel', type: '() => void', default: 'undefined' },
|
|
62
|
-
{ name: 'onOpenChange', type: '(open: boolean) => void', default: 'undefined' },
|
|
63
|
-
{ name: 'onAfterClose', type: '() => void', default: 'undefined', desc: '关闭过渡结束触发' },
|
|
64
|
-
{
|
|
65
|
-
name: 'okButtonProps',
|
|
66
|
-
type: 'Record<string, unknown>',
|
|
67
|
-
default: 'undefined',
|
|
68
|
-
desc: '透传给确定按钮的额外 props(如 disabled、size 等)',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'cancelButtonProps',
|
|
72
|
-
type: 'Record<string, unknown>',
|
|
73
|
-
default: 'undefined',
|
|
74
|
-
desc: '透传给取消按钮的额外 props',
|
|
75
|
-
},
|
|
76
|
-
{ name: 'hasCancel', type: 'boolean', default: 'true', desc: '是否显示取消按钮' },
|
|
77
|
-
{
|
|
78
|
-
name: 'size',
|
|
79
|
-
type: "'small'|'medium'|'large'|'full-width'",
|
|
80
|
-
default: 'undefined',
|
|
81
|
-
desc: '预设宽度枚举(small=480px, medium=600px, large=800px, full-width=100vw),优先级低于 width',
|
|
82
|
-
},
|
|
83
|
-
{ name: 'fullScreen', type: 'boolean', default: 'false', desc: '全屏模式' },
|
|
84
|
-
{
|
|
85
|
-
name: 'keepDOM',
|
|
86
|
-
type: 'boolean',
|
|
87
|
-
default: 'false',
|
|
88
|
-
desc: '关闭时保留 DOM(display:none 隐藏),与 destroyOnClose 反义',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'lazyRender',
|
|
92
|
-
type: 'boolean',
|
|
93
|
-
default: 'true',
|
|
94
|
-
desc: '配合 keepDOM 的懒挂载:true 时首次打开前不渲染内容',
|
|
95
|
-
},
|
|
96
|
-
{ name: 'bodyStyle', type: 'string', default: 'undefined', desc: '内容区内联 style 字符串' },
|
|
97
|
-
{ name: 'maskStyle', type: 'string', default: 'undefined', desc: '遮罩层内联 style 字符串' },
|
|
98
|
-
{ name: 'height', type: 'number|string', default: 'undefined', desc: 'Modal 高度' },
|
|
99
|
-
{ name: 'footerFill', type: 'boolean', default: 'false', desc: '底部按钮撑满宽度' },
|
|
100
|
-
{
|
|
101
|
-
name: 'modalContentClass',
|
|
102
|
-
type: 'string',
|
|
103
|
-
default: 'undefined',
|
|
104
|
-
desc: '内容区域额外 class',
|
|
105
|
-
},
|
|
106
|
-
{ name: 'closeIcon', type: 'Snippet', default: 'undefined', desc: '自定义关闭图标' },
|
|
107
|
-
{ name: 'mask', type: 'boolean', default: 'true', desc: '是否显示遮罩' },
|
|
108
|
-
],
|
|
109
|
-
events: [
|
|
110
|
-
{ name: 'onOk', desc: '确认按钮点击(非受控自动关闭)' },
|
|
111
|
-
{ name: 'onCancel', desc: '取消/关闭按钮/遮罩/Esc 关闭' },
|
|
112
|
-
{ name: 'onOpenChange', desc: '显隐变化通知' },
|
|
113
|
-
{ name: 'onAfterClose', desc: '关闭过渡结束' },
|
|
114
|
-
],
|
|
115
|
-
slots: [
|
|
116
|
-
{ name: 'children', desc: '内容主体' },
|
|
117
|
-
{ name: 'titleSnippet', desc: '自定义标题' },
|
|
118
|
-
{ name: 'footer', desc: '自定义尾部(接收 { ok, cancel })' },
|
|
119
|
-
{ name: 'closeIcon', desc: '自定义关闭图标' },
|
|
120
|
-
],
|
|
121
|
-
a11y: {
|
|
122
|
-
hasRole: true,
|
|
123
|
-
focusable: true,
|
|
124
|
-
note: 'role=dialog + aria-modal=true;有 title 用 aria-labelledby,无则 aria-label;useFocusTrap 捕获 Tab 焦点并在关闭时归还触发元素;Esc 关闭受 keyboard 控制;useScrollLock 锁背景滚动;关闭按钮 aria-label「关闭」。',
|
|
125
|
-
},
|
|
126
|
-
tokens: [
|
|
127
|
-
'--cd-modal-radius',
|
|
128
|
-
'--cd-modal-bg',
|
|
129
|
-
'--cd-modal-shadow',
|
|
130
|
-
'--cd-modal-mask-bg',
|
|
131
|
-
'--cd-modal-padding',
|
|
132
|
-
'--cd-modal-header-gap',
|
|
133
|
-
'--cd-modal-footer-gap',
|
|
134
|
-
'--cd-modal-title-color',
|
|
135
|
-
'--cd-modal-title-size',
|
|
136
|
-
'--cd-modal-body-color',
|
|
137
|
-
'--cd-modal-close-color',
|
|
138
|
-
'--cd-modal-close-hover-bg',
|
|
139
|
-
'--cd-modal-z',
|
|
140
|
-
'--cd-modal-motion-duration',
|
|
141
|
-
],
|
|
142
|
-
responsive: false,
|
|
143
|
-
examples: [
|
|
144
|
-
{
|
|
145
|
-
title: '基础确认框',
|
|
146
|
-
code: '<Modal open={visible} title="提示" onOk={() => (visible = false)} onCancel={() => (visible = false)}>确认操作?</Modal>',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
title: '自定义尾部',
|
|
150
|
-
code: '<Modal open={visible} title="标题">\n 内容\n {#snippet footer({ cancel })}<Button onclick={cancel}>知道了</Button>{/snippet}\n</Modal>',
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
title: 'danger 确认',
|
|
154
|
-
code: '<Modal open={visible} title="删除" okType="danger" okText="删除" onOk={remove}>不可恢复,确定删除?</Modal>',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
title: '命令式确认(异步 onOk 自动 loading)',
|
|
158
|
-
code: "Modal.confirm({ title: '确认操作', content: '确定执行?', onOk: () => fetch('/api/do') });",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
title: 'destroyOnClose 重开重建',
|
|
162
|
-
code: '<Modal open={visible} title="表单" destroyOnClose>...每次重开重置内部状态...</Modal>',
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
} as const;
|
package/src/modal/z-stack.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 模块级 z-index 堆叠管理:多个 Modal(声明式 <Modal> + 命令式 modal.confirm)
|
|
3
|
-
* 共享同一计数器,后开者在上;关闭时回收,避免无限增长。
|
|
4
|
-
* 用递增整数(不用 Math.random/Date.now,红线 #3)。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// 与 --cd-modal-z token 基线一致;每开一个 +10,给遮罩/面板留间隙。
|
|
8
|
-
const Z_BASE = 1000;
|
|
9
|
-
const STEP = 10;
|
|
10
|
-
|
|
11
|
-
let counter = 0;
|
|
12
|
-
|
|
13
|
-
/** 申请一个堆叠层级,返回 z-index 与回收函数。回收幂等。 */
|
|
14
|
-
export function acquireZIndex(): { zIndex: number; release: () => void } {
|
|
15
|
-
counter += 1;
|
|
16
|
-
const zIndex = Z_BASE + counter * STEP;
|
|
17
|
-
let released = false;
|
|
18
|
-
return {
|
|
19
|
-
zIndex,
|
|
20
|
-
release() {
|
|
21
|
-
if (released) return;
|
|
22
|
-
released = true;
|
|
23
|
-
counter = Math.max(0, counter - 1);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
NotificationContainer — 单例容器,订阅 store 渲染全部通知。
|
|
3
|
-
由 store.ts 惰性 mount 到 body(或 getPopupContainer)下的宿主节点;仅此一个实例。
|
|
4
|
-
按 6 placement(topLeft/top/topRight/bottomLeft/bottom/bottomRight)分组渲染独立堆叠列。
|
|
5
|
-
RTL:item.direction==='rtl' 时左右方位互换(topRight→topLeft 视觉镜像),堆叠列写 dir=rtl
|
|
6
|
-
令卡片整体镜像(关闭按钮、图标、文案方向、内边距均经逻辑属性自动翻转);进出场水平偏移随之取反。
|
|
7
|
-
Esc 关闭(红线 #3):$effect 命令式挂 window keydown,按 Esc 关闭最近一条通知;cleanup 移除监听。
|
|
8
|
-
进出场用 svelte/transition fly(运行时驱动,退场后 DOM 正常卸载,不卡 from 帧);
|
|
9
|
-
重排用 animate:flip。reduced-motion 时 fly duration 降为 0。
|
|
10
|
-
红线:render 不读 effect 写的状态——items 初始同步读一次(拿到惰性挂载前已入队的首条),
|
|
11
|
-
$effect 仅做订阅 + cleanup 退订 / keydown 监听 + cleanup。
|
|
12
|
-
-->
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import { fly } from 'svelte/transition';
|
|
15
|
-
import { flip } from 'svelte/animate';
|
|
16
|
-
import { prefersReducedMotion } from 'svelte/motion';
|
|
17
|
-
import type {
|
|
18
|
-
NotificationStore,
|
|
19
|
-
NotificationItem,
|
|
20
|
-
NotificationPlacement,
|
|
21
|
-
} from '@chenzy-design/core';
|
|
22
|
-
import NotificationItemView from './NotificationItem.svelte';
|
|
23
|
-
import { onCloseClickMap } from './store.js';
|
|
24
|
-
|
|
25
|
-
interface Props {
|
|
26
|
-
store: NotificationStore;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let { store }: Props = $props();
|
|
30
|
-
|
|
31
|
-
// 初始同步读一次:捕获惰性挂载前已入队的首条通知。
|
|
32
|
-
// 用函数包裹读取,避免 state 初始化器直接引用 prop 触发 state_referenced_locally。
|
|
33
|
-
// core 的 subscribe 不会立即回放当前值,因此必须在此先读一次。
|
|
34
|
-
function readInitial(): NotificationItem[] {
|
|
35
|
-
return store.getItems();
|
|
36
|
-
}
|
|
37
|
-
let items = $state<NotificationItem[]>(readInitial());
|
|
38
|
-
|
|
39
|
-
// 桥接外部(非 Svelte runes)store:订阅写入本地 state,cleanup 退订。
|
|
40
|
-
// 这是 store->state 的单向桥,无法用 $derived 表达(外部 store 非响应式源)。
|
|
41
|
-
$effect(() => {
|
|
42
|
-
const unsub = store.subscribe((v) => {
|
|
43
|
-
items = v;
|
|
44
|
-
});
|
|
45
|
-
return unsub;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Esc 关闭(红线 #3):命令式挂 window keydown,关闭最近一条(最后入队)通知;cleanup 移除。
|
|
49
|
-
// 直接读 store.getItems()(快照),不读 effect 写的 items state,避免 effect 自依赖重订阅。
|
|
50
|
-
$effect(() => {
|
|
51
|
-
function onKeydown(e: KeyboardEvent): void {
|
|
52
|
-
if (e.key !== 'Escape') return;
|
|
53
|
-
const current = store.getItems();
|
|
54
|
-
const last = current[current.length - 1];
|
|
55
|
-
if (last) store.close(last.id, 'manual');
|
|
56
|
-
}
|
|
57
|
-
window.addEventListener('keydown', onKeydown);
|
|
58
|
-
return () => window.removeEventListener('keydown', onKeydown);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const placements: NotificationPlacement[] = [
|
|
62
|
-
'topLeft',
|
|
63
|
-
'top',
|
|
64
|
-
'topRight',
|
|
65
|
-
'bottomLeft',
|
|
66
|
-
'bottom',
|
|
67
|
-
'bottomRight',
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
// RTL 方位镜像:rtl 通知的左右方位视觉互换(topRight→topLeft 等),居中不变。
|
|
71
|
-
const RTL_SWAP: Record<NotificationPlacement, NotificationPlacement> = {
|
|
72
|
-
topLeft: 'topRight',
|
|
73
|
-
topRight: 'topLeft',
|
|
74
|
-
bottomLeft: 'bottomRight',
|
|
75
|
-
bottomRight: 'bottomLeft',
|
|
76
|
-
top: 'top',
|
|
77
|
-
bottom: 'bottom',
|
|
78
|
-
};
|
|
79
|
-
function effectivePlacement(item: NotificationItem): NotificationPlacement {
|
|
80
|
-
return item.direction === 'rtl' ? RTL_SWAP[item.placement] : item.placement;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const flyDuration = $derived(prefersReducedMotion.current ? 0 : 220);
|
|
84
|
-
const flipDuration = $derived(prefersReducedMotion.current ? 0 : 200);
|
|
85
|
-
|
|
86
|
-
const grouped = $derived(
|
|
87
|
-
placements.map((p) => ({
|
|
88
|
-
placement: p,
|
|
89
|
-
items: items.filter((i) => effectivePlacement(i) === p),
|
|
90
|
-
})),
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
// 每个方位的进出场水平/垂直偏移:左侧从左滑入、右侧从右滑入、居中走垂直。
|
|
94
|
-
function flyParams(placement: NotificationPlacement): { x: number; y: number } {
|
|
95
|
-
if (placement === 'topLeft' || placement === 'bottomLeft') return { x: -24, y: 0 };
|
|
96
|
-
if (placement === 'topRight' || placement === 'bottomRight') return { x: 24, y: 0 };
|
|
97
|
-
return { x: 0, y: placement === 'top' ? -16 : 16 };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function handleClose(id: string) {
|
|
101
|
-
store.close(id, 'manual');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function handleCloseClick(id: string) {
|
|
105
|
-
onCloseClickMap.get(id)?.(id);
|
|
106
|
-
store.close(id, 'manual');
|
|
107
|
-
}
|
|
108
|
-
function handlePause(id: string) {
|
|
109
|
-
store.pause(id);
|
|
110
|
-
}
|
|
111
|
-
function handleResume(id: string) {
|
|
112
|
-
store.resume(id);
|
|
113
|
-
}
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
|
-
{#each grouped as group (group.placement)}
|
|
117
|
-
{#if group.items.length > 0}
|
|
118
|
-
<div class="cd-notification-stack cd-notification-stack--{group.placement}">
|
|
119
|
-
{#each group.items as item (item.id)}
|
|
120
|
-
<div
|
|
121
|
-
class="cd-notification-stack__item"
|
|
122
|
-
dir={item.direction}
|
|
123
|
-
in:fly={{ ...flyParams(group.placement), duration: flyDuration }}
|
|
124
|
-
out:fly={{ ...flyParams(group.placement), duration: flyDuration }}
|
|
125
|
-
animate:flip={{ duration: flipDuration }}
|
|
126
|
-
>
|
|
127
|
-
<NotificationItemView
|
|
128
|
-
{item}
|
|
129
|
-
onClose={handleClose}
|
|
130
|
-
onCloseClick={handleCloseClick}
|
|
131
|
-
onPause={handlePause}
|
|
132
|
-
onResume={handleResume}
|
|
133
|
-
/>
|
|
134
|
-
</div>
|
|
135
|
-
{/each}
|
|
136
|
-
</div>
|
|
137
|
-
{/if}
|
|
138
|
-
{/each}
|
|
139
|
-
|
|
140
|
-
<style>
|
|
141
|
-
.cd-notification-stack {
|
|
142
|
-
position: fixed;
|
|
143
|
-
z-index: var(--cd-notification-z);
|
|
144
|
-
display: flex;
|
|
145
|
-
flex-direction: column;
|
|
146
|
-
gap: var(--cd-notification-gap);
|
|
147
|
-
inline-size: max-content;
|
|
148
|
-
max-inline-size: calc(100vw - 2 * var(--cd-notification-offset));
|
|
149
|
-
pointer-events: none;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.cd-notification-stack--topLeft {
|
|
153
|
-
top: var(--cd-notification-offset);
|
|
154
|
-
left: var(--cd-notification-offset);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.cd-notification-stack--top {
|
|
158
|
-
top: var(--cd-notification-offset);
|
|
159
|
-
left: 50%;
|
|
160
|
-
transform: translateX(-50%);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.cd-notification-stack--topRight {
|
|
164
|
-
top: var(--cd-notification-offset);
|
|
165
|
-
right: var(--cd-notification-offset);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.cd-notification-stack--bottomLeft {
|
|
169
|
-
bottom: var(--cd-notification-offset);
|
|
170
|
-
left: var(--cd-notification-offset);
|
|
171
|
-
flex-direction: column-reverse;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.cd-notification-stack--bottom {
|
|
175
|
-
bottom: var(--cd-notification-offset);
|
|
176
|
-
left: 50%;
|
|
177
|
-
transform: translateX(-50%);
|
|
178
|
-
flex-direction: column-reverse;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.cd-notification-stack--bottomRight {
|
|
182
|
-
bottom: var(--cd-notification-offset);
|
|
183
|
-
right: var(--cd-notification-offset);
|
|
184
|
-
flex-direction: column-reverse;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.cd-notification-stack__item {
|
|
188
|
-
inline-size: auto;
|
|
189
|
-
max-inline-size: 100%;
|
|
190
|
-
pointer-events: none;
|
|
191
|
-
}
|
|
192
|
-
</style>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Notification a11y:命令式单例 API(notification.open)经惰性挂载容器渲染。
|
|
2
|
-
// 这里直接渲染纯展示的 NotificationItem(接收一个完整 item),断言静态 ARIA:
|
|
3
|
-
// - error/warning → role=alert + aria-live=assertive;其余 → role=status + aria-live=polite。
|
|
4
|
-
// - title/content 经 useId 关联 aria-labelledby / aria-describedby。
|
|
5
|
-
// - 视觉隐藏类型前缀(如「Error:」)令屏幕阅读器先播报极性语义。
|
|
6
|
-
// jsdom 只断言静态 ARIA + axe(定时器 / hover 暂停留给真实浏览器)。
|
|
7
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
-
import type { Component } from 'svelte';
|
|
9
|
-
import { renderWithLocale, expectNoAxeViolations } from '../test-utils/a11y.js';
|
|
10
|
-
import NotificationItemRaw from './NotificationItem.svelte';
|
|
11
|
-
import type { NotificationItem as NotificationItemData } from '@chenzy-design/core';
|
|
12
|
-
|
|
13
|
-
// NotificationItem 有必填 props(item/onClose/...);测试帮手用宽松 Record 构造器签名,
|
|
14
|
-
// 故在此把组件转为宽松类型(props 实际值在调用处提供,运行时安全)。
|
|
15
|
-
const NotificationItem = NotificationItemRaw as unknown as Component<Record<string, unknown>>;
|
|
16
|
-
|
|
17
|
-
const noop = () => {};
|
|
18
|
-
|
|
19
|
-
function makeItem(overrides: Partial<NotificationItemData> = {}): NotificationItemData {
|
|
20
|
-
return {
|
|
21
|
-
id: 'n1',
|
|
22
|
-
title: 'Saved',
|
|
23
|
-
content: 'Your changes were saved.',
|
|
24
|
-
type: 'success',
|
|
25
|
-
duration: 4.5,
|
|
26
|
-
placement: 'topRight',
|
|
27
|
-
closable: true,
|
|
28
|
-
pauseOnHover: true,
|
|
29
|
-
showProgress: false,
|
|
30
|
-
theme: 'light',
|
|
31
|
-
direction: 'ltr',
|
|
32
|
-
footer: undefined,
|
|
33
|
-
onClose: undefined,
|
|
34
|
-
...overrides,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
describe('Notification a11y', () => {
|
|
39
|
-
it('success:role=status + aria-live=polite + aria-labelledby/describedby,无 axe violations', async () => {
|
|
40
|
-
const { container } = renderWithLocale(NotificationItem, {
|
|
41
|
-
props: { item: makeItem(), onClose: noop, onPause: noop, onResume: noop },
|
|
42
|
-
});
|
|
43
|
-
const card = container.querySelector('.cd-notification-item');
|
|
44
|
-
expect(card?.getAttribute('role')).toBe('status');
|
|
45
|
-
expect(card?.getAttribute('aria-live')).toBe('polite');
|
|
46
|
-
const labelledby = card?.getAttribute('aria-labelledby');
|
|
47
|
-
const describedby = card?.getAttribute('aria-describedby');
|
|
48
|
-
expect(labelledby ? container.querySelector(`#${labelledby}`)?.textContent : '').toContain('Saved');
|
|
49
|
-
expect(
|
|
50
|
-
describedby ? container.querySelector(`#${describedby}`)?.textContent : '',
|
|
51
|
-
).toContain('changes');
|
|
52
|
-
// 关闭按钮可访问名来自 locale。
|
|
53
|
-
expect(container.querySelector('.cd-notification-item__close')?.getAttribute('aria-label')).toBeTruthy();
|
|
54
|
-
await expectNoAxeViolations(container);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('error:role=alert + aria-live=assertive + 视觉隐藏类型前缀,无 axe violations', async () => {
|
|
58
|
-
const { container } = renderWithLocale(NotificationItem, {
|
|
59
|
-
props: {
|
|
60
|
-
item: makeItem({ type: 'error', title: 'Upload failed', content: 'Try again.' }),
|
|
61
|
-
onClose: noop,
|
|
62
|
-
onPause: noop,
|
|
63
|
-
onResume: noop,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
const card = container.querySelector('.cd-notification-item');
|
|
67
|
-
expect(card?.getAttribute('role')).toBe('alert');
|
|
68
|
-
expect(card?.getAttribute('aria-live')).toBe('assertive');
|
|
69
|
-
// 类型前缀(如「Error:」)以视觉隐藏文本注入,非空。
|
|
70
|
-
expect(container.querySelector('.cd-sr-only')?.textContent?.trim()).toBeTruthy();
|
|
71
|
-
await expectNoAxeViolations(container);
|
|
72
|
-
});
|
|
73
|
-
});
|