fablecut 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +29 -0
- package/README.md +2 -1
- package/app.js +232 -111
- package/compact.css +702 -0
- package/compact.js +785 -0
- package/doc-guard.js +97 -0
- package/index.html +28 -10
- package/layout.js +72 -0
- package/manifest.json +1 -1
- package/mcp-server.js +1 -1
- package/package.json +2 -1
- package/style.css +7 -0
- package/touch.js +815 -0
package/doc-guard.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* What a project.json may carry where the editor expects a word or a number.
|
|
2
|
+
|
|
3
|
+
A project can come from anywhere: a shared file, a template, an agent. Text
|
|
4
|
+
people write (names, titles, notes, credits, tags) may hold any character and
|
|
5
|
+
is escaped wherever it is shown. Nothing else in a project is prose: an id, a
|
|
6
|
+
kind, a colour, an option name, a size never needs the characters markup is
|
|
7
|
+
made of, so they are taken out here, once, as a document is loaded. In an id
|
|
8
|
+
each of them becomes a character of its own instead, in every reference too:
|
|
9
|
+
two ids that differ still differ, and a reference still finds its item.
|
|
10
|
+
Well-formed projects come through unchanged.
|
|
11
|
+
|
|
12
|
+
clean(doc) works in place and returns doc: a project, a saved template or
|
|
13
|
+
preset, or a list of them. Loaded by the editor as a plain script (global
|
|
14
|
+
`FableCutGuard`) and required by the tests. */
|
|
15
|
+
(function (root, factory) {
|
|
16
|
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
|
17
|
+
else root.FableCutGuard = factory();
|
|
18
|
+
})(typeof self !== "undefined" ? self : this, function () {
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
// text people write, or copy from somewhere: kept exactly, escaped where it is shown
|
|
22
|
+
const PROSE = new Set(["name", "text", "label", "title", "note", "notes", "description", "artist", "author", "creator", "copyright", "date", "keywords",
|
|
23
|
+
"filename", "caption", "license", "licenseUrl", "attribution", "credit", "source", "url", "link", "landing", "src", "tags", "placeholder", "default", "group",
|
|
24
|
+
"why", "reason", "words"]);
|
|
25
|
+
const MARKUP = /[<>"'`\u0000-\u0008\u000b-\u001f]/g;
|
|
26
|
+
const IN_FONT = /[<>"`\u0000-\u0008\u000b-\u001f]/g; // a family name may have an apostrophe
|
|
27
|
+
const IN_WORD = /[<>"'`&\\\u0000-\u001f]/g;
|
|
28
|
+
// a colour as CSS writes it, or a plain word ("red", or a delivery colour such as "bt709")
|
|
29
|
+
const COLOR = /^(#[0-9a-f]{3,8}|[a-z][a-z0-9-]{1,30}|(rgb|hsl)a?\([\d\s.,%/a-z+-]{3,60}\))$/i;
|
|
30
|
+
// names in the document: ids and the references to them alike (a template's target is "<clip id>:<path>")
|
|
31
|
+
const IDS = new Set(["id", "ids", "mediaId", "clipId", "compId", "folderId", "parentId", "linkGroup", "linkedId", "parent", "track", "out", "sequence", "media",
|
|
32
|
+
"derivedFrom", "matteTrack", "targets"]);
|
|
33
|
+
const WORDS = new Set(["kind", "type"]); // names in the editor's own lists
|
|
34
|
+
const SIZES = new Set(["width", "height", "fps"]);
|
|
35
|
+
const isColorKey = (k) => /colou?r\d?$/i.test(k) || k === "background" || k === "fill" || k === "stroke";
|
|
36
|
+
const DEPTH = 60;
|
|
37
|
+
|
|
38
|
+
const strip = (s, re) => s.replace(re, "");
|
|
39
|
+
/** One character for one (a braille pattern per code, or the same place in a later block), so an id keeps its length. */
|
|
40
|
+
const word = (s, block = 0x2800) => s.replace(IN_WORD, (c) => String.fromCharCode(block + c.charCodeAt(0)));
|
|
41
|
+
|
|
42
|
+
function clean(doc) {
|
|
43
|
+
const ids = new Map(), taken = new Set(); // id as written → as loaded · every id the document has
|
|
44
|
+
allIds(doc, taken, 0);
|
|
45
|
+
ids.taken = taken;
|
|
46
|
+
for (const id of [...taken]) rename(id, ids); // first, so that a reference is found under any key
|
|
47
|
+
walk(doc, "", 0, ids);
|
|
48
|
+
return doc;
|
|
49
|
+
}
|
|
50
|
+
function allIds(o, taken, depth) {
|
|
51
|
+
if (!o || typeof o !== "object" || depth > DEPTH) return;
|
|
52
|
+
if (!Array.isArray(o) && typeof o.id === "string") taken.add(o.id);
|
|
53
|
+
for (const k of Object.keys(o)) allIds(o[k], taken, depth + 1);
|
|
54
|
+
}
|
|
55
|
+
/** An id, or a reference to one: the same answer for both, and never another item's id. */
|
|
56
|
+
function rename(s, ids) {
|
|
57
|
+
if (ids.has(s)) return ids.get(s);
|
|
58
|
+
let to = word(s);
|
|
59
|
+
if (to === s) return s;
|
|
60
|
+
for (let block = 0x2900; ids.taken.has(to) && block < 0xd800; block += 0x100) to = word(s, block);
|
|
61
|
+
while (ids.taken.has(to)) to += "\u28ff"; // every block taken (a file made for it): longer, but its own
|
|
62
|
+
ids.taken.add(to);
|
|
63
|
+
ids.set(s, to);
|
|
64
|
+
return to;
|
|
65
|
+
}
|
|
66
|
+
function target(s, ids) { // "<clip id>:<path>"
|
|
67
|
+
const i = s.indexOf(":");
|
|
68
|
+
return i < 0 ? rename(s, ids) : rename(s.slice(0, i), ids) + word(s.slice(i));
|
|
69
|
+
}
|
|
70
|
+
function text(v, k, ids) {
|
|
71
|
+
if (PROSE.has(k)) return v;
|
|
72
|
+
if (/^font/i.test(k)) return strip(v, IN_FONT); // never a reference, even when an id reads the same
|
|
73
|
+
if (k === "targets") return target(v, ids);
|
|
74
|
+
if (IDS.has(k) || /Tracks$/.test(k) || ids.has(v)) return rename(v, ids);
|
|
75
|
+
return strip(v, WORDS.has(k) ? IN_WORD : MARKUP);
|
|
76
|
+
}
|
|
77
|
+
function walk(o, key, depth, ids) {
|
|
78
|
+
if (!o || typeof o !== "object") return;
|
|
79
|
+
if (depth > DEPTH) { for (const k of Object.keys(o)) delete o[k]; return; } // nothing real is nested that deep
|
|
80
|
+
if (Array.isArray(o)) {
|
|
81
|
+
for (let i = 0; i < o.length; i++) if (typeof o[i] === "string") { const t = text(o[i], key, ids); if (t !== o[i]) o[i] = t; } else walk(o[i], key, depth + 1, ids);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (o.type === "media" && ids.has(o.default)) o.default = ids.get(o.default); // a template field's file; other defaults are text
|
|
85
|
+
for (let k of Object.keys(o)) {
|
|
86
|
+
const v = o[k];
|
|
87
|
+
if (ids.has(k)) { delete o[k]; k = ids.get(k); o[k] = v; } // a table with a row per id
|
|
88
|
+
if (strip(k, MARKUP) !== k) { delete o[k]; continue; } // the editor prints property and channel names
|
|
89
|
+
if (typeof v !== "string") { walk(v, k, depth + 1, ids); continue; }
|
|
90
|
+
if (SIZES.has(k)) { const n = parseFloat(v); if (Number.isFinite(n)) o[k] = n; else delete o[k]; }
|
|
91
|
+
else if (isColorKey(k)) { if (v && !COLOR.test(v.trim())) delete o[k]; } // its default takes over
|
|
92
|
+
else { const t = text(v, k, ids); if (t !== v) o[k] = t; }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return { clean, word, COLOR, PROSE };
|
|
97
|
+
});
|
package/index.html
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
|
6
6
|
<title>FableCut - Video Editor</title>
|
|
7
7
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
8
8
|
<link rel="icon" href="/icons/favicon-32.png" sizes="32x32" type="image/png">
|
|
9
9
|
<meta name="theme-color" content="#0e0e10">
|
|
10
10
|
<link rel="stylesheet" href="style.css">
|
|
11
|
+
<link rel="stylesheet" href="compact.css">
|
|
11
12
|
</head>
|
|
12
13
|
<body>
|
|
13
14
|
<div class="app" id="app">
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
</svg>
|
|
40
41
|
</button>
|
|
41
42
|
<button class="btn ghost" id="btnHelp" title="Keyboard shortcuts">?</button>
|
|
42
|
-
<button class="btn primary" id="btnExport"
|
|
43
|
+
<button class="btn primary" id="btnExport"><span class="gx gx-get">⬇</span> Export</button>
|
|
43
44
|
</div>
|
|
44
45
|
</header>
|
|
45
46
|
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
<input type="file" id="fileInput" class="sr-only" multiple accept="video/*,audio/*,image/*,.mp4,.mov,.webm,.mkv,.mp3,.wav,.m4a,.png,.jpg,.jpeg,.gif,.webp,.svg">
|
|
84
85
|
<div class="bin-list" id="binList">
|
|
85
86
|
<div class="bin-empty" id="binEmpty">
|
|
86
|
-
<div class="bin-empty-icon">🎬</div>
|
|
87
|
+
<div class="bin-empty-icon"><span class="gx gx-video">🎬</span></div>
|
|
87
88
|
<p>Drop video, audio or images here<br>or click <b>+ Import</b> / <b>+ URL</b></p>
|
|
88
89
|
<p class="hint">Double-click to open in Source, or drag onto the timeline.</p>
|
|
89
90
|
</div>
|
|
@@ -159,11 +160,11 @@
|
|
|
159
160
|
</span>
|
|
160
161
|
<div class="transport-btns">
|
|
161
162
|
<button class="btn icon" id="btnMarkIn" title="Mark In (I) — Source marks when Source is active; timeline work area in Program">I</button>
|
|
162
|
-
<button class="btn icon" id="btnHome" title="Go to start (Home)">⏮</button>
|
|
163
|
-
<button class="btn icon" id="btnBack" title="Back 1 frame (←)">◀︎</button>
|
|
164
|
-
<button class="btn icon big" id="btnPlay" title="Play / Pause (Space)">▶</button>
|
|
165
|
-
<button class="btn icon" id="btnFwd" title="Forward 1 frame (→)">▶︎</button>
|
|
166
|
-
<button class="btn icon" id="btnEnd" title="Go to end (End)">⏭</button>
|
|
163
|
+
<button class="btn icon" id="btnHome" title="Go to start (Home)"><span class="gx gx-start">⏮</span></button>
|
|
164
|
+
<button class="btn icon" id="btnBack" title="Back 1 frame (←)"><span class="gx gx-prev">◀︎</span></button>
|
|
165
|
+
<button class="btn icon big" id="btnPlay" title="Play / Pause (Space)"><span class="gx gx-play">▶</span></button>
|
|
166
|
+
<button class="btn icon" id="btnFwd" title="Forward 1 frame (→)"><span class="gx gx-next">▶︎</span></button>
|
|
167
|
+
<button class="btn icon" id="btnEnd" title="Go to end (End)"><span class="gx gx-end">⏭</span></button>
|
|
167
168
|
<button class="btn icon" id="btnMarkOut" title="Mark Out (O) — Source marks when Source is active; timeline work area in Program">O</button>
|
|
168
169
|
<button class="btn icon toggle" id="btnSpeed" title="Preview speed — click to cycle 1×/1.5×/2×/4×. L forward · J reverse (tap again = faster) · K stop. Preview only, not export.">1×</button>
|
|
169
170
|
</div>
|
|
@@ -225,7 +226,7 @@
|
|
|
225
226
|
<button class="btn tiny hidden" id="btnTrimIO" title="Trim clips to IN/OUT (⇧T)"><svg class="ico" viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="square" d="M1.25 4.5H12M4.5 1.25V12M4.5 12H14.75M12 4.5V14.75"/></svg> Trim</button>
|
|
226
227
|
<button class="btn tiny toggle hidden" id="btnWorkAreaPlay" title="Limit playback to IN/OUT (Home/End jump to markers; playhead outside = override)"><svg class="ico" viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="square" stroke-linejoin="miter" d="M1.5 2.5V13.5M14.5 2.5V13.5M4.25 8H11.75M9.35 5.6L12 8L9.35 10.4"/></svg> Limit</button>
|
|
227
228
|
<span class="tool-seg" role="group" aria-label="Edit tool"><button type="button" class="btn tiny on" data-edit-tool="select" aria-pressed="true" title="Selection tool (V) — move and trim clips"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M4 1.5v11.2l3-2.9 1.9 4.6 1.8-.8-1.9-4.4h4.2z"/></svg></button><button type="button" class="btn tiny" data-edit-tool="ripple" aria-pressed="false" title="Ripple edit (B) — drag a clip edge; everything after it moves with it"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M5 2.5v11M5 8h8.5M11 5.5 13.5 8 11 10.5"/></svg></button><button type="button" class="btn tiny" data-edit-tool="roll" aria-pressed="false" title="Rolling edit (R) — drag a cut; the clips on both sides trim, nothing else moves"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M8 2v12M1.5 8h4M10.5 8h4M3.5 6 1.5 8l2 2M12.5 6l2 2-2 2"/></svg></button><button type="button" class="btn tiny" data-edit-tool="slip" aria-pressed="false" title="Slip (Y) — drag a clip to change which part of the source it shows"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M2.5 3v10M13.5 3v10M5 8h6M6.8 6.2 5 8l1.8 1.8M9.2 6.2 11 8l-1.8 1.8"/></svg></button><button type="button" class="btn tiny" data-edit-tool="slide" aria-pressed="false" title="Slide (U) — drag a clip along the track; its neighbours trim to make room"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><rect fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" x="5" y="4" width="6" height="8" rx="1"/><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M1 8h2.5M12.5 8H15M2.3 6.7 1 8l1.3 1.3M13.7 6.7 15 8l-1.3 1.3"/></svg></button></span>
|
|
228
|
-
<button class="btn tiny" id="btnSplit" title="Split at playhead on targeted tracks (S)"
|
|
229
|
+
<button class="btn tiny" id="btnSplit" title="Split at playhead on targeted tracks (S)"><span class="gx gx-split">✂</span> Split</button>
|
|
229
230
|
<button class="btn tiny" id="btnCloseGap" title="Close gap at playhead (⇧G)"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" style="vertical-align:-3px" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" d="M0.75 4.5H3.5V11.5H0.75M15.25 4.5H12.5V11.5H15.25"/><path fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" d="M6.35 5.85L9.65 10.15M9.65 5.85L6.35 10.15"/></svg> Close gap</button>
|
|
230
231
|
<button class="btn tiny" id="btnNextGap" title="Find gap (G)"><svg class="ico" viewBox="0 0 16 16" width="14" height="14" style="vertical-align:-3px" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" d="M0.75 4.5H3.5V11.5H0.75M15.25 4.5H12.5V11.5H15.25"/><text x="8" y="11.1" text-anchor="middle" fill="currentColor" font-size="9.5" font-family="Segoe UI, system-ui, sans-serif" font-weight="700">?</text></svg> Find gap</button>
|
|
231
232
|
<button class="btn tiny" id="btnDelete" title="Delete selected (Del)"><svg class="ico" viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path fill="currentColor" d="M5.5 1.5h5v1.25H14v1.5H2v-1.5h3.5V1.5zM3.75 5.5h8.5v8.25a1.5 1.5 0 0 1-1.5 1.5h-5.5a1.5 1.5 0 0 1-1.5-1.5V5.5zm2 2v5h1.25v-5H5.75zm3.25 0v5H10.25v-5H9z"/></svg> Delete</button>
|
|
@@ -237,7 +238,7 @@
|
|
|
237
238
|
<button class="btn tiny toggle" id="btnAudioHold" title="Audio Hold — while paused, loop one frame of audio at the playhead. Play/Stop turns it off."><svg class="ico" viewBox="0 0 16 16" width="13" height="13" style="vertical-align:-3px" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="square" d="M1.75 2.75V13.25M14.25 2.75V13.25"/><path fill="currentColor" d="M5.2 5.85h1.15v4.3H5.2V5.85zM7.05 5.85h0.55l2.85-2.2v8.7l-2.85-2.2H7.05V5.85z"/></svg> Audio hold</button>
|
|
238
239
|
<span class="flex-spacer"></span>
|
|
239
240
|
<span class="dim tiny-label">Zoom</span>
|
|
240
|
-
<input type="range" id="zoomSlider" min="1" max="300" value="60">
|
|
241
|
+
<input type="range" id="zoomSlider" aria-label="Timeline zoom" min="1" max="300" value="60">
|
|
241
242
|
<button class="btn tiny" id="btnZoomFit" title="Zoom timeline to fit (⇧Z)"><span class="fit-icon">│<span class="fit-arrow">↔</span>│</span> Fit</button>
|
|
242
243
|
</div>
|
|
243
244
|
<div class="timeline">
|
|
@@ -506,6 +507,19 @@
|
|
|
506
507
|
</span>
|
|
507
508
|
</label>
|
|
508
509
|
</div>
|
|
510
|
+
<div class="settings-section">
|
|
511
|
+
<h3>Screen</h3>
|
|
512
|
+
<label class="settings-row settings-pick">
|
|
513
|
+
<span>
|
|
514
|
+
<span class="settings-label">Layout</span>
|
|
515
|
+
<span class="settings-hint">Automatic picks by window size and whether you use a finger or a mouse. Remembered in this browser.</span>
|
|
516
|
+
</span>
|
|
517
|
+
<select id="setLayout" aria-label="Layout">
|
|
518
|
+
<option value="">Automatic</option><option value="phone">Phone</option>
|
|
519
|
+
<option value="tablet">Tablet</option><option value="desktop">Desktop</option>
|
|
520
|
+
</select>
|
|
521
|
+
</label>
|
|
522
|
+
</div>
|
|
509
523
|
<div class="settings-section">
|
|
510
524
|
<h3>Export</h3>
|
|
511
525
|
<label class="settings-row">
|
|
@@ -709,6 +723,8 @@
|
|
|
709
723
|
|
|
710
724
|
<div id="toast"></div>
|
|
711
725
|
|
|
726
|
+
<script src="layout.js"></script>
|
|
727
|
+
<script src="doc-guard.js"></script>
|
|
712
728
|
<script src="loudness.js"></script>
|
|
713
729
|
<script src="ducking.js"></script>
|
|
714
730
|
<script src="silence.js"></script>
|
|
@@ -735,5 +751,7 @@
|
|
|
735
751
|
<script src="focus.js"></script>
|
|
736
752
|
<script src="select-menu.js"></script>
|
|
737
753
|
<script src="app.js"></script>
|
|
754
|
+
<script src="compact.js"></script>
|
|
755
|
+
<script src="touch.js"></script>
|
|
738
756
|
</body>
|
|
739
757
|
</html>
|
package/layout.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* Which layout fits this screen: phone, tablet or desktop.
|
|
2
|
+
|
|
3
|
+
Decided here and nowhere else, from the space and the kind of input (never
|
|
4
|
+
from the browser's name), and written as one attribute on the root element
|
|
5
|
+
that style sheets and scripts both read:
|
|
6
|
+
|
|
7
|
+
<html data-layout="phone portrait"> phone, held upright
|
|
8
|
+
<html data-layout="phone landscape"> phone on its side, or a very short window
|
|
9
|
+
<html data-layout="tablet portrait"> one side panel at a time
|
|
10
|
+
<html data-layout="desktop landscape"> the three-column editor
|
|
11
|
+
|
|
12
|
+
Match a word with [data-layout~="phone"]. A `fablecut:layout` event on
|
|
13
|
+
window follows every change. Nothing that draws or exports reads this. */
|
|
14
|
+
(function (root, factory) {
|
|
15
|
+
if (typeof module === "object" && module.exports) module.exports = factory();
|
|
16
|
+
else root.FableCutLayout = factory();
|
|
17
|
+
})(typeof self !== "undefined" ? self : this, function () {
|
|
18
|
+
"use strict";
|
|
19
|
+
|
|
20
|
+
const MODES = ["phone", "tablet", "desktop"];
|
|
21
|
+
const KEY = "fablecut-layout"; // the manual choice, per browser
|
|
22
|
+
const DESKTOP_W = 1100; // with a mouse: at and above this, always today's layout
|
|
23
|
+
const DESKTOP_W_TOUCH = 1400; // finger first: an iPad Pro on its side (1366) is still a tablet
|
|
24
|
+
const PHONE_W = 700;
|
|
25
|
+
const PHONE_H = 480; // a phone on its side is wide but short
|
|
26
|
+
|
|
27
|
+
/** w, h: the window in CSS px. coarse: the main pointer is a finger. override: a mode, or null for auto. */
|
|
28
|
+
function pick({ w, h, coarse = false, override = null }) {
|
|
29
|
+
const landscape = w > h;
|
|
30
|
+
if (MODES.includes(override)) return { mode: override, landscape };
|
|
31
|
+
if (w >= (coarse ? DESKTOP_W_TOUCH : DESKTOP_W)) return { mode: "desktop", landscape };
|
|
32
|
+
if (w < PHONE_W || h < PHONE_H) return { mode: "phone", landscape };
|
|
33
|
+
return { mode: "tablet", landscape };
|
|
34
|
+
}
|
|
35
|
+
const attr = (r) => `${r.mode} ${r.landscape ? "landscape" : "portrait"}`;
|
|
36
|
+
|
|
37
|
+
const api = { MODES, pick, attr, mode: "desktop", landscape: true, override: null, set: () => { }, update: () => { } };
|
|
38
|
+
if (typeof window === "undefined" || typeof document === "undefined") return api;
|
|
39
|
+
|
|
40
|
+
const coarse = window.matchMedia("(pointer: coarse)");
|
|
41
|
+
try { const v = localStorage.getItem(KEY); if (MODES.includes(v)) api.override = v; } catch { }
|
|
42
|
+
|
|
43
|
+
const typing = () => {
|
|
44
|
+
const el = document.activeElement;
|
|
45
|
+
return !!el && (el.tagName === "TEXTAREA" || el.isContentEditable ||
|
|
46
|
+
(el.tagName === "INPUT" && !["range", "checkbox", "radio", "button", "color", "file"].includes(el.type)));
|
|
47
|
+
};
|
|
48
|
+
let lastW = 0;
|
|
49
|
+
api.update = () => {
|
|
50
|
+
const w = window.innerWidth, h = window.innerHeight;
|
|
51
|
+
// some browsers shrink the window for the on-screen keyboard: that is not a rotation
|
|
52
|
+
if (w === lastW && typing() && coarse.matches) return;
|
|
53
|
+
lastW = w;
|
|
54
|
+
const r = pick({ w, h, coarse: coarse.matches, override: api.override });
|
|
55
|
+
const next = attr(r), was = document.documentElement.dataset.layout;
|
|
56
|
+
api.mode = r.mode; api.landscape = r.landscape;
|
|
57
|
+
if (next === was) return;
|
|
58
|
+
document.documentElement.dataset.layout = next;
|
|
59
|
+
window.dispatchEvent(new CustomEvent("fablecut:layout", { detail: { from: was || null, to: next } }));
|
|
60
|
+
};
|
|
61
|
+
/** Choose by hand (null: back to automatic). Remembered in this browser. */
|
|
62
|
+
api.set = (mode) => {
|
|
63
|
+
api.override = MODES.includes(mode) ? mode : null;
|
|
64
|
+
try { if (api.override) localStorage.setItem(KEY, api.override); else localStorage.removeItem(KEY); } catch { }
|
|
65
|
+
api.update();
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("resize", api.update);
|
|
68
|
+
document.addEventListener("focusout", () => setTimeout(api.update, 60)); // a rotation while the keyboard was up
|
|
69
|
+
coarse.addEventListener("change", api.update);
|
|
70
|
+
api.update();
|
|
71
|
+
return api;
|
|
72
|
+
});
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": "0.2",
|
|
3
3
|
"name": "fablecut",
|
|
4
4
|
"display_name": "FableCut",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.23.0",
|
|
6
6
|
"description": "Zero-dependency browser video editor that AI agents can drive — JSON timeline, MCP tools, live-reloading UI.",
|
|
7
7
|
"long_description": "FableCut is a Premiere-style non-linear video editor that runs in the browser with zero npm dependencies. An AI agent edits video by patching a single project.json timeline (clips, keyframes, transitions, text animations, filters, speed ramps, adjustment layers) through MCP tools, with color grading, masks and tracking, an audio mixer with effects, motion graphics (shape layers, compositions, animation presets and templates), and media management with offline relink and proxies; the open editor UI live-reloads within ~150 ms and exports through ffmpeg with delivery presets (YouTube, Reels, TikTok, Broadcast ProRes, lossless archive…), batch outputs from one render, loudness normalization and a check of every file. Includes reference-video analysis (shot cuts, beats, BPM, energy, drop) so agents can remake an edit with new footage.",
|
|
8
8
|
"author": {
|
package/mcp-server.js
CHANGED
|
@@ -2290,7 +2290,7 @@ async function handle(msg) {
|
|
|
2290
2290
|
result: {
|
|
2291
2291
|
protocolVersion: negotiateProtocolVersion(params?.protocolVersion),
|
|
2292
2292
|
capabilities: { tools: {} },
|
|
2293
|
-
serverInfo: { name: "fablecut", version: "1.
|
|
2293
|
+
serverInfo: { name: "fablecut", version: "1.23.0" },
|
|
2294
2294
|
},
|
|
2295
2295
|
});
|
|
2296
2296
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fablecut",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Zero-dependency browser video editor that AI agents can drive — JSON timeline, MCP server, REST API, live-reloading UI.",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"*.js",
|
|
11
11
|
"index.html",
|
|
12
12
|
"style.css",
|
|
13
|
+
"compact.css",
|
|
13
14
|
"favicon.svg",
|
|
14
15
|
"icons/",
|
|
15
16
|
"encoding-profiles.json",
|
package/style.css
CHANGED
|
@@ -4877,3 +4877,10 @@ input[type=number]:hover::-webkit-inner-spin-button { opacity: .8; }
|
|
|
4877
4877
|
.export-credits-head .btn { margin-left: auto; }
|
|
4878
4878
|
.export-credit { color: var(--dim); overflow-wrap: anywhere; }
|
|
4879
4879
|
.export-credit.warn { color: #f0c14a; }
|
|
4880
|
+
|
|
4881
|
+
/* Settings → Screen: a choice instead of a switch */
|
|
4882
|
+
.settings-row.settings-pick { justify-content: space-between; align-items: center; gap: 14px; }
|
|
4883
|
+
.settings-pick select {
|
|
4884
|
+
flex: none; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
|
|
4885
|
+
border-radius: 6px; padding: 6px 28px 6px 10px; font: inherit;
|
|
4886
|
+
}
|