@krizaka/ui 3.85.0 → 3.86.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.
Files changed (33) hide show
  1. package/dist/{chunk-FYPYJ6MW.js → chunk-GOGEYAYK.js} +25 -19
  2. package/dist/chunk-GOGEYAYK.js.map +1 -0
  3. package/dist/filter-bar.d.ts +3 -3
  4. package/dist/media-carousel.d.ts +10 -3
  5. package/dist/media-carousel.js +23 -14
  6. package/dist/media-carousel.js.map +1 -1
  7. package/dist/media-player.d.ts +16 -2
  8. package/dist/media-player.js +1 -1
  9. package/dist/pausable-loop.d.ts +27 -0
  10. package/dist/pausable-loop.js +68 -0
  11. package/dist/pausable-loop.js.map +1 -0
  12. package/dist/{player-lightbox-ETBQWDOT.js → player-lightbox-ASFOSUSD.js} +6 -3
  13. package/dist/{player-lightbox-ETBQWDOT.js.map → player-lightbox-ASFOSUSD.js.map} +1 -1
  14. package/dist/virtual.d.ts +3 -3
  15. package/package.json +19 -5
  16. package/registry/app-frame.json +1 -1
  17. package/registry/examples/media-gallery/carousel-loop.d.ts +4 -0
  18. package/registry/examples/media-gallery/carousel-loop.js +26 -0
  19. package/registry/examples/media-gallery/carousel-loop.tsx +24 -0
  20. package/registry/examples/media-gallery/carousel-single.d.ts +4 -0
  21. package/registry/examples/media-gallery/carousel-single.js +12 -0
  22. package/registry/examples/media-gallery/carousel-single.tsx +12 -0
  23. package/registry/examples/media-gallery/player-trigger.d.ts +4 -0
  24. package/registry/examples/media-gallery/player-trigger.js +20 -0
  25. package/registry/examples/media-gallery/player-trigger.tsx +19 -0
  26. package/registry/index.json +11 -10
  27. package/registry/map.json +1 -1
  28. package/registry/media-gallery.json +43 -7
  29. package/registry/nav-bar.json +1 -1
  30. package/registry/rail-nav.json +1 -1
  31. package/registry/shop.json +1 -1
  32. package/registry/site-footer.json +1 -1
  33. package/dist/chunk-FYPYJ6MW.js.map +0 -1
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": "3.85.0",
3
+ "version": "3.86.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, Orazaka, Yomizaka, Akinaza) and the motion signature — web and /native.",
5
5
  "keywords": [
6
6
  "krizaka",
@@ -525,6 +525,10 @@
525
525
  "types": "./dist/media-carousel.d.ts",
526
526
  "import": "./dist/media-carousel.js"
527
527
  },
528
+ "./pausable-loop": {
529
+ "types": "./dist/pausable-loop.d.ts",
530
+ "import": "./dist/pausable-loop.js"
531
+ },
528
532
  "./sticky-action": {
529
533
  "types": "./dist/sticky-action.d.ts",
530
534
  "import": "./dist/sticky-action.js"
@@ -1001,7 +1005,7 @@
1001
1005
  ],
1002
1006
  "peerDependencies": {
1003
1007
  "@krizaka/query": ">=0.3.0",
1004
- "@krizaka/tailwind": ">=3.85.0",
1008
+ "@krizaka/tailwind": ">=3.86.0",
1005
1009
  "@maplibre/maplibre-react-native": ">=11",
1006
1010
  "@shopify/flash-list": ">=2",
1007
1011
  "expo-camera": ">=16",
@@ -2203,6 +2207,16 @@
2203
2207
  "clsx"
2204
2208
  ]
2205
2209
  },
2210
+ {
2211
+ "name": "./pausable-loop",
2212
+ "path": "dist/pausable-loop.js",
2213
+ "limit": "2 kB",
2214
+ "gzip": true,
2215
+ "ignore": [
2216
+ "tailwind-variants",
2217
+ "clsx"
2218
+ ]
2219
+ },
2206
2220
  {
2207
2221
  "name": "./media-gallery",
2208
2222
  "path": "dist/media-gallery.js",
@@ -3453,9 +3467,9 @@
3453
3467
  "sonner": "^2.0.8",
3454
3468
  "tailwind-variants": "^3.3.1",
3455
3469
  "zod": "^4.6.7",
3456
- "@krizaka/pacer": "^0.2.0",
3457
- "@krizaka/tokens": "^3.85.0",
3458
- "@krizaka/intl": "^0.4.1"
3470
+ "@krizaka/intl": "^0.4.1",
3471
+ "@krizaka/tokens": "^3.86.0",
3472
+ "@krizaka/pacer": "^0.2.0"
3459
3473
  },
3460
3474
  "scripts": {
3461
3475
  "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",
@@ -370,7 +370,7 @@
370
370
  }
371
371
  ],
372
372
  "dependencies": [
373
- "@krizaka/tokens@^3.85.0"
373
+ "@krizaka/tokens@^3.86.0"
374
374
  ],
