beatsheet 0.0.0-stage → 0.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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -2
  3. package/bin/beatsheet.js +14 -0
  4. package/bin/register-fallback.mjs +23 -0
  5. package/bin/resolve-fallback.mjs +83 -0
  6. package/package.json +45 -4
  7. package/player/env.d.ts +5 -0
  8. package/player/gallery-audio.ts +147 -0
  9. package/player/gallery-css.ts +144 -0
  10. package/player/gallery-detail.ts +385 -0
  11. package/player/gallery-music.ts +257 -0
  12. package/player/gallery-pick-state.ts +167 -0
  13. package/player/gallery-pick.ts +749 -0
  14. package/player/gallery-sounds.ts +137 -0
  15. package/player/gallery-state.ts +457 -0
  16. package/player/gallery.ts +612 -0
  17. package/player/index.html +49 -0
  18. package/player/main.ts +83 -0
  19. package/skill/SKILL.md +658 -0
  20. package/skill/examples/library/assets/tour/avatar-mk.svg +1 -0
  21. package/skill/examples/library/assets/tour/dashboard-insights.svg +1 -0
  22. package/skill/examples/library/assets/tour/dashboard.svg +1 -0
  23. package/skill/examples/library/assets/tour/settings.svg +1 -0
  24. package/skill/examples/library/library-tour.plan.md +32 -0
  25. package/skill/examples/library/library-tour.video.json +268 -0
  26. package/skill/reference/scene-techniques.md +306 -0
  27. package/skill/scripts/beats.ts +34 -0
  28. package/skill/scripts/catalogue.ts +120 -0
  29. package/skill/scripts/frames.ts +105 -0
  30. package/src/args.ts +344 -0
  31. package/src/cli.ts +95 -0
  32. package/src/commands.ts +812 -0
  33. package/src/default-project.config.ts +9 -0
  34. package/src/index.ts +47 -0
  35. package/src/packages.ts +17 -0
  36. package/src/paths.ts +32 -0
  37. package/src/project.ts +200 -0
  38. package/src/render/browser.ts +185 -0
  39. package/src/render/capture.ts +320 -0
  40. package/src/render/ffmpeg.ts +229 -0
  41. package/src/render/gif-info.ts +61 -0
  42. package/src/render/render.ts +220 -0
  43. package/src/samples.ts +557 -0
  44. package/src/server/api.ts +494 -0
  45. package/src/server/jobs.ts +210 -0
  46. package/src/server/security.ts +47 -0
  47. package/src/server/server.ts +191 -0
  48. package/src/server/sse.ts +76 -0
  49. package/src/server/static.ts +127 -0
  50. package/src/server/vite.ts +100 -0
  51. package/src/skill.ts +111 -0
  52. package/src/snap.ts +212 -0
  53. package/src/speech.ts +689 -0
  54. package/src/svg-text.ts +136 -0
  55. package/src/voicefx.ts +311 -0
  56. package/studio/3rdpartylicenses.txt +287 -0
  57. package/studio/favicon.ico +0 -0
  58. package/studio/icons/apple-touch-icon.png +0 -0
  59. package/studio/icons/icon-192.png +0 -0
  60. package/studio/icons/icon-512.png +0 -0
  61. package/studio/icons/icon.svg +1 -0
  62. package/studio/icons/maskable-512.png +0 -0
  63. package/studio/index.html +18 -0
  64. package/studio/main-KMYDBWZH.js +15 -0
  65. package/studio/manifest.webmanifest +17 -0
  66. package/studio/offline.html +92 -0
  67. package/studio/styles-NJ2CULOW.css +1 -0
  68. package/studio/sw.js +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dominik Strasser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,64 @@
