@opendaw/studio-core 0.0.45 → 0.0.47
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/EffectBox.d.ts +2 -2
- package/dist/EffectBox.d.ts.map +1 -1
- package/dist/EffectFactories.d.ts +3 -0
- package/dist/EffectFactories.d.ts.map +1 -1
- package/dist/EffectFactories.js +14 -2
- package/dist/EngineWorklet.d.ts.map +1 -1
- package/dist/EngineWorklet.js +8 -1
- package/dist/InstrumentBox.d.ts +2 -2
- package/dist/InstrumentBox.d.ts.map +1 -1
- package/dist/InstrumentFactories.d.ts +2 -0
- package/dist/InstrumentFactories.d.ts.map +1 -1
- package/dist/InstrumentFactories.js +13 -2
- package/dist/capture/CaptureDevices.d.ts +1 -1
- package/dist/capture/CaptureDevices.d.ts.map +1 -1
- package/dist/capture/CaptureDevices.js +21 -10
- package/dist/capture/CaptureMidi.js +1 -1
- package/dist/processors.js +12 -12
- package/dist/processors.js.map +4 -4
- package/dist/project/Project.d.ts +9 -3
- package/dist/project/Project.d.ts.map +1 -1
- package/dist/project/Project.js +47 -6
- package/dist/project/ProjectApi.js +1 -1
- package/dist/ui/TimeGrid.d.ts +19 -0
- package/dist/ui/TimeGrid.d.ts.map +1 -0
- package/dist/ui/TimeGrid.js +74 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/workers-main.js +2 -2
- package/dist/workers-main.js.map +1 -1
- package/dist/ysync/YService.d.ts.map +1 -1
- package/dist/ysync/YService.js +19 -8
- package/dist/ysync/YSync.d.ts +4 -4
- package/dist/ysync/YSync.d.ts.map +1 -1
- package/dist/ysync/YSync.js +29 -26
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YService.d.ts","sourceRoot":"","sources":["../../src/ysync/YService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"YService.d.ts","sourceRoot":"","sources":["../../src/ysync/YService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAyC,MAAM,kBAAkB,CAAA;AAQvF,OAAO,EAAC,OAAO,EAAE,UAAU,EAAC,MAAM,YAAY,CAAA;AAI9C,yBAAiB,QAAQ,CAAC;IAMf,MAAM,eAAe,GAAU,YAAY,MAAM,CAAC,OAAO,CAAC,EAC3B,KAAK,UAAU,EACf,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CA6DvE,CAAA;CACJ"}
|
package/dist/ysync/YService.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Errors, Option, panic, RuntimeNotifier, TimeSpan } from "@opendaw/lib-std";
|
|
1
|
+
import { Errors, Option, panic, RuntimeNotifier, TimeSpan, UUID } from "@opendaw/lib-std";
|
|
2
2
|
import { BoxGraph } from "@opendaw/lib-box";
|
|
3
3
|
import { Promises } from "@opendaw/lib-runtime";
|
|
4
|
-
import { BoxIO } from "@opendaw/studio-boxes";
|
|
4
|
+
import { BoxIO, UserInterfaceBox } from "@opendaw/studio-boxes";
|
|
5
5
|
import { ProjectDecoder } from "@opendaw/studio-adapters";
|
|
6
6
|
import { YSync } from "./YSync";
|
|
7
7
|
import * as Y from "yjs";
|
|
@@ -33,13 +33,18 @@ export var YService;
|
|
|
33
33
|
provider.on("sync", onSync);
|
|
34
34
|
await Promises.timeout(promise, TimeSpan.seconds(10), "Timeout 'synced'");
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const boxes = doc.getMap("boxes");
|
|
37
|
+
const isRoomEmpty = boxes.size === 0;
|
|
38
|
+
if (isRoomEmpty) {
|
|
38
39
|
const project = optProject.match({
|
|
39
40
|
none: () => Project.new(env),
|
|
40
41
|
some: project => project.copy()
|
|
41
42
|
});
|
|
42
|
-
const sync = await YSync.
|
|
43
|
+
const sync = await YSync.populateRoom({
|
|
44
|
+
boxGraph: project.boxGraph,
|
|
45
|
+
boxes,
|
|
46
|
+
conflict: () => project.invalid()
|
|
47
|
+
});
|
|
43
48
|
project.own(sync);
|
|
44
49
|
project.editing.disable();
|
|
45
50
|
return project;
|
|
@@ -57,11 +62,17 @@ export var YService;
|
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
const boxGraph = new BoxGraph(Option.wrap(BoxIO.create));
|
|
60
|
-
const sync = await YSync.
|
|
65
|
+
const sync = await YSync.joinRoom({ boxGraph, boxes, conflict: () => project.invalid() });
|
|
66
|
+
const mandatoryBoxes = ProjectDecoder.findMandatoryBoxes(boxGraph);
|
|
61
67
|
const project = Project.skeleton(env, {
|
|
62
68
|
boxGraph,
|
|
63
|
-
mandatoryBoxes
|
|
64
|
-
});
|
|
69
|
+
mandatoryBoxes
|
|
70
|
+
}, false);
|
|
71
|
+
boxGraph.beginTransaction();
|
|
72
|
+
// TODO How takes care to remove the user interface boxes?
|
|
73
|
+
const userInterfaceBox = UserInterfaceBox.create(boxGraph, UUID.generate(), box => box.root.refer(mandatoryBoxes.rootBox.users));
|
|
74
|
+
boxGraph.endTransaction();
|
|
75
|
+
project.follow(userInterfaceBox);
|
|
65
76
|
project.own(sync);
|
|
66
77
|
project.editing.disable();
|
|
67
78
|
return project;
|
package/dist/ysync/YSync.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { BoxGraph } from "@opendaw/lib-box";
|
|
|
3
3
|
import * as Y from "yjs";
|
|
4
4
|
export type Construct<T> = {
|
|
5
5
|
boxGraph: BoxGraph<T>;
|
|
6
|
-
|
|
6
|
+
boxes: Y.Map<unknown>;
|
|
7
7
|
conflict?: Provider<boolean>;
|
|
8
8
|
};
|
|
9
9
|
export declare class YSync<T> implements Terminable {
|
|
10
10
|
#private;
|
|
11
11
|
static isEmpty(doc: Y.Doc): boolean;
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
constructor({ boxGraph,
|
|
12
|
+
static populateRoom<T>({ boxGraph, boxes }: Construct<T>): Promise<YSync<T>>;
|
|
13
|
+
static joinRoom<T>({ boxGraph, boxes }: Construct<T>): Promise<YSync<T>>;
|
|
14
|
+
constructor({ boxGraph, boxes, conflict }: Construct<T>);
|
|
15
15
|
terminate(): void;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=YSync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YSync.d.ts","sourceRoot":"","sources":["../../src/ysync/YSync.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,QAAQ,EAER,UAAU,EAGb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAa,QAAQ,EAA2D,MAAM,kBAAkB,CAAA;AAE/G,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACvB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"YSync.d.ts","sourceRoot":"","sources":["../../src/ysync/YSync.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,QAAQ,EAER,UAAU,EAGb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAa,QAAQ,EAA2D,MAAM,kBAAkB,CAAA;AAE/G,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACvB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC/B,CAAA;AAED,qBAAa,KAAK,CAAC,CAAC,CAAE,YAAW,UAAU;;IACvC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,OAAO;WAItB,YAAY,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;WAcnE,QAAQ,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBA0BhE,EAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAQrD,SAAS,IAAI,IAAI;CAgLpB"}
|
package/dist/ysync/YSync.js
CHANGED
|
@@ -5,25 +5,25 @@ export class YSync {
|
|
|
5
5
|
static isEmpty(doc) {
|
|
6
6
|
return doc.getMap("boxes").size === 0;
|
|
7
7
|
}
|
|
8
|
-
static async
|
|
8
|
+
static async populateRoom({ boxGraph, boxes }) {
|
|
9
9
|
console.debug("populate");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
assert(boxes.size === 0, "boxes must be empty");
|
|
11
|
+
const sync = new YSync({ boxGraph, boxes });
|
|
12
|
+
asDefined(boxes.doc, "Y.Map is not connect to Y.Doc")
|
|
13
|
+
.transact(() => boxGraph.boxes()
|
|
14
|
+
.forEach(box => {
|
|
14
15
|
const key = UUID.toString(box.address.uuid);
|
|
15
16
|
const map = YMapper.createBoxMap(box);
|
|
16
|
-
|
|
17
|
+
boxes.set(key, map);
|
|
17
18
|
}), "[openDAW] populate");
|
|
18
19
|
return sync;
|
|
19
20
|
}
|
|
20
|
-
static async
|
|
21
|
+
static async joinRoom({ boxGraph, boxes }) {
|
|
21
22
|
console.debug("join");
|
|
22
23
|
assert(boxGraph.boxes().length === 0, "BoxGraph must be empty");
|
|
23
|
-
const sync = new YSync({ boxGraph,
|
|
24
|
+
const sync = new YSync({ boxGraph, boxes });
|
|
24
25
|
boxGraph.beginTransaction();
|
|
25
|
-
|
|
26
|
-
boxesMap.forEach((value, key) => {
|
|
26
|
+
boxes.forEach((value, key) => {
|
|
27
27
|
const boxMap = value;
|
|
28
28
|
const uuid = UUID.parse(key);
|
|
29
29
|
const name = boxMap.get("name");
|
|
@@ -36,16 +36,14 @@ export class YSync {
|
|
|
36
36
|
}
|
|
37
37
|
#terminator = new Terminator();
|
|
38
38
|
#boxGraph;
|
|
39
|
-
#doc;
|
|
40
39
|
#conflict;
|
|
41
|
-
#
|
|
40
|
+
#boxes;
|
|
42
41
|
#updates;
|
|
43
42
|
#ignoreUpdates = false;
|
|
44
|
-
constructor({ boxGraph,
|
|
43
|
+
constructor({ boxGraph, boxes, conflict }) {
|
|
45
44
|
this.#boxGraph = boxGraph;
|
|
46
|
-
this.#doc = doc;
|
|
47
45
|
this.#conflict = Option.wrap(conflict);
|
|
48
|
-
this.#
|
|
46
|
+
this.#boxes = boxes;
|
|
49
47
|
this.#updates = [];
|
|
50
48
|
this.#terminator.ownAll(this.#setupYjs(), this.#setupOpenDAW());
|
|
51
49
|
}
|
|
@@ -83,7 +81,8 @@ export class YSync {
|
|
|
83
81
|
this.#ignoreUpdates = true;
|
|
84
82
|
this.#boxGraph.endTransaction();
|
|
85
83
|
this.#ignoreUpdates = false;
|
|
86
|
-
|
|
84
|
+
// TODO Only in DEV-MODE
|
|
85
|
+
// this.#boxGraph.verifyPointers()
|
|
87
86
|
}
|
|
88
87
|
catch (reason) {
|
|
89
88
|
this.terminate();
|
|
@@ -94,11 +93,11 @@ export class YSync {
|
|
|
94
93
|
this.#rollbackTransaction(events);
|
|
95
94
|
}
|
|
96
95
|
};
|
|
97
|
-
this.#
|
|
98
|
-
return { terminate: () => { this.#
|
|
96
|
+
this.#boxes.observeDeep(eventHandler);
|
|
97
|
+
return { terminate: () => { this.#boxes.unobserveDeep(eventHandler); } };
|
|
99
98
|
}
|
|
100
99
|
#createBox(key) {
|
|
101
|
-
const map = this.#
|
|
100
|
+
const map = this.#boxes.get(key);
|
|
102
101
|
const name = map.get("name");
|
|
103
102
|
const fields = map.get("fields");
|
|
104
103
|
const uuid = UUID.parse(key);
|
|
@@ -119,7 +118,7 @@ export class YSync {
|
|
|
119
118
|
}
|
|
120
119
|
const vertex = vertexOption.unwrap("Could not find field");
|
|
121
120
|
const [uuidAsString, fieldsKey, ...fieldKeys] = path;
|
|
122
|
-
const targetMap = YMapper.findMap(this.#
|
|
121
|
+
const targetMap = YMapper.findMap(this.#boxes
|
|
123
122
|
.get(String(uuidAsString))
|
|
124
123
|
.get(String(fieldsKey)), fieldKeys);
|
|
125
124
|
assert(vertex.isField(), "Vertex must be either Primitive or Pointer");
|
|
@@ -146,7 +145,8 @@ export class YSync {
|
|
|
146
145
|
}
|
|
147
146
|
#rollbackTransaction(events) {
|
|
148
147
|
console.debug(`rollback ${events.length} events...`);
|
|
149
|
-
this.#
|
|
148
|
+
this.#getDoc()
|
|
149
|
+
.transact(() => {
|
|
150
150
|
for (let i = events.length - 1; i >= 0; i--) {
|
|
151
151
|
const event = events[i];
|
|
152
152
|
const target = asInstanceOf(event.target, Y.Map);
|
|
@@ -180,7 +180,7 @@ export class YSync {
|
|
|
180
180
|
this.#updates.length = 0;
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
|
-
this.#
|
|
183
|
+
this.#getDoc().transact(() => this.#updates.forEach(update => {
|
|
184
184
|
/**
|
|
185
185
|
* TRANSFER CHANGES FROM OPENDAW TO YJS
|
|
186
186
|
*/
|
|
@@ -188,11 +188,11 @@ export class YSync {
|
|
|
188
188
|
const uuid = update.uuid;
|
|
189
189
|
const key = UUID.toString(uuid);
|
|
190
190
|
const box = this.#boxGraph.findBox(uuid).unwrap();
|
|
191
|
-
this.#
|
|
191
|
+
this.#boxes.set(key, YMapper.createBoxMap(box));
|
|
192
192
|
}
|
|
193
193
|
else if (update.type === "primitive") {
|
|
194
194
|
const key = UUID.toString(update.address.uuid);
|
|
195
|
-
const boxObject = asDefined(this.#
|
|
195
|
+
const boxObject = asDefined(this.#boxes.get(key), "Could not find box");
|
|
196
196
|
const { address: { fieldKeys }, newValue } = update;
|
|
197
197
|
let field = boxObject.get("fields");
|
|
198
198
|
for (let i = 0; i < fieldKeys.length - 1; i++) {
|
|
@@ -202,7 +202,7 @@ export class YSync {
|
|
|
202
202
|
}
|
|
203
203
|
else if (update.type === "pointer") {
|
|
204
204
|
const key = UUID.toString(update.address.uuid);
|
|
205
|
-
const boxObject = asDefined(this.#
|
|
205
|
+
const boxObject = asDefined(this.#boxes.get(key), "Could not find box");
|
|
206
206
|
const { address: { fieldKeys }, newAddress } = update;
|
|
207
207
|
let field = boxObject.get("fields");
|
|
208
208
|
for (let i = 0; i < fieldKeys.length - 1; i++) {
|
|
@@ -211,7 +211,7 @@ export class YSync {
|
|
|
211
211
|
field.set(String(fieldKeys[fieldKeys.length - 1]), newAddress.mapOr(address => address.toString(), null));
|
|
212
212
|
}
|
|
213
213
|
else if (update.type === "delete") {
|
|
214
|
-
this.#
|
|
214
|
+
this.#boxes.delete(UUID.toString(update.uuid));
|
|
215
215
|
}
|
|
216
216
|
}), "[openDAW] updates");
|
|
217
217
|
this.#updates.length = 0;
|
|
@@ -220,4 +220,7 @@ export class YSync {
|
|
|
220
220
|
onUpdate: (update) => this.#updates.push(update)
|
|
221
221
|
}));
|
|
222
222
|
}
|
|
223
|
+
#getDoc() {
|
|
224
|
+
return asDefined(this.#boxes.doc, "Y.Map is not connect to Y.Doc");
|
|
225
|
+
}
|
|
223
226
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"test": "vitest run --config vitest.config.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@opendaw/lib-box": "^0.0.
|
|
30
|
-
"@opendaw/lib-dawproject": "^0.0.
|
|
31
|
-
"@opendaw/lib-dom": "^0.0.
|
|
32
|
-
"@opendaw/lib-dsp": "^0.0.
|
|
33
|
-
"@opendaw/lib-fusion": "^0.0.
|
|
34
|
-
"@opendaw/lib-runtime": "^0.0.
|
|
35
|
-
"@opendaw/lib-std": "^0.0.
|
|
36
|
-
"@opendaw/studio-adapters": "^0.0.
|
|
37
|
-
"@opendaw/studio-boxes": "^0.0.
|
|
38
|
-
"@opendaw/studio-enums": "^0.0.
|
|
29
|
+
"@opendaw/lib-box": "^0.0.38",
|
|
30
|
+
"@opendaw/lib-dawproject": "^0.0.24",
|
|
31
|
+
"@opendaw/lib-dom": "^0.0.38",
|
|
32
|
+
"@opendaw/lib-dsp": "^0.0.38",
|
|
33
|
+
"@opendaw/lib-fusion": "^0.0.38",
|
|
34
|
+
"@opendaw/lib-runtime": "^0.0.38",
|
|
35
|
+
"@opendaw/lib-std": "^0.0.38",
|
|
36
|
+
"@opendaw/studio-adapters": "^0.0.39",
|
|
37
|
+
"@opendaw/studio-boxes": "^0.0.38",
|
|
38
|
+
"@opendaw/studio-enums": "^0.0.29",
|
|
39
39
|
"dropbox": "^10.34.0",
|
|
40
40
|
"y-websocket": "^1.4.5",
|
|
41
41
|
"yjs": "^13.6.27",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@opendaw/eslint-config": "^0.0.20",
|
|
46
|
-
"@opendaw/studio-core-processors": "^0.0.
|
|
47
|
-
"@opendaw/studio-core-workers": "^0.0.
|
|
48
|
-
"@opendaw/studio-forge-boxes": "^0.0.
|
|
46
|
+
"@opendaw/studio-core-processors": "^0.0.39",
|
|
47
|
+
"@opendaw/studio-core-workers": "^0.0.34",
|
|
48
|
+
"@opendaw/studio-forge-boxes": "^0.0.38",
|
|
49
49
|
"@opendaw/typescript-config": "^0.0.20"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "5a6c7ff14cb76c6e46c9511799596a5133dae043"
|
|
52
52
|
}
|