@mengine/medeo-tool 2.0.1-alpha.8 → 2.0.1-alpha.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.
- package/dist/{entity-sandbox-CzaUmSsS.mjs → entity-sandbox-CJeLcNcx.mjs} +69 -43
- package/dist/entity-sandbox-CJeLcNcx.mjs.map +1 -0
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/worker-entry.mjs +1 -1
- package/package.json +2 -2
- package/dist/entity-sandbox-CzaUmSsS.mjs.map +0 -1
|
@@ -1,62 +1,84 @@
|
|
|
1
1
|
import { applyFieldChanges, assertCanonicalEditorResources, assertFieldChanges, ensureEditorFoundation, importMediaAsset, readDocumentAudioScript } from "@mengine/medeo-client";
|
|
2
2
|
//#region ../medeo-dsl/src/entities.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* What every known entity kind declares.
|
|
5
5
|
*
|
|
6
|
-
* `
|
|
7
|
-
* the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `kinds` is a multi-declaration: every entry holds at the same time, the first
|
|
7
|
+
* naming the object and the rest the properties it shares with others. The
|
|
8
|
+
* order carries no priority, endpoint role, or edit sequence — an operation
|
|
9
|
+
* asks whether the entity declares the kind it needs, never what its "main
|
|
10
|
+
* type" is.
|
|
11
|
+
*
|
|
12
|
+
* `Caption` declares `Sequence` on purpose: it owns the display timing of the
|
|
13
|
+
* one AudioScript segment it shows, which is what admits it into a Clip.
|
|
14
|
+
* `Voice` declares neither `MediaFile` nor `Sequence` — it is a timbre
|
|
15
|
+
* identity, not playable content; a rendered voiceover is an `audio` entity.
|
|
10
16
|
*/
|
|
11
|
-
const
|
|
17
|
+
const ENTITY_KINDS = Object.freeze({
|
|
12
18
|
axvideo: Object.freeze([
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
19
|
+
"AXVideo",
|
|
20
|
+
"Container",
|
|
21
|
+
"Sequence",
|
|
22
|
+
"Visual",
|
|
23
|
+
"Audible"
|
|
24
|
+
]),
|
|
25
|
+
timeline: Object.freeze(["Timeline", "Container"]),
|
|
26
|
+
track: Object.freeze([
|
|
27
|
+
"Track",
|
|
28
|
+
"Container",
|
|
29
|
+
"Sequence"
|
|
17
30
|
]),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
clip: Object.freeze(["container"]),
|
|
21
|
-
asset: Object.freeze([]),
|
|
31
|
+
clip: Object.freeze(["Clip", "Container"]),
|
|
32
|
+
asset: Object.freeze(["Asset"]),
|
|
22
33
|
video: Object.freeze([
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
34
|
+
"Video",
|
|
35
|
+
"MediaFile",
|
|
36
|
+
"Sequence",
|
|
37
|
+
"Visual",
|
|
38
|
+
"Audible"
|
|
27
39
|
]),
|
|
28
40
|
audio: Object.freeze([
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
41
|
+
"Audio",
|
|
42
|
+
"MediaFile",
|
|
43
|
+
"Sequence",
|
|
44
|
+
"Audible"
|
|
32
45
|
]),
|
|
33
46
|
image: Object.freeze([
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
47
|
+
"Image",
|
|
48
|
+
"MediaFile",
|
|
49
|
+
"Sequence",
|
|
50
|
+
"Visual"
|
|
37
51
|
]),
|
|
38
|
-
voice: Object.freeze([
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
voice: Object.freeze([
|
|
53
|
+
"Voice",
|
|
54
|
+
"Container",
|
|
55
|
+
"IPBound"
|
|
56
|
+
]),
|
|
57
|
+
"sequence-marker": Object.freeze(["SequenceMarker"]),
|
|
58
|
+
viewport: Object.freeze(["Viewport"]),
|
|
59
|
+
"audio-script": Object.freeze(["AudioScript", "SegmentText"]),
|
|
60
|
+
"phonetic-script": Object.freeze(["PhoneticScript", "SegmentText"]),
|
|
61
|
+
caption: Object.freeze([
|
|
62
|
+
"Caption",
|
|
63
|
+
"SegmentText",
|
|
64
|
+
"Sequence"
|
|
65
|
+
])
|
|
44
66
|
});
|
|
45
|
-
/**
|
|
46
|
-
function
|
|
47
|
-
return isKnownEntityKind(entityKind) ?
|
|
67
|
+
/** What a known kind declares; extension kinds declare nothing through this table. */
|
|
68
|
+
function kindsOf(entityKind) {
|
|
69
|
+
return isKnownEntityKind(entityKind) ? ENTITY_KINDS[entityKind] : [];
|
|
48
70
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
71
|
+
function declaresKind(entityKind, kind) {
|
|
72
|
+
return kindsOf(entityKind).includes(kind);
|
|
51
73
|
}
|
|
52
74
|
/**
|
|
53
|
-
* Sequence admission asks
|
|
54
|
-
*
|
|
55
|
-
*
|
|
75
|
+
* Sequence admission asks `kinds` first, so an entity that does not declare
|
|
76
|
+
* `Sequence` can never buy its way in by carrying the fields. Extension kinds
|
|
77
|
+
* declare nothing and stay structurally detected.
|
|
56
78
|
*/
|
|
57
79
|
function hasSequence(entity) {
|
|
58
80
|
if (isReservedEntityKind(entity.entityKind)) return false;
|
|
59
|
-
if (isKnownEntityKind(entity.entityKind) && !
|
|
81
|
+
if (isKnownEntityKind(entity.entityKind) && !declaresKind(entity.entityKind, "Sequence")) return false;
|
|
60
82
|
return isSequenceFields(entity);
|
|
61
83
|
}
|
|
62
84
|
function isSequenceFields(value) {
|
|
@@ -73,7 +95,7 @@ function isMediaAssetVariantKind(kind) {
|
|
|
73
95
|
return kind === "video" || kind === "image" || kind === "audio";
|
|
74
96
|
}
|
|
75
97
|
function isKnownEntityKind(kind) {
|
|
76
|
-
return Object.hasOwn(
|
|
98
|
+
return Object.hasOwn(ENTITY_KINDS, kind);
|
|
77
99
|
}
|
|
78
100
|
function isReservedEntityKind(kind) {
|
|
79
101
|
const normalized = kind.toLowerCase().replaceAll("-", "").replaceAll("_", "");
|
|
@@ -258,14 +280,17 @@ function assembleCaptionContent(rows, captionEntityId) {
|
|
|
258
280
|
requireEntityKind(rows, captionEntityId, "caption");
|
|
259
281
|
const caption = assembleEntityContent(rows, captionEntityId);
|
|
260
282
|
const script = findComposedAudioScript(rows, captionEntityId, "caption");
|
|
261
|
-
const
|
|
283
|
+
const selection = captionSelection(caption);
|
|
284
|
+
const composed = {
|
|
262
285
|
...script,
|
|
263
286
|
payload: caption.payload
|
|
264
|
-
}
|
|
287
|
+
};
|
|
288
|
+
const segment = selectAudioScriptSegment(composed, selection);
|
|
265
289
|
return {
|
|
266
290
|
caption,
|
|
267
291
|
audioScript: script,
|
|
268
292
|
segments: [segment],
|
|
293
|
+
segmentIndex: scriptSegments(composed).findIndex((entry) => entry.segmentId === selection.segmentId),
|
|
269
294
|
text: segment.text
|
|
270
295
|
};
|
|
271
296
|
}
|
|
@@ -1675,6 +1700,7 @@ var EntitySandbox = class {
|
|
|
1675
1700
|
const assembled = assembleCaptionContent(toDslRows(this.state), createEntityId(entityId));
|
|
1676
1701
|
return clone({
|
|
1677
1702
|
audio_script_entity_id: assembled.audioScript.entityId,
|
|
1703
|
+
segment_index: assembled.segmentIndex,
|
|
1678
1704
|
text: assembled.text,
|
|
1679
1705
|
segments: assembled.segments.map((segment) => ({ ...segment }))
|
|
1680
1706
|
});
|
|
@@ -2171,4 +2197,4 @@ const numericMarkerComparators = { compareMarkerPoints: (_marker, _range, left,
|
|
|
2171
2197
|
//#endregion
|
|
2172
2198
|
export { isJsonObject as a, isMediaAssetVariantKind as c, businessState as i, toDslRows as n, createEntityId as o, businessFacades as r, createRelationId as s, EntitySandbox as t };
|
|
2173
2199
|
|
|
2174
|
-
//# sourceMappingURL=entity-sandbox-
|
|
2200
|
+
//# sourceMappingURL=entity-sandbox-CJeLcNcx.mjs.map
|