375
375
  "registryDependencies": [
376
376
  "account-menu",
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,26 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/carousel-loop.tsx
4
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
5
+ import { PausableLoop } from "@krizaka/ui/pausable-loop";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#23496f'/></svg>")}`;
8
+ var FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
9
+ function MediaCarouselLoopExample() {
10
+ return /* @__PURE__ */ jsx("div", { className: "max-w-xl", children: /* @__PURE__ */ jsx(
11
+ MediaCarousel,
12
+ {
13
+ label: "R\xE9alisations",
14
+ slides: [
15
+ { id: "a", src: POSTER, alt: "Le film de Krizaka", caption: "Fig. 1a", video: { mp4: FILM }, film: { src: FILM, title: "Film : le monde de Krizaka", playLabel: "Lire le film" } },
16
+ { id: "b", src: POSTER, alt: "Un bail lu en une minute", caption: "Fig. 1b", video: { mp4: FILM } }
17
+ ],
18
+ labels: { previous: "Pr\xE9c\xE9dent", next: "Suivant", close: "Fermer", slide: "{n} sur {total}" },
19
+ renderLoop: (video, { poster, inView }) => /* @__PURE__ */ jsx(PausableLoop, { sources: video, poster, active: inView, labels: { pause: "Mettre l\u2019animation en pause", play: "Lancer l\u2019animation" } }),
20
+ playerLabels: { play: "Lire", pause: "Pause", mute: "Couper le son", unmute: "Remettre le son", volume: "Volume", seek: "Position", fullscreen: "Plein \xE9cran", exitFullscreen: "Quitter le plein \xE9cran", loading: "Chargement", error: "Cette vid\xE9o ne peut pas \xEAtre lue.", retry: "R\xE9essayer" }
21
+ }
22
+ ) });
23
+ }
24
+ export {
25
+ MediaCarouselLoopExample as default
26
+ };
@@ -0,0 +1,24 @@
1
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
2
+ import { PausableLoop } from "@krizaka/ui/pausable-loop";
3
+
4
+ const POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#23496f'/></svg>")}`;
5
+ const FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
6
+
7
+ // A French page: a silent loop previews the film (after the page's load, only on screen, with a visible pause), a press opens the
8
+ // film, and every word of the carousel and of the player is passed translated. A still under reduced motion.
9
+ export default function MediaCarouselLoopExample() {
10
+ return (
11
+ <div className="max-w-xl">
12
+ <MediaCarousel
13
+ label="Réalisations"
14
+ slides={[
15
+ { id: "a", src: POSTER, alt: "Le film de Krizaka", caption: "Fig. 1a", video: { mp4: FILM }, film: { src: FILM, title: "Film : le monde de Krizaka", playLabel: "Lire le film" } },
16
+ { id: "b", src: POSTER, alt: "Un bail lu en une minute", caption: "Fig. 1b", video: { mp4: FILM } },
17
+ ]}
18
+ labels={{ previous: "Précédent", next: "Suivant", close: "Fermer", slide: "{n} sur {total}" }}
19
+ renderLoop={(video, { poster, inView }) => <PausableLoop sources={video} poster={poster} active={inView} labels={{ pause: "Mettre l’animation en pause", play: "Lancer l’animation" }} />}
20
+ playerLabels={{ play: "Lire", pause: "Pause", mute: "Couper le son", unmute: "Remettre le son", volume: "Volume", seek: "Position", fullscreen: "Plein écran", exitFullscreen: "Quitter le plein écran", loading: "Chargement", error: "Cette vidéo ne peut pas être lue.", retry: "Réessayer" }}
21
+ />
22
+ </div>
23
+ );
24
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/carousel-single.tsx
4
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var PIC = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#1d3f6b'/></svg>")}`;
7
+ function MediaCarouselSingleExample() {
8
+ return /* @__PURE__ */ jsx("div", { className: "max-w-xl", children: /* @__PURE__ */ jsx(MediaCarousel, { label: "Realisation", slides: [{ id: "a", src: PIC, alt: "A lease read in a minute", caption: "Fig. 1a" }] }) });
9
+ }
10
+ export {
11
+ MediaCarouselSingleExample as default
12
+ };
@@ -0,0 +1,12 @@
1
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
2
+
3
+ const PIC = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#1d3f6b'/></svg>")}`;
4
+
5
+ // One slide: the frame alone, no arrows and no « 1 / 1 ». A page can pass one or many without branching.
6
+ export default function MediaCarouselSingleExample() {
7
+ return (
8
+ <div className="max-w-xl">
9
+ <MediaCarousel label="Realisation" slides={[{ id: "a", src: PIC, alt: "A lease read in a minute", caption: "Fig. 1a" }]} />
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/player-trigger.tsx
4
+ import { Button } from "@krizaka/ui/button";
5
+ import { MediaPlayer } from "@krizaka/ui/media-player";
6
+ import * as React from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
9
+ var POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>")}`;
10
+ function MediaPlayerTriggerExample() {
11
+ const [open, setOpen] = React.useState(false);
12
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
13
+ /* @__PURE__ */ jsx(MediaPlayer, { mode: "lightbox", src: FILM, poster: POSTER, title: "Film: the world of Krizaka", trigger: (openIt) => /* @__PURE__ */ jsx(Button, { onClick: openIt, children: "Watch the film" }) }),
14
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setOpen(true), children: "Open from outside" }),
15
+ /* @__PURE__ */ jsx(MediaPlayer, { mode: "lightbox", ratio: "19 / 16", src: FILM, poster: POSTER, title: "Film: the engine take", trigger: null, open, onOpenChange: setOpen })
16
+ ] });
17
+ }
18
+ export {
19
+ MediaPlayerTriggerExample as default
20
+ };
@@ -0,0 +1,19 @@
1
+ import { Button } from "@krizaka/ui/button";
2
+ import { MediaPlayer } from "@krizaka/ui/media-player";
3
+ import * as React from "react";
4
+
5
+ const FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
6
+ const POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>")}`;
7
+
8
+ // The page's own button opens the lightbox (`trigger`); a second one drives it from outside (`open`), on a free 19 / 16 frame.
9
+ // Under reduced motion the dialog opens on the poster and waits for the press on play.
10
+ export default function MediaPlayerTriggerExample() {
11
+ const [open, setOpen] = React.useState(false);
12
+ return (
13
+ <div className="flex flex-wrap gap-3">
14
+ <MediaPlayer mode="lightbox" src={FILM} poster={POSTER} title="Film: the world of Krizaka" trigger={(openIt) => <Button onClick={openIt}>Watch the film</Button>} />
15
+ <Button variant="secondary" onClick={() => setOpen(true)}>Open from outside</Button>
16
+ <MediaPlayer mode="lightbox" ratio="19 / 16" src={FILM} poster={POSTER} title="Film: the engine take" trigger={null} open={open} onOpenChange={setOpen} />
17
+ </div>
18
+ );
19
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krizaka/ui",
3
- "version": "3.85.0",
3
+ "version": "3.86.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@^3.85.0"
1007
+ "@krizaka/tokens@^3.86.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@^3.85.0",
4011
+ "@krizaka/tokens@^3.86.0",
4012
4012
  "@protomaps/basemaps@5.7.2",
4013
4013
  "tailwind-variants@^3.3.1"
4014
4014
  ],
@@ -4268,8 +4268,8 @@
4268
4268
  "name": "media-gallery",
4269
4269
  "type": "primitive",
4270
4270
  "title": "Media gallery",
4271
- "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
4272
- "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
4271
+ "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
4272
+ "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
4273
4273
  "status": "beta",
4274
4274
  "category": "media",
4275
4275
  "platforms": "web",
@@ -4286,7 +4286,7 @@
4286
4286
  }
4287
4287
  },
4288
4288
  "examples": {
4289
- "web": 3,
4289
+ "web": 6,
4290
4290
  "native": 0
4291
4291
  },
4292
4292
  "dependencies": [
@@ -4294,6 +4294,7 @@
4294
4294
  ],
4295
4295
  "registryDependencies": [
4296
4296
  "button",
4297
+ "cn",
4297
4298
  "dialog",
4298
4299
  "video-player"
4299
4300
  ]
@@ -4420,7 +4421,7 @@
4420
4421
  "native": 0
4421
4422
  },
4422
4423
  "dependencies": [
4423
- "@krizaka/tokens@^3.85.0",
4424
+ "@krizaka/tokens@^3.86.0",
4424
4425
  "radix-ui@^1.8.1",
4425
4426
  "tailwind-variants@^3.3.1"
4426
4427
  ],
@@ -5288,7 +5289,7 @@
5288
5289
  "native": 0
5289
5290
  },
5290
5291
  "dependencies": [
5291
- "@krizaka/tokens@^3.85.0",
5292
+ "@krizaka/tokens@^3.86.0",
5292
5293
  "radix-ui@^1.8.1",
5293
5294
  "tailwind-variants@^3.3.1"
5294
5295
  ],
