canvas-recorder-lib 0.7.1 → 0.7.3

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.
Files changed (180) hide show
  1. package/README.md +51 -8
  2. package/dev/audio-builder.ts +5 -1
  3. package/dev/canvas-recorder.css +15 -4
  4. package/dev/canvas-recorder.ts +518 -131
  5. package/dev/delay-files.ts +1 -1
  6. package/dev/format-editor.ts +7 -2
  7. package/dev/fourier-panel.ts +11 -3
  8. package/dev/handwriting-panel.ts +14 -9
  9. package/dev/local-file-row.ts +12 -5
  10. package/dev/multi-text-dialog.ts +15 -6
  11. package/dev/multi-text-panel.ts +6 -2
  12. package/dev/player-body.ts +4 -0
  13. package/dev/schedule-helpers.ts +11 -4
  14. package/dev/sound-clips.ts +4 -1
  15. package/dev/soundtrack.ts +42 -11
  16. package/dev/split-dialog.ts +49 -19
  17. package/dev/static-image-panel.ts +17 -5
  18. package/dev/synced-file.ts +4 -5
  19. package/dev/timeline-display.ts +152 -50
  20. package/dev/transcribe-core.ts +48 -17
  21. package/dev/transcribe-worker.ts +20 -9
  22. package/dev/transcript-align.ts +95 -20
  23. package/dev/transcript-export.ts +18 -7
  24. package/dev/transcript-view.ts +78 -22
  25. package/dev/transcripts.ts +43 -23
  26. package/dev/video-clip-panel.ts +64 -18
  27. package/dev/voice/chirp.ts +21 -5
  28. package/dev/voice/folder.ts +22 -7
  29. package/dev/voice/voice-panel.ts +34 -10
  30. package/dev/voice/voice-recorder.ts +74 -18
  31. package/dist/dev/audio-builder.js.map +1 -1
  32. package/dist/dev/canvas-recorder.css +15 -4
  33. package/dist/dev/canvas-recorder.js +375 -85
  34. package/dist/dev/canvas-recorder.js.map +1 -1
  35. package/dist/dev/format-editor.d.ts.map +1 -1
  36. package/dist/dev/format-editor.js.map +1 -1
  37. package/dist/dev/fourier-panel.d.ts.map +1 -1
  38. package/dist/dev/fourier-panel.js.map +1 -1
  39. package/dist/dev/handwriting-panel.d.ts.map +1 -1
  40. package/dist/dev/handwriting-panel.js +10 -8
  41. package/dist/dev/handwriting-panel.js.map +1 -1
  42. package/dist/dev/local-file-row.d.ts.map +1 -1
  43. package/dist/dev/local-file-row.js +12 -4
  44. package/dist/dev/local-file-row.js.map +1 -1
  45. package/dist/dev/multi-text-dialog.d.ts.map +1 -1
  46. package/dist/dev/multi-text-dialog.js +4 -2
  47. package/dist/dev/multi-text-dialog.js.map +1 -1
  48. package/dist/dev/multi-text-panel.d.ts.map +1 -1
  49. package/dist/dev/multi-text-panel.js +2 -1
  50. package/dist/dev/multi-text-panel.js.map +1 -1
  51. package/dist/dev/player-body.d.ts +1 -1
  52. package/dist/dev/player-body.d.ts.map +1 -1
  53. package/dist/dev/player-body.js +4 -0
  54. package/dist/dev/player-body.js.map +1 -1
  55. package/dist/dev/schedule-helpers.d.ts.map +1 -1
  56. package/dist/dev/schedule-helpers.js +4 -1
  57. package/dist/dev/schedule-helpers.js.map +1 -1
  58. package/dist/dev/sound-clips.d.ts.map +1 -1
  59. package/dist/dev/sound-clips.js.map +1 -1
  60. package/dist/dev/soundtrack.d.ts +12 -0
  61. package/dist/dev/soundtrack.d.ts.map +1 -1
  62. package/dist/dev/soundtrack.js +33 -7
  63. package/dist/dev/soundtrack.js.map +1 -1
  64. package/dist/dev/split-dialog.d.ts.map +1 -1
  65. package/dist/dev/split-dialog.js +17 -10
  66. package/dist/dev/split-dialog.js.map +1 -1
  67. package/dist/dev/static-image-panel.d.ts.map +1 -1
  68. package/dist/dev/static-image-panel.js +7 -3
  69. package/dist/dev/static-image-panel.js.map +1 -1
  70. package/dist/dev/synced-file.d.ts.map +1 -1
  71. package/dist/dev/synced-file.js.map +1 -1
  72. package/dist/dev/timeline-display.d.ts.map +1 -1
  73. package/dist/dev/timeline-display.js +62 -17
  74. package/dist/dev/timeline-display.js.map +1 -1
  75. package/dist/dev/transcribe-core.d.ts.map +1 -1
  76. package/dist/dev/transcribe-core.js +13 -3
  77. package/dist/dev/transcribe-core.js.map +1 -1
  78. package/dist/dev/transcribe-worker.d.ts.map +1 -1
  79. package/dist/dev/transcribe-worker.js +9 -3
  80. package/dist/dev/transcribe-worker.js.map +1 -1
  81. package/dist/dev/transcript-align.d.ts.map +1 -1
  82. package/dist/dev/transcript-align.js +52 -9
  83. package/dist/dev/transcript-align.js.map +1 -1
  84. package/dist/dev/transcript-export.d.ts.map +1 -1
  85. package/dist/dev/transcript-export.js +10 -4
  86. package/dist/dev/transcript-export.js.map +1 -1
  87. package/dist/dev/transcript-view.d.ts +2 -0
  88. package/dist/dev/transcript-view.d.ts.map +1 -1
  89. package/dist/dev/transcript-view.js +32 -11
  90. package/dist/dev/transcript-view.js.map +1 -1
  91. package/dist/dev/transcripts.d.ts.map +1 -1
  92. package/dist/dev/transcripts.js +5 -3
  93. package/dist/dev/transcripts.js.map +1 -1
  94. package/dist/dev/video-clip-panel.d.ts.map +1 -1
  95. package/dist/dev/video-clip-panel.js +25 -8
  96. package/dist/dev/video-clip-panel.js.map +1 -1
  97. package/dist/dev/voice/chirp.d.ts.map +1 -1
  98. package/dist/dev/voice/chirp.js +5 -1
  99. package/dist/dev/voice/chirp.js.map +1 -1
  100. package/dist/dev/voice/folder.d.ts.map +1 -1
  101. package/dist/dev/voice/folder.js +1 -1
  102. package/dist/dev/voice/folder.js.map +1 -1
  103. package/dist/dev/voice/voice-panel.d.ts.map +1 -1
  104. package/dist/dev/voice/voice-panel.js +15 -6
  105. package/dist/dev/voice/voice-panel.js.map +1 -1
  106. package/dist/dev/voice/voice-recorder.d.ts.map +1 -1
  107. package/dist/dev/voice/voice-recorder.js +34 -9
  108. package/dist/dev/voice/voice-recorder.js.map +1 -1
  109. package/dist/lib/main-control.d.ts +35 -1
  110. package/dist/lib/main-control.d.ts.map +1 -1
  111. package/dist/lib/main-control.js +76 -0
  112. package/dist/lib/main-control.js.map +1 -1
  113. package/dist/src/corner-rounder.d.ts.map +1 -1
  114. package/dist/src/corner-rounder.js +1 -1
  115. package/dist/src/corner-rounder.js.map +1 -1
  116. package/dist/src/local-files.d.ts.map +1 -1
  117. package/dist/src/local-files.js +5 -2
  118. package/dist/src/local-files.js.map +1 -1
  119. package/dist/src/peano-fourier/fourier-shared.d.ts +7 -0
  120. package/dist/src/peano-fourier/fourier-shared.d.ts.map +1 -1
  121. package/dist/src/peano-fourier/fourier-shared.js +8 -1
  122. package/dist/src/peano-fourier/fourier-shared.js.map +1 -1
  123. package/dist/src/showable.d.ts +74 -0
  124. package/dist/src/showable.d.ts.map +1 -1
  125. package/dist/src/showable.js.map +1 -1
  126. package/dist/src/slide-components/fourier.d.ts.map +1 -1
  127. package/dist/src/slide-components/fourier.js +12 -4
  128. package/dist/src/slide-components/fourier.js.map +1 -1
  129. package/dist/src/slide-components/image.d.ts.map +1 -1
  130. package/dist/src/slide-components/image.js +1 -1
  131. package/dist/src/slide-components/image.js.map +1 -1
  132. package/dist/src/slide-components/in-parallel.d.ts.map +1 -1
  133. package/dist/src/slide-components/in-parallel.js.map +1 -1
  134. package/dist/src/slide-components/multi-text.d.ts.map +1 -1
  135. package/dist/src/slide-components/multi-text.js +1 -1
  136. package/dist/src/slide-components/multi-text.js.map +1 -1
  137. package/dist/src/slide-components/rectangle.d.ts.map +1 -1
  138. package/dist/src/slide-components/rectangle.js +1 -1
  139. package/dist/src/slide-components/rectangle.js.map +1 -1
  140. package/dist/src/slide-components/registry.js.map +1 -1
  141. package/dist/src/slide-components/serialize.d.ts.map +1 -1
  142. package/dist/src/slide-components/serialize.js +2 -1
  143. package/dist/src/slide-components/serialize.js.map +1 -1
  144. package/dist/src/slide-components/split-video-clip.d.ts.map +1 -1
  145. package/dist/src/slide-components/split-video-clip.js +4 -1
  146. package/dist/src/slide-components/split-video-clip.js.map +1 -1
  147. package/dist/src/slide-components/video-clip.d.ts.map +1 -1
  148. package/dist/src/slide-components/video-clip.js +7 -4
  149. package/dist/src/slide-components/video-clip.js.map +1 -1
  150. package/dist/src/slide-components/video-info.d.ts.map +1 -1
  151. package/dist/src/slide-components/video-info.js.map +1 -1
  152. package/dist/src/slow-image-sources.d.ts.map +1 -1
  153. package/dist/src/slow-image-sources.js +1 -1
  154. package/dist/src/slow-image-sources.js.map +1 -1
  155. package/dist/src/snapshot.d.ts.map +1 -1
  156. package/dist/src/snapshot.js +1 -1
  157. package/dist/src/snapshot.js.map +1 -1
  158. package/dist/src/utility.d.ts.map +1 -1
  159. package/dist/src/utility.js +1 -3
  160. package/dist/src/utility.js.map +1 -1
  161. package/lib/main-control.ts +95 -2
  162. package/package.json +4 -1
  163. package/src/corner-rounder.ts +5 -12
  164. package/src/glib/letters-base.ts +1 -1
  165. package/src/local-files.ts +19 -6
  166. package/src/peano-fourier/fourier-shared.ts +8 -1
  167. package/src/showable.ts +79 -0
  168. package/src/slide-components/fourier.ts +32 -10
  169. package/src/slide-components/image.ts +4 -1
  170. package/src/slide-components/in-parallel.ts +1 -2
  171. package/src/slide-components/multi-text.ts +17 -4
  172. package/src/slide-components/rectangle.ts +4 -1
  173. package/src/slide-components/registry.ts +1 -1
  174. package/src/slide-components/serialize.ts +4 -1
  175. package/src/slide-components/split-video-clip.ts +4 -1
  176. package/src/slide-components/video-clip.ts +21 -8
  177. package/src/slide-components/video-info.ts +4 -1
  178. package/src/slow-image-sources.ts +5 -1
  179. package/src/snapshot.ts +13 -4
  180. package/src/utility.ts +70 -33
