@krizaka/ui 3.71.0 → 3.73.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/blocks.css +26 -0
- package/dist/chunk-M3T5RQYV.js +34 -0
- package/dist/chunk-M3T5RQYV.js.map +1 -0
- package/dist/chunk-ZFR6ZNXD.js +203 -0
- package/dist/chunk-ZFR6ZNXD.js.map +1 -0
- package/dist/filter-bar.d.ts +3 -3
- package/dist/{frame-D6Xv83t8.d.ts → frame-CNZ5VgDD.d.ts} +11 -4
- package/dist/retro-tv-playlist.d.ts +148 -0
- package/dist/retro-tv-playlist.js +234 -0
- package/dist/retro-tv-playlist.js.map +1 -0
- package/dist/retro-tv.js +4 -160
- package/dist/retro-tv.js.map +1 -1
- package/dist/schema-DgjBz7-8.d.ts +242 -0
- package/dist/shop/booking.d.ts +2 -2
- package/dist/shop/booking.js +1 -1
- package/dist/shop/booking.js.map +1 -1
- package/dist/shop/bulletin.js +1 -1
- package/dist/shop/faq.d.ts +2 -1
- package/dist/shop/faq.js +1 -1
- package/dist/shop/faq.js.map +1 -1
- package/dist/shop/gallery.js +1 -1
- package/dist/shop/look.d.ts +43 -0
- package/dist/shop/look.js +52 -0
- package/dist/shop/look.js.map +1 -0
- package/dist/shop/policies.d.ts +2 -1
- package/dist/shop/policies.js +1 -1
- package/dist/shop/policies.js.map +1 -1
- package/dist/shop/reviews.d.ts +2 -1
- package/dist/shop/reviews.js +1 -1
- package/dist/shop/reviews.js.map +1 -1
- package/dist/shop/services.js +1 -1
- package/dist/shop/social.js +1 -1
- package/dist/shop/story.d.ts +2 -1
- package/dist/shop/story.js +1 -1
- package/dist/shop/story.js.map +1 -1
- package/dist/shop/team.js +1 -1
- package/dist/shop/video.js +1 -1
- package/dist/shop/visit.js +1 -1
- package/dist/shop-composer.d.ts +29 -0
- package/dist/shop-composer.js +156 -89
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop.d.ts +6 -240
- package/dist/shop.js +24 -212
- package/dist/shop.js.map +1 -1
- package/package.json +37 -7
- package/registry/account-menu.json +4 -2
- package/registry/account-settings.json +4 -2
- package/registry/achievement.json +4 -2
- package/registry/action-bar.json +4 -2
- package/registry/action-sheet.json +2 -0
- package/registry/activity-feed.json +4 -2
- package/registry/agenda.json +4 -2
- package/registry/alert.json +4 -2
- package/registry/analysis-report.json +4 -2
- package/registry/anatomy-plate.json +4 -2
- package/registry/app-frame.json +5 -3
- package/registry/app-header.json +4 -2
- package/registry/app-shell.json +4 -2
- package/registry/argument-card.json +4 -2
- package/registry/audio-player.json +4 -2
- package/registry/auth-layout.json +4 -2
- package/registry/avatar.json +4 -2
- package/registry/badge.json +4 -2
- package/registry/bird-plate.json +4 -2
- package/registry/button.json +4 -2
- package/registry/captcha.json +4 -2
- package/registry/card-grid.json +4 -2
- package/registry/card.json +4 -2
- package/registry/catalogue-page.json +4 -2
- package/registry/changelog-page.json +4 -2
- package/registry/chapter.json +4 -2
- package/registry/chat.json +4 -2
- package/registry/checkbox.json +4 -2
- package/registry/chip-link.json +4 -2
- package/registry/chip-row.json +4 -2
- package/registry/chip.json +4 -2
- package/registry/choice-grid.json +4 -2
- package/registry/cn.json +2 -0
- package/registry/code-block.json +4 -2
- package/registry/collection-switcher.json +4 -2
- package/registry/combobox.json +4 -2
- package/registry/command.json +4 -2
- package/registry/comparison-table.json +4 -2
- package/registry/component-page.json +4 -2
- package/registry/confirm-button.json +4 -2
- package/registry/contact-page.json +4 -2
- package/registry/continue-prompt.json +4 -2
- package/registry/copy-button.json +4 -2
- package/registry/countdown.json +4 -2
- package/registry/cover-hero.json +4 -2
- package/registry/cta-panel.json +4 -2
- package/registry/dashboard-layout.json +4 -2
- package/registry/data-table.json +4 -2
- package/registry/date-picker.json +4 -2
- package/registry/decision-list.json +4 -2
- package/registry/description-list.json +4 -2
- package/registry/desktop-window.json +5 -3
- package/registry/detail-layout.json +4 -2
- package/registry/dialog.json +4 -2
- package/registry/docs-article-page.json +4 -2
- package/registry/docs-hub-page.json +4 -2
- package/registry/docs-layout.json +4 -2
- package/registry/docs-nav.json +4 -2
- package/registry/document-viewer.json +4 -2
- package/registry/doodle.json +4 -2
- package/registry/drop-overlay.json +4 -2
- package/registry/dropdown-menu.json +4 -2
- package/registry/elephant.json +5 -3
- package/registry/embed-facade.json +4 -2
- package/registry/empty-state.json +4 -2
- package/registry/engine-flow.json +4 -2
- package/registry/entity-header.json +4 -2
- package/registry/environment-notice.json +4 -2
- package/registry/error-page.json +4 -2
- package/registry/fab.json +2 -0
- package/registry/field.json +4 -2
- package/registry/file-upload.json +4 -2
- package/registry/filter-bar.json +4 -2
- package/registry/flock.json +4 -2
- package/registry/footnote.json +4 -2
- package/registry/force-update-screen.json +4 -2
- package/registry/form-flow.json +3 -1
- package/registry/form.json +4 -2
- package/registry/gallery-page.json +4 -2
- package/registry/genui.json +4 -2
- package/registry/glossary-term.json +4 -2
- package/registry/glossary.json +4 -2
- package/registry/glow-card.json +4 -2
- package/registry/goal-gauge.json +4 -2
- package/registry/grade-stamp.json +4 -2
- package/registry/grid.json +2 -0
- package/registry/header.json +2 -0
- package/registry/how-it-works-page.json +4 -2
- package/registry/image-cropper.json +4 -2
- package/registry/image-viewer.json +2 -0
- package/registry/index.json +19 -18
- package/registry/iso.json +4 -2
- package/registry/kanban.json +4 -2
- package/registry/kbd.json +4 -2
- package/registry/kind-config-editor.json +4 -2
- package/registry/kpi-explained.json +4 -2
- package/registry/landing-page.json +4 -2
- package/registry/landscape.json +4 -2
- package/registry/language-switch.json +4 -2
- package/registry/legal-page.json +4 -2
- package/registry/link-card.json +4 -2
- package/registry/list-detail.json +2 -0
- package/registry/list.json +4 -2
- package/registry/loader.json +4 -2
- package/registry/longform-page.json +4 -2
- package/registry/maintenance-screen.json +4 -2
- package/registry/map.json +5 -3
- package/registry/margin-layout.json +4 -2
- package/registry/markdown.json +4 -2
- package/registry/marketing-layout.json +4 -2
- package/registry/marquee.json +4 -2
- package/registry/mascot-quote.json +4 -2
- package/registry/mascot-state.json +4 -2
- package/registry/mascots.json +4 -2
- package/registry/match-dialog.json +4 -2
- package/registry/media-capture.json +4 -2
- package/registry/media-gallery.json +4 -2
- package/registry/media-grid.json +4 -2
- package/registry/media-picker.json +2 -0
- package/registry/meta-row.json +4 -2
- package/registry/meter.json +4 -2
- package/registry/money-input.json +5 -3
- package/registry/nav-bar.json +5 -3
- package/registry/next-actions.json +4 -2
- package/registry/notification-preferences.json +4 -2
- package/registry/number-ticker.json +4 -2
- package/registry/onboarding.json +2 -0
- package/registry/opening-hours.json +4 -2
- package/registry/otp-input.json +2 -0
- package/registry/page-header.json +4 -2
- package/registry/page-hero.json +4 -2
- package/registry/page-index.json +4 -2
- package/registry/page.json +4 -2
- package/registry/pagination.json +4 -2
- package/registry/permission-prompt.json +2 -0
- package/registry/photo-grid.json +4 -2
- package/registry/pointer-light.json +4 -2
- package/registry/popover.json +4 -2
- package/registry/price-catalogue-editor.json +5 -3
- package/registry/pricing-page.json +4 -2
- package/registry/product-page.json +4 -2
- package/registry/profile-card.json +4 -2
- package/registry/progress.json +4 -2
- package/registry/promise-card.json +4 -2
- package/registry/promo-code-field.json +5 -3
- package/registry/proposal.json +5 -3
- package/registry/pull-to-refresh.json +2 -0
- package/registry/qr-code.json +4 -2
- package/registry/quota-meter.json +4 -2
- package/registry/radio-group.json +4 -2
- package/registry/rail-nav.json +5 -3
- package/registry/recipes.json +4 -2
- package/registry/retro-tv.json +9 -3
- package/registry/reviews.json +4 -2
- package/registry/router.json +4 -2
- package/registry/schema-form.json +5 -3
- package/registry/screen.json +2 -0
- package/registry/scroll-stage.json +4 -2
- package/registry/search-field.json +4 -2
- package/registry/section-backdrop.json +4 -2
- package/registry/segmented.json +2 -0
- package/registry/separator.json +4 -2
- package/registry/service-card.json +4 -2
- package/registry/settings-layout.json +4 -2
- package/registry/shop-composer.json +13 -7
- package/registry/shop-gallery.json +5 -3
- package/registry/shop.json +54 -11
- package/registry/showcase.json +4 -2
- package/registry/signature.json +4 -2
- package/registry/site-cahier.json +4 -2
- package/registry/site-footer.json +5 -3
- package/registry/sites.json +4 -2
- package/registry/skeleton.json +4 -2
- package/registry/skip-link.json +4 -2
- package/registry/slider.json +4 -2
- package/registry/slot-picker.json +4 -2
- package/registry/slot.json +4 -2
- package/registry/specimen-tag.json +4 -2
- package/registry/speed-lines.json +4 -2
- package/registry/spinner.json +4 -2
- package/registry/splash-handoff.json +2 -0
- package/registry/split-view.json +4 -2
- package/registry/stage-banner.json +4 -2
- package/registry/stat.json +4 -2
- package/registry/state-screen.json +3 -1
- package/registry/status-chip.json +4 -2
- package/registry/status-page.json +4 -2
- package/registry/step-progress.json +4 -2
- package/registry/step-showcase.json +4 -2
- package/registry/stepper.json +4 -2
- package/registry/sticky-action.json +4 -2
- package/registry/stuck.json +4 -2
- package/registry/swipe-deck.json +4 -2
- package/registry/swipeable-row.json +2 -0
- package/registry/switch.json +4 -2
- package/registry/tab-bar.json +2 -0
- package/registry/tabs.json +4 -2
- package/registry/tag-input.json +4 -2
- package/registry/tag-selector.json +4 -2
- package/registry/taped-photo.json +4 -2
- package/registry/terminal-replay.json +4 -2
- package/registry/text-style.json +4 -2
- package/registry/theme.json +4 -2
- package/registry/toast.json +4 -2
- package/registry/toc.json +4 -2
- package/registry/tooltip.json +4 -2
- package/registry/tree-view.json +4 -2
- package/registry/txt.json +2 -0
- package/registry/update-prompt.json +4 -2
- package/registry/upload-queue.json +4 -2
- package/registry/usage.json +5 -3
- package/registry/verified-badge.json +4 -2
- package/registry/versus-card.json +4 -2
- package/registry/vertical-video.json +4 -2
- package/registry/video-player.json +4 -2
- package/registry/video-trimmer.json +4 -2
- package/registry/virtual.json +4 -2
- package/registry/wall.json +4 -2
- package/registry/waveform.json +4 -2
- package/dist/chunk-A7MQPIEG.js +0 -31
- package/dist/chunk-A7MQPIEG.js.map +0 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/retro-tv/playlist-screen.tsx
|
|
5
|
+
import * as React2 from "react";
|
|
6
|
+
|
|
7
|
+
// src/glyphs.tsx
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function Glyph({ className = "h-4 w-4", fill, children }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"svg",
|
|
12
|
+
{
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
className,
|
|
15
|
+
fill: fill ? "currentColor" : "none",
|
|
16
|
+
stroke: fill ? "none" : "currentColor",
|
|
17
|
+
strokeWidth: "2",
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
strokeLinejoin: "round",
|
|
20
|
+
"aria-hidden": true,
|
|
21
|
+
focusable: "false",
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
var PlayGlyph = (p) => /* @__PURE__ */ jsx(Glyph, { ...p, fill: true, children: /* @__PURE__ */ jsx("path", { d: "M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z" }) });
|
|
27
|
+
var PauseGlyph = (p) => /* @__PURE__ */ jsxs(Glyph, { ...p, fill: true, children: [
|
|
28
|
+
/* @__PURE__ */ jsx("rect", { x: "6", y: "5", width: "4", height: "14", rx: "1" }),
|
|
29
|
+
/* @__PURE__ */ jsx("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1" })
|
|
30
|
+
] });
|
|
31
|
+
var VolumeGlyph = ({ muted, ...p }) => /* @__PURE__ */ jsxs(Glyph, { ...p, children: [
|
|
32
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5 6 9H3v6h3l5 4V5Z" }),
|
|
33
|
+
muted ? /* @__PURE__ */ jsx("path", { d: "m22 9-6 6m0-6 6 6" }) : /* @__PURE__ */ jsx("path", { d: "M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13" })
|
|
34
|
+
] });
|
|
35
|
+
var CaptionsGlyph = (p) => /* @__PURE__ */ jsxs(Glyph, { ...p, children: [
|
|
36
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
37
|
+
/* @__PURE__ */ jsx("path", { d: "M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3" })
|
|
38
|
+
] });
|
|
39
|
+
|
|
40
|
+
// src/media.ts
|
|
41
|
+
import * as React from "react";
|
|
42
|
+
function formatClock(seconds) {
|
|
43
|
+
const s = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
|
|
44
|
+
const h = Math.floor(s / 3600);
|
|
45
|
+
const m = Math.floor(s % 3600 / 60);
|
|
46
|
+
const rest = String(s % 60).padStart(2, "0");
|
|
47
|
+
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${rest}` : `${m}:${rest}`;
|
|
48
|
+
}
|
|
49
|
+
function useLatest(value) {
|
|
50
|
+
const ref = React.useRef(value);
|
|
51
|
+
React.useLayoutEffect(() => {
|
|
52
|
+
ref.current = value;
|
|
53
|
+
});
|
|
54
|
+
return ref;
|
|
55
|
+
}
|
|
56
|
+
function useInView(ref, onChange, enabled = true, threshold = 0.25) {
|
|
57
|
+
const latest = useLatest(onChange);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
const element = ref.current;
|
|
60
|
+
if (!enabled || !element || typeof IntersectionObserver === "undefined") return;
|
|
61
|
+
const observer = new IntersectionObserver(([entry]) => entry && latest.current(entry.isIntersecting), { threshold });
|
|
62
|
+
observer.observe(element);
|
|
63
|
+
return () => observer.disconnect();
|
|
64
|
+
}, [ref, enabled, threshold, latest]);
|
|
65
|
+
}
|
|
66
|
+
function playSafely(media) {
|
|
67
|
+
try {
|
|
68
|
+
const started = media?.play();
|
|
69
|
+
started?.catch?.(() => void 0);
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/retro-tv/playlist-screen.tsx
|
|
75
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
76
|
+
var styles = `.kz-rtv-layer{position:absolute;inset:0;background:var(--kz-scrim-strong)}
|
|
77
|
+
.kz-rtv-layer video,.kz-rtv-layer img,.kz-rtv-layer .kz-embed{width:100%;height:100%;object-fit:contain;aspect-ratio:auto}
|
|
78
|
+
.kz-rtv-layer[data-role=out]{z-index:1}.kz-rtv-layer[data-role=in]{z-index:2}
|
|
79
|
+
.kz-rtv-static{position:absolute;inset:0;z-index:4;overflow:hidden;pointer-events:none}
|
|
80
|
+
.kz-rtv-static:after{position:absolute;inset:-20% 0 auto;height:18%;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-text-on-media) 55%,transparent),transparent);content:""}
|
|
81
|
+
.kz-rtv-chip,.kz-rtv-bar button{display:inline-flex;min-width:2.25rem;min-height:2.25rem;align-items:center;justify-content:center;gap:.35rem;padding:0 .55rem;border:1px solid color-mix(in srgb,var(--kz-text-on-media) 30%,transparent);border-radius:999px;background:color-mix(in srgb,var(--kz-scrim-strong) 82%,transparent);color:var(--kz-text-on-media);font:600 .72rem/1 var(--kz-font-mono,monospace);cursor:pointer}
|
|
82
|
+
.kz-rtv-chip{position:absolute;z-index:8;top:.5rem;left:.5rem}
|
|
83
|
+
.kz-rtv-chip:focus-visible,.kz-rtv-bar button:focus-visible,.kz-rtv-seek:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}
|
|
84
|
+
.kz-rtv-bar{position:absolute;z-index:8;inset:auto 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;padding:1.6rem .6rem .6rem;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-scrim-strong) 85%,transparent));opacity:0;transition:opacity .25s}
|
|
85
|
+
.kz-rtv-screen[data-active=true] .kz-rtv-bar,.kz-rtv-screen:focus-within .kz-rtv-bar,.kz-rtv-screen:hover .kz-rtv-bar{opacity:1}
|
|
86
|
+
.kz-rtv-bar svg{width:1rem;height:1rem}
|
|
87
|
+
.kz-rtv-time{padding:.2rem .45rem;border-radius:4px;background:var(--kz-scrim-strong);color:var(--kz-text-on-media);font:600 .75rem/1 var(--kz-font-mono,monospace);font-variant-numeric:tabular-nums}
|
|
88
|
+
.kz-rtv-seek{flex:1 1 6rem;min-width:5rem;height:1.5rem;accent-color:var(--kz-accent);cursor:pointer}
|
|
89
|
+
.kz-rtv-progress{position:absolute;z-index:7;inset:auto 0 0;height:3px;background:color-mix(in srgb,var(--kz-text-on-media) 25%,transparent)}
|
|
90
|
+
.kz-rtv-progress i{display:block;height:100%;background:var(--kz-accent);transform-origin:left;transform:scaleX(var(--kz-rtv-p,0))}
|
|
91
|
+
@keyframes kz-rtv-in{from{opacity:0}to{opacity:1}}@keyframes kz-rtv-out{from{opacity:1}to{opacity:0}}
|
|
92
|
+
@keyframes kz-rtv-sin{from{transform:translateX(100%)}to{transform:none}}@keyframes kz-rtv-sout{from{transform:none}to{transform:translateX(-100%)}}
|
|
93
|
+
@keyframes kz-rtv-tune{0%{transform:translateY(-12%) scaleY(1.15);filter:contrast(2) brightness(1.6)}100%{transform:none;filter:none}}
|
|
94
|
+
@keyframes kz-rtv-roll{from{transform:translateY(0)}to{transform:translateY(700%)}}
|
|
95
|
+
@media (prefers-reduced-motion:no-preference){
|
|
96
|
+
.kz-rtv-layer[data-role=in][data-tr=crossfade]{animation:kz-rtv-in .6s both}.kz-rtv-layer[data-role=out][data-tr=crossfade]{animation:kz-rtv-out .6s both}
|
|
97
|
+
.kz-rtv-layer[data-role=in][data-tr=slide]{animation:kz-rtv-sin .5s ease-out both}.kz-rtv-layer[data-role=out][data-tr=slide]{animation:kz-rtv-sout .5s ease-out both}
|
|
98
|
+
.kz-rtv-layer[data-role=in][data-tr=channel]{animation:kz-rtv-tune .55s steps(8,end) both}
|
|
99
|
+
.kz-rtv-static{animation:kz-rtv-in .55s reverse both}.kz-rtv-static:after{animation:kz-rtv-roll .55s linear both}}
|
|
100
|
+
`;
|
|
101
|
+
function PlaylistScreen({ playlist, transition, labels, muted, autoPlay, renderEmbed, onMutedChange, onIndexChange, title, reduced, setMutedState, setIndex, index }) {
|
|
102
|
+
const region = React2.useRef(null);
|
|
103
|
+
const video = React2.useRef(null);
|
|
104
|
+
const [prev, setPrev] = React2.useState(null);
|
|
105
|
+
const [seen, setSeen] = React2.useState(false);
|
|
106
|
+
const [playing, setPlaying] = React2.useState(false);
|
|
107
|
+
const [time, setTime] = React2.useState({ t: 0, d: 0 });
|
|
108
|
+
const [active, setActive] = React2.useState(false);
|
|
109
|
+
const [captionsOn, setCaptionsOn] = React2.useState(false);
|
|
110
|
+
const n = playlist.length;
|
|
111
|
+
const current = playlist[index];
|
|
112
|
+
const wake = React2.useCallback(() => setActive(true), []);
|
|
113
|
+
useInView(region, (v) => {
|
|
114
|
+
if (v) setSeen(true);
|
|
115
|
+
else video.current?.pause();
|
|
116
|
+
});
|
|
117
|
+
React2.useEffect(() => {
|
|
118
|
+
if (!active) return;
|
|
119
|
+
const id = setTimeout(() => setActive(false), 2500);
|
|
120
|
+
return () => clearTimeout(id);
|
|
121
|
+
}, [active]);
|
|
122
|
+
React2.useEffect(() => {
|
|
123
|
+
if (prev === null) return;
|
|
124
|
+
const id = setTimeout(() => setPrev(null), reduced ? 0 : 650);
|
|
125
|
+
return () => clearTimeout(id);
|
|
126
|
+
}, [prev, reduced]);
|
|
127
|
+
React2.useEffect(() => {
|
|
128
|
+
if (seen && autoPlay && !reduced && current?.src) playSafely(video.current);
|
|
129
|
+
}, [seen, autoPlay, reduced, index, current?.src]);
|
|
130
|
+
React2.useEffect(() => {
|
|
131
|
+
const list = video.current?.textTracks;
|
|
132
|
+
if (list) Array.from(list).forEach((track, i) => {
|
|
133
|
+
track.mode = captionsOn && i === 0 ? "showing" : "disabled";
|
|
134
|
+
});
|
|
135
|
+
}, [captionsOn, index]);
|
|
136
|
+
const go = (to) => {
|
|
137
|
+
const next = (to % n + n) % n;
|
|
138
|
+
if (next === index && n > 1) return;
|
|
139
|
+
if (!reduced && n > 1) setPrev(index);
|
|
140
|
+
setIndex(next);
|
|
141
|
+
setTime({ t: 0, d: 0 });
|
|
142
|
+
onIndexChange?.(next);
|
|
143
|
+
};
|
|
144
|
+
const toggle = () => {
|
|
145
|
+
const v = video.current;
|
|
146
|
+
if (!v) return;
|
|
147
|
+
if (v.paused) playSafely(v);
|
|
148
|
+
else v.pause();
|
|
149
|
+
};
|
|
150
|
+
const setMuted = (m) => {
|
|
151
|
+
setMutedState(m);
|
|
152
|
+
onMutedChange?.(m);
|
|
153
|
+
};
|
|
154
|
+
const onKey = (e) => {
|
|
155
|
+
if (e.target !== e.currentTarget) return;
|
|
156
|
+
const v = video.current;
|
|
157
|
+
const act = { " ": toggle, k: toggle, m: () => setMuted(!muted), n: () => go(index + 1), p: () => go(index - 1), ArrowRight: () => {
|
|
158
|
+
if (v) v.currentTime += 5;
|
|
159
|
+
}, ArrowLeft: () => {
|
|
160
|
+
if (v) v.currentTime -= 5;
|
|
161
|
+
} };
|
|
162
|
+
const fn = act[e.key.length === 1 ? e.key.toLowerCase() : e.key];
|
|
163
|
+
if (fn) {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
fn();
|
|
166
|
+
wake();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const layer = (i, role) => {
|
|
170
|
+
const src = playlist[i];
|
|
171
|
+
if (!src) return null;
|
|
172
|
+
return /* @__PURE__ */ jsx2("div", { className: "kz-rtv-layer", "data-role": role, "data-tr": transition, children: src.src ? role === "in" ? /* @__PURE__ */ jsx2(
|
|
173
|
+
"video",
|
|
174
|
+
{
|
|
175
|
+
ref: video,
|
|
176
|
+
src: seen ? src.src : void 0,
|
|
177
|
+
poster: src.poster,
|
|
178
|
+
muted,
|
|
179
|
+
playsInline: true,
|
|
180
|
+
preload: seen ? "auto" : "none",
|
|
181
|
+
loop: n === 1,
|
|
182
|
+
"aria-label": src.title,
|
|
183
|
+
onPlay: () => setPlaying(true),
|
|
184
|
+
onPause: () => setPlaying(false),
|
|
185
|
+
onEnded: () => {
|
|
186
|
+
if (n > 1) go(index + 1);
|
|
187
|
+
},
|
|
188
|
+
onTimeUpdate: (e) => setTime({ t: e.currentTarget.currentTime, d: e.currentTarget.duration || 0 }),
|
|
189
|
+
onLoadedMetadata: (e) => setTime({ t: 0, d: e.currentTarget.duration || 0 }),
|
|
190
|
+
children: src.tracks?.map((t) => /* @__PURE__ */ jsx2("track", { kind: "captions", src: t.src, srcLang: t.srcLang, label: t.label }, t.src))
|
|
191
|
+
}
|
|
192
|
+
) : src.poster ? /* @__PURE__ */ jsx2("img", { src: src.poster, alt: "" }) : null : role === "in" ? renderEmbed?.(src) : null }, src.id);
|
|
193
|
+
};
|
|
194
|
+
const p = time.d ? Math.min(1, time.t / time.d) : 0;
|
|
195
|
+
const hasCaptions = !!current?.tracks?.length;
|
|
196
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ jsx2("style", { children: styles }),
|
|
198
|
+
/* @__PURE__ */ jsxs2("div", { ref: region, role: "region", "aria-label": title ?? current?.title, tabIndex: 0, className: "kz-rtv-playlist", "data-active": active ? "true" : void 0, onKeyDown: onKey, onPointerMove: wake, onPointerDown: wake, onFocus: wake, style: { position: "absolute", inset: 0, "--kz-rtv-p": p }, children: [
|
|
199
|
+
prev !== null && layer(prev, "out"),
|
|
200
|
+
layer(index, "in"),
|
|
201
|
+
prev !== null && transition === "channel" && /* @__PURE__ */ jsx2("div", { className: "kz-rtv-static", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { className: "kz-rtv-noise", style: { position: "absolute", inset: 0, background: "repeating-linear-gradient(0deg,var(--kz-text-on-media) 0 1px,var(--kz-scrim-strong) 1px 3px)" } }) }),
|
|
202
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "kz-rtv-chip", "aria-pressed": !muted, "aria-label": muted ? labels.soundOff : labels.soundOn, onClick: () => setMuted(!muted), children: /* @__PURE__ */ jsx2(VolumeGlyph, { muted }) }),
|
|
203
|
+
/* @__PURE__ */ jsx2("div", { className: "kz-rtv-progress", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("i", {}) }),
|
|
204
|
+
/* @__PURE__ */ jsxs2("div", { className: "kz-rtv-bar", children: [
|
|
205
|
+
/* @__PURE__ */ jsx2("button", { type: "button", "aria-label": labels.previous, onClick: () => go(index - 1), disabled: n < 2, children: "\xAB" }),
|
|
206
|
+
/* @__PURE__ */ jsx2("button", { type: "button", "aria-label": playing ? labels.pause : labels.play, onClick: toggle, disabled: !current?.src, children: playing ? /* @__PURE__ */ jsx2(PauseGlyph, {}) : /* @__PURE__ */ jsx2(PlayGlyph, {}) }),
|
|
207
|
+
/* @__PURE__ */ jsx2("button", { type: "button", "aria-label": labels.next, onClick: () => go(index + 1), disabled: n < 2, children: "\xBB" }),
|
|
208
|
+
/* @__PURE__ */ jsxs2("span", { className: "kz-rtv-time", children: [
|
|
209
|
+
formatClock(time.t),
|
|
210
|
+
" / ",
|
|
211
|
+
formatClock(time.d)
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ jsx2("input", { className: "kz-rtv-seek", type: "range", "aria-label": labels.seek, min: 0, max: Math.max(1, Math.floor(time.d)), value: Math.floor(time.t), disabled: !time.d, onChange: (e) => {
|
|
214
|
+
if (video.current) video.current.currentTime = Number(e.target.value);
|
|
215
|
+
} }),
|
|
216
|
+
hasCaptions && /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": labels.captions, "aria-pressed": captionsOn, onClick: () => setCaptionsOn(!captionsOn), children: /* @__PURE__ */ jsx2(CaptionsGlyph, {}) })
|
|
217
|
+
] }),
|
|
218
|
+
/* @__PURE__ */ jsxs2("span", { className: "sr-only", "aria-live": "polite", children: [
|
|
219
|
+
labels.nowPlaying,
|
|
220
|
+
": ",
|
|
221
|
+
current?.title,
|
|
222
|
+
" (",
|
|
223
|
+
index + 1,
|
|
224
|
+
"/",
|
|
225
|
+
n,
|
|
226
|
+
")"
|
|
227
|
+
] })
|
|
228
|
+
] })
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
231
|
+
export {
|
|
232
|
+
PlaylistScreen
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=retro-tv-playlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/retro-tv/playlist-screen.tsx","../src/glyphs.tsx","../src/media.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { CaptionsGlyph, PauseGlyph, PlayGlyph, VolumeGlyph } from \"../glyphs\";\nimport { formatClock, playSafely, useInView } from \"../media\";\nimport type { RetroTvLabels, RetroTvSource, RetroTvTransition } from \"./retro-tv\";\n\nconst styles = `.kz-rtv-layer{position:absolute;inset:0;background:var(--kz-scrim-strong)}\n.kz-rtv-layer video,.kz-rtv-layer img,.kz-rtv-layer .kz-embed{width:100%;height:100%;object-fit:contain;aspect-ratio:auto}\n.kz-rtv-layer[data-role=out]{z-index:1}.kz-rtv-layer[data-role=in]{z-index:2}\n.kz-rtv-static{position:absolute;inset:0;z-index:4;overflow:hidden;pointer-events:none}\n.kz-rtv-static:after{position:absolute;inset:-20% 0 auto;height:18%;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-text-on-media) 55%,transparent),transparent);content:\"\"}\n.kz-rtv-chip,.kz-rtv-bar button{display:inline-flex;min-width:2.25rem;min-height:2.25rem;align-items:center;justify-content:center;gap:.35rem;padding:0 .55rem;border:1px solid color-mix(in srgb,var(--kz-text-on-media) 30%,transparent);border-radius:999px;background:color-mix(in srgb,var(--kz-scrim-strong) 82%,transparent);color:var(--kz-text-on-media);font:600 .72rem/1 var(--kz-font-mono,monospace);cursor:pointer}\n.kz-rtv-chip{position:absolute;z-index:8;top:.5rem;left:.5rem}\n.kz-rtv-chip:focus-visible,.kz-rtv-bar button:focus-visible,.kz-rtv-seek:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}\n.kz-rtv-bar{position:absolute;z-index:8;inset:auto 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;padding:1.6rem .6rem .6rem;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-scrim-strong) 85%,transparent));opacity:0;transition:opacity .25s}\n.kz-rtv-screen[data-active=true] .kz-rtv-bar,.kz-rtv-screen:focus-within .kz-rtv-bar,.kz-rtv-screen:hover .kz-rtv-bar{opacity:1}\n.kz-rtv-bar svg{width:1rem;height:1rem}\n.kz-rtv-time{padding:.2rem .45rem;border-radius:4px;background:var(--kz-scrim-strong);color:var(--kz-text-on-media);font:600 .75rem/1 var(--kz-font-mono,monospace);font-variant-numeric:tabular-nums}\n.kz-rtv-seek{flex:1 1 6rem;min-width:5rem;height:1.5rem;accent-color:var(--kz-accent);cursor:pointer}\n.kz-rtv-progress{position:absolute;z-index:7;inset:auto 0 0;height:3px;background:color-mix(in srgb,var(--kz-text-on-media) 25%,transparent)}\n.kz-rtv-progress i{display:block;height:100%;background:var(--kz-accent);transform-origin:left;transform:scaleX(var(--kz-rtv-p,0))}\n@keyframes kz-rtv-in{from{opacity:0}to{opacity:1}}@keyframes kz-rtv-out{from{opacity:1}to{opacity:0}}\n@keyframes kz-rtv-sin{from{transform:translateX(100%)}to{transform:none}}@keyframes kz-rtv-sout{from{transform:none}to{transform:translateX(-100%)}}\n@keyframes kz-rtv-tune{0%{transform:translateY(-12%) scaleY(1.15);filter:contrast(2) brightness(1.6)}100%{transform:none;filter:none}}\n@keyframes kz-rtv-roll{from{transform:translateY(0)}to{transform:translateY(700%)}}\n@media (prefers-reduced-motion:no-preference){\n.kz-rtv-layer[data-role=in][data-tr=crossfade]{animation:kz-rtv-in .6s both}.kz-rtv-layer[data-role=out][data-tr=crossfade]{animation:kz-rtv-out .6s both}\n.kz-rtv-layer[data-role=in][data-tr=slide]{animation:kz-rtv-sin .5s ease-out both}.kz-rtv-layer[data-role=out][data-tr=slide]{animation:kz-rtv-sout .5s ease-out both}\n.kz-rtv-layer[data-role=in][data-tr=channel]{animation:kz-rtv-tune .55s steps(8,end) both}\n.kz-rtv-static{animation:kz-rtv-in .55s reverse both}.kz-rtv-static:after{animation:kz-rtv-roll .55s linear both}}\n`;\n\ntype PlaylistProps = { playlist: readonly RetroTvSource[]; transition: RetroTvTransition; labels: RetroTvLabels; muted: boolean; autoPlay: boolean; renderEmbed?: (source: RetroTvSource) => React.ReactNode; onMutedChange?: (muted: boolean) => void; onIndexChange?: (index: number) => void; title?: string; reduced: boolean; setMutedState: (m: boolean) => void; setIndex: (i: number) => void; index: number };\n\nexport function PlaylistScreen({ playlist, transition, labels, muted, autoPlay, renderEmbed, onMutedChange, onIndexChange, title, reduced, setMutedState, setIndex, index }: PlaylistProps) {\n const region = React.useRef<HTMLDivElement>(null);\n const video = React.useRef<HTMLVideoElement>(null);\n const [prev, setPrev] = React.useState<number | null>(null);\n const [seen, setSeen] = React.useState(false);\n const [playing, setPlaying] = React.useState(false);\n const [time, setTime] = React.useState({ t: 0, d: 0 });\n const [active, setActive] = React.useState(false);\n const [captionsOn, setCaptionsOn] = React.useState(false);\n const n = playlist.length;\n const current = playlist[index];\n const wake = React.useCallback(() => setActive(true), []);\n\n useInView(region, (v) => { if (v) setSeen(true); else video.current?.pause(); });\n React.useEffect(() => { if (!active) return; const id = setTimeout(() => setActive(false), 2500); return () => clearTimeout(id); }, [active]);\n React.useEffect(() => { if (prev === null) return; const id = setTimeout(() => setPrev(null), reduced ? 0 : 650); return () => clearTimeout(id); }, [prev, reduced]);\n React.useEffect(() => { if (seen && autoPlay && !reduced && current?.src) playSafely(video.current); }, [seen, autoPlay, reduced, index, current?.src]);\n React.useEffect(() => { const list = video.current?.textTracks; if (list) Array.from(list).forEach((track, i) => { track.mode = captionsOn && i === 0 ? \"showing\" : \"disabled\"; }); }, [captionsOn, index]);\n\n const go = (to: number) => {\n const next = ((to % n) + n) % n;\n if (next === index && n > 1) return;\n if (!reduced && n > 1) setPrev(index);\n setIndex(next);\n setTime({ t: 0, d: 0 });\n onIndexChange?.(next);\n };\n const toggle = () => { const v = video.current; if (!v) return; if (v.paused) playSafely(v); else v.pause(); };\n const setMuted = (m: boolean) => { setMutedState(m); onMutedChange?.(m); };\n const onKey = (e: React.KeyboardEvent) => {\n if (e.target !== e.currentTarget) return;\n const v = video.current;\n const act: Record<string, () => void> = { \" \": toggle, k: toggle, m: () => setMuted(!muted), n: () => go(index + 1), p: () => go(index - 1), ArrowRight: () => { if (v) v.currentTime += 5; }, ArrowLeft: () => { if (v) v.currentTime -= 5; } };\n const fn = act[e.key.length === 1 ? e.key.toLowerCase() : e.key];\n if (fn) { e.preventDefault(); fn(); wake(); }\n };\n const layer = (i: number, role: \"in\" | \"out\") => {\n const src = playlist[i];\n if (!src) return null;\n return (\n <div className=\"kz-rtv-layer\" key={src.id} data-role={role} data-tr={transition}>\n {src.src ? (\n role === \"in\" ? (\n <video ref={video} src={seen ? src.src : undefined} poster={src.poster} muted={muted} playsInline preload={seen ? \"auto\" : \"none\"} loop={n === 1} aria-label={src.title}\n onPlay={() => setPlaying(true)} onPause={() => setPlaying(false)} onEnded={() => { if (n > 1) go(index + 1); }}\n onTimeUpdate={(e) => setTime({ t: e.currentTarget.currentTime, d: e.currentTarget.duration || 0 })} onLoadedMetadata={(e) => setTime({ t: 0, d: e.currentTarget.duration || 0 })}>\n {src.tracks?.map((t) => <track key={t.src} kind=\"captions\" src={t.src} srcLang={t.srcLang} label={t.label} />)}\n </video>\n ) : src.poster ? <img src={src.poster} alt=\"\" /> : null\n ) : role === \"in\" ? renderEmbed?.(src) : null}\n </div>\n );\n };\n const p = time.d ? Math.min(1, time.t / time.d) : 0;\n const hasCaptions = !!current?.tracks?.length;\n return (\n <>\n <style>{styles}</style>\n <div ref={region} role=\"region\" aria-label={title ?? current?.title} tabIndex={0} className=\"kz-rtv-playlist\" data-active={active ? \"true\" : undefined} onKeyDown={onKey} onPointerMove={wake} onPointerDown={wake} onFocus={wake} style={{ position: \"absolute\", inset: 0, \"--kz-rtv-p\": p } as React.CSSProperties}>\n {prev !== null && layer(prev, \"out\")}\n {layer(index, \"in\")}\n {prev !== null && transition === \"channel\" && <div className=\"kz-rtv-static\" aria-hidden=\"true\"><span className=\"kz-rtv-noise\" style={{ position: \"absolute\", inset: 0, background: \"repeating-linear-gradient(0deg,var(--kz-text-on-media) 0 1px,var(--kz-scrim-strong) 1px 3px)\" }} /></div>}\n <button type=\"button\" className=\"kz-rtv-chip\" aria-pressed={!muted} aria-label={muted ? labels.soundOff : labels.soundOn} onClick={() => setMuted(!muted)}><VolumeGlyph muted={muted} /></button>\n <div className=\"kz-rtv-progress\" aria-hidden=\"true\"><i /></div>\n <div className=\"kz-rtv-bar\">\n <button type=\"button\" aria-label={labels.previous} onClick={() => go(index - 1)} disabled={n < 2}>«</button>\n <button type=\"button\" aria-label={playing ? labels.pause : labels.play} onClick={toggle} disabled={!current?.src}>{playing ? <PauseGlyph /> : <PlayGlyph />}</button>\n <button type=\"button\" aria-label={labels.next} onClick={() => go(index + 1)} disabled={n < 2}>»</button>\n <span className=\"kz-rtv-time\">{formatClock(time.t)} / {formatClock(time.d)}</span>\n <input className=\"kz-rtv-seek\" type=\"range\" aria-label={labels.seek} min={0} max={Math.max(1, Math.floor(time.d))} value={Math.floor(time.t)} disabled={!time.d} onChange={(e) => { if (video.current) video.current.currentTime = Number(e.target.value); }} />\n {hasCaptions && <button type=\"button\" aria-label={labels.captions} aria-pressed={captionsOn} onClick={() => setCaptionsOn(!captionsOn)}><CaptionsGlyph /></button>}\n </div>\n <span className=\"sr-only\" aria-live=\"polite\">{labels.nowPlaying}: {current?.title} ({index + 1}/{n})</span>\n </div>\n </>\n );\n}\n","// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" }) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n","// Shared by the data and media primitives (client): the clock format, the reduced-motion preference, the\n// in-view observer, a debounced callback. Never an entry of its own.\nimport * as React from \"react\";\n\n/** Seconds as a clock: `75` → `1:15`, `3725` → `1:02:05`. Negative or unknown values read `0:00`. */\nexport function formatClock(seconds: number): string {\n const s = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;\n const h = Math.floor(s / 3600);\n const m = Math.floor((s % 3600) / 60);\n const rest = String(s % 60).padStart(2, \"0\");\n return h > 0 ? `${h}:${String(m).padStart(2, \"0\")}:${rest}` : `${m}:${rest}`;\n}\n\n/** Clamps `value` between `min` and `max`. */\nexport const clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));\n\nconst REDUCE = \"(prefers-reduced-motion: reduce)\";\nconst subscribeReduce = (notify: () => void) => {\n if (typeof window === \"undefined\" || !window.matchMedia) return () => undefined;\n const query = window.matchMedia(REDUCE);\n query.addEventListener?.(\"change\", notify);\n return () => query.removeEventListener?.(\"change\", notify);\n};\n\n/** `true` when the person asked for less motion (`prefers-reduced-motion: reduce`); follows a change of the setting. */\nexport function usePrefersReducedMotion(): boolean {\n return React.useSyncExternalStore(\n subscribeReduce,\n () => (typeof window !== \"undefined\" && window.matchMedia ? window.matchMedia(REDUCE).matches : false),\n () => false,\n );\n}\n\n/** The latest value of a callback, for an effect or an event that must not re-subscribe when it changes. */\nexport function useLatest<T>(value: T) {\n const ref = React.useRef(value);\n React.useLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/** Calls `onChange(visible)` when at least `threshold` of the element enters or leaves the viewport. */\nexport function useInView(ref: React.RefObject<Element | null>, onChange: (visible: boolean) => void, enabled = true, threshold = 0.25) {\n const latest = useLatest(onChange);\n React.useEffect(() => {\n const element = ref.current;\n if (!enabled || !element || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(([entry]) => entry && latest.current(entry.isIntersecting), { threshold });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref, enabled, threshold, latest]);\n}\n\n/** A value controlled by a prop when it is given, held inside otherwise; `set` calls `onChange` either way. */\nexport function useControllable<T>(value: T | undefined, defaultValue: T, onChange?: (next: T) => void) {\n const [inner, setInner] = React.useState(defaultValue);\n const controlled = value !== undefined;\n const current = controlled ? value : inner;\n const set = React.useCallback(\n (next: T) => {\n if (!controlled) setInner(next);\n onChange?.(next);\n },\n [controlled, onChange],\n );\n return [current, set] as const;\n}\n\n/** Starts a media element without an unhandled rejection (autoplay refused, the source replaced meanwhile). */\nexport function playSafely(media: HTMLMediaElement | null | undefined) {\n try {\n const started = media?.play() as Promise<void> | undefined;\n started?.catch?.(() => undefined);\n } catch {\n // Not playable here (no media support): the controls stay as they are.\n }\n}\n"],"mappings":";;;;AAEA,YAAYA,YAAW;;;ACOnB,cAsBF,YAtBE;AAFJ,SAAS,MAAM,EAAE,YAAY,WAAW,MAAM,SAAS,GAA+D;AACpH,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR;AAAA,MACA,MAAM,OAAO,iBAAiB;AAAA,MAC9B,QAAQ,OAAO,SAAS;AAAA,MACxB,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAW;AAAA,MACX,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,YAAY,CAAC,MACxB,oBAAC,SAAO,GAAG,GAAG,MAAI,MAChB,8BAAC,UAAK,GAAE,kFAAiF,GAC3F;AAEK,IAAM,aAAa,CAAC,MACzB,qBAAC,SAAO,GAAG,GAAG,MAAI,MAChB;AAAA,sBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,KAAI,QAAO,MAAK,IAAG,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GAAE;AAAA,SAC3J;AAAA,MACA,gBAAAC,MAAC,UAAK,WAAU,WAAU,aAAU,UAAU;AAAA,eAAO;AAAA,QAAW;AAAA,QAAG,SAAS;AAAA,QAAM;AAAA,QAAG,QAAQ;AAAA,QAAE;AAAA,QAAE;AAAA,QAAE;AAAA,SAAC;AAAA,OACtG;AAAA,KACA;AAEJ;","names":["React","jsx","jsxs"]}
|
package/dist/retro-tv.js
CHANGED
|
@@ -6,21 +6,15 @@ import "./chunk-ADRUEPYC.js";
|
|
|
6
6
|
import "./chunk-HJFRHYCI.js";
|
|
7
7
|
import "./chunk-NSLXEDIS.js";
|
|
8
8
|
import {
|
|
9
|
-
formatClock,
|
|
10
|
-
playSafely,
|
|
11
9
|
useInView,
|
|
12
10
|
usePrefersReducedMotion
|
|
13
11
|
} from "./chunk-FZBWEDQI.js";
|
|
14
|
-
import
|
|
15
|
-
CaptionsGlyph,
|
|
16
|
-
PauseGlyph,
|
|
17
|
-
PlayGlyph,
|
|
18
|
-
VolumeGlyph
|
|
19
|
-
} from "./chunk-PGBF3UBX.js";
|
|
12
|
+
import "./chunk-PGBF3UBX.js";
|
|
20
13
|
|
|
21
14
|
// src/retro-tv/retro-tv.tsx
|
|
22
15
|
import * as React from "react";
|
|
23
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var PlaylistScreen = React.lazy(() => import("./retro-tv-playlist.js").then((m) => ({ default: m.PlaylistScreen })));
|
|
24
18
|
var styles = `
|
|
25
19
|
.kz-rtv{container-type:inline-size;width:100%;max-width:100%;color:var(--kz-text-primary)}
|
|
26
20
|
.kz-rtv-frame{position:relative;isolation:isolate;width:100%;aspect-ratio:4/5}
|
|
@@ -58,165 +52,15 @@ var styles = `
|
|
|
58
52
|
.kz-rtv[data-powered=true] .kz-rtv-power{animation:kz-rtv-power .65s ease-out both}
|
|
59
53
|
.kz-rtv-channel{position:absolute;z-index:7;top:8%;right:5%;width:24%;overflow:hidden;padding:.25em .4em;border:1px solid var(--kz-border-strong);border-radius:3px;background:var(--kz-surface-1);box-shadow:inset 0 1px 0 var(--kz-surface-sheen);color:var(--kz-text-primary);font:700 clamp(.5rem,1.4cqw,.7rem)/1.2 var(--kz-font-mono,monospace);letter-spacing:.12em;text-transform:uppercase;text-align:center;text-overflow:ellipsis;white-space:nowrap}
|
|
60
54
|
.kz-rtv[data-variant=portable] .kz-rtv-channel{top:7%}
|
|
61
|
-
.kz-rtv-layer{position:absolute;inset:0;background:var(--kz-scrim-strong)}
|
|
62
|
-
.kz-rtv-layer video,.kz-rtv-layer img,.kz-rtv-layer .kz-embed{width:100%;height:100%;object-fit:contain;aspect-ratio:auto}
|
|
63
|
-
.kz-rtv-layer[data-role=out]{z-index:1}.kz-rtv-layer[data-role=in]{z-index:2}
|
|
64
|
-
.kz-rtv-static{position:absolute;inset:0;z-index:4;overflow:hidden;pointer-events:none}
|
|
65
|
-
.kz-rtv-static:after{position:absolute;inset:-20% 0 auto;height:18%;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-text-on-media) 55%,transparent),transparent);content:""}
|
|
66
|
-
.kz-rtv-chip,.kz-rtv-bar button{display:inline-flex;min-width:2.25rem;min-height:2.25rem;align-items:center;justify-content:center;gap:.35rem;padding:0 .55rem;border:1px solid color-mix(in srgb,var(--kz-text-on-media) 30%,transparent);border-radius:999px;background:color-mix(in srgb,var(--kz-scrim-strong) 82%,transparent);color:var(--kz-text-on-media);font:600 .72rem/1 var(--kz-font-mono,monospace);cursor:pointer}
|
|
67
|
-
.kz-rtv-chip{position:absolute;z-index:8;top:.5rem;left:.5rem}
|
|
68
|
-
.kz-rtv-chip:focus-visible,.kz-rtv-bar button:focus-visible,.kz-rtv-seek:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}
|
|
69
|
-
.kz-rtv-bar{position:absolute;z-index:8;inset:auto 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;padding:1.6rem .6rem .6rem;background:linear-gradient(transparent,color-mix(in srgb,var(--kz-scrim-strong) 85%,transparent));opacity:0;transition:opacity .25s}
|
|
70
|
-
.kz-rtv-screen[data-active=true] .kz-rtv-bar,.kz-rtv-screen:focus-within .kz-rtv-bar,.kz-rtv-screen:hover .kz-rtv-bar{opacity:1}
|
|
71
|
-
.kz-rtv-bar svg{width:1rem;height:1rem}
|
|
72
|
-
.kz-rtv-time{padding:.2rem .45rem;border-radius:4px;background:var(--kz-scrim-strong);color:var(--kz-text-on-media);font:600 .75rem/1 var(--kz-font-mono,monospace);font-variant-numeric:tabular-nums}
|
|
73
|
-
.kz-rtv-seek{flex:1 1 6rem;min-width:5rem;height:1.5rem;accent-color:var(--kz-accent);cursor:pointer}
|
|
74
|
-
.kz-rtv-progress{position:absolute;z-index:7;inset:auto 0 0;height:3px;background:color-mix(in srgb,var(--kz-text-on-media) 25%,transparent)}
|
|
75
|
-
.kz-rtv-progress i{display:block;height:100%;background:var(--kz-accent);transform-origin:left;transform:scaleX(var(--kz-rtv-p,0))}
|
|
76
|
-
@media (prefers-reduced-motion:no-preference){
|
|
77
|
-
.kz-rtv-layer[data-role=in][data-tr=crossfade]{animation:kz-rtv-in .6s both}.kz-rtv-layer[data-role=out][data-tr=crossfade]{animation:kz-rtv-out .6s both}
|
|
78
|
-
.kz-rtv-layer[data-role=in][data-tr=slide]{animation:kz-rtv-sin .5s ease-out both}.kz-rtv-layer[data-role=out][data-tr=slide]{animation:kz-rtv-sout .5s ease-out both}
|
|
79
|
-
.kz-rtv-layer[data-role=in][data-tr=channel]{animation:kz-rtv-tune .55s steps(8,end) both}
|
|
80
|
-
.kz-rtv-static{animation:kz-rtv-in .55s reverse both}.kz-rtv-static:after{animation:kz-rtv-roll .55s linear both}}
|
|
81
|
-
@keyframes kz-rtv-in{from{opacity:0}to{opacity:1}}@keyframes kz-rtv-out{from{opacity:1}to{opacity:0}}
|
|
82
|
-
@keyframes kz-rtv-sin{from{transform:translateX(100%)}to{transform:none}}@keyframes kz-rtv-sout{from{transform:none}to{transform:translateX(-100%)}}
|
|
83
|
-
@keyframes kz-rtv-tune{0%{transform:translateY(-12%) scaleY(1.15);filter:contrast(2) brightness(1.6)}100%{transform:none;filter:none}}
|
|
84
|
-
@keyframes kz-rtv-roll{from{transform:translateY(0)}to{transform:translateY(700%)}}
|
|
85
55
|
.kz-rtv:focus-within .kz-rtv-screen{outline:2px solid var(--kz-ring);outline-offset:3px}
|
|
86
56
|
@keyframes kz-rtv-power{0%{opacity:1;transform:scaleY(.01)}45%{opacity:.9;transform:scaleY(1)}100%{opacity:0;transform:scaleY(1)}}
|
|
87
57
|
@keyframes kz-rtv-noise{0%,100%{opacity:.38}50%{opacity:.62}}
|
|
88
58
|
@media (prefers-reduced-motion:no-preference){.kz-rtv[data-off=true] .kz-rtv-noise{animation:kz-rtv-noise .18s steps(2,end) infinite}}
|
|
89
59
|
@media (prefers-reduced-motion:reduce){.kz-rtv-power{display:none!important}.kz-rtv-noise{animation:none!important}}
|
|
60
|
+
|
|
90
61
|
`;
|
|
91
62
|
var retroTvLabels = { play: "Play", pause: "Pause", next: "Next video", previous: "Previous video", soundOff: "Sound off: turn on", soundOn: "Sound on: turn off", captions: "Captions", seek: "Seek", nowPlaying: "Now playing" };
|
|
92
63
|
var retroTvLabelsFr = { play: "Lecture", pause: "Pause", next: "Vid\xE9o suivante", previous: "Vid\xE9o pr\xE9c\xE9dente", soundOff: "Son coup\xE9 : activer", soundOn: "Son activ\xE9 : couper", captions: "Sous-titres", seek: "Position", nowPlaying: "En cours" };
|
|
93
|
-
function PlaylistScreen({ playlist, transition, labels, muted, autoPlay, renderEmbed, onMutedChange, onIndexChange, title, reduced, setMutedState, setIndex, index }) {
|
|
94
|
-
const region = React.useRef(null);
|
|
95
|
-
const video = React.useRef(null);
|
|
96
|
-
const [prev, setPrev] = React.useState(null);
|
|
97
|
-
const [seen, setSeen] = React.useState(false);
|
|
98
|
-
const [playing, setPlaying] = React.useState(false);
|
|
99
|
-
const [time, setTime] = React.useState({ t: 0, d: 0 });
|
|
100
|
-
const [active, setActive] = React.useState(false);
|
|
101
|
-
const [captionsOn, setCaptionsOn] = React.useState(false);
|
|
102
|
-
const n = playlist.length;
|
|
103
|
-
const current = playlist[index];
|
|
104
|
-
const wake = React.useCallback(() => setActive(true), []);
|
|
105
|
-
useInView(region, (v) => {
|
|
106
|
-
if (v) setSeen(true);
|
|
107
|
-
else video.current?.pause();
|
|
108
|
-
});
|
|
109
|
-
React.useEffect(() => {
|
|
110
|
-
if (!active) return;
|
|
111
|
-
const id = setTimeout(() => setActive(false), 2500);
|
|
112
|
-
return () => clearTimeout(id);
|
|
113
|
-
}, [active]);
|
|
114
|
-
React.useEffect(() => {
|
|
115
|
-
if (prev === null) return;
|
|
116
|
-
const id = setTimeout(() => setPrev(null), reduced ? 0 : 650);
|
|
117
|
-
return () => clearTimeout(id);
|
|
118
|
-
}, [prev, reduced]);
|
|
119
|
-
React.useEffect(() => {
|
|
120
|
-
if (seen && autoPlay && !reduced && current?.src) playSafely(video.current);
|
|
121
|
-
}, [seen, autoPlay, reduced, index, current?.src]);
|
|
122
|
-
React.useEffect(() => {
|
|
123
|
-
const list = video.current?.textTracks;
|
|
124
|
-
if (list) Array.from(list).forEach((track, i) => {
|
|
125
|
-
track.mode = captionsOn && i === 0 ? "showing" : "disabled";
|
|
126
|
-
});
|
|
127
|
-
}, [captionsOn, index]);
|
|
128
|
-
const go = (to) => {
|
|
129
|
-
const next = (to % n + n) % n;
|
|
130
|
-
if (next === index && n > 1) return;
|
|
131
|
-
if (!reduced && n > 1) setPrev(index);
|
|
132
|
-
setIndex(next);
|
|
133
|
-
setTime({ t: 0, d: 0 });
|
|
134
|
-
onIndexChange?.(next);
|
|
135
|
-
};
|
|
136
|
-
const toggle = () => {
|
|
137
|
-
const v = video.current;
|
|
138
|
-
if (!v) return;
|
|
139
|
-
if (v.paused) playSafely(v);
|
|
140
|
-
else v.pause();
|
|
141
|
-
};
|
|
142
|
-
const setMuted = (m) => {
|
|
143
|
-
setMutedState(m);
|
|
144
|
-
onMutedChange?.(m);
|
|
145
|
-
};
|
|
146
|
-
const onKey = (e) => {
|
|
147
|
-
if (e.target !== e.currentTarget) return;
|
|
148
|
-
const v = video.current;
|
|
149
|
-
const act = { " ": toggle, k: toggle, m: () => setMuted(!muted), n: () => go(index + 1), p: () => go(index - 1), ArrowRight: () => {
|
|
150
|
-
if (v) v.currentTime += 5;
|
|
151
|
-
}, ArrowLeft: () => {
|
|
152
|
-
if (v) v.currentTime -= 5;
|
|
153
|
-
} };
|
|
154
|
-
const fn = act[e.key.length === 1 ? e.key.toLowerCase() : e.key];
|
|
155
|
-
if (fn) {
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
fn();
|
|
158
|
-
wake();
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
const layer = (i, role) => {
|
|
162
|
-
const src = playlist[i];
|
|
163
|
-
if (!src) return null;
|
|
164
|
-
return /* @__PURE__ */ jsx("div", { className: "kz-rtv-layer", "data-role": role, "data-tr": transition, children: src.src ? role === "in" ? /* @__PURE__ */ jsx(
|
|
165
|
-
"video",
|
|
166
|
-
{
|
|
167
|
-
ref: video,
|
|
168
|
-
src: seen ? src.src : void 0,
|
|
169
|
-
poster: src.poster,
|
|
170
|
-
muted,
|
|
171
|
-
playsInline: true,
|
|
172
|
-
preload: seen ? "auto" : "none",
|
|
173
|
-
loop: n === 1,
|
|
174
|
-
"aria-label": src.title,
|
|
175
|
-
onPlay: () => setPlaying(true),
|
|
176
|
-
onPause: () => setPlaying(false),
|
|
177
|
-
onEnded: () => {
|
|
178
|
-
if (n > 1) go(index + 1);
|
|
179
|
-
},
|
|
180
|
-
onTimeUpdate: (e) => setTime({ t: e.currentTarget.currentTime, d: e.currentTarget.duration || 0 }),
|
|
181
|
-
onLoadedMetadata: (e) => setTime({ t: 0, d: e.currentTarget.duration || 0 }),
|
|
182
|
-
children: src.tracks?.map((t) => /* @__PURE__ */ jsx("track", { kind: "captions", src: t.src, srcLang: t.srcLang, label: t.label }, t.src))
|
|
183
|
-
}
|
|
184
|
-
) : src.poster ? /* @__PURE__ */ jsx("img", { src: src.poster, alt: "" }) : null : role === "in" ? renderEmbed?.(src) : null }, src.id);
|
|
185
|
-
};
|
|
186
|
-
const p = time.d ? Math.min(1, time.t / time.d) : 0;
|
|
187
|
-
const hasCaptions = !!current?.tracks?.length;
|
|
188
|
-
return /* @__PURE__ */ jsxs("div", { ref: region, role: "region", "aria-label": title ?? current?.title, tabIndex: 0, className: "kz-rtv-playlist", "data-active": active ? "true" : void 0, onKeyDown: onKey, onPointerMove: wake, onPointerDown: wake, onFocus: wake, style: { position: "absolute", inset: 0, "--kz-rtv-p": p }, children: [
|
|
189
|
-
prev !== null && layer(prev, "out"),
|
|
190
|
-
layer(index, "in"),
|
|
191
|
-
prev !== null && transition === "channel" && /* @__PURE__ */ jsx("div", { className: "kz-rtv-static", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "kz-rtv-noise", style: { position: "absolute", inset: 0, background: "repeating-linear-gradient(0deg,var(--kz-text-on-media) 0 1px,var(--kz-scrim-strong) 1px 3px)" } }) }),
|
|
192
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "kz-rtv-chip", "aria-pressed": !muted, "aria-label": muted ? labels.soundOff : labels.soundOn, onClick: () => setMuted(!muted), children: /* @__PURE__ */ jsx(VolumeGlyph, { muted }) }),
|
|
193
|
-
/* @__PURE__ */ jsx("div", { className: "kz-rtv-progress", "aria-hidden": "true", children: /* @__PURE__ */ jsx("i", {}) }),
|
|
194
|
-
/* @__PURE__ */ jsxs("div", { className: "kz-rtv-bar", children: [
|
|
195
|
-
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": labels.previous, onClick: () => go(index - 1), disabled: n < 2, children: "\xAB" }),
|
|
196
|
-
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": playing ? labels.pause : labels.play, onClick: toggle, disabled: !current?.src, children: playing ? /* @__PURE__ */ jsx(PauseGlyph, {}) : /* @__PURE__ */ jsx(PlayGlyph, {}) }),
|
|
197
|
-
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": labels.next, onClick: () => go(index + 1), disabled: n < 2, children: "\xBB" }),
|
|
198
|
-
/* @__PURE__ */ jsxs("span", { className: "kz-rtv-time", children: [
|
|
199
|
-
formatClock(time.t),
|
|
200
|
-
" / ",
|
|
201
|
-
formatClock(time.d)
|
|
202
|
-
] }),
|
|
203
|
-
/* @__PURE__ */ jsx("input", { className: "kz-rtv-seek", type: "range", "aria-label": labels.seek, min: 0, max: Math.max(1, Math.floor(time.d)), value: Math.floor(time.t), disabled: !time.d, onChange: (e) => {
|
|
204
|
-
if (video.current) video.current.currentTime = Number(e.target.value);
|
|
205
|
-
} }),
|
|
206
|
-
hasCaptions && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": labels.captions, "aria-pressed": captionsOn, onClick: () => setCaptionsOn(!captionsOn), children: /* @__PURE__ */ jsx(CaptionsGlyph, {}) })
|
|
207
|
-
] }),
|
|
208
|
-
/* @__PURE__ */ jsxs("span", { className: "sr-only", "aria-live": "polite", children: [
|
|
209
|
-
labels.nowPlaying,
|
|
210
|
-
": ",
|
|
211
|
-
current?.title,
|
|
212
|
-
" (",
|
|
213
|
-
index + 1,
|
|
214
|
-
"/",
|
|
215
|
-
n,
|
|
216
|
-
")"
|
|
217
|
-
] })
|
|
218
|
-
] });
|
|
219
|
-
}
|
|
220
64
|
function RetroTv({
|
|
221
65
|
variant = "cabinet",
|
|
222
66
|
channel,
|
|
@@ -248,7 +92,7 @@ function RetroTv({
|
|
|
248
92
|
useInView(root, setPowered);
|
|
249
93
|
const player = src ? /* @__PURE__ */ jsx(VideoPlayer, { ...playerProps, src, className: "kz-rtv-player", aspectRatio: "9 / 16", autoPlay, muted, loop, preload }) : null;
|
|
250
94
|
const knob = { channel: index * 50, sound: mutedState ? -50 : 50 };
|
|
251
|
-
const screen = playlist?.length ? /* @__PURE__ */ jsx(PlaylistScreen, { playlist, transition, labels: { ...retroTvLabels, ...labels }, muted: mutedState, autoPlay, renderEmbed, onMutedChange, onIndexChange, title: playerProps.title, reduced: reducedMotion, setMutedState, setIndex, index }) : children ?? player;
|
|
95
|
+
const screen = playlist?.length ? /* @__PURE__ */ jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(PlaylistScreen, { playlist, transition, labels: { ...retroTvLabels, ...labels }, muted: mutedState, autoPlay, renderEmbed, onMutedChange, onIndexChange, title: playerProps.title, reduced: reducedMotion, setMutedState, setIndex, index }) }) : children ?? player;
|
|
252
96
|
return /* @__PURE__ */ jsxs("div", { ref: root, className: ["kz-rtv", className].filter(Boolean).join(" "), "data-variant": variant, "data-powered": powered && !reducedMotion ? "true" : void 0, "data-off": off ? "true" : void 0, children: [
|
|
253
97
|
/* @__PURE__ */ jsx("style", { children: styles }),
|
|
254
98
|
/* @__PURE__ */ jsxs("div", { className: "kz-rtv-frame", children: [
|