@@ -5735,7 +5736,7 @@
5735
5736
  "native": 0
5736
5737
  },
5737
5738
  "dependencies": [
5738
- "@krizaka/tokens@^3.85.0",
5739
+ "@krizaka/tokens@^3.86.0",
5739
5740
  "zod@^4.6.7"
5740
5741
  ],
5741
5742
  "registryDependencies": [
@@ -5955,7 +5956,7 @@
5955
5956
  "native": 0
5956
5957
  },
5957
5958
  "dependencies": [
5958
- "@krizaka/tokens@^3.85.0",
5959
+ "@krizaka/tokens@^3.86.0",
5959
5960
  "radix-ui@^1.8.1",
5960
5961
  "tailwind-variants@^3.3.1"
5961
5962
  ],
package/registry/map.json CHANGED
@@ -1158,7 +1158,7 @@
1158
1158
  }
1159
1159
  ],
1160
1160
  "dependencies": [
1161
- "@krizaka/tokens@^3.85.0",
1161
+ "@krizaka/tokens@^3.86.0",
1162
1162
  "@protomaps/basemaps@5.7.2",
1163
1163
  "tailwind-variants@^3.3.1"
1164
1164
  ],
@@ -2,8 +2,8 @@
2
2
  "name": "media-gallery",
3
3
  "type": "primitive",
4
4
  "title": "Media gallery",
5
- "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
6
- "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
5
+ "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
6
+ "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
7
7
  "status": "beta",
8
8
  "deprecated": null,
9
9
  "category": "media",
@@ -41,6 +41,9 @@
41
41
  "A list named by `label`; each tile is a figure with the photo's `alt` and its caption.",
42
42
  "`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.",
43
43
  "`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.",
44
+ "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.",
45
+ "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.",
46
+ "`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`).",
44
47
  "Nothing moves under the pointer and nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).",
45
48
  "A loop is decorative (`aria-hidden`), starts only while its tile is on screen and never under reduced motion."
46
49
  ]
@@ -50,7 +53,7 @@
50
53
  ],
51
54
  "web": {
52
55
  "entry": "@krizaka/ui/media-gallery",
53
- "import": "import { MediaGallery, MediaCarousel, MediaPlayer } from \"@krizaka/ui/media-gallery\";",
56
+ "import": "import { MediaGallery, MediaCarousel, MediaPlayer, PausableLoop } from \"@krizaka/ui/media-gallery\";",
54
57
  "props": [
55
58
  {
56
59
  "component": "MediaGallery",
@@ -90,6 +93,22 @@
90
93
  "module": "@krizaka/ui/registry/examples/media-gallery/carousel",
91
94
  "code": "import { MediaCarousel } from \"@krizaka/ui/media-carousel\";\n\n// Drawn pictures (data URIs, no network); a page passes its own realisations.\nconst PIC = (a: string, b: string) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><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='800' height='500' fill='url(#g)'/></svg>`)}`;\n\n// Three realisations, one at a time; the first opens its film in a lightbox. Nothing advances by itself.\nexport default function MediaCarouselExample() {\n return (\n <div className=\"max-w-xl\">\n <MediaCarousel\n label=\"Realisations\"\n slides={[\n { id: \"a\", src: PIC(\"#1d3f6b\", \"#4d7fb8\"), alt: \"The brand film\", caption: \"Fig. 1a\", film: { src: \"https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4\", title: \"Film: the world of Krizaka\", playLabel: \"Play the film\" } },\n { id: \"b\", src: PIC(\"#23496f\", \"#6b9bc9\"), alt: \"A lease read in a minute\", caption: \"Fig. 1b\" },\n { id: \"c\", src: PIC(\"#2a3f5c\", \"#7aa5d6\"), alt: \"A return prepared, never filed\", caption: \"Fig. 1c\" },\n ]}\n />\n </div>\n );\n}\n"
92
95
  },
96
+ {
97
+ "name": "carousel-single",
98
+ "title": "Carousel, one slide",
99
+ "description": "A single slide draws no arrows and no count.",
100
+ "path": "examples/media-gallery/carousel-single.tsx",
101
+ "module": "@krizaka/ui/registry/examples/media-gallery/carousel-single",
102
+ "code": "import { MediaCarousel } from \"@krizaka/ui/media-carousel\";\n\nconst PIC = `data:image/svg+xml,${encodeURIComponent(\"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#1d3f6b'/></svg>\")}`;\n\n// One slide: the frame alone, no arrows and no « 1 / 1 ». A page can pass one or many without branching.\nexport default function MediaCarouselSingleExample() {\n return (\n <div className=\"max-w-xl\">\n <MediaCarousel label=\"Realisation\" slides={[{ id: \"a\", src: PIC, alt: \"A lease read in a minute\", caption: \"Fig. 1a\" }]} />\n </div>\n );\n}\n"
103
+ },
104
+ {
105
+ "name": "carousel-loop",
106
+ "title": "Carousel, loop and French words",
107
+ "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.",
108
+ "path": "examples/media-gallery/carousel-loop.tsx",
109
+ "module": "@krizaka/ui/registry/examples/media-gallery/carousel-loop",
110
+ "code": "import { MediaCarousel } from \"@krizaka/ui/media-carousel\";\nimport { PausableLoop } from \"@krizaka/ui/pausable-loop\";\n\nconst POSTER = `data:image/svg+xml,${encodeURIComponent(\"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#23496f'/></svg>\")}`;\nconst FILM = \"https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4\";\n\n// A French page: a silent loop previews the film (after the page's load, only on screen, with a visible pause), a press opens the\n// film, and every word of the carousel and of the player is passed translated. A still under reduced motion.\nexport default function MediaCarouselLoopExample() {\n return (\n <div className=\"max-w-xl\">\n <MediaCarousel\n label=\"Réalisations\"\n slides={[\n { id: \"a\", src: POSTER, alt: \"Le film de Krizaka\", caption: \"Fig. 1a\", video: { mp4: FILM }, film: { src: FILM, title: \"Film : le monde de Krizaka\", playLabel: \"Lire le film\" } },\n { id: \"b\", src: POSTER, alt: \"Un bail lu en une minute\", caption: \"Fig. 1b\", video: { mp4: FILM } },\n ]}\n labels={{ previous: \"Précédent\", next: \"Suivant\", close: \"Fermer\", slide: \"{n} sur {total}\" }}\n renderLoop={(video, { poster, inView }) => <PausableLoop sources={video} poster={poster} active={inView} labels={{ pause: \"Mettre l’animation en pause\", play: \"Lancer l’animation\" }} />}\n playerLabels={{ play: \"Lire\", pause: \"Pause\", mute: \"Couper le son\", unmute: \"Remettre le son\", volume: \"Volume\", seek: \"Position\", fullscreen: \"Plein écran\", exitFullscreen: \"Quitter le plein écran\", loading: \"Chargement\", error: \"Cette vidéo ne peut pas être lue.\", retry: \"Réessayer\" }}\n />\n </div>\n );\n}\n"
111
+ },
93
112
  {
94
113
  "name": "player",
95
114
  "title": "Player",
@@ -97,6 +116,14 @@
97
116
  "path": "examples/media-gallery/player.tsx",
98
117
  "module": "@krizaka/ui/registry/examples/media-gallery/player",
99
118
  "code": "import { MediaPlayer } from \"@krizaka/ui/media-player\";\n\nconst POSTER = `data:image/svg+xml,${encodeURIComponent(\"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>\")}`;\n\n// One player, three ways: a lightbox (a press opens it, with sound), inline, and vertical 9:16 in a lightbox.\nexport default function MediaPlayerExample() {\n return (\n <div className=\"grid max-w-2xl grid-cols-[2fr_1fr] items-start gap-3\">\n <MediaPlayer mode=\"lightbox\" src=\"https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4\" poster={POSTER} title=\"Film: the world of Krizaka\" playLabel=\"Play the film\" caption=\"Fig. 1\" />\n <MediaPlayer mode=\"lightbox\" vertical src=\"https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-9x16.aa28980db3.mp4\" poster={POSTER} title=\"Film: the world of Krizaka, vertical\" playLabel=\"Play the vertical film\" />\n </div>\n );\n}\n"
119
+ },
120
+ {
121
+ "name": "player-trigger",
122
+ "title": "Player, own trigger",
123
+ "description": "The page's button opens the lightbox (`trigger`); another drives a 19 / 16 one from outside (`open`, `onOpenChange`).",
124
+ "path": "examples/media-gallery/player-trigger.tsx",
125
+ "module": "@krizaka/ui/registry/examples/media-gallery/player-trigger",
126
+ "code": "import { Button } from \"@krizaka/ui/button\";\nimport { MediaPlayer } from \"@krizaka/ui/media-player\";\nimport * as React from \"react\";\n\nconst FILM = \"https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4\";\nconst POSTER = `data:image/svg+xml,${encodeURIComponent(\"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>\")}`;\n\n// The page's own button opens the lightbox (`trigger`); a second one drives it from outside (`open`), on a free 19 / 16 frame.\n// Under reduced motion the dialog opens on the poster and waits for the press on play.\nexport default function MediaPlayerTriggerExample() {\n const [open, setOpen] = React.useState(false);\n return (\n <div className=\"flex flex-wrap gap-3\">\n <MediaPlayer mode=\"lightbox\" src={FILM} poster={POSTER} title=\"Film: the world of Krizaka\" trigger={(openIt) => <Button onClick={openIt}>Watch the film</Button>} />\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>Open from outside</Button>\n <MediaPlayer mode=\"lightbox\" ratio=\"19 / 16\" src={FILM} poster={POSTER} title=\"Film: the engine take\" trigger={null} open={open} onOpenChange={setOpen} />\n </div>\n );\n}\n"
100
127
  }
101
128
  ]
102
129
  },
