@w-run/wdesign-ui 1.0.0 → 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 (213) hide show
  1. package/README.md +208 -127
  2. package/dist/index.d.ts +1010 -80
  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 +572 -13
  116. package/dist/style/alert.css +577 -5
  117. package/dist/style/anchor.css +630 -0
  118. package/dist/style/audio.css +658 -67
  119. package/dist/style/avatar.css +575 -12
  120. package/dist/style/backtop.css +625 -0
  121. package/dist/style/badge.css +595 -11
  122. package/dist/style/bento.css +763 -0
  123. package/dist/style/bottom-sheet.css +776 -0
  124. package/dist/style/breadcrumb.css +579 -4
  125. package/dist/style/button.css +631 -36
  126. package/dist/style/calendar.css +1512 -0
  127. package/dist/style/card.css +683 -6
  128. package/dist/style/carousel.css +573 -4
  129. package/dist/style/cascader.css +862 -0
  130. package/dist/style/checkbox.css +584 -7
  131. package/dist/style/chevron.css +543 -1
  132. package/dist/style/collapse.css +586 -7
  133. package/dist/style/colorpicker.css +876 -0
  134. package/dist/style/command.css +572 -13
  135. package/dist/style/container.css +543 -0
  136. package/dist/style/countdown.css +722 -0
  137. package/dist/style/danmaku.css +644 -0
  138. package/dist/style/datepicker.css +606 -128
  139. package/dist/style/datetime-picker.css +714 -0
  140. package/dist/style/descriptions.css +604 -11
  141. package/dist/style/divider.css +544 -2
  142. package/dist/style/dot.css +556 -1
  143. package/dist/style/drawer.css +609 -11
  144. package/dist/style/dropdown.css +565 -3
  145. package/dist/style/empty.css +624 -3
  146. package/dist/style/explorer.css +632 -24
  147. package/dist/style/file-list.css +577 -5
  148. package/dist/style/flip.css +600 -0
  149. package/dist/style/form.css +550 -8
  150. package/dist/style/grid.css +614 -0
  151. package/dist/style/group.css +560 -16
  152. package/dist/style/icon-btn.css +570 -4
  153. package/dist/style/image-preview.css +652 -8
  154. package/dist/style/input-number.css +680 -0
  155. package/dist/style/input.css +571 -8
  156. package/dist/style/list.css +553 -4
  157. package/dist/style/loading.css +667 -0
  158. package/dist/style/markdown.css +592 -20
  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 +626 -15
  164. package/dist/style/nav.css +1046 -0
  165. package/dist/style/notification.css +556 -7
  166. package/dist/style/otp.css +567 -7
  167. package/dist/style/pagination.css +571 -11
  168. package/dist/style/popconfirm.css +568 -10
  169. package/dist/style/popover.css +645 -15
  170. package/dist/style/post-item.css +548 -6
  171. package/dist/style/progress-ring.css +640 -0
  172. package/dist/style/progress.css +543 -1
  173. package/dist/style/pull-refresh.css +637 -0
  174. package/dist/style/qrcode.css +613 -0
  175. package/dist/style/radio.css +584 -5
  176. package/dist/style/rate.css +594 -1
  177. package/dist/style/result.css +546 -3
  178. package/dist/style/scroll-reveal.css +613 -0
  179. package/dist/style/scrollbar.css +644 -0
  180. package/dist/style/segmented-picker.css +573 -14
  181. package/dist/style/segmented.css +711 -7
  182. package/dist/style/select.css +682 -26
  183. package/dist/style/skeleton.css +559 -0
  184. package/dist/style/slider.css +565 -4
  185. package/dist/style/sortable.css +593 -7
  186. package/dist/style/space.css +543 -0
  187. package/dist/style/sparkline.css +606 -0
  188. package/dist/style/spinner.css +559 -0
  189. package/dist/style/splitter.css +711 -0
  190. package/dist/style/stat-bar.css +767 -0
  191. package/dist/style/statistic.css +552 -7
  192. package/dist/style/steps.css +633 -9
  193. package/dist/style/switch.css +585 -4
  194. package/dist/style/tab-bar.css +647 -0
  195. package/dist/style/table.css +886 -36
  196. package/dist/style/tabs.css +599 -10
  197. package/dist/style/tag-input.css +710 -0
  198. package/dist/style/tag.css +603 -18
  199. package/dist/style/time-picker.css +749 -0
  200. package/dist/style/timeline.css +575 -14
  201. package/dist/style/toast.css +567 -6
  202. package/dist/style/tooltip.css +564 -5
  203. package/dist/style/tour.css +683 -0
  204. package/dist/style/transfer.css +858 -0
  205. package/dist/style/tree.css +613 -16
  206. package/dist/style/typography.css +884 -3
  207. package/dist/style/upload.css +602 -13
  208. package/dist/style/vlist.css +543 -1
  209. package/dist/style/vplayer.css +799 -57
  210. package/dist/style/watermark.css +570 -0
  211. package/dist/wdesign-ui.css +18055 -7262
  212. package/dist/wdesign-ui.esm.js +8976 -5044
  213. package/package.json +99 -13
