@sdxc/ui 2026.11.14 → 2026.11.17
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 +26 -18
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +1 -0
- package/dist/app/mixins/log-viewer.js +15 -1
- package/dist/app/profile-picker.d.ts +47 -0
- package/dist/app/profile-picker.js +104 -0
- package/dist/app/save-status.js +1 -1
- package/dist/components/property-list.js +29 -7
- package/dist/video/episode-list.d.ts +48 -0
- package/dist/video/episode-list.js +161 -0
- package/dist/video/index.d.ts +7 -3
- package/dist/video/index.js +7 -3
- package/dist/video/mixins/video-shelf-steps.d.ts +20 -0
- package/dist/video/mixins/video-shelf-steps.js +79 -0
- package/dist/video/title-hero.d.ts +51 -0
- package/dist/video/title-hero.js +170 -0
- package/dist/video/video-card.d.ts +51 -0
- package/dist/video/video-card.js +135 -0
- package/dist/video/video-shelf.d.ts +58 -0
- package/dist/video/video-shelf.js +155 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -118,24 +118,24 @@ A page that sticks to baseline behavior ships no library JavaScript at all.
|
|
|
118
118
|
|
|
119
119
|
## API
|
|
120
120
|
|
|
121
|
-
| Import | Contains
|
|
122
|
-
| ---------------------- |
|
|
123
|
-
| `@sdxc/ui` | The general components, usable on any page, and their parts.
|
|
124
|
-
| `@sdxc/ui/<name>` | One general component, by its file name: `@sdxc/ui/youtube-embed`.
|
|
125
|
-
| `@sdxc/ui/landing` | Landing bands, composition craft and animated visuals.
|
|
126
|
-
| `@sdxc/ui/docs` | The docs shell, navigation and content blocks.
|
|
127
|
-
| `@sdxc/ui/chat` | The message log, turns, bubbles, markers and attachments.
|
|
128
|
-
| `@sdxc/ui/color` | Colour fields, pickers, sliders, swatches, area and wheel.
|
|
129
|
-
| `@sdxc/ui/app` | Dashboard and workspace components: charts, tables, lists, toasts.
|
|
130
|
-
| `@sdxc/ui/video` | A video player
|
|
131
|
-
| `@sdxc/ui/<ns>/<name>` | One namespace component, by its file name: `@sdxc/ui/docs/steps`.
|
|
132
|
-
| `@sdxc/ui/mixins` | Opt-in DOM behaviors applied through `mix`.
|
|
133
|
-
| `@sdxc/ui/behaviors` | Headless state classes built on `TypedEventTarget`.
|
|
134
|
-
| `@sdxc/ui/animations` | CSS-only motion factories and the `durations`/`easings` tokens.
|
|
135
|
-
| `@sdxc/ui/styles` | Style recipes composed inside a `mix` array.
|
|
136
|
-
| `@sdxc/ui/utils` | Framework-free color, chart, geometry, key and DOM helpers; types.
|
|
137
|
-
| `@sdxc/ui/reset.css` | The base reset in `@layer base`.
|
|
138
|
-
| `@sdxc/ui/theme.css` | The `--ui-*` semantic variables and the `--ui-chart-1`…`8` palette.
|
|
121
|
+
| Import | Contains |
|
|
122
|
+
| ---------------------- | --------------------------------------------------------------------------------- |
|
|
123
|
+
| `@sdxc/ui` | The general components, usable on any page, and their parts. |
|
|
124
|
+
| `@sdxc/ui/<name>` | One general component, by its file name: `@sdxc/ui/youtube-embed`. |
|
|
125
|
+
| `@sdxc/ui/landing` | Landing bands, composition craft and animated visuals. |
|
|
126
|
+
| `@sdxc/ui/docs` | The docs shell, navigation and content blocks. |
|
|
127
|
+
| `@sdxc/ui/chat` | The message log, turns, bubbles, markers and attachments. |
|
|
128
|
+
| `@sdxc/ui/color` | Colour fields, pickers, sliders, swatches, area and wheel. |
|
|
129
|
+
| `@sdxc/ui/app` | Dashboard and workspace components: charts, tables, lists, toasts. |
|
|
130
|
+
| `@sdxc/ui/video` | A video player, plus the cards, shelves and episode lists a library browses with. |
|
|
131
|
+
| `@sdxc/ui/<ns>/<name>` | One namespace component, by its file name: `@sdxc/ui/docs/steps`. |
|
|
132
|
+
| `@sdxc/ui/mixins` | Opt-in DOM behaviors applied through `mix`. |
|
|
133
|
+
| `@sdxc/ui/behaviors` | Headless state classes built on `TypedEventTarget`. |
|
|
134
|
+
| `@sdxc/ui/animations` | CSS-only motion factories and the `durations`/`easings` tokens. |
|
|
135
|
+
| `@sdxc/ui/styles` | Style recipes composed inside a `mix` array. |
|
|
136
|
+
| `@sdxc/ui/utils` | Framework-free color, chart, geometry, key and DOM helpers; types. |
|
|
137
|
+
| `@sdxc/ui/reset.css` | The base reset in `@layer base`. |
|
|
138
|
+
| `@sdxc/ui/theme.css` | The `--ui-*` semantic variables and the `--ui-chart-1`…`8` palette. |
|
|
139
139
|
|
|
140
140
|
A namespace builds on the general components and never on another namespace, and exports the
|
|
141
141
|
mixins, behaviors and styles only its components use; the shared helper subpaths hold the rest.
|
|
@@ -379,6 +379,7 @@ Dashboard and workspace components.
|
|
|
379
379
|
- `Toolbar`, `Menubar`, `ContextMenu` — a row of controls, a row of menu triggers, and a
|
|
380
380
|
pointer-positioned menu.
|
|
381
381
|
- `PageHeader` — a screen's title row and tabs; tabs that overflow fold into a More menu.
|
|
382
|
+
- `ProfilePicker` — a shared account's "who is using this?" grid; each `.Profile` is a submit button.
|
|
382
383
|
- `CommandPalette` — a ⌘K command list; `CommandPalette.Finder` is a fuzzy file finder page.
|
|
383
384
|
- `FilterMenu` — a filterable popover of links, radios or checkboxes, posted as a form on close.
|
|
384
385
|
- `CheckRuns`, `MergeBox` — a commit's checks summarised by state, and a merge box that says why it is blocked.
|
|
@@ -418,6 +419,13 @@ Dashboard and workspace components.
|
|
|
418
419
|
`VideoPlayerSync` island swaps them. `.Settings` takes `.CaptionsMenu`, `.SpeedMenu`,
|
|
419
420
|
`.QualityMenu`, and the page's own `.SettingsToggle` checkboxes and `.SettingsMenu` radio groups,
|
|
420
421
|
which the page reads by `name` from `change` events.
|
|
422
|
+
- `VideoCard` — a title as one link: 16:9 or 2:3 art, a badge, a watched bar, its name and meta.
|
|
423
|
+
- `VideoShelf` — a titled row of `.Item`s that scrolls sideways; `VideoShelfSync` reveals paging
|
|
424
|
+
buttons at its edges.
|
|
425
|
+
- `EpisodeList` — a season as an `<ol>` of `.Item` links with a still, number, runtime, synopsis
|
|
426
|
+
and watched bar.
|
|
427
|
+
- `TitleHero` — a title's art edge to edge under the top bar, faded into the page, with
|
|
428
|
+
`.Eyebrow`, `.Title`, `.Facts`, `.Rating`, `.Summary` and `.Actions`.
|
|
421
429
|
|
|
422
430
|
### Component helpers
|
|
423
431
|
|
package/dist/app/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export * from "./mixins/tree-filter.js";
|
|
|
75
75
|
export { TREE_NAVIGATION_ROW_SELECTOR, treeNavigation } from "./mixins/tree-navigation.js";
|
|
76
76
|
export * from "./optimistic-toggle.js";
|
|
77
77
|
export * from "./page-header.js";
|
|
78
|
+
export * from "./profile-picker.js";
|
|
78
79
|
export * from "./range-picker.js";
|
|
79
80
|
export * from "./resizable.js";
|
|
80
81
|
export * from "./gantt.js";
|
package/dist/app/index.js
CHANGED
|
@@ -75,6 +75,7 @@ export * from "./mixins/tree-filter.js";
|
|
|
75
75
|
export { TREE_NAVIGATION_ROW_SELECTOR, treeNavigation } from "./mixins/tree-navigation.js";
|
|
76
76
|
export * from "./optimistic-toggle.js";
|
|
77
77
|
export * from "./page-header.js";
|
|
78
|
+
export * from "./profile-picker.js";
|
|
78
79
|
export * from "./range-picker.js";
|
|
79
80
|
export * from "./resizable.js";
|
|
80
81
|
export * from "./gantt.js";
|
|
@@ -137,6 +137,18 @@ function attachSearch(root, options, signal) {
|
|
|
137
137
|
highlights?.delete(CURRENT_HIGHLIGHT);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Resolves a streamed line's link against the page, keeping only http(s) targets: the template
|
|
142
|
+
* comes from the DOM, so a `javascript:` or `data:` one leaves the line number unlinked.
|
|
143
|
+
*/
|
|
144
|
+
function webHref(href, base) {
|
|
145
|
+
let url = URL.parse(href, base);
|
|
146
|
+
if (url === null)
|
|
147
|
+
return undefined;
|
|
148
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
149
|
+
return undefined;
|
|
150
|
+
return url.href;
|
|
151
|
+
}
|
|
140
152
|
/**
|
|
141
153
|
* Builds one streamed line in the markup the server draws: a row holding its number link and
|
|
142
154
|
* its spans, or a fold whose summary is the row. An `##[endgroup]` closes the innermost fold.
|
|
@@ -163,7 +175,9 @@ function appendLine(live, raw) {
|
|
|
163
175
|
if (marker !== undefined && !isGroup)
|
|
164
176
|
row.setAttribute("data-tone", marker);
|
|
165
177
|
let link = document.createElement("a");
|
|
166
|
-
|
|
178
|
+
let target = webHref(href, document.baseURI);
|
|
179
|
+
if (target !== undefined)
|
|
180
|
+
link.href = target;
|
|
167
181
|
link.dataset["n"] = String(n);
|
|
168
182
|
if (ts !== undefined)
|
|
169
183
|
link.dataset["ts"] = formatLogTime(ts);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "who is using this?" screen of an account several people share: a question and a grid of
|
|
3
|
+
* large avatars, each one a button that picks that profile. It renders inside the page's own
|
|
4
|
+
* form, so each pick is a plain post that works without script.
|
|
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 ProfilePicker} and {@link ProfilePicker.Profile}. */
|
|
11
|
+
export declare namespace ProfilePicker {
|
|
12
|
+
/** Every native `<section>` attribute, plus the question it asks. */
|
|
13
|
+
interface Props extends Omit<TagProps<"section">, "title"> {
|
|
14
|
+
/** The question, such as "Who's watching?", which names the section. */
|
|
15
|
+
title: RemixNode;
|
|
16
|
+
/** A line under the grid, such as what a profile keeps apart. */
|
|
17
|
+
footer?: RemixNode;
|
|
18
|
+
/** {@link ProfilePicker.Profile} elements. */
|
|
19
|
+
children: RemixNode;
|
|
20
|
+
}
|
|
21
|
+
/** Every native `<button>` attribute but `children`, plus the profile it picks. */
|
|
22
|
+
interface ProfileProps extends Omit<TagProps<"button">, "children" | "name"> {
|
|
23
|
+
/** The profile's name, the button's text. */
|
|
24
|
+
name: string;
|
|
25
|
+
/** The profile's picture, drawn square at the button's width. */
|
|
26
|
+
avatar: RemixNode;
|
|
27
|
+
/** Where the pick posts, for a form holding every profile; see `formaction`. */
|
|
28
|
+
formAction?: string;
|
|
29
|
+
/** Marks the profile in use with `aria-current`. */
|
|
30
|
+
current?: boolean;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Renders the picker centred on the page: the question as its heading, then two profiles to a
|
|
35
|
+
* row on a phone and up to five on a wider screen.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <form method="post">
|
|
39
|
+
* <ProfilePicker title="Who's watching?">
|
|
40
|
+
* <ProfilePicker.Profile name="Noa" avatar={<Avatar />} formAction="/profiles/noa" />
|
|
41
|
+
* </ProfilePicker>
|
|
42
|
+
* </form>
|
|
43
|
+
*/
|
|
44
|
+
export declare function ProfilePicker(handle: Handle<ProfilePicker.Props>): () => import("remix/component").RemixElement;
|
|
45
|
+
export declare namespace ProfilePicker {
|
|
46
|
+
var Profile: (handle: Handle<ProfilePicker.ProfileProps>) => () => import("remix/component").RemixElement;
|
|
47
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
3
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
4
|
+
import { when } from "@sdxc/u/state";
|
|
5
|
+
/** Container the picker declares, which its grid sets its columns from. */
|
|
6
|
+
const CONTAINER = "ui-profile-picker";
|
|
7
|
+
/**
|
|
8
|
+
* Renders the picker centred on the page: the question as its heading, then two profiles to a
|
|
9
|
+
* row on a phone and up to five on a wider screen.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <form method="post">
|
|
13
|
+
* <ProfilePicker title="Who's watching?">
|
|
14
|
+
* <ProfilePicker.Profile name="Noa" avatar={<Avatar />} formAction="/profiles/noa" />
|
|
15
|
+
* </ProfilePicker>
|
|
16
|
+
* </form>
|
|
17
|
+
*/
|
|
18
|
+
export function ProfilePicker(handle) {
|
|
19
|
+
return () => {
|
|
20
|
+
let { children, footer, mix, title, ...rest } = handle.props;
|
|
21
|
+
return (_jsxs("section", { ...rest, "data-slot": "profile-picker", mix: mergeMix([
|
|
22
|
+
raw({
|
|
23
|
+
containerName: CONTAINER,
|
|
24
|
+
containerType: "inline-size",
|
|
25
|
+
display: "grid",
|
|
26
|
+
justifyItems: "center",
|
|
27
|
+
gap: "2.5rem",
|
|
28
|
+
paddingInline: "1rem",
|
|
29
|
+
textAlign: "center",
|
|
30
|
+
}),
|
|
31
|
+
], mix), children: [_jsx("h1", { mix: [
|
|
32
|
+
raw({
|
|
33
|
+
margin: "0",
|
|
34
|
+
fontSize: "clamp(1.75rem, 6cqi, 3rem)",
|
|
35
|
+
fontWeight: "600",
|
|
36
|
+
letterSpacing: "-0.02em",
|
|
37
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
38
|
+
}),
|
|
39
|
+
], children: title }), _jsx("ul", { mix: [
|
|
40
|
+
raw({
|
|
41
|
+
display: "grid",
|
|
42
|
+
gridTemplateColumns: "repeat(2, minmax(0, 8.5rem))",
|
|
43
|
+
gap: "1.75rem clamp(1rem, 4cqi, 2.5rem)",
|
|
44
|
+
margin: "0",
|
|
45
|
+
padding: "0",
|
|
46
|
+
listStyle: "none",
|
|
47
|
+
[`@container ${CONTAINER} (min-width: 40rem)`]: {
|
|
48
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(0, 9.5rem))",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
inlineSize: "100%",
|
|
51
|
+
maxInlineSize: "60rem",
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
], children: children }), footer === undefined ? null : (_jsx("p", { mix: [
|
|
55
|
+
raw({
|
|
56
|
+
margin: "0",
|
|
57
|
+
fontSize: "0.875rem",
|
|
58
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
59
|
+
}),
|
|
60
|
+
], children: footer }))] }));
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One profile: its avatar and name as a submit button. It rises a little and rings under the
|
|
65
|
+
* pointer, held still under reduced motion; the profile in use carries a ring at rest.
|
|
66
|
+
*/
|
|
67
|
+
ProfilePicker.Profile = function ProfilePickerProfile(handle) {
|
|
68
|
+
return () => {
|
|
69
|
+
let { avatar, current = false, formAction, mix, name, ...rest } = handle.props;
|
|
70
|
+
return (_jsx("li", { children: _jsxs("button", { type: "submit", ...rest, formaction: formAction, "aria-current": current ? "true" : undefined, "data-slot": "profile-picker-profile", mix: mergeMix([
|
|
71
|
+
raw({
|
|
72
|
+
display: "grid",
|
|
73
|
+
justifyItems: "center",
|
|
74
|
+
gap: "0.75rem",
|
|
75
|
+
inlineSize: "100%",
|
|
76
|
+
padding: "0",
|
|
77
|
+
border: "0",
|
|
78
|
+
background: "transparent",
|
|
79
|
+
font: "inherit",
|
|
80
|
+
fontSize: "1rem",
|
|
81
|
+
color: "var(--ui-neutral-fg)",
|
|
82
|
+
cursor: "pointer",
|
|
83
|
+
}),
|
|
84
|
+
when("&:hover", raw({ color: "var(--ui-neutral-fg-emphasis)" })),
|
|
85
|
+
when("&:focus-visible", raw({ outline: "none" })),
|
|
86
|
+
], mix), children: [_jsx("span", { "data-slot": "profile-picker-avatar", mix: [
|
|
87
|
+
raw({
|
|
88
|
+
display: "grid",
|
|
89
|
+
inlineSize: "100%",
|
|
90
|
+
aspectRatio: "1",
|
|
91
|
+
overflow: "clip",
|
|
92
|
+
borderRadius: "var(--ui-profile-picker-radius, 1rem)",
|
|
93
|
+
transition: "box-shadow 160ms ease, translate 160ms ease",
|
|
94
|
+
"& > *": { inlineSize: "100%", blockSize: "100%" },
|
|
95
|
+
"[aria-current] > &": {
|
|
96
|
+
boxShadow: "0 0 0 3px var(--ui-brand-bg-solid)",
|
|
97
|
+
},
|
|
98
|
+
":hover > &": { boxShadow: "0 0 0 3px var(--ui-neutral-fg-emphasis)" },
|
|
99
|
+
":focus-visible > &": { boxShadow: "0 0 0 3px var(--ui-brand-ring)" },
|
|
100
|
+
}),
|
|
101
|
+
motionSafe(raw({ ":hover > &": { translate: "0 -3px" } })),
|
|
102
|
+
], children: avatar }), _jsx("span", { children: name })] }) }));
|
|
103
|
+
};
|
|
104
|
+
};
|
package/dist/app/save-status.js
CHANGED
|
@@ -41,7 +41,7 @@ export const SaveStatus = clientEntry("@sdxc/ui/app/save-status#SaveStatus", fun
|
|
|
41
41
|
savedMs: handle.props.savedMs ?? DEFAULT_SAVED_MS,
|
|
42
42
|
decayMs,
|
|
43
43
|
}),
|
|
44
|
-
hstack({ gap: 2, align: "
|
|
44
|
+
hstack({ gap: 2, align: "baseline" }),
|
|
45
45
|
text("sm"),
|
|
46
46
|
nowrap(),
|
|
47
47
|
tabularNums(),
|
|
@@ -113,6 +113,7 @@ PropertyList.Item = function PropertyListItem(handle) {
|
|
|
113
113
|
grid(),
|
|
114
114
|
pb(1),
|
|
115
115
|
items("baseline"),
|
|
116
|
+
raw({ position: "relative" }),
|
|
116
117
|
/**
|
|
117
118
|
* The stacked and side-by-side tracks live in one rule, so the label column
|
|
118
119
|
* holds at its width whatever order the stylesheet layers land in.
|
|
@@ -142,20 +143,20 @@ PropertyList.Item = function PropertyListItem(handle) {
|
|
|
142
143
|
minBs("2rem"),
|
|
143
144
|
tabularNums(),
|
|
144
145
|
tiles ? [text("lg"), weight("semibold")] : null,
|
|
145
|
-
], children: edit ? (_jsx(PropertyEdit, { edit: edit, empty: isEmpty, children: value })) : (value) })] }));
|
|
146
|
+
], children: edit ? (_jsx(PropertyEdit, { edit: edit, empty: isEmpty, labelRow: !tiles, children: value })) : (value) })] }));
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
149
|
/**
|
|
149
|
-
* The editable value: a full-width button naming its action before the current value,
|
|
150
|
-
* and the popover it opens, the row's own or the app's.
|
|
151
|
-
* invoker
|
|
150
|
+
* The editable value: a full-width button naming its action before the current value, its
|
|
151
|
+
* chevron on the label's row, and the popover it opens, the row's own or the app's. As the
|
|
152
|
+
* popover's invoker the button is its implicit anchor, so it opens under its row.
|
|
152
153
|
*
|
|
153
154
|
* @param handle Runtime handle carrying the edit description and the rendered value.
|
|
154
155
|
* @returns The render function producing the button and its popover.
|
|
155
156
|
*/
|
|
156
157
|
function PropertyEdit(handle) {
|
|
157
158
|
return () => {
|
|
158
|
-
let { edit, children } = handle.props;
|
|
159
|
+
let { edit, children, labelRow } = handle.props;
|
|
159
160
|
return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", "data-slot": "property-edit", popovertarget: edit.id, "aria-haspopup": "dialog", mix: [
|
|
160
161
|
flex(),
|
|
161
162
|
items("center"),
|
|
@@ -164,7 +165,11 @@ function PropertyEdit(handle) {
|
|
|
164
165
|
is("full"),
|
|
165
166
|
minBs("2rem"),
|
|
166
167
|
pi(2),
|
|
167
|
-
raw({
|
|
168
|
+
raw({
|
|
169
|
+
marginInline: "-0.5rem",
|
|
170
|
+
inlineSize: "calc(100% + 1rem)",
|
|
171
|
+
paddingBlock: "0.25rem",
|
|
172
|
+
}),
|
|
168
173
|
rounded("md"),
|
|
169
174
|
border({ color: "transparent", width: 0 }),
|
|
170
175
|
bg("transparent"),
|
|
@@ -175,6 +180,23 @@ function PropertyEdit(handle) {
|
|
|
175
180
|
transition("background-color"),
|
|
176
181
|
hover(bg("neutral.tint")),
|
|
177
182
|
focusVisible(outline({ color: "brand.ring", width: 2, offset: -2 })),
|
|
178
|
-
], children: [_jsxs("span", { mix: [flex(), items("center"), gap(1.5), raw({ flexWrap: "wrap" }), minIs(0)], children: [_jsx("span", { mix: [visuallyHidden()], children: `${edit.label}: ` }), children] }), _jsx(
|
|
183
|
+
], children: [_jsxs("span", { mix: [flex(), items("center"), gap(1.5), raw({ flexWrap: "wrap" }), minIs(0)], children: [_jsx("span", { mix: [visuallyHidden()], children: `${edit.label}: ` }), children] }), _jsx("span", { "aria-hidden": "true", mix: [
|
|
184
|
+
flex(),
|
|
185
|
+
items("center"),
|
|
186
|
+
shrink(0),
|
|
187
|
+
raw({ alignSelf: "flex-start", blockSize: "1.5rem" }),
|
|
188
|
+
labelRow
|
|
189
|
+
? raw({
|
|
190
|
+
position: "absolute",
|
|
191
|
+
insetBlockStart: "0.625rem",
|
|
192
|
+
insetInlineEnd: 0,
|
|
193
|
+
blockSize: "1.25rem",
|
|
194
|
+
[`@container ${PROPERTY_LIST_CONTAINER} (min-width: 22rem)`]: {
|
|
195
|
+
position: "static",
|
|
196
|
+
blockSize: "1.5rem",
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
: null,
|
|
200
|
+
], children: _jsx(ChevronDownIcon, { size: 14, mix: [fg("neutral.muted")] }) })] }), edit.popover ?? (_jsx(Popover, { id: edit.id, placement: "bottom-start", role: "dialog", "aria-label": edit.label, "data-slot": "property-popover", mix: [p(3), is("min(20rem, calc(100vw - 2rem))"), text("sm")], children: edit.content }))] }));
|
|
179
201
|
};
|
|
180
202
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A season's episodes as an ordered list: each one a link with its still, number, title,
|
|
3
|
+
* running time and synopsis, a bar for how much of it was watched, and a mark on the one the
|
|
4
|
+
* viewer is up to. Wide, the still sits beside the text; on a phone, the synopsis wraps under both.
|
|
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 EpisodeList} and its parts. */
|
|
11
|
+
export declare namespace EpisodeList {
|
|
12
|
+
/** Every native `<ol>` attribute, with {@link EpisodeList.Item} children. */
|
|
13
|
+
interface Props extends TagProps<"ol"> {
|
|
14
|
+
}
|
|
15
|
+
/** One episode; every native `<li>` attribute but `title`, plus the episode's content. */
|
|
16
|
+
interface ItemProps extends Omit<TagProps<"li">, "title" | "children"> {
|
|
17
|
+
/** Where the episode plays. */
|
|
18
|
+
href: string;
|
|
19
|
+
/** The episode's number in its season, drawn large beside the still. */
|
|
20
|
+
number: number;
|
|
21
|
+
title: string;
|
|
22
|
+
/** The still, drawn edge to edge in a 16:9 frame. */
|
|
23
|
+
still: RemixNode;
|
|
24
|
+
/** The running time as it reads, such as "48 min". */
|
|
25
|
+
duration?: string;
|
|
26
|
+
/** One or two sentences on the episode. */
|
|
27
|
+
synopsis?: RemixNode;
|
|
28
|
+
/** The share watched, from 0 to 1. */
|
|
29
|
+
progress?: number;
|
|
30
|
+
/** What a screen reader hears for the bar, such as "Watched 60%". */
|
|
31
|
+
progressLabel?: string;
|
|
32
|
+
/** Marks the episode the viewer is up to, with `aria-current` on its link. */
|
|
33
|
+
current?: boolean;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Renders the list. It is an `<ol>`, so a screen reader hears where each episode falls in the
|
|
38
|
+
* season, and each row is one link named by its number and title.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <EpisodeList aria-label="Season 1">
|
|
42
|
+
* <EpisodeList.Item href="/watch/1" number={1} title="Low Tide" still={<Still />} duration="52 min" />
|
|
43
|
+
* </EpisodeList>
|
|
44
|
+
*/
|
|
45
|
+
export declare function EpisodeList(handle: Handle<EpisodeList.Props>): () => import("remix/component").RemixElement;
|
|
46
|
+
export declare namespace EpisodeList {
|
|
47
|
+
var Item: (handle: Handle<EpisodeList.ItemProps>) => () => import("remix/component").RemixElement;
|
|
48
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
3
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
4
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
5
|
+
import { when } from "@sdxc/u/state";
|
|
6
|
+
import { clampProgress } from "./video-card.js";
|
|
7
|
+
/** Container each row queries, so the layout follows the list's width rather than the page's. */
|
|
8
|
+
const CONTAINER = "ui-episode-list";
|
|
9
|
+
/**
|
|
10
|
+
* Renders the list. It is an `<ol>`, so a screen reader hears where each episode falls in the
|
|
11
|
+
* season, and each row is one link named by its number and title.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <EpisodeList aria-label="Season 1">
|
|
15
|
+
* <EpisodeList.Item href="/watch/1" number={1} title="Low Tide" still={<Still />} duration="52 min" />
|
|
16
|
+
* </EpisodeList>
|
|
17
|
+
*/
|
|
18
|
+
export function EpisodeList(handle) {
|
|
19
|
+
return () => {
|
|
20
|
+
let { mix, ...rest } = handle.props;
|
|
21
|
+
return (_jsx("ol", { ...rest, "data-slot": "episode-list", mix: mergeMix([
|
|
22
|
+
raw({
|
|
23
|
+
containerName: CONTAINER,
|
|
24
|
+
containerType: "inline-size",
|
|
25
|
+
display: "grid",
|
|
26
|
+
gap: "0.25rem",
|
|
27
|
+
margin: "0",
|
|
28
|
+
padding: "0",
|
|
29
|
+
listStyle: "none",
|
|
30
|
+
}),
|
|
31
|
+
], mix) }));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One episode row. The whole row is the link; its wash lights on hover and focus, and the still
|
|
36
|
+
* lifts a little under the pointer, held still under reduced motion.
|
|
37
|
+
*/
|
|
38
|
+
EpisodeList.Item = function EpisodeListItem(handle) {
|
|
39
|
+
return () => {
|
|
40
|
+
let { current, duration, href, mix, number, progress, progressLabel, still, synopsis, title, ...rest } = handle.props;
|
|
41
|
+
let watched = progress === undefined ? null : clampProgress(progress);
|
|
42
|
+
return (_jsx("li", { ...rest, "data-slot": "episode-list-item", mix: mergeMix([], mix), children: _jsxs("a", { href: href, "aria-current": current ? "true" : undefined, mix: [
|
|
43
|
+
raw({
|
|
44
|
+
position: "relative",
|
|
45
|
+
display: "grid",
|
|
46
|
+
gridTemplateColumns: "minmax(0, 9rem) minmax(0, 1fr)",
|
|
47
|
+
gridTemplateAreas: '"still head" "copy copy"',
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
columnGap: "0.875rem",
|
|
50
|
+
rowGap: "0.625rem",
|
|
51
|
+
padding: "0.75rem",
|
|
52
|
+
borderRadius: "var(--ui-radius-lg, 0.5rem)",
|
|
53
|
+
color: "inherit",
|
|
54
|
+
textDecoration: "none",
|
|
55
|
+
outline: "none",
|
|
56
|
+
transition: "background-color 140ms ease",
|
|
57
|
+
[`@container ${CONTAINER} (min-width: 40rem)`]: {
|
|
58
|
+
gridTemplateColumns: "2.5rem minmax(0, 13rem) minmax(0, 1fr)",
|
|
59
|
+
gridTemplateAreas: '"number still head" "number still copy"',
|
|
60
|
+
alignItems: "start",
|
|
61
|
+
columnGap: "1.25rem",
|
|
62
|
+
rowGap: "0.375rem",
|
|
63
|
+
padding: "1rem",
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
when("&:hover", raw({ backgroundColor: "var(--ui-neutral-bg-tint-hover)" })),
|
|
67
|
+
when("&:focus-visible", raw({ boxShadow: "inset 0 0 0 2px var(--ui-brand-ring)" })),
|
|
68
|
+
when("&[aria-current]", raw({ backgroundColor: "var(--ui-neutral-bg-tint-hover)" })),
|
|
69
|
+
motionSafe(when("&:hover [data-slot=episode-still] > :first-child", raw({ scale: "1.04" }))),
|
|
70
|
+
], children: [_jsx("span", { "aria-hidden": "true", mix: [
|
|
71
|
+
raw({
|
|
72
|
+
gridArea: "number",
|
|
73
|
+
display: "none",
|
|
74
|
+
alignSelf: "center",
|
|
75
|
+
fontSize: "1.5rem",
|
|
76
|
+
lineHeight: "1",
|
|
77
|
+
fontWeight: "600",
|
|
78
|
+
fontVariantNumeric: "tabular-nums",
|
|
79
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
80
|
+
[`@container ${CONTAINER} (min-width: 40rem)`]: { display: "block" },
|
|
81
|
+
}),
|
|
82
|
+
], children: number }), _jsx(EpisodeStill, { watched: watched, children: still }), _jsxs("span", { mix: [
|
|
83
|
+
raw({
|
|
84
|
+
gridArea: "head",
|
|
85
|
+
display: "flex",
|
|
86
|
+
alignItems: "baseline",
|
|
87
|
+
justifyContent: "space-between",
|
|
88
|
+
gap: "0.75rem",
|
|
89
|
+
minInlineSize: "0",
|
|
90
|
+
alignSelf: "center",
|
|
91
|
+
[`@container ${CONTAINER} (min-width: 40rem)`]: { alignSelf: "end" },
|
|
92
|
+
}),
|
|
93
|
+
], children: [_jsxs("span", { "data-slot": "episode-title", mix: [
|
|
94
|
+
raw({
|
|
95
|
+
fontSize: "0.9375rem",
|
|
96
|
+
lineHeight: "1.375rem",
|
|
97
|
+
fontWeight: "600",
|
|
98
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
99
|
+
textWrap: "balance",
|
|
100
|
+
}),
|
|
101
|
+
], children: [_jsxs("span", { "aria-hidden": "true", mix: [raw({ [`@container ${CONTAINER} (min-width: 40rem)`]: { display: "none" } })], children: [number, ".", " "] }), _jsxs("span", { mix: [visuallyHidden()], children: [number, ". "] }), title] }), duration === undefined ? null : (_jsx("span", { mix: [
|
|
102
|
+
raw({
|
|
103
|
+
flexShrink: "0",
|
|
104
|
+
fontSize: "0.8125rem",
|
|
105
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
106
|
+
fontVariantNumeric: "tabular-nums",
|
|
107
|
+
}),
|
|
108
|
+
], children: duration }))] }), _jsxs("span", { mix: [
|
|
109
|
+
raw({
|
|
110
|
+
gridArea: "copy",
|
|
111
|
+
alignSelf: "start",
|
|
112
|
+
fontSize: "0.875rem",
|
|
113
|
+
lineHeight: "1.375rem",
|
|
114
|
+
color: "var(--ui-neutral-fg)",
|
|
115
|
+
}),
|
|
116
|
+
], children: [synopsis, watched === null || progressLabel === undefined ? null : (_jsxs("span", { mix: [visuallyHidden()], children: [" ", progressLabel] }))] })] }) }));
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The still in its 16:9 frame with the watched bar along its foot; the bar is decorative, its
|
|
121
|
+
* share spoken through the row's own text.
|
|
122
|
+
*/
|
|
123
|
+
function EpisodeStill(handle) {
|
|
124
|
+
return () => {
|
|
125
|
+
let { children, watched } = handle.props;
|
|
126
|
+
return (_jsxs("span", { "data-slot": "episode-still", mix: [
|
|
127
|
+
raw({
|
|
128
|
+
gridArea: "still",
|
|
129
|
+
position: "relative",
|
|
130
|
+
display: "block",
|
|
131
|
+
aspectRatio: "16 / 9",
|
|
132
|
+
overflow: "clip",
|
|
133
|
+
borderRadius: "var(--ui-radius-md, 0.375rem)",
|
|
134
|
+
backgroundColor: "var(--ui-neutral-bg-tint-pressed)",
|
|
135
|
+
boxShadow: "0 0 0 1px var(--ui-image-outline, rgb(0 0 0 / 0.08))",
|
|
136
|
+
"& > :first-child": {
|
|
137
|
+
position: "absolute",
|
|
138
|
+
inset: "0",
|
|
139
|
+
inlineSize: "100%",
|
|
140
|
+
blockSize: "100%",
|
|
141
|
+
objectFit: "cover",
|
|
142
|
+
transition: "scale 320ms cubic-bezier(0.2, 0.7, 0.2, 1)",
|
|
143
|
+
},
|
|
144
|
+
}),
|
|
145
|
+
], children: [children, watched === null ? null : (_jsx("span", { "aria-hidden": "true", mix: [
|
|
146
|
+
raw({
|
|
147
|
+
position: "absolute",
|
|
148
|
+
insetInline: "0",
|
|
149
|
+
insetBlockEnd: "0",
|
|
150
|
+
blockSize: "0.1875rem",
|
|
151
|
+
backgroundColor: "rgb(255 255 255 / 0.28)",
|
|
152
|
+
}),
|
|
153
|
+
], children: _jsx("span", { mix: [
|
|
154
|
+
raw({
|
|
155
|
+
display: "block",
|
|
156
|
+
blockSize: "100%",
|
|
157
|
+
backgroundColor: "var(--ui-video-card-progress-color, var(--ui-brand-bg-solid))",
|
|
158
|
+
}),
|
|
159
|
+
], style: { inlineSize: `${(watched * 100).toFixed(1)}%` } }) }))] }));
|
|
160
|
+
};
|
|
161
|
+
}
|
package/dist/video/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Barrel for `@sdxc/ui/video`: a video player and its parts,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Barrel for `@sdxc/ui/video`: a video player and its parts, and the catalogue pieces a
|
|
3
|
+
* video library browses with (cards, shelves, heroes, episode lists), with the helpers only they use.
|
|
4
|
+
* Each module also imports on its own, as `@sdxc/ui/video/video-player`.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
9
|
export * from "./mixins/video-player-sync.js";
|
|
10
10
|
export * from "./utils/timeline.js";
|
|
11
|
+
export * from "./episode-list.js";
|
|
12
|
+
export * from "./title-hero.js";
|
|
13
|
+
export * from "./video-card.js";
|
|
11
14
|
export * from "./video-player.js";
|
|
15
|
+
export * from "./video-shelf.js";
|
package/dist/video/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Barrel for `@sdxc/ui/video`: a video player and its parts,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Barrel for `@sdxc/ui/video`: a video player and its parts, and the catalogue pieces a
|
|
3
|
+
* video library browses with (cards, shelves, heroes, episode lists), with the helpers only they use.
|
|
4
|
+
* Each module also imports on its own, as `@sdxc/ui/video/video-player`.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
9
|
export * from "./mixins/video-player-sync.js";
|
|
10
10
|
export * from "./utils/timeline.js";
|
|
11
|
+
export * from "./episode-list.js";
|
|
12
|
+
export * from "./title-hero.js";
|
|
13
|
+
export * from "./video-card.js";
|
|
11
14
|
export * from "./video-player.js";
|
|
15
|
+
export * from "./video-shelf.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: paging a scroller by one screenful and disabling a button at the end it points to
|
|
3
|
+
* both need the scroller's live width and position, which CSS cannot read.
|
|
4
|
+
* No-JS baseline: the shelf scrolls by touch, trackpad, wheel and the Tab key through its
|
|
5
|
+
* cards, with its scrollbar showing and its paging buttons hidden.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import type { MixinFactory } from "remix/component";
|
|
11
|
+
/** Set on the scroller once its paging buttons run, which then hide its scrollbar. */
|
|
12
|
+
export declare const READY_ATTRIBUTE = "data-video-shelf-ready";
|
|
13
|
+
/** The attribute a paging button carries: `-1` steps back, `1` steps forward. */
|
|
14
|
+
export declare const STEP_ATTRIBUTE = "data-video-shelf-step";
|
|
15
|
+
/**
|
|
16
|
+
* Runs the paging buttons of the shelf it sits in: each step moves one screenful, flipped under
|
|
17
|
+
* right-to-left, and each button disables at the end it points to as the scroller moves or
|
|
18
|
+
* resizes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const videoShelfSteps: MixinFactory<HTMLElement>;
|