@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
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Switch a11y:原生 role="switch" 按钮,受控/非受控。
|
|
2
|
-
// 只断言静态 ARIA(role/aria-checked/aria-disabled)+ axe 0 violations,
|
|
3
|
-
// 不测真实键盘/焦点(jsdom 限制,见 test-utils/a11y.ts 说明)。
|
|
4
|
-
import { describe, it, expect } from 'vitest';
|
|
5
|
-
import { renderWithLocale, expectNoAxeViolations } from '../test-utils/a11y.js';
|
|
6
|
-
import Switch from './Switch.svelte';
|
|
7
|
-
|
|
8
|
-
describe('Switch a11y', () => {
|
|
9
|
-
it('默认:role=switch / aria-checked=false / ariaLabel 提供可访问名,无 axe violations', async () => {
|
|
10
|
-
const { container } = renderWithLocale(Switch, {
|
|
11
|
-
props: { ariaLabel: 'Dark mode' },
|
|
12
|
-
});
|
|
13
|
-
const sw = container.querySelector('[role="switch"]');
|
|
14
|
-
expect(sw).not.toBeNull();
|
|
15
|
-
expect(sw?.getAttribute('aria-checked')).toBe('false');
|
|
16
|
-
expect(sw?.getAttribute('aria-label')).toBe('Dark mode');
|
|
17
|
-
await expectNoAxeViolations(container);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('选中:value=true → aria-checked=true', async () => {
|
|
21
|
-
const { container } = renderWithLocale(Switch, {
|
|
22
|
-
props: { ariaLabel: 'Wifi', value: true },
|
|
23
|
-
});
|
|
24
|
-
const sw = container.querySelector('[role="switch"]');
|
|
25
|
-
expect(sw?.getAttribute('aria-checked')).toBe('true');
|
|
26
|
-
await expectNoAxeViolations(container);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('禁用:disabled,无 axe violations', async () => {
|
|
30
|
-
const { container } = renderWithLocale(Switch, {
|
|
31
|
-
props: { ariaLabel: 'Bluetooth', disabled: true },
|
|
32
|
-
});
|
|
33
|
-
const sw = container.querySelector('[role="switch"]');
|
|
34
|
-
expect(sw).not.toBeNull();
|
|
35
|
-
await expectNoAxeViolations(container);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('loading:aria-busy=true', async () => {
|
|
39
|
-
const { container } = renderWithLocale(Switch, {
|
|
40
|
-
props: { ariaLabel: 'Sync', loading: true },
|
|
41
|
-
});
|
|
42
|
-
const sw = container.querySelector('[role="switch"]');
|
|
43
|
-
expect(sw?.getAttribute('aria-busy')).toBe('true');
|
|
44
|
-
await expectNoAxeViolations(container);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Switch 键盘 e2e(browser project / 真实 chromium)。
|
|
2
|
-
// Switch 是原生 <button role="switch">,焦点落在按钮本身:Tab 聚焦、
|
|
3
|
-
// Space/Enter 经原生 click 触发 toggle,aria-checked 翻转。jsdom 下
|
|
4
|
-
// 原生按钮的 Space/Enter→click 合成不可靠,故在真浏览器里验真实键盘。
|
|
5
|
-
import { describe, it, expect } from 'vitest';
|
|
6
|
-
import { page } from 'vitest/browser';
|
|
7
|
-
import { renderKbdFixture, userEvent } from '../test-utils/kbd.js';
|
|
8
|
-
import SwitchKbdFixture from './SwitchKbdFixture.svelte';
|
|
9
|
-
|
|
10
|
-
function loc(el: Element) {
|
|
11
|
-
return page.elementLocator(el);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
describe('Switch 键盘 e2e(role=switch Space/Enter 切换)', () => {
|
|
15
|
-
it('Tab 聚焦 + Space/Enter 翻转 aria-checked', async () => {
|
|
16
|
-
const { baseElement } = renderKbdFixture(SwitchKbdFixture);
|
|
17
|
-
|
|
18
|
-
const sw = baseElement.querySelector('[role="switch"]') as HTMLElement;
|
|
19
|
-
expect(sw).not.toBeNull();
|
|
20
|
-
expect(sw.getAttribute('aria-checked')).toBe('false');
|
|
21
|
-
|
|
22
|
-
// Tab 从 before 进入,焦点落在 switch 按钮本身。
|
|
23
|
-
const before = baseElement.querySelector('[data-testid="before"]') as HTMLElement;
|
|
24
|
-
before.focus();
|
|
25
|
-
await expect.element(loc(before)).toHaveFocus();
|
|
26
|
-
await userEvent.tab();
|
|
27
|
-
await expect.element(loc(sw)).toHaveFocus();
|
|
28
|
-
|
|
29
|
-
// Space 切到 on(aria-checked=true,onChange 写入 true)。
|
|
30
|
-
await userEvent.keyboard(' ');
|
|
31
|
-
await expect.element(loc(sw)).toHaveAttribute('aria-checked', 'true');
|
|
32
|
-
const out = baseElement.querySelector('[data-testid="value"]') as HTMLElement;
|
|
33
|
-
expect(out.textContent).toBe(JSON.stringify(true));
|
|
34
|
-
|
|
35
|
-
// Enter 切回 off。
|
|
36
|
-
await userEvent.keyboard('{Enter}');
|
|
37
|
-
await expect.element(loc(sw)).toHaveAttribute('aria-checked', 'false');
|
|
38
|
-
expect(out.textContent).toBe(JSON.stringify(false));
|
|
39
|
-
});
|
|
40
|
-
});
|
package/src/switch/Switch.svelte
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Switch — see specs/components/input/Switch.spec.md
|
|
3
|
-
Native role="switch" button, controlled / uncontrolled.
|
|
4
|
-
|
|
5
|
-
⚠️ 死循环红线:
|
|
6
|
-
- 受控(value=/bind:value):父持有 value,仅经 onChange 上抛,绝不回写 prop(红线 #1)。
|
|
7
|
-
- 派生(on / nativeValue / cls / activeChildren)均为纯函数 $derived(红线 #2)。
|
|
8
|
-
- autofocus:$effect 内命令式 focus(),无 cleanup 必要(focus 一次性);
|
|
9
|
-
announceOnChange 的 live region 写入在事件回调(非 render 期),$effect 仅清空兜底(红线 #3)。
|
|
10
|
-
- checkedValue/uncheckedValue:开/关态映射到任意业务值,仅用于 onChange.nativeValue 与
|
|
11
|
-
隐藏 input 提交值;on 仍为 boolean,映射不回写。
|
|
12
|
-
-->
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import type { Snippet } from 'svelte';
|
|
15
|
-
import { useLocale } from '../locale-provider/index.js';
|
|
16
|
-
|
|
17
|
-
type Size = 'small' | 'default' | 'large';
|
|
18
|
-
type Status = 'default' | 'warning' | 'error';
|
|
19
|
-
type NativeValue = string | number | boolean;
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
value?: boolean;
|
|
23
|
-
defaultValue?: boolean;
|
|
24
|
-
/** 开态对应的实际值(onChange.nativeValue 与表单提交值)。 */
|
|
25
|
-
checkedValue?: NativeValue;
|
|
26
|
-
/** 关态对应的实际值。 */
|
|
27
|
-
uncheckedValue?: NativeValue;
|
|
28
|
-
size?: Size;
|
|
29
|
-
status?: Status;
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
loading?: boolean;
|
|
32
|
-
checkedChildren?: string | Snippet;
|
|
33
|
-
uncheckedChildren?: string | Snippet;
|
|
34
|
-
name?: string;
|
|
35
|
-
/** 表单必填校验(须为开态)。 */
|
|
36
|
-
required?: boolean;
|
|
37
|
-
ariaLabel?: string;
|
|
38
|
-
/** 关联外部可见文本(如 Label 组件)的 id,体现可访问名(优先于 ariaLabel)。 */
|
|
39
|
-
ariaLabelledby?: string;
|
|
40
|
-
/** 切换后是否用 live region 播报新状态(文案经 locale)。 */
|
|
41
|
-
announceOnChange?: boolean;
|
|
42
|
-
/** 挂载后自动聚焦。 */
|
|
43
|
-
autofocus?: boolean;
|
|
44
|
-
onChange?: (
|
|
45
|
-
v: boolean,
|
|
46
|
-
detail?: { value: boolean; nativeValue: NativeValue; event: Event },
|
|
47
|
-
) => void;
|
|
48
|
-
/** 获得焦点。 */
|
|
49
|
-
onFocus?: (event: FocusEvent) => void;
|
|
50
|
-
/** 失去焦点。 */
|
|
51
|
-
onBlur?: (event: FocusEvent) => void;
|
|
52
|
-
/** 键盘按下(可用于自定义快捷键扩展)。 */
|
|
53
|
-
onKeydown?: (event: KeyboardEvent) => void;
|
|
54
|
-
/** checked 时显示的文字(checkedChildren 的字符串别名) */
|
|
55
|
-
checkedText?: string;
|
|
56
|
-
/** unchecked 时显示的文字 */
|
|
57
|
-
uncheckedText?: string;
|
|
58
|
-
/** checked 时的 Snippet(checkedChildren 的 Snippet 别名) */
|
|
59
|
-
checkedContent?: Snippet;
|
|
60
|
-
/** unchecked 时的 Snippet */
|
|
61
|
-
uncheckedContent?: Snippet;
|
|
62
|
-
/** 鼠标进入 */
|
|
63
|
-
onMouseEnter?: (e: MouseEvent) => void;
|
|
64
|
-
/** 鼠标离开 */
|
|
65
|
-
onMouseLeave?: (e: MouseEvent) => void;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let {
|
|
69
|
-
value = $bindable(),
|
|
70
|
-
defaultValue = false,
|
|
71
|
-
checkedValue = true,
|
|
72
|
-
uncheckedValue = false,
|
|
73
|
-
size = 'default',
|
|
74
|
-
status = 'default',
|
|
75
|
-
disabled = false,
|
|
76
|
-
loading = false,
|
|
77
|
-
checkedChildren,
|
|
78
|
-
uncheckedChildren,
|
|
79
|
-
name,
|
|
80
|
-
required = false,
|
|
81
|
-
ariaLabel,
|
|
82
|
-
ariaLabelledby,
|
|
83
|
-
announceOnChange = false,
|
|
84
|
-
autofocus = false,
|
|
85
|
-
onChange,
|
|
86
|
-
onFocus,
|
|
87
|
-
onBlur,
|
|
88
|
-
onKeydown,
|
|
89
|
-
checkedText,
|
|
90
|
-
uncheckedText,
|
|
91
|
-
checkedContent,
|
|
92
|
-
uncheckedContent,
|
|
93
|
-
onMouseEnter,
|
|
94
|
-
onMouseLeave,
|
|
95
|
-
}: Props = $props();
|
|
96
|
-
|
|
97
|
-
const loc = useLocale();
|
|
98
|
-
|
|
99
|
-
const isControlled = $derived(value !== undefined);
|
|
100
|
-
let inner = $state(getInitialValue());
|
|
101
|
-
const on = $derived(isControlled ? !!value : inner);
|
|
102
|
-
|
|
103
|
-
function getInitialValue(): boolean {
|
|
104
|
-
return defaultValue;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const interactable = $derived(!disabled && !loading);
|
|
108
|
-
|
|
109
|
-
// 映射到业务值(红线 #2 纯派生):仅用于 onChange.nativeValue 与表单提交。
|
|
110
|
-
const nativeValue = $derived<NativeValue>(on ? checkedValue : uncheckedValue);
|
|
111
|
-
|
|
112
|
-
// 切换播报 live region(命令式写入,初始空;render 期只读 $state)。
|
|
113
|
-
let announceText = $state('');
|
|
114
|
-
|
|
115
|
-
let rootEl: HTMLButtonElement | undefined;
|
|
116
|
-
|
|
117
|
-
// autofocus:命令式聚焦一次(红线 #3,SSR 安全,$effect 仅 client)。
|
|
118
|
-
$effect(() => {
|
|
119
|
-
if (autofocus && rootEl && interactable) rootEl.focus();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
function announce(next: boolean) {
|
|
123
|
-
if (!announceOnChange) return;
|
|
124
|
-
announceText = '';
|
|
125
|
-
// 微任务后再写入,先清空再赋值,触发 AT 重新播报。
|
|
126
|
-
queueMicrotask(() => {
|
|
127
|
-
announceText = loc().t(next ? 'Switch.announceChecked' : 'Switch.announceUnchecked');
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function toggle(event: Event) {
|
|
132
|
-
if (!interactable) return;
|
|
133
|
-
const next = !on;
|
|
134
|
-
// Controlled (`value=` / `bind:value`): parent owns `value`; propagate only
|
|
135
|
-
// via `onChange`. Writing the prop AND firing `onChange` loops.
|
|
136
|
-
// Uncontrolled: keep our own state in sync.
|
|
137
|
-
if (!isControlled) inner = next;
|
|
138
|
-
const nv = next ? checkedValue : uncheckedValue;
|
|
139
|
-
onChange?.(next, { value: next, nativeValue: nv, event });
|
|
140
|
-
announce(next);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// checkedText / uncheckedText 是 checkedChildren / uncheckedChildren 的字符串别名;
|
|
144
|
-
// checkedContent / uncheckedContent 是 Snippet 别名。
|
|
145
|
-
// 优先级:checkedChildren > checkedContent > checkedText(同理 unchecked)。
|
|
146
|
-
const resolvedChecked = $derived<string | Snippet | undefined>(
|
|
147
|
-
checkedChildren ?? checkedContent ?? checkedText,
|
|
148
|
-
);
|
|
149
|
-
const resolvedUnchecked = $derived<string | Snippet | undefined>(
|
|
150
|
-
uncheckedChildren ?? uncheckedContent ?? uncheckedText,
|
|
151
|
-
);
|
|
152
|
-
const activeChildren = $derived(on ? resolvedChecked : resolvedUnchecked);
|
|
153
|
-
const isSnippet = (c: string | Snippet | undefined): c is Snippet => typeof c === 'function';
|
|
154
|
-
|
|
155
|
-
// 隐藏 input 提交值:boolean → 'true'/'false',其余按原值字符串化。
|
|
156
|
-
const submitValue = $derived(
|
|
157
|
-
typeof nativeValue === 'boolean' ? (nativeValue ? 'true' : 'false') : String(nativeValue),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
const cls = $derived(
|
|
161
|
-
['cd-switch', `cd-switch--${size}`, `cd-switch--${status}`, on && 'cd-switch--on']
|
|
162
|
-
.filter(Boolean)
|
|
163
|
-
.join(' '),
|
|
164
|
-
);
|
|
165
|
-
</script>
|
|
166
|
-
|
|
167
|
-
<button
|
|
168
|
-
bind:this={rootEl}
|
|
169
|
-
type="button"
|
|
170
|
-
role="switch"
|
|
171
|
-
class={cls}
|
|
172
|
-
aria-checked={on}
|
|
173
|
-
aria-labelledby={ariaLabelledby}
|
|
174
|
-
aria-label={ariaLabelledby ? undefined : ariaLabel}
|
|
175
|
-
aria-busy={loading || undefined}
|
|
176
|
-
aria-required={required || undefined}
|
|
177
|
-
aria-invalid={status === 'error' || undefined}
|
|
178
|
-
disabled={disabled || loading}
|
|
179
|
-
onclick={toggle}
|
|
180
|
-
onfocus={onFocus}
|
|
181
|
-
onblur={onBlur}
|
|
182
|
-
onkeydown={onKeydown}
|
|
183
|
-
onmouseenter={onMouseEnter}
|
|
184
|
-
onmouseleave={onMouseLeave}
|
|
185
|
-
>
|
|
186
|
-
{#if name}<input type="hidden" {name} value={submitValue} {required} />{/if}
|
|
187
|
-
{#if activeChildren !== undefined}
|
|
188
|
-
<span class="cd-switch__label">
|
|
189
|
-
{#if isSnippet(activeChildren)}{@render activeChildren()}{:else}{activeChildren}{/if}
|
|
190
|
-
</span>
|
|
191
|
-
{/if}
|
|
192
|
-
<span class="cd-switch__knob">
|
|
193
|
-
{#if loading}<span class="cd-switch__spinner" aria-hidden="true"></span>{/if}
|
|
194
|
-
</span>
|
|
195
|
-
</button>
|
|
196
|
-
|
|
197
|
-
{#if announceOnChange}
|
|
198
|
-
<!-- 切换播报 live region:视觉隐藏,仅供辅助技术读取(render 期只读 $state)。 -->
|
|
199
|
-
<div class="cd-switch__sr-live" role="status" aria-live="polite" aria-atomic="true">
|
|
200
|
-
{announceText}
|
|
201
|
-
</div>
|
|
202
|
-
{/if}
|
|
203
|
-
|
|
204
|
-
<style>
|
|
205
|
-
.cd-switch {
|
|
206
|
-
position: relative;
|
|
207
|
-
display: inline-flex;
|
|
208
|
-
align-items: center;
|
|
209
|
-
justify-content: flex-start;
|
|
210
|
-
inline-size: var(--cd-switch-width-default);
|
|
211
|
-
block-size: var(--cd-switch-height-default);
|
|
212
|
-
padding: 0;
|
|
213
|
-
border: none;
|
|
214
|
-
border-radius: var(--cd-switch-radius);
|
|
215
|
-
background: var(--cd-switch-bg-off);
|
|
216
|
-
cursor: pointer;
|
|
217
|
-
transition: background-color var(--cd-motion-duration-mid) var(--cd-motion-ease-standard);
|
|
218
|
-
}
|
|
219
|
-
.cd-switch--small {
|
|
220
|
-
inline-size: var(--cd-switch-width-small);
|
|
221
|
-
block-size: var(--cd-switch-height-small);
|
|
222
|
-
}
|
|
223
|
-
.cd-switch--large {
|
|
224
|
-
inline-size: var(--cd-switch-width-large);
|
|
225
|
-
block-size: var(--cd-switch-height-large);
|
|
226
|
-
}
|
|
227
|
-
.cd-switch--on {
|
|
228
|
-
background: var(--cd-switch-bg-on);
|
|
229
|
-
justify-content: flex-end;
|
|
230
|
-
}
|
|
231
|
-
.cd-switch--warning.cd-switch--on {
|
|
232
|
-
background: var(--cd-color-warning);
|
|
233
|
-
}
|
|
234
|
-
.cd-switch--warning.cd-switch--on .cd-switch__label {
|
|
235
|
-
color: var(--cd-color-text-inverse);
|
|
236
|
-
}
|
|
237
|
-
.cd-switch--error.cd-switch--on {
|
|
238
|
-
background: var(--cd-color-danger);
|
|
239
|
-
}
|
|
240
|
-
.cd-switch:focus-visible {
|
|
241
|
-
outline: none;
|
|
242
|
-
box-shadow: var(--cd-focus-ring);
|
|
243
|
-
}
|
|
244
|
-
.cd-switch:disabled {
|
|
245
|
-
cursor: not-allowed;
|
|
246
|
-
opacity: 0.5;
|
|
247
|
-
}
|
|
248
|
-
.cd-switch__knob {
|
|
249
|
-
position: absolute;
|
|
250
|
-
inset-block: 2px;
|
|
251
|
-
inset-inline-start: 2px;
|
|
252
|
-
aspect-ratio: 1;
|
|
253
|
-
block-size: calc(100% - 4px);
|
|
254
|
-
display: inline-flex;
|
|
255
|
-
align-items: center;
|
|
256
|
-
justify-content: center;
|
|
257
|
-
border-radius: var(--cd-radius-full);
|
|
258
|
-
background: var(--cd-switch-knob-bg);
|
|
259
|
-
transition: inset-inline-start var(--cd-motion-duration-mid) var(--cd-motion-ease-standard);
|
|
260
|
-
}
|
|
261
|
-
.cd-switch--on .cd-switch__knob {
|
|
262
|
-
inset-inline-start: calc(100% - 2px);
|
|
263
|
-
transform: translateX(-100%);
|
|
264
|
-
}
|
|
265
|
-
.cd-switch__label {
|
|
266
|
-
color: var(--cd-color-text-inverse);
|
|
267
|
-
font-size: var(--cd-font-size-1);
|
|
268
|
-
line-height: 1;
|
|
269
|
-
padding-inline: var(--cd-spacing-2);
|
|
270
|
-
}
|
|
271
|
-
.cd-switch--on .cd-switch__label {
|
|
272
|
-
padding-inline-start: var(--cd-spacing-3);
|
|
273
|
-
padding-inline-end: var(--cd-spacing-5);
|
|
274
|
-
}
|
|
275
|
-
.cd-switch__spinner {
|
|
276
|
-
inline-size: 60%;
|
|
277
|
-
aspect-ratio: 1;
|
|
278
|
-
border: 2px solid var(--cd-color-grey-3);
|
|
279
|
-
border-block-start-color: var(--cd-color-primary);
|
|
280
|
-
border-radius: var(--cd-radius-full);
|
|
281
|
-
animation: cd-switch-spin var(--cd-motion-duration-slow) linear infinite;
|
|
282
|
-
}
|
|
283
|
-
@keyframes cd-switch-spin {
|
|
284
|
-
to {
|
|
285
|
-
transform: rotate(360deg);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/* 视觉隐藏但对辅助技术可见(不可用 display:none / visibility:hidden)。 */
|
|
289
|
-
.cd-switch__sr-live {
|
|
290
|
-
position: absolute;
|
|
291
|
-
inline-size: 1px;
|
|
292
|
-
block-size: 1px;
|
|
293
|
-
margin: -1px;
|
|
294
|
-
padding: 0;
|
|
295
|
-
overflow: hidden;
|
|
296
|
-
clip: rect(0 0 0 0);
|
|
297
|
-
clip-path: inset(50%);
|
|
298
|
-
white-space: nowrap;
|
|
299
|
-
border: 0;
|
|
300
|
-
}
|
|
301
|
-
@media (prefers-reduced-motion: reduce) {
|
|
302
|
-
.cd-switch,
|
|
303
|
-
.cd-switch__knob {
|
|
304
|
-
transition: none;
|
|
305
|
-
}
|
|
306
|
-
.cd-switch__spinner {
|
|
307
|
-
animation: none;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
</style>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
仅供 Switch.kbd.test.ts(browser project)使用的键盘 e2e 夹具。
|
|
3
|
-
Switch 是原生 <button role="switch">,焦点落在按钮本身;Space/Enter 经原生
|
|
4
|
-
click 触发 toggle,aria-checked 翻转。夹具暴露 onChange 写入 lastValue。
|
|
5
|
-
-->
|
|
6
|
-
<script lang="ts">
|
|
7
|
-
import { LocaleProvider } from '../locale-provider/index.js';
|
|
8
|
-
import Switch from './Switch.svelte';
|
|
9
|
-
|
|
10
|
-
let lastValue = $state<unknown>(undefined);
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<LocaleProvider locale="en_US">
|
|
14
|
-
<button type="button" data-testid="before">before</button>
|
|
15
|
-
<Switch
|
|
16
|
-
ariaLabel="Toggle"
|
|
17
|
-
onChange={(v) => {
|
|
18
|
-
lastValue = v;
|
|
19
|
-
}}
|
|
20
|
-
/>
|
|
21
|
-
<output data-testid="value">{JSON.stringify(lastValue ?? null)}</output>
|
|
22
|
-
</LocaleProvider>
|
package/src/switch/index.ts
DELETED
package/src/switch/meta.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Machine-readable component metadata for AI/docs consumption.
|
|
3
|
-
* See specs/00-foundation/ai-friendly.spec.md.
|
|
4
|
-
*/
|
|
5
|
-
export const meta = {
|
|
6
|
-
name: 'Switch',
|
|
7
|
-
category: 'input',
|
|
8
|
-
description: '开关选择器,表示两种互斥状态的即时切换,支持加载态与自定义文案。',
|
|
9
|
-
props: [
|
|
10
|
-
{ name: 'value', type: 'boolean', default: 'undefined', desc: '受控值;提供则为受控' },
|
|
11
|
-
{ name: 'defaultValue', type: 'boolean', default: 'false', desc: '非受控初始值' },
|
|
12
|
-
{ name: 'checkedValue', type: 'string | number | boolean', default: 'true', desc: '开态映射的实际值(onChange.nativeValue 与表单提交值)' },
|
|
13
|
-
{ name: 'uncheckedValue', type: 'string | number | boolean', default: 'false', desc: '关态映射的实际值' },
|
|
14
|
-
{ name: 'size', type: "'small'|'default'|'large'", default: 'default' },
|
|
15
|
-
{ name: 'status', type: "'default'|'warning'|'error'", default: 'default' },
|
|
16
|
-
{ name: 'disabled', type: 'boolean', default: 'false' },
|
|
17
|
-
{ name: 'loading', type: 'boolean', default: 'false' },
|
|
18
|
-
{ name: 'checkedChildren', type: 'string | Snippet', default: 'undefined' },
|
|
19
|
-
{ name: 'uncheckedChildren', type: 'string | Snippet', default: 'undefined' },
|
|
20
|
-
{ name: 'name', type: 'string', default: 'undefined' },
|
|
21
|
-
{ name: 'required', type: 'boolean', default: 'false', desc: '表单必填校验(须为开态)' },
|
|
22
|
-
{ name: 'ariaLabel', type: 'string', default: 'undefined' },
|
|
23
|
-
{ name: 'ariaLabelledby', type: 'string', default: 'undefined', desc: '关联外部可见文本 id(优先于 ariaLabel)' },
|
|
24
|
-
{ name: 'announceOnChange', type: 'boolean', default: 'false', desc: '切换后用 live region 播报新状态' },
|
|
25
|
-
{ name: 'autofocus', type: 'boolean', default: 'false', desc: '挂载后自动聚焦' },
|
|
26
|
-
{ name: 'onChange', type: '(v: boolean, detail?: { value: boolean; nativeValue: string|number|boolean; event: Event }) => void', default: 'undefined' },
|
|
27
|
-
{ name: 'onFocus', type: '(event: FocusEvent) => void', default: 'undefined', desc: '获得焦点' },
|
|
28
|
-
{ name: 'onBlur', type: '(event: FocusEvent) => void', default: 'undefined', desc: '失去焦点' },
|
|
29
|
-
{ name: 'onKeydown', type: '(event: KeyboardEvent) => void', default: 'undefined', desc: '键盘按下(自定义快捷键扩展)' },
|
|
30
|
-
],
|
|
31
|
-
i18nKeys: [
|
|
32
|
-
'Switch.on',
|
|
33
|
-
'Switch.off',
|
|
34
|
-
'Switch.loading',
|
|
35
|
-
'Switch.announceChecked',
|
|
36
|
-
'Switch.announceUnchecked',
|
|
37
|
-
],
|
|
38
|
-
a11y: {
|
|
39
|
-
role: 'switch',
|
|
40
|
-
keyboard: ['Enter', 'Space'],
|
|
41
|
-
notes: ['原生 button role=switch', 'aria-checked 反映状态', 'loading 时 aria-busy'],
|
|
42
|
-
},
|
|
43
|
-
tokens: ['--cd-switch-*', '--cd-focus-ring', '--cd-motion-*', '--cd-radius-full'],
|
|
44
|
-
} as const;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Table a11y:数据表格。
|
|
2
|
-
// 纯展示表为原生 <table>(role=table);交互态(sorter/rowSelection 等)升级为
|
|
3
|
-
// WAI-ARIA Grid Pattern:role=grid + columnheader/row/gridcell。两种都各测一个。
|
|
4
|
-
import { describe, it, expect } from 'vitest';
|
|
5
|
-
import { renderWithLocale, expectNoAxeViolations } from '../test-utils/a11y.js';
|
|
6
|
-
import Table from './Table.svelte';
|
|
7
|
-
|
|
8
|
-
interface Row {
|
|
9
|
-
key: string;
|
|
10
|
-
name: string;
|
|
11
|
-
age: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const dataSource: Row[] = [
|
|
15
|
-
{ key: '1', name: 'Alice', age: 30 },
|
|
16
|
-
{ key: '2', name: 'Bob', age: 25 },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const plainColumns = [
|
|
20
|
-
{ key: 'name', dataIndex: 'name', title: 'Name' },
|
|
21
|
-
{ key: 'age', dataIndex: 'age', title: 'Age' },
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
describe('Table a11y', () => {
|
|
25
|
-
it('纯展示表:原生 table 语义(无 role=grid),无 axe violations', async () => {
|
|
26
|
-
const { container } = renderWithLocale(Table, {
|
|
27
|
-
props: { columns: plainColumns, dataSource, ariaLabel: 'Users' },
|
|
28
|
-
});
|
|
29
|
-
const table = container.querySelector('table');
|
|
30
|
-
expect(table).not.toBeNull();
|
|
31
|
-
// 纯展示降级:不应有 role=grid
|
|
32
|
-
expect(table?.getAttribute('role')).toBeNull();
|
|
33
|
-
expect(container.querySelector('[role="grid"]')).toBeNull();
|
|
34
|
-
// 列头与数据行
|
|
35
|
-
expect(container.querySelectorAll('th[scope="col"]').length).toBe(2);
|
|
36
|
-
await expectNoAxeViolations(container);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('交互态(sortable):role=grid + columnheader/gridcell + aria-rowcount', async () => {
|
|
40
|
-
const sortableColumns = [
|
|
41
|
-
{ key: 'name', dataIndex: 'name', title: 'Name', sorter: true },
|
|
42
|
-
{ key: 'age', dataIndex: 'age', title: 'Age', sorter: true },
|
|
43
|
-
];
|
|
44
|
-
const { container } = renderWithLocale(Table, {
|
|
45
|
-
props: { columns: sortableColumns, dataSource, ariaLabel: 'Users grid' },
|
|
46
|
-
});
|
|
47
|
-
const grid = container.querySelector('[role="grid"]');
|
|
48
|
-
expect(grid).not.toBeNull();
|
|
49
|
-
expect(grid?.getAttribute('aria-rowcount')).toBeTruthy();
|
|
50
|
-
expect(container.querySelectorAll('[role="columnheader"]').length).toBeGreaterThanOrEqual(2);
|
|
51
|
-
expect(container.querySelectorAll('[role="row"]').length).toBeGreaterThanOrEqual(1);
|
|
52
|
-
expect(container.querySelectorAll('[role="gridcell"]').length).toBeGreaterThanOrEqual(1);
|
|
53
|
-
await expectNoAxeViolations(container);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('rowSelection:交互态 role=grid + 全选 checkbox 有可访问名', async () => {
|
|
57
|
-
const { container } = renderWithLocale(Table, {
|
|
58
|
-
props: {
|
|
59
|
-
columns: plainColumns,
|
|
60
|
-
dataSource,
|
|
61
|
-
ariaLabel: 'Selectable',
|
|
62
|
-
rowSelection: {},
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
expect(container.querySelector('[role="grid"]')).not.toBeNull();
|
|
66
|
-
const checkbox = container.querySelector('input[type="checkbox"]');
|
|
67
|
-
expect(checkbox?.getAttribute('aria-label')).toBeTruthy();
|
|
68
|
-
await expectNoAxeViolations(container);
|
|
69
|
-
});
|
|
70
|
-
});
|
package/src/table/Table.bench.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Table 渲染基准(最小骨架,趋势参考,不接 CI 门禁)。
|
|
2
|
-
// 在 jsdom 下真实 mount Table,测不同行数的挂载耗时。仅供观察回归趋势,
|
|
3
|
-
// 数字受 jsdom/CI 机器影响,不作为硬门禁(门禁是 size-limit 体积预算)。
|
|
4
|
-
import { bench, describe } from 'vitest';
|
|
5
|
-
import { render, cleanup } from '@testing-library/svelte';
|
|
6
|
-
import Table from './Table.svelte';
|
|
7
|
-
|
|
8
|
-
interface Row extends Record<string, unknown> {
|
|
9
|
-
key: string;
|
|
10
|
-
name: string;
|
|
11
|
-
age: number;
|
|
12
|
-
city: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const columns = [
|
|
16
|
-
{ key: 'name', dataIndex: 'name', title: 'Name' },
|
|
17
|
-
{ key: 'age', dataIndex: 'age', title: 'Age' },
|
|
18
|
-
{ key: 'city', dataIndex: 'city', title: 'City' },
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
function makeRows(n: number): Row[] {
|
|
22
|
-
return Array.from({ length: n }, (_, i) => ({
|
|
23
|
-
key: String(i),
|
|
24
|
-
name: `User ${i}`,
|
|
25
|
-
age: 20 + (i % 50),
|
|
26
|
-
city: `City ${i % 10}`,
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
describe('Table render', () => {
|
|
31
|
-
const rows100 = makeRows(100);
|
|
32
|
-
const rows1000 = makeRows(1000);
|
|
33
|
-
|
|
34
|
-
bench(
|
|
35
|
-
'mount 100 rows',
|
|
36
|
-
() => {
|
|
37
|
-
render(Table, { props: { columns, dataSource: rows100 } });
|
|
38
|
-
cleanup();
|
|
39
|
-
},
|
|
40
|
-
{ time: 300 },
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
bench(
|
|
44
|
-
'mount 1000 rows',
|
|
45
|
-
() => {
|
|
46
|
-
render(Table, { props: { columns, dataSource: rows1000 } });
|
|
47
|
-
cleanup();
|
|
48
|
-
},
|
|
49
|
-
{ time: 500 },
|
|
50
|
-
);
|
|
51
|
-
});
|