@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.
Files changed (210) hide show
  1. package/README.md +300 -171
  2. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  3. package/dist/bing-ui.css +1 -1
  4. package/dist/components/BingAnimatedText/BingAnimatedText.js +7 -0
  5. package/dist/components/BingAnimatedText/BingAnimatedText.vue_vue_type_script_setup_true_lang.js +194 -0
  6. package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.js +7 -0
  7. package/dist/components/BingAppSwitcherTransition/BingAppSwitcherTransition.vue_vue_type_script_setup_true_lang.js +244 -0
  8. package/dist/components/BingAutocomplete/BingAutocomplete.js +7 -0
  9. package/dist/components/BingAutocomplete/BingAutocomplete.vue.d.ts +4 -4
  10. package/dist/components/BingAutocomplete/BingAutocomplete.vue_vue_type_script_setup_true_lang.js +560 -0
  11. package/dist/components/BingButton/BingButton.js +7 -0
  12. package/dist/components/BingButton/BingButton.vue.d.ts +2 -2
  13. package/dist/components/BingButton/BingButton.vue_vue_type_script_setup_true_lang.js +200 -0
  14. package/dist/components/BingCard/BingCard.js +7 -0
  15. package/dist/components/BingCard/BingCard.vue_vue_type_script_setup_true_lang.js +481 -0
  16. package/dist/components/BingCarouselTransition/BingCarouselTransition.js +7 -0
  17. package/dist/components/BingCarouselTransition/BingCarouselTransition.vue_vue_type_script_setup_true_lang.js +174 -0
  18. package/dist/components/BingCheckbox/BingCheckbox.js +7 -0
  19. package/dist/components/BingCheckbox/BingCheckbox.vue.d.ts +4 -4
  20. package/dist/components/BingCheckbox/BingCheckbox.vue_vue_type_script_setup_true_lang.js +233 -0
  21. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.context.js +4 -0
  22. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.js +7 -0
  23. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue.d.ts +4 -4
  24. package/dist/components/BingCheckboxGroup/BingCheckboxGroup.vue_vue_type_script_setup_true_lang.js +105 -0
  25. package/dist/components/BingCodeBlock/BingCodeBlock.highlight.js +78 -0
  26. package/dist/components/BingCodeBlock/BingCodeBlock.js +7 -0
  27. package/dist/components/BingCodeBlock/BingCodeBlock.vue_vue_type_script_setup_true_lang.js +347 -0
  28. package/dist/components/BingColorPicker/BingColorPicker.js +7 -0
  29. package/dist/components/BingColorPicker/BingColorPicker.utils.d.ts +70 -0
  30. package/dist/components/BingColorPicker/BingColorPicker.utils.js +265 -0
  31. package/dist/components/BingColorPicker/BingColorPicker.vue.d.ts +7 -7
  32. package/dist/components/BingColorPicker/BingColorPicker.vue_vue_type_script_setup_true_lang.js +540 -0
  33. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.js +7 -0
  34. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue.d.ts +27 -0
  35. package/dist/components/BingColorPicker/BingColorPickerFormatEditor.vue_vue_type_script_setup_true_lang.js +142 -0
  36. package/dist/components/BingColorPicker/BingColorPickerSpectrum.js +7 -0
  37. package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue.d.ts +26 -0
  38. package/dist/components/BingColorPicker/BingColorPickerSpectrum.vue_vue_type_script_setup_true_lang.js +168 -0
  39. package/dist/components/BingConfigProvider/BingConfigProvider.js +5 -0
  40. package/dist/components/BingConfigProvider/BingConfigProvider.types.d.ts +5 -0
  41. package/dist/components/BingConfigProvider/BingConfigProvider.vue.d.ts +18 -0
  42. package/dist/components/BingConfigProvider/BingConfigProvider.vue_vue_type_script_setup_true_lang.js +18 -0
  43. package/dist/components/BingConfigProvider/index.d.ts +3 -0
  44. package/dist/components/BingCursor/BingCursor.controller.js +240 -0
  45. package/dist/components/BingCursor/BingCursor.js +7 -0
  46. package/dist/components/BingCursor/BingCursor.native.js +20 -0
  47. package/dist/components/BingCursor/BingCursor.presets.js +60 -0
  48. package/dist/components/BingCursor/BingCursor.shapes.js +83 -0
  49. package/dist/components/BingCursor/BingCursor.styleSource.js +83 -0
  50. package/dist/components/BingCursor/BingCursor.vue_vue_type_script_setup_true_lang.js +73 -0
  51. package/dist/components/BingDatePicker/BingDatePicker.js +7 -0
  52. package/dist/components/BingDatePicker/BingDatePicker.utils.d.ts +26 -0
  53. package/dist/components/BingDatePicker/BingDatePicker.utils.js +137 -0
  54. package/dist/components/BingDatePicker/BingDatePicker.vue.d.ts +14 -14
  55. package/dist/components/BingDatePicker/BingDatePicker.vue_vue_type_script_setup_true_lang.js +804 -0
  56. package/dist/components/BingDatePicker/BingDatePickerCalendar.js +7 -0
  57. package/dist/components/BingDatePicker/BingDatePickerCalendar.vue.d.ts +37 -0
  58. package/dist/components/BingDatePicker/BingDatePickerCalendar.vue_vue_type_script_setup_true_lang.js +248 -0
  59. package/dist/components/BingDatePicker/BingDatePickerTimePanel.js +7 -0
  60. package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue.d.ts +26 -0
  61. package/dist/components/BingDatePicker/BingDatePickerTimePanel.vue_vue_type_script_setup_true_lang.js +97 -0
  62. package/dist/components/BingDeckTransition/BingDeckTransition.js +7 -0
  63. package/dist/components/BingDeckTransition/BingDeckTransition.vue_vue_type_script_setup_true_lang.js +187 -0
  64. package/dist/components/BingDialog/BingDialog.js +7 -0
  65. package/dist/components/BingDialog/BingDialog.vue.d.ts +4 -5
  66. package/dist/components/BingDialog/BingDialog.vue_vue_type_script_setup_true_lang.js +558 -0
  67. package/dist/components/BingDropDown/BingDropDown.context.js +4 -0
  68. package/dist/components/BingDropDown/BingDropDown.js +7 -0
  69. package/dist/components/BingDropDown/BingDropDown.vue.d.ts +1 -2
  70. package/dist/components/BingDropDown/BingDropDown.vue_vue_type_script_setup_true_lang.js +649 -0
  71. package/dist/components/BingDropDown/BingDropDownItem.js +7 -0
  72. package/dist/components/BingDropDown/BingDropDownItem.vue.d.ts +1 -1
  73. package/dist/components/BingDropDown/BingDropDownItem.vue_vue_type_script_setup_true_lang.js +308 -0
  74. package/dist/components/BingFilePreview/BingFilePreview.js +7 -0
  75. package/dist/components/BingFilePreview/BingFilePreview.vue.d.ts +4 -5
  76. package/dist/components/BingFilePreview/BingFilePreview.vue_vue_type_script_setup_true_lang.js +589 -0
  77. package/dist/components/BingForm/BingForm.context.js +7 -0
  78. package/dist/components/BingForm/BingForm.js +7 -0
  79. package/dist/components/BingForm/BingForm.vue.d.ts +0 -1
  80. package/dist/components/BingForm/BingForm.vue_vue_type_script_setup_true_lang.js +300 -0
  81. package/dist/components/BingForm/formFocus.js +13 -0
  82. package/dist/components/BingForm/formTabOrder.js +27 -0
  83. package/dist/components/BingForm/useFormControl.d.ts +1 -1
  84. package/dist/components/BingForm/useFormControl.js +24 -0
  85. package/dist/components/BingForm/useFormNextHint.js +135 -0
  86. package/dist/components/BingFormItem/BingFormItem.js +7 -0
  87. package/dist/components/BingFormItem/BingFormItem.vue.d.ts +1 -1
  88. package/dist/components/BingFormItem/BingFormItem.vue_vue_type_script_setup_true_lang.js +252 -0
  89. package/dist/components/BingIcon/BingIcon.js +7 -0
  90. package/dist/components/BingIcon/BingIcon.vue_vue_type_script_setup_true_lang.js +48 -0
  91. package/dist/components/BingImage/BingImage.js +7 -0
  92. package/dist/components/BingImage/BingImage.vue_vue_type_script_setup_true_lang.js +244 -0
  93. package/dist/components/BingImagePreview/BingImagePreview.js +7 -0
  94. package/dist/components/BingImagePreview/BingImagePreview.vue.d.ts +4 -5
  95. package/dist/components/BingImagePreview/BingImagePreview.vue_vue_type_script_setup_true_lang.js +699 -0
  96. package/dist/components/BingInput/BingInput.js +7 -0
  97. package/dist/components/BingInput/BingInput.vue.d.ts +6 -6
  98. package/dist/components/BingInput/BingInput.vue_vue_type_script_setup_true_lang.js +311 -0
  99. package/dist/components/BingRadio/BingRadio.js +7 -0
  100. package/dist/components/BingRadio/BingRadio.vue.d.ts +4 -4
  101. package/dist/components/BingRadio/BingRadio.vue_vue_type_script_setup_true_lang.js +170 -0
  102. package/dist/components/BingRadioGroup/BingRadioGroup.context.js +4 -0
  103. package/dist/components/BingRadioGroup/BingRadioGroup.js +7 -0
  104. package/dist/components/BingRadioGroup/BingRadioGroup.vue.d.ts +4 -4
  105. package/dist/components/BingRadioGroup/BingRadioGroup.vue_vue_type_script_setup_true_lang.js +125 -0
  106. package/dist/components/BingResizable/BingResizable.js +7 -0
  107. package/dist/components/BingResizable/BingResizable.vue.d.ts +1 -1
  108. package/dist/components/BingResizable/BingResizable.vue_vue_type_script_setup_true_lang.js +555 -0
  109. package/dist/components/BingScrollbar/BingScrollbar.js +7 -0
  110. package/dist/components/BingScrollbar/BingScrollbar.vue.d.ts +2 -2
  111. package/dist/components/BingScrollbar/BingScrollbar.vue_vue_type_script_setup_true_lang.js +398 -0
  112. package/dist/components/BingSelect/BingSelect.js +7 -0
  113. package/dist/components/BingSelect/BingSelect.vue.d.ts +7 -7
  114. package/dist/components/BingSelect/BingSelect.vue_vue_type_script_setup_true_lang.js +1066 -0
  115. package/dist/components/BingSlider/BingSlider.js +7 -0
  116. package/dist/components/BingSlider/BingSlider.vue.d.ts +6 -6
  117. package/dist/components/BingSlider/BingSlider.vue_vue_type_script_setup_true_lang.js +130 -0
  118. package/dist/components/BingSortableList/BingSortableList.js +7 -0
  119. package/dist/components/BingSortableList/BingSortableList.vue_vue_type_script_setup_true_lang.js +334 -0
  120. package/dist/components/BingSortableList/BingSortableListItem.js +7 -0
  121. package/dist/components/BingSortableList/BingSortableListItem.vue_vue_type_script_setup_true_lang.js +76 -0
  122. package/dist/components/BingSplitPane/BingSplitPane.js +7 -0
  123. package/dist/components/BingSplitPane/BingSplitPane.vue_vue_type_script_setup_true_lang.js +167 -0
  124. package/dist/components/BingTable/BingTable.js +7 -0
  125. package/dist/components/BingTable/BingTable.measurements.js +72 -0
  126. package/dist/components/BingTable/BingTable.vue.d.ts +1 -2
  127. package/dist/components/BingTable/BingTable.vue_vue_type_script_setup_true_lang.js +1416 -0
  128. package/dist/components/BingTable/BingTableCellValue.js +7 -0
  129. package/dist/components/BingTable/BingTableCellValue.vue_vue_type_script_setup_true_lang.js +68 -0
  130. package/dist/components/BingTable/BingTableHeaderCell.js +5 -0
  131. package/dist/components/BingTable/BingTableHeaderCell.vue_vue_type_script_setup_true_lang.js +45 -0
  132. package/dist/components/BingTable/BingTableHeaderContent.js +7 -0
  133. package/dist/components/BingTable/BingTableHeaderContent.vue_vue_type_script_setup_true_lang.js +110 -0
  134. package/dist/components/BingTable/useTableColumns.js +126 -0
  135. package/dist/components/BingTableColumnControls/BingTableColumnControls.js +7 -0
  136. package/dist/components/BingTableColumnControls/BingTableColumnControls.vue.d.ts +1 -1
  137. package/dist/components/BingTableColumnControls/BingTableColumnControls.vue_vue_type_script_setup_true_lang.js +251 -0
  138. package/dist/components/BingTabs/BingTabs.js +7 -0
  139. package/dist/components/BingTabs/BingTabs.vue.d.ts +2 -3
  140. package/dist/components/BingTabs/BingTabs.vue_vue_type_script_setup_true_lang.js +320 -0
  141. package/dist/components/BingTag/BingTag.js +7 -0
  142. package/dist/components/BingTag/BingTag.vue.d.ts +0 -1
  143. package/dist/components/BingTag/BingTag.vue_vue_type_script_setup_true_lang.js +65 -0
  144. package/dist/components/BingTextarea/BingTextarea.js +7 -0
  145. package/dist/components/BingTextarea/BingTextarea.vue.d.ts +6 -6
  146. package/dist/components/BingTextarea/BingTextarea.vue_vue_type_script_setup_true_lang.js +243 -0
  147. package/dist/components/BingToast/BingToast.js +7 -0
  148. package/dist/components/BingToast/BingToast.service.js +132 -0
  149. package/dist/components/BingToast/BingToast.types.d.ts +1 -1
  150. package/dist/components/BingToast/BingToast.types.js +19 -0
  151. package/dist/components/BingToast/BingToast.vue.d.ts +0 -1
  152. package/dist/components/BingToast/BingToast.vue_vue_type_script_setup_true_lang.js +307 -0
  153. package/dist/components/BingTooltip/BingTooltip.js +7 -0
  154. package/dist/components/BingTooltip/BingTooltip.shared.js +14 -0
  155. package/dist/components/BingTooltip/BingTooltip.vue.d.ts +4 -5
  156. package/dist/components/BingTooltip/BingTooltip.vue_vue_type_script_setup_true_lang.js +572 -0
  157. package/dist/components/BingTreeSelect/BingTreeSelect.js +7 -0
  158. package/dist/components/BingTreeSelect/BingTreeSelect.vue.d.ts +7 -7
  159. package/dist/components/BingTreeSelect/BingTreeSelect.vue_vue_type_script_setup_true_lang.js +1274 -0
  160. package/dist/components/index.d.ts +1 -0
  161. package/dist/icons/LICENSE-lucide.txt +39 -0
  162. package/dist/icons/createIcon.d.ts +8 -0
  163. package/dist/icons/createIcon.js +36 -0
  164. package/dist/icons/icons.d.ts +51 -0
  165. package/dist/icons/icons.js +252 -0
  166. package/dist/icons/index.d.ts +3 -0
  167. package/dist/index.js +48 -0
  168. package/dist/motion/clickParticles.d.ts +1 -1
  169. package/dist/motion/clickParticles2.js +66 -0
  170. package/dist/motion/index.d.ts +1 -1
  171. package/dist/motion/index.js +17 -0
  172. package/dist/motion/liquidHover.js +36 -0
  173. package/dist/motion/optionDetailMotion.d.ts +7 -1
  174. package/dist/motion/optionDetailMotion.js +74 -0
  175. package/dist/motion/panelMotion.js +19 -0
  176. package/dist/motion/reducedMotion.d.ts +16 -0
  177. package/dist/motion/reducedMotion.js +28 -0
  178. package/dist/motion/selectPanelMotion.js +115 -0
  179. package/dist/motion/smoothScroll.d.ts +2 -0
  180. package/dist/motion/smoothScroll.js +276 -0
  181. package/dist/motion/useClickFeedback.js +47 -0
  182. package/dist/motion/useTextControlCaret.js +136 -0
  183. package/dist/utils/clipboard.d.ts +9 -0
  184. package/dist/utils/clipboard.js +16 -0
  185. package/dist/utils/config.d.ts +42 -0
  186. package/dist/utils/config.js +37 -0
  187. package/dist/utils/controlAttrs.js +37 -0
  188. package/dist/utils/floating.d.ts +86 -0
  189. package/dist/utils/floating.js +99 -0
  190. package/dist/utils/glass.js +25 -0
  191. package/dist/utils/overlay.js +94 -0
  192. package/dist/utils/scrollLock.js +44 -0
  193. package/dist/utils/search.d.ts +16 -0
  194. package/dist/utils/search.js +23 -0
  195. package/dist/utils/useClientReady.js +10 -0
  196. package/dist/utils/useDeferredBlurValidation.d.ts +18 -0
  197. package/dist/utils/useDeferredBlurValidation.js +34 -0
  198. package/dist/utils/useKeyboardScrollSync.d.ts +11 -0
  199. package/dist/utils/useKeyboardScrollSync.js +28 -0
  200. package/dist/utils/useOptionDetailPanel.d.ts +50 -0
  201. package/dist/utils/useOptionDetailPanel.js +180 -0
  202. package/dist/utils/useOutsidePointerDown.d.ts +8 -0
  203. package/dist/utils/useOutsidePointerDown.js +17 -0
  204. package/dist/utils/useSearchShortcutFocus.d.ts +18 -0
  205. package/dist/utils/useSearchShortcutFocus.js +47 -0
  206. package/dist/utils/useVirtualList.d.ts +42 -0
  207. package/dist/utils/useVirtualList.js +74 -0
  208. package/package.json +15 -9
  209. package/dist/bing-ui.es.js +0 -31278
  210. package/dist/bing-ui.umd.js +0 -229