@@ -0,0 +1,264 @@
1
+ import {
2
+ useFocusTrap
3
+ } from "./chunk-LT3NTWIT.js";
4
+ import "./chunk-5HYOQ52I.js";
5
+ import {
6
+ useAnchoredPosition
7
+ } from "./chunk-WFXLDBP2.js";
8
+
9
+ // .lib-build/WdTour.ts
10
+ import { defineComponent as _defineComponent } from "vue";
11
+ import { createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, renderSlot as _renderSlot, mergeProps as _mergeProps, Teleport as _Teleport, createBlock as _createBlock } from "vue";
12
+ import { ref, computed, watch, onMounted, onUnmounted, nextTick } from "vue";
13
+ var _hoisted_1 = {
14
+ key: 1,
15
+ class: "wd-tour__veil"
16
+ };
17
+ var _hoisted_2 = ["aria-label"];
18
+ var _hoisted_3 = { class: "wd-tour__head" };
19
+ var _hoisted_4 = { class: "wd-tour__count" };
20
+ var _hoisted_5 = { class: "wd-tour__title" };
21
+ var _hoisted_6 = {
22
+ key: 0,
23
+ class: "wd-tour__desc"
24
+ };
25
+ var _hoisted_7 = { class: "wd-tour__foot" };
26
+ var WdTour_default = /* @__PURE__ */ _defineComponent({
27
+ ...{ name: "WdTour" },
28
+ __name: "WdTour",
29
+ props: {
30
+ modelValue: { type: Boolean, required: false, default: false },
31
+ steps: { type: Array, required: true },
32
+ startAt: { type: Number, required: false, default: 0 },
33
+ maskOpacity: { type: Number, required: false, default: 0.45 },
34
+ nextText: { type: String, required: false, default: "\u4E0B\u4E00\u6B65" },
35
+ prevText: { type: String, required: false, default: "\u4E0A\u4E00\u6B65" },
36
+ doneText: { type: String, required: false, default: "\u77E5\u9053\u4E86" },
37
+ skipText: { type: String, required: false, default: "\u8DF3\u8FC7" }
38
+ },
39
+ emits: ["update:modelValue", "change", "finish", "skip"],
40
+ setup(__props, { emit: __emit }) {
41
+ const props = __props;
42
+ const emit = __emit;
43
+ const idx = ref(props.startAt);
44
+ const rootEl = ref(null);
45
+ const panelEl = ref(null);
46
+ const anchorEl = ref(null);
47
+ const current = computed(() => props.steps[idx.value]);
48
+ const isLast = computed(() => idx.value >= props.steps.length - 1);
49
+ const isFirst = computed(() => idx.value <= 0);
50
+ const hole = ref(null);
51
+ function resolveTarget(step) {
52
+ if (!step) return null;
53
+ const t = step.target;
54
+ if (typeof t === "string") return document.querySelector(t);
55
+ if (typeof t === "function") return t();
56
+ return t;
57
+ }
58
+ function measure() {
59
+ const el = resolveTarget(current.value);
60
+ anchorEl.value = el;
61
+ if (!el) {
62
+ hole.value = null;
63
+ return;
64
+ }
65
+ const r = el.getBoundingClientRect();
66
+ const pad = 6;
67
+ hole.value = {
68
+ top: r.top + window.scrollY - pad,
69
+ left: r.left + window.scrollX - pad,
70
+ width: r.width + pad * 2,
71
+ height: r.height + pad * 2
72
+ };
73
+ }
74
+ async function go(i) {
75
+ if (i < 0 || i >= props.steps.length) return;
76
+ idx.value = i;
77
+ emit("change", i);
78
+ await nextTick();
79
+ const el = resolveTarget(current.value);
80
+ if (el) {
81
+ el.scrollIntoView({ block: "center", behavior: "smooth" });
82
+ await new Promise((r) => setTimeout(r, 260));
83
+ }
84
+ measure();
85
+ panelEl.value?.focus();
86
+ }
87
+ function next() {
88
+ if (isLast.value) {
89
+ finish();
90
+ } else {
91
+ go(idx.value + 1);
92
+ }
93
+ }
94
+ function prev() {
95
+ if (!isFirst.value) go(idx.value - 1);
96
+ }
97
+ function finish() {
98
+ emit("update:modelValue", false);
99
+ emit("finish");
100
+ }
101
+ function skip() {
102
+ emit("update:modelValue", false);
103
+ emit("skip", idx.value);
104
+ }
105
+ const { pos } = useAnchoredPosition(
106
+ computed(() => props.modelValue && !!anchorEl.value),
107
+ anchorEl,
108
+ panelEl,
109
+ { placement: current.value?.placement || "bottom", offset: 12 }
110
+ );
111
+ const openRef = computed(() => props.modelValue);
112
+ useFocusTrap(openRef, panelEl, () => {
113
+ skip();
114
+ return true;
115
+ });
116
+ function onKey(e) {
117
+ if (!props.modelValue) return;
118
+ if (e.key === "ArrowRight") {
119
+ e.preventDefault();
120
+ next();
121
+ } else if (e.key === "ArrowLeft") {
122
+ e.preventDefault();
123
+ prev();
124
+ }
125
+ }
126
+ function onResize() {
127
+ if (props.modelValue) measure();
128
+ }
129
+ watch(() => props.modelValue, async (v) => {
130
+ if (v) {
131
+ idx.value = props.startAt;
132
+ await nextTick();
133
+ await go(props.startAt);
134
+ }
135
+ });
136
+ watch(() => props.steps, () => {
137
+ if (props.modelValue) measure();
138
+ }, { deep: true });
139
+ onMounted(() => {
140
+ window.addEventListener("keydown", onKey);
141
+ window.addEventListener("resize", onResize);
142
+ window.addEventListener("scroll", onResize, true);
143
+ });
144
+ onUnmounted(() => {
145
+ window.removeEventListener("keydown", onKey);
146
+ window.removeEventListener("resize", onResize);
147
+ window.removeEventListener("scroll", onResize, true);
148
+ });
149
+ return (_ctx, _cache) => {
150
+ return _openBlock(), _createBlock(_Teleport, { to: "body" }, [
151
+ __props.modelValue ? (_openBlock(), _createElementBlock(
152
+ "div",
153
+ _mergeProps({
154
+ key: 0,
155
+ ref_key: "rootEl",
156
+ ref: rootEl
157
+ }, _ctx.$attrs, {
158
+ class: "wd-tour",
159
+ style: { "--mask-a": __props.maskOpacity }
160
+ }),
161
+ [
162
+ _createCommentVNode("\n \u906E\u7F69\u7528\u300C\u6316\u6D1E\u300D\u800C\u4E0D\u662F\u76D6\u4E00\u5C42\u7CCA\u4F4F\uFF1A\n box-shadow: 0 0 0 9999px \u5E26\u900F\u660E\u5EA6\uFF0C\u4E2D\u95F4\u7684\u6D1E\u662F\u5143\u7D20\u672C\u8EAB\u7684\u5F62\u72B6\u3002\n \u6BD4 clip-path \u517C\u5BB9\u6027\u597D\uFF0C\u4E5F\u4E0D\u7528\u989D\u5916\u7B97 path\u3002\n "),
163
+ hole.value ? (_openBlock(), _createElementBlock(
164
+ "div",
165
+ {
166
+ key: 0,
167
+ class: "wd-tour__hole",
168
+ style: _normalizeStyle({
169
+ top: hole.value.top + "px",
170
+ left: hole.value.left + "px",
171
+ width: hole.value.width + "px",
172
+ height: hole.value.height + "px"
173
+ })
174
+ },
175
+ null,
176
+ 4
177
+ /* STYLE */
178
+ )) : (_openBlock(), _createElementBlock("div", _hoisted_1)),
179
+ _createElementVNode("div", {
180
+ ref_key: "panelEl",
181
+ ref: panelEl,
182
+ class: "wd-tour__panel",
183
+ role: "dialog",
184
+ "aria-modal": "true",
185
+ "aria-label": current.value?.title || "\u5F15\u5BFC",
186
+ tabindex: "-1",
187
+ style: _normalizeStyle(anchorEl.value && hole.value ? { top: _unref(pos).top + "px", left: _unref(pos).left + "px" } : { top: "50%", left: "50%", transform: "translate(-50%, -50%)" })
188
+ }, [
189
+ _createElementVNode("div", _hoisted_3, [
190
+ _createElementVNode(
191
+ "span",
192
+ _hoisted_4,
193
+ _toDisplayString(idx.value + 1) + " / " + _toDisplayString(__props.steps.length),
194
+ 1
195
+ /* TEXT */
196
+ ),
197
+ __props.skipText && current.value?.closable !== false ? (_openBlock(), _createElementBlock(
198
+ "button",
199
+ {
200
+ key: 0,
201
+ type: "button",
202
+ class: "wd-tour__skip",
203
+ onClick: skip
204
+ },
205
+ _toDisplayString(__props.skipText),
206
+ 1
207
+ /* TEXT */
208
+ )) : _createCommentVNode("v-if", true)
209
+ ]),
210
+ _createElementVNode(
211
+ "h4",
212
+ _hoisted_5,
213
+ _toDisplayString(current.value?.title),
214
+ 1
215
+ /* TEXT */
216
+ ),
217
+ current.value?.desc ? (_openBlock(), _createElementBlock(
218
+ "p",
219
+ _hoisted_6,
220
+ _toDisplayString(current.value.desc),
221
+ 1
222
+ /* TEXT */
223
+ )) : _createCommentVNode("v-if", true),
224
+ _createElementVNode("div", _hoisted_7, [
225
+ !isFirst.value ? (_openBlock(), _createElementBlock(
226
+ "button",
227
+ {
228
+ key: 0,
229
+ type: "button",
230
+ class: "wd-tour__btn",
231
+ onClick: prev
232
+ },
233
+ _toDisplayString(__props.prevText),
234
+ 1
235
+ /* TEXT */
236
+ )) : _createCommentVNode("v-if", true),
237
+ _createElementVNode(
238
+ "button",
239
+ {
240
+ type: "button",
241
+ class: "wd-tour__btn wd-tour__btn--main",
242
+ onClick: next
243
+ },
244
+ _toDisplayString(isLast.value ? __props.doneText : __props.nextText),
245
+ 1
246
+ /* TEXT */
247
+ )
248
+ ]),
249
+ _renderSlot(_ctx.$slots, "panel", {
250
+ index: idx.value,
251
+ step: current.value
252
+ })
253
+ ], 12, _hoisted_2)
254
+ ],
255
+ 16
256
+ /* FULL_PROPS */
257
+ )) : _createCommentVNode("v-if", true)
258
+ ]);
259
+ };
260
+ }
261
+ });
262
+ export {
263
+ WdTour_default as WdTour
264
+ };