@1337exp/taoui 5.32.2 → 5.34.1
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 +18 -0
- package/README.md +3 -1
- package/README.ru.md +3 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +142 -13
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/taoui/references/components.md +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.34.1
|
|
4
|
+
|
|
5
|
+
Nothing to migrate; a fix.
|
|
6
|
+
|
|
7
|
+
- **`TaoCarousel` `centered` + `loop`: no flicker at the seam.** When the strip stopped on a copy (going from the last slide to the first, or back) it jumped to the real set in `scrollend`, and the scale and the fade of the slides (`--tao-carousel-d`) were rewritten only by the `scroll` event of that jump, which comes a frame later; that one frame drew the slides in their new places with the old look, a flash. The distances are written in the same frame as the jump now.
|
|
8
|
+
|
|
9
|
+
## 5.34.0
|
|
10
|
+
|
|
11
|
+
Nothing to migrate for a plain `loop`. `centered` with `loop` changes: it was a rewind to the first slide, it is a cycle now.
|
|
12
|
+
|
|
13
|
+
- **`TaoCarousel` `centered` + `loop`: a cycle with no end.** At the ends of a centered strip there was an empty place; now the slides from the other end stand in it. Forward from the last slide is the first one, back from the first is the last, with no rewind, for the arrows, the keys, a swipe and a drag, the autoplay and the model; a dot goes to the nearest copy of its slide, so the shortest way. The slides are drawn three times (more when there are few of them, so the frame is never empty): the middle set is the real one, the others are `inert` and `aria-hidden` and marked `data-tao-carousel-copy`, and a slide should not hold an `id` or a `ref`. Whenever the strip stops in a copy it jumps by whole sets back to the real one, which looks the same. The dots, `v-model` and the `change` event count only the real slides. The copies are drawn after the mount (the server draws the slides once, so hydration has nothing to differ in). A plain `loop` is a rewind as before.
|
|
14
|
+
|
|
15
|
+
## 5.33.0
|
|
16
|
+
|
|
17
|
+
Nothing to migrate: `centered` is off by default, and a carousel without it works as before.
|
|
18
|
+
|
|
19
|
+
- **`TaoCarousel` `centered`: the current slide in the middle.** The strip the shop and gallery pages use: the current slide stands in the middle and is the biggest, the ones beside it are smaller, the outer ones fade and are cut by the edge of the strip, the arrows hang over its edges. `perView` is how many whole slides are in the frame, `peek` is how much of the outer ones shows on each side, and a step (the arrows, the keys, the autoplay) is one slide, the dots count every slide. The strip is still a scroll-snap strip, so the swipe, the mouse drag, the wheel and `loop` work as in the other modes; the first and the last slide can stand in the middle (two spacers), and a change of the width keeps the current one there. The script writes only one number to each slide, `--tao-carousel-d` (its distance from the middle, 0 … 2 slides), and the CSS turns it into `scale` and `opacity`, so the look is restyled with `--tao-carousel-scale-step` (0.09), `--tao-carousel-fade` (0.55) and `--tao-carousel-ring` (the ring around an arrow, the page background by default). The width of a slide is measured by its layout width (the drawn one is scaled).
|
|
20
|
+
|
|
3
21
|
## 5.32.2
|
|
4
22
|
|
|
5
23
|
Nothing to migrate; a fix.
|
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
- **TaoTimeline** — a vertical feed of events: order steps, releases, a log. `active` fills the line up to the current event (`aria-current="step"`), without it the feed is a log of the past; `tone` and `icon` per marker, `#marker` / `#title` / `#content` slots; `align="alternate"` puts events on both sides and folds into one below 480px of its own width
|
|
121
121
|
- **TaoSkeleton** — loading placeholder (text / title / circle / rect)
|
|
122
122
|
- **TaoCounter** — flipping digits (not an input)
|
|
123
|
-
- **TaoCarousel** — strip: full slide with `autoplay`, card with `peek`, row with `per-view
|
|
123
|
+
- **TaoCarousel** — strip: full slide with `autoplay`, card with `peek`, row with `per-view`, or `centered` (the current slide in the middle and the biggest, the neighbours smaller, the outer ones faded; with `loop` a seamless cycle with no end). Arrows via `controls` or `#prev` / `#next`; marks under the strip via `indicator` (`dots`, `bars` or `progress`). With `autoplay` the current mark fills over the interval and the slide changes when it is full; hover, keyboard focus, touch, a hidden tab and the pause button stop it, `prefers-reduced-motion` turns it off
|
|
124
124
|
- **TaoAvatar** — photo or initials, sizes `small` / `medium` / `large`. Status `dot` and `count`
|
|
125
125
|
- **TaoTag** — badge with tones. `#prefix` (avatar), `closable` dismisses the chip, `flat` drops the border
|
|
126
126
|
- **TaoAlert** — inline page/form banner (success / error / warning / info); `collapsible` folds the body under the title (find-in-page still finds it)
|
|
@@ -617,6 +617,8 @@ The `cell-<key>` slot replaces a cell. `loading` shows an overlay; an empty list
|
|
|
617
617
|
</article>
|
|
618
618
|
</TaoCarousel>
|
|
619
619
|
<TaoCarousel :peek="72" :controls="false" indicator="dots">…</TaoCarousel>
|
|
620
|
+
<TaoCarousel v-model="slide" centered :per-view="3" :peek="40" indicator="dots">…</TaoCarousel>
|
|
621
|
+
<TaoCarousel v-model="slide" centered loop :per-view="3" :peek="40" indicator="dots">…</TaoCarousel>
|
|
620
622
|
<TaoCarousel v-model="slide" :per-view="5" :peek="28">
|
|
621
623
|
<template #prev></template>
|
|
622
624
|
<template #next="{ go, disabled }">
|
package/README.ru.md
CHANGED
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
- **TaoTimeline** — вертикальная лента событий: шаги заказа, релизы, журнал. `active` заливает линию до текущего события (`aria-current="step"`), без него лента — журнал прошедшего; `tone` и `icon` у маркера, слоты `#marker` / `#title` / `#content`; `align="alternate"` раскладывает события по обе стороны и складывается в одну уже 480px своей ширины
|
|
121
121
|
- **TaoSkeleton** — плейсхолдер загрузки (text / title / circle / rect)
|
|
122
122
|
- **TaoCounter** — витрина числа с переворотом цифр (не инпут)
|
|
123
|
-
- **TaoCarousel** — лента: целый слайд с `autoplay`, карточка с `peek`, полоса с `per-view
|
|
123
|
+
- **TaoCarousel** — лента: целый слайд с `autoplay`, карточка с `peek`, полоса с `per-view` или `centered` (текущий слайд по центру и крупнее всех, соседние меньше, дальние бледнее; с `loop` — бесшовный цикл без конца). Стрелки через `controls` или `#prev` / `#next`; метки под лентой — `indicator` (`dots`, `bars` или `progress`). С `autoplay` текущая метка заполняется за интервал, по заполнении слайд меняется; hover, фокус с клавиатуры, касание, скрытая вкладка и кнопка паузы останавливают, `prefers-reduced-motion` выключает
|
|
124
124
|
- **TaoAvatar** — фото или инициалы, размеры `small` / `medium` / `large`. Точка `dot` и счётчик `count`
|
|
125
125
|
- **TaoTag** — тег/бейдж со статусами. `#prefix` (аватар), `closable` убирает чип, `flat` — без рамки
|
|
126
126
|
- **TaoAlert** — инлайн-баннер страницы или ошибки формы (success / error / warning / info); `collapsible` сворачивает тело под заголовок (поиск по странице его всё равно находит)
|
|
@@ -617,6 +617,8 @@ const columns = [
|
|
|
617
617
|
</article>
|
|
618
618
|
</TaoCarousel>
|
|
619
619
|
<TaoCarousel :peek="72" :controls="false" indicator="dots">…</TaoCarousel>
|
|
620
|
+
<TaoCarousel v-model="slide" centered :per-view="3" :peek="40" indicator="dots">…</TaoCarousel>
|
|
621
|
+
<TaoCarousel v-model="slide" centered loop :per-view="3" :peek="40" indicator="dots">…</TaoCarousel>
|
|
620
622
|
<TaoCarousel v-model="slide" :per-view="5" :peek="28">
|
|
621
623
|
<template #prev></template>
|
|
622
624
|
<template #next="{ go, disabled }">
|
package/dist/index.d.ts
CHANGED
|
@@ -3133,8 +3133,15 @@ swipeThreshold: number;
|
|
|
3133
3133
|
declare const __VLS_component_69: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_76<__VLS_TypePropsToRuntimeProps_81<{
|
|
3134
3134
|
modelValue?: number;
|
|
3135
3135
|
peek?: number;
|
|
3136
|
-
/** How many slides fit in the viewport. 5 = product strip. 1 = one card. */
|
|
3136
|
+
/** How many slides fit in the viewport. 5 = product strip. 1 = one card. With `centered`: how many whole slides around the middle one. */
|
|
3137
3137
|
perView?: number;
|
|
3138
|
+
/**
|
|
3139
|
+
* The current slide stands in the middle and is the biggest; the ones beside it shrink and the outer ones fade
|
|
3140
|
+
* (`peek` is how much of them shows at the edges). The arrows sit on the edges of the strip, move by one slide.
|
|
3141
|
+
* Текущий слайд стоит по центру и крупнее всех; соседние уменьшаются, дальние бледнеют (`peek` — сколько их видно
|
|
3142
|
+
* по краям). Стрелки лежат на краях ленты и листают по одному слайду.
|
|
3143
|
+
*/
|
|
3144
|
+
centered?: boolean;
|
|
3138
3145
|
controls?: boolean;
|
|
3139
3146
|
/**
|
|
3140
3147
|
* Time per slide in ms. 0 — off. The current indicator fills over this time and the slide changes when it is full.
|
|
@@ -3142,6 +3149,12 @@ controls?: boolean;
|
|
|
3142
3149
|
* Время на слайд в мс. 0 — выключено. Текущий индикатор заливается за это время, по заполнении слайд меняется.
|
|
3143
3150
|
*/
|
|
3144
3151
|
autoplay?: number;
|
|
3152
|
+
/**
|
|
3153
|
+
* Go round in a circle. With `centered` it is a seamless cycle: the empty places at the ends are taken by the slides
|
|
3154
|
+
* from the other end, so the slides are drawn 3 times (the extra copies are `inert` and `aria-hidden`; no ids, no refs in a slide).
|
|
3155
|
+
* Крутить по кругу. С `centered` — бесшовный цикл: пустоту по краям занимают слайды с другого конца, поэтому слайды
|
|
3156
|
+
* рисуются трижды (лишние копии `inert` и `aria-hidden`; id и ref в слайде не нужны).
|
|
3157
|
+
*/
|
|
3145
3158
|
loop?: boolean;
|
|
3146
3159
|
/**
|
|
3147
3160
|
* Under the track, one mark per snap: `dots` (the current one stretches into a pill), `bars` (equal bars),
|
|
@@ -3163,6 +3176,7 @@ slideLabel?: string;
|
|
|
3163
3176
|
modelValue: number;
|
|
3164
3177
|
peek: number;
|
|
3165
3178
|
perView: number;
|
|
3179
|
+
centered: boolean;
|
|
3166
3180
|
controls: boolean;
|
|
3167
3181
|
autoplay: number;
|
|
3168
3182
|
loop: boolean;
|
|
@@ -3174,8 +3188,15 @@ change: (value: number) => void;
|
|
|
3174
3188
|
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_76<__VLS_TypePropsToRuntimeProps_81<{
|
|
3175
3189
|
modelValue?: number;
|
|
3176
3190
|
peek?: number;
|
|
3177
|
-
/** How many slides fit in the viewport. 5 = product strip. 1 = one card. */
|
|
3191
|
+
/** How many slides fit in the viewport. 5 = product strip. 1 = one card. With `centered`: how many whole slides around the middle one. */
|
|
3178
3192
|
perView?: number;
|
|
3193
|
+
/**
|
|
3194
|
+
* The current slide stands in the middle and is the biggest; the ones beside it shrink and the outer ones fade
|
|
3195
|
+
* (`peek` is how much of them shows at the edges). The arrows sit on the edges of the strip, move by one slide.
|
|
3196
|
+
* Текущий слайд стоит по центру и крупнее всех; соседние уменьшаются, дальние бледнеют (`peek` — сколько их видно
|
|
3197
|
+
* по краям). Стрелки лежат на краях ленты и листают по одному слайду.
|
|
3198
|
+
*/
|
|
3199
|
+
centered?: boolean;
|
|
3179
3200
|
controls?: boolean;
|
|
3180
3201
|
/**
|
|
3181
3202
|
* Time per slide in ms. 0 — off. The current indicator fills over this time and the slide changes when it is full.
|
|
@@ -3183,6 +3204,12 @@ controls?: boolean;
|
|
|
3183
3204
|
* Время на слайд в мс. 0 — выключено. Текущий индикатор заливается за это время, по заполнении слайд меняется.
|
|
3184
3205
|
*/
|
|
3185
3206
|
autoplay?: number;
|
|
3207
|
+
/**
|
|
3208
|
+
* Go round in a circle. With `centered` it is a seamless cycle: the empty places at the ends are taken by the slides
|
|
3209
|
+
* from the other end, so the slides are drawn 3 times (the extra copies are `inert` and `aria-hidden`; no ids, no refs in a slide).
|
|
3210
|
+
* Крутить по кругу. С `centered` — бесшовный цикл: пустоту по краям занимают слайды с другого конца, поэтому слайды
|
|
3211
|
+
* рисуются трижды (лишние копии `inert` и `aria-hidden`; id и ref в слайде не нужны).
|
|
3212
|
+
*/
|
|
3186
3213
|
loop?: boolean;
|
|
3187
3214
|
/**
|
|
3188
3215
|
* Under the track, one mark per snap: `dots` (the current one stretches into a pill), `bars` (equal bars),
|
|
@@ -3204,6 +3231,7 @@ slideLabel?: string;
|
|
|
3204
3231
|
modelValue: number;
|
|
3205
3232
|
peek: number;
|
|
3206
3233
|
perView: number;
|
|
3234
|
+
centered: boolean;
|
|
3207
3235
|
controls: boolean;
|
|
3208
3236
|
autoplay: number;
|
|
3209
3237
|
loop: boolean;
|
|
@@ -3216,6 +3244,7 @@ onChange?: ((value: number) => any) | undefined;
|
|
|
3216
3244
|
modelValue: number;
|
|
3217
3245
|
peek: number;
|
|
3218
3246
|
perView: number;
|
|
3247
|
+
centered: boolean;
|
|
3219
3248
|
controls: boolean;
|
|
3220
3249
|
autoplay: number;
|
|
3221
3250
|
loop: boolean;
|
package/dist/index.js
CHANGED
|
@@ -13197,6 +13197,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13197
13197
|
modelValue: { default: 0 },
|
|
13198
13198
|
peek: { default: 0 },
|
|
13199
13199
|
perView: { default: 1 },
|
|
13200
|
+
centered: { type: Boolean, default: false },
|
|
13200
13201
|
controls: { type: Boolean, default: true },
|
|
13201
13202
|
autoplay: { default: 0 },
|
|
13202
13203
|
loop: { type: Boolean, default: false },
|
|
@@ -13218,6 +13219,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13218
13219
|
const track = ref(null);
|
|
13219
13220
|
const index = ref(props.modelValue);
|
|
13220
13221
|
const count = ref(0);
|
|
13222
|
+
const copies = ref(1);
|
|
13221
13223
|
const dragging = ref(false);
|
|
13222
13224
|
const gliding = ref(false);
|
|
13223
13225
|
const hoverPaused = ref(false);
|
|
@@ -13236,7 +13238,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13236
13238
|
let settleTimer = 0;
|
|
13237
13239
|
let samples = [];
|
|
13238
13240
|
let focusFrame = 0;
|
|
13239
|
-
const
|
|
13241
|
+
const view = computed(() => Math.max(1, Math.round(props.perView)));
|
|
13242
|
+
const step = computed(() => props.centered ? 1 : view.value);
|
|
13243
|
+
const cyclic = computed(() => copies.value > 1);
|
|
13244
|
+
const base = computed(() => (copies.value - 1) / 2 * count.value);
|
|
13240
13245
|
const lastIndex = computed(() => Math.max(count.value - step.value, 0));
|
|
13241
13246
|
const atStart = computed(() => !props.loop && index.value <= 0);
|
|
13242
13247
|
const atEnd = computed(() => !props.loop && index.value >= lastIndex.value);
|
|
@@ -13255,7 +13260,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13255
13260
|
const progressRatio = computed(() => snapCount.value > 0 ? (index.value + 1) / snapCount.value : 0);
|
|
13256
13261
|
const trackStyle = computed(() => ({
|
|
13257
13262
|
"--tao-carousel-peek": `${Math.max(props.peek, 0)}px`,
|
|
13258
|
-
"--tao-carousel-per-view": String(
|
|
13263
|
+
"--tao-carousel-per-view": String(view.value)
|
|
13259
13264
|
}));
|
|
13260
13265
|
function prefersReducedMotion() {
|
|
13261
13266
|
return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13267,8 +13272,73 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13267
13272
|
}
|
|
13268
13273
|
const styles = getComputedStyle(el);
|
|
13269
13274
|
const gap = Number.parseFloat(styles.columnGap || styles.gap) || 0;
|
|
13270
|
-
const
|
|
13271
|
-
|
|
13275
|
+
const first = el.children[0];
|
|
13276
|
+
let width = first.getBoundingClientRect().width;
|
|
13277
|
+
if (props.centered) {
|
|
13278
|
+
const scale = Number.parseFloat(getComputedStyle(first).scale);
|
|
13279
|
+
if (scale > 0) {
|
|
13280
|
+
width /= scale;
|
|
13281
|
+
}
|
|
13282
|
+
}
|
|
13283
|
+
return { width, gap, total: Math.round(el.children.length / copies.value) };
|
|
13284
|
+
}
|
|
13285
|
+
function wantedCopies(real) {
|
|
13286
|
+
if (!props.centered || !props.loop || real < 2) {
|
|
13287
|
+
return 1;
|
|
13288
|
+
}
|
|
13289
|
+
return 2 * Math.ceil((view.value + 1) / real) + 1;
|
|
13290
|
+
}
|
|
13291
|
+
function syncClones() {
|
|
13292
|
+
const el = track.value;
|
|
13293
|
+
if (!el) {
|
|
13294
|
+
return;
|
|
13295
|
+
}
|
|
13296
|
+
const real = count.value;
|
|
13297
|
+
const middle = (copies.value - 1) / 2;
|
|
13298
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
13299
|
+
const slide = el.children[i];
|
|
13300
|
+
const copy = real > 0 ? Math.floor(i / real) : 0;
|
|
13301
|
+
if (copies.value > 1 && copy !== middle) {
|
|
13302
|
+
slide.setAttribute("aria-hidden", "true");
|
|
13303
|
+
slide.setAttribute("inert", "");
|
|
13304
|
+
slide.setAttribute("data-tao-carousel-copy", "");
|
|
13305
|
+
} else if (slide.hasAttribute("data-tao-carousel-copy")) {
|
|
13306
|
+
slide.removeAttribute("aria-hidden");
|
|
13307
|
+
slide.removeAttribute("inert");
|
|
13308
|
+
slide.removeAttribute("data-tao-carousel-copy");
|
|
13309
|
+
}
|
|
13310
|
+
}
|
|
13311
|
+
}
|
|
13312
|
+
function recenterCycle() {
|
|
13313
|
+
const el = track.value;
|
|
13314
|
+
if (!cyclic.value || !el || dragging.value || gliding.value) {
|
|
13315
|
+
return;
|
|
13316
|
+
}
|
|
13317
|
+
const { width, gap, total } = metrics();
|
|
13318
|
+
if (width <= 0 || total <= 0) {
|
|
13319
|
+
return;
|
|
13320
|
+
}
|
|
13321
|
+
const slot = Math.round(el.scrollLeft / (width + gap));
|
|
13322
|
+
const home = base.value + (slot % total + total) % total;
|
|
13323
|
+
if (home !== slot) {
|
|
13324
|
+
el.scrollLeft += (home - slot) * (width + gap);
|
|
13325
|
+
updateFocus();
|
|
13326
|
+
}
|
|
13327
|
+
}
|
|
13328
|
+
function updateFocus() {
|
|
13329
|
+
const el = track.value;
|
|
13330
|
+
if (!props.centered || !el) {
|
|
13331
|
+
return;
|
|
13332
|
+
}
|
|
13333
|
+
const { width, gap } = metrics();
|
|
13334
|
+
if (width <= 0) {
|
|
13335
|
+
return;
|
|
13336
|
+
}
|
|
13337
|
+
const at = el.scrollLeft / (width + gap);
|
|
13338
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
13339
|
+
const distance = Math.min(Math.abs(i - at), 2);
|
|
13340
|
+
el.children[i].style.setProperty("--tao-carousel-d", distance.toFixed(3));
|
|
13341
|
+
}
|
|
13272
13342
|
}
|
|
13273
13343
|
function nearestIndex(scrollLeft) {
|
|
13274
13344
|
const { width, gap, total } = metrics();
|
|
@@ -13276,8 +13346,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13276
13346
|
return 0;
|
|
13277
13347
|
}
|
|
13278
13348
|
const left = scrollLeft ?? track.value?.scrollLeft ?? 0;
|
|
13349
|
+
const slot = Math.round(left / (width + gap));
|
|
13350
|
+
if (cyclic.value) {
|
|
13351
|
+
return (slot % total + total) % total;
|
|
13352
|
+
}
|
|
13279
13353
|
const last = Math.max(total - step.value, 0);
|
|
13280
|
-
return Math.min(Math.max(
|
|
13354
|
+
return Math.min(Math.max(slot, 0), last);
|
|
13281
13355
|
}
|
|
13282
13356
|
function setIndex(next) {
|
|
13283
13357
|
if (next === index.value) {
|
|
@@ -13288,7 +13362,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13288
13362
|
emit("change", next);
|
|
13289
13363
|
}
|
|
13290
13364
|
function refreshCount() {
|
|
13291
|
-
count.value = track.value?.children.length ?? 0;
|
|
13365
|
+
count.value = Math.round((track.value?.children.length ?? 0) / copies.value);
|
|
13366
|
+
const wanted = wantedCopies(count.value);
|
|
13367
|
+
if (wanted !== copies.value) {
|
|
13368
|
+
copies.value = wanted;
|
|
13369
|
+
nextTick(() => {
|
|
13370
|
+
goTo(index.value, true);
|
|
13371
|
+
updateFocus();
|
|
13372
|
+
});
|
|
13373
|
+
}
|
|
13374
|
+
syncClones();
|
|
13292
13375
|
}
|
|
13293
13376
|
function goPrev() {
|
|
13294
13377
|
goTo(index.value - step.value);
|
|
@@ -13303,6 +13386,20 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13303
13386
|
if (!el || width <= 0 || total <= 0) {
|
|
13304
13387
|
return;
|
|
13305
13388
|
}
|
|
13389
|
+
if (cyclic.value && total > 1) {
|
|
13390
|
+
const slot = width + gap;
|
|
13391
|
+
const at = el.scrollLeft / slot;
|
|
13392
|
+
const home = (next % total + total) % total;
|
|
13393
|
+
let target = base.value + home;
|
|
13394
|
+
for (let copy = home; !instant && copy < total * copies.value; copy += total) {
|
|
13395
|
+
if (Math.abs(copy - at) < Math.abs(target - at)) {
|
|
13396
|
+
target = copy;
|
|
13397
|
+
}
|
|
13398
|
+
}
|
|
13399
|
+
el.scrollTo({ left: target * slot, behavior: prefersReducedMotion() || dragging.value || instant ? "auto" : "smooth" });
|
|
13400
|
+
setIndex(home);
|
|
13401
|
+
return;
|
|
13402
|
+
}
|
|
13306
13403
|
const last = Math.max(total - step.value, 0);
|
|
13307
13404
|
let page = next;
|
|
13308
13405
|
let wrapping = false;
|
|
@@ -13356,6 +13453,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13356
13453
|
});
|
|
13357
13454
|
}
|
|
13358
13455
|
function onScroll() {
|
|
13456
|
+
updateFocus();
|
|
13359
13457
|
if (dragging.value || gliding.value) {
|
|
13360
13458
|
return;
|
|
13361
13459
|
}
|
|
@@ -13371,6 +13469,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13371
13469
|
}
|
|
13372
13470
|
function settle() {
|
|
13373
13471
|
window.clearTimeout(settleTimer);
|
|
13472
|
+
recenterCycle();
|
|
13374
13473
|
const el = track.value;
|
|
13375
13474
|
if (!el || dragging.value || gliding.value || getComputedStyle(el).scrollSnapType !== "none") {
|
|
13376
13475
|
return;
|
|
@@ -13423,6 +13522,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13423
13522
|
function finishGlide() {
|
|
13424
13523
|
glideFrame = 0;
|
|
13425
13524
|
gliding.value = false;
|
|
13525
|
+
recenterCycle();
|
|
13426
13526
|
setIndex(nearestIndex());
|
|
13427
13527
|
}
|
|
13428
13528
|
function glideTo(target, velocity) {
|
|
@@ -13565,6 +13665,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13565
13665
|
fillEpoch.value += 1;
|
|
13566
13666
|
}
|
|
13567
13667
|
);
|
|
13668
|
+
let resizeObserver = null;
|
|
13669
|
+
function onTrackResize() {
|
|
13670
|
+
if (!props.centered || dragging.value || gliding.value) {
|
|
13671
|
+
return;
|
|
13672
|
+
}
|
|
13673
|
+
goTo(index.value, true);
|
|
13674
|
+
updateFocus();
|
|
13675
|
+
}
|
|
13568
13676
|
onMounted(() => {
|
|
13569
13677
|
refreshCount();
|
|
13570
13678
|
mounted.value = true;
|
|
@@ -13572,13 +13680,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13572
13680
|
pageHidden.value = document.hidden;
|
|
13573
13681
|
nextTick(() => {
|
|
13574
13682
|
goTo(props.modelValue);
|
|
13683
|
+
updateFocus();
|
|
13575
13684
|
});
|
|
13685
|
+
if (typeof ResizeObserver !== "undefined" && track.value) {
|
|
13686
|
+
resizeObserver = new ResizeObserver(onTrackResize);
|
|
13687
|
+
resizeObserver.observe(track.value);
|
|
13688
|
+
}
|
|
13576
13689
|
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
13577
13690
|
window.addEventListener("blur", onWindowBlur);
|
|
13578
13691
|
window.addEventListener("pagehide", onWindowBlur);
|
|
13579
13692
|
});
|
|
13580
|
-
onUpdated(
|
|
13693
|
+
onUpdated(() => {
|
|
13694
|
+
refreshCount();
|
|
13695
|
+
updateFocus();
|
|
13696
|
+
});
|
|
13697
|
+
watch(
|
|
13698
|
+
() => [props.centered, props.loop, props.perView],
|
|
13699
|
+
() => {
|
|
13700
|
+
refreshCount();
|
|
13701
|
+
nextTick(() => {
|
|
13702
|
+
goTo(index.value, true);
|
|
13703
|
+
updateFocus();
|
|
13704
|
+
});
|
|
13705
|
+
}
|
|
13706
|
+
);
|
|
13581
13707
|
onBeforeUnmount(() => {
|
|
13708
|
+
resizeObserver?.disconnect();
|
|
13582
13709
|
endDrag();
|
|
13583
13710
|
cancelGlide();
|
|
13584
13711
|
window.clearTimeout(settleTimer);
|
|
@@ -13590,7 +13717,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13590
13717
|
});
|
|
13591
13718
|
return (_ctx, _cache) => {
|
|
13592
13719
|
return openBlock(), createElementBlock("div", {
|
|
13593
|
-
class: "tao-carousel",
|
|
13720
|
+
class: normalizeClass(["tao-carousel", { "tao-carousel--centered": __props.centered }]),
|
|
13594
13721
|
style: normalizeStyle(trackStyle.value),
|
|
13595
13722
|
onMouseenter: onMouseEnter,
|
|
13596
13723
|
onMouseleave: onMouseLeave,
|
|
@@ -13605,7 +13732,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13605
13732
|
showControls.value ? (openBlock(), createElementBlock("button", {
|
|
13606
13733
|
key: 0,
|
|
13607
13734
|
type: "button",
|
|
13608
|
-
class: "tao-carousel__nav",
|
|
13735
|
+
class: "tao-carousel__nav tao-carousel__nav--prev",
|
|
13609
13736
|
"aria-label": unref(l10n).prevLabel,
|
|
13610
13737
|
disabled: atStart.value,
|
|
13611
13738
|
onClick: goPrev
|
|
@@ -13639,7 +13766,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13639
13766
|
onLostpointercapture: onLostPointerCapture,
|
|
13640
13767
|
onClickCapture
|
|
13641
13768
|
}, [
|
|
13642
|
-
|
|
13769
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(copies.value, (copy) => {
|
|
13770
|
+
return renderSlot(_ctx.$slots, "default", {}, void 0, true, copy);
|
|
13771
|
+
}), 128))
|
|
13643
13772
|
], 42, _hoisted_4$3),
|
|
13644
13773
|
renderSlot(_ctx.$slots, "next", {
|
|
13645
13774
|
disabled: atEnd.value,
|
|
@@ -13648,7 +13777,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13648
13777
|
showControls.value ? (openBlock(), createElementBlock("button", {
|
|
13649
13778
|
key: 0,
|
|
13650
13779
|
type: "button",
|
|
13651
|
-
class: "tao-carousel__nav",
|
|
13780
|
+
class: "tao-carousel__nav tao-carousel__nav--next",
|
|
13652
13781
|
"aria-label": unref(l10n).nextLabel,
|
|
13653
13782
|
disabled: atEnd.value,
|
|
13654
13783
|
onClick: goNext
|
|
@@ -13738,11 +13867,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13738
13867
|
}, null, 38))
|
|
13739
13868
|
])) : createCommentVNode("", true)
|
|
13740
13869
|
])) : createCommentVNode("", true)
|
|
13741
|
-
],
|
|
13870
|
+
], 38);
|
|
13742
13871
|
};
|
|
13743
13872
|
}
|
|
13744
13873
|
});
|
|
13745
|
-
const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
13874
|
+
const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c1dbc679"]]);
|
|
13746
13875
|
const _hoisted_1$3 = ["aria-label"];
|
|
13747
13876
|
const _hoisted_2$2 = ["aria-label"];
|
|
13748
13877
|
const _hoisted_3$2 = {
|