@1337exp/taoui 5.32.1 → 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 CHANGED
@@ -1,5 +1,29 @@
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
+
21
+ ## 5.32.2
22
+
23
+ Nothing to migrate; a fix.
24
+
25
+ - **`TaoSegmented`: the thumb in a scaled parent.** The thumb was measured with `getBoundingClientRect()` (screen px) and drawn in layout px, so inside a parent with `transform: scale(...)` (a zoomed canvas of nodes) it came out smaller by the scale and sat off its option. A change of the zoom does not resize the track, so the `ResizeObserver` stayed quiet and the thumb kept the size of the zoom it appeared at. The boxes are now divided by the scale (the screen size of the track over its layout size), so the thumb is in layout px and right at any zoom; without a layout (SSR, jsdom) the scale is 1 and nothing changes. Found in `kupona`, a calculator on a canvas of nodes.
26
+
3
27
  ## 5.32.1
4
28
 
5
29
  Nothing to migrate; one look changes: the confirm dialog has no bar on its left edge.
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`. 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
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`. Стрелки через `controls` или `#prev` / `#next`; метки под лентой — `indicator` (`dots`, `bars` или `progress`). С `autoplay` текущая метка заполняется за интервал, по заполнении слайд меняется; hover, фокус с клавиатуры, касание, скрытая вкладка и кнопка паузы останавливают, `prefers-reduced-motion` выключает
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
@@ -9144,10 +9144,12 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
9144
9144
  }
9145
9145
  const trackBox = track.getBoundingClientRect();
9146
9146
  const optionBox = selected.getBoundingClientRect();
9147
+ const scaleX = track.offsetWidth > 0 && trackBox.width > 0 ? trackBox.width / track.offsetWidth : 1;
9148
+ const scaleY = track.offsetHeight > 0 && trackBox.height > 0 ? trackBox.height / track.offsetHeight : 1;
9147
9149
  const next = {
9148
- width: `${optionBox.width}px`,
9149
- height: `${optionBox.height}px`,
9150
- transform: `translate(${optionBox.left - trackBox.left - track.clientLeft}px, ${optionBox.top - trackBox.top - track.clientTop}px)`,
9150
+ width: `${optionBox.width / scaleX}px`,
9151
+ height: `${optionBox.height / scaleY}px`,
9152
+ transform: `translate(${(optionBox.left - trackBox.left) / scaleX - track.clientLeft}px, ${(optionBox.top - trackBox.top) / scaleY - track.clientTop}px)`,
9151
9153
  opacity: "1"
9152
9154
  };
9153
9155
  const prev = thumbStyle.value;
@@ -9226,7 +9228,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
9226
9228
  };
9227
9229
  }
9228
9230
  });
9229
- const TaoSegmented = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-49ed8ced"]]);
9231
+ const TaoSegmented = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-c4a6edd1"]]);
9230
9232
  const _hoisted_1$q = ["for"];
9231
9233
  const _hoisted_2$o = ["id", "name", "value", "checked", "disabled", "aria-label"];
9232
9234
  const _hoisted_3$k = { class: "tao-segmented-option__face" };
@@ -13195,6 +13197,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13195
13197
  modelValue: { default: 0 },
13196
13198
  peek: { default: 0 },
13197
13199
  perView: { default: 1 },
13200
+ centered: { type: Boolean, default: false },
13198
13201
  controls: { type: Boolean, default: true },
13199
13202
  autoplay: { default: 0 },
13200
13203
  loop: { type: Boolean, default: false },
@@ -13216,6 +13219,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13216
13219
  const track = ref(null);
13217
13220
  const index = ref(props.modelValue);
13218
13221
  const count = ref(0);
13222
+ const copies = ref(1);
13219
13223
  const dragging = ref(false);
13220
13224
  const gliding = ref(false);
13221
13225
  const hoverPaused = ref(false);
@@ -13234,7 +13238,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13234
13238
  let settleTimer = 0;
13235
13239
  let samples = [];
13236
13240
  let focusFrame = 0;
13237
- const step = computed(() => Math.max(1, Math.round(props.perView)));
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);
13238
13245
  const lastIndex = computed(() => Math.max(count.value - step.value, 0));
13239
13246
  const atStart = computed(() => !props.loop && index.value <= 0);
13240
13247
  const atEnd = computed(() => !props.loop && index.value >= lastIndex.value);
@@ -13253,7 +13260,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13253
13260
  const progressRatio = computed(() => snapCount.value > 0 ? (index.value + 1) / snapCount.value : 0);
13254
13261
  const trackStyle = computed(() => ({
13255
13262
  "--tao-carousel-peek": `${Math.max(props.peek, 0)}px`,
13256
- "--tao-carousel-per-view": String(step.value)
13263
+ "--tao-carousel-per-view": String(view.value)
13257
13264
  }));
13258
13265
  function prefersReducedMotion() {
13259
13266
  return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13265,8 +13272,73 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13265
13272
  }
13266
13273
  const styles = getComputedStyle(el);
13267
13274
  const gap = Number.parseFloat(styles.columnGap || styles.gap) || 0;
13268
- const width = el.children[0].getBoundingClientRect().width;
13269
- return { width, gap, total: el.children.length };
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
+ }
13270
13342
  }
13271
13343
  function nearestIndex(scrollLeft) {
13272
13344
  const { width, gap, total } = metrics();
@@ -13274,8 +13346,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13274
13346
  return 0;
13275
13347
  }
13276
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
+ }
13277
13353
  const last = Math.max(total - step.value, 0);
