@braccato/core 1.22.0 → 2.0.0-beta.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.
Files changed (102) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +202 -607
  3. package/js/element.js +234 -0
  4. package/js/renderer.d.ts +157 -0
  5. package/js/renderer.js +535 -0
  6. package/package.json +22 -17
  7. package/pkg/braccato_core_rs.d.ts +236 -0
  8. package/pkg/braccato_core_rs.js +1735 -0
  9. package/pkg/braccato_core_rs_bg.wasm +0 -0
  10. package/pkg/braccato_core_rs_bg.wasm.d.ts +55 -0
  11. package/dist/LICENSE +0 -21
  12. package/dist/README.md +0 -639
  13. package/dist/element.d.ts +0 -168
  14. package/dist/element.js +0 -730
  15. package/dist/engine/animationConfig.d.ts +0 -84
  16. package/dist/engine/animationConfig.js +0 -95
  17. package/dist/engine/animationDrift.d.ts +0 -11
  18. package/dist/engine/animationDrift.js +0 -43
  19. package/dist/engine/animationTiming.d.ts +0 -27
  20. package/dist/engine/animationTiming.js +0 -145
  21. package/dist/engine/autoScroll.d.ts +0 -24
  22. package/dist/engine/autoScroll.js +0 -103
  23. package/dist/engine/clock.d.ts +0 -29
  24. package/dist/engine/clock.js +0 -70
  25. package/dist/engine/contextSweep.d.ts +0 -10
  26. package/dist/engine/contextSweep.js +0 -102
  27. package/dist/engine/cssValues.d.ts +0 -13
  28. package/dist/engine/cssValues.js +0 -47
  29. package/dist/engine/culling.d.ts +0 -6
  30. package/dist/engine/culling.js +0 -76
  31. package/dist/engine/debugOverlay.d.ts +0 -14
  32. package/dist/engine/debugOverlay.js +0 -58
  33. package/dist/engine/decorationSlides.d.ts +0 -6
  34. package/dist/engine/decorationSlides.js +0 -53
  35. package/dist/engine/elementMotion.d.ts +0 -18
  36. package/dist/engine/elementMotion.js +0 -98
  37. package/dist/engine/glow.d.ts +0 -7
  38. package/dist/engine/glow.js +0 -59
  39. package/dist/engine/instance.d.ts +0 -105
  40. package/dist/engine/instance.js +0 -89
  41. package/dist/engine/instrumentalAnimations.d.ts +0 -7
  42. package/dist/engine/instrumentalAnimations.js +0 -59
  43. package/dist/engine/letterPlans.d.ts +0 -31
  44. package/dist/engine/letterPlans.js +0 -62
  45. package/dist/engine/lineAnimationState.d.ts +0 -10
  46. package/dist/engine/lineAnimationState.js +0 -82
  47. package/dist/engine/lineAnimations.d.ts +0 -5
  48. package/dist/engine/lineAnimations.js +0 -63
  49. package/dist/engine/lineLifecycle.d.ts +0 -12
  50. package/dist/engine/lineLifecycle.js +0 -92
  51. package/dist/engine/lineScroll.d.ts +0 -47
  52. package/dist/engine/lineScroll.js +0 -184
  53. package/dist/engine/lineScrollStyle.d.ts +0 -32
  54. package/dist/engine/lineScrollStyle.js +0 -133
  55. package/dist/engine/liveViews.d.ts +0 -3
  56. package/dist/engine/liveViews.js +0 -5
  57. package/dist/engine/motionCurves.d.ts +0 -19
  58. package/dist/engine/motionCurves.js +0 -85
  59. package/dist/engine/motionPreference.d.ts +0 -1
  60. package/dist/engine/motionPreference.js +0 -1
  61. package/dist/engine/passiveScroll.d.ts +0 -10
  62. package/dist/engine/passiveScroll.js +0 -93
  63. package/dist/engine/renderedLines.d.ts +0 -16
  64. package/dist/engine/renderedLines.js +0 -130
  65. package/dist/engine/scrollViewport.d.ts +0 -36
  66. package/dist/engine/scrollViewport.js +0 -104
  67. package/dist/engine/stageMotion.d.ts +0 -7
  68. package/dist/engine/stageMotion.js +0 -319
  69. package/dist/engine/sweepPlans.d.ts +0 -38
  70. package/dist/engine/sweepPlans.js +0 -66
  71. package/dist/engine/tick.d.ts +0 -16
  72. package/dist/engine/tick.js +0 -270
  73. package/dist/engine/timingLogs.d.ts +0 -7
  74. package/dist/engine/timingLogs.js +0 -81
  75. package/dist/engine/userScroll.d.ts +0 -12
  76. package/dist/engine/userScroll.js +0 -62
  77. package/dist/engine/wavePool.d.ts +0 -7
  78. package/dist/engine/wavePool.js +0 -22
  79. package/dist/engine/wordAnimations.d.ts +0 -5
  80. package/dist/engine/wordAnimations.js +0 -206
  81. package/dist/imageHighlights.d.ts +0 -4
  82. package/dist/imageHighlights.js +0 -34
  83. package/dist/index.d.ts +0 -17
  84. package/dist/index.js +0 -12
  85. package/dist/inject.d.ts +0 -98
  86. package/dist/inject.js +0 -591
  87. package/dist/instrumental.d.ts +0 -11
  88. package/dist/instrumental.js +0 -121
  89. package/dist/language.d.ts +0 -9
  90. package/dist/language.js +0 -47
  91. package/dist/letters.d.ts +0 -2
  92. package/dist/letters.js +0 -25
  93. package/dist/renderer.d.ts +0 -29
  94. package/dist/renderer.js +0 -412
  95. package/dist/seek.d.ts +0 -1
  96. package/dist/seek.js +0 -27
  97. package/dist/stage.d.ts +0 -58
  98. package/dist/stage.js +0 -121
  99. package/dist/types.d.ts +0 -236
  100. package/dist/types.js +0 -1
  101. package/dist/view.d.ts +0 -51
  102. package/dist/view.js +0 -398