1
- # Temporary Holding Version
1
+ # beatsheet
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Short launch and feature videos as structured data. A video is a JSON file of scenes with texts, durations and
4
+ timing points; a local editor changes it without code; the renderer turns it into frame-exact MP4s (16:9, 4:5, 1:1,
5
+ 9:16) with music and sound effects. Change one scene's length and everything after it moves along, picture and
6
+ sound together.
7
+
8
+ ## Start
9
+
10
+ In an empty folder (no install, no config):
11
+
12
+ ```bash
13
+ npx beatsheet skill install
14
+ npx beatsheet studio
15
+ # tell your agent: "I've got an idea for a new beatsheet video - here it is: …"
16
+ ```
17
+
18
+ `skill install` copies the agent skill for Claude Code to `~/.claude/skills/beatsheet` (`--dir` for another folder;
19
+ `--force` refreshes it after an update). `studio` serves the editor at http://localhost:4321 (`--open` opens it in
20
+ your browser) and, in an empty folder, shows what to tell the agent; the agent's first video appears there once it is
21
+ saved. *Open the library tour* copies a finished video (a tour of the built-in scene types) and its images into the
22
+ folder. The agent researches the change, plans the story, writes the video file, checks stills and renders both
23
+ formats; you fine-tune it in the studio.
24
+
25
+ ```bash
26
+ npx beatsheet check videos/<name>.video.json # validation, layout and read-time warnings
27
+ npx beatsheet render videos/<name>.video.json --format 16:9,4:5
28
+ npx beatsheet paths # where beatsheet's sources, skill and examples are
29
+ npx beatsheet --help # every command and flag
30
+ ```
31
+
32
+ A folder without `beatsheet.config.ts` uses the neutral default theme and the built-in scene types. Add a config
33
+ only for a brand theme or a scene type of your own, then restart the studio:
34
+
35
+ ```ts
36
+ import { defineProject } from '@beatsheet/core';
37
+ import { builtinScenes, defaultTheme } from '@beatsheet/scenes';
38
+
39
+ export default defineProject({ name: 'my-videos', theme: defaultTheme, scenes: builtinScenes });
40
+ ```
41
+
42
+ Its imports resolve to beatsheet's own copies of `@beatsheet/core` and `@beatsheet/scenes`. The folder's `.ts`
43
+ files load as ES modules when its `package.json` declares no `"type"`, so `require`, `__dirname` and
44
+ `module.exports` don't work in a config.
45
+
46
+ ## Pin versions or add your own npm packages
47
+
48
+ A scene type that needs npm packages of its own (gsap, three.js), or a project that pins beatsheet's version,
49
+ installs beatsheet into the folder; that install then wins over npx's:
50
+
51
+ ```bash
52
+ npm init -y
53
+ npm install -D beatsheet @beatsheet/core @beatsheet/scenes
54
+ ```
55
+
56
+ ## Notes
57
+
58
+ - Node 20.19+ or 22.12+. ffmpeg comes with `ffmpeg-static`; npm 11 may ask you to approve the install scripts of
59
+ `ffmpeg-static` (it downloads ffmpeg) and `esbuild` (it runs TypeScript): `npm approve-scripts ffmpeg-static esbuild`.
60
+ - Chromium downloads itself on the first `check`, `stills` or `render` (about 100 MB, once per machine).
61
+ `BEATSHEET_CHROMIUM` points at a Chromium of your own; `BEATSHEET_NO_DOWNLOAD=1` turns the download off.
62
+ - Voice-over (`beatsheet speak`) needs `@beatsheet/voice-kokoro`, which is not on npm yet.
63
+ - MIT licensed. The studio bundles Angular and rxjs; their licences are in `studio/3rdpartylicenses.txt`. The
64
+ `ffmpeg-static` binary it runs is a GPL build of ffmpeg, used as a separate program.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ // Registers tsx so the TypeScript sources (and the project's beatsheet.config.ts) load in Node.
3
+ import { register } from 'tsx/esm/api';
4
+
5
+ register();
6
+ // After tsx: a project without its own install imports @beatsheet/* from the CLI's copies.
7
+ await import('./register-fallback.mjs');
8
+ const { main } = await import('../src/cli.ts');
9
+ const code = await main(process.argv.slice(2));
10
+ // Exit when the event loop is empty rather than with process.exit(): onnxruntime-node (loaded by a
11
+ // speech engine plugin in `speak` and the studio) aborts in its teardown on an explicit exit on
12
+ // macOS ("mutex lock failed", exit 134). Whatever still holds the loop open gets 2 s, then we exit.
13
+ process.exitCode = code;
14
+ setTimeout(() => process.exit(code), 2000).unref();
@@ -0,0 +1,23 @@
1
+ // A project's @beatsheet/core and @beatsheet/scenes imports fall back to the CLI's copies when the
2
+ // project has none (npx beatsheet in a fresh folder). Imported by bin/beatsheet.js after tsx's
3
+ // register(), and passed with --import after tsx to the skill scripts' child processes.
4
+ import Module, { createRequire, register } from 'node:module';
5
+ import { BEATSHEET_PACKAGE } from './resolve-fallback.mjs';
6
+
7
+ const parentURL = new URL('../package.json', import.meta.url).href;
8
+
9
+ // import: registered after tsx, so these hooks see tsx's resolution fail first.
10
+ register(new URL('./resolve-fallback.mjs', import.meta.url), { data: { parentURL } });
11
+
12
+ // require: tsx loads a .ts file outside a "type": "module" package (an empty folder's
13
+ // beatsheet.config.ts) as CommonJS, and its require() calls bypass the import hooks.
14
+ const cliRequire = createRequire(parentURL);
15
+ const resolveFilename = Module._resolveFilename;
16
+ Module._resolveFilename = function (request, ...rest) {
17
+ try {
18
+ return resolveFilename.call(this, request, ...rest);
19
+ } catch (err) {
20
+ if (!BEATSHEET_PACKAGE.test(request) || err?.code !== 'MODULE_NOT_FOUND') throw err;
21
+ return cliRequire.resolve(request);
22
+ }
23
+ };
@@ -0,0 +1,83 @@
1
+ // Node module-customization hooks (registered by bin/register-fallback.mjs): a project without its
2
+ // own install (npx beatsheet in a fresh folder) imports @beatsheet/core and @beatsheet/scenes from
3
+ // the CLI's copies. A project's own install still wins: the fallback runs only when that fails.
4
+ // A project's TypeScript files load as ES modules where its package.json declares no "type" (an
5
+ // empty folder has none), so they share the CLI's @beatsheet/core instead of a CommonJS copy.
6
+ // Plain .mjs because hooks run on a loader thread that tsx's registration may not cover.
7
+
8
+ import fs from 'node:fs';
9
+ import path from 'node:path';
10
+ import { fileURLToPath, pathToFileURL } from 'node:url';
11
+
12
+ // The same pattern as BEATSHEET_PACKAGE in src/packages.ts (bin/ cannot import TypeScript).
13
+ export const BEATSHEET_PACKAGE = /^@beatsheet\/(core|scenes)(\/|$)/;
14
+
15
+ /** The CLI's package.json URL: the fallback resolves from there. */
16
+ let parentURL;
17
+
18
+ export function initialize(data) {
19
+ parentURL = data?.parentURL;
20
+ }
21
+
22
+ export async function resolve(specifier, context, next) {
23
+ let resolved;
24
+ try {
25
+ resolved = await next(specifier, context);
26
+ } catch (err) {
27
+ if (!parentURL || !BEATSHEET_PACKAGE.test(specifier) || err?.code !== 'ERR_MODULE_NOT_FOUND') throw err;
28
+ return next(specifier, { ...context, parentURL });
29
+ }
30
+ return forcedModule(resolved.url) ? { ...resolved, url: withoutCommonJsQuery(resolved.url), format: 'module' } : resolved;
31
+ }
32
+
33
+ /**
34
+ * tsx (Node 20, 22) marks a file it took for CommonJS with query parameters of its own
35
+ * (tsx-commonjs-export-preparse, tsx-commonjs-virtual-query), the latter repeating the query
36
+ * inside the path. A forced module drops them and keeps any other query (a config's ?v=).
37
+ */
38
+ function withoutCommonJsQuery(url) {
39
+ const u = new URL(url);
40
+ const clean = pathToFileURL(filePath(u));
41
+ for (const [key, value] of u.searchParams) if (!key.startsWith('tsx-commonjs-')) clean.searchParams.append(key, value);
42
+ clean.hash = u.hash;
43
+ return clean.href;
44
+ }
45
+
46
+ /** The file of a file: URL, without tsx's query in its path. */
47
+ function filePath(u) {
48
+ const bare = new URL(u.href);
49
+ bare.search = '';
50
+ bare.hash = '';
51
+ return fileURLToPath(bare).split('?')[0];
52
+ }
53
+
54
+ const TS_FILE = /\.(ts|mts|tsx)$/;
55
+
56
+ /** The "type" of the package.json nearest to each folder (undefined: none, or none declared). */
57
+ const scopeTypes = new Map();
58
+
59
+ function scopeType(dir) {
60
+ if (scopeTypes.has(dir)) return scopeTypes.get(dir);
61
+ let type;
62
+ const file = path.join(dir, 'package.json');
63
+ if (fs.existsSync(file)) {
64
+ try {
65
+ type = JSON.parse(fs.readFileSync(file, 'utf8')).type;
66
+ } catch {
67
+ type = undefined;
68
+ }
69
+ } else {
70
+ const parent = path.dirname(dir);
71
+ type = parent === dir ? undefined : scopeType(parent);
72
+ }
73
+ scopeTypes.set(dir, type);
74
+ return type;
75
+ }
76
+
77
+ /** A project TypeScript file (not in node_modules) whose package scope declares no "type". */
78
+ function forcedModule(url) {
79
+ if (!url.startsWith('file:')) return false;
80
+ const file = filePath(new URL(url));
81
+ if (!TS_FILE.test(file) || file.split(path.sep).includes('node_modules')) return false;
82
+ return scopeType(path.dirname(file)) === undefined;
83
+ }
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "beatsheet",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Short launch and feature videos as structured data: a JSON file per video, a local editor, frame-exact MP4 renders",
5
+ "license": "MIT",
6
+ "author": "Dominik Strasser",
7
+ "keywords": [
8
+ "video",
9
+ "launch-video",
10
+ "motion",
11
+ "mp4",
12
+ "playwright"
13
+ ],
14
+ "type": "module",
15
+ "bin": {
16
+ "beatsheet": "bin/beatsheet.js"
17
+ },
18
+ "exports": {
19
+ ".": "./src/index.ts"
20
+ },
21
+ "scripts": {
22
+ "test": "vitest run",
23
+ "typecheck": "tsc -p tsconfig.json",
24
+ "prepack": "node scripts/prepack.mjs",
25
+ "postpack": "node scripts/postpack.mjs"
26
+ },
27
+ "dependencies": {
28
+ "@beatsheet/core": "0.2.0",
29
+ "@beatsheet/scenes": "0.2.0",
30
+ "ffmpeg-static": "^5.3.0",
31
+ "playwright": "1.63.0",
32
+ "tsx": "^4.20.0",
33
+ "vite": "^8.3.8"
34
+ },
35
+ "engines": {
36
+ "node": "^20.19.0 || >=22.12.0"
37
+ },
38
+ "files": [
39
+ "bin",
40
+ "src",
41
+ "player",
42
+ "studio",
43
+ "skill",
44
+ "LICENSE",
45
+ "README.md"
46
+ ]
47
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'virtual:beatsheet/project' {
2
+ import type { ProjectConfig } from '@beatsheet/core';
3
+ const project: ProjectConfig;
4
+ export default project;
5
+ }
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Live audio of the gallery page: one AudioContext, created on the first click that plays
3
+ * something (browsers allow it only from a user gesture), a master gain into the speakers, and
4
+ * playback of a rendered buffer with a clock.
5
+ */
6
+ import { mulberry32, type FileSound, type SoundDef } from '@beatsheet/core';
7
+
8
+ function isFileSound(def: SoundDef): def is FileSound {
9
+ return typeof (def as Partial<FileSound>).url === 'string';
10
+ }
11
+
12
+ let ctx: AudioContext | null = null;
13
+ let master: GainNode | null = null;
14
+
15
+ /** The page's AudioContext. Call it from a click handler the first time. Null when the browser has none. */
16
+ export function liveContext(): AudioContext | null {
17
+ if (!ctx) {
18
+ const Ctor = (globalThis as { AudioContext?: typeof AudioContext }).AudioContext;
19
+ if (!Ctor) return null;
20
+ try {
21
+ ctx = new Ctor({ latencyHint: 'interactive' });
22
+ master = ctx.createGain();
23
+ master.gain.value = 0.9;
24
+ master.connect(ctx.destination);
25
+ } catch (err) {
26
+ console.warn(`[beatsheet gallery] no AudioContext: ${err instanceof Error ? err.message : String(err)}`);
27
+ ctx = null;
28
+ return null;
29
+ }
30
+ }
31
+ if (ctx.state === 'suspended') void ctx.resume();
32
+ return ctx;
33
+ }
34
+
35
+ function out(): AudioNode {
36
+ return master as GainNode;
37
+ }
38
+
39
+ /**
40
+ * Silences everything the page plays now (one-shot sounds, mixes): the master bus is swapped for a
41
+ * fresh one, so sources already scheduled on the old bus are cut off. Players keep their own stop().
42
+ */
43
+ export function silenceAll(): void {
44
+ if (!ctx || !master) return;
45
+ master.disconnect();
46
+ master = ctx.createGain();
47
+ master.gain.value = 0.9;
48
+ master.connect(ctx.destination);
49
+ }
50
+
51
+ const decoded = new Map<string, Promise<AudioBuffer>>();
52
+
53
+ /** Fetch and decode an audio file once per URL. */
54
+ export function decodeUrl(context: BaseAudioContext, url: string): Promise<AudioBuffer> {
55
+ let p = decoded.get(url);
56
+ if (!p) {
57
+ p = fetch(url)
58
+ .then((res) => {
59
+ if (!res.ok) throw new Error(`HTTP ${res.status} for ${url}`);
60
+ return res.arrayBuffer();
61
+ })
62
+ .then((bytes) => context.decodeAudioData(bytes));
63
+ decoded.set(url, p);
64
+ p.catch(() => decoded.delete(url));
65
+ }
66
+ return p;
67
+ }
68
+
69
+ /** A fixed seed per sound id, so a synth sounds the same on every click. */
70
+ export function soundSeed(id: string): number {
71
+ let h = 7;
72
+ for (let i = 0; i < id.length; i++) h = (Math.imul(h, 31) + id.charCodeAt(i)) >>> 0;
73
+ return h;
74
+ }
75
+
76
+ /** Plays a theme sound now. Resolves with its length in seconds (approximate for synths). */
77
+ export async function playSound(id: string, def: SoundDef): Promise<number> {
78
+ const context = liveContext();
79
+ if (!context) throw new Error('this browser has no AudioContext');
80
+ const when = context.currentTime + 0.05;
81
+ if (isFileSound(def)) {
82
+ const buffer = await decodeUrl(context, def.url);
83
+ const src = context.createBufferSource();
84
+ src.buffer = buffer;
85
+ src.connect(out());
86
+ src.start(Math.max(when, context.currentTime));
87
+ return buffer.duration;
88
+ }
89
+ def.synth(context, out(), when, 1, mulberry32(soundSeed(id)));
90
+ return 1;
91
+ }
92
+
93
+ /** A buffer playing from `offset`; `time()` follows the audio clock. */
94
+ export interface Playback {
95
+ time(): number;
96
+ stop(): void;
97
+ /** True when sound plays (false: a silent clock, e.g. without AudioContext or when the mix failed). */
98
+ audible: boolean;
99
+ }
100
+
101
+ /** Plays `buffer` (or, without one, a silent clock) from `offset` seconds. */
102
+ export function startPlayback(buffer: AudioBuffer | null, offset: number): Playback {
103
+ const context = buffer ? liveContext() : null;
104
+ if (!buffer || !context) {
105
+ const t0 = performance.now();
106
+ return { time: () => offset + (performance.now() - t0) / 1000, stop: () => undefined, audible: false };
107
+ }
108
+ const src = context.createBufferSource();
109
+ src.buffer = buffer;
110
+ src.connect(out());
111
+ const startAt = context.currentTime + 0.03;
112
+ src.start(startAt, Math.min(Math.max(0, offset), buffer.duration));
113
+ let stopped = false;
114
+ return {
115
+ audible: true,
116
+ time: () => offset + Math.max(0, context.currentTime - startAt),
117
+ stop: (): void => {
118
+ if (stopped) return;
119
+ stopped = true;
120
+ try {
121
+ src.stop();
122
+ } catch {
123
+ // already ended
124
+ }
125
+ src.disconnect();
126
+ },
127
+ };
128
+ }
129
+
130
+ /** Renders a sound offline (mono, 22.05 kHz) for its waveform. */
131
+ export async function renderSoundOffline(id: string, def: SoundDef, seconds = 3): Promise<Float32Array> {
132
+ const Ctor = (globalThis as { OfflineAudioContext?: typeof OfflineAudioContext }).OfflineAudioContext;
133
+ if (!Ctor) return new Float32Array(0);
134
+ const rate = 22050;
135
+ const off = new Ctor({ numberOfChannels: 1, length: Math.round(seconds * rate), sampleRate: rate });
136
+ if (isFileSound(def)) {
137
+ const buffer = await decodeUrl(off, def.url);
138
+ const src = off.createBufferSource();
139
+ src.buffer = buffer;
140
+ src.connect(off.destination);
141
+ src.start(0);
142
+ } else {
143
+ def.synth(off, off.destination, 0.01, 1, mulberry32(soundSeed(id)));
144
+ }
145
+ const rendered = await off.startRendering();
146
+ return rendered.getChannelData(0);
147
+ }
@@ -0,0 +1,144 @@
1
+ /** Styles of the gallery page (the studio's calm dark editor look). Scene previews keep their own theme. */
2
+ export const GALLERY_CSS = `
3
+ :root.bs-gallery {
4
+ --g-bg: #141518; --g-panel: #1b1c20; --g-panel-2: #22242a; --g-panel-3: #2a2d34;
5
+ --g-border: #30333b; --g-border-strong: #3d414b; --g-text: #e4e5e9; --g-muted: #959aa5; --g-faint: #6b707b;
6
+ --g-accent: #7aa2f7; --g-accent-soft: rgba(122, 162, 247, 0.16); --g-warn: #e0b85c; --g-error: #f07a7a; --g-ok: #7fcf96;
7
+ --g-radius: 6px; --g-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
8
+ --g-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
9
+ color-scheme: dark;
10
+ }
11
+ /* The viewport scrolls (body must not be a scroll container, or the sticky header would not stick). */
12
+ html.bs-gallery { overflow: auto; background: var(--g-bg); }
13
+ html.bs-gallery body { overflow: visible; background: var(--g-bg); height: auto; }
14
+ html.bs-gallery body { color: var(--g-text); font: 13px/1.45 var(--g-font); min-height: 100vh; }
15
+ html.bs-gallery #beatsheet-player { display: none; }
16
+ .bs-gallery * { box-sizing: border-box; }
17
+ .bs-gallery button, .bs-gallery input { font: inherit; color: inherit; }
18
+ .bs-gallery button {
19
+ background: var(--g-panel-3); border: 1px solid var(--g-border-strong); border-radius: var(--g-radius);
20
+ padding: 3px 10px; cursor: pointer; min-height: 26px;
21
+ }
22
+ .bs-gallery button:hover:not(:disabled) { background: #333741; }
23
+ .bs-gallery button:disabled { opacity: 0.45; cursor: default; }
24
+ .bs-gallery button.g-primary { background: var(--g-accent); border-color: var(--g-accent); color: #0d1424; font-weight: 600; }
25
+ .bs-gallery button.g-primary:hover:not(:disabled) { background: #8fb2fa; }
26
+ .bs-gallery :focus-visible { outline: 2px solid var(--g-accent); outline-offset: 1px; }
27
+ .bs-gallery code { font-family: var(--g-mono); font-size: 11px; color: var(--g-muted); }
28
+ .bs-gallery input[type='search'] {
29
+ background: var(--g-bg); border: 1px solid var(--g-border); border-radius: var(--g-radius); padding: 3px 8px; min-height: 26px; width: 220px;
30
+ }
31
+ .bs-gallery input[type='search']:focus { border-color: var(--g-accent); outline: none; }
32
+ .bs-gallery input[type='checkbox'] { accent-color: var(--g-accent); margin: 0; }
33
+
34
+ .g-head { position: sticky; top: 0; z-index: 20; background: var(--g-panel); border-bottom: 1px solid var(--g-border); }
35
+ .g-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; flex-wrap: wrap; }
36
+ .g-row[hidden] { display: none; }
37
+ .g-row + .g-row { border-top: 1px solid var(--g-border); padding-top: 6px; }
38
+ .g-brand { font-weight: 700; color: var(--g-accent); letter-spacing: 0.02em; }
39
+ .g-sub { color: var(--g-muted); }
40
+ .g-spacer { flex: 1; }
41
+ .g-seg { display: inline-flex; border: 1px solid var(--g-border-strong); border-radius: var(--g-radius); overflow: hidden; }
42
+ .bs-gallery .g-seg button { border: 0; border-radius: 0; background: transparent; color: var(--g-muted); min-height: 24px; }
43
+ .bs-gallery .g-seg button + button { border-left: 1px solid var(--g-border); }
44
+ .bs-gallery .g-seg button[aria-pressed='true'] { background: var(--g-accent-soft); color: var(--g-text); }
45
+ .g-tabs { display: inline-flex; gap: 2px; }
46
+ .bs-gallery .g-tabs button { background: transparent; border-color: transparent; color: var(--g-muted); }
47
+ .bs-gallery .g-tabs button[aria-selected='true'] { color: var(--g-text); border-color: var(--g-border-strong); background: var(--g-panel-2); }
48
+ .g-count { color: var(--g-faint); font-size: 11px; margin-left: 4px; font-variant-numeric: tabular-nums; }
49
+ .g-label { color: var(--g-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
50
+ .g-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
51
+ .bs-gallery .g-chip { border-radius: 999px; padding: 1px 10px; min-height: 24px; background: transparent; color: var(--g-muted); }
52
+ .bs-gallery .g-chip[aria-pressed='true'] { background: var(--g-accent-soft); border-color: var(--g-accent); color: var(--g-text); }
53
+ .g-check { display: inline-flex; align-items: center; gap: 6px; color: var(--g-muted); cursor: pointer; }
54
+ .g-summary { color: var(--g-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
55
+
56
+ .g-main { padding: 6px 14px 80px; }
57
+ .g-panel[hidden] { display: none; }
58
+ .g-empty { color: var(--g-muted); padding: 40px 0; text-align: center; }
59
+ .g-cat { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--g-muted); border-bottom: 1px solid var(--g-border); padding-bottom: 4px; }
60
+ .g-type { margin: 10px 0 18px; }
61
+ .g-type-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
62
+ .g-type-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
63
+ .g-type-head p { margin: 0; color: var(--g-muted); flex-basis: 100%; }
64
+ .g-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
65
+ .g-tile { background: var(--g-panel); border: 1px solid var(--g-border); border-radius: var(--g-radius); padding: 6px; cursor: pointer; position: relative; }
66
+ .g-tile:hover { border-color: var(--g-faint); }
67
+ .g-tile:focus-visible { outline: 2px solid var(--g-accent); }
68
+ .g-previews { display: flex; gap: 6px; align-items: flex-start; }
69
+ .g-preview { position: relative; overflow: hidden; background: #0c0c0e; border-radius: 3px; box-shadow: 0 0 0 1px var(--g-border); }
70
+ .g-holder { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
71
+ .g-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 11px; color: var(--g-faint); background: linear-gradient(135deg, #131318, #0c0c0e); }
72
+ .g-tile.live .g-ph { display: none; }
73
+ .g-preview-label { position: absolute; right: 4px; bottom: 3px; font: 10px/1 var(--g-mono); color: rgba(255,255,255,0.75); background: rgba(0,0,0,0.45); padding: 2px 4px; border-radius: 3px; }
74
+ .g-tile-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; min-height: 18px; }
75
+ .g-tile-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
76
+ .g-dur { color: var(--g-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
77
+ .g-badge { font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 3px; border: 1px solid var(--g-border-strong); color: var(--g-muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
78
+ .g-badge.stress { color: var(--g-warn); border-color: rgba(224, 184, 92, 0.5); }
79
+ .g-badge.file { color: var(--g-ok); border-color: rgba(127, 207, 150, 0.45); }
80
+ .g-badge.library { color: var(--g-accent); border-color: rgba(122, 162, 247, 0.45); }
81
+ .g-progress { position: absolute; left: 6px; right: 6px; height: 2px; background: transparent; overflow: hidden; }
82
+ .g-progress i { display: block; height: 100%; background: var(--g-accent); transform-origin: 0 0; transform: scaleX(0); opacity: 0.8; }
83
+ .g-error { color: var(--g-error); font-size: 11px; padding: 6px; }
84
+
85
+ /* Large view */
86
+ .g-detail { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); display: flex; padding: 18px; }
87
+ .g-detail[hidden] { display: none; }
88
+ .g-detail-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--g-panel); border: 1px solid var(--g-border-strong); border-radius: 10px; overflow: hidden; }
89
+ .g-detail-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--g-border); }
90
+ .g-detail-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
91
+ .g-detail-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
92
+ .g-detail-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0c0c0e; }
93
+ .g-detail-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; overflow: hidden; }
94
+ .g-transport { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--g-panel); border-top: 1px solid var(--g-border); }
95
+ .g-time { font-family: var(--g-mono); font-variant-numeric: tabular-nums; min-width: 110px; }
96
+ .g-scrub { position: relative; flex: 1; display: flex; align-items: center; }
97
+ .g-scrub input { width: 100%; accent-color: var(--g-accent); margin: 0; }
98
+ .g-beat-marks { position: absolute; left: 8px; right: 8px; top: -6px; height: 5px; pointer-events: none; }
99
+ .g-beat-marks i { position: absolute; top: 0; width: 1px; height: 5px; background: var(--g-muted); }
100
+ .g-detail-side { overflow: auto; padding: 12px 14px 30px; border-left: 1px solid var(--g-border); }
101
+ .g-detail-side h4 { margin: 14px 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--g-muted); display: flex; align-items: center; gap: 6px; }
102
+ .g-detail-side h4:first-child { margin-top: 0; }
103
+ .g-detail-side p { margin: 0 0 8px; color: var(--g-muted); }
104
+ .g-json { margin: 0; padding: 8px 10px; background: var(--g-bg); border: 1px solid var(--g-border); border-radius: var(--g-radius); font: 11px/1.45 var(--g-mono); white-space: pre-wrap; word-break: break-word; max-height: 46vh; overflow: auto; user-select: text; }
105
+ .g-list { list-style: none; margin: 0; padding: 0; }
106
+ .g-list li { display: flex; gap: 8px; padding: 2px 0; font-size: 12px; }
107
+ .g-list li span:first-child { font-family: var(--g-mono); color: var(--g-faint); min-width: 52px; font-variant-numeric: tabular-nums; }
108
+ .bs-gallery .g-list button { background: none; border: 0; padding: 0; min-height: 0; color: var(--g-text); text-align: left; }
109
+ .bs-gallery .g-list button:hover { color: var(--g-accent); background: none; }
110
+ .g-copied { color: var(--g-ok); font-size: 11px; }
111
+
112
+ /* Sound board */
113
+ .g-sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
114
+ .bs-gallery .g-sound { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 10px; text-align: left; padding: 8px 10px; background: var(--g-panel); border-color: var(--g-border); }
115
+ .bs-gallery .g-sound:hover { border-color: var(--g-faint); background: var(--g-panel-2); }
116
+ .bs-gallery .g-sound.playing { border-color: var(--g-accent); background: var(--g-accent-soft); }
117
+ .g-sound-icon { grid-row: span 3; align-self: center; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--g-panel-3); color: var(--g-accent); font-size: 11px; }
118
+ .g-sound-name { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
119
+ .g-sound-name strong { font-weight: 600; }
120
+ .g-sound p { margin: 0; color: var(--g-muted); font-size: 12px; }
121
+ .g-wave { width: 100%; height: 28px; display: block; }
122
+
123
+ /* Music browser */
124
+ .g-music-head { position: sticky; top: var(--g-head-h, 84px); z-index: 10; background: var(--g-bg); padding: 10px 0 8px; border-bottom: 1px solid var(--g-border); display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 8px 14px; align-items: start; }
125
+ .g-music-preview { grid-row: span 2; }
126
+ .g-music-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
127
+ .g-music-now { color: var(--g-muted); }
128
+ .g-music-now strong { color: var(--g-text); font-weight: 600; }
129
+ .g-tl { position: relative; height: 54px; background: var(--g-panel); border: 1px solid var(--g-border); border-radius: var(--g-radius); overflow: hidden; cursor: pointer; }
130
+ .g-tl-block { position: absolute; top: 6px; bottom: 6px; background: #2b3140; border: 1px solid var(--g-border-strong); border-radius: 4px; padding: 3px 6px; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
131
+ .g-tl-block span { display: block; color: var(--g-faint); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
132
+ .g-tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #f2f3f5; pointer-events: none; }
133
+ .g-tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
134
+ .g-track { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 10px; background: var(--g-panel); border: 1px solid var(--g-border); border-radius: var(--g-radius); }
135
+ .g-track.playing { border-color: var(--g-accent); background: var(--g-accent-soft); }
136
+ .g-track p { margin: 0; color: var(--g-muted); font-size: 12px; grid-column: 2; }
137
+ .g-track-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
138
+ .g-track-name strong { font-weight: 600; }
139
+ .g-track .g-state { grid-row: span 2; color: var(--g-faint); font-size: 11px; }
140
+ .bs-gallery .g-play { grid-row: span 2; min-width: 64px; }
141
+ .g-parts { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
142
+ .bs-gallery .g-part { min-height: 0; padding: 1px 8px; font-size: 11px; border-radius: 10px; }
143
+ .bs-gallery .g-part[aria-pressed='true'] { text-decoration: line-through; color: var(--g-faint); border-style: dashed; }
144
+ `;