@opendaw/studio-core 0.0.42 → 0.0.43
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/AssetService.d.ts +18 -0
- package/dist/AssetService.d.ts.map +1 -0
- package/dist/AssetService.js +49 -0
- package/dist/cloud/CloudAuthManager.d.ts.map +1 -1
- package/dist/cloud/CloudAuthManager.js +3 -2
- package/dist/dawproject/DawProjectService.js +1 -1
- package/dist/env.d.ts +6 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +9 -0
- package/dist/processors.js +3 -3
- package/dist/processors.js.map +3 -3
- package/dist/samples/SampleService.d.ts +7 -13
- package/dist/samples/SampleService.d.ts.map +1 -1
- package/dist/samples/SampleService.js +10 -41
- package/dist/soundfont/OpenSoundfontAPI.js +1 -1
- package/dist/soundfont/SoundfontService.d.ts +7 -13
- package/dist/soundfont/SoundfontService.d.ts.map +1 -1
- package/dist/soundfont/SoundfontService.js +22 -51
- package/dist/workers-main.js +2 -2
- package/dist/workers-main.js.map +3 -3
- package/dist/ysync/YService.d.ts.map +1 -1
- package/dist/ysync/YService.js +2 -3
- package/package.json +15 -15
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Procedure, Progress, UUID } from "@opendaw/lib-std";
|
|
2
|
+
export declare namespace AssetService {
|
|
3
|
+
type ImportArgs = {
|
|
4
|
+
uuid?: UUID.Bytes;
|
|
5
|
+
name?: string;
|
|
6
|
+
arrayBuffer: ArrayBuffer;
|
|
7
|
+
progressHandler?: Progress.Handler;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class AssetService<T> {
|
|
11
|
+
protected readonly onUpdate: Procedure<T>;
|
|
12
|
+
protected abstract readonly nameSingular: string;
|
|
13
|
+
protected abstract readonly namePlural: string;
|
|
14
|
+
protected constructor(onUpdate: Procedure<T>);
|
|
15
|
+
abstract importFile(args: AssetService.ImportArgs): Promise<T>;
|
|
16
|
+
protected browseFiles(multiple: boolean, filePickerSettings: FilePickerOptions): Promise<ReadonlyArray<T>>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=AssetService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetService.d.ts","sourceRoot":"","sources":["../src/AssetService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,SAAS,EAAE,QAAQ,EAAmB,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAIlH,yBAAiB,YAAY,CAAC;IAC1B,KAAY,UAAU,GAAG;QACrB,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAA;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,WAAW,CAAC;QACzB,eAAe,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAA;KACrC,CAAA;CACJ;AAED,8BAAsB,YAAY,CAAC,CAAC;IAIV,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAH/D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAChD,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAE9C,SAAS,aAAgC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/D,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;cAE9C,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAmCnH"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefaultObservableValue, Errors, panic, Progress, RuntimeNotifier } from "@opendaw/lib-std";
|
|
2
|
+
import { Files } from "@opendaw/lib-dom";
|
|
3
|
+
import { Promises } from "@opendaw/lib-runtime";
|
|
4
|
+
export class AssetService {
|
|
5
|
+
onUpdate;
|
|
6
|
+
constructor(onUpdate) {
|
|
7
|
+
this.onUpdate = onUpdate;
|
|
8
|
+
}
|
|
9
|
+
async browseFiles(multiple, filePickerSettings) {
|
|
10
|
+
const { error, status, value: files } = await Promises.tryCatch(Files.open({ ...filePickerSettings, multiple }));
|
|
11
|
+
if (status === "rejected") {
|
|
12
|
+
if (Errors.isAbort(error)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return panic(String(error));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const progress = new DefaultObservableValue(0.0);
|
|
20
|
+
const dialog = RuntimeNotifier.progress({
|
|
21
|
+
headline: `Importing ${files.length === 1 ? this.nameSingular : this.namePlural}...`, progress
|
|
22
|
+
});
|
|
23
|
+
const progressHandler = Progress.split(value => progress.setValue(value), files.length);
|
|
24
|
+
const rejected = [];
|
|
25
|
+
const imported = [];
|
|
26
|
+
for (const [index, file] of files.entries()) {
|
|
27
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
28
|
+
const { status, value, error } = await Promises.tryCatch(this.importFile({
|
|
29
|
+
name: file.name,
|
|
30
|
+
arrayBuffer: arrayBuffer,
|
|
31
|
+
progressHandler: progressHandler[index]
|
|
32
|
+
}));
|
|
33
|
+
if (status === "rejected") {
|
|
34
|
+
rejected.push(String(error));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
imported.push(value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
dialog.terminate();
|
|
41
|
+
if (rejected.length > 0) {
|
|
42
|
+
await RuntimeNotifier.info({
|
|
43
|
+
headline: `${this.nameSingular} Import Issues`,
|
|
44
|
+
message: `${rejected.join(", ")} could not be imported.`
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return imported;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudAuthManager.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudAuthManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"CloudAuthManager.d.ts","sourceRoot":"","sources":["../../src/cloud/CloudAuthManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAK3C,qBAAa,gBAAgB;;IACzB,MAAM,CAAC,MAAM,IAAI,gBAAgB;IAqBjC,QAAQ,CAAC,EAAE,SAAyB;IAIpC,OAAO;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAuLjE"}
|
|
@@ -2,6 +2,7 @@ import { asDefined, Errors, isDefined, isNull, Maps, panic, RuntimeNotifier, Tim
|
|
|
2
2
|
import { Promises } from "@opendaw/lib-runtime";
|
|
3
3
|
import { DropboxHandler } from "./DropboxHandler";
|
|
4
4
|
import { GoogleDriveHandler } from "./GoogleDriveHandler";
|
|
5
|
+
import { VITE_DROPBOX_CLIENT_ID, VITE_GOOGLE_CLIENT_ID } from "../env";
|
|
5
6
|
export class CloudAuthManager {
|
|
6
7
|
static create() { return new CloudAuthManager(); }
|
|
7
8
|
static async #createCodes() {
|
|
@@ -130,7 +131,7 @@ export class CloudAuthManager {
|
|
|
130
131
|
async #oauthDropbox() {
|
|
131
132
|
return this.#oauthPkceFlow({
|
|
132
133
|
service: "dropbox",
|
|
133
|
-
clientId: asDefined(
|
|
134
|
+
clientId: asDefined(VITE_DROPBOX_CLIENT_ID, "Missing VITE_DROPBOX_CLIENT_ID"),
|
|
134
135
|
authUrlBase: "https://www.dropbox.com/oauth2/authorize",
|
|
135
136
|
tokenUrl: "https://api.dropboxapi.com/oauth2/token",
|
|
136
137
|
scope: "", // Dropbox scope is optional
|
|
@@ -140,7 +141,7 @@ export class CloudAuthManager {
|
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
143
|
async #oauthGoogle() {
|
|
143
|
-
const clientId = asDefined(
|
|
144
|
+
const clientId = asDefined(VITE_GOOGLE_CLIENT_ID, "Missing VITE_GOOGLE_CLIENT_ID");
|
|
144
145
|
const scope = "https://www.googleapis.com/auth/drive.appdata";
|
|
145
146
|
const redirectUri = `${location.origin}/auth-callback.html`;
|
|
146
147
|
const params = new URLSearchParams({
|
|
@@ -33,7 +33,7 @@ export class DawProjectService {
|
|
|
33
33
|
const { skeleton, audioIds } = importResult.value;
|
|
34
34
|
await Promise.all(audioIds
|
|
35
35
|
.map(uuid => resources.fromUUID(uuid))
|
|
36
|
-
.map(resource => this.sampleService.
|
|
36
|
+
.map(resource => this.sampleService.importFile({
|
|
37
37
|
uuid: resource.uuid,
|
|
38
38
|
name: resource.name,
|
|
39
39
|
arrayBuffer: resource.buffer
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const VITE_GOOGLE_CLIENT_ID: string;
|
|
2
|
+
export declare const VITE_DROPBOX_CLIENT_ID: string;
|
|
3
|
+
export declare const VITE_VJS_USE_LOCAL_SERVER: string;
|
|
4
|
+
export declare const VITE_VJS_LOCAL_SERVER_URL: string;
|
|
5
|
+
export declare const VITE_VJS_ONLINE_SERVER_URL: string;
|
|
6
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,EAAgC,MAAM,CAAA;AACxE,eAAO,MAAM,sBAAsB,EAAiC,MAAM,CAAA;AAC1E,eAAO,MAAM,yBAAyB,EAAoC,MAAM,CAAA;AAChF,eAAO,MAAM,yBAAyB,EAAoC,MAAM,CAAA;AAChF,eAAO,MAAM,0BAA0B,EAAqC,MAAM,CAAA"}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This works in both Vite and Next.js
|
|
2
|
+
const env = typeof window !== "undefined" && import.meta.env
|
|
3
|
+
? import.meta.env // Vite (browser)
|
|
4
|
+
: process.env; // Next.js (gets replaced at build time)
|
|
5
|
+
export const VITE_GOOGLE_CLIENT_ID = env.VITE_GOOGLE_CLIENT_ID;
|
|
6
|
+
export const VITE_DROPBOX_CLIENT_ID = env.VITE_DROPBOX_CLIENT_ID;
|
|
7
|
+
export const VITE_VJS_USE_LOCAL_SERVER = env.VITE_VJS_USE_LOCAL_SERVER;
|
|
8
|
+
export const VITE_VJS_LOCAL_SERVER_URL = env.VITE_VJS_LOCAL_SERVER_URL;
|
|
9
|
+
export const VITE_VJS_ONLINE_SERVER_URL = env.VITE_VJS_ONLINE_SERVER_URL;
|