@styleflow.app/flowpress-astro-core 1.0.0-beta.42 → 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 +14 -0
- package/README.md +15 -2
- package/dist/astro/blocks/CarouselBlock.astro +64 -94
- package/dist/astro/native/carousel.css +323 -0
- package/dist/astro/native/query-carousel.d.ts +2 -1
- package/dist/astro/native/query-carousel.d.ts.map +1 -1
- package/dist/astro/native/query-carousel.js.map +1 -1
- package/dist/astro/native/query-carousel.ts +8 -4
- package/dist/build-cache.d.ts.map +1 -1
- package/dist/build-cache.js +2 -1
- package/dist/build-cache.js.map +1 -1
- package/dist/carousel.d.ts +56 -6
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +183 -27
- package/dist/carousel.js.map +1 -1
- package/dist/client.d.ts +11 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +46 -3
- package/dist/client.js.map +1 -1
- package/dist/env.d.ts +12 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +33 -0
- package/dist/env.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
11
|
+
## 1.0.0-beta.43 — 2026-10-30
|
|
12
|
+
|
|
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.
|
|
14
|
+
- Add `readFlowpressGraphqlOptions()` for `FLOWPRESS_GRAPHQL_TIMEOUT_MS` and `FLOWPRESS_GRAPHQL_RETRIES`. It refuses budgets that reach the shared 120 s lock of the build request store. The build store keeps storing only final successes.
|
|
15
|
+
- [Canonical report](https://github.com/StyleFlow-App/styleflow-docs/blob/main/dev/rapporti/2026-10-30-graphql-cold-start-retry.md).
|
|
16
|
+
|
|
3
17
|
## 1.0.0-beta.42 — 2026-10-27
|
|
4
18
|
|
|
5
19
|
- Add the one-shot `sf-reveal--zoom-in` preset: the editorial media scales from 1.25 to 1 over 2000 ms inside a stationary clipping frame, without fading or moving the block or caption.
|
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.
|
|
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
|
|
|
@@ -35,10 +35,23 @@ remain hidden unless `debug: true` is explicitly set for local development.
|
|
|
35
35
|
```ts
|
|
36
36
|
const client = new FlowpressClient({
|
|
37
37
|
endpoint: process.env.BACKEND_GRAPHQL_URL!,
|
|
38
|
-
debug: process.env.APP_ENV === "local"
|
|
38
|
+
debug: process.env.APP_ENV === "local",
|
|
39
|
+
...readFlowpressGraphqlOptions(process.env)
|
|
39
40
|
});
|
|
40
41
|
```
|
|
41
42
|
|
|
43
|
+
Each attempt has its own `timeoutMs` (default 15000 ms, covering the body
|
|
44
|
+
as well as the headers). Query documents are retried `retries` times (default 1)
|
|
45
|
+
after a timeout, a network failure or HTTP 429/502/503/504, with backoff that
|
|
46
|
+
starts at `retryDelayMs` (default 1000 ms) and doubles. Each retry logs one
|
|
47
|
+
`console.warn` with the operation, the attempt and the elapsed time.
|
|
48
|
+
Mutations, GraphQL `errors` and other HTTP statuses are never replayed. A build
|
|
49
|
+
request store receives only the final successful response.
|
|
50
|
+
`readFlowpressGraphqlOptions()` reads optional `FLOWPRESS_GRAPHQL_TIMEOUT_MS`
|
|
51
|
+
(1000–60000) and `FLOWPRESS_GRAPHQL_RETRIES` (0–5) values. It refuses any pair
|
|
52
|
+
whose worst case reaches the 120 s lock that build processes wait on in the
|
|
53
|
+
shared request store.
|
|
54
|
+
|
|
42
55
|
For local Cloudflare development, prefer an HTTP loopback endpoint dedicated
|
|
43
56
|
to server-to-server traffic. Keep the public HTTPS backend URL separate for
|
|
44
57
|
canonical URL rewriting.
|
|
@@ -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 {
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
{
|
|
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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
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,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAC3D,WAAW,GAAG,
|
|
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,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEhD,KAAK,UAAU,CAAC,IAAI,SAAS,MAAM,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;AAE9F,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAC3D,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,GACxF,OAAO,GAAG,cAAc,GAAG,KAAK,GAAG,kBAAkB,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,GACzF,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAC9E,YAAY,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,aAAa,GAAG,YAAY,GACvF,gBAAgB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,cAAc,GAC5E,mBAAmB,GAAG,UAAU,GAAG,kBAAkB,GAAG,cAAc,GAAG,cAAc,CACxF,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AAUD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,2BAA2B,EACzE,OAAO,GAAG,WAAW,GAAG,gBAAgB,CACzC,GAAG,cAAc,EAAE,GAAG,SAAS,CA6B/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-carousel.js","sourceRoot":"","sources":["../../../src/astro/native/query-carousel.ts"],"names":[],"mappings":"
|
|
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,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEhE,6EAA6E;AAC7E,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;KAC/E,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,+DAA+D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7G,MAAM,UAAU,mBAAmB,CAAC,KAEnC;IACC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACnD,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAsB,CAAC;IAC7D,IAAI,IAAI,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC;IAChG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;IAChE,OAAO,CAAC;YACN,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE;gBACV,GAAG,UAAU,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ;gBAC7C,sEAAsE;gBACtE,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,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"]}
|