@@ -114,9 +141,13 @@
114
141
  "path": "media-gallery/index.ts",
115
142
  "content": "/** @krizaka/ui/media-gallery — `MediaGallery` (`items`, `label`), `mediaGallery`: a shop's photos and loops in tiles, the first featured. Client. `MediaCarousel` is `@krizaka/ui/media-carousel` and `MediaPlayer` is `@krizaka/ui/media-player`: their own entries, so the tiles stay light. */\nexport { type GalleryMedia, MediaGallery, mediaGallery, type MediaGalleryProps } from \"./media-gallery\";\n"
116
143
  },
144
+ {
145
+ "path": "media-gallery/loop-index.ts",
146
+ "content": "/** @krizaka/ui/pausable-loop — `PausableLoop` (`sources`, `poster`, `active`, `labels`): a muted loop over a still with a visible pause, for `MediaPlayer`'s `preview` and `MediaCarousel`'s `renderLoop`. Client. */\nexport { type LoopLabels, type LoopSources, PausableLoop, type PausableLoopProps } from \"./pausable-loop\";\n"
147
+ },
117
148
  {
118
149
  "path": "media-gallery/media-carousel.tsx",
119
- "content": "// Client (the slide in view, the reader's motion preference). A few realisations in one frame: a scroll-snap track moved by\n// a swipe, previous / next buttons in a toolbar that also takes the arrow keys, a « n / N » count. Nothing advances by itself and nothing moves under the pointer; a loop plays only on the\n// slide in view (a still under reduced motion); a slide with a film opens it in the MediaPlayer lightbox.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph } from \"../glyphs\";\nimport { usePrefersReducedMotion } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full\",\n track: \"m-0 flex list-none snap-x snap-mandatory gap-3 overflow-hidden p-0 touch-pan-y\",\n slide: \"relative m-0 w-full shrink-0 snap-center overflow-hidden rounded-xl border border-border-default bg-media\",\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 bar: \"mt-3 flex items-center justify-between gap-3\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex gap-2\",\n },\n});\nconst s = mediaCarousel();\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** The still, or the poster of a loop or a film. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a »: one line over the foot of the slide. */\n caption?: string;\n /** A muted loop playing while the slide is the one in view. */\n video?: { webm?: string; mp4?: string };\n /** A film opened by a press, with sound, in the lightbox of the MediaPlayer. */\n film?: Pick<MediaPlayerProps, \"src\" | \"title\" | \"tracks\" | \"loadHls\"> & { playLabel: string; vertical?: boolean };\n};\n\nexport type MediaCarouselLabels = { previous: string; next: string; close: string; slide: string };\nexport const mediaCarouselLabels: MediaCarouselLabels = { previous: \"Previous\", next: \"Next\", close: \"Close\", slide: \"{n} of {total}\" };\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order: 3 to 4 realisations. */\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 / 10`. */\n ratio?: string;\n /** The words, passed translated; English by default. `slide` takes `{n}` and `{total}`. */\n labels?: Partial<MediaCarouselLabels>;\n};\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\n\n/** The slide in view and the one way to change it: the track scrolls only from here, so it holds no scroll of its own to reach. */\nfunction useActiveSlide(track: React.RefObject<HTMLUListElement | null>, count: number) {\n const [active, setActive] = React.useState(0);\n const reduce = usePrefersReducedMotion();\n const go = (to: number) => {\n const el = track.current;\n if (!el) return active;\n const next = Math.min(count - 1, Math.max(0, to));\n el.scrollTo({ left: next * (el.scrollWidth / count), behavior: reduce ? \"auto\" : \"smooth\" });\n setActive(next);\n return next;\n };\n return { active, go, reduce };\n}\n\n/** A horizontal swipe on the track 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\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) || count < 2) return;\n const [previous, next] = toolbar.querySelectorAll(\"button\");\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\n/** The arrow keys of the toolbar: right turns forward, left back. */\nconst ARROWS: Partial<Record<string, 1 | -1>> = { ArrowRight: 1, ArrowLeft: -1 };\n\nfunction SlideMedia({ slide, playing, ratio, closeLabel }: Readonly<{ slide: CarouselSlide; playing: boolean; ratio: string; closeLabel: string }>) {\n if (slide.film) {\n const { playLabel, vertical, ...film } = slide.film;\n return <MediaPlayer {...film} mode=\"lightbox\" poster={slide.src} posterAlt={slide.alt} playLabel={playLabel} vertical={vertical} caption={slide.caption} closeLabel={closeLabel} className=\"h-full rounded-none border-0\" />;\n }\n return (\n <>\n <img src={slide.src} alt={slide.alt} loading=\"lazy\" decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />\n {playing && slide.video && (\n <video className={s.media()} poster={slide.src} autoPlay muted loop playsInline aria-hidden tabIndex={-1}>\n {slide.video.webm && <source src={slide.video.webm} type=\"video/webm\" />}\n {slide.video.mp4 && <source src={slide.video.mp4} type=\"video/mp4\" />}\n </video>\n )}\n {slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A few realisations in one frame, one at a time: swipe, buttons or arrow keys on them; nothing advances by itself. */\nexport function MediaCarousel({ slides, label, ratio = \"16 / 10\", labels: given, className, ...props }: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const track = React.useRef<HTMLUListElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const { active, go, reduce } = useActiveSlide(track, slides.length);\n const turn = (delta: 1 | -1) => keepFocus(toolbar.current, go(active + delta), slides.length);\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const delta = ARROWS[event.key];\n if (!delta) return;\n event.preventDefault();\n turn(delta);\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(slides.length));\n return (\n <section aria-roledescription=\"carousel\" aria-label={label} className={s.root({ className })} {...props}>\n <ul ref={track} className={s.track()} {...swipe}>\n {slides.map((slide, i) => (\n <li key={slide.id} aria-roledescription=\"slide\" aria-label={name(i)} className={s.slide()} style={{ aspectRatio: ratio }} aria-hidden={i === active ? undefined : true} inert={i === active ? undefined : true}>\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia slide={slide} playing={i === active && !reduce} ratio={ratio} closeLabel={labels.close} />\n </figure>\n </li>\n ))}\n </ul>\n <div className={s.bar()}>\n <span className={s.count()} aria-live=\"polite\">{active + 1} / {slides.length}</span>\n <div ref={toolbar} role=\"toolbar\" aria-orientation=\"horizontal\" className={s.buttons()} onKeyDown={keys}>\n <IconButton variant=\"secondary\" label={labels.previous} disabled={active === 0} onClick={() => turn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n <IconButton variant=\"secondary\" label={labels.next} disabled={active === slides.length - 1} onClick={() => turn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n </div>\n </div>\n </section>\n );\n}\n"
150
+ "content": "// Client (the slide in view, the reader's motion preference). A few realisations in one frame: a scroll-snap track moved by\n// a swipe, previous / next buttons in a toolbar that also takes the arrow keys, a « n / N » count. Nothing advances by itself and nothing moves under the pointer; a loop plays only on the\n// slide in view (a still under reduced motion); a slide with a film opens it in the MediaPlayer lightbox.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { ChevronGlyph } from \"../glyphs\";\nimport { usePrefersReducedMotion } from \"../media\";\nimport { MediaPlayer, type MediaPlayerProps } from \"./media-player\";\n\nexport const mediaCarousel = tv({\n slots: {\n root: \"relative isolate w-full\",\n track: \"m-0 flex list-none snap-x snap-mandatory gap-3 overflow-hidden p-0 touch-pan-y\",\n slide: \"relative m-0 w-full shrink-0 snap-center overflow-hidden rounded-xl border border-border-default bg-media\",\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 bar: \"mt-3 flex items-center justify-between gap-3\",\n count: \"text-xs tabular-nums text-fg-secondary\",\n buttons: \"flex gap-2\",\n },\n});\nconst s = mediaCarousel();\n\nexport type CarouselSlide = {\n /** A stable id. */\n id: string;\n /** The still, or the poster of a loop or a film. */\n src: string;\n /** What it shows, in words. */\n alt: string;\n /** « Fig. 1a »: one line over the foot of the slide. */\n caption?: string;\n /** A muted loop playing while the slide is the one in view and on screen, after the page's `load`, with a visible pause; a still under reduced motion. On a `film` slide it previews the film. */\n video?: { webm?: string; mp4?: string };\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 = { previous: string; next: string; close: string; slide: string };\nexport const mediaCarouselLabels: MediaCarouselLabels = { previous: \"Previous\", next: \"Next\", close: \"Close\", slide: \"{n} of {total}\" };\n\nexport type MediaCarouselProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** The slides, in order: 3 to 4 realisations. */\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 / 10`. */\n ratio?: string;\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 /** Draws a slide's `video`: `(video, { poster, inView }) => <PausableLoop sources={video} poster={poster} active={inView} />` (`@krizaka/ui/pausable-loop`, which brings the pause and play). Without it a slide stays a still, and this entry stays light. */\n renderLoop?: (video: NonNullable<CarouselSlide[\"video\"]>, context: { poster: string; inView: boolean }) => React.ReactNode;\n};\n\n/** How far a swipe travels, in CSS pixels, before it turns the slide. */\nconst SWIPE_DISTANCE = 40;\n\n/** The slide in view and the one way to change it: the track scrolls only from here, so it holds no scroll of its own to reach. */\nfunction useActiveSlide(track: React.RefObject<HTMLUListElement | null>, count: number) {\n const [active, setActive] = React.useState(0);\n const reduce = usePrefersReducedMotion();\n const go = (to: number) => {\n const el = track.current;\n if (!el) return active;\n const next = Math.min(count - 1, Math.max(0, to));\n el.scrollTo({ left: next * (el.scrollWidth / count), behavior: reduce ? \"auto\" : \"smooth\" });\n setActive(next);\n return next;\n };\n return { active, go };\n}\n\n/** A horizontal swipe on the track 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\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 [previous, next] = toolbar.querySelectorAll(\"button\");\n if (at === 0) next?.focus();\n if (at === count - 1) previous?.focus();\n}\n\n/** The arrow keys of the toolbar: right turns forward, left back. */\nconst ARROWS: Partial<Record<string, 1 | -1>> = { ArrowRight: 1, ArrowLeft: -1 };\n\ntype SlideMediaProps = Readonly<{ slide: CarouselSlide; loop: React.ReactNode; ratio: string; closeLabel: string; playerLabels?: MediaPlayerProps[\"labels\"] }>;\n\n/** A poster that opens its film, or a still; its loop, when `renderLoop` draws one, previews the film or plays over the still while the slide is the one in view. */\nfunction SlideMedia({ slide, loop, ratio, closeLabel, playerLabels }: SlideMediaProps) {\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={slide.caption}\n closeLabel={closeLabel}\n preview={loop}\n className=\"h-full rounded-none border-0\"\n />\n );\n }\n return (\n <>\n <img src={slide.src} alt={slide.alt} loading=\"lazy\" decoding=\"async\" draggable={false} className={s.media()} style={{ aspectRatio: ratio }} />\n {loop}\n {slide.caption && <figcaption className={s.caption()}>{slide.caption}</figcaption>}\n </>\n );\n}\n\n/** A few realisations in one frame, one at a time: swipe, buttons or arrow keys on them; nothing advances by itself. */\nexport function MediaCarousel({ slides, label, ratio = \"16 / 10\", labels: given, playerLabels, renderLoop, className, ...props }: Readonly<MediaCarouselProps>) {\n const labels = { ...mediaCarouselLabels, ...given };\n const track = React.useRef<HTMLUListElement>(null);\n const toolbar = React.useRef<HTMLDivElement>(null);\n const { active, go } = useActiveSlide(track, slides.length);\n const turn = (delta: 1 | -1) => keepFocus(toolbar.current, go(active + delta), slides.length);\n const swipe = useSwipe(turn);\n const keys = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const delta = ARROWS[event.key];\n if (!delta) return;\n event.preventDefault();\n turn(delta);\n };\n const name = (i: number) => labels.slide.replace(\"{n}\", String(i + 1)).replace(\"{total}\", String(slides.length));\n return (\n <section aria-roledescription=\"carousel\" aria-label={label} className={s.root({ className })} {...props}>\n <ul ref={track} className={s.track()} {...swipe}>\n {slides.map((slide, i) => (\n <li key={slide.id} aria-roledescription=\"slide\" aria-label={name(i)} className={s.slide()} style={{ aspectRatio: ratio }} aria-hidden={i === active ? undefined : true} inert={i === active ? undefined : true}>\n <figure className=\"m-0 h-full w-full\">\n <SlideMedia slide={slide} loop={slide.video && renderLoop?.(slide.video, { poster: slide.src, inView: i === active })} ratio={ratio} closeLabel={labels.close} playerLabels={playerLabels} />\n </figure>\n </li>\n ))}\n </ul>\n {slides.length > 1 && (\n <div className={s.bar()}>\n <span className={s.count()} aria-live=\"polite\">{active + 1} / {slides.length}</span>\n <div ref={toolbar} role=\"toolbar\" aria-orientation=\"horizontal\" className={s.buttons()} onKeyDown={keys}>\n <IconButton variant=\"secondary\" label={labels.previous} disabled={active === 0} onClick={() => turn(-1)}>\n <ChevronGlyph direction=\"left\" className=\"h-5 w-5\" />\n </IconButton>\n <IconButton variant=\"secondary\" label={labels.next} disabled={active === slides.length - 1} onClick={() => turn(1)}>\n <ChevronGlyph direction=\"right\" className=\"h-5 w-5\" />\n </IconButton>\n </div>\n </div>\n )}\n </section>\n );\n}\n"
120
151
  },
