@w-run/wdesign-ui 0.0.0-stage → 1.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.
Files changed (214) hide show
  1. package/README.md +255 -2
  2. package/dist/index.d.ts +1013 -0
  3. package/dist/parts/WdAffix.js +159 -0
  4. package/dist/parts/WdAiMessage.js +277 -0
  5. package/dist/parts/WdAlert.js +92 -0
  6. package/dist/parts/WdAnchor.js +159 -0
  7. package/dist/parts/WdAudioPlayer.js +1024 -0
  8. package/dist/parts/WdAvatar.js +6 -0
  9. package/dist/parts/WdAvatarGroup.js +46 -0
  10. package/dist/parts/WdBacktop.js +120 -0
  11. package/dist/parts/WdBadge.js +61 -0
  12. package/dist/parts/WdBento.js +40 -0
  13. package/dist/parts/WdBentoItem.js +43 -0
  14. package/dist/parts/WdBottomSheet.js +263 -0
  15. package/dist/parts/WdBreadcrumb.js +64 -0
  16. package/dist/parts/WdButton.js +94 -0
  17. package/dist/parts/WdCalendar.js +11 -0
  18. package/dist/parts/WdCard.js +113 -0
  19. package/dist/parts/WdCarousel.js +365 -0
  20. package/dist/parts/WdCascader.js +386 -0
  21. package/dist/parts/WdCheckbox.js +81 -0
  22. package/dist/parts/WdCollapse.js +135 -0
  23. package/dist/parts/WdColorPicker.js +592 -0
  24. package/dist/parts/WdCommand.js +357 -0
  25. package/dist/parts/WdContainer.js +37 -0
  26. package/dist/parts/WdCountdown.js +163 -0
  27. package/dist/parts/WdDanmaku.js +6 -0
  28. package/dist/parts/WdDatePicker.js +169 -0
  29. package/dist/parts/WdDateTimePicker.js +162 -0
  30. package/dist/parts/WdDescriptions.js +146 -0
  31. package/dist/parts/WdDivider.js +64 -0
  32. package/dist/parts/WdDrawer.js +176 -0
  33. package/dist/parts/WdDropdown.js +140 -0
  34. package/dist/parts/WdEmpty.js +79 -0
  35. package/dist/parts/WdExplorer.js +336 -0
  36. package/dist/parts/WdFileList.js +177 -0
  37. package/dist/parts/WdForm.js +111 -0
  38. package/dist/parts/WdFormItem.js +156 -0
  39. package/dist/parts/WdGrid.js +40 -0
  40. package/dist/parts/WdGroup.js +68 -0
  41. package/dist/parts/WdImagePreview.js +274 -0
  42. package/dist/parts/WdInput.js +10 -0
  43. package/dist/parts/WdInputNumber.js +253 -0
  44. package/dist/parts/WdListItem.js +60 -0
  45. package/dist/parts/WdLoading.js +128 -0
  46. package/dist/parts/WdMarkdown.js +172 -0
  47. package/dist/parts/WdMarquee.js +80 -0
  48. package/dist/parts/WdMasonry.js +40 -0
  49. package/dist/parts/WdMediaCard.js +302 -0
  50. package/dist/parts/WdMentions.js +277 -0
  51. package/dist/parts/WdModal.js +149 -0
  52. package/dist/parts/WdNav.js +311 -0
  53. package/dist/parts/WdNotification.js +112 -0
  54. package/dist/parts/WdOtp.js +107 -0
  55. package/dist/parts/WdPagination.js +252 -0
  56. package/dist/parts/WdPopconfirm.js +214 -0
  57. package/dist/parts/WdPopover.js +203 -0
  58. package/dist/parts/WdPostItem.js +84 -0
  59. package/dist/parts/WdProgress.js +48 -0
  60. package/dist/parts/WdProgressRing.js +101 -0
  61. package/dist/parts/WdPullRefresh.js +167 -0
  62. package/dist/parts/WdQRCode.js +1909 -0
  63. package/dist/parts/WdRadioGroup.js +95 -0
  64. package/dist/parts/WdRate.js +128 -0
  65. package/dist/parts/WdResult.js +86 -0
  66. package/dist/parts/WdScrollbar.js +186 -0
  67. package/dist/parts/WdSegmented.js +11 -0
  68. package/dist/parts/WdSelect.js +465 -0
  69. package/dist/parts/WdSkeleton.js +69 -0
  70. package/dist/parts/WdSlider.js +100 -0
  71. package/dist/parts/WdSortableList.js +291 -0
  72. package/dist/parts/WdSpace.js +46 -0
  73. package/dist/parts/WdSparkline.js +148 -0
  74. package/dist/parts/WdSpinner.js +6 -0
  75. package/dist/parts/WdSplitter.js +183 -0
  76. package/dist/parts/WdStatBar.js +202 -0
  77. package/dist/parts/WdStatistic.js +131 -0
  78. package/dist/parts/WdSteps.js +110 -0
  79. package/dist/parts/WdSwitch.js +63 -0
  80. package/dist/parts/WdTabBar.js +84 -0
  81. package/dist/parts/WdTable.js +589 -0
  82. package/dist/parts/WdTabs.js +219 -0
  83. package/dist/parts/WdTag.js +6 -0
  84. package/dist/parts/WdTagInput.js +181 -0
  85. package/dist/parts/WdTimePicker.js +12 -0
  86. package/dist/parts/WdTimeline.js +145 -0
  87. package/dist/parts/WdTooltip.js +108 -0
  88. package/dist/parts/WdTour.js +264 -0
  89. package/dist/parts/WdTransfer.js +446 -0
  90. package/dist/parts/WdTree.js +322 -0
  91. package/dist/parts/WdUpload.js +309 -0
  92. package/dist/parts/WdVideoPlayer.js +1006 -0
  93. package/dist/parts/WdVirtualList.js +169 -0
  94. package/dist/parts/WdWatermark.js +150 -0
  95. package/dist/parts/chunk-3LVE72ZK.js +361 -0
  96. package/dist/parts/chunk-5HYOQ52I.js +101 -0
  97. package/dist/parts/chunk-7M3MUL3B.js +275 -0
  98. package/dist/parts/chunk-AOTJ63HN.js +15 -0
  99. package/dist/parts/chunk-AXEF2U2A.js +41 -0
  100. package/dist/parts/chunk-CY3QOSFP.js +645 -0
  101. package/dist/parts/chunk-G7NN4A6J.js +40 -0
  102. package/dist/parts/chunk-HAKYCUAR.js +9 -0
  103. package/dist/parts/chunk-JDE4AHBR.js +160 -0
  104. package/dist/parts/chunk-LT3NTWIT.js +117 -0
  105. package/dist/parts/chunk-OGHYFT7B.js +387 -0
  106. package/dist/parts/chunk-Q34U2HES.js +261 -0
  107. package/dist/parts/chunk-RLSVPJHM.js +10 -0
  108. package/dist/parts/chunk-U2CDKD2T.js +30 -0
  109. package/dist/parts/chunk-UYUNYHZD.js +40 -0
  110. package/dist/parts/chunk-VUJL2HGD.js +23 -0
  111. package/dist/parts/chunk-WCFG5KNT.js +51 -0
  112. package/dist/parts/chunk-WDDAALPI.js +42 -0
  113. package/dist/parts/chunk-WFXLDBP2.js +149 -0
  114. package/dist/style/affix.css +566 -0
  115. package/dist/style/ai-msg.css +746 -0
  116. package/dist/style/alert.css +636 -0
  117. package/dist/style/anchor.css +630 -0
  118. package/dist/style/audio.css +1954 -0
  119. package/dist/style/avatar.css +651 -0
  120. package/dist/style/backtop.css +625 -0
  121. package/dist/style/badge.css +632 -0
  122. package/dist/style/bento.css +763 -0
  123. package/dist/style/bottom-sheet.css +776 -0
  124. package/dist/style/breadcrumb.css +629 -0
  125. package/dist/style/button.css +829 -0
  126. package/dist/style/calendar.css +1512 -0
  127. package/dist/style/card.css +748 -0
  128. package/dist/style/carousel.css +670 -0
  129. package/dist/style/cascader.css +862 -0
  130. package/dist/style/checkbox.css +706 -0
  131. package/dist/style/chevron.css +575 -0
  132. package/dist/style/collapse.css +648 -0
  133. package/dist/style/colorpicker.css +876 -0
  134. package/dist/style/command.css +760 -0
  135. package/dist/style/container.css +550 -0
  136. package/dist/style/countdown.css +722 -0
  137. package/dist/style/danmaku.css +644 -0
  138. package/dist/style/datepicker.css +683 -0
  139. package/dist/style/datetime-picker.css +714 -0
  140. package/dist/style/descriptions.css +712 -0
  141. package/dist/style/divider.css +604 -0
  142. package/dist/style/dot.css +585 -0
  143. package/dist/style/drawer.css +743 -0
  144. package/dist/style/dropdown.css +645 -0
  145. package/dist/style/empty.css +657 -0
  146. package/dist/style/explorer.css +944 -0
  147. package/dist/style/file-list.css +664 -0
  148. package/dist/style/flip.css +600 -0
  149. package/dist/style/form.css +638 -0
  150. package/dist/style/grid.css +618 -0
  151. package/dist/style/group.css +1022 -0
  152. package/dist/style/icon-btn.css +641 -0
  153. package/dist/style/image-preview.css +725 -0
  154. package/dist/style/input-number.css +680 -0
  155. package/dist/style/input.css +682 -0
  156. package/dist/style/list.css +630 -0
  157. package/dist/style/loading.css +667 -0
  158. package/dist/style/markdown.css +884 -0
  159. package/dist/style/marquee.css +678 -0
  160. package/dist/style/masonry.css +614 -0
  161. package/dist/style/media-card.css +1229 -0
  162. package/dist/style/mentions.css +690 -0
  163. package/dist/style/modal.css +775 -0
  164. package/dist/style/nav.css +1046 -0
  165. package/dist/style/notification.css +601 -0
  166. package/dist/style/otp.css +699 -0
  167. package/dist/style/pagination.css +680 -0
  168. package/dist/style/popconfirm.css +645 -0
  169. package/dist/style/popover.css +740 -0
  170. package/dist/style/post-item.css +676 -0
  171. package/dist/style/progress-ring.css +640 -0
  172. package/dist/style/progress.css +576 -0
  173. package/dist/style/pull-refresh.css +637 -0
  174. package/dist/style/qrcode.css +613 -0
  175. package/dist/style/radio.css +705 -0
  176. package/dist/style/rate.css +637 -0
  177. package/dist/style/result.css +597 -0
  178. package/dist/style/scroll-reveal.css +613 -0
  179. package/dist/style/scrollbar.css +644 -0
  180. package/dist/style/segmented-picker.css +679 -0
  181. package/dist/style/segmented.css +894 -0
  182. package/dist/style/select.css +937 -0
  183. package/dist/style/skeleton.css +590 -0
  184. package/dist/style/slider.css +642 -0
  185. package/dist/style/sortable.css +714 -0
  186. package/dist/style/space.css +568 -0
  187. package/dist/style/sparkline.css +606 -0
  188. package/dist/style/spinner.css +586 -0
  189. package/dist/style/splitter.css +711 -0
  190. package/dist/style/stat-bar.css +767 -0
  191. package/dist/style/statistic.css +589 -0
  192. package/dist/style/steps.css +724 -0
  193. package/dist/style/switch.css +676 -0
  194. package/dist/style/tab-bar.css +647 -0
  195. package/dist/style/table.css +1229 -0
  196. package/dist/style/tabs.css +756 -0
  197. package/dist/style/tag-input.css +710 -0
  198. package/dist/style/tag.css +682 -0
  199. package/dist/style/time-picker.css +749 -0
  200. package/dist/style/timeline.css +1082 -0
  201. package/dist/style/toast.css +598 -0
  202. package/dist/style/tooltip.css +604 -0
  203. package/dist/style/tour.css +683 -0
  204. package/dist/style/transfer.css +858 -0
  205. package/dist/style/tree.css +786 -0
  206. package/dist/style/typography.css +947 -0
  207. package/dist/style/upload.css +758 -0
  208. package/dist/style/vlist.css +591 -0
  209. package/dist/style/vplayer.css +1588 -0
  210. package/dist/style/watermark.css +570 -0
  211. package/dist/wdesign-ui.css +21093 -0
  212. package/dist/wdesign-ui.esm.js +20265 -0
  213. package/package.json +134 -4
  214. package/tokens.json +385 -0
