@sdxc/ui 2026.11.11 → 2026.11.14
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 +89 -44
- 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 +19 -0
- package/dist/app/index.js +19 -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 +333 -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/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/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 +11 -6
- 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/index.d.ts +11 -0
- package/dist/video/index.js +11 -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/utils/timeline.d.ts +55 -0
- package/dist/video/utils/timeline.js +90 -0
- package/dist/video/video-player.d.ts +261 -0
- package/dist/video/video-player.js +927 -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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/video`: a video player and its parts, from the screen and the
|
|
3
|
+
* chapter list to the control bar and its settings menu, with the helpers only they use.
|
|
4
|
+
* The player 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 "./video-player.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/video`: a video player and its parts, from the screen and the
|
|
3
|
+
* chapter list to the control bar and its settings menu, with the helpers only they use.
|
|
4
|
+
* The player 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 "./video-player.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>;
|