Skip to content

armgit / hypit

Public Imported from GitHub
0

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.

feat(studio): add traceable semantic timeline

kashorin106fe91a1b76
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 24f733fe..799e014f 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -154,7 +154,7 @@ const enTheme = {
{ text: "Tracks", link: "/quickstart/tracks" },
{ text: "Image Operations", link: "/quickstart/images" },
{ text: "Film & Rendering", link: "/quickstart/composition" },
- { text: "Live Preview", link: "/quickstart/preview" },
+ { text: "Studio", link: "/quickstart/preview" },
{ text: "Run Source & Builds", link: "/quickstart/run" },
],
},
@@ -169,6 +169,7 @@ const enTheme = {
{ text: "Component Anatomy", link: "/guide/component-anatomy" },
{ text: "Adding a Provider", link: "/guide/providers" },
{ text: "Runtime", link: "/guide/runtime" },
+ { text: "Studio Temporal Windows", link: "/guide/studio-temporal-windows" },
{ text: "Testing", link: "/guide/testing" },
{ text: "Conventions", link: "/guide/conventions" },
],
@@ -198,7 +199,7 @@ const zhTheme = {
{ text: "轨道", link: "/zh/quickstart/tracks" },
{ text: "图片操作", link: "/zh/quickstart/images" },
{ text: "Film 与渲染", link: "/zh/quickstart/composition" },
- { text: "实时预览", link: "/zh/quickstart/preview" },
+ { text: "Studio", link: "/zh/quickstart/preview" },
{ text: "Run Source 与 Build", link: "/zh/quickstart/run" },
],
},
@@ -212,6 +213,7 @@ const zhTheme = {
{ text: "添加 Author 包", link: "/zh/guide/author-packages" },
{ text: "添加 Provider", link: "/zh/guide/providers" },
{ text: "Runtime", link: "/zh/guide/runtime" },
+ { text: "Studio 三窗口", link: "/zh/guide/studio-temporal-windows" },
{ text: "测试", link: "/zh/guide/testing" },
{ text: "代码规范", link: "/zh/guide/conventions" },
],
diff --git a/docs/guide/studio-temporal-windows.md b/docs/guide/studio-temporal-windows.md
new file mode 100644
index 00000000..e6e73cce
--- /dev/null
+++ b/docs/guide/studio-temporal-windows.md
@@ -0,0 +1,94 @@
+---
+title: Studio Temporal Windows
+description: Open design note for displaying authored, projected and consumed time in Hypit Studio.
+---
+
+# Studio Temporal Windows
+
+> Status: the read-only presentation is decided and being implemented. Timeline writeback remains
+> open. This does not define a new Core protocol.
+
+A timeline item does not merely "have a start and end frame". Most authored Tracks begin with a
+named semantic source such as a Selection, Segment or Moment, project that source into frame space,
+and then consume the projected result as picture, sound, animation or an internal schedule. Studio
+must preserve those three stages instead of flattening them into one anonymous rectangle.
+
+## The three windows
+
+### 1. Selection window
+
+The selection window is the semantic source chosen by the author. It retains:
+
+- the source kind: Selection, Segment, Moment or Program;
+- the canonical source identity and occurrence identity;
+- its anchors on the selected Semantic Track;
+- the source range of the author expression that refers to it.
+
+For a Moment this may be a point rather than a duration. A repeated Selection may produce several
+occurrences. Equal frame coordinates do not make two semantic sources identical.
+
+### 2. Projection window
+
+The projection window is the result of applying the Track's temporal expression to one source
+occurrence. For example, an item may use the complete Selection, begin three frames before a
+Moment, or run from `segment.start + 2s` to `segment.end`. Projection includes occurrence expansion,
+offset evaluation, clipping to Program Space and frame quantization.
+
+One authored binding can therefore produce zero, one or several projected windows. A component can
+also apply a relation between its projected windows, such as requiring or computing disjoint
+reveal intervals. That relation belongs to the component's public programme or schedule, not to a
+Studio guess.
+
+### 3. Consumption window
+
+The consumption window describes what the realized Track actually uses. It may equal the projected
+window, but equality is not assumed. Examples include:
+
+- a Media Item whose picture lifetime equals its projected window;
+- a source-audio trim whose source samples differ from its target window;
+- a Media Sequence with logical member spans, visual spans and a handoff span;
+- a Ranking with one outer projected window and several reveal-consumption windows;
+- an enter or exit animation whose motion occupies part of the Track item's lifetime.
+
+Consumption is published by the domain programme, schedule, Visual Track or Audio Track. Studio
+must not reconstruct it from naming conventions or reimplement a package's scheduling algorithm.
+
+## Identity chain Studio must retain
+
+Studio eventually needs a lossless chain with explicit identities:
+
+```text
+author element
+ -> semantic binding (kind, source id, occurrence, author range)
+ -> projection expression and projected window(s)
+ -> consumed entity and consumed window(s)
+ -> terminal visual/audio realization
+```
+
+The links matter more than coincident frame numbers. Several Tracks may consume the same Selection;
+one projected window may feed several visual and audio facets; one component may expand one outer
+window into many internal windows. These are shared bindings and projections, not duplicate clips.
+
+The current Studio adapter registry is the right local place to interpret this chain. Domain
+packages remain unaware of Studio. Adapters should reuse author observations and the public values
+already emitted by Narrative, Temporal and each Track family. If a required link is not observable,
+Studio should call it unresolved rather than infer it from ids, labels or equal spans.
+
+## Timeline questions that remain deliberately open
+
+Before any drag or trim writeback is enabled, the product design must decide:
+
+1. Whether the three windows appear as nested geometry in one lane, separate linked sub-lanes, or
+ an overlay revealed when an item is selected.
+2. How a point-like Moment and its duration-like projection are distinguished visually.
+3. How repeated Selection occurrences and `one` versus `each` expansion are shown.
+4. How a shared Selection communicates the blast radius across all consuming Tracks.
+5. Whether the playhead/inspector selects the semantic source, projected occurrence, consumed
+ entity or terminal realization, and how the user moves between those levels.
+6. How component-internal schedules such as Ranking reveals expand without making the primary
+ timeline noisy.
+7. Which drag gesture owns which level. Moving a semantic source, changing a projection offset and
+ trimming a consumption window are different edits and must never be silently substituted.
+
+Until these questions are answered, timeline entities remain selectable and seekable but read-only.
+The rule is simple: difficulty is acceptable; implicit guessing is not.
diff --git a/docs/quickstart/preview.md b/docs/quickstart/preview.md
index f0d15806..5533689f 100644
--- a/docs/quickstart/preview.md
+++ b/docs/quickstart/preview.md
@@ -14,13 +14,15 @@ it needs a Run whose material is satisfied — every generated output either pro
Build or standing against a file. That is what you point it at.
```bash
-pnpm studio -- --run path/to/build.svrun
+pnpm studio -- --run examples/all-components-preview/studio.svrun --workspace .
# ➜ http://localhost:5179/
```
::: warning The examples in this repository need material first
-Every Run Source under `examples/` still names shots a Provider has to make, or footage under
-`examples/**/assets/`, which is not committed. Satisfy those in a Run of your own before opening it.
+`examples/all-components-preview/studio.svrun` is ready to open: it explicitly supplies its
+Semantic Takes and caption plan. Other example Runs may still name shots a Provider has to make, or
+footage under `examples/**/assets/` that is not committed. Satisfy those in a Run of your own before
+opening them.
:::
| Argument | Meaning |
@@ -133,6 +135,17 @@ into a piano roll. Double-click a Segment to zoom to it; the toolbar has explici
Clicking a word moves the playhead to the frame that word starts on, which is the fastest way to
answer "does this cutaway land on the right sentence".
+## Selection, projection and consumption
+
+A timeline block is not assumed to be the authored Selection. Studio keeps three facts separate:
+the named semantic source, the component's projection from that source, and the frame windows the
+component finally consumes. Selection ranges and Moment points remain visible on the semantic lane;
+an item's projection line connects that source to its realized window. Components with nested
+schedules, such as a Ranking Column, expose the total window and their reveal phases separately.
+
+The current projection view is read-only. Its data contract and the remaining write-back questions
+are recorded in [Studio Temporal Windows](../guide/studio-temporal-windows.md).
+
## Sound
HyperFrames renders a silent picture on purpose: programme audio is a separate Track the media
diff --git a/docs/zh/guide/studio-temporal-windows.md b/docs/zh/guide/studio-temporal-windows.md
new file mode 100644
index 00000000..cf00efc0
--- /dev/null
+++ b/docs/zh/guide/studio-temporal-windows.md
@@ -0,0 +1,78 @@
+---
+title: Studio 三窗口
+description: Studio 如何显式呈现选择、投影与消费窗口的待设计记录。
+---
+
+# Studio 三窗口
+
+> 状态:只读呈现已经定案并开始实现;回写交互仍待讨论,不因此新增 Core 协议。
+
+时间线上的 item 并不只是一个起止帧矩形。绝大多数 Track 先引用 Selection、Segment 或
+Moment,再把它投影到帧空间,最后才由画面、声音、动画或组件内部 schedule 消费。Studio
+必须保留这三个层级,不能压平后靠相同帧数、字符串 id 或组件名字猜回去。
+
+## 一、选择窗口
+
+这是作者选中的语义来源,需要保留来源种类、规范 id、occurrence、Semantic Track 上的
+Anchor,以及引用它的 SVML 源码范围。Moment 可以只是一个点;重复 Selection 可以有多次
+occurrence。两个来源落在相同帧上,不代表它们是同一件事。
+
+## 二、投影窗口
+
+这是 Track 把一次语义 occurrence 按时间表达式投进帧空间后的结果。例如完整使用
+Selection、从 Moment 前三帧开始,或从 `segment.start + 2s` 到 `segment.end`。它包括
+occurrence 展开、offset 计算、Program Space 裁切与帧量化。
+
+一个作者绑定可以产出零个、一个或多个投影窗口;组件也可能在这些窗口之间施加关系,
+例如算出互不重叠的 Ranking reveal。关系必须来自领域组件公开的 programme/schedule,
+不能由 Studio 重新实现。
+
+## 三、消费窗口
+
+这是最终 Track 实际使用的窗口。它可能与投影窗口相同,但不能预设相同:Media Sequence
+同时有 logical span、visual span 与 handoff;源音频有 source trim 和 target window;
+Ranking 有一个外层窗口和多个内部 reveal;进入、持续、退出动画也会消费生命周期的不同
+部分。Studio 应读取领域 programme、schedule、Visual Track 或 Audio Track 公开的事实,
+不能从渲染 id 猜。
+
+## 时间线呈现约定
+
+三者是时间谱系的三层,不保证都是区间。Semantic Lane 始终显示语义来源:Selection 和
+Segment 是括号区间,Moment 是精确时间点。每个 Track 的作者 item 仍用实心块表达实际
+消费;它的顶部用空心细线表达投影窗口。投影与消费完全重合时也保留细线,不能因此抹掉
+恒等投影。选中 item 后,Semantic Lane 会强调它绑定的来源和 occurrence。
+
+组件内部 schedule 不制造额外 Track item。Ranking Column 的整个 Column 是父 item;每个
+ColumnItem 是子 item,`preferred` 显示为投影线,`active` 和 `settled` 显示为同一子 item
+底部的阶段条。Preset 没有独立语义投影,明确标记为由父 schedule 派生。
+
+投影端点必须逐个保留原表达式,例如 `selection.start+3f` 和 `selection.end+3f`,不能在
+Studio 中概括成一次“整体平移”。Program 给出解析后的帧窗口,Surface 真正封存的 Spec
+给出端点表达式;Studio adapter 只把它们按作者实体重新组合,不重新执行 Temporal。
+
+## 必须保留的身份链
+
+```text
+作者元素
+ -> 语义绑定(种类、来源 id、occurrence、源码范围)
+ -> 投影表达式与投影窗口
+ -> 消费实体与消费窗口
+ -> 最终画面/声音实现
+```
+
+多个 Track 可以共享同一个 Selection;一个投影可以生成同源的 visual/audio facet;一个
+组件的外层投影也可以展开成多个内部消费窗口。它们是共享绑定和投影,不是若干恰好重叠
+的 clip。
+
+Studio adapter registry 是解释这条链的本地中心。领域包和 Core 不认识 Studio;adapter
+复用 Narrative、Temporal 和 Track family 已公开的值。如果链上某一环不可观察,就明确
+显示 unresolved,绝不通过名称或相同 span 补猜。
+
+## 回写前必须显式讨论的问题
+
+1. 共享 Selection 如何展示所有消费者及修改影响范围。
+2. Inspector 如何在语义来源、投影 occurrence、消费实体和最终 realization 之间切换。
+3. 每种拖动到底修改哪一层:移动语义来源、修改 projection offset、裁切消费窗口是三种
+ 不同操作,严禁相互替代。
+
+这些问题定案前,时间线可以选中、定位,但保持只读。可以难,不能隐式猜。
diff --git a/docs/zh/quickstart/preview.md b/docs/zh/quickstart/preview.md
index 7c0c2325..840c7b39 100644
--- a/docs/zh/quickstart/preview.md
+++ b/docs/zh/quickstart/preview.md
@@ -10,12 +10,12 @@ description: 把一个素材已经存在的 Run 当作可编辑的时间线来
Studio 只构建它能从 Run 已经提供的 Candidate 确定性推导出来的东西,因此它需要一个素材已被满足的 Run——每一个生成 output 要么由一次已接受的 Build 产出,要么由一个文件顶上。你指向的就是这样一个 Run。
```bash
-pnpm studio -- --run path/to/build.svrun
+pnpm studio -- --run examples/all-components-preview/studio.svrun --workspace .
# ➜ http://localhost:5179/
```
::: warning 本仓库的示例需要先有素材
-`examples/` 下的每一个 Run Source,都还指名着需要 Provider 去做的镜头,或者 `examples/**/assets/` 下未提交的素材。先在你自己的 Run 里满足它们,再打开。
+`examples/all-components-preview/studio.svrun` 可以直接打开:它显式提供了 Semantic Take 和字幕计划。其他示例 Run 仍可能指名需要 Provider 去做的镜头,或 `examples/**/assets/` 下未提交的素材。先在你自己的 Run 里满足它们,再打开。
:::
| 参数 | 含义 |
@@ -100,6 +100,12 @@ Track 之上有一条并不是 Track 的泳道:`SemanticTrack` 本身,每个
点击一个词,播放头会移到那个词开始的帧——这是回答"这个空镜是不是落在正确的那句话上"最快的方式。
+## 选择、投影与消费
+
+时间线上的块不会被默认当成作者写下的 Selection。Studio 分开保留三个事实:具名的语义来源、组件对该来源的投影,以及组件最终消费的帧窗口。Selection 区间和 Moment 时点保留在语义泳道上;item 的投影线把该来源连到实际窗口。像 Ranking Column 这样含子调度的组件,会分开显示总窗口和各揭示阶段。
+
+当前投影视图只读。它的数据契约与尚未确定的回写问题记录在 [Studio 时间窗口](../guide/studio-temporal-windows.md)。
+
## 声音
HyperFrames 刻意只渲染无声画面:programme audio 是一条独立的 Track,由 media pipeline 在最后 mux 进去。但把 B-roll 对着语音安放,前提就是能听见那句话,所以走带播放时 Speech Track 自己的素材允许发声。Cutaway 保持静音——除非显式声明要带音频,这和真实构建里的行为一致。喇叭按钮可以关掉。
diff --git a/examples/all-components-preview/README.md b/examples/all-components-preview/README.md
index 0a715ee7..38f52dea 100644
--- a/examples/all-components-preview/README.md
+++ b/examples/all-components-preview/README.md
@@ -1,13 +1,19 @@
# All components
One Source that writes every kind of Track at once: speech, a ranking board, a
-media card, a screen treatment, typography and captions, over a take nobody has
-generated yet.
+media card, a screen treatment, typography and captions.
It exists to exercise the vocabulary: every Track kind declared once, in one
Source, so a change that breaks one of them breaks something a reader can see.
`hypit check` proves it is legal, and the graph-shape tests read it.
-Opening it in Studio means satisfying its generated outputs first — seven
-capabilities, from `gpt-image-2` through `whisperx-alignment` — in a Run Source
-or an accepted Build. See `docs/quickstart/preview.md`.
+`studio.svrun` supplies two materialized Semantic Takes and one caption plan, so
+every Studio projection is explicit and opening it invokes no Provider:
+
+```bash
+pnpm studio -- --run examples/all-components-preview/studio.svrun --workspace .
+```
+
+Every Track, the Film composition and the HyperFrames picture use the same
+deterministic package code as a Build. `build.svrun` remains the real generation
+Run; `studio.svrun` is its explicit authoring view.
diff --git a/examples/all-components-preview/fixtures/studio-caption-plan.json b/examples/all-components-preview/fixtures/studio-caption-plan.json
new file mode 100644
index 00000000..0698849b
--- /dev/null
+++ b/examples/all-components-preview/fixtures/studio-caption-plan.json
@@ -0,0 +1,136 @@
+{
+ "kind": "inline",
+ "value": {
+ "runs": [
+ {
+ "id": "caption-program:run:1",
+ "styleId": "base-caption",
+ "cues": [
+ {
+ "id": "studio-cue-1",
+ "atomIds": [
+ "story.caption:atom:1",
+ "story.caption:atom:2",
+ "story.caption:atom:3"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-2",
+ "atomIds": [
+ "story.caption:atom:4",
+ "story.caption:atom:5",
+ "story.caption:atom:6"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-3",
+ "atomIds": [
+ "story.caption:atom:7",
+ "story.caption:atom:8",
+ "story.caption:atom:9"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-4",
+ "atomIds": [
+ "story.caption:atom:10",
+ "story.caption:atom:11",
+ "story.caption:atom:12"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-5",
+ "atomIds": [
+ "story.caption:atom:13",
+ "story.caption:atom:14",
+ "story.caption:atom:15"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-6",
+ "atomIds": [
+ "story.caption:atom:16",
+ "story.caption:atom:17",
+ "story.caption:atom:18"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-7",
+ "atomIds": [
+ "story.caption:atom:19",
+ "story.caption:atom:20",
+ "story.caption:atom:21"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-8",
+ "atomIds": [
+ "story.caption:atom:22",
+ "story.caption:atom:23"
+ ],
+ "fields": []
+ }
+ ]
+ },
+ {
+ "id": "caption-program:run:2",
+ "styleId": "base-caption",
+ "cues": [
+ {
+ "id": "studio-cue-9",
+ "atomIds": [
+ "story.caption:atom:24",
+ "story.caption:atom:25"
+ ],
+ "fields": []
+ }
+ ]
+ },
+ {
+ "id": "caption-program:run:3",
+ "styleId": "base-caption",
+ "cues": [
+ {
+ "id": "studio-cue-10",
+ "atomIds": [
+ "story.caption:atom:26",
+ "story.caption:atom:27"
+ ],
+ "fields": []
+ }
+ ]
+ },
+ {
+ "id": "caption-program:run:4",
+ "styleId": "base-caption",
+ "cues": [
+ {
+ "id": "studio-cue-11",
+ "atomIds": [
+ "story.caption:atom:28",
+ "story.caption:atom:29",
+ "story.caption:atom:30"
+ ],
+ "fields": []
+ },
+ {
+ "id": "studio-cue-12",
+ "atomIds": [
+ "story.caption:atom:31",
+ "story.caption:atom:32",
+ "story.caption:atom:33"
+ ],
+ "fields": []
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/examples/all-components-preview/fixtures/studio-closing-take.json b/examples/all-components-preview/fixtures/studio-closing-take.json
new file mode 100644
index 00000000..5690e966
--- /dev/null
+++ b/examples/all-components-preview/fixtures/studio-closing-take.json
@@ -0,0 +1,179 @@
+{
+ "kind": "inline",
+ "value": {
+ "media": {
+ "timeline": {
+ "frameRate": {
+ "numerator": 24,
+ "denominator": 1
+ },
+ "frameCount": 289
+ },
+ "visual": {
+ "artifact": {
+ "kind": "blob",
+ "digest": "sha256:460ebf6cf4a22f0cabd13eb1646aa221dba8938ee008a165a3ed4eeb5ac451f4",
+ "size": 600761,
+ "mediaType": "video/mp4"
+ },
+ "width": 540,
+ "height": 960
+ }
+ },
+ "segment": {
+ "segmentId": "closing",
+ "startAnchorId": "segment:closing:start",
+ "endAnchorId": "segment:closing:end",
+ "startFrame": 0,
+ "endFrameExclusive": 289
+ },
+ "tokens": [
+ {
+ "tokenId": "segment:closing:token:1",
+ "segmentId": "closing",
+ "text": "Ranking",
+ "startAnchorId": "segment:closing:token:1:start",
+ "endAnchorId": "segment:closing:token:1:end",
+ "startFrame": 0,
+ "endFrameExclusive": 36
+ },
+ {
+ "tokenId": "segment:closing:token:2",
+ "segmentId": "closing",
+ "text": "Captions",
+ "startAnchorId": "segment:closing:token:2:start",
+ "endAnchorId": "segment:closing:token:2:end",
+ "startFrame": 36,
+ "endFrameExclusive": 72
+ },
+ {
+ "tokenId": "segment:closing:token:3",
+ "segmentId": "closing",
+ "text": "That",
+ "startAnchorId": "segment:closing:token:3:start",
+ "endAnchorId": "segment:closing:token:3:end",
+ "startFrame": 72,
+ "endFrameExclusive": 108
+ },
+ {
+ "tokenId": "segment:closing:token:4",
+ "segmentId": "closing",
+ "text": "is",
+ "startAnchorId": "segment:closing:token:4:start",
+ "endAnchorId": "segment:closing:token:4:end",
+ "startFrame": 108,
+ "endFrameExclusive": 144
+ },
+ {
+ "tokenId": "segment:closing:token:5",
+ "segmentId": "closing",
+ "text": "the",
+ "startAnchorId": "segment:closing:token:5:start",
+ "endAnchorId": "segment:closing:token:5:end",
+ "startFrame": 144,
+ "endFrameExclusive": 180
+ },
+ {
+ "tokenId": "segment:closing:token:6",
+ "segmentId": "closing",
+ "text": "whole",
+ "startAnchorId": "segment:closing:token:6:start",
+ "endAnchorId": "segment:closing:token:6:end",
+ "startFrame": 180,
+ "endFrameExclusive": 216
+ },
+ {
+ "tokenId": "segment:closing:token:7",
+ "segmentId": "closing",
+ "text": "of",
+ "startAnchorId": "segment:closing:token:7:start",
+ "endAnchorId": "segment:closing:token:7:end",
+ "startFrame": 216,
+ "endFrameExclusive": 252
+ },
+ {
+ "tokenId": "segment:closing:token:8",
+ "segmentId": "closing",
+ "text": "it",
+ "startAnchorId": "segment:closing:token:8:start",
+ "endAnchorId": "segment:closing:token:8:end",
+ "startFrame": 252,
+ "endFrameExclusive": 289
+ }
+ ],
+ "anchors": [
+ {
+ "identity": "segment:closing:start",
+ "frame": 0
+ },
+ {
+ "identity": "segment:closing:token:1:start",
+ "frame": 0
+ },
+ {
+ "identity": "segment:closing:token:1:end",
+ "frame": 36
+ },
+ {
+ "identity": "segment:closing:token:2:start",
+ "frame": 36
+ },
+ {
+ "identity": "segment:closing:token:2:end",
+ "frame": 72
+ },
+ {
+ "identity": "segment:closing:token:3:start",
+ "frame": 72
+ },
+ {
+ "identity": "segment:closing:token:3:end",
+ "frame": 108
+ },
+ {
+ "identity": "segment:closing:token:4:start",
+ "frame": 108
+ },
+ {
+ "identity": "segment:closing:token:4:end",
+ "frame": 144
+ },
+ {
+ "identity": "segment:closing:token:5:start",
+ "frame": 144
+ },
+ {
+ "identity": "segment:closing:token:5:end",
+ "frame": 180
+ },
+ {
+ "identity": "segment:closing:token:6:start",
+ "frame": 180
+ },
+ {
+ "identity": "segment:closing:token:6:end",
+ "frame": 216
+ },
+ {
+ "identity": "segment:closing:token:7:start",
+ "frame": 216
+ },
+ {
+ "identity": "segment:closing:token:7:end",
+ "frame": 252
+ },
+ {
+ "identity": "segment:closing:token:8:start",
+ "frame": 252
+ },
+ {
+ "identity": "segment:closing:token:8:end",
+ "frame": 289
+ },
+ {
+ "identity": "segment:closing:end",
+ "frame": 289
+ }
+ ]
+ }
+}
diff --git a/examples/all-components-preview/fixtures/studio-opening-take.json b/examples/all-components-preview/fixtures/studio-opening-take.json
new file mode 100644
index 00000000..92e06fcf
--- /dev/null
+++ b/examples/all-components-preview/fixtures/studio-opening-take.json
@@ -0,0 +1,468 @@
+{
+ "kind": "inline",
+ "value": {
+ "media": {
+ "timeline": {
+ "frameRate": {
+ "numerator": 24,
+ "denominator": 1
+ },
+ "frameCount": 289
+ },
+ "visual": {
+ "artifact": {
+ "kind": "blob",
+ "digest": "sha256:82367e703005d86c2f5e25f8e88ca3fa3b8057e7bda837f8fb15f6fedcb14d3c",
+ "size": 581338,
+ "mediaType": "video/mp4"
+ },
+ "width": 540,
+ "height": 960
+ }
+ },
+ "segment": {
+ "segmentId": "opening",
+ "startAnchorId": "segment:opening:start",
+ "endAnchorId": "segment:opening:end",
+ "startFrame": 0,
+ "endFrameExclusive": 289
+ },
+ "tokens": [
+ {
+ "tokenId": "segment:opening:token:1",
+ "segmentId": "opening",
+ "text": "This",
+ "startAnchorId": "segment:opening:token:1:start",
+ "endAnchorId": "segment:opening:token:1:end",
+ "startFrame": 0,
+ "endFrameExclusive": 11
+ },
+ {
+ "tokenId": "segment:opening:token:2",
+ "segmentId": "opening",
+ "text": "is",
+ "startAnchorId": "segment:opening:token:2:start",
+ "endAnchorId": "segment:opening:token:2:end",
+ "startFrame": 11,
+ "endFrameExclusive": 23
+ },
+ {
+ "tokenId": "segment:opening:token:3",
+ "segmentId": "opening",
+ "text": "every",
+ "startAnchorId": "segment:opening:token:3:start",
+ "endAnchorId": "segment:opening:token:3:end",
+ "startFrame": 23,
+ "endFrameExclusive": 34
+ },
+ {
+ "tokenId": "segment:opening:token:4",
+ "segmentId": "opening",
+ "text": "component",
+ "startAnchorId": "segment:opening:token:4:start",
+ "endAnchorId": "segment:opening:token:4:end",
+ "startFrame": 34,
+ "endFrameExclusive": 46
+ },
+ {
+ "tokenId": "segment:opening:token:5",
+ "segmentId": "opening",
+ "text": "at",
+ "startAnchorId": "segment:opening:token:5:start",
+ "endAnchorId": "segment:opening:token:5:end",
+ "startFrame": 46,
+ "endFrameExclusive": 57
+ },
+ {
+ "tokenId": "segment:opening:token:6",
+ "segmentId": "opening",
+ "text": "once",
+ "startAnchorId": "segment:opening:token:6:start",
+ "endAnchorId": "segment:opening:token:6:end",
+ "startFrame": 57,
+ "endFrameExclusive": 69
+ },
+ {
+ "tokenId": "segment:opening:token:7",
+ "segmentId": "opening",
+ "text": "A",
+ "startAnchorId": "segment:opening:token:7:start",
+ "endAnchorId": "segment:opening:token:7:end",
+ "startFrame": 69,
+ "endFrameExclusive": 80
+ },
+ {
+ "tokenId": "segment:opening:token:8",
+ "segmentId": "opening",
+ "text": "card",
+ "startAnchorId": "segment:opening:token:8:start",
+ "endAnchorId": "segment:opening:token:8:end",
+ "startFrame": 80,
+ "endFrameExclusive": 92
+ },
+ {
+ "tokenId": "segment:opening:token:9",
+ "segmentId": "opening",
+ "text": "cuts",
+ "startAnchorId": "segment:opening:token:9:start",
+ "endAnchorId": "segment:opening:token:9:end",
+ "startFrame": 92,
+ "endFrameExclusive": 104
+ },
+ {
+ "tokenId": "segment:opening:token:10",
+ "segmentId": "opening",
+ "text": "in",
+ "startAnchorId": "segment:opening:token:10:start",
+ "endAnchorId": "segment:opening:token:10:end",
+ "startFrame": 104,
+ "endFrameExclusive": 115
+ },
+ {
+ "tokenId": "segment:opening:token:11",
+ "segmentId": "opening",
+ "text": "here",
+ "startAnchorId": "segment:opening:token:11:start",
+ "endAnchorId": "segment:opening:token:11:end",
+ "startFrame": 115,
+ "endFrameExclusive": 127
+ },
+ {
+ "tokenId": "segment:opening:token:12",
+ "segmentId": "opening",
+ "text": "the",
+ "startAnchorId": "segment:opening:token:12:start",
+ "endAnchorId": "segment:opening:token:12:end",
+ "startFrame": 127,
+ "endFrameExclusive": 138
+ },
+ {
+ "tokenId": "segment:opening:token:13",
+ "segmentId": "opening",
+ "text": "picture",
+ "startAnchorId": "segment:opening:token:13:start",
+ "endAnchorId": "segment:opening:token:13:end",
+ "startFrame": 138,
+ "endFrameExclusive": 150
+ },
+ {
+ "tokenId": "segment:opening:token:14",
+ "segmentId": "opening",
+ "text": "flashes",
+ "startAnchorId": "segment:opening:token:14:start",
+ "endAnchorId": "segment:opening:token:14:end",
+ "startFrame": 150,
+ "endFrameExclusive": 161
+ },
+ {
+ "tokenId": "segment:opening:token:15",
+ "segmentId": "opening",
+ "text": "and",
+ "startAnchorId": "segment:opening:token:15:start",
+ "endAnchorId": "segment:opening:token:15:end",
+ "startFrame": 161,
+ "endFrameExclusive": 173
+ },
+ {
+ "tokenId": "segment:opening:token:16",
+ "segmentId": "opening",
+ "text": "the",
+ "startAnchorId": "segment:opening:token:16:start",
+ "endAnchorId": "segment:opening:token:16:end",
+ "startFrame": 173,
+ "endFrameExclusive": 184
+ },
+ {
+ "tokenId": "segment:opening:token:17",
+ "segmentId": "opening",
+ "text": "board",
+ "startAnchorId": "segment:opening:token:17:start",
+ "endAnchorId": "segment:opening:token:17:end",
+ "startFrame": 184,
+ "endFrameExclusive": 196
+ },
+ {
+ "tokenId": "segment:opening:token:18",
+ "segmentId": "opening",
+ "text": "fills",
+ "startAnchorId": "segment:opening:token:18:start",
+ "endAnchorId": "segment:opening:token:18:end",
+ "startFrame": 196,
+ "endFrameExclusive": 208
+ },
+ {
+ "tokenId": "segment:opening:token:19",
+ "segmentId": "opening",
+ "text": "as",
+ "startAnchorId": "segment:opening:token:19:start",
+ "endAnchorId": "segment:opening:token:19:end",
+ "startFrame": 208,
+ "endFrameExclusive": 219
+ },
+ {
+ "tokenId": "segment:opening:token:20",
+ "segmentId": "opening",
+ "text": "each",
+ "startAnchorId": "segment:opening:token:20:start",
+ "endAnchorId": "segment:opening:token:20:end",
+ "startFrame": 219,
+ "endFrameExclusive": 231
+ },
+ {
+ "tokenId": "segment:opening:token:21",
+ "segmentId": "opening",
+ "text": "one",
+ "startAnchorId": "segment:opening:token:21:start",
+ "endAnchorId": "segment:opening:token:21:end",
+ "startFrame": 231,
+ "endFrameExclusive": 242
+ },
+ {
+ "tokenId": "segment:opening:token:22",
+ "segmentId": "opening",
+ "text": "is",
+ "startAnchorId": "segment:opening:token:22:start",
+ "endAnchorId": "segment:opening:token:22:end",
+ "startFrame": 242,
+ "endFrameExclusive": 254
+ },
+ {
+ "tokenId": "segment:opening:token:23",
+ "segmentId": "opening",
+ "text": "named",
+ "startAnchorId": "segment:opening:token:23:start",
+ "endAnchorId": "segment:opening:token:23:end",
+ "startFrame": 254,
+ "endFrameExclusive": 265
+ },
+ {
+ "tokenId": "segment:opening:token:24",
+ "segmentId": "opening",
+ "text": "Spatial",
+ "startAnchorId": "segment:opening:token:24:start",
+ "endAnchorId": "segment:opening:token:24:end",
+ "startFrame": 265,
+ "endFrameExclusive": 277
+ },
+ {
+ "tokenId": "segment:opening:token:25",
+ "segmentId": "opening",
+ "text": "Typography",
+ "startAnchorId": "segment:opening:token:25:start",
+ "endAnchorId": "segment:opening:token:25:end",
+ "startFrame": 277,
+ "endFrameExclusive": 289
+ }
+ ],
+ "anchors": [
+ {
+ "identity": "segment:opening:start",
+ "frame": 0
+ },
+ {
+ "identity": "segment:opening:token:1:start",
+ "frame": 0
+ },
+ {
+ "identity": "segment:opening:token:1:end",
+ "frame": 11
+ },
+ {
+ "identity": "segment:opening:token:2:start",
+ "frame": 11
+ },
+ {
+ "identity": "segment:opening:token:2:end",
+ "frame": 23
+ },
+ {
+ "identity": "segment:opening:token:3:start",
+ "frame": 23
+ },
+ {
+ "identity": "segment:opening:token:3:end",
+ "frame": 34
+ },
+ {
+ "identity": "segment:opening:token:4:start",
+ "frame": 34
+ },
+ {
+ "identity": "segment:opening:token:4:end",
+ "frame": 46
+ },
+ {
+ "identity": "segment:opening:token:5:start",
+ "frame": 46
+ },
+ {
+ "identity": "segment:opening:token:5:end",
+ "frame": 57
+ },
+ {
+ "identity": "segment:opening:token:6:start",
+ "frame": 57
+ },
+ {
+ "identity": "segment:opening:token:6:end",
+ "frame": 69
+ },
+ {
+ "identity": "segment:opening:token:7:start",
+ "frame": 69
+ },
+ {
+ "identity": "segment:opening:token:7:end",
+ "frame": 80
+ },
+ {
+ "identity": "segment:opening:token:8:start",
+ "frame": 80
+ },
+ {
+ "identity": "segment:opening:token:8:end",
+ "frame": 92
+ },
+ {
+ "identity": "segment:opening:token:9:start",
+ "frame": 92
+ },
+ {
+ "identity": "segment:opening:token:9:end",
+ "frame": 104
+ },
+ {
+ "identity": "segment:opening:token:10:start",
+ "frame": 104
+ },
+ {
+ "identity": "segment:opening:token:10:end",
+ "frame": 115
+ },
+ {
+ "identity": "segment:opening:token:11:start",
+ "frame": 115
+ },
+ {
+ "identity": "segment:opening:token:11:end",
+ "frame": 127
+ },
+ {
+ "identity": "segment:opening:token:12:start",
+ "frame": 127
+ },
+ {
+ "identity": "segment:opening:token:12:end",
+ "frame": 138
+ },
+ {
+ "identity": "segment:opening:token:13:start",
+ "frame": 138
+ },
+ {
+ "identity": "segment:opening:token:13:end",
+ "frame": 150
+ },
+ {
+ "identity": "segment:opening:token:14:start",
+ "frame": 150
+ },
+ {
+ "identity": "segment:opening:token:14:end",
+ "frame": 161
+ },
+ {
+ "identity": "segment:opening:token:15:start",
+ "frame": 161
+ },
+ {
+ "identity": "segment:opening:token:15:end",
+ "frame": 173
+ },
+ {
+ "identity": "segment:opening:token:16:start",
+ "frame": 173
+ },
+ {
+ "identity": "segment:opening:token:16:end",
+ "frame": 184
+ },
+ {
+ "identity": "segment:opening:token:17:start",
+ "frame": 184
+ },
+ {
+ "identity": "segment:opening:token:17:end",
+ "frame": 196
+ },
+ {
+ "identity": "segment:opening:token:18:start",
+ "frame": 196
+ },
+ {
+ "identity": "segment:opening:token:18:end",
+ "frame": 208
+ },
+ {
+ "identity": "segment:opening:token:19:start",
+ "frame": 208
+ },
+ {
+ "identity": "segment:opening:token:19:end",
+ "frame": 219
+ },
+ {
+ "identity": "segment:opening:token:20:start",
+ "frame": 219
+ },
+ {
+ "identity": "segment:opening:token:20:end",
+ "frame": 231
+ },
+ {
+ "identity": "segment:opening:token:21:start",
+ "frame": 231
+ },
+ {
+ "identity": "segment:opening:token:21:end",
+ "frame": 242
+ },
+ {
+ "identity": "segment:opening:token:22:start",
+ "frame": 242
+ },
+ {
+ "identity": "segment:opening:token:22:end",
+ "frame": 254
+ },
+ {
+ "identity": "segment:opening:token:23:start",
+ "frame": 254
+ },
+ {
+ "identity": "segment:opening:token:23:end",
+ "frame": 265
+ },
+ {
+ "identity": "segment:opening:token:24:start",
+ "frame": 265
+ },
+ {
+ "identity": "segment:opening:token:24:end",
+ "frame": 277
+ },
+ {
+ "identity": "segment:opening:token:25:start",
+ "frame": 277
+ },
+ {
+ "identity": "segment:opening:token:25:end",
+ "frame": 289
+ },
+ {
+ "identity": "segment:opening:end",
+ "frame": 289
+ }
+ ]
+ }
+}
diff --git a/examples/all-components-preview/main.svml b/examples/all-components-preview/main.svml
index 2bba1949..7a7c9f73 100644
--- a/examples/all-components-preview/main.svml
+++ b/examples/all-components-preview/main.svml
@@ -46,7 +46,7 @@
<!-- A board fills from its bottom edge upward, so the Frame is sized to the
rows it holds: four rows, three gaps and the Recipe's padding. A taller
Frame would leave the rows floating at the bottom of an empty box. -->
- <space:Frame id="board-frame" within={vertical} left="4%" top="14%" right="38%" bottom="32.85%"/>
+ <space:Frame id="board-frame" within={vertical} left="4%" top="14%" right="38%" bottom="33.5%"/>
<space:Frame id="card-frame" within={vertical} left="10%" top="60%" right="90%" bottom="86%"/>
<space:Frame id="title-frame" within={vertical} left="0%" top="6%" right="100%" bottom="13%"/>
diff --git a/examples/all-components-preview/studio.svrun b/examples/all-components-preview/studio.svrun
new file mode 100644
index 00000000..446e146a
--- /dev/null
+++ b/examples/all-components-preview/studio.svrun
@@ -0,0 +1,25 @@
+<?svml using="@hypit/run-markup@1"?>
+
+<svrun version="1">
+ <author source="./main.svml"/>
+ <target output="final.video"/>
+
+ <!-- Studio opens only from explicit, already materialized projection inputs.
+ These two files also make the exact media bytes referenced by the
+ SemanticTake candidates available to HyperFrames. -->
+ <file id="studio-opening-video" type="@hypit/artifact@1#BlobArtifact"
+ from="../../docs/public/regen-ranking/avatar-1.mp4" media-type="video/mp4"/>
+ <file id="studio-closing-video" type="@hypit/artifact@1#BlobArtifact"
+ from="../../docs/public/regen-ranking/avatar-2.mp4" media-type="video/mp4"/>
+
+ <value id="studio-opening-take" type="@hypit/speech@1#SemanticTake"
+ from="./fixtures/studio-opening-take.json"/>
+ <value id="studio-closing-take" type="@hypit/speech@1#SemanticTake"
+ from="./fixtures/studio-closing-take.json"/>
+ <value id="studio-caption-plan" type="@hypit/caption@1#CaptionPlan"
+ from="./fixtures/studio-caption-plan.json"/>
+
+ <satisfy output="opening-semantic.take" candidate="studio-opening-take"/>
+ <satisfy output="closing-semantic.take" candidate="studio-closing-take"/>
+ <satisfy output="cue-plan.plan" candidate="studio-caption-plan"/>
+</svrun>
diff --git a/packages/media-track/src/manifest.ts b/packages/media-track/src/manifest.ts
index 9ce9e79c..c1cb12dd 100644
--- a/packages/media-track/src/manifest.ts
+++ b/packages/media-track/src/manifest.ts
@@ -471,6 +471,8 @@ export const mediaTrackMarkupSurfaces = [{
] },
],
ports: [
+ { name: "program", type: mediaTrackTypes.program,
+ summary: "The resolved Item and Sequence schedule consumed by both rendered facets." },
{ name: "visual", type: compositionTypes.visualTrack,
summary: "The rendered picture, an ordinary peer VisualTrack." },
{ name: "audio", type: compositionTypes.audioTrack,
diff --git a/packages/media-track/src/surface.ts b/packages/media-track/src/surface.ts
index e9f3166e..9dd47e28 100644
--- a/packages/media-track/src/surface.ts
+++ b/packages/media-track/src/surface.ts
@@ -356,6 +356,7 @@ function createMediaTrackSurfaceFragment(inputTypes: readonly { readonly name: s
inputs: inputTypes,
operations,
exports: [
+ { name: "program", type: mediaTrackTypes.program, root: operation("track:finalize") },
{ name: "visual", type: compositionTypes.visualTrack, root: operation("track:visual") },
...(audio ? [{ name: "audio" as const, type: compositionTypes.audioTrack, root: operation("track:audio") }] : []),
],
@@ -787,8 +788,8 @@ export const decodeMediaTrackSurface: StructuredSurfaceHandler = ({ element, res
return {
records: state.records,
components: [{ id: trackId, fragment: fragment.id, inputs: state.inputs,
- outputs: { visual: `${trackId}.visual`, ...(hasAudio ? { audio: `${trackId}.audio` } : {}) }, range: element.range }],
+ outputs: { program: `${trackId}.program`, visual: `${trackId}.visual`, ...(hasAudio ? { audio: `${trackId}.audio` } : {}) }, range: element.range }],
fragments: [fragment],
- exports: [`${trackId}.visual`, ...(hasAudio ? [`${trackId}.audio`] : [])],
+ exports: [`${trackId}.program`, `${trackId}.visual`, ...(hasAudio ? [`${trackId}.audio`] : [])],
};
};
diff --git a/packages/media-track/test/media-track.test.ts b/packages/media-track/test/media-track.test.ts
index ecc3e25e..7e602ff5 100644
--- a/packages/media-track/test/media-track.test.ts
+++ b/packages/media-track/test/media-track.test.ts
@@ -727,7 +727,7 @@ test("the Media author Surface emits explicit graph edges for layers, semantic t
resolveAsset: async () => { throw new Error("no asset resolution expected"); },
});
assert.equal(result.components.length, 1);
- assert.deepEqual(Object.keys(result.components[0]!.outputs).sort(), ["audio", "visual"]);
+ assert.deepEqual(Object.keys(result.components[0]!.outputs).sort(), ["audio", "program", "visual"]);
const fragment = result.fragments[0]!;
const producers = fragment.operations.map((entry) => entry.producer.name);
assert.ok(producers.includes("append-still-media-layer"));
diff --git a/packages/studio/index.html b/packages/studio/index.html
index e6b04d51..ea99f4b8 100644
--- a/packages/studio/index.html
+++ b/packages/studio/index.html
@@ -4,10 +4,6 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="icon" href="data:," />
- <link rel="preconnect" href="https://fonts.googleapis.com" />
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
- <link rel="stylesheet"
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,1,0&display=block" />
<title>Hypit Studio</title>
</head>
<body><div id="app"></div><script type="module" src="/src/ui/main.ts"></script></body>
diff --git a/packages/studio/src/adapters/audio.ts b/packages/studio/src/adapters/audio.ts
index d95e7da7..f5af302d 100644
--- a/packages/studio/src/adapters/audio.ts
+++ b/packages/studio/src/adapters/audio.ts
@@ -18,7 +18,7 @@ export const audioAdapters: readonly StudioAdapter[] = [
{ id: "audio-program", role: "realization", output: { type: "AudioTrackProgram", modules: ["@hypit/audio-track"] } },
{
id: "audio", role: "track", output: { type: "AudioTrack", surface: "track", modules: ["@hypit/audio-track"] },
- family: "audio", icon: "graphic_eq", interaction: readonlyInteraction,
+ family: "audio", icon: "waveform", interaction: readonlyInteraction,
realizationPorts: ["program"], project: projectAudio,
},
];
diff --git a/packages/studio/src/adapters/generic.ts b/packages/studio/src/adapters/generic.ts
index 87b766c7..7917c9b5 100644
--- a/packages/studio/src/adapters/generic.ts
+++ b/packages/studio/src/adapters/generic.ts
@@ -1,22 +1,53 @@
-import type { StudioAdapter } from "./types.js";
-import { readonlyInteraction } from "./types.js";
+import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "./types.js";
+import { childEntities, readonlyInteraction, sameSurfaceValue } from "./types.js";
+import { itemTemporalLineage } from "./temporal.js";
+
+type TypographyTrackProgram = {
+ readonly items?: readonly {
+ readonly id: string;
+ readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };
+ readonly style: { readonly stackingOrder: number };
+ }[];
+};
+
+function projectText(context: StudioAdapterContext): readonly StudioEntityDraft[] {
+ const program = sameSurfaceValue(context, "program") as TypographyTrackProgram | undefined;
+ if (program?.items === undefined) return context.generic();
+ const items = program.items.map((item) => ({
+ id: item.id,
+ startFrame: item.span.startFrame,
+ endFrameExclusive: item.span.endFrameExclusive,
+ stackOrder: item.style.stackingOrder,
+ }));
+ return childEntities(context, items, "typography-item", "text").map((entity, index) => {
+ const item = items[index];
+ if (item === undefined) return entity;
+ const temporal = itemTemporalLineage({
+ runtimeId: item.id, span: item,
+ ...(context.placement === undefined ? {} : { placement: context.placement }),
+ });
+ return temporal === undefined ? entity : { ...entity, temporal };
+ });
+}
export const genericAdapters: readonly StudioAdapter[] = [
{ id: "caption-plan", role: "caption-plan", output: { type: "CaptionPlan" } },
+ { id: "typography-program", role: "realization", output: { type: "TypographyTrackProgram", modules: ["@hypit/typography-track"] } },
{
id: "text", role: "text", output: { type: "VisualTrack", surface: "track", modules: ["@hypit/typography-track"] },
- family: "text", icon: "title", interaction: readonlyInteraction,
+ family: "text", icon: "text", interaction: readonlyInteraction,
+ realizationPorts: ["program"], project: projectText,
},
{
id: "caption", role: "caption", output: { type: "VisualTrack", surface: "track", modules: ["@hypit/caption-fine"] },
- family: "caption", icon: "subtitles", interaction: readonlyInteraction,
+ family: "caption", icon: "captions", interaction: readonlyInteraction,
dependencies: [{ type: "CaptionPlan", role: "caption-plan" }],
},
{
id: "component", role: "track",
output: { type: "VisualTrack", modules: ["@hypit/ranking", "@hypit/comment-sticker", "@hypit/screen-overlay", "@hypit/deck-track"] },
- family: "component", icon: "widgets", interaction: readonlyInteraction,
+ family: "component", icon: "component", interaction: readonlyInteraction,
},
- { id: "audio-fallback", role: "track", output: { type: "AudioTrack" }, family: "audio", icon: "graphic_eq", interaction: readonlyInteraction },
+ { id: "audio-fallback", role: "track", output: { type: "AudioTrack" }, family: "audio", icon: "waveform", interaction: readonlyInteraction },
{ id: "visual-fallback", role: "track", output: { type: "VisualTrack" }, family: "visual", icon: "layers", interaction: readonlyInteraction },
];
diff --git a/packages/studio/src/adapters/media.ts b/packages/studio/src/adapters/media.ts
index 75c89408..ebb850d2 100644
--- a/packages/studio/src/adapters/media.ts
+++ b/packages/studio/src/adapters/media.ts
@@ -1,5 +1,6 @@
import type { StudioAdapter, StudioAdapterContext, StudioEntityDraft } from "./types.js";
import { childEntities, readonlyInteraction, sameSurfaceValue } from "./types.js";
+import { 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 } }[];
@@ -14,7 +15,15 @@ function projectMedia(context: StudioAdapterContext): readonly StudioEntityDraft
stackOrder: item.stacking.order,
}));
return childEntities(context, items, "media-item",
- context.track.type === "AudioTrack" ? "waveform" : "picture");
+ context.track.type === "AudioTrack" ? "waveform" : "picture").map((entity, index) => {
+ const item = items[index];
+ if (item === undefined) return entity;
+ const temporal = itemTemporalLineage({
+ runtimeId: item.id, span: item,
+ ...(context.placement === undefined ? {} : { placement: context.placement }),
+ });
+ return temporal === undefined ? entity : { ...entity, temporal };
+ });
}
export const mediaAdapters: readonly StudioAdapter[] = [
@@ -22,13 +31,13 @@ export const mediaAdapters: readonly StudioAdapter[] = [
{
id: "media-visual", role: "media",
output: { type: "VisualTrack", surface: "track", modules: ["@hypit/media-track"] },
- family: "media", icon: "movie", interaction: readonlyInteraction,
+ family: "media", icon: "video", interaction: readonlyInteraction,
realizationPorts: ["program"], project: projectMedia,
},
{
id: "media-audio", role: "media",
output: { type: "AudioTrack", surface: "track", modules: ["@hypit/media-track"] },
- family: "media", icon: "graphic_eq", interaction: readonlyInteraction,
+ family: "media", icon: "waveform", interaction: readonlyInteraction,
realizationPorts: ["program"], project: projectMedia,
},
];
diff --git a/packages/studio/src/adapters/ranking.ts b/packages/studio/src/adapters/ranking.ts
index 1d2e1a37..1121fab2 100644
--- a/packages/studio/src/adapters/ranking.ts
+++ b/packages/studio/src/adapters/ranking.ts
@@ -4,13 +4,17 @@ import { readonlyInteraction } from "./types.js";
type RankingSchedule = {
readonly variant?: string;
readonly outer?: { readonly startFrame: number; readonly endFrameExclusive: number };
- readonly entries?: readonly ({ readonly itemId: string; readonly mode: "preset" } | {
+ readonly entries?: readonly ({ readonly itemId: string; readonly mode: "preset"; readonly settled: Span } | {
readonly itemId: string;
readonly mode: "reveal";
- readonly active: { readonly startFrame: number; readonly endFrameExclusive: number };
+ readonly preferred: Span;
+ readonly active: Span;
+ readonly settled: Span;
})[];
};
+type Span = { readonly startFrame: number; readonly endFrameExclusive: number };
+
/** Column entities come from the public resolved Schedule, never renderer id conventions. */
function projectRanking(context: StudioAdapterContext): readonly StudioEntityDraft[] {
const placement = context.placement;
@@ -19,6 +23,11 @@ function projectRanking(context: StudioAdapterContext): readonly StudioEntityDra
if (placement === undefined || schedule?.outer === undefined || schedule.variant !== "column") return context.generic();
const boardId = placement.id ?? context.track.outputRef;
const parent = `${context.track.outputRef}:entity:${boardId}`;
+ const outerMarkerId = placement.referenceAttributes.during?.split(".").at(-1);
+ const outerSourceType = placement.referenceTypes.during;
+ const outerSourceKind = outerSourceType === "NarrativeExcerpt" ? "segment" as const : "selection" as const;
+ const outerStartExpression = outerSourceKind === "segment" ? "segment.start" : "selection.start";
+ const outerEndExpression = outerSourceKind === "segment" ? "segment.end" : "selection.end";
const group: StudioEntityDraft = {
id: parent,
authoredId: boardId,
@@ -29,28 +38,54 @@ function projectRanking(context: StudioAdapterContext): readonly StudioEntityDra
elementRange: placement.range,
renderIds: context.spans.map((span) => span.id),
presentation: { entity: "ranking", shape: "group", depth: 0 },
+ temporal: {
+ source: { kind: outerSourceKind, ...(outerMarkerId === undefined ? {} : { id: outerMarkerId }) },
+ projection: {
+ startExpression: outerStartExpression,
+ endExpression: outerEndExpression,
+ ...schedule.outer,
+ },
+ phases: [],
+ },
interaction: readonlyInteraction,
};
const children = new Map(placement.children.flatMap((child) =>
child.id === undefined ? [] : [[child.id, child] as const]));
- const reveals = (schedule.entries ?? []).flatMap((entry): StudioEntityDraft[] => {
- if (entry.mode !== "reveal") return [];
+ const entries = (schedule.entries ?? []).map((entry): StudioEntityDraft => {
const child = children.get(entry.itemId);
const markerId = child?.referenceAttributes.during?.split(".").at(-1);
- return [{
- id: `${context.track.outputRef}:entity:${entry.itemId}:reveal`,
+ const span = entry.mode === "preset"
+ ? entry.settled
+ : { startFrame: entry.active.startFrame, endFrameExclusive: entry.settled.endFrameExclusive };
+ return {
+ id: `${context.track.outputRef}:entity:${entry.itemId}`,
authoredId: entry.itemId,
...(markerId === undefined ? {} : { markerId }),
label: child?.attributes.label ?? entry.itemId,
- startFrame: entry.active.startFrame,
- endFrameExclusive: entry.active.endFrameExclusive,
+ startFrame: span.startFrame,
+ endFrameExclusive: span.endFrameExclusive,
stackOrder: group.stackOrder + 1,
...(child === undefined ? {} : { elementRange: child.range }),
- presentation: { entity: "ranking-reveal", shape: "window", parentId: parent, depth: 1 },
+ presentation: { entity: "ranking-item", shape: "window", parentId: parent, depth: 1 },
+ temporal: entry.mode === "preset" ? {
+ source: { kind: "parent-schedule" },
+ phases: [{ id: `${entry.itemId}:settled`, label: "Settled", role: "settled", ...entry.settled }],
+ } : {
+ source: { kind: "selection", ...(markerId === undefined ? {} : { id: markerId }) },
+ projection: {
+ startExpression: "selection.start",
+ endExpression: "selection.end",
+ ...entry.preferred,
+ },
+ phases: [
+ { id: `${entry.itemId}:active`, label: "Reveal", role: "active", ...entry.active },
+ { id: `${entry.itemId}:settled`, label: "Settled", role: "settled", ...entry.settled },
+ ],
+ },
interaction: readonlyInteraction,
- }];
+ };
});
- return [group, ...reveals];
+ return [group, ...entries];
}
export const rankingAdapters: readonly StudioAdapter[] = [
@@ -58,7 +93,7 @@ export const rankingAdapters: readonly StudioAdapter[] = [
{
id: "ranking-column", role: "track",
output: { type: "VisualTrack", surface: "column", modules: ["@hypit/ranking"] },
- family: "component", icon: "leaderboard", realizationPorts: ["schedule"],
+ family: "component", icon: "ranking", realizationPorts: ["schedule"],
lane: { layout: "nested", boundFacets: false },
interaction: readonlyInteraction, project: projectRanking,
},
diff --git a/packages/studio/src/adapters/speech.ts b/packages/studio/src/adapters/speech.ts
index 729227dd..cc543515 100644
--- a/packages/studio/src/adapters/speech.ts
+++ b/packages/studio/src/adapters/speech.ts
@@ -27,14 +27,14 @@ export const speechAdapters: readonly StudioAdapter[] = [
{
id: "speech-visual", role: "speech-visual",
output: { type: "VisualTrack", surface: "track", modules: ["@hypit/speech-track"], siblingType: "SemanticTrack" },
- family: "speech", icon: "record_voice_over", interaction: readonlyInteraction,
+ family: "speech", icon: "speech", interaction: readonlyInteraction,
realizationPorts: ["semantic"], project: projectSpeech,
lane: { layout: "flat", boundFacets: true },
},
{
id: "speech-audio", role: "speech-audio",
output: { type: "AudioTrack", surface: "track", modules: ["@hypit/speech-track"], siblingType: "SemanticTrack" },
- family: "speech", icon: "graphic_eq", interaction: readonlyInteraction,
+ family: "speech", icon: "waveform", interaction: readonlyInteraction,
realizationPorts: ["semantic"], project: projectSpeech,
lane: { layout: "flat", boundFacets: true },
},
diff --git a/packages/studio/src/adapters/temporal.ts b/packages/studio/src/adapters/temporal.ts
new file mode 100644
index 00000000..5f865943
--- /dev/null
+++ b/packages/studio/src/adapters/temporal.ts
@@ -0,0 +1,117 @@
+import type { Placement } from "../observe.js";
+import type {
+ StudioTemporalLineage,
+ StudioTemporalProjection,
+ StudioTemporalSource,
+} from "../shared.js";
+
+type Point = {
+ readonly ref: "program.start" | "program.end" | "selection.start" | "selection.end" | "segment.start" | "segment.end" | "moment.cue" | "absolute";
+ readonly offset?: unknown;
+ readonly at?: unknown;
+};
+
+type Projection = { readonly start: Point; readonly end: Point };
+type Spec = { readonly id?: string; readonly projection?: Projection };
+
+function valueOf(child: Placement["children"][number]): Spec | undefined {
+ const found = child.values.find((value) => value.type.name === "MediaItemSpec"
+ || value.type.name === "TextItemSpec" || value.type.name === "PlainTextItemSpec");
+ return found?.value as Spec | undefined;
+}
+
+function authoredId(runtimeId: string, children: readonly Placement["children"][number][]): string | undefined {
+ return children
+ .filter((child): child is Placement["children"][number] & { readonly id: string } => child.id !== undefined)
+ .map((child) => child.id)
+ .sort((left, right) => right.length - left.length)
+ .find((id) => runtimeId === id || runtimeId.startsWith(`${id}::`));
+}
+
+function occurrenceId(runtimeId: string, id: string): string | undefined {
+ return runtimeId.startsWith(`${id}::`) ? runtimeId.slice(id.length + 2) : undefined;
+}
+
+function expression(point: Point): string {
+ if (point.ref === "absolute") return duration(point.at);
+ return point.offset === undefined ? point.ref : `${point.ref}${signed(point.offset)}`;
+}
+
+function duration(value: unknown): string {
+ const item = value as { readonly unit?: string; readonly value?: number; readonly numerator?: number; readonly denominator?: number } | undefined;
+ if (item?.unit === "frames") return `${item.value ?? 0}f`;
+ if (item?.unit === "milliseconds") return `${item.value ?? 0}ms`;
+ if (item?.unit === "seconds") return item.denominator === 1
+ ? `${item.numerator ?? 0}s`
+ : `${item.numerator ?? 0}/${item.denominator ?? 1}s`;
+ return "?";
+}
+
+function signed(value: unknown): string {
+ const item = value as { readonly unit?: string; readonly value?: number; readonly numerator?: number } | undefined;
+ if (item === undefined) return "+?";
+ const negative = item?.unit === "seconds" ? (item.numerator ?? 0) < 0 : (item?.value ?? 0) < 0;
+ if (!negative) return `+${duration(value)}`;
+ if (item?.unit === "seconds") return `-${duration({ ...item, numerator: Math.abs(item.numerator ?? 0) })}`;
+ return `-${duration({ ...item, value: Math.abs(item.value ?? 0) })}`;
+}
+
+function markerId(child: Placement["children"][number]): string | undefined {
+ const path = child.referenceAttributes.during
+ ?? child.referenceAttributes.selection
+ ?? child.referenceAttributes.segment
+ ?? child.referenceAttributes.at
+ ?? child.referenceAttributes.moment;
+ return path?.slice(path.lastIndexOf(".") + 1);
+}
+
+function sourceOf(
+ child: Placement["children"][number],
+ projection: Projection,
+ runtimeId: string,
+ id: string,
+): StudioTemporalSource {
+ const marker = markerId(child);
+ const refs = [projection.start.ref, projection.end.ref];
+ const sourceType = child.referenceTypes.during ?? child.referenceTypes.selection
+ ?? child.referenceTypes.segment ?? child.referenceTypes.at ?? child.referenceTypes.moment;
+ const kind = sourceType === "NarrativeSelection" || refs.some((ref) => ref.startsWith("selection."))
+ ? "selection"
+ : sourceType === "NarrativeExcerpt" || refs.some((ref) => ref.startsWith("segment."))
+ ? "segment"
+ : sourceType === "NarrativeMoment" || refs.some((ref) => ref === "moment.cue")
+ ? "moment"
+ : "program";
+ const occurrence = occurrenceId(runtimeId, id);
+ return {
+ kind,
+ ...(marker === undefined ? {} : { id: marker }),
+ ...(occurrence === undefined || occurrence === "program" ? {} : { occurrenceId: occurrence }),
+ };
+}
+
+/**
+ * Join one resolved Program item back to the exact child-authored projection.
+ * The Program supplies the frame truth; the observed inline Spec supplies the
+ * endpoint expressions. Nothing here evaluates or reimplements Temporal.
+ */
+export function itemTemporalLineage(input: {
+ readonly runtimeId: string;
+ readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };
+ readonly placement?: Placement;
+}): StudioTemporalLineage | undefined {
+ const children = input.placement?.children ?? [];
+ const id = authoredId(input.runtimeId, children);
+ const child = id === undefined ? undefined : children.find((candidate) => candidate.id === id);
+ const spec = child === undefined ? undefined : valueOf(child);
+ const projection = spec?.projection;
+ if (child === undefined || projection === undefined) return undefined;
+ const source = sourceOf(child, projection, input.runtimeId, id!);
+ const projected: StudioTemporalProjection = {
+ startExpression: expression(projection.start),
+ endExpression: expression(projection.end),
+ startFrame: input.span.startFrame,
+ endFrameExclusive: input.span.endFrameExclusive,
+ };
+ return { source, projection: projected, phases: [] };
+}
diff --git a/packages/studio/src/adapters/types.ts b/packages/studio/src/adapters/types.ts
index 495ecd8d..7199fb64 100644
--- a/packages/studio/src/adapters/types.ts
+++ b/packages/studio/src/adapters/types.ts
@@ -2,10 +2,12 @@ import type { Placement } from "../observe.js";
import type { BuiltTrack } from "../programme.js";
import type {
Range,
+ SemanticTimeline,
StudioInteraction,
StudioInspectorDescription,
StudioLaneDescription,
StudioTimelinePresentation,
+ StudioTemporalLineage,
StudioTrackFamily,
} from "../shared.js";
@@ -41,6 +43,7 @@ export type StudioEntityDraft = {
readonly renderIds?: readonly string[];
readonly presentation?: StudioTimelinePresentation;
readonly interaction?: StudioInteraction;
+ readonly temporal?: StudioTemporalLineage;
};
export type StudioAdapterContext = {
@@ -48,6 +51,7 @@ export type StudioAdapterContext = {
readonly placement?: Placement;
readonly spans: readonly StudioSpan[];
readonly values: ReadonlyMap<string, unknown>;
+ readonly semantic: SemanticTimeline;
readonly generic: () => readonly StudioEntityDraft[];
};
@@ -103,15 +107,17 @@ export function childEntities(
const children = new Map(context.placement?.children.flatMap((child) =>
child.id === undefined ? [] : [[child.id, child] as const]) ?? []);
return items.map((item) => {
- const child = children.get(item.id);
+ const child = children.get(item.id) ?? [...children.entries()]
+ .sort(([left], [right]) => right.length - left.length)
+ .find(([id]) => item.id.startsWith(`${id}::`))?.[1];
// A dedicated adapter does not reverse-engineer renderer ids. Only an exact
// public identity is safe; richer renderer correspondence needs its own
// declared realization rather than another naming convention.
const render = context.spans.find((span) => span.id === item.id);
return {
id: `${context.track.outputRef}:entity:${item.id}`,
- authoredId: item.id,
- label: item.id,
+ authoredId: child?.id ?? item.id,
+ label: child?.id ?? item.id,
startFrame: item.startFrame,
endFrameExclusive: item.endFrameExclusive,
stackOrder: item.stackOrder,
diff --git a/packages/studio/src/observe.ts b/packages/studio/src/observe.ts
index d032ecdd..04c3a387 100644
--- a/packages/studio/src/observe.ts
+++ b/packages/studio/src/observe.ts
@@ -8,13 +8,19 @@
* keep what passes through.
*/
import type {
- MarkupSurfaceRegistryLike, RegisteredSurface, StructuredElement, SurfaceDecodeOutput,
+ MarkupSurfaceRegistryLike, RegisteredSurface, StructuredElement, StructuredSurfaceInput, SurfaceDecodeOutput,
} from "@hypit/markup";
import type { ModuleRef } from "@hypit/protocol";
import { parseScript } from "@hypit/script";
import type { Range } from "./shared.js";
+export type ObservedValue = {
+ readonly id: string;
+ readonly type: { readonly module: ModuleRef; readonly name: string };
+ readonly value: unknown;
+};
+
/** One authored element, where it was written, and what it produced. */
export type Placement = {
readonly tag: string;
@@ -26,6 +32,8 @@ export type Placement = {
readonly range: Range;
/** Records this element sealed, so a value can be traced back to its tag. */
readonly records: readonly string[];
+ /** Inline author values sealed for this exact element. */
+ readonly values: readonly ObservedValue[];
/** Graph outputs this element declared, named as the author would write them. */
readonly outputs: readonly string[];
/** Exact Surface output port to graph-output mapping. */
@@ -39,10 +47,14 @@ export type Placement = {
/** What the child itself points at, which is how it is placed. */
readonly references: readonly string[];
readonly referenceAttributes: Readonly<Record<string, string>>;
+ readonly referenceTypes: Readonly<Record<string, string>>;
+ /** Inline author values sealed for this exact child. */
+ readonly values: readonly ObservedValue[];
}[];
/** What the author wrote on it: plain text as written, references by path. */
readonly attributes: Readonly<Record<string, string>>;
readonly referenceAttributes: Readonly<Record<string, string>>;
+ readonly referenceTypes: Readonly<Record<string, string>>;
/** Paths this element and its children reference, in the order written. */
readonly references: readonly string[];
};
@@ -117,12 +129,26 @@ export function createObserver(
},
} as RegisteredSurface;
}
- const handler = found.handler as (input: { element: StructuredElement }) => unknown;
+ const handler = found.handler as (input: StructuredSurfaceInput) => unknown;
return {
...found,
- async handler(input: { element: StructuredElement }) {
+ async handler(input: StructuredSurfaceInput) {
const output = await handler(input) as SurfaceDecodeOutput;
const id = input.element.attributes.id;
+ const observed = output.records.flatMap((record): ObservedValue[] => record.value.kind === "inline" ? [{
+ id: record.id,
+ type: { module: { ...record.type.module }, name: record.type.name },
+ value: structuredClone(record.value.value),
+ }] : []);
+ const valuesFor = (range: { readonly start: number; readonly end: number }): readonly ObservedValue[] =>
+ observed.filter((value) => output.records.some((record) =>
+ record.id === value.id && record.range.start === range.start && record.range.end === range.end));
+ const referenceTypes = (element: StructuredElement): Readonly<Record<string, string>> => Object.fromEntries(
+ Object.entries(referenceAttributes(element)).flatMap(([name, path]) => {
+ const resolved = input.resolveReference(path);
+ return resolved === undefined ? [] : [[name, resolved.type.name]];
+ }),
+ );
placements.push({
tag: input.element.name,
module: { ...module },
@@ -130,11 +156,13 @@ export function createObserver(
...(typeof id === "string" ? { id } : {}),
range: { start: input.element.range.start, end: input.element.range.end },
records: output.records.map((record) => record.id),
+ values: valuesFor(input.element.range),
outputs: output.components.flatMap((component) => Object.values(component.outputs)),
outputPorts: output.components.flatMap((component) =>
Object.entries(component.outputs).map(([name, ref]) => ({ name, ref }))),
attributes: written(input.element),
referenceAttributes: referenceAttributes(input.element),
+ referenceTypes: referenceTypes(input.element),
references: [
...referenced(input.element),
...input.element.children
@@ -152,6 +180,8 @@ export function createObserver(
attributes: written(child),
references: referenced(child),
referenceAttributes: referenceAttributes(child),
+ referenceTypes: referenceTypes(child),
+ values: valuesFor(child.range),
};
}),
});
diff --git a/packages/studio/src/server.ts b/packages/studio/src/server.ts
index 1b2c00cf..188b6882 100644
--- a/packages/studio/src/server.ts
+++ b/packages/studio/src/server.ts
@@ -1,6 +1,7 @@
import { watch } from "node:fs";
import type { FSWatcher } from "node:fs";
import { writeFile } from "node:fs/promises";
+import { relative } from "node:path";
import type { Plugin, ViteDevServer } from "vite";
@@ -15,6 +16,7 @@ export type StudioPluginOptions = {
readonly source: string;
readonly runPath: string;
readonly domain: StudioDomain;
+ readonly workspaceRoot: string;
readonly archive?: StudioArchive;
};
@@ -76,6 +78,7 @@ export function studioPlugin(options: StudioPluginOptions): Plugin {
run,
...(options.archive === undefined ? {} : { archive: options.archive }),
revision: attempt,
+ sourcePath: relative(options.workspaceRoot, run.authorSource),
});
if (attempt !== requestedRevision) return;
revision = attempt;
diff --git a/packages/studio/src/session.ts b/packages/studio/src/session.ts
index 5cb430d5..a0620d9a 100644
--- a/packages/studio/src/session.ts
+++ b/packages/studio/src/session.ts
@@ -24,6 +24,7 @@ export async function readStudioSession(input: {
readonly run: RunPlan;
readonly archive?: StudioArchive;
readonly revision: number;
+ readonly sourcePath?: string;
}): Promise<StudioSession> {
const source = input.run.source;
const inspection = inspectStudioRun(source, input.run);
@@ -50,7 +51,7 @@ export async function readStudioSession(input: {
return {
snapshot: snapshot(built, {
revision: input.revision,
- path: input.run.authorSource,
+ path: input.sourcePath ?? input.run.authorSource,
text,
canvas: built.canvas,
frameRate: built.frameRate,
diff --git a/packages/studio/src/shared.ts b/packages/studio/src/shared.ts
index 223b1a1c..9348c607 100644
--- a/packages/studio/src/shared.ts
+++ b/packages/studio/src/shared.ts
@@ -9,23 +9,52 @@ export type Range = { readonly start: number; readonly end: number };
export type CandidateOrigin = "run" | "source" | "none";
export type CandidateStatus = "resolved" | "unresolved";
-export type StudioTrackFamily =
- | "speech"
- | "media"
- | "text"
- | "caption"
- | "component"
- | "audio"
- | "visual";
+/** Adapter-owned family id. Studio must not make third-party families edit this protocol. */
+export type StudioTrackFamily = string;
export type StudioTimelinePresentation = {
/** What one selectable box means, never how the renderer happened to split it. */
- readonly entity: "present" | "audio-clip" | "semantic-take" | "media-item" | "caption-cue" | "ranking" | "ranking-reveal";
- readonly shape: "block" | "picture" | "waveform" | "words" | "group" | "window";
+ readonly entity: string;
+ readonly shape: string;
readonly parentId?: string;
readonly depth: number;
};
+/** One semantic source that an authored component bound its timing to. */
+export type StudioTemporalSource = {
+ readonly kind: "program" | "selection" | "segment" | "moment" | "parent-schedule";
+ readonly id?: string;
+ /** Repeated Selection/Moment occurrences stay distinct when a component expands `each`. */
+ readonly occurrenceId?: string;
+};
+
+/** The exact authored endpoint expressions and the frame window they projected to. */
+export type StudioTemporalProjection = {
+ readonly startExpression: string;
+ readonly endExpression: string;
+ readonly startFrame: number;
+ readonly endFrameExclusive: number;
+};
+
+export type StudioTemporalPhase = {
+ readonly id: string;
+ readonly label: string;
+ readonly role: "preferred" | "active" | "settled" | "enter" | "body" | "exit";
+ readonly startFrame: number;
+ readonly endFrameExclusive: number;
+};
+
+/**
+ * Studio's explanation of an entity's time. The Clip span remains the actual
+ * consumption window; this value preserves how author and component arrived
+ * there without pretending every layer is another Track item.
+ */
+export type StudioTemporalLineage = {
+ readonly source: StudioTemporalSource;
+ readonly projection?: StudioTemporalProjection;
+ readonly phases: readonly StudioTemporalPhase[];
+};
+
export type StudioInteraction = {
readonly select: boolean;
readonly seek: "start" | "pointer" | "none";
@@ -105,6 +134,7 @@ export type Clip = {
readonly elementRange?: Range;
readonly stackOrder: number;
readonly presentation: StudioTimelinePresentation;
+ readonly temporal?: StudioTemporalLineage;
readonly interaction: StudioInteraction;
/** Rendering identities implementing this author entity; optional for non-visual entities. */
readonly renderIds: readonly string[];
@@ -190,6 +220,19 @@ export type SemanticTimeline = {
readonly anchors: readonly SemanticAnchor[];
readonly segments: readonly SemanticSegment[];
readonly tokens: readonly SemanticToken[];
+ readonly selections: readonly {
+ readonly id: string;
+ readonly occurrence: number;
+ readonly occurrenceId: string;
+ readonly startFrame: number;
+ readonly endFrameExclusive: number;
+ }[];
+ readonly moments: readonly {
+ readonly id: string;
+ readonly occurrence: number;
+ readonly occurrenceId: string;
+ readonly frame: number;
+ }[];
/** The SemanticTrack candidate that supplied these frame anchors. */
readonly provenance: CandidateProvenance;
};
@@ -197,6 +240,7 @@ export type SemanticTimeline = {
export type StudioSnapshot = {
readonly revision: number;
readonly source: {
+ /** Workspace-relative presentation path; the server retains the absolute write target. */
readonly path: string;
readonly text: string;
};
@@ -214,7 +258,7 @@ export type StudioSnapshot = {
* The special Studio lane. This is not another VisualTrack: it is the
* Narrative's segment/word geometry projected onto the same frame domain.
*/
- readonly semantic?: SemanticTimeline;
+ readonly semantic: SemanticTimeline;
/**
* The picture, ready to mount. Real material is the base layer rather than the
* whole picture: the Tracks above it have not been rendered into that file, so
diff --git a/packages/studio/src/snapshot.ts b/packages/studio/src/snapshot.ts
index 09def553..c70b44d1 100644
--- a/packages/studio/src/snapshot.ts
+++ b/packages/studio/src/snapshot.ts
@@ -138,6 +138,18 @@ type NarrativeValue = {
readonly endAnchorId: string;
readonly text: string;
}[];
+ readonly selections?: readonly {
+ readonly id: string;
+ readonly occurrences: readonly {
+ readonly occurrence: number;
+ readonly startAnchorId: string;
+ readonly endAnchorId: string;
+ }[];
+ }[];
+ readonly moments?: readonly {
+ readonly id: string;
+ readonly occurrences: readonly { readonly occurrence: number; readonly anchorId: string }[];
+ }[];
readonly semanticIndex?: {
readonly anchors?: readonly {
readonly id: string;
@@ -163,11 +175,11 @@ function inlineRecord(compiled: unknown, id: string): unknown {
* already using. No frontend timing is invented here: if an anchor is absent
* from the built SemanticTrack, the corresponding item is simply not drawable yet.
*/
-function semanticTimeline(built: Preview, script: ScriptMap | undefined): SemanticTimeline | undefined {
+function semanticTimeline(built: Preview, script: ScriptMap | undefined): SemanticTimeline {
const exported = built.source.exports.find((item) => item.type === "Narrative");
- if (exported === undefined) return undefined;
+ if (exported === undefined) throw new Error("Studio SemanticTrack has no traceable Narrative.");
const narrative = inlineRecord(built.source.compiled, exported.ref) as NarrativeValue | undefined;
- if (narrative === undefined) return undefined;
+ if (narrative === undefined) throw new Error("Studio Narrative is not an inline authored value.");
const segmentRanges = new Map((script?.segments ?? []).map((item) => [item.id, item.range]));
const tokenRanges = new Map((script?.tokens ?? []).map((item) => [item.id, item.range]));
@@ -208,7 +220,30 @@ function semanticTimeline(built: Preview, script: ScriptMap | undefined): Semant
...(anchor.tokenId === undefined ? {} : { tokenId: anchor.tokenId }),
}];
});
- if (segments.length === 0 && tokens.length === 0) return undefined;
+ const selections = (narrative.selections ?? []).flatMap((selection) =>
+ selection.occurrences.flatMap((occurrence) => {
+ const startFrame = frame(occurrence.startAnchorId);
+ const endFrameExclusive = frame(occurrence.endAnchorId);
+ if (startFrame === undefined || endFrameExclusive === undefined || endFrameExclusive <= startFrame) return [];
+ return [{
+ id: selection.id,
+ occurrence: occurrence.occurrence,
+ occurrenceId: `${selection.id}#${occurrence.occurrence}`,
+ startFrame,
+ endFrameExclusive,
+ }];
+ }));
+ const moments = (narrative.moments ?? []).flatMap((moment) =>
+ moment.occurrences.flatMap((occurrence) => {
+ const at = frame(occurrence.anchorId);
+ return at === undefined ? [] : [{
+ id: moment.id,
+ occurrence: occurrence.occurrence,
+ occurrenceId: `${moment.id}#${occurrence.occurrence}`,
+ frame: at,
+ }];
+ }));
+ if (segments.length === 0) throw new Error("Studio SemanticTrack resolves no authored Segment anchors.");
const provenance: CandidateProvenance = {
output: built.timingOutput?.name ?? "SemanticTrack",
...(built.timingOutput?.ref === undefined ? {} : { outputRef: built.timingOutput.ref }),
@@ -221,6 +256,8 @@ function semanticTimeline(built: Preview, script: ScriptMap | undefined): Semant
anchors: anchors.sort((left, right) => left.frame - right.frame || left.id.localeCompare(right.id)),
segments: segments.sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id)),
tokens: tokens.sort((left, right) => left.startFrame - right.startFrame || left.id.localeCompare(right.id)),
+ selections: selections.sort((left, right) => left.startFrame - right.startFrame || left.occurrenceId.localeCompare(right.occurrenceId)),
+ moments: moments.sort((left, right) => left.frame - right.frame || left.occurrenceId.localeCompare(right.occurrenceId)),
provenance,
};
}
@@ -306,6 +343,7 @@ export function snapshot(built: Preview, input: {
...(placement === undefined ? {} : { placement }),
spans: projectedSpans,
values: built.values,
+ semantic,
generic,
}).map((draft) => sealStudioClip(item.outputRef, draft, binding));
const provenance: CandidateProvenance = {
@@ -356,7 +394,7 @@ export function snapshot(built: Preview, input: {
durationSec: frameCount * input.frameRate.denominator / input.frameRate.numerator,
},
tracks: rows,
- ...(semantic === undefined ? {} : { semantic }),
+ semantic,
preview: input.preview,
provenance: {
timing: "measured",
diff --git a/packages/studio/src/studio-registry.ts b/packages/studio/src/studio-registry.ts
index a7b55126..890e9412 100644
--- a/packages/studio/src/studio-registry.ts
+++ b/packages/studio/src/studio-registry.ts
@@ -23,7 +23,7 @@ const REGISTRY: readonly StudioAdapter[] = [
function matches(
adapter: StudioAdapter,
type: string,
- placement: Placement | undefined,
+ placement: Pick<Placement, "surface" | "module"> | undefined,
siblingTypes: readonly string[],
): boolean {
const rule = adapter.output;
@@ -33,12 +33,29 @@ function matches(
&& (rule.siblingType === undefined || siblingTypes.includes(rule.siblingType));
}
+function specificity(adapter: StudioAdapter): number {
+ const rule = adapter.output;
+ return (rule.surface === undefined ? 0 : 8)
+ + (rule.siblingType === undefined ? 0 : 4)
+ + (rule.modules === undefined ? 0 : 2);
+}
+
function adapterFor(
type: string,
- placement: Placement | undefined,
+ placement: Pick<Placement, "surface" | "module"> | undefined,
siblingTypes: readonly string[],
): StudioAdapter | undefined {
- return REGISTRY.find((adapter) => matches(adapter, type, placement, siblingTypes));
+ const candidates = REGISTRY
+ .filter((adapter) => matches(adapter, type, placement, siblingTypes))
+ .map((adapter) => ({ adapter, score: specificity(adapter) }))
+ .sort((left, right) => right.score - left.score || left.adapter.id.localeCompare(right.adapter.id));
+ const best = candidates[0];
+ if (best === undefined) return undefined;
+ const tied = candidates.filter((candidate) => candidate.score === best.score);
+ if (tied.length > 1) {
+ throw new Error(`Studio adapters are ambiguous for ${type}: ${tied.map((candidate) => candidate.adapter.id).join(", ")}`);
+ }
+ return best.adapter;
}
export function classifyStudioOutput(
@@ -67,23 +84,29 @@ export function studioRealizationPorts(
return adapterFor(type, placement, siblingTypes)?.realizationPorts ?? [];
}
-function trackAdapter(track: BuiltTrack): StudioAdapter {
- return REGISTRY.find((adapter) =>
- adapter.family !== undefined
- && adapter.role === track.role
- && adapter.output.type === track.type
- && (adapter.output.surface === undefined || adapter.output.surface === track.trace.surface)
- && (adapter.output.modules === undefined
- || (track.trace.module !== undefined && adapter.output.modules.includes(track.trace.module))))!;
+function trackAdapter(track: BuiltTrack): StudioAdapter & { readonly family: StudioTrackBinding["family"] } {
+ const placement = track.trace.surface === undefined || track.trace.module === undefined
+ ? undefined
+ : {
+ surface: track.trace.surface,
+ module: { name: track.trace.module, version: "" },
+ };
+ const siblingTypes = track.trace.outputPorts.flatMap((item) => item.type === undefined ? [] : [item.type]);
+ const adapter = adapterFor(track.type, placement, siblingTypes);
+ const family = adapter?.family;
+ if (adapter === undefined || family === undefined) {
+ throw new Error(`Studio has no timeline adapter for ${track.type} (${track.name}).`);
+ }
+ return { ...adapter, family };
}
export function bindStudioTrack(track: BuiltTrack): StudioTrackBinding {
const adapter = trackAdapter(track);
return {
- family: adapter.family!,
+ family: adapter.family,
facet: track.type === "AudioTrack" ? "audio" : "visual",
groupId: track.trace.authoredId ?? track.outputRef,
- icon: adapter.icon!,
+ icon: adapter.icon ?? (track.type === "AudioTrack" ? "waveform" : "layers"),
adapter: adapter.id,
lane: adapter.lane ?? flatLane,
inspector: adapter.inspector ?? standardInspector,
@@ -98,6 +121,7 @@ export function projectStudioTrack(input: {
readonly placement?: Placement;
readonly spans: readonly StudioSpan[];
readonly values: ReadonlyMap<string, unknown>;
+ readonly semantic: import("./shared.js").SemanticTimeline;
readonly generic: () => readonly StudioEntityDraft[];
}): readonly StudioEntityDraft[] {
return trackAdapter(input.track).project?.(input) ?? input.generic();
@@ -123,6 +147,7 @@ export function sealStudioClip(
shape: fallback.facet === "audio" ? "waveform" : "block",
depth: 0,
},
+ ...(draft.temporal === undefined ? {} : { temporal: draft.temporal }),
interaction: draft.interaction ?? fallback.interaction,
renderIds: draft.renderIds ?? (draft.presentId === undefined ? [] : [draft.presentId]),
};
diff --git a/packages/studio/src/studio-trace.ts b/packages/studio/src/studio-trace.ts
index b77e3e98..0eeed174 100644
--- a/packages/studio/src/studio-trace.ts
+++ b/packages/studio/src/studio-trace.ts
@@ -20,7 +20,7 @@ export type StudioTrace = {
readonly surface?: string;
readonly module?: string;
readonly authoredId?: string;
- readonly outputPorts: readonly { readonly name: string; readonly ref: string }[];
+ readonly outputPorts: readonly { readonly name: string; readonly ref: string; readonly type?: string }[];
readonly references: readonly StudioTraceDependency[];
};
@@ -79,10 +79,14 @@ export function traceFor(source: CompiledSource, ref: string): StudioTrace {
surface: placement.surface,
module: placement.module.name,
...(placement.id === undefined ? {} : { authoredId: placement.id }),
- outputPorts: placement.outputPorts.map((port) => ({
- name: port.name,
- ref: outputFor(source, port.ref)?.ref ?? port.ref,
- })),
+ outputPorts: placement.outputPorts.map((port) => {
+ const output = outputFor(source, port.ref);
+ return {
+ name: port.name,
+ ref: output?.ref ?? port.ref,
+ ...(output?.type === undefined ? {} : { type: output.type }),
+ };
+ }),
references: refs,
};
}
diff --git a/packages/studio/src/style.css b/packages/studio/src/style.css
index 960dd1ff..ab243240 100644
--- a/packages/studio/src/style.css
+++ b/packages/studio/src/style.css
@@ -1,331 +1,282 @@
:root {
color-scheme: dark;
- --bg: #08090b;
- --panel: #0e1013;
- --panel-raised: #13161a;
- --panel-soft: #171a1f;
- --inset: #090b0e;
- --line: rgba(255, 255, 255, 0.075);
- --line-strong: rgba(255, 255, 255, 0.13);
- --text: #f3f4f6;
- --text-soft: #c8ccd2;
- --muted: #858b95;
- --dim: #555c66;
- --accent: #ff745f;
- --marker: #f5c95b;
- --danger: #ff6f78;
- --ok: #57d39b;
+ --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;
--workspace-width: 300px;
- font: 13px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+ font: 13px/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(--bg); color: var(--text);
+ overscroll-behavior: none; background: var(--s0); color: var(--t1);
}
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(255, 116, 95, 0.28); color: #fff; }
+::selection { background: rgba(77, 141, 255, .3); color: var(--t1); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
-*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }
+*::-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; }
+.icon, .pane-icon { width: 16px; height: 16px; display: block; flex: none; }
#app { display: flex; flex-direction: column; position: relative; }
-.material-symbols-rounded {
- font-family: "Material Symbols Rounded"; font-size: 20px; line-height: 1; font-weight: 400;
- font-style: normal; letter-spacing: normal; text-transform: none; white-space: nowrap;
- direction: ltr; -webkit-font-feature-settings: "liga"; font-variation-settings: "FILL" 1;
-}
-/* Application chrome ------------------------------------------------ */
+/* Chrome ----------------------------------------------------------- */
.topbar {
- height: 48px; flex: none; display: grid;
- grid-template-columns: minmax(190px, auto) minmax(120px, 1fr) auto auto auto;
- align-items: center; gap: 14px; padding: 0 14px;
- border-bottom: 1px solid var(--line); background: #0b0d10;
- user-select: none;
-}
-.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
-.brand-mark {
- width: 26px; height: 26px; display: grid; place-items: center;
- border-radius: 7px; background: var(--text); color: #0a0b0d;
- font-size: 14px; font-weight: 850; letter-spacing: -.04em;
+ 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 > div { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
-.brand strong { font-size: 13px; font-weight: 680; letter-spacing: -.01em; white-space: nowrap; }
-.brand small { color: var(--dim); font-size: 10px; white-space: nowrap; }
+.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; }
.project-title {
- min-width: 0; justify-self: center; max-width: 360px; overflow: hidden;
- color: var(--text-soft); font-size: 12px; font-weight: 580; text-overflow: ellipsis; white-space: nowrap;
+ 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;
}
-.meta { color: var(--dim); font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
-.badges { display: flex; gap: 5px; }
-.badge {
- padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px;
- background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; white-space: nowrap;
-}
-.status { min-width: 94px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
-.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
-.status.ok i { background: var(--ok); box-shadow: 0 0 0 3px rgba(87,211,155,.08); }
+.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); }
.studio-shell {
flex: 1; min-height: 0; display: grid;
grid-template-columns: var(--source-width) 5px minmax(360px, 1fr);
- background: var(--bg); user-select: none;
+ 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(--panel); }
-.workspace-panel { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); }
-.workbench {
- --timeline-height: 330px;
- display: grid; grid-template-rows: minmax(0, 1fr) 5px var(--timeline-height);
- overflow: hidden; background: #07080a;
-}
-.preview-row {
- --workspace-width: 300px;
- min-height: 0; display: grid;
- grid-template-columns: minmax(0, 1fr) 5px var(--workspace-width);
- overflow: hidden;
-}
+.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; }
-
-.pane-heading {
- height: 44px; flex: none; display: flex; align-items: center; justify-content: space-between;
- padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel);
+.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);
}
-.pane-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
+.pane-title, .stage-title { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--t2); }
.pane-title > div { min-width: 0; }
-.pane-title h2 { margin: 0; color: var(--text-soft); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
-.pane-title span:not(.pane-icon) { display: block; max-width: 260px; overflow: hidden; color: var(--dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
-.pane-icon { color: var(--muted); font-size: 17px; }
+.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: 26px; height: 26px; display: grid; place-items: center; padding: 0;
- border: 0; border-radius: 5px; background: transparent; color: var(--muted);
+ 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: rgba(255,255,255,.07); color: var(--text); }
-.icon-button:active { background: rgba(255,255,255,.11); }
-.icon-button .material-symbols-rounded { font-size: 17px; }
+.icon-button:hover { background: var(--s3); color: var(--t1); }
-/* 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(--dim); font-size: 9px; white-space: nowrap; }
-.code-save-state.saving, .code-save-state.dirty { color: var(--marker); }
+.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-save-state.error { color: var(--danger); }
.code-scroll {
- position: relative; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto;
- padding: 10px 10px 42px 0; background: #0b0d10;
- font: 11.5px/20px ui-monospace, SFMono-Regular, Menlo, monospace;
+ 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;
}
.code-editor {
- display: none; flex: 1; min-height: 0; width: 100%; resize: none; padding: 12px 14px;
- border: 0; background: #0a0c0f; color: #d2d6dc;
- font: 11.5px/20px ui-monospace, SFMono-Regular, Menlo, monospace;
+ 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;
}
.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; }
-.code-line .line-number { flex: none; width: 46px; padding-right: 19px; text-align: right; color: #404650; user-select: none; }
+.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.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 .gutter-bar { opacity: 1; }
.code-line.bound:hover .line-number { color: var(--tone, #fff); }
-.code-line code { flex: 1; min-width: 0; padding-right: 5px; color: #8d949e; font: inherit; white-space: pre-wrap; overflow-wrap: break-word; }
-.tok-header, .tok-comment { color: #505762; font-style: italic; }
-.tok-punct { color: #686f79; }
-.tok-tag { color: #7dadf2; }
-.tok-attr { color: #bd9ae0; }
-.tok-string { color: #80c99a; }
-.tok-reference { color: #ef8a73; }
-.tok-marker { color: var(--marker); font-weight: 650; cursor: pointer; }
-.tok-role { color: #e987aa; }
-.tone-0 { --tone: #f5c95b; } .tone-1 { --tone: #61c3e8; }
-.tone-2 { --tone: #82cf8a; } .tone-3 { --tone: #db86bd; }
+.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; }
.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) 12%, transparent);
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 30%, transparent);
- border-radius: 3px; padding: 0 1px;
+ color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, transparent); border-radius: 3px; padding: 0 1px;
}
.range-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
-.spoken { position: absolute; z-index: 0; border-radius: 3px; background: rgba(245,201,91,.12); box-shadow: inset 0 0 0 1px rgba(245,201,91,.35); pointer-events: none; }
-.range-element { fill: rgba(255,255,255,.055); stroke: rgba(255,255,255,.82); stroke-width: 1.2; }
-.range-binding { fill: color-mix(in srgb, var(--tone, var(--marker)) 9%, transparent); stroke: var(--tone, var(--marker)); stroke-width: 1.2; }
+.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; }
-/* Preview ----------------------------------------------------------- */
-.stage { height: 100%; min-height: 0; display: flex; flex-direction: column; background: #08090b; }
-.stage-heading { height: 38px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); background: #0c0e11; }
-.stage-title { display: flex; align-items: center; gap: 7px; color: var(--text-soft); }
-.stage-title .material-symbols-rounded { color: var(--muted); font-size: 17px; }
-.stage-title strong { font-size: 11px; font-weight: 650; }
-.stage-canvas { color: var(--dim); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
+/* 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; }
.stage-viewport {
flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
- padding: 18px; background: radial-gradient(circle at 50% 48%, rgba(255,255,255,.035), transparent 42%), #07080a;
+ padding: 14px; background: var(--s0);
}
.stage-scaler { position: relative; transform-origin: top left; }
-.stage iframe {
- display: block; border: 0; border-radius: 3px; background: #000; transform-origin: top left;
- pointer-events: none; box-shadow: 0 22px 70px rgba(0,0,0,.68), 0 0 0 1px rgba(255,255,255,.13);
-}
+.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-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) 8%, transparent); stroke: var(--tone); stroke-width: 2; }
+.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 Inter, sans-serif; paint-order: stroke; stroke: rgba(0,0,0,.85); stroke-width: 5px; }
+.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: 3px;
- border-top: 1px solid var(--line); background: #0c0e11;
-}
-.stage-bar button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
-.stage-bar button:hover { background: rgba(255,255,255,.07); color: var(--text); }
-.stage-bar button[data-play] { width: 34px; height: 34px; margin: 0 2px; background: var(--text); color: #0a0b0d; border-radius: 50%; }
-.stage-bar button[data-play]:hover { background: #fff; transform: scale(1.025); }
-.stage-bar button[data-play] .material-symbols-rounded { font-size: 23px; }
-.stage-time { position: absolute; left: 12px; color: var(--dim); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
+.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; }
.stage-mute { margin-left: 5px; }
-/* Workspace --------------------------------------------------------- */
+/* Inspector -------------------------------------------------------- */
.workspace-panel { overflow: hidden; }
-.workspace-scroll { flex: 1; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
-.workspace-section { min-width: 0; padding: 0; }
-.inspector { min-width: 0; 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(--dim); text-align: center; }
-.inspector-empty .material-symbols-rounded { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: #525963; font-size: 19px; }
-.inspector-empty strong { color: var(--muted); font-size: 11px; font-weight: 620; }
-.inspector-empty small { max-width: 190px; margin-top: 5px; color: var(--dim); font-size: 9px; line-height: 1.5; }
-.selection-hero { min-width: 0; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 14px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.018), transparent); }
-.selection-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line)); border-radius: 8px; background: rgba(255,116,95,.08); color: var(--accent); }
-.selection-icon .material-symbols-rounded { font-size: 17px; }
+.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-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(--text); font-size: 11px; font-weight: 650; }
-.selection-title small { margin-top: 2px; color: var(--dim); font-size: 9px; }
-.selection-kind { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 8px; }
-.property-group { min-width: 0; padding: 13px 12px 14px; border-bottom: 1px solid var(--line); }
-.property-group h3 { margin: 0 0 9px; color: var(--dim); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
-.property-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
-.property { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.018); }
-.property > span { overflow: hidden; color: var(--dim); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
-.property > strong { min-width: 0; overflow: hidden; color: var(--text-soft); font-size: 10px; font-weight: 590; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
-.property-wide { grid-column: 1 / -1; }
-.property-code > strong { font: 9px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; }
-.inspector-notice { min-width: 0; display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 8px; margin: 12px; padding: 9px; border: 1px solid rgba(245,201,91,.18); border-radius: 6px; background: rgba(245,201,91,.055); }
-.inspector-notice > .material-symbols-rounded { color: var(--marker); font-size: 16px; }
-.inspector-notice strong { display: block; color: var(--marker); font-size: 9px; font-weight: 620; }
-.inspector-notice p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
-/* Timeline ---------------------------------------------------------- */
-.timeline { height: 100%; min-height: 0; display: flex; flex-direction: column; background: #090b0e; }
-.timeline-toolbar { height: 38px; flex: none; display: grid; grid-template-columns: minmax(190px,1fr) auto minmax(190px,1fr); align-items: center; gap: 8px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--line); background: #0d0f12; }
+.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; }
+.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 > .material-symbols-rounded { color: var(--muted); font-size: 17px; }
-.timeline-title strong { color: var(--text-soft); font-size: 11px; font-weight: 650; }
-.timeline-mode { display: inline-flex; align-items: center; gap: 5px; margin-left: 3px; color: var(--dim); font-size: 9px; }
-.timeline-mode i { width: 5px; height: 5px; border-radius: 50%; background: #72a4ff; }
-.timeline-readout { justify-self: center; color: var(--text-soft); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
+.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-view-actions { justify-content: flex-end; }
-.timeline-hint { margin-right: 3px; color: var(--dim); font-size: 9px; }
-.timeline-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 126px minmax(0,1fr); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
-.timeline-labels { position: sticky; left: 0; z-index: 3; border-right: 1px solid var(--line); background: var(--panel); }
-.label-corner { position: sticky; top: 0; z-index: 4; height: 24px; display: flex; align-items: center; justify-content: flex-end; padding-right: 9px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--dim); font: 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
-.track-label { min-height: 52px; min-width: 0; display: grid; grid-template-columns: 22px minmax(0,1fr) 8px; align-items: center; gap: 5px; padding: 0 8px; border-bottom: 1px solid var(--line); background: #0f1115; }
-.track-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: color-mix(in srgb, var(--track) 13%, transparent); color: var(--track); font-size: 14px; }
+.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; }
.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(--text-soft); font-size: 10px; font-weight: 620; }
-.track-copy small { margin-top: 2px; color: var(--dim); font-size: 8.5px; }
-.track-state { color: var(--marker); font-size: 10px; }
-.track-media { --track: #668cf1; } .track-speech { --track: #55c6a2; }
-.track-caption { --track: #b27ee5; } .track-component { --track: #ef9469; }
-.track-audio { --track: #d7b95d; } .track-visual { --track: #7da0bb; }
+.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; }
.timeline-lanes { position: relative; min-width: 0; cursor: default; user-select: none; touch-action: pan-y; }
-.ruler { position: sticky; top: 0; z-index: 2; height: 24px; border-bottom: 1px solid var(--line); background: #0d0f12; cursor: ew-resize; }
-.tick { position: absolute; top: 0; height: 24px; padding-left: 5px; border-left: 1px solid rgba(255,255,255,.08); color: var(--dim); font: 8.5px/24px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
-.tick-last { padding-left: 0; padding-right: 5px; border-right: 1px solid rgba(255,255,255,.08); border-left: 0; transform: translateX(-100%); }
-.lane { position: relative; min-height: 52px; border-bottom: 1px solid var(--line); background-color: #090b0e; background-image: linear-gradient(to right, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 48px 100%; }
-.semantic-label { --track: #7da0bb; align-items: start; padding-top: 10px; background: #10151b; }
-.semantic-label .track-icon { margin-top: 1px; }
-.semantic-label .track-copy small { white-space: normal; line-height: 1.2; }
-.semantic-lane { min-height: 72px; overflow: hidden; background-color: #0a0e13; background-image: linear-gradient(to right, rgba(125,160,187,.08) 1px, transparent 1px); background-size: 48px 100%; }
-.semantic-segment { --semantic-tone: #7199b8; position: absolute; top: 7px; bottom: 7px; min-width: 3px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--semantic-tone) 65%, var(--line)); border-radius: 7px; background: linear-gradient(180deg, color-mix(in srgb, var(--semantic-tone) 22%, #172029), color-mix(in srgb, var(--semantic-tone) 10%, #10151b)); color: var(--text); text-align: left; cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.055); transition: border-color 100ms ease, box-shadow 100ms ease, filter 100ms ease; }
-.semantic-segment:hover, .semantic-segment:focus-visible { z-index: 5; border-color: color-mix(in srgb, var(--semantic-tone) 90%, #fff 12%); filter: brightness(1.08); outline: none; }
-.semantic-segment.live { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,116,95,.45), 0 0 14px rgba(255,116,95,.08); }
-.semantic-segment-label { position: absolute; top: 4px; left: 8px; right: 8px; overflow: hidden; color: color-mix(in srgb, var(--semantic-tone) 68%, var(--text-soft)); font-size: 9px; font-weight: 650; line-height: 12px; white-space: nowrap; text-overflow: clip; pointer-events: none; }
-.semantic-words { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 27px; pointer-events: none; }
-.semantic-word { position: absolute; top: 0; height: 25px; min-width: 2px; overflow: hidden; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--semantic-tone) 45%, var(--line)); border-radius: 4px; background: color-mix(in srgb, var(--semantic-tone) 22%, #151b21); color: var(--text-soft); font: inherit; text-align: left; white-space: nowrap; cursor: pointer; pointer-events: auto; }
-.semantic-word:hover, .semantic-word:focus-visible { z-index: 6; border-color: color-mix(in srgb, var(--semantic-tone) 84%, #fff 10%); outline: none; }
-.semantic-word.current { border-color: color-mix(in srgb, var(--accent) 72%, #fff 10%); background: color-mix(in srgb, var(--accent) 16%, #151b21); }
-.semantic-word-label { display: block; overflow: hidden; color: inherit; font-size: 8px; line-height: 23px; white-space: nowrap; text-overflow: clip; pointer-events: none; }
-.semantic-segment-label.label-hidden, .semantic-word.label-hidden .semantic-word-label { display: none; }
-.semantic-anchor { position: absolute; top: 22px; bottom: 7px; width: 1px; background: color-mix(in srgb, var(--semantic-tone) 54%, transparent); opacity: .45; pointer-events: none; }
-.semantic-anchor-segment-start, .semantic-anchor-segment-end { opacity: .86; background: color-mix(in srgb, var(--semantic-tone) 82%, #fff 8%); }
-.semantic-segment.semantic-coarse .semantic-words, .semantic-segment.semantic-coarse .semantic-anchor { display: none; }
-.clip { --tone: var(--track); position: absolute; height: 40px; min-width: 3px; margin-top: 6px; display: flex; align-items: center; gap: 6px; padding: 0 8px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tone) 36%, var(--line)); border-radius: 5px; background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 18%, #171a20), color-mix(in srgb, var(--tone) 10%, #111419)); color: var(--text); text-align: left; box-shadow: inset 0 1px rgba(255,255,255,.035); transition: border-color 100ms ease, box-shadow 100ms ease, filter 100ms ease, transform 100ms ease; touch-action: none; }
-.clip-shape-group { padding-top: 2px; align-items: flex-start; background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 13%, #171a20), color-mix(in srgb, var(--tone) 7%, #111419)); }
-.clip-shape-group .clip-copy { flex-direction: row; align-items: baseline; gap: 6px; }
-.clip-shape-window { z-index: 2; height: 19px; margin-top: 24px; padding: 0 5px; border-color: color-mix(in srgb, var(--tone) 62%, #fff 8%); border-radius: 3px; background: color-mix(in srgb, var(--tone) 35%, #171a20); }
-.clip-shape-window .clip-icon { display: none; }
-.clip-shape-window .clip-copy { flex-direction: row; align-items: center; gap: 4px; }
-.clip-shape-window .clip-name { font-size: 8px; }
-.clip-shape-window .clip-meta { font-size: 7px; }
-.clip:hover { z-index: 4; border-color: color-mix(in srgb, var(--tone) 66%, #fff 10%); filter: brightness(1.08); }
-.clip:active { cursor: grabbing; transform: translateY(1px); }
-.clip-icon { flex: none; color: color-mix(in srgb, var(--tone) 80%, #fff 15%); font-size: 14px; }
-.clip-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
-.clip-name { overflow: hidden; color: var(--text-soft); font-size: 10px; font-weight: 630; text-overflow: ellipsis; white-space: nowrap; }
-.clip-meta { color: color-mix(in srgb, var(--tone) 55%, var(--muted)); font: 8.5px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; }
-.clip-edge { position: absolute; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: rgba(255,255,255,.62); opacity: 0; transition: opacity 100ms ease; }
-.clip-edge-left { left: 2px; } .clip-edge-right { right: 2px; }
-.clip:hover .clip-edge, .clip.selected .clip-edge { opacity: .55; }
-.clip.live { filter: brightness(1.16); box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent); }
-.clip.selected { z-index: 5; border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,116,95,.65), 0 0 0 1px rgba(0,0,0,.8), 0 0 18px rgba(255,116,95,.1); }
-.clip.selected .clip-edge { background: var(--accent); opacity: 1; }
-.clipped-left { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
-.clipped-right { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
-.playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 8; width: 1px; background: var(--accent); pointer-events: none; will-change: transform; box-shadow: 0 0 0 .5px rgba(0,0,0,.55); }
-.playhead-grip { position: sticky; top: 0; display: block; width: 11px; height: 9px; margin-left: -5px; background: var(--accent); clip-path: polygon(0 0,100% 0,50% 100%); }
-.timeline-zoom { height: 24px; flex: none; padding: 5px 9px 5px 135px; border-top: 1px solid var(--line); background: #0d0f12; }
-.zoom { position: relative; height: 14px; border-radius: 4px; background: #080a0d; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
-.zoom-window { position: absolute; top: 1px; bottom: 1px; border-radius: 3px; background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.17); cursor: grab; }
+.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)); }
+.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); }
+.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-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-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; }
.zoom-window:active { cursor: grabbing; }
-.zoom-grip { position: absolute; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 2px; background: rgba(255,255,255,.78); cursor: col-resize; }
-.zoom-grip-start { left: 3px; } .zoom-grip-end { right: 3px; }
-.track-fold { height: 14px; margin-left: 4px; padding: 0 4px; border: 0; border-radius: 4px; background: rgba(255,255,255,.08); color: var(--muted); font-size: 8px; line-height: 14px; }
-.track-fold:hover { background: rgba(255,255,255,.14); color: var(--text); }
+.zoom-grip { position: absolute; top: -2px; width: 6px; height: 12px; cursor: ew-resize; }
+.zoom-grip-start { left: -2px; } .zoom-grip-end { right: -2px; }
-/* Resizing and errors ------------------------------------------------ */
-.handle { position: relative; z-index: 20; background: transparent; touch-action: none; }
+/* 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; }
-.handle:hover::after, .handle:focus-visible::after { background: var(--accent); }
-.handle:focus-visible { outline: none; }
-.failure { position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 70; max-height: 180px; overflow: auto; margin: 0; padding: 12px 14px; border: 1px solid rgba(255,111,120,.45); border-radius: 7px; background: rgba(49,15,19,.95); color: #ffb0b5; box-shadow: 0 18px 50px rgba(0,0,0,.5); font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; user-select: text; }
+.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; }
.failure:empty { display: none; }
-@media (max-width: 1180px) {
- :root { --workspace-width: 250px; --source-width: 330px; }
- .studio-shell { grid-template-columns: var(--source-width) 5px minmax(340px, 1fr); }
- .preview-row { --workspace-width: 250px; }
- .meta, .timeline-hint { display: none; }
-}
-@media (max-width: 900px) {
- .workspace-panel, .workspace-handle { display: none; }
- .studio-shell { grid-template-columns: minmax(280px, 36vw) 5px minmax(0,1fr); }
- .preview-row { grid-template-columns: minmax(0,1fr); }
- .topbar { grid-template-columns: auto minmax(80px,1fr) auto; }
- .badges, .meta { display: none; }
+@media (max-width: 920px) {
+ .meta { display: none; }
+ .topbar { grid-template-columns: 1fr minmax(120px, 1fr); }
+ .topbar-right { display: none; }
+ .timeline-hint { display: none; }
}
diff --git a/packages/studio/src/ui/code.ts b/packages/studio/src/ui/code.ts
index f3812f89..15f949cc 100644
--- a/packages/studio/src/ui/code.ts
+++ b/packages/studio/src/ui/code.ts
@@ -1,4 +1,5 @@
import type { Range, StudioSnapshot } from "../shared.js";
+import { icon, setIcon } from "./icons.js";
import { markerTones } from "./markers.js";
import { tokenizeSvml } from "./syntax.js";
import type { Token } from "./syntax.js";
@@ -79,13 +80,13 @@ export function createCodePane(): CodePane {
element.innerHTML = `
<div class="pane-heading code-heading">
<div class="pane-title">
- <span class="material-symbols-rounded pane-icon">code</span>
+ ${icon("code", "pane-icon")}
<div><h2>SVML</h2><span data-path></span></div>
</div>
<div class="code-actions">
<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 class="material-symbols-rounded">edit</span>
+ <span data-mode-icon>${icon("edit")}</span>
</button>
</div>
</div>
@@ -96,7 +97,7 @@ export function createCodePane(): CodePane {
const canvas = element.querySelector<SVGSVGElement>(".range-canvas")!;
const editor = element.querySelector<HTMLTextAreaElement>("[data-editor]")!;
const mode = element.querySelector<HTMLButtonElement>("[data-mode]")!;
- const modeIcon = mode.querySelector<HTMLElement>(".material-symbols-rounded")!;
+ const modeIcon = mode.querySelector<HTMLElement>("[data-mode-icon]")!;
const saveState = element.querySelector<HTMLElement>("[data-save-state]")!;
let lines: Line[] = [];
@@ -112,7 +113,7 @@ export function createCodePane(): CodePane {
const setEditing = (value: boolean): void => {
editing = value;
element.classList.toggle("is-editing", editing);
- modeIcon.textContent = editing ? "visibility" : "edit";
+ setIcon(modeIcon, editing ? "eye" : "edit");
mode.setAttribute("aria-label", editing ? "Read source" : "Edit source");
mode.title = editing ? "Read source" : "Edit source";
if (editing) {
@@ -174,9 +175,8 @@ export function createCodePane(): CodePane {
lines.find((line) => offset >= line.start && offset <= line.end);
/**
- * Measure one absolute offset. Text is wrapped, so a collapsed DOM range at a
- * wrap boundary can report no rectangles at all: measure a real character and
- * take the edge that faces the offset instead.
+ * Measure one absolute offset from a real source character. Using a character
+ * rectangle also keeps punctuation and token boundaries exact.
*/
const caret = (offset: number, edge: "start" | "end"): Caret | undefined => {
const line = lineAt(offset);
@@ -215,7 +215,7 @@ export function createCodePane(): CodePane {
};
const draw = (): void => {
- const width = scroll.clientWidth;
+ const width = Math.max(scroll.clientWidth, scroll.scrollWidth);
const last = lines.at(-1)?.element;
const height = Math.max(scroll.clientHeight, last === undefined ? 0 : last.offsetTop + last.offsetHeight);
canvas.setAttribute("width", String(width));
@@ -237,8 +237,7 @@ export function createCodePane(): CodePane {
const endX = Math.max(left, end.x + 3);
const top = start.y - lineHeight / 2;
const bottom = end.y + lineHeight / 2;
- // Wrapping means "same line" is a question about rendered rows, not about
- // source lines: compare the measured baselines.
+ // Compare measured baselines so multi-line source ranges use one outline.
const sameRow = Math.abs(start.y - end.y) < lineHeight / 2;
// A multi-row range becomes one flag rather than a stack of boxes, so the
// whole region reads as a single selection.
@@ -421,8 +420,7 @@ export function createCodePane(): CodePane {
? undefined
: lines.find((item) => item.element === row);
if (line === undefined) return undefined;
- // Pick the character whose rendered box contains the pointer. Wrapping
- // makes this a two-dimensional question, so the row has to match too.
+ // Pick the character whose rendered box is nearest to the pointer.
const range = document.createRange();
let best = line.start;
let bestDistance = Number.POSITIVE_INFINITY;
diff --git a/packages/studio/src/ui/icons.ts b/packages/studio/src/ui/icons.ts
new file mode 100644
index 00000000..1292bf54
--- /dev/null
+++ b/packages/studio/src/ui/icons.ts
@@ -0,0 +1,34 @@
+const paths: Readonly<Record<string, string>> = {
+ code: '<path d="M9 7 4 12l5 5M15 7l5 5-5 5M13 4l-2 16"/>',
+ edit: '<path d="m4 16-.8 4 4-.8L18.5 8.9 15.1 5.5 4 16Z"/><path d="m13.8 6.8 3.4 3.4"/>',
+ eye: '<path d="M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"/><circle cx="12" cy="12" r="2.5"/>',
+ preview: '<rect x="3" y="4" width="18" height="14" rx="2"/><path d="m10 8 5 3.5-5 3.5V8ZM8 21h8"/>',
+ tune: '<path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/>',
+ select: '<path d="M5 3v15l4-4 3 6 3-1.5-3-6h6L5 3Z"/>',
+ timeline: '<path d="M3 6h18M3 12h18M3 18h18"/><path d="M8 4v4M16 10v4M11 16v4"/>',
+ minus: '<path d="M5 12h14"/>',
+ plus: '<path d="M12 5v14M5 12h14"/>',
+ fit: '<path d="M8 4H4v4M16 4h4v4M8 20H4v-4M16 20h4v-4"/>',
+ previous: '<path d="M7 5v14M18 6l-8 6 8 6V6Z"/>',
+ next: '<path d="M17 5v14M6 6l8 6-8 6V6Z"/>',
+ play: '<path d="m8 5 11 7-11 7V5Z"/>',
+ pause: '<path d="M8 5v14M16 5v14"/>',
+ volume: '<path d="M4 10v4h4l5 4V6l-5 4H4Z"/><path d="M16 9c1.5 1.7 1.5 4.3 0 6M19 6.5c3 3 3 8 0 11"/>',
+ muted: '<path d="M4 10v4h4l5 4V6l-5 4H4ZM17 10l4 4M21 10l-4 4"/>',
+ speech: '<path d="M7 17H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3h-4l-4 3v-3Z"/><path d="M7 9h6M7 12h4"/>',
+ waveform: '<path d="M3 12h2l1.5-6 3 12 3-14 3 16 2-8H21"/>',
+ video: '<rect x="3" y="5" width="14" height="14" rx="2"/><path d="m17 10 4-2v8l-4-2v-4Z"/>',
+ text: '<path d="M5 5h14M12 5v14M8 19h8"/>',
+ captions: '<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M7 11h4M13 11h4M7 15h3M12 15h5"/>',
+ component: '<rect x="4" y="4" width="6" height="6" rx="1"/><rect x="14" y="4" width="6" height="6" rx="1"/><rect x="4" y="14" width="6" height="6" rx="1"/><rect x="14" y="14" width="6" height="6" rx="1"/>',
+ layers: '<path d="m12 3 9 5-9 5-9-5 9-5Z"/><path d="m3 12 9 5 9-5M3 16l9 5 9-5"/>',
+ ranking: '<path d="M5 19V9h4v10M10 19V5h4v14M15 19v-7h4v7M3 19h18"/>',
+};
+
+export function icon(name: string, className = "icon"): string {
+ return `<svg class="${className}" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${paths[name] ?? paths.layers}</svg>`;
+}
+
+export function setIcon(target: Element, name: string): void {
+ target.innerHTML = icon(name);
+}
diff --git a/packages/studio/src/ui/main.ts b/packages/studio/src/ui/main.ts
index 09768e5a..977cf7cf 100644
--- a/packages/studio/src/ui/main.ts
+++ b/packages/studio/src/ui/main.ts
@@ -1,5 +1,6 @@
import type { StudioFailure, StudioSnapshot } from "../shared.js";
import { createCodePane } from "./code.js";
+import { icon, setIcon } from "./icons.js";
import { createHandle } from "./resize.js";
import type { Highlight } from "./code.js";
import { liveRanges, markerTones, spanAtOffset } from "./markers.js";
@@ -12,13 +13,16 @@ const app = document.querySelector<HTMLElement>("#app")!;
app.innerHTML = `
<header class="topbar">
<div class="brand">
- <span class="brand-mark">H</span>
- <div><strong>Hypit Studio</strong><small>SVML workspace</small></div>
+ <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>
<div class="project-title" data-project></div>
- <div class="meta" data-meta></div>
- <div class="badges" data-badges></div>
- <div class="status" data-status><i></i><span>Reading…</span></div>
+ <div class="topbar-right">
+ <div class="meta" data-meta></div>
+ <div class="status" data-status><i></i><span>Reading…</span></div>
+ </div>
</header>
<main class="studio-shell">
<aside class="source-panel" data-code></aside>
@@ -28,7 +32,7 @@ app.innerHTML = `
<aside class="workspace-panel">
<div class="pane-heading workspace-heading">
<div class="pane-title">
- <span class="material-symbols-rounded pane-icon">tune</span>
+ ${icon("tune", "pane-icon")}
<div><h2>Inspector</h2><span>Selected item</span></div>
</div>
</div>
@@ -83,14 +87,9 @@ workbench.insertBefore(createHandle({
const inspector = app.querySelector<HTMLElement>("[data-inspector]")!;
const meta = app.querySelector<HTMLElement>("[data-meta]")!;
const project = app.querySelector<HTMLElement>("[data-project]")!;
-const badges = app.querySelector<HTMLElement>("[data-badges]")!;
const status = app.querySelector<HTMLElement>("[data-status]")!;
const failureView = app.querySelector<HTMLElement>("[data-failure]")!;
-function renderBadges(_snapshot: StudioSnapshot): void {
- badges.replaceChildren();
-}
-
// Program-level facts never change while a Source is being read, so they live in
// the header rather than taking a panel that would have to sit over something.
function renderMeta(snapshot: StudioSnapshot): void {
@@ -137,7 +136,7 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):
if (clip === undefined) {
const empty = document.createElement("div");
empty.className = "inspector-empty";
- empty.innerHTML = `<span class="material-symbols-rounded">select</span><strong>Nothing selected</strong><small>Choose a clip, source marker, or object in the preview.</small>`;
+ 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);
return;
}
@@ -148,10 +147,10 @@ function renderInspector(snapshot: StudioSnapshot, clipId: string | undefined):
const hero = document.createElement("div");
hero.className = "selection-hero";
hero.innerHTML = `
- <span class="selection-icon"><span class="material-symbols-rounded"></span></span>
+ <span class="selection-icon" data-selection-icon></span>
<div class="selection-title"><strong></strong><small></small></div>
<span class="selection-kind"></span>`;
- hero.querySelector(".selection-icon .material-symbols-rounded")!.textContent = track?.binding.icon ?? "widgets";
+ setIcon(hero.querySelector("[data-selection-icon]")!, track?.binding.icon ?? "component");
hero.querySelector(".selection-kind")!.textContent = track === undefined
? "Track"
: `${track.binding.family} · ${track.binding.facet}`;
@@ -163,6 +162,14 @@ 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"),
@@ -330,7 +337,6 @@ function applySnapshot(snapshot: StudioSnapshot): void {
status.className = "status ok";
status.innerHTML = `<i></i><span>Live · r${snapshot.revision}</span>`;
renderMeta(snapshot);
- renderBadges(snapshot);
code.show(snapshot);
store.load(snapshot);
}
diff --git a/packages/studio/src/ui/stage.ts b/packages/studio/src/ui/stage.ts
index fe68bcaf..4372a49c 100644
--- a/packages/studio/src/ui/stage.ts
+++ b/packages/studio/src/ui/stage.ts
@@ -1,5 +1,6 @@
import type { StudioSnapshot } from "../shared.js";
import { createOverlay } from "./overlay.js";
+import { icon, setIcon } from "./icons.js";
import type { State, Store } from "./selection.js";
export type Stage = {
@@ -21,7 +22,7 @@ export function createStage(store: Store): Stage {
element.className = "stage";
element.innerHTML = `
<div class="stage-heading">
- <div class="stage-title"><span class="material-symbols-rounded">smart_display</span><strong>Preview</strong></div>
+ <div class="stage-title">${icon("preview")}<strong>Preview</strong></div>
<span class="stage-canvas" data-canvas></span>
</div>
<div class="stage-viewport">
@@ -32,16 +33,16 @@ export function createStage(store: Store): Stage {
<div class="stage-bar">
<span class="stage-time" data-time>00:00:00</span>
<button type="button" data-previous aria-label="Previous frame" title="Previous frame">
- <span class="material-symbols-rounded">skip_previous</span>
+ ${icon("previous")}
</button>
<button type="button" data-play aria-label="Play">
- <span class="material-symbols-rounded" data-icon>play_arrow</span>
+ <span data-icon>${icon("play")}</span>
</button>
<button type="button" data-next aria-label="Next frame" title="Next frame">
- <span class="material-symbols-rounded">skip_next</span>
+ ${icon("next")}
</button>
<button type="button" data-mute aria-label="Mute" class="stage-mute">
- <span class="material-symbols-rounded" data-mute-icon>volume_up</span>
+ <span data-mute-icon>${icon("volume")}</span>
</button>
</div>`;
@@ -90,7 +91,7 @@ export function createStage(store: Store): Stage {
const play = element.querySelector<HTMLButtonElement>("[data-play]")!;
const previous = element.querySelector<HTMLButtonElement>("[data-previous]")!;
const next = element.querySelector<HTMLButtonElement>("[data-next]")!;
- const icon = element.querySelector<HTMLElement>("[data-icon]")!;
+ const playIcon = element.querySelector<HTMLElement>("[data-icon]")!;
const mute = element.querySelector<HTMLButtonElement>("[data-mute]")!;
const muteIcon = element.querySelector<HTMLElement>("[data-mute-icon]")!;
const time = element.querySelector<HTMLElement>("[data-time]")!;
@@ -131,7 +132,6 @@ export function createStage(store: Store): Stage {
const scale = Math.min(
(room.width - 28) / canvasWidth,
(room.height - 28) / canvasHeight,
- 1,
);
// A zero-sized viewport during layout would otherwise produce NaN.
const valid = Number.isFinite(scale) && scale > 0 ? scale : 1;
@@ -145,7 +145,7 @@ export function createStage(store: Store): Stage {
const stop = (): void => {
const wasPlaying = playing;
playing = false;
- icon.textContent = "play_arrow";
+ setIcon(playIcon, "play");
play.setAttribute("aria-label", "Play");
if (raf !== 0) cancelAnimationFrame(raf);
raf = 0;
@@ -159,7 +159,7 @@ export function createStage(store: Store): Stage {
if (state === undefined) return;
if (playing) { stop(); return; }
playing = true;
- icon.textContent = "pause";
+ setIcon(playIcon, "pause");
play.setAttribute("aria-label", "Pause");
const total = state.snapshot.space.frameCount;
const rate = fps(state.snapshot);
@@ -183,7 +183,7 @@ export function createStage(store: Store): Stage {
});
const applyMuted = (): void => {
- muteIcon.textContent = muted ? "volume_off" : "volume_up";
+ setIcon(muteIcon, muted ? "muted" : "volume");
mute.setAttribute("aria-label", muted ? "Unmute" : "Mute");
(iframe.contentWindow as SeekWindow | null)?.__hypitSetMuted?.(muted);
};
diff --git a/packages/studio/src/ui/timeline.ts b/packages/studio/src/ui/timeline.ts
index 12622fac..5e4fc5d3 100644
--- a/packages/studio/src/ui/timeline.ts
+++ b/packages/studio/src/ui/timeline.ts
@@ -1,4 +1,5 @@
import type { SemanticAnchor, SemanticToken, StudioSnapshot } 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";
@@ -24,8 +25,8 @@ function timecode(seconds: number): string {
* editor would lay them out.
*/
/** One row of one Track. A Track with overlapping clips is several rows tall. */
-const LANE_HEIGHT = 52;
-const SEMANTIC_HEIGHT = 72;
+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>();
@@ -46,21 +47,21 @@ export function createTimeline(store: Store): Timeline {
element.innerHTML = `
<div class="timeline-toolbar">
<div class="timeline-title">
- <span class="material-symbols-rounded">view_timeline</span>
+ ${icon("timeline")}
<strong>Timeline</strong>
<span class="timeline-mode"><i></i>Semantic + frame timebase</span>
</div>
- <div class="timeline-readout" data-readout></div>
+ <div></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">
- <span class="material-symbols-rounded">remove</span>
+ ${icon("minus")}
</button>
<button type="button" class="icon-button" data-zoom-fit aria-label="Fit timeline" title="Fit timeline">
- <span class="material-symbols-rounded">fit_screen</span>
+ ${icon("fit")}
</button>
<button type="button" class="icon-button" data-zoom-in aria-label="Zoom in" title="Zoom in">
- <span class="material-symbols-rounded">add</span>
+ ${icon("plus")}
</button>
</div>
</div>
@@ -74,7 +75,6 @@ export function createTimeline(store: Store): Timeline {
</div>
<div class="timeline-zoom" data-zoom></div>`;
- const readout = element.querySelector<HTMLElement>("[data-readout]")!;
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.
@@ -96,6 +96,7 @@ export function createTimeline(store: Store): Timeline {
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;
const fps = (snapshot: StudioSnapshot): number =>
@@ -149,6 +150,17 @@ export function createTimeline(store: Store): Timeline {
tick.textContent = timecode(seconds);
ruler.append(tick);
}
+ 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 marker = document.createElement("span");
+ marker.className = "ruler-segment";
+ marker.style.left = `${Math.max(0, from) * 100}%`;
+ marker.style.width = `${Math.max(0, Math.min(1, to) - Math.max(0, from)) * 100}%`;
+ marker.textContent = segment.id;
+ ruler.append(marker);
+ }
};
const build = (snapshot: StudioSnapshot): void => {
@@ -163,13 +175,14 @@ export function createTimeline(store: Store): Timeline {
labels.append(corner);
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 !== undefined && snapshot.semantic.segments.length > 0) {
+ 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="material-symbols-rounded track-icon">timeline</span>
+ <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
@@ -274,6 +287,32 @@ export function createTimeline(store: Store): Timeline {
}
semanticLane.append(node);
}
+ 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 });
+ }
+ 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 });
+ }
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
@@ -294,8 +333,8 @@ export function createTimeline(store: Store): Timeline {
const kind = track.binding.family;
const label = document.createElement("div");
label.className = `track-label track-${kind}`;
- label.innerHTML = `<span class="material-symbols-rounded track-icon"></span><span class="track-copy"><strong></strong><small></small></span><span class="track-state"></span>`;
- label.querySelector(".track-icon")!.textContent = track.binding.icon;
+ 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"}`;
@@ -310,6 +349,12 @@ export function createTimeline(store: Store): Timeline {
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) {
@@ -362,15 +407,47 @@ export function createTimeline(store: Store): Timeline {
node.style.left = `${visibleFrom * 100}%`;
const row = rowOf.get(clip.id) ?? 0;
if (folded && row > 0) continue;
- node.style.top = `${row * LANE_HEIGHT}px`;
+ 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="material-symbols-rounded clip-icon"></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>' : ""}`;
- node.querySelector(".clip-icon")!.textContent = track.binding.icon;
+ 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`;
@@ -386,11 +463,13 @@ export function createTimeline(store: Store): 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);
}
clipNodes = nextClipNodes;
semanticNodes = nextSemanticNodes;
+ sourceNodes = nextSourceNodes;
drawRuler(snapshot);
};
@@ -399,8 +478,6 @@ export function createTimeline(store: Store): Timeline {
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)`;
- readout.textContent =
- `${timecode(head.frame / fps(snapshot))}:${String(head.frame % Math.round(fps(snapshot))).padStart(2, "0")} · ${head.frame}f`;
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));
@@ -410,6 +487,12 @@ export function createTimeline(store: Store): Timeline {
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));
+ }
};
const schedulePaint = (): void => {
diff --git a/packages/studio/start.ts b/packages/studio/start.ts
index 2f606738..b96f9762 100644
--- a/packages/studio/start.ts
+++ b/packages/studio/start.ts
@@ -42,8 +42,14 @@ const invokedFrom = process.env.INIT_CWD ?? process.cwd();
const runArgument = values.get("run");
if (runArgument === undefined || runArgument.trim().length === 0) usage("Missing --run");
const runPath = resolve(invokedFrom, runArgument);
-const packageRoot = resolve(values.get("package-root") ?? invokedFrom);
-const workspaceRoot = resolve(values.get("workspace") ?? dirname(runPath));
+const packageRootArgument = values.get("package-root");
+const workspaceArgument = values.get("workspace");
+const packageRoot = packageRootArgument === undefined
+ ? invokedFrom
+ : resolve(invokedFrom, packageRootArgument);
+const workspaceRoot = workspaceArgument === undefined
+ ? dirname(runPath)
+ : resolve(invokedFrom, workspaceArgument);
const runtimeArgument = values.get("runtime");
const runtimePath = runtimeArgument === undefined ? undefined : resolve(invokedFrom, runtimeArgument);
const port = Number(values.get("port") ?? "5179");
@@ -79,6 +85,7 @@ const server = await createServer({
plugins: [studioPlugin({
source,
runPath,
+ workspaceRoot,
domain,
...(archive === undefined ? {} : { archive }),
})],