canvas-recorder-lib 0.8.3 → 0.8.4
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/README.md +10 -2
- package/dev/canvas-recorder.css +14 -0
- package/dev/canvas-recorder.ts +379 -45
- package/dev/color-picker.ts +13 -0
- package/dev/component-picker.ts +60 -11
- package/dev/font-widgets.ts +2 -2
- package/dev/format-editor.ts +3 -1
- package/dev/fourier-panel.ts +7 -3
- package/dev/handwriting-panel.ts +7 -7
- package/dev/multi-text-dialog.ts +28 -15
- package/dev/player-body.ts +75 -30
- package/dev/schedule-helpers.ts +10 -3
- package/dev/static-image-panel.ts +4 -4
- package/dev/subtitles.ts +170 -0
- package/dev/synced-file.ts +34 -0
- package/dev/timeline-display.ts +1 -1
- package/dev/transcript-align.ts +4 -1
- package/dev/transcript-editor.ts +1187 -0
- package/dev/transcript-export.ts +90 -0
- package/dev/transcript-view.ts +8 -5
- package/dev/transcripts.ts +140 -15
- package/dev/video-clip-panel.ts +4 -4
- package/dist/dev/canvas-recorder.css +14 -0
- package/dist/dev/canvas-recorder.js +304 -39
- package/dist/dev/canvas-recorder.js.map +1 -1
- package/dist/dev/color-picker.d.ts.map +1 -1
- package/dist/dev/color-picker.js +15 -0
- package/dist/dev/color-picker.js.map +1 -1
- package/dist/dev/component-picker.d.ts +2 -1
- package/dist/dev/component-picker.d.ts.map +1 -1
- package/dist/dev/component-picker.js +56 -11
- package/dist/dev/component-picker.js.map +1 -1
- package/dist/dev/font-widgets.d.ts +2 -2
- package/dist/dev/font-widgets.d.ts.map +1 -1
- package/dist/dev/font-widgets.js.map +1 -1
- package/dist/dev/format-editor.d.ts.map +1 -1
- package/dist/dev/format-editor.js +3 -1
- package/dist/dev/format-editor.js.map +1 -1
- package/dist/dev/fourier-panel.d.ts.map +1 -1
- package/dist/dev/fourier-panel.js +4 -3
- package/dist/dev/fourier-panel.js.map +1 -1
- package/dist/dev/handwriting-panel.d.ts +4 -4
- package/dist/dev/handwriting-panel.d.ts.map +1 -1
- package/dist/dev/handwriting-panel.js.map +1 -1
- package/dist/dev/multi-text-dialog.d.ts.map +1 -1
- package/dist/dev/multi-text-dialog.js +23 -12
- package/dist/dev/multi-text-dialog.js.map +1 -1
- package/dist/dev/player-body.d.ts +1 -1
- package/dist/dev/player-body.d.ts.map +1 -1
- package/dist/dev/player-body.js +75 -30
- package/dist/dev/player-body.js.map +1 -1
- package/dist/dev/schedule-helpers.d.ts.map +1 -1
- package/dist/dev/schedule-helpers.js +4 -2
- package/dist/dev/schedule-helpers.js.map +1 -1
- package/dist/dev/static-image-panel.d.ts +3 -3
- package/dist/dev/static-image-panel.d.ts.map +1 -1
- package/dist/dev/subtitles.d.ts +36 -0
- package/dist/dev/subtitles.d.ts.map +1 -0
- package/dist/dev/subtitles.js +135 -0
- package/dist/dev/subtitles.js.map +1 -0
- package/dist/dev/synced-file.d.ts +14 -0
- package/dist/dev/synced-file.d.ts.map +1 -1
- package/dist/dev/synced-file.js +22 -0
- package/dist/dev/synced-file.js.map +1 -1
- package/dist/dev/timeline-display.d.ts +5 -0
- package/dist/dev/timeline-display.d.ts.map +1 -1
- package/dist/dev/timeline-display.js +1 -1
- package/dist/dev/timeline-display.js.map +1 -1
- package/dist/dev/transcript-align.d.ts +3 -1
- package/dist/dev/transcript-align.d.ts.map +1 -1
- package/dist/dev/transcript-align.js +2 -0
- package/dist/dev/transcript-align.js.map +1 -1
- package/dist/dev/transcript-editor.d.ts +36 -0
- package/dist/dev/transcript-editor.d.ts.map +1 -0
- package/dist/dev/transcript-editor.js +948 -0
- package/dist/dev/transcript-editor.js.map +1 -0
- package/dist/dev/transcript-export.d.ts +21 -0
- package/dist/dev/transcript-export.d.ts.map +1 -1
- package/dist/dev/transcript-export.js +65 -0
- package/dist/dev/transcript-export.js.map +1 -1
- package/dist/dev/transcript-view.d.ts +2 -0
- package/dist/dev/transcript-view.d.ts.map +1 -1
- package/dist/dev/transcript-view.js +1 -1
- package/dist/dev/transcript-view.js.map +1 -1
- package/dist/dev/transcripts.d.ts +18 -1
- package/dist/dev/transcripts.d.ts.map +1 -1
- package/dist/dev/transcripts.js +102 -12
- package/dist/dev/transcripts.js.map +1 -1
- package/dist/dev/video-clip-panel.d.ts +3 -3
- package/dist/dev/video-clip-panel.d.ts.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/src/glib/line-font.d.ts +6 -0
- package/dist/src/glib/line-font.d.ts.map +1 -1
- package/dist/src/glib/line-font.js +9 -0
- package/dist/src/glib/line-font.js.map +1 -1
- package/dist/src/glib/path-shape.d.ts +16 -0
- package/dist/src/glib/path-shape.d.ts.map +1 -1
- package/dist/src/glib/path-shape.js +23 -0
- package/dist/src/glib/path-shape.js.map +1 -1
- package/dist/src/glib/transforms.d.ts +9 -0
- package/dist/src/glib/transforms.d.ts.map +1 -1
- package/dist/src/glib/transforms.js +7 -4
- package/dist/src/glib/transforms.js.map +1 -1
- package/dist/src/interpolate.d.ts +17 -10
- package/dist/src/interpolate.d.ts.map +1 -1
- package/dist/src/interpolate.js +1 -17
- package/dist/src/interpolate.js.map +1 -1
- package/dist/src/morph-animation.js +1 -1
- package/dist/src/morph-animation.js.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.d.ts.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.js +4 -2
- package/dist/src/peano-fourier/fourier-shared.js.map +1 -1
- package/dist/src/schedule-helper.d.ts +50 -28
- package/dist/src/schedule-helper.d.ts.map +1 -1
- package/dist/src/schedule-helper.js +22 -0
- package/dist/src/schedule-helper.js.map +1 -1
- package/dist/src/showable.d.ts +57 -10
- package/dist/src/showable.d.ts.map +1 -1
- package/dist/src/showable.js +19 -0
- package/dist/src/showable.js.map +1 -1
- package/dist/src/slide-components/arrow.d.ts +4 -4
- package/dist/src/slide-components/arrow.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts +2 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.js +2 -1
- package/dist/src/slide-components/cross-fade-transition.js.map +1 -1
- package/dist/src/slide-components/duration-agnostic.d.ts +3 -2
- package/dist/src/slide-components/duration-agnostic.d.ts.map +1 -1
- package/dist/src/slide-components/duration-agnostic.js +4 -2
- package/dist/src/slide-components/duration-agnostic.js.map +1 -1
- package/dist/src/slide-components/fixed-duration.d.ts +3 -1
- package/dist/src/slide-components/fixed-duration.d.ts.map +1 -1
- package/dist/src/slide-components/fixed-duration.js +4 -2
- package/dist/src/slide-components/fixed-duration.js.map +1 -1
- package/dist/src/slide-components/fourier.d.ts +19 -12
- package/dist/src/slide-components/fourier.d.ts.map +1 -1
- package/dist/src/slide-components/fourier.js +70 -22
- package/dist/src/slide-components/fourier.js.map +1 -1
- package/dist/src/slide-components/function-graph.d.ts +4 -3
- package/dist/src/slide-components/function-graph.d.ts.map +1 -1
- package/dist/src/slide-components/function-graph.js +6 -2
- package/dist/src/slide-components/function-graph.js.map +1 -1
- package/dist/src/slide-components/halftone-shadow.d.ts +8 -7
- package/dist/src/slide-components/halftone-shadow.d.ts.map +1 -1
- package/dist/src/slide-components/halftone-shadow.js +2 -1
- package/dist/src/slide-components/halftone-shadow.js.map +1 -1
- package/dist/src/slide-components/handwriting-effect.d.ts +8 -6
- package/dist/src/slide-components/handwriting-effect.d.ts.map +1 -1
- package/dist/src/slide-components/handwriting-effect.js +4 -2
- package/dist/src/slide-components/handwriting-effect.js.map +1 -1
- package/dist/src/slide-components/hold.d.ts +4 -2
- package/dist/src/slide-components/hold.d.ts.map +1 -1
- package/dist/src/slide-components/hold.js +4 -2
- package/dist/src/slide-components/hold.js.map +1 -1
- package/dist/src/slide-components/image.d.ts +7 -7
- package/dist/src/slide-components/image.d.ts.map +1 -1
- package/dist/src/slide-components/image.js +4 -2
- package/dist/src/slide-components/image.js.map +1 -1
- package/dist/src/slide-components/in-parallel.d.ts +6 -3
- package/dist/src/slide-components/in-parallel.d.ts.map +1 -1
- package/dist/src/slide-components/in-parallel.js +12 -2
- package/dist/src/slide-components/in-parallel.js.map +1 -1
- package/dist/src/slide-components/in-series.d.ts +2 -1
- package/dist/src/slide-components/in-series.d.ts.map +1 -1
- package/dist/src/slide-components/in-series.js +2 -1
- package/dist/src/slide-components/in-series.js.map +1 -1
- package/dist/src/slide-components/live-duration.d.ts +3 -1
- package/dist/src/slide-components/live-duration.d.ts.map +1 -1
- package/dist/src/slide-components/live-duration.js +4 -2
- package/dist/src/slide-components/live-duration.js.map +1 -1
- package/dist/src/slide-components/multi-text.d.ts +39 -26
- package/dist/src/slide-components/multi-text.d.ts.map +1 -1
- package/dist/src/slide-components/multi-text.js +44 -29
- package/dist/src/slide-components/multi-text.js.map +1 -1
- package/dist/src/slide-components/rectangle.d.ts +5 -4
- package/dist/src/slide-components/rectangle.d.ts.map +1 -1
- package/dist/src/slide-components/rectangle.js +2 -1
- package/dist/src/slide-components/rectangle.js.map +1 -1
- package/dist/src/slide-components/registry.d.ts +5 -0
- package/dist/src/slide-components/registry.d.ts.map +1 -1
- package/dist/src/slide-components/registry.js +28 -27
- package/dist/src/slide-components/registry.js.map +1 -1
- package/dist/src/slide-components/show-error.d.ts.map +1 -1
- package/dist/src/slide-components/show-error.js +3 -2
- package/dist/src/slide-components/show-error.js.map +1 -1
- package/dist/src/slide-components/simple-text.d.ts +11 -10
- package/dist/src/slide-components/simple-text.d.ts.map +1 -1
- package/dist/src/slide-components/simple-text.js +5 -3
- package/dist/src/slide-components/simple-text.js.map +1 -1
- package/dist/src/slide-components/slide-component.d.ts +14 -13
- package/dist/src/slide-components/slide-component.d.ts.map +1 -1
- package/dist/src/slide-components/slide-component.js +2 -1
- package/dist/src/slide-components/slide-component.js.map +1 -1
- package/dist/src/slide-components/slide-left.d.ts +2 -1
- package/dist/src/slide-components/slide-left.d.ts.map +1 -1
- package/dist/src/slide-components/slide-left.js +2 -1
- package/dist/src/slide-components/slide-left.js.map +1 -1
- package/dist/src/slide-components/text-effect.d.ts +9 -1
- package/dist/src/slide-components/text-effect.d.ts.map +1 -1
- package/dist/src/slide-components/text-effect.js.map +1 -1
- package/dist/src/slide-components/traditional-text.d.ts +8 -8
- package/dist/src/slide-components/traditional-text.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.d.ts +4 -3
- package/dist/src/slide-components/video-clip.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.js +2 -1
- package/dist/src/slide-components/video-clip.js.map +1 -1
- package/lib/index.ts +1 -0
- package/package.json +2 -2
- package/src/glib/line-font.ts +9 -0
- package/src/glib/path-shape.ts +35 -0
- package/src/glib/transforms.ts +7 -4
- package/src/interpolate.ts +18 -27
- package/src/morph-animation.ts +1 -1
- package/src/peano-fourier/fourier-shared.ts +4 -2
- package/src/schedule-helper.ts +50 -28
- package/src/showable.ts +79 -10
- package/src/slide-components/arrow.ts +4 -4
- package/src/slide-components/cross-fade-transition.ts +9 -2
- package/src/slide-components/duration-agnostic.ts +4 -3
- package/src/slide-components/fixed-duration.ts +4 -2
- package/src/slide-components/fourier.ts +89 -32
- package/src/slide-components/function-graph.ts +7 -3
- package/src/slide-components/halftone-shadow.ts +9 -7
- package/src/slide-components/handwriting-effect.ts +8 -6
- package/src/slide-components/hold.ts +18 -4
- package/src/slide-components/image.ts +9 -7
- package/src/slide-components/in-parallel.ts +16 -1
- package/src/slide-components/in-series.ts +3 -1
- package/src/slide-components/live-duration.ts +4 -2
- package/src/slide-components/multi-text.ts +71 -44
- package/src/slide-components/rectangle.ts +6 -4
- package/src/slide-components/registry.ts +33 -27
- package/src/slide-components/show-error.ts +4 -2
- package/src/slide-components/simple-text.ts +22 -12
- package/src/slide-components/slide-component.ts +15 -13
- package/src/slide-components/slide-left.ts +9 -2
- package/src/slide-components/text-effect.ts +9 -0
- package/src/slide-components/traditional-text.ts +8 -8
- package/src/slide-components/video-clip.ts +5 -3
package/dev/color-picker.ts
CHANGED
|
@@ -400,6 +400,12 @@ async function openColorPickerDialog(
|
|
|
400
400
|
|
|
401
401
|
function showTab(name: TabName) {
|
|
402
402
|
tabContent.replaceChildren(TAB_BUILDERS[name]());
|
|
403
|
+
if (name === "String") {
|
|
404
|
+
// So you can type, or paste, a color right away.
|
|
405
|
+
const input = tabContent.querySelector("input");
|
|
406
|
+
input?.focus();
|
|
407
|
+
input?.select();
|
|
408
|
+
}
|
|
403
409
|
tabBtns.forEach((btn, n) => {
|
|
404
410
|
btn.style.fontWeight = n === name ? "bold" : "";
|
|
405
411
|
btn.style.borderBottomColor = n === name ? "#333" : "transparent";
|
|
@@ -416,6 +422,13 @@ async function openColorPickerDialog(
|
|
|
416
422
|
dialog.close();
|
|
417
423
|
});
|
|
418
424
|
cancelBtn.addEventListener("click", () => dialog.close());
|
|
425
|
+
// Enter is OK, as Escape is Cancel. A focused button keeps its own Enter.
|
|
426
|
+
dialog.addEventListener("keydown", (event) => {
|
|
427
|
+
if (event.key !== "Enter" || event.isComposing) return;
|
|
428
|
+
if (event.target instanceof HTMLButtonElement) return;
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
okBtn.click();
|
|
431
|
+
});
|
|
419
432
|
|
|
420
433
|
dialog.addEventListener("close", () => {
|
|
421
434
|
addToRecentColors(colorRef.value);
|
package/dev/component-picker.ts
CHANGED
|
@@ -24,7 +24,8 @@ function writeLastChoice(purpose: string, key: string): void {
|
|
|
24
24
|
* Ask the user to choose a component from the registry.
|
|
25
25
|
*
|
|
26
26
|
* Shows a modal list of `choices` with the selected item's description beside it.
|
|
27
|
-
* Arrow keys move the selection, Enter or a
|
|
27
|
+
* Typing searches the names and descriptions. Arrow keys move the selection, Enter or a
|
|
28
|
+
* double-click accepts, Escape cancels.
|
|
28
29
|
*
|
|
29
30
|
* @param options.title The action, e.g. "Insert New Child".
|
|
30
31
|
* @param options.subtitle What it applies to, e.g. `Inside "Scene List"`.
|
|
@@ -53,6 +54,11 @@ export function pickComponent(options: {
|
|
|
53
54
|
"margin-bottom:0.6em;font-size:0.85em;color:#555;font-style:italic";
|
|
54
55
|
hint.textContent = subtitle;
|
|
55
56
|
|
|
57
|
+
const search = document.createElement("input");
|
|
58
|
+
search.type = "text";
|
|
59
|
+
search.placeholder = "Search names and descriptions…";
|
|
60
|
+
search.style.cssText = "width:100%;box-sizing:border-box;margin-bottom:0.6em";
|
|
61
|
+
|
|
56
62
|
const body = document.createElement("div");
|
|
57
63
|
body.style.cssText = "display:flex;gap:0.8em;margin-bottom:1em";
|
|
58
64
|
|
|
@@ -77,27 +83,36 @@ export function pickComponent(options: {
|
|
|
77
83
|
okBtn.textContent = "OK";
|
|
78
84
|
buttons.append(cancelBtn, okBtn);
|
|
79
85
|
|
|
80
|
-
dialog.append(heading, hint, body, buttons);
|
|
86
|
+
dialog.append(heading, hint, search, body, buttons);
|
|
81
87
|
|
|
88
|
+
/** The name shown: the registry entry's label, or else its key. */
|
|
89
|
+
const labelOf = (key: string) => componentRegistry.get(key)?.label ?? key;
|
|
82
90
|
const items = choices.map((key) => {
|
|
83
91
|
const li = document.createElement("li");
|
|
84
|
-
li.textContent = key;
|
|
92
|
+
li.textContent = labelOf(key);
|
|
85
93
|
li.style.cssText =
|
|
86
94
|
"padding:0.35em 0.6em;cursor:pointer;border-bottom:1px solid #eee";
|
|
87
95
|
list.append(li);
|
|
88
96
|
return li;
|
|
89
97
|
});
|
|
90
98
|
|
|
99
|
+
/** What each choice is searched by: its name and its description. */
|
|
100
|
+
const searchText = choices.map((key) =>
|
|
101
|
+
`${labelOf(key)} ${key} ${componentRegistry.get(key)?.description ?? ""}`.toLowerCase(),
|
|
102
|
+
);
|
|
103
|
+
/** The indices that match the search, in order. */
|
|
104
|
+
let visible = choices.map((_, i) => i);
|
|
105
|
+
|
|
91
106
|
let selectedIndex = -1;
|
|
92
107
|
function select(index: number) {
|
|
93
|
-
if (index
|
|
108
|
+
if (!visible.includes(index)) return;
|
|
94
109
|
selectedIndex = index;
|
|
95
110
|
items.forEach((li, i) => li.classList.toggle("selected", i === index));
|
|
96
111
|
items[index].scrollIntoView({ block: "nearest" });
|
|
97
112
|
const key = choices[index];
|
|
98
113
|
const name = document.createElement("b");
|
|
99
114
|
name.style.cssText = "font-style:italic;font-family:Bevan,Georgia,serif";
|
|
100
|
-
name.textContent = key;
|
|
115
|
+
name.textContent = labelOf(key);
|
|
101
116
|
const text = document.createElement("p");
|
|
102
117
|
text.style.margin = "0.4em 0 0 0";
|
|
103
118
|
text.textContent =
|
|
@@ -106,10 +121,40 @@ export function pickComponent(options: {
|
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
function accept() {
|
|
109
|
-
if (selectedIndex
|
|
124
|
+
if (!visible.includes(selectedIndex)) return;
|
|
110
125
|
dialog.close(choices[selectedIndex]);
|
|
111
126
|
}
|
|
112
127
|
|
|
128
|
+
/** Move the selection `delta` places among the visible choices. */
|
|
129
|
+
function move(delta: 1 | -1) {
|
|
130
|
+
const at = visible.indexOf(selectedIndex);
|
|
131
|
+
select(visible[at + delta] ?? visible[at] ?? visible[0]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Every word typed must appear, as in the font picker. */
|
|
135
|
+
function applySearch() {
|
|
136
|
+
const terms = search.value
|
|
137
|
+
.trim()
|
|
138
|
+
.toLowerCase()
|
|
139
|
+
.split(/\s+/)
|
|
140
|
+
.filter(Boolean);
|
|
141
|
+
visible = [];
|
|
142
|
+
items.forEach((li, i) => {
|
|
143
|
+
const match = terms.every((term) => searchText[i].includes(term));
|
|
144
|
+
li.hidden = !match;
|
|
145
|
+
if (match) visible.push(i);
|
|
146
|
+
});
|
|
147
|
+
okBtn.disabled = visible.length === 0;
|
|
148
|
+
if (visible.length === 0) {
|
|
149
|
+
selectedIndex = -1;
|
|
150
|
+
items.forEach((li) => li.classList.remove("selected"));
|
|
151
|
+
description.textContent = "Nothing matches.";
|
|
152
|
+
} else if (!visible.includes(selectedIndex)) {
|
|
153
|
+
select(visible[0]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
search.addEventListener("input", applySearch);
|
|
157
|
+
|
|
113
158
|
items.forEach((li, i) => {
|
|
114
159
|
li.addEventListener("click", () => select(i));
|
|
115
160
|
li.addEventListener("dblclick", () => {
|
|
@@ -117,18 +162,21 @@ export function pickComponent(options: {
|
|
|
117
162
|
accept();
|
|
118
163
|
});
|
|
119
164
|
});
|
|
120
|
-
list
|
|
165
|
+
// The same keys in the list and in the search box.
|
|
166
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
121
167
|
if (e.key === "ArrowDown") {
|
|
122
|
-
|
|
168
|
+
move(1);
|
|
123
169
|
e.preventDefault();
|
|
124
170
|
} else if (e.key === "ArrowUp") {
|
|
125
|
-
|
|
171
|
+
move(-1);
|
|
126
172
|
e.preventDefault();
|
|
127
173
|
} else if (e.key === "Enter") {
|
|
128
174
|
accept();
|
|
129
175
|
e.preventDefault();
|
|
130
176
|
}
|
|
131
|
-
}
|
|
177
|
+
};
|
|
178
|
+
list.addEventListener("keydown", onKeyDown);
|
|
179
|
+
search.addEventListener("keydown", onKeyDown);
|
|
132
180
|
okBtn.addEventListener("click", accept);
|
|
133
181
|
cancelBtn.addEventListener("click", () => dialog.close(""));
|
|
134
182
|
okBtn.disabled = choices.length === 0;
|
|
@@ -146,6 +194,7 @@ export function pickComponent(options: {
|
|
|
146
194
|
});
|
|
147
195
|
document.body.append(dialog);
|
|
148
196
|
dialog.showModal();
|
|
149
|
-
|
|
197
|
+
// Ready to type. The arrows and Enter work from here too.
|
|
198
|
+
search.focus();
|
|
150
199
|
});
|
|
151
200
|
}
|
package/dev/font-widgets.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TimedKeyframe } from "../src/interpolate.ts";
|
|
2
2
|
import { TraditionalTextComponent } from "../src/slide-components/traditional-text.ts";
|
|
3
3
|
import {
|
|
4
4
|
_fetchLocalFonts,
|
|
@@ -153,7 +153,7 @@ export function buildTraditionalTextPanel(
|
|
|
153
153
|
* so the user can revert by clicking it. There is no explicit cancel button.
|
|
154
154
|
*/
|
|
155
155
|
export async function openFontPickerDialog(
|
|
156
|
-
strKf:
|
|
156
|
+
strKf: TimedKeyframe<string>,
|
|
157
157
|
choices: readonly string[],
|
|
158
158
|
cell: HTMLElement,
|
|
159
159
|
): Promise<void> {
|
package/dev/format-editor.ts
CHANGED
|
@@ -88,7 +88,9 @@ export class FormatEditor {
|
|
|
88
88
|
const element = this.element;
|
|
89
89
|
element.className = "format-editor";
|
|
90
90
|
element.contentEditable = "true";
|
|
91
|
-
|
|
91
|
+
// On, like the other text fields. A suggestion arrives as ordinary input
|
|
92
|
+
// (insertReplacementText), which the editor reads back like typing.
|
|
93
|
+
element.spellcheck = true;
|
|
92
94
|
element.addEventListener("beforeinput", (event) =>
|
|
93
95
|
this.#onBeforeInput(event),
|
|
94
96
|
);
|
package/dev/fourier-panel.ts
CHANGED
|
@@ -79,7 +79,7 @@ export type FourierPanel = {
|
|
|
79
79
|
|
|
80
80
|
const HELP =
|
|
81
81
|
"Term Groups says which terms each step adds. Terms are numbered by size, 0 the largest. " +
|
|
82
|
-
"Separate numbers with spaces and groups with commas; 5-9 means 5 6 7 8 9. " +
|
|
82
|
+
"Separate numbers with spaces and groups with commas; 5-9 means 5 6 7 8 9, and 8- means 8 to the last term. " +
|
|
83
83
|
"Step 1 adds the first group, step 2 the second, and so on. Terms are only ever added. " +
|
|
84
84
|
"Step: 0 is a single dot, the number of groups is the finished curve, fractions animate " +
|
|
85
85
|
"between steps, and a negative value hides it.";
|
|
@@ -115,11 +115,15 @@ export function buildFourierPanel(component: FourierComponent): FourierPanel {
|
|
|
115
115
|
for (const keyframe of keyframes) {
|
|
116
116
|
// Each Term Groups keyframe is checked against the source in effect then.
|
|
117
117
|
const prefix = keyframes.length > 1 ? `At ${keyframe.time} ms: ` : "";
|
|
118
|
-
const parsed = parseTermGroups(keyframe.value);
|
|
119
|
-
groupCounts.add(parsed.groups.length);
|
|
120
118
|
const source = component.termsFor(
|
|
121
119
|
component.sourceSchedule.at(keyframe.time),
|
|
122
120
|
);
|
|
121
|
+
// So 8- ends at this source's last term.
|
|
122
|
+
const parsed = parseTermGroups(
|
|
123
|
+
keyframe.value,
|
|
124
|
+
typeof source === "string" ? undefined : source.terms.length,
|
|
125
|
+
);
|
|
126
|
+
groupCounts.add(parsed.groups.length);
|
|
123
127
|
const termCount = parsed.groups.reduce(
|
|
124
128
|
(sum, group) => sum + group.length,
|
|
125
129
|
0,
|
package/dev/handwriting-panel.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
HandwritingUnit,
|
|
6
6
|
handwritingUnits,
|
|
7
7
|
} from "../src/slide-components/handwriting-effect.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { TimedKeyframe } from "../src/interpolate.ts";
|
|
9
9
|
import { MultiTextComponent } from "../src/slide-components/multi-text.ts";
|
|
10
10
|
import { isTextEffect } from "../src/slide-components/text-effect.ts";
|
|
11
11
|
import { Showable } from "../src/showable.ts";
|
|
@@ -237,7 +237,7 @@ let lastHoldMs = 1000;
|
|
|
237
237
|
* {@link FillIn.lastEase} says what to give the existing last keyframe.
|
|
238
238
|
*/
|
|
239
239
|
export function fillInKeyframes(
|
|
240
|
-
schedule: readonly
|
|
240
|
+
schedule: readonly TimedKeyframe<number>[],
|
|
241
241
|
count: number,
|
|
242
242
|
transitionMs: number,
|
|
243
243
|
holdMs: number,
|
|
@@ -245,7 +245,7 @@ export function fillInKeyframes(
|
|
|
245
245
|
const sorted = [...schedule].sort((a, b) => a.time - b.time);
|
|
246
246
|
const last = sorted.at(-1)!;
|
|
247
247
|
const beforeLast = sorted.at(-2);
|
|
248
|
-
let ease:
|
|
248
|
+
let ease: TimedKeyframe<number>["easeAfter"];
|
|
249
249
|
for (let i = sorted.length - 2; i >= 0; i--) {
|
|
250
250
|
if (sorted[i + 1].value > sorted[i].value) {
|
|
251
251
|
ease = sorted[i].easeAfter;
|
|
@@ -257,11 +257,11 @@ export function fillInKeyframes(
|
|
|
257
257
|
time: number,
|
|
258
258
|
value: number,
|
|
259
259
|
startsTransition: boolean,
|
|
260
|
-
):
|
|
260
|
+
): TimedKeyframe<number> =>
|
|
261
261
|
startsTransition && ease
|
|
262
262
|
? { time, value, easeAfter: ease }
|
|
263
263
|
: { time, value };
|
|
264
|
-
const added:
|
|
264
|
+
const added: TimedKeyframe<number>[] = [];
|
|
265
265
|
let time = last.time;
|
|
266
266
|
let lastEase = ease;
|
|
267
267
|
if (Number.isInteger(last.value) && beforeLast?.value !== last.value) {
|
|
@@ -281,9 +281,9 @@ export function fillInKeyframes(
|
|
|
281
281
|
|
|
282
282
|
export type FillIn = {
|
|
283
283
|
/** New keyframes, in order, all after the existing last one. */
|
|
284
|
-
readonly added: readonly
|
|
284
|
+
readonly added: readonly TimedKeyframe<number>[];
|
|
285
285
|
/** The `easeAfter` the existing last keyframe should have. */
|
|
286
|
-
readonly lastEase:
|
|
286
|
+
readonly lastEase: TimedKeyframe<number>["easeAfter"];
|
|
287
287
|
};
|
|
288
288
|
|
|
289
289
|
/**
|
package/dev/multi-text-dialog.ts
CHANGED
|
@@ -51,6 +51,32 @@ export async function openMultiTextDialog(
|
|
|
51
51
|
// Revert, and the History dialog, can then bring back exactly what's here now, animation and all.
|
|
52
52
|
await hooks.saveNow();
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Add a Text Format called `name`, after the other formats. A copy of `source`, so nothing
|
|
56
|
+
* changes on screen until the new format is edited, or else a brand new one.
|
|
57
|
+
*/
|
|
58
|
+
function addFormat(name: string, source?: TextFormatComponent): void {
|
|
59
|
+
const copy = source && hooks.copyComponent(source);
|
|
60
|
+
const format =
|
|
61
|
+
copy instanceof TextFormatComponent ? copy : new TextFormatComponent();
|
|
62
|
+
format.nameScalar.value = name;
|
|
63
|
+
// So the component list shows the name. Spans find a format by its Name, not this.
|
|
64
|
+
(format as Showable).userEditableDescription = name;
|
|
65
|
+
const children = text.replaceableComponents!.get();
|
|
66
|
+
const lastFormat = children.findLastIndex(
|
|
67
|
+
(child) => child instanceof TextFormatComponent,
|
|
68
|
+
);
|
|
69
|
+
children.splice(lastFormat + 1, 0, format);
|
|
70
|
+
text.replaceableComponents!.replace(children);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// With no formats, every menu would offer only "(empty)", which draws nothing and shows an
|
|
74
|
+
// error. Start with one, as New… would make it. It stays after Revert.
|
|
75
|
+
if (text.formatNamesInScope().length === 0) {
|
|
76
|
+
addFormat("default");
|
|
77
|
+
hooks.changed();
|
|
78
|
+
}
|
|
79
|
+
|
|
54
80
|
const originalChildren = text.replaceableComponents!.get();
|
|
55
81
|
const copyKeyframes = <T>(keyframes: readonly T[]) =>
|
|
56
82
|
keyframes.map((keyframe) => ({ ...keyframe }));
|
|
@@ -237,21 +263,8 @@ export async function openMultiTextDialog(
|
|
|
237
263
|
if (name === undefined) return undefined;
|
|
238
264
|
// A name that's already there just picks that format.
|
|
239
265
|
if (!text.formatNamesInScope().includes(name)) {
|
|
240
|
-
// A
|
|
241
|
-
|
|
242
|
-
const source = text.formatInScope(currentName);
|
|
243
|
-
const copy = source && hooks.copyComponent(source);
|
|
244
|
-
const format =
|
|
245
|
-
copy instanceof TextFormatComponent ? copy : new TextFormatComponent();
|
|
246
|
-
format.nameScalar.value = name;
|
|
247
|
-
// So the component list shows the name. Spans find a format by its Name, not this.
|
|
248
|
-
(format as Showable).userEditableDescription = name;
|
|
249
|
-
const children = text.replaceableComponents!.get();
|
|
250
|
-
const lastFormat = children.findLastIndex(
|
|
251
|
-
(child) => child instanceof TextFormatComponent,
|
|
252
|
-
);
|
|
253
|
-
children.splice(lastFormat + 1, 0, format);
|
|
254
|
-
text.replaceableComponents!.replace(children);
|
|
266
|
+
// A brand new format would draw at its own defaults: a different size and color.
|
|
267
|
+
addFormat(name, text.formatInScope(currentName));
|
|
255
268
|
revertBtn.disabled = false;
|
|
256
269
|
hooks.changed();
|
|
257
270
|
}
|
package/dev/player-body.ts
CHANGED
|
@@ -39,40 +39,13 @@ export const playerBodyHtml = `
|
|
|
39
39
|
>
|
|
40
40
|
🔓 Allow local files
|
|
41
41
|
</button>
|
|
42
|
-
<button type="button" id="loadJsonTestBtn">📂 Import</button>
|
|
43
|
-
<!-- Each status is outside its label: clicking inside a label
|
|
44
|
-
toggles the checkbox, and a status can hold buttons. -->
|
|
45
|
-
<span style="white-space: nowrap">
|
|
46
|
-
<label
|
|
47
|
-
title="Your work is always saved inside the browser (see Load). When this is checked, every one of those saves is also written to a JSON file on disk, for git and your editor. Checking it asks where."
|
|
48
|
-
><input type="checkbox" id="jsonSyncCheckbox" disabled /> Sync to
|
|
49
|
-
file:</label
|
|
50
|
-
>
|
|
51
|
-
<span id="jsonSyncStatus" style="font-size: 0.85em">…</span>
|
|
52
|
-
</span>
|
|
53
42
|
<button
|
|
54
43
|
type="button"
|
|
55
|
-
id="
|
|
56
|
-
title="
|
|
44
|
+
id="filesBtn"
|
|
45
|
+
title="Import, Save Copy As, and the files on disk that follow your work."
|
|
57
46
|
>
|
|
58
|
-
|
|
47
|
+
💾 Files
|
|
59
48
|
</button>
|
|
60
|
-
<span style="white-space: nowrap">
|
|
61
|
-
<label
|
|
62
|
-
title="The TypeScript defaults, written to a JSON file whenever they change. Compare with the synced file to see what the Visual Editor changed."
|
|
63
|
-
><input type="checkbox" id="defaultsSyncCheckbox" disabled /> Sync
|
|
64
|
-
defaults to file:</label
|
|
65
|
-
>
|
|
66
|
-
<span id="defaultsSyncStatus" style="font-size: 0.85em">…</span>
|
|
67
|
-
</span>
|
|
68
|
-
<span style="white-space: nowrap">
|
|
69
|
-
<label
|
|
70
|
-
title="A readable list of every difference from the TypeScript defaults, with code you can paste, rewritten whenever the synced file is."
|
|
71
|
-
><input type="checkbox" id="diffSyncCheckbox" disabled /> Sync diffs
|
|
72
|
-
to file:</label
|
|
73
|
-
>
|
|
74
|
-
<span id="diffSyncStatus" style="font-size: 0.85em">…</span>
|
|
75
|
-
</span>
|
|
76
49
|
<label hidden
|
|
77
50
|
><input
|
|
78
51
|
type="radio"
|
|
@@ -355,6 +328,68 @@ export const playerBodyHtml = `
|
|
|
355
328
|
</div>
|
|
356
329
|
</dialog>
|
|
357
330
|
|
|
331
|
+
<dialog id="filesDialog" style="min-width: 32em; max-width: 50em">
|
|
332
|
+
<h2 style="margin-top: 0">Files</h2>
|
|
333
|
+
<p style="margin-top: 0; font-size: 0.85em; color: #555">
|
|
334
|
+
Your work is always saved inside the browser (see Load). The files
|
|
335
|
+
checked here are copies on disk, for git, your editor and Claude,
|
|
336
|
+
rewritten whenever your work is saved. The 💾 Files button turns orange
|
|
337
|
+
while a change is waiting to be written, and red when something here
|
|
338
|
+
needs a click.
|
|
339
|
+
</p>
|
|
340
|
+
<div style="margin-bottom: 0.8em">
|
|
341
|
+
<button type="button" id="loadJsonTestBtn">📂 Import</button>
|
|
342
|
+
</div>
|
|
343
|
+
<div
|
|
344
|
+
style="display: flex; flex-direction: column; align-items: flex-start; gap: 0.5em"
|
|
345
|
+
>
|
|
346
|
+
<!-- Each status is outside its label: clicking inside a label
|
|
347
|
+
toggles the checkbox, and a status can hold buttons. -->
|
|
348
|
+
<span style="white-space: nowrap">
|
|
349
|
+
<label
|
|
350
|
+
title="Your work is always saved inside the browser (see Load). When this is checked, every one of those saves is also written to a JSON file on disk, for git and your editor. Checking it asks where."
|
|
351
|
+
><input type="checkbox" id="jsonSyncCheckbox" disabled /> Sync to
|
|
352
|
+
file:</label
|
|
353
|
+
>
|
|
354
|
+
<span id="jsonSyncStatus" style="font-size: 0.85em">…</span>
|
|
355
|
+
</span>
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
id="saveCopyAsJsonBtn"
|
|
359
|
+
title="Write the current state to a file of your choosing, once. Doesn't change which file is synced."
|
|
360
|
+
>
|
|
361
|
+
📋 Save Copy As…
|
|
362
|
+
</button>
|
|
363
|
+
<span style="white-space: nowrap">
|
|
364
|
+
<label
|
|
365
|
+
title="The TypeScript defaults, written to a JSON file whenever they change. Compare with the synced file to see what the Visual Editor changed."
|
|
366
|
+
><input type="checkbox" id="defaultsSyncCheckbox" disabled /> Sync
|
|
367
|
+
defaults to file:</label
|
|
368
|
+
>
|
|
369
|
+
<span id="defaultsSyncStatus" style="font-size: 0.85em">…</span>
|
|
370
|
+
</span>
|
|
371
|
+
<span style="white-space: nowrap">
|
|
372
|
+
<label
|
|
373
|
+
title="A readable list of every difference from the TypeScript defaults, with code you can paste, rewritten whenever the synced file is."
|
|
374
|
+
><input type="checkbox" id="diffSyncCheckbox" disabled /> Sync diffs
|
|
375
|
+
to file:</label
|
|
376
|
+
>
|
|
377
|
+
<span id="diffSyncStatus" style="font-size: 0.85em">…</span>
|
|
378
|
+
</span>
|
|
379
|
+
<span style="white-space: nowrap">
|
|
380
|
+
<label
|
|
381
|
+
title="Every transcript this video uses, word by word, rewritten whenever one changes. For a second pair of eyes, yours or Claude's, looking for words that are wrong. Fix them with ✎ on a sound clip."
|
|
382
|
+
><input type="checkbox" id="transcriptsSyncCheckbox" disabled />
|
|
383
|
+
Sync transcripts to file:</label
|
|
384
|
+
>
|
|
385
|
+
<span id="transcriptsSyncStatus" style="font-size: 0.85em">…</span>
|
|
386
|
+
</span>
|
|
387
|
+
</div>
|
|
388
|
+
<div style="margin-top: 1em">
|
|
389
|
+
<button type="button" id="filesDialogCloseBtn">Close</button>
|
|
390
|
+
</div>
|
|
391
|
+
</dialog>
|
|
392
|
+
|
|
358
393
|
<dialog id="saveDialog" style="min-width: 28em">
|
|
359
394
|
<h2 style="margin-top: 0">Save Video</h2>
|
|
360
395
|
<div style="margin-bottom: 0.6em">
|
|
@@ -457,6 +492,16 @@ export const playerBodyHtml = `
|
|
|
457
492
|
></td>
|
|
458
493
|
</tr>
|
|
459
494
|
</table>
|
|
495
|
+
<div style="margin-bottom: 0.6em">
|
|
496
|
+
<label
|
|
497
|
+
title="Put the transcripts in the file as a subtitle track, one word at a time as each is spoken, with the line before above it. Fix the words first with ✎ on a sound clip."
|
|
498
|
+
><input type="checkbox" id="saveSubtitles" checked /> Subtitles</label
|
|
499
|
+
>
|
|
500
|
+
<span
|
|
501
|
+
id="saveSubtitlesNote"
|
|
502
|
+
style="font-size: 0.85em; color: #555; margin-left: 0.5em"
|
|
503
|
+
></span>
|
|
504
|
+
</div>
|
|
460
505
|
<div
|
|
461
506
|
id="saveLocalFilesRow"
|
|
462
507
|
hidden
|
package/dev/schedule-helpers.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { ease, easeIn, easeOut } from "../src/interpolate.ts";
|
|
2
2
|
import { easeName } from "../src/snapshot.ts";
|
|
3
3
|
import { LatticeValue } from "../src/lattice.ts";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
choiceLabel,
|
|
6
|
+
propertyLabel,
|
|
7
|
+
ScalarInfo,
|
|
8
|
+
ScheduleInfo,
|
|
9
|
+
Showable,
|
|
10
|
+
} from "../src/showable.ts";
|
|
5
11
|
import { openColorPickerDialog } from "./color-picker.ts";
|
|
6
12
|
import { setSwatchColor } from "./color-utils.ts";
|
|
7
13
|
|
|
@@ -252,7 +258,7 @@ export function buildScalarSection(
|
|
|
252
258
|
const section = document.createElement("fieldset");
|
|
253
259
|
section.style.cssText = "margin-bottom:0.4em";
|
|
254
260
|
const legend = document.createElement("legend");
|
|
255
|
-
legend.textContent = info
|
|
261
|
+
legend.textContent = propertyLabel(info);
|
|
256
262
|
section.append(legend);
|
|
257
263
|
|
|
258
264
|
if (info.type === "string") {
|
|
@@ -292,7 +298,8 @@ export function buildScalarSection(
|
|
|
292
298
|
const sel = document.createElement("select");
|
|
293
299
|
for (const choice of info.choices) {
|
|
294
300
|
const opt = document.createElement("option");
|
|
295
|
-
opt.value =
|
|
301
|
+
opt.value = choice;
|
|
302
|
+
opt.textContent = choiceLabel(info, choice);
|
|
296
303
|
if (choice === info.value) opt.selected = true;
|
|
297
304
|
sel.append(opt);
|
|
298
305
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReadOnlyRect } from "phil-lib/misc";
|
|
2
|
-
import {
|
|
2
|
+
import { TimedKeyframe } from "../src/interpolate.ts";
|
|
3
3
|
import { SingleImageComponent } from "../src/slide-components/image.ts";
|
|
4
4
|
import {
|
|
5
5
|
centeredOnCanvas,
|
|
@@ -24,9 +24,9 @@ export type StaticImagePanelHooks = {
|
|
|
24
24
|
/** The URL was changed by a button here. Save, and rebuild the schedule editor so the URL field shows it. */
|
|
25
25
|
readonly urlChanged: () => void;
|
|
26
26
|
/** A Dest Rect keyframe's value was replaced. Sync its number fields and on-canvas handles, and save. */
|
|
27
|
-
readonly rectKeyframeChanged: (keyframe:
|
|
27
|
+
readonly rectKeyframeChanged: (keyframe: TimedKeyframe<ReadOnlyRect>) => void;
|
|
28
28
|
/** The Dest Rect keyframe in ✎ edit mode, if there is one. */
|
|
29
|
-
readonly editingRectKeyframe: () =>
|
|
29
|
+
readonly editingRectKeyframe: () => TimedKeyframe<ReadOnlyRect> | null;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export type StaticImagePanel = {
|
|
@@ -216,7 +216,7 @@ export function buildStaticImagePanel(
|
|
|
216
216
|
// MARK: Actions
|
|
217
217
|
|
|
218
218
|
/** Which Dest Rect keyframe a button should change, or why it can't decide. */
|
|
219
|
-
function targetKeyframe():
|
|
219
|
+
function targetKeyframe(): TimedKeyframe<ReadOnlyRect> | string {
|
|
220
220
|
const schedule = component.destRectSchedule.schedule;
|
|
221
221
|
if (schedule.length === 1) return schedule[0];
|
|
222
222
|
const editing = hooks.editingRectKeyframe();
|