@braccato/core 1.21.6 → 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.
- package/LICENSE +1 -1
- package/README.md +202 -600
- package/dist/styles/lyrics.css +6 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +4 -0
- package/js/element.js +234 -0
- package/js/renderer.d.ts +157 -0
- package/js/renderer.js +535 -0
- package/package.json +22 -17
- package/pkg/braccato_core_rs.d.ts +236 -0
- package/pkg/braccato_core_rs.js +1735 -0
- package/pkg/braccato_core_rs_bg.wasm +0 -0
- package/pkg/braccato_core_rs_bg.wasm.d.ts +55 -0
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -632
- package/dist/element.d.ts +0 -168
- package/dist/element.js +0 -730
- package/dist/engine/animationConfig.d.ts +0 -84
- package/dist/engine/animationConfig.js +0 -95
- package/dist/engine/animationDrift.d.ts +0 -11
- package/dist/engine/animationDrift.js +0 -43
- package/dist/engine/animationTiming.d.ts +0 -27
- package/dist/engine/animationTiming.js +0 -145
- package/dist/engine/autoScroll.d.ts +0 -24
- package/dist/engine/autoScroll.js +0 -103
- package/dist/engine/clock.d.ts +0 -29
- package/dist/engine/clock.js +0 -70
- package/dist/engine/contextSweep.d.ts +0 -10
- package/dist/engine/contextSweep.js +0 -102
- package/dist/engine/cssValues.d.ts +0 -13
- package/dist/engine/cssValues.js +0 -47
- package/dist/engine/culling.d.ts +0 -6
- package/dist/engine/culling.js +0 -76
- package/dist/engine/debugOverlay.d.ts +0 -14
- package/dist/engine/debugOverlay.js +0 -58
- package/dist/engine/decorationSlides.d.ts +0 -6
- package/dist/engine/decorationSlides.js +0 -53
- package/dist/engine/elementMotion.d.ts +0 -18
- package/dist/engine/elementMotion.js +0 -98
- package/dist/engine/glow.d.ts +0 -7
- package/dist/engine/glow.js +0 -59
- package/dist/engine/instance.d.ts +0 -105
- package/dist/engine/instance.js +0 -89
- package/dist/engine/instrumentalAnimations.d.ts +0 -7
- package/dist/engine/instrumentalAnimations.js +0 -59
- package/dist/engine/letterPlans.d.ts +0 -31
- package/dist/engine/letterPlans.js +0 -62
- package/dist/engine/lineAnimationState.d.ts +0 -10
- package/dist/engine/lineAnimationState.js +0 -82
- package/dist/engine/lineAnimations.d.ts +0 -5
- package/dist/engine/lineAnimations.js +0 -63
- package/dist/engine/lineLifecycle.d.ts +0 -12
- package/dist/engine/lineLifecycle.js +0 -92
- package/dist/engine/lineScroll.d.ts +0 -47
- package/dist/engine/lineScroll.js +0 -184
- package/dist/engine/lineScrollStyle.d.ts +0 -32
- package/dist/engine/lineScrollStyle.js +0 -133
- package/dist/engine/liveViews.d.ts +0 -3
- package/dist/engine/liveViews.js +0 -5
- package/dist/engine/motionCurves.d.ts +0 -19
- package/dist/engine/motionCurves.js +0 -85
- package/dist/engine/motionPreference.d.ts +0 -1
- package/dist/engine/motionPreference.js +0 -1
- package/dist/engine/passiveScroll.d.ts +0 -10
- package/dist/engine/passiveScroll.js +0 -93
- package/dist/engine/renderedLines.d.ts +0 -16
- package/dist/engine/renderedLines.js +0 -130
- package/dist/engine/scrollViewport.d.ts +0 -36
- package/dist/engine/scrollViewport.js +0 -104
- package/dist/engine/stageMotion.d.ts +0 -7
- package/dist/engine/stageMotion.js +0 -319
- package/dist/engine/sweepPlans.d.ts +0 -38
- package/dist/engine/sweepPlans.js +0 -66
- package/dist/engine/tick.d.ts +0 -16
- package/dist/engine/tick.js +0 -270
- package/dist/engine/timingLogs.d.ts +0 -7
- package/dist/engine/timingLogs.js +0 -81
- package/dist/engine/userScroll.d.ts +0 -12
- package/dist/engine/userScroll.js +0 -62
- package/dist/engine/wavePool.d.ts +0 -7
- package/dist/engine/wavePool.js +0 -22
- package/dist/engine/wordAnimations.d.ts +0 -5
- package/dist/engine/wordAnimations.js +0 -206
- package/dist/imageHighlights.d.ts +0 -4
- package/dist/imageHighlights.js +0 -34
- package/dist/index.d.ts +0 -17
- package/dist/index.js +0 -12
- package/dist/inject.d.ts +0 -98
- package/dist/inject.js +0 -591
- package/dist/instrumental.d.ts +0 -11
- package/dist/instrumental.js +0 -121
- package/dist/language.d.ts +0 -9
- package/dist/language.js +0 -47
- package/dist/letters.d.ts +0 -2
- package/dist/letters.js +0 -25
- package/dist/renderer.d.ts +0 -29
- package/dist/renderer.js +0 -412
- package/dist/seek.d.ts +0 -1
- package/dist/seek.js +0 -27
- package/dist/stage.d.ts +0 -58
- package/dist/stage.js +0 -121
- package/dist/types.d.ts +0 -236
- package/dist/types.js +0 -1
- package/dist/view.d.ts +0 -51
- package/dist/view.js +0 -396
package/dist/element.d.ts
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import type { StageBox } from "./stage.js";
|
|
2
|
-
import type { Lyric, LyricsLayout, LyricsRenderer, LyricsRendererHost, LyricSyncType, TickOptions } from "./types.js";
|
|
3
|
-
import type { SetLyricsOptions } from "./view.js";
|
|
4
|
-
/**
|
|
5
|
-
* What a tick carries beyond the clock. `isPlaying` is not among them: `playing` is the property
|
|
6
|
-
* that says so, and one question with two answers has no rule for choosing between them.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export type ElementTickOptions = Omit<TickOptions, "isPlaying">;
|
|
11
|
-
/**
|
|
12
|
-
* How the lines are built, beyond the lines themselves. The mount is not among them: the element is
|
|
13
|
-
* the mount.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export type ElementLyricsOptions = Partial<SetLyricsOptions>;
|
|
18
|
-
/** @public */
|
|
19
|
-
export type ElementErrorPhase = "connect" | "conflict" | "layout" | "lyrics" | "source" | "theme";
|
|
20
|
-
/** @public */
|
|
21
|
-
export interface ElementErrorDetail {
|
|
22
|
-
/** What the element was doing. Nothing thrown by a tick is reported here: see the README. */
|
|
23
|
-
phase: ElementErrorPhase;
|
|
24
|
-
error: Error;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* What the element is doing, and why it is not doing what it was asked. Every `braccato:error` is
|
|
28
|
-
* dispatched a microtask after the fact so that a listener added straight after the element was
|
|
29
|
-
* inserted still hears it; this is the answer for a consumer that added one later than that, or
|
|
30
|
-
* never.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export type ElementStatus = "idle" | "rendering" | "theme-conflict" | "unsynced-on-stage" | "no-browsing-context";
|
|
35
|
-
/** @public */
|
|
36
|
-
export interface LyricsLoadedDetail {
|
|
37
|
-
lineCount: number;
|
|
38
|
-
syncType: LyricSyncType;
|
|
39
|
-
}
|
|
40
|
-
/** @public */
|
|
41
|
-
export interface LineClickDetail {
|
|
42
|
-
/** Where the click asked the player to go, in seconds. */
|
|
43
|
-
timeS: number;
|
|
44
|
-
}
|
|
45
|
-
/** @public */
|
|
46
|
-
export interface StageLayoutDetail {
|
|
47
|
-
/** Around the lines being sung, in the container's coordinates, or null when nothing sung is on stage. */
|
|
48
|
-
box: StageBox | null;
|
|
49
|
-
}
|
|
50
|
-
/** @public */
|
|
51
|
-
export interface ScrollStateDetail {
|
|
52
|
-
/** Whether the user has scrolled away, so autoscroll is waiting rather than following the song. */
|
|
53
|
-
userScrolling: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Mounts a lyrics view into itself. The renderer is built when the element is connected and
|
|
57
|
-
* destroyed when it is disconnected, so an element that is moved around the page rebuilds rather
|
|
58
|
-
* than going quiet, and every property may be written before either has happened.
|
|
59
|
-
*
|
|
60
|
-
* `dir` is not among the properties, and that is the point: `HTMLElement` already reflects it, the
|
|
61
|
-
* lines this module builds carry `dir="auto"` and resolve their own direction from their text, and a
|
|
62
|
-
* property here would be a second opinion about a question the platform has already answered.
|
|
63
|
-
*/
|
|
64
|
-
export declare class BraccatoLyricsElement extends HTMLElement {
|
|
65
|
-
#private;
|
|
66
|
-
static readonly observedAttributes: string[];
|
|
67
|
-
/**
|
|
68
|
-
* The song. An empty array clears the view, so a consumer between songs has a way to say so.
|
|
69
|
-
*/
|
|
70
|
-
get lyrics(): Lyric[] | null;
|
|
71
|
-
set lyrics(lyrics: Lyric[] | null);
|
|
72
|
-
/**
|
|
73
|
-
* How the lines are built, beyond the lines themselves: whether a loader is still covering the
|
|
74
|
-
* view, and whether these lyrics are a "not found" placeholder rather than a song. The second one
|
|
75
|
-
* is what keeps passive scrolling off a one line message it would otherwise drift for the length
|
|
76
|
-
* of the song.
|
|
77
|
-
*
|
|
78
|
-
* Read by the next build rather than causing one, so a consumer writes it beside `lyrics` rather
|
|
79
|
-
* than instead of it, and writing both renders once.
|
|
80
|
-
*/
|
|
81
|
-
get lyricsOptions(): ElementLyricsOptions;
|
|
82
|
-
set lyricsOptions(options: ElementLyricsOptions);
|
|
83
|
-
/**
|
|
84
|
-
* The media element the lyrics follow, as a CSS selector resolved in this element's own document
|
|
85
|
-
* or as the element itself. Setting it binds and null unbinds, and while it is bound the element
|
|
86
|
-
* reads the clock rather than being told it: `currentTime` and `playing` become what it reports.
|
|
87
|
-
*
|
|
88
|
-
* Bound only while connected, the way the renderer is built only while connected, and a selector
|
|
89
|
-
* is resolved again every time it is written and every time the element connects.
|
|
90
|
-
*/
|
|
91
|
-
get source(): HTMLMediaElement | string | null;
|
|
92
|
-
set source(source: HTMLMediaElement | string | null);
|
|
93
|
-
/**
|
|
94
|
-
* The media element `source` resolved to. Null whenever nothing is being followed, which is the
|
|
95
|
-
* answer for a selector that matched nothing and for an element that is not connected.
|
|
96
|
-
*/
|
|
97
|
-
get mediaElement(): HTMLMediaElement | null;
|
|
98
|
-
/**
|
|
99
|
-
* Playback position in seconds, not milliseconds: the module ticks in seconds, and converting here
|
|
100
|
-
* would leave the element and the renderer underneath it disagreeing about what a number means.
|
|
101
|
-
* Writing it renders the view again, so whoever owns the clock drives the lyrics by writing this.
|
|
102
|
-
*
|
|
103
|
-
* While a media element is bound it is the one that owns the clock, so a write is dropped and this
|
|
104
|
-
* keeps reporting what the binding last read. Dropped rather than reported: a consumer who left
|
|
105
|
-
* their own frame loop running would otherwise be told about it sixty times a second.
|
|
106
|
-
*/
|
|
107
|
-
get currentTime(): number;
|
|
108
|
-
set currentTime(currentTimeS: number);
|
|
109
|
-
/** An output rather than an input while a media element is bound, exactly as `currentTime` is. */
|
|
110
|
-
get playing(): boolean;
|
|
111
|
-
set playing(playing: boolean);
|
|
112
|
-
/**
|
|
113
|
-
* The rest of a tick: the user offsets the clock is matched against, whether passive scrolling is
|
|
114
|
-
* switched on for unsynced lyrics, and the timestamp of the player snapshot the clock came from.
|
|
115
|
-
*
|
|
116
|
-
* That last one matters beyond this element. The playback clock the module compares a tick
|
|
117
|
-
* against is module scope, so an element sharing a realm with another view has to be given the
|
|
118
|
-
* same snapshot timestamps that view is, or every tick reads as a jump away from the other one.
|
|
119
|
-
*
|
|
120
|
-
* Read by the next tick rather than causing one, so a consumer that writes these and the clock on
|
|
121
|
-
* the same frame renders the view once rather than twice.
|
|
122
|
-
*/
|
|
123
|
-
get tickOptions(): ElementTickOptions;
|
|
124
|
-
set tickOptions(options: ElementTickOptions);
|
|
125
|
-
/**
|
|
126
|
-
* A compiled stylesheet. Its `blyrics-*` comments configure the module and the sheet itself goes
|
|
127
|
-
* into this element's document. An empty one puts every setting back to its default, and is
|
|
128
|
-
* applied like any other: the settings are module scope, so an element that applied nothing would
|
|
129
|
-
* render against whatever the last theme in that bundle left behind. What that costs is that
|
|
130
|
-
* connecting an element nobody gave a theme empties the theme element already in its document.
|
|
131
|
-
*/
|
|
132
|
-
get theme(): string;
|
|
133
|
-
set theme(css: string);
|
|
134
|
-
/**
|
|
135
|
-
* Overrides for anything the renderer asks of its surroundings. Every member has a default, so a
|
|
136
|
-
* consumer with nothing to say leaves this alone. Writing it while connected rebuilds the view:
|
|
137
|
-
* the renderer is handed its host once, when it is created.
|
|
138
|
-
*/
|
|
139
|
-
get host(): Partial<LyricsRendererHost>;
|
|
140
|
-
set host(overrides: Partial<LyricsRendererHost>);
|
|
141
|
-
/**
|
|
142
|
-
* `"stage"` shows only the lines being sung, for subtitles over a video, and fills the nearest
|
|
143
|
-
* positioned ancestor. Anything else scrolls. Writing it while connected rebuilds the view: the
|
|
144
|
-
* renderer is handed its layout once, when it is created.
|
|
145
|
-
*/
|
|
146
|
-
get layout(): LyricsLayout;
|
|
147
|
-
set layout(layout: LyricsLayout);
|
|
148
|
-
/**
|
|
149
|
-
* The renderer underneath, for a consumer who outgrows the element. Null while disconnected, and a
|
|
150
|
-
* different one after every reconnection.
|
|
151
|
-
*/
|
|
152
|
-
get renderer(): LyricsRenderer | null;
|
|
153
|
-
/**
|
|
154
|
-
* What the element is doing, asked rather than listened for. `theme-conflict` is the one that says
|
|
155
|
-
* the view is on the screen but not necessarily the way it was asked for: the theme settings are
|
|
156
|
-
* module scope, so a document with two elements holding different themes renders both against
|
|
157
|
-
* whichever was applied last.
|
|
158
|
-
*
|
|
159
|
-
* A `source` that named nothing to follow is deliberately not one of these. The element is still
|
|
160
|
-
* rendering, and a status saying otherwise would trade one true answer for another. What a
|
|
161
|
-
* consumer who was not listening for the error reads instead is `mediaElement`, which is null
|
|
162
|
-
* while `source` still holds the selector it could not resolve.
|
|
163
|
-
*/
|
|
164
|
-
get status(): ElementStatus;
|
|
165
|
-
connectedCallback(): void;
|
|
166
|
-
disconnectedCallback(): void;
|
|
167
|
-
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
168
|
-
}
|