@moubing/bing-ui 0.11.2 → 0.12.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/README.md +300 -171
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/bing-ui.css +1 -1
- package/dist/components/BingAnimatedText/BingAnimatedText.js +7 -0
- package/dist/components/BingAnimatedText/BingAnimatedText.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.js +7 -0
- package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.js +7 -0
- package/dist/components/BingAutocomplete/BingAutocomplete.vue.d.ts +4 -4
- package/dist/components/BingAutocomplete/BingAutocomplete.vue_vue_type_script_setup_true_lang.js +560 -0
- package/dist/components/BingButton/BingButton.js +7 -0
- package/dist/components/BingButton/BingButton.vue.d.ts +2 -2
- package/dist/components/BingButton/BingButton.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BingCard/BingCard.js +7 -0
- package/dist/components/BingCard/BingCard.vue_vue_type_script_setup_true_lang.js +481 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.js +7 -0
- package/dist/components/BingCarouselTransition/BingCarouselTransition.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/BingCheckbox/BingCheckbox.js +7 -0
- package/dist/components/BingCheckbox/BingCheckbox.vue.d.ts +4 -4
- package/dist/components/BingCheckbox/BingCheckbox.vue_vue_type_script_setup_true_lang.js +233 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.context.js +4 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.js +7 -0
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.highlight.js +78 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.js +7 -0
- package/dist/components/BingCodeBlock/BingCodeBlock.vue_vue_type_script_setup_true_lang.js +347 -0
- package/dist/components/BingColorPicker/BingColorPicker.js +7 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.d.ts +70 -0
- package/dist/components/BingColorPicker/BingColorPicker.utils.js +265 -0
- package/dist/components/BingColorPicker/BingColorPicker.vue.d.ts +7 -7
- package/dist/components/BingColorPicker/BingColorPicker.vue_vue_type_script_setup_true_lang.js +540 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue.d.ts +27 -0
- package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.js +7 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue.d.ts +26 -0
- package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.js +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.types.d.ts +5 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue.d.ts +18 -0
- package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/components/BingConfigProvider/index.d.ts +3 -0
- package/dist/components/BingCursor/BingCursor.controller.js +240 -0
- package/dist/components/BingCursor/BingCursor.js +7 -0
- package/dist/components/BingCursor/BingCursor.native.js +20 -0
- package/dist/components/BingCursor/BingCursor.presets.js +60 -0
- package/dist/components/BingCursor/BingCursor.shapes.js +83 -0
- package/dist/components/BingCursor/BingCursor.styleSource.js +83 -0
- package/dist/components/BingCursor/BingCursor.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/BingDatePicker/BingDatePicker.js +7 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePicker.utils.js +137 -0
- package/dist/components/BingDatePicker/BingDatePicker.vue.d.ts +14 -14
- package/dist/components/BingDatePicker/BingDatePicker.vue_vue_type_script_setup_true_lang.js +804 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue.d.ts +37 -0
- package/dist/components/BingDatePicker/BingDatePickerCalendar.vue_vue_type_script_setup_true_lang.js +248 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.js +7 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue.d.ts +26 -0
- package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.js +7 -0
- package/dist/components/BingDeckTransition/BingDeckTransition.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/BingDialog/BingDialog.js +7 -0
- package/dist/components/BingDialog/BingDialog.vue.d.ts +4 -5
- package/dist/components/BingDialog/BingDialog.vue_vue_type_script_setup_true_lang.js +558 -0
- package/dist/components/BingDropDown/BingDropDown.context.js +4 -0
- package/dist/components/BingDropDown/BingDropDown.js +7 -0
- package/dist/components/BingDropDown/BingDropDown.vue.d.ts +1 -2
- package/dist/components/BingDropDown/BingDropDown.vue_vue_type_script_setup_true_lang.js +649 -0
- package/dist/components/BingDropDown/BingDropDownItem.js +7 -0
- package/dist/components/BingDropDown/BingDropDownItem.vue.d.ts +1 -1
- package/dist/components/BingDropDown/BingDropDownItem.vue_vue_type_script_setup_true_lang.js +308 -0
- package/dist/components/BingFilePreview/BingFilePreview.js +7 -0
- package/dist/components/BingFilePreview/BingFilePreview.vue.d.ts +4 -5
- package/dist/components/BingFilePreview/BingFilePreview.vue_vue_type_script_setup_true_lang.js +589 -0
- package/dist/components/BingForm/BingForm.context.js +7 -0
- package/dist/components/BingForm/BingForm.js +7 -0
- package/dist/components/BingForm/BingForm.vue.d.ts +0 -1
- package/dist/components/BingForm/BingForm.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/components/BingForm/formFocus.js +13 -0
- package/dist/components/BingForm/formTabOrder.js +27 -0
- package/dist/components/BingForm/useFormControl.d.ts +1 -1
- package/dist/components/BingForm/useFormControl.js +24 -0
- package/dist/components/BingForm/useFormNextHint.js +135 -0
- package/dist/components/BingFormItem/BingFormItem.js +7 -0
- package/dist/components/BingFormItem/BingFormItem.vue.d.ts +1 -1
- package/dist/components/BingFormItem/BingFormItem.vue_vue_type_script_setup_true_lang.js +252 -0
- package/dist/components/BingIcon/BingIcon.js +7 -0
- package/dist/components/BingIcon/BingIcon.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/BingImage/BingImage.js +7 -0
- package/dist/components/BingImage/BingImage.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BingImagePreview/BingImagePreview.js +7 -0
- package/dist/components/BingImagePreview/BingImagePreview.vue.d.ts +4 -5
- package/dist/components/BingImagePreview/BingImagePreview.vue_vue_type_script_setup_true_lang.js +699 -0
- package/dist/components/BingInput/BingInput.js +7 -0
- package/dist/components/BingInput/BingInput.vue.d.ts +6 -6
- package/dist/components/BingInput/BingInput.vue_vue_type_script_setup_true_lang.js +311 -0
- package/dist/components/BingRadio/BingRadio.js +7 -0
- package/dist/components/BingRadio/BingRadio.vue.d.ts +4 -4
- package/dist/components/BingRadio/BingRadio.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.context.js +4 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.js +7 -0
- package/dist/components/BingRadioGroup/BingRadioGroup.vue.d.ts +4 -4
- package/dist/components/BingRadioGroup/BingRadioGroup.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/BingResizable/BingResizable.js +7 -0
- package/dist/components/BingResizable/BingResizable.vue.d.ts +1 -1
- package/dist/components/BingResizable/BingResizable.vue_vue_type_script_setup_true_lang.js +555 -0
- package/dist/components/BingScrollbar/BingScrollbar.js +7 -0
- package/dist/components/BingScrollbar/BingScrollbar.vue.d.ts +2 -2
- package/dist/components/BingScrollbar/BingScrollbar.vue_vue_type_script_setup_true_lang.js +398 -0
- package/dist/components/BingSelect/BingSelect.js +7 -0
- package/dist/components/BingSelect/BingSelect.vue.d.ts +7 -7
- package/dist/components/BingSelect/BingSelect.vue_vue_type_script_setup_true_lang.js +1066 -0
- package/dist/components/BingSlider/BingSlider.js +7 -0
- package/dist/components/BingSlider/BingSlider.vue.d.ts +6 -6
- package/dist/components/BingSlider/BingSlider.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/components/BingSortableList/BingSortableList.js +7 -0
- package/dist/components/BingSortableList/BingSortableList.vue_vue_type_script_setup_true_lang.js +334 -0
- package/dist/components/BingSortableList/BingSortableListItem.js +7 -0
- package/dist/components/BingSortableList/BingSortableListItem.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/components/BingSplitPane/BingSplitPane.js +7 -0
- package/dist/components/BingSplitPane/BingSplitPane.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/BingTable/BingTable.js +7 -0
- package/dist/components/BingTable/BingTable.measurements.js +72 -0
- package/dist/components/BingTable/BingTable.vue.d.ts +1 -2
- package/dist/components/BingTable/BingTable.vue_vue_type_script_setup_true_lang.js +1416 -0
- package/dist/components/BingTable/BingTableCellValue.js +7 -0
- package/dist/components/BingTable/BingTableCellValue.vue_vue_type_script_setup_true_lang.js +68 -0
- package/dist/components/BingTable/BingTableHeaderCell.js +5 -0
- package/dist/components/BingTable/BingTableHeaderCell.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/BingTable/BingTableHeaderContent.js +7 -0
- package/dist/components/BingTable/BingTableHeaderContent.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/components/BingTable/useTableColumns.js +126 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.js +7 -0
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue.d.ts +1 -1
- package/dist/components/BingTableColumnControls/BingTableColumnControls.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/BingTabs/BingTabs.js +7 -0
- package/dist/components/BingTabs/BingTabs.vue.d.ts +2 -3
- package/dist/components/BingTabs/BingTabs.vue_vue_type_script_setup_true_lang.js +320 -0
- package/dist/components/BingTag/BingTag.js +7 -0
- package/dist/components/BingTag/BingTag.vue.d.ts +0 -1
- package/dist/components/BingTag/BingTag.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BingTextarea/BingTextarea.js +7 -0
- package/dist/components/BingTextarea/BingTextarea.vue.d.ts +6 -6
- package/dist/components/BingTextarea/BingTextarea.vue_vue_type_script_setup_true_lang.js +243 -0
- package/dist/components/BingToast/BingToast.js +7 -0
- package/dist/components/BingToast/BingToast.service.js +132 -0
- package/dist/components/BingToast/BingToast.types.d.ts +1 -1
- package/dist/components/BingToast/BingToast.types.js +19 -0
- package/dist/components/BingToast/BingToast.vue.d.ts +0 -1
- package/dist/components/BingToast/BingToast.vue_vue_type_script_setup_true_lang.js +307 -0
- package/dist/components/BingTooltip/BingTooltip.js +7 -0
- package/dist/components/BingTooltip/BingTooltip.shared.js +14 -0
- package/dist/components/BingTooltip/BingTooltip.vue.d.ts +4 -5
- package/dist/components/BingTooltip/BingTooltip.vue_vue_type_script_setup_true_lang.js +572 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.js +7 -0
- package/dist/components/BingTreeSelect/BingTreeSelect.vue.d.ts +7 -7
- package/dist/components/BingTreeSelect/BingTreeSelect.vue_vue_type_script_setup_true_lang.js +1274 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/icons/LICENSE-lucide.txt +39 -0
- package/dist/icons/createIcon.d.ts +8 -0
- package/dist/icons/createIcon.js +36 -0
- package/dist/icons/icons.d.ts +51 -0
- package/dist/icons/icons.js +252 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/index.js +48 -0
- package/dist/motion/clickParticles.d.ts +1 -1
- package/dist/motion/clickParticles2.js +66 -0
- package/dist/motion/index.d.ts +1 -1
- package/dist/motion/index.js +17 -0
- package/dist/motion/liquidHover.js +36 -0
- package/dist/motion/optionDetailMotion.d.ts +7 -1
- package/dist/motion/optionDetailMotion.js +74 -0
- package/dist/motion/panelMotion.js +19 -0
- package/dist/motion/reducedMotion.d.ts +16 -0
- package/dist/motion/reducedMotion.js +28 -0
- package/dist/motion/selectPanelMotion.js +115 -0
- package/dist/motion/smoothScroll.d.ts +2 -0
- package/dist/motion/smoothScroll.js +276 -0
- package/dist/motion/useClickFeedback.js +47 -0
- package/dist/motion/useTextControlCaret.js +136 -0
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/clipboard.js +16 -0
- package/dist/utils/config.d.ts +42 -0
- package/dist/utils/config.js +37 -0
- package/dist/utils/controlAttrs.js +37 -0
- package/dist/utils/floating.d.ts +86 -0
- package/dist/utils/floating.js +99 -0
- package/dist/utils/glass.js +25 -0
- package/dist/utils/overlay.js +94 -0
- package/dist/utils/scrollLock.js +44 -0
- package/dist/utils/search.d.ts +16 -0
- package/dist/utils/search.js +23 -0
- package/dist/utils/useClientReady.js +10 -0
- package/dist/utils/useDeferredBlurValidation.d.ts +18 -0
- package/dist/utils/useDeferredBlurValidation.js +34 -0
- package/dist/utils/useKeyboardScrollSync.d.ts +11 -0
- package/dist/utils/useKeyboardScrollSync.js +28 -0
- package/dist/utils/useOptionDetailPanel.d.ts +50 -0
- package/dist/utils/useOptionDetailPanel.js +180 -0
- package/dist/utils/useOutsidePointerDown.d.ts +8 -0
- package/dist/utils/useOutsidePointerDown.js +17 -0
- package/dist/utils/useSearchShortcutFocus.d.ts +18 -0
- package/dist/utils/useSearchShortcutFocus.js +47 -0
- package/dist/utils/useVirtualList.d.ts +42 -0
- package/dist/utils/useVirtualList.js +74 -0
- package/package.json +15 -9
- package/dist/bing-ui.es.js +0 -31278
- package/dist/bing-ui.umd.js +0 -229
package/README.md
CHANGED
|
@@ -1,171 +1,300 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
</
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="public/bing-ui-logo.png" width="88" alt="Bing UI 标识">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Bing UI</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><strong>让界面,动得恰到好处。</strong></p>
|
|
8
|
+
<p align="center">Vue 3 · TypeScript · GSAP · 38 个主要组件 · 浅色 / 深色 / 跟随系统</p>
|
|
9
|
+
|
|
10
|
+
Bing UI 是一套面向创意交互和真实产品场景的 Vue 3 组件库。它以中性配色、清晰边界和轻磨砂建立安静的视觉基础,把文字反馈、卡片翻面、面板转场与平滑滚动融入日常操作,适合构建工作台、内容工具、配置面板和需要细腻反馈的应用。
|
|
11
|
+
|
|
12
|
+
从按钮、表单到虚拟化表格、文件预览和可调整布局,组件通过显式的 Props、Emits、Slots 和 TypeScript 类型组合使用。当前仓库版本为 **0.12.0**,版本变化见 [更新日志](CHANGELOG.md)。
|
|
13
|
+
|
|
14
|
+
[](docs/images/components-overview-light.png)
|
|
15
|
+
|
|
16
|
+
*实际组件截图:Storybook「Design / 组件总览 / 组件与交互」。集中展示操作反馈、输入选择、卡片内容、数据协作与代码展示,点击图片可查看原图。*
|
|
17
|
+
|
|
18
|
+
[设计与交互](#设计与交互) · [快速开始](#快速开始) · [组件一览](#组件一览) · [交互细节](#交互细节) · [主题与外观](#主题与外观) · [本地开发](#本地开发) · [进一步阅读](#进一步阅读)
|
|
19
|
+
|
|
20
|
+
## 设计与交互
|
|
21
|
+
|
|
22
|
+
### 把反馈放在操作发生的地方
|
|
23
|
+
|
|
24
|
+
- **按钮与文字**:按钮提供点击碎屑、悬停反馈和加载时的逐字跳动;`BingAnimatedText` 可单独用于文字扫光和字符跳动。
|
|
25
|
+
- **卡片与转场**:卡片支持倾斜、反光、入场与点击 / 长按翻面;应用切换、横向轮播和卡组转场分别封装为独立组件。
|
|
26
|
+
- **输入与滚动**:Input / Textarea 支持平滑光标;Scrollbar 提供平滑滚动和固定轨道占位,减少内容变化时的布局偏移。
|
|
27
|
+
- **指针反馈**:`BingCursor` 提供 16 种本地 SVG 光标状态,使用浏览器原生 CSS 光标绘制,可在局部区域或整个文档启用。
|
|
28
|
+
|
|
29
|
+
动效遵循 `prefers-reduced-motion`,并在组件卸载时清理。键盘操作、焦点反馈与禁用状态按各组件的交互方式提供;复杂组合的具体边界请查阅对应示例和说明。
|
|
30
|
+
|
|
31
|
+
### 让组件能组成实际产品
|
|
32
|
+
|
|
33
|
+
- **表单**:使用 `BingForm` / `BingFormItem` 组织响应式布局、统一尺寸和禁用状态,并通过 Zod schema 校验、定位错误和管理表单。
|
|
34
|
+
- **数据工作台**:表格支持树形行、行选择、分页、排序、固定列、列宽调整和虚拟滚动;可配合独立列设置、分栏和尺寸调整组件。
|
|
35
|
+
- **内容工具**:图片、图片预览、文件预览与代码块覆盖常见内容展示,配合菜单、弹窗、提示和消息反馈完成操作流程。
|
|
36
|
+
- **主题适配**:浅色、深色和系统主题共享语义变量,支持品牌色覆盖;有磨砂能力的组件可以切换为实色表面。
|
|
37
|
+
|
|
38
|
+
## 快速开始
|
|
39
|
+
|
|
40
|
+
### 安装
|
|
41
|
+
|
|
42
|
+
在已有 Vue 3 项目中安装组件库与 GSAP:
|
|
43
|
+
|
|
44
|
+
```powershell
|
|
45
|
+
pnpm add @moubing/bing-ui gsap
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
当前包的 peer dependencies 为 `vue@^3.5.0` 和 `gsap@^3.15.0`。`zod@^4` 是可选 peer dependency:使用 `BingForm` 的 schema 校验时,请在应用中安装 Zod。
|
|
49
|
+
|
|
50
|
+
组件库以纯 ESM 多文件形式发布,其余运行时依赖(Shiki、Day.js、dnd-kit)不再打进产物,由包管理器安装与去重;打包器只会包含实际导入的组件。`BingCodeBlock` 的 Shiki 语法与主题在首次高亮时按需加载。
|
|
51
|
+
|
|
52
|
+
### 引入样式
|
|
53
|
+
|
|
54
|
+
在应用入口全局引入一次:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// src/main.ts
|
|
58
|
+
import '@moubing/bing-ui/style.css'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 使用组件
|
|
62
|
+
|
|
63
|
+
组件通过具名导入使用,无需全局注册。下面是一份可直接放入 `App.vue` 的示例:
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<script setup lang="ts">
|
|
67
|
+
import { ref } from 'vue'
|
|
68
|
+
import { BingButton, BingCard } from '@moubing/bing-ui'
|
|
69
|
+
|
|
70
|
+
const count = ref(0)
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<main class="demo">
|
|
75
|
+
<BingCard
|
|
76
|
+
title="从一个交互开始"
|
|
77
|
+
description="把内容、状态和操作放在一起。"
|
|
78
|
+
:tilt="false"
|
|
79
|
+
>
|
|
80
|
+
<p role="status">你已经点击了 {{ count }} 次。</p>
|
|
81
|
+
|
|
82
|
+
<template #footer>
|
|
83
|
+
<BingButton @click="count += 1">体验交互</BingButton>
|
|
84
|
+
<BingButton variant="secondary" @click="count = 0">重置</BingButton>
|
|
85
|
+
</template>
|
|
86
|
+
</BingCard>
|
|
87
|
+
</main>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<style scoped>
|
|
91
|
+
.demo {
|
|
92
|
+
max-width: 420px;
|
|
93
|
+
margin: 64px auto;
|
|
94
|
+
padding: 0 20px;
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
组件对应的类型也从包入口导出,例如:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import type { BingButtonProps, BingTableColumn } from '@moubing/bing-ui'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 全局配置
|
|
106
|
+
|
|
107
|
+
用 `BingConfigProvider` 包住应用或局部区域,统一默认尺寸、浮层层级和动效策略。组件显式传入的 props 始终优先;嵌套的 Provider 只覆盖自己设置的字段。
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<BingConfigProvider size="sm" :z-index="4000" reduced-motion="user">
|
|
112
|
+
<RouterView />
|
|
113
|
+
</BingConfigProvider>
|
|
114
|
+
</template>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- **`size`**:未传 `size` 的组件使用此尺寸,优先级为组件 props → 表单 / 表单项 → 全局配置 → `md`。
|
|
118
|
+
- **`zIndex`**:浮层层级基准,默认 `2000`。弹窗、消息、文件 / 图片预览、颜色选择、下拉与选择面板、日期面板、提示依次在基准上加 `0 / 100 / 300 / 400 / 900 / 1000 / 1100 / 1200`。
|
|
119
|
+
- **`reducedMotion`**:`user`(默认)跟随系统的 `prefers-reduced-motion`,`always` 始终减少 JS 动效,`never` 忽略系统设置。CSS 中的 `@media (prefers-reduced-motion)` 规则仍只跟随系统。
|
|
120
|
+
|
|
121
|
+
自定义组件可以用 `useReducedMotion()` 获得同样的判断函数,用 `useBingConfig()` 读取当前配置。
|
|
122
|
+
|
|
123
|
+
### 在 Nuxt 中使用
|
|
124
|
+
|
|
125
|
+
在 Nuxt 配置中全局加载样式,页面中仍使用显式导入:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
// nuxt.config.ts
|
|
129
|
+
export default defineNuxtConfig({
|
|
130
|
+
css: ['@moubing/bing-ui/style.css'],
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Teleport 浮层在客户端挂载后创建,服务端保留页面和控件本体。初始打开的弹层会在挂载后的更新中显示;相关测试需等待 Vue 的 `nextTick()`。业务代码若直接读取 `window` / `document`,应放在客户端生命周期中。
|
|
135
|
+
|
|
136
|
+
## 组件一览
|
|
137
|
+
|
|
138
|
+
目前提供 38 个主要组件,按使用场景组织如下。完整公开导出以 [组件入口](src/components/index.ts) 为准,各目录内包含实现、类型和 Storybook 示例。
|
|
139
|
+
|
|
140
|
+
| 场景 | 组件 | 主要能力 |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| 基础操作与展示 | `BingButton` · `BingIcon` · `BingCard` · `BingTag` | 操作层级、图标规范、内容卡片、状态标签 |
|
|
143
|
+
| 文本与候选输入 | `BingInput` · `BingTextarea` · `BingAutocomplete` | 文本 / 数字输入、多行编辑、候选搜索与异步状态 |
|
|
144
|
+
| 选择与数值 | `BingSelect` · `BingTreeSelect` · `BingDatePicker` · `BingColorPicker` · `BingSlider` | 搜索选择、树形选择、日期时间、颜色与滑块 |
|
|
145
|
+
| 单选与多选 | `BingCheckbox` · `BingCheckboxGroup` · `BingRadio` · `BingRadioGroup` | 独立控件、选项组、统一状态与键盘操作 |
|
|
146
|
+
| 表单组织 | `BingForm` · `BingFormItem` | 布局、标签、校验、错误提示与实例方法 |
|
|
147
|
+
| 浮层与反馈 | `BingDialog` · `BingDropDown` · `BingTooltip` · `BingToast` | 弹窗、普通 / 右键菜单、提示与全局消息 |
|
|
148
|
+
| 布局与操作 | `BingTabs` · `BingScrollbar` · `BingResizable` · `BingSplitPane` · `BingSortableList` | 标签切换、滚动、尺寸调整、分栏、拖拽排序 |
|
|
149
|
+
| 数据表格 | `BingTable` · `BingTableColumnControls` | 树形行、虚拟化、服务端排序 / 分页、共享列设置 |
|
|
150
|
+
| 内容与预览 | `BingImage` · `BingImagePreview` · `BingFilePreview` · `BingCodeBlock` | 图片与图库、文件预览、代码高亮与复制 |
|
|
151
|
+
| 动效与指针 | `BingAnimatedText` · `BingAppSwitcherTransition` · `BingCarouselTransition` · `BingDeckTransition` · `BingCursor` | 文字效果、面板 / 轮播 / 卡组转场、原生光标 |
|
|
152
|
+
|
|
153
|
+
另提供 `BingConfigProvider` 全局配置、`BingDropDownItem` 菜单子组件、`bingToast` / `useBingToast` 消息服务,以及 `motion`、`prefersReducedMotion` / `useReducedMotion` 和平滑滚动相关工具。
|
|
154
|
+
|
|
155
|
+
`BingIcon` 接收本地或第三方 Vue / SVG 图标组件,负责统一尺寸、描边、颜色和可访问名称。组件库内部图标已固化为本地 SVG 组件,不需要额外安装图标库。按钮图标通过 `prefix` / `suffix` 插槽传入,可以自由选择图标来源。
|
|
156
|
+
|
|
157
|
+
### 表格与复杂交互
|
|
158
|
+
|
|
159
|
+
[](docs/images/table.png)
|
|
160
|
+
|
|
161
|
+
*总览中的表格特写:选中行、状态标签与进度可同时展示,顶部搜索框与状态标签能联动筛选数据。*
|
|
162
|
+
|
|
163
|
+
`BingTable` 将数据、列定义和交互状态分开管理。通过 `v-model` 可以控制选择、展开、分页、排序和列设置;`remoteSort` 与 `remotePagination` 分别用于服务端排序和分页。多个表格需要共用列偏好时,可使用 `BingTableColumnControls`。
|
|
164
|
+
|
|
165
|
+
Storybook 的「Composition / 组件联动」进一步展示弹窗内表单、表格内操作控件,以及表单尺寸和禁用状态的传递。
|
|
166
|
+
|
|
167
|
+
## 交互细节
|
|
168
|
+
|
|
169
|
+
### 卡片的内容、操作与背面
|
|
170
|
+
|
|
171
|
+
`BingCard` 通过插槽容纳资源列表、图标、状态标签和操作按钮,点击或长按可以切换到背面。下面是同一张卡片翻面前后的实际状态:
|
|
172
|
+
|
|
173
|
+
| 正面:资源列表与底部操作 | 背面:补充信息与返回提示 |
|
|
174
|
+
| :---: | :---: |
|
|
175
|
+
| [](docs/images/card-front.png) | [](docs/images/card-back.png) |
|
|
176
|
+
|
|
177
|
+
总览示例使用默认内容、`footer` 和 `back` 插槽组织信息;卡片中的按钮保留自己的点击操作。倾斜、反光、入场和翻面效果可以在 Storybook 中实际体验。
|
|
178
|
+
|
|
179
|
+
### 多选状态与候选详情
|
|
180
|
+
|
|
181
|
+
选中的内容以可移除标签显示,展开后可以继续勾选、全选或查看禁用状态。悬停候选项时,旁侧详情面板展示补充说明和元数据,适合需要解释选项含义的场景。
|
|
182
|
+
|
|
183
|
+
[](docs/images/select-details.png)
|
|
184
|
+
|
|
185
|
+
*实际组件截图:Storybook「Components / BingSelect / 多选」。总览中的协作角色选择器另展示了搜索过滤能力。*
|
|
186
|
+
|
|
187
|
+
### 颜色、透明度与预设色板
|
|
188
|
+
|
|
189
|
+
`BingColorPicker` 在同一个面板中提供二维取色、色相、透明度、预设色板、格式切换和颜色值复制。下图展示展开后的完整面板,可以直接看到各项调节能力。
|
|
190
|
+
|
|
191
|
+
<p align="center">
|
|
192
|
+
<a href="docs/images/color-picker.png"><img src="docs/images/color-picker.png" width="420" alt="BingColorPicker 展开特写,包含取色区域、色相、透明度、预设色板、HEX 输入与复制按钮"></a>
|
|
193
|
+
</p>
|
|
194
|
+
|
|
195
|
+
*实际组件截图:Storybook「Components / BingColorPicker / 自定义色板」。*
|
|
196
|
+
|
|
197
|
+
## 主题与外观
|
|
198
|
+
|
|
199
|
+
默认浅色主题采用中性灰黑、白色表面、细边框和轻阴影;深色主题使用炭灰表面。配色、尺寸和磨砂参数集中在 [主题样式](src/theme/index.css)。
|
|
200
|
+
|
|
201
|
+
[](docs/images/components-overview-dark.png)
|
|
202
|
+
|
|
203
|
+
*与开篇相同的组件总览,切换为深色主题;输入状态、表格选中行、标签和代码配色一同变化。*
|
|
204
|
+
|
|
205
|
+
把主题设置在文档根元素上,让 Teleport 到 `body` 的弹层继承同一套变量:
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
// 在客户端执行;也可设为 'light' 或 'system'。
|
|
209
|
+
document.documentElement.dataset.bingTheme = 'dark'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
`system` 会跟随操作系统外观。应用可自行保存主题偏好,并在挂载 Vue 前恢复,减少启动时的主题闪烁。局部容器上的主题不会自动传递到其 DOM 范围之外的 Teleport 浮层。
|
|
213
|
+
|
|
214
|
+
品牌定制优先覆盖语义变量,同时维护颜色值和对应的 RGB 通道:
|
|
215
|
+
|
|
216
|
+
```css
|
|
217
|
+
html[data-bing-theme='dark'] {
|
|
218
|
+
--bing-accent-rgb: 139 92 246;
|
|
219
|
+
--bing-accent-strong-rgb: 196 181 253;
|
|
220
|
+
--bing-accent-solid-rgb: 167 139 250;
|
|
221
|
+
--bing-accent: rgb(var(--bing-accent-rgb));
|
|
222
|
+
--bing-accent-strong: rgb(var(--bing-accent-strong-rgb));
|
|
223
|
+
--bing-accent-solid: rgb(var(--bing-accent-solid-rgb));
|
|
224
|
+
--bing-accent-soft: rgb(var(--bing-accent-rgb) / 0.16);
|
|
225
|
+
--bing-accent-contrast: #0f172a;
|
|
226
|
+
--bing-focus: rgb(var(--bing-accent-rgb) / 0.62);
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- **尺寸**:常规输入和选择控件的 `sm / md / lg` 高度为 `32 / 36 / 40px`;Button 另外提供 `xs=28px`、`xl=44px`。表格行高等特殊尺寸以组件 API 为准。
|
|
231
|
+
- **磨砂**:支持 `glass` 的组件可通过 `:glass="false"` 使用实色底;显式传入的 `glassBlur` / `glassOpacity` / `glassSaturation` 优先于主题变量。
|
|
232
|
+
- **代码配色**:`BingCodeBlock` 的默认 `theme="auto"` 随明暗主题切换,也可指定 Shiki 主题名。
|
|
233
|
+
|
|
234
|
+
## 本地开发
|
|
235
|
+
|
|
236
|
+
本仓库使用 pnpm;组件开发和交互验证主要在 Storybook 中进行。
|
|
237
|
+
|
|
238
|
+
```powershell
|
|
239
|
+
pnpm install
|
|
240
|
+
pnpm storybook
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Storybook 默认使用 `6006` 端口,端口被占用时自动寻找下一个可用端口。需要临时指定起始端口时,在 PowerShell 中设置 `$env:STORYBOOK_PORT=6007` 后启动;不要追加另一组 `-p` 参数。需要独立演示入口时运行 `pnpm dev`。
|
|
244
|
+
|
|
245
|
+
### 常用命令
|
|
246
|
+
|
|
247
|
+
| 命令 | 用途 |
|
|
248
|
+
| --- | --- |
|
|
249
|
+
| `pnpm dev` | 启动 Vite 演示页面 |
|
|
250
|
+
| `pnpm storybook` | 启动组件示例与交互调试环境 |
|
|
251
|
+
| `pnpm test:run` | 运行单元 / 组件测试 |
|
|
252
|
+
| `pnpm test:browser` | 运行无头浏览器组件测试 |
|
|
253
|
+
| `pnpm build` | 类型检查并构建组件库,输出到 `dist/` |
|
|
254
|
+
| `pnpm build-storybook` | 生成静态 Storybook |
|
|
255
|
+
| `pnpm changeset` | 为需要发版的改动记录变更说明 |
|
|
256
|
+
| `pnpm version-packages` | 根据 Changesets 更新版本 |
|
|
257
|
+
|
|
258
|
+
视觉回归在组件迭代阶段暂停,仅在明确需要时运行 `pnpm test:visual`,不随日常验证更新截图基线。纯文档修改通常无需构建;逻辑改动运行单元测试,涉及公开 API / 构建的改动再执行构建,界面改动需用无头 Playwright 检查受影响的 Storybook 页面。
|
|
259
|
+
|
|
260
|
+
浏览器测试默认使用无头模式。内置 Chromium 不可用时,可以为本次测试临时设置 `BING_UI_BROWSER_CHANNEL=chrome` 或 `msedge`;运行后恢复环境变量,不把本机浏览器路径提交到仓库。
|
|
261
|
+
|
|
262
|
+
### 技术栈与目录
|
|
263
|
+
|
|
264
|
+
| 层次 | 实现 |
|
|
265
|
+
| --- | --- |
|
|
266
|
+
| 组件与类型 | Vue 3、TypeScript、单文件组件 |
|
|
267
|
+
| 动效与拖拽 | GSAP、`@dnd-kit/vue` / `@dnd-kit/dom` |
|
|
268
|
+
| 表单、日期与内容 | Zod、Day.js、Shiki |
|
|
269
|
+
| 开发与打包 | Vite 库模式、`vue-tsc`、`vite-plugin-dts` |
|
|
270
|
+
| 示例与验证 | Storybook、Vitest、Vue Test Utils、Playwright |
|
|
271
|
+
| 版本管理 | Changesets |
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
src/
|
|
275
|
+
components/ # 组件实现、类型、测试和 Storybook 示例
|
|
276
|
+
BingButton/
|
|
277
|
+
BingTable/
|
|
278
|
+
...
|
|
279
|
+
motion/ # 动效令牌与平滑滚动工具
|
|
280
|
+
theme/ # 全局主题与设计变量
|
|
281
|
+
utils/ # 组件间共享能力
|
|
282
|
+
index.ts # 公开入口
|
|
283
|
+
.storybook/ # Storybook 配置与组合展示
|
|
284
|
+
tests/visual/ # 视觉回归测试
|
|
285
|
+
docs/ # 接入说明、设计记录与 README 配图
|
|
286
|
+
.changeset/ # 版本变更记录
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
新增组件应通过组件目录的 `index.ts`、`src/components/index.ts` 和 `src/index.ts` 导出。动画需限定在实例范围内,优先使用 transform / opacity,并处理卸载清理和减少动态效果偏好。
|
|
290
|
+
|
|
291
|
+
## 进一步阅读
|
|
292
|
+
|
|
293
|
+
- [组件接入与行为说明](docs/component-notes.md):SSR 浮层、稳定滚动条占位、数字输入、自动填充、自定义光标及旧版迁移细节。
|
|
294
|
+
- [更新日志](CHANGELOG.md):已发布版本的组件与行为变化。
|
|
295
|
+
- [开发约定](AGENTS.md):目录规范、动效原则和验证要求。
|
|
296
|
+
- [组件联动示例源码](src/components/Composition.stories.ts):查看表单、弹窗和表格如何组合。
|
|
297
|
+
- [组件总览示例源码](.storybook/ReadmeShowcase.vue):查看 README 中的组件组合,或在 Storybook「Design / 组件总览 / 组件与交互」中操作并更新配图。
|
|
298
|
+
- **配套项目 `bing-ui-docs`**:基于 Nuxt 的使用文档站,包含快速开始、38 个组件页面、完整示例和 `llms.txt` AI 文档入口。
|
|
299
|
+
|
|
300
|
+
本文七张效果图均来自本仓库的实际 Storybook 页面,使用 2 倍像素密度保存到 `docs/images/`。点击图片可查看原图;阅读 README 无需启动开发服务,动态交互可在对应 Storybook 示例中体验。
|