@@ -0,0 +1,84 @@
1
+ // .lib-build/WdPostItem.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createBlock as _createBlock } from "vue";
4
+ var _hoisted_1 = { class: "wd-post-item__title" };
5
+ var _hoisted_2 = {
6
+ key: 0,
7
+ class: "wd-post-item__emoji"
8
+ };
9
+ var _hoisted_3 = {
10
+ key: 0,
11
+ class: "wd-post-item__summary"
12
+ };
13
+ var _hoisted_4 = {
14
+ key: 1,
15
+ class: "wd-post-item__tags"
16
+ };
17
+ var WdPostItem_default = /* @__PURE__ */ _defineComponent({
18
+ ...{ name: "WdPostItem" },
19
+ __name: "WdPostItem",
20
+ props: {
21
+ title: { type: String, required: true },
22
+ summary: { type: String, required: false },
23
+ tags: { type: Array, required: false, default: () => [] },
24
+ emoji: { type: String, required: false },
25
+ href: { type: String, required: false }
26
+ },
27
+ setup(__props) {
28
+ return (_ctx, _cache) => {
29
+ return _openBlock(), _createBlock(_resolveDynamicComponent(__props.href ? "a" : "div"), {
30
+ href: __props.href,
31
+ class: "wd-post-item"
32
+ }, {
33
+ default: _withCtx(() => [
34
+ _createElementVNode("h3", _hoisted_1, [
35
+ __props.emoji ? (_openBlock(), _createElementBlock(
36
+ "span",
37
+ _hoisted_2,
38
+ _toDisplayString(__props.emoji),
39
+ 1
40
+ /* TEXT */
41
+ )) : _createCommentVNode("v-if", true),
42
+ _createTextVNode(
43
+ _toDisplayString(__props.title),
44
+ 1
45
+ /* TEXT */
46
+ )
47
+ ]),
48
+ __props.summary ? (_openBlock(), _createElementBlock(
49
+ "p",
50
+ _hoisted_3,
51
+ _toDisplayString(__props.summary),
52
+ 1
53
+ /* TEXT */
54
+ )) : _createCommentVNode("v-if", true),
55
+ __props.tags.length ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
56
+ (_openBlock(true), _createElementBlock(
57
+ _Fragment,
58
+ null,
59
+ _renderList(__props.tags, (t) => {
60
+ return _openBlock(), _createElementBlock(
61
+ "span",
62
+ {
63
+ key: t,
64
+ class: "wd-tag wd-tag--sm wd-tag--gray"
65
+ },
66
+ _toDisplayString(t),
67
+ 1
68
+ /* TEXT */
69
+ );
70
+ }),
71
+ 128
72
+ /* KEYED_FRAGMENT */
73
+ ))
74
+ ])) : _createCommentVNode("v-if", true)
75
+ ]),
76
+ _: 1
77
+ /* STABLE */
78
+ }, 8, ["href"]);
79
+ };
80
+ }
81
+ });
82
+ export {
83
+ WdPostItem_default as WdPostItem
84
+ };
@@ -0,0 +1,48 @@
1
+ // .lib-build/WdProgress.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ import { computed } from "vue";
5
+ var _hoisted_1 = ["aria-valuenow"];
6
+ var WdProgress_default = /* @__PURE__ */ _defineComponent({
7
+ ...{ name: "WdProgress" },
8
+ __name: "WdProgress",
9
+ props: {
10
+ value: { type: Number, required: false, default: 0 },
11
+ thin: { type: Boolean, required: false, default: false },
12
+ onDark: { type: Boolean, required: false, default: false },
13
+ color: { type: String, required: false, default: "" }
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const percent = computed(() => Math.max(0, Math.min(100, props.value)));
18
+ const classes = computed(() => [
19
+ "wd-progress",
20
+ props.thin ? "wd-progress--thin" : "",
21
+ props.onDark ? "wd-progress--on-dark" : ""
22
+ ]);
23
+ return (_ctx, _cache) => {
24
+ return _openBlock(), _createElementBlock("div", {
25
+ class: _normalizeClass(classes.value),
26
+ role: "progressbar",
27
+ "aria-valuenow": percent.value,
28
+ "aria-valuemin": "0",
29
+ "aria-valuemax": "100",
30
+ style: _normalizeStyle(__props.color ? { "--wd-progress-color": __props.color } : void 0)
31
+ }, [
32
+ _createElementVNode(
33
+ "span",
34
+ {
35
+ class: "wd-progress__bar",
36
+ style: _normalizeStyle({ width: percent.value + "%" })
37
+ },
38
+ null,
39
+ 4
40
+ /* STYLE */
41
+ )
42
+ ], 14, _hoisted_1);
43
+ };
44
+ }
45
+ });
46
+ export {
47
+ WdProgress_default as WdProgress
48
+ };
@@ -0,0 +1,101 @@
1
+ // .lib-build/WdProgressRing.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
4
+ import { computed } from "vue";
5
+ var _hoisted_1 = ["aria-valuenow", "aria-label"];
6
+ var _hoisted_2 = ["viewBox"];
7
+ var _hoisted_3 = ["cx", "cy", "r", "stroke-width"];
8
+ var _hoisted_4 = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "transform"];
9
+ var _hoisted_5 = { class: "wd-progress-ring__center" };
10
+ var _hoisted_6 = { class: "wd-progress-ring__value" };
11
+ var WdProgressRing_default = /* @__PURE__ */ _defineComponent({
12
+ ...{ name: "WdProgressRing" },
13
+ __name: "WdProgressRing",
14
+ props: {
15
+ value: { type: Number, required: false, default: 0 },
16
+ size: { type: Number, required: false, default: 96 },
17
+ thickness: { type: Number, required: false, default: 8 },
18
+ color: { type: String, required: false, default: "" },
19
+ trackColor: { type: String, required: false, default: "" },
20
+ onDark: { type: Boolean, required: false, default: false },
21
+ intent: { type: String, required: false, default: "normal" },
22
+ label: { type: String, required: false, default: "" }
23
+ },
24
+ setup(__props) {
25
+ const props = __props;
26
+ const percent = computed(() => Math.max(0, Math.min(100, props.value)));
27
+ const R = computed(() => (props.size - props.thickness) / 2);
28
+ const C = computed(() => 2 * Math.PI * R.value);
29
+ const dash = computed(() => percent.value / 100 * C.value);
30
+ const mid = computed(() => props.size / 2);
31
+ const ringColor = computed(() => {
32
+ if (props.color) return props.color;
33
+ return props.intent === "inverse" ? "var(--wd-warning)" : "var(--wd-red)";
34
+ });
35
+ return (_ctx, _cache) => {
36
+ return _openBlock(), _createElementBlock("div", {
37
+ class: _normalizeClass(["wd-progress-ring", { "wd-progress-ring--on-dark": __props.onDark }]),
38
+ style: _normalizeStyle({
39
+ width: __props.size + "px",
40
+ height: __props.size + "px",
41
+ "--wd-ring-color": ringColor.value,
42
+ "--wd-ring-track": __props.trackColor || void 0
43
+ }),
44
+ role: "progressbar",
45
+ "aria-valuenow": percent.value,
46
+ "aria-valuemin": "0",
47
+ "aria-valuemax": "100",
48
+ "aria-label": __props.label || void 0
49
+ }, [
50
+ (_openBlock(), _createElementBlock("svg", {
51
+ class: "wd-progress-ring__svg",
52
+ viewBox: "0 0 " + __props.size + " " + __props.size,
53
+ "aria-hidden": "true"
54
+ }, [
55
+ _createElementVNode("circle", {
56
+ class: "wd-progress-ring__track",
57
+ cx: mid.value,
58
+ cy: mid.value,
59
+ r: R.value,
60
+ fill: "none",
61
+ "stroke-width": __props.thickness
62
+ }, null, 8, _hoisted_3),
63
+ _createElementVNode("circle", {
64
+ class: "wd-progress-ring__bar",
65
+ cx: mid.value,
66
+ cy: mid.value,
67
+ r: R.value,
68
+ fill: "none",
69
+ "stroke-width": __props.thickness,
70
+ "stroke-linecap": "round",
71
+ "stroke-dasharray": C.value,
72
+ "stroke-dashoffset": C.value - dash.value,
73
+ transform: "rotate(-90 " + mid.value + " " + mid.value + ")"
74
+ }, null, 8, _hoisted_4)
75
+ ], 8, _hoisted_2)),
76
+ _createCommentVNode(" \u4E2D\u5FC3\u5185\u5BB9\uFF1A\u9ED8\u8BA4\u663E\u793A\u767E\u5206\u6BD4\uFF0C\u4E5F\u53EF\u4EE5\u585E\u56FE\u6807 / \u6587\u6848 "),
77
+ _createElementVNode("div", _hoisted_5, [
78
+ _renderSlot(_ctx.$slots, "default", { percent: percent.value }, () => [
79
+ _createElementVNode("span", _hoisted_6, [
80
+ _createTextVNode(
81
+ _toDisplayString(Math.round(percent.value)),
82
+ 1
83
+ /* TEXT */
84
+ ),
85
+ _cache[0] || (_cache[0] = _createElementVNode(
86
+ "i",
87
+ null,
88
+ "%",
89
+ -1
90
+ /* CACHED */
91
+ ))
92
+ ])
93
+ ])
94
+ ])
95
+ ], 14, _hoisted_1);
96
+ };
97
+ }
98
+ });
99
+ export {
100
+ WdProgressRing_default as WdProgressRing
101
+ };
@@ -0,0 +1,167 @@
1
+ // .lib-build/WdPullRefresh.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ import { computed, ref, watch } from "vue";
5
+ var _hoisted_1 = ["aria-label", "aria-busy"];
6
+ var _hoisted_2 = { class: "wd-pull-refresh__text" };
7
+ var WdPullRefresh_default = /* @__PURE__ */ _defineComponent({
8
+ ...{ name: "WdPullRefresh" },
9
+ __name: "WdPullRefresh",
10
+ props: {
11
+ threshold: { type: Number, required: false, default: 64 },
12
+ damping: { type: Number, required: false, default: 0.5 },
13
+ max: { type: Number, required: false, default: 120 },
14
+ refreshing: { type: Boolean, required: false, default: void 0 },
15
+ pullText: { type: String, required: false, default: "\u4E0B\u62C9\u5237\u65B0" },
16
+ releaseText: { type: String, required: false, default: "\u677E\u5F00\u5373\u53EF\u5237\u65B0" },
17
+ loadingText: { type: String, required: false, default: "\u6B63\u5728\u5237\u65B0" },
18
+ label: { type: String, required: false, default: "\u4E0B\u62C9\u5237\u65B0\u533A\u57DF" }
19
+ },
20
+ emits: ["refresh", "update:refreshing"],
21
+ setup(__props, { expose: __expose, emit: __emit }) {
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const root = ref(null);
25
+ const pull = ref(0);
26
+ const dragging = ref(false);
27
+ const inner = ref(false);
28
+ let startY = 0;
29
+ const isRefreshing = computed(
30
+ () => props.refreshing === void 0 ? inner.value : props.refreshing
31
+ );
32
+ const offset = computed(() => {
33
+ if (isRefreshing.value) return props.threshold;
34
+ return pull.value;
35
+ });
36
+ const state = computed(() => {
37
+ if (isRefreshing.value) return "loading";
38
+ return pull.value >= props.threshold ? "release" : "pull";
39
+ });
40
+ const tip = computed(() => {
41
+ if (state.value === "loading") return props.loadingText;
42
+ if (state.value === "release") return props.releaseText;
43
+ return props.pullText;
44
+ });
45
+ function atTop() {
46
+ let el = root.value?.parentElement ?? null;
47
+ while (el) {
48
+ const oy = getComputedStyle(el).overflowY;
49
+ if (oy === "auto" || oy === "scroll") {
50
+ return el.scrollTop <= 0;
51
+ }
52
+ el = el.parentElement;
53
+ }
54
+ return (window.scrollY || document.documentElement.scrollTop || 0) <= 0;
55
+ }
56
+ function onDown(e) {
57
+ if (isRefreshing.value) return;
58
+ if (!atTop()) return;
59
+ if (e.button !== 0 && e.pointerType === "mouse") return;
60
+ dragging.value = true;
61
+ startY = e.clientY;
62
+ pull.value = 0;
63
+ }
64
+ function onMove(e) {
65
+ if (!dragging.value) return;
66
+ const dy = e.clientY - startY;
67
+ if (dy <= 0) {
68
+ dragging.value = false;
69
+ pull.value = 0;
70
+ return;
71
+ }
72
+ if (dy > 4) e.preventDefault();
73
+ pull.value = Math.min(dy * props.damping, props.max);
74
+ }
75
+ function abort() {
76
+ dragging.value = false;
77
+ pull.value = 0;
78
+ }
79
+ function finish() {
80
+ if (!dragging.value) return;
81
+ dragging.value = false;
82
+ if (pull.value >= props.threshold) {
83
+ if (props.refreshing === void 0) inner.value = true;
84
+ emit("update:refreshing", true);
85
+ emit("refresh");
86
+ } else {
87
+ pull.value = 0;
88
+ }
89
+ }
90
+ watch(
91
+ () => props.refreshing,
92
+ (now, prev) => {
93
+ if (prev === true && now === false) {
94
+ pull.value = 0;
95
+ dragging.value = false;
96
+ }
97
+ }
98
+ );
99
+ function done() {
100
+ inner.value = false;
101
+ pull.value = 0;
102
+ emit("update:refreshing", false);
103
+ }
104
+ __expose({ done });
105
+ return (_ctx, _cache) => {
106
+ return _openBlock(), _createElementBlock("div", {
107
+ ref_key: "root",
108
+ ref: root,
109
+ class: _normalizeClass(["wd-pull-refresh", `wd-pull-refresh--${state.value}`]),
110
+ role: "group",
111
+ "aria-label": __props.label,
112
+ "aria-busy": isRefreshing.value || void 0,
113
+ onPointerdown: onDown,
114
+ onPointermove: onMove,
115
+ onPointerup: finish,
116
+ onPointercancel: abort,
117
+ onPointerleave: abort
118
+ }, [
119
+ _createCommentVNode(" \u63D0\u793A\u6761\uFF1A\u8DDF\u7740\u4E0B\u62C9\u8DDD\u79BB\u4E00\u8D77\u79FB\u52A8\uFF0C\u85CF\u5728\u5185\u5BB9\u4E0A\u65B9 "),
120
+ _createElementVNode(
121
+ "div",
122
+ {
123
+ class: "wd-pull-refresh__tip",
124
+ style: _normalizeStyle({ height: "0px", transform: `translateY(${offset.value}px)` }),
125
+ "aria-live": "polite"
126
+ },
127
+ [
128
+ _cache[0] || (_cache[0] = _createElementVNode(
129
+ "span",
130
+ {
131
+ class: "wd-pull-refresh__spinner",
132
+ "aria-hidden": "true"
133
+ },
134
+ null,
135
+ -1
136
+ /* CACHED */
137
+ )),
138
+ _createElementVNode(
139
+ "span",
140
+ _hoisted_2,
141
+ _toDisplayString(tip.value),
142
+ 1
143
+ /* TEXT */
144
+ )
145
+ ],
146
+ 4
147
+ /* STYLE */
148
+ ),
149
+ _createElementVNode(
150
+ "div",
151
+ {
152
+ class: "wd-pull-refresh__body",
153
+ style: _normalizeStyle({ transform: `translate3d(0, ${offset.value}px, 0)` })
154
+ },
155
+ [
156
+ _renderSlot(_ctx.$slots, "default")
157
+ ],
158
+ 4
159
+ /* STYLE */
160
+ )
161
+ ], 42, _hoisted_1);
162
+ };
163
+ }
164
+ });
165
+ export {
166
+ WdPullRefresh_default as WdPullRefresh
167
+ };