package/README.md CHANGED
@@ -65,6 +65,38 @@ This refers to simple-video-editor and showcase found in this repository.
65
65
  Note: [Riemann](https://github.com/TradeIdeasPhilip/riemann-surfaces-3d) provides a different type of example.
66
66
  This shows how to attach this library to a project that was not specifically developed for this library.
67
67
 
68
+ ## Quick Instructions for Publishing
69
+
70
+ Start with everything committed.
71
+
72
+ 1. **Check.** `npm run check` looks for Prettier formatting (without changing anything), checks the imports, and type-checks.
73
+ If Prettier complains: `npm run format`, test again, and commit.
74
+ 2. **Breaking changes?** If [BREAKING-CHANGES.md](BREAKING-CHANGES.md) has an "Unreleased" section, change that heading to the new version and today's date, and commit.
75
+ 3. **Bump the version.** This makes a commit and a tag.
76
+
77
+ | Command | When | Example |
78
+ | ------------------- | --------------------------------------------------------------------- | ------------- |
79
+ | `npm version patch` | Nothing breaking | 0.7.1 → 0.7.2 |
80
+ | `npm version minor` | BREAKING-CHANGES.md has an "Unreleased" section | 0.7.1 → 0.8.0 |
81
+ | `npm version major` | Going to 1.0 (see [release-1.0.md](development-plans/release-1.0.md)) | 0.7.1 → 1.0.0 |
82
+
83
+ 4. `git push --follow-tags`. Pushing also publishes the API docs and the showcase.
84
+ 5. `npm whoami` says whether you're logged in. If not, `npm login`, which opens a browser. Logins time out eventually.
85
+ 6. `npm publish`. It opens a browser to confirm, even right after `npm login`.
86
+ It empties and rebuilds `dist/` first, so restart `npm run dev` in `test-project/` or `simple-video-editor/` if it's running. `npm run watch` can keep running.
87
+
88
+ The new version can take a few minutes to appear. Check the library's [npm page](https://www.npmjs.com/package/canvas-recorder-lib) before installing it.
89
+
90
+ Then, in each project that uses the library:
91
+
92
+ ```bash
93
+ npm install canvas-recorder-lib@0.7.2 # the new version
94
+ npx tsc --noEmit # a breaking change shows up here
95
+ git commit -m "canvas-recorder-lib 0.7.2" package.json package-lock.json
96
+ ```
97
+
98
+ Restart that project's `npm run dev`: Vite only notices a new version of a dependency when it starts.
99
+
68
100
  ## Notes for a project that uses this library
69
101
 
70
102
  Things the first project to use this library ([riemann-surfaces-3d](https://github.com/TradeIdeasPhilip/riemann-surfaces-3d)) ran into.
@@ -190,6 +222,19 @@ For a new project, take the next number and add it here.
190
222
  When the editor loads saved changes, it rebuilds those children from the registry, so a `description` from your constructor comes back as the registry's default.
191
223
  `userEditableDescription` is saved with the rest, and the diff file uses it to match each child with its TypeScript.
192
224
 
225
+ ### Your own panels in the Visual Editor
226
+
227
+ A panel is your own HTML, shown with a component's properties, bottom right, whenever that component is selected.
228
+ It can read the playhead in the component's own time, move it, and change the component's properties.
229
+ See `EditorPanel` in `src/showable.ts`, and the showcase's "Editor Panels" slide (`test-project/src/showcase/editor-panel.ts`).
230
+
231
+ - **On your own component:** give it an `editorPanel`.
232
+ - **On any component, including the library's:** `canvasRecorder.addEditorPanel((component) => …)` returns a panel for the components you choose, and `undefined` for the rest.
233
+ The showcase gives every Fourier a list of its terms this way.
234
+ - **After changing a property, call `propertyChanged()`.** That saves it, like any other edit, and rebuilds the tables.
235
+ - **Anything worth keeping goes in a property.** The panel object lasts as long as its component, but not across a reload.
236
+ - **Touch the DOM only in `start()` and later,** never while a module loads.
237
+
193
238
  ### Recording a program that has its own state
194
239
 
195
240
  Most of canvas-recorder's components draw any time you ask, in any order.
@@ -223,8 +268,13 @@ npm install
223
268
  npm run build # or: npm run watch
224
269
  npm run clean # empty dist/
225
270
  npm run docs # API docs, in docs/
271
+ npm run format # Prettier
272
+ npm run check # Prettier, imports and types, without changing anything
226
273
  ```
227
274
 
275
+ VS Code formats TypeScript, JavaScript, CSS and JSON on save, with the Prettier in `devDependencies` (see `.vscode/settings.json`).
276
+ Markdown and HTML are left alone: `.prettierignore` says why.
277
+
228
278
  Output goes to `dist/`: `.js`, `.d.ts`, source maps, plus the CSS and JSON files the JavaScript imports.
229
279
 
230
280
  Every relative import names its file, like `from "./utility.ts"`, and `npm run build` stops if one doesn't.
@@ -237,11 +287,4 @@ A project that has linked this library (see [Working on the library at the same
237
287
 
238
288
  The Simple Video Editor is a separate npm project inside this repo. [simple-video-editor/README.md](simple-video-editor/README.md) says how to run it.
239
289
 
240
- ## Releasing
241
-
242
- 1. Bump the version. If [BREAKING-CHANGES.md](BREAKING-CHANGES.md) has an "Unreleased" section: `npm version minor --no-git-tag-version`, and replace "Unreleased" with the new version and the date.
243
- Otherwise: `npm version patch --no-git-tag-version`. Commit and push.
244
- 2. `npm publish`. `prepublishOnly` empties and rebuilds `dist/` first, so nothing stale is published.
245
- 3. In each project: `npm install canvas-recorder-lib@<version>`, `npx tsc --noEmit`, and commit `package.json` and `package-lock.json`.
246
-
247
- The API docs publish themselves on every push to master.
290
+ To publish a new version, see [Quick Instructions for Publishing](#quick-instructions-for-publishing).
@@ -170,7 +170,11 @@ function audioBufferToWav(buffer: AudioBuffer): ArrayBuffer {
170
170
  const channel = buffer.getChannelData(ch);
171
171
  for (let i = 0; i < buffer.length; i++) {
172
172
  const sample = Math.max(-1, Math.min(1, channel[i]));
173
- view.setInt16(offset, sample < 0 ? sample * 0x8000 : sample * 0x7fff, true);
173
+ view.setInt16(
174
+ offset,
175
+ sample < 0 ? sample * 0x8000 : sample * 0x7fff,
176
+ true,
177
+ );
174
178
  offset += 2;
175
179
  }
176
180
  }
@@ -22,8 +22,12 @@ body {
22
22
  height: 100%;
23
23
  }
24
24
 
25
- #left-col { flex: 0 0 50%; }
26
- #right-col { flex: 1; }
25
+ #left-col {
26
+ flex: 0 0 50%;
27
+ }
28
+ #right-col {
29
+ flex: 1;
30
+ }
27
31
 
28
32
  /* ── Vertical resize handle between left/right columns ──────────────── */
29
33
 
@@ -139,7 +143,7 @@ body {
139
143
  display: block;
140
144
  width: 100%;
141
145
  min-height: 28px;
142
- max-height: 168px; /* cap at 6 rows × 28 px */
146
+ max-height: 168px; /* cap at 6 rows × 28 px */
143
147
  cursor: crosshair;
144
148
  border-bottom: 1px solid #bbb;
145
149
  box-sizing: border-box;
@@ -208,6 +212,9 @@ body {
208
212
  font-style: italic;
209
213
  color: #777;
210
214
  }
215
+ #transcriptView .tv-problem {
216
+ color: #b00020;
217
+ }
211
218
  #transcriptView .tv-word {
212
219
  cursor: pointer;
213
220
  border-radius: 2px;
@@ -337,6 +344,11 @@ body {
337
344
  flex-grow: 1;
338
345
  }
339
346
 
347
+ /* About 60% of the default width, to make room for "local". */
348
+ #playPositionSeconds {
349
+ width: 6.5em;
350
+ }
351
+
340
352
  /* ── History dialog ──────────────────────────────────────────────────── */
341
353
 
342
354
  #historyList li.selected {
@@ -359,7 +371,6 @@ body {
359
371
  outline-offset: -2px;
360
372
  }
361
373
 
362
-
363
374
  /* ── Component picker dialog ─────────────────────────────────────────── */
364
375
 
365
376
  .component-picker li.selected {