@mengine/medeo-client 2.1.1-dsl.0 → 2.1.1-dsl.10

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.
@@ -17,9 +17,24 @@ interface SeqMarker {
17
17
  rate?: number;
18
18
  fillTimeline?: true;
19
19
  }
20
+ /**
21
+ * Where a Clip starts: at an absolute time on the Timeline, or following another Clip. No anchor
22
+ * means it plays in Tree order. One value, so concurrent placements keep one whole placement.
23
+ */
24
+ interface TimeAnchor {
25
+ /** The Timeline (absolute) or another Clip (following). */
26
+ to: string;
27
+ offsetMs: number;
28
+ /** The absolute start recorded by the placement edit; used when the anchor cannot be solved. */
29
+ fallback_abs_ms: number;
30
+ }
31
+ /** A Clip's single-valued relations are fields of its own row: its content and its time anchor. */
20
32
  interface Clip {
21
33
  seqMarker: SeqMarker;
22
34
  volume?: number;
35
+ /** The media or Caption this use plays. */
36
+ source: string;
37
+ anchor?: TimeAnchor;
23
38
  }
24
39
  interface MediaLocator {
25
40
  system: ResourceSystem;
@@ -38,8 +53,14 @@ type Media = MediaLocator & ({
38
53
  kind: 'image';
39
54
  storageKey?: string;
40
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). */
41
62
  interface AudioScript {
42
- body: string;
63
+ segments: AudioScriptSegment[];
43
64
  defaultLanguage?: string;
44
65
  }
45
66
  interface CaptionStyle$1 {
@@ -57,21 +78,49 @@ interface CaptionStyle$1 {
57
78
  positionX?: number;
58
79
  positionY?: number;
59
80
  }
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 {
87
+ audioScriptId: string;
88
+ segmentId: string;
89
+ start?: Cursor;
90
+ end?: Cursor;
91
+ }
92
+ type CaptionContent = SegmentSelection;
93
+ /** Words come from a selected run of a script or from the Caption's own text, never both. */
60
94
  interface Caption {
95
+ selection?: CaptionContent;
61
96
  text?: string;
62
97
  style?: CaptionStyle$1;
63
98
  }
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. */
102
+ phonemeScript?: string;
103
+ }
104
+ /** A file Memota stored from raw content: how a Media File entity names it, and its digest. */
105
+ interface StoredFile {
106
+ system: 'memota';
107
+ key: string;
108
+ storageKey?: string;
109
+ digest: string;
110
+ }
111
+ /**
112
+ * A variant of an AudioScript: the segment it is written for, plus what to synthesize. It has the Media File
113
+ * trait (D178): its `phonemeScript` is raw content, stored in Memota as a text file whenever it is
114
+ * written, and the file's facts are kept beside it. Without a `phonemeScript` it has no file.
115
+ */
116
+ interface PhoneticScript extends Partial<StoredFile> {
117
+ phoneme: Phoneme;
118
+ }
64
119
  interface Voice {
65
120
  system: 'voice-library';
66
121
  key: string;
67
122
  name?: string;
68
123
  }
69
- interface Asset {
70
- system: ResourceSystem;
71
- key: string;
72
- storageKey?: string;
73
- digest?: string;
74
- }
75
124
  /** Table keys carry entity identity; values never duplicate an id or a single-table kind. */
76
125
  interface EntityValues {
77
126
  'timeline-entities': Record<string, never>;
@@ -79,52 +128,32 @@ interface EntityValues {
79
128
  'clip-entities': Clip;
80
129
  'media-entities': Media;
81
130
  'audio-script-entities': AudioScript;
131
+ 'phonetic-script-entities': PhoneticScript;
82
132
  'caption-entities': Caption;
83
133
  'voice-entities': Voice;
84
- 'asset-entities': Asset;
85
- }
86
- interface TimeAnchor {
87
- from: string;
88
- to: string;
89
- offsetMs: number;
90
- fallback_abs_ms: number;
91
- }
92
- interface CaptionContent {
93
- captionId: string;
94
- audioScriptId: string;
95
- start: Cursor;
96
- end: Cursor;
97
134
  }
135
+ /** Only relations an entity may hold many of have tables; single-valued ones are fields of their owner. */
98
136
  interface RelationValues {
99
- 'clip-source-relations': {
100
- clipId: string;
101
- sourceId: string;
102
- };
103
- 'time-anchor-relations': TimeAnchor;
104
- 'caption-content-relations': CaptionContent;
105
- 'caption-alignment-relations': {
106
- captionId: string;
107
- mediaId: string;
108
- startMs: number;
109
- endMs: number;
110
- };
111
137
  'voice-timbre-relations': {
112
138
  recordingId: string;
113
139
  voiceId: string;
114
140
  };
141
+ /**
142
+ * `sourceDigest`: the source's digest when the product was made from it (D177). A product whose
143
+ * source's digest differs now was made from content the source no longer has.
144
+ */
115
145
  'derived-from-relations': {
116
146
  entityId: string;
117
147
  sourceId: string;
118
- };
119
- 'from-asset-relations': {
120
- audioScriptId: string;
121
- assetId: string;
122
- };
123
- 'to-asset-relations': {
124
- audioScriptId: string;
125
- assetId: string;
148
+ sourceDigest?: string;
126
149
  };
127
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
+ };
128
157
  type EntityTable = keyof EntityValues;
129
158
  type RelationTable = keyof RelationValues;
130
159
  type EntityTables = { [K in EntityTable]: Record<string, EntityValues[K]> };
@@ -134,7 +163,7 @@ type EntityMutation = { [K in EntityTable]: {
134
163
  type: 'create-entity';
135
164
  table: K;
136
165
  id: string;
137
- value: EntityValues[K];
166
+ value: EntityInput[K];
138
167
  } | {
139
168
  type: 'patch-entity';
140
169
  table: K;
@@ -168,12 +197,37 @@ type ContainMutation = {
168
197
  type: 'delete-node';
169
198
  entityId: string;
170
199
  };
171
- interface CaptionSelection {
172
- 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 {
173
202
  audioScriptId: string;
174
- start: number;
175
- end: number;
203
+ segmentId: string;
204
+ start?: number;
205
+ end?: number;
176
206
  }
207
+ interface CaptionSelection extends SegmentRange {
208
+ captionId: string;
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
+ };
177
231
  type TextMutation = {
178
232
  type: 'edit-caption-text';
179
233
  captionId: string;
@@ -182,12 +236,15 @@ type TextMutation = {
182
236
  } | {
183
237
  type: 'edit-text';
184
238
  audioScriptId: string;
239
+ segmentId: string;
185
240
  expectedBodyId?: string;
186
241
  edits: readonly TextEdit[];
187
242
  } | ({
188
243
  type: 'set-caption-content';
189
- } & CaptionSelection);
190
- type DslMutation = EntityMutation | RelationMutation | ContainMutation | TextMutation;
244
+ } & CaptionSelection) | ({
245
+ type: 'set-phoneme';
246
+ } & PhonemeSelection);
247
+ type DslMutation = EntityMutation | RelationMutation | ContainMutation | SegmentMutation | TextMutation;
191
248
  interface ContainNode {
192
249
  treeId: TreeID;
193
250
  entityId: string;
@@ -207,6 +264,7 @@ interface RichTextSnapshot {
207
264
  plainText: string;
208
265
  delta: TextRun[];
209
266
  }
267
+ /** Selected text, with its UTF-16 range in the Text it lies in: the segment's, or a Caption's own. */
210
268
  interface CaptionText {
211
269
  text: string;
212
270
  start: number;
@@ -215,12 +273,13 @@ interface CaptionText {
215
273
  }
216
274
  type DeepReadonly<T> = T extends Cursor ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
217
275
  type MedeoDslSnapshot = DeepReadonly<EntityTables & RelationTables & {
218
- '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. */
219
277
  richText: Record<string, RichTextSnapshot>;
220
- 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>;
221
280
  diagnostics: DslDiagnostic[];
222
281
  }>;
223
- type TextMark = 'language' | 'pauseMs';
282
+ type TextMark = 'language';
224
283
  type TextEdit = {
225
284
  type: 'insert';
226
285
  at: number;
@@ -234,7 +293,7 @@ type TextEdit = {
234
293
  start: number;
235
294
  end: number;
236
295
  key: TextMark;
237
- value: string | number;
296
+ value: string;
238
297
  } | {
239
298
  type: 'unmark';
240
299
  start: number;
@@ -256,9 +315,10 @@ type TextDelta = {
256
315
  //#endregion
257
316
  //#region ../medeo-dsl/src/ids.d.ts
258
317
  declare function tupleHash(tuple: readonly string[]): string;
259
- declare function resourceId(kind: 'media' | 'voice' | 'asset', system: string, key: string): string;
318
+ declare function resourceId(kind: 'media' | 'voice', system: string, key: string): string;
260
319
  declare function relationId<K extends RelationTable>(table: K, value: RelationValues[K]): string;
261
- type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-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';
262
322
  type DslIdFactory = (kind: EntityIdKind) => string;
263
323
  declare const defaultIdFactory: DslIdFactory;
264
324
  //#endregion
@@ -806,4 +866,4 @@ type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_mai
806
866
  type VideoDraftInput = Pick<VideoDraft, keyof VideoDraftContent>;
807
867
  declare const DEFAULT_UNIT_TIME_MS = 33.333;
808
868
  //#endregion
809
- export { Track$1 as $, ContainNode as A, Media as B, Caption as C, CaptionText as D, CaptionStyle$1 as E, EntityTable as F, ResourceSystem as G, RelationTable as H, EntityTables as I, TextEdit as J, RichTextSnapshot as K, EntityValues as L, DslDiagnostic as M, DslMutation as N, Clip as O, EntityMutation as P, TimeAnchor as Q, FieldPatch as R, AudioScript as S, CaptionSelection as T, RelationTables as U, RelationMutation as V, RelationValues 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, DeepReadonly as j, ContainMutation 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, CaptionContent as w, Asset as x, resourceId as y, MedeoDslSnapshot 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.0",
3
+ "version": "2.1.1-dsl.10",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,16 +28,16 @@
28
28
  "dependencies": {
29
29
  "@noble/hashes": "^2.4.0",
30
30
  "immer": "^10.2.0",
31
- "loro-mirror": "2.3.3",
32
31
  "zod": "^4.4.3",
33
- "@mengine/storage": "2.1.1-dsl.0",
34
- "@mengine/sync": "2.1.1-dsl.0",
35
- "@mengine/utils": "2.1.1-dsl.0"
32
+ "@mengine/sync": "2.1.1-dsl.10",
33
+ "@mengine/utils": "2.1.1-dsl.10",
34
+ "@mengine/storage": "2.1.1-dsl.10"
36
35
  },
37
36
  "devDependencies": {
38
37
  "@types/node": "^25.9.1",
39
38
  "@typescript/native-preview": "7.0.0-dev.20260521.1",
40
39
  "loro-crdt": "^1.16.1",
40
+ "loro-mirror": "2.3.3",
41
41
  "tsx": "^4.22.3",
42
42
  "typescript": "^6.0.3",
43
43
  "vite-plugin-wasm": "^3.6.0",
@@ -48,6 +48,9 @@
48
48
  "peerDependencies": {
49
49
  "loro-crdt": "^1.16.1"
50
50
  },
51
+ "inlinedDependencies": {
52
+ "loro-mirror": "2.3.3"
53
+ },
51
54
  "scripts": {
52
55
  "build": "vp pack",
53
56
  "dev": "vp pack --watch",