@styleflow.app/flowpress-astro-core 1.0.0-beta.43 → 1.0.0-beta.44

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0-beta.44 — 2026-11-04
4
+
5
+ - `sf/carousel` follows the extended contract of Components beta.18: fractional items per view, fixed slide width and peek per breakpoint (`fixedWidth`, `padding`), centred focus, aspect ratio, equal height, fade, rewind, start index, free drag, wheel, arrow position/shape/size with a mobile position, dots, bars or a fraction counter, and controls background from StyleFlow tone and intensity. Carousels saved with the original fields mount with exactly the same Splide options.
6
+ - New shared stylesheet `native/carousel.css` (also exported) and `carouselLayout()`: the page before Splide mounts shows the same geometry as the mounted carousel at rest, without relying on `splide-core.css`. WordPress Core copies the stylesheet verbatim for the block editor; `tests/fixtures/carousel-layout.json` is shared with its port. Arrows are SVG chevrons and dots are visible by default.
7
+ - Slides no longer reveal one by one (`sf-motion-disable` on the track), so loop clones never stay hidden; the carousel also follows the site's reduced-motion switch. The root keeps native flex-item sizing (`--fp-flex-basis`) next to the carousel geometry.
8
+ - Depend on `@styleflow.app/flowpress-components` 1.0.0-beta.18.
9
+ - [Canonical report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-11-04-carosello-completo.md).
10
+
3
11
  ## 1.0.0-beta.43 — 2026-10-30
4
12
 
5
13
  - Retry GraphQL query documents after a timeout, a network failure or HTTP 429/502/503/504. Every attempt has a fresh timeout that also covers the response body, backoff starts at `retryDelayMs` and doubles, and each retry logs one warning. Mutations, GraphQL errors and other statuses are never replayed. Defaults: 15000 ms per attempt and 1 retry.
