@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,101 @@
1
+ // .lib-build/overlay-stack.ts
2
+ import { onBeforeUnmount, ref, watch } from "vue";
3
+ var stack = [];
4
+ var seq = 0;
5
+ var overlayDepth = ref(0);
6
+ var BASE_Z = 1e3;
7
+ var zSeq = 0;
8
+ function nextZIndex() {
9
+ if (stack.length === 0) zSeq = 0;
10
+ return BASE_Z + ++zSeq * 10;
11
+ }
12
+ function topOverlay() {
13
+ return stack[stack.length - 1];
14
+ }
15
+ function isTopOverlay(id) {
16
+ const t = topOverlay();
17
+ return !!t && t.id === id;
18
+ }
19
+ function pushOverlay(entry) {
20
+ const id = ++seq;
21
+ stack.push({ ...entry, id });
22
+ overlayDepth.value = stack.length;
23
+ return id;
24
+ }
25
+ function removeOverlay(id) {
26
+ const i = stack.findIndex((e) => e.id === id);
27
+ const removed = i >= 0 ? stack[i] : void 0;
28
+ if (i >= 0) stack.splice(i, 1);
29
+ overlayDepth.value = stack.length;
30
+ const to = removed?.restoreTo;
31
+ if (!to) return;
32
+ setTimeout(() => {
33
+ if (!to.isConnected || typeof to.focus !== "function") return;
34
+ if (to.hasAttribute("disabled")) return;
35
+ if (to.getAttribute("aria-hidden") === "true") return;
36
+ const rect = to.getBoundingClientRect();
37
+ if (rect.width === 0 && rect.height === 0) return;
38
+ const active = document.activeElement;
39
+ const anchorEl = removed?.panel.value;
40
+ const focusElsewhere = !!(active && active !== document.body && !(anchorEl && anchorEl.contains(active)) && !active.closest('.wd-datepicker__panel, .wd-select__menu, .wd-dropdown__menu, .wd-popover__panel, [class*="__panel"], [class*="__menu"]'));
41
+ if (focusElsewhere) return;
42
+ to.focus({ preventScroll: true });
43
+ }, 0);
44
+ }
45
+ function useOverlayLayer(open, panel, onEsc) {
46
+ installOverlayKeyboard();
47
+ let myId = null;
48
+ watch(
49
+ open,
50
+ (v) => {
51
+ if (v) {
52
+ const active = document.activeElement;
53
+ myId = pushOverlay({
54
+ panel,
55
+ restoreTo: active && active !== document.body ? active : null,
56
+ onEscape: onEsc
57
+ });
58
+ } else if (myId !== null) {
59
+ removeOverlay(myId);
60
+ myId = null;
61
+ }
62
+ },
63
+ { immediate: true }
64
+ );
65
+ onBeforeUnmount(() => {
66
+ if (myId !== null) {
67
+ removeOverlay(myId);
68
+ myId = null;
69
+ }
70
+ });
71
+ return {
72
+ /** 本层是否在栈顶(需要响应键盘时先判断它) */
73
+ isTop: () => myId === null ? false : isTopOverlay(myId)
74
+ };
75
+ }
76
+ var installed = false;
77
+ function installOverlayKeyboard() {
78
+ if (installed || typeof document === "undefined") return;
79
+ installed = true;
80
+ document.addEventListener(
81
+ "keydown",
82
+ (e) => {
83
+ const top = topOverlay();
84
+ if (!top) return;
85
+ if (e.key === "Escape") {
86
+ const handled = top.onEscape?.();
87
+ if (handled !== false) {
88
+ e.stopPropagation();
89
+ }
90
+ }
91
+ },
92
+ true
93
+ );
94
+ }
95
+
96
+ export {
97
+ nextZIndex,
98
+ topOverlay,
99
+ useOverlayLayer,
100
+ installOverlayKeyboard
101
+ };
@@ -0,0 +1,275 @@
1
+ // .lib-build/WdDanmaku.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle } from "vue";
4
+ import { computed, onBeforeUnmount, ref, watch } from "vue";
5
+
6
+ // .lib-build/danmaku-source.ts
7
+ function decToHex(dec) {
8
+ const n = Math.max(0, Math.min(16777215, dec | 0));
9
+ return "#" + n.toString(16).padStart(6, "0").toUpperCase();
10
+ }
11
+ function parseBiliXml(xml) {
12
+ const out = [];
13
+ const re = /<d\s+p="([^"]*)"[^>]*>([\s\S]*?)<\/d>/g;
14
+ let m;
15
+ while ((m = re.exec(xml)) !== null) {
16
+ const attrs = m[1].split(",");
17
+ const text = unescapeHtml(m[2]).trim();
18
+ if (!text) continue;
19
+ const time = parseFloat(attrs[0]);
20
+ if (!isFinite(time)) continue;
21
+ const modeNum = parseInt(attrs[1], 10);
22
+ const colorDec = parseInt(attrs[3], 10);
23
+ let mode = "scroll";
24
+ if (modeNum === 4) mode = "bottom";
25
+ else if (modeNum === 5) mode = "top";
26
+ out.push({
27
+ time,
28
+ text,
29
+ mode,
30
+ // 白色(16777215)是默认值,不显式设置省一次属性
31
+ color: isFinite(colorDec) && colorDec !== 16777215 ? decToHex(colorDec) : void 0
32
+ });
33
+ }
34
+ return out.sort((a, b) => a.time - b.time);
35
+ }
36
+ function unescapeHtml(s) {
37
+ return s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
38
+ }
39
+ function parseJson(json) {
40
+ if (!Array.isArray(json)) return [];
41
+ const out = [];
42
+ for (const raw of json) {
43
+ if (!raw || typeof raw !== "object") continue;
44
+ const o = raw;
45
+ const time = Number(o.time ?? o.t ?? o.start ?? o.stime);
46
+ const text = String(o.text ?? o.content ?? o.body ?? "").trim();
47
+ if (!isFinite(time) || !text) continue;
48
+ const modeRaw = o.mode;
49
+ const mode = modeRaw === "top" || modeRaw === 5 ? "top" : modeRaw === "bottom" || modeRaw === 4 ? "bottom" : "scroll";
50
+ out.push({
51
+ time,
52
+ text,
53
+ mode,
54
+ color: typeof o.color === "string" ? o.color : void 0
55
+ });
56
+ }
57
+ return out.sort((a, b) => a.time - b.time);
58
+ }
59
+ function parseText(text) {
60
+ const out = [];
61
+ for (const line of text.split(/\r?\n/)) {
62
+ const t = line.trim();
63
+ if (!t || t.startsWith("#")) continue;
64
+ const parts = t.split(",");
65
+ if (parts.length < 2) continue;
66
+ const time = parseFloat(parts[0]);
67
+ if (!isFinite(time)) continue;
68
+ const rest = parts.slice(1).join(",").trim();
69
+ if (!rest) continue;
70
+ const modePart = (parts[1] || "").trim().toLowerCase();
71
+ const colorPart = (parts[2] || "").trim();
72
+ const textStart = rest.startsWith(modePart) || rest.startsWith(colorPart) ? rest.replace(/^[^,]*,?/, "").replace(/^[^,]*,?/, "") : rest;
73
+ out.push({
74
+ time,
75
+ text: textStart.trim() || rest,
76
+ mode: modePart === "top" ? "top" : modePart === "bottom" ? "bottom" : "scroll",
77
+ color: /^#[0-9a-f]{3,8}$/i.test(colorPart) ? colorPart : void 0
78
+ });
79
+ }
80
+ return out.sort((a, b) => a.time - b.time);
81
+ }
82
+ function parseDanmaku(input) {
83
+ if (Array.isArray(input)) return parseJson(input);
84
+ if (typeof input !== "string") return [];
85
+ const s = input.trim();
86
+ if (!s) return [];
87
+ if (s.includes("<d p=") || s.startsWith("<?xml") || s.startsWith("<i>")) {
88
+ return parseBiliXml(s);
89
+ }
90
+ if (s.startsWith("[") || s.startsWith("{")) {
91
+ try {
92
+ return parseJson(JSON.parse(s));
93
+ } catch {
94
+ }
95
+ }
96
+ return parseText(s);
97
+ }
98
+ async function loadDanmaku(url) {
99
+ const res = await fetch(url);
100
+ if (!res.ok) throw new Error(`\u5F39\u5E55\u52A0\u8F7D\u5931\u8D25\uFF1AHTTP ${res.status}`);
101
+ const text = await res.text();
102
+ return parseDanmaku(text);
103
+ }
104
+
105
+ // .lib-build/WdDanmaku.ts
106
+ var WINDOW = 8;
107
+ var WdDanmaku_default = /* @__PURE__ */ _defineComponent({
108
+ ...{ name: "WdDanmaku" },
109
+ __name: "WdDanmaku",
110
+ props: {
111
+ items: { type: Array, required: false, default: () => [] },
112
+ src: { type: String, required: false, default: "" },
113
+ raw: { type: String, required: false, default: "" },
114
+ current: { type: Number, required: false, default: 0 },
115
+ visible: { type: Boolean, required: false, default: true },
116
+ paused: { type: Boolean, required: false, default: false },
117
+ speed: { type: Number, required: false, default: 120 },
118
+ rows: { type: Number, required: false, default: 6 },
119
+ fontSize: { type: Number, required: false, default: 15 },
120
+ opacity: { type: Number, required: false, default: 1 }
121
+ },
122
+ emits: ["error"],
123
+ setup(__props, { emit: __emit }) {
124
+ const props = __props;
125
+ const emit = __emit;
126
+ const loaded = ref([]);
127
+ const loadError = ref("");
128
+ const loading = ref(false);
129
+ const resolved = computed(() => {
130
+ if (props.items.length) return props.items;
131
+ if (props.raw) return parseDanmaku(props.raw);
132
+ return loaded.value;
133
+ });
134
+ watch(
135
+ () => props.src,
136
+ async (url) => {
137
+ loaded.value = [];
138
+ loadError.value = "";
139
+ if (!url) return;
140
+ loading.value = true;
141
+ try {
142
+ loaded.value = await loadDanmaku(url);
143
+ } catch (e) {
144
+ loadError.value = e instanceof Error ? e.message : String(e);
145
+ emit("error", loadError.value);
146
+ } finally {
147
+ loading.value = false;
148
+ }
149
+ },
150
+ { immediate: true }
151
+ );
152
+ const active = computed(() => {
153
+ if (!props.visible) return [];
154
+ const t = props.current;
155
+ return resolved.value.map((it, i) => ({ ...it, _i: i })).filter((it) => it.time <= t && it.time > t - WINDOW).map((it) => ({
156
+ ...it,
157
+ /** 已经飞过的百分比,用于让中途进入的弹幕从正确位置开始 */
158
+ progress: (t - it.time) / WINDOW
159
+ }));
160
+ });
161
+ const assigned = computed(() => {
162
+ return active.value.map((it, i) => ({
163
+ ...it,
164
+ row: it.mode === "top" ? 0 : it.mode === "bottom" ? props.rows - 1 : i % props.rows
165
+ }));
166
+ });
167
+ const fixedTop = computed(() => assigned.value.filter((d) => d.mode === "top").slice(0, 2));
168
+ const fixedBottom = computed(() => assigned.value.filter((d) => d.mode === "bottom").slice(0, 2));
169
+ const layerStyle = computed(() => ({
170
+ "--dm-font": props.fontSize + "px",
171
+ "--dm-opacity": String(props.opacity),
172
+ "--dm-rows": String(props.rows),
173
+ /*
174
+ * 暂停时用 animation-play-state: paused 让所有弹幕**原地定格**。
175
+ * ⚠️ 不能用"暂停就不渲染" —— 那会让弹幕瞬间消失,
176
+ * 恢复播放又从窗口外重新飞入,观感是"闪一下然后重来"。
177
+ */
178
+ "--dm-play-state": props.paused ? "paused" : "running"
179
+ }));
180
+ function itemStyle(d) {
181
+ return {
182
+ top: `calc(var(--dm-row-h) * ${d.row} + 6px)`,
183
+ color: d.color || "#fff",
184
+ // 负 delay 让"已开始"的弹幕从中间位置继续,而不是从头飞
185
+ animationDelay: `-${d.progress * 8}s`
186
+ };
187
+ }
188
+ const root = ref(null);
189
+ watch(() => props.visible, () => {
190
+ });
191
+ onBeforeUnmount(() => {
192
+ });
193
+ return (_ctx, _cache) => {
194
+ return __props.visible && resolved.value.length ? (_openBlock(), _createElementBlock(
195
+ "div",
196
+ {
197
+ key: 0,
198
+ ref_key: "root",
199
+ ref: root,
200
+ class: "wd-danmaku",
201
+ style: _normalizeStyle(layerStyle.value),
202
+ "aria-hidden": "true"
203
+ },
204
+ [
205
+ _createCommentVNode(" \u6EDA\u52A8\u5F39\u5E55 "),
206
+ (_openBlock(true), _createElementBlock(
207
+ _Fragment,
208
+ null,
209
+ _renderList(assigned.value.filter((x) => !x.mode || x.mode === "scroll"), (d) => {
210
+ return _openBlock(), _createElementBlock(
211
+ "div",
212
+ {
213
+ key: d._i,
214
+ class: "wd-danmaku__item",
215
+ style: _normalizeStyle(itemStyle(d))
216
+ },
217
+ _toDisplayString(d.text),
218
+ 5
219
+ /* TEXT, STYLE */
220
+ );
221
+ }),
222
+ 128
223
+ /* KEYED_FRAGMENT */
224
+ )),
225
+ _createCommentVNode(" \u9876\u90E8\u56FA\u5B9A "),
226
+ (_openBlock(true), _createElementBlock(
227
+ _Fragment,
228
+ null,
229
+ _renderList(fixedTop.value, (d, i) => {
230
+ return _openBlock(), _createElementBlock(
231
+ "div",
232
+ {
233
+ key: "t" + d._i,
234
+ class: "wd-danmaku__item wd-danmaku__item--fixed",
235
+ style: _normalizeStyle({ top: i * 30 + 6 + "px", color: d.color || "#fff" })
236
+ },
237
+ _toDisplayString(d.text),
238
+ 5
239
+ /* TEXT, STYLE */
240
+ );
241
+ }),
242
+ 128
243
+ /* KEYED_FRAGMENT */
244
+ )),
245
+ _createCommentVNode(" \u5E95\u90E8\u56FA\u5B9A "),
246
+ (_openBlock(true), _createElementBlock(
247
+ _Fragment,
248
+ null,
249
+ _renderList(fixedBottom.value, (d, i) => {
250
+ return _openBlock(), _createElementBlock(
251
+ "div",
252
+ {
253
+ key: "b" + d._i,
254
+ class: "wd-danmaku__item wd-danmaku__item--fixed",
255
+ style: _normalizeStyle({ bottom: i * 30 + 6 + "px", color: d.color || "#fff" })
256
+ },
257
+ _toDisplayString(d.text),
258
+ 5
259
+ /* TEXT, STYLE */
260
+ );
261
+ }),
262
+ 128
263
+ /* KEYED_FRAGMENT */
264
+ ))
265
+ ],
266
+ 4
267
+ /* STYLE */
268
+ )) : _createCommentVNode("v-if", true);
269
+ };
270
+ }
271
+ });
272
+
273
+ export {
274
+ WdDanmaku_default
275
+ };
@@ -0,0 +1,15 @@
1
+ // .lib-build/time.ts
2
+ function formatDuration(seconds, forceHours = false) {
3
+ if (!Number.isFinite(seconds) || seconds < 0) seconds = 0;
4
+ const total = Math.floor(seconds);
5
+ const h = Math.floor(total / 3600);
6
+ const m = Math.floor(total % 3600 / 60);
7
+ const s = total % 60;
8
+ const pad = (n) => String(n).padStart(2, "0");
9
+ if (h > 0 || forceHours) return `${h}:${pad(m)}:${pad(s)}`;
10
+ return `${m}:${pad(s)}`;
11
+ }
12
+
13
+ export {
14
+ formatDuration
15
+ };
@@ -0,0 +1,41 @@
1
+ // .lib-build/WdTag.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass } from "vue";
4
+ var _hoisted_1 = {
5
+ key: 0,
6
+ class: "wd-tag__dot"
7
+ };
8
+ var WdTag_default = /* @__PURE__ */ _defineComponent({
9
+ ...{ name: "WdTag" },
10
+ __name: "WdTag",
11
+ props: {
12
+ variant: { type: String, required: false, default: "tint" },
13
+ size: { type: String, required: false },
14
+ dot: { type: Boolean, required: false, default: false },
15
+ plain: { type: Boolean, required: false, default: false }
16
+ },
17
+ setup(__props) {
18
+ return (_ctx, _cache) => {
19
+ return _openBlock(), _createElementBlock(
20
+ "span",
21
+ {
22
+ class: _normalizeClass(["wd-tag", [
23
+ `wd-tag--${__props.variant}`,
24
+ { "wd-tag--lg": __props.size === "lg", "wd-tag--sm": __props.size === "sm", "wd-tag--plain": __props.plain }
25
+ ]]),
26
+ "data-wd-hover": ""
27
+ },
28
+ [
29
+ __props.dot ? (_openBlock(), _createElementBlock("i", _hoisted_1)) : _createCommentVNode("v-if", true),
30
+ _renderSlot(_ctx.$slots, "default")
31
+ ],
32
+ 2
33
+ /* CLASS */
34
+ );
35
+ };
36
+ }
37
+ });
38
+
39
+ export {
40
+ WdTag_default
41
+ };