@industry-theme/file-city-panel 0.3.0 → 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.
package/dist/index.d.ts
CHANGED
|
@@ -45,12 +45,14 @@ export type { PrFilesStatus, PrChangeSelectionStatus } from './panels/components
|
|
|
45
45
|
export { StoryboardFilesCardList } from './panels/components/StoryboardFilesCardList';
|
|
46
46
|
export type { StoryboardFileCategory } from './panels/components/StoryboardFilesCardList';
|
|
47
47
|
/**
|
|
48
|
-
* Export TTS (Text-to-Speech) components and
|
|
48
|
+
* Export TTS (Text-to-Speech) components and types for tour narration.
|
|
49
|
+
*
|
|
50
|
+
* Note: The panel defines the TextToSpeechAdapter interface but does NOT
|
|
51
|
+
* provide a production implementation. Host applications must implement
|
|
52
|
+
* the adapter to handle API calls with proper credentials.
|
|
49
53
|
*/
|
|
50
54
|
export { TourPlayer } from './components/TourPlayer';
|
|
51
55
|
export type { TourPlayerProps } from './components/TourPlayer';
|
|
52
|
-
export { S3BackedTTSAdapter } from './adapters/S3BackedTTSAdapter';
|
|
53
|
-
export type { S3BackedTTSAdapterConfig } from './adapters/S3BackedTTSAdapter';
|
|
54
56
|
export { MockTTSAdapter } from './mocks/MockTTSAdapter';
|
|
55
57
|
export type { MockTTSAdapterConfig } from './mocks/MockTTSAdapter';
|
|
56
58
|
export type { TextToSpeechAdapter, TTSState, TTSOptions, TTSEvent, TourAudioContext, } from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,EAyEnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe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pG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAE1F;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,YAAY,EACV,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -56320,202 +56320,6 @@ const ProjectInfoHeader = ({
|
|
|
56320
56320
|
}
|
|
56321
56321
|
);
|
|
56322
56322
|
};
|
|
56323
|
-
class S3BackedTTSAdapter {
|
|
56324
|
-
constructor(config) {
|
|
56325
|
-
this.audioCache = /* @__PURE__ */ new Map();
|
|
56326
|
-
this.audio = null;
|
|
56327
|
-
this.eventTarget = new EventTarget();
|
|
56328
|
-
this._state = {
|
|
56329
|
-
isLoading: false,
|
|
56330
|
-
isPlaying: false,
|
|
56331
|
-
isPaused: false,
|
|
56332
|
-
error: null
|
|
56333
|
-
};
|
|
56334
|
-
this.apiBaseUrl = config.apiBaseUrl.replace(/\/$/, "");
|
|
56335
|
-
this.fetchImpl = config.fetchImpl || fetch.bind(window);
|
|
56336
|
-
}
|
|
56337
|
-
get state() {
|
|
56338
|
-
return { ...this._state };
|
|
56339
|
-
}
|
|
56340
|
-
setState(updates) {
|
|
56341
|
-
this._state = { ...this._state, ...updates };
|
|
56342
|
-
}
|
|
56343
|
-
/**
|
|
56344
|
-
* Fetch audio URLs for all steps in a tour
|
|
56345
|
-
*/
|
|
56346
|
-
async fetchTourAudio(tourId, stepIds, context, options) {
|
|
56347
|
-
this.setState({ isLoading: true, error: null });
|
|
56348
|
-
this.emit("loading");
|
|
56349
|
-
try {
|
|
56350
|
-
const response = await this.fetchImpl(`${this.apiBaseUrl}/api/tts/batch-generate`, {
|
|
56351
|
-
method: "POST",
|
|
56352
|
-
headers: {
|
|
56353
|
-
"Content-Type": "application/json"
|
|
56354
|
-
},
|
|
56355
|
-
body: JSON.stringify({
|
|
56356
|
-
owner: context.owner,
|
|
56357
|
-
repo: context.repo,
|
|
56358
|
-
path: context.path,
|
|
56359
|
-
commitSha: context.commitSha,
|
|
56360
|
-
voice: options == null ? void 0 : options.voice,
|
|
56361
|
-
speed: options == null ? void 0 : options.speed
|
|
56362
|
-
})
|
|
56363
|
-
});
|
|
56364
|
-
if (!response.ok) {
|
|
56365
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
56366
|
-
throw new Error(error.message || `API error: ${response.statusText}`);
|
|
56367
|
-
}
|
|
56368
|
-
const data = await response.json();
|
|
56369
|
-
this.audioCache.clear();
|
|
56370
|
-
for (const step of data.steps) {
|
|
56371
|
-
if (step.status === "ready" || step.status === void 0) {
|
|
56372
|
-
this.audioCache.set(step.stepId, step.audioUrl);
|
|
56373
|
-
}
|
|
56374
|
-
}
|
|
56375
|
-
this.setState({ isLoading: false });
|
|
56376
|
-
console.log(
|
|
56377
|
-
`[TTS] Loaded ${this.audioCache.size}/${data.totalSteps} audio files (${data.cachedSteps} cached, ${data.generatingSteps} generating)`
|
|
56378
|
-
);
|
|
56379
|
-
return new Map(this.audioCache);
|
|
56380
|
-
} catch (error) {
|
|
56381
|
-
const err = error instanceof Error ? error : new Error("Failed to fetch tour audio");
|
|
56382
|
-
this.setState({ isLoading: false, error: err });
|
|
56383
|
-
this.emit("error");
|
|
56384
|
-
throw err;
|
|
56385
|
-
}
|
|
56386
|
-
}
|
|
56387
|
-
/**
|
|
56388
|
-
* Play audio for a specific step
|
|
56389
|
-
*/
|
|
56390
|
-
async speak(stepId) {
|
|
56391
|
-
const audioUrl = this.audioCache.get(stepId);
|
|
56392
|
-
if (!audioUrl) {
|
|
56393
|
-
const error = new Error(
|
|
56394
|
-
`No audio URL for step: ${stepId}. Call fetchTourAudio first.`
|
|
56395
|
-
);
|
|
56396
|
-
this.setState({ error });
|
|
56397
|
-
this.emit("error");
|
|
56398
|
-
throw error;
|
|
56399
|
-
}
|
|
56400
|
-
this.stop();
|
|
56401
|
-
try {
|
|
56402
|
-
await this.playAudio(audioUrl);
|
|
56403
|
-
} catch (error) {
|
|
56404
|
-
const err = error instanceof Error ? error : new Error("Audio playback failed");
|
|
56405
|
-
this.setState({ error: err, isPlaying: false });
|
|
56406
|
-
this.emit("error");
|
|
56407
|
-
throw err;
|
|
56408
|
-
}
|
|
56409
|
-
}
|
|
56410
|
-
/**
|
|
56411
|
-
* Play audio from URL
|
|
56412
|
-
*/
|
|
56413
|
-
async playAudio(url) {
|
|
56414
|
-
this.audio = new Audio(url);
|
|
56415
|
-
this.setState({ isPlaying: true, isPaused: false, error: null });
|
|
56416
|
-
this.audio.addEventListener("loadedmetadata", () => {
|
|
56417
|
-
if (this.audio) {
|
|
56418
|
-
this.setState({
|
|
56419
|
-
duration: this.audio.duration,
|
|
56420
|
-
currentTime: 0,
|
|
56421
|
-
progress: 0
|
|
56422
|
-
});
|
|
56423
|
-
}
|
|
56424
|
-
});
|
|
56425
|
-
this.audio.addEventListener("timeupdate", () => {
|
|
56426
|
-
if (this.audio && this.audio.duration) {
|
|
56427
|
-
const currentTime = this.audio.currentTime;
|
|
56428
|
-
const progress = currentTime / this.audio.duration * 100;
|
|
56429
|
-
this.setState({ currentTime, progress });
|
|
56430
|
-
}
|
|
56431
|
-
});
|
|
56432
|
-
this.audio.addEventListener("ended", () => {
|
|
56433
|
-
this.setState({
|
|
56434
|
-
isPlaying: false,
|
|
56435
|
-
isPaused: false,
|
|
56436
|
-
currentTime: 0,
|
|
56437
|
-
progress: 0
|
|
56438
|
-
});
|
|
56439
|
-
this.emit("ended");
|
|
56440
|
-
});
|
|
56441
|
-
this.audio.addEventListener("error", () => {
|
|
56442
|
-
const error = new Error("Audio playback failed");
|
|
56443
|
-
this.setState({ isPlaying: false, error });
|
|
56444
|
-
this.emit("error");
|
|
56445
|
-
});
|
|
56446
|
-
this.emit("playing");
|
|
56447
|
-
await this.audio.play();
|
|
56448
|
-
}
|
|
56449
|
-
/**
|
|
56450
|
-
* Stop current audio playback
|
|
56451
|
-
*/
|
|
56452
|
-
stop() {
|
|
56453
|
-
if (this.audio) {
|
|
56454
|
-
this.audio.pause();
|
|
56455
|
-
this.audio.currentTime = 0;
|
|
56456
|
-
this.audio = null;
|
|
56457
|
-
}
|
|
56458
|
-
this.setState({
|
|
56459
|
-
isPlaying: false,
|
|
56460
|
-
isPaused: false,
|
|
56461
|
-
currentTime: 0,
|
|
56462
|
-
progress: 0
|
|
56463
|
-
});
|
|
56464
|
-
}
|
|
56465
|
-
/**
|
|
56466
|
-
* Pause current audio playback
|
|
56467
|
-
*/
|
|
56468
|
-
pause() {
|
|
56469
|
-
if (this.audio && !this.audio.paused) {
|
|
56470
|
-
this.audio.pause();
|
|
56471
|
-
this.setState({ isPlaying: false, isPaused: true });
|
|
56472
|
-
this.emit("paused");
|
|
56473
|
-
}
|
|
56474
|
-
}
|
|
56475
|
-
/**
|
|
56476
|
-
* Resume paused audio playback
|
|
56477
|
-
*/
|
|
56478
|
-
resume() {
|
|
56479
|
-
if (this.audio && this.audio.paused) {
|
|
56480
|
-
this.audio.play();
|
|
56481
|
-
this.setState({ isPlaying: true, isPaused: false });
|
|
56482
|
-
this.emit("playing");
|
|
56483
|
-
}
|
|
56484
|
-
}
|
|
56485
|
-
/**
|
|
56486
|
-
* Subscribe to TTS events
|
|
56487
|
-
*/
|
|
56488
|
-
addEventListener(event, handler) {
|
|
56489
|
-
this.eventTarget.addEventListener(event, handler);
|
|
56490
|
-
}
|
|
56491
|
-
/**
|
|
56492
|
-
* Unsubscribe from TTS events
|
|
56493
|
-
*/
|
|
56494
|
-
removeEventListener(event, handler) {
|
|
56495
|
-
this.eventTarget.removeEventListener(event, handler);
|
|
56496
|
-
}
|
|
56497
|
-
/**
|
|
56498
|
-
* Emit an event
|
|
56499
|
-
*/
|
|
56500
|
-
emit(event) {
|
|
56501
|
-
this.eventTarget.dispatchEvent(new Event(event));
|
|
56502
|
-
}
|
|
56503
|
-
/**
|
|
56504
|
-
* Clear all cached audio URLs
|
|
56505
|
-
*/
|
|
56506
|
-
clearCache() {
|
|
56507
|
-
this.audioCache.clear();
|
|
56508
|
-
}
|
|
56509
|
-
/**
|
|
56510
|
-
* Get cache statistics (for debugging)
|
|
56511
|
-
*/
|
|
56512
|
-
getCacheStats() {
|
|
56513
|
-
return {
|
|
56514
|
-
size: this.audioCache.size,
|
|
56515
|
-
entries: Array.from(this.audioCache.keys())
|
|
56516
|
-
};
|
|
56517
|
-
}
|
|
56518
|
-
}
|
|
56519
56323
|
class MockTTSAdapter {
|
|
56520
56324
|
constructor(config = {}) {
|
|
56521
56325
|
this.audioCache = /* @__PURE__ */ new Map();
|
|
@@ -56803,7 +56607,6 @@ export {
|
|
|
56803
56607
|
PrChangesCardList,
|
|
56804
56608
|
ProjectInfoHeader,
|
|
56805
56609
|
QUALITY_COLOR_MODES,
|
|
56806
|
-
S3BackedTTSAdapter,
|
|
56807
56610
|
StoryboardFilesCardList,
|
|
56808
56611
|
TourPlayer,
|
|
56809
56612
|
codeCityPanelTools,
|