@krizaka/ui 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/filter-bar.d.ts +3 -3
- package/dist/media-carousel.d.ts +4 -2
- package/dist/media-carousel.js +4 -2
- package/dist/media-carousel.js.map +1 -1
- package/dist/virtual.d.ts +3 -3
- package/package.json +5 -5
- package/registry/app-frame.json +1 -1
- package/registry/examples/media-gallery/carousel-autoplay.tsx +2 -1
- package/registry/index.json +7 -7
- package/registry/map.json +1 -1
- package/registry/media-gallery.json +5 -5
- package/registry/nav-bar.json +1 -1
- package/registry/rail-nav.json +1 -1
- package/registry/shop.json +1 -1
- package/registry/site-footer.json +1 -1
package/dist/filter-bar.d.ts
CHANGED
|
@@ -82,8 +82,8 @@ declare function SavedViews({ views, current, modified, onSelect, onSave, onRena
|
|
|
82
82
|
declare const filterBar: tailwind_variants.TVReturnType<{
|
|
83
83
|
[key: string]: {
|
|
84
84
|
[key: string]: tailwind_variants.ClassValue | {
|
|
85
|
-
count?: tailwind_variants.ClassValue;
|
|
86
85
|
root?: tailwind_variants.ClassValue;
|
|
86
|
+
count?: tailwind_variants.ClassValue;
|
|
87
87
|
controls?: tailwind_variants.ClassValue;
|
|
88
88
|
active?: tailwind_variants.ClassValue;
|
|
89
89
|
clear?: tailwind_variants.ClassValue;
|
|
@@ -95,8 +95,8 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
95
95
|
} | {
|
|
96
96
|
[x: string]: {
|
|
97
97
|
[x: string]: tailwind_variants.ClassValue | {
|
|
98
|
-
count?: tailwind_variants.ClassValue;
|
|
99
98
|
root?: tailwind_variants.ClassValue;
|
|
99
|
+
count?: tailwind_variants.ClassValue;
|
|
100
100
|
controls?: tailwind_variants.ClassValue;
|
|
101
101
|
active?: tailwind_variants.ClassValue;
|
|
102
102
|
clear?: tailwind_variants.ClassValue;
|
|
@@ -117,8 +117,8 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
117
117
|
}, undefined, {
|
|
118
118
|
[key: string]: {
|
|
119
119
|
[key: string]: tailwind_variants.ClassValue | {
|
|
120
|
-
count?: tailwind_variants.ClassValue;
|
|
121
120
|
root?: tailwind_variants.ClassValue;
|
|
121
|
+
count?: tailwind_variants.ClassValue;
|
|
122
122
|
controls?: tailwind_variants.ClassValue;
|
|
123
123
|
active?: tailwind_variants.ClassValue;
|
|
124
124
|
clear?: tailwind_variants.ClassValue;
|
package/dist/media-carousel.d.ts
CHANGED
|
@@ -156,8 +156,10 @@ type MediaCarouselProps = Omit<React.ComponentProps<"section">, "children"> & {
|
|
|
156
156
|
label: string;
|
|
157
157
|
/** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */
|
|
158
158
|
ratio?: string;
|
|
159
|
-
/** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button,
|
|
159
|
+
/** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, a hidden tab, off screen (and, with `holds="pointer-focus"`, the pointer and a keyboard focus). */
|
|
160
160
|
autoplay?: boolean | CarouselAutoplay;
|
|
161
|
+
/** What holds the autoplay clock besides the visible pause, a hidden tab, off screen, reduced motion and Save-Data. `pause-only` (default, WCAG 2.2.2): nothing else, so a resting pointer or a click on next never freezes it. `pointer-focus`: the pointer (not a touch) and a keyboard focus inside hold it too. */
|
|
162
|
+
holds?: "pause-only" | "pointer-focus";
|
|
161
163
|
/** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */
|
|
162
164
|
sound?: boolean;
|
|
163
165
|
/** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */
|
|
@@ -184,7 +186,7 @@ type MediaCarouselProps = Omit<React.ComponentProps<"section">, "children"> & {
|
|
|
184
186
|
}) => React.ReactNode;
|
|
185
187
|
};
|
|
186
188
|
/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */
|
|
187
|
-
declare function MediaCarousel({ slides, label, ratio, autoplay, sound, frame, caption, textVersion, children, labels: given, playerLabels, onSlideChange, renderLoop, className, ...props }: Readonly<MediaCarouselProps>): React.JSX.Element;
|
|
189
|
+
declare function MediaCarousel({ slides, label, ratio, autoplay, holds, sound, frame, caption, textVersion, children, labels: given, playerLabels, onSlideChange, renderLoop, className, ...props }: Readonly<MediaCarouselProps>): React.JSX.Element;
|
|
188
190
|
|
|
189
191
|
export { CAROUSEL_MAX_DWELL, CAROUSEL_MIN_DWELL, MediaCarousel, carouselDwell, chapterAt, mediaCarousel, mediaCarouselLabels };
|
|
190
192
|
export type { CarouselAutoplay, CarouselChapter, CarouselSlide, CarouselSlideKind, MediaCarouselLabels, MediaCarouselProps };
|
package/dist/media-carousel.js
CHANGED
|
@@ -251,7 +251,7 @@ function CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }) {
|
|
|
251
251
|
var CarouselToolbar = React.forwardRef(function CarouselToolbar2({ labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className }, ref) {
|
|
252
252
|
return /* @__PURE__ */ jsxs("div", { ref, role: "toolbar", "aria-orientation": "horizontal", className, onKeyDown, children: [
|
|
253
253
|
turns && /* @__PURE__ */ jsx(IconButton, { variant: "secondary", label: labels.previous, disabled: atStart, onClick: () => onTurn(-1), children: /* @__PURE__ */ jsx(ChevronGlyph, { direction: "left", className: "h-5 w-5" }) }),
|
|
254
|
-
moving && /* @__PURE__ */ jsx(IconButton, { variant: "secondary", label: paused ? labels.play : labels.pause, onClick: onPause, children: paused ? /* @__PURE__ */ jsx(PlayGlyph, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(PauseGlyph, { className: "h-4 w-4" }) }),
|
|
254
|
+
moving && /* @__PURE__ */ jsx(IconButton, { variant: "secondary", label: paused ? labels.play : labels.pause, "aria-pressed": paused, onClick: onPause, children: paused ? /* @__PURE__ */ jsx(PlayGlyph, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(PauseGlyph, { className: "h-4 w-4" }) }),
|
|
255
255
|
sound.shown && /* @__PURE__ */ jsx(IconButton, { variant: "secondary", label: labels.soundOn, "aria-pressed": sound.on, onClick: sound.toggle, children: /* @__PURE__ */ jsx(VolumeGlyph, { muted: !sound.on, className: "h-4 w-4" }) }),
|
|
256
256
|
turns && /* @__PURE__ */ jsx(IconButton, { variant: "secondary", label: labels.next, disabled: atEnd, onClick: () => onTurn(1), children: /* @__PURE__ */ jsx(ChevronGlyph, { direction: "right", className: "h-5 w-5" }) })
|
|
257
257
|
] });
|
|
@@ -277,6 +277,7 @@ function MediaCarousel({
|
|
|
277
277
|
label,
|
|
278
278
|
ratio = "16 / 9",
|
|
279
279
|
autoplay,
|
|
280
|
+
holds = "pause-only",
|
|
280
281
|
sound,
|
|
281
282
|
frame = "product",
|
|
282
283
|
caption = "overlay",
|
|
@@ -311,7 +312,8 @@ function MediaCarousel({
|
|
|
311
312
|
const wraps = Boolean(autoplay) && total > 1;
|
|
312
313
|
const ownClips = !renderLoop && slides.some((slide) => slide.video);
|
|
313
314
|
const moving = !calm && (wraps || ownClips);
|
|
314
|
-
const
|
|
315
|
+
const held = holds === "pointer-focus" && (hovered || keyboardIn);
|
|
316
|
+
const advancing = wraps && !calm && !paused && !held && onScreen && !hidden;
|
|
315
317
|
const clipPlaying = onScreen && !paused && !hidden;
|
|
316
318
|
const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);
|
|
317
319
|
const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/media-gallery/media-carousel.tsx"],"sourcesContent":["// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, the pointer, the keyboard focus, a hidden tab, off screen. */\n autoplay?: boolean | CarouselAutoplay;\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: ClipProps) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: SlideMediaProps) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: TicksProps) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const advancing = wraps && !calm && !paused && !hovered && !keyboardIn && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>\n ) : (\n children\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,YAAY,WAAW;AACvB,SAAS,UAAU;AA2Pf,SAuCA,UA3BiB,KAZjB;AApPG,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS,EAAE,OAAO,0CAA0C;AAAA,MAC5D,QAAQ,EAAE,OAAO,uFAAuF,OAAO,mCAAmC;AAAA,IACpJ;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,OAAO,UAAU;AACtC,CAAC;AAmDM,IAAM,sBAA2C;AAAA,EACtD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AACb;AAMO,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB;AAElC,IAAM,cAAc;AAGb,SAAS,cAAc,OAAkD,SAA2B,CAAC,GAAW;AACrH,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,KAAK,IAAI,KAAK,OAAO,YAAY,kBAAkB;AAC/D,QAAM,UAAU,MAAM,SAAS,MAAM,YAAY,MAAM,WAAW,IAAI,MAAM,MAAM,UAAU,KAAK,GAAG,IAAI,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QAAQ,UAC1D;AAAA,oBAAQ,KACP,qBAAC,UAAK,WAAW,EAAE,MAAM,GACtB;AAAA,uBAAS;AAAA,cAAE;AAAA,cAAI;AAAA,eAClB;AAAA,YAED,cAAc,iCAAE;AAAA;AAAA,cAAE;AAAA,eAAW;AAAA,aAChC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,cACA,OAAO,QAAQ;AAAA,cACf,SAAS,CAAC,SAAS,WAAW;AAAA,cAC9B,OAAO,CAAC,SAAS,WAAW,QAAQ;AAAA,cACpC;AAAA,cACA;AAAA,cACA,SAAS,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAAA,cAClC,OAAO,EAAE,OAAO,UAAU,IAAI,aAAa,QAAQ,YAAY;AAAA,cAC/D,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,WAAW,EAAE,QAAQ;AAAA;AAAA,UACvB;AAAA,WACF;AAAA,QAED,cACC,oBAAC,eAAY,QAAgB,SAAS,OAAO,aAAa,WAAW,EAAE,KAAK,GACzE,UACH,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["CarouselToolbar"]}
|
|
1
|
+
{"version":3,"sources":["../src/media-gallery/media-carousel.tsx"],"sourcesContent":["// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, a hidden tab, off screen (and, with `holds=\"pointer-focus\"`, the pointer and a keyboard focus). */\n autoplay?: boolean | CarouselAutoplay;\n /** What holds the autoplay clock besides the visible pause, a hidden tab, off screen, reduced motion and Save-Data. `pause-only` (default, WCAG 2.2.2): nothing else, so a resting pointer or a click on next never freezes it. `pointer-focus`: the pointer (not a touch) and a keyboard focus inside hold it too. */\n holds?: \"pause-only\" | \"pointer-focus\";\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: ClipProps) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: SlideMediaProps) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: TicksProps) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} aria-pressed={paused} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n holds = \"pause-only\",\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const held = holds === \"pointer-focus\" && (hovered || keyboardIn);\n const advancing = wraps && !calm && !paused && !held && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>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AC,UAAK,WAAW,EAAE,MAAM,GACtB;AAAA,uBAAS;AAAA,cAAE;AAAA,cAAI;AAAA,eAClB;AAAA,YAED,cAAc,iCAAE;AAAA;AAAA,cAAE;AAAA,eAAW;AAAA,aAChC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,cACA,OAAO,QAAQ;AAAA,cACf,SAAS,CAAC,SAAS,WAAW;AAAA,cAC9B,OAAO,CAAC,SAAS,WAAW,QAAQ;AAAA,cACpC;AAAA,cACA;AAAA,cACA,SAAS,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAAA,cAClC,OAAO,EAAE,OAAO,UAAU,IAAI,aAAa,QAAQ,YAAY;AAAA,cAC/D,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,WAAW,EAAE,QAAQ;AAAA;AAAA,UACvB;AAAA,WACF;AAAA,QAED,cACC,oBAAC,eAAY,QAAgB,SAAS,OAAO,aAAa,WAAW,EAAE,KAAK,GACzE,UACH,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["CarouselToolbar"]}
|
package/dist/virtual.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
declare const virtual: tailwind_variants.TVReturnType<{
|
|
7
7
|
[key: string]: {
|
|
8
8
|
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
-
viewport?: tailwind_variants.ClassValue;
|
|
10
9
|
list?: tailwind_variants.ClassValue;
|
|
10
|
+
viewport?: tailwind_variants.ClassValue;
|
|
11
11
|
item?: tailwind_variants.ClassValue;
|
|
12
12
|
row?: tailwind_variants.ClassValue;
|
|
13
13
|
empty?: tailwind_variants.ClassValue;
|
|
@@ -16,8 +16,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
|
|
|
16
16
|
} | {
|
|
17
17
|
[x: string]: {
|
|
18
18
|
[x: string]: tailwind_variants.ClassValue | {
|
|
19
|
-
viewport?: tailwind_variants.ClassValue;
|
|
20
19
|
list?: tailwind_variants.ClassValue;
|
|
20
|
+
viewport?: tailwind_variants.ClassValue;
|
|
21
21
|
item?: tailwind_variants.ClassValue;
|
|
22
22
|
row?: tailwind_variants.ClassValue;
|
|
23
23
|
empty?: tailwind_variants.ClassValue;
|
|
@@ -32,8 +32,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
|
|
|
32
32
|
}, undefined, {
|
|
33
33
|
[key: string]: {
|
|
34
34
|
[key: string]: tailwind_variants.ClassValue | {
|
|
35
|
-
viewport?: tailwind_variants.ClassValue;
|
|
36
35
|
list?: tailwind_variants.ClassValue;
|
|
36
|
+
viewport?: tailwind_variants.ClassValue;
|
|
37
37
|
item?: tailwind_variants.ClassValue;
|
|
38
38
|
row?: tailwind_variants.ClassValue;
|
|
39
39
|
empty?: tailwind_variants.ClassValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Sovkora, Verikora, Folioviv) and the motion signature — web and /native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"krizaka",
|
|
@@ -1012,7 +1012,7 @@
|
|
|
1012
1012
|
],
|
|
1013
1013
|
"peerDependencies": {
|
|
1014
1014
|
"@krizaka/query": ">=0.3.0",
|
|
1015
|
-
"@krizaka/tailwind": ">=4.
|
|
1015
|
+
"@krizaka/tailwind": ">=4.3.0",
|
|
1016
1016
|
"@maplibre/maplibre-react-native": ">=11",
|
|
1017
1017
|
"@shopify/flash-list": ">=2",
|
|
1018
1018
|
"expo-camera": ">=16",
|
|
@@ -3480,10 +3480,10 @@
|
|
|
3480
3480
|
"sonner": "^2.0.8",
|
|
3481
3481
|
"tailwind-variants": "^3.3.1",
|
|
3482
3482
|
"zod": "^4.6.7",
|
|
3483
|
-
"@krizaka/pacer": "^0.2.0",
|
|
3484
|
-
"@krizaka/tokens": "^4.2.1",
|
|
3485
3483
|
"@krizaka/intl": "^0.4.1",
|
|
3486
|
-
"@krizaka/icons": "^0.10.0"
|
|
3484
|
+
"@krizaka/icons": "^0.10.0",
|
|
3485
|
+
"@krizaka/tokens": "^4.3.0",
|
|
3486
|
+
"@krizaka/pacer": "^0.2.0"
|
|
3487
3487
|
},
|
|
3488
3488
|
"scripts": {
|
|
3489
3489
|
"build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
|
package/registry/app-frame.json
CHANGED
|
@@ -3,7 +3,8 @@ import { MediaCarousel } from "@krizaka/ui/media-carousel";
|
|
|
3
3
|
const PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='1600' height='900' fill='url(#g)'/></svg>`)}`;
|
|
4
4
|
|
|
5
5
|
// Carousel v2: it advances by itself at each slide's pace (a clip for its duration, a still for a reading time), with ticks
|
|
6
|
-
// and a visible pause; it holds
|
|
6
|
+
// and a visible pause; it holds with the Pause button and off screen
|
|
7
|
+
// (`holds: pointer-focus` adds the pointer and the keyboard focus). Nothing moves under reduced motion.
|
|
7
8
|
export default function MediaCarouselAutoplayExample() {
|
|
8
9
|
return (
|
|
9
10
|
<div className="max-w-2xl">
|
package/registry/index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"templatePurposes": {
|
|
5
5
|
"convince": {
|
|
6
6
|
"title": "Convince",
|
|
@@ -1004,7 +1004,7 @@
|
|
|
1004
1004
|
"native": 0
|
|
1005
1005
|
},
|
|
1006
1006
|
"dependencies": [
|
|
1007
|
-
"@krizaka/tokens@^4.
|
|
1007
|
+
"@krizaka/tokens@^4.3.0"
|
|
1008
1008
|
],
|
|
1009
1009
|
"registryDependencies": [
|
|
1010
1010
|
"account-menu",
|
|
@@ -4008,7 +4008,7 @@
|
|
|
4008
4008
|
"native": 2
|
|
4009
4009
|
},
|
|
4010
4010
|
"dependencies": [
|
|
4011
|
-
"@krizaka/tokens@^4.
|
|
4011
|
+
"@krizaka/tokens@^4.3.0",
|
|
4012
4012
|
"@protomaps/basemaps@5.7.2",
|
|
4013
4013
|
"tailwind-variants@^3.3.1"
|
|
4014
4014
|
],
|
|
@@ -4421,7 +4421,7 @@
|
|
|
4421
4421
|
"native": 0
|
|
4422
4422
|
},
|
|
4423
4423
|
"dependencies": [
|
|
4424
|
-
"@krizaka/tokens@^4.
|
|
4424
|
+
"@krizaka/tokens@^4.3.0",
|
|
4425
4425
|
"radix-ui@^1.8.1",
|
|
4426
4426
|
"tailwind-variants@^3.3.1"
|
|
4427
4427
|
],
|
|
@@ -5289,7 +5289,7 @@
|
|
|
5289
5289
|
"native": 0
|
|
5290
5290
|
},
|
|
5291
5291
|
"dependencies": [
|
|
5292
|
-
"@krizaka/tokens@^4.
|
|
5292
|
+
"@krizaka/tokens@^4.3.0",
|
|
5293
5293
|
"radix-ui@^1.8.1",
|
|
5294
5294
|
"tailwind-variants@^3.3.1"
|
|
5295
5295
|
],
|
|
@@ -5736,7 +5736,7 @@
|
|
|
5736
5736
|
"native": 0
|
|
5737
5737
|
},
|
|
5738
5738
|
"dependencies": [
|
|
5739
|
-
"@krizaka/tokens@^4.
|
|
5739
|
+
"@krizaka/tokens@^4.3.0",
|
|
5740
5740
|
"zod@^4.6.7"
|
|
5741
5741
|
],
|
|
5742
5742
|
"registryDependencies": [
|
|
@@ -5957,7 +5957,7 @@
|
|
|
5957
5957
|
},
|
|
5958
5958
|
"dependencies": [
|
|
5959
5959
|
"@krizaka/icons@^0.10.0",
|
|
5960
|
-
"@krizaka/tokens@^4.
|
|
5960
|
+
"@krizaka/tokens@^4.3.0",
|
|
5961
5961
|
"radix-ui@^1.8.1",
|
|
5962
5962
|
"tailwind-variants@^3.3.1"
|
|
5963
5963
|
],
|
package/registry/map.json
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"Every word is a prop: the carousel's `labels`, the lightbox player's `playerLabels` (or a film's own `labels`), `MediaPlayer`'s `labels`, `playLabel`, `closeLabel`, and `PausableLoop`'s `labels`; English by default.",
|
|
50
50
|
"`MediaPlayer` in a lightbox opens on the poster, waiting for a press on play, under reduced motion. `trigger` swaps the poster for the page's own opener (focus returns to it on close), `open` / `onOpenChange` drive it from outside, `ratio` takes any frame (`19 / 16`).",
|
|
51
51
|
"Nothing moves under the pointer; without `autoplay` nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).",
|
|
52
|
-
"`autoplay` (WCAG 2.2.2): a visible pause / play in the toolbar; it also holds under the pointer
|
|
52
|
+
"`autoplay` (WCAG 2.2.2): a visible pause / play in the toolbar; it also holds while the tab is hidden and off screen, but never under the pointer or on a focus, and a click on previous / next never pauses it (`holds: pointer-focus` brings back the pointer (not a touch) and keyboard-focus holds, and the count is then announced only while held); it wraps. The clock is the current tick's CSS animation, so a hold keeps it where it stood. Under reduced motion or Save-Data: no clock, no clip, no pause button, the current tick full.",
|
|
53
53
|
"The carousel draws a slide's `video` itself (v2): one `<video>`, the current slide's, muted, mounted after the page's `load`, `webm` before `mp4`; if no source plays it unmounts and the poster stays. Only the posters seen and the next one are drawn, the first eagerly.",
|
|
54
54
|
"`sound`: « Sound on » is a toggle (`aria-pressed`) shown only when a slide declares `audio`; after the press, the pointer or the focus in the carousel unmutes that slide's clip, leaving mutes it; the choice lasts the session; never under reduced motion.",
|
|
55
55
|
"Only the buttons take the focus, and their ring shows for the keyboard only (`:focus-visible`): no frame around the stage. `textVersion` adds a native `<details>` with every caption, text and chapter.",
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
{
|
|
105
105
|
"name": "carousel-autoplay",
|
|
106
106
|
"title": "Carousel v2, autoplay",
|
|
107
|
-
"description": "It advances by itself at each slide's pace, with ticks and a visible pause; holds
|
|
107
|
+
"description": "It advances by itself at each slide's pace, with ticks and a visible pause; holds with the Pause button and off screen; nothing moves under reduced motion.",
|
|
108
108
|
"path": "examples/media-gallery/carousel-autoplay.tsx",
|
|
109
109
|
"module": "@krizaka/ui/registry/examples/media-gallery/carousel-autoplay",
|
|
110
|
-
"code": "import { MediaCarousel } from \"@krizaka/ui/media-carousel\";\n\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='1600' height='900' fill='url(#g)'/></svg>`)}`;\n\n// Carousel v2: it advances by itself at each slide's pace (a clip for its duration, a still for a reading time), with ticks\n// and a visible pause; it holds
|
|
110
|
+
"code": "import { MediaCarousel } from \"@krizaka/ui/media-carousel\";\n\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 900'><defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='${a}'/><stop offset='1' stop-color='${b}'/></linearGradient></defs><rect width='1600' height='900' fill='url(#g)'/></svg>`)}`;\n\n// Carousel v2: it advances by itself at each slide's pace (a clip for its duration, a still for a reading time), with ticks\n// and a visible pause; it holds with the Pause button and off screen\n// (`holds: pointer-focus` adds the pointer and the keyboard focus). Nothing moves under reduced motion.\nexport default function MediaCarouselAutoplayExample() {\n return (\n <div className=\"max-w-2xl\">\n <MediaCarousel\n label=\"What the engine made\"\n autoplay\n slides={[\n { id: \"a\", kind: \"still\", src: PIC(\"#1d3f6b\", \"#4d7fb8\"), alt: \"A tea pour, the steam lit from the left\", caption: \"Fig. 2a — a product shot\" },\n { id: \"b\", kind: \"still\", src: PIC(\"#23496f\", \"#6b9bc9\"), alt: \"A storyboard of six frames\", caption: \"Fig. 2b — a storyboard\" },\n { id: \"c\", kind: \"still\", src: PIC(\"#2a3f5c\", \"#7aa5d6\"), alt: \"A finished cut on the timeline\", caption: \"Fig. 2c — the cut\" },\n ]}\n />\n </div>\n );\n}\n"
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"name": "carousel-cahier",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
"path": "media-gallery/media-carousel.tsx",
|
|
202
|
-
"content": "// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, the pointer, the keyboard focus, a hidden tab, off screen. */\n autoplay?: boolean | CarouselAutoplay;\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: ClipProps) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: SlideMediaProps) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: TicksProps) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const advancing = wraps && !calm && !paused && !hovered && !keyboardIn && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>\n ) : (\n children\n )}\n </section>\n );\n}\n"
|
|
202
|
+
"content": "// Client (the slide in view, the clock, the reader's motion, data and sound choices). Carousel v2 (ADR-010): a sequence of\n// clips, screen demos and stills given as data, one at a time in one frame. The slides cross-fade in place (nothing\n// travels); previous / next sit in a toolbar that also takes ← → Home End, a swipe turns one slide, a « n / N » count.\n// With `autoplay` it advances by itself at the media's pace — the clock IS the CSS animation of the current progress\n// tick, so holding it (the pause button, the pointer, the keyboard focus, a hidden tab, off screen) keeps it where it\n// stood. Under reduced motion or Save-Data nothing advances and no clip is mounted: the posters and the buttons.\n// Posters first, one clip (the slide in view) after the page's `load`; a clip that cannot play leaves its poster. Sound is\n// an option: after a press on « Sound on », hovering or focusing the carousel plays the slide's audio.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { clamp, playSafely, useCalm, useInView, usePageHidden, usePageLoaded } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full min-w-0\",\n stage: \"relative isolate w-full overflow-hidden bg-media\",\n track: \"m-0 grid list-none p-0 touch-pan-y\",\n slide: \"relative col-start-1 row-start-1 m-0 w-full overflow-hidden opacity-0 transition-opacity duration-500 motion-reduce:transition-none data-[active]:opacity-100\",\n media: \"absolute inset-0 h-full w-full object-cover\",\n caption: \"absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-xs font-semibold text-fg-on-media\",\n ticks: \"pointer-events-none absolute inset-x-3 bottom-2.5 z-10 flex gap-1.5\",\n tick: \"relative h-0.5 flex-1 overflow-hidden bg-fg-on-media/30 data-[state=done]:bg-fg-on-media data-[state=full]:bg-[var(--kz-hue,var(--kz-accent))]\",\n fill: \"kz-media-carousel-fill absolute inset-0 bg-[var(--kz-hue,var(--kz-accent))]\",\n mark: \"absolute top-0 h-full w-px bg-media\",\n bar: \"mt-3 flex items-start justify-between gap-3\",\n barCaption: \"m-0 min-w-0 font-mono text-[13px] leading-[19px] text-fg-secondary [overflow-wrap:anywhere]\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex flex-none gap-2\",\n text: \"mt-2.5 text-sm text-fg-secondary [&_li]:my-1\",\n },\n variants: {\n frame: {\n product: { stage: \"rounded-xl border border-border-default\" },\n cahier: { stage: \"rounded-none border border-border-strong shadow-[4px_4px_0_var(--kz-border-strong)]\", count: \"mr-2.5 font-mono text-fg-primary\" },\n },\n },\n defaultVariants: { frame: \"product\" },\n});\n\n/** What a slide is: a clip (a short generated or filmed shot), a screen demo (a product journey, often with chapters), a still. */\nexport type CarouselSlideKind = \"clip\" | \"screen-demo\" | \"still\";\n/** A step of a screen demo: where it starts, in seconds, and its name. */\nexport type CarouselChapter = { at: number; label: string };\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** What it is. Default: `clip` with a `video`, `still` without. */\n kind?: CarouselSlideKind;\n /** The poster of a clip or a film, or the still: 16:9, drawn first. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a — … »: over the foot of the slide, or in the bar with `caption=\"bar\"`. */\n caption?: string;\n /** The slide's line in the text version; `alt` when absent. */\n text?: string;\n /** The clip: one rendition, two encodes (VP9 `webm` first, H.264 `mp4` for Safari). Muted; plays while the slide is in view, on screen, after the page's `load`; never under reduced motion or Save-Data. */\n video?: { webm?: string; mp4?: string };\n /** The clip's length in seconds, as measured on the file (`krizaka-media-guard` reports it): with `autoplay`, the slide's time on screen. */\n duration?: number;\n /** The clip's file has an audio track (the guard checks it says the truth): « Sound on » can then play it. */\n audio?: boolean;\n /** A screen demo's steps: marks on the progress tick, the caption follows the step under the playhead, listed in the text version. */\n chapters?: readonly CarouselChapter[];\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"ratio\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = {\n previous: string;\n next: string;\n close: string;\n /** A slide's name, with `{n}` and `{total}`. */\n slide: string;\n /** The pause button while something moves. */\n pause: string;\n /** The same button once paused. */\n play: string;\n /** The sound toggle (pressed or not). */\n soundOn: string;\n /** The summary of the text version. */\n textVersion: string;\n /** The carousel's role description (`aria-roledescription`). */\n carousel: string;\n /** A slide's role description. */\n slideRole: string;\n};\nexport const mediaCarouselLabels: MediaCarouselLabels = {\n previous: \"Previous\",\n next: \"Next\",\n close: \"Close\",\n slide: \"{n} of {total}\",\n pause: \"Pause the carousel\",\n play: \"Play the carousel\",\n soundOn: \"Sound on\",\n textVersion: \"Text version\",\n carousel: \"carousel\",\n slideRole: \"slide\",\n};\n\n/** The bounds of a slide's time on screen, in seconds. */\nexport type CarouselAutoplay = { minDwell?: number; maxDwell?: number };\n\n// @fixed: the shortest time a slide stays, in seconds: reading a caption (ADR-010 §3), not a setting.\nexport const CAROUSEL_MIN_DWELL = 5;\n// @fixed: the longest, in seconds: the longest screen journey of a product demo (krizaka-internal#2655).\nexport const CAROUSEL_MAX_DWELL = 45;\n// @fixed: a still (or a clip of unknown length) stays a reading time and a breath, in seconds.\nconst STILL_EXTRA = 1.5;\n\n/** How long a slide stays with `autoplay`, in milliseconds: its media's duration within the bounds, or a reading time for a still. */\nexport function carouselDwell(slide: Pick<CarouselSlide, \"duration\" | \"video\">, bounds: CarouselAutoplay = {}): number {\n const min = bounds.minDwell ?? CAROUSEL_MIN_DWELL;\n const max = Math.max(min, bounds.maxDwell ?? CAROUSEL_MAX_DWELL);\n const seconds = slide.video && slide.duration && slide.duration > 0 ? clamp(slide.duration, min, max) : clamp(min + STILL_EXTRA, min, max);\n return Math.round(seconds * 1000);\n}\n\n/** The chapter under the playhead: the last one that has started. */\nexport function chapterAt(chapters: readonly CarouselChapter[] | undefined, seconds: number): number {\n if (!chapters?.length) return -1;\n let found = -1;\n chapters.forEach((c, i) => {\n if (seconds >= c.at) found = i;\n });\n return found;\n}\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order. */\n slides: readonly CarouselSlide[];\n /** The carousel's accessible name, passed translated. */\n label: string;\n /** The frame ratio of every slide (width / height). Default `16 / 9`, the house ratio. */\n ratio?: string;\n /** Advances by itself (wrapping), each slide for its `duration` within the bounds (`true`: 5–45 s). Never under reduced motion or Save-Data; held by the pause button, a hidden tab, off screen (and, with `holds=\"pointer-focus\"`, the pointer and a keyboard focus). */\n autoplay?: boolean | CarouselAutoplay;\n /** What holds the autoplay clock besides the visible pause, a hidden tab, off screen, reduced motion and Save-Data. `pause-only` (default, WCAG 2.2.2): nothing else, so a resting pointer or a click on next never freezes it. `pointer-focus`: the pointer (not a touch) and a keyboard focus inside hold it too. */\n holds?: \"pause-only\" | \"pointer-focus\";\n /** Offers « Sound on » when a slide declares `audio`: after the press, hovering or focusing the carousel plays that slide's sound. Never without the press. */\n sound?: boolean;\n /** `product` (default): the product register's rounded frame. `cahier`: the company's sites — square, a solid paper shadow, the count in the typewriter face. */\n frame?: \"product\" | \"cahier\";\n /** Where a slide's caption sits: over its foot (`overlay`, default) or in the bar under the frame (`bar`). */\n caption?: \"overlay\" | \"bar\";\n /** Renders the text version under the carousel: every slide's caption and text (and chapters), in a native `<details>`. */\n textVersion?: boolean;\n /** Rendered inside the text version (the host's sources, a link to the film); after the carousel without one. */\n children?: React.ReactNode;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n /** The words of the lightbox player of every film (speed, captions, time…), passed translated; a slide's own `film.labels` wins. */\n playerLabels?: MediaPlayerProps[\"labels\"];\n /** Called with the index of the slide in view when it changes. */\n onSlideChange?: (index: number) => void;\n /**\n * Draws a slide's `video` in place of the carousel's own clip.\n * @deprecated Since carousel v2 (ADR-010) the carousel draws its clips itself, with its pause in the toolbar. Removed in 4.0.\n */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\nconst CLOCK_CSS =\n \".kz-media-carousel-fill{transform-origin:left;transform:scaleX(0);animation-name:kz-media-carousel-fill;animation-timing-function:linear;animation-fill-mode:forwards}\" +\n \"@keyframes kz-media-carousel-fill{from{transform:scaleX(0)}to{transform:scaleX(1)}}\";\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\nconst SOUND_KEY = \"kz-media-carousel-sound\";\nconst SOUND_EVENT = \"kz-media-carousel-sound\";\n\n/** A horizontal swipe turns one slide; a vertical one stays the page's scroll (`touch-action: pan-y`). */\nfunction useSwipe(turn: (delta: 1 | -1) => void) {\n const from = React.useRef<number | null>(null);\n return {\n onPointerDown: (event: React.PointerEvent) => {\n from.current = event.clientX;\n },\n onPointerUp: (event: React.PointerEvent) => {\n const start = from.current;\n from.current = null;\n if (start === null) return;\n const distance = event.clientX - start;\n if (Math.abs(distance) >= SWIPE_DISTANCE) turn(distance < 0 ? 1 : -1);\n },\n onPointerCancel: () => {\n from.current = null;\n },\n };\n}\n\nconst subscribeSound = (notify: () => void) => {\n globalThis.addEventListener(SOUND_EVENT, notify);\n return () => globalThis.removeEventListener(SOUND_EVENT, notify);\n};\nconst readSound = () => {\n try {\n return globalThis.sessionStorage.getItem(SOUND_KEY) === \"1\";\n } catch {\n return false;\n }\n};\n/** The visitor's choice of sound, for this session (off on the server and before any press). */\nfunction useSoundChoice(): [boolean, () => void] {\n const on = React.useSyncExternalStore(subscribeSound, readSound, () => false);\n const toggle = () => {\n try {\n globalThis.sessionStorage.setItem(SOUND_KEY, on ? \"0\" : \"1\");\n } catch {\n // No storage (a private window): the choice holds until the next render only.\n }\n globalThis.dispatchEvent(new Event(SOUND_EVENT));\n };\n return [on, toggle];\n}\n\n/** The keyboard put the focus there (`:focus-visible`): only then does a focus hold the clock; a click does not. */\nfunction keyboardFocus(target: EventTarget | null): boolean {\n try {\n return target instanceof Element && target.matches(\":focus-visible\");\n } catch {\n return true;\n }\n}\n\n/** At an end the button just used is disabled: the focus moves to the other one, never to the page. */\nfunction keepFocus(toolbar: HTMLElement | null, at: number, count: number) {\n if (!toolbar?.contains(document.activeElement)) return;\n const buttons = toolbar.querySelectorAll(\"button\");\n const previous = buttons[0];\n const next = buttons[buttons.length - 1];\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\ntype ClipProps = Readonly<{\n video: NonNullable<CarouselSlide[\"video\"]>;\n poster: string;\n playing: boolean;\n muted: boolean;\n onBroken: () => void;\n onTime?: (seconds: number) => void;\n}>;\n\n/** The slide's clip: muted until the sound is chosen, looping while its slide stays (never a held last frame), gone if no source plays. */\nfunction SlideClip({ video, poster, playing, muted, onBroken, onTime }: ClipProps) {\n const ref = React.useRef<HTMLVideoElement>(null);\n React.useEffect(() => {\n if (ref.current) ref.current.muted = muted;\n }, [muted]);\n React.useEffect(() => {\n if (!ref.current) return;\n if (playing) playSafely(ref.current);\n else ref.current.pause?.();\n }, [playing]);\n const last = video.mp4 ? \"mp4\" : \"webm\";\n return (\n <video\n ref={ref}\n className={mediaCarousel().media()}\n poster={poster}\n muted\n loop\n playsInline\n preload=\"auto\"\n aria-hidden\n tabIndex={-1}\n onTimeUpdate={onTime ? (e) => onTime(e.currentTarget.currentTime) : undefined}\n >\n {video.webm && <source src={video.webm} type=\"video/webm\" onError={last === \"webm\" ? onBroken : undefined} />}\n {video.mp4 && <source src={video.mp4} type=\"video/mp4\" onError={onBroken} />}\n </video>\n );\n}\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; first: boolean; drawn: boolean; clip: React.ReactNode; ratio: string; closeLabel: string; overlay: boolean; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its clip plays over it while the slide is the one in view. */\nfunction SlideMedia({ slide, first, drawn, clip, ratio, closeLabel, overlay, playerLabels }: SlideMediaProps) {\n const s = mediaCarousel();\n if (slide.film) {\n return (\n <MediaPlayer\n {...slide.film}\n labels={slide.film.labels ?? playerLabels}\n mode=\"lightbox\"\n poster={slide.src}\n posterAlt={slide.alt}\n caption={overlay ? slide.caption : undefined}\n closeLabel={closeLabel}\n preview={clip}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n {drawn && <img src={slide.src} alt={slide.alt} loading={first ? undefined : \"lazy\"} decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />}\n {clip}\n {overlay && slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A tick's state: before the current one, the current one (filling, or full when nothing advances), still to come. */\nfunction tickState(i: number, active: number, filling: boolean): \"done\" | \"now\" | \"full\" | undefined {\n if (i < active) return \"done\";\n if (i !== active) return undefined;\n return filling ? \"now\" : \"full\";\n}\n\n/** A screen demo's steps, as marks on its progress tick (where each starts, over the clip's length). */\nfunction ChapterMarks({ slide, className }: Readonly<{ slide: CarouselSlide; className: string }>) {\n const length = slide.duration ?? 0;\n if (!slide.chapters?.length || length <= 0) return null;\n return slide.chapters.map((c) => <i key={c.at} className={className} style={{ left: `${(c.at / length) * 100}%` }} />);\n}\n\n/** The step of the current slide under the playhead, followed only for a slide with chapters. */\nfunction useChapter(slide: CarouselSlide | undefined) {\n const [chapter, setChapter] = React.useState(-1);\n const [shown, setShown] = React.useState(slide?.id);\n if (shown !== slide?.id) {\n setShown(slide?.id);\n setChapter(-1);\n }\n const onTime = slide?.chapters?.length ? (seconds: number) => setChapter(chapterAt(slide.chapters, seconds)) : undefined;\n return { chapter: slide?.chapters?.[chapter], onTime };\n}\n\n/** What holds the clock and what lets the sound play: the pointer (not a touch), any focus inside, a keyboard focus inside. */\nfunction useHolds() {\n const [hovered, setHovered] = React.useState(false);\n const [focusIn, setFocusIn] = React.useState(false);\n const [keyboardIn, setKeyboardIn] = React.useState(false);\n const handlers = {\n onPointerEnter: (e: React.PointerEvent) => setHovered(e.pointerType !== \"touch\"),\n onPointerLeave: () => setHovered(false),\n onFocus: (e: React.FocusEvent) => {\n setFocusIn(true);\n setKeyboardIn(keyboardFocus(e.target));\n },\n onBlur: (e: React.FocusEvent) => {\n if (e.currentTarget.contains(e.relatedTarget as Node | null)) return;\n setFocusIn(false);\n setKeyboardIn(false);\n },\n };\n return { hovered, focusIn, keyboardIn, handlers };\n}\n\ntype TicksProps = Readonly<{ slides: readonly CarouselSlide[]; active: number; calm: boolean; dwell: number; advancing: boolean; onEnd: () => void; s: ReturnType<typeof mediaCarousel> }>;\n\n/** One hairline per slide; the current one fills over its dwell — the clock — and holds with the carousel. */\nfunction CarouselTicks({ slides, active, calm, dwell, advancing, onEnd, s }: TicksProps) {\n return (\n <div className={s.ticks()} aria-hidden>\n {slides.map((slide, i) => (\n <span key={slide.id} className={s.tick()} data-state={tickState(i, active, !calm)}>\n {i === active && !calm && (\n <span\n key={`${active}`}\n className={s.fill()}\n style={{ animationDuration: `${dwell}ms`, animationPlayState: advancing ? \"running\" : \"paused\" }}\n onAnimationEnd={() => advancing && onEnd()}\n />\n )}\n {i === active && <ChapterMarks slide={slide} className={s.mark()} />}\n </span>\n ))}\n </div>\n );\n}\n\ntype ToolbarProps = Readonly<{\n labels: MediaCarouselLabels;\n turns: boolean;\n atStart: boolean;\n atEnd: boolean;\n moving: boolean;\n paused: boolean;\n onPause: () => void;\n sound: { shown: boolean; on: boolean; toggle: () => void };\n onTurn: (delta: number) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;\n className: string;\n}>;\n\n/** Previous, pause / play, « Sound on », next: one toolbar that also takes ← → Home End. */\nconst CarouselToolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function CarouselToolbar(\n { labels, turns, atStart, atEnd, moving, paused, onPause, sound, onTurn, onKeyDown, className },\n ref,\n) {\n return (\n <div ref={ref} role=\"toolbar\" aria-orientation=\"horizontal\" className={className} onKeyDown={onKeyDown}>\n {turns && (\n <IconButton variant=\"secondary\" label={labels.previous} disabled={atStart} onClick={() => onTurn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n {moving && (\n <IconButton variant=\"secondary\" label={paused ? labels.play : labels.pause} aria-pressed={paused} onClick={onPause}>\n {paused ? <PlayGlyph className=\"h-4 w-4\" /> : <PauseGlyph className=\"h-4 w-4\" />}\n </IconButton>\n )}\n {sound.shown && (\n <IconButton variant=\"secondary\" label={labels.soundOn} aria-pressed={sound.on} onClick={sound.toggle}>\n <VolumeGlyph muted={!sound.on} className=\"h-4 w-4\" />\n </IconButton>\n )}\n {turns && (\n <IconButton variant=\"secondary\" label={labels.next} disabled={atEnd} onClick={() => onTurn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n )}\n </div>\n );\n});\n\n/** Every slide's caption and text, and a screen demo's chapters, in a native `<details>`; the host's `children` inside. */\nfunction TextVersion({ slides, summary, className, children }: Readonly<{ slides: readonly CarouselSlide[]; summary: string; className: string; children?: React.ReactNode }>) {\n return (\n <details className={className}>\n <summary>{summary}</summary>\n <ol>\n {slides.map((slide) => (\n <li key={slide.id}>\n {slide.caption && <b>{slide.caption}</b>} {slide.text ?? slide.alt}\n {slide.chapters?.length ? (\n <ol>\n {slide.chapters.map((c) => (\n <li key={c.at}>{c.label}</li>\n ))}\n </ol>\n ) : null}\n </li>\n ))}\n </ol>\n {children}\n </details>\n );\n}\n\n/** The caption shown in the bar: the slide's, with the chapter under the playhead. */\nfunction barCaptionOf(placement: \"overlay\" | \"bar\", slide: CarouselSlide | undefined, chapter: CarouselChapter | undefined) {\n if (placement !== \"bar\" || !slide?.caption) return undefined;\n return chapter ? [slide.caption, chapter.label].join(\" · \") : slide.caption;\n}\n\n/** A sequence of clips, screen demos and stills, one at a time: buttons, arrow keys, swipe, and with `autoplay` it advances at the media's pace. */\nexport function MediaCarousel({\n slides,\n label,\n ratio = \"16 / 9\",\n autoplay,\n holds = \"pause-only\",\n sound,\n frame = \"product\",\n caption = \"overlay\",\n textVersion,\n children,\n labels: given,\n playerLabels,\n onSlideChange,\n renderLoop,\n className,\n ...props\n}: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const s = mediaCarousel({ frame });\n const total = slides.length;\n const root = React.useRef<HTMLElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const calm = useCalm();\n const loaded = usePageLoaded();\n const hidden = usePageHidden();\n const [soundChosen, toggleSound] = useSoundChoice();\n const [active, setActive] = React.useState(0);\n const [seen, setSeen] = React.useState<ReadonlySet<number>>(() => new Set([0]));\n const [broken, setBroken] = React.useState<ReadonlySet<string>>(() => new Set());\n const [paused, setPaused] = React.useState(false);\n const { hovered, focusIn, keyboardIn, handlers } = useHolds();\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n useInView(root, setOnScreen);\n\n const current = slides[active];\n const { chapter, onTime } = useChapter(current);\n const bounds = typeof autoplay === \"object\" ? autoplay : {};\n const wraps = Boolean(autoplay) && total > 1;\n const ownClips = !renderLoop && slides.some((slide) => slide.video);\n const moving = !calm && (wraps || ownClips);\n const held = holds === \"pointer-focus\" && (hovered || keyboardIn);\n const advancing = wraps && !calm && !paused && !held && onScreen && !hidden;\n const clipPlaying = onScreen && !paused && !hidden;\n const hasAudio = Boolean(sound) && !calm && ownClips && slides.some((slide) => slide.audio && slide.video);\n const audible = hasAudio && soundChosen && Boolean(current?.audio) && (hovered || focusIn);\n\n const show = (to: number) => {\n setActive(to);\n setSeen((before) => new Set(before).add(to));\n onSlideChange?.(to);\n };\n const turn = (delta: number) => {\n const to = wraps ? (active + delta + total) % total : clamp(active + delta, 0, total - 1);\n if (to === active) return;\n show(to);\n if (!wraps) keepFocus(toolbar.current, to, total);\n };\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const moves: Partial<Record<string, () => void>> = {\n ArrowRight: () => turn(1),\n ArrowLeft: () => turn(-1),\n Home: () => turn(-active),\n End: () => turn(total - 1 - active),\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n move();\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(total));\n const clipOf = (slide: CarouselSlide, i: number): React.ReactNode => {\n if (!slide.video) return null;\n if (renderLoop) return renderLoop(slide.video, { poster: slide.src, inView: i === active });\n if (i !== active || calm || !loaded || broken.has(slide.id)) return null;\n return (\n <SlideClip\n key={slide.id}\n video={slide.video}\n poster={slide.src}\n playing={clipPlaying}\n muted={!audible}\n onTime={onTime}\n onBroken={() => setBroken((before) => new Set(before).add(slide.id))}\n />\n );\n };\n const dwell = current ? carouselDwell(current, bounds) : 0;\n const barCaption = barCaptionOf(caption, current, chapter);\n const showBar = total > 1 || moving || Boolean(barCaption);\n\n return (\n <section\n ref={root}\n aria-roledescription={labels.carousel}\n aria-label={label}\n data-frame={frame}\n data-advancing={advancing ? \"\" : undefined}\n className={s.root({ className })}\n {...handlers}\n {...props}\n >\n {wraps && (\n <style href=\"kz-media-carousel\" precedence=\"medium\">\n {CLOCK_CSS}\n </style>\n )}\n <div className={s.stage()} style={{ aspectRatio: ratio }}>\n <ul className={s.track()} {...swipe}>\n {slides.map((slide, i) => {\n const here = i === active;\n return (\n <li\n key={slide.id}\n aria-roledescription={labels.slideRole}\n aria-label={name(i)}\n data-kind={slide.kind ?? (slide.video ? \"clip\" : \"still\")}\n data-active={here ? \"\" : undefined}\n className={s.slide()}\n style={{ aspectRatio: ratio }}\n aria-hidden={here ? undefined : true}\n inert={here ? undefined : true}\n >\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia\n slide={slide}\n first={i === 0}\n drawn={seen.has(i) || i === (active + 1) % total}\n clip={clipOf(slide, i)}\n ratio={ratio}\n closeLabel={labels.close}\n overlay={caption === \"overlay\"}\n playerLabels={playerLabels}\n />\n </figure>\n </li>\n );\n })}\n </ul>\n {wraps && <CarouselTicks slides={slides} active={active} calm={calm} dwell={dwell} advancing={advancing} onEnd={() => turn(1)} s={s} />}\n </div>\n {showBar && (\n <div className={s.bar()}>\n <p className={s.barCaption()} aria-live={advancing ? \"off\" : \"polite\"}>\n {total > 1 && (\n <span className={s.count()}>\n {active + 1} / {total}\n </span>\n )}\n {barCaption && <> {barCaption}</>}\n </p>\n <CarouselToolbar\n ref={toolbar}\n labels={labels}\n turns={total > 1}\n atStart={!wraps && active === 0}\n atEnd={!wraps && active === total - 1}\n moving={moving}\n paused={paused}\n onPause={() => setPaused((p) => !p)}\n sound={{ shown: hasAudio, on: soundChosen, toggle: toggleSound }}\n onTurn={turn}\n onKeyDown={keys}\n className={s.buttons()}\n />\n </div>\n )}\n {textVersion ? (\n <TextVersion slides={slides} summary={labels.textVersion} className={s.text()}>\n {children}\n </TextVersion>\n ) : (\n children\n )}\n </section>\n );\n}\n"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"path": "media-gallery/media-gallery.tsx",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
"path": "media-gallery/meta.ts",
|
|
214
|
-
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Media gallery\",\n summary: \"Also `MediaCarousel` (clips, screen demos and stills one at a time; `autoplay` with a visible pause, optional sound, its files checked by `krizaka-media-guard`), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause). A shop's own photos and loops in tiles, the first featured.\",\n status: \"beta\",\n category: \"media\",\n domain: \"media\",\n platforms: \"web\",\n parity: { native: { status: \"n/a\", reason: \"A shop's public storefront is a web page.\" }, desktop: \"web\" },\n whenToUse: [\"The « look inside » of a business page: its real photos and short clips.\"],\n whenNotToUse: [\n { when: \"A demo gallery with titles and captions per piece.\" },\n ],\n bestPractices: [\n \"Real photos only; every tile has `alt` text that says what it shows.\",\n \"Give a landscape source `shape=\\\"wide\\\"` so it is not cropped to a portrait.\",\n \"Keep loops short and few: one or two per gallery.\",\n \"Carousel: 16:9 files only, checked before they ship — `krizaka-media-guard slides.json` refuses a vertical reel in a wide file (pillarbox), a letterbox, a black end card, an mp4 that is not H.264 yuv420p fast start, and an `audio` or `duration` that does not match the file.\",\n \"Carousel: give each clip its `duration` (the guard reports it): with `autoplay` a slide stays for it, within 5–45 s; a still stays 6.5 s. The clip loops while its slide stays, so it never holds a last frame.\",\n \"Carousel: `sound` only for slides whose file has sound; it plays after the visitor presses « Sound on », then only under the pointer or the focus.\",\n \"Carousel on a company site: `frame=\\\"cahier\\\"`, `caption=\\\"bar\\\"`, `textVersion`, and the product's `data-hue` on the carousel or an ancestor.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"A list named by `label`; each tile is a figure with the photo's `alt` and its caption.\",\n \"`MediaCarousel` is a `carousel` region named by `label`; each slide is a numbered group, only the one in view is exposed (`inert` on the others); previous / next are buttons in a `toolbar` that also takes ← / → (at an end the focus moves to the other button), a swipe turns one slide, the track has no scroll of its own to reach, the count is polite.\",\n \"`MediaPlayer` in a lightbox: one button named `playLabel` opens a modal dialog (focus trapped, Escape closes, focus returns) holding the VideoPlayer; the press starts it with sound.\",\n \"One slide draws no toolbar and no count. A loop (`PausableLoop` of `@krizaka/ui/pausable-loop`, handed to the carousel's `renderLoop` for a slide's `video`, also on a film slide, where it previews the film, or to `MediaPlayer`'s `preview`) is fetched after the page's `load`, plays only while on screen and on the slide in view, and has a visible pause / play button (the words of `PausableLoop`'s `labels`); under reduced motion or Save-Data the poster stays alone and there is no control, since nothing moves.\",\n \"Every word is a prop: the carousel's `labels`, the lightbox player's `playerLabels` (or a film's own `labels`), `MediaPlayer`'s `labels`, `playLabel`, `closeLabel`, and `PausableLoop`'s `labels`; English by default.\",\n \"`MediaPlayer` in a lightbox opens on the poster, waiting for a press on play, under reduced motion. `trigger` swaps the poster for the page's own opener (focus returns to it on close), `open` / `onOpenChange` drive it from outside, `ratio` takes any frame (`19 / 16`).\",\n \"Nothing moves under the pointer; without `autoplay` nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).\",\n \"`autoplay` (WCAG 2.2.2): a visible pause / play in the toolbar; it also holds under the pointer
|
|
214
|
+
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Media gallery\",\n summary: \"Also `MediaCarousel` (clips, screen demos and stills one at a time; `autoplay` with a visible pause, optional sound, its files checked by `krizaka-media-guard`), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause). A shop's own photos and loops in tiles, the first featured.\",\n status: \"beta\",\n category: \"media\",\n domain: \"media\",\n platforms: \"web\",\n parity: { native: { status: \"n/a\", reason: \"A shop's public storefront is a web page.\" }, desktop: \"web\" },\n whenToUse: [\"The « look inside » of a business page: its real photos and short clips.\"],\n whenNotToUse: [\n { when: \"A demo gallery with titles and captions per piece.\" },\n ],\n bestPractices: [\n \"Real photos only; every tile has `alt` text that says what it shows.\",\n \"Give a landscape source `shape=\\\"wide\\\"` so it is not cropped to a portrait.\",\n \"Keep loops short and few: one or two per gallery.\",\n \"Carousel: 16:9 files only, checked before they ship — `krizaka-media-guard slides.json` refuses a vertical reel in a wide file (pillarbox), a letterbox, a black end card, an mp4 that is not H.264 yuv420p fast start, and an `audio` or `duration` that does not match the file.\",\n \"Carousel: give each clip its `duration` (the guard reports it): with `autoplay` a slide stays for it, within 5–45 s; a still stays 6.5 s. The clip loops while its slide stays, so it never holds a last frame.\",\n \"Carousel: `sound` only for slides whose file has sound; it plays after the visitor presses « Sound on », then only under the pointer or the focus.\",\n \"Carousel on a company site: `frame=\\\"cahier\\\"`, `caption=\\\"bar\\\"`, `textVersion`, and the product's `data-hue` on the carousel or an ancestor.\",\n ],\n accessibility: {\n keyboard: [],\n notes: [\n \"A list named by `label`; each tile is a figure with the photo's `alt` and its caption.\",\n \"`MediaCarousel` is a `carousel` region named by `label`; each slide is a numbered group, only the one in view is exposed (`inert` on the others); previous / next are buttons in a `toolbar` that also takes ← / → (at an end the focus moves to the other button), a swipe turns one slide, the track has no scroll of its own to reach, the count is polite.\",\n \"`MediaPlayer` in a lightbox: one button named `playLabel` opens a modal dialog (focus trapped, Escape closes, focus returns) holding the VideoPlayer; the press starts it with sound.\",\n \"One slide draws no toolbar and no count. A loop (`PausableLoop` of `@krizaka/ui/pausable-loop`, handed to the carousel's `renderLoop` for a slide's `video`, also on a film slide, where it previews the film, or to `MediaPlayer`'s `preview`) is fetched after the page's `load`, plays only while on screen and on the slide in view, and has a visible pause / play button (the words of `PausableLoop`'s `labels`); under reduced motion or Save-Data the poster stays alone and there is no control, since nothing moves.\",\n \"Every word is a prop: the carousel's `labels`, the lightbox player's `playerLabels` (or a film's own `labels`), `MediaPlayer`'s `labels`, `playLabel`, `closeLabel`, and `PausableLoop`'s `labels`; English by default.\",\n \"`MediaPlayer` in a lightbox opens on the poster, waiting for a press on play, under reduced motion. `trigger` swaps the poster for the page's own opener (focus returns to it on close), `open` / `onOpenChange` drive it from outside, `ratio` takes any frame (`19 / 16`).\",\n \"Nothing moves under the pointer; without `autoplay` nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).\",\n \"`autoplay` (WCAG 2.2.2): a visible pause / play in the toolbar; it also holds while the tab is hidden and off screen, but never under the pointer or on a focus, and a click on previous / next never pauses it (`holds: pointer-focus` brings back the pointer (not a touch) and keyboard-focus holds, and the count is then announced only while held); it wraps. The clock is the current tick's CSS animation, so a hold keeps it where it stood. Under reduced motion or Save-Data: no clock, no clip, no pause button, the current tick full.\",\n \"The carousel draws a slide's `video` itself (v2): one `<video>`, the current slide's, muted, mounted after the page's `load`, `webm` before `mp4`; if no source plays it unmounts and the poster stays. Only the posters seen and the next one are drawn, the first eagerly.\",\n \"`sound`: « Sound on » is a toggle (`aria-pressed`) shown only when a slide declares `audio`; after the press, the pointer or the focus in the carousel unmutes that slide's clip, leaving mutes it; the choice lasts the session; never under reduced motion.\",\n \"Only the buttons take the focus, and their ring shows for the keyboard only (`:focus-visible`): no frame around the stage. `textVersion` adds a native `<details>` with every caption, text and chapter.\",\n \"A loop is decorative (`aria-hidden`), starts only while its tile is on screen and never under reduced motion.\",\n ],\n },\n related: [\"cover-hero\"],\n web: {\n imports: [\"MediaGallery\", \"MediaCarousel\", \"MediaPlayer\", \"PausableLoop\"],\n examples: [\n { name: \"shop\", title: \"Shop\", description: \"Three photos, the first featured, one with a caption.\" },\n { name: \"carousel\", title: \"Carousel\", description: \"Three realisations one at a time, the first opens its film; buttons (and ← / → on them), swipe, nothing advances by itself.\" },\n { name: \"carousel-autoplay\", title: \"Carousel v2, autoplay\", description: \"It advances by itself at each slide's pace, with ticks and a visible pause; holds with the Pause button and off screen; nothing moves under reduced motion.\" },\n { name: \"carousel-cahier\", title: \"Carousel v2, Cahier frame and sound\", description: \"The company's sites: square frame with a paper shadow, the caption in the bar, a hue, the text version, « Sound on » for the slides with sound.\" },\n { name: \"carousel-demo\", title: \"Carousel v2, screen demo with chapters\", description: \"A 30 s product journey: chapter marks on the tick, the caption follows the step under the playhead, the steps in the text version.\" },\n { name: \"carousel-single\", title: \"Carousel, one slide\", description: \"A single slide draws no arrows and no count.\" },\n { name: \"carousel-loop\", title: \"Carousel, loop and French words\", description: \"A film slide previewed by a silent loop with a visible pause (after load, on screen only), the carousel and the lightbox player in French.\" },\n { name: \"player\", title: \"Player\", description: \"The one video frame: a poster that opens a lightbox started by the press (with sound), 16:9 and vertical 9:16.\" },\n { name: \"player-trigger\", title: \"Player, own trigger\", description: \"The page's button opens the lightbox (`trigger`); another drives a 19 / 16 one from outside (`open`, `onOpenChange`).\" },\n ],\n },\n} satisfies ComponentMeta;\n"
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
"path": "media-gallery/pausable-loop.tsx",
|
package/registry/nav-bar.json
CHANGED
package/registry/rail-nav.json
CHANGED
package/registry/shop.json
CHANGED