Skip to content

Play a finished motion-graphics ad in sync with the rough drafts it grew from, and export the breakdown as MP4.

Curate motion references and rebuild full-frame preview

wasely994d1e1af8ba
diff --git a/README.md b/README.md
index 2553b21..329ade6 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,9 @@ The importer includes saved source videos and the standalone Nexa/Troovy referen
Media, reference titles, and extracted thumbnails stay local and are excluded from Git. The server supports byte ranges so seeking does not read entire videos into memory. A fresh checkout opens with an empty library until references are imported or uploaded. Browser uploads last for the current session.
-The current local library contains 21 references and 182 segments. These are reference clips, not claims of commissioned work. Public hosting needs separately supplied media you can distribute.
+The curated local library contains 20 motion-graphics references and 142 segments. The live-action Astra promo is excluded by `data/reference-policy.json`; reimporting does not restore it. These are reference clips, not claims of commissioned work. Public hosting needs separately supplied media you can distribute.
+
+The preview displays source footage full-frame at its original proportions, with optional brand overlays, safe-area guides, and presentation mode. Brand layers do not rewrite text already in the footage. Saved custom sequences are retained; excluded references are removed from saved timelines when loaded.
The optional `PORT` environment variable changes the port. `HOST` defaults to `127.0.0.1`; set it to your hosting environment's required bind address when deploying. This repository does not provision a hosted service.
diff --git a/data/reference-policy.json b/data/reference-policy.json
new file mode 100644
index 0000000..a226d4c
--- /dev/null
+++ b/data/reference-policy.json
@@ -0,0 +1,12 @@
+{
+ "excluded": {
+ "nexa-references-2095595661559574528": "Primarily live-action Astra promo: presenter, studio and camera footage; not a motion-graphics reference."
+ },
+ "names": {
+ "2896ae0eec89": "Hero · Brand system",
+ "69614b10fa87": "Infinite · Global payments",
+ "760ad39806d7": "Talis · Product launch",
+ "c188fa8ce06e": "Framer · Portfolio motion"
+ },
+ "featured": ["69614b10fa87", "2896ae0eec89", "760ad39806d7", "3227c09daea3", "5924a2f28506", "919ebec37a3b", "09782d1f7c63", "cf8c4707e634"]
+}
diff --git a/docs/launch-editor.md b/docs/launch-editor.md
index 9cd185b..a9fa4b9 100644
--- a/docs/launch-editor.md
+++ b/docs/launch-editor.md
@@ -4,17 +4,17 @@ The editor adapts MotionClone's reference selection, in/out ranges, ordered segm
The promotion layout is arranged vertically:
-1. Large film preview, live identity controls, and concept/reference toggle.
+1. Full-frame film preview, optional identity overlay, safe-area guides, and film/original toggle.
2. Clip timeline with source thumbnails, brand track, playhead, trimming, and undo/redo.
3. Reference-video tabs and short selectable moments with hover playback and insertion controls.
-The first visit assembles a four-clip example from different references. Changes save in this browser. The Play concept control plays the selected source intervals in order while the brand composition updates. Present removes workspace controls for recording the concept. Escape restores the editor.
+The first visit assembles a four-clip example from Infinite, Hero, Talis, and Supahub. Changes save in this browser. The Play concept control plays the selected source intervals in order, with a light brand overlay. Present removes workspace controls for recording the concept. Escape restores the editor. The video uses contain sizing so artwork is not cropped or distorted.
-The reference importer creates time ranges rather than rendering 182 separate files. This keeps original quality, storage use, and editability. Preview posters are extracted at each segment's midpoint. Byte-range streaming supports scrubbing large sources.
+The reference importer creates time ranges rather than rendering separate files. This keeps original quality, storage use, and editability. Preview posters are extracted at each segment's midpoint. Byte-range streaming supports scrubbing large sources. The curation policy removes the live-action Astra promo and its 40 segments, including on reimport. The original MotionClone source is preserved.
## Verified locally
-- 21 reference videos and 182 segments imported.
+- 20 motion-graphics reference videos and 142 segments available after curation.
- Playback crosses from one source video to the next.
- In/out validation, insert, reorder, remove, undo/redo, and saved restoration.
- Brand name, message, palette, portrait/landscape/square modes, and presentation mode.
diff --git a/public/editor-preview.css b/public/editor-preview.css
new file mode 100644
index 0000000..c66f9f2
--- /dev/null
+++ b/public/editor-preview.css
@@ -0,0 +1,31 @@
+/* Film-first monitor and calmer, more legible workspace chrome. */
+:root{--bg:#111214;--panel:#191a1d;--surface:#222326;--line:#2e3035;--muted:#a0a3ab;--lime:#d7d7fa}
+.topbar{height:64px;background:#151619;padding-inline:24px;border-bottom-color:#292b30}
+.logo-mark{background:#e5e5eb}.logo-dot{color:#c5bef3}.logo{font-size:25px}.project-link,.project-name{font-size:12px}.save-state{font-size:11px}.top-actions .button{font-size:12px;min-height:35px}.avatar{background:#2b2d36;border-color:#4c4d60;color:#d9d6ee}.demo-label{font-size:9px;color:#a2a2ae}
+.rail{width:68px;background:#151619;border-color:#292b30;gap:10px}.rail-item.active{background:#2b2a38;color:#d8d0fa}.rail-item{font-size:10px;height:61px;gap:8px}.rail-item:hover{background:#2b2c33}.rail-bottom{font-size:9px}
+main{max-width:1920px}.studio-heading{height:72px;padding-inline:30px}.studio-title{gap:10px}.studio-title h1{font-size:19px;font-weight:530;letter-spacing:-.6px}.live-dot{width:6px;height:6px;background:#bdb4e9}.subtle-label{font-size:11px;margin-left:14px;color:#989ba5}.view-toggle{background:#191a1e;border-color:#34353e;padding:4px}.view-toggle button{font-size:11px;padding:6px 14px}.view-toggle .active{background:#34343e}
+.upper-workspace{padding:0 30px 22px;grid-template-columns:minmax(0,1fr) 236px;gap:30px;align-items:start}.preview-area{min-width:0;max-width:900px;width:100%;margin:auto}.canvas-top{font-size:10px;letter-spacing:1px;height:33px;padding:0 0 12px;align-items:center}.canvas-top>span{display:flex;align-items:center}.canvas-top>span:last-child{font-size:9px;letter-spacing:.5px;color:#999da7}.monitor-dot{width:6px;height:6px;background:#c4c1e5;display:inline-block;border-radius:50%;margin-right:8px}.monitor-option{background:none;color:#aaa9b8;width:25px;height:23px;font-size:18px;margin-left:12px;border-radius:4px}.monitor-option:hover,.monitor-option[aria-pressed=true]{color:#e0d9ff;background:#35323e}
+.canvas-wrap{width:100%;max-width:800px;margin-inline:auto;aspect-ratio:16/9;height:auto;min-height:0;border:1px solid #393b43;border-radius:10px;background:#07080a;box-shadow:0 22px 50px #0005,0 0 0 5px #ffffff02;overflow:hidden}
+.film-stage{position:relative;width:100%;height:100%;aspect-ratio:auto;max-width:none;max-height:none;background:#07080a;color:#fff;container-type:inline-size;flex-shrink:0;isolation:isolate}
+.film-stage>video{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain;background:#07080a}
+.video-loading{inset:0;z-index:6;background:#121318;color:#adaebb;font-size:12px;letter-spacing:.2px}.video-loading[hidden]{display:none}
+.monitor-brand{position:absolute;left:3.5%;top:6%;display:flex;align-items:center;gap:8px;padding:7px 10px 7px 7px;border:1px solid #ffffff25;border-radius:7px;backdrop-filter:blur(12px);background:#101218b0;box-shadow:0 2px 12px #0002;font-size:1.5cqw;z-index:2;max-width:80%;color:#f6f5fc}
+.monitor-brand .film-monogram{background:var(--accent);color:#16151b;width:2.7cqw;height:2.7cqw;min-width:18px;min-height:18px;border-radius:5px;font-size:1.7cqw;padding:0;letter-spacing:-.1em;font-weight:850}
+#film-brand-name{font-weight:600;font-size:1.6cqw;letter-spacing:-.04em;overflow-wrap:anywhere}.brand-overlay-divider{height:12px;width:1px;background:#ffffff30;margin-inline:4px}.monitor-brand>span:last-child{font-size:.75cqw;letter-spacing:.17em;color:#ddd8ec;white-space:nowrap}
+.monitor-caption{position:absolute;bottom:6%;left:3.5%;max-width:80%;display:flex;gap:9px;align-items:center;padding:10px 13px;background:#0c0d14c9;border:1px solid #ffffff1f;border-radius:5px;backdrop-filter:blur(12px);z-index:2;color:#eeedf6;font-size:1.35cqw;line-height:1.4;letter-spacing:-.01em}
+.caption-accent{display:block;width:3px;height:18px;background:var(--accent);flex-shrink:0;border-radius:3px}.monitor-caption #film-headline{max-width:100%;overflow-wrap:anywhere}.reference-mode .monitor-brand,.reference-mode .monitor-caption,.no-brand .monitor-brand,.no-brand .monitor-caption{display:none}
+.monitor-guides{position:absolute;inset:5%;border:1px dashed #fff6;pointer-events:none;z-index:4}.monitor-guides[hidden]{display:none}.monitor-guides:after{content:"";position:absolute;inset:5.5%;border:1px solid #fff3}.monitor-guides>span{position:absolute;left:50%;top:50%;width:14px;height:14px;transform:translate(-50%,-50%)}.monitor-guides>span:before,.monitor-guides>span:after{content:"";position:absolute;inset:6px 0;background:#fff8;height:1px}.monitor-guides>span:after{transform:rotate(90deg)}
+.canvas-play{position:absolute;z-index:5;left:50%;top:50%;transform:translate(-50%,-50%);width:58px;height:58px;border-radius:50%;background:#171821ad;backdrop-filter:blur(15px);border:1px solid #ffffff5c;color:white;display:grid;place-items:center;opacity:0;transition:opacity .16s,background .16s;font-size:20px}.canvas-play svg{width:20px;height:20px}.canvas-wrap:hover .canvas-play,.canvas-play:focus-visible{opacity:1}.canvas-play:hover{background:#373442bd}
+.transport{height:56px;max-width:800px;margin:auto;gap:12px}.transport-start{gap:13px}.transport-play{height:32px;width:38px;border-radius:6px;background:#e6e5ee;color:#202026}.transport-play:hover{background:white}.transport-play svg{height:15px;width:15px}.time-readout{font-size:12px;gap:11px;color:#999ca7}.time-readout strong{color:#e5e5ee}.icon-button{width:30px;height:30px;color:#a4a7b1}.icon-button svg{width:16px;height:16px}.cut-label{font:9px monospace;color:#9094a1;margin-right:7px;letter-spacing:.7px}.cut-label>span{color:#dedde8;margin-left:8px}.monitor-source{display:flex;justify-content:space-between;align-items:center;gap:12px;max-width:800px;margin:auto;border-top:1px solid #2b2d34;padding-top:10px;font-size:10px;color:#9b9fac}.monitor-source>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.monitor-source>span:last-child{font:8px monospace;letter-spacing:.6px;white-space:nowrap;display:flex;align-items:center;gap:8px;color:#91949f}.monitor-source i{width:3px;height:3px;background:#747782;border-radius:50%}.preview-description{display:block}
+.brand-panel{border-left:0;margin-top:33px;padding:20px 18px;background:linear-gradient(145deg,#202125,#191a1d);border:1px solid #32343a;border-radius:10px;min-width:0;box-shadow:0 8px 30px #0001}.panel-title h2{font-size:14px;letter-spacing:-.3px}.panel-title svg{color:#c9c0ec}.panel-description{font-size:12px;line-height:1.5;color:#a7a8b2;margin:10px 0 12px}.brand-panel .field-label{font-size:11px;color:#b1b2bd;margin:12px 0 6px}.brand-panel input:not([type=color]):not([type=checkbox]),.brand-panel textarea,.brand-panel select{background:#15161a;border-color:#373941;font-size:12px;padding:9px 10px;border-radius:6px;color:#ededf4}.brand-panel textarea{min-height:48px}.brand-panel select{height:36px}.palette{gap:10px;margin-top:9px}.swatch{width:26px;height:26px;border-color:#202125}.swatch.active{outline-color:#e5e2f6}.custom-color{width:24px;height:24px;border-color:#777789}.brand-divider{background:#36373e;margin:14px 0 12px}.identity-footnote{font-size:10px;color:#c0bacc;display:flex;align-items:center;gap:4px}.identity-footnote .tiny-dot{background:#a9ae92}.concept-note{font-size:10px;line-height:1.6;color:#9696a3;margin-top:8px}.overlay-toggle{position:relative;display:flex;align-items:center;justify-content:space-between;margin-top:14px;font-size:11px;color:#c0bfcd;cursor:pointer}.overlay-toggle input{position:absolute;right:0;width:30px;height:18px;opacity:0;cursor:pointer;z-index:1}.toggle-track{width:30px;height:18px;border-radius:20px;background:#4d4d59;padding:3px;transition:background .15s}.toggle-track:before{content:"";display:block;background:#c6c4d1;width:12px;height:12px;border-radius:50%;transition:transform .15s}.overlay-toggle input:checked+.toggle-track{background:#a6a0cb}.overlay-toggle input:checked+.toggle-track:before{transform:translateX(12px);background:#fff}.overlay-toggle input:focus-visible+.toggle-track{outline:2px solid #d9cffc;outline-offset:3px}
+.timeline-panel{margin:0 30px;border:1px solid #33343c;border-radius:10px;background:#1a1b1f;overflow:hidden;box-shadow:0 8px 26px #0001}.timeline-toolbar{height:47px;padding-inline:18px}.timeline-heading h2{font-size:12px}.timeline-heading svg{color:#a9a6bd}.clip-count{font-size:10px;border-color:#42424d;background:#27272f;padding:3px 6px;color:#c5c3d1}.timeline-tools .small{font-size:11px;padding:5px 10px}.timeline-hint{font-size:10px;color:#999baa}.timeline-scroll{padding-inline:18px}.ruler{background-color:#1a1b1f;font-size:9px;color:#a3a1b2;background-image:repeating-linear-gradient(90deg,#0000 0,#0000 calc(2.5% - 1px),#474752 calc(2.5% - 1px),#474752 2.5%)}.ruler span{background:#1a1b1f}.clips-track{height:65px}.timeline-clip,.timeline-clip:nth-child(2n),.timeline-clip:nth-child(3n){border-color:#656174;background:#35313d;border-radius:4px}.timeline-clip.selected{border-color:#d1c2f3;box-shadow:0 0 0 1px #100f14}.timeline-clip img{opacity:.82}.timeline-clip>span{font-size:10px}.timeline-clip small{font-size:9px;color:#e0dce9}.lane-label{font-size:10px;color:#a7a5b7}.brand-track{background:#2d2838;border-color:#4c425e;color:#c1b7d5;font-size:9px}.brand-track-name{color:#e0d5ef}.brand-track-line{background:linear-gradient(90deg,#8c74b0,#8c74b033)}.playhead{background:#dbd0fb;box-shadow:none}.playhead>span{background:#dbd0fb}.clip-inspector{font-size:10px;padding:6px 18px;border-color:#33313d;color:#bcb7ca}.clip-inspector label{font-size:10px;color:#9f9aaa}.clip-inspector input{font-size:10px;background:#232129;border-color:#46404f;color:#e0dbea;width:54px}.text-button{font-size:11px;color:#c1b8cc}.remove-clip{color:#d7b4b2}
+.library-panel{padding:28px 30px 20px}.library-heading{margin-bottom:20px}.library-heading h2{font-size:22px;font-weight:520;letter-spacing:-.8px}.library-heading p{font-size:12px;line-height:1.6;margin-top:6px;color:#a4a2b0}.library-title-row{gap:14px}.library-count{font-size:10px;color:#c3bbdb;background:#282532;border-color:#41394d;padding:4px 7px}.search-box{height:35px;background:#19191f;border-color:#38363f;padding-inline:11px}.search-box input{font-size:11px;width:148px}.upload-button{font-size:11px}.reference-tabs{gap:8px;margin-bottom:9px;padding-bottom:11px}.reference-tab{font-size:11px;min-height:39px;border-color:#34313e;background:#1c1b22;gap:9px}.reference-tab img{width:40px;height:26px;filter:none}.reference-tab.active{background:#302a3d;border-color:#77668e;color:#ebe3f8}.reference-tab:hover{border-color:#8b789e}.source-heading{font-size:11px;margin-bottom:14px;color:#c0baca}.source-heading>span:last-child{font-size:10px;color:#9f98ad}.segment-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:20px 15px}.segment-visual{aspect-ratio:16/10;border-radius:8px;border-color:#393541;transition:border-color .15s,transform .2s;box-shadow:0 7px 15px #0002}.segment-card:hover .segment-visual{border-color:#afa0c6;transform:translateY(-2px)}.segment-add{background:#e4dff1;color:#292233;border-color:#f6f3ffad;width:29px;height:29px}.segment-add:hover{background:#fff}.segment-number,.segment-length{font-size:9px;background:#19141fce;padding:4px 5px}.segment-meta{font-size:12px;margin-top:10px;color:#e0dae9}.segment-meta small{font-size:9px;color:#b2a8c0}.segment-subtitle{font-size:10px;line-height:1.5;color:#a299ae;margin-top:4px}.studio-footer{margin-inline:30px;font-size:10px;color:#9b93a7}.studio-footer>span:last-child{font-size:9px}.footer-mark{color:#c1b5d2}.toast{background:#e6e0f1;color:#2c2339;border-color:#f5eefe}
+.canvas-wrap.portrait,.canvas-wrap.square{aspect-ratio:16/9;background:repeating-conic-gradient(#17171d 0% 25%,#131319 0% 50%) 50%/18px 18px;display:flex;align-items:center;justify-content:center}.portrait .film-stage{height:100%;width:auto;aspect-ratio:9/16}.square .film-stage{height:100%;width:auto;aspect-ratio:1}.portrait .monitor-brand{font-size:3cqw;padding:5px;gap:5px;top:3%;left:5%;max-width:90%}.portrait #film-brand-name{font-size:4cqw}.portrait .film-monogram{width:6cqw;height:6cqw;font-size:4cqw}.portrait .monitor-brand>span:last-child{font-size:1.5cqw}.portrait .monitor-caption{font-size:3cqw;left:5%;bottom:4%;padding:6px;max-width:90%}.square .monitor-caption{font-size:2cqw}.square #film-brand-name{font-size:2.4cqw}
+.present-mode .upper-workspace{padding:20px;height:100vh;align-items:center}.present-mode .preview-area{max-width:calc((100vh - 130px)*16/9);height:auto}.present-mode .canvas-wrap{width:100%;max-width:none;height:auto;aspect-ratio:16/9}.present-mode .film-stage{height:100%;width:100%}.present-mode .transport,.present-mode .monitor-source{max-width:none}.canvas-wrap:fullscreen{max-width:none;aspect-ratio:auto;background:#07080a}.canvas-wrap:fullscreen .film-stage{width:100%;height:100%;aspect-ratio:auto}.canvas-wrap:fullscreen video{object-fit:contain}
+@media(min-width:1650px){.upper-workspace{grid-template-columns:minmax(0,1fr) 260px;gap:40px}.preview-area{max-width:1040px}.canvas-wrap,.transport,.monitor-source{max-width:920px}.brand-panel{padding:24px}.segment-grid{grid-template-columns:repeat(6,minmax(0,1fr))}}
+@media(max-width:1150px){.upper-workspace{padding-inline:22px;grid-template-columns:minmax(0,1fr) 218px;gap:22px}.studio-heading{padding-inline:22px}.studio-title h1{font-size:17px}.subtle-label{display:none}.brand-panel{padding:17px 14px}.panel-description{font-size:11px;margin-bottom:14px}.brand-panel .field-label{margin-top:13px}.brand-panel textarea{min-height:54px}.brand-panel input:not([type=color]):not([type=checkbox]),.brand-panel textarea,.brand-panel select{font-size:11px}.concept-note{font-size:9px}.monitor-source>span:last-child{display:none}.timeline-panel{margin-inline:22px}.library-panel{padding-inline:22px}.library-heading h2{font-size:20px}.segment-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.library-heading p{font-size:11px}.time-readout{font-size:11px;gap:8px}.cut-label{display:none}.brand-panel{margin-top:33px}.studio-footer{margin-inline:22px}}
+@media(max-width:850px){.upper-workspace{grid-template-columns:1fr;padding-inline:20px;gap:16px}.studio-heading{height:65px;padding-inline:20px}.brand-panel{margin:0;display:grid;grid-template-columns:90px minmax(0,1fr) 90px minmax(0,1fr);gap:10px 12px;padding:16px}.brand-panel .panel-title{grid-column:1/-1;margin-bottom:2px}.brand-panel .panel-description,.brand-panel .brand-divider,.identity-footnote,.concept-note{display:none}.brand-panel>.field-label{margin:0;font-size:11px}.brand-panel>input,.brand-panel>textarea,.brand-panel select,.brand-panel .palette{grid-column:auto;margin:0}.brand-panel textarea{min-height:38px;height:38px;resize:vertical}.brand-panel .palette{gap:7px}.overlay-toggle{grid-column:3/-1;margin:0}.brand-panel .swatch{width:23px;height:23px}.brand-panel .custom-color{width:22px;height:22px}.timeline-panel{margin-inline:20px}.library-panel{padding-inline:20px}.segment-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.library-heading{gap:16px}.library-actions{justify-content:space-between;width:100%}.library-heading p{max-width:none}.search-box{flex:1;max-width:none}.search-box input{width:100%}.topbar .save-state{display:none}.monitor-caption{font-size:1.55cqw}.canvas-wrap{max-width:none}.preview-area{margin:0}.transport,.monitor-source{max-width:none}}
+@media(max-width:550px){.topbar{height:58px;padding-inline:16px}.rail{display:none}.topbar .button{font-size:11px}.studio-heading{height:65px;padding:0 16px;gap:8px}.studio-title h1{font-size:16px;letter-spacing:-.5px}.studio-title .live-dot{display:none}.view-toggle button{font-size:10px;padding:6px 9px}.view-toggle{padding:3px}.upper-workspace{padding:0 16px 18px;gap:17px}.canvas-top{height:29px;font-size:9px;letter-spacing:.8px}.canvas-top>span:last-child{font-size:8px}.canvas-sep{margin-inline:6px}.monitor-option{margin-left:5px}.canvas-wrap{height:auto;aspect-ratio:16/9;border-radius:7px;box-shadow:0 10px 30px #0003}.monitor-brand{padding:4px 6px 4px 4px;gap:5px;border-radius:5px;top:6%}.monitor-brand .film-monogram{width:17px;height:17px;min-width:17px;min-height:17px;font-size:11px;border-radius:3px}#film-brand-name{font-size:11px}.monitor-brand>span:last-child{font-size:6px}.brand-overlay-divider{margin-inline:1px;height:10px}.monitor-caption{font-size:9px;padding:5px 7px;gap:6px;bottom:6%;max-width:88%;border-radius:4px}.caption-accent{height:13px;width:2px}.canvas-play{width:44px;height:44px}.transport{height:52px}.transport-start{gap:9px}.transport-play{width:33px;height:30px}.transport-end{gap:4px}.time-readout{font-size:10px;gap:7px}.monitor-source{padding-top:9px;font-size:10px}.brand-panel{grid-template-columns:76px minmax(0,1fr);padding:14px;gap:10px 11px;border-radius:8px}.brand-panel input:not([type=color]):not([type=checkbox]),.brand-panel textarea,.brand-panel select{font-size:12px}.brand-panel>.field-label{font-size:11px}.brand-panel>.overlay-toggle{grid-column:1/-1;margin-top:3px}.brand-panel .palette{gap:10px}.brand-panel .swatch{width:25px;height:25px}.panel-title h2{font-size:13px}.timeline-panel{margin-inline:16px;border-radius:8px}.timeline-toolbar{height:46px;padding-inline:12px}.timeline-tools .small{font-size:10px}.timeline-heading{gap:7px}.timeline-heading svg{display:none}.timeline-scroll{padding-inline:12px}.timeline-tools .tool-divider{display:none}.clip-inspector{padding-inline:12px;font-size:10px;gap:8px}.clip-inspector>div{gap:8px}.library-panel{padding:25px 16px 10px}.library-title-row{gap:9px;flex-wrap:wrap}.library-heading h2{font-size:21px}.library-heading p{font-size:11px;margin-top:8px}.library-count{font-size:9px}.library-heading{gap:15px}.reference-tabs{padding-top:2px;margin-bottom:7px}.reference-tab{font-size:10px}.segment-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:19px 12px}.segment-meta{font-size:11px}.segment-meta small{font-size:8px}.segment-add{width:30px;height:30px}.segment-subtitle{font-size:9px}.source-heading{font-size:11px;gap:10px}.source-heading>span:last-child{font-size:8px;max-width:126px;line-height:1.5}.studio-footer{margin-inline:16px;font-size:9px}.portrait .monitor-brand>span:last-child{display:none}.portrait .brand-overlay-divider{display:none}.portrait #film-brand-name{font-size:9px}.portrait .film-monogram{min-width:13px;min-height:13px;width:13px;height:13px;font-size:9px}.portrait .monitor-caption{font-size:7px;padding:4px}.canvas-wrap:fullscreen{height:100vh;width:100vw}}
+.present-mode .portrait .film-stage,.canvas-wrap.portrait:fullscreen .film-stage{width:auto;height:100%;aspect-ratio:9/16}
+.present-mode .square .film-stage,.canvas-wrap.square:fullscreen .film-stage{width:auto;height:100%;aspect-ratio:1}
+@media(prefers-reduced-motion:reduce){.canvas-play,.segment-visual,.toggle-track,.toggle-track:before{transition:none}}
diff --git a/public/editor.html b/public/editor.html
index ec9d676..c3d4b65 100644
--- a/public/editor.html
+++ b/public/editor.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#101112"><title>Null — Launch Studio</title>
- <link rel="icon" href="assets/null-logo.png"><link rel="stylesheet" href="editor.css">
+ <link rel="icon" href="assets/null-logo.png"><link rel="stylesheet" href="editor.css"><link rel="stylesheet" href="editor-preview.css">
<script type="module" src="editor.mjs"></script>
</head>
<body>
@@ -30,28 +30,30 @@
<div class="workspace">
<nav class="rail" aria-label="Tools"><button class="rail-item active" id="rail-references" aria-label="Reference library" title="Reference library"><svg><use href="#i-film"/></svg><span>Library</span></button><button class="rail-item" id="rail-brand" aria-label="Brand settings" title="Brand settings"><svg><use href="#i-spark"/></svg><span>Brand</span></button><a class="rail-item" href="index.html" title="Motion templates"><svg><use href="#i-grid"/></svg><span>Templates</span></a><span class="rail-bottom">N / 01</span></nav>
<main id="main">
-<div class="studio-heading"><div class="studio-title"><span class="live-dot"></span><h1>Launch studio</h1><span class="subtle-label">A little inspiration. Entirely your direction.</span></div><div class="view-toggle" aria-label="Preview mode"><button id="mode-concept" class="active" aria-pressed="true">Your film</button><button id="mode-reference" aria-pressed="false">Reference</button></div></div>
+<div class="studio-heading"><div class="studio-title"><span class="live-dot"></span><h1>Your next big thing.</h1><span class="subtle-label">Launch film / Untitled 01</span></div><div class="view-toggle" aria-label="Preview mode"><button id="mode-concept" class="active" aria-pressed="true">Film preview</button><button id="mode-reference" aria-pressed="false">Original</button></div></div>
<section class="upper-workspace" aria-label="Film preview and brand settings">
<div class="preview-area">
- <div class="canvas-top"><span id="canvas-label">CONCEPT PREVIEW</span><span><i class="tiny-dot"></i> <span id="format-label">1920 × 1080</span> <span class="canvas-sep">/</span> 30 FPS</span></div>
+ <div class="canvas-top"><span><span class="monitor-dot"></span><span id="canvas-label">FILM PREVIEW</span></span><span><span id="format-label">1920 × 1080</span> <span class="canvas-sep">/</span> FIT <button id="safe-area" class="monitor-option" aria-label="Show safe area guides" aria-pressed="false">⌗</button></span></div>
<div class="canvas-wrap" id="canvas-wrap">
<div class="film-stage" id="film-stage" data-scene="0">
- <div class="stage-grain"></div><div class="stage-orbit orbit-one"></div><div class="stage-orbit orbit-two"></div>
- <div class="film-brand"><span class="film-monogram">N</span><span id="film-brand-name">null</span><span class="film-brand-plus">®</span></div>
- <div class="film-copy"><span class="film-kicker" id="film-kicker">MAKE SOMETHING THAT MOVES.</span><h2 id="film-headline">Good ideas.<br><em>Great motion.</em></h2><p id="film-subline">Your vision. Every frame.</p><span class="film-cta" id="film-cta">Meet your next big thing <span>↗</span></span></div>
- <div class="motion-window" id="motion-window"><div class="window-chrome"><span class="window-dots">● ● ●</span><span id="window-label">a new perspective</span><span>↗</span></div><video id="preview-video" muted playsinline preload="metadata"></video><div class="video-loading" id="video-loading">Loading your reference…</div></div>
- <div class="film-footer"><span>BUILT FROM INSPIRATION. MADE YOURS.</span><span id="film-progress">01 / 04</span></div><div class="film-timecode" aria-hidden="true">NULL® — A NEW POINT OF VIEW</div>
+ <video id="preview-video" muted playsinline preload="metadata"></video>
+ <div class="video-loading" id="video-loading">Loading your reference…</div>
+ <div class="monitor-brand"><span class="film-monogram">N</span><span id="film-brand-name">null</span><span class="brand-overlay-divider"></span><span>IN MOTION</span></div>
+ <div class="monitor-caption"><span class="caption-accent"></span><span id="film-headline">Good ideas. Great motion.</span></div>
+ <div class="monitor-guides" id="monitor-guides" hidden><span></span></div>
+ <button class="canvas-play" id="canvas-play" aria-label="Play film"><svg><use href="#i-play"/></svg></button>
</div>
- <div class="canvas-badge" id="canvas-badge"><span></span>Live brand preview</div>
</div>
- <div class="transport"><div class="transport-start"><button class="icon-button" id="restart" aria-label="Restart sequence">↤</button><button class="transport-play" id="play" aria-label="Play sequence"><svg><use href="#i-play"/></svg></button><span class="time-readout"><strong id="time-current">00:00.00</strong><span>/</span><span id="time-total">00:00.00</span></span></div><span class="preview-description" id="preview-description">A concept assembled from your selected moments</span><div class="transport-end"><button class="icon-button" id="mute" aria-label="Unmute reference audio" aria-pressed="true"><svg><use href="#i-volume"/></svg><span class="mute-slash"></span></button><button class="icon-button" id="fullscreen" aria-label="Fullscreen preview"><svg><use href="#i-full"/></svg></button></div></div>
+ <div class="transport"><div class="transport-start"><button class="icon-button" id="restart" aria-label="Restart sequence">↤</button><button class="transport-play" id="play" aria-label="Play sequence"><svg><use href="#i-play"/></svg></button><span class="time-readout"><strong id="time-current">00:00.00</strong><span>/</span><span id="time-total">00:00.00</span></span></div><div class="transport-end"><span class="cut-label">CUT <span id="film-progress">01 / 04</span></span><button class="icon-button" id="mute" aria-label="Unmute reference audio" aria-pressed="true"><svg><use href="#i-volume"/></svg><span class="mute-slash"></span></button><button class="icon-button" id="fullscreen" aria-label="Fullscreen preview"><svg><use href="#i-full"/></svg></button></div></div>
+ <div class="monitor-source"><span id="preview-description">Your reference cut</span><span>REFERENCE CUT <i></i> BRAND OVERLAY</span></div>
</div>
- <aside class="brand-panel" id="brand-panel" aria-label="Brand settings"><div class="panel-title"><h2>Make it yours</h2><svg><use href="#i-spark"/></svg></div><p class="panel-description">Same inspiration.<br>A whole new identity.</p>
+ <aside class="brand-panel" id="brand-panel" aria-label="Brand settings"><div class="panel-title"><h2>Your identity</h2><svg><use href="#i-spark"/></svg></div><p class="panel-description">A signature that carries<br>through every frame.</p>
<label class="field-label" for="brand-name">Brand name</label><input id="brand-name" value="null" maxlength="30" autocomplete="off">
<label class="field-label" for="brand-message">Your message</label><textarea id="brand-message" rows="2" maxlength="80">Good ideas. Great motion.</textarea>
<span class="field-label">Brand palette</span><div class="palette"><button class="swatch active" data-accent="#daef79" data-paper="#eeefdf" style="--swatch:#daef79" aria-label="Citron palette" aria-pressed="true"></button><button class="swatch" data-accent="#b9b0fb" data-paper="#ece8f8" style="--swatch:#b9b0fb" aria-label="Lavender palette" aria-pressed="false"></button><button class="swatch" data-accent="#f4a98d" data-paper="#f7e9df" style="--swatch:#f4a98d" aria-label="Apricot palette" aria-pressed="false"></button><button class="swatch" data-accent="#9ed1e7" data-paper="#e4eef2" style="--swatch:#9ed1e7" aria-label="Glacier palette" aria-pressed="false"></button><label class="custom-color" title="Custom brand color"><input type="color" id="custom-color" value="#daef79" aria-label="Custom brand color"><span>+</span></label></div>
<label class="field-label" for="aspect">Canvas</label><select id="aspect"><option value="landscape">Landscape &nbsp; 16:9</option><option value="portrait">Portrait &nbsp; 9:16</option><option value="square">Square &nbsp; 1:1</option></select>
- <div class="brand-divider"></div><div class="direction-label"><span class="field-label">Creative direction</span><span>↗</span></div><p class="direction-copy">Bold typography. Clean transitions. A launch worth watching.</p><div class="concept-note"><span class="tiny-dot"></span> Concept preview · AI rendering comes next</div>
+ <label class="overlay-toggle"><span>Brand overlay</span><input type="checkbox" id="brand-visible" checked><span class="toggle-track" aria-hidden="true"></span></label>
+ <div class="brand-divider"></div><div class="identity-footnote"><span class="tiny-dot"></span> Changes preview instantly</div><div class="concept-note">Reference footage with your brand layer.<br>AI reconstruction comes next.</div>
</aside>
</section>
<section class="timeline-panel" aria-labelledby="timeline-title">
@@ -59,7 +61,7 @@
<div class="timeline-scroll"><div class="timeline-body" id="timeline-body"><div class="ruler" id="ruler" aria-hidden="true"></div><div class="timeline-lane"><div class="lane-label"><svg><use href="#i-film"/></svg><span>Video</span></div><div class="clips-track" id="clips-track" aria-label="Film clips"></div></div><div class="brand-lane"><span class="lane-label">Aa <span>Brand</span></span><div class="brand-track"><span class="brand-track-name">null</span><span class="brand-track-line"></span><span>Your identity, throughout</span></div></div><div class="playhead" id="playhead"><span></span></div><input id="scrubber" class="timeline-scrubber" type="range" min="0" max="1" step="0.01" value="0" aria-label="Sequence playhead"></div></div>
<div class="clip-inspector" id="clip-inspector"><span id="selected-clip-name">Choose a clip to fine-tune</span><div><label>In <input id="clip-in" type="number" min="0" step="0.1" aria-label="Clip in point"></label><label>Out <input id="clip-out" type="number" min="0" step="0.1" aria-label="Clip out point"></label><button class="text-button" id="move-left" aria-label="Move selected clip earlier">←</button><button class="text-button" id="move-right" aria-label="Move selected clip later">→</button><button class="text-button remove-clip" id="remove-clip">Remove</button></div></div>
</section>
-<section class="library-panel" id="library-panel" aria-labelledby="library-title"><div class="library-heading"><div><div class="library-title-row"><h2 id="library-title">Find your next moment.</h2><span class="library-count" id="library-count">Loading library…</span></div><p>Take the opening from one. The reveal from another. Make the whole thing yours.</p></div><div class="library-actions"><label class="search-box"><svg><use href="#i-search"/></svg><input id="search" type="search" placeholder="Find a reference…" aria-label="Search reference videos"></label><label class="button subtle upload-button"><svg><use href="#i-plus"/></svg>Add video<input id="upload" type="file" accept="video/*" hidden></label></div></div>
+<section class="library-panel" id="library-panel" aria-labelledby="library-title"><div class="library-heading"><div><div class="library-title-row"><h2 id="library-title">Motion worth borrowing.</h2><span class="library-count" id="library-count">Loading library…</span></div><p>Great openings. Clever transitions. Unforgettable reveals.</p></div><div class="library-actions"><label class="search-box"><svg><use href="#i-search"/></svg><input id="search" type="search" placeholder="Find a reference…" aria-label="Search reference videos"></label><label class="button subtle upload-button"><svg><use href="#i-plus"/></svg>Add video<input id="upload" type="file" accept="video/*" hidden></label></div></div>
<div class="reference-tabs" id="reference-tabs" role="tablist" aria-label="Reference videos"></div>
<div class="source-heading"><span id="source-title">Your reference library</span><span id="source-detail">Every video, split into moments.</span></div>
<div class="segment-grid" id="segment-grid"><div class="library-loading">Preparing your references…</div></div>
diff --git a/public/editor.mjs b/public/editor.mjs
index 2e50e21..cfb9536 100644
--- a/public/editor.mjs
+++ b/public/editor.mjs
@@ -27,7 +27,7 @@ function toast(message) {
function persist() {
if (!state.initialized) return;
try {
- localStorage.setItem(STORAGE, JSON.stringify({ clips: state.clips.filter(clip => !refFor(clip.ref)?.uploaded), brand: $('brand-name').value, message: $('brand-message').value, accent: getComputedStyle(document.documentElement).getPropertyValue('--accent').trim(), paper: getComputedStyle(document.documentElement).getPropertyValue('--paper').trim(), aspect: $('aspect').value }));
+ localStorage.setItem(STORAGE, JSON.stringify({ clips: state.clips.filter(clip => !refFor(clip.ref)?.uploaded), brand: $('brand-name').value, message: $('brand-message').value, accent: getComputedStyle(document.documentElement).getPropertyValue('--accent').trim(), paper: getComputedStyle(document.documentElement).getPropertyValue('--paper').trim(), aspect: $('aspect').value, overlay: $('brand-visible').checked }));
$('save-state').lastChild.textContent = ' Saved locally';
} catch { $('save-state').lastChild.textContent = ' Not saved'; }
}
@@ -45,11 +45,12 @@ function restoreHistory(direction) {
renderTimeline(); seek(startOf(state.selected)); persist();
}
function demoClips() {
- const picks = [0, 1, 2, 4].filter(index => state.references[index]);
- return picks.map((referenceIndex, index) => {
- const reference = state.references[referenceIndex];
- const segment = reference.segments[Math.min(index % 3, reference.segments.length - 1)];
- return { ...segment, label: ['The opening', 'The build', 'The reveal', 'The close'][index] };
+ const picks = [['69614b10fa87', 4], ['2896ae0eec89', 2], ['760ad39806d7', 1], ['3227c09daea3', 13]].filter(([id]) => refFor(id));
+ if (!picks.length) return state.references.slice(0, 4).map(reference => ({ ...reference.segments[0] }));
+ return picks.map(([id, part], index) => {
+ const reference = refFor(id);
+ const segment = reference.segments[Math.min(part, reference.segments.length - 1)];
+ return { ...segment, in: index === 0 ? +((segment.in + segment.out) / 2).toFixed(3) : segment.in, label: ['The opening', 'The build', 'The reveal', 'The close'][index] };
});
}
function loadDemo() {
@@ -63,10 +64,7 @@ function brand() {
document.querySelector('.brand-track-name').textContent = name;
document.querySelector('.film-monogram').textContent = name[0].toUpperCase();
const message = $('brand-message').value.trim() || 'Good ideas. Great motion.';
- const split = message.indexOf('. ');
- const headline = $('film-headline'); headline.replaceChildren();
- if (split > -1) headline.append(document.createTextNode(message.slice(0, split + 1)), document.createElement('br'), element('em', '', message.slice(split + 2)));
- else headline.textContent = message;
+ $('film-headline').textContent = message;
clearTimeout(savedTimer); savedTimer = setTimeout(persist, 250);
}
function palette(accent, paper) {
@@ -133,9 +131,6 @@ function updateScene(index) {
const clip = state.clips[index]; if (!clip) return;
$('film-stage').dataset.scene = index % 4;
$('film-progress').textContent = `${String(index + 1).padStart(2, '0')} / ${String(state.clips.length).padStart(2, '0')}`;
- $('window-label').textContent = ['a new perspective', 'find your flow', 'made to stand out', 'your next chapter'][index % 4];
- $('film-kicker').textContent = ['MAKE SOMETHING THAT MOVES.', 'A DIFFERENT KIND OF ENERGY.', 'EVERY DETAIL. YOUR DIRECTION.', 'READY FOR YOUR NEXT CHAPTER.'][index % 4];
- $('film-subline').textContent = ['Your vision. Every frame.', 'One spark. Endless possibilities.', 'Built around your big idea.', 'This is where it begins.'][index % 4];
$('preview-description').textContent = `${clip.label || `Moment ${index + 1}`} · ${refFor(clip.ref)?.name || 'Reference'}`;
}
function seek(time) {
@@ -145,6 +140,7 @@ function seek(time) {
state.selected = position.index;
const reference = refFor(state.clips[position.index].ref);
if (!reference) return;
+ video.poster = state.clips[position.index].poster || reference.poster || '';
updateScene(position.index); renderSelection();
if (video.dataset.reference !== reference.id) {
$('video-loading').hidden = false; $('video-loading').textContent = 'Loading your reference…';
@@ -157,6 +153,9 @@ function seek(time) {
function playButtons() {
$('play').innerHTML = state.playing ? '<span aria-hidden="true">Ⅱ</span>' : '<svg><use href="#i-play"/></svg>';
$('play').setAttribute('aria-label', state.playing ? 'Pause sequence' : 'Play sequence');
+ $('canvas-play').innerHTML = state.playing ? '<span aria-hidden="true">Ⅱ</span>' : '<svg><use href="#i-play"/></svg>';
+ $('canvas-play').setAttribute('aria-label', state.playing ? 'Pause film' : 'Play film');
+ $('canvas-wrap').classList.toggle('is-playing', state.playing);
$('play-top').innerHTML = state.playing ? 'Ⅱ &nbsp; Pause concept' : '<svg><use href="#i-play"/></svg>Play concept';
}
function tick() {
@@ -301,7 +300,14 @@ $('clips-track').addEventListener('drop', event => {
else if (state.dragged?.type === 'clip') reorder(state.dragged.index, Math.min(index, state.clips.length - 1));
state.dragged = null;
});
-for (const id of ['play', 'play-top']) $(id).addEventListener('click', togglePlay);
+for (const id of ['play', 'play-top', 'canvas-play']) $(id).addEventListener('click', togglePlay);
+$('safe-area').addEventListener('click', () => {
+ const show = $('monitor-guides').hidden;
+ $('monitor-guides').hidden = !show; $('safe-area').setAttribute('aria-pressed', show);
+});
+$('brand-visible').addEventListener('change', () => {
+ $('film-stage').classList.toggle('no-brand', !$('brand-visible').checked); persist();
+});
$('restart').addEventListener('click', () => { pause(); seek(0); });
$('scrubber').addEventListener('input', () => { pause(); seek(Number($('scrubber').value)); });
$('mute').addEventListener('click', () => { video.muted = !video.muted; $('mute').setAttribute('aria-pressed', video.muted); $('mute').setAttribute('aria-label', video.muted ? 'Unmute reference audio' : 'Mute reference audio'); document.querySelector('.mute-slash').hidden = !video.muted; });
@@ -322,7 +328,7 @@ $('rail-brand').addEventListener('click', () => { $('brand-panel').scrollIntoVie
for (const mode of ['concept', 'reference']) $(`mode-${mode}`).addEventListener('click', () => {
state.mode = mode; $('canvas-wrap').classList.toggle('reference-mode', mode === 'reference');
for (const option of ['concept', 'reference']) { $(`mode-${option}`).classList.toggle('active', option === mode); $(`mode-${option}`).setAttribute('aria-pressed', option === mode); }
- $('canvas-label').textContent = mode === 'concept' ? 'CONCEPT PREVIEW' : 'ORIGINAL REFERENCE';
+ $('canvas-label').textContent = mode === 'concept' ? 'FILM PREVIEW' : 'ORIGINAL REFERENCE';
});
$('close-dialog').addEventListener('click', closeReference);
$('reference-dialog').addEventListener('close', () => { $('dialog-video').pause(); dialogTrigger?.focus(); });
@@ -365,6 +371,14 @@ async function initialize() {
if (typeof saved.message === 'string') $('brand-message').value = saved.message.slice(0, 80);
if (/^#[a-f\d]{6}$/i.test(saved.accent) && /^#[a-f\d]{6}$/i.test(saved.paper)) palette(saved.accent, saved.paper);
if (['landscape', 'portrait', 'square'].includes(saved.aspect)) $('aspect').value = saved.aspect;
+ if (typeof saved.overlay === 'boolean') $('brand-visible').checked = saved.overlay;
+ $('film-stage').classList.toggle('no-brand', !$('brand-visible').checked);
+ const legacyPicks = [['09a418cdd005', 0], ['09782d1f7c63', 1], ['cf8c4707e634', 2], ['919ebec37a3b', 0]];
+ const untouchedLegacyDemo = state.clips.length === 4 && state.clips.every((clip, index) => {
+ const [id, part] = legacyPicks[index]; const source = refFor(id)?.segments[part];
+ return source && clip.ref === id && clip.in === source.in && clip.out === source.out && clip.label === ['The opening', 'The build', 'The reveal', 'The close'][index];
+ });
+ if (untouchedLegacyDemo) state.clips = demoClips();
} else state.clips = demoClips();
state.initialized = true;
renderLibrary(); brand(); setAspect(); renderTimeline(); seek(0);
diff --git a/public/reference-policy.mjs b/public/reference-policy.mjs
new file mode 100644
index 0000000..f2d91aa
--- /dev/null
+++ b/public/reference-policy.mjs
@@ -0,0 +1,9 @@
+export function curateReferences(references, policy) {
+ const order = policy.featured || [];
+ return references.filter(reference => !Object.hasOwn(policy.excluded || {}, reference.id)).map(reference => ({
+ ...reference, name: policy.names?.[reference.id] || reference.name
+ })).sort((a, b) => {
+ const rank = id => order.includes(id) ? order.indexOf(id) : order.length;
+ return rank(a.id) - rank(b.id);
+ });
+}
diff --git a/scripts/import-motionclone.py b/scripts/import-motionclone.py
index 73d0c1b..f3e688f 100644
--- a/scripts/import-motionclone.py
+++ b/scripts/import-motionclone.py
@@ -10,6 +10,7 @@ parser = argparse.ArgumentParser()
parser.add_argument('--source', required=True, type=Path, help='MotionClone project directory')
args = parser.parse_args()
target = Path(__file__).resolve().parent.parent
+policy = json.loads((target / 'data' / 'reference-policy.json').read_text(encoding='utf-8'))
media_root = target / '.local-media'
thumb_root = target / 'public' / 'references'
media_root.mkdir(exist_ok=True)
@@ -28,6 +29,9 @@ for directory in sorted((args.source / 'data').iterdir()):
sources.append((directory.name + '-' + video.stem, video, info.get('title', video.stem)))
references = []
for identifier, video, title in sources:
+ if identifier in policy['excluded']:
+ print(f'Skipped {identifier}: excluded by reference policy.', flush=True)
+ continue
probe = subprocess.run(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=width,height:format=duration', '-of', 'json', str(video)], capture_output=True, text=True, check=True)
details = json.loads(probe.stdout)
duration = float(details['format']['duration'])
@@ -53,11 +57,11 @@ for identifier, video, title in sources:
'227b019e7968': 'SaaS · Launch sequence', '5db95a3a7c73': 'Motion study 08',
'5924a2f28506': 'Interface · Motion study'
}
- references.append({'id': identifier, 'name': aliases.get(identifier, name[:85]), 'originalName': str(title)[:200],
+ references.append({'id': identifier, 'name': policy.get('names', {}).get(identifier, aliases.get(identifier, name[:85])), 'originalName': str(title)[:200],
'duration': round(duration, 3), 'width': details['streams'][0]['width'], 'height': details['streams'][0]['height'],
'src': f'/media/references/{identifier}.mp4', 'poster': segments[0]['poster'], 'segments': segments})
print(f'Imported {identifier}: {len(segments)} segments', flush=True)
-preferred = ['09a418cdd005', '09782d1f7c63', 'cf8c4707e634', '4d97811d6dae', '919ebec37a3b', '3227c09daea3']
+preferred = policy['featured']
references.sort(key=lambda item: preferred.index(item['id']) if item['id'] in preferred else len(preferred))
(thumb_root / 'catalog.json').write_text(json.dumps({'references': references}, indent=2, ensure_ascii=False), encoding='utf-8')
print(f'Ready: {len(references)} references, {sum(len(r["segments"]) for r in references)} selectable segments.')
diff --git a/server.js b/server.js
index 1ca461a..cb20573 100644
--- a/server.js
+++ b/server.js
@@ -3,9 +3,11 @@ import { readFile, realpath, stat } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { streamVideo } from './media.js';
+import { curateReferences } from './public/reference-policy.mjs';
const root = fileURLToPath(new URL('./public/', import.meta.url));
const catalog = JSON.parse(await readFile(new URL('./data/template-catalog.json', import.meta.url), 'utf8'));
+const referencePolicy = JSON.parse(await readFile(new URL('./data/reference-policy.json', import.meta.url), 'utf8'));
const templates = catalog.templates.map(template => ({
...template,
...template.output,
@@ -51,11 +53,17 @@ export function createApp() {
return json(response, 403, { error: 'Forbidden.' });
}
if (pathname === '/api/references') {
- try { return json(response, 200, JSON.parse(await readFile(new URL('./public/references/catalog.json', import.meta.url), 'utf8'))); }
+ try {
+ const library = JSON.parse(await readFile(new URL('./public/references/catalog.json', import.meta.url), 'utf8'));
+ return json(response, 200, { references: curateReferences(library.references || [], referencePolicy) });
+ }
catch { return json(response, 200, { references: [] }); }
}
const mediaMatch = pathname.match(/^\/media\/references\/([a-z0-9-]+)\.mp4$/);
- if (mediaMatch) return streamVideo(request, response, fileURLToPath(new URL(`./.local-media/${mediaMatch[1]}.mp4`, import.meta.url)));
+ if (mediaMatch) {
+ if (Object.hasOwn(referencePolicy.excluded, mediaMatch[1])) return json(response, 404, { error: 'Reference removed from this library.' });
+ return streamVideo(request, response, fileURLToPath(new URL(`./.local-media/${mediaMatch[1]}.mp4`, import.meta.url)));
+ }
if (pathname === '/' || pathname === '/editor') pathname = '/editor.html';
if (readOnly.has(pathname)) return json(response, 200, readOnly.get(pathname));
const sourceMatch = pathname.match(/^\/api\/v1\/templates\/([^/]+)\/source$/);
diff --git a/test/reference-policy.test.js b/test/reference-policy.test.js
new file mode 100644
index 0000000..477e127
--- /dev/null
+++ b/test/reference-policy.test.js
@@ -0,0 +1,13 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile } from 'node:fs/promises';
+import { curateReferences } from '../public/reference-policy.mjs';
+const policy = JSON.parse(await readFile(new URL('../data/reference-policy.json', import.meta.url), 'utf8'));
+test('curation removes live-action footage while preserving motion references', () => {
+ const references = [{ id: 'nexa-references-2095595661559574528', segments: [{ in: 0, out: 4 }] }, { id: '919ebec37a3b', name: 'Troovy' }, { id: '69614b10fa87', name: 'Old title' }];
+ const curated = curateReferences(references, policy);
+ assert.equal(curated.length, 2);
+ assert.equal(curated[0].name, 'Infinite · Global payments');
+ assert.equal(curated[1].name, 'Troovy');
+ assert.equal(references.length, 3);
+});
diff --git a/test/server.test.js b/test/server.test.js
index a4f5b63..ad88359 100644
--- a/test/server.test.js
+++ b/test/server.test.js
@@ -37,4 +37,7 @@ test('public workspace is standalone, read-only, and serves its own previews', a
}
assert.equal((await get('/%ZZ')).status, 400);
assert.equal((await get('/api/v1/unknown')).status, 501);
+ const references = await (await get('/api/references')).json();
+ assert.ok(!references.references.some(reference => reference.id === 'nexa-references-2095595661559574528'));
+ assert.equal((await get('/media/references/nexa-references-2095595661559574528.mp4')).status, 404);
});