Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
feat(studio): rebuild the semantic NLE interface
kashorine6fa0fcacf9b
diff --git a/packages/studio/src/adapters/deck.ts b/packages/studio/src/adapters/deck.tsnew file mode 100644index 00000000..100cd937--- /dev/null+++ b/packages/studio/src/adapters/deck.ts@@ -0,0 +1,57 @@+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "./types.js";+import { readonlyInteraction, sameSurfaceValue } from "./types.js";++type DepthStackProgram = {+ readonly terminalFrame: number;+ readonly cards?: readonly { readonly id: string; readonly activationFrame: number }[];+ readonly spec?: { readonly stackingOrder?: number };+};++function projectDeck(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const program = sameSurfaceValue(context, "program") as DepthStackProgram | undefined;+ if (program?.cards === undefined || context.placement === undefined) return context.generic();+ const cards = program.cards;+ const children = new Map(context.placement.children.flatMap((child) =>+ child.id === undefined ? [] : [[child.id, child] as const]));+ return cards.map((card, index): StudioEntityDraft => {+ const child = children.get(card.id);+ const markerId = child?.referenceAttributes.at?.split(".").at(-1)+ ?? child?.referenceAttributes.moment?.split(".").at(-1);+ const endFrameExclusive = cards[index + 1]?.activationFrame ?? program.terminalFrame;+ const render = context.spans.find((span) => span.id === card.id+ || span.id.startsWith(`${card.id}:`) || span.id.startsWith(`${card.id}#`));+ return {+ id: `${context.track.outputRef}:entity:${card.id}`,+ authoredId: card.id,+ ...(markerId === undefined ? {} : { markerId }),+ label: card.id.replace(/^card-/u, ""),+ startFrame: card.activationFrame,+ endFrameExclusive,+ stackOrder: program.spec?.stackingOrder ?? render?.stackOrder ?? 0,+ ...(child === undefined ? {} : { elementRange: child.range }),+ ...(render === undefined ? {} : { presentId: render.id, renderIds: [render.id] }),+ presentation: { entity: "deck-card", shape: "picture", depth: 0 },+ temporal: {+ source: { kind: "moment", ...(markerId === undefined ? {} : { id: markerId }) },+ projection: {+ startExpression: "moment.cue",+ endExpression: "next moment / terminal",+ startFrame: card.activationFrame,+ endFrameExclusive,+ },+ phases: [],+ },+ interaction: readonlyInteraction,+ };+ });+}++export const deckAdapters: readonly StudioAdapter[] = [+ { id: "deck-program", role: "realization", output: { type: "DepthStackProgram", modules: ["@hypit/deck-track"] } },+ {+ id: "deck", role: "track",+ output: { type: "VisualTrack", surface: "track", modules: ["@hypit/deck-track"] },+ family: "component", icon: "layers", realizationPorts: ["program"],+ interaction: readonlyInteraction, project: projectDeck,+ },+];diff --git a/packages/studio/src/adapters/generic.ts b/packages/studio/src/adapters/generic.tsindex 7917c9b5..dceae13e 100644--- a/packages/studio/src/adapters/generic.ts+++ b/packages/studio/src/adapters/generic.ts@@ -7,9 +7,34 @@ type TypographyTrackProgram = {readonly id: string;readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };readonly style: { readonly stackingOrder: number };+ readonly document?: {+ readonly paragraphs?: readonly {+ readonly inlines?: readonly ({ readonly kind: "text"; readonly text: string } | { readonly kind: "break" })[];+ }[];+ };}[];};+function textOf(document: NonNullable<NonNullable<TypographyTrackProgram["items"]>[number]["document"]>): string {+ return (document.paragraphs ?? []).map((paragraph) => (paragraph.inlines ?? [])+ .map((inline) => inline.kind === "text" ? inline.text : " ")+ .join(""))+ .join(" ")+ .replace(/\s+/gu, " ")+ .trim();+}++type CaptionPlanValue = {+ readonly runs?: readonly {+ readonly cues?: readonly { readonly id: string; readonly atomIds: readonly string[] }[];+ }[];+};++type CaptionDisplayValue = {+ readonly atoms?: readonly { readonly id: string; readonly wordIds: readonly string[] }[];+ readonly words?: readonly { readonly id: string; readonly text: string }[];+};+function projectText(context: StudioAdapterContext): readonly StudioEntityDraft[] {const program = sameSurfaceValue(context, "program") as TypographyTrackProgram | undefined;if (program?.items === undefined) return context.generic();@@ -22,11 +47,45 @@ function projectText(context: StudioAdapterContext): readonly StudioEntityDraft[return childEntities(context, items, "typography-item", "text").map((entity, index) => {const item = items[index];if (item === undefined) return entity;+ const document = program.items?.[index]?.document;+ const label = document === undefined ? "" : textOf(document);const temporal = itemTemporalLineage({runtimeId: item.id, span: item,...(context.placement === undefined ? {} : { placement: context.placement }),});- return temporal === undefined ? entity : { ...entity, temporal };+ const named = label.length === 0 ? entity : { ...entity, label };+ return temporal === undefined ? named : { ...named, temporal };+ });+}++function projectCaption(context: StudioAdapterContext): readonly StudioEntityDraft[] {+ const planRef = context.track.trace.references.find((reference) => reference.type === "CaptionPlan")?.ref;+ const displayRef = context.track.trace.references.find((reference) => reference.type === "CaptionDisplaySequence")?.ref;+ const plan = planRef === undefined ? undefined : context.values.get(planRef) as CaptionPlanValue | undefined;+ const display = displayRef === undefined ? undefined : context.values.get(displayRef) as CaptionDisplayValue | undefined;+ if (plan?.runs === undefined || display?.atoms === undefined || display.words === undefined) return context.generic();+ const atoms = new Map(display.atoms.map((atom) => [atom.id, atom] as const));+ const words = new Map(display.words.map((word) => [word.id, word.text] as const));+ const spans = new Map(context.spans.map((span) => [span.id, span] as const));+ return plan.runs.flatMap((run) => run.cues ?? []).flatMap((cue): readonly StudioEntityDraft[] => {+ const span = spans.get(cue.id);+ if (span === undefined) return [];+ const label = cue.atomIds.flatMap((atomId) => atoms.get(atomId)?.wordIds ?? [])+ .flatMap((wordId) => words.get(wordId) ?? [])+ .join(" ");+ return [{+ id: `${context.track.outputRef}:entity:${cue.id}`,+ authoredId: context.placement?.id ?? cue.id,+ label: label.length === 0 ? cue.id : label,+ startFrame: span.startFrame,+ endFrameExclusive: span.endFrameExclusive,+ stackOrder: span.stackOrder,+ ...(context.placement === undefined ? {} : { elementRange: context.placement.range }),+ presentId: span.id,+ renderIds: [span.id],+ presentation: { entity: "caption-cue", shape: "text", depth: 0 },+ interaction: readonlyInteraction,+ }];});}@@ -41,11 +100,11 @@ export const genericAdapters: readonly StudioAdapter[] = [{id: "caption", role: "caption", output: { type: "VisualTrack", surface: "track", modules: ["@hypit/caption-fine"] },family: "caption", icon: "captions", interaction: readonlyInteraction,- dependencies: [{ type: "CaptionPlan", role: "caption-plan" }],+ dependencies: [{ type: "CaptionPlan", role: "caption-plan" }], project: projectCaption,},{id: "component", role: "track",- output: { type: "VisualTrack", modules: ["@hypit/ranking", "@hypit/comment-sticker", "@hypit/screen-overlay", "@hypit/deck-track"] },+ output: { type: "VisualTrack", modules: ["@hypit/ranking", "@hypit/comment-sticker", "@hypit/screen-overlay"] },family: "component", icon: "component", interaction: readonlyInteraction,},{ id: "audio-fallback", role: "track", output: { type: "AudioTrack" }, family: "audio", icon: "waveform", interaction: readonlyInteraction },diff --git a/packages/studio/src/adapters/media.ts b/packages/studio/src/adapters/media.tsindex ebb850d2..8f63ff01 100644--- a/packages/studio/src/adapters/media.ts+++ b/packages/studio/src/adapters/media.ts@@ -3,17 +3,50 @@ import { childEntities, readonlyInteraction, sameSurfaceValue } from "./types.jsimport { itemTemporalLineage } from "./temporal.js";type MediaTrackProgramValue = {- readonly items?: readonly { readonly id: string; readonly span: { readonly startFrame: number; readonly endFrameExclusive: number }; readonly stacking: { readonly order: number } }[];- readonly sequences?: readonly { readonly id: string; readonly span: { readonly startFrame: number; readonly endFrameExclusive: number }; readonly stacking: { readonly order: number } }[];+ readonly items?: readonly {+ readonly id: string;+ readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };+ readonly stacking: { readonly order: number };+ readonly layers?: readonly MediaLayerValue[];+ }[];+ readonly sequences?: readonly {+ readonly id: string;+ readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };+ readonly stacking: { readonly order: number };+ readonly members?: readonly { readonly layers?: readonly MediaLayerValue[] }[];+ }[];};+type MediaLayerValue = {+ readonly kind?: string;+ readonly source?: {+ readonly kind?: string;+ readonly artifact?: { readonly digest?: string; readonly mediaType?: string };+ };+};++function imagePreview(layers: readonly MediaLayerValue[] | undefined): StudioEntityDraft["preview"] {+ const source = layers?.find((layer) => layer.kind === "sample")?.source;+ const artifact = source?.artifact;+ if (source?.kind !== "still" || artifact?.digest === undefined || artifact.mediaType?.startsWith("image/") !== true) {+ return undefined;+ }+ return { kind: "image", url: `/__studio/material/${artifact.digest}` };+}+function projectMedia(context: StudioAdapterContext): readonly StudioEntityDraft[] {const program = sameSurfaceValue(context, "program") as MediaTrackProgramValue | undefined;if (program === undefined) return context.generic();- const items = [...(program.items ?? []), ...(program.sequences ?? [])].map((item) => ({- id: item.id, startFrame: item.span.startFrame, endFrameExclusive: item.span.endFrameExclusive,- stackOrder: item.stacking.order,- }));+ const items = [+ ...(program.items ?? []).map((item) => ({+ id: item.id, startFrame: item.span.startFrame, endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.stacking.order, preview: imagePreview(item.layers),+ })),+ ...(program.sequences ?? []).map((item) => ({+ id: item.id, startFrame: item.span.startFrame, endFrameExclusive: item.span.endFrameExclusive,+ stackOrder: item.stacking.order, preview: imagePreview(item.members?.[0]?.layers),+ })),+ ];return childEntities(context, items, "media-item",context.track.type === "AudioTrack" ? "waveform" : "picture").map((entity, index) => {const item = items[index];@@ -22,7 +55,11 @@ function projectMedia(context: StudioAdapterContext): readonly StudioEntityDraftruntimeId: item.id, span: item,...(context.placement === undefined ? {} : { placement: context.placement }),});- return temporal === undefined ? entity : { ...entity, temporal };+ return {+ ...entity,+ ...(item.preview === undefined || context.track.type === "AudioTrack" ? {} : { preview: item.preview }),+ ...(temporal === undefined ? {} : { temporal }),+ };});}diff --git a/packages/studio/src/adapters/types.ts b/packages/studio/src/adapters/types.tsindex 7199fb64..6799b0c2 100644--- a/packages/studio/src/adapters/types.ts+++ b/packages/studio/src/adapters/types.ts@@ -6,6 +6,7 @@ import type {StudioInteraction,StudioInspectorDescription,StudioLaneDescription,+ StudioMaterialPreview,StudioTimelinePresentation,StudioTemporalLineage,StudioTrackFamily,@@ -44,6 +45,7 @@ export type StudioEntityDraft = {readonly presentation?: StudioTimelinePresentation;readonly interaction?: StudioInteraction;readonly temporal?: StudioTemporalLineage;+ readonly preview?: StudioMaterialPreview;};export type StudioAdapterContext = {diff --git a/packages/studio/src/programme.ts b/packages/studio/src/programme.tsindex 2ba390f6..b4b314d4 100644--- a/packages/studio/src/programme.ts+++ b/packages/studio/src/programme.ts@@ -206,6 +206,29 @@ export async function preview(input: {const stored = selectedValue(executed.state, target.ref);if (stored?.kind === "inline") values.set(target.ref, stored.value);}+ // Author Records are already deterministic inline values from this exact+ // compilation. Studio adapters may need them to name a resolved projection+ // (for example Caption cue text); exposing them here avoids recomputing the+ // domain value or turning a Record into a fake graph target.+ for (const placement of input.source.observations.placements) {+ for (const value of placement.values) {+ const suffixes = [`::record::${value.id}`, `::output::${value.id}`];+ for (const reference of input.projections.flatMap((projection) => projection.trace.references)) {+ if (suffixes.some((suffix) => reference.ref.endsWith(suffix))) values.set(reference.ref, value.value);+ }+ }+ }+ // Script is a raw Surface, so its inline Records are not among the structured+ // element observations above. They are still ordinary Author values from+ // the same compilation and are needed to turn Caption atom ids back into the+ // text the author actually sees.+ for (const record of input.source.compiled.program.records) {+ if (record.value.kind !== "inline") continue;+ if (input.projections.some((projection) => projection.trace.references+ .some((reference) => reference.ref === record.id))) {+ values.set(record.id, record.value.value);+ }+ }const timingCandidateId = satisfactions.get(timingOutput.ref);return {source: input.source,diff --git a/packages/studio/src/shared.ts b/packages/studio/src/shared.tsindex 9348c607..fd57ce3b 100644--- a/packages/studio/src/shared.ts+++ b/packages/studio/src/shared.ts@@ -65,6 +65,12 @@ export type StudioInteraction = {readonly writeback: "source" | "none";};+/** Material Studio can show without inventing a proxy or rerunning a Provider. */+export type StudioMaterialPreview = {+ readonly kind: "image";+ readonly url: string;+};+export type StudioLaneDescription = {readonly layout: "flat" | "nested";readonly boundFacets: boolean;@@ -135,6 +141,8 @@ export type Clip = {readonly stackOrder: number;readonly presentation: StudioTimelinePresentation;readonly temporal?: StudioTemporalLineage;+ /** A real material selected by this Run; absent means Studio draws no fake preview. */+ readonly preview?: StudioMaterialPreview;readonly interaction: StudioInteraction;/** Rendering identities implementing this author entity; optional for non-visual entities. */readonly renderIds: readonly string[];diff --git a/packages/studio/src/studio-registry.ts b/packages/studio/src/studio-registry.tsindex 890e9412..e2a3d4ea 100644--- a/packages/studio/src/studio-registry.ts+++ b/packages/studio/src/studio-registry.ts@@ -1,4 +1,5 @@import { audioAdapters } from "./adapters/audio.js";+import { deckAdapters } from "./adapters/deck.js";import { genericAdapters } from "./adapters/generic.js";import { mediaAdapters } from "./adapters/media.js";import { rankingAdapters } from "./adapters/ranking.js";@@ -14,6 +15,7 @@ export type { StudioEntityDraft, StudioProjectionRole, StudioSpan } from "./adap/** One Studio-local registry. Author packages and Core know nothing about it. */const REGISTRY: readonly StudioAdapter[] = [...rankingAdapters,+ ...deckAdapters,...speechAdapters,...mediaAdapters,...audioAdapters,@@ -148,6 +150,7 @@ export function sealStudioClip(depth: 0,},...(draft.temporal === undefined ? {} : { temporal: draft.temporal }),+ ...(draft.preview === undefined ? {} : { preview: draft.preview }),interaction: draft.interaction ?? fallback.interaction,renderIds: draft.renderIds ?? (draft.presentId === undefined ? [] : [draft.presentId]),};diff --git a/packages/studio/src/style.css b/packages/studio/src/style.cssindex ab243240..b8dbcb51 100644--- a/packages/studio/src/style.css+++ b/packages/studio/src/style.css@@ -1,282 +1,740 @@:root {color-scheme: dark;- --s0: #0b0c0e;- --s1: #131519;- --s2: #1b1e23;- --s3: #252930;- --line: rgba(255, 255, 255, .07);- --edge: rgba(255, 255, 255, .12);- --t1: #eef0f4;- --t2: #a3aab6;- --t3: #6e7783;- --accent: #4d8dff;- --semantic: #f2b544;- --ok: #3ecf8e;- --danger: #ff6b6b;- --source-width: 390px;+ --app: #0f1012;+ --panel: #17181b;+ --panel-raised: #1c1d21;+ --field: #222429;+ --hover: #292b31;+ --line: #292b30;+ --line-strong: #34373d;+ --text: #e7e8eb;+ --text-2: #a4a7ae;+ --text-3: #6f737c;+ --cyan: #00c8d7;+ --cyan-soft: rgba(0, 200, 215, .16);+ --danger: #ff646b;+ --speech: #3e9f8c;+ --media: #5176bd;+ --audio: #b69a58;+ --text-track: #6877aa;+ --caption: #8c66ae;+ --component: #a66e53;+ --source-width: 350px;--workspace-width: 300px;- font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;+ --timeline-height: 390px;+ font: 12px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;}* { box-sizing: border-box; }html, body, #app {- width: 100%; height: 100%; margin: 0; overflow: hidden;- overscroll-behavior: none; background: var(--s0); color: var(--t1);+ width: 100%;+ height: 100%;+ margin: 0;+ overflow: hidden;+ overscroll-behavior: none;+ background: var(--app);+ color: var(--text);}body { cursor: default; }button, [role="button"] { font: inherit; }button { cursor: pointer; }-button:focus-visible, textarea:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }-::selection { background: rgba(77, 141, 255, .3); color: var(--t1); }-*::-webkit-scrollbar { width: 10px; height: 10px; }+button:focus-visible, textarea:focus-visible {+ outline: 1px solid var(--cyan);+ outline-offset: -1px;+}+::selection { background: rgba(0, 200, 215, .27); color: #fff; }+*::-webkit-scrollbar { width: 9px; height: 9px; }*::-webkit-scrollbar-track { background: transparent; }-*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.13); border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }-*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); border: 3px solid transparent; background-clip: padding-box; }+*::-webkit-scrollbar-thumb {+ border: 3px solid transparent;+ border-radius: 10px;+ background: rgba(255, 255, 255, .16);+ background-clip: padding-box;+}+*::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .26); }-.icon, .pane-icon { width: 16px; height: 16px; display: block; flex: none; }-#app { display: flex; flex-direction: column; position: relative; }+.icon, .pane-icon { display: block; width: 16px; height: 16px; flex: none; }+#app { position: relative; display: flex; flex-direction: column; }-/* Chrome ----------------------------------------------------------- */+/* App chrome and four-zone geometry */.topbar {- height: 44px; flex: none; display: grid;- grid-template-columns: minmax(170px, 1fr) minmax(160px, 420px) minmax(170px, 1fr);- align-items: center; gap: 12px; padding: 0 12px;- border-bottom: 1px solid var(--line); background: var(--s1); user-select: none;-}-.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }-.brand-mark { width: 24px; height: 24px; display: grid; place-items: center; }-.brand-mark svg { width: 24px; height: 24px; fill: var(--t1); }-.brand strong { font-size: 13px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }+ height: 38px;+ flex: none;+ display: grid;+ grid-template-columns: minmax(150px, 1fr) minmax(160px, 420px) minmax(150px, 1fr);+ align-items: center;+ padding: 0 12px;+ border-bottom: 1px solid #08090a;+ background: #151619;+ user-select: none;+}+.brand { display: flex; align-items: center; gap: 7px; min-width: 0; }+.brand-mark { width: 21px; height: 21px; display: grid; place-items: center; }+.brand-mark svg { width: 21px; height: 21px; fill: var(--text); }+.brand strong { font-size: 12px; font-weight: 600; letter-spacing: -.01em; }.project-title {- min-width: 0; justify-self: center; max-width: 420px; overflow: hidden;- color: var(--t2); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap;-}-.topbar-right { justify-self: end; min-width: 0; display: flex; align-items: center; gap: 14px; }-.meta { color: var(--t3); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }-.status { display: flex; align-items: center; gap: 6px; color: var(--t3); font-size: 11px; white-space: nowrap; }-.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--t3); }-.status.ok i { background: var(--ok); }-.status.error { color: var(--danger); }-.status.error i { background: var(--danger); }+ min-width: 0;+ justify-self: center;+ overflow: hidden;+ color: #c7c9cf;+ font-size: 12px;+ font-weight: 500;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.topbar-right { justify-self: end; display: flex; align-items: center; min-width: 0; }+.meta {+ color: var(--text-3);+ font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+}+.status { color: var(--text-3); font-size: 11px; }+.status.error { margin-left: 10px; color: var(--danger); }.studio-shell {- flex: 1; min-height: 0; display: grid;- grid-template-columns: var(--source-width) 5px minmax(360px, 1fr);- background: var(--s0); user-select: none;-}-.source-panel, .workspace-panel, .workbench, .preview-row, .preview-panel, .timeline-panel { min-width: 0; min-height: 0; }-.source-panel { display: flex; border-right: 1px solid var(--line); background: var(--s1); }-.workspace-panel { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--s1); }-.workbench { --timeline-height: 330px; display: grid; grid-template-rows: minmax(0, 1fr) 5px var(--timeline-height); overflow: hidden; }-.preview-row { --workspace-width: 300px; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 5px var(--workspace-width); overflow: hidden; }-.preview-panel, .timeline-panel { overflow: hidden; }+ flex: 1;+ min-height: 0;+ display: grid;+ grid-template-rows: minmax(0, 1fr) 8px var(--timeline-height);+ padding: 6px 6px 0;+ background: #0c0d0f;+ user-select: none;+ overflow: hidden;+}+.upper-shell {+ min-width: 0;+ min-height: 0;+ display: grid;+ grid-template-columns: var(--source-width) 8px minmax(320px, 1fr) 8px var(--workspace-width);+ overflow: hidden;+}+.source-panel, .preview-panel, .workspace-panel, .timeline-panel {+ min-width: 0;+ min-height: 0;+ overflow: hidden;+ background: var(--panel);+}+.source-panel, .workspace-panel { display: flex; flex-direction: column; }.pane-heading, .stage-heading {- height: 36px; flex: none; display: flex; align-items: center; justify-content: space-between;- padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--s1);+ height: 36px;+ flex: none;+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0 10px;+ border-bottom: 1px solid var(--line);+ background: var(--panel);}-.pane-title, .stage-title { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--t2); }+.pane-title, .stage-title { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--text-2); }.pane-title > div { min-width: 0; }-.pane-title h2, .stage-title strong { margin: 0; font-size: 12px; font-weight: 600; }-.pane-title span:not(.pane-icon) { display: block; max-width: 260px; overflow: hidden; color: var(--t3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }-.pane-icon { color: var(--t3); }-.icon-button {- width: 28px; height: 28px; display: grid; place-items: center; padding: 0;- border: 0; border-radius: 4px; background: transparent; color: var(--t3);-}-.icon-button:hover { background: var(--s3); color: var(--t1); }+.pane-title h2, .stage-title strong { margin: 0; font-size: 12px; font-weight: 500; }+.pane-title span:not(.pane-icon) {+ display: block;+ max-width: 250px;+ overflow: hidden;+ color: var(--text-3);+ font-size: 11px;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.pane-icon { color: var(--text-3); }+.pane-tabs { height: 100%; display: flex; align-items: stretch; gap: 18px; }+.pane-tab {+ position: relative;+ padding: 0 2px;+ border: 0;+ background: transparent;+ color: var(--text-3);+ font-size: 12px;+}+.pane-tab.active { color: var(--text); }+.pane-tab.active::after {+ content: "";+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ background: var(--cyan);+}+.icon-button, .tool-button {+ width: 28px;+ height: 28px;+ display: grid;+ place-items: center;+ padding: 0;+ border: 0;+ border-radius: 4px;+ background: transparent;+ color: var(--text-3);+}+.icon-button:hover, .tool-button:hover { background: var(--hover); color: var(--text); }+.tool-button.active { background: var(--cyan-soft); color: var(--cyan); }-/* Source ----------------------------------------------------------- */+/* Source */.code { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }.code-actions { display: flex; align-items: center; gap: 5px; }-.code-save-state { color: var(--t3); font-size: 11px; white-space: nowrap; }-.code-save-state.saving, .code-save-state.dirty { color: var(--semantic); }-.code-save-state.saved { color: var(--ok); }+.code-location {+ max-width: 130px;+ overflow: hidden;+ color: var(--text-3);+ font-size: 11px;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.code-save-state { color: var(--text-3); font-size: 11px; white-space: nowrap; }+.code-save-state.saving, .code-save-state.dirty { color: #d0a96c; }+.code-save-state.saved { color: #65b796; }.code-save-state.error { color: var(--danger); }.code-scroll {- position: relative; flex: 1; min-height: 0; overflow: auto;- padding: 10px 10px 42px 0; background: var(--s0);- font: 12px/20px ui-monospace, SFMono-Regular, Menlo, monospace;- user-select: text; cursor: text;+ position: relative;+ flex: 1;+ min-height: 0;+ overflow: auto;+ padding: 10px 10px 42px 0;+ background: #141518;+ font: 11px/19px ui-monospace, SFMono-Regular, Menlo, monospace;+ user-select: text;+ cursor: text;}.code-editor {- display: none; flex: 1; min-height: 0; width: 100%; resize: none; padding: 10px 12px 42px 48px;- border: 0; background: var(--s0); color: var(--t2);- font: 12px/20px ui-monospace, SFMono-Regular, Menlo, monospace;- tab-size: 2; caret-color: var(--accent); outline: none; user-select: text; cursor: text;- white-space: pre; overflow: auto;+ display: none;+ flex: 1;+ min-height: 0;+ width: 100%;+ resize: none;+ overflow: auto;+ padding: 10px 12px 42px 46px;+ border: 0;+ outline: none;+ background: #141518;+ color: #b5b8bf;+ font: 11px/19px ui-monospace, SFMono-Regular, Menlo, monospace;+ tab-size: 2;+ caret-color: var(--cyan);+ user-select: text;+ cursor: text;+ white-space: pre;}.code.is-editing .code-scroll { display: none; }.code.is-editing .code-editor { display: block; }-.code-line { position: relative; display: flex; align-items: flex-start; min-height: 20px; width: max-content; min-width: 100%; }-.code-line .line-number { flex: none; width: 46px; padding-right: 18px; text-align: right; color: #424852; user-select: none; }+.code-line { position: relative; display: flex; align-items: flex-start; width: max-content; min-width: 100%; min-height: 19px; }+.code-line .line-number {+ width: 42px;+ flex: none;+ padding-right: 14px;+ color: #454850;+ text-align: right;+ user-select: none;+}.code-line.bound { cursor: pointer; }-.code-line.bound:hover { background: rgba(255,255,255,.025); }-.code-line .gutter-bar { position: absolute; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--tone, #fff); opacity: .72; pointer-events: none; }+.code-line.bound:hover { background: rgba(255, 255, 255, .025); }+.code-line .gutter-bar {+ position: absolute;+ top: 2px;+ bottom: 2px;+ width: 2px;+ border-radius: 1px;+ background: var(--tone, #fff);+ opacity: .68;+ pointer-events: none;+}.code-line.bound:hover .gutter-bar { opacity: 1; }-.code-line.bound:hover .line-number { color: var(--tone, #fff); }-.code-line code { flex: none; padding-right: 12px; color: #9198a3; font: inherit; white-space: pre; }-.tok-header, .tok-comment { color: #5f6671; font-style: italic; }-.tok-punct { color: #747b86; }-.tok-tag { color: #79a8ec; }-.tok-attr { color: #b995d9; }-.tok-string { color: #79bf93; }-.tok-reference { color: #e88975; }-.tok-marker { color: var(--semantic); font-weight: 600; cursor: pointer; }-.tok-role { color: #dc82a5; }-.tone-0 { --tone: #f2b544; } .tone-1 { --tone: #61b9df; }-.tone-2 { --tone: #79c486; } .tone-3 { --tone: #cb7fb0; }+.code-line.bound:hover .line-number { color: var(--tone, var(--text-2)); }+.code-line code { flex: none; padding-right: 12px; color: #9b9fa8; font: inherit; white-space: pre; }+.tok-header, .tok-comment { color: #5e626b; font-style: italic; }+.tok-punct { color: #777b84; }+.tok-tag { color: #7da5dc; }+.tok-attr { color: #b391c6; }+.tok-string { color: #7db08c; }+.tok-reference { color: #d58b78; }+.tok-marker { color: #76b7c4; font-weight: 500; cursor: pointer; }+.tok-role { color: #c987a2; }+.tone-0 { --tone: #77a6c7; }+.tone-1 { --tone: #6fae9d; }+.tone-2 { --tone: #ad946b; }+.tone-3 { --tone: #a582b3; }.tok-marker.tone-0, .tok-marker.tone-1, .tok-marker.tone-2, .tok-marker.tone-3 {- color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, transparent); border-radius: 3px; padding: 0 1px;+ color: var(--tone);+ background: transparent;}.range-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }-.spoken { position: absolute; z-index: 0; border-radius: 3px; background: rgba(242,181,68,.13); box-shadow: inset 0 0 0 1px rgba(242,181,68,.34); pointer-events: none; }-.range-element { fill: rgba(255,255,255,.05); stroke: rgba(255,255,255,.75); stroke-width: 1.2; }-.range-binding { fill: color-mix(in srgb, var(--tone, var(--semantic)) 9%, transparent); stroke: var(--tone, var(--semantic)); stroke-width: 1.2; }+.spoken { position: absolute; z-index: 0; border-radius: 2px; background: rgba(0, 200, 215, .12); pointer-events: none; }+.range-element { fill: rgba(255, 255, 255, .035); stroke: rgba(255, 255, 255, .64); stroke-width: 1; }+.range-binding { fill: transparent; stroke: var(--tone, var(--cyan)); stroke-width: 1; }-/* Preview ---------------------------------------------------------- */-.stage { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--s0); }-.stage-canvas { color: var(--t3); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }+/* Preview */+.stage { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--panel); }+.stage-canvas { color: var(--text-3); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }.stage-viewport {- flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;- padding: 14px; background: var(--s0);+ flex: 1;+ min-height: 0;+ overflow: hidden;+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 12px;+ background: #111214;}.stage-scaler { position: relative; transform-origin: top left; }-.stage iframe { display: block; border: 0; background: #000; transform-origin: top left; pointer-events: none; box-shadow: 0 0 0 1px var(--edge), 0 18px 50px rgba(0,0,0,.48); }+.stage iframe {+ display: block;+ border: 0;+ background: #000;+ transform-origin: top left;+ pointer-events: none;+ box-shadow: 0 0 0 1px #27292d, 0 10px 34px rgba(0, 0, 0, .35);+}.stage-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }.box { --tone: #fff; }-.box-content { fill: color-mix(in srgb, var(--tone) 7%, transparent); stroke: var(--tone); stroke-width: 2; }-.box-content-guide { fill: none; stroke: color-mix(in srgb, var(--tone) 45%, transparent); stroke-width: 1; stroke-dasharray: 3 4; }-.box-label { fill: var(--tone); font: 600 25px -apple-system, BlinkMacSystemFont, sans-serif; paint-order: stroke; stroke: rgba(0,0,0,.85); stroke-width: 5px; }-.box-elsewhere { opacity: .35; }-.stage-bar { position: relative; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; gap: 2px; border-top: 1px solid var(--line); background: var(--s1); }-.stage-bar button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--t2); }-.stage-bar button:hover { background: var(--s3); color: var(--t1); }-.stage-bar button[data-play] { width: 32px; height: 32px; margin: 0 2px; background: var(--t1); color: var(--s0); border-radius: 50%; }-.stage-bar button[data-play]:hover { background: #fff; }-.stage-time { position: absolute; left: 12px; color: var(--t1); font: 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }+.box-content { fill: transparent; stroke: var(--cyan); stroke-width: 2; }+.box-content-guide { fill: none; stroke: rgba(0, 200, 215, .55); stroke-width: 1; stroke-dasharray: 3 4; }+.box-label {+ fill: #fff;+ font: 500 23px -apple-system, BlinkMacSystemFont, sans-serif;+ paint-order: stroke;+ stroke: rgba(0, 0, 0, .85);+ stroke-width: 5px;+}+.box-elsewhere { opacity: .26; }+.stage-bar {+ position: relative;+ height: 42px;+ flex: none;+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 2px;+ border-top: 1px solid var(--line);+ background: var(--panel);+}+.stage-bar button {+ width: 28px;+ height: 28px;+ display: grid;+ place-items: center;+ padding: 0;+ border: 0;+ border-radius: 4px;+ background: transparent;+ color: #b6b9c0;+}+.stage-bar button:hover { background: var(--hover); color: #fff; }+.stage-bar button[data-play] { width: 30px; height: 30px; color: #f0f1f3; }+.stage-time {+ position: absolute;+ left: 12px;+ color: #c8cbd1;+ font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+ font-variant-numeric: tabular-nums;+}.stage-mute { margin-left: 5px; }-/* Inspector -------------------------------------------------------- */-.workspace-panel { overflow: hidden; }+/* Inspector */.workspace-scroll { flex: 1; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }.workspace-section, .inspector { min-width: 0; }.inspector { display: flex; flex-direction: column; }-.inspector-empty { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px; color: var(--t3); text-align: center; }-.inspector-empty-icon { width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--t3); }-.inspector-empty strong { color: var(--t2); font-size: 12px; font-weight: 600; }-.inspector-empty small { max-width: 200px; margin-top: 5px; color: var(--t3); font-size: 11px; line-height: 1.45; }-.selection-hero { min-width: 0; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 12px 10px; border-bottom: 1px solid var(--line); }-.selection-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; background: var(--s2); color: var(--accent); }+.selection-hero {+ min-width: 0;+ display: grid;+ grid-template-columns: 28px minmax(0, 1fr) auto;+ align-items: center;+ gap: 8px;+ padding: 10px 12px;+ border-bottom: 1px solid var(--line);+}+.selection-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--text-2); }.selection-title { min-width: 0; }-.selection-title strong, .selection-title small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.selection-title strong { color: var(--t1); font-size: 12px; font-weight: 600; }-.selection-title small { margin-top: 2px; color: var(--t3); font-size: 11px; }-.selection-kind { color: var(--t3); font-size: 11px; }-.property-group { min-width: 0; padding: 12px 10px; border-bottom: 1px solid var(--line); }-.property-group h3 { margin: 0 0 6px; color: var(--t3); font-size: 11px; font-weight: 600; }-.property-grid { min-width: 0; display: block; }-.property { min-width: 0; min-height: 30px; display: grid; grid-template-columns: minmax(84px, .8fr) minmax(0, 1.2fr); align-items: center; gap: 10px; border-top: 1px solid var(--line); }-.property:first-child { border-top: 0; }-.property > span { overflow: hidden; color: var(--t3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }-.property > strong { min-width: 0; overflow: hidden; color: var(--t2); font-size: 12px; font-weight: 500; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }+.selection-title strong, .selection-title small {+ display: block;+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.selection-title strong { color: var(--text); font-size: 12px; font-weight: 500; }+.selection-title small { margin-top: 1px; color: var(--text-3); font-size: 11px; }+.selection-kind { color: var(--text-3); font-size: 11px; text-transform: capitalize; }+.property-group { min-width: 0; padding: 11px 12px; border-bottom: 1px solid var(--line); }+.property-group h3 { margin: 0 0 6px; color: #c4c6cc; font-size: 11px; font-weight: 500; }+.property-grid { min-width: 0; }+.property {+ min-width: 0;+ min-height: 30px;+ display: grid;+ grid-template-columns: minmax(76px, .8fr) minmax(0, 1.2fr);+ align-items: center;+ gap: 10px;+}+.property > span {+ overflow: hidden;+ color: var(--text-3);+ font-size: 11px;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.property > strong {+ min-width: 0;+ overflow: hidden;+ color: var(--text-2);+ font-size: 11px;+ font-weight: 400;+ text-align: right;+ text-overflow: ellipsis;+ white-space: nowrap;+ font-variant-numeric: tabular-nums;+}.property-code > strong { font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }-.inspector-notice { margin: 10px; padding: 9px; border-left: 2px solid var(--semantic); background: rgba(242,181,68,.05); }-/* Timeline --------------------------------------------------------- */-.timeline { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--s0); }-.timeline-toolbar { height: 36px; flex: none; display: grid; grid-template-columns: minmax(210px,1fr) auto minmax(210px,1fr); align-items: center; gap: 8px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--line); background: var(--s1); }-.timeline-title, .timeline-view-actions { display: flex; align-items: center; gap: 7px; min-width: 0; }-.timeline-title strong { color: var(--t2); font-size: 12px; font-weight: 600; }-.timeline-mode { display: inline-flex; align-items: center; gap: 5px; margin-left: 3px; color: var(--t3); font-size: 11px; }-.timeline-mode i { width: 5px; height: 5px; border-radius: 50%; background: var(--semantic); }+/* Timeline */+.timeline { height: 100%; min-height: 0; display: flex; flex-direction: column; background: #131417; }+.timeline-toolbar {+ height: 38px;+ flex: none;+ display: grid;+ grid-template-columns: 1fr auto 1fr;+ align-items: center;+ padding: 0 8px;+ border-bottom: 1px solid var(--line);+ background: var(--panel);+}+.timeline-tools, .timeline-view-actions { min-width: 0; display: flex; align-items: center; gap: 3px; }.timeline-view-actions { justify-content: flex-end; }-.timeline-hint { margin-right: 3px; color: var(--t3); font-size: 11px; }-.timeline-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 136px minmax(0,1fr); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }-.timeline-labels { position: sticky; left: 0; z-index: 5; border-right: 1px solid var(--line); background: var(--s1); }-.label-corner { position: sticky; top: 0; z-index: 6; height: 28px; display: flex; align-items: center; justify-content: flex-end; padding-right: 9px; border-bottom: 1px solid var(--line); background: var(--s1); color: var(--t3); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }-.track-label { min-height: 56px; min-width: 0; display: grid; grid-template-columns: 22px minmax(0,1fr) 8px; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--s1); }-.track-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--track); }-.track-icon .icon { width: 16px; height: 16px; }+.timeline-time {+ color: var(--cyan);+ font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+ font-variant-numeric: tabular-nums;+ letter-spacing: .01em;+}+.timeline-body {+ flex: 1;+ min-height: 0;+ display: grid;+ grid-template-columns: 176px minmax(0, 1fr);+ overflow-x: hidden;+ overflow-y: auto;+ overscroll-behavior: contain;+ background: #111215;+}+.timeline-labels {+ position: sticky;+ left: 0;+ z-index: 5;+ border-right: 1px solid var(--line-strong);+ background: #17181b;+}+.label-corner {+ position: sticky;+ top: 0;+ z-index: 7;+ height: 28px;+ display: flex;+ align-items: center;+ justify-content: flex-end;+ padding-right: 8px;+ border-bottom: 1px solid var(--line);+ background: #17181b;+ color: var(--text-3);+ font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+}+.track-label {+ min-width: 0;+ min-height: 52px;+ display: grid;+ grid-template-columns: 20px minmax(0, 1fr) 18px;+ align-items: center;+ gap: 5px;+ padding: 0 7px;+ border-bottom: 1px solid var(--line);+ background: #17181b;+}+.track-icon { width: 20px; height: 20px; display: grid; place-items: center; color: var(--track); }+.track-icon .icon { width: 15px; height: 15px; }.track-copy { min-width: 0; }-.track-copy strong, .track-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.track-copy strong { color: var(--t2); font-size: 12px; font-weight: 500; }-.track-copy small { margin-top: 2px; color: var(--t3); font-size: 11px; }-.track-state { color: var(--semantic); font-size: 11px; }-.track-media { --track: #6f8ff7; } .track-speech { --track: #57c9a5; }-.track-caption { --track: #b07ce8; } .track-component { --track: #f08a5d; }-.track-audio { --track: #d7b95d; } .track-visual, .track-text { --track: #8291a8; }+.track-copy strong, .track-copy small {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.track-copy strong { color: #c8cad0; font-size: 11px; font-weight: 500; }+.track-copy small { margin-top: 1px; color: #62666e; font-size: 11px; }+.track-state { display: grid; place-items: center; }+.track-media { --track: var(--media); }+.track-speech { --track: var(--speech); }+.track-caption { --track: var(--caption); }+.track-component { --track: var(--component); }+.track-audio { --track: var(--audio); }+.track-text { --track: var(--text-track); }+.track-visual { --track: #727882; }.timeline-lanes { position: relative; min-width: 0; cursor: default; user-select: none; touch-action: pan-y; }-.ruler { position: sticky; top: 0; z-index: 4; height: 28px; border-bottom: 1px solid var(--line); background: var(--s1); cursor: ew-resize; overflow: hidden; }-.tick { position: absolute; top: 0; height: 14px; padding-left: 5px; border-left: 1px solid var(--edge); color: var(--t3); font: 11px/14px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }-.tick-last { padding-left: 0; padding-right: 5px; border-right: 1px solid var(--edge); border-left: 0; transform: translateX(-100%); }-.ruler-segment { position: absolute; top: 15px; height: 13px; overflow: hidden; border-left: 1px solid var(--semantic); padding-left: 4px; color: color-mix(in srgb, var(--semantic) 72%, var(--t3)); font-size: 11px; line-height: 13px; white-space: nowrap; }-.lane { position: relative; min-height: 56px; border-bottom: 1px solid var(--line); background: var(--s0); }-.semantic-label { --track: var(--semantic); position: sticky; top: 28px; z-index: 4; align-items: start; padding-top: 12px; background: #19170f; }-.semantic-label .track-copy small { white-space: normal; line-height: 1.25; }-.semantic-lane { position: sticky; top: 28px; z-index: 3; min-height: 96px; overflow: hidden; background: #15140f; box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(0,0,0,.28); }-.semantic-segment { position: absolute; top: 8px; bottom: 8px; min-width: 3px; overflow: hidden; border-left: 1px solid var(--semantic); border-right: 1px solid rgba(242,181,68,.25); background: rgba(242,181,68,.035); color: var(--t1); text-align: left; cursor: pointer; }-.semantic-segment:hover { background: rgba(242,181,68,.075); }-.semantic-segment.live { background: rgba(242,181,68,.09); }-.semantic-segment-label { position: absolute; top: 5px; left: 6px; right: 6px; overflow: hidden; color: var(--semantic); font-size: 11px; font-weight: 600; white-space: nowrap; }-.semantic-words { position: absolute; left: 0; right: 0; top: 28px; bottom: 4px; }-.semantic-word { position: absolute; top: 0; bottom: 0; min-width: 1px; overflow: hidden; padding: 0 4px; border: 0; border-left: 1px solid rgba(242,181,68,.22); background: transparent; color: var(--t2); text-align: left; cursor: pointer; }-.semantic-word:hover { background: rgba(242,181,68,.08); color: var(--t1); }-.semantic-word.current { background: var(--accent); color: #fff; }-.semantic-word-label { display: block; overflow: hidden; font-size: 12px; line-height: 56px; white-space: nowrap; }-.semantic-anchor { position: absolute; bottom: 0; width: 1px; height: 35%; background: rgba(242,181,68,.22); pointer-events: none; }-.semantic-anchor-segment-start, .semantic-anchor-segment-end { top: 5%; bottom: auto; height: 90%; background: rgba(242,181,68,.62); }-.semantic-selection-source { position: absolute; z-index: 4; top: 22px; height: 7px; min-width: 3px; border: 1px solid color-mix(in srgb, var(--tone, var(--semantic)) 72%, #fff); border-bottom: 0; border-radius: 3px 3px 0 0; opacity: .62; pointer-events: none; }-.semantic-moment-source { position: absolute; z-index: 5; top: 20px; width: 7px; height: 7px; margin-left: -4px; border: 1px solid color-mix(in srgb, var(--tone, var(--semantic)) 72%, #fff); background: #15140f; transform: rotate(45deg); opacity: .72; pointer-events: none; }-.semantic-selection-source.linked, .semantic-moment-source.linked { border-color: var(--accent); opacity: 1; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 60%, transparent)); }+.ruler {+ position: sticky;+ top: 0;+ z-index: 6;+ height: 28px;+ overflow: hidden;+ border-bottom: 1px solid var(--line);+ background: #17181b;+ cursor: ew-resize;+}+.tick {+ position: absolute;+ top: 0;+ height: 14px;+ padding-left: 4px;+ border-left: 1px solid #45484e;+ color: #70747c;+ font: 11px/14px ui-monospace, SFMono-Regular, Menlo, monospace;+ white-space: nowrap;+}+.tick-last { padding-right: 4px; padding-left: 0; border-right: 1px solid #45484e; border-left: 0; transform: translateX(-100%); }+.ruler-segment {+ position: absolute;+ top: 15px;+ height: 13px;+ overflow: hidden;+ padding-left: 4px;+ border-left: 1px solid #656970;+ color: #737780;+ font-size: 11px;+ line-height: 13px;+ white-space: nowrap;+}+.lanes { min-height: 100%; }+.lane { position: relative; min-height: 52px; overflow: hidden; border-bottom: 1px solid var(--line); background: #111215; }+.semantic-lane { background: #131a19; }+.semantic-segment {+ position: absolute;+ top: 4px;+ bottom: 4px;+ min-width: 2px;+ overflow: hidden;+ border: 1px solid rgba(86, 162, 146, .34);+ border-radius: 3px;+ background: #1b302c;+ color: #d5ddda;+ text-align: left;+ cursor: pointer;+}+.semantic-segment:hover { background: #203b35; border-color: rgba(97, 178, 160, .52); }+.semantic-segment.live { border-color: rgba(104, 195, 174, .68); }+.semantic-segment-label {+ position: absolute;+ top: 3px;+ left: 5px;+ right: 5px;+ overflow: hidden;+ color: #b3c8c2;+ font-size: 11px;+ font-weight: 500;+ white-space: nowrap;+}+.semantic-words { position: absolute; right: 0; bottom: 3px; left: 0; height: 22px; }+.semantic-word {+ position: absolute;+ top: 0;+ bottom: 0;+ min-width: 1px;+ overflow: hidden;+ padding: 0 3px;+ border: 0;+ border-left: 1px solid rgba(135, 186, 175, .22);+ background: transparent;+ color: #aebcb8;+ text-align: left;+ cursor: pointer;+}+.semantic-word:hover { background: rgba(255, 255, 255, .05); color: #fff; }+.semantic-word.current { background: var(--cyan); color: #071214; }+.semantic-word-label { display: block; overflow: hidden; font-size: 11px; line-height: 22px; white-space: nowrap; }+.semantic-anchor { position: absolute; bottom: 3px; width: 1px; height: 7px; background: rgba(143, 195, 183, .32); pointer-events: none; }+.semantic-anchor-segment-start, .semantic-anchor-segment-end { top: 0; bottom: 0; height: auto; background: rgba(117, 185, 169, .66); }.label-hidden .semantic-word-label, .label-hidden.semantic-segment > .semantic-segment-label { display: none; }-.semantic-coarse .semantic-words, .semantic-coarse .semantic-anchor:not(.semantic-anchor-segment-start):not(.semantic-anchor-segment-end) { display: none; }-.track-fold { margin-left: 4px; padding: 0 3px; border: 0; border-radius: 3px; background: var(--s3); color: var(--t2); font-size: 11px; }-.clip { --track: #8291a8; position: absolute; top: 0; height: 46px; min-width: 2px; margin-top: 5px; overflow: visible; display: flex; align-items: center; padding: 0 7px 0 10px; border: 1px solid var(--line); border-left: 3px solid var(--track); border-radius: 4px; background: var(--s2); color: var(--t2); text-align: left; cursor: pointer; }-.clip:hover { border-color: var(--edge); background: var(--s3); }-.clip.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--t1); }-.clip.live:not(.selected) { border-color: color-mix(in srgb, var(--track) 42%, var(--line)); }-.clip-copy { min-width: 0; display: block; }-.projection-line { position: absolute; z-index: 3; top: -4px; height: 5px; min-width: 2px; border: 1px solid color-mix(in srgb, var(--track) 72%, #fff); border-bottom: 0; border-radius: 3px 3px 0 0; pointer-events: auto; }-.clip-phases { position: absolute; z-index: 1; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }-.clip-phase { position: absolute; bottom: 0; height: 5px; border-left: 1px solid rgba(255,255,255,.22); }-.clip-phase-active { background: color-mix(in srgb, var(--track) 74%, transparent); }-.clip-phase-settled { background: color-mix(in srgb, var(--track) 25%, transparent); }-.clip-phase-preferred { background: transparent; border-top: 1px dashed var(--track); }+.semantic-coarse .semantic-words,+.semantic-coarse .semantic-anchor:not(.semantic-anchor-segment-start):not(.semantic-anchor-segment-end) { display: none; }+.track-fold {+ min-width: 17px;+ height: 17px;+ padding: 0 3px;+ border: 0;+ border-radius: 3px;+ background: #24262a;+ color: #92969e;+ font-size: 11px;+ line-height: 17px;+}+.track-fold:hover { background: #303238; color: #fff; }+.clip {+ --track: #727882;+ position: absolute;+ top: 0;+ height: 42px;+ min-width: 2px;+ margin-top: 5px;+ overflow: hidden;+ display: flex;+ align-items: center;+ padding: 0 7px;+ border: 1px solid color-mix(in srgb, var(--track) 65%, #25272b);+ border-radius: 3px;+ background: color-mix(in srgb, var(--track) 38%, #1b1d20);+ color: #d6d8dc;+ text-align: left;+ cursor: pointer;+}+.clip:hover { filter: brightness(1.09); }+.clip.selected {+ z-index: 4;+ border-color: var(--cyan);+ box-shadow: inset 0 0 0 1px var(--cyan), 0 0 0 1px rgba(0, 200, 215, .22);+ color: #fff;+}+.clip.live:not(.selected) { filter: brightness(1.05); }+.clip-copy { position: relative; z-index: 2; min-width: 0; display: block; }+.clip-material { position: absolute; z-index: 0; inset: 0; pointer-events: none; }+.clip-material-image {+ background-position: center;+ background-size: auto 100%;+ opacity: .7;+}+.clip-material-image::after {+ content: "";+ position: absolute;+ inset: 0;+ background: rgba(8, 10, 12, .28);+}+.clip-phases { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }+.clip-phase { position: absolute; bottom: 0; height: 3px; border-left: 1px solid rgba(255, 255, 255, .17); }+.clip-phase-active, .clip-phase-enter, .clip-phase-exit { background: rgba(255, 255, 255, .24); }+.clip-phase-settled, .clip-phase-body { background: rgba(255, 255, 255, .10); }+.clip-phase-preferred { border-top: 1px dashed rgba(255, 255, 255, .48); background: transparent; }.clip-name, .clip-meta { display: block; overflow: hidden; text-overflow: clip; white-space: nowrap; }-.clip-name { font-size: 12px; font-weight: 500; }-.clip-meta { display: none; margin-top: 2px; color: var(--t3); font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }+.clip-name { font-size: 11px; font-weight: 500; }+.clip-meta {+ display: none;+ margin-top: 2px;+ color: rgba(255, 255, 255, .54);+ font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;+ font-variant-numeric: tabular-nums;+}.clip-wide .clip-meta { display: block; }-.clip-shape-group { background: color-mix(in srgb, var(--track) 7%, var(--s2)); }-.clip-shape-window { height: 24px; margin-top: 16px; border-style: dashed; background: transparent; }-.clip-nested-child { z-index: 2; min-height: 3px; margin-top: 0; padding: 0; border-width: 0 1px 0 2px; border-style: solid; border-color: color-mix(in srgb, var(--track) 45%, var(--line)); border-left-color: var(--track); border-radius: 2px; background: color-mix(in srgb, var(--track) 18%, var(--s2)); }+.clip-media { --track: var(--media); }+.clip-speech { --track: var(--speech); }+.clip-audio { --track: var(--audio); }+.clip-text { --track: var(--text-track); }+.clip-caption { --track: var(--caption); }+.clip-component { --track: var(--component); }+.clip-visual { --track: #727882; }+.clip-facet-audio::after {+ content: "";+ position: absolute;+ z-index: 1;+ right: 7px;+ left: 7px;+ top: 50%;+ height: 1px;+ background: color-mix(in srgb, var(--track) 74%, white);+ opacity: .46;+ pointer-events: none;+}+.clip-facet-audio .clip-copy { transform: translateY(-9px); }+.clip-shape-group {+ border-style: dashed;+ background: color-mix(in srgb, var(--track) 10%, #111215);+}+.clip-shape-group > .clip-copy { align-self: flex-start; margin-top: 4px; }+.clip-shape-group > .clip-copy .clip-meta { display: none; }+.clip-shape-window { height: 22px; margin-top: 15px; border-style: dashed; background: transparent; }+.clip-nested-child {+ z-index: 2;+ min-height: 3px;+ margin-top: 0;+ padding: 0;+ border-width: 0 1px 0 2px;+ border-style: solid;+ border-color: color-mix(in srgb, var(--track) 42%, var(--line));+ border-left-color: var(--track);+ border-radius: 1px;+ background: color-mix(in srgb, var(--track) 24%, #1b1d20);+}.clip-nested-child .clip-copy { display: none; }-.clip-nested-child .projection-line { top: -2px; height: 3px; }.clip-nested-child .clip-phase { height: 100%; opacity: .7; }-.clip-edge { position: absolute; top: 4px; bottom: 4px; width: 4px; background: var(--accent); }-.clip-edge-left { left: 1px; } .clip-edge-right { right: 1px; }-.playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 8; width: 1px; background: var(--accent); pointer-events: none; will-change: transform; }-.playhead-grip { position: absolute; top: 0; left: -4px; width: 9px; height: 7px; border-radius: 0 0 3px 3px; background: var(--accent); }-.timeline-zoom { height: 24px; flex: none; display: flex; align-items: center; padding: 0 8px 0 144px; border-top: 1px solid var(--line); background: var(--s1); }-.zoom { position: relative; width: 100%; height: 8px; border-radius: 4px; background: var(--s0); cursor: pointer; }-.zoom-window { position: absolute; top: 0; height: 8px; min-width: 8px; border: 1px solid var(--edge); border-radius: 4px; background: var(--s3); cursor: grab; }+.projection-overlay {+ position: absolute;+ top: 0;+ left: 0;+ z-index: 3;+ overflow: visible;+ pointer-events: none;+}+.projection-path {+ fill: none;+ stroke: rgba(0, 200, 215, .9);+ stroke-width: 1;+ stroke-dasharray: 4 4;+ vector-effect: non-scaling-stroke;+}+.projection-point { fill: #111215; stroke: var(--cyan); stroke-width: 1.25; vector-effect: non-scaling-stroke; }+.playhead {+ position: absolute;+ top: 0;+ bottom: 0;+ left: 0;+ z-index: 8;+ width: 1px;+ background: var(--cyan);+ pointer-events: none;+ will-change: transform;+}+.playhead.outside { display: none; }+.playhead-grip { position: absolute; top: 0; left: -4px; width: 9px; height: 7px; border-radius: 0 0 3px 3px; background: var(--cyan); }+.timeline-zoom {+ height: 20px;+ flex: none;+ display: flex;+ align-items: center;+ padding: 0 8px 0 184px;+ border-top: 1px solid var(--line);+ background: #17181b;+}+.zoom { position: relative; width: 100%; height: 4px; border-radius: 2px; background: #0f1012; cursor: pointer; }+.zoom-window { position: absolute; top: -1px; height: 6px; min-width: 8px; border-radius: 3px; background: #4a4d54; cursor: grab; }.zoom-window:active { cursor: grabbing; }-.zoom-grip { position: absolute; top: -2px; width: 6px; height: 12px; cursor: ew-resize; }-.zoom-grip-start { left: -2px; } .zoom-grip-end { right: -2px; }+.zoom-grip { position: absolute; top: -3px; width: 7px; height: 12px; cursor: ew-resize; }+.zoom-grip-start { left: -2px; }+.zoom-grip-end { right: -2px; }-/* Resizers and failures ------------------------------------------- */-.handle { position: relative; z-index: 20; background: var(--s0); touch-action: none; }-.handle::after { content: ""; position: absolute; background: transparent; transition: background 100ms ease; }-.handle:hover::after, .handle:focus-visible::after { background: var(--accent); }-.handle-column { width: 5px; cursor: col-resize; }-.handle-column::after { top: 0; bottom: 0; left: 2px; width: 1px; }-.handle-row { height: 5px; cursor: row-resize; }-.handle-row::after { left: 0; right: 0; top: 2px; height: 1px; }-.failure { position: absolute; z-index: 50; left: 50%; bottom: 14px; max-width: min(720px, calc(100vw - 40px)); margin: 0; transform: translateX(-50%); padding: 10px 12px; border: 1px solid rgba(255,107,107,.35); border-radius: 6px; background: #251517; color: #ffc4c7; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; pointer-events: none; }+/* Resizers and errors */+.handle { position: relative; z-index: 20; background: #0c0d0f; touch-action: none; }+.handle::after { content: ""; position: absolute; background: transparent; }+.handle:hover::after, .handle:focus-visible::after { background: var(--cyan); }+.handle-column { width: 8px; cursor: col-resize; }+.handle-column::after { top: 0; bottom: 0; left: 3px; width: 1px; }+.handle-row { height: 8px; cursor: row-resize; }+.handle-row::after { right: 0; left: 0; top: 3px; height: 1px; }+.failure {+ position: absolute;+ z-index: 50;+ right: 16px;+ bottom: 16px;+ max-width: min(680px, calc(100vw - 32px));+ margin: 0;+ padding: 9px 11px;+ border: 1px solid rgba(255, 100, 107, .38);+ border-radius: 4px;+ background: #2a181a;+ color: #ffc1c4;+ font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;+ white-space: pre-wrap;+ pointer-events: none;+}.failure:empty { display: none; }@media (max-width: 920px) {- .meta { display: none; }+ .meta, .topbar-right { display: none; }.topbar { grid-template-columns: 1fr minmax(120px, 1fr); }- .topbar-right { display: none; }- .timeline-hint { display: none; }+ .upper-shell { grid-template-columns: minmax(280px, var(--source-width)) 8px minmax(300px, 1fr); }+ .workspace-handle, .workspace-panel { display: none; }}diff --git a/packages/studio/src/ui/code.ts b/packages/studio/src/ui/code.tsindex 15f949cc..a039a028 100644--- a/packages/studio/src/ui/code.ts+++ b/packages/studio/src/ui/code.ts@@ -79,11 +79,11 @@ export function createCodePane(): CodePane {element.className = "code";element.innerHTML = `<div class="pane-heading code-heading">- <div class="pane-title">- ${icon("code", "pane-icon")}- <div><h2>SVML</h2><span data-path></span></div>+ <div class="pane-tabs" role="tablist" aria-label="Workspace views">+ <button type="button" class="pane-tab active" role="tab" aria-selected="true">SVML</button></div><div class="code-actions">+ <span class="code-location" data-path></span><span class="code-save-state" data-save-state></span><button type="button" class="icon-button code-mode" data-mode aria-label="Edit source" title="Edit source"><span data-mode-icon>${icon("edit")}</span>diff --git a/packages/studio/src/ui/main.ts b/packages/studio/src/ui/main.tsindex 977cf7cf..c3d9e5a6 100644--- a/packages/studio/src/ui/main.ts+++ b/packages/studio/src/ui/main.ts@@ -1,6 +1,6 @@import type { StudioFailure, StudioSnapshot } from "../shared.js";import { createCodePane } from "./code.js";-import { icon, setIcon } from "./icons.js";+import { setIcon } from "./icons.js";import { createHandle } from "./resize.js";import type { Highlight } from "./code.js";import { liveRanges, markerTones, spanAtOffset } from "./markers.js";@@ -16,35 +16,32 @@ app.innerHTML = `<span class="brand-mark" aria-hidden="true"><svg viewBox="0 0 32 32"><path d="M7.6 3.8H14.6L12.6 7.2H5.6L7.6 3.8ZM4.1 10.4H16.6L18.7 7H30.4L27.9 11.1H16.1L14.1 14.2H1.8L4.1 10.4ZM19.1 14.1H23.1L19.3 20.7H15.4L19.1 14.1Z"/></svg></span>- <div><strong>Hypit Studio</strong></div>+ <div><strong>Hypit</strong></div></div><div class="project-title" data-project></div><div class="topbar-right"><div class="meta" data-meta></div>- <div class="status" data-status><i></i><span>Reading…</span></div>+ <div class="status" data-status></div></div></header><main class="studio-shell">- <aside class="source-panel" data-code></aside>- <section class="workbench">- <div class="preview-row">- <div class="preview-panel" data-stage></div>- <aside class="workspace-panel">- <div class="pane-heading workspace-heading">- <div class="pane-title">- ${icon("tune", "pane-icon")}- <div><h2>Inspector</h2><span>Selected item</span></div>- </div>+ <section class="upper-shell">+ <aside class="source-panel" data-code></aside>+ <div class="preview-panel" data-stage></div>+ <aside class="workspace-panel">+ <div class="pane-heading workspace-heading">+ <div class="pane-tabs" role="tablist" aria-label="Inspector views">+ <button type="button" class="pane-tab active" role="tab" aria-selected="true">Properties</button></div>- <div class="workspace-scroll">- <section class="workspace-section">- <div class="inspector" data-inspector></div>- </section>- </div>- </aside>- </div>- <div class="timeline-panel" data-timeline></div>+ </div>+ <div class="workspace-scroll">+ <section class="workspace-section">+ <div class="inspector" data-inspector></div>+ </section>+ </div>+ </aside></section>+ <div class="timeline-panel" data-timeline></div></main><pre class="failure" data-failure></pre>`;@@ -59,30 +56,29 @@ app.querySelector<HTMLElement>("[data-stage]")!.append(stage.element);// The source, picture, workspace and timeline all need different amounts of// room for different jobs, so each boundary is draggable and remembered.const shell = app.querySelector<HTMLElement>(".studio-shell")!;-const workbench = app.querySelector<HTMLElement>(".workbench")!;-const previewRow = app.querySelector<HTMLElement>(".preview-row")!;+const upperShell = app.querySelector<HTMLElement>(".upper-shell")!;const workspacePanel = app.querySelector<HTMLElement>(".workspace-panel")!;const sourceHandle = createHandle({- axis: "column", initial: 390, minimum: 280,- maximum: () => Math.max(320, shell.clientWidth - 760),- apply: (size) => { shell.style.setProperty("--source-width", `${size}px`); },- remember: "hypit-studio.source-width",+ axis: "column", initial: Math.round(window.innerWidth * 0.34), minimum: 280,+ maximum: () => Math.max(360, upperShell.clientWidth - 720),+ apply: (size) => { upperShell.style.setProperty("--source-width", `${size}px`); },+ remember: "hypit-studio.v3.source-width",});sourceHandle.classList.add("source-handle");-shell.insertBefore(sourceHandle, workbench);+upperShell.insertBefore(sourceHandle, app.querySelector<HTMLElement>("[data-stage]")!);const workspaceHandle = createHandle({- axis: "column", initial: 300, minimum: 240, invert: true,- maximum: () => Math.max(260, previewRow.clientWidth - 360),- apply: (size) => { previewRow.style.setProperty("--workspace-width", `${size}px`); },- remember: "hypit-studio.workspace-width",+ axis: "column", initial: Math.round(window.innerWidth * 0.22), minimum: 270, invert: true,+ maximum: () => Math.max(320, upperShell.clientWidth - 680),+ apply: (size) => { upperShell.style.setProperty("--workspace-width", `${size}px`); },+ remember: "hypit-studio.v3.workspace-width",});workspaceHandle.classList.add("workspace-handle");-previewRow.insertBefore(workspaceHandle, workspacePanel);-workbench.insertBefore(createHandle({- axis: "row", initial: 330, minimum: 176, invert: true,- maximum: () => Math.max(220, workbench.clientHeight - 260),- apply: (size) => { workbench.style.setProperty("--timeline-height", `${size}px`); },- remember: "hypit-studio.timeline-height",+upperShell.insertBefore(workspaceHandle, workspacePanel);+shell.insertBefore(createHandle({+ axis: "row", initial: Math.round(window.innerHeight * 0.45), minimum: 220, invert: true,+ maximum: () => Math.max(260, shell.clientHeight - 260),+ apply: (size) => { shell.style.setProperty("--timeline-height", `${size}px`); },+ remember: "hypit-studio.v3.timeline-height",}), app.querySelector<HTMLElement>("[data-timeline]")!);const inspector = app.querySelector<HTMLElement>("[data-inspector]")!;const meta = app.querySelector<HTMLElement>("[data-meta]")!;@@ -134,10 +130,7 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):const clip = clipId === undefined ? undefined : store.clip(clipId);if (clip === undefined) {- const empty = document.createElement("div");- empty.className = "inspector-empty";- empty.innerHTML = `<span class="inspector-empty-icon">${icon("select")}</span><strong>Nothing selected</strong><small>Choose a timeline item, source marker, or object in the preview.</small>`;- inspector.replaceChildren(empty);+ inspector.replaceChildren();return;}@@ -162,63 +155,20 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):property("End", `${clip.endFrameExclusive}f`),property("Duration", `${durationFrames}f`),property("Seconds", `${(durationFrames / fps).toFixed(2)}s`),- ...(clip.temporal?.projection === undefined ? [] : [- property("Projection start", clip.temporal.projection.startExpression, "property-wide property-code"),- property("Projection end", clip.temporal.projection.endExpression, "property-wide property-code"),- ]),- ...(clip.temporal === undefined ? [] : [- property("Temporal source", `${clip.temporal.source.kind}${clip.temporal.source.id === undefined ? "" : ` · ${clip.temporal.source.id}`}`, "property-wide property-code"),- property("Schedule phases", String(clip.temporal.phases.length)),- ]),]);- const identity = group("Binding", [- property("Authored id", clip.authoredId, "property-wide property-code"),- ...(clip.markerId === undefined- ? []- : [property("Script marker", clip.markerId, "property-wide property-code")]),- property("Entity", clip.presentation.entity, "property-wide property-code"),- ...(clip.presentId === undefined- ? []- : [property("Present id", clip.presentId, "property-wide property-code")]),- ]);- const composition = group("Composition", [+ const placement = group("Placement", [property("Track", track?.label ?? "—", "property-wide"),- property("Family", track?.binding.family ?? "—"),- property("Facet", track?.binding.facet ?? "—"),- property("Stack order", String(clip.stackOrder)),- property("Source", track?.provenance.origin ?? "source"),- ]);- const authoring = group("Authoring", [- property("Group", track?.binding.groupId ?? "—", "property-wide property-code"),- property("Surface", track?.binding.authoredTag ?? "—", "property-wide property-code"),- property("Adapter", track?.binding.adapter ?? "—", "property-wide property-code"),- property("Writeback", clip.interaction.writeback),- property("Move / trim", clip.interaction.move || clip.interaction.trimStart || clip.interaction.trimEnd ? "enabled" : "read-only"),- property("Inputs", String(track?.binding.references.length ?? 0)),+ property("Type", track === undefined ? clip.presentation.entity : `${track.binding.family} / ${track.binding.facet}`),+ property("Item", clip.authoredId, "property-wide property-code"),]);- const run = group("Run provenance", [- property("Output", track?.provenance.output ?? "—", "property-wide property-code"),- property("Candidate", track?.provenance.candidateId ?? "—", "property-wide property-code"),- property("Origin", track?.provenance.origin ?? "none"),- property("Status", track?.provenance.status ?? "unresolved"),- ...(track === undefined || track.provenance.errors.length === 0- ? []- : [property("Error", track.provenance.errors.join(" "), "property-wide property-code")]),+ const source = clip.temporal === undefined ? undefined : group("Binding", [+ property("Source", `${clip.temporal.source.kind}${clip.temporal.source.id === undefined ? "" : ` · ${clip.temporal.source.id}`}`, "property-wide property-code"),+ ...(clip.temporal.projection === undefined ? [] : [+ property("From", clip.temporal.projection.startExpression, "property-wide property-code"),+ property("To", clip.temporal.projection.endExpression, "property-wide property-code"),+ ]),]);- const available = {- authoring,- resolved: timing,- material: undefined,- composition,- identity,- run,- } as const;- const sections: HTMLElement[] = [- hero,- ...(track?.binding.inspector.sections ?? ["resolved", "composition", "identity", "run"])- .flatMap((name) => available[name] === undefined ? [] : [available[name]]),- ];- inspector.replaceChildren(...sections);+ inspector.replaceChildren(hero, placement, timing, ...(source === undefined ? [] : [source]));}// The word being spoken at the playhead, which is the point of carrying token@@ -334,8 +284,8 @@ window.addEventListener("keydown", (event) => {function applySnapshot(snapshot: StudioSnapshot): void {failureView.textContent = "";- status.className = "status ok";- status.innerHTML = `<i></i><span>Live · r${snapshot.revision}</span>`;+ status.className = "status";+ status.textContent = "";renderMeta(snapshot);code.show(snapshot);store.load(snapshot);@@ -343,7 +293,7 @@ function applySnapshot(snapshot: StudioSnapshot): void {function applyFailure(failure: StudioFailure): void {status.className = "status error";- status.innerHTML = `<i></i><span>Compile failed · r${failure.revision}</span>`;+ status.textContent = "Compile failed";failureView.textContent = failure.error;if (failure.range !== undefined) code.highlight([{ range: failure.range, tone: "element" }], true);}diff --git a/packages/studio/src/ui/timeline.ts b/packages/studio/src/ui/timeline.tsindex 5e4fc5d3..868de7d4 100644--- a/packages/studio/src/ui/timeline.ts+++ b/packages/studio/src/ui/timeline.ts@@ -1,15 +1,22 @@-import type { SemanticAnchor, SemanticToken, StudioSnapshot } from "../shared.js";+import type {+ SemanticAnchor,+ SemanticToken,+ StudioSnapshot,+ StudioTemporalLineage,+} from "../shared.js";import { icon, setIcon } from "./icons.js";-import { markerTones } from "./markers.js";import type { State, Store } from "./selection.js";import { createZoom } from "./zoom.js";export type Timeline = { readonly element: HTMLElement };-/** Ruler ticks land on whole seconds until that gets too dense, then on 5s / 10s. */+const LANE_HEIGHT = 52;+const opened = new Set<string>();+let speechExpanded = false;+function tickSeconds(durationSec: number, widthPx: number): number {for (const step of [1, 2, 5, 10, 15, 30, 60]) {- if (durationSec / step <= Math.max(2, widthPx / 64)) return step;+ if (durationSec / step <= Math.max(2, widthPx / 72)) return step;}return 120;}@@ -19,57 +26,69 @@ function timecode(seconds: number): string {return `${String(Math.floor(whole / 60)).padStart(2, "0")}:${String(whole % 60).padStart(2, "0")}`;}-/**- * A cutting-room timeline read straight from the Source: the Speech Track on the- * bottom track, every Media Item above it on one shared track, exactly as an- * editor would lay them out.- */-/** One row of one Track. A Track with overlapping clips is several rows tall. */-const LANE_HEIGHT = 56;-const SEMANTIC_HEIGHT = 96;--/** Tracks the reader has opened. A Track shows only its front row until then. */-const opened = new Set<string>();--/**- * Where a frame sits across the strip, once the zoom window is taken into- * account. Everything the timeline draws goes through here, so the ruler, the- * clips and the playhead cannot disagree about where a moment is.- */function place(frame: number, frameCount: number, shown: { start: number; end: number }): number {const span = Math.max(1e-6, shown.end - shown.start);return (frame / Math.max(1, frameCount) - shown.start) / span;}+function displayTrackName(track: StudioSnapshot["tracks"][number]): string {+ if (track.binding.family === "speech") return track.binding.facet === "audio" ? "Voice" : "Picture";+ const base = track.label.replace(/\.(?:track|visual|audio)$/u, "");+ return base.length === 0 ? track.label : base;+}++function sourceWindow(+ snapshot: StudioSnapshot,+ source: StudioTemporalLineage["source"],+): { readonly start: number; readonly end: number } | undefined {+ if (source.kind === "selection") {+ const match = snapshot.semantic.selections.find((item) => item.id === source.id+ && (source.occurrenceId === undefined || source.occurrenceId === item.occurrenceId));+ return match === undefined ? undefined : { start: match.startFrame, end: match.endFrameExclusive };+ }+ if (source.kind === "moment") {+ const match = snapshot.semantic.moments.find((item) => item.id === source.id+ && (source.occurrenceId === undefined || source.occurrenceId === item.occurrenceId));+ return match === undefined ? undefined : { start: match.frame, end: match.frame };+ }+ if (source.kind === "segment") {+ const match = snapshot.semantic.segments.find((item) => item.id === source.id);+ return match === undefined ? undefined : { start: match.startFrame, end: match.endFrameExclusive };+ }+ return undefined;+}++function sourceFrame(+ snapshot: StudioSnapshot,+ source: StudioTemporalLineage["source"],+ endpoint: "start" | "end",+): number | undefined {+ const window = sourceWindow(snapshot, source);+ if (window === undefined) return undefined;+ return endpoint === "start" ? window.start : window.end;+}+export function createTimeline(store: Store): Timeline {const element = document.createElement("section");element.className = "timeline";element.innerHTML = `<div class="timeline-toolbar">- <div class="timeline-title">- ${icon("timeline")}- <strong>Timeline</strong>- <span class="timeline-mode"><i></i>Semantic + frame timebase</span>+ <div class="timeline-tools">+ <button type="button" class="tool-button active" aria-label="Select" title="Select">${icon("select")}</button></div>- <div></div>+ <div class="timeline-time" data-timeline-time>00:00:00</div><div class="timeline-view-actions">- <span class="timeline-hint">⌘ scroll to zoom</span>- <button type="button" class="icon-button" data-zoom-out aria-label="Zoom out" title="Zoom out">- ${icon("minus")}- </button>- <button type="button" class="icon-button" data-zoom-fit aria-label="Fit timeline" title="Fit timeline">- ${icon("fit")}- </button>- <button type="button" class="icon-button" data-zoom-in aria-label="Zoom in" title="Zoom in">- ${icon("plus")}- </button>+ <button type="button" class="icon-button" data-zoom-out aria-label="Zoom out" title="Zoom out">${icon("minus")}</button>+ <button type="button" class="icon-button" data-zoom-fit aria-label="Fit timeline" title="Fit timeline">${icon("fit")}</button>+ <button type="button" class="icon-button" data-zoom-in aria-label="Zoom in" title="Zoom in">${icon("plus")}</button></div></div>- <div class="timeline-body">+ <div class="timeline-body" data-timeline-body><div class="timeline-labels" data-labels></div><div class="timeline-lanes" data-lanes><div class="ruler" data-ruler></div><div class="lanes" data-rows></div>+ <svg class="projection-overlay" data-projection aria-hidden="true"></svg><div class="playhead" data-playhead><div class="playhead-grip"></div></div></div></div>@@ -77,7 +96,11 @@ export function createTimeline(store: Store): Timeline {const labels = element.querySelector<HTMLElement>("[data-labels]")!;const lanes = element.querySelector<HTMLElement>("[data-lanes]")!;- // The whole programme as a bar, with the shown part as a window inside it.+ const ruler = element.querySelector<HTMLElement>("[data-ruler]")!;+ const rows = element.querySelector<HTMLElement>("[data-rows]")!;+ const projectionOverlay = element.querySelector<SVGSVGElement>("[data-projection]")!;+ const playhead = element.querySelector<HTMLElement>("[data-playhead]")!;+ const timelineTime = element.querySelector<HTMLElement>("[data-timeline-time]")!;const zoom = createZoom();element.querySelector<HTMLElement>("[data-zoom]")!.append(zoom.element);element.querySelector<HTMLButtonElement>("[data-zoom-out]")!@@ -86,18 +109,25 @@ export function createTimeline(store: Store): Timeline {.addEventListener("click", () => zoom.pinch(0.5, 0.68));element.querySelector<HTMLButtonElement>("[data-zoom-fit]")!.addEventListener("click", () => zoom.fit());- // Positions are computed against the window rather than scaled, so a clip's- // label stays the size it was however far in the reader has zoomed.- const ruler = element.querySelector<HTMLElement>("[data-ruler]")!;- const rows = element.querySelector<HTMLElement>("[data-rows]")!;- const playhead = element.querySelector<HTMLElement>("[data-playhead]")!;let state: State | undefined;let built = -1;- let clipNodes: readonly { readonly node: HTMLElement; readonly start: number; readonly end: number; readonly id: string }[] = [];- let semanticNodes: readonly { readonly node: HTMLElement; readonly start: number; readonly end: number; readonly kind: "segment" | "word" }[] = [];- let sourceNodes: readonly { readonly node: HTMLElement; readonly id: string; readonly occurrenceId: string }[] = [];let paintFrame = 0;+ let rebuildFrame = 0;+ let projectionKey = "";+ let semanticLane: HTMLElement | undefined;+ let clipNodes: readonly {+ readonly node: HTMLElement;+ readonly start: number;+ readonly end: number;+ readonly id: string;+ }[] = [];+ let semanticNodes: readonly {+ readonly node: HTMLElement;+ readonly start: number;+ readonly end: number;+ readonly kind: "segment" | "word";+ }[] = [];const fps = (snapshot: StudioSnapshot): number =>snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;@@ -105,48 +135,34 @@ export function createTimeline(store: Store): Timeline {const frameAt = (clientX: number): number => {const box = lanes.getBoundingClientRect();if (box.width === 0 || state === undefined) return 0;- // Where the pointer is inside the window that is shown, not inside the- // whole programme; zoomed in, the two are different places.- const across = (clientX - box.left) / box.width;+ const across = Math.max(0, Math.min(1, (clientX - box.left) / box.width));const shown = zoom.window();- const ratio = shown.start + across * (shown.end - shown.start);- return Math.floor(ratio * state.snapshot.space.frameCount);+ return Math.floor((shown.start + across * (shown.end - shown.start)) * state.snapshot.space.frameCount);};const scrub = (event: PointerEvent): void => {- // Capture keeps a drag alive past the edge of the lanes, but it is not- // essential: never let it stop the seek that the author actually asked for.- try { lanes.setPointerCapture(event.pointerId); } catch { /* drag stays local */ }+ try { lanes.setPointerCapture(event.pointerId); } catch { /* pointer remains local */ }store.seek(frameAt(event.clientX), "timeline");};lanes.addEventListener("pointerdown", (event) => {- // A click on a clip selects it; a click on open track or the ruler moves the- // playhead and lets go of whatever was selected, because open track is the- // one place that plainly means "not that one".- if ((event.target as HTMLElement).closest(".clip") !== null) return;+ if ((event.target as HTMLElement).closest(".clip, .semantic-segment, .semantic-word") !== null) return;store.clearSelection();scrub(event);});lanes.addEventListener("pointermove", (event) => {- if (event.buttons === 1 && lanes.hasPointerCapture(event.pointerId)) {- store.seek(frameAt(event.clientX), "timeline");- }+ if (event.buttons === 1 && lanes.hasPointerCapture(event.pointerId)) scrub(event);});const drawRuler = (snapshot: StudioSnapshot): void => {ruler.replaceChildren();- const width = lanes.clientWidth;- const step = tickSeconds(snapshot.space.durationSec, width);+ const step = tickSeconds(snapshot.space.durationSec, lanes.clientWidth);for (let seconds = 0; seconds <= snapshot.space.durationSec; seconds += step) {+ const at = place(seconds * fps(snapshot), snapshot.space.frameCount, zoom.window());+ if (at < 0 || at > 1) continue;const tick = document.createElement("span");- tick.className = "tick";- const frame = seconds * snapshot.space.frameRate.numerator / snapshot.space.frameRate.denominator;- const at = place(frame, snapshot.space.frameCount, zoom.window());+ tick.className = `tick${at > 0.94 ? " tick-last" : ""}`;tick.style.left = `${at * 100}%`;- // A label near the end would hang past the strip and give the panel a- // width nothing occupies, so the last one reads back from its own mark.- if (at > 0.94) tick.classList.add("tick-last");tick.textContent = timecode(seconds);ruler.append(tick);}@@ -163,336 +179,366 @@ export function createTimeline(store: Store): Timeline {}};- const build = (snapshot: StudioSnapshot): void => {- labels.replaceChildren();- rows.replaceChildren();- const nextClipNodes: { node: HTMLElement; start: number; end: number; id: string }[] = [];- const tones = markerTones(snapshot);+ const createTrackLabel = (+ name: string,+ kind: string,+ iconName: string,+ detail: string,+ height = LANE_HEIGHT,+ ): HTMLElement => {+ const label = document.createElement("div");+ label.className = `track-label track-${kind}`;+ label.style.height = `${height}px`;+ label.innerHTML = `<span class="track-icon"></span><span class="track-copy"><strong></strong><small></small></span><span class="track-state"></span>`;+ setIcon(label.querySelector(".track-icon")!, iconName);+ label.querySelector("strong")!.textContent = name;+ label.querySelector("small")!.textContent = detail;+ return label;+ };- const corner = document.createElement("div");- corner.className = "label-corner";- corner.textContent = `${snapshot.space.frameCount}f`;- labels.append(corner);+ const buildSemanticLane = (snapshot: StudioSnapshot): void => {+ if (snapshot.semantic.segments.length === 0) {+ semanticLane = undefined;+ return;+ }+ const label = createTrackLabel(+ "Speech",+ "speech",+ "speech",+ `${snapshot.semantic.segments.length} take${snapshot.semantic.segments.length === 1 ? "" : "s"}`,+ );+ const facets = snapshot.tracks.filter((track) => track.binding.family === "speech").length;+ if (facets > 0) {+ const fold = document.createElement("button");+ fold.type = "button";+ fold.className = "track-fold speech-fold";+ fold.textContent = speechExpanded ? "−" : "+";+ fold.title = speechExpanded ? "Hide picture and voice facets" : "Show picture and voice facets";+ fold.setAttribute("aria-expanded", String(speechExpanded));+ fold.addEventListener("click", (event) => {+ event.stopPropagation();+ speechExpanded = !speechExpanded;+ build(snapshot);+ paint();+ });+ label.querySelector(".track-state")!.append(fold);+ }+ labels.append(label);+ const lane = document.createElement("div");+ lane.className = "lane semantic-lane track-speech";+ lane.style.height = `${LANE_HEIGHT}px`;+ semanticLane = lane;+ const tokensBySegment = new Map<string, SemanticToken[]>();+ for (const token of snapshot.semantic.tokens) {+ const held = tokensBySegment.get(token.segmentId);+ if (held === undefined) tokensBySegment.set(token.segmentId, [token]);+ else held.push(token);+ }+ const anchorsBySegment = new Map<string, SemanticAnchor[]>();+ for (const anchor of snapshot.semantic.anchors) {+ const held = anchorsBySegment.get(anchor.segmentId);+ if (held === undefined) anchorsBySegment.set(anchor.segmentId, [anchor]);+ else held.push(anchor);+ }const nextSemanticNodes: { node: HTMLElement; start: number; end: number; kind: "segment" | "word" }[] = [];- const nextSourceNodes: { node: HTMLElement; id: string; occurrenceId: string }[] = [];- const semanticTextNodes: { node: HTMLElement; label: HTMLElement }[] = [];- if (snapshot.semantic.segments.length > 0) {- const semanticLabel = document.createElement("div");- semanticLabel.className = "track-label semantic-label track-visual";- semanticLabel.style.height = `${SEMANTIC_HEIGHT}px`;- semanticLabel.innerHTML = `- <span class="track-icon">${icon("timeline")}</span>- <span class="track-copy"><strong>Semantic</strong><small></small></span>- <span class="track-state"></span>`;- const semanticSource = snapshot.semantic.provenance.candidateId === undefined- ? "no candidate"- : `${snapshot.semantic.provenance.origin} candidate`;- semanticLabel.querySelector("small")!.textContent =- `${snapshot.semantic.segments.length} segment${snapshot.semantic.segments.length === 1 ? "" : "s"} · ${snapshot.semantic.tokens.length} words · ${snapshot.semantic.provenance.status} · ${semanticSource}`;- labels.append(semanticLabel);-- const semanticLane = document.createElement("div");- semanticLane.className = "lane semantic-lane";- semanticLane.style.height = `${SEMANTIC_HEIGHT}px`;- const tokensBySegment = new Map<string, SemanticToken[]>();- for (const token of snapshot.semantic.tokens) {- const held = tokensBySegment.get(token.segmentId);- if (held === undefined) tokensBySegment.set(token.segmentId, [token]);- else held.push(token);- }- const anchorsBySegment = new Map<string, SemanticAnchor[]>();- for (const anchor of snapshot.semantic.anchors) {- const held = anchorsBySegment.get(anchor.segmentId);- if (held === undefined) anchorsBySegment.set(anchor.segmentId, [anchor]);- else held.push(anchor);- }+ const measured: { node: HTMLElement; label: HTMLElement; segment: boolean }[] = [];- for (const segment of snapshot.semantic.segments) {- const from = place(segment.startFrame, snapshot.space.frameCount, zoom.window());- const to = place(segment.endFrameExclusive, snapshot.space.frameCount, zoom.window());- if (to <= 0 || from >= 1) continue;- const visibleFrom = Math.max(0, from);- const visibleTo = Math.min(1, to);- const node = document.createElement("div");- node.className = "semantic-segment";- node.setAttribute("role", "button");- node.tabIndex = 0;- node.dataset.semanticSegment = segment.id;- node.style.left = `${visibleFrom * 100}%`;- node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;- node.title = `${segment.id} (${segment.startFrame}-${segment.endFrameExclusive}f) · double-click to focus`;- const segmentLabel = document.createElement("span");- segmentLabel.className = "semantic-segment-label";- segmentLabel.textContent = segment.id;- node.append(segmentLabel);- semanticTextNodes.push({ node, label: segmentLabel });- node.addEventListener("pointerdown", (event) => {- event.stopPropagation();- store.seek(segment.startFrame, "timeline");- });- node.addEventListener("dblclick", (event) => {+ for (const segment of snapshot.semantic.segments) {+ const from = place(segment.startFrame, snapshot.space.frameCount, zoom.window());+ const to = place(segment.endFrameExclusive, snapshot.space.frameCount, zoom.window());+ if (to <= 0 || from >= 1) continue;+ const visibleFrom = Math.max(0, from);+ const visibleTo = Math.min(1, to);+ const node = document.createElement("div");+ node.className = "semantic-segment";+ node.tabIndex = 0;+ node.setAttribute("role", "button");+ node.dataset.semanticSegment = segment.id;+ node.style.left = `${visibleFrom * 100}%`;+ node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;+ node.title = `${segment.id} · ${segment.startFrame}-${segment.endFrameExclusive}f`;+ const segmentLabel = document.createElement("span");+ segmentLabel.className = "semantic-segment-label";+ segmentLabel.textContent = segment.id;+ node.append(segmentLabel);+ measured.push({ node, label: segmentLabel, segment: true });+ node.addEventListener("pointerdown", (event) => {+ event.stopPropagation();+ store.seek(segment.startFrame, "timeline");+ });+ node.addEventListener("dblclick", (event) => {+ event.stopPropagation();+ zoom.focus(+ segment.startFrame / Math.max(1, snapshot.space.frameCount),+ segment.endFrameExclusive / Math.max(1, snapshot.space.frameCount),+ );+ });+ node.addEventListener("keydown", (event) => {+ if (event.key !== "Enter" && event.key !== " ") return;+ event.preventDefault();+ store.seek(segment.startFrame, "timeline");+ });+ nextSemanticNodes.push({ node, start: segment.startFrame, end: segment.endFrameExclusive, kind: "segment" });++ const words = document.createElement("div");+ words.className = "semantic-words";+ for (const token of tokensBySegment.get(segment.id) ?? []) {+ const wordFrom = place(token.startFrame, snapshot.space.frameCount, zoom.window());+ const wordTo = place(token.endFrameExclusive, snapshot.space.frameCount, zoom.window());+ if (wordTo <= 0 || wordFrom >= 1) continue;+ const word = document.createElement("button");+ word.type = "button";+ word.className = "semantic-word";+ word.dataset.semanticToken = token.id;+ const span = Math.max(1e-6, visibleTo - visibleFrom);+ const clippedFrom = Math.max(visibleFrom, wordFrom);+ const clippedTo = Math.min(visibleTo, wordTo);+ word.style.left = `${Math.max(0, clippedFrom - visibleFrom) / span * 100}%`;+ word.style.width = `${Math.max(0, clippedTo - clippedFrom) / span * 100}%`;+ word.title = `${token.text} · ${token.startFrame}-${token.endFrameExclusive}f`;+ const text = document.createElement("span");+ text.className = "semantic-word-label";+ text.textContent = token.text;+ word.append(text);+ measured.push({ node: word, label: text, segment: false });+ word.addEventListener("pointerdown", (event) => {event.stopPropagation();- store.seek(segment.startFrame, "timeline");- zoom.focus(- segment.startFrame / Math.max(1, snapshot.space.frameCount),- segment.endFrameExclusive / Math.max(1, snapshot.space.frameCount),- );- });- node.addEventListener("keydown", (event) => {- if (event.key !== "Enter" && event.key !== " ") return;- event.preventDefault();- store.seek(segment.startFrame, "timeline");+ store.seek(token.startFrame, "timeline");});- nextSemanticNodes.push({ node, start: segment.startFrame, end: segment.endFrameExclusive, kind: "segment" });-- const words = document.createElement("div");- words.className = "semantic-words";- for (const token of tokensBySegment.get(segment.id) ?? []) {- const wordFrom = place(token.startFrame, snapshot.space.frameCount, zoom.window());- const wordTo = place(token.endFrameExclusive, snapshot.space.frameCount, zoom.window());- if (wordTo <= 0 || wordFrom >= 1) continue;- const word = document.createElement("button");- word.type = "button";- word.className = "semantic-word";- word.dataset.semanticToken = token.id;- const segmentVisibleSpan = Math.max(1e-6, visibleTo - visibleFrom);- const wordVisibleFrom = Math.max(visibleFrom, wordFrom);- const wordVisibleTo = Math.min(visibleTo, wordTo);- word.style.left = `${Math.max(0, wordVisibleFrom - visibleFrom) / segmentVisibleSpan * 100}%`;- word.style.width = `${Math.max(0, wordVisibleTo - wordVisibleFrom) / segmentVisibleSpan * 100}%`;- word.title = `${token.text} (${token.startFrame}-${token.endFrameExclusive}f)`;- const wordLabel = document.createElement("span");- wordLabel.className = "semantic-word-label";- wordLabel.textContent = token.text;- word.append(wordLabel);- semanticTextNodes.push({ node: word, label: wordLabel });- word.addEventListener("pointerdown", (event) => {- event.stopPropagation();- store.seek(token.startFrame, "timeline");- });- nextSemanticNodes.push({ node: word, start: token.startFrame, end: token.endFrameExclusive, kind: "word" });- words.append(word);- }- node.append(words);-- for (const anchor of anchorsBySegment.get(segment.id) ?? []) {- const at = place(anchor.frame, snapshot.space.frameCount, zoom.window());- if (at < from || at > to) continue;- const tick = document.createElement("span");- tick.className = `semantic-anchor semantic-anchor-${anchor.kind}`;- tick.style.left = `${(at - from) / Math.max(1e-6, to - from) * 100}%`;- tick.title = `${anchor.kind} · ${anchor.frame}f`;- node.append(tick);- }- semanticLane.append(node);+ nextSemanticNodes.push({ node: word, start: token.startFrame, end: token.endFrameExclusive, kind: "word" });+ words.append(word);}- for (const selection of snapshot.semantic.selections) {- const from = place(selection.startFrame, snapshot.space.frameCount, zoom.window());- const to = place(selection.endFrameExclusive, snapshot.space.frameCount, zoom.window());- if (to <= 0 || from >= 1) continue;- const node = document.createElement("span");- node.className = "semantic-selection-source";- node.style.left = `${Math.max(0, from) * 100}%`;- node.style.width = `${Math.max(0, Math.min(1, to) - Math.max(0, from)) * 100}%`;- node.title = `Selection ${selection.occurrenceId} · ${selection.startFrame}-${selection.endFrameExclusive}f`;- const tone = tones.get(selection.id);- if (tone !== undefined) node.classList.add(`tone-${tone}`);- semanticLane.append(node);- nextSourceNodes.push({ node, id: selection.id, occurrenceId: selection.occurrenceId });+ node.append(words);++ for (const anchor of anchorsBySegment.get(segment.id) ?? []) {+ const at = place(anchor.frame, snapshot.space.frameCount, zoom.window());+ if (at < from || at > to) continue;+ const tick = document.createElement("span");+ tick.className = `semantic-anchor semantic-anchor-${anchor.kind}`;+ tick.style.left = `${(at - from) / Math.max(1e-6, to - from) * 100}%`;+ node.append(tick);}- for (const moment of snapshot.semantic.moments) {- const at = place(moment.frame, snapshot.space.frameCount, zoom.window());- if (at < 0 || at > 1) continue;- const node = document.createElement("span");- node.className = "semantic-moment-source";- node.style.left = `${at * 100}%`;- node.title = `Moment ${moment.occurrenceId} · ${moment.frame}f`;- const tone = tones.get(moment.id);- if (tone !== undefined) node.classList.add(`tone-${tone}`);- semanticLane.append(node);- nextSourceNodes.push({ node, id: moment.id, occurrenceId: moment.occurrenceId });+ lane.append(node);+ }+ rows.append(lane);+ semanticNodes = nextSemanticNodes;+ requestAnimationFrame(() => {+ for (const item of measured) {+ item.node.classList.toggle("label-hidden", item.label.scrollWidth + 6 > item.label.clientWidth);+ if (item.segment) item.node.classList.toggle("semantic-coarse", item.node.clientWidth < 92);}- rows.append(semanticLane);- // Widths are only meaningful after the lane has entered the document.- // Hide labels that cannot fit in full; a clipped word remains a useful- // coloured timing block and never becomes an ugly ellipsis.- requestAnimationFrame(() => {- for (const item of semanticTextNodes) {- item.node.classList.toggle("label-hidden", item.label.scrollWidth > item.label.clientWidth);- if (!item.node.classList.contains("semantic-segment")) continue;- // At the whole-programme view a Segment is the useful unit. Once it- // has enough physical width, its words become a real sub-lane, like a- // Pattern Clip opening into FL Studio's piano roll.- item.node.classList.toggle("semantic-coarse", item.node.clientWidth < 88);- }+ });+ };++ const buildTrack = (+ snapshot: StudioSnapshot,+ track: StudioSnapshot["tracks"][number],+ nextClipNodes: { node: HTMLElement; start: number; end: number; id: string }[],+ ): void => {+ const kind = track.binding.family;+ const freeFrom: number[] = [];+ const rowOf = new Map<string, number>();+ const roots = track.clips.filter((clip) => clip.presentation.parentId === undefined);+ const childrenByParent = new Map<string, typeof track.clips>();+ for (const clip of track.clips) {+ const parentId = clip.presentation.parentId;+ if (parentId !== undefined) childrenByParent.set(parentId, [...(childrenByParent.get(parentId) ?? []), clip]);+ }+ for (const clip of [...roots].sort((a, b) => b.stackOrder - a.stackOrder || a.startFrame - b.startFrame)) {+ let row = freeFrom.findIndex((free) => free <= clip.startFrame);+ if (row < 0) { row = freeFrom.length; freeFrom.push(0); }+ freeFrom[row] = clip.endFrameExclusive;+ rowOf.set(clip.id, row);+ }+ for (const clip of track.clips) {+ const parentId = clip.presentation.parentId;+ if (parentId !== undefined) rowOf.set(clip.id, rowOf.get(parentId) ?? 0);+ }+ const depth = Math.max(1, freeFrom.length);+ const folded = depth > 1 && !opened.has(track.id);+ const shownRows = folded ? 1 : depth;+ const nestedItems = track.clips.filter((clip) => clip.presentation.parentId !== undefined).length;+ const displayedItems = nestedItems > 0 ? nestedItems : track.clips.length;+ const label = createTrackLabel(+ displayTrackName(track),+ kind,+ track.binding.icon,+ `${displayedItems} item${displayedItems === 1 ? "" : "s"}`,+ shownRows * LANE_HEIGHT,+ );+ label.classList.add(`track-facet-${track.binding.facet}`);+ if (depth > 1) {+ const fold = document.createElement("button");+ fold.type = "button";+ fold.className = "track-fold";+ fold.textContent = folded ? `+${depth - 1}` : "−";+ fold.title = folded ? `Show ${depth} rows` : "Collapse rows";+ fold.setAttribute("aria-expanded", String(!folded));+ fold.addEventListener("click", (event) => {+ event.stopPropagation();+ if (opened.has(track.id)) opened.delete(track.id);+ else opened.add(track.id);+ build(snapshot);+ paint();});+ label.querySelector(".track-state")!.append(fold);}+ labels.append(label);- for (const track of snapshot.tracks) {- const kind = track.binding.family;- const label = document.createElement("div");- label.className = `track-label track-${kind}`;- label.innerHTML = `<span class="track-icon"></span><span class="track-copy"><strong></strong><small></small></span><span class="track-state"></span>`;- setIcon(label.querySelector(".track-icon")!, track.binding.icon);- label.querySelector("strong")!.textContent = track.label;- label.querySelector("small")!.textContent =- `${track.clips.length} clip${track.clips.length === 1 ? "" : "s"}`;- label.querySelector(".track-state")!.textContent = "";- labels.append(label);-- // Clips that overlap in time cannot share a row without hiding each- // other, so a Track is as many rows tall as it needs. A board's panel- // runs the whole programme and its rows settle underneath it.- // Packed by what is in front: the topmost row holds whatever is drawn over- // everything else, so a folded Track shows the picture the viewer sees.- const freeFrom: number[] = [];- const rowOf = new Map<string, number>();- const roots = track.clips.filter((clip) => clip.presentation.parentId === undefined);- const childrenByParent = new Map<string, typeof track.clips>();- for (const clip of track.clips) {- const parentId = clip.presentation.parentId;- if (parentId === undefined) continue;- childrenByParent.set(parentId, [...(childrenByParent.get(parentId) ?? []), clip]);- }- const ordered = [...roots].sort((a, b) =>- b.stackOrder - a.stackOrder || a.startFrame - b.startFrame);- for (const clip of ordered) {- let row = freeFrom.findIndex((free) => free <= clip.startFrame);- if (row < 0) { row = freeFrom.length; freeFrom.push(0); }- freeFrom[row] = clip.endFrameExclusive;- rowOf.set(clip.id, row);+ const lane = document.createElement("div");+ lane.className = `lane track-${kind} track-facet-${track.binding.facet}`;+ lane.style.height = `${shownRows * LANE_HEIGHT}px`;+ for (const clip of track.clips) {+ const from = place(clip.startFrame, snapshot.space.frameCount, zoom.window());+ const to = place(clip.endFrameExclusive, snapshot.space.frameCount, zoom.window());+ if (to <= 0 || from >= 1) continue;+ const row = rowOf.get(clip.id) ?? 0;+ if (folded && row > 0) continue;+ const visibleFrom = Math.max(0, from);+ const visibleTo = Math.min(1, to);+ const node = document.createElement("button");+ node.type = "button";+ node.className = `clip clip-${kind} clip-facet-${track.binding.facet} clip-shape-${clip.presentation.shape}`;+ node.dataset.clip = clip.id;+ node.style.left = `${visibleFrom * 100}%`;+ node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;+ const parentId = clip.presentation.parentId;+ if (parentId === undefined) {+ node.style.top = `${row * LANE_HEIGHT}px`;+ } else {+ const siblings = childrenByParent.get(parentId) ?? [];+ const index = Math.max(0, siblings.findIndex((candidate) => candidate.id === clip.id));+ const slot = 34 / Math.max(1, siblings.length);+ node.classList.add("clip-nested-child");+ node.style.top = `${row * LANE_HEIGHT + 9 + index * slot}px`;+ node.style.height = `${Math.max(3, slot - 2)}px`;}- // Child entities are drawn inside their registered parent entity. They- // describe its internal semantic windows and must not manufacture extra- // Track rows merely because their resolved spans overlap the parent.- for (const clip of track.clips) {- const parentId = clip.presentation.parentId;- if (parentId !== undefined) rowOf.set(clip.id, rowOf.get(parentId) ?? 0);+ node.title = `${clip.label} · ${clip.startFrame}-${clip.endFrameExclusive}f`;+ node.innerHTML = `<span class="clip-material" aria-hidden="true"></span><span class="clip-phases"></span><span class="clip-copy"><span class="clip-name"></span><span class="clip-meta"></span></span>`;+ const material = node.querySelector<HTMLElement>(".clip-material")!;+ if (clip.preview?.kind === "image") {+ material.classList.add("clip-material-image");+ material.style.backgroundImage = `url(${JSON.stringify(clip.preview.url)})`;}- const depth = Math.max(1, freeFrom.length);- const folded = depth > 1 && !opened.has(track.id);- const shownRows = folded ? 1 : depth;- label.style.height = `${shownRows * LANE_HEIGHT}px`;- if (depth > 1) {- const fold = document.createElement("button");- fold.type = "button";- fold.className = "track-fold";- fold.textContent = folded ? `+${depth - 1}` : "\u2212";- fold.title = folded ? `Show all ${depth} rows` : "Show only what is in front";- fold.setAttribute("aria-expanded", String(!folded));- fold.addEventListener("click", (event) => {- event.stopPropagation();- if (opened.has(track.id)) opened.delete(track.id);- else opened.add(track.id);- build(snapshot);- paint();- });- label.querySelector("small")!.append(fold);+ const phaseLayer = node.querySelector<HTMLElement>(".clip-phases")!;+ for (const phase of clip.temporal?.phases ?? []) {+ if (phase.endFrameExclusive <= clip.startFrame || phase.startFrame >= clip.endFrameExclusive) continue;+ const phaseNode = document.createElement("span");+ phaseNode.className = `clip-phase clip-phase-${phase.role}`;+ phaseNode.style.left = `${(phase.startFrame - clip.startFrame) / Math.max(1, clip.endFrameExclusive - clip.startFrame) * 100}%`;+ phaseNode.style.width = `${(phase.endFrameExclusive - phase.startFrame) / Math.max(1, clip.endFrameExclusive - clip.startFrame) * 100}%`;+ phaseLayer.append(phaseNode);}+ node.querySelector(".clip-name")!.textContent = clip.label;+ node.querySelector(".clip-meta")!.textContent = `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;+ node.addEventListener("pointerdown", (event) => {+ event.stopPropagation();+ if (clip.interaction.select) store.focus(frameAt(event.clientX), clip.id, "timeline");+ });+ nextClipNodes.push({ node, start: clip.startFrame, end: clip.endFrameExclusive, id: clip.id });+ lane.append(node);+ requestAnimationFrame(() => node.classList.toggle("clip-wide", node.clientWidth >= 110));+ }+ rows.append(lane);+ };- const lane = document.createElement("div");- lane.className = `lane track-${kind}`;- lane.style.height = `${shownRows * LANE_HEIGHT}px`;- for (const clip of track.clips) {- const from = place(clip.startFrame, snapshot.space.frameCount, zoom.window());- const to = place(clip.endFrameExclusive, snapshot.space.frameCount, zoom.window());- if (to <= 0 || from >= 1) continue;- const node = document.createElement("button");- node.type = "button";- node.className = `clip clip-${kind} clip-shape-${clip.presentation.shape}`;- node.dataset.clip = clip.id;- const visibleFrom = Math.max(0, from);- const visibleTo = Math.min(1, to);- node.style.left = `${visibleFrom * 100}%`;- const row = rowOf.get(clip.id) ?? 0;- if (folded && row > 0) continue;- const parentId = clip.presentation.parentId;- if (parentId === undefined) {- node.style.top = `${row * LANE_HEIGHT}px`;- } else {- const siblings = childrenByParent.get(parentId) ?? [];- const index = Math.max(0, siblings.findIndex((candidate) => candidate.id === clip.id));- const slot = 38 / Math.max(1, siblings.length);- node.classList.add("clip-nested-child");- node.style.top = `${row * LANE_HEIGHT + 8 + index * slot}px`;- node.style.height = `${Math.max(3, slot - 2)}px`;- }- node.style.width = `${Math.max(0, visibleTo - visibleFrom) * 100}%`;- node.title = `${clip.label} (${clip.startFrame}-${clip.endFrameExclusive}f)`;- node.innerHTML = `- <span class="clip-phases"></span>- ${clip.interaction.trimStart ? '<span class="clip-edge clip-edge-left"></span>' : ""}- <span class="clip-copy"><span class="clip-name"></span><span class="clip-meta"></span></span>- ${clip.interaction.trimEnd ? '<span class="clip-edge clip-edge-right"></span>' : ""}`;- const projection = clip.temporal?.projection;- if (projection !== undefined) {- const projectionFrom = place(projection.startFrame, snapshot.space.frameCount, zoom.window());- const projectionTo = place(projection.endFrameExclusive, snapshot.space.frameCount, zoom.window());- if (projectionTo > 0 && projectionFrom < 1) {- const line = document.createElement("span");- line.className = "projection-line";- line.style.left = `${(Math.max(0, projectionFrom) - visibleFrom) / Math.max(1e-6, visibleTo - visibleFrom) * 100}%`;- line.style.width = `${(Math.min(1, projectionTo) - Math.max(0, projectionFrom)) / Math.max(1e-6, visibleTo - visibleFrom) * 100}%`;- line.title = `${projection.startExpression} → ${projection.endExpression} · ${projection.startFrame}-${projection.endFrameExclusive}f`;- node.append(line);- }- }- const phaseLayer = node.querySelector<HTMLElement>(".clip-phases")!;- for (const phase of clip.temporal?.phases ?? []) {- if (phase.endFrameExclusive <= clip.startFrame || phase.startFrame >= clip.endFrameExclusive) continue;- const phaseNode = document.createElement("span");- phaseNode.className = `clip-phase clip-phase-${phase.role}`;- phaseNode.style.left = `${(phase.startFrame - clip.startFrame) / Math.max(1, clip.endFrameExclusive - clip.startFrame) * 100}%`;- phaseNode.style.width = `${(phase.endFrameExclusive - phase.startFrame) / Math.max(1, clip.endFrameExclusive - clip.startFrame) * 100}%`;- phaseNode.title = `${phase.label} · ${phase.startFrame}-${phase.endFrameExclusive}f`;- phaseLayer.append(phaseNode);- }- node.querySelector(".clip-name")!.textContent = clip.label;- node.querySelector(".clip-meta")!.textContent =- `${((clip.endFrameExclusive - clip.startFrame) / fps(snapshot)).toFixed(2)}s`;- if (from < 0) node.classList.add("clipped-left");- if (to > 1) node.classList.add("clipped-right");- // Same tone as the Script marker this clip is named after.- const tone = tones.get(clip.authoredId);- if (tone !== undefined) node.classList.add(`tone-${tone}`);- node.addEventListener("pointerdown", (event) => {- event.stopPropagation();- if (!clip.interaction.select) return;- store.focus(frameAt(event.clientX), clip.id, "timeline");- });- nextClipNodes.push({ node, start: clip.startFrame, end: clip.endFrameExclusive, id: clip.id });- lane.append(node);- requestAnimationFrame(() => node.classList.toggle("clip-wide", node.clientWidth >= 120));- }- rows.append(lane);+ const build = (snapshot: StudioSnapshot): void => {+ labels.replaceChildren();+ rows.replaceChildren();+ projectionOverlay.replaceChildren();+ projectionKey = "";+ semanticNodes = [];+ const corner = document.createElement("div");+ corner.className = "label-corner";+ corner.textContent = `${snapshot.space.frameCount}f`;+ labels.append(corner);+ buildSemanticLane(snapshot);+ const nextClipNodes: { node: HTMLElement; start: number; end: number; id: string }[] = [];+ for (const track of snapshot.tracks) {+ if (track.binding.family === "speech" && !speechExpanded) continue;+ buildTrack(snapshot, track, nextClipNodes);}clipNodes = nextClipNodes;- semanticNodes = nextSemanticNodes;- sourceNodes = nextSourceNodes;drawRuler(snapshot);};+ const drawProjection = (current: State): void => {+ const nextKey = current.selection.kind === "clip"+ ? `${current.snapshot.revision}:${current.selection.clipId}:${zoom.window().start}:${zoom.window().end}:${lanes.clientWidth}:${lanes.scrollHeight}`+ : `${current.snapshot.revision}:none`;+ if (nextKey === projectionKey) return;+ projectionKey = nextKey;+ projectionOverlay.replaceChildren();+ if (current.selection.kind !== "clip" || semanticLane === undefined) return;+ const clip = store.clip(current.selection.clipId);+ const source = clip?.temporal === undefined ? undefined : sourceWindow(current.snapshot, clip.temporal.source);+ const target = clipNodes.find((item) => item.id === clip?.id)?.node;+ if (source === undefined || target === undefined) return;+ const width = lanes.clientWidth;+ const height = Math.max(lanes.scrollHeight, lanes.clientHeight);+ if (width <= 0 || height <= 0) return;+ projectionOverlay.setAttribute("viewBox", `0 0 ${width} ${height}`);+ projectionOverlay.setAttribute("width", String(width));+ projectionOverlay.setAttribute("height", String(height));+ const lanesBox = lanes.getBoundingClientRect();+ const semanticBox = semanticLane.getBoundingClientRect();+ const targetBox = target.getBoundingClientRect();+ const sourceY = semanticBox.bottom - lanesBox.top - 5;+ const targetY = targetBox.top - lanesBox.top + 4;+ if (sourceY < 0 || sourceY > height || targetY < 0 || targetY > height) return;+ const targetWindow = clip?.temporal?.projection ?? {+ startFrame: clip?.startFrame ?? 0,+ endFrameExclusive: clip?.endFrameExclusive ?? 0,+ };+ const endpoints = clip?.temporal?.projection === undefined ? undefined : {+ start: sourceFrame(current.snapshot, clip.temporal.source, "start"),+ end: sourceFrame(current.snapshot, clip.temporal.source, "end"),+ };+ const pairs: readonly (readonly [number, number])[] = source.start === source.end+ ? [[endpoints?.start ?? source.start, targetWindow.startFrame]]+ : [+ [endpoints?.start ?? source.start, targetWindow.startFrame],+ [endpoints?.end ?? source.end, targetWindow.endFrameExclusive],+ ];+ for (const [fromFrame, toFrame] of pairs) {+ const fromX = place(fromFrame, current.snapshot.space.frameCount, zoom.window()) * width;+ const toX = place(toFrame, current.snapshot.space.frameCount, zoom.window()) * width;+ if ((fromX < 0 && toX < 0) || (fromX > width && toX > width)) continue;+ const middle = sourceY + (targetY - sourceY) * 0.48;+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");+ path.setAttribute("class", "projection-path");+ path.setAttribute("d", `M ${fromX} ${sourceY} C ${fromX} ${middle}, ${toX} ${middle}, ${toX} ${targetY}`);+ projectionOverlay.append(path);+ const sourcePoint = document.createElementNS("http://www.w3.org/2000/svg", "circle");+ sourcePoint.setAttribute("class", "projection-point");+ sourcePoint.setAttribute("cx", String(fromX));+ sourcePoint.setAttribute("cy", String(sourceY));+ sourcePoint.setAttribute("r", "2.5");+ projectionOverlay.append(sourcePoint);+ }+ };+const paint = (): void => {if (state === undefined) return;const { snapshot, selection, playhead: head } = state;const position = place(head.frame, snapshot.space.frameCount, zoom.window()) * lanes.clientWidth;playhead.style.transform = `translate3d(${position}px,0,0)`;+ playhead.classList.toggle("outside", position < 0 || position > lanes.clientWidth);+ const rate = Math.max(1, Math.round(fps(snapshot)));+ const seconds = Math.floor(head.frame / fps(snapshot));+ timelineTime.textContent = `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}:${String(head.frame % rate).padStart(2, "0")}`;for (const item of clipNodes) {- item.node.classList.toggle("selected", selection.kind === "clip" && selection.clipId === item.id);- item.node.setAttribute("aria-pressed", String(selection.kind === "clip" && selection.clipId === item.id));+ const selected = selection.kind === "clip" && selection.clipId === item.id;+ item.node.classList.toggle("selected", selected);+ item.node.setAttribute("aria-pressed", String(selected));item.node.classList.toggle("live", head.frame >= item.start && head.frame < item.end);}for (const item of semanticNodes) {item.node.classList.toggle("live", item.kind === "segment" && head.frame >= item.start && head.frame < item.end);item.node.classList.toggle("current", item.kind === "word" && head.frame >= item.start && head.frame < item.end);}- const selectedClip = selection.kind === "clip" ? store.clip(selection.clipId) : undefined;- for (const item of sourceNodes) {- const source = selectedClip?.temporal?.source;- item.node.classList.toggle("linked", source?.id === item.id- && (source.occurrenceId === undefined || source.occurrenceId === item.occurrenceId));- }+ drawProjection(state);};const schedulePaint = (): void => {@@ -503,8 +549,16 @@ export function createTimeline(store: Store): Timeline {});};- // A trackpad pinch is a wheel event with ctrlKey set; two fingers sideways is- // a wheel with deltaX. Both are how a reader expects to move around a strip.+ const scheduleBuild = (): void => {+ if (rebuildFrame !== 0 || state === undefined) return;+ rebuildFrame = requestAnimationFrame(() => {+ rebuildFrame = 0;+ if (state === undefined) return;+ build(state.snapshot);+ paint();+ });+ };+lanes.addEventListener("wheel", (event) => {if (event.ctrlKey) {event.preventDefault();@@ -518,14 +572,7 @@ export function createTimeline(store: Store): Timeline {zoom.slide(event.deltaX / Math.max(1, lanes.clientWidth));}, { passive: false });- // Subscribed here rather than where the zoom is made: it reports its window- // at once, and there is nothing to redraw until a Source has been read.- zoom.subscribe(() => {- if (state === undefined) return;- build(state.snapshot);- schedulePaint();- });-+ zoom.subscribe(scheduleBuild);store.subscribe((value) => {state = value;if (value.snapshot.revision !== built) {@@ -534,7 +581,6 @@ export function createTimeline(store: Store): Timeline {}schedulePaint();});-new ResizeObserver(() => {if (state !== undefined) {drawRuler(state.snapshot);