13278
- return Math.min(Math.max(Math.round(left / (width + gap)), 0), last);
13354
+ return Math.min(Math.max(slot, 0), last);
13279
13355
  }
13280
13356
  function setIndex(next) {
13281
13357
  if (next === index.value) {
@@ -13286,7 +13362,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13286
13362
  emit("change", next);
13287
13363
  }
13288
13364
  function refreshCount() {
13289
- 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();
13290
13375
  }
13291
13376
  function goPrev() {
13292
13377
  goTo(index.value - step.value);
@@ -13301,6 +13386,20 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13301
13386
  if (!el || width <= 0 || total <= 0) {
13302
13387
  return;
13303
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
+ }
13304
13403
  const last = Math.max(total - step.value, 0);
13305
13404
  let page = next;
13306
13405
  let wrapping = false;
@@ -13354,6 +13453,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13354
13453
  });
13355
13454
  }
13356
13455
  function onScroll() {
13456
+ updateFocus();
13357
13457
  if (dragging.value || gliding.value) {
13358
13458
  return;
13359
13459
  }
@@ -13369,6 +13469,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13369
13469
  }
13370
13470
  function settle() {
13371
13471
  window.clearTimeout(settleTimer);
13472
+ recenterCycle();
13372
13473
  const el = track.value;
13373
13474
  if (!el || dragging.value || gliding.value || getComputedStyle(el).scrollSnapType !== "none") {
13374
13475
  return;
@@ -13421,6 +13522,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13421
13522
  function finishGlide() {
13422
13523
  glideFrame = 0;
13423
13524
  gliding.value = false;
13525
+ recenterCycle();
13424
13526
  setIndex(nearestIndex());
13425
13527
  }
13426
13528
  function glideTo(target, velocity) {
@@ -13563,6 +13665,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13563
13665
  fillEpoch.value += 1;
13564
13666
  }
13565
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
+ }
13566
13676
  onMounted(() => {
13567
13677
  refreshCount();
13568
13678
  mounted.value = true;
@@ -13570,13 +13680,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13570
13680
  pageHidden.value = document.hidden;
13571
13681
  nextTick(() => {
13572
13682
  goTo(props.modelValue);
13683
+ updateFocus();
13573
13684
  });
13685
+ if (typeof ResizeObserver !== "undefined" && track.value) {
13686
+ resizeObserver = new ResizeObserver(onTrackResize);
13687
+ resizeObserver.observe(track.value);
13688
+ }
13574
13689
  document.addEventListener("visibilitychange", onVisibilityChange);
13575
13690
  window.addEventListener("blur", onWindowBlur);
13576
13691
  window.addEventListener("pagehide", onWindowBlur);
13577
13692
  });
13578
- onUpdated(refreshCount);
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
+ );
13579
13707
  onBeforeUnmount(() => {
13708
+ resizeObserver?.disconnect();
13580
13709
  endDrag();
13581
13710
  cancelGlide();
13582
13711
  window.clearTimeout(settleTimer);
@@ -13588,7 +13717,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13588
13717
  });
13589
13718
  return (_ctx, _cache) => {
13590
13719
  return openBlock(), createElementBlock("div", {
13591
- class: "tao-carousel",
13720
+ class: normalizeClass(["tao-carousel", { "tao-carousel--centered": __props.centered }]),
13592
13721
  style: normalizeStyle(trackStyle.value),
13593
13722
  onMouseenter: onMouseEnter,
13594
13723
  onMouseleave: onMouseLeave,
@@ -13603,7 +13732,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13603
13732
  showControls.value ? (openBlock(), createElementBlock("button", {
13604
13733
  key: 0,
13605
13734
  type: "button",
13606
- class: "tao-carousel__nav",
13735
+ class: "tao-carousel__nav tao-carousel__nav--prev",
13607
13736
  "aria-label": unref(l10n).prevLabel,
13608
13737
  disabled: atStart.value,
13609
13738
  onClick: goPrev
@@ -13637,7 +13766,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13637
13766
  onLostpointercapture: onLostPointerCapture,
13638
13767
  onClickCapture
13639
13768
  }, [
13640
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
13769
+ (openBlock(true), createElementBlock(Fragment, null, renderList(copies.value, (copy) => {
13770
+ return renderSlot(_ctx.$slots, "default", {}, void 0, true, copy);
13771
+ }), 128))
13641
13772
  ], 42, _hoisted_4$3),
13642
13773
  renderSlot(_ctx.$slots, "next", {
13643
13774
  disabled: atEnd.value,
@@ -13646,7 +13777,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13646
13777
  showControls.value ? (openBlock(), createElementBlock("button", {
13647
13778
  key: 0,
13648
13779
  type: "button",
13649
- class: "tao-carousel__nav",
13780
+ class: "tao-carousel__nav tao-carousel__nav--next",
13650
13781
  "aria-label": unref(l10n).nextLabel,
13651
13782
  disabled: atEnd.value,
13652
13783
  onClick: goNext
@@ -13736,11 +13867,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13736
13867
  }, null, 38))
13737
13868
  ])) : createCommentVNode("", true)
13738
13869
  ])) : createCommentVNode("", true)
13739
- ], 36);
13870
+ ], 38);
13740
13871
  };
13741
13872
  }
13742
13873
  });
13743
- const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-7d6c5a70"]]);
13874
+ const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c1dbc679"]]);
13744
13875
  const _hoisted_1$3 = ["aria-label"];
13745
13876
  const _hoisted_2$2 = ["aria-label"];
13746
13877
  const _hoisted_3$2 = {