@@ -0,0 +1,74 @@
1
+ import { gsap as e } from "gsap";
2
+ //#region src/motion/optionDetailMotion.ts
3
+ function t(e) {
4
+ let t = window.devicePixelRatio || 1;
5
+ return Math.round(e * t) / t;
6
+ }
7
+ function n(t) {
8
+ if (!t || (Number(e.getProperty(t, "autoAlpha")) || 0) <= .01) return;
9
+ let n = t.getBoundingClientRect();
10
+ if (!(n.width <= 0 || n.height <= 0)) return {
11
+ height: n.height,
12
+ left: n.left,
13
+ top: n.top,
14
+ width: n.width
15
+ };
16
+ }
17
+ function r({ panel: r, content: i, getTarget: a, animateContent: o = !1, previousSnapshot: s, reducedMotion: c = !1, hiddenScale: l = .96, enterEase: u = "back.out(1.5)", force3D: d, onComplete: f }) {
18
+ if (!r) return;
19
+ let p = !!r.style.height;
20
+ p && !s && (s = n(r)), (s || p) && (e.killTweensOf(r), e.set(r, { clearProps: "width,height,overflow" }));
21
+ let m = a();
22
+ if (!m) return;
23
+ let h = Number(e.getProperty(r, "autoAlpha")) || 0, g = h > .01 || !!s, _ = r.getBoundingClientRect(), v = s ?? _, y = {
24
+ height: _.height,
25
+ width: _.width
26
+ }, b = !!s && g && (o || p) && y.width > 0 && y.height > 0 && (Math.abs((s?.width ?? 0) - y.width) > .5 || Math.abs((s?.height ?? 0) - y.height) > .5), x = g ? t(v.left - m.x) : m.placement === "right" ? -8 : 8, S = g ? t(v.top - m.y) : 0, C = b ? .32 : g ? .26 : .22, w = b ? "power2.out" : g ? "power3.out" : u;
27
+ return e.killTweensOf(r), r.style.left = `${m.x}px`, r.style.top = `${m.y}px`, c ? (e.set(r, {
28
+ autoAlpha: 1,
29
+ clearProps: "transform,width,height,overflow",
30
+ willChange: "auto"
31
+ }), i && (e.killTweensOf(i), e.set(i, { clearProps: "transform,opacity,visibility" })), f?.(), m) : (e.set(r, {
32
+ autoAlpha: g ? h : 0,
33
+ scale: g ? 1 : l,
34
+ ...d === void 0 ? {} : { force3D: d },
35
+ x,
36
+ y: S,
37
+ ...b && s ? {
38
+ height: s.height,
39
+ overflow: "hidden",
40
+ width: s.width
41
+ } : {},
42
+ willChange: b ? "opacity, transform, width, height" : "opacity, transform"
43
+ }), e.to(r, {
44
+ autoAlpha: 1,
45
+ scale: 1,
46
+ x: 0,
47
+ y: 0,
48
+ ...b ? {
49
+ height: y.height,
50
+ width: y.width
51
+ } : {},
52
+ duration: C,
53
+ ease: w,
54
+ overwrite: !0,
55
+ onComplete: () => {
56
+ e.set(r, {
57
+ clearProps: "transform,width,height,overflow",
58
+ willChange: "auto"
59
+ }), f?.();
60
+ }
61
+ }), o && i && (e.killTweensOf(i), e.fromTo(i, {
62
+ autoAlpha: .72,
63
+ y: 3
64
+ }, {
65
+ autoAlpha: 1,
66
+ y: 0,
67
+ duration: .18,
68
+ ease: "power2.out",
69
+ overwrite: !0,
70
+ clearProps: "transform,opacity,visibility"
71
+ })), m);
72
+ }
73
+ //#endregion
74
+ export { n as getOptionDetailSnapshot, r as moveOptionDetailPanel };
@@ -0,0 +1,19 @@
1
+ //#region src/motion/panelMotion.ts
2
+ var e = {
3
+ duration: .18,
4
+ ease: "power3.out"
5
+ }, t = {
6
+ duration: .16,
7
+ ease: "power2.in"
8
+ };
9
+ function n(e) {
10
+ let t = e === "left" || e === "right";
11
+ return {
12
+ x: t ? e === "left" ? 8 : -8 : 0,
13
+ y: t ? 0 : e === "bottom" ? -8 : 8,
14
+ scale: .985,
15
+ transformOrigin: t ? e === "left" ? "100% 50%" : "0% 50%" : e === "bottom" ? "50% 0%" : "50% 100%"
16
+ };
17
+ }
18
+ //#endregion
19
+ export { n as getPanelHiddenTransform, e as panelEnterMotion, t as panelLeaveMotion };
@@ -0,0 +1,16 @@
1
+ import { BingReducedMotion } from '../utils/config';
2
+ type MediaQueryHost = Pick<Window, 'matchMedia'>;
3
+ /** 读取系统的减少动效设置;SSR 环境返回 false。每次调用都实时查询,不做缓存。 */
4
+ export declare function prefersReducedMotion(view?: MediaQueryHost | null | undefined): boolean;
5
+ /** 按全局策略解析是否减少动效;`view` 用于 iframe 等非当前窗口的文档。 */
6
+ export declare function resolveReducedMotion(mode: BingReducedMotion, view?: MediaQueryHost | null): boolean;
7
+ export interface UseReducedMotionOptions {
8
+ /** 系统设置或全局 `reducedMotion` 配置变化时调用,用于重建常驻动画。 */
9
+ onChange?: () => void;
10
+ }
11
+ /**
12
+ * 结合 BingConfigProvider 的 `reducedMotion` 与系统设置,返回实时判断函数。
13
+ * 必须在组件 setup 中调用。
14
+ */
15
+ export declare function useReducedMotion(options?: UseReducedMotionOptions): (view?: MediaQueryHost | null) => boolean;
16
+ export {};
@@ -0,0 +1,28 @@
1
+ import { useBingConfig as e } from "../utils/config.js";
2
+ import { getCurrentInstance as t, onBeforeUnmount as n, onMounted as r, watch as i } from "vue";
3
+ //#region src/motion/reducedMotion.ts
4
+ var a = "(prefers-reduced-motion: reduce)";
5
+ function o() {
6
+ return typeof window > "u" ? void 0 : window;
7
+ }
8
+ function s(e = o()) {
9
+ return !!(e && typeof e.matchMedia == "function" && e.matchMedia(a)?.matches);
10
+ }
11
+ function c(e, t) {
12
+ return e === "always" ? !0 : e === "never" ? !1 : s(t === void 0 ? o() : t);
13
+ }
14
+ function l(s = {}) {
15
+ let l = e(), u = (e) => c(l.reducedMotion.value, e), { onChange: d } = s;
16
+ if (d && t()) {
17
+ let e;
18
+ i(l.reducedMotion, () => d()), r(() => {
19
+ let t = o();
20
+ e = typeof t?.matchMedia == "function" ? t.matchMedia(a) : void 0, e?.addEventListener?.("change", d);
21
+ }), n(() => {
22
+ e?.removeEventListener?.("change", d), e = void 0;
23
+ });
24
+ }
25
+ return u;
26
+ }
27
+ //#endregion
28
+ export { s as prefersReducedMotion, l as useReducedMotion };
@@ -0,0 +1,115 @@
1
+ import { gsap as e } from "gsap";
2
+ //#region src/motion/selectPanelMotion.ts
3
+ function t(e, t) {
4
+ return e === "top" ? {
5
+ x: 0,
6
+ y: t
7
+ } : e === "bottom" ? {
8
+ x: 0,
9
+ y: -t
10
+ } : e === "left" ? {
11
+ x: t,
12
+ y: 0
13
+ } : {
14
+ x: -t,
15
+ y: 0
16
+ };
17
+ }
18
+ function n(e, t) {
19
+ return e === "left" || e === "right" ? { scaleX: t } : { scaleY: t };
20
+ }
21
+ function r(e, t) {
22
+ let n = t === "middle" ? "50%" : t === "end" ? "100%" : "0%";
23
+ return e === "top" ? `${n} 100%` : e === "bottom" ? `${n} 0%` : e === "left" ? `100% ${n}` : `0% ${n}`;
24
+ }
25
+ function i(e, t) {
26
+ return t.getBoundingClientRect().left < e.getBoundingClientRect().left ? 8 : -8;
27
+ }
28
+ function a({ panel: a, items: o, actionRail: s, actionButtons: c, placement: l, align: u, scale: d = !0, onComplete: f }) {
29
+ let p = l === "left" || l === "right" ? 6 : -6, m = d ? {} : { force3D: !1 }, h = e.timeline({
30
+ defaults: {
31
+ duration: .22,
32
+ ease: "power3.out",
33
+ overwrite: !0
34
+ },
35
+ onComplete: f
36
+ });
37
+ if (h.fromTo(a, {
38
+ autoAlpha: 0,
39
+ ...t(l, 8),
40
+ ...n(l, d ? .96 : 1),
41
+ ...m,
42
+ transformOrigin: r(l, u)
43
+ }, {
44
+ autoAlpha: 1,
45
+ x: 0,
46
+ y: 0,
47
+ ...n(l, 1),
48
+ duration: .24,
49
+ ease: "power3.out"
50
+ }, 0), o.length && h.fromTo(o, {
51
+ autoAlpha: 0,
52
+ ...t(l, p),
53
+ scale: d ? .98 : 1,
54
+ ...m
55
+ }, {
56
+ autoAlpha: 1,
57
+ x: 0,
58
+ y: 0,
59
+ scale: 1,
60
+ duration: .22,
61
+ stagger: .022
62
+ }, .06), s) {
63
+ let t = i(a, s);
64
+ e.set(s, { autoAlpha: 1 }), h.fromTo(c, {
65
+ autoAlpha: 0,
66
+ x: t,
67
+ scale: .72,
68
+ transformOrigin: "50% 50%"
69
+ }, {
70
+ autoAlpha: 1,
71
+ x: 0,
72
+ scale: 1,
73
+ duration: .26,
74
+ ease: "back.out(1.8)",
75
+ stagger: .055
76
+ }, .08);
77
+ }
78
+ return h;
79
+ }
80
+ function o({ panel: r, items: a, actionRail: o, actionButtons: s, placement: c, scale: l = !0, onComplete: u }) {
81
+ let d = e.timeline({
82
+ defaults: {
83
+ duration: .16,
84
+ ease: "power2.in",
85
+ overwrite: !0
86
+ },
87
+ onComplete: u
88
+ });
89
+ return a.length && d.to(a, {
90
+ autoAlpha: 0,
91
+ ...t(c, 4),
92
+ duration: .1,
93
+ stagger: {
94
+ each: .01,
95
+ from: "end"
96
+ }
97
+ }, 0), d.to(r, {
98
+ autoAlpha: 0,
99
+ ...t(c, 6),
100
+ ...n(c, l ? .97 : 1),
101
+ duration: .16
102
+ }, 0), o && (d.to(s, {
103
+ autoAlpha: 0,
104
+ x: i(r, o),
105
+ scale: .72,
106
+ duration: .14,
107
+ ease: "power2.in",
108
+ stagger: {
109
+ each: .045,
110
+ from: "end"
111
+ }
112
+ }, 0), d.set(o, { autoAlpha: 0 }, ">")), d;
113
+ }
114
+ //#endregion
115
+ export { a as createSelectPanelEnter, o as createSelectPanelLeave };
@@ -30,6 +30,8 @@ export interface SmoothScrollControllerOptions {
30
30
  getOptions?: () => SmoothScrollOptions | undefined;
31
31
  getAxes?: () => SmoothScrollAxes;
32
32
  isEnabled?: () => boolean;
33
+ /** 是否减少动效;默认只读取系统设置。 */
34
+ prefersReducedMotion?: () => boolean;
33
35
  }
