@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,357 @@
1
+ import {
2
+ useComposition
3
+ } from "./chunk-U2CDKD2T.js";
4
+ import {
5
+ useFocusTrap
6
+ } from "./chunk-LT3NTWIT.js";
7
+ import "./chunk-5HYOQ52I.js";
8
+ import {
9
+ WdIcon_default
10
+ } from "./chunk-Q34U2HES.js";
11
+
12
+ // .lib-build/WdCommand.ts
13
+ import { defineComponent as _defineComponent } from "vue";
14
+ import { createElementVNode as _createElementVNode, unref as _unref, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, Teleport as _Teleport, createBlock as _createBlock } from "vue";
15
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, toRef, watch } from "vue";
16
+ var _hoisted_1 = { class: "wd-command__input-row" };
17
+ var _hoisted_2 = ["value", "placeholder"];
18
+ var _hoisted_3 = {
19
+ key: 0,
20
+ class: "wd-command__group"
21
+ };
22
+ var _hoisted_4 = ["data-idx", "disabled", "onClick", "onMousemove"];
23
+ var _hoisted_5 = {
24
+ key: 0,
25
+ class: "wd-command__item-icon"
26
+ };
27
+ var _hoisted_6 = { class: "wd-command__item-main" };
28
+ var _hoisted_7 = { class: "wd-command__item-label" };
29
+ var _hoisted_8 = {
30
+ key: 0,
31
+ class: "wd-command__item-hint"
32
+ };
33
+ var _hoisted_9 = {
34
+ key: 1,
35
+ class: "wd-command__item-shortcut"
36
+ };
37
+ var _hoisted_10 = {
38
+ key: 0,
39
+ class: "wd-command__empty"
40
+ };
41
+ var WdCommand_default = /* @__PURE__ */ _defineComponent({
42
+ ...{ name: "WdCommand" },
43
+ __name: "WdCommand",
44
+ props: {
45
+ modelValue: { type: Boolean, required: false, default: false },
46
+ items: { type: Array, required: false, default: () => [] },
47
+ placeholder: { type: String, required: false, default: "\u8F93\u5165\u547D\u4EE4\u6216\u641C\u7D22\u2026" },
48
+ emptyText: { type: String, required: false, default: "\u6CA1\u6709\u5339\u914D\u7684\u7ED3\u679C" },
49
+ autofocus: { type: Boolean, required: false, default: true },
50
+ maxHeight: { type: Number, required: false, default: 380 }
51
+ },
52
+ emits: ["update:modelValue", "select", "search"],
53
+ setup(__props, { emit: __emit }) {
54
+ const props = __props;
55
+ const emit = __emit;
56
+ const q = ref("");
57
+ const { onCompositionStart, onCompositionEnd, shouldSkip } = useComposition();
58
+ function onSearchInput(e) {
59
+ if (shouldSkip(e)) return;
60
+ q.value = e.target.value;
61
+ }
62
+ function onSearchCompositionEnd(e) {
63
+ onCompositionEnd(e);
64
+ q.value = e.target.value;
65
+ }
66
+ const activeIdx = ref(0);
67
+ const inputEl = ref(null);
68
+ const listEl = ref(null);
69
+ const panelEl = ref(null);
70
+ function score(item, needle) {
71
+ const low = needle.toLowerCase();
72
+ const label = item.label.toLowerCase();
73
+ if (label.startsWith(low)) return 0;
74
+ if (label.includes(low)) return 1;
75
+ if (item.hint?.toLowerCase().includes(low)) return 2;
76
+ if (item.keywords?.some((k) => k.toLowerCase().includes(low))) return 3;
77
+ return -1;
78
+ }
79
+ const filtered = computed(() => {
80
+ const needle = q.value.trim();
81
+ if (!needle) return props.items;
82
+ return props.items.map((it) => ({ it, s: score(it, needle) })).filter((x) => x.s >= 0).sort((a, b) => a.s - b.s).map((x) => x.it);
83
+ });
84
+ const groups = computed(() => {
85
+ const out = [];
86
+ const idx = /* @__PURE__ */ new Map();
87
+ for (const it of filtered.value) {
88
+ const g = it.group || "";
89
+ if (!idx.has(g)) {
90
+ idx.set(g, out.length);
91
+ out.push({ name: g, items: [] });
92
+ }
93
+ out[idx.get(g)].items.push(it);
94
+ }
95
+ return out;
96
+ });
97
+ const flatFiltered = computed(() => filtered.value.filter((i) => !i.disabled));
98
+ watch(filtered, () => {
99
+ activeIdx.value = 0;
100
+ });
101
+ watch(q, (v) => emit("search", v));
102
+ function close() {
103
+ emit("update:modelValue", false);
104
+ q.value = "";
105
+ }
106
+ function choose(it) {
107
+ const target = it ?? flatFiltered.value[activeIdx.value];
108
+ if (!target || target.disabled) return;
109
+ emit("select", target);
110
+ close();
111
+ }
112
+ function move(dir) {
113
+ const n = flatFiltered.value.length;
114
+ if (!n) return;
115
+ activeIdx.value = (activeIdx.value + dir + n) % n;
116
+ nextTick(() => {
117
+ listEl.value?.querySelector(`[data-idx="${activeIdx.value}"]`)?.scrollIntoView({ block: "nearest" });
118
+ });
119
+ }
120
+ function idxOf(item) {
121
+ return flatFiltered.value.indexOf(item);
122
+ }
123
+ function onKey(e) {
124
+ if (shouldSkip(e)) return;
125
+ switch (e.key) {
126
+ case "ArrowDown":
127
+ e.preventDefault();
128
+ move(1);
129
+ break;
130
+ case "ArrowUp":
131
+ e.preventDefault();
132
+ move(-1);
133
+ break;
134
+ case "Enter":
135
+ e.preventDefault();
136
+ choose();
137
+ break;
138
+ case "Escape":
139
+ e.preventDefault();
140
+ close();
141
+ break;
142
+ }
143
+ }
144
+ const openRef = toRef(props, "modelValue");
145
+ useFocusTrap(openRef, panelEl, () => {
146
+ close();
147
+ return true;
148
+ });
149
+ function onGlobalKey(e) {
150
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
151
+ e.preventDefault();
152
+ emit("update:modelValue", !props.modelValue);
153
+ }
154
+ }
155
+ onMounted(() => {
156
+ window.addEventListener("keydown", onGlobalKey);
157
+ });
158
+ onBeforeUnmount(() => {
159
+ window.removeEventListener("keydown", onGlobalKey);
160
+ });
161
+ watch(
162
+ () => props.modelValue,
163
+ async (v) => {
164
+ if (v) {
165
+ q.value = "";
166
+ activeIdx.value = 0;
167
+ await nextTick();
168
+ if (props.autofocus) inputEl.value?.focus();
169
+ }
170
+ }
171
+ );
172
+ return (_ctx, _cache) => {
173
+ return _openBlock(), _createBlock(_Teleport, { to: "body" }, [
174
+ __props.modelValue ? (_openBlock(), _createElementBlock(
175
+ "div",
176
+ _mergeProps({ key: 0 }, _ctx.$attrs, {
177
+ class: "wd-command",
178
+ role: "dialog",
179
+ "aria-modal": "true",
180
+ "aria-label": "\u547D\u4EE4\u9762\u677F"
181
+ }),
182
+ [
183
+ _createElementVNode("div", {
184
+ class: "wd-command__mask",
185
+ onClick: close
186
+ }),
187
+ _createElementVNode(
188
+ "div",
189
+ {
190
+ ref_key: "panelEl",
191
+ ref: panelEl,
192
+ class: "wd-command__panel",
193
+ tabindex: "-1",
194
+ style: _normalizeStyle({ maxHeight: __props.maxHeight + "px" })
195
+ },
196
+ [
197
+ _createElementVNode("div", _hoisted_1, [
198
+ _createVNode(_unref(WdIcon_default), {
199
+ class: "wd-command__search-icon",
200
+ name: "search",
201
+ size: 16
202
+ }),
203
+ _createElementVNode("input", {
204
+ ref_key: "inputEl",
205
+ ref: inputEl,
206
+ value: q.value,
207
+ class: "wd-command__input",
208
+ placeholder: __props.placeholder,
209
+ type: "text",
210
+ spellcheck: "false",
211
+ autocomplete: "off",
212
+ onInput: onSearchInput,
213
+ onCompositionstart: _cache[0] || (_cache[0] = //@ts-ignore
214
+ (...args) => _unref(onCompositionStart) && _unref(onCompositionStart)(...args)),
215
+ onCompositionend: onSearchCompositionEnd,
216
+ onKeydown: onKey
217
+ }, null, 40, _hoisted_2),
218
+ _cache[1] || (_cache[1] = _createElementVNode(
219
+ "kbd",
220
+ { class: "wd-command__esc" },
221
+ "ESC",
222
+ -1
223
+ /* CACHED */
224
+ ))
225
+ ]),
226
+ _createElementVNode(
227
+ "div",
228
+ {
229
+ ref_key: "listEl",
230
+ ref: listEl,
231
+ class: "wd-command__list"
232
+ },
233
+ [
234
+ (_openBlock(true), _createElementBlock(
235
+ _Fragment,
236
+ null,
237
+ _renderList(groups.value, (g) => {
238
+ return _openBlock(), _createElementBlock(
239
+ _Fragment,
240
+ {
241
+ key: g.name
242
+ },
243
+ [
244
+ g.name ? (_openBlock(), _createElementBlock(
245
+ "div",
246
+ _hoisted_3,
247
+ _toDisplayString(g.name),
248
+ 1
249
+ /* TEXT */
250
+ )) : _createCommentVNode("v-if", true),
251
+ (_openBlock(true), _createElementBlock(
252
+ _Fragment,
253
+ null,
254
+ _renderList(g.items, (it) => {
255
+ return _openBlock(), _createElementBlock("button", {
256
+ key: it.key,
257
+ type: "button",
258
+ class: _normalizeClass(["wd-command__item", {
259
+ "wd-command__item--active": idxOf(it) === activeIdx.value,
260
+ "wd-command__item--disabled": it.disabled
261
+ }]),
262
+ "data-idx": idxOf(it),
263
+ disabled: it.disabled,
264
+ onClick: ($event) => choose(it),
265
+ onMousemove: ($event) => !it.disabled && (activeIdx.value = idxOf(it))
266
+ }, [
267
+ it.icon || _ctx.$slots.icon ? (_openBlock(), _createElementBlock("span", _hoisted_5, [
268
+ _renderSlot(_ctx.$slots, "icon", { item: it }, () => [
269
+ _createVNode(_unref(WdIcon_default), {
270
+ name: it.icon,
271
+ size: 16
272
+ }, null, 8, ["name"])
273
+ ])
274
+ ])) : _createCommentVNode("v-if", true),
275
+ _createElementVNode("span", _hoisted_6, [
276
+ _createElementVNode(
277
+ "span",
278
+ _hoisted_7,
279
+ _toDisplayString(it.label),
280
+ 1
281
+ /* TEXT */
282
+ ),
283
+ it.hint ? (_openBlock(), _createElementBlock(
284
+ "span",
285
+ _hoisted_8,
286
+ _toDisplayString(it.hint),
287
+ 1
288
+ /* TEXT */
289
+ )) : _createCommentVNode("v-if", true)
290
+ ]),
291
+ it.shortcut ? (_openBlock(), _createElementBlock(
292
+ "kbd",
293
+ _hoisted_9,
294
+ _toDisplayString(it.shortcut),
295
+ 1
296
+ /* TEXT */
297
+ )) : _createCommentVNode("v-if", true)
298
+ ], 42, _hoisted_4);
299
+ }),
300
+ 128
301
+ /* KEYED_FRAGMENT */
302
+ ))
303
+ ],
304
+ 64
305
+ /* STABLE_FRAGMENT */
306
+ );
307
+ }),
308
+ 128
309
+ /* KEYED_FRAGMENT */
310
+ )),
311
+ !filtered.value.length ? (_openBlock(), _createElementBlock(
312
+ "div",
313
+ _hoisted_10,
314
+ _toDisplayString(__props.emptyText),
315
+ 1
316
+ /* TEXT */
317
+ )) : _createCommentVNode("v-if", true)
318
+ ],
319
+ 512
320
+ /* NEED_PATCH */
321
+ ),
322
+ _cache[2] || (_cache[2] = _createElementVNode(
323
+ "div",
324
+ { class: "wd-command__footer" },
325
+ [
326
+ _createElementVNode("span", null, [
327
+ _createElementVNode("kbd", null, "\u2191"),
328
+ _createElementVNode("kbd", null, "\u2193"),
329
+ _createTextVNode(" \u9009\u62E9")
330
+ ]),
331
+ _createElementVNode("span", null, [
332
+ _createElementVNode("kbd", null, "\u21B5"),
333
+ _createTextVNode(" \u786E\u8BA4")
334
+ ]),
335
+ _createElementVNode("span", null, [
336
+ _createElementVNode("kbd", null, "esc"),
337
+ _createTextVNode(" \u5173\u95ED")
338
+ ])
339
+ ],
340
+ -1
341
+ /* CACHED */
342
+ ))
343
+ ],
344
+ 4
345
+ /* STYLE */
346
+ )
347
+ ],
348
+ 16
349
+ /* FULL_PROPS */
350
+ )) : _createCommentVNode("v-if", true)
351
+ ]);
352
+ };
353
+ }
354
+ });
355
+ export {
356
+ WdCommand_default as WdCommand
357
+ };
@@ -0,0 +1,37 @@
1
+ // .lib-build/WdContainer.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ var WdContainer_default = /* @__PURE__ */ _defineComponent({
5
+ ...{ name: "WdContainer" },
6
+ __name: "WdContainer",
7
+ props: {
8
+ maxWidth: { type: String, required: false, default: "1200px" },
9
+ pad: { type: String, required: false, default: "md" }
10
+ },
11
+ setup(__props) {
12
+ const props = __props;
13
+ const PAD_X = { sm: "var(--wd-space-3)", md: "var(--wd-space-4)", lg: "var(--wd-space-6)" };
14
+ const PAD_Y = { sm: "var(--wd-space-3)", md: "var(--wd-space-4)", lg: "var(--wd-space-6)" };
15
+ return (_ctx, _cache) => {
16
+ return _openBlock(), _createElementBlock(
17
+ "div",
18
+ {
19
+ class: "wd-container",
20
+ style: _normalizeStyle({
21
+ maxWidth: __props.maxWidth,
22
+ paddingInline: PAD_X[props.pad],
23
+ paddingBlock: PAD_Y[props.pad]
24
+ })
25
+ },
26
+ [
27
+ _renderSlot(_ctx.$slots, "default")
28
+ ],
29
+ 4
30
+ /* STYLE */
31
+ );
32
+ };
33
+ }
34
+ });
35
+ export {
36
+ WdContainer_default as WdContainer
37
+ };
@@ -0,0 +1,163 @@
1
+ // .lib-build/WdCountdown.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
4
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
5
+ var _hoisted_1 = ["aria-label"];
6
+ var _hoisted_2 = {
7
+ key: 0,
8
+ class: "wd-countdown__colon",
9
+ "aria-hidden": "true"
10
+ };
11
+ var _hoisted_3 = { class: "wd-countdown__unit" };
12
+ var _hoisted_4 = { class: "wd-countdown__value" };
13
+ var _hoisted_5 = {
14
+ key: 0,
15
+ class: "wd-countdown__label"
16
+ };
17
+ var WdCountdown_default = /* @__PURE__ */ _defineComponent({
18
+ ...{ name: "WdCountdown" },
19
+ __name: "WdCountdown",
20
+ props: {
21
+ target: { type: [Date, Number, String], required: true },
22
+ secondsMode: { type: Boolean, required: false, default: false },
23
+ format: { type: String, required: false, default: "dhms" },
24
+ hideZeroDays: { type: Boolean, required: false, default: true },
25
+ labels: { type: String, required: false, default: "zh" },
26
+ size: { type: String, required: false, default: "md" },
27
+ variant: { type: String, required: false, default: "card" },
28
+ colon: { type: Boolean, required: false, default: true }
29
+ },
30
+ emits: ["tick", "finish", "urgent"],
31
+ setup(__props, { emit: __emit }) {
32
+ const props = __props;
33
+ const emit = __emit;
34
+ const now = ref(Date.now());
35
+ const deadline = computed(() => {
36
+ const t = props.target;
37
+ if (typeof t === "number") {
38
+ return props.secondsMode ? Date.now() + t * 1e3 : t;
39
+ }
40
+ if (t instanceof Date) return t.getTime();
41
+ const parsed = new Date(t).getTime();
42
+ return Number.isNaN(parsed) ? 0 : parsed;
43
+ });
44
+ const remain = computed(() => Math.max(0, deadline.value - now.value));
45
+ const done = computed(() => remain.value <= 0);
46
+ const finished = ref(false);
47
+ const urgentFired = ref(false);
48
+ let timer = null;
49
+ function schedule() {
50
+ clear();
51
+ if (done.value) return;
52
+ const delay = Math.max(30, remain.value % 1e3 || 1e3);
53
+ timer = setTimeout(() => {
54
+ now.value = Date.now();
55
+ emit("tick", remain.value);
56
+ if (!urgentFired.value && remain.value > 0 && remain.value <= 1e4) {
57
+ urgentFired.value = true;
58
+ emit("urgent");
59
+ }
60
+ if (remain.value <= 0 && !finished.value) {
61
+ finished.value = true;
62
+ emit("finish");
63
+ return;
64
+ }
65
+ schedule();
66
+ }, delay);
67
+ }
68
+ function clear() {
69
+ if (timer) {
70
+ clearTimeout(timer);
71
+ timer = null;
72
+ }
73
+ }
74
+ onMounted(schedule);
75
+ onBeforeUnmount(clear);
76
+ watch(deadline, () => {
77
+ finished.value = false;
78
+ urgentFired.value = false;
79
+ now.value = Date.now();
80
+ schedule();
81
+ });
82
+ const parts = computed(() => {
83
+ const total = Math.floor(remain.value / 1e3);
84
+ const d = Math.floor(total / 86400);
85
+ const h = Math.floor(total % 86400 / 3600);
86
+ const m = Math.floor(total % 3600 / 60);
87
+ const s = total % 60;
88
+ const pad = (n) => String(n).padStart(2, "0");
89
+ const units = [];
90
+ const fmt = props.format;
91
+ if (fmt === "dhm" || fmt === "dhms") {
92
+ if (!(props.hideZeroDays && d === 0)) {
93
+ units.push({ key: "d", value: String(d), label: props.labels === "zh" ? "\u5929" : "DAYS" });
94
+ }
95
+ }
96
+ if (fmt !== "ms") {
97
+ units.push({ key: "h", value: pad(h), label: props.labels === "zh" ? "\u65F6" : "HRS" });
98
+ }
99
+ units.push({ key: "m", value: pad(m), label: props.labels === "zh" ? "\u5206" : "MIN" });
100
+ units.push({ key: "s", value: pad(s), label: props.labels === "zh" ? "\u79D2" : "SEC" });
101
+ return units;
102
+ });
103
+ const readable = computed(() => {
104
+ if (done.value) return "\u5DF2\u7ED3\u675F";
105
+ return parts.value.map((u) => u.value + (props.labels === "zh" ? u.label : " " + u.label)).join(" ");
106
+ });
107
+ const rootClass = computed(() => [
108
+ "wd-countdown",
109
+ `wd-countdown--${props.size}`,
110
+ `wd-countdown--${props.variant}`,
111
+ {
112
+ "is-done": done.value,
113
+ "is-urgent": urgentFired.value && !done.value
114
+ }
115
+ ]);
116
+ return (_ctx, _cache) => {
117
+ return _openBlock(), _createElementBlock("div", {
118
+ class: _normalizeClass(rootClass.value),
119
+ role: "timer",
120
+ "aria-label": readable.value
121
+ }, [
122
+ (_openBlock(true), _createElementBlock(
123
+ _Fragment,
124
+ null,
125
+ _renderList(parts.value, (u, i) => {
126
+ return _openBlock(), _createElementBlock(
127
+ _Fragment,
128
+ {
129
+ key: u.key
130
+ },
131
+ [
132
+ i > 0 && __props.variant === "plain" && __props.colon ? (_openBlock(), _createElementBlock("span", _hoisted_2, ":")) : _createCommentVNode("v-if", true),
133
+ _createElementVNode("span", _hoisted_3, [
134
+ _createElementVNode(
135
+ "span",
136
+ _hoisted_4,
137
+ _toDisplayString(u.value),
138
+ 1
139
+ /* TEXT */
140
+ ),
141
+ __props.labels !== "none" ? (_openBlock(), _createElementBlock(
142
+ "span",
143
+ _hoisted_5,
144
+ _toDisplayString(u.label),
145
+ 1
146
+ /* TEXT */
147
+ )) : _createCommentVNode("v-if", true)
148
+ ])
149
+ ],
150
+ 64
151
+ /* STABLE_FRAGMENT */
152
+ );
153
+ }),
154
+ 128
155
+ /* KEYED_FRAGMENT */
156
+ ))
157
+ ], 10, _hoisted_1);
158
+ };
159
+ }
160
+ });
161
+ export {
162
+ WdCountdown_default as WdCountdown
163
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ WdDanmaku_default
3
+ } from "./chunk-7M3MUL3B.js";
4
+ export {
5
+ WdDanmaku_default as WdDanmaku
6
+ };