@brett_lamy/ui 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/components/adaptive-pane.d.ts +12 -1
  2. package/dist/components/adaptive-pane.d.ts.map +1 -1
  3. package/dist/components/adaptive-pane.js +122 -19
  4. package/dist/components/avatar.d.ts +47 -5
  5. package/dist/components/avatar.d.ts.map +1 -1
  6. package/dist/components/avatar.js +101 -14
  7. package/dist/components/breadcrumb.d.ts +87 -0
  8. package/dist/components/breadcrumb.d.ts.map +1 -0
  9. package/dist/components/breadcrumb.js +312 -0
  10. package/dist/components/color-picker.js +15 -15
  11. package/dist/components/command-menu.js +13 -13
  12. package/dist/components/credenza.d.ts +5 -2
  13. package/dist/components/credenza.d.ts.map +1 -1
  14. package/dist/components/credenza.js +62 -60
  15. package/dist/components/date-picker.js +9 -9
  16. package/dist/components/edge-drawer.d.ts +7 -2
  17. package/dist/components/edge-drawer.d.ts.map +1 -1
  18. package/dist/components/edge-drawer.js +7 -4
  19. package/dist/components/filmstrip.d.ts +19 -0
  20. package/dist/components/filmstrip.d.ts.map +1 -0
  21. package/dist/components/filmstrip.js +59 -0
  22. package/dist/components/filter-input.js +4 -4
  23. package/dist/components/filter.js +62 -62
  24. package/dist/components/font-picker.d.ts +67 -0
  25. package/dist/components/font-picker.d.ts.map +1 -0
  26. package/dist/components/font-picker.js +373 -0
  27. package/dist/components/markdown-editor.d.ts +11 -0
  28. package/dist/components/markdown-editor.d.ts.map +1 -1
  29. package/dist/components/markdown-editor.js +72 -65
  30. package/dist/components/navigation-stack.d.ts.map +1 -1
  31. package/dist/components/navigation-stack.js +75 -65
  32. package/dist/components/number-morph.d.ts.map +1 -1
  33. package/dist/components/number-morph.js +5 -5
  34. package/dist/components/replay-preview.d.ts +2 -2
  35. package/dist/components/replay-preview.d.ts.map +1 -1
  36. package/dist/components/replay-preview.js +3 -3
  37. package/dist/components/result-table.js +10 -10
  38. package/dist/components/schema-tree.d.ts.map +1 -1
  39. package/dist/components/schema-tree.js +62 -131
  40. package/dist/components/segmented.d.ts +1 -1
  41. package/dist/components/segmented.d.ts.map +1 -1
  42. package/dist/components/segmented.js +1 -1
  43. package/dist/components/sidebar.d.ts.map +1 -1
  44. package/dist/components/sidebar.js +8 -4
  45. package/dist/components/split-view.d.ts +3 -1
  46. package/dist/components/split-view.d.ts.map +1 -1
  47. package/dist/components/split-view.js +211 -211
  48. package/dist/components/spreadsheet.d.ts +58 -0
  49. package/dist/components/spreadsheet.d.ts.map +1 -0
  50. package/dist/components/spreadsheet.js +804 -0
  51. package/dist/components/sql-console.d.ts.map +1 -1
  52. package/dist/components/sql-console.js +2 -1
  53. package/dist/components/sql-editor.js +8 -8
  54. package/dist/components/stl-viewer.d.ts +3 -0
  55. package/dist/components/stl-viewer.d.ts.map +1 -0
  56. package/dist/components/stl-viewer.js +2 -0
  57. package/dist/components/strudel-player.d.ts +3 -0
  58. package/dist/components/strudel-player.d.ts.map +1 -0
  59. package/dist/components/strudel-player.js +2 -0
  60. package/dist/components/strudel-rack.d.ts +3 -0
  61. package/dist/components/strudel-rack.d.ts.map +1 -0
  62. package/dist/components/strudel-rack.js +2 -0
  63. package/dist/components/strudel-syntax.d.ts +3 -0
  64. package/dist/components/strudel-syntax.d.ts.map +1 -0
  65. package/dist/components/strudel-syntax.js +2 -0
  66. package/dist/components/tabs.js +3 -3
  67. package/dist/components/tailscale-menu.d.ts +69 -0
  68. package/dist/components/tailscale-menu.d.ts.map +1 -0
  69. package/dist/components/tailscale-menu.js +202 -0
  70. package/dist/components/toggle-group.js +3 -3
  71. package/dist/components/tree.d.ts +82 -0
  72. package/dist/components/tree.d.ts.map +1 -0
  73. package/dist/components/tree.js +494 -0
  74. package/dist/components/video-preview.d.ts +46 -0
  75. package/dist/components/video-preview.d.ts.map +1 -0
  76. package/dist/components/video-preview.js +197 -0
  77. package/dist/components/video-timeline.d.ts +64 -0
  78. package/dist/components/video-timeline.d.ts.map +1 -0
  79. package/dist/components/video-timeline.js +479 -0
  80. package/dist/components/waveform.d.ts +23 -0
  81. package/dist/components/waveform.d.ts.map +1 -0
  82. package/dist/components/waveform.js +56 -0
  83. package/dist/ffmpeg-worker.js +118 -0
  84. package/dist/index.css +1 -1
  85. package/dist/index.d.ts +48 -4
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +145 -121
  88. package/dist/lib/csv.d.ts +28 -0
  89. package/dist/lib/csv.d.ts.map +1 -0
  90. package/dist/lib/csv.js +90 -0
  91. package/dist/lib/drawer-swipe.d.ts +31 -0
  92. package/dist/lib/drawer-swipe.d.ts.map +1 -0
  93. package/dist/lib/drawer-swipe.js +68 -0
  94. package/dist/lib/ffmpeg/index.d.ts +117 -0
  95. package/dist/lib/ffmpeg/index.d.ts.map +1 -0
  96. package/dist/lib/ffmpeg/index.js +204 -0
  97. package/dist/lib/ffmpeg/media.d.ts +39 -0
  98. package/dist/lib/ffmpeg/media.d.ts.map +1 -0
  99. package/dist/lib/ffmpeg/media.js +100 -0
  100. package/dist/lib/ffmpeg/react.d.ts +51 -0
  101. package/dist/lib/ffmpeg/react.d.ts.map +1 -0
  102. package/dist/lib/ffmpeg/react.js +113 -0
  103. package/dist/lib/google-fonts.d.ts +47 -0
  104. package/dist/lib/google-fonts.d.ts.map +1 -0
  105. package/dist/lib/google-fonts.generated.d.ts +2 -0
  106. package/dist/lib/google-fonts.generated.d.ts.map +1 -0
  107. package/dist/lib/google-fonts.generated.js +1925 -0
  108. package/dist/lib/google-fonts.js +112 -0
  109. package/dist/lib/icon.d.ts +6 -1
  110. package/dist/lib/icon.d.ts.map +1 -1
  111. package/dist/lib/icon.js +2 -0
  112. package/dist/lib/playback.d.ts +34 -0
  113. package/dist/lib/playback.d.ts.map +1 -0
  114. package/dist/lib/playback.js +79 -0
  115. package/dist/lib/spreadsheet-gpu.d.ts +9 -0
  116. package/dist/lib/spreadsheet-gpu.d.ts.map +1 -0
  117. package/dist/lib/spreadsheet-gpu.js +237 -0
  118. package/dist/lib/spreadsheet.d.ts +82 -0
  119. package/dist/lib/spreadsheet.d.ts.map +1 -0
  120. package/dist/lib/spreadsheet.js +162 -0
  121. package/dist/lib/syntax.d.ts +2 -6
  122. package/dist/lib/syntax.d.ts.map +1 -1
  123. package/dist/lib/syntax.js +53 -75
  124. package/dist/lib/tailscale-connect.d.ts +33 -0
  125. package/dist/lib/tailscale-connect.d.ts.map +1 -1
  126. package/dist/lib/tailscale-connect.js +221 -42
  127. package/dist/lib/tailscale-exit.d.ts +19 -0
  128. package/dist/lib/tailscale-exit.d.ts.map +1 -0
  129. package/dist/lib/tailscale-exit.js +14 -0
  130. package/dist/lib/tailscale-fake.d.ts +8 -0
  131. package/dist/lib/tailscale-fake.d.ts.map +1 -1
  132. package/dist/lib/tailscale-fake.js +51 -26
  133. package/dist/lib/tailscale-roots.d.ts +3 -0
  134. package/dist/lib/tailscale-roots.d.ts.map +1 -0
  135. package/dist/lib/tailscale-roots.js +4 -0
  136. package/dist/lib/tailscale.d.ts +23 -0
  137. package/dist/lib/tailscale.d.ts.map +1 -1
  138. package/dist/lib/tailscale.js +156 -94
  139. package/dist/lib/title-flight.d.ts +4 -0
  140. package/dist/lib/title-flight.d.ts.map +1 -1
  141. package/dist/lib/title-flight.js +15 -12
  142. package/dist/lib/tokens.generated.d.ts +2 -2
  143. package/dist/lib/tokens.generated.d.ts.map +1 -1
  144. package/dist/lib/tokens.generated.js +2 -2
  145. package/dist/lib/video-render.d.ts +38 -0
  146. package/dist/lib/video-render.d.ts.map +1 -0
  147. package/dist/lib/video-render.js +147 -0
  148. package/dist/lib/video-timeline.d.ts +154 -0
  149. package/dist/lib/video-timeline.d.ts.map +1 -0
  150. package/dist/lib/video-timeline.js +265 -0
  151. package/dist/lib/webgpu.d.ts +26 -0
  152. package/dist/lib/webgpu.d.ts.map +1 -0
  153. package/dist/lib/webgpu.js +28 -0
  154. package/dist/theme.css +3 -0
  155. package/package.json +8 -3
