@video-editor/editor-core 0.0.1-beta.34 → 1.0.0-beta.1

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/index.d.ts CHANGED
@@ -15,6 +15,9 @@ export declare function createPluginManager(ctx: EditorCoreContext): EditorCoreP
15
15
 
16
16
  export declare function createSegmentRegistry(): SegmentRegistry;
17
17
 
18
+ /** Result payload returned by duplicateSegment. */
19
+ export declare type DuplicateSegmentResult = ReturnType<ProtocolManager['duplicateSegment']>;
20
+
18
21
  /**
19
22
  * The headless editor-core instance.
20
23
  */
@@ -47,20 +50,28 @@ export declare interface EditorCoreCommands {
47
50
  setSelectedSegment: ProtocolManager['setSelectedSegment'];
48
51
  /** Insert a segment into the timeline. */
49
52
  addSegment: ProtocolManager['addSegment'];
50
- /** Remove a segment by id. */
53
+ /** Remove a segment by id, optionally rippling later segments on the track left. */
51
54
  removeSegment: ProtocolManager['removeSegment'];
55
+ /** Duplicate a segment and place the copy at the current playhead (single undo step). */
56
+ duplicateSegment: ProtocolManager['duplicateSegment'];
52
57
  /** Mutate a segment (by id or current selection). */
53
58
  updateSegment: ProtocolManager['updateSegment'];
54
59
  /** Move a segment between tracks or positions. */
55
60
  moveSegment: ProtocolManager['moveSegment'];
56
61
  /** Resize a segment's time range. */
57
62
  resizeSegment: ProtocolManager['resizeSegment'];
63
+ /** Split a segment into two at a timeline position (single undo step). */
64
+ splitSegment: ProtocolManager['splitSegment'];
58
65
  /** Add a transition at the current time or a specified time. */
59
66
  addTransition: ProtocolManager['addTransition'];
60
67
  /** Remove a transition by segment id. */
61
68
  removeTransition: ProtocolManager['removeTransition'];
62
69
  /** Update a transition by segment id. */
63
70
  updateTransition: ProtocolManager['updateTransition'];
71
+ /** Update a track's mutable presentation fields (hidden / muted / extra). */
72
+ updateTrack: ProtocolManager['updateTrack'];
73
+ /** Resize the project canvas as a single undoable step. */
74
+ setCanvasSize: ProtocolManager['setCanvasSize'];
64
75
  /** Replace a track id (useful for migrations). */
65
76
  replaceTrackId: ProtocolManager['replaceTrackId'];
66
77
  /** Replace a segment id (useful for migrations). */
@@ -195,6 +206,9 @@ export declare type MoveSegmentOptions = Parameters<ProtocolManager['moveSegment
195
206
  /** Internal protocol manager type used to align editor-core signatures with protocol behavior. */
196
207
  declare type ProtocolManager = ReturnType<typeof createVideoProtocolManager>;
197
208
 
209
+ /** Optional flags accepted by removeSegment (e.g. ripple delete). */
210
+ export declare type RemoveSegmentOptions = Parameters<ProtocolManager['removeSegment']>[1];
211
+
198
212
  /** Options for resizing a segment on a track. */
199
213
  export declare type ResizeSegmentOptions = Parameters<ProtocolManager['resizeSegment']>[0];
200
214
 
@@ -250,4 +264,10 @@ export declare interface SegmentRegistry {
250
264
  list: () => SegmentPlugin[];
251
265
  }
252
266
 
267
+ /** Result payload returned by setCanvasSize. */
268
+ export declare type SetCanvasSizeResult = ReturnType<ProtocolManager['setCanvasSize']>;
269
+
270
+ /** The mutable track fields exposed to an updateTrack updater. */
271
+ export declare type TrackMutableFields = Parameters<Parameters<ProtocolManager['updateTrack']>[1]>[0];
272
+
253
273
  export { }
package/dist/index.js CHANGED
@@ -1,69 +1,69 @@
1
- import { computed as p } from "@vue/reactivity";
2
1
  import { createVideoProtocolManager as v } from "@video-editor/protocol";
2
+ import { computed as p } from "@vue/reactivity";
3
3
  function y(s) {
4
- const e = [], r = /* @__PURE__ */ new Map();
5
- let a = !1;
4
+ const e = [], o = /* @__PURE__ */ new Map();
5
+ let c = !1;
6
6
  return {
7
7
  register: async (t, n) => {
8
- const c = t(s), { name: i } = c;
9
- if (r.has(i)) {
8
+ const a = t(s), { name: i } = a;
9
+ if (o.has(i)) {
10
10
  if (!n?.override)
11
11
  throw new Error(`Plugin ${i} has been registered`);
12
- await r.get(i)?.destroy?.();
12
+ await o.get(i)?.destroy?.();
13
13
  const u = e.findIndex((S) => S.name === i);
14
- u >= 0 && e.splice(u, 1), r.delete(i);
14
+ u >= 0 && e.splice(u, 1), o.delete(i);
15
15
  }
16
- e.push(c), r.set(i, c), (n?.autoInit || a) && await c.init?.();
16
+ e.push(a), o.set(i, a), (n?.autoInit || c) && await a.init?.();
17
17
  },
18
18
  init: async () => {
19
19
  for (const t of e)
20
20
  await t.init?.();
21
- a = !0;
21
+ c = !0;
22
22
  },
23
- get: (t) => r.get(t),
24
- has: (t) => r.has(t),
23
+ get: (t) => o.get(t),
24
+ has: (t) => o.has(t),
25
25
  remove: async (t) => {
26
26
  const n = e.findIndex((i) => i.name === t);
27
- return n === -1 ? !1 : (await e[n].destroy?.(), e.splice(n, 1), r.delete(t));
27
+ return n === -1 ? !1 : (await e[n].destroy?.(), e.splice(n, 1), o.delete(t));
28
28
  },
29
29
  destroy: async () => {
30
30
  for (const t of e)
31
31
  await t.destroy?.();
32
- e.length = 0, r.clear(), a = !1;
32
+ e.length = 0, o.clear(), c = !1;
33
33
  }
34
34
  };
35
35
  }
36
36
  function T() {
37
37
  const s = /* @__PURE__ */ new Map();
38
38
  return {
39
- register: (o, d) => {
40
- if (s.has(o.type) && !d?.override)
41
- throw new Error(`Segment plugin ${o.type} has been registered`);
42
- s.set(o.type, o);
39
+ register: (r, d) => {
40
+ if (s.has(r.type) && !d?.override)
41
+ throw new Error(`Segment plugin ${r.type} has been registered`);
42
+ s.set(r.type, r);
43
43
  },
44
- get: (o) => s.get(o),
44
+ get: (r) => s.get(r),
45
45
  list: () => [...s.values()]
46
46
  };
47
47
  }
48
48
  function k(s) {
49
49
  let e = 0;
50
- for (const r of s)
51
- for (const a of r.children)
52
- a.endTime > e && (e = a.endTime);
50
+ for (const o of s)
51
+ for (const c of o.children)
52
+ c.endTime > e && (e = c.endTime);
53
53
  return e;
54
54
  }
55
55
  function x(s) {
56
56
  const e = v(s.protocol, {
57
57
  idFactory: s.idFactory
58
- }), r = p(() => e.selectedSegment.value?.id), a = p(() => k(e.protocol.value.tracks)), o = {
58
+ }), o = p(() => e.selectedSegment.value?.id), c = p(() => k(e.protocol.value.tracks)), r = {
59
59
  protocol: e.protocol,
60
60
  videoBasicInfo: e.videoBasicInfo,
61
61
  currentTime: e.curTime,
62
62
  selectedSegment: e.selectedSegment,
63
- selectedSegmentId: r,
63
+ selectedSegmentId: o,
64
64
  trackMap: e.trackMap,
65
65
  segmentMap: e.segmentMap,
66
- duration: a,
66
+ duration: c,
67
67
  undoCount: e.undoCount,
68
68
  redoCount: e.redoCount
69
69
  }, d = {
@@ -73,12 +73,16 @@ function x(s) {
73
73
  setSelectedSegment: e.setSelectedSegment,
74
74
  addSegment: e.addSegment,
75
75
  removeSegment: e.removeSegment,
76
+ duplicateSegment: e.duplicateSegment,
76
77
  updateSegment: e.updateSegment,
77
78
  moveSegment: e.moveSegment,
78
79
  resizeSegment: e.resizeSegment,
80
+ splitSegment: e.splitSegment,
79
81
  addTransition: e.addTransition,
80
82
  removeTransition: e.removeTransition,
81
83
  updateTransition: e.updateTransition,
84
+ updateTrack: e.updateTrack,
85
+ setCanvasSize: e.setCanvasSize,
82
86
  replaceTrackId: e.replaceTrackId,
83
87
  replaceSegmentId: e.replaceSegmentId,
84
88
  undo: e.undo,
@@ -86,20 +90,20 @@ function x(s) {
86
90
  exportProtocol: e.exportProtocol
87
91
  }, g = {
88
92
  getSegment: e.getSegment,
89
- getTrackById: (n) => o.protocol.value.tracks.find((c) => c.trackId === n),
90
- getTrackBySegmentId: (n) => o.protocol.value.tracks.find((c) => c.children.some((i) => i.id === n)),
91
- getTracks: (n) => n ? o.protocol.value.tracks.filter((c) => c.trackType === n) : o.protocol.value.tracks
93
+ getTrackById: (n) => r.protocol.value.tracks.find((a) => a.trackId === n),
94
+ getTrackBySegmentId: (n) => r.protocol.value.tracks.find((a) => a.children.some((i) => i.id === n)),
95
+ getTracks: (n) => n ? r.protocol.value.tracks.filter((a) => a.trackType === n) : r.protocol.value.tracks
92
96
  }, l = {
93
97
  segments: T()
94
98
  }, m = s.services ?? {}, t = y({
95
- state: o,
99
+ state: r,
96
100
  commands: d,
97
101
  selectors: g,
98
102
  registry: l,
99
103
  services: m
100
104
  });
101
105
  return {
102
- state: o,
106
+ state: r,
103
107
  commands: d,
104
108
  selectors: g,
105
109
  plugins: t,
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@video-editor/editor-core",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.34",
4
+ "version": "1.0.0-beta.1",
5
5
  "exports": {
6
6
  ".": {
7
+ "types": "./dist/index.d.ts",
7
8
  "import": "./dist/index.js"
8
9
  },
9
10
  "./*": "./*"
@@ -18,8 +19,8 @@
18
19
  "@vue/reactivity": "^3.5.26"
19
20
  },
20
21
  "dependencies": {
21
- "@video-editor/protocol": "0.0.1-beta.34",
22
- "@video-editor/shared": "0.0.1-beta.34"
22
+ "@video-editor/protocol": "1.0.0-beta.1",
23
+ "@video-editor/shared": "1.0.0-beta.1"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@vue/reactivity": "^3.5.26"