121
152
  {
122
153
  "path": "media-gallery/media-gallery.tsx",
@@ -124,11 +155,15 @@
124
155
  },
125
156
  {
126
157
  "path": "media-gallery/media-player.tsx",
127
- "content": "// Client (a dialog, the video player). ONE designed media player: the same frame inline, in a lightbox, or vertical (9:16).\n// Inline it is the VideoPlayer of `@krizaka/ui/video-player`; as a lightbox a poster with a play button opens the player in a\n// dialog, started by that press, with sound. Nothing moves under the pointer: the poster's hover is a colour.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { PlayGlyph } from \"../glyphs\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\n// The dialog and the player of the lightbox load when the poster is pressed, not with the page.\nconst PlayerLightbox = React.lazy(() => import(\"./player-lightbox\"));\n\nexport const mediaPlayer = tv({\n slots: {\n poster:\n \"group relative isolate block w-full overflow-hidden rounded-xl border border-border-default bg-media p-0 text-fg-on-media \" +\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n image: \"absolute inset-0 h-full w-full object-cover\",\n play:\n \"absolute left-1/2 top-1/2 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full \" +\n \"bg-scrim-strong text-fg-on-media transition-colors group-hover:bg-scrim\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-left text-xs font-semibold\",\n },\n});\nconst s = mediaPlayer();\n\nexport type MediaPlayerProps = Pick<\n VideoPlayerProps,\n \"src\" | \"poster\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"onPlay\" | \"onPause\" | \"onEnded\" | \"onError\"\n> & {\n /** `inline`: the player itself. `lightbox`: a poster that opens it in a dialog. Default `inline`. */\n mode?: \"inline\" | \"lightbox\";\n /** `9 / 16` frame for a vertical film; default `16 / 9`. */\n vertical?: boolean;\n /** The poster's words in the lightbox (\"Play the film\"), passed translated. Required for `lightbox`. */\n playLabel?: string;\n /** The close button's words, passed translated. Default `Close`. */\n closeLabel?: string;\n /** What the poster shows, in words (the `alt` of its image); default is empty (decorative: `playLabel` names the button). */\n posterAlt?: string;\n /** A line over the foot of the poster (« Fig. 1a »). */\n caption?: string;\n /** Called when the lightbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Classes merged on the player or the poster. */\n className?: string;\n};\n\n/** A video in one frame: inline, in a lightbox (a press opens it with sound), 16:9 or vertical. */\nexport function MediaPlayer({\n mode = \"inline\",\n vertical = false,\n playLabel,\n closeLabel = \"Close\",\n posterAlt = \"\",\n caption,\n onOpenChange,\n className,\n ...player\n}: MediaPlayerProps) {\n const ratio = vertical ? \"9 / 16\" : \"16 / 9\";\n const [open, setOpen] = React.useState(false);\n const poster = React.useRef<HTMLButtonElement>(null);\n const toggle = React.useCallback(\n (next: boolean) => {\n setOpen(next);\n onOpenChange?.(next);\n if (!next) poster.current?.focus();\n },\n [onOpenChange],\n );\n if (mode === \"inline\") return <VideoPlayer {...player} aspectRatio={ratio} className={className} />;\n return (\n <>\n <button ref={poster} type=\"button\" className={s.poster({ className })} style={{ aspectRatio: ratio }} aria-label={caption ? `${caption}. ${playLabel ?? player.title}` : (playLabel ?? player.title)} onClick={() => toggle(true)}>\n {player.poster && <img src={player.poster} alt={posterAlt} loading=\"lazy\" decoding=\"async\" className={s.image()} />}\n <span className={s.play()} aria-hidden>\n <PlayGlyph className=\"ml-1 h-6 w-6\" />\n </span>\n {caption && <span className={s.caption()}>{caption}</span>}\n </button>\n {open && (\n <React.Suspense fallback={null}>\n <PlayerLightbox player={player} ratio={ratio} vertical={vertical} closeLabel={closeLabel} onClose={() => toggle(false)} />\n </React.Suspense>\n )}\n </>\n );\n}\n"
158
+ "content": "// Client (a dialog, the video player). ONE designed media player: the same frame inline, in a lightbox, or vertical (9:16).\n// Inline it is the VideoPlayer of `@krizaka/ui/video-player`; as a lightbox a poster with a play button opens the player in a\n// dialog, started by that press, with sound. Nothing moves under the pointer: the poster's hover is a colour.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { PlayGlyph } from \"../glyphs\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\n// The dialog and the player of the lightbox load when the poster is pressed, not with the page.\nconst PlayerLightbox = React.lazy(() => import(\"./player-lightbox\"));\n\nexport const mediaPlayer = tv({\n slots: {\n frame: \"relative block w-full overflow-hidden rounded-xl border border-border-default bg-media p-0 text-fg-on-media\",\n poster:\n \"group absolute inset-0 block h-full w-full \" +\n \"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\",\n image: \"absolute inset-0 h-full w-full object-cover\",\n play:\n \"absolute left-1/2 top-1/2 flex h-14 w-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full \" +\n \"bg-scrim-strong text-fg-on-media transition-colors group-hover:bg-scrim\",\n caption: \"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-scrim-strong to-transparent p-3 pt-8 text-left text-xs font-semibold\",\n },\n});\nconst s = mediaPlayer();\n\nexport type MediaPlayerProps = Pick<\n VideoPlayerProps,\n \"src\" | \"poster\" | \"title\" | \"tracks\" | \"loadHls\" | \"labels\" | \"onPlay\" | \"onPause\" | \"onEnded\" | \"onError\"\n> & {\n /** `inline`: the player itself. `lightbox`: a poster that opens it in a dialog. Default `inline`. */\n mode?: \"inline\" | \"lightbox\";\n /** `9 / 16` frame and the narrow dialog for a vertical film; default `16 / 9`. */\n vertical?: boolean;\n /** Any frame ratio (`19 / 16`, `4 / 3`): wins over the frame of `vertical` (give both for a portrait ratio: `vertical ratio=\"3 / 4\"`). Default `16 / 9` (`9 / 16` when `vertical`). */\n ratio?: string;\n /** The poster's words in the lightbox (\"Play the film\"), passed translated. Required for `lightbox`. */\n playLabel?: string;\n /** The close button's words, passed translated. Default `Close`. */\n closeLabel?: string;\n /** What the poster shows, in words (the `alt` of its image); default is empty (decorative: `playLabel` names the button). */\n posterAlt?: string;\n /** A line over the foot of the poster (« Fig. 1a »). */\n caption?: string;\n /** Lightbox: drawn over the poster, under its press (the frame is `relative`): a `<PausableLoop>` of `@krizaka/ui/pausable-loop` previews the film with a muted loop. */\n preview?: React.ReactNode;\n /** Lightbox: opens or closes it from outside (controlled). With it, `onOpenChange` is how the lightbox asks to close. */\n open?: boolean;\n /** Lightbox: replaces the poster with your own opener (`(open) => <button onClick={open}>…`); `null` draws nothing, for a lightbox driven by `open` alone. */\n trigger?: ((open: () => void) => React.ReactNode) | null;\n /** Called when the lightbox opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Classes merged on the player or the poster. */\n className?: string;\n};\n\n/** A video in one frame: inline, in a lightbox (a press opens it with sound), 16:9 or vertical. */\nexport function MediaPlayer({\n mode = \"inline\",\n vertical = false,\n playLabel,\n closeLabel = \"Close\",\n posterAlt = \"\",\n caption,\n preview,\n open: given,\n trigger,\n onOpenChange,\n ratio: freeRatio,\n className,\n ...player\n}: MediaPlayerProps) {\n const ratio = freeRatio ?? (vertical ? \"9 / 16\" : \"16 / 9\");\n const [inner, setInner] = React.useState(false);\n const open = given ?? inner;\n const setOpen = (next: boolean) => {\n setInner(next);\n onOpenChange?.(next);\n };\n // The dialog hands the focus back to whatever opened it (the poster or the page's own trigger) when it closes.\n if (mode === \"inline\") return <VideoPlayer {...player} aspectRatio={ratio} className={className} />;\n const name = playLabel ?? player.title;\n // The default opener: the poster (and its loop) in a frame, one button named by `playLabel`; the pause is a sibling, never nested.\n const opener =\n trigger === undefined ? (\n <div className={s.frame({ className })} style={{ aspectRatio: ratio }}>\n {player.poster && <img src={player.poster} alt={posterAlt} loading=\"lazy\" decoding=\"async\" className={s.image()} />}\n {preview}\n <button type=\"button\" className={s.poster()} aria-label={caption ? `${caption}. ${name}` : name} onClick={() => setOpen(true)}>\n <span className={s.play()} aria-hidden>\n <PlayGlyph className=\"ml-1 h-6 w-6\" />\n </span>\n {caption && <span className={s.caption()}>{caption}</span>}\n </button>\n </div>\n ) : (\n trigger?.(() => setOpen(true))\n );\n return (\n <>\n {opener}\n {open && (\n <React.Suspense fallback={null}>\n <PlayerLightbox player={player} ratio={ratio} vertical={vertical} closeLabel={closeLabel} onClose={() => setOpen(false)} />\n </React.Suspense>\n )}\n </>\n );\n}\n"
128
159
  },
