@vocasync/astro 1.0.0 → 2.0.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/README.md +618 -80
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/components/AudioPlayer.astro +298 -1136
- package/dist/components/index.d.ts +10 -32
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/types.d.ts +117 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/components/types.js +2 -0
- package/dist/components/types.js.map +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/schema.d.ts +124 -169
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +4 -4
- package/dist/config/schema.js.map +1 -1
- package/dist/core/content-loader.js +1 -1
- package/dist/core/content-loader.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/speech-builder.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/integration.d.ts +28 -2
- package/dist/integration.d.ts.map +1 -1
- package/dist/integration.js +40 -3
- package/dist/integration.js.map +1 -1
- package/dist/lib/latex-to-speech/index.d.ts.map +1 -1
- package/dist/lib/latex-to-speech/index.js.map +1 -1
- package/dist/player-core/boot.d.ts +9 -0
- package/dist/player-core/boot.d.ts.map +1 -0
- package/dist/player-core/boot.js +59 -0
- package/dist/player-core/boot.js.map +1 -0
- package/dist/player-core/highlighter.d.ts +31 -0
- package/dist/player-core/highlighter.d.ts.map +1 -0
- package/dist/player-core/highlighter.js +103 -0
- package/dist/player-core/highlighter.js.map +1 -0
- package/dist/player-core/index.d.ts +17 -0
- package/dist/player-core/index.d.ts.map +1 -0
- package/dist/player-core/index.js +24 -0
- package/dist/player-core/index.js.map +1 -0
- package/dist/player-core/media-url.d.ts +18 -0
- package/dist/player-core/media-url.d.ts.map +1 -0
- package/dist/player-core/media-url.js +33 -0
- package/dist/player-core/media-url.js.map +1 -0
- package/dist/player-core/player.d.ts +9 -0
- package/dist/player-core/player.d.ts.map +1 -0
- package/dist/player-core/player.js +622 -0
- package/dist/player-core/player.js.map +1 -0
- package/dist/player-core/registry.d.ts +20 -0
- package/dist/player-core/registry.d.ts.map +1 -0
- package/dist/player-core/registry.js +31 -0
- package/dist/player-core/registry.js.map +1 -0
- package/dist/player-core/seek-delegate.d.ts +24 -0
- package/dist/player-core/seek-delegate.d.ts.map +1 -0
- package/dist/player-core/seek-delegate.js +64 -0
- package/dist/player-core/seek-delegate.js.map +1 -0
- package/dist/player-core/storage.d.ts +38 -0
- package/dist/player-core/storage.d.ts.map +1 -0
- package/dist/player-core/storage.js +107 -0
- package/dist/player-core/storage.js.map +1 -0
- package/dist/player-core/strings.d.ts +53 -0
- package/dist/player-core/strings.d.ts.map +1 -0
- package/dist/player-core/strings.js +45 -0
- package/dist/player-core/strings.js.map +1 -0
- package/dist/player-core/timings.d.ts +56 -0
- package/dist/player-core/timings.d.ts.map +1 -0
- package/dist/player-core/timings.js +90 -0
- package/dist/player-core/timings.js.map +1 -0
- package/dist/rehype/audio-words.d.ts +9 -3
- package/dist/rehype/audio-words.d.ts.map +1 -1
- package/dist/rehype/audio-words.js +8 -8
- package/dist/rehype/audio-words.js.map +1 -1
- package/dist/rehype/index.d.ts +2 -2
- package/dist/rehype/index.d.ts.map +1 -1
- package/dist/rehype/index.js.map +1 -1
- package/dist/rehype/rehype-math-speech.d.ts.map +1 -1
- package/dist/rehype/rehype-math-speech.js +2 -0
- package/dist/rehype/rehype-math-speech.js.map +1 -1
- package/dist/styles/content.css +41 -0
- package/dist/styles/layers.css +13 -0
- package/dist/styles/player.css +517 -0
- package/dist/styles/preset-shadcn.css +31 -0
- package/dist/styles/tokens.css +266 -0
- package/dist/styles/vocasync.css +10 -0
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/orchestrator.d.ts.map +1 -1
- package/dist/sync/orchestrator.js.map +1 -1
- package/package.json +40 -17
- package/src/api/index.ts +4 -4
- package/src/components/AudioPlayer.astro +298 -1136
- package/src/components/index.ts +19 -34
- package/src/components/types.ts +140 -0
- package/src/config/index.ts +23 -24
- package/src/config/schema.ts +4 -4
- package/src/core/content-loader.ts +1 -1
- package/src/core/index.ts +7 -7
- package/src/env.d.ts +2 -0
- package/src/index.ts +23 -28
- package/src/integration.ts +66 -4
- package/src/player-core/boot.ts +62 -0
- package/src/player-core/highlighter.ts +159 -0
- package/src/player-core/index.ts +45 -0
- package/src/player-core/media-url.ts +35 -0
- package/src/player-core/player.ts +725 -0
- package/src/player-core/registry.ts +40 -0
- package/src/player-core/seek-delegate.ts +92 -0
- package/src/player-core/storage.ts +112 -0
- package/src/player-core/strings.ts +89 -0
- package/src/player-core/timings.ts +115 -0
- package/src/rehype/audio-words.ts +17 -11
- package/src/rehype/index.ts +2 -3
- package/src/rehype/rehype-math-speech.ts +3 -1
- package/src/styles/content.css +41 -0
- package/src/styles/layers.css +13 -0
- package/src/styles/player.css +517 -0
- package/src/styles/preset-shadcn.css +31 -0
- package/src/styles/tokens.css +266 -0
- package/src/styles/vocasync.css +10 -0
- package/src/sync/index.ts +1 -1
- package/src/sync/orchestrator.ts +1 -1
- package/dist/styles/variables.css +0 -164
- package/src/styles/variables.css +0 -164
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The VocaSync theming surface.
|
|
3
|
+
*
|
|
4
|
+
* Four seeds carry a whole theme:
|
|
5
|
+
*
|
|
6
|
+
* :root {
|
|
7
|
+
* --vocasync-accent: #8b5cf6;
|
|
8
|
+
* --vocasync-surface: #faf7ff;
|
|
9
|
+
* --vocasync-text: #1e1b2e;
|
|
10
|
+
* --vocasync-highlight: #f59e0b;
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* Everything else derives from them, and every derived token can still be overridden
|
|
14
|
+
* on its own. Point a seed at a token you already have and the player adopts your
|
|
15
|
+
* palette -- and your dark mode with it, because your token already flips:
|
|
16
|
+
*
|
|
17
|
+
* :root { --vocasync-accent: var(--primary); }
|
|
18
|
+
*
|
|
19
|
+
* See preset-shadcn.css for that wired up.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/* Must precede @property: only @charset, @import and @layer may come first. */
|
|
23
|
+
@layer vocasync.tokens, vocasync.base, vocasync.variants;
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Registering the seeds means a value that is not a colour -- a gradient, a typo,
|
|
27
|
+
* `currentColor` -- falls back to the default instead of resolving to `unset` and
|
|
28
|
+
* rendering the component invisible. Only the seeds are registered: constraining the
|
|
29
|
+
* derived tokens would stop consumers assigning whatever they like to them.
|
|
30
|
+
*/
|
|
31
|
+
@property --vocasync-accent {
|
|
32
|
+
syntax: "<color>";
|
|
33
|
+
inherits: true;
|
|
34
|
+
initial-value: #3b82f6;
|
|
35
|
+
}
|
|
36
|
+
@property --vocasync-surface {
|
|
37
|
+
syntax: "<color>";
|
|
38
|
+
inherits: true;
|
|
39
|
+
initial-value: #f8fafc;
|
|
40
|
+
}
|
|
41
|
+
@property --vocasync-text {
|
|
42
|
+
syntax: "<color>";
|
|
43
|
+
inherits: true;
|
|
44
|
+
initial-value: #1e293b;
|
|
45
|
+
}
|
|
46
|
+
@property --vocasync-highlight {
|
|
47
|
+
syntax: "<color>";
|
|
48
|
+
inherits: true;
|
|
49
|
+
initial-value: #10b981;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@layer vocasync.tokens {
|
|
53
|
+
:root {
|
|
54
|
+
/* ---------------------------------------------------------------- seeds */
|
|
55
|
+
--vocasync-accent: #3b82f6;
|
|
56
|
+
--vocasync-surface: #f8fafc;
|
|
57
|
+
--vocasync-text: #1e293b;
|
|
58
|
+
--vocasync-highlight: #10b981;
|
|
59
|
+
|
|
60
|
+
/* ------------------------------------------------ derived: static values
|
|
61
|
+
* Overridden below by the @supports blocks wherever the browser can compute
|
|
62
|
+
* them from the seeds. These literals are what a browser without relative
|
|
63
|
+
* colour syntax falls back to, so they match the default seeds rather than
|
|
64
|
+
* tracking a custom one.
|
|
65
|
+
*/
|
|
66
|
+
--vocasync-accent-hover: #2563eb;
|
|
67
|
+
--vocasync-accent-content: #ffffff;
|
|
68
|
+
--vocasync-surface-raised: #ffffff;
|
|
69
|
+
--vocasync-text-muted: #64748b;
|
|
70
|
+
--vocasync-text-faint: #94a3b8;
|
|
71
|
+
--vocasync-border: #e2e8f0;
|
|
72
|
+
--vocasync-track: #e2e8f0;
|
|
73
|
+
--vocasync-buffered-color: #cbd5e1;
|
|
74
|
+
--vocasync-highlight-active-bg: rgb(16 185 129 / 0.25);
|
|
75
|
+
--vocasync-highlight-trail-bg: rgb(16 185 129 / 0.12);
|
|
76
|
+
/* Left unset so the active word keeps the prose colour. Set it to force one. */
|
|
77
|
+
--vocasync-highlight-active-text: ;
|
|
78
|
+
|
|
79
|
+
/* ------------------------------------------------------------ typography
|
|
80
|
+
* The family inherits by default: the player should read as part of the page
|
|
81
|
+
* it sits in, not announce itself.
|
|
82
|
+
*/
|
|
83
|
+
--vocasync-font-family: inherit;
|
|
84
|
+
--vocasync-font-size: 0.875rem;
|
|
85
|
+
--vocasync-font-size-sm: 0.75rem;
|
|
86
|
+
--vocasync-font-weight: 400;
|
|
87
|
+
--vocasync-font-weight-medium: 500;
|
|
88
|
+
--vocasync-line-height: 1.4;
|
|
89
|
+
--vocasync-numeric: tabular-nums;
|
|
90
|
+
|
|
91
|
+
/* ---------------------------------------------------------------- density
|
|
92
|
+
* One multiplier scales padding, gaps and control sizes together, so a player
|
|
93
|
+
* can be made compact without restating a dozen lengths.
|
|
94
|
+
*/
|
|
95
|
+
--vocasync-density: 1;
|
|
96
|
+
--vocasync-unit: 0.25rem;
|
|
97
|
+
/* Undensified base sizes. The density multiplier is applied where each of these is
|
|
98
|
+
* USED, not here: a custom property resolves its var() references on the element
|
|
99
|
+
* that declares it, so multiplying at :root would bake in density 1 and a
|
|
100
|
+
* per-player override -- which is exactly what `size` does -- could never take
|
|
101
|
+
* effect. Set any of these directly to change a size without touching density. */
|
|
102
|
+
--vocasync-gap: calc(var(--vocasync-unit) * 3);
|
|
103
|
+
--vocasync-gap-sm: var(--vocasync-unit);
|
|
104
|
+
--vocasync-padding: calc(var(--vocasync-unit) * 4);
|
|
105
|
+
--vocasync-control-size: 2.5rem;
|
|
106
|
+
--vocasync-control-size-sm: 2rem;
|
|
107
|
+
--vocasync-icon-size: 1.25rem;
|
|
108
|
+
|
|
109
|
+
/* ------------------------------------------------------------------ shape */
|
|
110
|
+
--vocasync-radius: 0.75rem;
|
|
111
|
+
--vocasync-radius-control: 0.375rem;
|
|
112
|
+
--vocasync-radius-menu: 0.5rem;
|
|
113
|
+
--vocasync-radius-pill: 9999px;
|
|
114
|
+
--vocasync-word-radius: 0.125rem;
|
|
115
|
+
--vocasync-border-width: 1px;
|
|
116
|
+
|
|
117
|
+
/* ---------------------------------------------------------------- sliders */
|
|
118
|
+
/* Runtime state, not settings: the player writes these onto the seek bar as
|
|
119
|
+
* percentages each frame. Declared here so the value is always defined. */
|
|
120
|
+
--vocasync-played: 0%;
|
|
121
|
+
--vocasync-buffered: 0%;
|
|
122
|
+
|
|
123
|
+
--vocasync-slider-height: 0.375rem;
|
|
124
|
+
--vocasync-slider-thumb-size: 1rem;
|
|
125
|
+
--vocasync-volume-width: 4rem;
|
|
126
|
+
|
|
127
|
+
/* ------------------------------------------------------------------- dock */
|
|
128
|
+
--vocasync-dock-height: 3.5rem;
|
|
129
|
+
--vocasync-dock-offset: 1rem;
|
|
130
|
+
--vocasync-dock-width: 20rem;
|
|
131
|
+
|
|
132
|
+
/* ------------------------------------------------------------------ focus */
|
|
133
|
+
--vocasync-focus-width: 2px;
|
|
134
|
+
--vocasync-focus-offset: 2px;
|
|
135
|
+
--vocasync-focus-color: var(--vocasync-accent);
|
|
136
|
+
|
|
137
|
+
/* -------------------------------------------------------------- elevation */
|
|
138
|
+
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
139
|
+
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
140
|
+
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
141
|
+
|
|
142
|
+
/* ----------------------------------------------------------------- motion */
|
|
143
|
+
--vocasync-transition-fast: 150ms ease;
|
|
144
|
+
--vocasync-transition: 200ms ease;
|
|
145
|
+
|
|
146
|
+
/* ------------------------------------------------------------------ layer */
|
|
147
|
+
--vocasync-menu-z: 10;
|
|
148
|
+
--vocasync-dock-z: 1000;
|
|
149
|
+
|
|
150
|
+
/* Lightness above which accent-content flips to black. Perceptual, not a WCAG
|
|
151
|
+
* measurement -- raise it if your accent needs dark text sooner. */
|
|
152
|
+
--vocasync-l-threshold: 0.623;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ------------------------------------------------------------------- dark
|
|
156
|
+
* Three ways in, because sites disagree on how they signal dark mode:
|
|
157
|
+
* - the OS preference, unless the page has explicitly opted into light
|
|
158
|
+
* - our own attribute, for explicit control
|
|
159
|
+
* - the conventions Tailwind, next-themes, daisyUI and Starlight already use,
|
|
160
|
+
* so most sites need no configuration at all
|
|
161
|
+
*
|
|
162
|
+
* These selectors are deliberately NOT wrapped in :where(). Zero specificity would
|
|
163
|
+
* lose to the `:root` block above, and the class-based switch -- the whole reason
|
|
164
|
+
* this exists -- would silently never apply.
|
|
165
|
+
*/
|
|
166
|
+
@media (prefers-color-scheme: dark) {
|
|
167
|
+
:root:not([data-vocasync-scheme="light"]):not(.light):not([data-theme="light"]):not(
|
|
168
|
+
[data-mode="light"]
|
|
169
|
+
) {
|
|
170
|
+
--vocasync-accent: #60a5fa;
|
|
171
|
+
--vocasync-surface: #1e293b;
|
|
172
|
+
--vocasync-text: #f1f5f9;
|
|
173
|
+
--vocasync-highlight: #34d399;
|
|
174
|
+
|
|
175
|
+
/* Static fallbacks for browsers without color-mix(); the @supports block below
|
|
176
|
+
* recomputes these from whichever seeds are in play. */
|
|
177
|
+
--vocasync-accent-hover: #3b82f6;
|
|
178
|
+
--vocasync-accent-content: #1e293b;
|
|
179
|
+
--vocasync-surface-raised: #334155;
|
|
180
|
+
--vocasync-text-muted: #94a3b8;
|
|
181
|
+
--vocasync-text-faint: #64748b;
|
|
182
|
+
--vocasync-border: #475569;
|
|
183
|
+
--vocasync-track: #475569;
|
|
184
|
+
--vocasync-buffered-color: #64748b;
|
|
185
|
+
--vocasync-highlight-active-bg: rgb(52 211 153 / 0.25);
|
|
186
|
+
--vocasync-highlight-trail-bg: rgb(52 211 153 / 0.12);
|
|
187
|
+
|
|
188
|
+
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
|
|
189
|
+
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
|
|
190
|
+
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
[data-vocasync-scheme="dark"],
|
|
195
|
+
.dark,
|
|
196
|
+
[data-theme="dark"],
|
|
197
|
+
[data-mode="dark"] {
|
|
198
|
+
--vocasync-accent: #60a5fa;
|
|
199
|
+
--vocasync-surface: #1e293b;
|
|
200
|
+
--vocasync-text: #f1f5f9;
|
|
201
|
+
--vocasync-highlight: #34d399;
|
|
202
|
+
|
|
203
|
+
/* Static fallbacks for browsers without color-mix(); the @supports block below
|
|
204
|
+
* recomputes these from whichever seeds are in play. */
|
|
205
|
+
--vocasync-accent-hover: #3b82f6;
|
|
206
|
+
--vocasync-accent-content: #1e293b;
|
|
207
|
+
--vocasync-surface-raised: #334155;
|
|
208
|
+
--vocasync-text-muted: #94a3b8;
|
|
209
|
+
--vocasync-text-faint: #64748b;
|
|
210
|
+
--vocasync-border: #475569;
|
|
211
|
+
--vocasync-track: #475569;
|
|
212
|
+
--vocasync-buffered-color: #64748b;
|
|
213
|
+
--vocasync-highlight-active-bg: rgb(52 211 153 / 0.25);
|
|
214
|
+
--vocasync-highlight-trail-bg: rgb(52 211 153 / 0.12);
|
|
215
|
+
|
|
216
|
+
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
|
|
217
|
+
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
|
|
218
|
+
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* --------------------------------------------------- derived: computed, last
|
|
222
|
+
* These come after the scheme blocks on purpose. Each derives from whichever
|
|
223
|
+
* seeds ended up winning, so overriding one seed re-colours the whole player in
|
|
224
|
+
* light AND dark. Putting them earlier -- as the first draft did -- let the dark
|
|
225
|
+
* block's static literals win, and a custom seed only half-applied.
|
|
226
|
+
*/
|
|
227
|
+
@supports (color: color-mix(in oklab, red, blue)) {
|
|
228
|
+
:root {
|
|
229
|
+
--vocasync-accent-hover: color-mix(in oklab, var(--vocasync-accent), black 12%);
|
|
230
|
+
--vocasync-surface-raised: color-mix(in oklab, var(--vocasync-surface), white 60%);
|
|
231
|
+
--vocasync-text-muted: color-mix(in oklab, var(--vocasync-text), var(--vocasync-surface) 40%);
|
|
232
|
+
--vocasync-text-faint: color-mix(in oklab, var(--vocasync-text), var(--vocasync-surface) 60%);
|
|
233
|
+
--vocasync-border: color-mix(in oklab, var(--vocasync-text), var(--vocasync-surface) 85%);
|
|
234
|
+
--vocasync-track: color-mix(in oklab, var(--vocasync-text), var(--vocasync-surface) 85%);
|
|
235
|
+
--vocasync-buffered-color: color-mix(
|
|
236
|
+
in oklab,
|
|
237
|
+
var(--vocasync-text),
|
|
238
|
+
var(--vocasync-surface) 70%
|
|
239
|
+
);
|
|
240
|
+
--vocasync-highlight-active-bg: color-mix(
|
|
241
|
+
in oklab,
|
|
242
|
+
var(--vocasync-highlight) 25%,
|
|
243
|
+
transparent
|
|
244
|
+
);
|
|
245
|
+
--vocasync-highlight-trail-bg: color-mix(
|
|
246
|
+
in oklab,
|
|
247
|
+
var(--vocasync-highlight) 12%,
|
|
248
|
+
transparent
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/*
|
|
254
|
+
* Black or white against the accent, whichever reads. Relative colour syntax
|
|
255
|
+
* cannot lift `l` out into a custom property, so the decision is made inline:
|
|
256
|
+
* below the threshold the clamp resolves to 1 (white), above it to 0 (black).
|
|
257
|
+
*/
|
|
258
|
+
@supports (color: oklch(from red l c h)) {
|
|
259
|
+
:root {
|
|
260
|
+
--vocasync-accent-content: oklch(
|
|
261
|
+
from var(--vocasync-accent) clamp(0, (l / var(--vocasync-l-threshold) - 1) * -infinity, 1) 0
|
|
262
|
+
h
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything, in the right order. This is what the integration injects.
|
|
3
|
+
*
|
|
4
|
+
* Import the parts directly instead if you want less: content.css alone is enough
|
|
5
|
+
* for a headless player that ships its own chrome.
|
|
6
|
+
*/
|
|
7
|
+
@import "./layers.css";
|
|
8
|
+
@import "./tokens.css";
|
|
9
|
+
@import "./content.css";
|
|
10
|
+
@import "./player.css";
|
package/src/sync/index.ts
CHANGED
package/src/sync/orchestrator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VocaSyncClient,
|
|
1
|
+
import { toAlignmentLocale, type VocaSyncClient, withPublishableKey } from "../api/client.js";
|
|
2
2
|
import { FormatSchema, LanguageSchema, type VocaSyncConfig, VoiceSchema } from "../config/index.js";
|
|
3
3
|
import { getAudioEntry, loadAudioMap, saveAudioMap, setAudioEntry } from "../core/audio-map.js";
|
|
4
4
|
import { loadContent } from "../core/content-loader.js";
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VocaSync AudioPlayer CSS Variables
|
|
3
|
-
*
|
|
4
|
-
* Import this file and override variables to customize the player appearance.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```css
|
|
8
|
-
* @import "@vocasync/astro/styles/variables.css";
|
|
9
|
-
*
|
|
10
|
-
* :root {
|
|
11
|
-
* --vocasync-primary: #8b5cf6;
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
:root {
|
|
17
|
-
/* ========================================
|
|
18
|
-
* COLOR PALETTE
|
|
19
|
-
* ======================================== */
|
|
20
|
-
|
|
21
|
-
/* Primary brand color - used for buttons, progress bar, active states */
|
|
22
|
-
--vocasync-primary: #3b82f6;
|
|
23
|
-
--vocasync-primary-hover: #2563eb;
|
|
24
|
-
--vocasync-primary-content: #ffffff;
|
|
25
|
-
|
|
26
|
-
/* Surface colors - backgrounds and cards */
|
|
27
|
-
--vocasync-surface: #f8fafc;
|
|
28
|
-
--vocasync-surface-elevated: #ffffff;
|
|
29
|
-
|
|
30
|
-
/* Border colors */
|
|
31
|
-
--vocasync-border: #e2e8f0;
|
|
32
|
-
--vocasync-border-focus: #3b82f6;
|
|
33
|
-
|
|
34
|
-
/* Text colors */
|
|
35
|
-
--vocasync-text: #1e293b;
|
|
36
|
-
--vocasync-text-muted: #64748b;
|
|
37
|
-
--vocasync-text-faint: #94a3b8;
|
|
38
|
-
|
|
39
|
-
/* ========================================
|
|
40
|
-
* WORD HIGHLIGHTING
|
|
41
|
-
* ======================================== */
|
|
42
|
-
|
|
43
|
-
/* Color for the currently spoken word */
|
|
44
|
-
--vocasync-highlight: #10b981;
|
|
45
|
-
--vocasync-highlight-text: #ffffff;
|
|
46
|
-
|
|
47
|
-
/* Opacity for active word background */
|
|
48
|
-
--vocasync-highlight-active-opacity: 0.25;
|
|
49
|
-
|
|
50
|
-
/* Opacity for trailing words (creates a "wake" effect) */
|
|
51
|
-
--vocasync-highlight-trail-opacity: 0.12;
|
|
52
|
-
|
|
53
|
-
/* ========================================
|
|
54
|
-
* SIZING & SPACING
|
|
55
|
-
* ======================================== */
|
|
56
|
-
|
|
57
|
-
/* Player dimensions */
|
|
58
|
-
--vocasync-player-radius: 0.75rem;
|
|
59
|
-
--vocasync-player-padding: 1rem;
|
|
60
|
-
--vocasync-player-gap: 0.75rem;
|
|
61
|
-
|
|
62
|
-
/* Button sizes */
|
|
63
|
-
--vocasync-button-size: 2.5rem;
|
|
64
|
-
--vocasync-button-radius: 9999px;
|
|
65
|
-
|
|
66
|
-
/* Slider/range input */
|
|
67
|
-
--vocasync-slider-height: 0.375rem;
|
|
68
|
-
--vocasync-slider-thumb-size: 1rem;
|
|
69
|
-
--vocasync-slider-radius: 9999px;
|
|
70
|
-
|
|
71
|
-
/* Mini player */
|
|
72
|
-
--vocasync-mini-height: 3.5rem;
|
|
73
|
-
--vocasync-mini-offset: 1rem;
|
|
74
|
-
|
|
75
|
-
/* ========================================
|
|
76
|
-
* SHADOWS & EFFECTS
|
|
77
|
-
* ======================================== */
|
|
78
|
-
|
|
79
|
-
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
80
|
-
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
81
|
-
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
82
|
-
|
|
83
|
-
/* ========================================
|
|
84
|
-
* TRANSITIONS
|
|
85
|
-
* ======================================== */
|
|
86
|
-
|
|
87
|
-
--vocasync-transition-fast: 150ms ease;
|
|
88
|
-
--vocasync-transition: 200ms ease;
|
|
89
|
-
--vocasync-transition-slow: 300ms ease;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* ========================================
|
|
93
|
-
* DARK MODE
|
|
94
|
-
* ======================================== */
|
|
95
|
-
|
|
96
|
-
@media (prefers-color-scheme: dark) {
|
|
97
|
-
:root {
|
|
98
|
-
--vocasync-primary: #60a5fa;
|
|
99
|
-
--vocasync-primary-hover: #3b82f6;
|
|
100
|
-
--vocasync-primary-content: #1e293b;
|
|
101
|
-
|
|
102
|
-
--vocasync-surface: #1e293b;
|
|
103
|
-
--vocasync-surface-elevated: #334155;
|
|
104
|
-
|
|
105
|
-
--vocasync-border: #475569;
|
|
106
|
-
--vocasync-border-focus: #60a5fa;
|
|
107
|
-
|
|
108
|
-
--vocasync-text: #f1f5f9;
|
|
109
|
-
--vocasync-text-muted: #94a3b8;
|
|
110
|
-
--vocasync-text-faint: #64748b;
|
|
111
|
-
|
|
112
|
-
--vocasync-highlight: #34d399;
|
|
113
|
-
--vocasync-highlight-text: #1e293b;
|
|
114
|
-
|
|
115
|
-
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
|
|
116
|
-
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
|
|
117
|
-
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* ========================================
|
|
122
|
-
* WORD HIGHLIGHTING STYLES
|
|
123
|
-
* ======================================== */
|
|
124
|
-
|
|
125
|
-
.vocasync-word {
|
|
126
|
-
transition: background-color var(--vocasync-transition-fast), color
|
|
127
|
-
var(--vocasync-transition-fast);
|
|
128
|
-
border-radius: 0.125rem;
|
|
129
|
-
padding: 0 0.0625rem;
|
|
130
|
-
margin: 0 -0.0625rem;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.vocasync-word.is-active {
|
|
134
|
-
background-color: color-mix(
|
|
135
|
-
in oklch,
|
|
136
|
-
var(--vocasync-highlight) calc(var(--vocasync-highlight-active-opacity) * 100%),
|
|
137
|
-
transparent
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* Trail effect for previous words - fading gradient */
|
|
142
|
-
.vocasync-word.is-trail {
|
|
143
|
-
background-color: color-mix(
|
|
144
|
-
in oklch,
|
|
145
|
-
var(--vocasync-highlight) calc(var(--vocasync-highlight-trail-opacity) * 100%),
|
|
146
|
-
transparent
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* ========================================
|
|
151
|
-
* MATH SPEECH (hidden visually, accessible to highlighter)
|
|
152
|
-
* ======================================== */
|
|
153
|
-
|
|
154
|
-
.vocasync-math-speech {
|
|
155
|
-
position: absolute;
|
|
156
|
-
width: 1px;
|
|
157
|
-
height: 1px;
|
|
158
|
-
padding: 0;
|
|
159
|
-
margin: -1px;
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
clip: rect(0, 0, 0, 0);
|
|
162
|
-
white-space: nowrap;
|
|
163
|
-
border: 0;
|
|
164
|
-
}
|
package/src/styles/variables.css
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VocaSync AudioPlayer CSS Variables
|
|
3
|
-
*
|
|
4
|
-
* Import this file and override variables to customize the player appearance.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```css
|
|
8
|
-
* @import "@vocasync/astro/styles/variables.css";
|
|
9
|
-
*
|
|
10
|
-
* :root {
|
|
11
|
-
* --vocasync-primary: #8b5cf6;
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
:root {
|
|
17
|
-
/* ========================================
|
|
18
|
-
* COLOR PALETTE
|
|
19
|
-
* ======================================== */
|
|
20
|
-
|
|
21
|
-
/* Primary brand color - used for buttons, progress bar, active states */
|
|
22
|
-
--vocasync-primary: #3b82f6;
|
|
23
|
-
--vocasync-primary-hover: #2563eb;
|
|
24
|
-
--vocasync-primary-content: #ffffff;
|
|
25
|
-
|
|
26
|
-
/* Surface colors - backgrounds and cards */
|
|
27
|
-
--vocasync-surface: #f8fafc;
|
|
28
|
-
--vocasync-surface-elevated: #ffffff;
|
|
29
|
-
|
|
30
|
-
/* Border colors */
|
|
31
|
-
--vocasync-border: #e2e8f0;
|
|
32
|
-
--vocasync-border-focus: #3b82f6;
|
|
33
|
-
|
|
34
|
-
/* Text colors */
|
|
35
|
-
--vocasync-text: #1e293b;
|
|
36
|
-
--vocasync-text-muted: #64748b;
|
|
37
|
-
--vocasync-text-faint: #94a3b8;
|
|
38
|
-
|
|
39
|
-
/* ========================================
|
|
40
|
-
* WORD HIGHLIGHTING
|
|
41
|
-
* ======================================== */
|
|
42
|
-
|
|
43
|
-
/* Color for the currently spoken word */
|
|
44
|
-
--vocasync-highlight: #10b981;
|
|
45
|
-
--vocasync-highlight-text: #ffffff;
|
|
46
|
-
|
|
47
|
-
/* Opacity for active word background */
|
|
48
|
-
--vocasync-highlight-active-opacity: 0.25;
|
|
49
|
-
|
|
50
|
-
/* Opacity for trailing words (creates a "wake" effect) */
|
|
51
|
-
--vocasync-highlight-trail-opacity: 0.12;
|
|
52
|
-
|
|
53
|
-
/* ========================================
|
|
54
|
-
* SIZING & SPACING
|
|
55
|
-
* ======================================== */
|
|
56
|
-
|
|
57
|
-
/* Player dimensions */
|
|
58
|
-
--vocasync-player-radius: 0.75rem;
|
|
59
|
-
--vocasync-player-padding: 1rem;
|
|
60
|
-
--vocasync-player-gap: 0.75rem;
|
|
61
|
-
|
|
62
|
-
/* Button sizes */
|
|
63
|
-
--vocasync-button-size: 2.5rem;
|
|
64
|
-
--vocasync-button-radius: 9999px;
|
|
65
|
-
|
|
66
|
-
/* Slider/range input */
|
|
67
|
-
--vocasync-slider-height: 0.375rem;
|
|
68
|
-
--vocasync-slider-thumb-size: 1rem;
|
|
69
|
-
--vocasync-slider-radius: 9999px;
|
|
70
|
-
|
|
71
|
-
/* Mini player */
|
|
72
|
-
--vocasync-mini-height: 3.5rem;
|
|
73
|
-
--vocasync-mini-offset: 1rem;
|
|
74
|
-
|
|
75
|
-
/* ========================================
|
|
76
|
-
* SHADOWS & EFFECTS
|
|
77
|
-
* ======================================== */
|
|
78
|
-
|
|
79
|
-
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
80
|
-
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
81
|
-
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
82
|
-
|
|
83
|
-
/* ========================================
|
|
84
|
-
* TRANSITIONS
|
|
85
|
-
* ======================================== */
|
|
86
|
-
|
|
87
|
-
--vocasync-transition-fast: 150ms ease;
|
|
88
|
-
--vocasync-transition: 200ms ease;
|
|
89
|
-
--vocasync-transition-slow: 300ms ease;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* ========================================
|
|
93
|
-
* DARK MODE
|
|
94
|
-
* ======================================== */
|
|
95
|
-
|
|
96
|
-
@media (prefers-color-scheme: dark) {
|
|
97
|
-
:root {
|
|
98
|
-
--vocasync-primary: #60a5fa;
|
|
99
|
-
--vocasync-primary-hover: #3b82f6;
|
|
100
|
-
--vocasync-primary-content: #1e293b;
|
|
101
|
-
|
|
102
|
-
--vocasync-surface: #1e293b;
|
|
103
|
-
--vocasync-surface-elevated: #334155;
|
|
104
|
-
|
|
105
|
-
--vocasync-border: #475569;
|
|
106
|
-
--vocasync-border-focus: #60a5fa;
|
|
107
|
-
|
|
108
|
-
--vocasync-text: #f1f5f9;
|
|
109
|
-
--vocasync-text-muted: #94a3b8;
|
|
110
|
-
--vocasync-text-faint: #64748b;
|
|
111
|
-
|
|
112
|
-
--vocasync-highlight: #34d399;
|
|
113
|
-
--vocasync-highlight-text: #1e293b;
|
|
114
|
-
|
|
115
|
-
--vocasync-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
|
|
116
|
-
--vocasync-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
|
|
117
|
-
--vocasync-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* ========================================
|
|
122
|
-
* WORD HIGHLIGHTING STYLES
|
|
123
|
-
* ======================================== */
|
|
124
|
-
|
|
125
|
-
.vocasync-word {
|
|
126
|
-
transition: background-color var(--vocasync-transition-fast), color
|
|
127
|
-
var(--vocasync-transition-fast);
|
|
128
|
-
border-radius: 0.125rem;
|
|
129
|
-
padding: 0 0.0625rem;
|
|
130
|
-
margin: 0 -0.0625rem;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.vocasync-word.is-active {
|
|
134
|
-
background-color: color-mix(
|
|
135
|
-
in oklch,
|
|
136
|
-
var(--vocasync-highlight) calc(var(--vocasync-highlight-active-opacity) * 100%),
|
|
137
|
-
transparent
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/* Trail effect for previous words - fading gradient */
|
|
142
|
-
.vocasync-word.is-trail {
|
|
143
|
-
background-color: color-mix(
|
|
144
|
-
in oklch,
|
|
145
|
-
var(--vocasync-highlight) calc(var(--vocasync-highlight-trail-opacity) * 100%),
|
|
146
|
-
transparent
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/* ========================================
|
|
151
|
-
* MATH SPEECH (hidden visually, accessible to highlighter)
|
|
152
|
-
* ======================================== */
|
|
153
|
-
|
|
154
|
-
.vocasync-math-speech {
|
|
155
|
-
position: absolute;
|
|
156
|
-
width: 1px;
|
|
157
|
-
height: 1px;
|
|
158
|
-
padding: 0;
|
|
159
|
-
margin: -1px;
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
clip: rect(0, 0, 0, 0);
|
|
162
|
-
white-space: nowrap;
|
|
163
|
-
border: 0;
|
|
164
|
-
}
|