@@ -0,0 +1,236 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class Renderer {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ /**
8
+ * Takes the lines off the screen and keeps the container. Returns whether there were any.
9
+ */
10
+ clearOnScreen(): boolean;
11
+ /**
12
+ * Drops the song and takes the container out of the page; `setLyrics` puts both back.
13
+ */
14
+ clear(): void;
15
+ /**
16
+ * Detaches everything. The renderer is unusable afterwards.
17
+ */
18
+ destroy(): void;
19
+ /**
20
+ * Sends any events waiting on the next frame now.
21
+ */
22
+ flushEvents(): void;
23
+ /**
24
+ * Hangs a romanization on line `index`, swept by `timed` (a `LyricPart[]`) if given, or takes
25
+ * it off with `null`. Returns whether the line had one before.
26
+ */
27
+ hangRomanization(index: number, text: string | null | undefined, timed: any): boolean;
28
+ /**
29
+ * Hangs a translation on line `index`, or takes it off with `null`. Returns whether the line
30
+ * had one before.
31
+ */
32
+ hangTranslation(index: number, text?: string | null, language?: string | null): boolean;
33
+ hasSong(): boolean;
34
+ /**
35
+ * `[{ element, parts: HTMLElement[] }]`, one per line, in order.
36
+ */
37
+ lineElements(): Array<any>;
38
+ /**
39
+ * The index of the line `element` is, or -1.
40
+ */
41
+ lineIndex(element: Element): number;
42
+ /**
43
+ * Builds the view inside `host`.
44
+ */
45
+ constructor(host: HTMLElement);
46
+ /**
47
+ * The host saw the reader scroll. Scrolls the renderer made itself are told apart and ignored.
48
+ */
49
+ noteScroll(): void;
50
+ /**
51
+ * Measures the lines again on the next frame. With `settle`, lines the new measurement moves
52
+ * slide there, and the line in view holds still.
53
+ */
54
+ relayout(settle?: boolean | null): void;
55
+ resetClock(): void;
56
+ resumeAutoscroll(): void;
57
+ /**
58
+ * Which decorations to show from the lyrics' own fields.
59
+ */
60
+ setDecorations(translations: boolean, romanizations: boolean): void;
61
+ /**
62
+ * Whether the host has the view off the screen. A hidden view draws nothing until shown.
63
+ */
64
+ setHidden(hidden: boolean): void;
65
+ /**
66
+ * Moves the view into another element of the same document.
67
+ */
68
+ setHost(host: HTMLElement): void;
69
+ setLanguage(language?: string | null): void;
70
+ /**
71
+ * `"stage"` shows only the lines being sung, at the bottom of the element; anything else scrolls.
72
+ */
73
+ setLayout(layout: string): void;
74
+ /**
75
+ * The song. `lyrics` is a `Lyric[]`, `options` a `{ noLyrics?, language?, songwriters? }`.
76
+ */
77
+ setLyrics(lyrics: any, options: any): void;
78
+ /**
79
+ * Binds a media element as the clock, or unbinds with `null`.
80
+ */
81
+ setMedia(media?: HTMLMediaElement | null): void;
82
+ /**
83
+ * Starts or stops profiling: GPU time, and each frame's CPU time by phase for `takeProfile()`.
84
+ * Returns whether the browser can time the GPU.
85
+ */
86
+ setProfiling(on: boolean): boolean;
87
+ /**
88
+ * Whether the view watches its scroll element for a reader scrolling (the default), or leaves
89
+ * it to the host to report scrolls through `noteScroll`.
90
+ */
91
+ setScrollDetection(own: boolean): void;
92
+ /**
93
+ * The element autoscroll moves. `null` finds the nearest scrolling ancestor.
94
+ */
95
+ setScrollElement(element?: Element | null): void;
96
+ /**
97
+ * A player snapshot: the time it showed, whether it was playing, and when it was read, as
98
+ * `Date.now()` (negative when it was not read off a player).
99
+ */
100
+ setSnapshot(seconds: number, playing: boolean, event_ms: number): void;
101
+ /**
102
+ * Moves line `index`'s start, or with `part` one of its parts', to `start` seconds.
103
+ */
104
+ setStart(index: number, part: number | null | undefined, start: number): void;
105
+ /**
106
+ * A theme stylesheet: `--blyrics-*` custom properties, and `blyrics-key = value;` settings in its comments.
107
+ */
108
+ setTheme(css: string): void;
109
+ /**
110
+ * `{ lyricOffset?, globalLyricOffset?, playbackRate?, smoothScroll?, passiveScrollEnabled? }`,
111
+ * offsets in seconds.
112
+ */
113
+ setTickOptions(options: any): void;
114
+ /**
115
+ * Drives the clock by hand, when no media element is bound.
116
+ */
117
+ setTime(seconds: number, playing: boolean): void;
118
+ /**
119
+ * A copy of what the view shows now, on a 2D canvas the same size, styled like the view's: for
120
+ * a host that clones the page to animate it away, where a WebGL canvas clones blank. The frame
121
+ * is drawn and copied in one go, while the drawing buffer still holds it.
122
+ */
123
+ snapshot(): HTMLCanvasElement | undefined;
124
+ /**
125
+ * `{ frames, cpuMs, maxCpuMs, gpuMs, quads, residentLines, textureBytes }`: averages over recent frames, and
126
+ * the slowest frame since the last call.
127
+ */
128
+ stats(): any;
129
+ /**
130
+ * `"richsync"`, `"synced"` or `"none"`, and `"none"` with no song.
131
+ */
132
+ syncType(): string;
133
+ /**
134
+ * The frames profiled since profiling started or this was last called, which it forgets:
135
+ * `{ fields, frames, gpu }`. `frames` holds one row of `fields.length` milliseconds per frame,
136
+ * the frame's total and then its phases. `gpu` holds the GPU milliseconds of the frames timed so
137
+ * far, which lag a few frames behind and are empty where the browser cannot time the GPU.
138
+ */
139
+ takeProfile(): any;
140
+ /**
141
+ * `[start, duration]` in seconds of line `index`, or with `part` one of its parts.
142
+ */
143
+ timing(index: number, part?: number | null): Float32Array | undefined;
144
+ /**
145
+ * The canvas the view draws on.
146
+ */
147
+ readonly canvas: HTMLCanvasElement;
148
+ /**
149
+ * The container the lines are built in, which the host may add its own things to.
150
+ */
151
+ readonly container: HTMLElement;
152
+ /**
153
+ * Changes whenever the line elements do.
154
+ */
155
+ readonly generation: number;
156
+ }
157
+
158
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
159
+
160
+ export interface InitOutput {
161
+ readonly memory: WebAssembly.Memory;
162
+ readonly __wbg_renderer_free: (a: number, b: number) => void;
163
+ readonly renderer_canvas: (a: number) => any;
164
+ readonly renderer_clear: (a: number) => void;
165
+ readonly renderer_clearOnScreen: (a: number) => number;
166
+ readonly renderer_container: (a: number) => any;
167
+ readonly renderer_destroy: (a: number) => void;
168
+ readonly renderer_flushEvents: (a: number) => void;
169
+ readonly renderer_generation: (a: number) => number;
170
+ readonly renderer_hangRomanization: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
171
+ readonly renderer_hangTranslation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
172
+ readonly renderer_hasSong: (a: number) => number;
173
+ readonly renderer_lineElements: (a: number) => any;
174
+ readonly renderer_lineIndex: (a: number, b: any) => number;
175
+ readonly renderer_new: (a: any) => [number, number, number];
176
+ readonly renderer_noteScroll: (a: number) => void;
177
+ readonly renderer_relayout: (a: number, b: number) => void;
178
+ readonly renderer_resetClock: (a: number) => void;
179
+ readonly renderer_resumeAutoscroll: (a: number) => void;
180
+ readonly renderer_setDecorations: (a: number, b: number, c: number) => void;
181
+ readonly renderer_setHidden: (a: number, b: number) => void;
182
+ readonly renderer_setHost: (a: number, b: any) => void;
183
+ readonly renderer_setLanguage: (a: number, b: number, c: number) => void;
184
+ readonly renderer_setLayout: (a: number, b: number, c: number) => void;
185
+ readonly renderer_setLyrics: (a: number, b: any, c: any) => [number, number];
186
+ readonly renderer_setMedia: (a: number, b: number) => void;
187
+ readonly renderer_setProfiling: (a: number, b: number) => number;
188
+ readonly renderer_setScrollDetection: (a: number, b: number) => void;
189
+ readonly renderer_setScrollElement: (a: number, b: number) => void;
190
+ readonly renderer_setSnapshot: (a: number, b: number, c: number, d: number) => void;
191
+ readonly renderer_setStart: (a: number, b: number, c: number, d: number) => void;
192
+ readonly renderer_setTheme: (a: number, b: number, c: number) => void;
193
+ readonly renderer_setTickOptions: (a: number, b: any) => void;
194
+ readonly renderer_setTime: (a: number, b: number, c: number) => void;
195
+ readonly renderer_snapshot: (a: number) => any;
196
+ readonly renderer_stats: (a: number) => any;
197
+ readonly renderer_syncType: (a: number) => [number, number];
198
+ readonly renderer_takeProfile: (a: number) => any;
199
+ readonly renderer_timing: (a: number, b: number, c: number) => [number, number];
200
+ readonly wasm_bindgen_662efdbedeaa8f26___convert__closures_____invoke___f64______true_: (a: number, b: number, c: number) => void;
201
+ readonly wasm_bindgen_662efdbedeaa8f26___convert__closures_____invoke___wasm_bindgen_662efdbedeaa8f26___JsValue______true_: (a: number, b: number, c: any) => void;
202
+ readonly wasm_bindgen_662efdbedeaa8f26___convert__closures_____invoke___wasm_bindgen_662efdbedeaa8f26___JsValue______true__39: (a: number, b: number, c: any) => void;
203
+ readonly wasm_bindgen_662efdbedeaa8f26___convert__closures_____invoke___wasm_bindgen_662efdbedeaa8f26___JsValue______true__40: (a: number, b: number, c: any) => void;
204
+ readonly wasm_bindgen_662efdbedeaa8f26___convert__closures_____invoke_______true_: (a: number, b: number) => void;
205
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
206
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
207
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
208
+ readonly __wbindgen_exn_store: (a: number) => void;
209
+ readonly __externref_table_alloc: () => number;
210
+ readonly __wbindgen_externrefs: WebAssembly.Table;
211
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
212
+ readonly __externref_table_dealloc: (a: number) => void;
213
+ readonly __wbindgen_start: () => void;
214
+ }
215
+
216
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
217
+
218
+ /**
219
+ * Instantiates the given `module`, which can either be bytes or
220
+ * a precompiled `WebAssembly.Module`.
221
+ *
222
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
223
+ *
224
+ * @returns {InitOutput}
225
+ */
226
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
227
+
228
+ /**
229
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
230
+ * for everything else, calls `WebAssembly.instantiate` directly.
231
+ *
232
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
233
+ *
234
+ * @returns {Promise<InitOutput>}
235
+ */
236
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;