@industry-theme/file-city-panel 0.2.80 → 0.3.1

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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Text-to-Speech Adapter Types
3
+ *
4
+ * These types define the interface for TTS functionality in tour players.
5
+ * The host application provides a TTS adapter implementation that handles
6
+ * audio generation, caching, and playback.
7
+ */
8
+ /**
9
+ * Audio event types
10
+ */
11
+ export type TTSEvent = 'ended' | 'error' | 'playing' | 'paused' | 'loading';
12
+ /**
13
+ * Current state of the TTS system
14
+ */
15
+ export interface TTSState {
16
+ /** Whether audio is currently being loaded/generated */
17
+ isLoading: boolean;
18
+ /** Whether audio is currently playing */
19
+ isPlaying: boolean;
20
+ /** Whether audio is paused */
21
+ isPaused: boolean;
22
+ /** Current error, if any */
23
+ error: Error | null;
24
+ /** Playback progress (0-100) */
25
+ progress?: number;
26
+ /** Total duration in seconds */
27
+ duration?: number;
28
+ /** Current playback time in seconds */
29
+ currentTime?: number;
30
+ }
31
+ /**
32
+ * Options for TTS generation and playback
33
+ */
34
+ export interface TTSOptions {
35
+ /** Voice identifier (e.g., ElevenLabs voice ID) */
36
+ voice?: string;
37
+ /** Speech speed multiplier (0.5 - 2.0) */
38
+ speed?: number;
39
+ /** Pitch adjustment (if supported by TTS provider) */
40
+ pitch?: number;
41
+ }
42
+ /**
43
+ * Context information for fetching tour audio
44
+ * This is used to identify the tour file in version control
45
+ */
46
+ export interface TourAudioContext {
47
+ /** Repository owner (e.g., "anthropics") */
48
+ owner: string;
49
+ /** Repository name (e.g., "web-ade") */
50
+ repo: string;
51
+ /** Path to tour file in repo (e.g., "docs/tours/intro.tour.json") */
52
+ path: string;
53
+ /** Git commit SHA to ensure cache invalidation on changes */
54
+ commitSha: string;
55
+ }
56
+ /**
57
+ * Text-to-Speech Adapter Interface
58
+ *
59
+ * Host applications implement this interface to provide TTS functionality.
60
+ * The adapter handles audio generation, caching (e.g., S3), and playback.
61
+ *
62
+ * Security: The adapter should NOT accept arbitrary text. Instead, it should
63
+ * fetch tour content from a trusted source (e.g., GitHub) using the context
64
+ * information provided.
65
+ */
66
+ export interface TextToSpeechAdapter {
67
+ /**
68
+ * Fetch audio URLs for all steps in a tour
69
+ * This is called when the tour loads to ensure audio is available
70
+ *
71
+ * @param tourId - Unique identifier for the tour
72
+ * @param stepIds - Array of step IDs to fetch audio for
73
+ * @param context - Repository and file context
74
+ * @param options - Voice and playback options
75
+ * @returns Map of stepId -> audio URL
76
+ */
77
+ fetchTourAudio(tourId: string, stepIds: string[], context: TourAudioContext, options?: TTSOptions): Promise<Map<string, string>>;
78
+ /**
79
+ * Play audio for a specific step
80
+ *
81
+ * @param stepId - The step ID to play audio for
82
+ * @throws Error if audio URL not found (fetchTourAudio must be called first)
83
+ */
84
+ speak(stepId: string): Promise<void>;
85
+ /**
86
+ * Stop current audio playback and reset position
87
+ */
88
+ stop(): void;
89
+ /**
90
+ * Pause current audio playback (preserves position)
91
+ */
92
+ pause(): void;
93
+ /**
94
+ * Resume paused audio playback
95
+ */
96
+ resume(): void;
97
+ /**
98
+ * Current state of the TTS system
99
+ */
100
+ readonly state: TTSState;
101
+ /**
102
+ * Subscribe to TTS events
103
+ *
104
+ * @param event - Event type to listen for
105
+ * @param handler - Callback function
106
+ */
107
+ addEventListener(event: TTSEvent, handler: () => void): void;
108
+ /**
109
+ * Unsubscribe from TTS events
110
+ *
111
+ * @param event - Event type to stop listening for
112
+ * @param handler - Callback function to remove
113
+ */
114
+ removeEventListener(event: TTSEvent, handler: () => void): void;
115
+ }
116
+ //# sourceMappingURL=TextToSpeech.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextToSpeech.d.ts","sourceRoot":"","sources":["../../src/types/TextToSpeech.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG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AK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAEzB;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAE7D;;;;;OAKG;IACH,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACjE"}
@@ -6,4 +6,5 @@
6
6
  export type { DataSlice, WorkspaceMetadata, RepositoryMetadata, FileTreeSource, ActiveFileSlice, PanelEventType, PanelEvent, PanelEventEmitter, PanelActions, PanelContextValue, PanelComponentProps, PanelMetadata, PanelLifecycleHooks, PanelDefinition, PanelModule, PanelRegistryEntry, PanelLoader, PanelRegistryConfig, } from '@principal-ade/panel-framework-core';
7
7
  export type { FileCityColorModesSliceData, QualitySliceData, ColorMode, ColorModeConfig, FileMetricData, HighlightLayer, } from '../panels/utils/qualityLayers';
8
8
  export type { IntroductionTour, IntroductionTourStep, HighlightLayerConfig, InteractiveAction, TourResource, } from './IntroductionTour';
9
+ export type { TextToSpeechAdapter, TTSState, TTSOptions, TTSEvent, TourAudioContext, } from './TextToSpeech';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAEV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EAGf,cAAc,EACd,UAAU,EACV,iBAAiB,EAGjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EAGnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,WAAW,EAGX,kBAAkB,EAClB,WAAW,EACX,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAG7C,YAAY,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,+BAA+B,CAAC;AAGvC,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAEV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EAGf,cAAc,EACd,UAAU,EACV,iBAAiB,EAGjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EAGnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,WAAW,EAGX,kBAAkB,EAClB,WAAW,EACX,mBAAmB,GACpB,MAAM,qCAAqC,CAAC;AAG7C,YAAY,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,+BAA+B,CAAC;AAGvC,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@industry-theme/file-city-panel",
3
- "version": "0.2.80",
3
+ "version": "0.3.1",
4
4
  "description": "File City visualization panel extension for @principal-ade/panel-framework-core",
5
5
  "type": "module",
6
6
  "main": "dist/panels.bundle.js",