@1337exp/taoui 5.16.2 → 5.20.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/CHANGELOG.md +69 -1
- package/MIGRATION-5.md +1 -1
- package/README.md +6 -5
- package/README.ru.md +6 -5
- package/dist/index.d.ts +45 -0
- package/dist/index.js +252 -70
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/taoui/references/components.md +5 -3
- package/src/styles/base.css +87 -81
- package/src/styles/index.css +1 -1
- package/src/styles/themes/light.css +1 -1
- package/src/styles/tokens/semantic.css +7 -0
package/dist/index.js
CHANGED
|
@@ -3652,7 +3652,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3652
3652
|
};
|
|
3653
3653
|
}
|
|
3654
3654
|
});
|
|
3655
|
-
const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-
|
|
3655
|
+
const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-5899337f"]]);
|
|
3656
3656
|
const _hoisted_1$N = {
|
|
3657
3657
|
key: 0,
|
|
3658
3658
|
class: "tao-fieldset__legend"
|
|
@@ -4138,6 +4138,33 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
4138
4138
|
};
|
|
4139
4139
|
}
|
|
4140
4140
|
});
|
|
4141
|
+
function fileMatchesAccept(file, accept) {
|
|
4142
|
+
const tokens = accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean);
|
|
4143
|
+
if (!tokens.length || tokens.includes("*") || tokens.includes("*/*")) {
|
|
4144
|
+
return true;
|
|
4145
|
+
}
|
|
4146
|
+
const name = file.name.toLowerCase();
|
|
4147
|
+
const mime = (file.type || "").toLowerCase();
|
|
4148
|
+
const dot2 = name.lastIndexOf(".");
|
|
4149
|
+
const ext = dot2 >= 0 ? name.slice(dot2) : "";
|
|
4150
|
+
return tokens.some((token) => {
|
|
4151
|
+
if (token.startsWith(".")) {
|
|
4152
|
+
return ext === token;
|
|
4153
|
+
}
|
|
4154
|
+
if (token.endsWith("/*")) {
|
|
4155
|
+
return mime.startsWith(token.slice(0, -1));
|
|
4156
|
+
}
|
|
4157
|
+
return mime === token;
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
function partitionByAccept(files, accept) {
|
|
4161
|
+
const accepted = [];
|
|
4162
|
+
const rejected = [];
|
|
4163
|
+
for (const file of files) {
|
|
4164
|
+
(fileMatchesAccept(file, accept) ? accepted : rejected).push(file);
|
|
4165
|
+
}
|
|
4166
|
+
return { accepted, rejected };
|
|
4167
|
+
}
|
|
4141
4168
|
const _hoisted_1$J = { class: "tao-file-drop__row" };
|
|
4142
4169
|
const _hoisted_2$D = ["aria-label"];
|
|
4143
4170
|
const _hoisted_3$y = { "aria-hidden": "true" };
|
|
@@ -4164,7 +4191,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4164
4191
|
formatSize: {},
|
|
4165
4192
|
list: { type: Boolean, default: true }
|
|
4166
4193
|
},
|
|
4167
|
-
emits: ["update:modelValue", "change", "clear-request"],
|
|
4194
|
+
emits: ["update:modelValue", "change", "reject", "clear-request"],
|
|
4168
4195
|
setup(__props, { emit: __emit }) {
|
|
4169
4196
|
const { rootAttrs, controlAttrs } = useControlAttrs();
|
|
4170
4197
|
const appLocale = useTaoLocale();
|
|
@@ -4176,28 +4203,6 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4176
4203
|
function sameFile(a, b) {
|
|
4177
4204
|
return a.name === b.name && a.size === b.size && a.lastModified === b.lastModified;
|
|
4178
4205
|
}
|
|
4179
|
-
function acceptTokens(accept) {
|
|
4180
|
-
return accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean);
|
|
4181
|
-
}
|
|
4182
|
-
function fileMatchesAccept(file, accept) {
|
|
4183
|
-
const tokens = acceptTokens(accept);
|
|
4184
|
-
if (!tokens.length || tokens.includes("*") || tokens.includes("*/*")) {
|
|
4185
|
-
return true;
|
|
4186
|
-
}
|
|
4187
|
-
const name = file.name.toLowerCase();
|
|
4188
|
-
const mime = (file.type || "").toLowerCase();
|
|
4189
|
-
const dot2 = name.lastIndexOf(".");
|
|
4190
|
-
const ext = dot2 >= 0 ? name.slice(dot2) : "";
|
|
4191
|
-
return tokens.some((token) => {
|
|
4192
|
-
if (token.startsWith(".")) {
|
|
4193
|
-
return ext === token;
|
|
4194
|
-
}
|
|
4195
|
-
if (token.endsWith("/*")) {
|
|
4196
|
-
return mime.startsWith(token.slice(0, -1));
|
|
4197
|
-
}
|
|
4198
|
-
return mime === token;
|
|
4199
|
-
});
|
|
4200
|
-
}
|
|
4201
4206
|
function commit(files) {
|
|
4202
4207
|
emit("update:modelValue", files);
|
|
4203
4208
|
emit("change", files);
|
|
@@ -4237,7 +4242,10 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4237
4242
|
}
|
|
4238
4243
|
}
|
|
4239
4244
|
function processFiles(fileList) {
|
|
4240
|
-
const incoming = Array.from(fileList)
|
|
4245
|
+
const { accepted: incoming, rejected } = partitionByAccept(Array.from(fileList), props.accept);
|
|
4246
|
+
if (rejected.length) {
|
|
4247
|
+
emit("reject", rejected);
|
|
4248
|
+
}
|
|
4241
4249
|
if (!incoming.length) {
|
|
4242
4250
|
resetInput();
|
|
4243
4251
|
return;
|
|
@@ -4350,7 +4358,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4350
4358
|
};
|
|
4351
4359
|
}
|
|
4352
4360
|
});
|
|
4353
|
-
const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-
|
|
4361
|
+
const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-093403e5"]]);
|
|
4354
4362
|
function isMenuSelectable(item) {
|
|
4355
4363
|
return item.type !== "separator" && item.type !== "label" && !item.disabled;
|
|
4356
4364
|
}
|
|
@@ -6079,26 +6087,31 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6079
6087
|
const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-31b1af76"]]);
|
|
6080
6088
|
function visibleRows(nodes, expanded, children) {
|
|
6081
6089
|
const rows = [];
|
|
6090
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
6082
6091
|
const walk = (list, level, parentId) => {
|
|
6083
6092
|
list.forEach((node, index) => {
|
|
6084
|
-
const
|
|
6085
|
-
const
|
|
6093
|
+
const repeated = ancestors.has(node.id);
|
|
6094
|
+
const own = repeated ? void 0 : children(node);
|
|
6095
|
+
const branch = !repeated && (Boolean(own?.length) || Boolean(node.hasChildren) && own === void 0);
|
|
6086
6096
|
const open = branch && expanded.has(node.id);
|
|
6087
6097
|
rows.push({ node, level, parentId, posinset: index + 1, setsize: list.length, branch, expanded: open });
|
|
6088
6098
|
if (open && own) {
|
|
6099
|
+
ancestors.add(node.id);
|
|
6089
6100
|
walk(own, level + 1, node.id);
|
|
6101
|
+
ancestors.delete(node.id);
|
|
6090
6102
|
}
|
|
6091
6103
|
});
|
|
6092
6104
|
};
|
|
6093
6105
|
walk(nodes, 1, null);
|
|
6094
6106
|
return rows;
|
|
6095
6107
|
}
|
|
6096
|
-
function checkUnits(node, children) {
|
|
6097
|
-
const own = children(node);
|
|
6108
|
+
function checkUnits(node, children, ancestors = /* @__PURE__ */ new Set()) {
|
|
6109
|
+
const own = ancestors.has(node.id) ? void 0 : children(node);
|
|
6098
6110
|
if (!own?.length) {
|
|
6099
6111
|
return node.disabled ? [] : [node.id];
|
|
6100
6112
|
}
|
|
6101
|
-
|
|
6113
|
+
const path = new Set(ancestors).add(node.id);
|
|
6114
|
+
return own.flatMap((child) => checkUnits(child, children, path));
|
|
6102
6115
|
}
|
|
6103
6116
|
function checkState(node, checked2, children) {
|
|
6104
6117
|
const units = checkUnits(node, children);
|
|
@@ -10643,6 +10656,27 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
10643
10656
|
}
|
|
10644
10657
|
});
|
|
10645
10658
|
const TaoSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bcd8d820"]]);
|
|
10659
|
+
const SHEET_DISMISS_RATIO = 0.3;
|
|
10660
|
+
const SHEET_FLING_SPEED = 0.5;
|
|
10661
|
+
const SHEET_FLING_MIN = 24;
|
|
10662
|
+
function sheetOffset(delta) {
|
|
10663
|
+
return Math.max(0, delta);
|
|
10664
|
+
}
|
|
10665
|
+
function releaseVelocity(samples, windowMs = 100) {
|
|
10666
|
+
const last = samples[samples.length - 1];
|
|
10667
|
+
if (!last) {
|
|
10668
|
+
return 0;
|
|
10669
|
+
}
|
|
10670
|
+
const first = samples.find((sample) => last.t - sample.t <= windowMs) ?? last;
|
|
10671
|
+
const dt = last.t - first.t;
|
|
10672
|
+
return dt > 0 ? (last.y - first.y) / dt : 0;
|
|
10673
|
+
}
|
|
10674
|
+
function shouldDismissSheet(offset, height, velocity) {
|
|
10675
|
+
if (offset <= 0 || height <= 0) {
|
|
10676
|
+
return false;
|
|
10677
|
+
}
|
|
10678
|
+
return offset >= height * SHEET_DISMISS_RATIO || velocity >= SHEET_FLING_SPEED && offset >= SHEET_FLING_MIN;
|
|
10679
|
+
}
|
|
10646
10680
|
const _hoisted_1$8 = ["aria-labelledby"];
|
|
10647
10681
|
const _hoisted_2$7 = {
|
|
10648
10682
|
key: 0,
|
|
@@ -10662,6 +10696,8 @@ const _hoisted_9$1 = {
|
|
|
10662
10696
|
key: 2,
|
|
10663
10697
|
class: "tao-drawer__footer"
|
|
10664
10698
|
};
|
|
10699
|
+
const SWIPE_FROM = ".tao-drawer__grip, .tao-drawer__header";
|
|
10700
|
+
const SWIPE_NOT_FROM = 'button, a, input, select, textarea, label, [role="button"], [contenteditable]';
|
|
10665
10701
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
10666
10702
|
...{ name: "TaoDrawer", inheritAttrs: false },
|
|
10667
10703
|
__name: "TaoDrawer",
|
|
@@ -10671,6 +10707,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10671
10707
|
side: { default: "right" },
|
|
10672
10708
|
surface: { default: "flat" },
|
|
10673
10709
|
closable: { type: Boolean, default: true },
|
|
10710
|
+
showClose: { type: Boolean, default: true },
|
|
10711
|
+
swipeToClose: { type: Boolean, default: true },
|
|
10674
10712
|
closeLabel: {}
|
|
10675
10713
|
},
|
|
10676
10714
|
emits: ["update:modelValue", "close"],
|
|
@@ -10679,7 +10717,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10679
10717
|
const l10n = useLocaleText(props, "drawer");
|
|
10680
10718
|
const emit = __emit;
|
|
10681
10719
|
const panelRef = ref(null);
|
|
10720
|
+
const rootRef = ref(null);
|
|
10682
10721
|
const titleId = useId();
|
|
10722
|
+
const showCloseButton = computed(() => props.closable && props.showClose);
|
|
10683
10723
|
function close() {
|
|
10684
10724
|
if (!props.closable) {
|
|
10685
10725
|
return;
|
|
@@ -10687,6 +10727,86 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10687
10727
|
emit("update:modelValue", false);
|
|
10688
10728
|
emit("close");
|
|
10689
10729
|
}
|
|
10730
|
+
const swipeable = computed(() => props.side === "bottom" && props.swipeToClose && props.closable);
|
|
10731
|
+
let drag = null;
|
|
10732
|
+
const reducedMotion = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
10733
|
+
function setSheet(offset, animate) {
|
|
10734
|
+
const panel = panelRef.value;
|
|
10735
|
+
if (!panel) {
|
|
10736
|
+
return;
|
|
10737
|
+
}
|
|
10738
|
+
panel.style.transition = animate && !reducedMotion() ? "transform var(--tao-duration-base) var(--tao-ease-base)" : "none";
|
|
10739
|
+
panel.style.transform = offset === null ? "" : `translateY(${offset}px)`;
|
|
10740
|
+
const height = panel.offsetHeight;
|
|
10741
|
+
rootRef.value?.style.setProperty("--_sheet-progress", offset && height ? String(Math.min(1, offset / height)) : "0");
|
|
10742
|
+
}
|
|
10743
|
+
function settleSheet() {
|
|
10744
|
+
setSheet(null, true);
|
|
10745
|
+
window.setTimeout(() => {
|
|
10746
|
+
if (panelRef.value && !drag) {
|
|
10747
|
+
panelRef.value.style.transition = "";
|
|
10748
|
+
}
|
|
10749
|
+
}, 250);
|
|
10750
|
+
}
|
|
10751
|
+
function capture(pointerId, on) {
|
|
10752
|
+
try {
|
|
10753
|
+
if (on) {
|
|
10754
|
+
panelRef.value?.setPointerCapture?.(pointerId);
|
|
10755
|
+
} else {
|
|
10756
|
+
panelRef.value?.releasePointerCapture?.(pointerId);
|
|
10757
|
+
}
|
|
10758
|
+
} catch {
|
|
10759
|
+
}
|
|
10760
|
+
}
|
|
10761
|
+
function onPointerDown(event) {
|
|
10762
|
+
if (!swipeable.value || drag || !event.isPrimary || event.pointerType === "mouse" && event.button !== 0) {
|
|
10763
|
+
return;
|
|
10764
|
+
}
|
|
10765
|
+
const target = event.target;
|
|
10766
|
+
if (!target?.closest(SWIPE_FROM) || target.closest(SWIPE_NOT_FROM)) {
|
|
10767
|
+
return;
|
|
10768
|
+
}
|
|
10769
|
+
drag = { pointerId: event.pointerId, startY: event.clientY, moved: false, offset: 0, samples: [{ t: event.timeStamp, y: event.clientY }] };
|
|
10770
|
+
capture(event.pointerId, true);
|
|
10771
|
+
}
|
|
10772
|
+
function onPointerMove(event) {
|
|
10773
|
+
if (!drag || event.pointerId !== drag.pointerId) {
|
|
10774
|
+
return;
|
|
10775
|
+
}
|
|
10776
|
+
const delta = event.clientY - drag.startY;
|
|
10777
|
+
if (!drag.moved && Math.abs(delta) < 4) {
|
|
10778
|
+
return;
|
|
10779
|
+
}
|
|
10780
|
+
drag.moved = true;
|
|
10781
|
+
drag.offset = sheetOffset(delta);
|
|
10782
|
+
drag.samples.push({ t: event.timeStamp, y: event.clientY });
|
|
10783
|
+
if (drag.samples.length > 8) {
|
|
10784
|
+
drag.samples.shift();
|
|
10785
|
+
}
|
|
10786
|
+
setSheet(drag.offset, false);
|
|
10787
|
+
}
|
|
10788
|
+
async function onPointerEnd(event) {
|
|
10789
|
+
const current2 = drag;
|
|
10790
|
+
if (!current2 || event.pointerId !== current2.pointerId) {
|
|
10791
|
+
return;
|
|
10792
|
+
}
|
|
10793
|
+
drag = null;
|
|
10794
|
+
capture(event.pointerId, false);
|
|
10795
|
+
if (!current2.moved) {
|
|
10796
|
+
return;
|
|
10797
|
+
}
|
|
10798
|
+
const height = panelRef.value?.offsetHeight ?? 0;
|
|
10799
|
+
if (event.type === "pointerup" && shouldDismissSheet(current2.offset, height, releaseVelocity(current2.samples))) {
|
|
10800
|
+
setSheet(height, true);
|
|
10801
|
+
close();
|
|
10802
|
+
await nextTick();
|
|
10803
|
+
if (props.modelValue) {
|
|
10804
|
+
settleSheet();
|
|
10805
|
+
}
|
|
10806
|
+
} else {
|
|
10807
|
+
settleSheet();
|
|
10808
|
+
}
|
|
10809
|
+
}
|
|
10690
10810
|
async function focusPanel() {
|
|
10691
10811
|
await nextTick();
|
|
10692
10812
|
const panel = panelRef.value;
|
|
@@ -10719,6 +10839,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10719
10839
|
default: withCtx(() => [
|
|
10720
10840
|
__props.modelValue ? (openBlock(), createElementBlock("div", {
|
|
10721
10841
|
key: 0,
|
|
10842
|
+
ref_key: "rootRef",
|
|
10843
|
+
ref: rootRef,
|
|
10722
10844
|
class: normalizeClass(["tao-drawer", `tao-drawer--${__props.side}`]),
|
|
10723
10845
|
onKeydown: onKeydown2
|
|
10724
10846
|
}, [
|
|
@@ -10733,28 +10855,34 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10733
10855
|
role: "dialog",
|
|
10734
10856
|
"aria-modal": "true",
|
|
10735
10857
|
"aria-labelledby": __props.title ? unref(titleId) : void 0,
|
|
10736
|
-
tabindex: "-1"
|
|
10858
|
+
tabindex: "-1",
|
|
10859
|
+
onPointerdown: onPointerDown,
|
|
10860
|
+
onPointermove: onPointerMove,
|
|
10861
|
+
onPointerup: onPointerEnd,
|
|
10862
|
+
onPointercancel: onPointerEnd
|
|
10737
10863
|
}), [
|
|
10738
10864
|
__props.side === "bottom" ? (openBlock(), createElementBlock("span", _hoisted_2$7)) : createCommentVNode("", true),
|
|
10739
|
-
__props.title ||
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10865
|
+
_ctx.$slots.header || __props.title || showCloseButton.value ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
|
|
10866
|
+
renderSlot(_ctx.$slots, "header", { close }, () => [
|
|
10867
|
+
__props.title ? (openBlock(), createElementBlock("h2", {
|
|
10868
|
+
key: 0,
|
|
10869
|
+
id: unref(titleId),
|
|
10870
|
+
class: "tao-drawer__title"
|
|
10871
|
+
}, toDisplayString(__props.title), 9, _hoisted_4$6)) : (openBlock(), createElementBlock("span", _hoisted_5$5)),
|
|
10872
|
+
showCloseButton.value ? (openBlock(), createElementBlock("button", {
|
|
10873
|
+
key: 2,
|
|
10874
|
+
type: "button",
|
|
10875
|
+
class: "tao-drawer__close",
|
|
10876
|
+
"aria-label": unref(l10n).closeLabel,
|
|
10877
|
+
onClick: close
|
|
10878
|
+
}, [
|
|
10879
|
+
createElementVNode("span", _hoisted_7$2, [
|
|
10880
|
+
renderSlot(_ctx.$slots, "close-icon", {}, () => [
|
|
10881
|
+
createVNode(TaoIcon, { name: "tao-close" })
|
|
10882
|
+
], true)
|
|
10883
|
+
])
|
|
10884
|
+
], 8, _hoisted_6$3)) : createCommentVNode("", true)
|
|
10885
|
+
], true)
|
|
10758
10886
|
])) : createCommentVNode("", true),
|
|
10759
10887
|
createElementVNode("div", _hoisted_8$1, [
|
|
10760
10888
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
@@ -10771,7 +10899,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
10771
10899
|
};
|
|
10772
10900
|
}
|
|
10773
10901
|
});
|
|
10774
|
-
const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
10902
|
+
const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-11b7fda2"]]);
|
|
10775
10903
|
const _hoisted_1$7 = ["title"];
|
|
10776
10904
|
const _hoisted_2$6 = { class: "tao-avatar__face" };
|
|
10777
10905
|
const _hoisted_3$5 = ["src", "alt"];
|
|
@@ -10947,6 +11075,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
10947
11075
|
}
|
|
10948
11076
|
});
|
|
10949
11077
|
const TaoBreadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b853fbd5"]]);
|
|
11078
|
+
function rollRanks(previous, next) {
|
|
11079
|
+
if (!previous) {
|
|
11080
|
+
return next.map(() => 0);
|
|
11081
|
+
}
|
|
11082
|
+
const ranks = next.map(() => 0);
|
|
11083
|
+
let rank = 0;
|
|
11084
|
+
for (let offset = 1; offset <= next.length; offset += 1) {
|
|
11085
|
+
const index = next.length - offset;
|
|
11086
|
+
if (previous[previous.length - offset] !== next[index]) {
|
|
11087
|
+
ranks[index] = rank;
|
|
11088
|
+
rank += 1;
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
return ranks;
|
|
11092
|
+
}
|
|
11093
|
+
function createRollGate(onIdle) {
|
|
11094
|
+
let rolling = 0;
|
|
11095
|
+
return {
|
|
11096
|
+
get busy() {
|
|
11097
|
+
return rolling > 0;
|
|
11098
|
+
},
|
|
11099
|
+
start() {
|
|
11100
|
+
rolling += 1;
|
|
11101
|
+
},
|
|
11102
|
+
end() {
|
|
11103
|
+
rolling = Math.max(0, rolling - 1);
|
|
11104
|
+
if (rolling === 0) {
|
|
11105
|
+
onIdle();
|
|
11106
|
+
}
|
|
11107
|
+
}
|
|
11108
|
+
};
|
|
11109
|
+
}
|
|
10950
11110
|
const _hoisted_1$5 = ["aria-label"];
|
|
10951
11111
|
const _hoisted_2$4 = {
|
|
10952
11112
|
class: "tao-counter__row",
|
|
@@ -10961,22 +11121,32 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
10961
11121
|
},
|
|
10962
11122
|
setup(__props) {
|
|
10963
11123
|
const props = __props;
|
|
11124
|
+
const shown = ref(props.value);
|
|
11125
|
+
function catchUp() {
|
|
11126
|
+
if (!gate.busy && shown.value !== props.value) {
|
|
11127
|
+
shown.value = props.value;
|
|
11128
|
+
}
|
|
11129
|
+
}
|
|
11130
|
+
const gate = createRollGate(catchUp);
|
|
11131
|
+
watch(() => props.value, catchUp);
|
|
10964
11132
|
function formatDigits(num, minDigits) {
|
|
10965
11133
|
const abs = Math.abs(Math.trunc(num));
|
|
10966
11134
|
return abs.toString().padStart(Math.max(1, minDigits), "0").replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
10967
11135
|
}
|
|
10968
|
-
const
|
|
10969
|
-
|
|
10970
|
-
const
|
|
11136
|
+
const isDigit = (slot) => /\d/.test(slot.value);
|
|
11137
|
+
const slots = computed((previous) => {
|
|
11138
|
+
const formatted = formatDigits(shown.value, props.maxDigits);
|
|
11139
|
+
const significant = Math.abs(Math.trunc(shown.value)).toString();
|
|
10971
11140
|
const leadingZeros = Math.max(0, props.maxDigits - significant.length);
|
|
10972
11141
|
const result = [];
|
|
10973
11142
|
let digitCount = 0;
|
|
10974
|
-
if (
|
|
11143
|
+
if (shown.value < 0) {
|
|
10975
11144
|
result.push({
|
|
10976
11145
|
value: "−",
|
|
10977
11146
|
isSpace: false,
|
|
10978
11147
|
isLeadingZero: false,
|
|
10979
|
-
key: "sign"
|
|
11148
|
+
key: "sign",
|
|
11149
|
+
rank: 0
|
|
10980
11150
|
});
|
|
10981
11151
|
}
|
|
10982
11152
|
for (let index = 0; index < formatted.length; index += 1) {
|
|
@@ -10986,7 +11156,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
10986
11156
|
value: " ",
|
|
10987
11157
|
isSpace: true,
|
|
10988
11158
|
isLeadingZero: false,
|
|
10989
|
-
key: `space-${index}
|
|
11159
|
+
key: `space-${index}`,
|
|
11160
|
+
rank: 0
|
|
10990
11161
|
});
|
|
10991
11162
|
continue;
|
|
10992
11163
|
}
|
|
@@ -10994,10 +11165,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
10994
11165
|
value: char,
|
|
10995
11166
|
isSpace: false,
|
|
10996
11167
|
isLeadingZero: digitCount < leadingZeros,
|
|
10997
|
-
key: `${index}-${char}
|
|
11168
|
+
key: `${index}-${char}`,
|
|
11169
|
+
rank: 0
|
|
10998
11170
|
});
|
|
10999
11171
|
digitCount += 1;
|
|
11000
11172
|
}
|
|
11173
|
+
const digits = result.filter(isDigit);
|
|
11174
|
+
const ranks = rollRanks(previous?.filter(isDigit).map((slot) => slot.value), digits.map((slot) => slot.value));
|
|
11175
|
+
digits.forEach((slot, index) => {
|
|
11176
|
+
slot.rank = ranks[index] ?? 0;
|
|
11177
|
+
});
|
|
11001
11178
|
return result;
|
|
11002
11179
|
});
|
|
11003
11180
|
return (_ctx, _cache) => {
|
|
@@ -11010,9 +11187,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
11010
11187
|
(openBlock(true), createElementBlock(Fragment, null, renderList(slots.value, (slot, index) => {
|
|
11011
11188
|
return openBlock(), createElementBlock("div", {
|
|
11012
11189
|
key: `${index}-${slot.isSpace ? "gap" : "d"}`,
|
|
11013
|
-
class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }])
|
|
11190
|
+
class: normalizeClass(["tao-counter__slot", { "tao-counter__slot--space": slot.isSpace }]),
|
|
11191
|
+
style: normalizeStyle({ "--_rank": slot.rank })
|
|
11014
11192
|
}, [
|
|
11015
|
-
createVNode(TransitionGroup, {
|
|
11193
|
+
createVNode(TransitionGroup, {
|
|
11194
|
+
name: "tao-digit",
|
|
11195
|
+
onBeforeEnter: _cache[0] || (_cache[0] = ($event) => unref(gate).start()),
|
|
11196
|
+
onAfterEnter: _cache[1] || (_cache[1] = ($event) => unref(gate).end()),
|
|
11197
|
+
onEnterCancelled: _cache[2] || (_cache[2] = ($event) => unref(gate).end()),
|
|
11198
|
+
onBeforeLeave: _cache[3] || (_cache[3] = ($event) => unref(gate).start()),
|
|
11199
|
+
onAfterLeave: _cache[4] || (_cache[4] = ($event) => unref(gate).end()),
|
|
11200
|
+
onLeaveCancelled: _cache[5] || (_cache[5] = ($event) => unref(gate).end())
|
|
11201
|
+
}, {
|
|
11016
11202
|
default: withCtx(() => [
|
|
11017
11203
|
!slot.isSpace ? (openBlock(), createElementBlock("span", {
|
|
11018
11204
|
key: slot.key,
|
|
@@ -11021,14 +11207,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
11021
11207
|
]),
|
|
11022
11208
|
_: 2
|
|
11023
11209
|
}, 1024)
|
|
11024
|
-
],
|
|
11210
|
+
], 6);
|
|
11025
11211
|
}), 128))
|
|
11026
11212
|
])
|
|
11027
11213
|
], 8, _hoisted_1$5);
|
|
11028
11214
|
};
|
|
11029
11215
|
}
|
|
11030
11216
|
});
|
|
11031
|
-
const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
11217
|
+
const TaoCounter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-0607352a"]]);
|
|
11032
11218
|
const GLIDE_TIME = 325;
|
|
11033
11219
|
const FLICK_SPEED = 0.3;
|
|
11034
11220
|
function glideTarget(from, velocity, pitch, max) {
|
|
@@ -11275,7 +11461,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
11275
11461
|
samples.shift();
|
|
11276
11462
|
}
|
|
11277
11463
|
}
|
|
11278
|
-
function
|
|
11464
|
+
function releaseVelocity2() {
|
|
11279
11465
|
const first = samples[0];
|
|
11280
11466
|
const last = samples[samples.length - 1];
|
|
11281
11467
|
if (!first || !last || last.t === first.t || performance.now() - last.t > 80) {
|
|
@@ -11356,7 +11542,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
11356
11542
|
dragMoved = 0;
|
|
11357
11543
|
}
|
|
11358
11544
|
const el = track.value;
|
|
11359
|
-
const velocity =
|
|
11545
|
+
const velocity = releaseVelocity2();
|
|
11360
11546
|
samples = [];
|
|
11361
11547
|
if (el) {
|
|
11362
11548
|
glideTo(glideTarget$1(el.scrollLeft, velocity), velocity);
|
|
@@ -11808,10 +11994,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
11808
11994
|
onMouseenter: pause,
|
|
11809
11995
|
onMouseleave: resume
|
|
11810
11996
|
}, [
|
|
11811
|
-
_cache[0] || (_cache[0] = createElementVNode("span", {
|
|
11812
|
-
class: "tao-toast__accent",
|
|
11813
|
-
"aria-hidden": "true"
|
|
11814
|
-
}, null, -1)),
|
|
11815
11997
|
hasIcon.value ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
|
|
11816
11998
|
__props.toast.loading ? (openBlock(), createElementBlock("span", _hoisted_3$1)) : __props.toast.icon ? (openBlock(), createBlock(TaoIcon, {
|
|
11817
11999
|
key: 1,
|
|
@@ -11874,7 +12056,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
11874
12056
|
};
|
|
11875
12057
|
}
|
|
11876
12058
|
});
|
|
11877
|
-
const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
12059
|
+
const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-02a16910"]]);
|
|
11878
12060
|
const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
|
|
11879
12061
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
11880
12062
|
...{ name: "TaoToastViewport" },
|