129
160
  {
130
161
  "path": "media-gallery/meta.ts",
131
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Media gallery\",\n summary: \"Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.\",\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 ],\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 \"Nothing moves under the pointer and nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).\",\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\"],\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: \"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 ],\n },\n} satisfies ComponentMeta;\n"
162
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Media gallery\",\n summary: \"Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.\",\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 ],\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 and nothing advances by itself; a loop plays only on the slide in view, never under reduced motion (the still shows, the buttons stay).\",\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-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"
163
+ },
164
+ {
165
+ "path": "media-gallery/pausable-loop.tsx",
166
+ "content": "// @krizaka/ui/pausable-loop. Client (the page's load, the viewport, the reader's motion and data preferences). A muted, silent loop that previews a still or a\n// film: poster first, nothing fetched before the page's `load`, playing only while on screen, with a visible pause / play\n// control (WCAG 2.2.2). Under reduced motion or Save-Data the poster stays alone and there is nothing to pause.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { PauseGlyph, PlayGlyph } from \"../glyphs\";\nimport { playSafely, useInView, usePrefersReducedMotion } from \"../media\";\n\nexport type LoopSources = { webm?: string; mp4?: string };\nexport type LoopLabels = { pause: string; play: string };\nexport const loopLabels: LoopLabels = { pause: \"Pause the animation\", play: \"Play the animation\" };\n\nconst subscribeLoad = (notify: () => void) => {\n window.addEventListener(\"load\", notify);\n return () => window.removeEventListener(\"load\", notify);\n};\n/** `true` once the page has finished loading: a loop is not worth bytes before it. */\nfunction usePageLoaded(): boolean {\n return React.useSyncExternalStore(subscribeLoad, () => document.readyState === \"complete\", () => false);\n}\n\ntype SaveDataNavigator = Navigator & { connection?: { saveData?: boolean } };\n/** `true` when the person asked for less motion or less data: a loop stays a poster. */\nfunction useCalm(): boolean {\n const reduce = usePrefersReducedMotion();\n return reduce || (typeof navigator !== \"undefined\" && Boolean((navigator as SaveDataNavigator).connection?.saveData));\n}\n\nexport type PausableLoopProps = {\n /** The loop's files; `mp4` and / or `webm`. */\n sources: LoopSources;\n /** The still under the loop, shown first and kept under reduced motion or Save-Data. */\n poster: string;\n /** Plays only while `true` (e.g. the slide in view). Default `true`. */\n active?: boolean;\n /** The pause / play words, passed translated. English by default. */\n labels?: LoopLabels;\n /** Classes of the `<video>`; default fills its frame, cropped. */\n className?: string;\n};\n\n/** A muted, silent loop over a still, with a visible pause / play. Drop it into a frame that is `relative`: `MediaPlayer`'s `preview`, `MediaCarousel`'s `renderLoop`. */\nexport function PausableLoop({ sources, poster, active = true, labels = loopLabels, className = \"absolute inset-0 h-full w-full object-cover\" }: Readonly<PausableLoopProps>) {\n const calm = useCalm();\n const loaded = usePageLoaded();\n const mounted = !calm && loaded;\n const holder = React.useRef<HTMLDivElement>(null);\n const video = React.useRef<HTMLVideoElement>(null);\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n const [paused, setPaused] = React.useState(false);\n useInView(holder, setOnScreen, mounted);\n const playing = mounted && onScreen && active && !paused;\n React.useEffect(() => {\n if (!video.current) return;\n if (playing) playSafely(video.current);\n else video.current.pause?.();\n }, [playing]);\n const Glyph = paused ? PlayGlyph : PauseGlyph;\n return (\n <>\n <div ref={holder} className=\"absolute inset-0\">\n {mounted && (\n <video ref={video} className={className} poster={poster} muted loop playsInline preload=\"metadata\" aria-hidden tabIndex={-1}>\n {sources.webm && <source src={sources.webm} type=\"video/webm\" />}\n {sources.mp4 && <source src={sources.mp4} type=\"video/mp4\" />}\n </video>\n )}\n </div>\n {!calm && (\n <button\n type=\"button\"\n aria-label={paused ? labels.play : labels.pause}\n onClick={() => setPaused((p) => !p)}\n className={cn(\n \"absolute right-2 top-2 z-10 flex h-9 w-9 items-center justify-center rounded-full bg-scrim-strong text-fg-on-media transition-colors hover:bg-scrim \" +\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none\",\n )}\n >\n <Glyph className=\"h-4 w-4\" />\n </button>\n )}\n </>\n );\n}\n"
132
167
  },
