@mengine/medeo-client 2.1.1-dsl.7 → 2.1.1-dsl.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.
@@ -53,8 +53,14 @@ type Media = MediaLocator & ({
53
53
  kind: 'image';
54
54
  storageKey?: string;
55
55
  });
56
+ /** One segment of a script: its own text, and the id a Caption or PhoneticScript names it by. */
57
+ interface AudioScriptSegment {
58
+ id: string;
59
+ text: string;
60
+ }
61
+ /** A script is segmented text: its segments in order (D181). */
56
62
  interface AudioScript {
57
- body: string;
63
+ segments: AudioScriptSegment[];
58
64
  defaultLanguage?: string;
59
65
  }
60
66
  interface CaptionStyle$1 {
@@ -72,22 +78,27 @@ interface CaptionStyle$1 {
72
78
  positionX?: number;
73
79
  positionY?: number;
74
80
  }
75
- /** A run of a script's body a Caption reads its words from. One value: script and range move together. */
76
- interface CaptionContent {
81
+ /**
82
+ * What a Caption shows or a PhoneticScript is written for: one segment of a script, or a run inside
83
+ * it (D181). The run's ends are Cursors on that segment's Text, so they follow its edits; without
84
+ * them the whole segment is meant, whatever it comes to say. One value: taken or replaced whole.
85
+ */
86
+ interface SegmentSelection {
77
87
  audioScriptId: string;
78
- start: Cursor;
79
- end: Cursor;
88
+ segmentId: string;
89
+ start?: Cursor;
90
+ end?: Cursor;
80
91
  }
92
+ type CaptionContent = SegmentSelection;
81
93
  /** Words come from a selected run of a script or from the Caption's own text, never both. */
82
94
  interface Caption {
83
95
  selection?: CaptionContent;
84
96
  text?: string;
85
97
  style?: CaptionStyle$1;
86
98
  }
87
- /** A phonetic script's base script and the pronunciation written for it, taken or replaced together. */
88
- interface Phoneme {
89
- audioScriptId: string;
90
- /** One whole script in the target TTS vocabulary, such as a `<speak>` document. */
99
+ /** The segment a PhoneticScript is written for, selected as a Caption selects one, and its pronunciation. */
100
+ interface Phoneme extends SegmentSelection {
101
+ /** What the voice synthesizes for that selection, written in what the voice accepts. */
91
102
  phonemeScript?: string;
92
103
  }
93
104
  /** A file Memota stored from raw content: how a Media File entity names it, and its digest. */
@@ -98,7 +109,7 @@ interface StoredFile {
98
109
  digest: string;
99
110
  }
100
111
  /**
101
- * A variant of an AudioScript: the script it reads, plus how to pronounce it. It has the Media File
112
+ * A variant of an AudioScript: the segment it is written for, plus what to synthesize. It has the Media File
102
113
  * trait (D178): its `phonemeScript` is raw content, stored in Memota as a text file whenever it is
103
114
  * written, and the file's facts are kept beside it. Without a `phonemeScript` it has no file.
104
115
  */
@@ -137,6 +148,12 @@ interface RelationValues {
137
148
  sourceDigest?: string;
138
149
  };
139
150
  }
151
+ /** What a create states: a PhoneticScript's phoneme may follow by set-phoneme in the same write. */
152
+ type EntityInput = Omit<EntityValues, 'phonetic-script-entities'> & {
153
+ 'phonetic-script-entities': Omit<PhoneticScript, 'phoneme'> & {
154
+ phoneme?: Phoneme;
155
+ };
156
+ };
140
157
  type EntityTable = keyof EntityValues;
141
158
  type RelationTable = keyof RelationValues;
142
159
  type EntityTables = { [K in EntityTable]: Record<string, EntityValues[K]> };
@@ -146,7 +163,7 @@ type EntityMutation = { [K in EntityTable]: {
146
163
  type: 'create-entity';
147
164
  table: K;
148
165
  id: string;
149
- value: EntityValues[K];
166
+ value: EntityInput[K];
150
167
  } | {
151
168
  type: 'patch-entity';
152
169
  table: K;
@@ -180,12 +197,37 @@ type ContainMutation = {
180
197
  type: 'delete-node';
181
198
  entityId: string;
182
199
  };
183
- interface CaptionSelection {
184
- captionId: string;
200
+ /** A segment, or a run of it in UTF-16 offsets of its current text, as a write states it. */
201
+ interface SegmentRange {
185
202
  audioScriptId: string;
186
- start: number;
187
- end: number;
203
+ segmentId: string;
204
+ start?: number;
205
+ end?: number;
206
+ }
207
+ interface CaptionSelection extends SegmentRange {
208
+ captionId: string;
188
209
  }
210
+ interface PhonemeSelection extends SegmentRange {
211
+ phoneticScriptId: string;
212
+ phonemeScript?: string;
213
+ }
214
+ /** A script's segments are added, moved and removed by id; their text is edited in place. */
215
+ type SegmentMutation = {
216
+ type: 'insert-segment';
217
+ audioScriptId: string;
218
+ segmentId: string;
219
+ index?: number;
220
+ text: string;
221
+ } | {
222
+ type: 'move-segment';
223
+ audioScriptId: string;
224
+ segmentId: string;
225
+ index: number;
226
+ } | {
227
+ type: 'delete-segment';
228
+ audioScriptId: string;
229
+ segmentId: string;
230
+ };
189
231
  type TextMutation = {
190
232
  type: 'edit-caption-text';
191
233
  captionId: string;
@@ -194,12 +236,15 @@ type TextMutation = {
194
236
  } | {
195
237
  type: 'edit-text';
196
238
  audioScriptId: string;
239
+ segmentId: string;
197
240
  expectedBodyId?: string;
198
241
  edits: readonly TextEdit[];
199
242
  } | ({
200
243
  type: 'set-caption-content';
201
- } & CaptionSelection);
202
- type DslMutation = EntityMutation | RelationMutation | ContainMutation | TextMutation;
244
+ } & CaptionSelection) | ({
245
+ type: 'set-phoneme';
246
+ } & PhonemeSelection);
247
+ type DslMutation = EntityMutation | RelationMutation | ContainMutation | SegmentMutation | TextMutation;
203
248
  interface ContainNode {
204
249
  treeId: TreeID;
205
250
  entityId: string;
@@ -219,6 +264,7 @@ interface RichTextSnapshot {
219
264
  plainText: string;
220
265
  delta: TextRun[];
221
266
  }
267
+ /** Selected text, with its UTF-16 range in the Text it lies in: the segment's, or a Caption's own. */
222
268
  interface CaptionText {
223
269
  text: string;
224
270
  start: number;
@@ -227,9 +273,10 @@ interface CaptionText {
227
273
  }
228
274
  type DeepReadonly<T> = T extends Cursor ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
229
275
  type MedeoDslSnapshot = DeepReadonly<EntityTables & RelationTables & {
230
- 'contain-relations': ContainNode[];
276
+ 'contain-relations': ContainNode[]; /** A Caption's own text by the Caption's id, and each script segment's text by the segment's id. */
231
277
  richText: Record<string, RichTextSnapshot>;
232
- captionText: Record<string, CaptionText>;
278
+ captionText: Record<string, CaptionText>; /** What each PhoneticScript's selection holds now, resolved as a Caption's is. */
279
+ phoneticText: Record<string, CaptionText>;
233
280
  diagnostics: DslDiagnostic[];
234
281
  }>;
235
282
  type TextMark = 'language';
@@ -270,7 +317,8 @@ type TextDelta = {
270
317
  declare function tupleHash(tuple: readonly string[]): string;
271
318
  declare function resourceId(kind: 'media' | 'voice', system: string, key: string): string;
272
319
  declare function relationId<K extends RelationTable>(table: K, value: RelationValues[K]): string;
273
- type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-script' | 'phonetic-script' | 'caption';
320
+ /** Kinds of id a document mints: its entities', and a script segment's. */
321
+ type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-script' | 'segment' | 'phonetic-script' | 'caption';
274
322
  type DslIdFactory = (kind: EntityIdKind) => string;
275
323
  declare const defaultIdFactory: DslIdFactory;
276
324
  //#endregion
@@ -818,4 +866,4 @@ type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_mai
818
866
  type VideoDraftInput = Pick<VideoDraft, keyof VideoDraftContent>;
819
867
  declare const DEFAULT_UNIT_TIME_MS = 33.333;
820
868
  //#endregion
821
- export { Track$1 as $, DeepReadonly as A, RelationMutation as B, CaptionContent as C, Clip as D, CaptionText as E, EntityTables as F, RichTextSnapshot as G, RelationTables as H, EntityValues as I, TextEdit as J, StoredFile as K, FieldPatch as L, DslMutation as M, EntityMutation as N, ContainMutation as O, EntityTable as P, TimeAnchor as Q, MedeoDslSnapshot as R, Caption as S, CaptionStyle$1 as T, RelationValues as U, RelationTable as V, ResourceSystem as W, TextMutation as X, TextMark as Y, TextRun as Z, defaultIdFactory as _, VideoDraftCaptionStyle as a, tupleHash as b, VideoDraftInput as c, VideoDraftTrack as d, TrackRole as et, VideoDraftTrackItem as f, EntityIdKind as g, DslIdFactory as h, VideoDraft as i, DslDiagnostic as j, ContainNode as k, VideoDraftPartUnion as l, OpActor as m, DEFAULT_UNIT_TIME_MS as n, VideoDraftContent as o, CommitOptions as p, TextDelta as q, VideoCreationSettings as r, VideoDraftContentPartUnion as s, CaptionDisplayCue as t, Voice as tt, VideoDraftTimeline as u, relationId as v, CaptionSelection as w, AudioScript as x, resourceId as y, Media as z };
869
+ export { TextMutation as $, DeepReadonly as A, PhonemeSelection as B, CaptionContent as C, Clip as D, CaptionText as E, EntityTables as F, ResourceSystem as G, RelationTable as H, EntityValues as I, SegmentSelection as J, RichTextSnapshot as K, FieldPatch as L, DslMutation as M, EntityMutation as N, ContainMutation as O, EntityTable as P, TextMark as Q, MedeoDslSnapshot as R, Caption as S, CaptionStyle$1 as T, RelationTables as U, RelationMutation as V, RelationValues as W, TextDelta as X, StoredFile as Y, TextEdit as Z, defaultIdFactory as _, VideoDraftCaptionStyle as a, tupleHash as b, VideoDraftInput as c, VideoDraftTrack as d, TextRun as et, VideoDraftTrackItem as f, EntityIdKind as g, DslIdFactory as h, VideoDraft as i, Voice as it, DslDiagnostic as j, ContainNode as k, VideoDraftPartUnion as l, OpActor as m, DEFAULT_UNIT_TIME_MS as n, Track$1 as nt, VideoDraftContent as o, CommitOptions as p, SegmentRange as q, VideoCreationSettings as r, TrackRole as rt, VideoDraftContentPartUnion as s, CaptionDisplayCue as t, TimeAnchor as tt, VideoDraftTimeline as u, relationId as v, CaptionSelection as w, AudioScript as x, resourceId as y, Media as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mengine/medeo-client",
3
- "version": "2.1.1-dsl.7",
3
+ "version": "2.1.1-dsl.9",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "@noble/hashes": "^2.4.0",
30
30
  "immer": "^10.2.0",
31
31
  "zod": "^4.4.3",
32
- "@mengine/storage": "2.1.1-dsl.7",
33
- "@mengine/sync": "2.1.1-dsl.7",
34
- "@mengine/utils": "2.1.1-dsl.7"
32
+ "@mengine/storage": "2.1.1-dsl.9",
33
+ "@mengine/sync": "2.1.1-dsl.9",
34
+ "@mengine/utils": "2.1.1-dsl.9"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.9.1",