package/README.md CHANGED
@@ -12,7 +12,7 @@ in the [canonical motion guide](https://github.com/StyleFlow-App/styleflow-docs/
12
12
  ## Install
13
13
 
14
14
  ```bash
15
- pnpm add @styleflow.app/flowpress-astro-core@1.0.0-beta.43 \
15
+ pnpm add @styleflow.app/flowpress-astro-core@1.0.0-beta.44 \
16
16
  @styleflow.app/astro@1.0.0-beta.11
17
17
  ```
18
18
 
@@ -1,7 +1,13 @@
1
1
  ---
2
2
  import "@splidejs/splide/css/core";
3
+ import "../native/carousel.css";
3
4
  import StyleflowElement from "../StyleflowElement.astro";
4
- import { carouselOptions, carouselSettings } from "../../carousel.js";
5
+ import {
6
+ carouselLayout,
7
+ carouselOptions,
8
+ carouselSettings,
9
+ carouselStyleText
10
+ } from "../../carousel.js";
5
11
  import type { FlowpressBlock } from "../../types.js";
6
12
  import type { StyleflowContract } from "../../styleflow.js";
7
13
  import { blockHtmlAttributes, semanticProps } from "./helpers.js";
@@ -16,24 +22,25 @@ interface Props {
16
22
  const { block, contract, validChildren, invalidChildNames = [] } = Astro.props;
17
23
  const settings = carouselSettings(block.attributes);
18
24
  const options = carouselOptions(settings);
25
+ const layout = carouselLayout(settings);
19
26
  const semantic = semanticProps(block.attributes, contract, {
20
27
  surface: "default",
21
28
  layoutRole: "container",
22
29
  density: "regular"
23
30
  });
24
- const htmlAttributes = blockHtmlAttributes(
31
+ const { style: nativeStyle, ...htmlAttributes } = blockHtmlAttributes(
25
32
  block.attributes,
26
33
  `flowpress-carousel${validChildren ? " splide" : " flowpress-carousel--static"}`
27
- );
28
- const style = [
29
- `--flowpress-carousel-gap:${settings.gap}px`,
30
- `--flowpress-carousel-base:${settings.itemsPerView.base}`,
31
- `--flowpress-carousel-sm:${settings.itemsPerView.sm}`,
32
- `--flowpress-carousel-md:${settings.itemsPerView.md}`,
33
- `--flowpress-carousel-lg:${settings.itemsPerView.lg}`,
34
- `--flowpress-carousel-xl:${settings.itemsPerView.xl}`,
35
- `--flowpress-carousel-2xl:${settings.itemsPerView["2xl"]}`
36
- ].join(";");
34
+ ) as Record<string, unknown>;
35
+ // Native flex-item sizing (e.g. --fp-flex-basis) and the carousel geometry share the root style.
36
+ const style = [nativeStyle, carouselStyleText(layout)].filter(Boolean).join(";");
37
+ const slideCount = block.innerBlocks?.length ?? 0;
38
+ const counter = settings.showPagination && settings.paginationStyle === "fraction";
39
+ const pagination = settings.showPagination && !counter;
40
+ const chevron = {
41
+ prev: "M15 18l-6-6 6-6",
42
+ next: "M9 6l6 6-6 6"
43
+ };
37
44
 
38
45
  if (!validChildren && import.meta.env.DEV) {
39
46
  console.warn(
@@ -47,6 +54,7 @@ if (!validChildren && import.meta.env.DEV) {
47
54
  <StyleflowElement as="section"
48
55
  {...semantic}
49
56
  {...htmlAttributes}
57
+ {...layout.data}
50
58
  aria-label={settings.ariaLabel}
51
59
  data-flowpress-carousel-root
52
60
  data-carousel-options={JSON.stringify(options)}
@@ -54,20 +62,32 @@ if (!validChildren && import.meta.env.DEV) {
54
62
  >
55
63
  {settings.showArrows ? (
56
64
  <div class="splide__arrows" data-flowpress-carousel-controls>
57
- <button class="splide__arrow splide__arrow--prev" type="button">
58
- <span aria-hidden="true">←</span>
59
- </button>
60
- <button class="splide__arrow splide__arrow--next" type="button">
61
- <span aria-hidden="true">→</span>
62
- </button>
65
+ {(["prev", "next"] as const).map((direction) => (
66
+ <button
67
+ class={`splide__arrow splide__arrow--${direction}`}
68
+ type="button"
69
+ aria-label={direction === "prev" ? "Slide precedente" : "Slide successiva"}
70
+ >
71
+ <span class="flowpress-carousel__icon" aria-hidden="true">
72
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false">
73
+ <path d={chevron[direction]} />
74
+ </svg>
75
+ </span>
76
+ </button>
77
+ ))}
63
78
  </div>
64
79
  ) : null}
65
- <div class="splide__track">
80
+ <div class="splide__track sf-motion-disable">
66
81
  <ul class="splide__list">
67
82
  <slot />
68
83
  </ul>
69
84
  </div>
70
- {settings.showPagination ? <ul class="splide__pagination"></ul> : null}
85
+ {pagination ? <ul class="splide__pagination"></ul> : null}
86
+ {counter ? (
87
+ <div class="flowpress-carousel__counter" aria-hidden="true" data-flowpress-carousel-counter>
88
+ {`${Math.min(settings.startIndex, Math.max(slideCount - 1, 0)) + 1} / ${slideCount}`}
89
+ </div>
90
+ ) : null}
71
91
  {settings.autoplay ? (
72
92
  <button
73
93
  class="splide__toggle"
@@ -96,10 +116,12 @@ if (!validChildren && import.meta.env.DEV) {
96
116
  <script>
97
117
  import Splide from "@splidejs/splide";
98
118
  import type { Options } from "@splidejs/splide";
119
+ import { getMotionPreference, subscribeMotionPreference } from "../../motion-preference.js";
99
120
 
100
121
  if (!customElements.get("flowpress-carousel")) {
101
122
  customElements.define("flowpress-carousel", class extends HTMLElement {
102
123
  private instance?: Splide | undefined;
124
+ private unsubscribe?: (() => void) | undefined;
103
125
 
104
126
  connectedCallback() {
105
127
  if (this.instance) return;
@@ -107,14 +129,33 @@ if (!validChildren && import.meta.env.DEV) {
107
129
  if (!root) return;
108
130
  try {
109
131
  const options = JSON.parse(root.dataset.carouselOptions || "{}") as Options;
110
- this.instance = new Splide(root, options);
111
- this.instance.mount();
132
+ const speed = options.speed ?? 400;
133
+ // The site's motion switch counts as much as the operating system setting.
134
+ if (getMotionPreference() === "reduce") {
135
+ options.speed = 0;
136
+ if (options.autoplay) options.autoplay = "pause";
137
+ }
138
+ const instance = new Splide(root, options);
139
+ const counter = root.querySelector<HTMLElement>("[data-flowpress-carousel-counter]");
140
+ if (counter) {
141
+ instance.on("mounted move", () => {
142
+ counter.textContent = `${instance.index + 1} / ${instance.length}`;
143
+ });
144
+ }
145
+ instance.mount();
146
+ this.instance = instance;
147
+ this.unsubscribe = subscribeMotionPreference((preference) => {
148
+ instance.options = { speed: preference === "reduce" ? 0 : speed };
149
+ if (preference === "reduce") instance.Components.Autoplay?.pause();
150
+ });
112
151
  } catch (error) {
113
152
  console.error("[flowpress-carousel-init] Unable to initialize carousel.", error);
114
153
  }
115
154
  }
116
155
 
117
156
  disconnectedCallback() {
157
+ this.unsubscribe?.();
158
+ this.unsubscribe = undefined;
118
159
  this.instance?.destroy(true);
119
160
  this.instance = undefined;
120
161
  }
@@ -122,80 +163,9 @@ if (!validChildren && import.meta.env.DEV) {
122
163
  }
123
164
  </script>
124
165
 
125
- <style>
166
+ <style is:global>
126
167
  flowpress-carousel { display: block; }
127
- .flowpress-carousel { min-width: 0; }
128
- .flowpress-carousel:not(.is-initialized) { visibility: visible; }
129
- .flowpress-carousel:not(.is-initialized) .splide__list {
130
- display: grid;
131
- grid-template-columns: repeat(var(--flowpress-carousel-base), minmax(0, 1fr));
132
- gap: var(--flowpress-carousel-gap);
133
- }
134
- .flowpress-carousel:not(.is-initialized) [data-flowpress-carousel-controls],
135
- .flowpress-carousel:not(.is-initialized) .splide__pagination {
136
- display: none;
137
- }
138
- .flowpress-carousel--static {
139
- display: grid;
140
- gap: var(--flowpress-carousel-gap);
141
- }
142
- .splide__arrows {
143
- display: flex;
144
- justify-content: space-between;
145
- gap: 0.5rem;
146
- margin-block-end: 0.75rem;
147
- }
148
- .splide__arrow:disabled { opacity: 0.45; }
149
- .splide__pagination {
150
- display: flex;
151
- justify-content: center;
152
- gap: 0.5rem;
153
- margin: 0.75rem 0 0;
154
- padding: 0;
155
- }
156
- :global(.splide__pagination__page) {
157
- width: 0.75rem;
158
- height: 0.75rem;
159
- border-radius: 999px;
160
- }
161
- .splide__toggle { margin-block-start: 0.75rem; }
162
- .splide__toggle__pause { display: none; }
163
- .splide__toggle.is-active .splide__toggle__play { display: none; }
164
- .splide__toggle.is-active .splide__toggle__pause { display: inline; }
165
- .splide__arrow:focus-visible,
166
- :global(.splide__pagination__page:focus-visible),
167
- .splide__toggle:focus-visible {
168
- outline: 3px solid currentColor;
169
- outline-offset: 3px;
170
- }
171
- @media (min-width: 40rem) {
172
- .flowpress-carousel:not(.is-initialized) .splide__list {
173
- grid-template-columns: repeat(var(--flowpress-carousel-sm), minmax(0, 1fr));
174
- }
175
- }
176
- @media (min-width: 48rem) {
177
- .flowpress-carousel:not(.is-initialized) .splide__list {
178
- grid-template-columns: repeat(var(--flowpress-carousel-md), minmax(0, 1fr));
179
- }
180
- }
181
- @media (min-width: 64rem) {
182
- .flowpress-carousel:not(.is-initialized) .splide__list {
183
- grid-template-columns: repeat(var(--flowpress-carousel-lg), minmax(0, 1fr));
184
- }
185
- }
186
- @media (min-width: 80rem) {
187
- .flowpress-carousel:not(.is-initialized) .splide__list {
188
- grid-template-columns: repeat(var(--flowpress-carousel-xl), minmax(0, 1fr));
189
- }
190
- }
191
- @media (min-width: 96rem) {
192
- .flowpress-carousel:not(.is-initialized) .splide__list {
193
- grid-template-columns: repeat(var(--flowpress-carousel-2xl), minmax(0, 1fr));
194
- }
195
- }
196
168
  @media (prefers-reduced-motion: reduce) {
197
169
  .flowpress-carousel * { scroll-behavior: auto !important; }
198
170
  }
199
171
  </style>
200
-
201
- <style is:global>.flowpress-carousel:not(.is-initialized) { visibility: visible; }</style>
@@ -0,0 +1,323 @@
1
+ /*
2
+ * FlowPress carousel (sf/carousel). Shared verbatim with the WordPress block editor, where Splide
3
+ * never mounts: the static layout below reproduces Splide at rest (slide widths, peeks, gap,
4
+ * centring), so the editor, the page before mounting and the mounted carousel look the same.
5
+ * It must not rely on splide-core.css, which only the frontend loads. Geometry comes from the
6
+ * custom properties written by `carouselLayout()`; colours come from the StyleFlow context.
7
+ */
8
+ .flowpress-carousel {
9
+ --flowpress-carousel-icon-fg: var(--sf-foreground-primary, currentColor);
10
+ --flowpress-carousel-veil: color-mix(in oklab, var(--flowpress-carousel-icon-fg) 30%, transparent);
11
+ --flowpress-carousel-arrow-size: 2.5rem;
12
+ --flowpress-carousel-arrow-radius: var(--sf-layout-chip-regular-radius, 999px);
13
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-base, 100%);
14
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-base, 0px);
15
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-base, 0px);
16
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-base, 0px);
17
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-base, 0px);
18
+ position: relative;
19
+ display: grid;
20
+ grid-template-columns: minmax(0, 1fr);
21
+ grid-template-areas: "arrows" "track" "pagination";
22
+ min-width: 0;
23
+ }
24
+ @media (min-width: 40rem) {
25
+ .flowpress-carousel {
26
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-sm, 100%);
27
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-sm, 0px);
28
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-sm, 0px);
29
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-sm, 0px);
30
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-sm, 0px);
31
+ }
32
+ }
33
+ @media (min-width: 48rem) {
34
+ .flowpress-carousel {
35
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-md, 100%);
36
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-md, 0px);
37
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-md, 0px);
38
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-md, 0px);
39
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-md, 0px);
40
+ }
41
+ }
42
+ @media (min-width: 64rem) {
43
+ .flowpress-carousel {
44
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-lg, 100%);
45
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-lg, 0px);
46
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-lg, 0px);
47
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-lg, 0px);
48
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-lg, 0px);
49
+ }
50
+ }
51
+ @media (min-width: 80rem) {
52
+ .flowpress-carousel {
53
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-xl, 100%);
54
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-xl, 0px);
55
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-xl, 0px);
56
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-xl, 0px);
57
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-xl, 0px);
58
+ }
59
+ }
60
+ @media (min-width: 96rem) {
61
+ .flowpress-carousel {
62
+ --flowpress-carousel-slide: var(--flowpress-carousel-slide-2xl, 100%);
63
+ --flowpress-carousel-peek-start: var(--flowpress-carousel-peek-start-2xl, 0px);
64
+ --flowpress-carousel-peek-end: var(--flowpress-carousel-peek-end-2xl, 0px);
65
+ --flowpress-carousel-shift: var(--flowpress-carousel-shift-2xl, 0px);
66
+ --flowpress-carousel-edge: var(--flowpress-carousel-edge-2xl, 0px);
67
+ }
68
+ }
69
+
70
+ /* The page shows the static layout until Splide mounts: no shift, no hidden first paint. */
71
+ .flowpress-carousel:not(.is-initialized) {
72
+ visibility: visible;
73
+ }
74
+
75
+ /* Track and slides: the same box model Splide sets inline once mounted. */
76
+ .flowpress-carousel .splide__track {
77
+ grid-area: track;
78
+ position: relative;
79
+ z-index: 0;
80
+ min-width: 0;
81
+ overflow: hidden;
82
+ padding-inline: var(--flowpress-carousel-peek-start) var(--flowpress-carousel-peek-end);
83
+ }
84
+ .flowpress-carousel .splide__list {
85
+ display: flex;
86
+ margin: 0;
87
+ padding: 0;
88
+ list-style: none;
89
+ transform: translateX(var(--flowpress-carousel-shift));
90
+ }
91
+ .flowpress-carousel .splide__list > * {
92
+ position: relative;
93
+ flex: 0 0 auto;
94
+ box-sizing: border-box;
95
+ inline-size: var(--flowpress-carousel-slide);
96
+ min-inline-size: 0;
97
+ margin: 0;
98
+ margin-inline-end: var(--flowpress-carousel-gap, 24px);
99
+ list-style: none;
100
+ }
101
+ .flowpress-carousel[data-aspect] .splide__list > * {
102
+ aspect-ratio: var(--flowpress-carousel-aspect);
103
+ }
104
+ .flowpress-carousel:is([data-aspect], [data-equal-height]) .splide__list > * {
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+ .flowpress-carousel:is([data-aspect], [data-equal-height]) .splide__list > * > * {
109
+ flex: 1 1 auto;
110
+ }
111
+ /* Fade shows one item at a time; the others wait in place until Splide mounts. */
112
+ .flowpress-carousel[data-effect="fade"]:not(.is-initialized) .splide__list > :not(:first-child) {
113
+ visibility: hidden;
114
+ }
115
+ /* Without JavaScript every item stays reachable by scrolling sideways. */
116
+ @media (scripting: none) {
117
+ .flowpress-carousel .splide__track {
118
+ overflow-x: auto;
119
+ scroll-snap-type: x mandatory;
120
+ }
121
+ .flowpress-carousel .splide__list {
122
+ transform: none;
123
+ }
124
+ .flowpress-carousel .splide__list > * {
125
+ scroll-snap-align: start;
126
+ visibility: visible;
127
+ }
128
+ .flowpress-carousel [data-flowpress-carousel-controls],
129
+ .flowpress-carousel .splide__pagination,
130
+ .flowpress-carousel .flowpress-carousel__counter {
131
+ display: none;
132
+ }
133
+ }
134
+
135
+ /* Controls: a transparent hit area around a StyleFlow-coloured icon. */
136
+ .flowpress-carousel[data-arrows-size="sm"] { --flowpress-carousel-arrow-size: 2rem; }
137
+ .flowpress-carousel[data-arrows-size="lg"] { --flowpress-carousel-arrow-size: 3rem; }
138
+ .flowpress-carousel[data-arrows-shape="rounded"] { --flowpress-carousel-arrow-radius: var(--sf-layout-control-regular-radius, 0.5rem); }
139
+ .flowpress-carousel[data-arrows-shape="square"] { --flowpress-carousel-arrow-radius: 0; }
140
+ /* Rows without a control collapse: spacing sits on the controls, never on the grid. */
141
+ .flowpress-carousel .splide__arrows {
142
+ grid-area: arrows;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: space-between;
146
+ gap: 0.5rem;
147
+ margin: 0 0 0.75rem;
148
+ }
149
+ .flowpress-carousel .splide__arrow {
150
+ display: grid;
151
+ place-items: center;
152
+ margin: 0;
153
+ padding: 0;
154
+ border: 0;
155
+ background: none;
156
+ color: var(--flowpress-carousel-icon-fg);
157
+ cursor: pointer;
158
+ }
159
+ .flowpress-carousel .flowpress-carousel__icon {
160
+ display: grid;
161
+ place-items: center;
162
+ inline-size: var(--flowpress-carousel-arrow-size);
163
+ block-size: var(--flowpress-carousel-arrow-size);
164
+ border-radius: var(--flowpress-carousel-arrow-radius);
165
+ background: var(--flowpress-carousel-control-bg, transparent);
166
+ color: var(--flowpress-carousel-icon-fg);
167
+ }
168
+ .flowpress-carousel .flowpress-carousel__icon svg {
169
+ inline-size: 45%;
170
+ block-size: 45%;
171
+ }
172
+ .flowpress-carousel .splide__arrow:disabled {
173
+ opacity: 0.45;
174
+ cursor: default;
175
+ }
176
+ .flowpress-carousel .splide__arrow:focus-visible {
177
+ outline: none;
178
+ }
179
+ .flowpress-carousel .splide__arrow:focus-visible .flowpress-carousel__icon,
180
+ .flowpress-carousel .splide__pagination__page:focus-visible,
181
+ .flowpress-carousel .splide__toggle:focus-visible {
182
+ outline: 3px solid var(--flowpress-carousel-icon-fg);
183
+ outline-offset: 3px;
184
+ }
185
+
186
+ .flowpress-carousel[data-arrows="top-end"] .splide__arrows { justify-content: flex-end; }
187
+ .flowpress-carousel:is([data-arrows="bottom"], [data-arrows="bottom-end"]) {
188
+ grid-template-areas: "track" "arrows" "pagination";
189
+ }
190
+ .flowpress-carousel:is([data-arrows="bottom"], [data-arrows="bottom-end"]) .splide__arrows {
191
+ margin: 0.75rem 0 0;
192
+ }
193
+ .flowpress-carousel[data-arrows="bottom"] .splide__arrows { justify-content: center; }
194
+ .flowpress-carousel[data-arrows="bottom-end"] .splide__arrows { justify-content: flex-end; }
195
+ /* Arrows over the slides: they share the track's grid area. */
196
+ .flowpress-carousel:is([data-arrows="sides"], [data-arrows="edges"]) .splide__arrows {
197
+ grid-area: track;
198
+ z-index: 2;
199
+ margin: 0;
200
+ pointer-events: none;
201
+ }
202
+ .flowpress-carousel:is([data-arrows="sides"], [data-arrows="edges"]) .splide__arrow {
203
+ pointer-events: auto;
204
+ }
205
+ .flowpress-carousel[data-arrows="sides"] .splide__arrows {
206
+ padding-inline: 0.75rem;
207
+ }
208
+ .flowpress-carousel[data-arrows="edges"] .splide__arrows {
209
+ align-items: stretch;
210
+ }
211
+ .flowpress-carousel[data-arrows="edges"] .splide__arrow {
212
+ inline-size: clamp(var(--flowpress-carousel-arrow-size), var(--flowpress-carousel-edge), 6.25rem);
213
+ background: var(--flowpress-carousel-veil);
214
+ }
215
+ /* Arrows outside the slides: one column on each side of the track. */
216
+ .flowpress-carousel[data-arrows="outside"] {
217
+ grid-template-columns: auto minmax(0, 1fr) auto;
218
+ grid-template-areas: "prev track next" ". pagination .";
219
+ column-gap: 0.75rem;
220
+ }
221
+ .flowpress-carousel[data-arrows="outside"] .splide__arrows { display: contents; }
222
+ .flowpress-carousel[data-arrows="outside"] .splide__arrow--prev { grid-area: prev; }
223
+ .flowpress-carousel[data-arrows="outside"] .splide__arrow--next { grid-area: next; }
224
+
225
+ /* Below md the arrows can move under the slides or disappear (swipe stays available). */
226
+ @media (width < 48rem) {
227
+ .flowpress-carousel[data-arrows-mobile="hidden"] .splide__arrows {
228
+ display: none;
229
+ }
230
+ .flowpress-carousel[data-arrows-mobile="bottom"] {
231
+ grid-template-columns: minmax(0, 1fr);
232
+ grid-template-areas: "track" "arrows" "pagination";
233
+ column-gap: 0;
234
+ }
235
+ .flowpress-carousel[data-arrows-mobile="bottom"] .splide__arrows {
236
+ display: flex;
237
+ grid-area: arrows;
238
+ justify-content: center;
239
+ align-items: center;
240
+ margin: 0.75rem 0 0;
241
+ padding-inline: 0;
242
+ pointer-events: auto;
243
+ }
244
+ .flowpress-carousel[data-arrows-mobile="bottom"] .splide__arrow {
245
+ grid-area: auto;
246
+ inline-size: auto;
247
+ background: none;
248
+ }
249
+ }
250
+
251
+ /* Pagination: dots or bars in the controls colour, the active one in the context foreground. */
252
+ .flowpress-carousel .splide__pagination {
253
+ grid-area: pagination;
254
+ display: flex;
255
+ flex-wrap: wrap;
256
+ align-items: center;
257
+ justify-content: center;
258
+ gap: 0.5rem;
259
+ margin: 0.75rem 0 0;
260
+ padding: 0;
261
+ list-style: none;
262
+ }
263
+ .flowpress-carousel .splide__pagination li {
264
+ display: inline-flex;
265
+ margin: 0;
266
+ list-style: none;
267
+ }
268
+ .flowpress-carousel .splide__pagination__page {
269
+ inline-size: 0.625rem;
270
+ block-size: 0.625rem;
271
+ margin: 0;
272
+ padding: 0;
273
+ border: 0;
274
+ border-radius: var(--sf-layout-chip-regular-radius, 999px);
275
+ background: var(--flowpress-carousel-control-bg, var(--flowpress-carousel-veil));
276
+ cursor: pointer;
277
+ }
278
+ .flowpress-carousel .splide__pagination__page.is-active {
279
+ background: var(--flowpress-carousel-icon-fg);
280
+ }
281
+ .flowpress-carousel[data-pagination="bars"] .splide__pagination__page {
282
+ inline-size: 1.5rem;
283
+ block-size: 0.25rem;
284
+ border-radius: 0.125rem;
285
+ }
286
+ .flowpress-carousel .flowpress-carousel__counter {
287
+ grid-area: pagination;
288
+ justify-self: center;
289
+ margin-block-start: 0.75rem;
290
+ padding: 0.25rem 0.75rem;
291
+ border-radius: var(--sf-layout-chip-regular-radius, 999px);
292
+ background: var(--flowpress-carousel-control-bg, transparent);
293
+ color: var(--flowpress-carousel-icon-fg);
294
+ font-variant-numeric: tabular-nums;
295
+ }
296
+ .flowpress-carousel[data-pagination-position="overlay"] :is(.splide__pagination, .flowpress-carousel__counter) {
297
+ grid-area: track;
298
+ align-self: end;
299
+ z-index: 2;
300
+ margin-block: 0 0.75rem;
301
+ }
302
+
303
+ /* Autoplay play/pause control, always available while autoplay runs (WCAG 2.2.2). */
304
+ .flowpress-carousel .splide__toggle {
305
+ grid-area: pagination;
306
+ justify-self: end;
307
+ margin: 0.75rem 0 0;
308
+ padding: 0.25rem 0.75rem;
309
+ border: 0;
310
+ border-radius: var(--sf-layout-chip-regular-radius, 999px);
311
+ background: var(--flowpress-carousel-control-bg, transparent);
312
+ color: var(--flowpress-carousel-icon-fg);
313
+ cursor: pointer;
314
+ }
315
+ .flowpress-carousel .splide__toggle__pause { display: none; }
316
+ .flowpress-carousel .splide__toggle.is-active .splide__toggle__play { display: none; }
317
+ .flowpress-carousel .splide__toggle.is-active .splide__toggle__pause { display: inline; }
318
+
319
+ /* Invalid children: the content stays readable as a plain stack. */
320
+ .flowpress-carousel.flowpress-carousel--static {
321
+ grid-template-areas: none;
322
+ gap: var(--flowpress-carousel-gap, 24px);
323
+ }
@@ -1,7 +1,8 @@
1
1
  import type { FlowpressBlock, FlowpressBlockRendererProps } from "../../index.js";
2
2
  import type { LoopTemplateData } from "./query-loop.js";
3
3
  type SfCarouselAttributes = Record<string, any>;
4
- export type QueryCarouselSettings = Pick<SfCarouselAttributes, "ariaLabel" | "itemsPerViewBase" | "itemsPerViewSm" | "itemsPerViewMd" | "itemsPerViewLg" | "itemsPerViewXl" | "itemsPerView2xl" | "itemsPerMove" | "gap" | "showArrows" | "showPagination" | "drag" | "keyboard" | "autoplay" | "autoplayInterval" | "pauseOnHover" | "pauseOnFocus" | "loop" | "speed"> & {
4
+ type Responsive<Name extends string> = `${Name}${"Base" | "Sm" | "Md" | "Lg" | "Xl" | "2xl"}`;
5
+ export type QueryCarouselSettings = Pick<SfCarouselAttributes, "ariaLabel" | Responsive<"itemsPerView"> | Responsive<"slideWidth"> | Responsive<"peek"> | "focus" | "itemsPerMove" | "gap" | "slideAspectRatio" | "equalHeight" | "effect" | "loop" | "rewind" | "startIndex" | "speed" | "drag" | "dragFree" | "keyboard" | "wheel" | "showArrows" | "arrowsPosition" | "arrowsPositionMobile" | "arrowsShape" | "arrowsSize" | "showPagination" | "paginationStyle" | "paginationPosition" | "controlsTone" | "controlsIntensity" | "autoplay" | "autoplayInterval" | "pauseOnHover" | "pauseOnFocus"> & {
5
6
  enabled: boolean;
6
7
  };
7
8
  export interface QueryCarouselData extends LoopTemplateData {
@@ -1 +1 @@
1
- {"version":3,"file":"query-carousel.d.ts","sourceRoot":"","sources":["../../../src/astro/native/query-carousel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,KAAK,oBAAoB,GAAG,MAA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AC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACjD;YACD,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,IAAI,EAAE,kBAAkB;gBACxB,UAAU,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,QAAQ,IAAI,CAAC,EAAE,EAAE,EACpE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBACjD,YAAY,EAAE,EAAE;gBAChB,SAAS,EAAE,EAAE;gBACb,WAAW,EAAE,IAAI,CAAC,MAAM;aACzB,CAAC,CAAC;SACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["// PILOT — Render-only adaptation of native Query Loop results. No new query.\nimport type { FlowpressBlock, FlowpressBlockRendererProps } from \"../../index.js\";\nimport type { LoopTemplateData } from \"./query-loop.js\";\ntype SfCarouselAttributes = Record<string, any>;\n\nexport type QueryCarouselSettings = Pick<SfCarouselAttributes,\n \"ariaLabel\" | \"itemsPerViewBase\" | \"itemsPerViewSm\" | \"itemsPerViewMd\" |\n \"itemsPerViewLg\" | \"itemsPerViewXl\" | \"itemsPerView2xl\" | \"itemsPerMove\" |\n \"gap\" | \"showArrows\" | \"showPagination\" | \"drag\" | \"keyboard\" | \"autoplay\" |\n \"autoplayInterval\" | \"pauseOnHover\" | \"pauseOnFocus\" | \"loop\" | \"speed\"\n> & { enabled: boolean };\n\nexport interface QueryCarouselData extends LoopTemplateData {\n sfQueryCarousel?: QueryCarouselSettings;\n}\n\nconst classNames = (...values: unknown[]) => [...new Set(values.flatMap((value) =>\n String(value ?? \"\").split(/\\s+/)).filter(Boolean))].join(\" \");\n\n// Remove this template's former grid decorations, retaining its placement in\n// a parent grid. Saved content and resolved card blocks are never mutated.\nconst withoutOwnGridClasses = (value: unknown) => String(value ?? \"\").split(/\\s+/)\n .filter((token) => !/^(?:fp-grid$|fp-cols-|fp-align-|is-layout-grid$|columns-\\d+$)/.test(token)).join(\" \");\n\nexport function queryCarouselBlocks(props: Pick<FlowpressBlockRendererProps,\n \"block\" | \"htmlProps\" | \"styleflowProps\"\n>): FlowpressBlock[] | undefined {\n const { block, htmlProps, styleflowProps } = props;\n const data = (block.resolvedData ?? {}) as QueryCarouselData;\n if (data.sfQueryCarousel?.enabled !== true) return undefined;\n const items = data.items ?? [];\n if (items.length === 0) return [];\n const { layout: _layout, style: _style, metadata: _metadata, ...attributes } = block.attributes;\n const { enabled: _enabled, ...settings } = data.sfQueryCarousel;\n return [{\n name: \"sf/carousel\",\n attributes: {\n ...attributes, ...styleflowProps, ...settings,\n // The official carousel renderer derives props from these attributes.\n ...((htmlProps.id ?? attributes.anchor) ? {anchor: String(htmlProps.id ?? attributes.anchor)} : {}),\n className: classNames(\"flowpress-query-carousel\", withoutOwnGridClasses(attributes.className),\n withoutOwnGridClasses(htmlProps.class)),\n ...(attributes.noGap === true ? { gap: 0 } : {}),\n },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: items.map((item) => ({\n name: \"sf/carousel-item\",\n attributes: { className: classNames(\"wp-block-post\", `post-${item.id}`,\n item.postType ? `type-${item.postType}` : \"\") },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: item.blocks,\n })),\n }];\n}\n"]}
1
+ {"version":3,"file":"query-carousel.js","sourceRoot":"","sources":["../../../src/astro/native/query-carousel.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,GAAG,CAAC,GAAG,MAAiB,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAChF,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,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AM,CAAC,SAAS,CAAC,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnG,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,UAAU,CAAC,SAAS,CAAC,EAC3F,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACzC,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACjD;YACD,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,IAAI,EAAE,kBAAkB;gBACxB,UAAU,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,QAAQ,IAAI,CAAC,EAAE,EAAE,EACpE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBACjD,YAAY,EAAE,EAAE;gBAChB,SAAS,EAAE,EAAE;gBACb,WAAW,EAAE,IAAI,CAAC,MAAM;aACzB,CAAC,CAAC;SACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["// PILOT — Render-only adaptation of native Query Loop results. No new query.\nimport type { FlowpressBlock, FlowpressBlockRendererProps } from \"../../index.js\";\nimport type { LoopTemplateData } from \"./query-loop.js\";\ntype SfCarouselAttributes = Record<string, any>;\n\ntype Responsive<Name extends string> = `${Name}${\"Base\" | \"Sm\" | \"Md\" | \"Lg\" | \"Xl\" | \"2xl\"}`;\n\nexport type QueryCarouselSettings = Pick<SfCarouselAttributes,\n \"ariaLabel\" | Responsive<\"itemsPerView\"> | Responsive<\"slideWidth\"> | Responsive<\"peek\"> |\n \"focus\" | \"itemsPerMove\" | \"gap\" | \"slideAspectRatio\" | \"equalHeight\" | \"effect\" | \"loop\" |\n \"rewind\" | \"startIndex\" | \"speed\" | \"drag\" | \"dragFree\" | \"keyboard\" | \"wheel\" |\n \"showArrows\" | \"arrowsPosition\" | \"arrowsPositionMobile\" | \"arrowsShape\" | \"arrowsSize\" |\n \"showPagination\" | \"paginationStyle\" | \"paginationPosition\" | \"controlsTone\" |\n \"controlsIntensity\" | \"autoplay\" | \"autoplayInterval\" | \"pauseOnHover\" | \"pauseOnFocus\"\n> & { enabled: boolean };\n\nexport interface QueryCarouselData extends LoopTemplateData {\n sfQueryCarousel?: QueryCarouselSettings;\n}\n\nconst classNames = (...values: unknown[]) => [...new Set(values.flatMap((value) =>\n String(value ?? \"\").split(/\\s+/)).filter(Boolean))].join(\" \");\n\n// Remove this template's former grid decorations, retaining its placement in\n// a parent grid. Saved content and resolved card blocks are never mutated.\nconst withoutOwnGridClasses = (value: unknown) => String(value ?? \"\").split(/\\s+/)\n .filter((token) => !/^(?:fp-grid$|fp-cols-|fp-align-|is-layout-grid$|columns-\\d+$)/.test(token)).join(\" \");\n\nexport function queryCarouselBlocks(props: Pick<FlowpressBlockRendererProps,\n \"block\" | \"htmlProps\" | \"styleflowProps\"\n>): FlowpressBlock[] | undefined {\n const { block, htmlProps, styleflowProps } = props;\n const data = (block.resolvedData ?? {}) as QueryCarouselData;\n if (data.sfQueryCarousel?.enabled !== true) return undefined;\n const items = data.items ?? [];\n if (items.length === 0) return [];\n const { layout: _layout, style: _style, metadata: _metadata, ...attributes } = block.attributes;\n const { enabled: _enabled, ...settings } = data.sfQueryCarousel;\n return [{\n name: \"sf/carousel\",\n attributes: {\n ...attributes, ...styleflowProps, ...settings,\n // The official carousel renderer derives props from these attributes.\n ...((htmlProps.id ?? attributes.anchor) ? {anchor: String(htmlProps.id ?? attributes.anchor)} : {}),\n className: classNames(\"flowpress-query-carousel\", withoutOwnGridClasses(attributes.className),\n withoutOwnGridClasses(htmlProps.class)),\n ...(attributes.noGap === true ? { gap: 0 } : {}),\n },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: items.map((item) => ({\n name: \"sf/carousel-item\",\n attributes: { className: classNames(\"wp-block-post\", `post-${item.id}`,\n item.postType ? `type-${item.postType}` : \"\") },\n resolvedData: {},\n innerHtml: \"\",\n innerBlocks: item.blocks,\n })),\n }];\n}\n"]}
@@ -3,11 +3,15 @@ import type { FlowpressBlock, FlowpressBlockRendererProps } from "../../index.js
3
3
  import type { LoopTemplateData } from "./query-loop.js";
4
4
  type SfCarouselAttributes = Record<string, any>;
5
5
 
6
+ type Responsive<Name extends string> = `${Name}${"Base" | "Sm" | "Md" | "Lg" | "Xl" | "2xl"}`;
7
+
6
8
  export type QueryCarouselSettings = Pick<SfCarouselAttributes,
7
- "ariaLabel" | "itemsPerViewBase" | "itemsPerViewSm" | "itemsPerViewMd" |
8
- "itemsPerViewLg" | "itemsPerViewXl" | "itemsPerView2xl" | "itemsPerMove" |
9
- "gap" | "showArrows" | "showPagination" | "drag" | "keyboard" | "autoplay" |
10
- "autoplayInterval" | "pauseOnHover" | "pauseOnFocus" | "loop" | "speed"
9
+ "ariaLabel" | Responsive<"itemsPerView"> | Responsive<"slideWidth"> | Responsive<"peek"> |
10
+ "focus" | "itemsPerMove" | "gap" | "slideAspectRatio" | "equalHeight" | "effect" | "loop" |
11
+ "rewind" | "startIndex" | "speed" | "drag" | "dragFree" | "keyboard" | "wheel" |
12
+ "showArrows" | "arrowsPosition" | "arrowsPositionMobile" | "arrowsShape" | "arrowsSize" |
13
+ "showPagination" | "paginationStyle" | "paginationPosition" | "controlsTone" |
14
+ "controlsIntensity" | "autoplay" | "autoplayInterval" | "pauseOnHover" | "pauseOnFocus"
11
15
  > & { enabled: boolean };
12
16
 
13
17
  export interface QueryCarouselData extends LoopTemplateData {
@@ -1,22 +1,72 @@
1
1
  import type { Options } from "@splidejs/splide";
2
- declare const BREAKPOINTS: readonly ["base", "sm", "md", "lg", "xl", "2xl"];
2
+ export declare const CAROUSEL_BREAKPOINTS: readonly ["base", "sm", "md", "lg", "xl", "2xl"];
3
+ export type CarouselBreakpoint = (typeof CAROUSEL_BREAKPOINTS)[number];
4
+ declare const ARROWS_POSITIONS: readonly ["top", "top-end", "sides", "edges", "outside", "bottom", "bottom-end"];
5
+ declare const ARROWS_MOBILE_POSITIONS: readonly ["same", "bottom", "hidden"];
6
+ declare const ARROWS_SHAPES: readonly ["circle", "rounded", "square"];
7
+ declare const ARROWS_SIZES: readonly ["sm", "md", "lg"];
8
+ declare const PAGINATION_STYLES: readonly ["dots", "bars", "fraction"];
9
+ declare const PAGINATION_POSITIONS: readonly ["below", "overlay"];
10
+ /** Peek keyword aligned with the StyleFlow container padding. */
11
+ export declare const CAROUSEL_CONTAINER_PEEK = "var(--sf-layout-container-comfortable-padding-x, 2rem)";
3
12
  export interface FlowpressCarouselSettings {
4
13
  ariaLabel: string;
5
- itemsPerView: Record<(typeof BREAKPOINTS)[number], number>;
14
+ itemsPerView: Record<CarouselBreakpoint, number>;
15
+ /** Fixed slide width per breakpoint; "" sizes slides from `itemsPerView`. */
16
+ slideWidth: Record<CarouselBreakpoint, string>;
17
+ /** Visible part of the neighbouring slides per breakpoint, as a CSS length ("0" for none). */
18
+ peek: Record<CarouselBreakpoint, string>;
19
+ focus: "start" | "center";
6
20
  itemsPerMove: number;
7
21
  gap: number;
8
- showArrows: boolean;
9
- showPagination: boolean;
22
+ slideAspectRatio: string;
23
+ equalHeight: boolean;
24
+ effect: "slide" | "fade";
25
+ loop: boolean;
26
+ rewind: boolean;
27
+ startIndex: number;
28
+ speed: number;
10
29
  drag: boolean;
30
+ dragFree: boolean;
11
31
  keyboard: boolean;
32
+ wheel: boolean;
33
+ showArrows: boolean;
34
+ arrowsPosition: (typeof ARROWS_POSITIONS)[number];
35
+ arrowsPositionMobile: (typeof ARROWS_MOBILE_POSITIONS)[number];
36
+ arrowsShape: (typeof ARROWS_SHAPES)[number];
37
+ arrowsSize: (typeof ARROWS_SIZES)[number];
38
+ showPagination: boolean;
39
+ paginationStyle: (typeof PAGINATION_STYLES)[number];
40
+ paginationPosition: (typeof PAGINATION_POSITIONS)[number];
41
+ /** StyleFlow tone and intensity of the controls' background; "" keeps the carousel's context. */
42
+ controlsTone: string;
43
+ controlsIntensity: string;
12
44
  autoplay: boolean;
13
45
  autoplayInterval: number;
14
46
  pauseOnHover: boolean;
15
47
  pauseOnFocus: boolean;
16
- loop: boolean;
17
- speed: number;
48
+ }
49
+ export interface FlowpressCarouselLayout {
50
+ /** Custom properties for the carousel root, read by the shared carousel stylesheet. */
51
+ style: Record<string, string>;
52
+ /** `data-*` attributes for the carousel root. */
53
+ data: Record<string, string>;
18
54
  }
19
55
  export declare function carouselSettings(attributes: Record<string, unknown>): FlowpressCarouselSettings;
56
+ /** CSS length of a peek setting. */
57
+ export declare function carouselPeekLength(peek: string): string;
58
+ /**
59
+ * Splide options. Options for settings that keep their previous defaults are left out, so a
60
+ * carousel saved with the original contract mounts with exactly the options it had before.
61
+ */
20
62
  export declare function carouselOptions(settings: FlowpressCarouselSettings): Options;
63
+ /**
64
+ * Static geometry shared by the frontend before Splide mounts and by the block editor: the same
65
+ * slide widths, peeks and centring Splide applies at rest. Percentages in `slide` and `shift`
66
+ * resolve against the list, those in `edge` against the carousel root.
67
+ */
68
+ export declare function carouselLayout(settings: FlowpressCarouselSettings): FlowpressCarouselLayout;
69
+ /** Inline `style` text of a layout. */
70
+ export declare function carouselStyleText(layout: FlowpressCarouselLayout): string;
21
71
  export {};
22
72
  //# sourceMappingURL=carousel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,QAAA,MAAM,WAAW,kDAAmD,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC,CAAC,OAA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ClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAsED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,yBAAyB,CAyD3B;AAED,oCAAoC;AACpC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAgBD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAyD5E;AAID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,uBAAuB,CAmD3F;AAED,uCAAuC;AACvC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAEzE"}
package/dist/carousel.js CHANGED
@@ -1,27 +1,74 @@
1
- const BREAKPOINTS = ["base", "sm", "md", "lg", "xl", "2xl"];
2
- function boundedNumber(value, fallback, min, max) {
1
+ export const CAROUSEL_BREAKPOINTS = ["base", "sm", "md", "lg", "xl", "2xl"];
2
+ /** Splide breakpoints (min-width, px); the static CSS uses the same values in rem. */
3
+ const BREAKPOINT_WIDTHS = {
4
+ sm: 640,
5
+ md: 768,
6
+ lg: 1024,
7
+ xl: 1280,
8
+ "2xl": 1536
9
+ };
10
+ const ARROWS_POSITIONS = ["top", "top-end", "sides", "edges", "outside", "bottom", "bottom-end"];
11
+ const ARROWS_MOBILE_POSITIONS = ["same", "bottom", "hidden"];
12
+ const ARROWS_SHAPES = ["circle", "rounded", "square"];
13
+ const ARROWS_SIZES = ["sm", "md", "lg"];
14
+ const PAGINATION_STYLES = ["dots", "bars", "fraction"];
15
+ const PAGINATION_POSITIONS = ["below", "overlay"];
16
+ const ASPECT_RATIOS = ["1/1", "4/5", "3/4", "2/3", "4/3", "3/2", "16/9", "21/9"];
17
+ /** Peek keyword aligned with the StyleFlow container padding. */
18
+ export const CAROUSEL_CONTAINER_PEEK = "var(--sf-layout-container-comfortable-padding-x, 2rem)";
19
+ function boundedNumber(value, fallback, min, max, decimals = 0) {
3
20
  if (value === "" || value === null || value === undefined || value === "inherit") {
4
21
  return fallback;
5
22
  }
6
23
  const numeric = Number(value);
24
+ const factor = 10 ** decimals;
7
25
  return Number.isFinite(numeric)
8
- ? Math.min(max, Math.max(min, Math.round(numeric)))
26
+ ? Math.min(max, Math.max(min, Math.round(numeric * factor) / factor))
9
27
  : fallback;
10
28
  }
11
29
  function booleanValue(value, fallback) {
12
30
  return typeof value === "boolean" ? value : fallback;
13
31
  }
32
+ function choice(value, choices, fallback) {
33
+ return choices.includes(value) ? value : fallback;
34
+ }
35
+ function token(value) {
36
+ return typeof value === "string" && /^[a-z0-9-]+$/.test(value) && value !== "inherit" ? value : "";
37
+ }
38
+ const suffix = (breakpoint) => breakpoint === "base"
39
+ ? "Base"
40
+ : breakpoint === "2xl"
41
+ ? "2xl"
42
+ : breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1);
43
+ const isLength = (value) => typeof value === "string" && /^(?:0|\d+(?:\.\d+)?(?:rem|px|%|vw))$/.test(value);
44
+ /**
45
+ * Resolves a responsive string field: an empty value inherits from the smaller breakpoint and an
46
+ * invalid one does too. `reset` (if given) is the value that clears an inherited setting.
47
+ */
48
+ function responsiveStrings(attributes, name, base, accept, reset) {
49
+ const values = {};
50
+ let inherited = base;
51
+ for (const breakpoint of CAROUSEL_BREAKPOINTS) {
52
+ const raw = attributes[`${name}${suffix(breakpoint)}`];
53
+ const value = reset !== undefined && raw === reset
54
+ ? ""
55
+ : accept(raw)
56
+ ? raw
57
+ : breakpoint === "base"
58
+ ? base
59
+ : inherited;
60
+ values[breakpoint] = value;
61
+ inherited = value;
62
+ }
63
+ return values;
64
+ }
65
+ const isPeek = (value) => value === "container" || isLength(value);
14
66
  export function carouselSettings(attributes) {
15
67
  const defaults = { base: 1, sm: 1, md: 2, lg: 3, xl: 3, "2xl": 3 };
16
68
  const values = {};
17
69
  let inherited = defaults.base;
18
- for (const breakpoint of BREAKPOINTS) {
19
- const suffix = breakpoint === "base"
20
- ? "Base"
21
- : breakpoint === "2xl"
22
- ? "2xl"
23
- : breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1);
24
- const raw = attributes[`itemsPerView${suffix}`];
70
+ for (const breakpoint of CAROUSEL_BREAKPOINTS) {
71
+ const raw = attributes[`itemsPerView${suffix(breakpoint)}`];
25
72
  const fallback = breakpoint !== "base" && (raw === "" || raw === "inherit")
26
73
  ? inherited
27
74
  : breakpoint === "base"
@@ -29,41 +76,95 @@ export function carouselSettings(attributes) {
29
76
  : breakpoint === "md" || breakpoint === "lg"
30
77
  ? defaults[breakpoint]
31
78
  : inherited;
32
- const value = boundedNumber(raw, fallback, 1, 12);
79
+ const value = boundedNumber(raw, fallback, 1, 12, 2);
33
80
  values[breakpoint] = value;
34
81
  inherited = value;
35
82
  }
36
83
  const ariaLabel = typeof attributes.ariaLabel === "string"
37
84
  ? attributes.ariaLabel.trim()
38
85
  : "";
86
+ const aspect = attributes.slideAspectRatio;
39
87
  return {
40
88
  ariaLabel: ariaLabel || "Carosello",
41
89
  itemsPerView: values,
90
+ slideWidth: responsiveStrings(attributes, "slideWidth", "", isLength, "auto"),
91
+ peek: responsiveStrings(attributes, "peek", "0", isPeek),
92
+ focus: choice(attributes.focus, ["start", "center"], "start"),
42
93
  itemsPerMove: boundedNumber(attributes.itemsPerMove, 1, 1, 12),
43
94
  gap: boundedNumber(attributes.gap, 24, 0, 128),
44
- showArrows: booleanValue(attributes.showArrows, true),
45
- showPagination: booleanValue(attributes.showPagination, true),
95
+ slideAspectRatio: ASPECT_RATIOS.includes(aspect) ? String(aspect) : "",
96
+ equalHeight: booleanValue(attributes.equalHeight, false),
97
+ effect: choice(attributes.effect, ["slide", "fade"], "slide"),
98
+ loop: booleanValue(attributes.loop, false),
99
+ rewind: booleanValue(attributes.rewind, false),
100
+ startIndex: boundedNumber(attributes.startIndex, 0, 0, 99),
101
+ speed: boundedNumber(attributes.speed, 400, 0, 5000),
46
102
  drag: booleanValue(attributes.drag, true),
103
+ dragFree: booleanValue(attributes.dragFree, false),
47
104
  keyboard: booleanValue(attributes.keyboard, true),
105
+ wheel: booleanValue(attributes.wheel, false),
106
+ showArrows: booleanValue(attributes.showArrows, true),
107
+ arrowsPosition: choice(attributes.arrowsPosition, ARROWS_POSITIONS, "top"),
108
+ arrowsPositionMobile: choice(attributes.arrowsPositionMobile, ARROWS_MOBILE_POSITIONS, "same"),
109
+ arrowsShape: choice(attributes.arrowsShape, ARROWS_SHAPES, "circle"),
110
+ arrowsSize: choice(attributes.arrowsSize, ARROWS_SIZES, "md"),
111
+ showPagination: booleanValue(attributes.showPagination, true),
112
+ paginationStyle: choice(attributes.paginationStyle, PAGINATION_STYLES, "dots"),
113
+ paginationPosition: choice(attributes.paginationPosition, PAGINATION_POSITIONS, "below"),
114
+ controlsTone: token(attributes.controlsTone),
115
+ controlsIntensity: token(attributes.controlsIntensity),
48
116
  autoplay: booleanValue(attributes.autoplay, false),
49
117
  autoplayInterval: boundedNumber(attributes.autoplayInterval, 5000, 1000, 60000),
50
118
  pauseOnHover: booleanValue(attributes.pauseOnHover, true),
51
- pauseOnFocus: booleanValue(attributes.pauseOnFocus, true),
52
- loop: booleanValue(attributes.loop, false),
53
- speed: boundedNumber(attributes.speed, 400, 0, 5000)
119
+ pauseOnFocus: booleanValue(attributes.pauseOnFocus, true)
54
120
  };
55
121
  }
122
+ /** CSS length of a peek setting. */
123
+ export function carouselPeekLength(peek) {
124
+ return peek === "container" ? CAROUSEL_CONTAINER_PEEK : peek;
125
+ }
126
+ function perPage(settings, breakpoint) {
127
+ return settings.effect === "fade" ? 1 : settings.itemsPerView[breakpoint];
128
+ }
129
+ function fixedWidth(settings, breakpoint) {
130
+ return settings.effect === "fade" ? "" : settings.slideWidth[breakpoint];
131
+ }
132
+ function padding(settings, breakpoint) {
133
+ const peek = settings.effect === "fade" ? "0" : carouselPeekLength(settings.peek[breakpoint]);
134
+ if (peek === "0")
135
+ return { left: 0, right: 0 };
136
+ return settings.focus === "center" ? { left: peek, right: peek } : { left: 0, right: peek };
137
+ }
138
+ /**
139
+ * Splide options. Options for settings that keep their previous defaults are left out, so a
140
+ * carousel saved with the original contract mounts with exactly the options it had before.
141
+ */
56
142
  export function carouselOptions(settings) {
143
+ const fade = settings.effect === "fade";
144
+ const usesWidth = CAROUSEL_BREAKPOINTS.some((breakpoint) => fixedWidth(settings, breakpoint) !== "");
145
+ const usesPadding = CAROUSEL_BREAKPOINTS.some((breakpoint) => padding(settings, breakpoint).right !== 0);
146
+ const sizing = (breakpoint) => ({
147
+ perPage: perPage(settings, breakpoint),
148
+ ...(usesWidth ? { fixedWidth: fixedWidth(settings, breakpoint) || 0 } : {}),
149
+ ...(usesPadding ? { padding: padding(settings, breakpoint) } : {})
150
+ });
151
+ const breakpoints = Object.fromEntries(Object.entries(BREAKPOINT_WIDTHS)
152
+ .map(([breakpoint, width]) => [width, sizing(breakpoint)]));
57
153
  return {
58
154
  label: settings.ariaLabel,
59
- type: settings.loop ? "loop" : "slide",
60
- perPage: settings.itemsPerView.base,
155
+ type: fade ? "fade" : settings.loop ? "loop" : "slide",
156
+ ...sizing("base"),
61
157
  perMove: settings.itemsPerMove,
62
158
  gap: `${settings.gap}px`,
159
+ ...(settings.focus === "center" && !fade ? { focus: "center", trimSpace: false } : {}),
160
+ ...(settings.rewind || (fade && settings.loop) ? { rewind: true } : {}),
161
+ ...(settings.startIndex > 0 ? { start: settings.startIndex } : {}),
63
162
  arrows: settings.showArrows,
64
- pagination: settings.showPagination,
65
- drag: settings.drag,
163
+ pagination: settings.showPagination && settings.paginationStyle !== "fraction",
164
+ drag: settings.drag && settings.dragFree ? "free" : settings.drag,
165
+ ...(settings.drag && settings.dragFree ? { snap: true } : {}),
66
166
  keyboard: settings.keyboard ? "focused" : false,
167
+ ...(settings.wheel ? { wheel: true } : {}),
67
168
  autoplay: settings.autoplay,
68
169
  interval: settings.autoplayInterval,
69
170
  pauseOnHover: settings.pauseOnHover,
@@ -71,13 +172,7 @@ export function carouselOptions(settings) {
71
172
  speed: settings.speed,
72
173
  live: true,
73
174
  mediaQuery: "min",
74
- breakpoints: {
75
- 640: { perPage: settings.itemsPerView.sm },
76
- 768: { perPage: settings.itemsPerView.md },
77
- 1024: { perPage: settings.itemsPerView.lg },
78
- 1280: { perPage: settings.itemsPerView.xl },
79
- 1536: { perPage: settings.itemsPerView["2xl"] }
80
- },
175
+ breakpoints,
81
176
  reducedMotion: {
82
177
  speed: 0,
83
178
  rewindSpeed: 0,
@@ -99,4 +194,65 @@ export function carouselOptions(settings) {
99
194
  }
100
195
  };
101
196
  }
197
+ const GAP = "var(--flowpress-carousel-gap)";
198
+ /**
199
+ * Static geometry shared by the frontend before Splide mounts and by the block editor: the same
200
+ * slide widths, peeks and centring Splide applies at rest. Percentages in `slide` and `shift`
201
+ * resolve against the list, those in `edge` against the carousel root.
202
+ */
203
+ export function carouselLayout(settings) {
204
+ const style = {
205
+ "--flowpress-carousel-gap": `${settings.gap}px`
206
+ };
207
+ for (const breakpoint of CAROUSEL_BREAKPOINTS) {
208
+ const count = perPage(settings, breakpoint);
209
+ const width = fixedWidth(settings, breakpoint);
210
+ const { left, right } = padding(settings, breakpoint);
211
+ const start = left === 0 ? "0px" : String(left);
212
+ const end = right === 0 ? "0px" : String(right);
213
+ const slide = width || `calc((100% + ${GAP}) / ${count} - ${GAP})`;
214
+ const centre = settings.focus === "center" && settings.effect !== "fade";
215
+ const offset = settings.startIndex > 0
216
+ ? ` - ${settings.startIndex} * (${slide} + ${GAP})`
217
+ : "";
218
+ // Width of the list once the root's peeks are removed, as a root percentage.
219
+ const list = `(100% - ${start} - ${end})`;
220
+ const rootSlide = width || `((${list} + ${GAP}) / ${count} - ${GAP})`;
221
+ style[`--flowpress-carousel-${breakpoint}`] = String(count);
222
+ style[`--flowpress-carousel-slide-${breakpoint}`] = slide;
223
+ style[`--flowpress-carousel-peek-start-${breakpoint}`] = start;
224
+ style[`--flowpress-carousel-peek-end-${breakpoint}`] = end;
225
+ style[`--flowpress-carousel-shift-${breakpoint}`] = centre || offset
226
+ ? `calc(${centre ? `(100% - ${slide}) / 2` : "0px"}${offset})`
227
+ : "0px";
228
+ style[`--flowpress-carousel-edge-${breakpoint}`] = centre
229
+ ? `calc(${start} + (${list} - ${rootSlide}) / 2 - ${GAP})`
230
+ : `calc(${end} - ${GAP})`;
231
+ }
232
+ if (settings.slideAspectRatio)
233
+ style["--flowpress-carousel-aspect"] = settings.slideAspectRatio;
234
+ if (settings.controlsTone) {
235
+ style["--flowpress-carousel-control-bg"] =
236
+ `var(--sf-color-${settings.controlsTone}-${settings.controlsIntensity || "base"}-default-background)`;
237
+ }
238
+ return {
239
+ style,
240
+ data: {
241
+ "data-focus": settings.effect === "fade" ? "start" : settings.focus,
242
+ "data-effect": settings.effect,
243
+ "data-arrows": settings.arrowsPosition,
244
+ "data-arrows-mobile": settings.arrowsPositionMobile,
245
+ "data-arrows-shape": settings.arrowsShape,
246
+ "data-arrows-size": settings.arrowsSize,
247
+ "data-pagination": settings.paginationStyle,
248
+ "data-pagination-position": settings.paginationPosition,
249
+ ...(settings.slideAspectRatio ? { "data-aspect": "" } : {}),
250
+ ...(settings.equalHeight ? { "data-equal-height": "" } : {})
251
+ }
252
+ };
253
+ }
254
+ /** Inline `style` text of a layout. */
255
+ export function carouselStyleText(layout) {
256
+ return Object.entries(layout.style).map(([name, value]) => `${name}:${value}`).join(";");
257
+ }
102
258
  //# sourceMappingURL=carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AAE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E,QAAQ,CAAC,YAAY;QACnC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE;YACX,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE;YAC1C,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE;YAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE;YAC3C,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE;YAC3C,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;SAChD;QACD,aAAa,EAAE;YACb,KAAK,EAAE,CAAC;YACR,WAAW,EAAE,CAAC;YACd,QAAQ,EAAE,OAAO;SAClB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,sBAAsB;YAC5B,MAAM,EAAE,mBAAmB;YAC3B,KAAK,EAAE,oBAAoB;YAC3B,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,gBAAgB;YACvB,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,iCAAiC;YACzC,UAAU,EAAE,UAAU;SACvB;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Options } from \"@splidejs/splide\";\n\nconst BREAKPOINTS = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\n\nexport interface FlowpressCarouselSettings {\n ariaLabel: string;\n itemsPerView: Record<(typeof BREAKPOINTS)[number], number>;\n itemsPerMove: number;\n gap: number;\n showArrows: boolean;\n showPagination: boolean;\n drag: boolean;\n keyboard: boolean;\n autoplay: boolean;\n autoplayInterval: number;\n pauseOnHover: boolean;\n pauseOnFocus: boolean;\n loop: boolean;\n speed: number;\n}\n\nfunction boundedNumber(\n value: unknown,\n fallback: number,\n min: number,\n max: number\n): number {\n if (value === \"\" || value === null || value === undefined || value === \"inherit\") {\n return fallback;\n }\n const numeric = Number(value);\n return Number.isFinite(numeric)\n ? Math.min(max, Math.max(min, Math.round(numeric)))\n : fallback;\n}\n\nfunction booleanValue(value: unknown, fallback: boolean): boolean {\n return typeof value === \"boolean\" ? value : fallback;\n}\n\nexport function carouselSettings(\n attributes: Record<string, unknown>\n): FlowpressCarouselSettings {\n const defaults = { base: 1, sm: 1, md: 2, lg: 3, xl: 3, \"2xl\": 3 };\n const values = {} as FlowpressCarouselSettings[\"itemsPerView\"];\n let inherited = defaults.base;\n for (const breakpoint of BREAKPOINTS) {\n const suffix = breakpoint === \"base\"\n ? \"Base\"\n : breakpoint === \"2xl\"\n ? \"2xl\"\n : breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1);\n const raw = attributes[`itemsPerView${suffix}`];\n const fallback = breakpoint !== \"base\" && (raw === \"\" || raw === \"inherit\")\n ? inherited\n : breakpoint === \"base\"\n ? defaults.base\n : breakpoint === \"md\" || breakpoint === \"lg\"\n ? defaults[breakpoint]\n : inherited;\n const value = boundedNumber(\n raw,\n fallback,\n 1,\n 12\n );\n values[breakpoint] = value;\n inherited = value;\n }\n\n const ariaLabel = typeof attributes.ariaLabel === \"string\"\n ? attributes.ariaLabel.trim()\n : \"\";\n\n return {\n ariaLabel: ariaLabel || \"Carosello\",\n itemsPerView: values,\n itemsPerMove: boundedNumber(attributes.itemsPerMove, 1, 1, 12),\n gap: boundedNumber(attributes.gap, 24, 0, 128),\n showArrows: booleanValue(attributes.showArrows, true),\n showPagination: booleanValue(attributes.showPagination, true),\n drag: booleanValue(attributes.drag, true),\n keyboard: booleanValue(attributes.keyboard, true),\n autoplay: booleanValue(attributes.autoplay, false),\n autoplayInterval: boundedNumber(attributes.autoplayInterval, 5000, 1000, 60000),\n pauseOnHover: booleanValue(attributes.pauseOnHover, true),\n pauseOnFocus: booleanValue(attributes.pauseOnFocus, true),\n loop: booleanValue(attributes.loop, false),\n speed: boundedNumber(attributes.speed, 400, 0, 5000)\n };\n}\n\nexport function carouselOptions(settings: FlowpressCarouselSettings): Options {\n return {\n label: settings.ariaLabel,\n type: settings.loop ? \"loop\" : \"slide\",\n perPage: settings.itemsPerView.base,\n perMove: settings.itemsPerMove,\n gap: `${settings.gap}px`,\n arrows: settings.showArrows,\n pagination: settings.showPagination,\n drag: settings.drag,\n keyboard: settings.keyboard ? \"focused\" : false,\n autoplay: settings.autoplay,\n interval: settings.autoplayInterval,\n pauseOnHover: settings.pauseOnHover,\n pauseOnFocus: settings.pauseOnFocus,\n speed: settings.speed,\n live: true,\n mediaQuery: \"min\",\n breakpoints: {\n 640: { perPage: settings.itemsPerView.sm },\n 768: { perPage: settings.itemsPerView.md },\n 1024: { perPage: settings.itemsPerView.lg },\n 1280: { perPage: settings.itemsPerView.xl },\n 1536: { perPage: settings.itemsPerView[\"2xl\"] }\n },\n reducedMotion: {\n speed: 0,\n rewindSpeed: 0,\n autoplay: \"pause\"\n },\n i18n: {\n prev: \"Slide precedente\",\n next: \"Slide successiva\",\n first: \"Vai alla prima slide\",\n last: \"Vai all'ultima slide\",\n slideX: \"Vai alla slide %s\",\n pageX: \"Vai alla pagina %s\",\n play: \"Avvia autoplay\",\n pause: \"Pausa autoplay\",\n carousel: \"carosello\",\n slide: \"slide\",\n select: \"Seleziona una slide da mostrare\",\n slideLabel: \"%s di %s\"\n }\n };\n}\n"]}
1
+ {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AAGrF,sFAAsF;AAC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AC3C,0BAA0B,EAAE,QAAQ,CAAC,kBAAkB;YACvD,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7D;KACF,CAAC;AACJ,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,iBAAiB,CAAC,MAA+B;IAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import type { Options } from \"@splidejs/splide\";\n\nexport const CAROUSEL_BREAKPOINTS = [\"base\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\"] as const;\nexport type CarouselBreakpoint = (typeof CAROUSEL_BREAKPOINTS)[number];\n\n/** Splide breakpoints (min-width, px); the static CSS uses the same values in rem. */\nconst BREAKPOINT_WIDTHS: Record<Exclude<CarouselBreakpoint, \"base\">, number> = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536\n};\n\nconst ARROWS_POSITIONS = [\"top\", \"top-end\", \"sides\", \"edges\", \"outside\", \"bottom\", \"bottom-end\"] as const;\nconst ARROWS_MOBILE_POSITIONS = [\"same\", \"bottom\", \"hidden\"] as const;\nconst ARROWS_SHAPES = [\"circle\", \"rounded\", \"square\"] as const;\nconst ARROWS_SIZES = [\"sm\", \"md\", \"lg\"] as const;\nconst PAGINATION_STYLES = [\"dots\", \"bars\", \"fraction\"] as const;\nconst PAGINATION_POSITIONS = [\"below\", \"overlay\"] as const;\nconst ASPECT_RATIOS = [\"1/1\", \"4/5\", \"3/4\", \"2/3\", \"4/3\", \"3/2\", \"16/9\", \"21/9\"] as const;\n\n/** Peek keyword aligned with the StyleFlow container padding. */\nexport const CAROUSEL_CONTAINER_PEEK = \"var(--sf-layout-container-comfortable-padding-x, 2rem)\";\n\nexport interface FlowpressCarouselSettings {\n ariaLabel: string;\n itemsPerView: Record<CarouselBreakpoint, number>;\n /** Fixed slide width per breakpoint; \"\" sizes slides from `itemsPerView`. */\n slideWidth: Record<CarouselBreakpoint, string>;\n /** Visible part of the neighbouring slides per breakpoint, as a CSS length (\"0\" for none). */\n peek: Record<CarouselBreakpoint, string>;\n focus: \"start\" | \"center\";\n itemsPerMove: number;\n gap: number;\n slideAspectRatio: string;\n equalHeight: boolean;\n effect: \"slide\" | \"fade\";\n loop: boolean;\n rewind: boolean;\n startIndex: number;\n speed: number;\n drag: boolean;\n dragFree: boolean;\n keyboard: boolean;\n wheel: boolean;\n showArrows: boolean;\n arrowsPosition: (typeof ARROWS_POSITIONS)[number];\n arrowsPositionMobile: (typeof ARROWS_MOBILE_POSITIONS)[number];\n arrowsShape: (typeof ARROWS_SHAPES)[number];\n arrowsSize: (typeof ARROWS_SIZES)[number];\n showPagination: boolean;\n paginationStyle: (typeof PAGINATION_STYLES)[number];\n paginationPosition: (typeof PAGINATION_POSITIONS)[number];\n /** StyleFlow tone and intensity of the controls' background; \"\" keeps the carousel's context. */\n controlsTone: string;\n controlsIntensity: string;\n autoplay: boolean;\n autoplayInterval: number;\n pauseOnHover: boolean;\n pauseOnFocus: boolean;\n}\n\nexport interface FlowpressCarouselLayout {\n /** Custom properties for the carousel root, read by the shared carousel stylesheet. */\n style: Record<string, string>;\n /** `data-*` attributes for the carousel root. */\n data: Record<string, string>;\n}\n\nfunction boundedNumber(\n value: unknown,\n fallback: number,\n min: number,\n max: number,\n decimals = 0\n): number {\n if (value === \"\" || value === null || value === undefined || value === \"inherit\") {\n return fallback;\n }\n const numeric = Number(value);\n const factor = 10 ** decimals;\n return Number.isFinite(numeric)\n ? Math.min(max, Math.max(min, Math.round(numeric * factor) / factor))\n : fallback;\n}\n\nfunction booleanValue(value: unknown, fallback: boolean): boolean {\n return typeof value === \"boolean\" ? value : fallback;\n}\n\nfunction choice<T extends string>(value: unknown, choices: readonly T[], fallback: T): T {\n return choices.includes(value as T) ? (value as T) : fallback;\n}\n\nfunction token(value: unknown): string {\n return typeof value === \"string\" && /^[a-z0-9-]+$/.test(value) && value !== \"inherit\" ? value : \"\";\n}\n\nconst suffix = (breakpoint: CarouselBreakpoint) => breakpoint === \"base\"\n ? \"Base\"\n : breakpoint === \"2xl\"\n ? \"2xl\"\n : breakpoint.charAt(0).toUpperCase() + breakpoint.slice(1);\n\nconst isLength = (value: unknown): value is string =>\n typeof value === \"string\" && /^(?:0|\\d+(?:\\.\\d+)?(?:rem|px|%|vw))$/.test(value);\n\n/**\n * Resolves a responsive string field: an empty value inherits from the smaller breakpoint and an\n * invalid one does too. `reset` (if given) is the value that clears an inherited setting.\n */\nfunction responsiveStrings(\n attributes: Record<string, unknown>,\n name: string,\n base: string,\n accept: (value: unknown) => value is string,\n reset?: string\n): Record<CarouselBreakpoint, string> {\n const values = {} as Record<CarouselBreakpoint, string>;\n let inherited = base;\n for (const breakpoint of CAROUSEL_BREAKPOINTS) {\n const raw = attributes[`${name}${suffix(breakpoint)}`];\n const value = reset !== undefined && raw === reset\n ? \"\"\n : accept(raw)\n ? raw\n : breakpoint === \"base\"\n ? base\n : inherited;\n values[breakpoint] = value;\n inherited = value;\n }\n return values;\n}\n\nconst isPeek = (value: unknown): value is string => value === \"container\" || isLength(value);\n\nexport function carouselSettings(\n attributes: Record<string, unknown>\n): FlowpressCarouselSettings {\n const defaults = { base: 1, sm: 1, md: 2, lg: 3, xl: 3, \"2xl\": 3 };\n const values = {} as FlowpressCarouselSettings[\"itemsPerView\"];\n let inherited = defaults.base;\n for (const breakpoint of CAROUSEL_BREAKPOINTS) {\n const raw = attributes[`itemsPerView${suffix(breakpoint)}`];\n const fallback = breakpoint !== \"base\" && (raw === \"\" || raw === \"inherit\")\n ? inherited\n : breakpoint === \"base\"\n ? defaults.base\n : breakpoint === \"md\" || breakpoint === \"lg\"\n ? defaults[breakpoint]\n : inherited;\n const value = boundedNumber(raw, fallback, 1, 12, 2);\n values[breakpoint] = value;\n inherited = value;\n }\n\n const ariaLabel = typeof attributes.ariaLabel === \"string\"\n ? attributes.ariaLabel.trim()\n : \"\";\n const aspect = attributes.slideAspectRatio;\n\n return {\n ariaLabel: ariaLabel || \"Carosello\",\n itemsPerView: values,\n slideWidth: responsiveStrings(attributes, \"slideWidth\", \"\", isLength, \"auto\"),\n peek: responsiveStrings(attributes, \"peek\", \"0\", isPeek),\n focus: choice(attributes.focus, [\"start\", \"center\"] as const, \"start\"),\n itemsPerMove: boundedNumber(attributes.itemsPerMove, 1, 1, 12),\n gap: boundedNumber(attributes.gap, 24, 0, 128),\n slideAspectRatio: ASPECT_RATIOS.includes(aspect as never) ? String(aspect) : \"\",\n equalHeight: booleanValue(attributes.equalHeight, false),\n effect: choice(attributes.effect, [\"slide\", \"fade\"] as const, \"slide\"),\n loop: booleanValue(attributes.loop, false),\n rewind: booleanValue(attributes.rewind, false),\n startIndex: boundedNumber(attributes.startIndex, 0, 0, 99),\n speed: boundedNumber(attributes.speed, 400, 0, 5000),\n drag: booleanValue(attributes.drag, true),\n dragFree: booleanValue(attributes.dragFree, false),\n keyboard: booleanValue(attributes.keyboard, true),\n wheel: booleanValue(attributes.wheel, false),\n showArrows: booleanValue(attributes.showArrows, true),\n arrowsPosition: choice(attributes.arrowsPosition, ARROWS_POSITIONS, \"top\"),\n arrowsPositionMobile: choice(attributes.arrowsPositionMobile, ARROWS_MOBILE_POSITIONS, \"same\"),\n arrowsShape: choice(attributes.arrowsShape, ARROWS_SHAPES, \"circle\"),\n arrowsSize: choice(attributes.arrowsSize, ARROWS_SIZES, \"md\"),\n showPagination: booleanValue(attributes.showPagination, true),\n paginationStyle: choice(attributes.paginationStyle, PAGINATION_STYLES, \"dots\"),\n paginationPosition: choice(attributes.paginationPosition, PAGINATION_POSITIONS, \"below\"),\n controlsTone: token(attributes.controlsTone),\n controlsIntensity: token(attributes.controlsIntensity),\n autoplay: booleanValue(attributes.autoplay, false),\n autoplayInterval: boundedNumber(attributes.autoplayInterval, 5000, 1000, 60000),\n pauseOnHover: booleanValue(attributes.pauseOnHover, true),\n pauseOnFocus: booleanValue(attributes.pauseOnFocus, true)\n };\n}\n\n/** CSS length of a peek setting. */\nexport function carouselPeekLength(peek: string): string {\n return peek === \"container\" ? CAROUSEL_CONTAINER_PEEK : peek;\n}\n\nfunction perPage(settings: FlowpressCarouselSettings, breakpoint: CarouselBreakpoint): number {\n return settings.effect === \"fade\" ? 1 : settings.itemsPerView[breakpoint];\n}\n\nfunction fixedWidth(settings: FlowpressCarouselSettings, breakpoint: CarouselBreakpoint): string {\n return settings.effect === \"fade\" ? \"\" : settings.slideWidth[breakpoint];\n}\n\nfunction padding(settings: FlowpressCarouselSettings, breakpoint: CarouselBreakpoint) {\n const peek = settings.effect === \"fade\" ? \"0\" : carouselPeekLength(settings.peek[breakpoint]);\n if (peek === \"0\") return { left: 0, right: 0 };\n return settings.focus === \"center\" ? { left: peek, right: peek } : { left: 0, right: peek };\n}\n\n/**\n * Splide options. Options for settings that keep their previous defaults are left out, so a\n * carousel saved with the original contract mounts with exactly the options it had before.\n */\nexport function carouselOptions(settings: FlowpressCarouselSettings): Options {\n const fade = settings.effect === \"fade\";\n const usesWidth = CAROUSEL_BREAKPOINTS.some((breakpoint) => fixedWidth(settings, breakpoint) !== \"\");\n const usesPadding = CAROUSEL_BREAKPOINTS.some((breakpoint) => padding(settings, breakpoint).right !== 0);\n const sizing = (breakpoint: CarouselBreakpoint) => ({\n perPage: perPage(settings, breakpoint),\n ...(usesWidth ? { fixedWidth: fixedWidth(settings, breakpoint) || 0 } : {}),\n ...(usesPadding ? { padding: padding(settings, breakpoint) } : {})\n });\n const breakpoints = Object.fromEntries(\n (Object.entries(BREAKPOINT_WIDTHS) as Array<[Exclude<CarouselBreakpoint, \"base\">, number]>)\n .map(([breakpoint, width]) => [width, sizing(breakpoint)])\n );\n\n return {\n label: settings.ariaLabel,\n type: fade ? \"fade\" : settings.loop ? \"loop\" : \"slide\",\n ...sizing(\"base\"),\n perMove: settings.itemsPerMove,\n gap: `${settings.gap}px`,\n ...(settings.focus === \"center\" && !fade ? { focus: \"center\" as const, trimSpace: false } : {}),\n ...(settings.rewind || (fade && settings.loop) ? { rewind: true } : {}),\n ...(settings.startIndex > 0 ? { start: settings.startIndex } : {}),\n arrows: settings.showArrows,\n pagination: settings.showPagination && settings.paginationStyle !== \"fraction\",\n drag: settings.drag && settings.dragFree ? \"free\" : settings.drag,\n ...(settings.drag && settings.dragFree ? { snap: true } : {}),\n keyboard: settings.keyboard ? \"focused\" : false,\n ...(settings.wheel ? { wheel: true } : {}),\n autoplay: settings.autoplay,\n interval: settings.autoplayInterval,\n pauseOnHover: settings.pauseOnHover,\n pauseOnFocus: settings.pauseOnFocus,\n speed: settings.speed,\n live: true,\n mediaQuery: \"min\",\n breakpoints,\n reducedMotion: {\n speed: 0,\n rewindSpeed: 0,\n autoplay: \"pause\"\n },\n i18n: {\n prev: \"Slide precedente\",\n next: \"Slide successiva\",\n first: \"Vai alla prima slide\",\n last: \"Vai all'ultima slide\",\n slideX: \"Vai alla slide %s\",\n pageX: \"Vai alla pagina %s\",\n play: \"Avvia autoplay\",\n pause: \"Pausa autoplay\",\n carousel: \"carosello\",\n slide: \"slide\",\n select: \"Seleziona una slide da mostrare\",\n slideLabel: \"%s di %s\"\n }\n };\n}\n\nconst GAP = \"var(--flowpress-carousel-gap)\";\n\n/**\n * Static geometry shared by the frontend before Splide mounts and by the block editor: the same\n * slide widths, peeks and centring Splide applies at rest. Percentages in `slide` and `shift`\n * resolve against the list, those in `edge` against the carousel root.\n */\nexport function carouselLayout(settings: FlowpressCarouselSettings): FlowpressCarouselLayout {\n const style: Record<string, string> = {\n \"--flowpress-carousel-gap\": `${settings.gap}px`\n };\n for (const breakpoint of CAROUSEL_BREAKPOINTS) {\n const count = perPage(settings, breakpoint);\n const width = fixedWidth(settings, breakpoint);\n const { left, right } = padding(settings, breakpoint);\n const start = left === 0 ? \"0px\" : String(left);\n const end = right === 0 ? \"0px\" : String(right);\n const slide = width || `calc((100% + ${GAP}) / ${count} - ${GAP})`;\n const centre = settings.focus === \"center\" && settings.effect !== \"fade\";\n const offset = settings.startIndex > 0\n ? ` - ${settings.startIndex} * (${slide} + ${GAP})`\n : \"\";\n // Width of the list once the root's peeks are removed, as a root percentage.\n const list = `(100% - ${start} - ${end})`;\n const rootSlide = width || `((${list} + ${GAP}) / ${count} - ${GAP})`;\n\n style[`--flowpress-carousel-${breakpoint}`] = String(count);\n style[`--flowpress-carousel-slide-${breakpoint}`] = slide;\n style[`--flowpress-carousel-peek-start-${breakpoint}`] = start;\n style[`--flowpress-carousel-peek-end-${breakpoint}`] = end;\n style[`--flowpress-carousel-shift-${breakpoint}`] = centre || offset\n ? `calc(${centre ? `(100% - ${slide}) / 2` : \"0px\"}${offset})`\n : \"0px\";\n style[`--flowpress-carousel-edge-${breakpoint}`] = centre\n ? `calc(${start} + (${list} - ${rootSlide}) / 2 - ${GAP})`\n : `calc(${end} - ${GAP})`;\n }\n if (settings.slideAspectRatio) style[\"--flowpress-carousel-aspect\"] = settings.slideAspectRatio;\n if (settings.controlsTone) {\n style[\"--flowpress-carousel-control-bg\"] =\n `var(--sf-color-${settings.controlsTone}-${settings.controlsIntensity || \"base\"}-default-background)`;\n }\n\n return {\n style,\n data: {\n \"data-focus\": settings.effect === \"fade\" ? \"start\" : settings.focus,\n \"data-effect\": settings.effect,\n \"data-arrows\": settings.arrowsPosition,\n \"data-arrows-mobile\": settings.arrowsPositionMobile,\n \"data-arrows-shape\": settings.arrowsShape,\n \"data-arrows-size\": settings.arrowsSize,\n \"data-pagination\": settings.paginationStyle,\n \"data-pagination-position\": settings.paginationPosition,\n ...(settings.slideAspectRatio ? { \"data-aspect\": \"\" } : {}),\n ...(settings.equalHeight ? { \"data-equal-height\": \"\" } : {})\n }\n };\n}\n\n/** Inline `style` text of a layout. */\nexport function carouselStyleText(layout: FlowpressCarouselLayout): string {\n return Object.entries(layout.style).map(([name, value]) => `${name}:${value}`).join(\";\");\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@styleflow.app/flowpress-astro-core",
3
- "version": "1.0.0-beta.43",
3
+ "version": "1.0.0-beta.44",
4
4
  "description": "Project-agnostic WordPress routing, templates, SEO and GraphQL runtime for FlowPress Astro apps.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -95,7 +95,7 @@
95
95
  "dependencies": {
96
96
  "@splidejs/splide": "4.1.4",
97
97
  "@styleflow.app/astro": "1.0.0-beta.11",
98
- "@styleflow.app/flowpress-components": "1.0.0-beta.16",
98
+ "@styleflow.app/flowpress-components": "1.0.0-beta.18",
99
99
  "entities": "8.1.0"
100
100
  },
101
101
  "peerDependencies": {