133
168
  {
134
169
  "path": "media-gallery/player-index.ts",
@@ -136,7 +171,7 @@
136
171
  },
137
172
  {
138
173
  "path": "media-gallery/player-lightbox.tsx",
139
- "content": "// Client. The lightbox's dialog and its player: loaded by `MediaPlayer` only when the poster is pressed.\nimport * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\nexport type PlayerLightboxProps = {\n player: Omit<VideoPlayerProps, \"aspectRatio\" | \"className\">;\n ratio: string;\n vertical: boolean;\n closeLabel: string;\n onClose: () => void;\n};\n\n/** The open dialog holding the player, started by the press that opened it. */\nexport default function PlayerLightbox({ player, ratio, vertical, closeLabel, onClose }: Readonly<PlayerLightboxProps>) {\n return (\n <Dialog.Root open onOpenChange={(open) => !open && onClose()}>\n <Dialog.Content size={vertical ? \"sm\" : \"lg\"} closeLabel={closeLabel} className=\"bg-media p-0\">\n <Dialog.Title className=\"sr-only\">{player.title}</Dialog.Title>\n <VideoPlayer {...player} aspectRatio={ratio} playOnMount pauseWhenHidden={false} />\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
174
+ "content": "// Client. The lightbox's dialog and its player: loaded by `MediaPlayer` only when the poster is pressed.\nimport * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { usePrefersReducedMotion } from \"../media\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\nexport type PlayerLightboxProps = {\n player: Omit<VideoPlayerProps, \"aspectRatio\" | \"className\">;\n ratio: string;\n vertical: boolean;\n closeLabel: string;\n onClose: () => void;\n};\n\n/** The open dialog holding the player, started by the press that opened it, except under reduced motion: it waits on the poster. */\nexport default function PlayerLightbox({ player, ratio, vertical, closeLabel, onClose }: Readonly<PlayerLightboxProps>) {\n const calm = usePrefersReducedMotion();\n return (\n <Dialog.Root open onOpenChange={(open) => !open && onClose()}>\n <Dialog.Content size={vertical ? \"sm\" : \"lg\"} closeLabel={closeLabel} className=\"bg-media p-0\">\n <Dialog.Title className=\"sr-only\">{player.title}</Dialog.Title>\n <VideoPlayer {...player} aspectRatio={ratio} playOnMount={!calm} pauseWhenHidden={false} />\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"
140
175
  },
