@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,291 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ WdIcon_default
6
+ } from "./chunk-Q34U2HES.js";
7
+
8
+ // .lib-build/WdSortableList.ts
9
+ import { defineComponent as _defineComponent } from "vue";
10
+ import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, withModifiers as _withModifiers, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createCommentVNode as _createCommentVNode, mergeProps as _mergeProps, Teleport as _Teleport, createBlock as _createBlock } from "vue";
11
+ import { computed, onBeforeUnmount, ref } from "vue";
12
+ var _hoisted_1 = ["aria-label", "onPointerdown", "onKeydown"];
13
+ var _hoisted_2 = { class: "wd-sortable__label" };
14
+ var _hoisted_3 = {
15
+ class: "wd-sortable__sr",
16
+ "aria-live": "polite"
17
+ };
18
+ var _hoisted_4 = {
19
+ class: "wd-sortable__handle",
20
+ "aria-hidden": "true"
21
+ };
22
+ var _hoisted_5 = { class: "wd-sortable__label" };
23
+ var DRAG_THRESHOLD = 4;
24
+ var WdSortableList_default = /* @__PURE__ */ _defineComponent({
25
+ ...{ name: "WdSortableList" },
26
+ __name: "WdSortableList",
27
+ props: {
28
+ modelValue: { type: Array, required: false },
29
+ defaultValue: { type: Array, required: false, default: () => [] }
30
+ },
31
+ emits: ["update:modelValue", "change"],
32
+ setup(__props, { emit: __emit }) {
33
+ const props = __props;
34
+ const emit = __emit;
35
+ const { value: items, set: setItems } = useControllable({
36
+ modelValue: computed(() => props.modelValue),
37
+ defaultValue: computed(() => props.defaultValue),
38
+ fallback: [],
39
+ onChange: (v) => emit("update:modelValue", v)
40
+ });
41
+ const list = ref(null);
42
+ function labelOf(it) {
43
+ return typeof it === "string" ? it : it.label;
44
+ }
45
+ const dragging = ref(false);
46
+ const fromIndex = ref(-1);
47
+ const overIndex = ref(-1);
48
+ const ghost = ref(null);
49
+ let startY = 0;
50
+ let startX = 0;
51
+ let armed = false;
52
+ function itemEls() {
53
+ if (!list.value) return [];
54
+ return Array.from(list.value.querySelectorAll(".wd-sortable__item"));
55
+ }
56
+ function computeOver(y) {
57
+ const els = itemEls();
58
+ for (let i = 0; i < els.length; i++) {
59
+ const r = els[i].getBoundingClientRect();
60
+ if (y < r.top + r.height / 2) return i;
61
+ }
62
+ return els.length;
63
+ }
64
+ function onPointerDown(e, i) {
65
+ if (e.button !== void 0 && e.button !== 0) return;
66
+ armed = true;
67
+ dragging.value = false;
68
+ fromIndex.value = i;
69
+ startY = e.clientY;
70
+ startX = e.clientX;
71
+ try {
72
+ ;
73
+ e.currentTarget.setPointerCapture?.(e.pointerId);
74
+ } catch {
75
+ }
76
+ window.addEventListener("pointermove", onPointerMove, { passive: false });
77
+ window.addEventListener("pointerup", onPointerUp);
78
+ window.addEventListener("pointercancel", onPointerUp);
79
+ }
80
+ function onPointerMove(e) {
81
+ if (!armed) return;
82
+ if (!dragging.value) {
83
+ if (Math.abs(e.clientY - startY) < DRAG_THRESHOLD && Math.abs(e.clientX - startX) < DRAG_THRESHOLD) return;
84
+ dragging.value = true;
85
+ const el = itemEls()[fromIndex.value];
86
+ if (el) {
87
+ const r = el.getBoundingClientRect();
88
+ grabOffsetY = e.clientY - r.top;
89
+ ghost.value = {
90
+ top: r.top,
91
+ left: r.left,
92
+ width: r.width,
93
+ label: labelOf(items.value[fromIndex.value])
94
+ };
95
+ }
96
+ }
97
+ if (e.cancelable) e.preventDefault();
98
+ if (ghost.value) ghost.value.top = e.clientY - grabOffsetY;
99
+ overIndex.value = computeOver(e.clientY);
100
+ }
101
+ function onPointerUp() {
102
+ if (dragging.value && fromIndex.value >= 0 && overIndex.value >= 0) {
103
+ let to = overIndex.value;
104
+ if (to > fromIndex.value) to -= 1;
105
+ if (to !== fromIndex.value) {
106
+ const arr = [...items.value];
107
+ const [moved] = arr.splice(fromIndex.value, 1);
108
+ arr.splice(to, 0, moved);
109
+ setItems(arr);
110
+ emit("change", arr);
111
+ }
112
+ }
113
+ cleanup();
114
+ }
115
+ function cleanup() {
116
+ armed = false;
117
+ dragging.value = false;
118
+ fromIndex.value = -1;
119
+ overIndex.value = -1;
120
+ ghost.value = null;
121
+ window.removeEventListener("pointermove", onPointerMove);
122
+ window.removeEventListener("pointerup", onPointerUp);
123
+ window.removeEventListener("pointercancel", onPointerUp);
124
+ }
125
+ function moveBy(from, to) {
126
+ const arr = [...items.value];
127
+ if (to < 0 || to >= arr.length || to === from) return;
128
+ const [moved] = arr.splice(from, 1);
129
+ arr.splice(to, 0, moved);
130
+ setItems(arr);
131
+ emit("change", arr);
132
+ announce.value = `${labelOf(moved)} \u5DF2\u79FB\u5230\u7B2C ${to + 1} \u9879\uFF0C\u5171 ${arr.length} \u9879`;
133
+ }
134
+ function onHandleKey(e, i) {
135
+ const n = items.value.length;
136
+ switch (e.key) {
137
+ case "ArrowUp":
138
+ e.preventDefault();
139
+ moveBy(i, i - 1);
140
+ focusIndex(i - 1);
141
+ break;
142
+ case "ArrowDown":
143
+ e.preventDefault();
144
+ moveBy(i, i + 1);
145
+ focusIndex(i + 1);
146
+ break;
147
+ case "Home":
148
+ e.preventDefault();
149
+ moveBy(i, 0);
150
+ focusIndex(0);
151
+ break;
152
+ case "End":
153
+ e.preventDefault();
154
+ moveBy(i, n - 1);
155
+ focusIndex(n - 1);
156
+ break;
157
+ }
158
+ }
159
+ function focusIndex(i) {
160
+ requestAnimationFrame(() => {
161
+ const els = itemEls();
162
+ els[Math.max(0, Math.min(i, els.length - 1))]?.querySelector(".wd-sortable__handle")?.focus();
163
+ });
164
+ }
165
+ const announce = ref("");
166
+ onBeforeUnmount(cleanup);
167
+ const dropLineTop = computed(() => {
168
+ if (!dragging.value || overIndex.value < 0 || !list.value) return null;
169
+ const els = itemEls();
170
+ if (!els.length) return null;
171
+ const base = list.value.getBoundingClientRect();
172
+ const i = overIndex.value;
173
+ return i < els.length ? els[i].getBoundingClientRect().top - base.top : els[els.length - 1].getBoundingClientRect().bottom - base.top;
174
+ });
175
+ return (_ctx, _cache) => {
176
+ return _openBlock(), _createElementBlock(
177
+ _Fragment,
178
+ null,
179
+ [
180
+ _createElementVNode(
181
+ "div",
182
+ _mergeProps(_ctx.$attrs, {
183
+ class: ["wd-sortable", { "wd-sortable--dragging": dragging.value }],
184
+ role: "list",
185
+ "aria-label": "\u53EF\u6392\u5E8F\u5217\u8868\uFF0C\u7528\u624B\u67C4\u4E0A\u7684\u4E0A\u4E0B\u65B9\u5411\u952E\u8C03\u6574\u987A\u5E8F",
186
+ ref_key: "list",
187
+ ref: list
188
+ }),
189
+ [
190
+ (_openBlock(true), _createElementBlock(
191
+ _Fragment,
192
+ null,
193
+ _renderList(_unref(items), (it, i) => {
194
+ return _openBlock(), _createElementBlock(
195
+ "div",
196
+ {
197
+ key: i,
198
+ class: _normalizeClass(["wd-sortable__item", {
199
+ "wd-sortable__item--drag": dragging.value && fromIndex.value === i,
200
+ "wd-sortable__item--over": dragging.value && overIndex.value === i && fromIndex.value !== i
201
+ }]),
202
+ role: "listitem"
203
+ },
204
+ [
205
+ _createElementVNode("span", {
206
+ class: "wd-sortable__handle",
207
+ role: "button",
208
+ tabindex: "0",
209
+ "aria-label": `\u8C03\u6574 ${labelOf(it)} \u7684\u987A\u5E8F\uFF0C\u5F53\u524D\u7B2C ${i + 1} \u9879\uFF0C\u5171 ${_unref(items).length} \u9879`,
210
+ onPointerdown: _withModifiers(($event) => onPointerDown($event, i), ["stop"]),
211
+ onKeydown: ($event) => onHandleKey($event, i)
212
+ }, [
213
+ _createVNode(_unref(WdIcon_default), {
214
+ name: "dots-drag",
215
+ size: 14
216
+ })
217
+ ], 40, _hoisted_1),
218
+ _createElementVNode(
219
+ "span",
220
+ _hoisted_2,
221
+ _toDisplayString(labelOf(it)),
222
+ 1
223
+ /* TEXT */
224
+ )
225
+ ],
226
+ 2
227
+ /* CLASS */
228
+ );
229
+ }),
230
+ 128
231
+ /* KEYED_FRAGMENT */
232
+ )),
233
+ dropLineTop.value !== null ? (_openBlock(), _createElementBlock(
234
+ "div",
235
+ {
236
+ key: 0,
237
+ class: "wd-sortable__drop-line",
238
+ style: _normalizeStyle({ top: dropLineTop.value + "px" })
239
+ },
240
+ null,
241
+ 4
242
+ /* STYLE */
243
+ )) : _createCommentVNode("v-if", true),
244
+ _createElementVNode(
245
+ "p",
246
+ _hoisted_3,
247
+ _toDisplayString(announce.value),
248
+ 1
249
+ /* TEXT */
250
+ )
251
+ ],
252
+ 16
253
+ /* FULL_PROPS */
254
+ ),
255
+ (_openBlock(), _createBlock(_Teleport, { to: "body" }, [
256
+ ghost.value ? (_openBlock(), _createElementBlock(
257
+ "div",
258
+ {
259
+ key: 0,
260
+ class: "wd-sortable__clone",
261
+ style: _normalizeStyle({ top: ghost.value.top + "px", left: ghost.value.left + "px", width: ghost.value.width + "px" })
262
+ },
263
+ [
264
+ _createElementVNode("span", _hoisted_4, [
265
+ _createVNode(_unref(WdIcon_default), {
266
+ name: "dots-drag",
267
+ size: 14
268
+ })
269
+ ]),
270
+ _createElementVNode(
271
+ "span",
272
+ _hoisted_5,
273
+ _toDisplayString(ghost.value.label),
274
+ 1
275
+ /* TEXT */
276
+ )
277
+ ],
278
+ 4
279
+ /* STYLE */
280
+ )) : _createCommentVNode("v-if", true)
281
+ ]))
282
+ ],
283
+ 64
284
+ /* STABLE_FRAGMENT */
285
+ );
286
+ };
287
+ }
288
+ });
289
+ export {
290
+ WdSortableList_default as WdSortableList
291
+ };
@@ -0,0 +1,46 @@
1
+ // .lib-build/WdSpace.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ import { computed } from "vue";
5
+ var WdSpace_default = /* @__PURE__ */ _defineComponent({
6
+ ...{ name: "WdSpace" },
7
+ __name: "WdSpace",
8
+ props: {
9
+ size: { type: [String, Number], required: false, default: "md" },
10
+ direction: { type: String, required: false, default: "row" },
11
+ wrap: { type: Boolean, required: false, default: false },
12
+ between: { type: Boolean, required: false, default: false },
13
+ center: { type: Boolean, required: false, default: false },
14
+ grow: { type: Boolean, required: false, default: false }
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ const gap = computed(() => {
19
+ if (typeof props.size === "number") return `${props.size}px`;
20
+ return { sm: "var(--wd-space-2)", md: "var(--wd-space-3)", lg: "var(--wd-space-6)" }[props.size];
21
+ });
22
+ return (_ctx, _cache) => {
23
+ return _openBlock(), _createElementBlock(
24
+ "div",
25
+ {
26
+ class: _normalizeClass(["wd-space", {
27
+ "wd-space--col": __props.direction === "col",
28
+ "wd-space--wrap": __props.wrap,
29
+ "wd-space--between": __props.between,
30
+ "wd-space--center": __props.center,
31
+ "wd-space--grow": __props.grow
32
+ }]),
33
+ style: _normalizeStyle({ gap: gap.value })
34
+ },
35
+ [
36
+ _renderSlot(_ctx.$slots, "default")
37
+ ],
38
+ 6
39
+ /* CLASS, STYLE */
40
+ );
41
+ };
42
+ }
43
+ });
44
+ export {
45
+ WdSpace_default as WdSpace
46
+ };
@@ -0,0 +1,148 @@
1
+ // .lib-build/WdSparkline.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
4
+ import { computed, useId } from "vue";
5
+ var _hoisted_1 = ["aria-label"];
6
+ var _hoisted_2 = ["viewBox"];
7
+ var _hoisted_3 = { key: 0 };
8
+ var _hoisted_4 = ["id"];
9
+ var _hoisted_5 = ["d", "fill"];
10
+ var _hoisted_6 = ["d", "stroke-width"];
11
+ var W = 100;
12
+ var WdSparkline_default = /* @__PURE__ */ _defineComponent({
13
+ ...{ name: "WdSparkline" },
14
+ __name: "WdSparkline",
15
+ props: {
16
+ data: { type: Array, required: true },
17
+ height: { type: Number, required: false, default: 40 },
18
+ area: { type: Boolean, required: false, default: false },
19
+ dot: { type: Boolean, required: false, default: false },
20
+ strokeWidth: { type: Number, required: false, default: 2 },
21
+ color: { type: String, required: false, default: "" },
22
+ smooth: { type: Number, required: false, default: 0 },
23
+ label: { type: String, required: true, default: "" }
24
+ },
25
+ setup(__props) {
26
+ const props = __props;
27
+ const uid = useId();
28
+ const geom = computed(() => {
29
+ const d = props.data.filter((n) => Number.isFinite(n));
30
+ if (d.length < 2) return null;
31
+ const min = Math.min(...d);
32
+ const max = Math.max(...d);
33
+ const span = max - min || 1;
34
+ const pad = props.strokeWidth / 2;
35
+ const H = props.height;
36
+ const pts = d.map((v, i) => {
37
+ const x = i / (d.length - 1) * W;
38
+ const y = H - pad - (v - min) / span * (H - pad * 2);
39
+ return { x, y };
40
+ });
41
+ let line = "";
42
+ if (props.smooth > 0 && pts.length > 2) {
43
+ line = "M" + pts[0].x.toFixed(2) + " " + pts[0].y.toFixed(2);
44
+ for (let i = 0; i < pts.length - 1; i++) {
45
+ const p0 = pts[i - 1] || pts[i];
46
+ const p1 = pts[i];
47
+ const p2 = pts[i + 1];
48
+ const p3 = pts[i + 2] || p2;
49
+ const t = props.smooth / 6;
50
+ const c1x = p1.x + (p2.x - p0.x) * t;
51
+ const c1y = p1.y + (p2.y - p0.y) * t;
52
+ const c2x = p2.x - (p3.x - p1.x) * t;
53
+ const c2y = p2.y - (p3.y - p1.y) * t;
54
+ line += " C" + c1x.toFixed(2) + " " + c1y.toFixed(2);
55
+ line += " " + c2x.toFixed(2) + " " + c2y.toFixed(2);
56
+ line += " " + p2.x.toFixed(2) + " " + p2.y.toFixed(2);
57
+ }
58
+ } else {
59
+ line = pts.map((p, i) => (i ? "L" : "M") + p.x.toFixed(2) + " " + p.y.toFixed(2)).join(" ");
60
+ }
61
+ const areaPath = line + " L" + W + " " + H + " L0 " + H + " Z";
62
+ const last = pts[pts.length - 1];
63
+ const rising = d[d.length - 1] >= d[0];
64
+ return { line, areaPath, last, min, max, rising };
65
+ });
66
+ const gid = computed(() => "wdsl-" + uid);
67
+ return (_ctx, _cache) => {
68
+ return _openBlock(), _createElementBlock("div", {
69
+ class: "wd-sparkline",
70
+ style: _normalizeStyle({ height: __props.height + "px", color: __props.color || void 0 }),
71
+ role: "img",
72
+ "aria-label": __props.label
73
+ }, [
74
+ geom.value ? (_openBlock(), _createElementBlock("svg", {
75
+ key: 0,
76
+ viewBox: "0 0 " + W + " " + __props.height,
77
+ preserveAspectRatio: "none",
78
+ class: "wd-sparkline__svg",
79
+ "aria-hidden": "true"
80
+ }, [
81
+ __props.area ? (_openBlock(), _createElementBlock("defs", _hoisted_3, [
82
+ _createElementVNode("linearGradient", {
83
+ id: gid.value,
84
+ x1: "0",
85
+ y1: "0",
86
+ x2: "0",
87
+ y2: "1"
88
+ }, [..._cache[0] || (_cache[0] = [
89
+ _createElementVNode(
90
+ "stop",
91
+ {
92
+ offset: "0%",
93
+ "stop-color": "currentColor",
94
+ "stop-opacity": ".22"
95
+ },
96
+ null,
97
+ -1
98
+ /* CACHED */
99
+ ),
100
+ _createElementVNode(
101
+ "stop",
102
+ {
103
+ offset: "100%",
104
+ "stop-color": "currentColor",
105
+ "stop-opacity": "0"
106
+ },
107
+ null,
108
+ -1
109
+ /* CACHED */
110
+ )
111
+ ])], 8, _hoisted_4)
112
+ ])) : _createCommentVNode("v-if", true),
113
+ __props.area ? (_openBlock(), _createElementBlock("path", {
114
+ key: 1,
115
+ d: geom.value.areaPath,
116
+ fill: "url(#" + gid.value + ")",
117
+ stroke: "none"
118
+ }, null, 8, _hoisted_5)) : _createCommentVNode("v-if", true),
119
+ _createElementVNode("path", {
120
+ d: geom.value.line,
121
+ fill: "none",
122
+ stroke: "currentColor",
123
+ "stroke-width": __props.strokeWidth,
124
+ "stroke-linecap": "round",
125
+ "stroke-linejoin": "round",
126
+ "vector-effect": "non-scaling-stroke"
127
+ }, null, 8, _hoisted_6)
128
+ ], 8, _hoisted_2)) : _createCommentVNode("v-if", true),
129
+ _createCommentVNode('\n \u672B\u70B9\u5706\u70B9\u7528 HTML \u753B\uFF0C\u4E0D\u7528 SVG circle\uFF1A\n SVG \u88AB preserveAspectRatio="none" \u6A2A\u5411\u62C9\u4F38\uFF0C\u5706\u4F1A\u88AB\u538B\u6210\u692D\u5706\u3002\n \u7528\u7EDD\u5BF9\u5B9A\u4F4D\u7684 div + \u767E\u5206\u6BD4\u5750\u6807\uFF0C\u5706\u6C38\u8FDC\u662F\u5706\u7684\u3002\n '),
130
+ geom.value && __props.dot ? (_openBlock(), _createElementBlock(
131
+ "span",
132
+ {
133
+ key: 1,
134
+ class: _normalizeClass(["wd-sparkline__dot", { "wd-sparkline__dot--down": !geom.value.rising }]),
135
+ style: _normalizeStyle({ left: geom.value.last.x / W * 100 + "%", top: geom.value.last.y + "px" }),
136
+ "aria-hidden": "true"
137
+ },
138
+ null,
139
+ 6
140
+ /* CLASS, STYLE */
141
+ )) : _createCommentVNode("v-if", true)
142
+ ], 12, _hoisted_1);
143
+ };
144
+ }
145
+ });
146
+ export {
147
+ WdSparkline_default as WdSparkline
148
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ WdSpinner_default
3
+ } from "./chunk-WDDAALPI.js";
4
+ export {
5
+ WdSpinner_default as WdSpinner
6
+ };
@@ -0,0 +1,183 @@
1
+ // .lib-build/WdSplitter.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { unref as _unref, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ import { computed, onBeforeUnmount, ref, watch } from "vue";
5
+ var _hoisted_1 = ["aria-orientation", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-label"];
6
+ var WdSplitter_default = /* @__PURE__ */ _defineComponent({
7
+ ...{ name: "WdSplitter" },
8
+ __name: "WdSplitter",
9
+ props: {
10
+ direction: { type: String, required: false, default: "horizontal" },
11
+ modelValue: { type: Number, required: false, default: void 0 },
12
+ defaultValue: { type: Number, required: false, default: 50 },
13
+ min: { type: Number, required: false, default: 10 },
14
+ max: { type: Number, required: false, default: 90 },
15
+ size: { type: Number, required: false, default: 6 },
16
+ disabled: { type: Boolean, required: false, default: false }
17
+ },
18
+ emits: ["update:modelValue", "resize", "resizeEnd"],
19
+ setup(__props, { emit: __emit }) {
20
+ const props = __props;
21
+ const emit = __emit;
22
+ const root = ref(null);
23
+ const inner = ref(props.defaultValue);
24
+ const isControlled = computed(() => props.modelValue !== void 0);
25
+ const ratio = computed(() => isControlled.value ? props.modelValue : inner.value);
26
+ let dragging = false;
27
+ let lastRatio = 0;
28
+ function clamp(v) {
29
+ return Math.max(props.min, Math.min(props.max, v));
30
+ }
31
+ function apply(v, final = false) {
32
+ const c = clamp(v);
33
+ lastRatio = c;
34
+ if (!isControlled.value) inner.value = c;
35
+ emit("resize", c);
36
+ if (final) {
37
+ emit("update:modelValue", c);
38
+ emit("resizeEnd", c);
39
+ }
40
+ }
41
+ function ratioFromEvent(e) {
42
+ const el = root.value;
43
+ if (!el) return null;
44
+ const r = el.getBoundingClientRect();
45
+ if (props.direction === "horizontal") {
46
+ if (r.width === 0) return null;
47
+ return (e.clientX - r.left) / r.width * 100;
48
+ }
49
+ if (r.height === 0) return null;
50
+ return (e.clientY - r.top) / r.height * 100;
51
+ }
52
+ function onDown(e) {
53
+ if (props.disabled) return;
54
+ e.preventDefault();
55
+ dragging = true;
56
+ lastRatio = ratio.value;
57
+ e.currentTarget.setPointerCapture?.(e.pointerId);
58
+ document.body.style.cursor = props.direction === "horizontal" ? "col-resize" : "row-resize";
59
+ document.body.style.userSelect = "none";
60
+ }
61
+ function onMove(e) {
62
+ if (!dragging) return;
63
+ const v = ratioFromEvent(e);
64
+ if (v !== null) apply(v);
65
+ }
66
+ function onUp(e) {
67
+ if (!dragging) return;
68
+ dragging = false;
69
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
70
+ document.body.style.cursor = "";
71
+ document.body.style.userSelect = "";
72
+ emit("update:modelValue", lastRatio);
73
+ emit("resizeEnd", lastRatio);
74
+ }
75
+ function onKeydown(e) {
76
+ if (props.disabled) return;
77
+ const step = e.shiftKey ? 10 : 2;
78
+ const forward = props.direction === "horizontal" ? "ArrowRight" : "ArrowDown";
79
+ const back = props.direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
80
+ if (e.key === forward) {
81
+ e.preventDefault();
82
+ apply(ratio.value + step, true);
83
+ } else if (e.key === back) {
84
+ e.preventDefault();
85
+ apply(ratio.value - step, true);
86
+ } else if (e.key === "Home") {
87
+ e.preventDefault();
88
+ apply(props.min, true);
89
+ } else if (e.key === "End") {
90
+ e.preventDefault();
91
+ apply(props.max, true);
92
+ }
93
+ }
94
+ function onDblClick() {
95
+ if (props.disabled) return;
96
+ apply(props.defaultValue, true);
97
+ }
98
+ onBeforeUnmount(() => {
99
+ document.body.style.cursor = "";
100
+ document.body.style.userSelect = "";
101
+ });
102
+ watch(
103
+ () => props.modelValue,
104
+ (v) => {
105
+ if (v !== void 0) lastRatio = v;
106
+ }
107
+ );
108
+ const firstStyle = computed(
109
+ () => props.direction === "horizontal" ? { width: `calc(${ratio.value}% - ${props.size / 2}px)` } : { height: `calc(${ratio.value}% - ${props.size / 2}px)` }
110
+ );
111
+ const secondStyle = computed(() => ({ flex: "1 1 0", minWidth: "0", minHeight: "0" }));
112
+ return (_ctx, _cache) => {
113
+ return _openBlock(), _createElementBlock(
114
+ "div",
115
+ {
116
+ ref_key: "root",
117
+ ref: root,
118
+ class: _normalizeClass(["wd-splitter", [`wd-splitter--${__props.direction}`, { "is-dragging": _unref(dragging), "is-disabled": __props.disabled }]])
119
+ },
120
+ [
121
+ _createElementVNode(
122
+ "div",
123
+ {
124
+ class: "wd-splitter__pane",
125
+ style: _normalizeStyle(firstStyle.value)
126
+ },
127
+ [
128
+ _renderSlot(_ctx.$slots, "first")
129
+ ],
130
+ 4
131
+ /* STYLE */
132
+ ),
133
+ _createCommentVNode('\n \u5206\u9694\u6761\uFF1Arole="separator" + aria-valuenow \u662F\u65E0\u969C\u788D\u6807\u51C6\u505A\u6CD5\uFF0C\n \u952E\u76D8\u5DE6\u53F3/\u4E0A\u4E0B\u7BAD\u5934\u53EF\u8C03\u8282\uFF0CHome/End \u5230\u4E24\u7AEF\u3002\n '),
134
+ _createElementVNode("div", {
135
+ class: "wd-splitter__bar",
136
+ style: _normalizeStyle(__props.direction === "horizontal" ? { width: __props.size + "px" } : { height: __props.size + "px" }),
137
+ role: "separator",
138
+ tabindex: "0",
139
+ "aria-orientation": __props.direction === "horizontal" ? "vertical" : "horizontal",
140
+ "aria-valuenow": Math.round(ratio.value),
141
+ "aria-valuemin": __props.min,
142
+ "aria-valuemax": __props.max,
143
+ "aria-label": `\u5206\u9694\u6761 ${Math.round(ratio.value)}%`,
144
+ onPointerdown: onDown,
145
+ onPointermove: onMove,
146
+ onPointerup: onUp,
147
+ onPointercancel: onUp,
148
+ onKeydown,
149
+ onDblclick: onDblClick
150
+ }, [
151
+ _createCommentVNode(" \u6293\u63E1\u63D0\u793A\uFF1A\u4E09\u6839\u77ED\u6A2A\u7EBF\uFF0C\u53EA\u6709 hover/\u62D6\u62FD\u65F6\u624D\u663E\u5F62 "),
152
+ _createElementVNode(
153
+ "span",
154
+ {
155
+ class: _normalizeClass(["wd-splitter__grip", { "is-visible": !__props.disabled }])
156
+ },
157
+ null,
158
+ 2
159
+ /* CLASS */
160
+ )
161
+ ], 44, _hoisted_1),
162
+ _createElementVNode(
163
+ "div",
164
+ {
165
+ class: "wd-splitter__pane wd-splitter__pane--second",
166
+ style: _normalizeStyle(secondStyle.value)
167
+ },
168
+ [
169
+ _renderSlot(_ctx.$slots, "second")
170
+ ],
171
+ 4
172
+ /* STYLE */
173
+ )
174
+ ],
175
+ 2
176
+ /* CLASS */
177
+ );
178
+ };
179
+ }
180
+ });
181
+ export {
182
+ WdSplitter_default as WdSplitter
183
+ };