@sdxc/ui 2026.11.11 → 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 +114 -61
- package/dist/app/app-shell-toggle.d.ts +2 -0
- package/dist/app/app-shell-toggle.js +5 -2
- package/dist/app/app-shell.d.ts +25 -1
- package/dist/app/app-shell.js +73 -38
- package/dist/app/auto-refresh.d.ts +2 -0
- package/dist/app/auto-refresh.js +3 -3
- package/dist/app/behaviors/refresh-schedule.d.ts +8 -3
- package/dist/app/behaviors/refresh-schedule.js +4 -3
- package/dist/app/board.d.ts +123 -0
- package/dist/app/board.js +224 -0
- package/dist/app/chart.d.ts +2 -2
- package/dist/app/chart.js +7 -3
- package/dist/app/check-runs.d.ts +116 -0
- package/dist/app/check-runs.js +201 -0
- package/dist/app/code-view.d.ts +172 -0
- package/dist/app/code-view.js +414 -0
- package/dist/app/command-palette.d.ts +38 -3
- package/dist/app/command-palette.js +53 -5
- package/dist/app/contribution-graph.d.ts +106 -0
- package/dist/app/contribution-graph.js +289 -0
- package/dist/app/detail-sheet.d.ts +7 -0
- package/dist/app/detail-sheet.js +7 -7
- package/dist/app/diff.d.ts +200 -0
- package/dist/app/diff.js +702 -0
- package/dist/app/filter-bar.d.ts +20 -0
- package/dist/app/filter-bar.js +35 -15
- package/dist/app/filter-menu.d.ts +144 -0
- package/dist/app/filter-menu.js +480 -0
- package/dist/app/gantt.d.ts +108 -0
- package/dist/app/gantt.js +420 -0
- package/dist/app/index.d.ts +20 -0
- package/dist/app/index.js +20 -0
- package/dist/app/log-viewer.d.ts +120 -0
- package/dist/app/log-viewer.js +384 -0
- package/dist/app/merge-box.d.ts +97 -0
- package/dist/app/merge-box.js +227 -0
- package/dist/app/mixins/app-shell-controls.d.ts +4 -1
- package/dist/app/mixins/app-shell-controls.js +64 -4
- package/dist/app/mixins/auto-refresh.d.ts +5 -2
- package/dist/app/mixins/auto-refresh.js +9 -3
- package/dist/app/mixins/close-popover-on-submit.d.ts +16 -0
- package/dist/app/mixins/close-popover-on-submit.js +32 -0
- package/dist/app/mixins/code-view-selection.d.ts +60 -0
- package/dist/app/mixins/code-view-selection.js +276 -0
- package/dist/app/mixins/command-palette.d.ts +15 -4
- package/dist/app/mixins/command-palette.js +94 -6
- package/dist/app/mixins/contribution-graph-keys.d.ts +19 -0
- package/dist/app/mixins/contribution-graph-keys.js +155 -0
- package/dist/app/mixins/diff-interactions.d.ts +72 -0
- package/dist/app/mixins/diff-interactions.js +269 -0
- package/dist/app/mixins/filter-menu-keys.d.ts +41 -0
- package/dist/app/mixins/filter-menu-keys.js +91 -0
- package/dist/app/mixins/gantt-today.d.ts +17 -0
- package/dist/app/mixins/gantt-today.js +50 -0
- package/dist/app/mixins/log-viewer.d.ts +29 -0
- package/dist/app/mixins/log-viewer.js +347 -0
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +5 -0
- package/dist/app/mixins/optimistic-toggle-sync.js +25 -1
- package/dist/app/mixins/save-bar-sync.d.ts +7 -1
- package/dist/app/mixins/save-bar-sync.js +23 -4
- package/dist/app/mixins/save-status-sync.js +23 -1
- package/dist/app/mixins/split-view.js +1 -1
- package/dist/app/mixins/submit-on-close.d.ts +17 -0
- package/dist/app/mixins/submit-on-close.js +52 -0
- package/dist/app/mixins/tree-filter.d.ts +44 -0
- package/dist/app/mixins/tree-filter.js +111 -0
- package/dist/app/mixins/tree-navigation.d.ts +50 -0
- package/dist/app/mixins/tree-navigation.js +216 -0
- package/dist/app/optimistic-toggle.d.ts +8 -0
- package/dist/app/optimistic-toggle.js +3 -2
- package/dist/app/page-header.d.ts +18 -3
- package/dist/app/page-header.js +105 -50
- package/dist/app/profile-picker.d.ts +47 -0
- package/dist/app/profile-picker.js +104 -0
- package/dist/app/review-thread.d.ts +115 -0
- package/dist/app/review-thread.js +116 -0
- package/dist/app/save-bar.d.ts +5 -0
- package/dist/app/save-bar.js +1 -1
- package/dist/app/save-status.js +1 -1
- package/dist/app/settings-layout.d.ts +5 -0
- package/dist/app/settings-layout.js +5 -5
- package/dist/app/skeleton.d.ts +9 -0
- package/dist/app/skeleton.js +28 -0
- package/dist/app/split-view.d.ts +4 -0
- package/dist/app/split-view.js +3 -3
- package/dist/app/styles/code-tokens.d.ts +24 -0
- package/dist/app/styles/code-tokens.js +47 -0
- package/dist/app/tab-bar.d.ts +59 -0
- package/dist/app/tab-bar.js +111 -0
- package/dist/app/tree.d.ts +111 -14
- package/dist/app/tree.js +202 -15
- package/dist/app/utils/ansi.d.ts +55 -0
- package/dist/app/utils/ansi.js +157 -0
- package/dist/app/utils/diff-rows.d.ts +82 -0
- package/dist/app/utils/diff-rows.js +209 -0
- package/dist/app/utils/fuzzy-path.d.ts +58 -0
- package/dist/app/utils/fuzzy-path.js +202 -0
- package/dist/app/utils/line-range.d.ts +48 -0
- package/dist/app/utils/line-range.js +61 -0
- package/dist/app/utils/log-lines.d.ts +107 -0
- package/dist/app/utils/log-lines.js +170 -0
- package/dist/app/utils/tree-filter.d.ts +19 -0
- package/dist/app/utils/tree-filter.js +26 -0
- package/dist/app/view-options.d.ts +2 -0
- package/dist/app/view-options.js +2 -2
- package/dist/chat/activity.d.ts +72 -0
- package/dist/chat/activity.js +184 -0
- package/dist/chat/composer-submit.d.ts +38 -0
- package/dist/chat/composer-submit.js +44 -0
- package/dist/chat/composer.d.ts +47 -0
- package/dist/chat/composer.js +100 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.js +6 -0
- package/dist/chat/mixins/composer-send.d.ts +32 -0
- package/dist/chat/mixins/composer-send.js +121 -0
- package/dist/chat/mixins/reveal-stream.d.ts +68 -0
- package/dist/chat/mixins/reveal-stream.js +184 -0
- package/dist/chat/mixins/stream-target.d.ts +18 -0
- package/dist/chat/mixins/stream-target.js +38 -0
- package/dist/components/button.js +7 -1
- package/dist/components/character-count.d.ts +44 -0
- package/dist/components/character-count.js +68 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/label-chip.d.ts +42 -0
- package/dist/components/label-chip.js +86 -0
- package/dist/components/property-list.d.ts +9 -2
- package/dist/components/property-list.js +37 -10
- package/dist/components/textarea.js +6 -1
- package/dist/components/timeline.d.ts +62 -5
- package/dist/components/timeline.js +124 -5
- package/dist/docs/code-block.js +8 -31
- package/dist/docs/file-tree.js +3 -48
- package/dist/landing/case-study.d.ts +79 -0
- package/dist/landing/case-study.js +162 -0
- package/dist/landing/contributor-wall.d.ts +72 -0
- package/dist/landing/contributor-wall.js +129 -0
- package/dist/landing/countdown.d.ts +88 -0
- package/dist/landing/countdown.js +91 -0
- package/dist/landing/episode-player.d.ts +87 -0
- package/dist/landing/episode-player.js +113 -0
- package/dist/landing/faq-band.d.ts +3 -2
- package/dist/landing/faq-band.js +4 -3
- package/dist/landing/index.d.ts +7 -0
- package/dist/landing/index.js +7 -0
- package/dist/landing/landing-header.js +15 -4
- package/dist/landing/mixins/countdown-tick.d.ts +29 -0
- package/dist/landing/mixins/countdown-tick.js +65 -0
- package/dist/landing/mixins/usage-estimate-live.d.ts +32 -0
- package/dist/landing/mixins/usage-estimate-live.js +120 -0
- package/dist/landing/phone-frame.d.ts +2 -1
- package/dist/landing/price-list.d.ts +68 -0
- package/dist/landing/price-list.js +125 -0
- package/dist/landing/scroll-scene.d.ts +59 -0
- package/dist/landing/scroll-scene.js +70 -0
- package/dist/landing/sponsor-wall.d.ts +30 -6
- package/dist/landing/sponsor-wall.js +70 -14
- package/dist/landing/typed-terminal.d.ts +24 -6
- package/dist/landing/typed-terminal.js +22 -14
- package/dist/landing/usage-estimate.d.ts +127 -0
- package/dist/landing/usage-estimate.js +164 -0
- package/dist/landing/utils/countdown.d.ts +33 -0
- package/dist/landing/utils/countdown.js +42 -0
- package/dist/landing/utils/pause-toggle.d.ts +2 -1
- package/dist/mixins/character-count.d.ts +62 -0
- package/dist/mixins/character-count.js +139 -0
- package/dist/mixins/index.d.ts +6 -2
- package/dist/mixins/index.js +6 -2
- package/dist/mixins/invoker-fields.d.ts +18 -0
- package/dist/mixins/invoker-fields.js +60 -0
- package/dist/mixins/media-sync.d.ts +58 -0
- package/dist/mixins/media-sync.js +102 -0
- package/dist/mixins/menu-keys.d.ts +11 -0
- package/dist/mixins/menu-keys.js +79 -70
- package/dist/mixins/sortable.d.ts +96 -0
- package/dist/mixins/sortable.js +433 -0
- package/dist/utils/code-lines.d.ts +26 -0
- package/dist/utils/code-lines.js +29 -0
- package/dist/utils/file-icon.d.ts +31 -0
- package/dist/utils/file-icon.js +60 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/write-cookie.d.ts +15 -15
- package/dist/utils/write-cookie.js +10 -16
- package/dist/video/episode-list.d.ts +48 -0
- package/dist/video/episode-list.js +161 -0
- package/dist/video/index.d.ts +15 -0
- package/dist/video/index.js +15 -0
- package/dist/video/mixins/video-player-sync.d.ts +27 -0
- package/dist/video/mixins/video-player-sync.js +413 -0
- 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/utils/timeline.d.ts +55 -0
- package/dist/video/utils/timeline.js +90 -0
- package/dist/video/video-card.d.ts +51 -0
- package/dist/video/video-card.js +135 -0
- package/dist/video/video-player.d.ts +261 -0
- package/dist/video/video-player.js +927 -0
- package/dist/video/video-shelf.d.ts +58 -0
- package/dist/video/video-shelf.js +155 -0
- package/package.json +6 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits highlighted runs into one list of runs per source line, so every component that
|
|
3
|
+
* draws code a line at a time (a docs card, a code viewer, a diff, a log) numbers, marks
|
|
4
|
+
* and anchors lines from the same split, multi-line tokens included.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One painted run of source. Structural, so any highlighter's `{ type, value }` runs pass
|
|
11
|
+
* straight through.
|
|
12
|
+
*/
|
|
13
|
+
export interface CodeToken {
|
|
14
|
+
type: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Splits runs at newlines (`\n` or `\r\n`) so each line owns its runs. A run spanning
|
|
19
|
+
* lines (a block comment, a template literal) becomes one run per line with the same type,
|
|
20
|
+
* and an empty line is an empty list, so the result always has one entry per source line.
|
|
21
|
+
*
|
|
22
|
+
* @param runs Runs covering the source in order, as a highlighter returns them.
|
|
23
|
+
* @returns One array of runs per line; empty pieces are dropped.
|
|
24
|
+
* @example codeLines(tokenize(source, "ts")).map((line, index) => <Line number={index + 1} runs={line} />)
|
|
25
|
+
*/
|
|
26
|
+
export declare function codeLines(runs: readonly CodeToken[]): CodeToken[][];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits highlighted runs into one list of runs per source line, so every component that
|
|
3
|
+
* draws code a line at a time (a docs card, a code viewer, a diff, a log) numbers, marks
|
|
4
|
+
* and anchors lines from the same split, multi-line tokens included.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Splits runs at newlines (`\n` or `\r\n`) so each line owns its runs. A run spanning
|
|
11
|
+
* lines (a block comment, a template literal) becomes one run per line with the same type,
|
|
12
|
+
* and an empty line is an empty list, so the result always has one entry per source line.
|
|
13
|
+
*
|
|
14
|
+
* @param runs Runs covering the source in order, as a highlighter returns them.
|
|
15
|
+
* @returns One array of runs per line; empty pieces are dropped.
|
|
16
|
+
* @example codeLines(tokenize(source, "ts")).map((line, index) => <Line number={index + 1} runs={line} />)
|
|
17
|
+
*/
|
|
18
|
+
export function codeLines(runs) {
|
|
19
|
+
let lines = [[]];
|
|
20
|
+
for (let run of runs) {
|
|
21
|
+
for (let [index, piece] of run.value.split(/\r?\n/).entries()) {
|
|
22
|
+
if (index > 0)
|
|
23
|
+
lines.push([]);
|
|
24
|
+
if (piece.length > 0)
|
|
25
|
+
lines[lines.length - 1]?.push({ type: run.type, value: piece });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return lines;
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picks the `@sdxc/icons` glyph for a file from its name, so every place that draws a file
|
|
3
|
+
* (a docs tree, a code card's header, a repository browser) shows the same kind of file
|
|
4
|
+
* with the same icon.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import { FileIcon } from "@sdxc/icons";
|
|
10
|
+
/** An icon component from `@sdxc/icons`, drawn as `<Glyph size={16} aria-hidden="true" />`. */
|
|
11
|
+
export type FileIconComponent = typeof FileIcon;
|
|
12
|
+
/** Options for {@link fileIcon}. */
|
|
13
|
+
export interface FileIconOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The icon for an extension outside the built-in map, such as `FileCodeIcon` where every
|
|
16
|
+
* titled file is source code.
|
|
17
|
+
*
|
|
18
|
+
* @default FileIcon
|
|
19
|
+
*/
|
|
20
|
+
fallback?: FileIconComponent;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Picks a file's icon from its extension, treating a dotfile's name as its extension
|
|
24
|
+
* (`.env`). A name without an extension draws a plain file.
|
|
25
|
+
*
|
|
26
|
+
* @param name File name or path, such as `app/routes.ts`.
|
|
27
|
+
* @param options The icon for an unrecognised extension.
|
|
28
|
+
* @returns The icon component to render.
|
|
29
|
+
* @example let Glyph = fileIcon("package.json"); <Glyph size={16} aria-hidden="true" />
|
|
30
|
+
*/
|
|
31
|
+
export declare function fileIcon(name: string, options?: FileIconOptions): FileIconComponent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picks the `@sdxc/icons` glyph for a file from its name, so every place that draws a file
|
|
3
|
+
* (a docs tree, a code card's header, a repository browser) shows the same kind of file
|
|
4
|
+
* with the same icon.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import { FileBracesIcon, FileCodeIcon, FileCogIcon, FileIcon, FileImageIcon, FileLockIcon, FileTerminalIcon, FileTextIcon, FileTypeIcon, } from "@sdxc/icons";
|
|
10
|
+
/** Icons for file extensions whose type a reader recognises at a glance. */
|
|
11
|
+
const ICON_BY_EXTENSION = {
|
|
12
|
+
ts: FileCodeIcon,
|
|
13
|
+
tsx: FileCodeIcon,
|
|
14
|
+
js: FileCodeIcon,
|
|
15
|
+
jsx: FileCodeIcon,
|
|
16
|
+
mjs: FileCodeIcon,
|
|
17
|
+
cjs: FileCodeIcon,
|
|
18
|
+
mts: FileCodeIcon,
|
|
19
|
+
cts: FileCodeIcon,
|
|
20
|
+
html: FileCodeIcon,
|
|
21
|
+
sql: FileCodeIcon,
|
|
22
|
+
json: FileBracesIcon,
|
|
23
|
+
jsonc: FileBracesIcon,
|
|
24
|
+
md: FileTextIcon,
|
|
25
|
+
mdx: FileTextIcon,
|
|
26
|
+
txt: FileTextIcon,
|
|
27
|
+
css: FileTypeIcon,
|
|
28
|
+
png: FileImageIcon,
|
|
29
|
+
jpg: FileImageIcon,
|
|
30
|
+
jpeg: FileImageIcon,
|
|
31
|
+
gif: FileImageIcon,
|
|
32
|
+
svg: FileImageIcon,
|
|
33
|
+
webp: FileImageIcon,
|
|
34
|
+
avif: FileImageIcon,
|
|
35
|
+
ico: FileImageIcon,
|
|
36
|
+
sh: FileTerminalIcon,
|
|
37
|
+
toml: FileCogIcon,
|
|
38
|
+
yaml: FileCogIcon,
|
|
39
|
+
yml: FileCogIcon,
|
|
40
|
+
env: FileCogIcon,
|
|
41
|
+
ini: FileCogIcon,
|
|
42
|
+
lock: FileLockIcon,
|
|
43
|
+
lockb: FileLockIcon,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Picks a file's icon from its extension, treating a dotfile's name as its extension
|
|
47
|
+
* (`.env`). A name without an extension draws a plain file.
|
|
48
|
+
*
|
|
49
|
+
* @param name File name or path, such as `app/routes.ts`.
|
|
50
|
+
* @param options The icon for an unrecognised extension.
|
|
51
|
+
* @returns The icon component to render.
|
|
52
|
+
* @example let Glyph = fileIcon("package.json"); <Glyph size={16} aria-hidden="true" />
|
|
53
|
+
*/
|
|
54
|
+
export function fileIcon(name, options = {}) {
|
|
55
|
+
let base = name.slice(name.lastIndexOf("/") + 1);
|
|
56
|
+
let dot = base.lastIndexOf(".");
|
|
57
|
+
if (dot === -1)
|
|
58
|
+
return FileIcon;
|
|
59
|
+
return ICON_BY_EXTENSION[base.slice(dot + 1).toLowerCase()] ?? options.fallback ?? FileIcon;
|
|
60
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
|
+
export * from "./code-lines.js";
|
|
9
10
|
export * from "./color-math.js";
|
|
10
11
|
export * from "./command-event.js";
|
|
11
12
|
export * from "./css-styles.js";
|
|
@@ -14,6 +15,7 @@ export * from "./disabled-selector.js";
|
|
|
14
15
|
export * from "./dispatch-change.js";
|
|
15
16
|
export * from "./eyebrow.js";
|
|
16
17
|
export * from "./field-parts.js";
|
|
18
|
+
export * from "./file-icon.js";
|
|
17
19
|
export * from "./full-turn-radians.js";
|
|
18
20
|
export * from "./geometry.js";
|
|
19
21
|
export * from "./glyph-edges.js";
|
package/dist/utils/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
|
+
export * from "./code-lines.js";
|
|
9
10
|
export * from "./color-math.js";
|
|
10
11
|
export * from "./command-event.js";
|
|
11
12
|
export * from "./css-styles.js";
|
|
@@ -14,6 +15,7 @@ export * from "./disabled-selector.js";
|
|
|
14
15
|
export * from "./dispatch-change.js";
|
|
15
16
|
export * from "./eyebrow.js";
|
|
16
17
|
export * from "./field-parts.js";
|
|
18
|
+
export * from "./file-icon.js";
|
|
17
19
|
export * from "./full-turn-radians.js";
|
|
18
20
|
export * from "./geometry.js";
|
|
19
21
|
export * from "./glyph-edges.js";
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
* persisted state outlives typical browsing gaps.
|
|
15
15
|
*/
|
|
16
16
|
export declare const ONE_YEAR_SECONDS: number;
|
|
17
|
+
/** Options for {@link writeCookie}. */
|
|
18
|
+
export interface WriteCookieOptions {
|
|
19
|
+
/** Seconds the cookie stays valid. @default ONE_YEAR_SECONDS */
|
|
20
|
+
maxAgeSeconds?: number;
|
|
21
|
+
/** The path the browser sends the cookie under, such as one app's own prefix. @default "/" */
|
|
22
|
+
path?: string;
|
|
23
|
+
}
|
|
17
24
|
/**
|
|
18
|
-
* Writes `value` under `name` into a `
|
|
19
|
-
*
|
|
20
|
-
* the same state, ahead of hydration ever running.
|
|
25
|
+
* Writes `value` under `name` into a `samesite=lax` cookie, so the next full navigation's server
|
|
26
|
+
* render can read it back and start already in the same state, ahead of hydration ever running.
|
|
21
27
|
*
|
|
22
28
|
* @param name Cookie name to write the value under.
|
|
23
|
-
* @param value Value to persist
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* writeCookie("app-sidebar:collapsed", true);
|
|
30
|
-
* @example
|
|
31
|
-
* writeCookie("ui:theme", "dark");
|
|
32
|
-
* @example
|
|
33
|
-
* writeCookie("ui:announcement-dismissed", true, 60 * 60 * 24 * 7);
|
|
29
|
+
* @param value Value to persist, interpolated as is, so a boolean persists as `"true"`/`"false"`.
|
|
30
|
+
* @param options How long the cookie lasts and which path it is sent under.
|
|
31
|
+
* @example writeCookie("app-sidebar:collapsed", true);
|
|
32
|
+
* @example writeCookie("ui:announcement-dismissed", true, { maxAgeSeconds: 60 * 60 * 24 * 7 });
|
|
33
|
+
* @example writeCookie("crm-sidebar", false, { path: "/crm" });
|
|
34
34
|
*/
|
|
35
|
-
export declare function writeCookie(name: string, value: string | boolean,
|
|
35
|
+
export declare function writeCookie(name: string, value: string | boolean, options?: WriteCookieOptions): void;
|
|
@@ -15,23 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export const ONE_YEAR_SECONDS = 60 * 60 * 24 * 365;
|
|
17
17
|
/**
|
|
18
|
-
* Writes `value` under `name` into a `
|
|
19
|
-
*
|
|
20
|
-
* the same state, ahead of hydration ever running.
|
|
18
|
+
* Writes `value` under `name` into a `samesite=lax` cookie, so the next full navigation's server
|
|
19
|
+
* render can read it back and start already in the same state, ahead of hydration ever running.
|
|
21
20
|
*
|
|
22
21
|
* @param name Cookie name to write the value under.
|
|
23
|
-
* @param value Value to persist
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* writeCookie("app-sidebar:collapsed", true);
|
|
30
|
-
* @example
|
|
31
|
-
* writeCookie("ui:theme", "dark");
|
|
32
|
-
* @example
|
|
33
|
-
* writeCookie("ui:announcement-dismissed", true, 60 * 60 * 24 * 7);
|
|
22
|
+
* @param value Value to persist, interpolated as is, so a boolean persists as `"true"`/`"false"`.
|
|
23
|
+
* @param options How long the cookie lasts and which path it is sent under.
|
|
24
|
+
* @example writeCookie("app-sidebar:collapsed", true);
|
|
25
|
+
* @example writeCookie("ui:announcement-dismissed", true, { maxAgeSeconds: 60 * 60 * 24 * 7 });
|
|
26
|
+
* @example writeCookie("crm-sidebar", false, { path: "/crm" });
|
|
34
27
|
*/
|
|
35
|
-
export function writeCookie(name, value,
|
|
36
|
-
|
|
28
|
+
export function writeCookie(name, value, options = {}) {
|
|
29
|
+
let { maxAgeSeconds = ONE_YEAR_SECONDS, path = "/" } = options;
|
|
30
|
+
document.cookie = `${name}=${value}; path=${path}; max-age=${maxAgeSeconds}; samesite=lax`;
|
|
37
31
|
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
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
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./mixins/video-player-sync.js";
|
|
10
|
+
export * from "./utils/timeline.js";
|
|
11
|
+
export * from "./episode-list.js";
|
|
12
|
+
export * from "./title-hero.js";
|
|
13
|
+
export * from "./video-card.js";
|
|
14
|
+
export * from "./video-player.js";
|
|
15
|
+
export * from "./video-shelf.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
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
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./mixins/video-player-sync.js";
|
|
10
|
+
export * from "./utils/timeline.js";
|
|
11
|
+
export * from "./episode-list.js";
|
|
12
|
+
export * from "./title-hero.js";
|
|
13
|
+
export * from "./video-card.js";
|
|
14
|
+
export * from "./video-player.js";
|
|
15
|
+
export * from "./video-shelf.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: seeking in place, marking what plays, and a custom control bar all need the media
|
|
3
|
+
* element's API. No-JS baseline: every time is a `#t=` link into the file, and the video
|
|
4
|
+
* keeps the browser's own controls; this mixin swaps them for the bar when it runs.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { ElementProps, MixinFactory } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Brings a player's marks to `time`: the chapter link and transcript line playing then
|
|
12
|
+
* carry `aria-current`, each scrubber segment fills to its played share, and a newly
|
|
13
|
+
* current line scrolls into view inside the transcript alone.
|
|
14
|
+
*
|
|
15
|
+
* @param root The player's `<figure>`.
|
|
16
|
+
* @param time The video's current time in seconds.
|
|
17
|
+
*/
|
|
18
|
+
export declare function syncVideo(root: HTMLElement, time: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Keeps a video player's links, marks, bar and video in step from a node inside its
|
|
21
|
+
* `[data-slot="video-player"]` root. A plain click on a time link seeks and plays; a
|
|
22
|
+
* modified click still opens the file itself.
|
|
23
|
+
*
|
|
24
|
+
* @returns A mixin descriptor for any element inside the player.
|
|
25
|
+
* @example <span hidden mix={[videoPlayerSync()]} />
|
|
26
|
+
*/
|
|
27
|
+
export declare const videoPlayerSync: MixinFactory<HTMLElement, [], ElementProps>;
|