141
176
  {
142
177
  "path": "media.ts",
@@ -152,6 +187,7 @@
152
187
  ],
153
188
  "registryDependencies": [
154
189
  "button",
190
+ "cn",
155
191
  "dialog",
156
192
  "video-player"
157
193
  ],
@@ -715,7 +715,7 @@
715
715
  }
716
716
  ],
717
717
  "dependencies": [
718
- "@krizaka/tokens@^3.85.0",
718
+ "@krizaka/tokens@^3.86.0",
719
719
  "radix-ui@^1.8.1",
720
720
  "tailwind-variants@^3.3.1"
721
721
  ],
@@ -340,7 +340,7 @@
340
340
  }
341
341
  ],
342
342
  "dependencies": [
343
- "@krizaka/tokens@^3.85.0",
343
+ "@krizaka/tokens@^3.86.0",
344
344
  "radix-ui@^1.8.1",
345
345
  "tailwind-variants@^3.3.1"
346
346
  ],
@@ -700,7 +700,7 @@
700
700
  }
701
701
  ],
702
702
  "dependencies": [
703
- "@krizaka/tokens@^3.85.0",
703
+ "@krizaka/tokens@^3.86.0",
704
704
  "zod@^4.6.7"
705
705
  ],
706
706
  "registryDependencies": [
@@ -366,7 +366,7 @@
366
366
  }
367
367
  ],
368
368
  "dependencies": [
369
- "@krizaka/tokens@^3.85.0",
369
+ "@krizaka/tokens@^3.86.0",
370
370
  "radix-ui@^1.8.1",
371
371
  "tailwind-variants@^3.3.1"
372
372
  ],