@opendaw/lib-fusion 0.0.65 → 0.0.67
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/opfs/OpfsWorker.d.ts.map +1 -1
- package/dist/opfs/OpfsWorker.js +4 -0
- package/dist/peaks/Peaks.js +2 -2
- package/dist/preferences/Preferences.d.ts +15 -0
- package/dist/preferences/Preferences.d.ts.map +1 -0
- package/dist/preferences/Preferences.js +26 -0
- package/dist/preferences/PreferencesClient.d.ts +10 -0
- package/dist/preferences/PreferencesClient.d.ts.map +1 -0
- package/dist/preferences/PreferencesClient.js +20 -0
- package/dist/preferences/PreferencesFacade.d.ts +16 -0
- package/dist/preferences/PreferencesFacade.d.ts.map +1 -0
- package/dist/preferences/PreferencesFacade.js +31 -0
- package/dist/preferences/PreferencesHost.d.ts +16 -0
- package/dist/preferences/PreferencesHost.d.ts.map +1 -0
- package/dist/preferences/PreferencesHost.js +33 -0
- package/dist/preferences/PreferencesProtocol.d.ts +4 -0
- package/dist/preferences/PreferencesProtocol.d.ts.map +1 -0
- package/dist/preferences/PreferencesProtocol.js +1 -0
- package/dist/preferences/index.d.ts +6 -0
- package/dist/preferences/index.d.ts.map +1 -0
- package/dist/preferences/index.js +5 -0
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,eAAe,CAAA;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,eAAe,CAAA;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpfsWorker.d.ts","sourceRoot":"","sources":["../../src/opfs/OpfsWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAE3C,yBAAiB,UAAU,CAAC;IAGjB,MAAM,IAAI,GAAI,WAAW,SAAS;;oBAIf,MAAM,QAAQ,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"OpfsWorker.d.ts","sourceRoot":"","sources":["../../src/opfs/OpfsWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAE3C,yBAAiB,UAAU,CAAC;IAGjB,MAAM,IAAI,GAAI,WAAW,SAAS;;oBAIf,MAAM,QAAQ,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;mBAkBzC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;qBAe1B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mBASxB,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;iBAWrD,OAAO,CAAC,IAAI,CAAC;kCAWT,CAAC,QAAQ,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;wCAqBnD,MAAM,YAAY,6BAA6B,GAAG,OAAO,CAAC,0BAA0B,CAAC;8CAO/E,aAAa,CAAC,MAAM,CAAC,YACrB,6BAA6B,GAAG,OAAO,CAAC,yBAAyB,CAAC;MAKnG,CAAA;CAMT"}
|
package/dist/opfs/OpfsWorker.js
CHANGED
|
@@ -16,6 +16,10 @@ export var OpfsWorker;
|
|
|
16
16
|
handle.write(data.buffer, { at: 0 });
|
|
17
17
|
handle.flush();
|
|
18
18
|
}
|
|
19
|
+
catch (reason) {
|
|
20
|
+
console.error("OPFS write failed:", reason?.name, reason?.message, reason?.stack ?? "(no stack trace)");
|
|
21
|
+
throw reason;
|
|
22
|
+
}
|
|
19
23
|
finally {
|
|
20
24
|
handle.close();
|
|
21
25
|
}
|
package/dist/peaks/Peaks.js
CHANGED
|
@@ -37,7 +37,7 @@ export class SamplePeaks {
|
|
|
37
37
|
const dataOffset = input.readInt();
|
|
38
38
|
const numPeaks = input.readInt();
|
|
39
39
|
const shift = input.readInt();
|
|
40
|
-
input.readInt(); //
|
|
40
|
+
input.readInt(); // deprecated (was mask)
|
|
41
41
|
stages[i] = new Peaks.Stage(shift, numPeaks, dataOffset);
|
|
42
42
|
}
|
|
43
43
|
const numData = input.readInt();
|
|
@@ -90,7 +90,7 @@ export class SamplePeaks {
|
|
|
90
90
|
output.writeInt(dataOffset);
|
|
91
91
|
output.writeInt(numPeaks);
|
|
92
92
|
output.writeInt(shift);
|
|
93
|
-
output.writeInt(
|
|
93
|
+
output.writeInt(0); // deprecated (was mask)
|
|
94
94
|
}
|
|
95
95
|
output.writeInt(this.data.length);
|
|
96
96
|
for (let i = 0; i < this.data.length; i++) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MutableObservableValue, Observer, PathTuple, Subscription, Terminable, ValueAtPath } from "@opendaw/lib-std";
|
|
2
|
+
import { PreferencesFacade } from "./PreferencesFacade";
|
|
3
|
+
import { PreferencesHost } from "./PreferencesHost";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export interface Preferences<SETTINGS> {
|
|
6
|
+
get settings(): SETTINGS;
|
|
7
|
+
subscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
8
|
+
catchupAndSubscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
9
|
+
createMutableObservableValue<P extends PathTuple<SETTINGS>>(...path: P): MutableObservableValue<ValueAtPath<SETTINGS, P>> & Terminable;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace Preferences {
|
|
12
|
+
const host: <SETTINGS extends object>(key: string, zod: z.ZodType<SETTINGS>) => PreferencesHost<SETTINGS>;
|
|
13
|
+
const facade: <SETTINGS extends object>(key: string, zod: z.ZodType<SETTINGS>) => PreferencesFacade<SETTINGS>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Preferences.d.ts","sourceRoot":"","sources":["../../src/preferences/Preferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EAEV,WAAW,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,MAAM,WAAW,WAAW,CAAC,QAAQ;IACjC,IAAI,QAAQ,IAAI,QAAQ,CAAA;IACxB,SAAS,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EACnC,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY,CAAA;IAC3E,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAC7C,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY,CAAA;IAC3E,4BAA4B,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAChE,sBAAsB,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,CAAA;CACtE;AAED,yBAAiB,WAAW,CAAC;IAClB,MAAM,IAAI,GAAI,QAAQ,SAAS,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAG,eAAe,CAAC,QAAQ,CAI7G,CAAA;IAEM,MAAM,MAAM,GAAI,QAAQ,SAAS,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAG,iBAAiB,CAAC,QAAQ,CAIjH,CAAA;CAYJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isDefined, tryCatch } from "@opendaw/lib-std";
|
|
2
|
+
import { PreferencesFacade } from "./PreferencesFacade";
|
|
3
|
+
import { PreferencesHost } from "./PreferencesHost";
|
|
4
|
+
export var Preferences;
|
|
5
|
+
(function (Preferences) {
|
|
6
|
+
Preferences.host = (key, zod) => {
|
|
7
|
+
const facade = new PreferencesHost(loadFromStorage(key, zod));
|
|
8
|
+
facade.subscribeAll(() => tryCatch(() => localStorage.setItem(key, JSON.stringify(facade.settings))));
|
|
9
|
+
return facade;
|
|
10
|
+
};
|
|
11
|
+
Preferences.facade = (key, zod) => {
|
|
12
|
+
const facade = new PreferencesFacade(loadFromStorage(key, zod));
|
|
13
|
+
facade.subscribeAll(() => tryCatch(() => localStorage.setItem(key, JSON.stringify(facade.settings))));
|
|
14
|
+
return facade;
|
|
15
|
+
};
|
|
16
|
+
const loadFromStorage = (key, zod) => {
|
|
17
|
+
const stored = localStorage.getItem(key);
|
|
18
|
+
if (isDefined(stored)) {
|
|
19
|
+
const { status, value } = tryCatch(() => JSON.parse(stored));
|
|
20
|
+
if (status === "success") {
|
|
21
|
+
return zod.parse(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return zod.parse({});
|
|
25
|
+
};
|
|
26
|
+
})(Preferences || (Preferences = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observer, PathTuple, Subscription, Terminable, ValueAtPath } from "@opendaw/lib-std";
|
|
2
|
+
import { Messenger } from "@opendaw/lib-runtime";
|
|
3
|
+
export declare class PreferencesClient<SETTINGS extends object> implements Terminable {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(messenger: Messenger, settings: SETTINGS);
|
|
6
|
+
get settings(): Readonly<SETTINGS>;
|
|
7
|
+
catchupAndSubscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
8
|
+
terminate(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PreferencesClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferencesClient.d.ts","sourceRoot":"","sources":["../../src/preferences/PreferencesClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAc,WAAW,EAAgB,MAAM,kBAAkB,CAAA;AACtH,OAAO,EAAe,SAAS,EAAC,MAAM,sBAAsB,CAAA;AAG5D,qBAAa,iBAAiB,CAAC,QAAQ,SAAS,MAAM,CAAE,YAAW,UAAU;;gBAI7D,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;IAOpD,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAA2B;IAE7D,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAC7C,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY;IAI3E,SAAS,IAAI,IAAI;CAIpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Terminator, VirtualObject } from "@opendaw/lib-std";
|
|
2
|
+
import { Communicator } from "@opendaw/lib-runtime";
|
|
3
|
+
export class PreferencesClient {
|
|
4
|
+
#terminator = new Terminator();
|
|
5
|
+
#object;
|
|
6
|
+
constructor(messenger, settings) {
|
|
7
|
+
this.#object = this.#terminator.own(new VirtualObject(settings));
|
|
8
|
+
this.#terminator.own(Communicator.executor(messenger, {
|
|
9
|
+
updateSettings: (preferences) => this.#object.update(preferences)
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
get settings() { return this.#object.data; }
|
|
13
|
+
catchupAndSubscribe(observer, ...path) {
|
|
14
|
+
return this.#object.catchupAndSubscribe(observer, ...path);
|
|
15
|
+
}
|
|
16
|
+
terminate() {
|
|
17
|
+
this.#terminator.terminate();
|
|
18
|
+
this.#object.terminate();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MutableObservableValue, Observer, PathTuple, Subscription, Terminable, ValueAtPath } from "@opendaw/lib-std";
|
|
2
|
+
import { Preferences } from "./Preferences";
|
|
3
|
+
import { PreferencesHost } from "./PreferencesHost";
|
|
4
|
+
export declare class PreferencesFacade<SETTINGS extends object> implements Preferences<SETTINGS>, Terminable {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(settings: SETTINGS);
|
|
7
|
+
setHost(host: PreferencesHost<SETTINGS>): void;
|
|
8
|
+
releaseHost(): void;
|
|
9
|
+
get settings(): SETTINGS;
|
|
10
|
+
subscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
11
|
+
subscribeAll(observer: Observer<keyof SETTINGS>): Subscription;
|
|
12
|
+
catchupAndSubscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
13
|
+
createMutableObservableValue<P extends PathTuple<SETTINGS>>(...path: P): MutableObservableValue<ValueAtPath<SETTINGS, P>> & Terminable;
|
|
14
|
+
terminate(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=PreferencesFacade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferencesFacade.d.ts","sourceRoot":"","sources":["../../src/preferences/PreferencesFacade.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EAEV,WAAW,EAEd,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AAEjD,qBAAa,iBAAiB,CAAC,QAAQ,SAAS,MAAM,CAAE,YAAW,WAAW,CAAC,QAAQ,CAAC,EAAE,UAAU;;gBAKpF,QAAQ,EAAE,QAAQ;IAI9B,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI;IAU9C,WAAW,IAAI,IAAI;IAEnB,IAAI,QAAQ,IAAI,QAAQ,CAA4B;IAEpD,SAAS,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EACnC,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY;IAI3E,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,YAAY;IAI9D,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAC7C,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY;IAI3E,4BAA4B,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAChE,sBAAsB,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU;IAInE,SAAS,IAAI,IAAI;CACpB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Terminator, VirtualObject } from "@opendaw/lib-std";
|
|
2
|
+
import { queueTask } from "@opendaw/lib-dom";
|
|
3
|
+
export class PreferencesFacade {
|
|
4
|
+
#terminator = new Terminator();
|
|
5
|
+
#lifecycle = this.#terminator.own(new Terminator());
|
|
6
|
+
#object;
|
|
7
|
+
constructor(settings) {
|
|
8
|
+
this.#object = this.#terminator.own(new VirtualObject(settings));
|
|
9
|
+
}
|
|
10
|
+
setHost(host) {
|
|
11
|
+
this.#lifecycle.terminate();
|
|
12
|
+
host.update(this.#object.data);
|
|
13
|
+
const queueHostUpdate = queueTask(() => host.update(this.#object.data));
|
|
14
|
+
this.#lifecycle.ownAll(host.subscribeAll(() => this.#object.update(host.settings)), this.#object.subscribeAll(queueHostUpdate));
|
|
15
|
+
}
|
|
16
|
+
releaseHost() { this.#lifecycle.terminate(); }
|
|
17
|
+
get settings() { return this.#object.proxy; }
|
|
18
|
+
subscribe(observer, ...path) {
|
|
19
|
+
return this.#object.subscribe(observer, ...path);
|
|
20
|
+
}
|
|
21
|
+
subscribeAll(observer) {
|
|
22
|
+
return this.#object.subscribeAll(observer);
|
|
23
|
+
}
|
|
24
|
+
catchupAndSubscribe(observer, ...path) {
|
|
25
|
+
return this.#object.catchupAndSubscribe(observer, ...path);
|
|
26
|
+
}
|
|
27
|
+
createMutableObservableValue(...path) {
|
|
28
|
+
return this.#object.createMutableObservableValue(...path);
|
|
29
|
+
}
|
|
30
|
+
terminate() { this.#terminator.terminate(); }
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MutableObservableValue, Observer, PathTuple, Subscription, Terminable, ValueAtPath } from "@opendaw/lib-std";
|
|
2
|
+
import { Messenger } from "@opendaw/lib-runtime";
|
|
3
|
+
import { Preferences } from "./Preferences";
|
|
4
|
+
export declare class PreferencesHost<SETTINGS extends object> implements Preferences<SETTINGS>, Terminable {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(settings: SETTINGS);
|
|
7
|
+
get settings(): SETTINGS;
|
|
8
|
+
syncWith(messenger: Messenger): Subscription;
|
|
9
|
+
update(data: SETTINGS): void;
|
|
10
|
+
subscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
11
|
+
catchupAndSubscribe<P extends PathTuple<SETTINGS>>(observer: Observer<ValueAtPath<SETTINGS, P>>, ...path: P): Subscription;
|
|
12
|
+
createMutableObservableValue<P extends PathTuple<SETTINGS>>(...path: P): MutableObservableValue<ValueAtPath<SETTINGS, P>> & Terminable;
|
|
13
|
+
subscribeAll(observer: Observer<keyof SETTINGS>): Subscription;
|
|
14
|
+
terminate(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=PreferencesHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferencesHost.d.ts","sourceRoot":"","sources":["../../src/preferences/PreferencesHost.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EAEV,WAAW,EAEd,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAe,SAAS,EAAC,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAGzC,qBAAa,eAAe,CAAC,QAAQ,SAAS,MAAM,CAAE,YAAW,WAAW,CAAC,QAAQ,CAAC,EAAE,UAAU;;gBAIlF,QAAQ,EAAE,QAAQ;IAE9B,IAAI,QAAQ,IAAI,QAAQ,CAA4B;IAEpD,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY;IAY5C,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAE5B,SAAS,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EACnC,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY;IAI3E,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAC7C,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY;IAI3E,4BAA4B,CAAC,CAAC,SAAS,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,sBAAsB,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU;IAItI,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,QAAQ,CAAC,GAAG,YAAY;IAI9D,SAAS,IAAI,IAAI;CACpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Terminator, VirtualObject } from "@opendaw/lib-std";
|
|
2
|
+
import { queueTask } from "@opendaw/lib-dom";
|
|
3
|
+
import { Communicator } from "@opendaw/lib-runtime";
|
|
4
|
+
export class PreferencesHost {
|
|
5
|
+
#terminator = new Terminator();
|
|
6
|
+
#object;
|
|
7
|
+
constructor(settings) { this.#object = this.#terminator.own(new VirtualObject(settings)); }
|
|
8
|
+
get settings() { return this.#object.proxy; }
|
|
9
|
+
syncWith(messenger) {
|
|
10
|
+
const client = Communicator.sender(messenger, ({ dispatchAndForget }) => new class {
|
|
11
|
+
updateSettings(preferences) {
|
|
12
|
+
dispatchAndForget(this.updateSettings, preferences);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const queue = queueTask(() => client.updateSettings(this.#object.data));
|
|
16
|
+
client.updateSettings(this.#object.data);
|
|
17
|
+
return this.#object.subscribeAll(queue);
|
|
18
|
+
}
|
|
19
|
+
update(data) { this.#object.update(data); }
|
|
20
|
+
subscribe(observer, ...path) {
|
|
21
|
+
return this.#object.subscribe(observer, ...path);
|
|
22
|
+
}
|
|
23
|
+
catchupAndSubscribe(observer, ...path) {
|
|
24
|
+
return this.#object.catchupAndSubscribe(observer, ...path);
|
|
25
|
+
}
|
|
26
|
+
createMutableObservableValue(...path) {
|
|
27
|
+
return this.#object.createMutableObservableValue(...path);
|
|
28
|
+
}
|
|
29
|
+
subscribeAll(observer) {
|
|
30
|
+
return this.#object.subscribeAll(observer);
|
|
31
|
+
}
|
|
32
|
+
terminate() { this.#terminator.terminate(); }
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferencesProtocol.d.ts","sourceRoot":"","sources":["../../src/preferences/PreferencesProtocol.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB,CAAC,QAAQ;IACzC,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preferences/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/lib-fusion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.67",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "LGPL-3.0-or-later",
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
"test": "vitest run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@opendaw/lib-box": "^0.0.
|
|
27
|
-
"@opendaw/lib-
|
|
28
|
-
"@opendaw/lib-
|
|
26
|
+
"@opendaw/lib-box": "^0.0.64",
|
|
27
|
+
"@opendaw/lib-dom": "^0.0.64",
|
|
28
|
+
"@opendaw/lib-runtime": "^0.0.63",
|
|
29
|
+
"@opendaw/lib-std": "^0.0.63"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@opendaw/eslint-config": "^0.0.27",
|
|
32
|
-
"@opendaw/typescript-config": "^0.0.
|
|
33
|
+
"@opendaw/typescript-config": "^0.0.28",
|
|
33
34
|
"jsdom": "^25.0.1",
|
|
34
35
|
"vitest": "^2.1.8"
|
|
35
36
|
},
|
|
36
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "db2b1bd172607177fef63077c2eed9b7cbec167f"
|
|
37
38
|
}
|