@lincyaw/kernel 1.0.0-rc.83 → 1.0.0-rc.85
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/package.json
CHANGED
|
@@ -163,6 +163,8 @@ export interface StepProduction {
|
|
|
163
163
|
narrationStart?: 'with-animation' | 'after-animation'
|
|
164
164
|
minimumHoldMs?: number
|
|
165
165
|
trailingPauseMs?: number
|
|
166
|
+
/** Show captions without changing the narration, voiceover or timing; inherited, default true. */
|
|
167
|
+
captionVisible?: boolean
|
|
166
168
|
voiceSource?: VoiceSource
|
|
167
169
|
}
|
|
168
170
|
export interface ProductionDefaults extends StepProduction {}
|
|
@@ -18,6 +18,8 @@ export function captionSourceFingerprint(document: TeachingDocument, stepId: str
|
|
|
18
18
|
const step = document.steps[stepId]
|
|
19
19
|
if (!step) throw new DocumentCaptionTimingError(404, 'caption-step-missing')
|
|
20
20
|
const timing = { ...document.production.defaults, ...document.production.sectionOverrides?.[step.sectionId], ...document.production.stepOverrides[stepId] }
|
|
21
|
+
// Visibility changes neither text nor alignment; restoring captions reuses the same reviewed map.
|
|
22
|
+
delete timing.captionVisible
|
|
21
23
|
return fnv1a64(JSON.stringify({ document: document.id, stepId, sectionId: step.sectionId, lang: document.metadata.lang, timing,
|
|
22
24
|
narrations: step.narrationIds.map(id => ({ id, content: document.narrations[id]?.content,
|
|
23
25
|
start: document.production.stepOverrides[stepId]?.narrationStart ?? document.production.narrationOverrides?.[id]?.narrationStart ?? timing.narrationStart })),
|
package/src/document-schema.ts
CHANGED
|
@@ -74,7 +74,7 @@ export const DOCUMENT_JSON_SCHEMA: Schema = {
|
|
|
74
74
|
State: object({ id, title: string, parameterSchema: ref('JsonSchema'), legacyIndex: integer }, ['id']),
|
|
75
75
|
Definition: object({ id, kind: { type: 'string', minLength: 1 }, schemaVersion: { type: 'integer', minimum: 1 }, implementation: ref('Implementation'), parameterSchema: ref('JsonSchema'), states: list(ref('State')), data: ref('JsonObject') }, ['id', 'kind', 'schemaVersion', 'implementation', 'parameterSchema', 'states']),
|
|
76
76
|
VoiceSource: { oneOf: [object({ type: tag('none') }), object({ type: tag('tts'), voice: object({ voice: { type: 'string', minLength: 1 }, engine: string, rate: positive, style: string }, ['voice']) }), object({ type: tag('recording'), assetId: id, sourceRange: object({ startMs: nonnegative, endMs: nonnegative }) }, ['type', 'assetId'])] },
|
|
77
|
-
StepProduction: object({ narrationStart: { enum: ['with-animation', 'after-animation'] }, minimumHoldMs: nonnegative, trailingPauseMs: nonnegative, voiceSource: ref('VoiceSource') }, []),
|
|
77
|
+
StepProduction: object({ narrationStart: { enum: ['with-animation', 'after-animation'] }, minimumHoldMs: nonnegative, trailingPauseMs: nonnegative, captionVisible: { type: 'boolean' }, voiceSource: ref('VoiceSource') }, []),
|
|
78
78
|
MediaClip: object({ id, assetId: id, sourceRange: object({ startMs: nonnegative, endMs: nonnegative }), attachment: object({ stepId: id, offsetMs: nonnegative }), volume: { type: 'number', minimum: 0, maximum: 1 }, muted: { type: 'boolean' } }, ['id', 'assetId', 'sourceRange', 'attachment', 'volume']),
|
|
79
79
|
CaptionTiming: object({ narrationIds: ids, sourceFingerprint: { type: 'string', pattern: '^[a-f0-9]{16}$' }, playbackFingerprint: { type: 'string', pattern: '^[a-f0-9]{16}$' }, durationMs: { type: 'integer', minimum: 1 }, segments: { type: 'array', minItems: 1, maxItems: 32, items: object({ id, from: integer, to: integer, startMs: integer, endMs: integer }) } }),
|
|
80
80
|
Production: object({ defaults: ref('StepProduction'), sectionOverrides: record(ref('StepProduction')), stepOverrides: record(ref('StepProduction')), narrationOverrides: record(object({ narrationStart: { enum: ['with-animation', 'after-animation'] } })), cueTimings: record(object({ pauseMs: nonnegative })), captionTimings: record(ref('CaptionTiming')), captions: object({ scale: { type: 'number', minimum: CAPTION_SCALE_MIN, maximum: CAPTION_SCALE_MAX } }), mediaClips: list(ref('MediaClip')) }, ['defaults', 'stepOverrides', 'mediaClips']),
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { applyDocumentComponentAction, effectiveComponentParameters, createDocum
|
|
|
15
15
|
export type { DocumentStepVoice, DocumentVoiceImpact, DocumentVoiceOptions, DocumentVoiceScope } from './document-voices.ts'
|
|
16
16
|
export { prepareTranscriptionAdoption } from './transcription-adoption.ts'
|
|
17
17
|
export { productionAssetIds, recordingStepIssue, recordingSourceRange } from './recording.ts'
|
|
18
|
+
export { stepCaptionsVisible } from './production-captions.ts'
|
|
18
19
|
export * from './ir.ts'
|
|
19
20
|
export { createAnchorResolverRegistry, isRenderable, parseAnchor } from './anchors.ts'
|
|
20
21
|
export type { ParsedAnchor } from './anchors.ts'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Production } from './contracts/document.ts'
|
|
2
|
+
|
|
3
|
+
/** Caption visibility inherits independently of voice choice and timing. */
|
|
4
|
+
export function stepCaptionsVisible(production: Production | undefined, sectionId: string, stepId?: string): boolean {
|
|
5
|
+
return (stepId ? production?.stepOverrides[stepId]?.captionVisible : undefined)
|
|
6
|
+
?? production?.sectionOverrides?.[sectionId]?.captionVisible
|
|
7
|
+
?? production?.defaults.captionVisible
|
|
8
|
+
?? true
|
|
9
|
+
}
|