@@ -0,0 +1,147 @@
1
+ import { mediaFileName as e } from "./ffmpeg/index.js";
2
+ import { clipDuration as t, lookFfmpeg as n, timelineDuration as r } from "./video-timeline.js";
3
+ //#region src/lib/video-render.ts
4
+ var i = {
5
+ mp4: "video/mp4",
6
+ webm: "video/webm",
7
+ gif: "image/gif",
8
+ mp3: "audio/mpeg",
9
+ wav: "audio/wav"
10
+ }, a = (e) => String(Math.round(e * 1e3) / 1e3), o = (e) => Math.max(2, Math.round(e / 2) * 2);
11
+ function s(e) {
12
+ if (!(e > 0) || !Number.isFinite(e)) return [];
13
+ let t = [], n = e;
14
+ for (; n < .5;) t.push("atempo=0.5"), n /= .5;
15
+ for (; n > 100;) t.push("atempo=100"), n /= 100;
16
+ return Math.abs(n - 1) > 1e-6 && t.push(`atempo=${a(n)}`), t;
17
+ }
18
+ function c(c, l, u, d = {}) {
19
+ let f = d.container ?? "mp4", p = d.quality ?? "medium", m = o(u.width), h = o(u.height), g = u.fps > 0 ? u.fps : 30, _ = r(c);
20
+ if (!(_ > 0)) throw RangeError("The timeline is empty.");
21
+ let v = f !== "mp3" && f !== "wav", y = f !== "gif", b = (d.background ?? "black").replace(/[^A-Za-z0-9#@.]/g, "") || "black", x = {}, S = /* @__PURE__ */ new Map(), C = (t, n) => {
22
+ let r = S.get(t);
23
+ if (!r) {
24
+ let i = /\.([a-z0-9]+)$/.exec(e(n.file))?.[1];
25
+ r = `m${S.size}${i ? `.${i}` : ""}`, S.set(t, r), x[r] = n.file;
26
+ }
27
+ return r;
28
+ }, w = [], T = [
29
+ "-hide_banner",
30
+ "-loglevel",
31
+ "error"
32
+ ];
33
+ for (let e of [...c.tracks].reverse()) e.clips.forEach((t, n) => {
34
+ let r = l[t.media];
35
+ if (!r) return;
36
+ let i = v && e.kind === "video" && !e.hidden && r.kind !== "audio", a = y && r.hasAudio && r.kind !== "image" && !e.muted && !t.muted && (t.volume ?? 1) > 0;
37
+ if (!i && !a) return;
38
+ let o = e.magnetic ? e.clips[n + 1] : void 0;
39
+ w.push({
40
+ clip: t,
41
+ m: r,
42
+ input: w.length,
43
+ picture: i,
44
+ sound: a,
45
+ fadeIn: Math.max(t.fadeIn ?? 0, e.magnetic ? t.transition ?? 0 : 0),
46
+ fadeOut: t.fadeOut ?? 0,
47
+ audioOut: Math.max(t.fadeOut ?? 0, o?.transition ?? 0)
48
+ });
49
+ });
50
+ if (f === "gif" && !w.some((e) => e.picture)) throw RangeError("Nothing on the timeline has a picture.");
51
+ if (!v && !w.some((e) => e.sound)) throw RangeError("Nothing on the timeline makes a sound.");
52
+ let E = w.length > 4 ? "1" : "2";
53
+ for (let e of w) {
54
+ let n = C(e.clip.media, e.m);
55
+ e.m.kind === "image" ? T.push("-loop", "1", "-framerate", a(g), "-t", a(t(e.clip)), "-i", n) : T.push("-threads", E, "-ss", a(e.clip.in), "-t", a(e.clip.out - e.clip.in), "-i", n);
56
+ }
57
+ let D = [], O = null;
58
+ if (v) {
59
+ D.push(`color=c=${b}:s=${m}x${h}:r=${a(g)}:d=${a(_)},format=yuv420p[bg]`);
60
+ let e = "bg";
61
+ if (w.filter((e) => e.picture).forEach((r, i) => {
62
+ let s = r.clip, c = t(s), l = s.frame ?? {
63
+ x: 0,
64
+ y: 0,
65
+ width: 1,
66
+ height: 1
67
+ }, u = o(l.width * m), d = o(l.height * h), f = s.speed || 1, p = ["setpts=PTS-STARTPTS"];
68
+ r.m.kind !== "image" && f !== 1 && p.push(`setpts=PTS/${a(f)}`), p.push("format=yuva420p"), s.fit === "cover" ? p.push(`scale=${u}:${d}:force_original_aspect_ratio=increase`, `crop=${u}:${d}`) : p.push(`scale=${u}:${d}:force_original_aspect_ratio=decrease:force_divisible_by=2`, `pad=${u}:${d}:(ow-iw)/2:(oh-ih)/2:color=black@0`), p.push("setsar=1", `fps=${a(g)}`);
69
+ let _ = n(s.look);
70
+ _ && p.push(_, "format=yuva420p"), r.fadeIn > 0 && p.push(`fade=t=in:st=0:d=${a(Math.min(r.fadeIn, c))}:alpha=1`), r.fadeOut > 0 && p.push(`fade=t=out:st=${a(Math.max(0, c - r.fadeOut))}:d=${a(Math.min(r.fadeOut, c))}:alpha=1`), p.push(`setpts=PTS+${a(s.start)}/TB`), D.push(`[${r.input}:v]${p.join(",")}[v${i}]`), D.push(`[${e}][v${i}]overlay=x=${Math.round(l.x * m)}:y=${Math.round(l.y * h)}:eof_action=pass[o${i}]`), e = `o${i}`;
71
+ }), f === "gif") {
72
+ let t = o(Math.min(m, 480));
73
+ D.push(`[${e}]fps=${a(Math.min(g, 15))},scale=${t}:-2:flags=lanczos,split[g1][g2]`), D.push("[g1]palettegen=stats_mode=diff[pal]", "[g2][pal]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle[vout]");
74
+ } else D.push(`[${e}]format=yuv420p[vout]`);
75
+ O = "[vout]";
76
+ }
77
+ let k = null, A = w.filter((e) => e.sound);
78
+ if (y && A.length) {
79
+ A.forEach((e, n) => {
80
+ let r = e.clip, i = t(r), o = [
81
+ "asetpts=PTS-STARTPTS",
82
+ ...s(r.speed || 1),
83
+ "aresample=48000",
84
+ "aformat=sample_fmts=fltp:channel_layouts=stereo"
85
+ ], c = r.volume ?? 1;
86
+ c !== 1 && o.push(`volume=${a(c)}`), e.fadeIn > 0 && o.push(`afade=t=in:st=0:d=${a(Math.min(e.fadeIn, i))}`), e.audioOut > 0 && o.push(`afade=t=out:st=${a(Math.max(0, i - e.audioOut))}:d=${a(Math.min(e.audioOut, i))}`), r.start > 0 && o.push(`adelay=delays=${Math.round(r.start * 1e3)}:all=1`), D.push(`[${e.input}:a]${o.join(",")}[a${n}]`);
87
+ });
88
+ let e = A.length > 1 ? `${A.map((e, t) => `[a${t}]`).join("")}amix=inputs=${A.length}:duration=longest:dropout_transition=0:normalize=0,` : "[a0]";
89
+ D.push(`${e}apad,atrim=end=${a(_)}[aout]`), k = "[aout]";
90
+ }
91
+ let j = `render.${f}`;
92
+ T.push("-filter_complex", D.join(";"), "-filter_complex_threads", "2"), O && T.push("-map", O), k && T.push("-map", k);
93
+ let M = m * h * g;
94
+ switch (f) {
95
+ case "mp4":
96
+ T.push("-c:v", "mpeg4", "-q:v", {
97
+ high: "2",
98
+ medium: "4",
99
+ low: "7"
100
+ }[p], "-pix_fmt", "yuv420p"), k && T.push("-c:a", "aac", "-b:a", p === "low" ? "96k" : "160k"), T.push("-movflags", "+faststart");
101
+ break;
102
+ case "webm": {
103
+ let e = {
104
+ high: .12,
105
+ medium: .07,
106
+ low: .035
107
+ }[p];
108
+ T.push("-c:v", "libvpx", "-deadline", "realtime", "-cpu-used", p === "high" ? "8" : "16", "-b:v", `${Math.round(M * e / 1e3)}k`, "-crf", {
109
+ high: "8",
110
+ medium: "16",
111
+ low: "28"
112
+ }[p], "-auto-alt-ref", "0"), k && T.push("-c:a", "opus", "-strict", "experimental", "-b:a", p === "low" ? "64k" : "128k");
113
+ break;
114
+ }
115
+ case "gif":
116
+ T.push("-loop", "0");
117
+ break;
118
+ case "mp3":
119
+ T.push("-c:a", "libmp3lame", "-b:a", {
120
+ high: "256k",
121
+ medium: "192k",
122
+ low: "128k"
123
+ }[p]);
124
+ break;
125
+ case "wav": T.push("-c:a", "pcm_s16le");
126
+ }
127
+ return T.push("-threads", "2", j), {
128
+ args: T,
129
+ inputs: x,
130
+ output: j,
131
+ mime: i[f],
132
+ duration: _
133
+ };
134
+ }
135
+ async function l(e, t, n, r, i = {}) {
136
+ let a = c(t, n, r, i), { files: o } = await e.run({
137
+ args: a.args,
138
+ inputs: a.inputs,
139
+ duration: a.duration,
140
+ onProgress: i.onProgress,
141
+ onLog: i.onLog,
142
+ signal: i.signal
143
+ });
144
+ return new Blob([o[a.output]], { type: a.mime });
145
+ }
146
+ //#endregion
147
+ export { c as buildRender, i as renderMime, l as renderTimeline };
@@ -0,0 +1,154 @@
1
+ /** A rectangle in the frame, as fractions of its width and height. */
2
+ export interface ClipFrame {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface TimelineClip {
9
+ id: string;
10
+ /** The media it plays: a key the app resolves (to a File for a render, a URL for the preview). */
11
+ media: string;
12
+ /** Where it starts on the timeline, seconds (derived on a magnetic track). */
13
+ start: number;
14
+ /** The part of the media it plays: source in and out points, seconds. */
15
+ in: number;
16
+ out: number;
17
+ /** Playback rate: 2 plays twice as fast, so the clip lasts (out - in) / 2. Default 1. */
18
+ speed?: number;
19
+ /** Gain, 0…2. Default 1. */
20
+ volume?: number;
21
+ /** Silences this clip's audio. */
22
+ muted?: boolean;
23
+ /** Seconds of fade in from, and out to, nothing (black or the tracks below; silence). */
24
+ fadeIn?: number;
25
+ fadeOut?: number;
26
+ /** Magnetic tracks: seconds this clip dissolves in over the one before (it starts that much earlier). */
27
+ transition?: number;
28
+ /** Where the picture sits in the frame (picture in picture). Default: the whole frame. */
29
+ frame?: ClipFrame;
30
+ /** Letterbox the picture into its frame (`contain`, the default) or fill it and crop (`cover`). */
31
+ fit?: 'contain' | 'cover';
32
+ /** A colour look (see `timelineLooks`). */
33
+ look?: TimelineLook;
34
+ /** A name to show instead of the media's. */
35
+ label?: string;
36
+ /** Whatever the app keeps with the clip (a title's text, a tint, …). */
37
+ data?: Record<string, unknown>;
38
+ }
39
+ export type TrackKind = 'video' | 'audio';
40
+ export interface TimelineTrack {
41
+ id: string;
42
+ kind: TrackKind;
43
+ name?: string;
44
+ clips: TimelineClip[];
45
+ /** The main storyline: clips butt end to end and edits ripple. */
46
+ magnetic?: boolean;
47
+ /** No audio from this track. */
48
+ muted?: boolean;
49
+ /** No picture from this track. */
50
+ hidden?: boolean;
51
+ /** No edits on this track. */
52
+ locked?: boolean;
53
+ }
54
+ export interface Timeline {
55
+ /** Top to bottom: the first video track draws over the rest. */
56
+ tracks: TimelineTrack[];
57
+ }
58
+ /** Output geometry and frame rate. */
59
+ export interface TimelineFormat {
60
+ width: number;
61
+ height: number;
62
+ fps: number;
63
+ }
64
+ export type TimelineLook = 'none' | 'mono' | 'noir' | 'sepia' | 'vintage' | 'vivid' | 'fade';
65
+ /** The looks a clip can take, with their names. */
66
+ export declare const timelineLooks: {
67
+ id: TimelineLook;
68
+ label: string;
69
+ }[];
70
+ /** A look as a CSS `filter` value (for the preview), or '' for none. */
71
+ export declare function lookCss(look: TimelineLook | undefined): string;
72
+ /** A look as FFmpeg filters (for a render), applied in the CSS filter's order, or '' for none. */
73
+ export declare function lookFfmpeg(look: TimelineLook | undefined): string;
74
+ /** Seconds a clip lasts on the timeline. */
75
+ export declare const clipDuration: (c: TimelineClip) => number;
76
+ /** Where a clip ends on the timeline. */
77
+ export declare const clipEnd: (c: TimelineClip) => number;
78
+ /** The media time showing at timeline time `t` in a clip. */
79
+ export declare const sourceTime: (c: TimelineClip, t: number) => number;
80
+ /** Where a track's last clip ends. */
81
+ export declare const trackDuration: (t: TimelineTrack) => number;
82
+ /** Where the timeline's last clip ends. */
83
+ export declare const timelineDuration: (tl: Timeline) => number;
84
+ /** `t` on the frame grid. */
85
+ export declare const quantize: (t: number, fps: number) => number;
86
+ /** The clips playing at `t`, per track (a free track may have several), top track first. */
87
+ export declare function clipsAt(tl: Timeline, t: number): {
88
+ track: TimelineTrack;
89
+ clip: TimelineClip;
90
+ }[];
91
+ /** A clip, its track and where they are. */
92
+ export declare function findClip(tl: Timeline, id: string): {
93
+ track: TimelineTrack;
94
+ trackIndex: number;
95
+ clip: TimelineClip;
96
+ index: number;
97
+ } | null;
98
+ /** A unique id (`clip-1a2b3c`). */
99
+ export declare function timelineId(prefix?: string): string;
100
+ /** A track with its clips in place: a magnetic one end to end from 0, any other sorted by start. On a magnetic track a
101
+ * transition overlaps the clip before it, by no more than this clip lasts nor more than the clip before has left
102
+ * after its own dissolve: never three clips at once. */
103
+ export declare function layoutTrack(track: TimelineTrack): TimelineTrack;
104
+ /** Changes a clip (the track re-lays out). */
105
+ export declare function updateClip(tl: Timeline, id: string, patch: Partial<Omit<TimelineClip, 'id'>>): Timeline;
106
+ /** Changes a track. */
107
+ export declare function updateTrack(tl: Timeline, id: string, patch: Partial<Omit<TimelineTrack, 'id' | 'clips'>>): Timeline;
108
+ /** Removes clips; on a magnetic track the rest close up. */
109
+ export declare function removeClips(tl: Timeline, ids: readonly string[]): Timeline;
110
+ /** Cuts a clip in two at timeline time `at` (the second half gets `newId`). Nothing happens unless `at` is inside it,
111
+ * nor inside a dissolve on a magnetic track (the stretch where two clips overlap): a cut there would move the edit. */
112
+ export declare function splitClip(tl: Timeline, id: string, at: number, newId?: string): Timeline;
113
+ export interface TrimLimits {
114
+ /** The media's length: the latest `out` (Infinity for a still). */
115
+ mediaDuration?: number;
116
+ /** The shortest a clip may get, seconds. Default 0.1. */
117
+ minDuration?: number;
118
+ }
119
+ /** Moves one edge of a clip to timeline time `at`. The start edge changes `in` (on a free track the clip's start moves
120
+ * with it and its end stays); the end edge changes `out`. On a magnetic track the clips after it ripple. */
121
+ export declare function trimClip(tl: Timeline, id: string, edge: 'start' | 'end', at: number, limits?: TrimLimits): Timeline;
122
+ export interface PlaceOptions {
123
+ /** The track to put it on (default: where it is). */
124
+ trackId?: string;
125
+ /** Free tracks: where it starts. */
126
+ start?: number;
127
+ /** Magnetic tracks: its position among the clips (default: by `start`, else at the end). */
128
+ index?: number;
129
+ }
130
+ /** Where a clip lands among a magnetic track's clips when dropped at time `t`: before the first clip whose middle is later. */
131
+ export declare function magneticIndex(track: TimelineTrack, t: number, excludeId?: string): number;
132
+ /** Puts a new clip on a track. */
133
+ export declare function insertClip(tl: Timeline, trackId: string, clip: TimelineClip, place?: Omit<PlaceOptions, 'trackId'>): Timeline;
134
+ /** Moves a clip along its track, to another position among magnetic clips, or to another track. */
135
+ export declare function moveClip(tl: Timeline, id: string, place: PlaceOptions): Timeline;
136
+ /** The part of a timeline between `from` and `to`, moved to start at 0: clips cut at the edges, the rest dropped
137
+ * (for rendering a range). Magnetic tracks stay magnetic. */
138
+ export declare function sliceTimeline(tl: Timeline, from: number, to: number): Timeline;
139
+ /** Every clip edge, 0 and any extra times, for snapping (minus the clips being dragged). */
140
+ export declare function snapTargets(tl: Timeline, { exclude, extra }?: {
141
+ exclude?: readonly string[];
142
+ extra?: readonly number[];
143
+ }): number[];
144
+ /** The target nearest `t` within `threshold` seconds, else `t`. */
145
+ export declare function snapTime(t: number, targets: readonly number[], threshold: number): {
146
+ time: number;
147
+ snapped: boolean;
148
+ };
149
+ /** `1:02.5` (minutes, seconds and tenths), or with `fps`, SMPTE-style `00:01:02:15` (hours:minutes:seconds:frames). */
150
+ export declare function formatTimecode(t: number, fps?: number): string;
151
+ /** Reads `1:02.5`, `62.5`, `00:01:02:15` (with `fps`) or `1:02:03` back into seconds, as `formatTimecode` writes
152
+ * them (a leading `-` included); NaN when it can't. */
153
+ export declare function parseTimecode(text: string, fps?: number): number;
154
+ //# sourceMappingURL=video-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-timeline.d.ts","sourceRoot":"","sources":["../../src/lib/video-timeline.ts"],"names":[],"mappings":"AAUA,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,kGAAkG;IAClG,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yGAAyG;IACzG,UAAU,CAAC,EAAE,MAAM,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mGAAmG;AACnG,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,QAAQ,CAiBhF;AAED;8DAC8D;AAC9D,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,CAgB9E;AAID,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAY,EAAE,KAAU,EAAE,GAAE;IAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,EAAE,CAKjJ;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAOrH;AAID,uHAAuH;AACvH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAa9D;AAED;wDACwD;AACxD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAahE"}
@@ -0,0 +1,265 @@
1
+ //#region src/lib/video-timeline.ts
2
+ var e = {
3
+ mono: {
4
+ label: "Mono",
5
+ p: { saturate: 0 }
6
+ },
7
+ noir: {
8
+ label: "Noir",
9
+ p: {
10
+ saturate: 0,
11
+ contrast: 1.35,
12
+ brightness: .95
13
+ }
14
+ },
15
+ sepia: {
16
+ label: "Sepia",
17
+ p: { sepia: 1 }
18
+ },
19
+ vintage: {
20
+ label: "Vintage",
21
+ p: {
22
+ sepia: .4,
23
+ saturate: .85,
24
+ contrast: 1.08,
25
+ brightness: 1.05
26
+ }
27
+ },
28
+ vivid: {
29
+ label: "Vivid",
30
+ p: {
31
+ saturate: 1.6,
32
+ contrast: 1.1
33
+ }
34
+ },
35
+ fade: {
36
+ label: "Faded",
37
+ p: {
38
+ saturate: .7,
39
+ contrast: .85,
40
+ brightness: 1.1
41
+ }
42
+ }
43
+ }, t = [
44
+ .393,
45
+ .769,
46
+ .189,
47
+ .349,
48
+ .686,
49
+ .168,
50
+ .272,
51
+ .534,
52
+ .131
53
+ ], n = (e) => String(Math.round(e * 1e3) / 1e3), r = [{
54
+ id: "none",
55
+ label: "None"
56
+ }, ...Object.entries(e).map(([e, t]) => ({
57
+ id: e,
58
+ label: t.label
59
+ }))];
60
+ function i(t) {
61
+ let n = t && t !== "none" ? e[t]?.p : void 0;
62
+ return n ? [
63
+ n.sepia != null && `sepia(${n.sepia})`,
64
+ n.saturate != null && `saturate(${n.saturate})`,
65
+ n.contrast != null && `contrast(${n.contrast})`,
66
+ n.brightness != null && `brightness(${n.brightness})`
67
+ ].filter(Boolean).join(" ") : "";
68
+ }
69
+ function a(r) {
70
+ let i = r && r !== "none" ? e[r]?.p : void 0;
71
+ if (!i) return "";
72
+ let a = [];
73
+ if (i.sepia) {
74
+ let e = i.sepia, r = t.map((t, n) => (1 - e) * (n % 4 == 0) + e * t);
75
+ a.push(`colorchannelmixer=rr=${n(r[0])}:rg=${n(r[1])}:rb=${n(r[2])}:gr=${n(r[3])}:gg=${n(r[4])}:gb=${n(r[5])}:br=${n(r[6])}:bg=${n(r[7])}:bb=${n(r[8])}`);
76
+ }
77
+ if (i.saturate != null && a.push(`hue=s=${n(i.saturate)}`), i.contrast != null && i.contrast !== 1) {
78
+ let e = i.contrast, t = e > 1 ? `0/0 ${n(.5 - .5 / e)}/0 ${n(.5 + .5 / e)}/1 1/1` : `0/${n(.5 - .5 * e)} 1/${n(.5 + .5 * e)}`;
79
+ a.push(`curves=all='${t}':interp=pchip`);
80
+ }
81
+ return i.brightness != null && i.brightness !== 1 && a.push(`colorchannelmixer=rr=${n(i.brightness)}:gg=${n(i.brightness)}:bb=${n(i.brightness)}`), a.join(",");
82
+ }
83
+ var o = (e) => Math.max(0, (e.out - e.in) / (e.speed || 1)), s = (e) => e.start + o(e), c = (e, t) => e.in + (t - e.start) * (e.speed || 1), l = (e) => e.clips.reduce((e, t) => Math.max(e, s(t)), 0), u = (e) => e.tracks.reduce((e, t) => Math.max(e, l(t)), 0), d = (e, t) => t > 0 ? Math.round(e * t) / t : e;
84
+ function f(e, t) {
85
+ return e.tracks.flatMap((e) => e.clips.filter((e) => e.start <= t && t < s(e)).map((t) => ({
86
+ track: e,
87
+ clip: t
88
+ })));
89
+ }
90
+ function p(e, t) {
91
+ for (let n = 0; n < e.tracks.length; n++) {
92
+ let r = e.tracks[n], i = r.clips.findIndex((e) => e.id === t);
93
+ if (i >= 0) return {
94
+ track: r,
95
+ trackIndex: n,
96
+ clip: r.clips[i],
97
+ index: i
98
+ };
99
+ }
100
+ return null;
101
+ }
102
+ function m(e = "clip") {
103
+ return `${e}-${typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().slice(0, 8) : Math.random().toString(36).slice(2, 10)}`;
104
+ }
105
+ function h(e) {
106
+ if (!e.magnetic) return {
107
+ ...e,
108
+ clips: [...e.clips].sort((e, t) => e.start - t.start)
109
+ };
110
+ let t = 0, n = 0, r = e.clips.map((e, r) => {
111
+ let i = o(e), a = r > 0 && e.transition ? Math.max(0, Math.min(e.transition, i, n)) : 0, s = Math.max(0, t - a), c = {
112
+ ...e,
113
+ start: s
114
+ };
115
+ return a > 0 ? c.transition = a : delete c.transition, t = s + i, n = i - a, c;
116
+ });
117
+ return {
118
+ ...e,
119
+ clips: r
120
+ };
121
+ }
122
+ var g = (e, t, n) => ({ tracks: e.tracks.map((e) => e.id === t ? h(n(e)) : e) });
123
+ function _(e, t, n) {
124
+ let r = p(e, t);
125
+ return r ? g(e, r.track.id, (e) => ({
126
+ ...e,
127
+ clips: e.clips.map((e) => e.id === t ? {
128
+ ...e,
129
+ ...n
130
+ } : e)
131
+ })) : e;
132
+ }
133
+ function v(e, t, n) {
134
+ return { tracks: e.tracks.map((e) => e.id === t ? h({
135
+ ...e,
136
+ ...n
137
+ }) : e) };
138
+ }
139
+ function y(e, t) {
140
+ let n = new Set(t);
141
+ return { tracks: e.tracks.map((e) => e.clips.some((e) => n.has(e.id)) ? h({
142
+ ...e,
143
+ clips: e.clips.filter((e) => !n.has(e.id))
144
+ }) : e) };
145
+ }
146
+ function b(e, t, n, r = m()) {
147
+ let i = p(e, t);
148
+ if (!i) return e;
149
+ let { clip: a, track: o, index: l } = i;
150
+ if (n <= a.start + 1e-6 || n >= s(a) - 1e-6) return e;
151
+ if (o.magnetic) {
152
+ let t = o.clips[l + 1];
153
+ if (a.transition && n < a.start + a.transition || t?.transition && n > t.start) return e;
154
+ }
155
+ let u = c(a, n), d = {
156
+ ...a,
157
+ out: u
158
+ };
159
+ delete d.fadeOut;
160
+ let f = {
161
+ ...a,
162
+ id: r,
163
+ in: u,
164
+ start: n
165
+ };
166
+ return delete f.fadeIn, delete f.transition, g(e, i.track.id, (e) => ({
167
+ ...e,
168
+ clips: e.clips.flatMap((e) => e.id === t ? [d, f] : [e])
169
+ }));
170
+ }
171
+ function x(e, t, n, r, i = {}) {
172
+ let a = p(e, t);
173
+ if (!a) return e;
174
+ let { clip: o, track: s } = a, l = o.speed || 1, u = (i.minDuration ?? .1) * l, d = i.mediaDuration ?? Infinity;
175
+ if (n === "end") return _(e, t, { out: Math.max(o.in + u, Math.min(d, c(o, r))) });
176
+ let f = s.magnetic ? 0 : o.in - o.start * l, m = Math.max(0, f, Math.min(o.out - u, c(o, r))), h = { in: m };
177
+ return s.magnetic || (h.start = o.start + (m - o.in) / l), _(e, t, h);
178
+ }
179
+ function S(e, t, n) {
180
+ let r = e.clips.filter((e) => e.id !== n), i = r.findIndex((e) => t < e.start + o(e) / 2);
181
+ return i < 0 ? r.length : i;
182
+ }
183
+ function C(e, t, n, r = {}) {
184
+ return g(e, t, (e) => {
185
+ if (!e.magnetic) return {
186
+ ...e,
187
+ clips: [...e.clips, {
188
+ ...n,
189
+ start: Math.max(0, r.start ?? n.start)
190
+ }]
191
+ };
192
+ let t = r.index ?? (r.start == null ? e.clips.length : S(e, r.start)), i = [...e.clips];
193
+ return i.splice(Math.max(0, Math.min(t, i.length)), 0, n), {
194
+ ...e,
195
+ clips: i
196
+ };
197
+ });
198
+ }
199
+ function w(e, t, n) {
200
+ let r = p(e, t);
201
+ if (!r) return e;
202
+ let i = n.trackId ?? r.track.id, a = e.tracks.find((e) => e.id === i);
203
+ if (!a) return e;
204
+ let o = { ...r.clip };
205
+ if (a.magnetic ? i !== r.track.id && delete o.transition : o.start = Math.max(0, n.start ?? o.start), i === r.track.id && a.magnetic) {
206
+ let r = a.clips.filter((e) => e.id !== t), s = Math.max(0, Math.min(n.index ?? S(a, n.start ?? o.start, t), r.length));
207
+ return r.splice(s, 0, o), g(e, i, (e) => ({
208
+ ...e,
209
+ clips: r
210
+ }));
211
+ }
212
+ return C(y(e, [t]), i, o, {
213
+ start: n.start ?? o.start,
214
+ index: n.index
215
+ });
216
+ }
217
+ function T(e, t, n) {
218
+ return { tracks: e.tracks.map((e) => {
219
+ let r = e.clips.flatMap((e) => {
220
+ let r = e.start, i = s(e);
221
+ if (i <= t || r >= n) return [];
222
+ let a = e.speed || 1, o = { ...e };
223
+ return r < t && (o.in = e.in + (t - r) * a, o.start = t, delete o.fadeIn, delete o.transition), i > n && (o.out = e.out - (i - n) * a, delete o.fadeOut), o.start -= t, [o];
224
+ });
225
+ return {
226
+ ...e,
227
+ clips: r
228
+ };
229
+ }) };
230
+ }
231
+ function E(e, { exclude: t = [], extra: n = [] } = {}) {
232
+ let r = new Set(t), i = /* @__PURE__ */ new Set([0, ...n]);
233
+ for (let t of e.tracks) for (let e of t.clips) r.has(e.id) || (i.add(e.start), i.add(s(e)));
234
+ return [...i].sort((e, t) => e - t);
235
+ }
236
+ function D(e, t, n) {
237
+ let r = e, i = n;
238
+ for (let n of t) {
239
+ let t = Math.abs(n - e);
240
+ t <= i && (r = n, i = t);
241
+ }
242
+ return {
243
+ time: r,
244
+ snapped: r !== e
245
+ };
246
+ }
247
+ function O(e, t) {
248
+ let n = e < 0 ? "-" : "", r = Math.abs(e);
249
+ if (t && t > 0) {
250
+ let e = Math.round(t), i = Math.round(r * t), a = i % e, o = Math.floor(i / e), s = (e) => String(e).padStart(2, "0");
251
+ return `${n}${s(Math.floor(o / 3600))}:${s(Math.floor(o / 60) % 60)}:${s(o % 60)}:${s(a)}`;
252
+ }
253
+ let i = Math.floor(r * 10 + 1e-6), a = Math.floor(i / 10);
254
+ return `${n}${Math.floor(a / 60)}:${String(a % 60).padStart(2, "0")}.${i % 10}`;
255
+ }
256
+ function k(e, t) {
257
+ let n = e.trim(), r = n.startsWith("-") ? -1 : 1;
258
+ if (r < 0 && (n = n.slice(1)), !n) return NaN;
259
+ let i = n.split(":");
260
+ if (i.some((e) => !/^\d*\.?\d+$/.test(e))) return NaN;
261
+ let a = i.map(Number);
262
+ return a.length === 4 ? t ? r * ((a[0] * 3600 + a[1] * 60 + a[2]) * Math.round(t) + a[3]) / t : NaN : r * a.reduce((e, t) => e * 60 + t, 0);
263
+ }
264
+ //#endregion
265
+ export { o as clipDuration, s as clipEnd, f as clipsAt, p as findClip, O as formatTimecode, C as insertClip, h as layoutTrack, i as lookCss, a as lookFfmpeg, S as magneticIndex, w as moveClip, k as parseTimecode, d as quantize, y as removeClips, T as sliceTimeline, E as snapTargets, D as snapTime, c as sourceTime, b as splitClip, u as timelineDuration, m as timelineId, r as timelineLooks, l as trackDuration, x as trimClip, _ as updateClip, v as updateTrack };
@@ -0,0 +1,26 @@
1
+ /** What the one-time adapter probe found: a `hardware` adapter, only a `software`/fallback one (or the probe timed
2
+ out), or `none` (no `navigator.gpu`, no adapter, insecure context, SSR). */
3
+ export type WebGPUProbe = 'hardware' | 'software' | 'none';
4
+ interface ProbeAdapterInfo {
5
+ vendor?: string;
6
+ architecture?: string;
7
+ device?: string;
8
+ description?: string;
9
+ isFallbackAdapter?: boolean;
10
+ }
11
+ interface ProbeAdapter {
12
+ isFallbackAdapter?: boolean;
13
+ info?: ProbeAdapterInfo;
14
+ requestAdapterInfo?: () => Promise<ProbeAdapterInfo>;
15
+ }
16
+ export interface ProbeGpu {
17
+ requestAdapter(): Promise<ProbeAdapter | null>;
18
+ }
19
+ export declare const navigatorGpu: () => ProbeGpu | undefined;
20
+ /** Probe WebGPU once per page (cached): is there an adapter, and is it real hardware? Settles within ~2.5 s; a probe
21
+ that takes longer counts as `software` (so `auto` falls back), and a late answer still updates later lexes. */
22
+ export declare function probeWebGPU(): Promise<WebGPUProbe>;
23
+ /** What the probe has found so far: `null` until it answers. */
24
+ export declare const webgpuProbeResult: () => WebGPUProbe | null;
25
+ export {};
26
+ //# sourceMappingURL=webgpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu.d.ts","sourceRoot":"","sources":["../../src/lib/webgpu.ts"],"names":[],"mappings":"AAIA;+EAC+E;AAC/E,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAS3D,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AACD,UAAU,YAAY;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACtD;AACD,MAAM,WAAW,QAAQ;IACvB,cAAc,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,YAAY,QAAO,QAAQ,GAAG,SACuD,CAAC;AAWnG;kHACkH;AAClH,wBAAgB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAoBlD;AAED,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,QAAO,WAAW,GAAG,IAAkB,CAAC"}
@@ -0,0 +1,28 @@
1
+ //#region src/lib/webgpu.ts
2
+ var e = null, t = null, n = /swiftshader|llvmpipe|lavapipe|software|microsoft basic/i, r = () => typeof navigator > "u" ? void 0 : navigator.gpu;
3
+ async function i(e) {
4
+ if (!e) return "none";
5
+ let t = e.info;
6
+ if (!t && typeof e.requestAdapterInfo == "function" && (t = await e.requestAdapterInfo().catch(() => void 0)), e.isFallbackAdapter || t?.isFallbackAdapter) return "software";
7
+ let r = [
8
+ t?.vendor,
9
+ t?.architecture,
10
+ t?.device,
11
+ t?.description
12
+ ].filter(Boolean).join(" ");
13
+ return n.test(r) ? "software" : "hardware";
14
+ }
15
+ function a() {
16
+ if (t) return t;
17
+ let n = r();
18
+ if (!n) return e = "none", t = Promise.resolve("none");
19
+ let a = Promise.resolve().then(() => n.requestAdapter()).then(i, () => "none"), o, s = new Promise((e) => {
20
+ o = setTimeout(() => e("software"), 2500);
21
+ });
22
+ return a.then((t) => {
23
+ clearTimeout(o), e = t;
24
+ }), t = Promise.race([a, s]).then((t) => e ??= t), t;
25
+ }
26
+ var o = () => e;
27
+ //#endregion
28
+ export { r as navigatorGpu, a as probeWebGPU, o as webgpuProbeResult };
package/dist/theme.css CHANGED
@@ -97,6 +97,7 @@
97
97
  --handle: rgba(120, 120, 128, .34);
98
98
  --code: #101014;
99
99
  --code-foreground: #D8D8E2;
100
+ --segment: #636366;
100
101
  }
101
102
 
102
103
  /* ── Workbench scope (WorkbenchShell, WorkbenchTheme, Composer surfaces): dark-first IDE palette ── */
@@ -159,6 +160,7 @@
159
160
  --code: #0C0C10;
160
161
  --code-foreground: #D8D8E2;
161
162
  --scope-terminal-background: #0C0C10;
163
+ --segment: #636366;
162
164
  }
163
165
 
164
166
  /* ── Terminal scope: the Workbench's integrated terminal stays dark in both appearances ── */
@@ -195,6 +197,7 @@
195
197
  --input: rgba(120, 120, 128, .24);
196
198
  --tertiary-foreground: rgba(235, 235, 245, .32);
197
199
  --secondary-strong: rgba(120, 120, 128, .36);
200
+ --segment: #636366;
198
201
  }
199
202
  [data-theme-scope="sheet"].light {
200
203
  color-scheme: light;