34
36
  export interface SmoothScrollController {
35
37
  cancel: () => void;
@@ -0,0 +1,276 @@
1
+ import { prefersReducedMotion as e } from "./reducedMotion.js";
2
+ //#region src/motion/smoothScroll.ts
3
+ var t = /^(auto|scroll|overlay)$/, n = [
4
+ "button",
5
+ "input",
6
+ "select",
7
+ "textarea",
8
+ "video",
9
+ "audio",
10
+ "[contenteditable=\"true\"]",
11
+ "[role=\"textbox\"]"
12
+ ].join(","), r = Object.freeze({
13
+ duration: 400,
14
+ stepSize: 100,
15
+ pulseScale: 4,
16
+ accelerationDelta: 50,
17
+ accelerationMax: 3,
18
+ keyboardStep: 50,
19
+ keyboard: !0,
20
+ smoothTouchpad: !1,
21
+ respectReducedMotion: !0
22
+ }), i = Object.freeze({
23
+ duration: 280,
24
+ stepSize: 72,
25
+ pulseScale: 4,
26
+ accelerationDelta: 50,
27
+ accelerationMax: 2,
28
+ keyboard: !1,
29
+ smoothTouchpad: !1,
30
+ respectReducedMotion: !0
31
+ });
32
+ function a(e, t = {}, n = {}) {
33
+ return e === !1 ? !1 : {
34
+ ...t,
35
+ ...typeof e == "object" ? e : {},
36
+ ...n
37
+ };
38
+ }
39
+ function o(e, t, n) {
40
+ return Number.isFinite(e) ? Math.max(n, e) : t;
41
+ }
42
+ function s(e) {
43
+ return {
44
+ duration: o(e?.duration, r.duration, 0),
45
+ stepSize: o(e?.stepSize, r.stepSize, 0),
46
+ pulseScale: o(e?.pulseScale, r.pulseScale, .1),
47
+ accelerationDelta: o(e?.accelerationDelta, r.accelerationDelta, 0),
48
+ accelerationMax: o(e?.accelerationMax, r.accelerationMax, 1),
49
+ keyboardStep: o(e?.keyboardStep, r.keyboardStep, 0),
50
+ keyboard: e?.keyboard ?? r.keyboard,
51
+ smoothTouchpad: e?.smoothTouchpad ?? r.smoothTouchpad,
52
+ respectReducedMotion: e?.respectReducedMotion ?? r.respectReducedMotion
53
+ };
54
+ }
55
+ function c(e, t) {
56
+ let n = e * t;
57
+ if (n < 1) return n - (1 - Math.exp(-n));
58
+ let r = Math.exp(-1);
59
+ return r + (1 - Math.exp(-(n - 1))) * (1 - r);
60
+ }
61
+ function l(e, t = r.pulseScale) {
62
+ if (e <= 0) return 0;
63
+ if (e >= 1) return 1;
64
+ let n = Math.max(.1, t);
65
+ return c(e, n) / c(1, n);
66
+ }
67
+ function u() {
68
+ return typeof window < "u" && typeof document < "u";
69
+ }
70
+ function d() {
71
+ return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
72
+ }
73
+ function f(e, t, n) {
74
+ return Math.min(n, Math.max(t, e));
75
+ }
76
+ function p(e) {
77
+ return e === 0 ? 0 : e > 0 ? 1 : -1;
78
+ }
79
+ function m(e, t, n) {
80
+ if (n === 0) return !1;
81
+ if (t === "x") {
82
+ let t = Math.max(0, e.scrollWidth - e.clientWidth);
83
+ return t > 0 && (n < 0 ? e.scrollLeft > 0 : e.scrollLeft < t - .5);
84
+ }
85
+ let r = Math.max(0, e.scrollHeight - e.clientHeight);
86
+ return r > 0 && (n < 0 ? e.scrollTop > 0 : e.scrollTop < r - .5);
87
+ }
88
+ function h(e) {
89
+ let t = e.composedPath?.()[0] ?? e.target;
90
+ return t instanceof Element ? t : null;
91
+ }
92
+ function g(e) {
93
+ if (e.parentElement) return e.parentElement;
94
+ let t = e.getRootNode?.();
95
+ return t && "host" in t && t.host instanceof Element ? t.host : null;
96
+ }
97
+ function _(e, n, r, i) {
98
+ let a = h(e);
99
+ for (; a && a !== n;) {
100
+ if (a instanceof HTMLElement) {
101
+ let e = r !== 0 && m(a, "x", r), n = i !== 0 && m(a, "y", i);
102
+ if (!e && !n) {
103
+ a = g(a);
104
+ continue;
105
+ }
106
+ let o = window.getComputedStyle(a), s = o.overflowX || a.style.overflowX || a.style.overflow, c = o.overflowY || a.style.overflowY || a.style.overflow, l = e && t.test(s), u = n && t.test(c);
107
+ if (l || u) return !0;
108
+ }
109
+ a = g(a);
110
+ }
111
+ return !1;
112
+ }
113
+ function v(e, t, n) {
114
+ let r = e, i = e.deltaX || -Number(r.wheelDeltaX || 0), a = e.deltaY || -Number(r.wheelDeltaY || 0);
115
+ return !i && !a && (a = -Number(r.wheelDelta || 0)), e.deltaMode === WheelEvent.DOM_DELTA_LINE ? (i *= 40, a *= 40) : e.deltaMode === WheelEvent.DOM_DELTA_PAGE && (i *= Math.max(1, t.clientWidth), a *= Math.max(1, t.clientHeight)), e.shiftKey && n.horizontal && Math.abs(a) > Math.abs(i) && (i = a, a = 0), n.horizontal || (i = 0), n.vertical || (a = 0), {
116
+ x: i,
117
+ y: a
118
+ };
119
+ }
120
+ function y(e, t) {
121
+ return Math.abs(e) > 1.2 ? t / 120 * e : e;
122
+ }
123
+ function b(e) {
124
+ let t = h(e);
125
+ return t instanceof HTMLElement && !!t.closest(n);
126
+ }
127
+ function x(t) {
128
+ let n = t.prefersReducedMotion ?? (() => e()), r = [], i, a = 0, o = 0, c = 0, h = [], g = 0, x = 0;
129
+ function S() {
130
+ return s(t.getOptions?.());
131
+ }
132
+ function C() {
133
+ return t.getAxes?.() ?? {
134
+ horizontal: !0,
135
+ vertical: !0
136
+ };
137
+ }
138
+ function w() {
139
+ return t.isEnabled?.() ?? !0;
140
+ }
141
+ function T() {
142
+ !u() || i === void 0 || (window.cancelAnimationFrame(i), i = void 0);
143
+ }
144
+ function E() {
145
+ T(), r = [], a = 0, o = 0, c = 0, g = 0, x = 0;
146
+ }
147
+ function D(e, t, n) {
148
+ if (t !== 0 || g !== 0) {
149
+ let n = Math.max(0, e.scrollWidth - e.clientWidth), r = f(e.scrollLeft + t + g, 0, n);
150
+ e.scrollLeft = r, g = r - e.scrollLeft;
151
+ }
152
+ if (n !== 0 || x !== 0) {
153
+ let t = Math.max(0, e.scrollHeight - e.clientHeight), r = f(e.scrollTop + n + x, 0, t);
154
+ e.scrollTop = r, x = r - e.scrollTop;
155
+ }
156
+ }
157
+ function O() {
158
+ i = void 0;
159
+ let e = t.getElement();
160
+ if (!e || !w()) {
161
+ E();
162
+ return;
163
+ }
164
+ let n = d(), a = 0, s = 0;
165
+ if (r.forEach((e) => {
166
+ let t = n - e.start, r = e.duration === 0 || t >= e.duration ? 1 : l(t / e.duration, e.pulseScale), i = e.x * r, o = e.y * r;
167
+ a += i - e.lastX, s += o - e.lastY, e.lastX = i, e.lastY = o;
168
+ }), r = r.filter((e) => n - e.start < e.duration), D(e, a, s), r.length > 0) {
169
+ i = window.requestAnimationFrame(O);
170
+ return;
171
+ }
172
+ o = 0, c = 0, g = 0, x = 0;
173
+ }
174
+ function k() {
175
+ if (!(!u() || i !== void 0)) {
176
+ if (typeof window.requestAnimationFrame != "function") {
177
+ O();
178
+ return;
179
+ }
180
+ i = window.requestAnimationFrame(O);
181
+ }
182
+ }
183
+ function A(e, n) {
184
+ let i = t.getElement();
185
+ if (!i || !e && !n) return !1;
186
+ let s = S(), l = p(e), f = p(n);
187
+ (l !== 0 && o !== 0 && l !== o || f !== 0 && c !== 0 && f !== c) && E();
188
+ let m = d(), h = a ? m - a : Infinity, g = 1;
189
+ s.accelerationDelta > 0 && h < s.accelerationDelta && (g = Math.min((1 + s.accelerationDelta / Math.max(1, h)) / 2, s.accelerationMax));
190
+ let _ = e * g, v = n * g;
191
+ return o = p(_) || o, c = p(v) || c, a = m, s.duration === 0 || !u() || typeof window.requestAnimationFrame != "function" ? (D(i, _, v), !0) : (r.push({
192
+ x: _,
193
+ y: v,
194
+ lastX: 0,
195
+ lastY: 0,
196
+ start: m,
197
+ duration: s.duration,
198
+ pulseScale: s.pulseScale
199
+ }), k(), !0);
200
+ }
201
+ function j(e) {
202
+ return h.length === 3 && h.every((t) => t % e === 0);
203
+ }
204
+ function M(e, t) {
205
+ if (e.deltaMode !== WheelEvent.DOM_DELTA_PIXEL) return !1;
206
+ let n = e, r = n.wheelDeltaX || 0, i = n.wheelDeltaY || 0, a = Math.abs(i) >= Math.abs(r), o = (a ? i : r) || n.wheelDelta || 0, s = a ? e.deltaY : e.deltaX;
207
+ if (Math.abs(o) >= 24 && o * s < 0 && Math.abs(Math.abs(o) - Math.abs(s) * 1.2) < 1) return !1;
208
+ let c = Math.abs(o || t);
209
+ if (!c) return !1;
210
+ h.length === 0 && (h = [
211
+ c,
212
+ c,
213
+ c
214
+ ]), h.push(c), h.shift();
215
+ let l = c > 120 && j(c);
216
+ return !j(120) && !j(100) && !l;
217
+ }
218
+ function N(e) {
219
+ let n = t.getElement();
220
+ if (!n) return null;
221
+ let r = S(), i = v(e, n, C()), a = Math.abs(i.y) >= Math.abs(i.x) ? i.y : i.x;
222
+ if (!r.smoothTouchpad && M(e, a)) return null;
223
+ let o = y(i.x, r.stepSize), s = y(i.y, r.stepSize);
224
+ return o && !m(n, "x", o) && (o = 0), s && !m(n, "y", s) && (s = 0), !o && !s || _(e, n, o, s) ? null : {
225
+ x: o,
226
+ y: s
227
+ };
228
+ }
229
+ function P(e) {
230
+ if (!u() || !w() || e.defaultPrevented || e.ctrlKey || S().respectReducedMotion && n()) return !1;
231
+ let t = N(e);
232
+ return t ? (e.preventDefault(), A(t.x, t.y)) : (e.defaultPrevented || E(), !1);
233
+ }
234
+ function F(e) {
235
+ let r = t.getElement(), i = S();
236
+ if (!u() || !r || !w() || !i.keyboard || e.defaultPrevented || e.ctrlKey || e.altKey || e.metaKey || e.shiftKey && e.key !== " " || b(e) || i.respectReducedMotion && n()) return !1;
237
+ let a = C(), o = 0, s = 0;
238
+ switch (e.key) {
239
+ case "ArrowUp":
240
+ s = a.vertical ? -i.keyboardStep : 0;
241
+ break;
242
+ case "ArrowDown":
243
+ s = a.vertical ? i.keyboardStep : 0;
244
+ break;
245
+ case "ArrowLeft":
246
+ o = a.horizontal ? -i.keyboardStep : 0;
247
+ break;
248
+ case "ArrowRight":
249
+ o = a.horizontal ? i.keyboardStep : 0;
250
+ break;
251
+ case "PageUp":
252
+ s = a.vertical ? -r.clientHeight * .9 : 0;
253
+ break;
254
+ case "PageDown":
255
+ case " ":
256
+ s = a.vertical ? r.clientHeight * (e.shiftKey ? -.9 : .9) : 0;
257
+ break;
258
+ case "Home":
259
+ s = a.vertical ? -r.scrollTop : 0, o = !a.vertical && a.horizontal ? -r.scrollLeft : 0;
260
+ break;
261
+ case "End":
262
+ s = a.vertical ? Math.max(0, r.scrollHeight - r.clientHeight - r.scrollTop) : 0, o = !a.vertical && a.horizontal ? Math.max(0, r.scrollWidth - r.clientWidth - r.scrollLeft) : 0;
263
+ break;
264
+ default: return !1;
265
+ }
266
+ return o && !m(r, "x", o) && (o = 0), s && !m(r, "y", s) && (s = 0), !o && !s ? !1 : (e.preventDefault(), A(o, s));
267
+ }
268
+ return {
269
+ cancel: E,
270
+ handleKeydown: F,
271
+ handleWheel: P,
272
+ isAnimating: () => i !== void 0 || r.length > 0
273
+ };
274
+ }
275
+ //#endregion
276
+ export { i as compactSmoothScrollOptions, x as createSmoothScrollController, r as defaultSmoothScrollOptions, l as pulseEase, a as resolveComponentSmoothScroll, s as resolveSmoothScrollOptions };
@@ -0,0 +1,47 @@
1
+ import { useReducedMotion as e } from "./reducedMotion.js";
2
+ import { createClickParticles as t } from "./clickParticles2.js";
3
+ import { getCurrentInstance as n } from "vue";
4
+ //#region src/motion/useClickFeedback.ts
5
+ var r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakSet();
6
+ function a() {
7
+ let a = n().appContext.app, o = e(), s = r.get(a);
8
+ if (!s) {
9
+ s = /* @__PURE__ */ new Map(), r.set(a, s);
10
+ let e = s;
11
+ a.onUnmount(() => {
12
+ for (let t of e.values()) t.clear();
13
+ e.clear(), r.delete(a);
14
+ });
15
+ }
16
+ function c(e, n = e.currentTarget) {
17
+ if (!n?.isConnected || i.has(e) || n.matches(":disabled, [aria-disabled=\"true\"]") || n.closest("[inert]") || e.target instanceof Element && e.target.closest(".bing-checkbox:not(.is-decorative), .bing-radio") && !n.matches(".bing-checkbox__control, .bing-radio__control")) return;
18
+ i.add(e);
19
+ let r = n.ownerDocument, a = s.get(r);
20
+ a || (a = t(), s.set(r, a)), a.play(n, e, o(r.defaultView));
21
+ }
22
+ let l = /* @__PURE__ */ new WeakMap();
23
+ return {
24
+ playClickFeedback: c,
25
+ vClickFeedback: {
26
+ mounted(e, t) {
27
+ let n = {
28
+ enabled: t.value !== !1,
29
+ click(t) {
30
+ n.enabled && !t.defaultPrevented && t.button === 0 && c(t, e);
31
+ }
32
+ };
33
+ l.set(e, n), e.addEventListener("click", n.click);
34
+ },
35
+ updated(e, t) {
36
+ let n = l.get(e);
37
+ n && (n.enabled = t.value !== !1);
38
+ },
39
+ beforeUnmount(e) {
40
+ let t = l.get(e);
41
+ t && e.removeEventListener("click", t.click), l.delete(e);
42
+ }
43
+ }
44
+ };
45
+ }
46
+ //#endregion
47
+ export { a as useClickFeedback };