@vocasync/astro 0.1.8 → 0.1.9

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 CHANGED
@@ -115,14 +115,16 @@ In your article layout or page:
115
115
  ```astro
116
116
  ---
117
117
  // src/layouts/ArticleLayout.astro
118
- import { AudioPlayer } from "@vocasync/astro/components";
118
+ import AudioPlayer from "@vocasync/astro/components/AudioPlayer.astro";
119
+ import audioMap from "../data/audio-map.json";
119
120
 
120
121
  const { post } = Astro.props;
122
+ const audioEntry = audioMap.entries[post.slug];
121
123
  ---
122
124
 
123
125
  <article>
124
126
  <!-- Audio player at the top -->
125
- <AudioPlayer slug={post.slug} label="Listen to this post" />
127
+ <AudioPlayer slug={post.slug} audioEntry={audioEntry} label="Listen to this post" />
126
128
 
127
129
  <!-- Article content - must have data-article-body for word highlighting -->
128
130
  <div data-article-body>
@@ -257,7 +259,7 @@ The main audio player component with word highlighting support.
257
259
 
258
260
  ```astro
259
261
  ---
260
- import { AudioPlayer } from "@vocasync/astro/components";
262
+ import AudioPlayer from "@vocasync/astro/components/AudioPlayer.astro";
261
263
  ---
262
264
 
263
265
  <AudioPlayer
@@ -276,7 +278,8 @@ import { AudioPlayer } from "@vocasync/astro/components";
276
278
  | Prop | Type | Default | Description |
277
279
  |------|------|---------|-------------|
278
280
  | `slug` | `string` | required | Post slug to lookup audio |
279
- | `label` | `string` | `"Listen to this post"` | Accessible label |
281
+ | `audioEntry` | `object` | `undefined` | Audio entry from audio-map.json (audioUrl, publishableKey, etc.) |
282
+ | `label` | `string` | `"Listen to this article"` | Accessible label |
280
283
  | `showPlaceholder` | `boolean` | `true` | Show message when no audio |
281
284
  | `class` | `string` | `""` | Additional CSS classes |
282
285
  | `articleSelector` | `string` | `"[data-article-body]"` | Selector for word highlighting container |
@@ -343,10 +346,10 @@ VocaSync supports LaTeX math equations using [Speech Rule Engine](https://github
343
346
 
344
347
  ### Installation
345
348
 
346
- Install the optional dependency:
349
+ Install the optional peer dependencies:
347
350
 
348
351
  ```bash
349
- npm install latex-to-speech
352
+ npm install speech-rule-engine mathjax-full
350
353
  ```
351
354
 
352
355
  ### Setup
@@ -1,6 +1,18 @@
1
1
  export interface AudioPlayerProps {
2
2
  /** Post slug to lookup audio in audio-map */
3
3
  slug: string;
4
+ /** Audio entry data from audio-map.json */
5
+ audioEntry?: {
6
+ audioUrl: string;
7
+ alignmentUrl?: string;
8
+ words?: {
9
+ word: string;
10
+ start: number;
11
+ end: number;
12
+ }[];
13
+ duration?: number;
14
+ publishableKey?: string;
15
+ };
4
16
  /** Accessible label for the player */
5
17
  label?: string;
6
18
  /** Show placeholder when no audio available */
@@ -13,6 +25,8 @@ export interface AudioPlayerProps {
13
25
  enableMiniPlayer?: boolean;
14
26
  /** Enable word highlighting during playback */
15
27
  enableHighlighting?: boolean;
28
+ /** Enable click on words to seek to that position */
29
+ enableClickToSeek?: boolean;
16
30
  /** Number of trailing highlighted words */
17
31
  trailLength?: number;
18
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,UAAU,CAAC,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocasync/astro",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "VocaSync integration for Astro - Text-to-speech synthesis and word-level alignment for static sites",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -7,6 +7,14 @@
7
7
  export interface AudioPlayerProps {
8
8
  /** Post slug to lookup audio in audio-map */
9
9
  slug: string;
10
+ /** Audio entry data from audio-map.json */
11
+ audioEntry?: {
12
+ audioUrl: string;
13
+ alignmentUrl?: string;
14
+ words?: { word: string; start: number; end: number }[];
15
+ duration?: number;
16
+ publishableKey?: string;
17
+ };
10
18
  /** Accessible label for the player */
11
19
  label?: string;
12
20
  /** Show placeholder when no audio available */
@@ -19,6 +27,8 @@ export interface AudioPlayerProps {
19
27
  enableMiniPlayer?: boolean;
20
28
  /** Enable word highlighting during playback */
21
29
  enableHighlighting?: boolean;
30
+ /** Enable click on words to seek to that position */
31
+ enableClickToSeek?: boolean;
22
32
  /** Number of trailing highlighted words */
23
33
  trailLength?: number;
24
34
  }