@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,368 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
NotificationItem — 单条通知卡片。
|
|
3
|
-
类型图标(可选)+ 主体(title + content)+ 可选关闭按钮(右上角绝对定位)+ 可选 footer 操作区。
|
|
4
|
-
pauseOnHover 经 mouseenter/leave + focusin/out 暂停/恢复定时器。
|
|
5
|
-
showProgress:底部倒计时进度条,随 duration 递减;hover/聚焦时暂停(与定时器同步)。
|
|
6
|
-
命令式 rAF 驱动(红线 #3)——effect 启动循环、cleanup 取消帧并清空 ref;duration<=0 时不渲染。
|
|
7
|
-
theme:light(默认,与卡片背景一致)/ dark(深色卡片)。
|
|
8
|
-
a11y:error/warning -> role=alert + aria-live=assertive;其余 -> role=status + aria-live=polite。
|
|
9
|
-
title/content 经 useId 关联 aria-labelledby / aria-describedby;关闭按钮 aria-label「关闭」,不抢焦点。
|
|
10
|
-
类型前缀(如「错误:」)以视觉隐藏文本注入卡片首部(spec §6),令屏幕阅读器先播报极性语义。
|
|
11
|
-
-->
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import type { Snippet } from 'svelte';
|
|
14
|
-
import { useId } from '@chenzy-design/core';
|
|
15
|
-
import type { NotificationItem, NotificationType } from '@chenzy-design/core';
|
|
16
|
-
import { useLocale } from '../locale-provider/index.js';
|
|
17
|
-
|
|
18
|
-
interface Props {
|
|
19
|
-
item: NotificationItem;
|
|
20
|
-
onClose: (id: string) => void;
|
|
21
|
-
/**
|
|
22
|
-
* 仅在用户点击关闭按钮时触发(与 onClose 区分:onClose 在任何关闭方式时触发)。
|
|
23
|
-
* 由 NotificationContainer 传入,从 onCloseClickMap 中查找并调用对应回调。
|
|
24
|
-
*/
|
|
25
|
-
onCloseClick?: (id: string) => void;
|
|
26
|
-
onPause: (id: string) => void;
|
|
27
|
-
onResume: (id: string) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let { item, onClose, onCloseClick, onPause, onResume }: Props = $props();
|
|
31
|
-
const loc = useLocale();
|
|
32
|
-
|
|
33
|
-
const titleId = useId('cd-notification-title');
|
|
34
|
-
const contentId = useId('cd-notification-content');
|
|
35
|
-
|
|
36
|
-
const isAlert = $derived(item.type === 'error' || item.type === 'warning');
|
|
37
|
-
const role = $derived(isAlert ? 'alert' : 'status');
|
|
38
|
-
const ariaLive = $derived(isAlert ? 'assertive' : 'polite');
|
|
39
|
-
const hasIcon = $derived(item.type !== 'default');
|
|
40
|
-
|
|
41
|
-
// 视觉隐藏类型前缀(如「错误:」):default 无前缀;其余走 i18n(colon 跟随 locale)。
|
|
42
|
-
// 注入卡片首部,令屏幕阅读器先读极性语义再读 title/content。
|
|
43
|
-
const typePrefix = $derived(
|
|
44
|
-
item.type === 'default'
|
|
45
|
-
? ''
|
|
46
|
-
: `${loc().t(`Notification.${item.type}`)}${loc().t('Form.colon')}`,
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// footer 是渲染层 Snippet(core 用 unknown 透传,无框架依赖)。
|
|
50
|
-
const footer = $derived(item.footer as Snippet | undefined);
|
|
51
|
-
|
|
52
|
-
// showProgress 仅在有限 duration 下有意义;duration<=0(常驻)无倒计时可显示。
|
|
53
|
-
const hasProgress = $derived(item.showProgress && item.duration > 0);
|
|
54
|
-
|
|
55
|
-
// 本地暂停态:与 store 定时器的暂停/恢复严格同源(同一组 hover/focus 处理器)。
|
|
56
|
-
// 用普通变量(非 $state)让 rAF 循环直接读取,避免 effect 重订阅/重启而丢失进度。
|
|
57
|
-
let paused = false;
|
|
58
|
-
// 进度条 DOM 引用;命令式驱动 scaleX,避免每帧触发 Svelte 响应式。
|
|
59
|
-
let progressEl = $state<HTMLDivElement | null>(null);
|
|
60
|
-
|
|
61
|
-
function handlePause() {
|
|
62
|
-
if (item.pauseOnHover) {
|
|
63
|
-
paused = true;
|
|
64
|
-
onPause(item.id);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function handleResume() {
|
|
68
|
-
if (item.pauseOnHover) {
|
|
69
|
-
paused = false;
|
|
70
|
-
onResume(item.id);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// 命令式 rAF 倒计时进度(红线 #3):effect 仅依赖 duration/progressEl 启动单条循环,
|
|
75
|
-
// 循环内直接读 paused(普通变量)冻结/推进剩余时间,直接写 DOM scaleX;cleanup 取消帧。
|
|
76
|
-
$effect(() => {
|
|
77
|
-
if (!hasProgress || !progressEl) return;
|
|
78
|
-
const totalMs = item.duration * 1000;
|
|
79
|
-
const el = progressEl;
|
|
80
|
-
let raf = 0;
|
|
81
|
-
let remaining = totalMs;
|
|
82
|
-
let last = performance.now();
|
|
83
|
-
|
|
84
|
-
function tick(t: number): void {
|
|
85
|
-
if (!paused) remaining = Math.max(0, remaining - (t - last));
|
|
86
|
-
last = t;
|
|
87
|
-
el.style.transform = `scaleX(${remaining / totalMs})`;
|
|
88
|
-
if (remaining > 0) raf = requestAnimationFrame(tick);
|
|
89
|
-
}
|
|
90
|
-
raf = requestAnimationFrame(tick);
|
|
91
|
-
return () => cancelAnimationFrame(raf);
|
|
92
|
-
});
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
{#snippet typeIcon(type: NotificationType)}
|
|
96
|
-
{#if type === 'success'}
|
|
97
|
-
<svg class="cd-notification-item__icon-svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
98
|
-
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.4" />
|
|
99
|
-
<path
|
|
100
|
-
fill="none"
|
|
101
|
-
stroke="currentColor"
|
|
102
|
-
stroke-width="1.6"
|
|
103
|
-
stroke-linecap="round"
|
|
104
|
-
stroke-linejoin="round"
|
|
105
|
-
d="M5 8.2l2 2 4-4.4"
|
|
106
|
-
/>
|
|
107
|
-
</svg>
|
|
108
|
-
{:else if type === 'info'}
|
|
109
|
-
<svg class="cd-notification-item__icon-svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
110
|
-
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.4" />
|
|
111
|
-
<path stroke="currentColor" stroke-width="1.4" stroke-linecap="round" d="M8 7.2v4" />
|
|
112
|
-
<circle cx="8" cy="4.7" r="0.85" fill="currentColor" />
|
|
113
|
-
</svg>
|
|
114
|
-
{:else if type === 'warning'}
|
|
115
|
-
<svg class="cd-notification-item__icon-svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
116
|
-
<path
|
|
117
|
-
fill="none"
|
|
118
|
-
stroke="currentColor"
|
|
119
|
-
stroke-width="1.4"
|
|
120
|
-
stroke-linejoin="round"
|
|
121
|
-
d="M8 1.5l6.5 12h-13z"
|
|
122
|
-
/>
|
|
123
|
-
<path stroke="currentColor" stroke-width="1.4" stroke-linecap="round" d="M8 6.5v3.2" />
|
|
124
|
-
<circle cx="8" cy="11.6" r="0.85" fill="currentColor" />
|
|
125
|
-
</svg>
|
|
126
|
-
{:else if type === 'error'}
|
|
127
|
-
<svg class="cd-notification-item__icon-svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
128
|
-
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.4" />
|
|
129
|
-
<path
|
|
130
|
-
stroke="currentColor"
|
|
131
|
-
stroke-width="1.6"
|
|
132
|
-
stroke-linecap="round"
|
|
133
|
-
d="M5.5 5.5l5 5M10.5 5.5l-5 5"
|
|
134
|
-
/>
|
|
135
|
-
</svg>
|
|
136
|
-
{/if}
|
|
137
|
-
{/snippet}
|
|
138
|
-
|
|
139
|
-
<div
|
|
140
|
-
class="cd-notification-item cd-notification-item--{item.type} cd-notification-item--{item.theme}"
|
|
141
|
-
{role}
|
|
142
|
-
aria-live={ariaLive}
|
|
143
|
-
aria-labelledby={item.title ? titleId : undefined}
|
|
144
|
-
aria-describedby={item.content ? contentId : undefined}
|
|
145
|
-
onmouseenter={handlePause}
|
|
146
|
-
onmouseleave={handleResume}
|
|
147
|
-
onfocusin={handlePause}
|
|
148
|
-
onfocusout={handleResume}
|
|
149
|
-
>
|
|
150
|
-
{#if typePrefix}
|
|
151
|
-
<span class="cd-sr-only">{typePrefix}</span>
|
|
152
|
-
{/if}
|
|
153
|
-
{#if hasIcon}
|
|
154
|
-
<span class="cd-notification-item__icon">
|
|
155
|
-
{@render typeIcon(item.type)}
|
|
156
|
-
</span>
|
|
157
|
-
{/if}
|
|
158
|
-
<div class="cd-notification-item__body">
|
|
159
|
-
{#if item.title}
|
|
160
|
-
<div class="cd-notification-item__title" id={titleId}>{item.title}</div>
|
|
161
|
-
{/if}
|
|
162
|
-
{#if item.content}
|
|
163
|
-
<div class="cd-notification-item__content" id={contentId}>{item.content}</div>
|
|
164
|
-
{/if}
|
|
165
|
-
{#if footer}
|
|
166
|
-
<div class="cd-notification-item__footer">
|
|
167
|
-
{@render footer()}
|
|
168
|
-
</div>
|
|
169
|
-
{/if}
|
|
170
|
-
</div>
|
|
171
|
-
{#if item.closable}
|
|
172
|
-
<button
|
|
173
|
-
type="button"
|
|
174
|
-
class="cd-notification-item__close"
|
|
175
|
-
aria-label={loc().t('Notification.closeText')}
|
|
176
|
-
onclick={() => { onCloseClick?.(item.id); onClose(item.id); }}
|
|
177
|
-
>
|
|
178
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
179
|
-
<path
|
|
180
|
-
stroke="currentColor"
|
|
181
|
-
stroke-width="1.4"
|
|
182
|
-
stroke-linecap="round"
|
|
183
|
-
d="M4 4l8 8M12 4l-8 8"
|
|
184
|
-
/>
|
|
185
|
-
</svg>
|
|
186
|
-
</button>
|
|
187
|
-
{/if}
|
|
188
|
-
{#if hasProgress}
|
|
189
|
-
<div class="cd-notification-item__progress" aria-hidden="true">
|
|
190
|
-
<div class="cd-notification-item__progress-bar" bind:this={progressEl}></div>
|
|
191
|
-
</div>
|
|
192
|
-
{/if}
|
|
193
|
-
</div>
|
|
194
|
-
|
|
195
|
-
<style>
|
|
196
|
-
.cd-notification-item {
|
|
197
|
-
position: relative;
|
|
198
|
-
display: flex;
|
|
199
|
-
gap: var(--cd-notification-gap);
|
|
200
|
-
align-items: flex-start;
|
|
201
|
-
box-sizing: border-box;
|
|
202
|
-
inline-size: var(--cd-notification-width);
|
|
203
|
-
max-inline-size: 100%;
|
|
204
|
-
padding: var(--cd-notification-padding);
|
|
205
|
-
background: var(--cd-notification-bg);
|
|
206
|
-
border: 1px solid var(--cd-notification-border);
|
|
207
|
-
border-radius: var(--cd-notification-radius);
|
|
208
|
-
box-shadow: var(--cd-notification-shadow);
|
|
209
|
-
pointer-events: auto;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/* 视觉隐藏类型前缀复用 tokens.css 全局 .cd-sr-only:仅供屏幕阅读器读取极性语义。 */
|
|
213
|
-
|
|
214
|
-
.cd-notification-item__icon {
|
|
215
|
-
display: inline-flex;
|
|
216
|
-
flex: none;
|
|
217
|
-
align-items: center;
|
|
218
|
-
justify-content: center;
|
|
219
|
-
inline-size: 1.25em;
|
|
220
|
-
block-size: 1.25em;
|
|
221
|
-
margin-block-start: 0.0625em;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.cd-notification-item__icon-svg {
|
|
225
|
-
inline-size: 100%;
|
|
226
|
-
block-size: 100%;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.cd-notification-item--success .cd-notification-item__icon {
|
|
230
|
-
color: var(--cd-notification-icon-success);
|
|
231
|
-
}
|
|
232
|
-
.cd-notification-item--info .cd-notification-item__icon {
|
|
233
|
-
color: var(--cd-notification-icon-info);
|
|
234
|
-
}
|
|
235
|
-
.cd-notification-item--warning .cd-notification-item__icon {
|
|
236
|
-
color: var(--cd-notification-icon-warning);
|
|
237
|
-
}
|
|
238
|
-
.cd-notification-item--error .cd-notification-item__icon {
|
|
239
|
-
color: var(--cd-notification-icon-error);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.cd-notification-item__body {
|
|
243
|
-
flex: 1 1 auto;
|
|
244
|
-
min-inline-size: 0;
|
|
245
|
-
/* 为右上角关闭按钮预留空间 */
|
|
246
|
-
padding-inline-end: 1.5em;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.cd-notification-item__title {
|
|
250
|
-
font-size: var(--cd-notification-title-size);
|
|
251
|
-
font-weight: 600;
|
|
252
|
-
line-height: 1.4;
|
|
253
|
-
color: var(--cd-notification-color-title);
|
|
254
|
-
overflow-wrap: anywhere;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.cd-notification-item__content {
|
|
258
|
-
margin-block-start: var(--cd-spacing-1);
|
|
259
|
-
font-size: var(--cd-notification-content-size);
|
|
260
|
-
line-height: 1.5;
|
|
261
|
-
color: var(--cd-notification-color-content);
|
|
262
|
-
overflow-wrap: anywhere;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.cd-notification-item__footer {
|
|
266
|
-
display: flex;
|
|
267
|
-
flex-wrap: wrap;
|
|
268
|
-
gap: var(--cd-spacing-2);
|
|
269
|
-
align-items: center;
|
|
270
|
-
margin-block-start: var(--cd-spacing-3);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.cd-notification-item__progress {
|
|
274
|
-
position: absolute;
|
|
275
|
-
inset-inline: 0;
|
|
276
|
-
inset-block-end: 0;
|
|
277
|
-
block-size: var(--cd-notification-progress-height);
|
|
278
|
-
overflow: hidden;
|
|
279
|
-
border-end-start-radius: var(--cd-notification-radius);
|
|
280
|
-
border-end-end-radius: var(--cd-notification-radius);
|
|
281
|
-
pointer-events: none;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.cd-notification-item__progress-bar {
|
|
285
|
-
block-size: 100%;
|
|
286
|
-
inline-size: 100%;
|
|
287
|
-
background: var(--cd-notification-progress-color);
|
|
288
|
-
/* 倒计时从起始边收缩:LTR 自左、RTL 自右(随 dir 翻转 transform-origin)。 */
|
|
289
|
-
transform-origin: left center;
|
|
290
|
-
/* 初始满格;命令式 rAF 写 scaleX 递减 */
|
|
291
|
-
transform: scaleX(1);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
:global([dir='rtl']) .cd-notification-item__progress-bar {
|
|
295
|
-
transform-origin: right center;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.cd-notification-item--success .cd-notification-item__progress-bar {
|
|
299
|
-
background: var(--cd-notification-icon-success);
|
|
300
|
-
}
|
|
301
|
-
.cd-notification-item--info .cd-notification-item__progress-bar {
|
|
302
|
-
background: var(--cd-notification-icon-info);
|
|
303
|
-
}
|
|
304
|
-
.cd-notification-item--warning .cd-notification-item__progress-bar {
|
|
305
|
-
background: var(--cd-notification-icon-warning);
|
|
306
|
-
}
|
|
307
|
-
.cd-notification-item--error .cd-notification-item__progress-bar {
|
|
308
|
-
background: var(--cd-notification-icon-error);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/* dark 主题:深色卡片,文案/边框/关闭色覆盖为 token */
|
|
312
|
-
.cd-notification-item--dark {
|
|
313
|
-
background: var(--cd-notification-bg-dark);
|
|
314
|
-
border-color: var(--cd-notification-border-dark);
|
|
315
|
-
}
|
|
316
|
-
.cd-notification-item--dark .cd-notification-item__title {
|
|
317
|
-
color: var(--cd-notification-color-title-dark);
|
|
318
|
-
}
|
|
319
|
-
.cd-notification-item--dark .cd-notification-item__content {
|
|
320
|
-
color: var(--cd-notification-color-content-dark);
|
|
321
|
-
}
|
|
322
|
-
.cd-notification-item--dark .cd-notification-item__close {
|
|
323
|
-
color: var(--cd-notification-close-color-dark);
|
|
324
|
-
}
|
|
325
|
-
.cd-notification-item--dark .cd-notification-item__close:hover {
|
|
326
|
-
color: var(--cd-notification-close-color-hover-dark);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.cd-notification-item__close {
|
|
330
|
-
position: absolute;
|
|
331
|
-
inset-block-start: var(--cd-notification-padding);
|
|
332
|
-
inset-inline-end: var(--cd-notification-padding);
|
|
333
|
-
display: inline-flex;
|
|
334
|
-
flex: none;
|
|
335
|
-
align-items: center;
|
|
336
|
-
justify-content: center;
|
|
337
|
-
inline-size: 1.25em;
|
|
338
|
-
block-size: 1.25em;
|
|
339
|
-
padding: 0;
|
|
340
|
-
margin: 0;
|
|
341
|
-
border: none;
|
|
342
|
-
background: transparent;
|
|
343
|
-
color: var(--cd-notification-close-color);
|
|
344
|
-
cursor: pointer;
|
|
345
|
-
border-radius: var(--cd-radius-1);
|
|
346
|
-
transition: color var(--cd-notification-motion-duration) ease;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.cd-notification-item__close:hover {
|
|
350
|
-
color: var(--cd-notification-close-color-hover);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.cd-notification-item__close:focus-visible {
|
|
354
|
-
outline: 2px solid var(--cd-color-primary);
|
|
355
|
-
outline-offset: 1px;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.cd-notification-item__close svg {
|
|
359
|
-
inline-size: 100%;
|
|
360
|
-
block-size: 100%;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
@media (prefers-reduced-motion: reduce) {
|
|
364
|
-
.cd-notification-item__close {
|
|
365
|
-
transition: none;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
</style>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { notification, type NotificationConfig, type SvelteNotificationOptions } from './store.js';
|
|
2
|
-
export { meta as notificationMeta } from './meta.js';
|
|
3
|
-
export type {
|
|
4
|
-
NotificationType,
|
|
5
|
-
NotificationOptions,
|
|
6
|
-
NotificationItem,
|
|
7
|
-
NotificationPlacement,
|
|
8
|
-
NotificationDirection,
|
|
9
|
-
} from '@chenzy-design/core';
|
package/src/notification/meta.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Machine-readable component metadata for AI/docs consumption.
|
|
3
|
-
* Notification — see specs/components/feedback/Notification.spec.md
|
|
4
|
-
*/
|
|
5
|
-
export const meta = {
|
|
6
|
-
name: 'Notification',
|
|
7
|
-
category: 'feedback',
|
|
8
|
-
description:
|
|
9
|
-
'通知提醒框:命令式全局反馈 API(notification.open/success/info/warning/error/close/update/destroyAll)。比 Toast 更丰富——标题 + 内容 + 图标;6 方位独立堆叠;单例容器惰性挂载到 body;自动关闭 + 悬停暂停 + maxCount 按方位 FIFO 淘汰 + 同 id 去重更新;error/warning role=alert(assertive)、其余 role=status(polite);可选 showProgress 倒计时进度条(命令式 rAF + 悬停同步暂停)、footer 操作区 Snippet、theme(light/dark);RTL(direction=rtl 镜像卡片布局并左右互换方位)、Esc 关闭最近一条(window keydown + cleanup)、notification.config({ direction, getPopupContainer }) 配置全局方向与容器挂载点(默认 ltr + body,对齐 Modal/Dropdown getContainer)。',
|
|
10
|
-
exports: ['notification'],
|
|
11
|
-
imperative: true,
|
|
12
|
-
config: {
|
|
13
|
-
direction: "全局默认书写方向 'ltr'|'rtl'(per-item direction 优先)",
|
|
14
|
-
getPopupContainer:
|
|
15
|
-
'() => HTMLElement,容器宿主挂载目标(默认 body);须在首条通知前调用方生效',
|
|
16
|
-
},
|
|
17
|
-
props: [
|
|
18
|
-
{ name: 'id', type: 'string', default: 'undefined', desc: '指定 id;已存在则原地更新' },
|
|
19
|
-
{ name: 'title', type: 'string', default: '—', desc: '通知标题' },
|
|
20
|
-
{ name: 'content', type: 'string', default: '—', desc: '通知正文' },
|
|
21
|
-
{
|
|
22
|
-
name: 'type',
|
|
23
|
-
type: "'default'|'success'|'info'|'warning'|'error'",
|
|
24
|
-
default: "'default'",
|
|
25
|
-
desc: '语义类型,决定图标与强调色',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'duration',
|
|
29
|
-
type: 'number',
|
|
30
|
-
default: '4.5',
|
|
31
|
-
desc: '自动关闭秒数;0 持久',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'placement',
|
|
35
|
-
type: "'topLeft'|'top'|'topRight'|'bottomLeft'|'bottom'|'bottomRight'",
|
|
36
|
-
default: "'topRight'",
|
|
37
|
-
desc: '弹出位置,每方位独立堆叠',
|
|
38
|
-
},
|
|
39
|
-
{ name: 'closable', type: 'boolean', default: 'true', desc: '是否显示关闭按钮' },
|
|
40
|
-
{ name: 'pauseOnHover', type: 'boolean', default: 'true', desc: '悬停/聚焦时暂停定时器' },
|
|
41
|
-
{
|
|
42
|
-
name: 'showProgress',
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
default: 'false',
|
|
45
|
-
desc: '底部倒计时进度条,随 duration 递减;悬停/聚焦时与定时器同步暂停(duration=0 时不显示)',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'theme',
|
|
49
|
-
type: "'light'|'dark'",
|
|
50
|
-
default: "'light'",
|
|
51
|
-
desc: '卡片主题;dark 为深色卡片',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'direction',
|
|
55
|
-
type: "'ltr'|'rtl'",
|
|
56
|
-
default: "'ltr'(可经 notification.config 改默认)",
|
|
57
|
-
desc: 'RTL 时镜像卡片布局(关闭按钮/图标/文案/进度方向翻转)并左右互换方位',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: 'footer',
|
|
61
|
-
type: 'Snippet',
|
|
62
|
-
default: 'undefined',
|
|
63
|
-
desc: '底部操作区插槽(按钮等),渲染在内容下方',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'onClose',
|
|
67
|
-
type: "(id: string, reason: 'timeout'|'manual'|'replace'|'destroyAll') => void",
|
|
68
|
-
default: 'undefined',
|
|
69
|
-
desc: '关闭回调,附关闭原因',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
events: [{ name: 'onClose', desc: '单条关闭(超时/手动/被替换/清空)时触发,带 id 与 reason' }],
|
|
73
|
-
slots: [],
|
|
74
|
-
a11y: {
|
|
75
|
-
hasRole: true,
|
|
76
|
-
focusable: false,
|
|
77
|
-
note: 'error/warning 用 role=alert + aria-live=assertive,其余 role=status + aria-live=polite;标题 aria-labelledby、内容 aria-describedby;关闭按钮 button + aria-label「关闭」。不抢焦点、不锁滚动。',
|
|
78
|
-
},
|
|
79
|
-
tokens: [
|
|
80
|
-
'--cd-notification-width',
|
|
81
|
-
'--cd-notification-bg',
|
|
82
|
-
'--cd-notification-color-title',
|
|
83
|
-
'--cd-notification-color-content',
|
|
84
|
-
'--cd-notification-border',
|
|
85
|
-
'--cd-notification-radius',
|
|
86
|
-
'--cd-notification-shadow',
|
|
87
|
-
'--cd-notification-padding',
|
|
88
|
-
'--cd-notification-gap',
|
|
89
|
-
'--cd-notification-icon-success',
|
|
90
|
-
'--cd-notification-icon-info',
|
|
91
|
-
'--cd-notification-icon-warning',
|
|
92
|
-
'--cd-notification-icon-error',
|
|
93
|
-
'--cd-notification-close-color',
|
|
94
|
-
'--cd-notification-close-color-hover',
|
|
95
|
-
'--cd-notification-title-size',
|
|
96
|
-
'--cd-notification-content-size',
|
|
97
|
-
'--cd-notification-z',
|
|
98
|
-
'--cd-notification-offset',
|
|
99
|
-
'--cd-notification-motion-duration',
|
|
100
|
-
'--cd-notification-progress-height',
|
|
101
|
-
'--cd-notification-progress-color',
|
|
102
|
-
'--cd-notification-bg-dark',
|
|
103
|
-
'--cd-notification-border-dark',
|
|
104
|
-
'--cd-notification-color-title-dark',
|
|
105
|
-
'--cd-notification-color-content-dark',
|
|
106
|
-
'--cd-notification-close-color-dark',
|
|
107
|
-
'--cd-notification-close-color-hover-dark',
|
|
108
|
-
],
|
|
109
|
-
responsive: false,
|
|
110
|
-
examples: [
|
|
111
|
-
{ title: '成功', code: "notification.success({ title: '已上传', content: '文件保存成功' })" },
|
|
112
|
-
{ title: '错误', code: "notification.error({ title: '保存失败', content: '网络中断' })" },
|
|
113
|
-
{ title: '常驻', code: "notification.open({ title: '提醒', duration: 0 })" },
|
|
114
|
-
{ title: 'RTL', code: "notification.info({ title: 'مرحبا', content: 'نص', direction: 'rtl' })" },
|
|
115
|
-
{
|
|
116
|
-
title: '全局配置',
|
|
117
|
-
code: "notification.config({ direction: 'rtl', getPopupContainer: () => document.getElementById('app')! })",
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
} as const;
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notification — 命令式全局通知提醒框入口。
|
|
3
|
-
* 模块级单例 store + 惰性挂载的单例 NotificationContainer(首次调用时 mount 到 body)。
|
|
4
|
-
* 复用 @chenzy-design/core 的 createNotificationStore(无框架依赖的队列 + 定时器)。
|
|
5
|
-
* 与 Toast 同构,差异:数据含 title + content、6 方位独立堆叠、无 loading 类型;
|
|
6
|
-
* 命令式入参是 NotificationOptions 配置对象(不像 Toast 首参是 string)。
|
|
7
|
-
* See specs/components/feedback/Notification.spec.md
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
createNotificationStore,
|
|
11
|
-
type NotificationStore,
|
|
12
|
-
type NotificationOptions,
|
|
13
|
-
type NotificationType,
|
|
14
|
-
type NotificationPlacement,
|
|
15
|
-
type NotificationDirection,
|
|
16
|
-
} from '@chenzy-design/core';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 全局通知配置(命令式单例特有)。容器经 mount() 挂在 Svelte 组件树之外,
|
|
20
|
-
* 拿不到 ConfigProvider context,故 RTL / 挂载容器只能经此命令式入口配置:
|
|
21
|
-
* - direction:未显式指定 direction 的通知的默认书写方向(rtl 镜像布局并左右互换方位)。
|
|
22
|
-
* - getPopupContainer:容器宿主挂载目标(默认 body),对齐 Modal/Dropdown getContainer。
|
|
23
|
-
* - top/bottom/left/right:六方位容器与视口边缘的偏移(CSS 像素字符串或数字)。
|
|
24
|
-
* - zIndex:通知容器层叠优先级。
|
|
25
|
-
* - duration:全局默认自动关闭秒数(0 = 常驻),可被单条 options.duration 覆盖。
|
|
26
|
-
* 须在首条通知前调用方对挂载点生效(容器惰性挂载且单例,仅挂一次)。
|
|
27
|
-
*/
|
|
28
|
-
export interface NotificationConfig {
|
|
29
|
-
direction?: NotificationDirection;
|
|
30
|
-
getPopupContainer?: () => HTMLElement | null | undefined;
|
|
31
|
-
/** 通知容器距视口顶部偏移(CSS 值,如 '24px' 或数字像素),适用于 topLeft/top/topRight 方位 */
|
|
32
|
-
top?: number | string;
|
|
33
|
-
/** 通知容器距视口底部偏移 */
|
|
34
|
-
bottom?: number | string;
|
|
35
|
-
/** 通知容器距视口左侧偏移 */
|
|
36
|
-
left?: number | string;
|
|
37
|
-
/** 通知容器距视口右侧偏移 */
|
|
38
|
-
right?: number | string;
|
|
39
|
-
/** 通知容器 z-index */
|
|
40
|
-
zIndex?: number;
|
|
41
|
-
/** 全局默认自动关闭秒数(0 = 常驻);可被单条 notification.xxx({ duration }) 覆盖 */
|
|
42
|
-
duration?: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let store: NotificationStore | null = null;
|
|
46
|
-
let containerMounted = false;
|
|
47
|
-
let globalDirection: NotificationDirection = 'ltr';
|
|
48
|
-
let getPopupContainer: (() => HTMLElement | null | undefined) | undefined;
|
|
49
|
-
let globalDuration: number | undefined;
|
|
50
|
-
// 位置偏移:由 NotificationContainer 读取并注入 CSS custom property。
|
|
51
|
-
type PositionOffsets = Pick<NotificationConfig, 'top' | 'bottom' | 'left' | 'right' | 'zIndex'>;
|
|
52
|
-
let positionOffsets: PositionOffsets = {};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Svelte 层扩展选项(core NotificationOptions 的超集):
|
|
56
|
-
* - showClose: closable 的别名(Semi 文档用 showClose),两者等价,showClose 优先。
|
|
57
|
-
* - onCloseClick: 仅在用户点击关闭按钮时触发(与 onClose 区分:onClose 在任何关闭方式时触发)。
|
|
58
|
-
*/
|
|
59
|
-
export interface SvelteNotificationOptions extends NotificationOptions {
|
|
60
|
-
/** closable 的别名(Semi 文档用 showClose);showClose 优先于 closable */
|
|
61
|
-
showClose?: boolean;
|
|
62
|
-
/** 仅在用户点击关闭按钮时触发;onClose 在所有关闭方式(timeout/manual/replace/destroyAll)时触发 */
|
|
63
|
-
onCloseClick?: (id: string) => void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// onCloseClick 回调按 id 存储在模块级 Map,NotificationContainer 关闭按钮点击时查找并调用。
|
|
67
|
-
export const onCloseClickMap = new Map<string, (id: string) => void>();
|
|
68
|
-
|
|
69
|
-
/** 位置偏移 getter:供 NotificationContainer 读取并注入 inline style(config() 后生效)。 */
|
|
70
|
-
export function getPositionOffsets(): Pick<NotificationConfig, 'top' | 'bottom' | 'left' | 'right' | 'zIndex'> {
|
|
71
|
-
return positionOffsets;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function ensureStore(): NotificationStore {
|
|
75
|
-
if (!store) {
|
|
76
|
-
store = createNotificationStore({
|
|
77
|
-
maxCount: 5,
|
|
78
|
-
defaultDuration: globalDuration ?? 4.5,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return store;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 把全局 direction 作为默认注入未显式指定方向的选项(per-item direction 仍优先)。
|
|
86
|
-
* 同时解析 showClose 别名(→ closable);onCloseClick 单独处理。
|
|
87
|
-
*/
|
|
88
|
-
interface ResolvedOpts {
|
|
89
|
-
coreOpts: NotificationOptions;
|
|
90
|
-
onCloseClick: ((id: string) => void) | undefined;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function resolveOpts(opts: SvelteNotificationOptions): ResolvedOpts {
|
|
94
|
-
// Cast via unknown to tolerate svelte-check false positives when @chenzy-design/core is not built.
|
|
95
|
-
type CoreOpts = NotificationOptions & Record<string, unknown>;
|
|
96
|
-
const { showClose, onCloseClick, ...rest } = opts as SvelteNotificationOptions & Record<string, unknown>;
|
|
97
|
-
// showClose 优先于 closable;都未传则 core 默认 true。
|
|
98
|
-
const closable = showClose !== undefined ? showClose : (rest as CoreOpts).closable;
|
|
99
|
-
const coreOpts: NotificationOptions = {
|
|
100
|
-
...(rest as NotificationOptions),
|
|
101
|
-
...(closable !== undefined ? { closable } : {}),
|
|
102
|
-
direction: (opts as CoreOpts).direction !== undefined
|
|
103
|
-
? (opts as CoreOpts).direction as string
|
|
104
|
-
: globalDirection,
|
|
105
|
-
} as NotificationOptions;
|
|
106
|
-
// 若有 onCloseClick,在 onClose 钩子中清理 map(防内存泄漏)。
|
|
107
|
-
if (onCloseClick) {
|
|
108
|
-
const origOnClose = (coreOpts as CoreOpts).onClose as ((id: string, r: unknown) => void) | undefined;
|
|
109
|
-
(coreOpts as CoreOpts).onClose = (closedId: string, reason: unknown) => {
|
|
110
|
-
onCloseClickMap.delete(closedId);
|
|
111
|
-
origOnClose?.(closedId, reason);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return { coreOpts, onCloseClick };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* 惰性挂载容器:首次调用时动态 import + mount NotificationContainer 到 body。
|
|
119
|
-
* mount 是 async(动态 import),但调用方的 s.open 已同步把数据写进 store;
|
|
120
|
-
* 容器在 mount 时立即同步读一次 store.getItems(),不会丢首条通知。
|
|
121
|
-
*/
|
|
122
|
-
async function ensureContainer(): Promise<void> {
|
|
123
|
-
if (containerMounted || typeof document === 'undefined') return;
|
|
124
|
-
containerMounted = true;
|
|
125
|
-
const { mount } = await import('svelte');
|
|
126
|
-
const { default: NotificationContainer } = await import('./NotificationContainer.svelte');
|
|
127
|
-
const host = document.createElement('div');
|
|
128
|
-
host.className = 'cd-notification-host';
|
|
129
|
-
// 挂载到 getPopupContainer() 指定容器(默认 body),对齐 Modal/Dropdown getContainer。
|
|
130
|
-
const target = getPopupContainer?.() ?? document.body;
|
|
131
|
-
target.appendChild(host);
|
|
132
|
-
mount(NotificationContainer, { target: host, props: { store: ensureStore() } });
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function show(type: NotificationType, opts: SvelteNotificationOptions): string {
|
|
136
|
-
const s = ensureStore();
|
|
137
|
-
void ensureContainer();
|
|
138
|
-
const merged: SvelteNotificationOptions = { ...opts };
|
|
139
|
-
(merged as NotificationOptions).type = type;
|
|
140
|
-
const { coreOpts, onCloseClick } = resolveOpts(merged);
|
|
141
|
-
const id = s.open(coreOpts);
|
|
142
|
-
if (onCloseClick) onCloseClickMap.set(id, onCloseClick);
|
|
143
|
-
return id;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export const notification = {
|
|
147
|
-
/**
|
|
148
|
-
* 配置全局通知行为:direction(默认书写方向)、getPopupContainer(容器挂载目标)、
|
|
149
|
-
* top/bottom/left/right/zIndex(容器位置偏移)、duration(全局默认自动关闭秒数)。
|
|
150
|
-
* 命令式单例特性——须在首条通知前调用方对挂载点生效。向后兼容:不调用即 ltr + body。
|
|
151
|
-
*/
|
|
152
|
-
config: (cfg: NotificationConfig): void => {
|
|
153
|
-
if (cfg.direction !== undefined) globalDirection = cfg.direction;
|
|
154
|
-
if ('getPopupContainer' in cfg) getPopupContainer = cfg.getPopupContainer;
|
|
155
|
-
if (cfg.duration !== undefined) globalDuration = cfg.duration;
|
|
156
|
-
const next: PositionOffsets = {};
|
|
157
|
-
if (cfg.top !== undefined) next.top = cfg.top;
|
|
158
|
-
if (cfg.bottom !== undefined) next.bottom = cfg.bottom;
|
|
159
|
-
if (cfg.left !== undefined) next.left = cfg.left;
|
|
160
|
-
if (cfg.right !== undefined) next.right = cfg.right;
|
|
161
|
-
if (cfg.zIndex !== undefined) next.zIndex = cfg.zIndex;
|
|
162
|
-
positionOffsets = next;
|
|
163
|
-
},
|
|
164
|
-
/** 完整选项打开一条通知,返回其 id。 */
|
|
165
|
-
open: (opts: SvelteNotificationOptions): string => {
|
|
166
|
-
void ensureContainer();
|
|
167
|
-
const { coreOpts, onCloseClick } = resolveOpts(opts);
|
|
168
|
-
const id = ensureStore().open(coreOpts);
|
|
169
|
-
if (onCloseClick) onCloseClickMap.set(id, onCloseClick);
|
|
170
|
-
return id;
|
|
171
|
-
},
|
|
172
|
-
success: (opts: SvelteNotificationOptions): string => show('success', opts),
|
|
173
|
-
info: (opts: SvelteNotificationOptions): string => show('info', opts),
|
|
174
|
-
warning: (opts: SvelteNotificationOptions): string => show('warning', opts),
|
|
175
|
-
error: (opts: SvelteNotificationOptions): string => show('error', opts),
|
|
176
|
-
/** 手动关闭指定通知。 */
|
|
177
|
-
close: (id: string): void => ensureStore().close(id, 'manual'),
|
|
178
|
-
/** 按同 id 更新一条通知(store.open 对已存在 id 走原地更新 + 重启定时器)。 */
|
|
179
|
-
update: (id: string, opts: SvelteNotificationOptions): string => {
|
|
180
|
-
void ensureContainer();
|
|
181
|
-
const merged: SvelteNotificationOptions = { ...opts };
|
|
182
|
-
(merged as NotificationOptions).id = id;
|
|
183
|
-
const { coreOpts, onCloseClick } = resolveOpts(merged);
|
|
184
|
-
const newId = ensureStore().open(coreOpts);
|
|
185
|
-
if (onCloseClick) onCloseClickMap.set(newId, onCloseClick);
|
|
186
|
-
return newId;
|
|
187
|
-
},
|
|
188
|
-
/** 清空全部通知,或仅清空指定方位。 */
|
|
189
|
-
destroyAll: (placement?: NotificationPlacement): void =>
|
|
190
|
-
ensureStore().destroyAll(placement),
|
|
191
|
-
};
|