@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.
@@ -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
- * The declared trait set of every known kind.
4
+ * What every known entity kind declares.
5
5
  *
6
- * `caption` carries `sequence` on purpose: a Caption owns the display timing of
7
- * the one AudioScript segment it shows, which is what admits it into a Clip.
8
- * `voice` carries no media or sequence trait it is a timbre identity, not
9
- * playable content; a rendered voiceover is an `audio` entity.
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 ENTITY_TRAIT_KINDS = Object.freeze({
17
+ const ENTITY_KINDS = Object.freeze({
12
18
  axvideo: Object.freeze([
13
- "container",
14
- "sequence",
15
- "visual",
16
- "audible"
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
- timeline: Object.freeze(["container"]),
19
- track: Object.freeze(["container", "sequence"]),
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
- "media-file",
24
- "sequence",
25
- "visual",
26
- "audible"
34
+ "Video",
35
+ "MediaFile",
36
+ "Sequence",
37
+ "Visual",
38
+ "Audible"
27
39
  ]),
28
40
  audio: Object.freeze([
29
- "media-file",
30
- "sequence",
31
- "audible"
41
+ "Audio",
42
+ "MediaFile",
43
+ "Sequence",
44
+ "Audible"
32
45
  ]),
33
46
  image: Object.freeze([
34
- "media-file",
35
- "sequence",
36
- "visual"
47
+ "Image",
48
+ "MediaFile",
49
+ "Sequence",
50
+ "Visual"
37
51
  ]),
38
- voice: Object.freeze(["container", "ip-bound"]),
39
- "sequence-marker": Object.freeze([]),
40
- viewport: Object.freeze([]),
41
- "audio-script": Object.freeze(["segment-text"]),
42
- "phonetic-script": Object.freeze(["segment-text"]),
43
- caption: Object.freeze(["segment-text", "sequence"])
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
- /** Declared traits of a known kind; extension kinds declare none through this table. */
46
- function traitKindsOf(entityKind) {
47
- return isKnownEntityKind(entityKind) ? ENTITY_TRAIT_KINDS[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 hasTraitKind(entityKind, trait) {
50
- return traitKindsOf(entityKind).includes(trait);
71
+ function declaresKind(entityKind, kind) {
72
+ return kindsOf(entityKind).includes(kind);
51
73
  }
52
74
  /**
53
- * Sequence admission asks the declared traits first, so a kind that does not
54
- * declare `sequence` can never buy its way in by carrying the fields. Extension
55
- * kinds declare no traits and stay structurally detected.
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) && !hasTraitKind(entity.entityKind, "sequence")) return false;
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(ENTITY_TRAIT_KINDS, kind);
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 segment = selectAudioScriptSegment({
283
+ const selection = captionSelection(caption);
284
+ const composed = {
262
285
  ...script,
263
286
  payload: caption.payload
264
- }, captionSelection(caption));
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-CzaUmSsS.mjs.map
2200
+ //# sourceMappingURL=entity-sandbox-CJeLcNcx.mjs.map