@xihan-ui/vue 2.1.0 → 3.1.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/CHANGELOG.md +1394 -0
- package/README.md +1 -1
- package/dist/components/accordion/accordion.d.ts +6 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +4 -2
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.d.ts +9 -0
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +4 -0
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/anchor/anchor.d.ts +2 -2
- package/dist/components/anchor/anchor.d.ts.map +1 -1
- package/dist/components/anchor/anchor.js +2 -2
- package/dist/components/anchor/anchor.js.map +1 -1
- package/dist/components/anchor/use-anchor.d.ts +2 -2
- package/dist/components/anchor/use-anchor.js +3 -3
- package/dist/components/anchor/use-anchor.js.map +1 -1
- package/dist/components/approval/approval.d.ts +8 -1
- package/dist/components/approval/approval.d.ts.map +1 -1
- package/dist/components/approval/approval.js +10 -1
- package/dist/components/approval/approval.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +8 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +3 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/avatar/use-avatar.d.ts.map +1 -1
- package/dist/components/avatar/use-avatar.js +3 -1
- package/dist/components/avatar/use-avatar.js.map +1 -1
- package/dist/components/back-top/use-back-top.d.ts.map +1 -1
- package/dist/components/back-top/use-back-top.js +3 -1
- package/dist/components/back-top/use-back-top.js.map +1 -1
- package/dist/components/badge/badge.d.ts +22 -0
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +11 -2
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +11 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +28 -9
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/calendar-picker/calendar-picker.d.ts +16 -0
- package/dist/components/calendar-picker/calendar-picker.d.ts.map +1 -1
- package/dist/components/calendar-picker/calendar-picker.js +4 -0
- package/dist/components/calendar-picker/calendar-picker.js.map +1 -1
- package/dist/components/calendar-range-picker/calendar-range-picker.d.ts +16 -0
- package/dist/components/calendar-range-picker/calendar-range-picker.d.ts.map +1 -1
- package/dist/components/calendar-range-picker/calendar-range-picker.js +4 -0
- package/dist/components/calendar-range-picker/calendar-range-picker.js.map +1 -1
- package/dist/components/card/card.d.ts +37 -2
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +40 -2
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/carousel/carousel.d.ts +7 -1
- package/dist/components/carousel/carousel.d.ts.map +1 -1
- package/dist/components/carousel/carousel.js +1 -0
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/carousel/use-carousel.d.ts.map +1 -1
- package/dist/components/carousel/use-carousel.js +3 -1
- package/dist/components/carousel/use-carousel.js.map +1 -1
- package/dist/components/cartesian-chart/cartesian-chart.d.ts +262 -0
- package/dist/components/cartesian-chart/cartesian-chart.d.ts.map +1 -0
- package/dist/components/cartesian-chart/cartesian-chart.js +293 -0
- package/dist/components/cartesian-chart/cartesian-chart.js.map +1 -0
- package/dist/components/cartesian-chart/context.js +15 -0
- package/dist/components/cartesian-chart/context.js.map +1 -0
- package/dist/components/cartesian-chart/use-cartesian-chart.d.ts +21 -0
- package/dist/components/cartesian-chart/use-cartesian-chart.d.ts.map +1 -0
- package/dist/components/cartesian-chart/use-cartesian-chart.js +29 -0
- package/dist/components/cartesian-chart/use-cartesian-chart.js.map +1 -0
- package/dist/components/cascader/cascader.d.ts +66 -3
- package/dist/components/cascader/cascader.d.ts.map +1 -1
- package/dist/components/cascader/cascader.js +110 -8
- package/dist/components/cascader/cascader.js.map +1 -1
- package/dist/components/cascader/context.js +10 -1
- package/dist/components/cascader/context.js.map +1 -1
- package/dist/components/cascader/use-cascader.d.ts +2 -1
- package/dist/components/cascader/use-cascader.d.ts.map +1 -1
- package/dist/components/cascader/use-cascader.js +4 -1
- package/dist/components/cascader/use-cascader.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/checkbox-group/checkbox-group.d.ts +24 -3
- package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +48 -12
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/checkbox-group/use-checkbox-group.d.ts +6 -1
- package/dist/components/checkbox-group/use-checkbox-group.d.ts.map +1 -1
- package/dist/components/checkbox-group/use-checkbox-group.js +7 -3
- package/dist/components/checkbox-group/use-checkbox-group.js.map +1 -1
- package/dist/components/citation/citation.d.ts +211 -0
- package/dist/components/citation/citation.d.ts.map +1 -0
- package/dist/components/citation/citation.js +222 -0
- package/dist/components/citation/citation.js.map +1 -0
- package/dist/components/citation/context.d.ts +11 -0
- package/dist/components/citation/context.d.ts.map +1 -0
- package/dist/components/citation/context.js +24 -0
- package/dist/components/citation/context.js.map +1 -0
- package/dist/components/citation/use-citation.d.ts +19 -0
- package/dist/components/citation/use-citation.d.ts.map +1 -0
- package/dist/components/citation/use-citation.js +51 -0
- package/dist/components/citation/use-citation.js.map +1 -0
- package/dist/components/code-view/code-view.d.ts +21 -0
- package/dist/components/code-view/code-view.d.ts.map +1 -1
- package/dist/components/code-view/code-view.js +23 -4
- package/dist/components/code-view/code-view.js.map +1 -1
- package/dist/components/collapsible/collapsible.d.ts +6 -0
- package/dist/components/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/collapsible.js +4 -2
- package/dist/components/collapsible/collapsible.js.map +1 -1
- package/dist/components/color-field/color-field.d.ts +4 -2
- package/dist/components/color-field/color-field.d.ts.map +1 -1
- package/dist/components/color-field/color-field.js +4 -2
- package/dist/components/color-field/color-field.js.map +1 -1
- package/dist/components/color-picker/color-picker.d.ts +115 -10
- package/dist/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/components/color-picker/color-picker.js +119 -9
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/color-picker/context.js +10 -1
- package/dist/components/color-picker/context.js.map +1 -1
- package/dist/components/color-picker/use-color-picker.d.ts +3 -1
- package/dist/components/color-picker/use-color-picker.d.ts.map +1 -1
- package/dist/components/color-picker/use-color-picker.js +20 -4
- package/dist/components/color-picker/use-color-picker.js.map +1 -1
- package/dist/components/color-slider/color-slider.d.ts +2 -2
- package/dist/components/color-slider/color-slider.js +1 -1
- package/dist/components/color-slider/color-slider.js.map +1 -1
- package/dist/components/color-swatch-picker/color-swatch-picker.d.ts.map +1 -1
- package/dist/components/color-swatch-picker/color-swatch-picker.js +21 -4
- package/dist/components/color-swatch-picker/color-swatch-picker.js.map +1 -1
- package/dist/components/color-swatch-picker/use-color-swatch-picker.d.ts +6 -1
- package/dist/components/color-swatch-picker/use-color-swatch-picker.d.ts.map +1 -1
- package/dist/components/color-swatch-picker/use-color-swatch-picker.js +7 -3
- package/dist/components/color-swatch-picker/use-color-swatch-picker.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +51 -4
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +76 -6
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/combobox/context.js +10 -1
- package/dist/components/combobox/context.js.map +1 -1
- package/dist/components/command/command.d.ts +3 -3
- package/dist/components/command/command.js +2 -2
- package/dist/components/command/use-command.d.ts.map +1 -1
- package/dist/components/command/use-command.js +9 -30
- package/dist/components/command/use-command.js.map +1 -1
- package/dist/components/context-menu/context-menu.d.ts +58 -18
- package/dist/components/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu/context-menu.js +110 -47
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/context-menu/context.js +1 -1
- package/dist/components/context-menu/context.js.map +1 -1
- package/dist/components/context-menu/use-context-menu.d.ts +1 -1
- package/dist/components/context-menu/use-context-menu.d.ts.map +1 -1
- package/dist/components/context-menu/use-context-menu.js +4 -2
- package/dist/components/context-menu/use-context-menu.js.map +1 -1
- package/dist/components/date-field/date-field.d.ts +15 -3
- package/dist/components/date-field/date-field.d.ts.map +1 -1
- package/dist/components/date-field/date-field.js +7 -2
- package/dist/components/date-field/date-field.js.map +1 -1
- package/dist/components/date-picker/context.js +10 -1
- package/dist/components/date-picker/context.js.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +98 -3
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.js +91 -7
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.ts +103 -2
- package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +111 -6
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker/use-date-range-picker.d.ts +1 -1
- package/dist/components/date-range-picker/use-date-range-picker.js.map +1 -1
- package/dist/components/descriptions/descriptions.d.ts +38 -7
- package/dist/components/descriptions/descriptions.d.ts.map +1 -1
- package/dist/components/descriptions/descriptions.js +38 -4
- package/dist/components/descriptions/descriptions.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +17 -2
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +15 -2
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/use-dialog.d.ts.map +1 -1
- package/dist/components/dialog/use-dialog.js +9 -27
- package/dist/components/dialog/use-dialog.js.map +1 -1
- package/dist/components/diff-view/diff-view.d.ts +22 -2
- package/dist/components/diff-view/diff-view.d.ts.map +1 -1
- package/dist/components/diff-view/diff-view.js +37 -14
- package/dist/components/diff-view/diff-view.js.map +1 -1
- package/dist/components/diff-view/use-diff-view.d.ts +7 -2
- package/dist/components/diff-view/use-diff-view.d.ts.map +1 -1
- package/dist/components/diff-view/use-diff-view.js +12 -5
- package/dist/components/diff-view/use-diff-view.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +47 -2
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +28 -4
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/drawer/use-drawer.d.ts +1 -1
- package/dist/components/drawer/use-drawer.d.ts.map +1 -1
- package/dist/components/drawer/use-drawer.js +12 -29
- package/dist/components/drawer/use-drawer.js.map +1 -1
- package/dist/components/empty-state/empty-state.js +4 -1
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/empty-state/use-empty-state.js +12 -3
- package/dist/components/empty-state/use-empty-state.js.map +1 -1
- package/dist/components/field/context.d.ts +6 -1
- package/dist/components/field/context.d.ts.map +1 -1
- package/dist/components/field/context.js +10 -1
- package/dist/components/field/context.js.map +1 -1
- package/dist/components/field/field.d.ts +9 -1
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +14 -2
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/use-field-control.d.ts +8 -1
- package/dist/components/field/use-field-control.d.ts.map +1 -1
- package/dist/components/field/use-field-control.js +14 -1
- package/dist/components/field/use-field-control.js.map +1 -1
- package/dist/components/field-array/field-array.d.ts +1 -1
- package/dist/components/field-array/field-array.d.ts.map +1 -1
- package/dist/components/field-array/field-array.js +5 -1
- package/dist/components/field-array/field-array.js.map +1 -1
- package/dist/components/field-array/use-field-array.d.ts +3 -1
- package/dist/components/field-array/use-field-array.d.ts.map +1 -1
- package/dist/components/field-array/use-field-array.js +5 -2
- package/dist/components/field-array/use-field-array.js.map +1 -1
- package/dist/components/file-upload/file-upload.d.ts +26 -1
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/file-upload.js +15 -3
- package/dist/components/file-upload/file-upload.js.map +1 -1
- package/dist/components/file-upload/use-file-upload.d.ts +1 -1
- package/dist/components/file-upload/use-file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/use-file-upload.js.map +1 -1
- package/dist/components/flex/flex.d.ts +1 -1
- package/dist/components/flex/flex.d.ts.map +1 -1
- package/dist/components/flex/flex.js +4 -4
- package/dist/components/flex/flex.js.map +1 -1
- package/dist/components/float-button/float-button.d.ts +26 -1
- package/dist/components/float-button/float-button.d.ts.map +1 -1
- package/dist/components/float-button/float-button.js +17 -5
- package/dist/components/float-button/float-button.js.map +1 -1
- package/dist/components/float-button/use-float-button.js +7 -1
- package/dist/components/float-button/use-float-button.js.map +1 -1
- package/dist/components/form/context.js +5 -1
- package/dist/components/form/context.js.map +1 -1
- package/dist/components/form/form.d.ts +18 -4
- package/dist/components/form/form.d.ts.map +1 -1
- package/dist/components/form/form.js +21 -7
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/use-form-control.js +1 -1
- package/dist/components/form/use-form.d.ts +6 -0
- package/dist/components/form/use-form.d.ts.map +1 -1
- package/dist/components/form/use-form.js +4 -0
- package/dist/components/form/use-form.js.map +1 -1
- package/dist/components/funnel-chart/context.js +15 -0
- package/dist/components/funnel-chart/context.js.map +1 -0
- package/dist/components/funnel-chart/funnel-chart.d.ts +175 -0
- package/dist/components/funnel-chart/funnel-chart.d.ts.map +1 -0
- package/dist/components/funnel-chart/funnel-chart.js +188 -0
- package/dist/components/funnel-chart/funnel-chart.js.map +1 -0
- package/dist/components/funnel-chart/use-funnel-chart.d.ts +19 -0
- package/dist/components/funnel-chart/use-funnel-chart.d.ts.map +1 -0
- package/dist/components/funnel-chart/use-funnel-chart.js +26 -0
- package/dist/components/funnel-chart/use-funnel-chart.js.map +1 -0
- package/dist/components/graph-chart/context.js +15 -0
- package/dist/components/graph-chart/context.js.map +1 -0
- package/dist/components/graph-chart/graph-chart.d.ts +194 -0
- package/dist/components/graph-chart/graph-chart.d.ts.map +1 -0
- package/dist/components/graph-chart/graph-chart.js +219 -0
- package/dist/components/graph-chart/graph-chart.js.map +1 -0
- package/dist/components/graph-chart/use-graph-chart.d.ts +19 -0
- package/dist/components/graph-chart/use-graph-chart.d.ts.map +1 -0
- package/dist/components/graph-chart/use-graph-chart.js +26 -0
- package/dist/components/graph-chart/use-graph-chart.js.map +1 -0
- package/dist/components/grid/grid.d.ts +7 -0
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/grid.js +7 -1
- package/dist/components/grid/grid.js.map +1 -1
- package/dist/components/grid-list/context.d.ts +9 -0
- package/dist/components/grid-list/context.d.ts.map +1 -0
- package/dist/components/grid-list/context.js +24 -0
- package/dist/components/grid-list/context.js.map +1 -0
- package/dist/components/grid-list/grid-list.d.ts +149 -0
- package/dist/components/grid-list/grid-list.d.ts.map +1 -0
- package/dist/components/grid-list/grid-list.js +118 -0
- package/dist/components/grid-list/grid-list.js.map +1 -0
- package/dist/components/grid-list/use-grid-list.d.ts +12 -0
- package/dist/components/grid-list/use-grid-list.d.ts.map +1 -0
- package/dist/components/grid-list/use-grid-list.js +20 -0
- package/dist/components/grid-list/use-grid-list.js.map +1 -0
- package/dist/components/heatmap/heatmap.d.ts +45 -4
- package/dist/components/heatmap/heatmap.d.ts.map +1 -1
- package/dist/components/heatmap/heatmap.js +40 -14
- package/dist/components/heatmap/heatmap.js.map +1 -1
- package/dist/components/heatmap/use-heatmap.d.ts +4 -2
- package/dist/components/heatmap/use-heatmap.d.ts.map +1 -1
- package/dist/components/heatmap/use-heatmap.js +8 -4
- package/dist/components/heatmap/use-heatmap.js.map +1 -1
- package/dist/components/hierarchy-chart/context.js +15 -0
- package/dist/components/hierarchy-chart/context.js.map +1 -0
- package/dist/components/hierarchy-chart/hierarchy-chart.d.ts +201 -0
- package/dist/components/hierarchy-chart/hierarchy-chart.d.ts.map +1 -0
- package/dist/components/hierarchy-chart/hierarchy-chart.js +228 -0
- package/dist/components/hierarchy-chart/hierarchy-chart.js.map +1 -0
- package/dist/components/hierarchy-chart/use-hierarchy-chart.d.ts +19 -0
- package/dist/components/hierarchy-chart/use-hierarchy-chart.d.ts.map +1 -0
- package/dist/components/hierarchy-chart/use-hierarchy-chart.js +26 -0
- package/dist/components/hierarchy-chart/use-hierarchy-chart.js.map +1 -0
- package/dist/components/hover-card/hover-card.js +2 -2
- package/dist/components/icon/icon.d.ts +7 -1
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +1 -0
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/image/use-image.d.ts.map +1 -1
- package/dist/components/image/use-image.js +3 -1
- package/dist/components/image/use-image.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.d.ts +35 -4
- package/dist/components/image-cropper/image-cropper.d.ts.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +34 -5
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/components/image-cropper/use-image-cropper.d.ts +3 -1
- package/dist/components/image-cropper/use-image-cropper.d.ts.map +1 -1
- package/dist/components/image-cropper/use-image-cropper.js +4 -1
- package/dist/components/image-cropper/use-image-cropper.js.map +1 -1
- package/dist/components/image-viewer/image-viewer.js +1 -1
- package/dist/components/image-viewer/use-image-viewer.d.ts.map +1 -1
- package/dist/components/image-viewer/use-image-viewer.js +9 -27
- package/dist/components/image-viewer/use-image-viewer.js.map +1 -1
- package/dist/components/infinite-scroll/infinite-scroll.d.ts +9 -1
- package/dist/components/infinite-scroll/infinite-scroll.d.ts.map +1 -1
- package/dist/components/infinite-scroll/infinite-scroll.js +2 -0
- package/dist/components/infinite-scroll/infinite-scroll.js.map +1 -1
- package/dist/components/json-viewer/json-viewer.d.ts +17 -2
- package/dist/components/json-viewer/json-viewer.d.ts.map +1 -1
- package/dist/components/json-viewer/json-viewer.js +26 -8
- package/dist/components/json-viewer/json-viewer.js.map +1 -1
- package/dist/components/listbox/listbox.d.ts +7 -1
- package/dist/components/listbox/listbox.d.ts.map +1 -1
- package/dist/components/listbox/listbox.js +2 -0
- package/dist/components/listbox/listbox.js.map +1 -1
- package/dist/components/loading-bar/use-loading-bar.d.ts.map +1 -1
- package/dist/components/loading-bar/use-loading-bar.js +3 -1
- package/dist/components/loading-bar/use-loading-bar.js.map +1 -1
- package/dist/components/log/log.d.ts +41 -2
- package/dist/components/log/log.d.ts.map +1 -1
- package/dist/components/log/log.js +25 -3
- package/dist/components/log/log.js.map +1 -1
- package/dist/components/log/use-log.d.ts +1 -1
- package/dist/components/log/use-log.d.ts.map +1 -1
- package/dist/components/log/use-log.js +4 -1
- package/dist/components/log/use-log.js.map +1 -1
- package/dist/components/markdown-stream/markdown-stream.d.ts +21 -1
- package/dist/components/markdown-stream/markdown-stream.d.ts.map +1 -1
- package/dist/components/markdown-stream/markdown-stream.js +43 -4
- package/dist/components/markdown-stream/markdown-stream.js.map +1 -1
- package/dist/components/marquee/marquee.d.ts +68 -12
- package/dist/components/marquee/marquee.d.ts.map +1 -1
- package/dist/components/marquee/marquee.js +52 -7
- package/dist/components/marquee/marquee.js.map +1 -1
- package/dist/components/mention/mention.d.ts +26 -6
- package/dist/components/mention/mention.d.ts.map +1 -1
- package/dist/components/mention/mention.js +14 -4
- package/dist/components/mention/mention.js.map +1 -1
- package/dist/components/menu/context.js +1 -1
- package/dist/components/menu/context.js.map +1 -1
- package/dist/components/menu/menu.d.ts +79 -28
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/menu/menu.js +132 -51
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/menu/use-menu.d.ts +1 -1
- package/dist/components/menu/use-menu.d.ts.map +1 -1
- package/dist/components/menu/use-menu.js +8 -6
- package/dist/components/menu/use-menu.js.map +1 -1
- package/dist/components/menubar/context.js +1 -1
- package/dist/components/menubar/context.js.map +1 -1
- package/dist/components/menubar/menubar.d.ts +47 -18
- package/dist/components/menubar/menubar.d.ts.map +1 -1
- package/dist/components/menubar/menubar.js +109 -47
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/menubar/use-menubar.d.ts +1 -1
- package/dist/components/menubar/use-menubar.d.ts.map +1 -1
- package/dist/components/menubar/use-menubar.js +4 -2
- package/dist/components/menubar/use-menubar.js.map +1 -1
- package/dist/components/message-feed/message-feed.d.ts +13 -1
- package/dist/components/message-feed/message-feed.d.ts.map +1 -1
- package/dist/components/message-feed/message-feed.js +25 -1
- package/dist/components/message-feed/message-feed.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts +58 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js +82 -10
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/notification/context.d.ts +5 -1
- package/dist/components/notification/context.d.ts.map +1 -1
- package/dist/components/notification/context.js.map +1 -1
- package/dist/components/notification/notification.d.ts +39 -23
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/notification/notification.js +27 -9
- package/dist/components/notification/notification.js.map +1 -1
- package/dist/components/notification/use-item-exit.js +22 -0
- package/dist/components/notification/use-item-exit.js.map +1 -0
- package/dist/components/notification/use-notification.d.ts +3 -3
- package/dist/components/notification/use-notification.d.ts.map +1 -1
- package/dist/components/notification/use-notification.js +20 -5
- package/dist/components/notification/use-notification.js.map +1 -1
- package/dist/components/number-animation/number-animation.d.ts +14 -2
- package/dist/components/number-animation/number-animation.d.ts.map +1 -1
- package/dist/components/number-animation/number-animation.js +5 -1
- package/dist/components/number-animation/number-animation.js.map +1 -1
- package/dist/components/number-field/number-field.d.ts +16 -1
- package/dist/components/number-field/number-field.d.ts.map +1 -1
- package/dist/components/number-field/number-field.js +6 -0
- package/dist/components/number-field/number-field.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +22 -2
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +22 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/pagination/use-pagination.js +1 -0
- package/dist/components/pagination/use-pagination.js.map +1 -1
- package/dist/components/pie-chart/context.js +15 -0
- package/dist/components/pie-chart/context.js.map +1 -0
- package/dist/components/pie-chart/pie-chart.d.ts +203 -0
- package/dist/components/pie-chart/pie-chart.d.ts.map +1 -0
- package/dist/components/pie-chart/pie-chart.js +236 -0
- package/dist/components/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/pie-chart/use-pie-chart.d.ts +19 -0
- package/dist/components/pie-chart/use-pie-chart.d.ts.map +1 -0
- package/dist/components/pie-chart/use-pie-chart.js +26 -0
- package/dist/components/pie-chart/use-pie-chart.js.map +1 -0
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/pin-input/pin-input.js +7 -1
- package/dist/components/pin-input/pin-input.js.map +1 -1
- package/dist/components/popconfirm/popconfirm.d.ts +20 -1
- package/dist/components/popconfirm/popconfirm.d.ts.map +1 -1
- package/dist/components/popconfirm/popconfirm.js +9 -2
- package/dist/components/popconfirm/popconfirm.js.map +1 -1
- package/dist/components/popconfirm/use-popconfirm.js +2 -0
- package/dist/components/popconfirm/use-popconfirm.js.map +1 -1
- package/dist/components/popover/popover.d.ts +12 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +7 -2
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.d.ts +63 -3
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +55 -3
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/question-flow/question-flow.d.ts +40 -1
- package/dist/components/question-flow/question-flow.d.ts.map +1 -1
- package/dist/components/question-flow/question-flow.js +37 -1
- package/dist/components/question-flow/question-flow.js.map +1 -1
- package/dist/components/radar-chart/context.js +15 -0
- package/dist/components/radar-chart/context.js.map +1 -0
- package/dist/components/radar-chart/radar-chart.d.ts +189 -0
- package/dist/components/radar-chart/radar-chart.d.ts.map +1 -0
- package/dist/components/radar-chart/radar-chart.js +220 -0
- package/dist/components/radar-chart/radar-chart.js.map +1 -0
- package/dist/components/radar-chart/use-radar-chart.d.ts +19 -0
- package/dist/components/radar-chart/use-radar-chart.d.ts.map +1 -0
- package/dist/components/radar-chart/use-radar-chart.js +26 -0
- package/dist/components/radar-chart/use-radar-chart.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +37 -2
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +74 -9
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/radio-group/use-radio-group.d.ts +8 -1
- package/dist/components/radio-group/use-radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/use-radio-group.js +10 -3
- package/dist/components/radio-group/use-radio-group.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/rating/rating.js +7 -1
- package/dist/components/rating/rating.js.map +1 -1
- package/dist/components/reasoning/reasoning.d.ts.map +1 -1
- package/dist/components/reasoning/reasoning.js +1 -0
- package/dist/components/reasoning/reasoning.js.map +1 -1
- package/dist/components/sankey-chart/context.js +15 -0
- package/dist/components/sankey-chart/context.js.map +1 -0
- package/dist/components/sankey-chart/sankey-chart.d.ts +161 -0
- package/dist/components/sankey-chart/sankey-chart.d.ts.map +1 -0
- package/dist/components/sankey-chart/sankey-chart.js +208 -0
- package/dist/components/sankey-chart/sankey-chart.js.map +1 -0
- package/dist/components/sankey-chart/use-sankey-chart.d.ts +19 -0
- package/dist/components/sankey-chart/use-sankey-chart.d.ts.map +1 -0
- package/dist/components/sankey-chart/use-sankey-chart.js +26 -0
- package/dist/components/sankey-chart/use-sankey-chart.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +13 -5
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +17 -3
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/select/select.d.ts +9 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +16 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/use-select.js +2 -1
- package/dist/components/select/use-select.js.map +1 -1
- package/dist/components/side-nav/context.js +17 -1
- package/dist/components/side-nav/context.js.map +1 -1
- package/dist/components/side-nav/side-nav.d.ts +51 -7
- package/dist/components/side-nav/side-nav.d.ts.map +1 -1
- package/dist/components/side-nav/side-nav.js +152 -13
- package/dist/components/side-nav/side-nav.js.map +1 -1
- package/dist/components/side-nav/use-side-nav.d.ts +4 -2
- package/dist/components/side-nav/use-side-nav.d.ts.map +1 -1
- package/dist/components/side-nav/use-side-nav.js +5 -3
- package/dist/components/side-nav/use-side-nav.js.map +1 -1
- package/dist/components/signature-pad/signature-pad.d.ts +28 -4
- package/dist/components/signature-pad/signature-pad.d.ts.map +1 -1
- package/dist/components/signature-pad/signature-pad.js +35 -5
- package/dist/components/signature-pad/signature-pad.js.map +1 -1
- package/dist/components/signature-pad/use-signature-pad.d.ts +1 -1
- package/dist/components/signature-pad/use-signature-pad.d.ts.map +1 -1
- package/dist/components/signature-pad/use-signature-pad.js.map +1 -1
- package/dist/components/skeleton/use-skeleton.js +6 -2
- package/dist/components/skeleton/use-skeleton.js.map +1 -1
- package/dist/components/slider/slider.d.ts +27 -0
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +19 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/sortable/sortable.d.ts +18 -0
- package/dist/components/sortable/sortable.d.ts.map +1 -1
- package/dist/components/sortable/sortable.js +7 -2
- package/dist/components/sortable/sortable.js.map +1 -1
- package/dist/components/sortable/use-sortable.d.ts +1 -1
- package/dist/components/sortable/use-sortable.d.ts.map +1 -1
- package/dist/components/sortable/use-sortable.js +2 -1
- package/dist/components/sortable/use-sortable.js.map +1 -1
- package/dist/components/sparkline/sparkline.d.ts +101 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -0
- package/dist/components/sparkline/sparkline.js +54 -0
- package/dist/components/sparkline/sparkline.js.map +1 -0
- package/dist/components/sparkline/use-sparkline.d.ts +15 -0
- package/dist/components/sparkline/use-sparkline.d.ts.map +1 -0
- package/dist/components/sparkline/use-sparkline.js +21 -0
- package/dist/components/sparkline/use-sparkline.js.map +1 -0
- package/dist/components/spinner/spinner.d.ts +8 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +2 -0
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/spinner/use-spinner.js +4 -2
- package/dist/components/spinner/use-spinner.js.map +1 -1
- package/dist/components/steps/steps.d.ts +28 -1
- package/dist/components/steps/steps.d.ts.map +1 -1
- package/dist/components/steps/steps.js +11 -2
- package/dist/components/steps/steps.js.map +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table/context.js +9 -1
- package/dist/components/table/context.js.map +1 -1
- package/dist/components/table/table.d.ts +52 -3
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +40 -11
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/table/use-table.d.ts +3 -1
- package/dist/components/table/use-table.d.ts.map +1 -1
- package/dist/components/table/use-table.js +5 -2
- package/dist/components/table/use-table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +51 -3
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +60 -8
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tag/use-tag.d.ts.map +1 -1
- package/dist/components/tag/use-tag.js +3 -1
- package/dist/components/tag/use-tag.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +12 -2
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/tags-input/tags-input.js +14 -5
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/tags-input/use-tags-input.d.ts +4 -2
- package/dist/components/tags-input/use-tags-input.d.ts.map +1 -1
- package/dist/components/tags-input/use-tags-input.js +5 -2
- package/dist/components/tags-input/use-tags-input.js.map +1 -1
- package/dist/components/text-field/text-field.d.ts +2 -0
- package/dist/components/text-field/text-field.d.ts.map +1 -1
- package/dist/components/text-field/text-field.js +3 -1
- package/dist/components/text-field/text-field.js.map +1 -1
- package/dist/components/time-field/time-field.d.ts +2 -0
- package/dist/components/time-field/time-field.d.ts.map +1 -1
- package/dist/components/time-field/time-field.js +3 -1
- package/dist/components/time-field/time-field.js.map +1 -1
- package/dist/components/time-picker/context.js +10 -1
- package/dist/components/time-picker/context.js.map +1 -1
- package/dist/components/time-picker/time-picker.d.ts +88 -15
- package/dist/components/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/time-picker/time-picker.js +92 -9
- package/dist/components/time-picker/time-picker.js.map +1 -1
- package/dist/components/time-range-picker/time-range-picker.d.ts +13 -7
- package/dist/components/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/components/time-range-picker/time-range-picker.js +7 -3
- package/dist/components/time-range-picker/time-range-picker.js.map +1 -1
- package/dist/components/timer/timer.d.ts +1 -1
- package/dist/components/timestamp/timestamp.d.ts +20 -1
- package/dist/components/timestamp/timestamp.d.ts.map +1 -1
- package/dist/components/timestamp/timestamp.js +16 -5
- package/dist/components/timestamp/timestamp.js.map +1 -1
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group/toggle-group.js +7 -1
- package/dist/components/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/toolbar/toolbar.d.ts +17 -2
- package/dist/components/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/toolbar/toolbar.js +31 -4
- package/dist/components/toolbar/toolbar.js.map +1 -1
- package/dist/components/toolbar/use-toolbar.d.ts +4 -2
- package/dist/components/toolbar/use-toolbar.d.ts.map +1 -1
- package/dist/components/toolbar/use-toolbar.js +5 -2
- package/dist/components/toolbar/use-toolbar.js.map +1 -1
- package/dist/components/tooltip/context.d.ts +21 -0
- package/dist/components/tooltip/context.d.ts.map +1 -0
- package/dist/components/tooltip/context.js +10 -1
- package/dist/components/tooltip/context.js.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +53 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +34 -3
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/tooltip/use-tooltip.d.ts +3 -18
- package/dist/components/tooltip/use-tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/use-tooltip.js +2 -0
- package/dist/components/tooltip/use-tooltip.js.map +1 -1
- package/dist/components/tour/tour.d.ts +8 -0
- package/dist/components/tour/tour.d.ts.map +1 -1
- package/dist/components/tour/tour.js +2 -0
- package/dist/components/tour/tour.js.map +1 -1
- package/dist/components/transfer/transfer.d.ts +21 -1
- package/dist/components/transfer/transfer.d.ts.map +1 -1
- package/dist/components/transfer/transfer.js +10 -2
- package/dist/components/transfer/transfer.js.map +1 -1
- package/dist/components/tree/tree.d.ts +34 -1
- package/dist/components/tree/tree.d.ts.map +1 -1
- package/dist/components/tree/tree.js +11 -0
- package/dist/components/tree/tree.js.map +1 -1
- package/dist/components/tree-select/context.js +10 -1
- package/dist/components/tree-select/context.js.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +72 -6
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.js +112 -13
- package/dist/components/tree-select/tree-select.js.map +1 -1
- package/dist/components/tree-select/use-tree-select.d.ts +3 -0
- package/dist/components/tree-select/use-tree-select.d.ts.map +1 -1
- package/dist/components/tree-select/use-tree-select.js +6 -1
- package/dist/components/tree-select/use-tree-select.js.map +1 -1
- package/dist/components/truncate/truncate.d.ts +25 -4
- package/dist/components/truncate/truncate.d.ts.map +1 -1
- package/dist/components/truncate/truncate.js +25 -14
- package/dist/components/truncate/truncate.js.map +1 -1
- package/dist/components/truncate/use-truncate.d.ts.map +1 -1
- package/dist/components/truncate/use-truncate.js +3 -1
- package/dist/components/truncate/use-truncate.js.map +1 -1
- package/dist/components/typography/typography.d.ts +35 -2
- package/dist/components/typography/typography.d.ts.map +1 -1
- package/dist/components/typography/typography.js +21 -3
- package/dist/components/typography/typography.js.map +1 -1
- package/dist/components/virtualizer/virtualizer.d.ts +26 -2
- package/dist/components/virtualizer/virtualizer.d.ts.map +1 -1
- package/dist/components/virtualizer/virtualizer.js +20 -3
- package/dist/components/virtualizer/virtualizer.js.map +1 -1
- package/dist/components/watermark/watermark.d.ts +14 -1
- package/dist/components/watermark/watermark.d.ts.map +1 -1
- package/dist/components/watermark/watermark.js +20 -5
- package/dist/components/watermark/watermark.js.map +1 -1
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +2 -1
- package/dist/config/config.js.map +1 -1
- package/dist/index.d.ts +64 -49
- package/dist/index.js +58 -43
- package/dist/package.js +1 -1
- package/dist/runtime/as-child.js +3 -2
- package/dist/runtime/as-child.js.map +1 -1
- package/dist/runtime/hydration.js +14 -0
- package/dist/runtime/hydration.js.map +1 -0
- package/dist/runtime/portal.js +2 -0
- package/dist/runtime/portal.js.map +1 -1
- package/dist/runtime/use-overlay-exit.js +0 -1
- package/dist/runtime/use-overlay-exit.js.map +1 -1
- package/dist/runtime/with-handlers.js +25 -0
- package/dist/runtime/with-handlers.js.map +1 -0
- package/dist/services/notification-service.d.ts +26 -7
- package/dist/services/notification-service.d.ts.map +1 -1
- package/dist/services/notification-service.js +35 -8
- package/dist/services/notification-service.js.map +1 -1
- package/dist/sound.d.ts +6 -7
- package/dist/sound.d.ts.map +1 -1
- package/dist/sound.js +6 -6
- package/dist/sound.js.map +1 -1
- package/package.json +15 -14
- package/dist/components/gradient-text/gradient-text.d.ts +0 -36
- package/dist/components/gradient-text/gradient-text.d.ts.map +0 -1
- package/dist/components/gradient-text/gradient-text.js +0 -20
- package/dist/components/gradient-text/gradient-text.js.map +0 -1
- package/dist/components/icon-wrapper/icon-wrapper.d.ts +0 -29
- package/dist/components/icon-wrapper/icon-wrapper.d.ts.map +0 -1
- package/dist/components/icon-wrapper/icon-wrapper.js +0 -20
- package/dist/components/icon-wrapper/icon-wrapper.js.map +0 -1
- package/dist/components/segmented/context.d.ts +0 -13
- package/dist/components/segmented/context.d.ts.map +0 -1
- package/dist/components/segmented/context.js +0 -24
- package/dist/components/segmented/context.js.map +0 -1
- package/dist/components/segmented/segmented.d.ts +0 -161
- package/dist/components/segmented/segmented.d.ts.map +0 -1
- package/dist/components/segmented/segmented.js +0 -142
- package/dist/components/segmented/segmented.js.map +0 -1
- package/dist/components/segmented/use-segmented.d.ts +0 -15
- package/dist/components/segmented/use-segmented.d.ts.map +0 -1
- package/dist/components/segmented/use-segmented.js +0 -22
- package/dist/components/segmented/use-segmented.js.map +0 -1
- package/dist/components/toast/context.js +0 -15
- package/dist/components/toast/context.js.map +0 -1
- package/dist/components/toast/toast.d.ts +0 -123
- package/dist/components/toast/toast.d.ts.map +0 -1
- package/dist/components/toast/toast.js +0 -112
- package/dist/components/toast/toast.js.map +0 -1
- package/dist/components/toast/use-toast.d.ts +0 -10
- package/dist/components/toast/use-toast.d.ts.map +0 -1
- package/dist/components/toast/use-toast.js +0 -17
- package/dist/components/toast/use-toast.js.map +0 -1
- package/dist/services/toast-service.d.ts +0 -69
- package/dist/services/toast-service.d.ts.map +0 -1
- package/dist/services/toast-service.js +0 -161
- package/dist/services/toast-service.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-overlay-exit.js","names":[],"sources":["../../src/runtime/use-overlay-exit.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 提供 use overlay exit 相关实现。\n\nimport type { RuntimeConfig } from '@xihan-ui/core'\nimport type { PresenceHandle } from '@xihan-ui/core/presence'\nimport type { MaybeRefOrGetter, Ref } from 'vue'\nimport { attachCssExit, createPresence } from '@xihan-ui/core/presence'\nimport { getCurrentInstance, isRef, onBeforeUnmount, onMounted, ref, toValue, watch } from 'vue'\n\n// 退场闸门:把「几时真的收起浮层」从展开态挪到 presence 上。\n//\n// 连接层给 content 打的 `hidden` 是跟着 open 走的——收起那一帧节点就不生成盒子了,\n// 退场动画一帧都播不出来。这里把它改成跟着 presence 走:展开时可见、退场动画播完之前\n// 也可见,播完才真收。作者节点始终留在原地,被拉长的是「可见的时间」而不是「存在的时间」。\n//\n// dialog / drawer
|
|
1
|
+
{"version":3,"file":"use-overlay-exit.js","names":[],"sources":["../../src/runtime/use-overlay-exit.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 提供 use overlay exit 相关实现。\n\nimport type { RuntimeConfig } from '@xihan-ui/core'\nimport type { PresenceHandle } from '@xihan-ui/core/presence'\nimport type { MaybeRefOrGetter, Ref } from 'vue'\nimport { attachCssExit, createPresence } from '@xihan-ui/core/presence'\nimport { getCurrentInstance, isRef, onBeforeUnmount, onMounted, ref, toValue, watch } from 'vue'\n\n// 退场闸门:把「几时真的收起浮层」从展开态挪到 presence 上。\n//\n// 连接层给 content 打的 `hidden` 是跟着 open 走的——收起那一帧节点就不生成盒子了,\n// 退场动画一帧都播不出来。这里把它改成跟着 presence 走:展开时可见、退场动画播完之前\n// 也可见,播完才真收。作者节点始终留在原地,被拉长的是「可见的时间」而不是「存在的时间」。\n//\n// 所有带退场的部件共用这一件:dialog / drawer / command / image-viewer 的遮罩经 additionalExitRefs\n// 一并计入,轻提示与通知卡片也经它把 Presence 交给机器。\n\nexport interface OverlayExitOptions {\n /**\n * 运行时配置,只用来区分有没有 DOM:服务端没有退场可言,传 null 即退化为可见与否跟随展开态。\n * 客户端必须等真实根节点才能确定 realm 时传 ref/getter;挂载后仍为空会明确失败。\n */\n config: MaybeRefOrGetter<RuntimeConfig | null>\n /** 当前逻辑上是否展开。 */\n isOpen: () => boolean\n /** content 节点,退场动画从它上面探测。 */\n contentRef: Ref<HTMLElement | null>\n /** 与 content 共同决定退出完成的其他真实视觉节点。 */\n additionalExitRefs?: Array<Ref<HTMLElement | null>>\n /** Presence 建立后交给需要共用退出生命周期的 Headless 状态机;卸载时回传 null。 */\n onPresence?: (presence: PresenceHandle | null) => void\n}\n\n/**\n * 返回当前是否应当可见。作者把它覆盖到 content 的 `hidden` 上:\n * `{ ...api.getContentProps(), hidden: !visible.value || undefined }`。\n */\nexport function useOverlayExit(options: OverlayExitOptions): Ref<boolean> {\n const { isOpen, contentRef } = options\n const visible = ref(isOpen())\n let presence: PresenceHandle | null = null\n const tracked = new Map<HTMLElement, () => void>()\n let stopOpen: (() => void) | undefined\n let stopContent: (() => void) | undefined\n\n const start = (config: RuntimeConfig | null): void => {\n if (!config) {\n stopOpen = watch(isOpen, (open) => {\n visible.value = open\n })\n return\n }\n\n presence = createPresence({\n open: isOpen(),\n onRenderedChange: (rendered) => {\n visible.value = rendered\n },\n })\n options.onPresence?.(presence)\n visible.value = presence.rendered\n\n // data-state 提交到 DOM 之后再驱动 presence,让退场探测读到正确的 animationName\n stopOpen = watch(isOpen, open => presence?.update(open), { flush: 'post' })\n\n // 延迟配置到挂载期才就绪时 content 已经存在,immediate 负责补上首次 attach。\n stopContent = watch([contentRef, ...(options.additionalExitRefs ?? [])], (nodes) => {\n const next = new Set(nodes.filter((node): node is HTMLElement => node !== null))\n for (const node of next) {\n if (!tracked.has(node))\n tracked.set(node, attachCssExit(node, presence!))\n }\n for (const [node, detach] of tracked) {\n if (!next.has(node)) {\n tracked.delete(node)\n detach()\n }\n }\n }, { flush: 'post', immediate: true })\n }\n\n const initial = toValue(options.config)\n const delayed = isRef(options.config) || typeof options.config === 'function'\n if (initial || !delayed) {\n start(initial)\n }\n else if (getCurrentInstance()) {\n onMounted(() => {\n const config = toValue(options.config)\n if (!config)\n throw new Error('[xh] useOverlayExit 的延迟 RuntimeConfig 在挂载后仍未就绪')\n start(config)\n })\n }\n else {\n throw new Error('[xh] useOverlayExit 的延迟 RuntimeConfig 只能在 Vue setup 生命周期内使用')\n }\n\n onBeforeUnmount(() => {\n stopOpen?.()\n stopContent?.()\n for (const detach of tracked.values()) detach()\n tracked.clear()\n presence?.dispose()\n options.onPresence?.(null)\n })\n\n return visible\n}\n"],"mappings":";;;;;;;AA0CA,SAAgB,eAAe,SAA2C;CACxE,MAAM,EAAE,QAAQ,eAAe;CAC/B,MAAM,UAAU,IAAI,OAAO,CAAC;CAC5B,IAAI,WAAkC;CACtC,MAAM,0BAAU,IAAI,IAA6B;CACjD,IAAI;CACJ,IAAI;CAEJ,MAAM,SAAS,WAAuC;EACpD,IAAI,CAAC,QAAQ;GACX,WAAW,MAAM,SAAS,SAAS;IACjC,QAAQ,QAAQ;GAClB,CAAC;GACD;EACF;EAEA,WAAW,eAAe;GACxB,MAAM,OAAO;GACb,mBAAmB,aAAa;IAC9B,QAAQ,QAAQ;GAClB;EACF,CAAC;EACD,QAAQ,aAAa,QAAQ;EAC7B,QAAQ,QAAQ,SAAS;EAGzB,WAAW,MAAM,SAAQ,SAAQ,UAAU,OAAO,IAAI,GAAG,EAAE,OAAO,OAAO,CAAC;EAG1E,cAAc,MAAM,CAAC,YAAY,GAAI,QAAQ,sBAAsB,CAAC,CAAE,IAAI,UAAU;GAClF,MAAM,OAAO,IAAI,IAAI,MAAM,QAAQ,SAA8B,SAAS,IAAI,CAAC;GAC/E,KAAK,MAAM,QAAQ,MACjB,IAAI,CAAC,QAAQ,IAAI,IAAI,GACnB,QAAQ,IAAI,MAAM,cAAc,MAAM,QAAS,CAAC;GAEpD,KAAK,MAAM,CAAC,MAAM,WAAW,SAC3B,IAAI,CAAC,KAAK,IAAI,IAAI,GAAG;IACnB,QAAQ,OAAO,IAAI;IACnB,OAAO;GACT;EAEJ,GAAG;GAAE,OAAO;GAAQ,WAAW;EAAK,CAAC;CACvC;CAEA,MAAM,UAAU,QAAQ,QAAQ,MAAM;CACtC,MAAM,UAAU,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,WAAW;CACnE,IAAI,WAAW,CAAC,SACd,MAAM,OAAO;MAEV,IAAI,mBAAmB,GAC1B,gBAAgB;EACd,MAAM,SAAS,QAAQ,QAAQ,MAAM;EACrC,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,gDAAgD;EAClE,MAAM,MAAM;CACd,CAAC;MAGD,MAAM,IAAI,MAAM,6DAA6D;CAG/E,sBAAsB;EACpB,WAAW;EACX,cAAc;EACd,KAAK,MAAM,UAAU,QAAQ,OAAO,GAAG,OAAO;EAC9C,QAAQ,MAAM;EACd,UAAU,QAAQ;EAClB,QAAQ,aAAa,IAAI;CAC3B,CAAC;CAED,OAAO;AACT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/runtime/with-handlers.ts
|
|
2
|
+
/**
|
|
3
|
+
* 组件把 emit 翻成 headless 认的回调(`onClear: () => emit('clear')`),并进交给状态机的 props。
|
|
4
|
+
*
|
|
5
|
+
* props 是响应式代理,展开成新对象会丢掉响应;这里再包一层代理:读回调键给回调,
|
|
6
|
+
* 其余照旧穿透到原 props,展开(`{ ...props }`)时回调键也一并列出。
|
|
7
|
+
*/
|
|
8
|
+
function withHandlers(props, handlers) {
|
|
9
|
+
const own = (key) => typeof key === "string" && Object.hasOwn(handlers, key);
|
|
10
|
+
return new Proxy(props, {
|
|
11
|
+
get: (target, key, receiver) => own(key) ? handlers[key] : Reflect.get(target, key, receiver),
|
|
12
|
+
has: (target, key) => own(key) || Reflect.has(target, key),
|
|
13
|
+
ownKeys: (target) => [.../* @__PURE__ */ new Set([...Reflect.ownKeys(target), ...Object.keys(handlers)])],
|
|
14
|
+
getOwnPropertyDescriptor: (target, key) => own(key) ? {
|
|
15
|
+
configurable: true,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
writable: false,
|
|
18
|
+
value: handlers[key]
|
|
19
|
+
} : Reflect.getOwnPropertyDescriptor(target, key)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { withHandlers };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=with-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-handlers.js","names":[],"sources":["../../src/runtime/with-handlers.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 把适配器自己翻译出的回调并进 props 代理。\n\n/**\n * 组件把 emit 翻成 headless 认的回调(`onClear: () => emit('clear')`),并进交给状态机的 props。\n *\n * props 是响应式代理,展开成新对象会丢掉响应;这里再包一层代理:读回调键给回调,\n * 其余照旧穿透到原 props,展开(`{ ...props }`)时回调键也一并列出。\n */\nexport function withHandlers<T extends object>(props: T, handlers: Readonly<Record<string, unknown>>): T {\n const own = (key: string | symbol): key is string => typeof key === 'string' && Object.hasOwn(handlers, key)\n return new Proxy(props, {\n get: (target, key, receiver) => (own(key) ? handlers[key] : Reflect.get(target, key, receiver)),\n has: (target, key) => own(key) || Reflect.has(target, key),\n ownKeys: target => [...new Set([...Reflect.ownKeys(target), ...Object.keys(handlers)])],\n getOwnPropertyDescriptor: (target, key) => (own(key)\n ? { configurable: true, enumerable: true, writable: false, value: handlers[key] }\n : Reflect.getOwnPropertyDescriptor(target, key)),\n })\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,aAA+B,OAAU,UAAgD;CACvG,MAAM,OAAO,QAAwC,OAAO,QAAQ,YAAY,OAAO,OAAO,UAAU,GAAG;CAC3G,OAAO,IAAI,MAAM,OAAO;EACtB,MAAM,QAAQ,KAAK,aAAc,IAAI,GAAG,IAAI,SAAS,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EAC7F,MAAM,QAAQ,QAAQ,IAAI,GAAG,KAAK,QAAQ,IAAI,QAAQ,GAAG;EACzD,UAAS,WAAU,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,QAAQ,QAAQ,MAAM,GAAG,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC;EACtF,2BAA2B,QAAQ,QAAS,IAAI,GAAG,IAC/C;GAAE,cAAc;GAAM,YAAY;GAAM,UAAU;GAAO,OAAO,SAAS;EAAK,IAC9E,QAAQ,yBAAyB,QAAQ,GAAG;CAClD,CAAC;AACH"}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { XhConfig } from "../config/config.js";
|
|
2
2
|
import { MaybeRefOrGetter } from "vue";
|
|
3
|
-
import { NotificationDedupe, NotificationOptions, NotificationPlacement, NotificationTranslations } from "@xihan-ui/headless";
|
|
3
|
+
import { NotificationDedupe, NotificationOptions, NotificationPlacement, NotificationPreset, NotificationTranslations } from "@xihan-ui/headless";
|
|
4
4
|
//#region src/services/notification-service.d.ts
|
|
5
5
|
interface NotificationServiceOptions {
|
|
6
|
-
/**
|
|
6
|
+
/** 形态预设,默认 card;轻提示传 'toast'。决定下面几项没写时的缺省值与卡片排版。 */
|
|
7
|
+
preset?: NotificationPreset;
|
|
8
|
+
/** 默认落位:card 为 bottom-end,toast 为 bottom;单条可用 options.placement 覆盖。 */
|
|
7
9
|
placement?: NotificationPlacement;
|
|
8
|
-
/**
|
|
10
|
+
/** 每个位置最多同时保留几条,超出时先移除低优先级的、同级中移除最旧的:card 为 5、toast 为 3;传 Infinity 即不限。 */
|
|
9
11
|
max?: number;
|
|
10
12
|
/** 重复的判定方式,默认 'id';传 'content' 则同一内容合并为一条并计数。 */
|
|
11
13
|
dedupe?: NotificationDedupe;
|
|
12
|
-
/** 同一堆叠内的间距(px
|
|
14
|
+
/** 同一堆叠内的间距(px):card 为 16、toast 为 12。 */
|
|
13
15
|
gap?: number;
|
|
16
|
+
/** 单条未写 duration 时的停留毫秒:card 为 5000、toast 为 4000。 */
|
|
14
17
|
duration?: number;
|
|
15
|
-
|
|
18
|
+
/** 同一位置的几条叠成一摞:card 默认不叠,toast 默认叠。 */
|
|
19
|
+
stacked?: boolean;
|
|
20
|
+
/** 页面切到后台时暂停计时:card 默认关闭,toast 默认开启。 */
|
|
16
21
|
pauseOnPageIdle?: boolean;
|
|
17
22
|
/** 通知的文案:堆叠区的读屏名与卡片上关闭按钮的读屏名,统一在一个桶中。 */
|
|
18
23
|
translations?: MaybeRefOrGetter<Partial<NotificationTranslations>>;
|
|
@@ -32,18 +37,32 @@ interface NotificationServiceOptions {
|
|
|
32
37
|
interface NotificationCreateOptions extends NotificationOptions {
|
|
33
38
|
onAction?: () => void;
|
|
34
39
|
}
|
|
35
|
-
/**
|
|
40
|
+
/** 语气糖的入参:只差 tone / loading 与 title,其余同 create。 */
|
|
36
41
|
type NotificationMessageOptions = Omit<NotificationCreateOptions, 'tone' | 'loading' | 'title'>;
|
|
42
|
+
/** promise 三态的标题:成功与失败可以传函数,拿到结果后再拼装标题。 */
|
|
43
|
+
interface NotificationPromiseOptions<T> extends Omit<NotificationMessageOptions, 'duration'> {
|
|
44
|
+
loading: string;
|
|
45
|
+
success: string | ((value: T) => string);
|
|
46
|
+
error: string | ((reason: unknown) => string);
|
|
47
|
+
}
|
|
37
48
|
interface NotificationService {
|
|
38
49
|
/** 入队并返回 id;同 id 已存在则就地改写,被合并的返回被并入的那一条。 */
|
|
39
50
|
create: (options?: NotificationCreateOptions) => string;
|
|
40
51
|
update: (id: string, options: Partial<NotificationOptions>) => void;
|
|
52
|
+
/** 立即从队列中删除,不播退场动画。卡片自己的关闭按钮先播退场动画再移出。 */
|
|
41
53
|
dismiss: (id: string) => void;
|
|
42
54
|
dismissAll: () => void;
|
|
43
55
|
info: (title: string, options?: NotificationMessageOptions) => string;
|
|
44
56
|
success: (title: string, options?: NotificationMessageOptions) => string;
|
|
45
57
|
warning: (title: string, options?: NotificationMessageOptions) => string;
|
|
46
58
|
danger: (title: string, options?: NotificationMessageOptions) => string;
|
|
59
|
+
/** 以 loading 态弹出一条并返回 id,之后用 update(id, { loading: false, tone: 'success', title: … }) 收尾。 */
|
|
60
|
+
loading: (title: string, options?: NotificationMessageOptions) => string;
|
|
61
|
+
/**
|
|
62
|
+
* 先弹出一条 loading,Promise 落定后就地改写为 success / danger;说明等其余字段三态共用。
|
|
63
|
+
* Promise 的结果原样交回调用方,拒绝也照旧拒绝。
|
|
64
|
+
*/
|
|
65
|
+
promise: <T>(input: Promise<T> | (() => Promise<T>), options: NotificationPromiseOptions<T>) => Promise<T>;
|
|
47
66
|
/** 暂停当前这些卡片的计时,'service' 这一路与指针、焦点并存。 */
|
|
48
67
|
pauseAll: () => void;
|
|
49
68
|
resumeAll: () => void;
|
|
@@ -54,5 +73,5 @@ interface NotificationService {
|
|
|
54
73
|
}
|
|
55
74
|
declare function createNotificationService(options?: NotificationServiceOptions): NotificationService;
|
|
56
75
|
//#endregion
|
|
57
|
-
export { NotificationCreateOptions, NotificationMessageOptions, NotificationService, NotificationServiceOptions, createNotificationService };
|
|
76
|
+
export { NotificationCreateOptions, NotificationMessageOptions, NotificationPromiseOptions, NotificationService, NotificationServiceOptions, createNotificationService };
|
|
58
77
|
//# sourceMappingURL=notification-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-service.d.ts","names":[],"sources":["../../src/services/notification-service.ts"],"mappings":";;;;UAsCiB;;EAEf,YAAY;;EAEZ;;EAEA,SAAS;;EAET
|
|
1
|
+
{"version":3,"file":"notification-service.d.ts","names":[],"sources":["../../src/services/notification-service.ts"],"mappings":";;;;UAsCiB;;EAEf,SAAS;;EAET,YAAY;;EAEZ;;EAEA,SAAS;;EAET;;EAEA;;EAEA;;EAEA;;EAEA,eAAe,iBAAiB,QAAQ;;;;;;EAMxC,SAAS,iBAAiB;;EAE1B,SAAS;;;;;;UAOM,kCAAkC;EACjD;;;KAIU,6BAA6B,KAAK;;UAG7B,2BAA2B,WAAW,KAAK;EAC1D;EACA,oBAAoB,OAAO;EAC3B,kBAAkB;;UAGH;;EAEf,SAAS,UAAU;EACnB,SAAS,YAAY,SAAS,QAAQ;;EAEtC,UAAU;EACV;EACA,OAAO,eAAe,UAAU;EAChC,UAAU,eAAe,UAAU;EACnC,UAAU,eAAe,UAAU;EACnC,SAAS,eAAe,UAAU;;EAElC,UAAU,eAAe,UAAU;;;;;EAKnC,UAAU,GAAG,OAAO,QAAQ,YAAY,QAAQ,KAAK,SAAS,2BAA2B,OAAO,QAAQ;;EAExG;EACA;;EAEA,YAAY,MAAM,iBAAiB;;EAEnC;;iBAsCc,0BAA0B,UAAS,6BAAkC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { vueNormalize } from "../runtime/normalize-props.js";
|
|
2
2
|
import { useMachine } from "../runtime/use-machine.js";
|
|
3
|
-
import { XhNotificationItem, XhNotificationItemActionTrigger, XhNotificationItemCloseTrigger, XhNotificationItemDescription, XhNotificationItemIndicator, XhNotificationItemTitle } from "../components/notification/notification.js";
|
|
3
|
+
import { XhNotificationItem, XhNotificationItemActionTrigger, XhNotificationItemCloseTrigger, XhNotificationItemContent, XhNotificationItemDescription, XhNotificationItemIndicator, XhNotificationItemTitle } from "../components/notification/notification.js";
|
|
4
4
|
import { createServiceConfig } from "./service-config.js";
|
|
5
5
|
import { mountServiceHost } from "./mount-host.js";
|
|
6
|
-
import { Fragment, computed, createApp, defineComponent, h, shallowRef, toValue } from "vue";
|
|
6
|
+
import { Fragment, computed, createApp, defineComponent, h, ref, shallowRef, toValue } from "vue";
|
|
7
7
|
import { ensurePortalRoot } from "@xihan-ui/core";
|
|
8
8
|
import { connectNotification, createFeedbackServiceController, notificationMachine, resolveFeedbackServiceTitle } from "@xihan-ui/headless";
|
|
9
9
|
//#region src/services/notification-service.ts
|
|
10
10
|
function defaultCard(item, translations, paused, onUnmounted, onAction) {
|
|
11
11
|
return h(XhNotificationItem, {
|
|
12
12
|
id: item.id,
|
|
13
|
+
preset: item.preset,
|
|
13
14
|
title: resolveFeedbackServiceTitle(item),
|
|
14
15
|
description: item.description,
|
|
15
16
|
tone: item.tone,
|
|
16
17
|
loading: item.loading,
|
|
17
18
|
duration: item.duration,
|
|
18
|
-
removeDelay: item.removeDelay,
|
|
19
19
|
closable: item.closable,
|
|
20
20
|
pauseOnPageIdle: item.pauseOnPageIdle,
|
|
21
21
|
paused,
|
|
@@ -23,13 +23,12 @@ function defaultCard(item, translations, paused, onUnmounted, onAction) {
|
|
|
23
23
|
onStatusChange: ({ id, status }) => {
|
|
24
24
|
if (status === "unmounted") onUnmounted(id);
|
|
25
25
|
},
|
|
26
|
-
onAction: () => onAction(
|
|
26
|
+
onAction: ({ id }) => onAction(id)
|
|
27
27
|
}, () => [
|
|
28
28
|
h(XhNotificationItemIndicator),
|
|
29
|
-
h(XhNotificationItemTitle),
|
|
30
|
-
h(XhNotificationItemDescription),
|
|
29
|
+
h(XhNotificationItemContent, () => [h(XhNotificationItemTitle), h(XhNotificationItemDescription)]),
|
|
31
30
|
item.actionLabel ? h(XhNotificationItemActionTrigger, () => item.actionLabel) : null,
|
|
32
|
-
item.closable
|
|
31
|
+
item.closable ? h(XhNotificationItemCloseTrigger) : null
|
|
33
32
|
]);
|
|
34
33
|
}
|
|
35
34
|
function createNotificationService(options = {}) {
|
|
@@ -53,6 +52,8 @@ function createNotificationService(options = {}) {
|
|
|
53
52
|
...queueProps,
|
|
54
53
|
translations: toValue(queueProps.translations)
|
|
55
54
|
}), void 0, { start: "setup" });
|
|
55
|
+
const rootRef = ref(null);
|
|
56
|
+
service.refs.set("getRootEl", () => rootRef.value);
|
|
56
57
|
const api = computed(() => connectNotification(service, vueNormalize));
|
|
57
58
|
controller.attach({
|
|
58
59
|
create: (opts) => api.value.create(opts),
|
|
@@ -63,7 +64,10 @@ function createNotificationService(options = {}) {
|
|
|
63
64
|
return () => {
|
|
64
65
|
const value = api.value;
|
|
65
66
|
controller.syncItems(value.visibleNotifications.map((item) => item.id));
|
|
66
|
-
return h("div",
|
|
67
|
+
return h("div", {
|
|
68
|
+
...value.getRootProps(),
|
|
69
|
+
ref: rootRef
|
|
70
|
+
}, value.placements.map((placement) => h("div", {
|
|
67
71
|
key: placement,
|
|
68
72
|
...value.getGroupProps({ placement })
|
|
69
73
|
}, value.getItemsByPlacement(placement).map((item) => h(Fragment, { key: item.id }, [defaultCard(item, toValue(queueProps.translations), pausedAll.value, controller.unmounted, controller.invokeAction)])))));
|
|
@@ -91,6 +95,29 @@ function createNotificationService(options = {}) {
|
|
|
91
95
|
success: sugar("success"),
|
|
92
96
|
warning: sugar("warning"),
|
|
93
97
|
danger: sugar("danger"),
|
|
98
|
+
loading: (title, opts = {}) => create({
|
|
99
|
+
...opts,
|
|
100
|
+
loading: true,
|
|
101
|
+
title
|
|
102
|
+
}),
|
|
103
|
+
promise: (input, opts) => {
|
|
104
|
+
const { loading, success, error, ...rest } = opts;
|
|
105
|
+
const running = typeof input === "function" ? input() : input;
|
|
106
|
+
const { onAction, ...record } = rest;
|
|
107
|
+
return controller.trackPromise(running, {
|
|
108
|
+
...record,
|
|
109
|
+
loading: true,
|
|
110
|
+
title: loading
|
|
111
|
+
}, (value) => ({
|
|
112
|
+
loading: false,
|
|
113
|
+
tone: "success",
|
|
114
|
+
title: typeof success === "function" ? success(value) : success
|
|
115
|
+
}), (reason) => ({
|
|
116
|
+
loading: false,
|
|
117
|
+
tone: "danger",
|
|
118
|
+
title: typeof error === "function" ? error(reason) : error
|
|
119
|
+
}), onAction);
|
|
120
|
+
},
|
|
94
121
|
pauseAll: controller.pauseAll,
|
|
95
122
|
resumeAll: controller.resumeAll,
|
|
96
123
|
setConfig: (next) => configSource.set(next),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-service.js","names":[],"sources":["../../src/services/notification-service.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 全局命令式通知服务:自带一个挂到 body 的宿主应用与默认渲染模板。\n//\n// 通知常常不是从组件树里发出来的——推送连接的回调、后台任务的收尾、拦截器里的\n// 一条系统消息,调用点都在组件之外。要它们各自去找一份队列上下文并不现实,\n// 所以队列由本服务持有,业务代码只管发。\n//\n// 队列要长在页面结构里(比如通知中心那一栏自己排版)时,用组件形态的\n// XhNotificationRoot,那是另一条路,两者不共享队列。\nimport type {\n NotificationDedupe,\n NotificationOptions,\n NotificationPlacement,\n NotificationTranslations,\n ResolvedNotification,\n} from '@xihan-ui/headless'\nimport type { App, MaybeRefOrGetter, VNode } from 'vue'\nimport type { XhConfig } from '../config/config'\nimport { ensurePortalRoot } from '@xihan-ui/core'\nimport { connectNotification, createFeedbackServiceController, notificationMachine, resolveFeedbackServiceTitle } from '@xihan-ui/headless'\nimport { computed, createApp, defineComponent, Fragment, h, shallowRef, toValue } from 'vue'\nimport {\n XhNotificationItem,\n XhNotificationItemActionTrigger,\n XhNotificationItemCloseTrigger,\n XhNotificationItemDescription,\n XhNotificationItemIndicator,\n XhNotificationItemTitle,\n} from '../components/notification/notification'\nimport { vueNormalize } from '../runtime/normalize-props'\nimport { useMachine } from '../runtime/use-machine'\nimport { mountServiceHost } from './mount-host'\nimport { createServiceConfig } from './service-config'\n\nexport interface NotificationServiceOptions {\n /** 默认落位,默认 bottom-end;单条可用 options.placement 覆盖。 */\n placement?: NotificationPlacement\n /** 每个位置最多同时保留几条,超出时先移除低优先级的、同级中移除最旧的。默认 5;传 Infinity 即不限。 */\n max?: number\n /** 重复的判定方式,默认 'id';传 'content' 则同一内容合并为一条并计数。 */\n dedupe?: NotificationDedupe\n /** 同一堆叠内的间距(px),默认 16。 */\n gap?: number\n duration?: number\n removeDelay?: number\n pauseOnPageIdle?: boolean\n /** 通知的文案:堆叠区的读屏名与卡片上关闭按钮的读屏名,统一在一个桶中。 */\n translations?: MaybeRefOrGetter<Partial<NotificationTranslations>>\n /**\n * 提供给通知子树的全局配置(locale / translations / size / portalContainer)。\n * 本服务自带宿主应用,无法接收组件树中的 provideXhConfig,需要与应用同语言时从这里提供;\n * 传 ref/getter 即可在运行期跟随切换语言,也可以之后用 setConfig 推送。\n */\n config?: MaybeRefOrGetter<XhConfig>\n /** 宿主容器;未提供时在 body 下新建一个。 */\n target?: HTMLElement\n}\n\n/**\n * create 的入参。`actionLabel` 是卡片上行内动作按钮的文案,`onAction` 是按下它执行的动作:\n * 回调不进入队列记录(该记录要能被整份替换、序列化、比对),服务按 id 单独保存一张表。\n */\nexport interface NotificationCreateOptions extends NotificationOptions {\n onAction?: () => void\n}\n\n/** 类型糖的入参:只差 type 与 title,其余同 create。 */\nexport type NotificationMessageOptions = Omit<NotificationCreateOptions, 'tone' | 'loading' | 'title'>\n\nexport interface NotificationService {\n /** 入队并返回 id;同 id 已存在则就地改写,被合并的返回被并入的那一条。 */\n create: (options?: NotificationCreateOptions) => string\n update: (id: string, options: Partial<NotificationOptions>) => void\n dismiss: (id: string) => void\n dismissAll: () => void\n info: (title: string, options?: NotificationMessageOptions) => string\n success: (title: string, options?: NotificationMessageOptions) => string\n warning: (title: string, options?: NotificationMessageOptions) => string\n danger: (title: string, options?: NotificationMessageOptions) => string\n /** 暂停当前这些卡片的计时,'service' 这一路与指针、焦点并存。 */\n pauseAll: () => void\n resumeAll: () => void\n /** 更换全局配置源。 */\n setConfig: (next: MaybeRefOrGetter<XhConfig> | undefined) => void\n /** 卸载宿主应用并移除容器。 */\n dispose: () => void\n}\n\nfunction defaultCard(\n item: ResolvedNotification,\n translations: Partial<NotificationTranslations> | undefined,\n paused: boolean,\n onUnmounted: (id: string) => void,\n onAction: (id: string) => void,\n): VNode {\n return h(XhNotificationItem, {\n id: item.id,\n title: resolveFeedbackServiceTitle(item),\n description: item.description,\n tone: item.tone,\n loading: item.loading,\n duration: item.duration,\n removeDelay: item.removeDelay,\n closable: item.closable,\n pauseOnPageIdle: item.pauseOnPageIdle,\n paused,\n translations,\n onStatusChange: ({ id, status }: { id: string, status: string }) => {\n if (status === 'unmounted')\n onUnmounted(id)\n },\n onAction: () => onAction(item.id),\n }, () => [\n // 四个节点平铺:两列网格与右上角那颗叉都归皮肤,模板套一层行容器只会与它打架。\n // 指示符与说明都恒渲染——皮肤的 :empty 规则负责把空盒收走,\n // 而 aria-describedby 无条件指着说明那一个,节点缺席就成了悬空引用\n h(XhNotificationItemIndicator),\n h(XhNotificationItemTitle),\n h(XhNotificationItemDescription),\n item.actionLabel ? h(XhNotificationItemActionTrigger, () => item.actionLabel) : null,\n item.closable !== false ? h(XhNotificationItemCloseTrigger) : null,\n ])\n}\n\nexport function createNotificationService(options: NotificationServiceOptions = {}): NotificationService {\n if (typeof document === 'undefined')\n throw new Error('createNotificationService 需要 document;SSR 里请等到客户端再创建')\n\n const { target, config, ...queueProps } = options\n const configSource = createServiceConfig(config)\n const holder = target ?? document.createElement('div')\n if (!target)\n ensurePortalRoot(document).appendChild(holder)\n\n let publishState: (paused: boolean) => void = () => {}\n const controller = createFeedbackServiceController<NotificationOptions, Partial<NotificationOptions>>({\n name: 'notification',\n onStateChange: state => publishState(state.paused),\n })\n const pausedAll = shallowRef(controller.state.paused)\n publishState = paused => void (pausedAll.value = paused)\n\n const Host = defineComponent({\n name: 'XhNotificationServiceHost',\n setup() {\n configSource.provide()\n // props 每帧现展开:文案是 getter 时才跟得上运行期切语言。\n // 队列机器在 setup 里当场 start:它没有 DOM 锚点,而端口紧接着就接上。\n // 等 mounted 再 start 的话,从业务组件的 onMounted 懒建本服务时,宿主的 mounted\n // 会排到调用方那条 post-flush 队列的队尾,调用方接着发的第一条命令就撞上 SEND_BEFORE_MOUNT\n const service = useMachine(\n notificationMachine,\n () => ({ ...queueProps, translations: toValue(queueProps.translations) }),\n undefined,\n { start: 'setup' },\n )\n // 部件不经 provide/inject 取队列:本服务自己收 status-change 把走完退场的那条删掉,\n // 卡片与队列之间因此没有第二条隐式链路\n const api = computed(() => connectNotification(service, vueNormalize))\n controller.attach({\n create: opts => api.value.create(opts),\n update: (id, opts) => api.value.update(id, opts),\n dismiss: id => api.value.dismiss(id),\n dismissAll: () => api.value.dismissAll(),\n })\n return () => {\n const value = api.value\n controller.syncItems(value.visibleNotifications.map(item => item.id))\n return h('div', value.getRootProps() as Record<string, unknown>, value.placements.map(placement =>\n h(\n 'div',\n { key: placement, ...value.getGroupProps({ placement }) as Record<string, unknown> },\n // 按队列身份 id 给 key,避免节点被就地复用\n value.getItemsByPlacement(placement).map(item => h(Fragment, { key: item.id }, [\n defaultCard(\n item,\n toValue(queueProps.translations),\n pausedAll.value,\n controller.unmounted,\n controller.invokeAction,\n ),\n ])),\n )))\n }\n },\n })\n\n const app: App = createApp(Host)\n const mounted = mountServiceHost(app, holder, 'notification')\n if (!mounted)\n controller.attach(null)\n\n /** 入队一条;回调另存一张表,队列记录中只保留文案。 */\n const create = (opts: NotificationCreateOptions = {}): string => {\n const { onAction, ...record } = opts\n return controller.create(record, onAction)\n }\n\n const sugar = (tone: NotificationOptions['tone']) =>\n (title: string, opts: NotificationMessageOptions = {}): string =>\n create({ ...opts, tone, title })\n\n return {\n create,\n update: controller.update,\n dismiss: controller.dismiss,\n dismissAll: controller.dismissAll,\n info: sugar('info'),\n success: sugar('success'),\n warning: sugar('warning'),\n danger: sugar('danger'),\n pauseAll: controller.pauseAll,\n resumeAll: controller.resumeAll,\n setConfig: next => configSource.set(next),\n dispose: () => {\n if (mounted)\n app.unmount()\n controller.dispose()\n if (!target)\n holder.remove()\n },\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"notification-service.js","names":[],"sources":["../../src/services/notification-service.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 全局命令式通知服务:自带一个挂到 body 的宿主应用与默认渲染模板,\n// info/success 等命令在任意模块作用域可调(请求拦截器、推送回调、store),\n// 不要求调用点在组件树内。卡片与轻提示是同一个服务的两种预设,preset 在创建时定下。\n//\n// 队列要长在页面结构里(比如通知中心那一栏自己排版)时,用组件形态的\n// XhNotificationRoot,那是另一条路,两者不共享队列。\nimport type {\n NotificationDedupe,\n NotificationOptions,\n NotificationPlacement,\n NotificationPreset,\n NotificationTranslations,\n ResolvedNotification,\n} from '@xihan-ui/headless'\nimport type { App, MaybeRefOrGetter, VNode } from 'vue'\nimport type { XhConfig } from '../config/config'\nimport { ensurePortalRoot } from '@xihan-ui/core'\nimport { connectNotification, createFeedbackServiceController, notificationMachine, resolveFeedbackServiceTitle } from '@xihan-ui/headless'\nimport { computed, createApp, defineComponent, Fragment, h, ref, shallowRef, toValue } from 'vue'\nimport {\n XhNotificationItem,\n XhNotificationItemActionTrigger,\n XhNotificationItemCloseTrigger,\n XhNotificationItemContent,\n XhNotificationItemDescription,\n XhNotificationItemIndicator,\n XhNotificationItemTitle,\n} from '../components/notification/notification'\nimport { vueNormalize } from '../runtime/normalize-props'\nimport { useMachine } from '../runtime/use-machine'\nimport { mountServiceHost } from './mount-host'\nimport { createServiceConfig } from './service-config'\n\nexport interface NotificationServiceOptions {\n /** 形态预设,默认 card;轻提示传 'toast'。决定下面几项没写时的缺省值与卡片排版。 */\n preset?: NotificationPreset\n /** 默认落位:card 为 bottom-end,toast 为 bottom;单条可用 options.placement 覆盖。 */\n placement?: NotificationPlacement\n /** 每个位置最多同时保留几条,超出时先移除低优先级的、同级中移除最旧的:card 为 5、toast 为 3;传 Infinity 即不限。 */\n max?: number\n /** 重复的判定方式,默认 'id';传 'content' 则同一内容合并为一条并计数。 */\n dedupe?: NotificationDedupe\n /** 同一堆叠内的间距(px):card 为 16、toast 为 12。 */\n gap?: number\n /** 单条未写 duration 时的停留毫秒:card 为 5000、toast 为 4000。 */\n duration?: number\n /** 同一位置的几条叠成一摞:card 默认不叠,toast 默认叠。 */\n stacked?: boolean\n /** 页面切到后台时暂停计时:card 默认关闭,toast 默认开启。 */\n pauseOnPageIdle?: boolean\n /** 通知的文案:堆叠区的读屏名与卡片上关闭按钮的读屏名,统一在一个桶中。 */\n translations?: MaybeRefOrGetter<Partial<NotificationTranslations>>\n /**\n * 提供给通知子树的全局配置(locale / translations / size / portalContainer)。\n * 本服务自带宿主应用,无法接收组件树中的 provideXhConfig,需要与应用同语言时从这里提供;\n * 传 ref/getter 即可在运行期跟随切换语言,也可以之后用 setConfig 推送。\n */\n config?: MaybeRefOrGetter<XhConfig>\n /** 宿主容器;未提供时在 body 下新建一个。 */\n target?: HTMLElement\n}\n\n/**\n * create 的入参。`actionLabel` 是卡片上行内动作按钮的文案,`onAction` 是按下它执行的动作:\n * 回调不进入队列记录(该记录要能被整份替换、序列化、比对),服务按 id 单独保存一张表。\n */\nexport interface NotificationCreateOptions extends NotificationOptions {\n onAction?: () => void\n}\n\n/** 语气糖的入参:只差 tone / loading 与 title,其余同 create。 */\nexport type NotificationMessageOptions = Omit<NotificationCreateOptions, 'tone' | 'loading' | 'title'>\n\n/** promise 三态的标题:成功与失败可以传函数,拿到结果后再拼装标题。 */\nexport interface NotificationPromiseOptions<T> extends Omit<NotificationMessageOptions, 'duration'> {\n loading: string\n success: string | ((value: T) => string)\n error: string | ((reason: unknown) => string)\n}\n\nexport interface NotificationService {\n /** 入队并返回 id;同 id 已存在则就地改写,被合并的返回被并入的那一条。 */\n create: (options?: NotificationCreateOptions) => string\n update: (id: string, options: Partial<NotificationOptions>) => void\n /** 立即从队列中删除,不播退场动画。卡片自己的关闭按钮先播退场动画再移出。 */\n dismiss: (id: string) => void\n dismissAll: () => void\n info: (title: string, options?: NotificationMessageOptions) => string\n success: (title: string, options?: NotificationMessageOptions) => string\n warning: (title: string, options?: NotificationMessageOptions) => string\n danger: (title: string, options?: NotificationMessageOptions) => string\n /** 以 loading 态弹出一条并返回 id,之后用 update(id, { loading: false, tone: 'success', title: … }) 收尾。 */\n loading: (title: string, options?: NotificationMessageOptions) => string\n /**\n * 先弹出一条 loading,Promise 落定后就地改写为 success / danger;说明等其余字段三态共用。\n * Promise 的结果原样交回调用方,拒绝也照旧拒绝。\n */\n promise: <T>(input: Promise<T> | (() => Promise<T>), options: NotificationPromiseOptions<T>) => Promise<T>\n /** 暂停当前这些卡片的计时,'service' 这一路与指针、焦点并存。 */\n pauseAll: () => void\n resumeAll: () => void\n /** 更换全局配置源。 */\n setConfig: (next: MaybeRefOrGetter<XhConfig> | undefined) => void\n /** 卸载宿主应用并移除容器。 */\n dispose: () => void\n}\n\nfunction defaultCard(\n item: ResolvedNotification,\n translations: Partial<NotificationTranslations> | undefined,\n paused: boolean,\n onUnmounted: (id: string) => void,\n onAction: (id: string) => void,\n): VNode {\n return h(XhNotificationItem, {\n id: item.id,\n preset: item.preset,\n title: resolveFeedbackServiceTitle(item),\n description: item.description,\n tone: item.tone,\n loading: item.loading,\n duration: item.duration,\n closable: item.closable,\n pauseOnPageIdle: item.pauseOnPageIdle,\n paused,\n translations,\n onStatusChange: ({ id, status }: { id: string, status: string }) => {\n if (status === 'unmounted')\n onUnmounted(id)\n },\n onAction: ({ id }: { id: string }) => onAction(id),\n }, () => [\n // 两种预设同一份结构,排版归皮肤按 data-preset 给。\n // 指示符与说明都恒渲染——皮肤的 :empty 规则负责把空盒收走,\n // 而 aria-describedby 无条件指着说明那一个,节点缺席就成了悬空引用\n h(XhNotificationItemIndicator),\n h(XhNotificationItemContent, () => [h(XhNotificationItemTitle), h(XhNotificationItemDescription)]),\n item.actionLabel ? h(XhNotificationItemActionTrigger, () => item.actionLabel) : null,\n item.closable ? h(XhNotificationItemCloseTrigger) : null,\n ])\n}\n\nexport function createNotificationService(options: NotificationServiceOptions = {}): NotificationService {\n if (typeof document === 'undefined')\n throw new Error('createNotificationService 需要 document;SSR 里请等到客户端再创建')\n\n const { target, config, ...queueProps } = options\n const configSource = createServiceConfig(config)\n const holder = target ?? document.createElement('div')\n if (!target)\n ensurePortalRoot(document).appendChild(holder)\n\n let publishState: (paused: boolean) => void = () => {}\n const controller = createFeedbackServiceController<NotificationOptions, Partial<NotificationOptions>>({\n name: 'notification',\n onStateChange: state => publishState(state.paused),\n })\n const pausedAll = shallowRef(controller.state.paused)\n publishState = paused => void (pausedAll.value = paused)\n\n const Host = defineComponent({\n name: 'XhNotificationServiceHost',\n setup() {\n configSource.provide()\n // props 每帧现展开:文案是 getter 时才跟得上运行期切语言。\n // 队列机器在 setup 里当场 start:它没有 DOM 锚点,而端口紧接着就接上。\n // 等 mounted 再 start 的话,从业务组件的 onMounted 懒建本服务时,宿主的 mounted\n // 会排到调用方那条 post-flush 队列的队尾,调用方接着发的第一条命令就撞上 SEND_BEFORE_MOUNT\n const service = useMachine(\n notificationMachine,\n () => ({ ...queueProps, translations: toValue(queueProps.translations) }),\n undefined,\n { start: 'setup' },\n )\n // 条目到达与叠摞都挂在作用域包装上;机器的追踪在首次提交之后才去取它\n const rootRef = ref<HTMLElement | null>(null)\n service.refs.set('getRootEl', () => rootRef.value)\n // 部件不经 provide/inject 取队列:本服务自己收 status-change 把走完退场的那条删掉,\n // 卡片与队列之间因此没有第二条隐式链路\n const api = computed(() => connectNotification(service, vueNormalize))\n controller.attach({\n create: opts => api.value.create(opts),\n update: (id, opts) => api.value.update(id, opts),\n dismiss: id => api.value.dismiss(id),\n dismissAll: () => api.value.dismissAll(),\n })\n return () => {\n const value = api.value\n controller.syncItems(value.visibleNotifications.map(item => item.id))\n return h('div', { ...value.getRootProps() as Record<string, unknown>, ref: rootRef }, value.placements.map(placement =>\n h(\n 'div',\n { key: placement, ...value.getGroupProps({ placement }) as Record<string, unknown> },\n // 按队列身份 id 给 key,避免节点被就地复用\n value.getItemsByPlacement(placement).map(item => h(Fragment, { key: item.id }, [\n defaultCard(\n item,\n toValue(queueProps.translations),\n pausedAll.value,\n controller.unmounted,\n controller.invokeAction,\n ),\n ])),\n )))\n }\n },\n })\n\n const app: App = createApp(Host)\n const mounted = mountServiceHost(app, holder, 'notification')\n if (!mounted)\n controller.attach(null)\n\n /** 入队一条;回调另存一张表,队列记录中只保留文案。 */\n const create = (opts: NotificationCreateOptions = {}): string => {\n const { onAction, ...record } = opts\n return controller.create(record, onAction)\n }\n\n const sugar = (tone: NotificationOptions['tone']) =>\n (title: string, opts: NotificationMessageOptions = {}): string =>\n create({ ...opts, tone, title })\n\n return {\n create,\n update: controller.update,\n dismiss: controller.dismiss,\n dismissAll: controller.dismissAll,\n info: sugar('info'),\n success: sugar('success'),\n warning: sugar('warning'),\n danger: sugar('danger'),\n loading: (title, opts = {}) => create({ ...opts, loading: true, title }),\n promise: <T>(input: Promise<T> | (() => Promise<T>), opts: NotificationPromiseOptions<T>): Promise<T> => {\n const { loading, success, error, ...rest } = opts\n const running = typeof input === 'function' ? input() : input\n const { onAction, ...record } = rest\n return controller.trackPromise(\n running,\n { ...record, loading: true, title: loading },\n value => ({ loading: false, tone: 'success', title: typeof success === 'function' ? success(value) : success }),\n reason => ({ loading: false, tone: 'danger', title: typeof error === 'function' ? error(reason) : error }),\n onAction,\n )\n },\n pauseAll: controller.pauseAll,\n resumeAll: controller.resumeAll,\n setConfig: next => configSource.set(next),\n dispose: () => {\n if (mounted)\n app.unmount()\n controller.dispose()\n if (!target)\n holder.remove()\n },\n }\n}\n"],"mappings":"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"}
|
package/dist/sound.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DialogService } from "./services/dialog-service.js";
|
|
2
|
-
import { ToastService } from "./services/toast-service.js";
|
|
3
2
|
import { Directive } from "vue";
|
|
4
|
-
import { DialogSoundKey, DialogSoundServiceOptions, SoundChoice, SoundPlayer, SoundPressOptions
|
|
3
|
+
import { DialogSoundKey, DialogSoundServiceOptions, NotificationSoundKey, NotificationSoundServiceOptions, NotificationSoundServicePort, SoundChoice, SoundPlayer, SoundPressOptions } from "@xihan-ui/sound";
|
|
5
4
|
//#region src/sound.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* 取共享播放器,没有时建立一个默认的。
|
|
@@ -10,7 +9,7 @@ import { DialogSoundKey, DialogSoundServiceOptions, SoundChoice, SoundPlayer, So
|
|
|
10
9
|
declare function getSoundPlayer(): SoundPlayer;
|
|
11
10
|
/** 换为自行配置的播放器(更换主题、接入用户偏好)。自动建立的播放器会被销毁。 */
|
|
12
11
|
declare function setSoundPlayer(player: SoundPlayer): void;
|
|
13
|
-
interface
|
|
12
|
+
interface NotificationSoundOptions extends Omit<NotificationSoundServiceOptions, 'player' | 'attachUnlock'> {
|
|
14
13
|
/** 使用哪个播放器,默认共享播放器。 */
|
|
15
14
|
player?: SoundPlayer;
|
|
16
15
|
}
|
|
@@ -18,14 +17,14 @@ interface ToastSoundOptions extends Omit<ToastSoundServiceOptions, 'player' | 'a
|
|
|
18
17
|
* 为命令式通知服务配上声音:入队即发声,调用点无需修改。
|
|
19
18
|
*
|
|
20
19
|
* ```ts
|
|
21
|
-
* export const
|
|
22
|
-
*
|
|
20
|
+
* export const notify = withNotificationSound(createNotificationService())
|
|
21
|
+
* notify.success('已保存') // 视觉 + 听觉
|
|
23
22
|
* ```
|
|
24
23
|
*
|
|
25
24
|
* `update` 只在类型改变且新类型不是 loading 时发声:上传完成时应当发声,
|
|
26
25
|
* 修改文案不应发声。
|
|
27
26
|
*/
|
|
28
|
-
declare function
|
|
27
|
+
declare function withNotificationSound<Service extends NotificationSoundServicePort>(service: Service, options?: NotificationSoundOptions): Service;
|
|
29
28
|
interface DialogSoundOptions extends Omit<DialogSoundServiceOptions, 'player' | 'attachUnlock'> {
|
|
30
29
|
player?: SoundPlayer;
|
|
31
30
|
}
|
|
@@ -50,5 +49,5 @@ type SoundDirectiveValue = string | SoundDirectiveOptions | undefined;
|
|
|
50
49
|
*/
|
|
51
50
|
declare const vSound: Directive<HTMLElement, SoundDirectiveValue>;
|
|
52
51
|
//#endregion
|
|
53
|
-
export { type DialogSoundKey, DialogSoundOptions, type SoundChoice, SoundDirectiveOptions, SoundDirectiveValue,
|
|
52
|
+
export { type DialogSoundKey, DialogSoundOptions, type NotificationSoundKey, NotificationSoundOptions, type SoundChoice, SoundDirectiveOptions, SoundDirectiveValue, getSoundPlayer, setSoundPlayer, vSound, withDialogSound, withNotificationSound };
|
|
54
53
|
//# sourceMappingURL=sound.d.ts.map
|
package/dist/sound.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound.d.ts","names":[],"sources":["../src/sound.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sound.d.ts","names":[],"sources":["../src/sound.ts"],"mappings":";;;;;;;;iBA4BgB,kBAAkB;;iBAKlB,eAAe,QAAQ;UAItB,iCAAiC,KAAK;;EAErD,SAAS;;;;;;;;;;;;;iBAcK,sBAAsB,gBAAgB,8BAA8B,SAAS,SAAS,UAAS,2BAAgC;UAQ9H,2BAA2B,KAAK;EAC/C,SAAS;;;;;;iBAOK,gBAAgB,SAAS,eAAe,UAAS,qBAA0B;UAQ1E,8BAA8B;KAEnC,+BAA+B;;;;;;;;;;;;;cAgB9B,QAAQ,UAAU,aAAa"}
|
package/dist/sound.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attachDocumentSoundUnlock, createSharedSoundPlayerController, isSoundTargetDisabled, resolveSoundPressOptions, withDialogSoundService,
|
|
1
|
+
import { attachDocumentSoundUnlock, createSharedSoundPlayerController, isSoundTargetDisabled, resolveSoundPressOptions, withDialogSoundService, withNotificationSoundService } from "@xihan-ui/sound";
|
|
2
2
|
//#region src/sound.ts
|
|
3
3
|
const shared = createSharedSoundPlayerController();
|
|
4
4
|
/**
|
|
@@ -16,15 +16,15 @@ function setSoundPlayer(player) {
|
|
|
16
16
|
* 为命令式通知服务配上声音:入队即发声,调用点无需修改。
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
|
-
* export const
|
|
20
|
-
*
|
|
19
|
+
* export const notify = withNotificationSound(createNotificationService())
|
|
20
|
+
* notify.success('已保存') // 视觉 + 听觉
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* `update` 只在类型改变且新类型不是 loading 时发声:上传完成时应当发声,
|
|
24
24
|
* 修改文案不应发声。
|
|
25
25
|
*/
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function withNotificationSound(service, options = {}) {
|
|
27
|
+
return withNotificationSoundService(service, {
|
|
28
28
|
...options,
|
|
29
29
|
player: options.player ?? getSoundPlayer(),
|
|
30
30
|
attachUnlock: attachDocumentSoundUnlock
|
|
@@ -78,6 +78,6 @@ const vSound = {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
//#endregion
|
|
81
|
-
export { getSoundPlayer, setSoundPlayer, vSound, withDialogSound,
|
|
81
|
+
export { getSoundPlayer, setSoundPlayer, vSound, withDialogSound, withNotificationSound };
|
|
82
82
|
|
|
83
83
|
//# sourceMappingURL=sound.js.map
|
package/dist/sound.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound.js","names":[],"sources":["../src/sound.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// @xihan-ui/vue/sound —— 声音层的 Vue 适配。\n//\n// 与主入口分开:@xihan-ui/sound 是可选 peer,不用音效的应用不会因为装了本包\n// 而多出一个音频引擎。用之前先装 @xihan-ui/sound。\n//\n// 三种用法,从轻到重:\n// v-sound 给任意元素或组件按下时配一声,一个字都不用改组件\n//
|
|
1
|
+
{"version":3,"file":"sound.js","names":[],"sources":["../src/sound.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// @xihan-ui/vue/sound —— 声音层的 Vue 适配。\n//\n// 与主入口分开:@xihan-ui/sound 是可选 peer,不用音效的应用不会因为装了本包\n// 而多出一个音频引擎。用之前先装 @xihan-ui/sound。\n//\n// 三种用法,从轻到重:\n// v-sound 给任意元素或组件按下时配一声,一个字都不用改组件\n// withNotificationSound 给命令式通知服务配上声音,调用点一行都不用改\n// getSoundPlayer 自己拿播放器,接偏好开关或调音面板\n\nimport type { DialogSoundServiceOptions, NotificationSoundServiceOptions, NotificationSoundServicePort, SoundPressOptions as SharedSoundPressOptions, SoundPlayer } from '@xihan-ui/sound'\nimport type { Directive } from 'vue'\nimport type { DialogService } from './services/dialog-service'\nimport { attachDocumentSoundUnlock, createSharedSoundPlayerController, isSoundTargetDisabled, resolveSoundPressOptions, withDialogSoundService, withNotificationSoundService } from '@xihan-ui/sound'\n\nexport type { DialogSoundKey, NotificationSoundKey, SoundChoice } from '@xihan-ui/sound'\n\nconst shared = createSharedSoundPlayerController()\n\n/**\n * 取共享播放器,没有时建立一个默认的。\n * 播放器本身很轻,音频上下文要等第一次真正发声才建立,取用后不使用不产生开销。\n */\nexport function getSoundPlayer(): SoundPlayer {\n return shared.getPlayer()\n}\n\n/** 换为自行配置的播放器(更换主题、接入用户偏好)。自动建立的播放器会被销毁。 */\nexport function setSoundPlayer(player: SoundPlayer): void {\n shared.setPlayer(player)\n}\n\nexport interface NotificationSoundOptions extends Omit<NotificationSoundServiceOptions, 'player' | 'attachUnlock'> {\n /** 使用哪个播放器,默认共享播放器。 */\n player?: SoundPlayer\n}\n\n/**\n * 为命令式通知服务配上声音:入队即发声,调用点无需修改。\n *\n * ```ts\n * export const notify = withNotificationSound(createNotificationService())\n * notify.success('已保存') // 视觉 + 听觉\n * ```\n *\n * `update` 只在类型改变且新类型不是 loading 时发声:上传完成时应当发声,\n * 修改文案不应发声。\n */\nexport function withNotificationSound<Service extends NotificationSoundServicePort>(service: Service, options: NotificationSoundOptions = {}): Service {\n return withNotificationSoundService(service, {\n ...options,\n player: options.player ?? getSoundPlayer(),\n attachUnlock: attachDocumentSoundUnlock,\n })\n}\n\nexport interface DialogSoundOptions extends Omit<DialogSoundServiceOptions, 'player' | 'attachUnlock'> {\n player?: SoundPlayer\n}\n\n/**\n * 为命令式确认框服务配上声音:弹出时发声,关闭时不发声\n * (按钮的按下声与随后的通知已经表明了结果)。\n */\nexport function withDialogSound(service: DialogService, options: DialogSoundOptions = {}): DialogService {\n return withDialogSoundService(service, {\n ...options,\n player: options.player ?? getSoundPlayer(),\n attachUnlock: attachDocumentSoundUnlock,\n })\n}\n\nexport interface SoundDirectiveOptions extends SharedSoundPressOptions {}\n\nexport type SoundDirectiveValue = string | SoundDirectiveOptions | undefined\n\nconst bound = new WeakMap<HTMLElement, { handler: () => void, options: ReturnType<typeof resolveSoundPressOptions> }>()\n\n/**\n * `v-sound`:为任意元素按下时配一声。\n *\n * 挂在 click 上而不是 pointerdown:键盘按 Enter / Space 激活也要发声,\n * 而按下后拖开取消的操作不应发声。\n *\n * ```vue\n * <XhButton v-sound>提交</XhButton>\n * <XhButton v-sound=\"'send'\">发送</XhButton>\n * <div v-sound=\"{ sound: 'toggle-on', volume: 0.6 }\" />\n * ```\n */\nexport const vSound: Directive<HTMLElement, SoundDirectiveValue> = {\n mounted(el, binding) {\n const entry = {\n options: resolveSoundPressOptions(binding.value),\n handler: (): void => {\n if (isSoundTargetDisabled(el))\n return\n const { sound, volume, player } = entry.options\n ;(player ?? getSoundPlayer()).play(sound, volume === undefined ? undefined : { volume })\n },\n }\n bound.set(el, entry)\n el.addEventListener('click', entry.handler)\n },\n updated(el, binding) {\n const entry = bound.get(el)\n if (entry)\n entry.options = resolveSoundPressOptions(binding.value)\n },\n unmounted(el) {\n const entry = bound.get(el)\n if (entry)\n el.removeEventListener('click', entry.handler)\n bound.delete(el)\n },\n}\n"],"mappings":";;AAsBA,MAAM,SAAS,kCAAkC;;;;;AAMjD,SAAgB,iBAA8B;CAC5C,OAAO,OAAO,UAAU;AAC1B;;AAGA,SAAgB,eAAe,QAA2B;CACxD,OAAO,UAAU,MAAM;AACzB;;;;;;;;;;;;AAkBA,SAAgB,sBAAoE,SAAkB,UAAoC,CAAC,GAAY;CACrJ,OAAO,6BAA6B,SAAS;EAC3C,GAAG;EACH,QAAQ,QAAQ,UAAU,eAAe;EACzC,cAAc;CAChB,CAAC;AACH;;;;;AAUA,SAAgB,gBAAgB,SAAwB,UAA8B,CAAC,GAAkB;CACvG,OAAO,uBAAuB,SAAS;EACrC,GAAG;EACH,QAAQ,QAAQ,UAAU,eAAe;EACzC,cAAc;CAChB,CAAC;AACH;AAMA,MAAM,wBAAQ,IAAI,QAAoG;;;;;;;;;;;;;AActH,MAAa,SAAsD;CACjE,QAAQ,IAAI,SAAS;EACnB,MAAM,QAAQ;GACZ,SAAS,yBAAyB,QAAQ,KAAK;GAC/C,eAAqB;IACnB,IAAI,sBAAsB,EAAE,GAC1B;IACF,MAAM,EAAE,OAAO,QAAQ,WAAW,MAAM;IACvC,CAAC,UAAU,eAAe,EAAA,CAAG,KAAK,OAAO,WAAW,KAAA,IAAY,KAAA,IAAY,EAAE,OAAO,CAAC;GACzF;EACF;EACA,MAAM,IAAI,IAAI,KAAK;EACnB,GAAG,iBAAiB,SAAS,MAAM,OAAO;CAC5C;CACA,QAAQ,IAAI,SAAS;EACnB,MAAM,QAAQ,MAAM,IAAI,EAAE;EAC1B,IAAI,OACF,MAAM,UAAU,yBAAyB,QAAQ,KAAK;CAC1D;CACA,UAAU,IAAI;EACZ,MAAM,QAAQ,MAAM,IAAI,EAAE;EAC1B,IAAI,OACF,GAAG,oBAAoB,SAAS,MAAM,OAAO;EAC/C,MAAM,OAAO,EAAE;CACjB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xihan-ui/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"description": "XiHan.UI Vue adapter — components, composables, machine runtime.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "XiHanFun",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"vue": "^3.5.0",
|
|
62
|
-
"@xihan-ui/backgrounds": "^
|
|
63
|
-
"@xihan-ui/code-highlight": "^
|
|
64
|
-
"@xihan-ui/sound": "^
|
|
62
|
+
"@xihan-ui/backgrounds": "^3.1.0",
|
|
63
|
+
"@xihan-ui/code-highlight": "^3.1.0",
|
|
64
|
+
"@xihan-ui/sound": "^3.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@xihan-ui/backgrounds": {
|
|
@@ -75,11 +75,12 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@xihan-ui/core": "^
|
|
79
|
-
"@xihan-ui/headless": "^
|
|
80
|
-
"@xihan-ui/motion": "^
|
|
81
|
-
"@xihan-ui/pointer": "^
|
|
82
|
-
"@xihan-ui/position": "^
|
|
78
|
+
"@xihan-ui/core": "^3.1.0",
|
|
79
|
+
"@xihan-ui/headless": "^3.1.0",
|
|
80
|
+
"@xihan-ui/motion": "^3.1.0",
|
|
81
|
+
"@xihan-ui/pointer": "^3.1.0",
|
|
82
|
+
"@xihan-ui/position": "^3.1.0",
|
|
83
|
+
"@xihan-ui/viz": "^3.1.0"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
86
|
"@vitest/browser": "^4.1.11",
|
|
@@ -89,13 +90,13 @@
|
|
|
89
90
|
"playwright": "^1.62.0",
|
|
90
91
|
"vitest": "^4.1.11",
|
|
91
92
|
"vue": "^3.5.40",
|
|
92
|
-
"@xihan-ui/backgrounds": "
|
|
93
|
+
"@xihan-ui/backgrounds": "3.1.0",
|
|
93
94
|
"@xihan-ui/build": "0.0.0",
|
|
94
|
-
"@xihan-ui/code-highlight": "
|
|
95
|
-
"@xihan-ui/sound": "
|
|
96
|
-
"@xihan-ui/styles": "
|
|
95
|
+
"@xihan-ui/code-highlight": "3.1.0",
|
|
96
|
+
"@xihan-ui/sound": "3.1.0",
|
|
97
|
+
"@xihan-ui/styles": "3.1.0",
|
|
97
98
|
"@xihan-ui/testing": "0.0.0",
|
|
98
|
-
"@xihan-ui/tokens": "
|
|
99
|
+
"@xihan-ui/tokens": "3.1.0",
|
|
99
100
|
"@xihan-ui/tsconfig": "0.0.0"
|
|
100
101
|
},
|
|
101
102
|
"scripts": {
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { PropType } from "vue";
|
|
2
|
-
import { Tone } from "@xihan-ui/core";
|
|
3
|
-
import { GradientTextDirection } from "@xihan-ui/headless";
|
|
4
|
-
//#region src/components/gradient-text/gradient-text.d.ts
|
|
5
|
-
declare const XhGradientText: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
-
from: {
|
|
7
|
-
type: StringConstructor;
|
|
8
|
-
};
|
|
9
|
-
to: {
|
|
10
|
-
type: StringConstructor;
|
|
11
|
-
};
|
|
12
|
-
direction: {
|
|
13
|
-
type: PropType<GradientTextDirection>;
|
|
14
|
-
};
|
|
15
|
-
tone: {
|
|
16
|
-
type: PropType<Tone>;
|
|
17
|
-
};
|
|
18
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
-
from: {
|
|
22
|
-
type: StringConstructor;
|
|
23
|
-
};
|
|
24
|
-
to: {
|
|
25
|
-
type: StringConstructor;
|
|
26
|
-
};
|
|
27
|
-
direction: {
|
|
28
|
-
type: PropType<GradientTextDirection>;
|
|
29
|
-
};
|
|
30
|
-
tone: {
|
|
31
|
-
type: PropType<Tone>;
|
|
32
|
-
};
|
|
33
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { XhGradientText };
|
|
36
|
-
//# sourceMappingURL=gradient-text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gradient-text.d.ts","names":[],"sources":["../../../src/components/gradient-text/gradient-text.ts"],"mappings":";;;;cAca,8BAAc,8BAAA;;;;;;;;IAMM,MAAA,SAAS;;;IACd,MAAA,SAAS;;;;;;;;;;;;IADJ,MAAA,SAAS;;;IACd,MAAA,SAAS;;MASnC,oDAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { vueNormalize } from "../../runtime/normalize-props.js";
|
|
2
|
-
import { defineComponent, h } from "vue";
|
|
3
|
-
import { connectGradientText } from "@xihan-ui/headless";
|
|
4
|
-
//#region src/components/gradient-text/gradient-text.ts
|
|
5
|
-
const XhGradientText = defineComponent({
|
|
6
|
-
name: "XhGradientText",
|
|
7
|
-
props: {
|
|
8
|
-
from: { type: String },
|
|
9
|
-
to: { type: String },
|
|
10
|
-
direction: { type: String },
|
|
11
|
-
tone: { type: String }
|
|
12
|
-
},
|
|
13
|
-
setup(props, { slots }) {
|
|
14
|
-
return () => h("span", connectGradientText(props, vueNormalize).getRootProps(), slots.default?.());
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
//#endregion
|
|
18
|
-
export { XhGradientText };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=gradient-text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gradient-text.js","names":[],"sources":["../../../src/components/gradient-text/gradient-text.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 提供 gradient text 相关实现。\n\nimport type { Tone } from '@xihan-ui/core'\nimport type { GradientTextDirection, GradientTextProps } from '@xihan-ui/headless'\nimport type { PropType } from 'vue'\nimport { connectGradientText } from '@xihan-ui/headless'\nimport { defineComponent, h } from 'vue'\nimport { vueNormalize } from '../../runtime/normalize-props'\n\nexport const XhGradientText = defineComponent({\n name: 'XhGradientText',\n // 有 connect 兜底的 prop:普通类型省略 default,Boolean 显式保留 undefined\n props: {\n from: { type: String },\n to: { type: String },\n direction: { type: String as PropType<GradientTextDirection> },\n tone: { type: String as PropType<Tone> },\n },\n setup(props, { slots }) {\n return () => h(\n 'span',\n connectGradientText(props as GradientTextProps, vueNormalize).getRootProps() as Record<string, unknown>,\n slots.default?.(),\n )\n },\n})\n"],"mappings":";;;;AAcA,MAAa,iBAAiB,gBAAgB;CAC5C,MAAM;CAEN,OAAO;EACL,MAAM,EAAE,MAAM,OAAO;EACrB,IAAI,EAAE,MAAM,OAAO;EACnB,WAAW,EAAE,MAAM,OAA0C;EAC7D,MAAM,EAAE,MAAM,OAAyB;CACzC;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,aAAa,EACX,QACA,oBAAoB,OAA4B,YAAY,CAAC,CAAC,aAAa,GAC3E,MAAM,UAAU,CAClB;CACF;AACF,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PropType } from "vue";
|
|
2
|
-
import { ActionVariant, Size, Tone } from "@xihan-ui/core";
|
|
3
|
-
//#region src/components/icon-wrapper/icon-wrapper.d.ts
|
|
4
|
-
declare const XhIconWrapper: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
-
variant: {
|
|
6
|
-
type: PropType<ActionVariant>;
|
|
7
|
-
};
|
|
8
|
-
tone: {
|
|
9
|
-
type: PropType<Tone>;
|
|
10
|
-
};
|
|
11
|
-
size: {
|
|
12
|
-
type: PropType<Size>;
|
|
13
|
-
};
|
|
14
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
-
variant: {
|
|
18
|
-
type: PropType<ActionVariant>;
|
|
19
|
-
};
|
|
20
|
-
tone: {
|
|
21
|
-
type: PropType<Tone>;
|
|
22
|
-
};
|
|
23
|
-
size: {
|
|
24
|
-
type: PropType<Size>;
|
|
25
|
-
};
|
|
26
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { XhIconWrapper };
|
|
29
|
-
//# sourceMappingURL=icon-wrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-wrapper.d.ts","names":[],"sources":["../../../src/components/icon-wrapper/icon-wrapper.ts"],"mappings":";;;cAea,6BAAa,8BAAA;;IAIK,MAAA,SAAS;;;IACZ,MAAA,SAAS;;;IACT,MAAA,SAAS;;;;;;IAFN,MAAA,SAAS;;;IACZ,MAAA,SAAS;;;IACT,MAAA,SAAS;;MASnC,oDAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { vueNormalize } from "../../runtime/normalize-props.js";
|
|
2
|
-
import { withXhConfig } from "../../config/config.js";
|
|
3
|
-
import { defineComponent, h } from "vue";
|
|
4
|
-
import { connectIconWrapper } from "@xihan-ui/headless";
|
|
5
|
-
//#region src/components/icon-wrapper/icon-wrapper.ts
|
|
6
|
-
const XhIconWrapper = defineComponent({
|
|
7
|
-
name: "XhIconWrapper",
|
|
8
|
-
props: {
|
|
9
|
-
variant: { type: String },
|
|
10
|
-
tone: { type: String },
|
|
11
|
-
size: { type: String }
|
|
12
|
-
},
|
|
13
|
-
setup(props, { slots }) {
|
|
14
|
-
return () => h("span", connectIconWrapper(withXhConfig("icon-wrapper", props), vueNormalize).getRootProps(), slots.default?.());
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
//#endregion
|
|
18
|
-
export { XhIconWrapper };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=icon-wrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-wrapper.js","names":[],"sources":["../../../src/components/icon-wrapper/icon-wrapper.ts"],"sourcesContent":["/*\n * Copyright (c) 2021-Present XiHanFun and contributors.\n * Licensed under the MIT License. See LICENSE in the project root for license information.\n */\n\n// 提供 icon wrapper 相关实现。\n\nimport type { ActionVariant, Size, Tone } from '@xihan-ui/core'\nimport type { IconWrapperProps } from '@xihan-ui/headless'\nimport type { PropType } from 'vue'\nimport { connectIconWrapper } from '@xihan-ui/headless'\nimport { defineComponent, h } from 'vue'\nimport { withXhConfig } from '../../config/config'\nimport { vueNormalize } from '../../runtime/normalize-props'\n\nexport const XhIconWrapper = defineComponent({\n name: 'XhIconWrapper',\n // 有 connect 兜底的 prop:普通类型省略 default,Boolean 显式保留 undefined\n props: {\n variant: { type: String as PropType<ActionVariant> },\n tone: { type: String as PropType<Tone> },\n size: { type: String as PropType<Size> },\n },\n setup(props, { slots }) {\n return () => h(\n 'span',\n connectIconWrapper(withXhConfig('icon-wrapper', props) as IconWrapperProps, vueNormalize).getRootProps() as Record<string, unknown>,\n slots.default?.(),\n )\n },\n})\n"],"mappings":";;;;;AAeA,MAAa,gBAAgB,gBAAgB;CAC3C,MAAM;CAEN,OAAO;EACL,SAAS,EAAE,MAAM,OAAkC;EACnD,MAAM,EAAE,MAAM,OAAyB;EACvC,MAAM,EAAE,MAAM,OAAyB;CACzC;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,aAAa,EACX,QACA,mBAAmB,aAAa,gBAAgB,KAAK,GAAuB,YAAY,CAAC,CAAC,aAAa,GACvG,MAAM,UAAU,CAClB;CACF;AACF,CAAC"}
|