@sdxc/ui 2026.11.17 → 2026.11.22
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/README.md +139 -2
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +1 -0
- package/dist/app/mixins/command-palette.js +10 -2
- package/dist/app/mixins/log-viewer.js +17 -14
- package/dist/app/mixins/route-dialog.d.ts +17 -0
- package/dist/app/mixins/route-dialog.js +53 -0
- package/dist/app/optimistic-toggle.js +6 -0
- package/dist/app/route-dialog.d.ts +38 -0
- package/dist/app/route-dialog.js +49 -0
- package/dist/audio/equalizer.d.ts +24 -0
- package/dist/audio/equalizer.js +57 -0
- package/dist/audio/index.d.ts +16 -0
- package/dist/audio/index.js +16 -0
- package/dist/audio/media-tile.d.ts +38 -0
- package/dist/audio/media-tile.js +98 -0
- package/dist/audio/player-bar.d.ts +108 -0
- package/dist/audio/player-bar.js +338 -0
- package/dist/audio/queue-list.d.ts +56 -0
- package/dist/audio/queue-list.js +102 -0
- package/dist/audio/track-list.d.ts +91 -0
- package/dist/audio/track-list.js +226 -0
- package/dist/audio/utils/media-session.d.ts +44 -0
- package/dist/audio/utils/media-session.js +87 -0
- package/dist/audio/utils/play-queue.d.ts +98 -0
- package/dist/audio/utils/play-queue.js +149 -0
- package/dist/audio/utils/track-time.d.ts +28 -0
- package/dist/audio/utils/track-time.js +36 -0
- package/dist/chat/composer-format.d.ts +35 -0
- package/dist/chat/composer-format.js +84 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.js +6 -0
- package/dist/chat/mention-menu.d.ts +43 -0
- package/dist/chat/mention-menu.js +70 -0
- package/dist/chat/message-group.d.ts +92 -0
- package/dist/chat/message-group.js +222 -0
- package/dist/chat/mixins/composer-format.d.ts +28 -0
- package/dist/chat/mixins/composer-format.js +80 -0
- package/dist/chat/mixins/composer-send.d.ts +2 -2
- package/dist/chat/mixins/composer-send.js +4 -2
- package/dist/chat/mixins/mention-menu.d.ts +41 -0
- package/dist/chat/mixins/mention-menu.js +213 -0
- package/dist/chat/mixins/reaction-sync.d.ts +47 -0
- package/dist/chat/mixins/reaction-sync.js +172 -0
- package/dist/chat/reaction-bar.d.ts +70 -0
- package/dist/chat/reaction-bar.js +108 -0
- package/dist/chat/typing-indicator.d.ts +42 -0
- package/dist/chat/typing-indicator.js +68 -0
- package/dist/chat/utils/composer-text.d.ts +38 -0
- package/dist/chat/utils/composer-text.js +86 -0
- package/dist/chat/utils/markdown-format.d.ts +30 -0
- package/dist/chat/utils/markdown-format.js +158 -0
- package/dist/chat/utils/mention-query.d.ts +55 -0
- package/dist/chat/utils/mention-query.js +60 -0
- package/dist/commerce/cart-drawer.d.ts +69 -0
- package/dist/commerce/cart-drawer.js +163 -0
- package/dist/commerce/cart-line.d.ts +32 -0
- package/dist/commerce/cart-line.js +43 -0
- package/dist/commerce/checkout-layout.d.ts +32 -0
- package/dist/commerce/checkout-layout.js +51 -0
- package/dist/commerce/facet-filters.d.ts +121 -0
- package/dist/commerce/facet-filters.js +318 -0
- package/dist/commerce/fulfilment-note.d.ts +28 -0
- package/dist/commerce/fulfilment-note.js +26 -0
- package/dist/commerce/index.d.ts +27 -0
- package/dist/commerce/index.js +27 -0
- package/dist/commerce/item-options-dialog.d.ts +67 -0
- package/dist/commerce/item-options-dialog.js +150 -0
- package/dist/commerce/menu-item-card.d.ts +37 -0
- package/dist/commerce/menu-item-card.js +96 -0
- package/dist/commerce/option-group.d.ts +62 -0
- package/dist/commerce/option-group.js +121 -0
- package/dist/commerce/order-summary.d.ts +42 -0
- package/dist/commerce/order-summary.js +76 -0
- package/dist/commerce/order-tracker.d.ts +80 -0
- package/dist/commerce/order-tracker.js +178 -0
- package/dist/commerce/price.d.ts +52 -0
- package/dist/commerce/price.js +108 -0
- package/dist/commerce/product-card.d.ts +53 -0
- package/dist/commerce/product-card.js +127 -0
- package/dist/commerce/product-gallery.d.ts +70 -0
- package/dist/commerce/product-gallery.js +186 -0
- package/dist/commerce/promo-code.d.ts +56 -0
- package/dist/commerce/promo-code.js +101 -0
- package/dist/commerce/quantity-stepper.d.ts +42 -0
- package/dist/commerce/quantity-stepper.js +53 -0
- package/dist/commerce/question-list.d.ts +53 -0
- package/dist/commerce/question-list.js +92 -0
- package/dist/commerce/shipping-estimate.d.ts +53 -0
- package/dist/commerce/shipping-estimate.js +39 -0
- package/dist/commerce/sort-select.d.ts +38 -0
- package/dist/commerce/sort-select.js +38 -0
- package/dist/commerce/variant-picker.d.ts +75 -0
- package/dist/commerce/variant-picker.js +135 -0
- package/dist/components/amount.d.ts +46 -0
- package/dist/components/amount.js +34 -0
- package/dist/components/autocomplete.d.ts +82 -0
- package/dist/components/autocomplete.js +114 -0
- package/dist/components/carousel.d.ts +31 -1
- package/dist/components/carousel.js +66 -3
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +11 -0
- package/dist/components/letterbox.d.ts +47 -0
- package/dist/components/letterbox.js +56 -0
- package/dist/components/lightbox.d.ts +88 -0
- package/dist/components/lightbox.js +224 -0
- package/dist/components/media-grid.d.ts +53 -0
- package/dist/components/media-grid.js +89 -0
- package/dist/components/range-months.d.ts +100 -0
- package/dist/components/range-months.js +274 -0
- package/dist/components/rating-input.d.ts +33 -0
- package/dist/components/rating-input.js +63 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +66 -0
- package/dist/components/review-card.d.ts +39 -0
- package/dist/components/review-card.js +59 -0
- package/dist/components/section-bar.d.ts +57 -0
- package/dist/components/section-bar.js +140 -0
- package/dist/components/step-indicator.d.ts +46 -0
- package/dist/components/step-indicator.js +96 -0
- package/dist/finance/index.d.ts +10 -0
- package/dist/finance/index.js +10 -0
- package/dist/finance/ledger.d.ts +60 -0
- package/dist/finance/ledger.js +93 -0
- package/dist/finance/payment-card.d.ts +49 -0
- package/dist/finance/payment-card.js +115 -0
- package/dist/map/engine.d.ts +49 -0
- package/dist/map/engine.js +591 -0
- package/dist/map/index.d.ts +12 -0
- package/dist/map/index.js +12 -0
- package/dist/map/map-canvas.d.ts +101 -0
- package/dist/map/map-canvas.js +275 -0
- package/dist/map/map.d.ts +217 -0
- package/dist/map/map.js +598 -0
- package/dist/map/mixins/map-link.d.ts +30 -0
- package/dist/map/mixins/map-link.js +116 -0
- package/dist/map/utils/basemap.d.ts +88 -0
- package/dist/map/utils/basemap.js +84 -0
- package/dist/map/utils/cluster.d.ts +43 -0
- package/dist/map/utils/cluster.js +80 -0
- package/dist/map/utils/mercator.d.ts +66 -0
- package/dist/map/utils/mercator.js +92 -0
- package/dist/map/utils/stage.d.ts +24 -0
- package/dist/map/utils/stage.js +49 -0
- package/dist/mixins/autocomplete.d.ts +28 -0
- package/dist/mixins/autocomplete.js +283 -0
- package/dist/mixins/carousel-controls.d.ts +14 -3
- package/dist/mixins/carousel-controls.js +89 -30
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/mixins/lightbox-controls.d.ts +34 -0
- package/dist/mixins/lightbox-controls.js +176 -0
- package/dist/schedule/agenda.d.ts +63 -0
- package/dist/schedule/agenda.js +221 -0
- package/dist/schedule/day-strip.d.ts +50 -0
- package/dist/schedule/day-strip.js +136 -0
- package/dist/schedule/free-busy.d.ts +96 -0
- package/dist/schedule/free-busy.js +285 -0
- package/dist/schedule/index.d.ts +15 -0
- package/dist/schedule/index.js +15 -0
- package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
- package/dist/schedule/mixins/day-strip-scroll.js +40 -0
- package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
- package/dist/schedule/mixins/time-grid-drag.js +532 -0
- package/dist/schedule/month-view.d.ts +68 -0
- package/dist/schedule/month-view.js +301 -0
- package/dist/schedule/time-grid.d.ts +168 -0
- package/dist/schedule/time-grid.js +417 -0
- package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
- package/dist/schedule/utils/time-grid-layout.js +93 -0
- package/dist/schedule/year-view.d.ts +46 -0
- package/dist/schedule/year-view.js +142 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/styles/typewriter-text.d.ts +20 -0
- package/dist/styles/typewriter-text.js +23 -0
- package/dist/test/map.d.ts +18 -0
- package/dist/test/map.js +96 -0
- package/dist/test/reels.d.ts +30 -0
- package/dist/test/reels.js +41 -0
- package/dist/test/stories.d.ts +31 -0
- package/dist/test/stories.js +66 -0
- package/dist/travel/boarding-pass.d.ts +107 -0
- package/dist/travel/boarding-pass.js +293 -0
- package/dist/travel/car-offer.d.ts +70 -0
- package/dist/travel/car-offer.js +127 -0
- package/dist/travel/fare-calendar.d.ts +85 -0
- package/dist/travel/fare-calendar.js +233 -0
- package/dist/travel/fare-options.d.ts +84 -0
- package/dist/travel/fare-options.js +142 -0
- package/dist/travel/flight-itinerary.d.ts +84 -0
- package/dist/travel/flight-itinerary.js +112 -0
- package/dist/travel/flight-option.d.ts +58 -0
- package/dist/travel/flight-option.js +111 -0
- package/dist/travel/flight-segment.d.ts +105 -0
- package/dist/travel/flight-segment.js +174 -0
- package/dist/travel/index.d.ts +20 -0
- package/dist/travel/index.js +20 -0
- package/dist/travel/package-savings.d.ts +74 -0
- package/dist/travel/package-savings.js +128 -0
- package/dist/travel/price-breakdown.d.ts +66 -0
- package/dist/travel/price-breakdown.js +102 -0
- package/dist/travel/rating-breakdown.d.ts +81 -0
- package/dist/travel/rating-breakdown.js +132 -0
- package/dist/travel/seat-map.d.ts +108 -0
- package/dist/travel/seat-map.js +371 -0
- package/dist/travel/trip-timeline.d.ts +84 -0
- package/dist/travel/trip-timeline.js +212 -0
- package/dist/utils/gamepad-presses.d.ts +21 -0
- package/dist/utils/gamepad-presses.js +28 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/move-focus.d.ts +20 -0
- package/dist/utils/move-focus.js +28 -0
- package/dist/utils/range-months.d.ts +54 -0
- package/dist/utils/range-months.js +98 -0
- package/dist/utils/swipe-direction.d.ts +23 -0
- package/dist/utils/swipe-direction.js +27 -0
- package/dist/utils/typewriter.d.ts +49 -0
- package/dist/utils/typewriter.js +171 -0
- package/dist/video/index.d.ts +6 -2
- package/dist/video/index.js +6 -2
- package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
- package/dist/video/mixins/reel-feed-sync.js +430 -0
- package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
- package/dist/video/mixins/story-viewer-sync.js +391 -0
- package/dist/video/mixins/video-player-sync.js +138 -5
- package/dist/video/reel-feed.d.ts +95 -0
- package/dist/video/reel-feed.js +124 -0
- package/dist/video/story-ring.d.ts +32 -0
- package/dist/video/story-ring.js +42 -0
- package/dist/video/story-viewer.d.ts +85 -0
- package/dist/video/story-viewer.js +250 -0
- package/dist/video/video-card.d.ts +3 -1
- package/dist/video/video-card.js +15 -5
- package/dist/video/video-player.d.ts +33 -0
- package/dist/video/video-player.js +226 -20
- package/package.json +21 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A full-height vertical feed of short videos, one per screen, the way a reels or shorts tab
|
|
3
|
+
* reads: native scroll snap moves it under the thumb, and its island loads only the reels
|
|
4
|
+
* around the one on screen, plays that one, and steps one reel per key or wheel flick.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
export { REEL_CHANGE_EVENT, reelPreload } from "./mixins/reel-feed-sync.js";
|
|
11
|
+
export type { ReelChangeDetail } from "./mixins/reel-feed-sync.js";
|
|
12
|
+
/** Prop types for {@link ReelFeed} and its parts. */
|
|
13
|
+
export declare namespace ReelFeed {
|
|
14
|
+
/** Every native `<section>` attribute, plus the feed's name and options. */
|
|
15
|
+
interface Props extends TagProps<"section"> {
|
|
16
|
+
/** The feed's accessible name, such as "Reels". */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* Puts each reel's `href` in the address bar as it comes on screen, in place, so the
|
|
20
|
+
* address always shares the reel being watched.
|
|
21
|
+
*/
|
|
22
|
+
followAddress?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Moves on to the next reel when the one on screen reaches its end, the way a reels tab
|
|
25
|
+
* plays through; the last reel loops. Without it every reel loops until the visitor swipes.
|
|
26
|
+
*/
|
|
27
|
+
autoAdvance?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Runs on from the last reel to the first, by swipe, key, wheel, step control or
|
|
30
|
+
* `autoAdvance`, so the feed never ends; the island adds a copy of the first reel to do it.
|
|
31
|
+
*/
|
|
32
|
+
loop?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The frame the next reel's page is prefetched into, such as `main`, so moving to it with
|
|
35
|
+
* a link renders without waiting; the document hint is prefetched either way.
|
|
36
|
+
*/
|
|
37
|
+
prefetchTarget?: string;
|
|
38
|
+
/** {@link ReelFeed.Item} elements in feed order. */
|
|
39
|
+
children: RemixNode;
|
|
40
|
+
/**
|
|
41
|
+
* Controls beside the scroller, such as up and down arrows: an element marked
|
|
42
|
+
* `data-reel-step="1"` or `"-1"` steps the feed, so a link to the next reel moves it in place;
|
|
43
|
+
* the island keeps its link on the neighbouring reel and marks it `aria-disabled` at an end.
|
|
44
|
+
*/
|
|
45
|
+
controls?: RemixNode;
|
|
46
|
+
}
|
|
47
|
+
/** One video source, in the order the browser should try them. */
|
|
48
|
+
interface Source {
|
|
49
|
+
src: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}
|
|
52
|
+
/** Every native `<article>` attribute, plus the reel's video and what sits over it. */
|
|
53
|
+
interface ItemProps extends Omit<TagProps<"article">, "children"> {
|
|
54
|
+
/** The reel's own address, which the feed follows and prefetches. */
|
|
55
|
+
href: string;
|
|
56
|
+
/** The reel's accessible name, such as "Reel by Mara Quint". */
|
|
57
|
+
label: string;
|
|
58
|
+
/**
|
|
59
|
+
* The reel's index minus the index of the reel the page opens on: `0` marks that reel,
|
|
60
|
+
* which the scroller starts at and which autoplays, and the distance sets its `preload`.
|
|
61
|
+
*/
|
|
62
|
+
offset: number;
|
|
63
|
+
sources: Source[];
|
|
64
|
+
/** Plays the video only this many seconds before looping, for a clip longer than the reel. */
|
|
65
|
+
loopAt?: number;
|
|
66
|
+
/** Drawn behind the video, for a transparent clip or while it loads. */
|
|
67
|
+
backdrop?: RemixNode;
|
|
68
|
+
/** The stage's play button names: it reads `pause` while playing, pressed once paused. */
|
|
69
|
+
labels: {
|
|
70
|
+
pause: string;
|
|
71
|
+
};
|
|
72
|
+
/** What sits over the video: the author, the caption, the action column. */
|
|
73
|
+
children?: RemixNode;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders the feed: a labelled `feed` scroller that snaps one reel per screen, and the island
|
|
78
|
+
* that runs it. It keeps scrolling and snapping without script; the reel at `offset` 0 is
|
|
79
|
+
* where the scroller starts and the one that autoplays.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* <ReelFeed label="Reels" followAddress prefetchTarget="main">
|
|
83
|
+
* {reels.map((reel, index) => <ReelFeed.Item href={reel.href} label={reel.label}
|
|
84
|
+
* offset={index - current} sources={reel.sources} labels={{ pause: "Pause" }} />)}
|
|
85
|
+
* </ReelFeed>
|
|
86
|
+
*/
|
|
87
|
+
export declare function ReelFeed(handle: Handle<ReelFeed.Props>): () => import("remix/component").RemixElement;
|
|
88
|
+
export declare namespace ReelFeed {
|
|
89
|
+
var Item: (handle: Handle<ReelFeed.ItemProps>) => () => import("remix/component").RemixElement;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The island inside every {@link ReelFeed}: a hidden marker that runs the feed. It loads from
|
|
93
|
+
* `@sdxc/ui/video/reel-feed`, which the browser entry maps to an import.
|
|
94
|
+
*/
|
|
95
|
+
export declare const ReelFeedSync: EntryComponent<Record<never, never>>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { PlayIcon } from "@sdxc/icons";
|
|
3
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
4
|
+
import { motionReduce } from "@sdxc/u/responsive";
|
|
5
|
+
import { when } from "@sdxc/u/state";
|
|
6
|
+
import { clientEntry } from "remix/component";
|
|
7
|
+
import { REEL_ACTIVE, REEL_PAUSED, reelFeedSync, reelPreload } from "./mixins/reel-feed-sync.js";
|
|
8
|
+
export { REEL_CHANGE_EVENT, reelPreload } from "./mixins/reel-feed-sync.js";
|
|
9
|
+
/**
|
|
10
|
+
* A one-pixel transparent GIF as the poster, so the drawn backdrop shows through until the
|
|
11
|
+
* first frame instead of the browser's grey placeholder.
|
|
12
|
+
*/
|
|
13
|
+
const CLEAR_POSTER = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
14
|
+
/** The feed's height, a screen by default, which a page shortens by its own bars. */
|
|
15
|
+
const HEIGHT = "var(--ui-reel-feed-height, 100dvh)";
|
|
16
|
+
/**
|
|
17
|
+
* Renders the feed: a labelled `feed` scroller that snaps one reel per screen, and the island
|
|
18
|
+
* that runs it. It keeps scrolling and snapping without script; the reel at `offset` 0 is
|
|
19
|
+
* where the scroller starts and the one that autoplays.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <ReelFeed label="Reels" followAddress prefetchTarget="main">
|
|
23
|
+
* {reels.map((reel, index) => <ReelFeed.Item href={reel.href} label={reel.label}
|
|
24
|
+
* offset={index - current} sources={reel.sources} labels={{ pause: "Pause" }} />)}
|
|
25
|
+
* </ReelFeed>
|
|
26
|
+
*/
|
|
27
|
+
export function ReelFeed(handle) {
|
|
28
|
+
return () => {
|
|
29
|
+
let { autoAdvance, children, controls, followAddress, label, loop, mix, prefetchTarget, ...rest } = handle.props;
|
|
30
|
+
return (_jsxs("section", { ...rest, "aria-label": label, "data-slot": "reel-feed", "data-follow-address": followAddress ? "" : undefined, "data-auto-advance": autoAdvance ? "" : undefined, "data-loop": loop ? "" : undefined, "data-prefetch-target": prefetchTarget, mix: mergeMix([raw({ position: "relative", blockSize: HEIGHT, minInlineSize: "0" })], mix), children: [_jsx("div", { role: "feed", "aria-label": label, "data-slot": "reel-feed-scroller", mix: [
|
|
31
|
+
raw({
|
|
32
|
+
blockSize: "100%",
|
|
33
|
+
overflowX: "hidden",
|
|
34
|
+
overflowY: "auto",
|
|
35
|
+
overscrollBehavior: "contain",
|
|
36
|
+
scrollSnapType: "y mandatory",
|
|
37
|
+
scrollbarWidth: "none",
|
|
38
|
+
outline: "none",
|
|
39
|
+
"&::-webkit-scrollbar": { display: "none" },
|
|
40
|
+
}),
|
|
41
|
+
when("&:focus-visible", raw({ boxShadow: "inset 0 0 0 2px var(--ui-brand-ring)" })),
|
|
42
|
+
], children: children }), controls, _jsx(ReelFeedSync, {})] }));
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One reel: a screen-high snap point holding a stage as tall as the feed and at most 9:16
|
|
47
|
+
* wide, with the backdrop, the video, a full-stage play button and the overlay over it, and
|
|
48
|
+
* a progress line along its foot.
|
|
49
|
+
*/
|
|
50
|
+
ReelFeed.Item = function ReelFeedItem(handle) {
|
|
51
|
+
return () => {
|
|
52
|
+
let { backdrop, children, href, label, labels, loopAt, mix, offset, sources, ...rest } = handle.props;
|
|
53
|
+
let current = offset === 0;
|
|
54
|
+
return (_jsxs("article", { ...rest, "aria-label": label, "data-slot": "reel-feed-item", "data-href": href, [REEL_ACTIVE]: current ? "" : undefined, mix: mergeMix([
|
|
55
|
+
raw({
|
|
56
|
+
position: "relative",
|
|
57
|
+
blockSize: "100%",
|
|
58
|
+
containerType: "size",
|
|
59
|
+
scrollSnapAlign: "start",
|
|
60
|
+
scrollSnapStop: "always",
|
|
61
|
+
display: "grid",
|
|
62
|
+
placeItems: "center",
|
|
63
|
+
overflow: "hidden",
|
|
64
|
+
}),
|
|
65
|
+
raw(current ? { scrollInitialTarget: "nearest" } : {}),
|
|
66
|
+
], mix), children: [_jsxs("div", { "data-slot": "reel-feed-stage", mix: [
|
|
67
|
+
raw({
|
|
68
|
+
position: "relative",
|
|
69
|
+
blockSize: "100%",
|
|
70
|
+
inlineSize: "min(100cqi, 56.25cqb)",
|
|
71
|
+
overflow: "hidden",
|
|
72
|
+
backgroundColor: "oklch(0.16 0.01 280)",
|
|
73
|
+
borderRadius: "var(--ui-reel-feed-radius, 0)",
|
|
74
|
+
isolation: "isolate",
|
|
75
|
+
}),
|
|
76
|
+
], children: [backdrop === undefined ? null : (_jsx("div", { "aria-hidden": "true", "data-slot": "reel-feed-backdrop", mix: [layer()], children: backdrop })), _jsx("video", { "data-reel-video": "", "data-loop-at": loopAt === undefined ? undefined : String(loopAt), preload: reelPreload(offset), poster: CLEAR_POSTER, autoplay: current, muted: true, loop: true, playsinline: true, "aria-hidden": "true", mix: [layer(), raw({ objectFit: "cover" })], children: sources.map((source) => (_jsx("source", { src: source.src, type: source.type }))) }), _jsx("button", { type: "button", "data-reel-toggle": "", "aria-label": labels.pause, "aria-pressed": "false", mix: [
|
|
77
|
+
layer(),
|
|
78
|
+
raw({
|
|
79
|
+
display: "grid",
|
|
80
|
+
placeItems: "center",
|
|
81
|
+
padding: "0",
|
|
82
|
+
border: "0",
|
|
83
|
+
background: "transparent",
|
|
84
|
+
color: "oklch(0.99 0 0)",
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
"& > svg": {
|
|
87
|
+
inlineSize: "4rem",
|
|
88
|
+
blockSize: "4rem",
|
|
89
|
+
padding: "1rem",
|
|
90
|
+
borderRadius: "999px",
|
|
91
|
+
backgroundColor: "rgb(0 0 0 / 0.45)",
|
|
92
|
+
opacity: "0",
|
|
93
|
+
transform: "scale(0.85)",
|
|
94
|
+
transition: "opacity 160ms ease, transform 160ms ease",
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
when(`[${REEL_PAUSED}] > [data-slot=reel-feed-stage] > & > svg`, raw({ opacity: "1", transform: "scale(1)" })),
|
|
98
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "-4px" })),
|
|
99
|
+
motionReduce(raw({ "& > svg": { transition: "none" } })),
|
|
100
|
+
], children: _jsx(PlayIcon, { "aria-hidden": "true", fill: "currentColor" }) }), children === undefined ? null : (_jsx("div", { "data-slot": "reel-feed-overlay", mix: [layer(), raw({ pointerEvents: "none", "& > *": { pointerEvents: "auto" } })], children: children })), _jsx("span", { "aria-hidden": "true", "data-slot": "reel-feed-progress", mix: [
|
|
101
|
+
raw({
|
|
102
|
+
position: "absolute",
|
|
103
|
+
insetInline: "0",
|
|
104
|
+
insetBlockEnd: "0",
|
|
105
|
+
blockSize: "2px",
|
|
106
|
+
backgroundColor: "rgb(255 255 255 / 0.85)",
|
|
107
|
+
transformOrigin: "left",
|
|
108
|
+
transform: "scaleX(var(--ui-reel-progress, 0))",
|
|
109
|
+
pointerEvents: "none",
|
|
110
|
+
}),
|
|
111
|
+
] })] }), offset === 1 ? _jsx("link", { rel: "prefetch", href: href, "data-reel-next": "" }) : null] }));
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** A layer filling the stage, stacked in source order. */
|
|
115
|
+
function layer() {
|
|
116
|
+
return raw({ position: "absolute", inset: "0", inlineSize: "100%", blockSize: "100%" });
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The island inside every {@link ReelFeed}: a hidden marker that runs the feed. It loads from
|
|
120
|
+
* `@sdxc/ui/video/reel-feed`, which the browser entry maps to an import.
|
|
121
|
+
*/
|
|
122
|
+
export const ReelFeedSync = clientEntry("@sdxc/ui/video/reel-feed#ReelFeedSync", function ReelFeedSync() {
|
|
123
|
+
return () => _jsx("span", { hidden: true, mix: [reelFeedSync()] });
|
|
124
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A picture in a ring that says whether there is a story to watch: a bright ring for one not
|
|
3
|
+
* yet seen, a thin quiet one once it has been, and a gap between ring and picture so it reads
|
|
4
|
+
* at any size. A row of them is a story tray, and a profile's highlights.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/** Prop types for {@link StoryRing}. */
|
|
11
|
+
export declare namespace StoryRing {
|
|
12
|
+
/** Every native `<span>` attribute, plus the picture and its state. */
|
|
13
|
+
interface Props extends Omit<TagProps<"span">, "children"> {
|
|
14
|
+
/** The picture inside the ring: an avatar, a drawn cover. */
|
|
15
|
+
children: RemixNode;
|
|
16
|
+
/** Whether every story behind it has been seen, which quiets the ring. Default: `false`. */
|
|
17
|
+
seen?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The ring's outer size in rem, or a CSS length, such as a custom property a page
|
|
20
|
+
* changes with its width. Default: `4`.
|
|
21
|
+
*/
|
|
22
|
+
size?: number | string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders the ring around its picture, its size set on the element itself so every ring shares
|
|
27
|
+
* one set of rules and the seen state always wins. The unseen ring paints `--ui-story-ring`, the brand's
|
|
28
|
+
* solid colour unless a page names a gradient; the seen ring paints the quiet border colour.
|
|
29
|
+
*
|
|
30
|
+
* @example <StoryRing seen={person.seen}><Avatar src={person.photo} alt="" /></StoryRing>
|
|
31
|
+
*/
|
|
32
|
+
export declare function StoryRing(handle: Handle<StoryRing.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
3
|
+
import { when } from "@sdxc/u/state";
|
|
4
|
+
/** The outer size, in rem, when a page names none. */
|
|
5
|
+
const DEFAULT_SIZE = 4;
|
|
6
|
+
/**
|
|
7
|
+
* Renders the ring around its picture, its size set on the element itself so every ring shares
|
|
8
|
+
* one set of rules and the seen state always wins. The unseen ring paints `--ui-story-ring`, the brand's
|
|
9
|
+
* solid colour unless a page names a gradient; the seen ring paints the quiet border colour.
|
|
10
|
+
*
|
|
11
|
+
* @example <StoryRing seen={person.seen}><Avatar src={person.photo} alt="" /></StoryRing>
|
|
12
|
+
*/
|
|
13
|
+
export function StoryRing(handle) {
|
|
14
|
+
return () => {
|
|
15
|
+
let { children, mix, seen = false, size = DEFAULT_SIZE, style, ...rest } = handle.props;
|
|
16
|
+
let side = typeof size === "number" ? `${size}rem` : size;
|
|
17
|
+
return (_jsx("span", { ...rest, style: `--ui-story-ring-size: ${side};${typeof style === "string" ? ` ${style}` : ""}`, "data-slot": "story-ring", "data-seen": seen ? "" : undefined, mix: mergeMix([
|
|
18
|
+
raw({
|
|
19
|
+
position: "relative",
|
|
20
|
+
display: "inline-grid",
|
|
21
|
+
placeItems: "center",
|
|
22
|
+
flexShrink: "0",
|
|
23
|
+
inlineSize: "var(--ui-story-ring-size)",
|
|
24
|
+
blockSize: "var(--ui-story-ring-size)",
|
|
25
|
+
padding: "calc(var(--ui-story-ring-size) * 0.05 + 1px)",
|
|
26
|
+
borderRadius: "var(--ui-story-ring-radius, 999px)",
|
|
27
|
+
background: "var(--ui-story-ring, var(--ui-brand-bg-solid))",
|
|
28
|
+
"& > *": {
|
|
29
|
+
inlineSize: "100%",
|
|
30
|
+
blockSize: "100%",
|
|
31
|
+
borderRadius: "inherit",
|
|
32
|
+
overflow: "hidden",
|
|
33
|
+
boxShadow: "0 0 0 calc(var(--ui-story-ring-size) * 0.035 + 1px) var(--ui-bg, Canvas)",
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
when("&[data-seen]", raw({
|
|
37
|
+
padding: "calc(var(--ui-story-ring-size) * 0.05)",
|
|
38
|
+
background: "var(--ui-neutral-border-strong)",
|
|
39
|
+
})),
|
|
40
|
+
], mix), children: children }));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A full-screen story player: each person's stories are a group of timed segments under a row
|
|
3
|
+
* of progress bars, groups sit side by side on a horizontal snap track, and tap zones that are
|
|
4
|
+
* links step through them, so the viewer reads and moves without script and its island adds
|
|
5
|
+
* timing, hold to pause and swipe down to close.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
11
|
+
export { STORY_CHANGE_EVENT } from "./mixins/story-viewer-sync.js";
|
|
12
|
+
export type { StoryChangeDetail } from "./mixins/story-viewer-sync.js";
|
|
13
|
+
/** Prop types for {@link StoryViewer} and its parts. */
|
|
14
|
+
export declare namespace StoryViewer {
|
|
15
|
+
/** Every native `<section>` attribute, plus the viewer's name, exit and control names. */
|
|
16
|
+
interface Props extends TagProps<"section"> {
|
|
17
|
+
/** The viewer's accessible name, such as "Stories". */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Where closing leaves to: the page the viewer opened from. */
|
|
20
|
+
closeHref: string;
|
|
21
|
+
labels: {
|
|
22
|
+
close: string;
|
|
23
|
+
/** The pause button's name; it is pressed while the story is paused. */
|
|
24
|
+
pause: string;
|
|
25
|
+
};
|
|
26
|
+
/** {@link StoryViewer.Group} elements, one per person, in viewing order. */
|
|
27
|
+
children: RemixNode;
|
|
28
|
+
}
|
|
29
|
+
/** Every native `<article>` attribute, plus one person's stories. */
|
|
30
|
+
interface GroupProps extends Omit<TagProps<"article">, "children"> {
|
|
31
|
+
/** The group's accessible name, such as "Mara Quint's story". */
|
|
32
|
+
label: string;
|
|
33
|
+
/** What sits under the progress bars: the person, how long ago, a menu. */
|
|
34
|
+
header?: RemixNode;
|
|
35
|
+
/** Each segment's length in seconds, in order, which times its progress bar. */
|
|
36
|
+
durations: number[];
|
|
37
|
+
/** The segment the group shows first. */
|
|
38
|
+
current: number;
|
|
39
|
+
/** Whether the viewer opens on this group; exactly one group in a viewer sets it. */
|
|
40
|
+
active?: boolean;
|
|
41
|
+
/** The address of the segment before the current one, or the close address before the first. */
|
|
42
|
+
previousHref: string;
|
|
43
|
+
/** The address of the segment after the current one, or the close address after the last. */
|
|
44
|
+
nextHref: string;
|
|
45
|
+
/** The tap zones' names. */
|
|
46
|
+
labels: {
|
|
47
|
+
previous: string;
|
|
48
|
+
next: string;
|
|
49
|
+
};
|
|
50
|
+
/** What sits at the foot of the card, such as a reply field. */
|
|
51
|
+
footer?: RemixNode;
|
|
52
|
+
/** {@link StoryViewer.Segment} elements in order. */
|
|
53
|
+
children: RemixNode;
|
|
54
|
+
}
|
|
55
|
+
/** Every native `<div>` attribute, plus one segment's address and picture. */
|
|
56
|
+
interface SegmentProps extends TagProps<"div"> {
|
|
57
|
+
/** The segment's own address, which the address bar follows. */
|
|
58
|
+
href: string;
|
|
59
|
+
/** Whether this is the group's current segment. */
|
|
60
|
+
current: boolean;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Renders the viewer: a full-screen dark stage with the close and pause buttons, and the track
|
|
65
|
+
* of groups; the group marked `active` is the one the track starts at. A page shows it inside
|
|
66
|
+
* a box by setting `--ui-story-viewer-position: absolute` and `--ui-story-viewer-height`.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* <StoryViewer label="Stories" closeHref="/" labels={{ close: "Close", pause: "Pause" }}>
|
|
70
|
+
* <StoryViewer.Group label="Mara's story" durations={[5, 5]} current={0} active
|
|
71
|
+
* previousHref="/" nextHref="/stories/mara/2" labels={{ previous: "Previous", next: "Next" }}>
|
|
72
|
+
* <StoryViewer.Segment href="/stories/mara/1" current><Art /></StoryViewer.Segment>
|
|
73
|
+
* </StoryViewer.Group>
|
|
74
|
+
* </StoryViewer>
|
|
75
|
+
*/
|
|
76
|
+
export declare function StoryViewer(handle: Handle<StoryViewer.Props>): () => import("remix/component").RemixElement;
|
|
77
|
+
export declare namespace StoryViewer {
|
|
78
|
+
var Group: (handle: Handle<StoryViewer.GroupProps>) => () => import("remix/component").RemixElement;
|
|
79
|
+
var Segment: (handle: Handle<StoryViewer.SegmentProps>) => () => import("remix/component").RemixElement;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The island inside every {@link StoryViewer}: a hidden marker that runs the viewer. It loads
|
|
83
|
+
* from `@sdxc/ui/video/story-viewer`, which the browser entry maps to an import.
|
|
84
|
+
*/
|
|
85
|
+
export declare const StoryViewerSync: EntryComponent<Record<never, never>>;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, PauseIcon, PlayIcon, XIcon } from "@sdxc/icons";
|
|
3
|
+
import { keyframes } from "@sdxc/u/animation";
|
|
4
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
5
|
+
import { motionReduce } from "@sdxc/u/responsive";
|
|
6
|
+
import { when } from "@sdxc/u/state";
|
|
7
|
+
import { clientEntry } from "remix/component";
|
|
8
|
+
import { STORY_ACTIVE, STORY_PAUSED, storyViewerSync } from "./mixins/story-viewer-sync.js";
|
|
9
|
+
export { STORY_CHANGE_EVENT } from "./mixins/story-viewer-sync.js";
|
|
10
|
+
/** The keyframes a current segment's bar fills by. */
|
|
11
|
+
const FILL = "ui-story-fill";
|
|
12
|
+
/**
|
|
13
|
+
* Renders the viewer: a full-screen dark stage with the close and pause buttons, and the track
|
|
14
|
+
* of groups; the group marked `active` is the one the track starts at. A page shows it inside
|
|
15
|
+
* a box by setting `--ui-story-viewer-position: absolute` and `--ui-story-viewer-height`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <StoryViewer label="Stories" closeHref="/" labels={{ close: "Close", pause: "Pause" }}>
|
|
19
|
+
* <StoryViewer.Group label="Mara's story" durations={[5, 5]} current={0} active
|
|
20
|
+
* previousHref="/" nextHref="/stories/mara/2" labels={{ previous: "Previous", next: "Next" }}>
|
|
21
|
+
* <StoryViewer.Segment href="/stories/mara/1" current><Art /></StoryViewer.Segment>
|
|
22
|
+
* </StoryViewer.Group>
|
|
23
|
+
* </StoryViewer>
|
|
24
|
+
*/
|
|
25
|
+
export function StoryViewer(handle) {
|
|
26
|
+
return () => {
|
|
27
|
+
let { children, closeHref, label, labels, mix, ...rest } = handle.props;
|
|
28
|
+
return (_jsxs("section", { ...rest, "aria-label": label, "aria-roledescription": "stories", tabindex: -1, "data-slot": "story-viewer", mix: mergeMix([
|
|
29
|
+
keyframes(FILL, { from: { inlineSize: "0%" }, to: { inlineSize: "100%" } }),
|
|
30
|
+
raw({
|
|
31
|
+
position: "var(--ui-story-viewer-position, fixed)",
|
|
32
|
+
inset: "0",
|
|
33
|
+
zIndex: "var(--ui-story-viewer-z, 60)",
|
|
34
|
+
display: "grid",
|
|
35
|
+
backgroundColor: "var(--ui-story-viewer-bg, oklch(0.14 0.01 280))",
|
|
36
|
+
color: "oklch(0.98 0 0)",
|
|
37
|
+
outline: "none",
|
|
38
|
+
overscrollBehavior: "contain",
|
|
39
|
+
}),
|
|
40
|
+
], mix), children: [_jsx("div", { "data-slot": "story-viewer-track", mix: [
|
|
41
|
+
raw({
|
|
42
|
+
display: "grid",
|
|
43
|
+
gridAutoFlow: "column",
|
|
44
|
+
gridAutoColumns: "100%",
|
|
45
|
+
overflowX: "auto",
|
|
46
|
+
overflowY: "hidden",
|
|
47
|
+
scrollSnapType: "x mandatory",
|
|
48
|
+
overscrollBehaviorX: "contain",
|
|
49
|
+
scrollbarWidth: "none",
|
|
50
|
+
"&::-webkit-scrollbar": { display: "none" },
|
|
51
|
+
}),
|
|
52
|
+
], children: children }), _jsxs("div", { mix: [
|
|
53
|
+
raw({
|
|
54
|
+
position: "absolute",
|
|
55
|
+
insetBlockStart: "max(0.75rem, env(safe-area-inset-top))",
|
|
56
|
+
insetInlineEnd: "0.75rem",
|
|
57
|
+
zIndex: "2",
|
|
58
|
+
display: "flex",
|
|
59
|
+
gap: "0.25rem",
|
|
60
|
+
}),
|
|
61
|
+
], children: [_jsxs("button", { type: "button", "data-story-pause": "", "data-story-control": "", "aria-label": labels.pause, "aria-pressed": "false", mix: [
|
|
62
|
+
roundControl(),
|
|
63
|
+
when("&:not([aria-pressed='true']) > [data-icon=play]", raw({ display: "none" })),
|
|
64
|
+
when("&[aria-pressed='true'] > [data-icon=pause]", raw({ display: "none" })),
|
|
65
|
+
], children: [_jsx(PauseIcon, { "aria-hidden": "true", "data-icon": "pause", size: 20, fill: "currentColor" }), _jsx(PlayIcon, { "aria-hidden": "true", "data-icon": "play", size: 20, fill: "currentColor" })] }), _jsx("a", { href: closeHref, "data-story-close": "", "data-story-control": "", "aria-label": labels.close, mix: [roundControl()], children: _jsx(XIcon, { "aria-hidden": "true", size: 24 }) })] }), _jsx(StoryViewerSync, {})] }));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** A round icon control over the dark stage, a 44px target. */
|
|
69
|
+
function roundControl() {
|
|
70
|
+
return [
|
|
71
|
+
raw({
|
|
72
|
+
display: "inline-grid",
|
|
73
|
+
placeItems: "center",
|
|
74
|
+
inlineSize: "2.75rem",
|
|
75
|
+
blockSize: "2.75rem",
|
|
76
|
+
padding: "0",
|
|
77
|
+
border: "0",
|
|
78
|
+
borderRadius: "999px",
|
|
79
|
+
color: "inherit",
|
|
80
|
+
background: "rgb(0 0 0 / 0.25)",
|
|
81
|
+
cursor: "pointer",
|
|
82
|
+
textDecoration: "none",
|
|
83
|
+
}),
|
|
84
|
+
when("&:hover", raw({ background: "rgb(255 255 255 / 0.16)" })),
|
|
85
|
+
when("&:focus-visible", raw({ outline: "2px solid oklch(0.98 0 0)", outlineOffset: "-2px" })),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* One person's stories: a screen-wide snap point holding a card that fills a phone and stands
|
|
90
|
+
* 9:16 with a margin on a wider screen, with the bars,
|
|
91
|
+
* the header, the segments, the two tap zones and an optional footer.
|
|
92
|
+
*/
|
|
93
|
+
StoryViewer.Group = function StoryViewerGroup(handle) {
|
|
94
|
+
return () => {
|
|
95
|
+
let { active, children, current, durations, footer, header, label, labels, mix, nextHref, previousHref, ...rest } = handle.props;
|
|
96
|
+
return (_jsx("article", { ...rest, "aria-label": label, "data-slot": "story-viewer-group", [STORY_ACTIVE]: active ? "" : undefined, mix: mergeMix([
|
|
97
|
+
raw({
|
|
98
|
+
container: "ui-story-group / size",
|
|
99
|
+
display: "grid",
|
|
100
|
+
placeItems: "center",
|
|
101
|
+
blockSize: "var(--ui-story-viewer-height, 100dvh)",
|
|
102
|
+
scrollSnapAlign: "center",
|
|
103
|
+
scrollSnapStop: "always",
|
|
104
|
+
overflow: "hidden",
|
|
105
|
+
}),
|
|
106
|
+
raw(active ? { scrollInitialTarget: "nearest" } : {}),
|
|
107
|
+
], mix), children: _jsxs("div", { "data-slot": "story-viewer-card", mix: [
|
|
108
|
+
raw({
|
|
109
|
+
position: "relative",
|
|
110
|
+
inlineSize: "100cqi",
|
|
111
|
+
blockSize: "100cqb",
|
|
112
|
+
overflow: "hidden",
|
|
113
|
+
backgroundColor: "oklch(0.2 0.01 280)",
|
|
114
|
+
touchAction: "pan-x",
|
|
115
|
+
userSelect: "none",
|
|
116
|
+
WebkitUserSelect: "none",
|
|
117
|
+
WebkitTouchCallout: "none",
|
|
118
|
+
transition: "transform 220ms ease, opacity 220ms ease, scale 220ms ease",
|
|
119
|
+
"@container ui-story-group (min-width: 40rem)": {
|
|
120
|
+
inlineSize: "min(100cqi, calc((100cqb - 3rem) * 0.5625))",
|
|
121
|
+
blockSize: "calc(100cqb - 3rem)",
|
|
122
|
+
borderRadius: "var(--ui-story-viewer-radius, 0.75rem)",
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
when(`[data-story-dragging] [${STORY_ACTIVE}] > &`, raw({
|
|
126
|
+
transition: "none",
|
|
127
|
+
transform: "translateY(var(--ui-story-pull, 0px))",
|
|
128
|
+
opacity: "var(--ui-story-fade, 1)",
|
|
129
|
+
})),
|
|
130
|
+
motionReduce(raw({ transition: "none" })),
|
|
131
|
+
], children: [children, _jsxs("div", { "data-slot": "story-viewer-chrome", mix: [
|
|
132
|
+
raw({
|
|
133
|
+
position: "absolute",
|
|
134
|
+
insetInline: "0",
|
|
135
|
+
insetBlockStart: "0",
|
|
136
|
+
zIndex: "2",
|
|
137
|
+
display: "grid",
|
|
138
|
+
gap: "0.625rem",
|
|
139
|
+
paddingBlock: "max(0.625rem, env(safe-area-inset-top)) 2.5rem",
|
|
140
|
+
paddingInline: "0.75rem 6.75rem",
|
|
141
|
+
background: "linear-gradient(rgb(0 0 0 / 0.45), rgb(0 0 0 / 0))",
|
|
142
|
+
pointerEvents: "none",
|
|
143
|
+
"& a, & button": { pointerEvents: "auto" },
|
|
144
|
+
"@container ui-story-group (min-width: 40rem)": { paddingInlineEnd: "0.75rem" },
|
|
145
|
+
}),
|
|
146
|
+
], children: [_jsx("div", { "aria-hidden": "true", mix: [
|
|
147
|
+
raw({
|
|
148
|
+
display: "grid",
|
|
149
|
+
gridAutoFlow: "column",
|
|
150
|
+
gridAutoColumns: "1fr",
|
|
151
|
+
gap: "0.25rem",
|
|
152
|
+
}),
|
|
153
|
+
], children: durations.map((seconds, index) => (_jsx("span", { "data-slot": "story-viewer-bar", "data-done": index < current ? "" : undefined, "data-current": index === current ? "" : undefined, style: `--ui-story-duration: ${seconds}s`, mix: [
|
|
154
|
+
raw({
|
|
155
|
+
display: "block",
|
|
156
|
+
blockSize: "0.1875rem",
|
|
157
|
+
borderRadius: "999px",
|
|
158
|
+
overflow: "hidden",
|
|
159
|
+
backgroundColor: "rgb(255 255 255 / 0.35)",
|
|
160
|
+
"& > span": {
|
|
161
|
+
display: "block",
|
|
162
|
+
blockSize: "100%",
|
|
163
|
+
inlineSize: "0%",
|
|
164
|
+
backgroundColor: "oklch(0.99 0 0)",
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
when("&[data-done] > span", raw({ inlineSize: "100%" })),
|
|
168
|
+
when("&[data-current] > span", raw({
|
|
169
|
+
animationName: FILL,
|
|
170
|
+
animationDuration: "var(--ui-story-duration)",
|
|
171
|
+
animationTimingFunction: "linear",
|
|
172
|
+
animationFillMode: "forwards",
|
|
173
|
+
animationPlayState: "paused",
|
|
174
|
+
})),
|
|
175
|
+
when(`[${STORY_ACTIVE}] &[data-current] > span`, raw({ animationPlayState: "running" })),
|
|
176
|
+
when(`[${STORY_PAUSED}] &[data-current] > span`, raw({ animationPlayState: "paused" })),
|
|
177
|
+
], children: _jsx("span", {}) }))) }), header] }), _jsx(StoryZone, { direction: "previous", href: previousHref, label: labels.previous }), _jsx(StoryZone, { direction: "next", href: nextHref, label: labels.next }), footer === undefined ? null : (_jsx("div", { "data-slot": "story-viewer-footer", "data-story-control": "", mix: [
|
|
178
|
+
raw({
|
|
179
|
+
position: "absolute",
|
|
180
|
+
insetInline: "0",
|
|
181
|
+
insetBlockEnd: "0",
|
|
182
|
+
zIndex: "2",
|
|
183
|
+
paddingBlock: "2.5rem max(0.75rem, env(safe-area-inset-bottom))",
|
|
184
|
+
paddingInline: "0.75rem",
|
|
185
|
+
background: "linear-gradient(rgb(0 0 0 / 0), rgb(0 0 0 / 0.5))",
|
|
186
|
+
}),
|
|
187
|
+
], children: footer }))] }) }));
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* A tap zone over one side of the card: a third of it going back, two thirds going forward,
|
|
192
|
+
* each a link to that segment's address, with a chevron where a pointer can hover.
|
|
193
|
+
*/
|
|
194
|
+
function StoryZone(handle) {
|
|
195
|
+
return () => {
|
|
196
|
+
let { direction, href, label } = handle.props;
|
|
197
|
+
let back = direction === "previous";
|
|
198
|
+
return (_jsx("a", { href: href, "data-story-zone": direction, "aria-label": label, draggable: false, mix: [
|
|
199
|
+
raw({
|
|
200
|
+
position: "absolute",
|
|
201
|
+
zIndex: "1",
|
|
202
|
+
insetBlock: "0",
|
|
203
|
+
insetInlineStart: back ? "0" : "33.333%",
|
|
204
|
+
insetInlineEnd: back ? "66.667%" : "0",
|
|
205
|
+
display: "flex",
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
justifyContent: back ? "flex-start" : "flex-end",
|
|
208
|
+
paddingInline: "0.5rem",
|
|
209
|
+
color: "oklch(0.99 0 0)",
|
|
210
|
+
WebkitTapHighlightColor: "transparent",
|
|
211
|
+
outline: "none",
|
|
212
|
+
"& > svg": {
|
|
213
|
+
inlineSize: "2rem",
|
|
214
|
+
blockSize: "2rem",
|
|
215
|
+
padding: "0.25rem",
|
|
216
|
+
borderRadius: "999px",
|
|
217
|
+
backgroundColor: "rgb(0 0 0 / 0.35)",
|
|
218
|
+
opacity: "0",
|
|
219
|
+
transition: "opacity 140ms ease",
|
|
220
|
+
},
|
|
221
|
+
"@media (hover: hover)": { "&:hover > svg": { opacity: "1" } },
|
|
222
|
+
}),
|
|
223
|
+
when("&:focus-visible > svg", raw({ opacity: "1", outline: "2px solid oklch(0.99 0 0)" })),
|
|
224
|
+
motionReduce(raw({ "& > svg": { transition: "none" } })),
|
|
225
|
+
], children: back ? _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) : _jsx(ChevronRightIcon, { "aria-hidden": "true" }) }));
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/** One segment: a full-card layer, shown only while it is its group's current one. */
|
|
229
|
+
StoryViewer.Segment = function StoryViewerSegment(handle) {
|
|
230
|
+
return () => {
|
|
231
|
+
let { current, href, mix, ...rest } = handle.props;
|
|
232
|
+
return (_jsx("div", { ...rest, "data-slot": "story-viewer-segment", "data-href": href, "data-current": current ? "" : undefined, mix: mergeMix([
|
|
233
|
+
raw({
|
|
234
|
+
position: "absolute",
|
|
235
|
+
inset: "0",
|
|
236
|
+
visibility: "hidden",
|
|
237
|
+
"& > *": { inlineSize: "100%", blockSize: "100%" },
|
|
238
|
+
"& video, & img, & svg": { objectFit: "cover" },
|
|
239
|
+
}),
|
|
240
|
+
when("&[data-current]", raw({ visibility: "visible" })),
|
|
241
|
+
], mix) }));
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* The island inside every {@link StoryViewer}: a hidden marker that runs the viewer. It loads
|
|
246
|
+
* from `@sdxc/ui/video/story-viewer`, which the browser entry maps to an import.
|
|
247
|
+
*/
|
|
248
|
+
export const StoryViewerSync = clientEntry("@sdxc/ui/video/story-viewer#StoryViewerSync", function StoryViewerSync() {
|
|
249
|
+
return () => _jsx("span", { hidden: true, mix: [storyViewerSync()] });
|
|
250
|
+
});
|
|
@@ -23,8 +23,10 @@ export declare namespace VideoCard {
|
|
|
23
23
|
shape?: Shape;
|
|
24
24
|
/** A short second line, such as "S2 · E4 · 38 min" or "2026 · Drama". */
|
|
25
25
|
meta?: RemixNode;
|
|
26
|
-
/** A label on the art
|
|
26
|
+
/** A label on the art, such as "New episodes". */
|
|
27
27
|
badge?: RemixNode;
|
|
28
|
+
/** Which corner of the art the badge sits in. Default: `"top"` (the start of the top edge). */
|
|
29
|
+
badgePlacement?: "top" | "bottom";
|
|
28
30
|
/** The share watched, from 0 to 1, drawn as a bar along the art's foot. */
|
|
29
31
|
progress?: number;
|
|
30
32
|
/** What a screen reader hears for the bar, such as "38% watched"; required with `progress`. */
|