@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.
- package/README.md +208 -127
- package/dist/index.d.ts +1010 -80
- package/dist/parts/WdAffix.js +159 -0
- package/dist/parts/WdAiMessage.js +277 -0
- package/dist/parts/WdAlert.js +92 -0
- package/dist/parts/WdAnchor.js +159 -0
- package/dist/parts/WdAudioPlayer.js +1024 -0
- package/dist/parts/WdAvatar.js +6 -0
- package/dist/parts/WdAvatarGroup.js +46 -0
- package/dist/parts/WdBacktop.js +120 -0
- package/dist/parts/WdBadge.js +61 -0
- package/dist/parts/WdBento.js +40 -0
- package/dist/parts/WdBentoItem.js +43 -0
- package/dist/parts/WdBottomSheet.js +263 -0
- package/dist/parts/WdBreadcrumb.js +64 -0
- package/dist/parts/WdButton.js +94 -0
- package/dist/parts/WdCalendar.js +11 -0
- package/dist/parts/WdCard.js +113 -0
- package/dist/parts/WdCarousel.js +365 -0
- package/dist/parts/WdCascader.js +386 -0
- package/dist/parts/WdCheckbox.js +81 -0
- package/dist/parts/WdCollapse.js +135 -0
- package/dist/parts/WdColorPicker.js +592 -0
- package/dist/parts/WdCommand.js +357 -0
- package/dist/parts/WdContainer.js +37 -0
- package/dist/parts/WdCountdown.js +163 -0
- package/dist/parts/WdDanmaku.js +6 -0
- package/dist/parts/WdDatePicker.js +169 -0
- package/dist/parts/WdDateTimePicker.js +162 -0
- package/dist/parts/WdDescriptions.js +146 -0
- package/dist/parts/WdDivider.js +64 -0
- package/dist/parts/WdDrawer.js +176 -0
- package/dist/parts/WdDropdown.js +140 -0
- package/dist/parts/WdEmpty.js +79 -0
- package/dist/parts/WdExplorer.js +336 -0
- package/dist/parts/WdFileList.js +177 -0
- package/dist/parts/WdForm.js +111 -0
- package/dist/parts/WdFormItem.js +156 -0
- package/dist/parts/WdGrid.js +40 -0
- package/dist/parts/WdGroup.js +68 -0
- package/dist/parts/WdImagePreview.js +274 -0
- package/dist/parts/WdInput.js +10 -0
- package/dist/parts/WdInputNumber.js +253 -0
- package/dist/parts/WdListItem.js +60 -0
- package/dist/parts/WdLoading.js +128 -0
- package/dist/parts/WdMarkdown.js +172 -0
- package/dist/parts/WdMarquee.js +80 -0
- package/dist/parts/WdMasonry.js +40 -0
- package/dist/parts/WdMediaCard.js +302 -0
- package/dist/parts/WdMentions.js +277 -0
- package/dist/parts/WdModal.js +149 -0
- package/dist/parts/WdNav.js +311 -0
- package/dist/parts/WdNotification.js +112 -0
- package/dist/parts/WdOtp.js +107 -0
- package/dist/parts/WdPagination.js +252 -0
- package/dist/parts/WdPopconfirm.js +214 -0
- package/dist/parts/WdPopover.js +203 -0
- package/dist/parts/WdPostItem.js +84 -0
- package/dist/parts/WdProgress.js +48 -0
- package/dist/parts/WdProgressRing.js +101 -0
- package/dist/parts/WdPullRefresh.js +167 -0
- package/dist/parts/WdQRCode.js +1909 -0
- package/dist/parts/WdRadioGroup.js +95 -0
- package/dist/parts/WdRate.js +128 -0
- package/dist/parts/WdResult.js +86 -0
- package/dist/parts/WdScrollbar.js +186 -0
- package/dist/parts/WdSegmented.js +11 -0
- package/dist/parts/WdSelect.js +465 -0
- package/dist/parts/WdSkeleton.js +69 -0
- package/dist/parts/WdSlider.js +100 -0
- package/dist/parts/WdSortableList.js +291 -0
- package/dist/parts/WdSpace.js +46 -0
- package/dist/parts/WdSparkline.js +148 -0
- package/dist/parts/WdSpinner.js +6 -0
- package/dist/parts/WdSplitter.js +183 -0
- package/dist/parts/WdStatBar.js +202 -0
- package/dist/parts/WdStatistic.js +131 -0
- package/dist/parts/WdSteps.js +110 -0
- package/dist/parts/WdSwitch.js +63 -0
- package/dist/parts/WdTabBar.js +84 -0
- package/dist/parts/WdTable.js +589 -0
- package/dist/parts/WdTabs.js +219 -0
- package/dist/parts/WdTag.js +6 -0
- package/dist/parts/WdTagInput.js +181 -0
- package/dist/parts/WdTimePicker.js +12 -0
- package/dist/parts/WdTimeline.js +145 -0
- package/dist/parts/WdTooltip.js +108 -0
- package/dist/parts/WdTour.js +264 -0
- package/dist/parts/WdTransfer.js +446 -0
- package/dist/parts/WdTree.js +322 -0
- package/dist/parts/WdUpload.js +309 -0
- package/dist/parts/WdVideoPlayer.js +1006 -0
- package/dist/parts/WdVirtualList.js +169 -0
- package/dist/parts/WdWatermark.js +150 -0
- package/dist/parts/chunk-3LVE72ZK.js +361 -0
- package/dist/parts/chunk-5HYOQ52I.js +101 -0
- package/dist/parts/chunk-7M3MUL3B.js +275 -0
- package/dist/parts/chunk-AOTJ63HN.js +15 -0
- package/dist/parts/chunk-AXEF2U2A.js +41 -0
- package/dist/parts/chunk-CY3QOSFP.js +645 -0
- package/dist/parts/chunk-G7NN4A6J.js +40 -0
- package/dist/parts/chunk-HAKYCUAR.js +9 -0
- package/dist/parts/chunk-JDE4AHBR.js +160 -0
- package/dist/parts/chunk-LT3NTWIT.js +117 -0
- package/dist/parts/chunk-OGHYFT7B.js +387 -0
- package/dist/parts/chunk-Q34U2HES.js +261 -0
- package/dist/parts/chunk-RLSVPJHM.js +10 -0
- package/dist/parts/chunk-U2CDKD2T.js +30 -0
- package/dist/parts/chunk-UYUNYHZD.js +40 -0
- package/dist/parts/chunk-VUJL2HGD.js +23 -0
- package/dist/parts/chunk-WCFG5KNT.js +51 -0
- package/dist/parts/chunk-WDDAALPI.js +42 -0
- package/dist/parts/chunk-WFXLDBP2.js +149 -0
- package/dist/style/affix.css +566 -0
- package/dist/style/ai-msg.css +572 -13
- package/dist/style/alert.css +577 -5
- package/dist/style/anchor.css +630 -0
- package/dist/style/audio.css +658 -67
- package/dist/style/avatar.css +575 -12
- package/dist/style/backtop.css +625 -0
- package/dist/style/badge.css +595 -11
- package/dist/style/bento.css +763 -0
- package/dist/style/bottom-sheet.css +776 -0
- package/dist/style/breadcrumb.css +579 -4
- package/dist/style/button.css +631 -36
- package/dist/style/calendar.css +1512 -0
- package/dist/style/card.css +683 -6
- package/dist/style/carousel.css +573 -4
- package/dist/style/cascader.css +862 -0
- package/dist/style/checkbox.css +584 -7
- package/dist/style/chevron.css +543 -1
- package/dist/style/collapse.css +586 -7
- package/dist/style/colorpicker.css +876 -0
- package/dist/style/command.css +572 -13
- package/dist/style/container.css +543 -0
- package/dist/style/countdown.css +722 -0
- package/dist/style/danmaku.css +644 -0
- package/dist/style/datepicker.css +606 -128
- package/dist/style/datetime-picker.css +714 -0
- package/dist/style/descriptions.css +604 -11
- package/dist/style/divider.css +544 -2
- package/dist/style/dot.css +556 -1
- package/dist/style/drawer.css +609 -11
- package/dist/style/dropdown.css +565 -3
- package/dist/style/empty.css +624 -3
- package/dist/style/explorer.css +632 -24
- package/dist/style/file-list.css +577 -5
- package/dist/style/flip.css +600 -0
- package/dist/style/form.css +550 -8
- package/dist/style/grid.css +614 -0
- package/dist/style/group.css +560 -16
- package/dist/style/icon-btn.css +570 -4
- package/dist/style/image-preview.css +652 -8
- package/dist/style/input-number.css +680 -0
- package/dist/style/input.css +571 -8
- package/dist/style/list.css +553 -4
- package/dist/style/loading.css +667 -0
- package/dist/style/markdown.css +592 -20
- package/dist/style/marquee.css +678 -0
- package/dist/style/masonry.css +614 -0
- package/dist/style/media-card.css +1229 -0
- package/dist/style/mentions.css +690 -0
- package/dist/style/modal.css +626 -15
- package/dist/style/nav.css +1046 -0
- package/dist/style/notification.css +556 -7
- package/dist/style/otp.css +567 -7
- package/dist/style/pagination.css +571 -11
- package/dist/style/popconfirm.css +568 -10
- package/dist/style/popover.css +645 -15
- package/dist/style/post-item.css +548 -6
- package/dist/style/progress-ring.css +640 -0
- package/dist/style/progress.css +543 -1
- package/dist/style/pull-refresh.css +637 -0
- package/dist/style/qrcode.css +613 -0
- package/dist/style/radio.css +584 -5
- package/dist/style/rate.css +594 -1
- package/dist/style/result.css +546 -3
- package/dist/style/scroll-reveal.css +613 -0
- package/dist/style/scrollbar.css +644 -0
- package/dist/style/segmented-picker.css +573 -14
- package/dist/style/segmented.css +711 -7
- package/dist/style/select.css +682 -26
- package/dist/style/skeleton.css +559 -0
- package/dist/style/slider.css +565 -4
- package/dist/style/sortable.css +593 -7
- package/dist/style/space.css +543 -0
- package/dist/style/sparkline.css +606 -0
- package/dist/style/spinner.css +559 -0
- package/dist/style/splitter.css +711 -0
- package/dist/style/stat-bar.css +767 -0
- package/dist/style/statistic.css +552 -7
- package/dist/style/steps.css +633 -9
- package/dist/style/switch.css +585 -4
- package/dist/style/tab-bar.css +647 -0
- package/dist/style/table.css +886 -36
- package/dist/style/tabs.css +599 -10
- package/dist/style/tag-input.css +710 -0
- package/dist/style/tag.css +603 -18
- package/dist/style/time-picker.css +749 -0
- package/dist/style/timeline.css +575 -14
- package/dist/style/toast.css +567 -6
- package/dist/style/tooltip.css +564 -5
- package/dist/style/tour.css +683 -0
- package/dist/style/transfer.css +858 -0
- package/dist/style/tree.css +613 -16
- package/dist/style/typography.css +884 -3
- package/dist/style/upload.css +602 -13
- package/dist/style/vlist.css +543 -1
- package/dist/style/vplayer.css +799 -57
- package/dist/style/watermark.css +570 -0
- package/dist/wdesign-ui.css +18055 -7262
- package/dist/wdesign-ui.esm.js +8976 -5044
- package/package.json +99 -13
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useControllable
|
|
3
|
+
} from "./chunk-G7NN4A6J.js";
|
|
4
|
+
import {
|
|
5
|
+
FORM_ITEM_CONTEXT
|
|
6
|
+
} from "./chunk-UYUNYHZD.js";
|
|
7
|
+
import {
|
|
8
|
+
WdIcon_default
|
|
9
|
+
} from "./chunk-Q34U2HES.js";
|
|
10
|
+
|
|
11
|
+
// .lib-build/WdInputNumber.ts
|
|
12
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
13
|
+
import { unref as _unref, createVNode as _createVNode, withModifiers as _withModifiers, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, mergeProps as _mergeProps, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
|
|
14
|
+
import { computed, inject, onBeforeUnmount, ref, useAttrs } from "vue";
|
|
15
|
+
var _hoisted_1 = ["disabled"];
|
|
16
|
+
var _hoisted_2 = { class: "wd-num__field" };
|
|
17
|
+
var _hoisted_3 = ["aria-label", "aria-valuenow", "aria-valuemin", "aria-valuemax", "value", "placeholder", "disabled", "readonly"];
|
|
18
|
+
var _hoisted_4 = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "wd-num__suffix"
|
|
21
|
+
};
|
|
22
|
+
var _hoisted_5 = ["disabled"];
|
|
23
|
+
var WdInputNumber_default = /* @__PURE__ */ _defineComponent({
|
|
24
|
+
...{ name: "WdInputNumber", inheritAttrs: false },
|
|
25
|
+
__name: "WdInputNumber",
|
|
26
|
+
props: {
|
|
27
|
+
modelValue: { type: [Number, null], required: false },
|
|
28
|
+
defaultValue: { type: [Number, null], required: false, default: null },
|
|
29
|
+
min: { type: Number, required: false, default: -Infinity },
|
|
30
|
+
max: { type: Number, required: false, default: Infinity },
|
|
31
|
+
step: { type: Number, required: false, default: 1 },
|
|
32
|
+
precision: { type: Number, required: false },
|
|
33
|
+
placeholder: { type: String, required: false },
|
|
34
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
35
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
36
|
+
size: { type: String, required: false, default: "md" },
|
|
37
|
+
shape: { type: String, required: false, default: "rounded" },
|
|
38
|
+
hideStep: { type: Boolean, required: false, default: false },
|
|
39
|
+
suffix: { type: String, required: false }
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue", "change"],
|
|
42
|
+
setup(__props, { emit: __emit }) {
|
|
43
|
+
const props = __props;
|
|
44
|
+
const emit = __emit;
|
|
45
|
+
const { value, set } = useControllable({
|
|
46
|
+
modelValue: computed(() => props.modelValue),
|
|
47
|
+
defaultValue: computed(() => props.defaultValue),
|
|
48
|
+
fallback: null
|
|
49
|
+
});
|
|
50
|
+
const el = ref();
|
|
51
|
+
const draft = ref(null);
|
|
52
|
+
const display = computed(() => {
|
|
53
|
+
if (draft.value !== null) return draft.value;
|
|
54
|
+
const v = value.value;
|
|
55
|
+
if (v === null || v === void 0) return "";
|
|
56
|
+
return props.precision === void 0 ? String(v) : v.toFixed(props.precision);
|
|
57
|
+
});
|
|
58
|
+
function clamp(n) {
|
|
59
|
+
let v = n;
|
|
60
|
+
if (v < props.min) v = props.min;
|
|
61
|
+
if (v > props.max) v = props.max;
|
|
62
|
+
if (props.precision !== void 0) {
|
|
63
|
+
v = Number(v.toFixed(props.precision));
|
|
64
|
+
}
|
|
65
|
+
return v;
|
|
66
|
+
}
|
|
67
|
+
function commit(n, source) {
|
|
68
|
+
const next = n === null ? null : clamp(n);
|
|
69
|
+
if (next !== value.value) {
|
|
70
|
+
set(next);
|
|
71
|
+
emit("update:modelValue", next);
|
|
72
|
+
}
|
|
73
|
+
emit("change", next, source);
|
|
74
|
+
}
|
|
75
|
+
function onInput(e) {
|
|
76
|
+
const t = e.target;
|
|
77
|
+
draft.value = t.value;
|
|
78
|
+
if (t.value.trim() === "") {
|
|
79
|
+
commit(null, "input");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const n = Number(t.value);
|
|
83
|
+
if (!Number.isNaN(n)) commit(n, "input");
|
|
84
|
+
}
|
|
85
|
+
function onBlur() {
|
|
86
|
+
const raw = draft.value;
|
|
87
|
+
draft.value = null;
|
|
88
|
+
if (raw === null) return;
|
|
89
|
+
const t = raw.trim();
|
|
90
|
+
if (t === "") {
|
|
91
|
+
commit(null, "blur");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const n = Number(t);
|
|
95
|
+
if (Number.isNaN(n)) {
|
|
96
|
+
if (el.value) el.value.value = display.value;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
commit(n, "blur");
|
|
100
|
+
}
|
|
101
|
+
const timer = ref();
|
|
102
|
+
const repeatCount = ref(0);
|
|
103
|
+
function stepBy(dir, big = false) {
|
|
104
|
+
if (props.disabled || props.readonly) return;
|
|
105
|
+
const base = value.value ?? 0;
|
|
106
|
+
const delta = props.step * (big ? 10 : 1) * dir;
|
|
107
|
+
commit(base + delta, "step");
|
|
108
|
+
}
|
|
109
|
+
function stopRepeat() {
|
|
110
|
+
if (timer.value) {
|
|
111
|
+
clearTimeout(timer.value);
|
|
112
|
+
timer.value = void 0;
|
|
113
|
+
}
|
|
114
|
+
repeatCount.value = 0;
|
|
115
|
+
}
|
|
116
|
+
function startRepeat(dir, big) {
|
|
117
|
+
stepBy(dir, big);
|
|
118
|
+
repeatCount.value = 0;
|
|
119
|
+
const tick = () => {
|
|
120
|
+
repeatCount.value += 1;
|
|
121
|
+
stepBy(dir, big);
|
|
122
|
+
const delay = repeatCount.value < 8 ? 120 : 60;
|
|
123
|
+
timer.value = window.setTimeout(tick, delay);
|
|
124
|
+
};
|
|
125
|
+
timer.value = window.setTimeout(tick, 500);
|
|
126
|
+
}
|
|
127
|
+
onBeforeUnmount(stopRepeat);
|
|
128
|
+
function onKeydown(e) {
|
|
129
|
+
if (props.disabled || props.readonly) return;
|
|
130
|
+
if (e.key === "ArrowUp") {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
stepBy(1, e.shiftKey);
|
|
133
|
+
} else if (e.key === "ArrowDown") {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
stepBy(-1, e.shiftKey);
|
|
136
|
+
} else if (e.key === "Home") {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
commit(props.min === -Infinity ? 0 : props.min, "step");
|
|
139
|
+
} else if (e.key === "End") {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
if (props.max !== Infinity) commit(props.max, "step");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const $attrs = useAttrs();
|
|
145
|
+
const formItem = inject(FORM_ITEM_CONTEXT, null);
|
|
146
|
+
const inputAttrs = computed(() => {
|
|
147
|
+
const { class: _c, style: _s, ...rest } = $attrs;
|
|
148
|
+
if (!formItem) return rest;
|
|
149
|
+
const merged = { ...rest };
|
|
150
|
+
if (merged["aria-invalid"] === void 0 && formItem.invalid()) {
|
|
151
|
+
merged["aria-invalid"] = "true";
|
|
152
|
+
}
|
|
153
|
+
const described = formItem.errorId();
|
|
154
|
+
if (described && merged["aria-describedby"] === void 0) {
|
|
155
|
+
merged["aria-describedby"] = described;
|
|
156
|
+
}
|
|
157
|
+
return merged;
|
|
158
|
+
});
|
|
159
|
+
const canMinus = computed(
|
|
160
|
+
() => !props.disabled && !props.readonly && (value.value ?? 0) > props.min
|
|
161
|
+
);
|
|
162
|
+
const canPlus = computed(
|
|
163
|
+
() => !props.disabled && !props.readonly && (value.value ?? 0) < props.max
|
|
164
|
+
);
|
|
165
|
+
return (_ctx, _cache) => {
|
|
166
|
+
return _openBlock(), _createElementBlock(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
class: _normalizeClass(["wd-num", [
|
|
170
|
+
{
|
|
171
|
+
"wd-num--lg": __props.size === "lg",
|
|
172
|
+
"wd-num--sm": __props.size === "sm",
|
|
173
|
+
"wd-num--rounded": __props.shape === "rounded",
|
|
174
|
+
"is-disabled": __props.disabled,
|
|
175
|
+
"is-readonly": __props.readonly
|
|
176
|
+
},
|
|
177
|
+
_unref($attrs).class
|
|
178
|
+
]]),
|
|
179
|
+
style: _normalizeStyle(_unref($attrs).style)
|
|
180
|
+
},
|
|
181
|
+
[
|
|
182
|
+
!__props.hideStep ? (_openBlock(), _createElementBlock("button", {
|
|
183
|
+
key: 0,
|
|
184
|
+
type: "button",
|
|
185
|
+
class: "wd-num__btn wd-num__btn--minus",
|
|
186
|
+
disabled: !canMinus.value,
|
|
187
|
+
"aria-label": "\u51CF",
|
|
188
|
+
tabindex: "-1",
|
|
189
|
+
onPointerdown: _cache[0] || (_cache[0] = _withModifiers(($event) => startRepeat(-1, $event.shiftKey), ["prevent"])),
|
|
190
|
+
onPointerup: stopRepeat,
|
|
191
|
+
onPointerleave: stopRepeat,
|
|
192
|
+
onPointercancel: stopRepeat
|
|
193
|
+
}, [
|
|
194
|
+
_createVNode(_unref(WdIcon_default), {
|
|
195
|
+
name: "minus",
|
|
196
|
+
size: 14
|
|
197
|
+
})
|
|
198
|
+
], 40, _hoisted_1)) : _createCommentVNode("v-if", true),
|
|
199
|
+
_createElementVNode("div", _hoisted_2, [
|
|
200
|
+
_createElementVNode("input", _mergeProps({
|
|
201
|
+
ref_key: "el",
|
|
202
|
+
ref: el
|
|
203
|
+
}, inputAttrs.value, {
|
|
204
|
+
type: "text",
|
|
205
|
+
inputmode: "decimal",
|
|
206
|
+
role: "spinbutton",
|
|
207
|
+
"aria-label": _unref($attrs)["aria-label"] ? void 0 : "\u6570\u503C",
|
|
208
|
+
"aria-valuenow": _unref(value) === null ? void 0 : _unref(value),
|
|
209
|
+
"aria-valuemin": __props.min === -Infinity ? void 0 : __props.min,
|
|
210
|
+
"aria-valuemax": __props.max === Infinity ? void 0 : __props.max,
|
|
211
|
+
value: display.value,
|
|
212
|
+
placeholder: __props.placeholder,
|
|
213
|
+
disabled: __props.disabled,
|
|
214
|
+
readonly: __props.readonly,
|
|
215
|
+
onInput,
|
|
216
|
+
onBlur,
|
|
217
|
+
onKeydown
|
|
218
|
+
}), null, 16, _hoisted_3),
|
|
219
|
+
__props.suffix ? (_openBlock(), _createElementBlock(
|
|
220
|
+
"span",
|
|
221
|
+
_hoisted_4,
|
|
222
|
+
_toDisplayString(__props.suffix),
|
|
223
|
+
1
|
|
224
|
+
/* TEXT */
|
|
225
|
+
)) : _createCommentVNode("v-if", true)
|
|
226
|
+
]),
|
|
227
|
+
!__props.hideStep ? (_openBlock(), _createElementBlock("button", {
|
|
228
|
+
key: 1,
|
|
229
|
+
type: "button",
|
|
230
|
+
class: "wd-num__btn wd-num__btn--plus",
|
|
231
|
+
disabled: !canPlus.value,
|
|
232
|
+
"aria-label": "\u52A0",
|
|
233
|
+
tabindex: "-1",
|
|
234
|
+
onPointerdown: _cache[1] || (_cache[1] = _withModifiers(($event) => startRepeat(1, $event.shiftKey), ["prevent"])),
|
|
235
|
+
onPointerup: stopRepeat,
|
|
236
|
+
onPointerleave: stopRepeat,
|
|
237
|
+
onPointercancel: stopRepeat
|
|
238
|
+
}, [
|
|
239
|
+
_createVNode(_unref(WdIcon_default), {
|
|
240
|
+
name: "plus",
|
|
241
|
+
size: 14
|
|
242
|
+
})
|
|
243
|
+
], 40, _hoisted_5)) : _createCommentVNode("v-if", true)
|
|
244
|
+
],
|
|
245
|
+
6
|
|
246
|
+
/* CLASS, STYLE */
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
export {
|
|
252
|
+
WdInputNumber_default as WdInputNumber
|
|
253
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// .lib-build/WdListItem.ts
|
|
2
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
+
import { renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
|
|
4
|
+
var _hoisted_1 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "wd-list-item__icon"
|
|
7
|
+
};
|
|
8
|
+
var _hoisted_2 = { class: "wd-list-item__title" };
|
|
9
|
+
var _hoisted_3 = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "wd-list-item__meta"
|
|
12
|
+
};
|
|
13
|
+
var WdListItem_default = /* @__PURE__ */ _defineComponent({
|
|
14
|
+
...{ name: "WdListItem" },
|
|
15
|
+
__name: "WdListItem",
|
|
16
|
+
props: {
|
|
17
|
+
title: { type: String, required: false, default: "" },
|
|
18
|
+
meta: { type: String, required: false, default: "" },
|
|
19
|
+
clickable: { type: Boolean, required: false, default: true }
|
|
20
|
+
},
|
|
21
|
+
emits: ["click"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const emit = __emit;
|
|
24
|
+
return (_ctx, _cache) => {
|
|
25
|
+
return _openBlock(), _createElementBlock(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
"data-wd-hover": "",
|
|
29
|
+
class: _normalizeClass(["wd-list-item", { "wd-list-item--clickable": __props.clickable }]),
|
|
30
|
+
onClick: _cache[0] || (_cache[0] = ($event) => __props.clickable && emit("click", $event))
|
|
31
|
+
},
|
|
32
|
+
[
|
|
33
|
+
_ctx.$slots.icon ? (_openBlock(), _createElementBlock("span", _hoisted_1, [
|
|
34
|
+
_renderSlot(_ctx.$slots, "icon")
|
|
35
|
+
])) : _createCommentVNode("v-if", true),
|
|
36
|
+
_createElementVNode(
|
|
37
|
+
"span",
|
|
38
|
+
_hoisted_2,
|
|
39
|
+
_toDisplayString(__props.title),
|
|
40
|
+
1
|
|
41
|
+
/* TEXT */
|
|
42
|
+
),
|
|
43
|
+
__props.meta ? (_openBlock(), _createElementBlock(
|
|
44
|
+
"span",
|
|
45
|
+
_hoisted_3,
|
|
46
|
+
_toDisplayString(__props.meta),
|
|
47
|
+
1
|
|
48
|
+
/* TEXT */
|
|
49
|
+
)) : _createCommentVNode("v-if", true),
|
|
50
|
+
_renderSlot(_ctx.$slots, "extra")
|
|
51
|
+
],
|
|
52
|
+
2
|
|
53
|
+
/* CLASS */
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export {
|
|
59
|
+
WdListItem_default as WdListItem
|
|
60
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WdSpinner_default
|
|
3
|
+
} from "./chunk-WDDAALPI.js";
|
|
4
|
+
|
|
5
|
+
// .lib-build/WdLoading.ts
|
|
6
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
7
|
+
import { renderSlot as _renderSlot, createCommentVNode as _createCommentVNode, createVNode as _createVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, Transition as _Transition, withCtx as _withCtx, mergeProps as _mergeProps, createBlock as _createBlock } from "vue";
|
|
8
|
+
import { computed, useSlots } from "vue";
|
|
9
|
+
var _hoisted_1 = {
|
|
10
|
+
class: "wd-loading__body",
|
|
11
|
+
role: "status",
|
|
12
|
+
"aria-live": "polite"
|
|
13
|
+
};
|
|
14
|
+
var _hoisted_2 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "wd-loading__text"
|
|
17
|
+
};
|
|
18
|
+
var _hoisted_3 = {
|
|
19
|
+
class: "wd-loading__body",
|
|
20
|
+
role: "status",
|
|
21
|
+
"aria-live": "polite"
|
|
22
|
+
};
|
|
23
|
+
var _hoisted_4 = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "wd-loading__text"
|
|
26
|
+
};
|
|
27
|
+
var WdLoading_default = /* @__PURE__ */ _defineComponent({
|
|
28
|
+
...{ name: "WdLoading" },
|
|
29
|
+
__name: "WdLoading",
|
|
30
|
+
props: {
|
|
31
|
+
loading: { type: Boolean, required: false, default: false },
|
|
32
|
+
text: { type: String, required: false, default: "\u52A0\u8F7D\u4E2D" },
|
|
33
|
+
delay: { type: Number, required: false, default: 180 },
|
|
34
|
+
size: { type: String, required: false, default: "md" },
|
|
35
|
+
opacity: { type: Number, required: false, default: 0.72 },
|
|
36
|
+
fullscreen: { type: Boolean, required: false, default: false }
|
|
37
|
+
},
|
|
38
|
+
setup(__props) {
|
|
39
|
+
const props = __props;
|
|
40
|
+
const slots = useSlots();
|
|
41
|
+
const wrapped = computed(() => !!slots.default);
|
|
42
|
+
const maskStyle = computed(() => ({
|
|
43
|
+
background: `rgb(255 255 255 / ${props.opacity})`
|
|
44
|
+
}));
|
|
45
|
+
const spinnerSize = computed(
|
|
46
|
+
() => props.size === "sm" ? "sm" : props.size === "lg" ? "lg" : "md"
|
|
47
|
+
);
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return wrapped.value ? (_openBlock(), _createElementBlock(
|
|
50
|
+
"div",
|
|
51
|
+
_mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
52
|
+
class: ["wd-loading wd-loading--wrapped", { "is-fullscreen": __props.fullscreen }],
|
|
53
|
+
style: maskStyle.value
|
|
54
|
+
}),
|
|
55
|
+
[
|
|
56
|
+
_renderSlot(_ctx.$slots, "default"),
|
|
57
|
+
_createCommentVNode(" :duration \u5FC5\u9700\uFF1Atransitionend \u4E22\u5931\u65F6\u5143\u7D20\u4F1A\u5361\u5728 enter-from "),
|
|
58
|
+
_createVNode(_Transition, {
|
|
59
|
+
name: "wd-loading-fade",
|
|
60
|
+
duration: 160
|
|
61
|
+
}, {
|
|
62
|
+
default: _withCtx(() => [
|
|
63
|
+
__props.loading ? (_openBlock(), _createElementBlock(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
key: 0,
|
|
67
|
+
class: _normalizeClass(["wd-loading__mask", `wd-loading__mask--${__props.size}`]),
|
|
68
|
+
style: _normalizeStyle({ transitionDelay: `${__props.delay}ms` })
|
|
69
|
+
},
|
|
70
|
+
[
|
|
71
|
+
_createElementVNode("div", _hoisted_1, [
|
|
72
|
+
_createVNode(WdSpinner_default, { size: spinnerSize.value }, null, 8, ["size"]),
|
|
73
|
+
__props.text ? (_openBlock(), _createElementBlock(
|
|
74
|
+
"span",
|
|
75
|
+
_hoisted_2,
|
|
76
|
+
_toDisplayString(__props.text),
|
|
77
|
+
1
|
|
78
|
+
/* TEXT */
|
|
79
|
+
)) : _createCommentVNode("v-if", true)
|
|
80
|
+
])
|
|
81
|
+
],
|
|
82
|
+
6
|
|
83
|
+
/* CLASS, STYLE */
|
|
84
|
+
)) : _createCommentVNode("v-if", true)
|
|
85
|
+
]),
|
|
86
|
+
_: 1
|
|
87
|
+
/* STABLE */
|
|
88
|
+
})
|
|
89
|
+
],
|
|
90
|
+
16
|
|
91
|
+
/* FULL_PROPS */
|
|
92
|
+
)) : (_openBlock(), _createBlock(_Transition, {
|
|
93
|
+
key: 1,
|
|
94
|
+
name: "wd-loading-fade",
|
|
95
|
+
duration: 160
|
|
96
|
+
}, {
|
|
97
|
+
default: _withCtx(() => [
|
|
98
|
+
__props.loading ? (_openBlock(), _createElementBlock(
|
|
99
|
+
"div",
|
|
100
|
+
_mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
101
|
+
class: ["wd-loading__mask wd-loading__mask--standalone", [`wd-loading__mask--${__props.size}`, { "is-fullscreen": __props.fullscreen }]],
|
|
102
|
+
style: [maskStyle.value, { transitionDelay: `${__props.delay}ms` }]
|
|
103
|
+
}),
|
|
104
|
+
[
|
|
105
|
+
_createElementVNode("div", _hoisted_3, [
|
|
106
|
+
_createVNode(WdSpinner_default, { size: spinnerSize.value }, null, 8, ["size"]),
|
|
107
|
+
__props.text ? (_openBlock(), _createElementBlock(
|
|
108
|
+
"span",
|
|
109
|
+
_hoisted_4,
|
|
110
|
+
_toDisplayString(__props.text),
|
|
111
|
+
1
|
|
112
|
+
/* TEXT */
|
|
113
|
+
)) : _createCommentVNode("v-if", true)
|
|
114
|
+
])
|
|
115
|
+
],
|
|
116
|
+
16
|
|
117
|
+
/* FULL_PROPS */
|
|
118
|
+
)) : _createCommentVNode("v-if", true)
|
|
119
|
+
]),
|
|
120
|
+
_: 1
|
|
121
|
+
/* STABLE */
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
export {
|
|
127
|
+
WdLoading_default as WdLoading
|
|
128
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// .lib-build/WdMarkdown.ts
|
|
2
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
+
import { normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
|
|
6
|
+
// .lib-build/markdown.ts
|
|
7
|
+
function escapeHtml(s) {
|
|
8
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
9
|
+
}
|
|
10
|
+
function inline(text) {
|
|
11
|
+
const codes = [];
|
|
12
|
+
let out = text.replace(/`([^`]+)`/g, (_, code) => {
|
|
13
|
+
codes.push(code);
|
|
14
|
+
return `\0CODE${codes.length - 1}\0`;
|
|
15
|
+
});
|
|
16
|
+
out = escapeHtml(out);
|
|
17
|
+
out = out.replace(
|
|
18
|
+
/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^&]*)")?\)/g,
|
|
19
|
+
(_, alt, src, title) => `<img src="${src}" alt="${alt}"${title ? ` title="${title}"` : ""} loading="lazy">`
|
|
20
|
+
);
|
|
21
|
+
out = out.replace(
|
|
22
|
+
/\[([^\]]+)\]\(([^)\s]+)(?:\s+"([^&]*)")?\)/g,
|
|
23
|
+
(_, label, href, title) => {
|
|
24
|
+
const external = /^https?:\/\//i.test(href);
|
|
25
|
+
const attrs = external ? ' target="_blank" rel="noopener noreferrer"' : "";
|
|
26
|
+
return `<a href="${href}"${title ? ` title="${title}"` : ""}${attrs}>${label}</a>`;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
out = out.replace(/(^|[\s(])(https?:\/\/[^\s<)]+)/g, (m, pre, url) => pre + `<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
|
|
30
|
+
out = out.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
31
|
+
out = out.replace(/__([^_]+)__/g, "<strong>$1</strong>");
|
|
32
|
+
out = out.replace(/(^|[^*])\*(\S[^*\n]*?\S|\S)\*(?=[^*]|$)/g, "$1<em>$2</em>");
|
|
33
|
+
out = out.replace(/(^|[^_])_(\S[^_\n]*?\S|\S)_(?=[^_]|$)/g, "$1<em>$2</em>");
|
|
34
|
+
out = out.replace(/~~([^~]+)~~/g, "<del>$1</del>");
|
|
35
|
+
out = out.replace(/\u0000CODE(\d+)\u0000/g, (_, i) => `<code>${escapeHtml(codes[Number(i)])}</code>`);
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function isTableSep(line) {
|
|
39
|
+
return /^\s*\|?[\s:-]*-[\s:|-]*\|?\s*$/.test(line) && line.includes("-");
|
|
40
|
+
}
|
|
41
|
+
function splitRow(line) {
|
|
42
|
+
let s = line.trim();
|
|
43
|
+
if (s.startsWith("|")) s = s.slice(1);
|
|
44
|
+
if (s.endsWith("|")) s = s.slice(0, -1);
|
|
45
|
+
return s.split("|").map((c) => c.trim());
|
|
46
|
+
}
|
|
47
|
+
function parseMarkdown(src) {
|
|
48
|
+
const lines = src.replace(/\r\n?/g, "\n").split("\n");
|
|
49
|
+
const out = [];
|
|
50
|
+
let i = 0;
|
|
51
|
+
while (i < lines.length) {
|
|
52
|
+
const line = lines[i];
|
|
53
|
+
const fence = line.match(/^\s*(```|~~~)(.*)$/);
|
|
54
|
+
if (fence) {
|
|
55
|
+
const marker = fence[1];
|
|
56
|
+
const lang = fence[2].trim();
|
|
57
|
+
const buf2 = [];
|
|
58
|
+
i++;
|
|
59
|
+
while (i < lines.length && !lines[i].trim().startsWith(marker)) {
|
|
60
|
+
buf2.push(lines[i]);
|
|
61
|
+
i++;
|
|
62
|
+
}
|
|
63
|
+
i++;
|
|
64
|
+
const cls = lang ? ` class="language-${escapeHtml(lang)}"` : "";
|
|
65
|
+
out.push(`<pre><code${cls}>${escapeHtml(buf2.join("\n"))}</code></pre>`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (/^\s*([-*_])\s*(\1\s*){2,}$/.test(line)) {
|
|
69
|
+
out.push("<hr>");
|
|
70
|
+
i++;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const h = line.match(/^(#{1,6})\s+(.*)$/);
|
|
74
|
+
if (h) {
|
|
75
|
+
const lv = h[1].length;
|
|
76
|
+
out.push(`<h${lv}>${inline(h[2].trim())}</h${lv}>`);
|
|
77
|
+
i++;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (/^\s*>/.test(line)) {
|
|
81
|
+
const buf2 = [];
|
|
82
|
+
while (i < lines.length && /^\s*>/.test(lines[i])) {
|
|
83
|
+
buf2.push(lines[i].replace(/^\s*>\s?/, ""));
|
|
84
|
+
i++;
|
|
85
|
+
}
|
|
86
|
+
out.push(`<blockquote>${parseMarkdown(buf2.join("\n"))}</blockquote>`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (line.includes("|") && i + 1 < lines.length && isTableSep(lines[i + 1])) {
|
|
90
|
+
const head = splitRow(line);
|
|
91
|
+
const aligns = splitRow(lines[i + 1]).map((c) => {
|
|
92
|
+
const l = c.startsWith(":");
|
|
93
|
+
const r = c.endsWith(":");
|
|
94
|
+
if (l && r) return "center";
|
|
95
|
+
if (r) return "right";
|
|
96
|
+
if (l) return "left";
|
|
97
|
+
return "";
|
|
98
|
+
});
|
|
99
|
+
i += 2;
|
|
100
|
+
const rows = [];
|
|
101
|
+
while (i < lines.length && lines[i].includes("|") && lines[i].trim() !== "") {
|
|
102
|
+
rows.push(splitRow(lines[i]));
|
|
103
|
+
i++;
|
|
104
|
+
}
|
|
105
|
+
const th = head.map((c, k) => `<th${aligns[k] ? ` style="text-align:${aligns[k]}"` : ""}>${inline(c)}</th>`).join("");
|
|
106
|
+
const tb = rows.map(
|
|
107
|
+
(r) => "<tr>" + head.map((_, k) => `<td${aligns[k] ? ` style="text-align:${aligns[k]}"` : ""}>${inline(r[k] ?? "")}</td>`).join("") + "</tr>"
|
|
108
|
+
).join("");
|
|
109
|
+
out.push(`<table><thead><tr>${th}</tr></thead><tbody>${tb}</tbody></table>`);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const ul = line.match(/^\s*([-*+])\s+(.*)$/);
|
|
113
|
+
const ol = line.match(/^\s*(\d+)[.)]\s+(.*)$/);
|
|
114
|
+
if (ul || ol) {
|
|
115
|
+
const ordered = !!ol;
|
|
116
|
+
const items = [];
|
|
117
|
+
const re = ordered ? /^\s*(\d+)[.)]\s+(.*)$/ : /^\s*([-*+])\s+(.*)$/;
|
|
118
|
+
while (i < lines.length) {
|
|
119
|
+
const m = lines[i].match(re);
|
|
120
|
+
if (!m) break;
|
|
121
|
+
items.push(m[2]);
|
|
122
|
+
i++;
|
|
123
|
+
}
|
|
124
|
+
const tag = ordered ? "ol" : "ul";
|
|
125
|
+
out.push(`<${tag}>` + items.map((t) => `<li>${inline(t)}</li>`).join("") + `</${tag}>`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (line.trim() === "") {
|
|
129
|
+
i++;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const buf = [];
|
|
133
|
+
while (i < lines.length) {
|
|
134
|
+
const l = lines[i];
|
|
135
|
+
if (l.trim() === "") break;
|
|
136
|
+
if (/^(#{1,6}\s|>|```|~~~)/.test(l)) break;
|
|
137
|
+
if (/^\s*([-*+]|\d+[.)])\s+/.test(l)) break;
|
|
138
|
+
if (/^\s*([-*_])\s*(\1\s*){2,}$/.test(l)) break;
|
|
139
|
+
buf.push(l);
|
|
140
|
+
i++;
|
|
141
|
+
}
|
|
142
|
+
if (buf.length) out.push(`<p>${inline(buf.join("\n")).replace(/\n/g, "<br>")}</p>`);
|
|
143
|
+
}
|
|
144
|
+
return out.join("\n");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// .lib-build/WdMarkdown.ts
|
|
148
|
+
var _hoisted_1 = ["innerHTML"];
|
|
149
|
+
var WdMarkdown_default = /* @__PURE__ */ _defineComponent({
|
|
150
|
+
...{ name: "WdMarkdown" },
|
|
151
|
+
__name: "WdMarkdown",
|
|
152
|
+
props: {
|
|
153
|
+
source: { type: String, required: false, default: "" },
|
|
154
|
+
html: { type: String, required: false, default: "" },
|
|
155
|
+
flush: { type: Boolean, required: false, default: false }
|
|
156
|
+
},
|
|
157
|
+
setup(__props) {
|
|
158
|
+
const props = __props;
|
|
159
|
+
const rendered = computed(
|
|
160
|
+
() => props.html ? props.html : parseMarkdown(props.source)
|
|
161
|
+
);
|
|
162
|
+
return (_ctx, _cache) => {
|
|
163
|
+
return _openBlock(), _createElementBlock("article", {
|
|
164
|
+
class: _normalizeClass(["wd-markdown", { "wd-markdown--flush": __props.flush }]),
|
|
165
|
+
innerHTML: rendered.value
|
|
166
|
+
}, null, 10, _hoisted_1);
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
export {
|
|
171
|
+
WdMarkdown_default as WdMarkdown
|
|
172
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// .lib-build/WdMarquee.ts
|
|
2
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
+
import { renderSlot as _renderSlot, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
+
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
|
|
5
|
+
var _hoisted_1 = { class: "wd-marquee__track" };
|
|
6
|
+
var _hoisted_2 = { class: "wd-marquee__group" };
|
|
7
|
+
var _hoisted_3 = {
|
|
8
|
+
class: "wd-marquee__group",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
};
|
|
11
|
+
var WdMarquee_default = /* @__PURE__ */ _defineComponent({
|
|
12
|
+
...{ name: "WdMarquee" },
|
|
13
|
+
__name: "WdMarquee",
|
|
14
|
+
props: {
|
|
15
|
+
direction: { type: String, required: false, default: "left" },
|
|
16
|
+
speed: { type: Number, required: false, default: 26 },
|
|
17
|
+
pauseOnHover: { type: Boolean, required: false, default: true },
|
|
18
|
+
fade: { type: Boolean, required: false, default: true },
|
|
19
|
+
gap: { type: Number, required: false, default: 24 }
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const trackRef = ref(null);
|
|
24
|
+
const reduced = ref(false);
|
|
25
|
+
let mq = null;
|
|
26
|
+
const onReduceChange = () => {
|
|
27
|
+
reduced.value = mq?.matches ?? false;
|
|
28
|
+
};
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
31
|
+
mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
32
|
+
reduced.value = mq.matches;
|
|
33
|
+
if (typeof mq.addEventListener === "function") mq.addEventListener("change", onReduceChange);
|
|
34
|
+
else mq.addListener(onReduceChange);
|
|
35
|
+
});
|
|
36
|
+
onBeforeUnmount(() => {
|
|
37
|
+
if (!mq) return;
|
|
38
|
+
if (typeof mq.removeEventListener === "function") mq.removeEventListener("change", onReduceChange);
|
|
39
|
+
else mq.removeListener(onReduceChange);
|
|
40
|
+
});
|
|
41
|
+
const styleVars = computed(() => ({
|
|
42
|
+
"--wd-marquee-dur": `${props.speed}s`,
|
|
43
|
+
"--wd-marquee-gap": `${props.gap}px`
|
|
44
|
+
}));
|
|
45
|
+
const classes = computed(() => [
|
|
46
|
+
"wd-marquee",
|
|
47
|
+
`wd-marquee--${props.direction}`,
|
|
48
|
+
{
|
|
49
|
+
"wd-marquee--fade": props.fade,
|
|
50
|
+
"wd-marquee--hover-pause": props.pauseOnHover,
|
|
51
|
+
"wd-marquee--static": reduced.value
|
|
52
|
+
}
|
|
53
|
+
]);
|
|
54
|
+
return (_ctx, _cache) => {
|
|
55
|
+
return _openBlock(), _createElementBlock(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
class: _normalizeClass(classes.value),
|
|
59
|
+
style: _normalizeStyle(styleVars.value)
|
|
60
|
+
},
|
|
61
|
+
[
|
|
62
|
+
_createElementVNode("div", _hoisted_1, [
|
|
63
|
+
_createElementVNode("div", _hoisted_2, [
|
|
64
|
+
_renderSlot(_ctx.$slots, "default")
|
|
65
|
+
]),
|
|
66
|
+
_createCommentVNode(" \u590D\u5236\u7684\u4E00\u4EFD\u53EA\u8D1F\u8D23\u89C6\u89C9\u8854\u63A5\uFF0C\u8BFB\u5C4F\u8DF3\u8FC7 "),
|
|
67
|
+
_createElementVNode("div", _hoisted_3, [
|
|
68
|
+
_renderSlot(_ctx.$slots, "default")
|
|
69
|
+
])
|
|
70
|
+
])
|
|
71
|
+
],
|
|
72
|
+
6
|
|
73
|
+
/* CLASS, STYLE */
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export {
|
|
79
|
+
WdMarquee_default as WdMarquee
|
|
80
|
+
};
|