@moises.ai/extension 1.0.2 → 1.0.3

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
@@ -1,4 +1,51 @@
1
1
 
2
+ /** Link API for managing extension links */
3
+ export interface LinkApi {
4
+
5
+ /** Creates a context menu item for tracks */
6
+ trackContextMenu: (config: {
7
+
8
+ /** Display label for the menu item */
9
+ label: string;
10
+ }, onClick: {
11
+
12
+ /** Parameters passed to the onClick handler */
13
+ params: any;
14
+ }) => void;
15
+
16
+ /** Creates a context menu item for single track selections */
17
+ singleTrackSelectionContextMenu: (config: {
18
+
19
+ /** Display label for the menu item */
20
+ label: string;
21
+ }, onClick: {
22
+
23
+ /** Parameters passed to the onClick handler */
24
+ params: any;
25
+ }) => void;
26
+
27
+ /** Creates a button in the toolbar */
28
+ toolbarButton: (config: {
29
+
30
+ /** Display label for the button */
31
+ label: string;
32
+
33
+ /** Icon identifier for the button */
34
+ icon: string;
35
+ }, onClick: Function) => void;
36
+
37
+ /** Creates a button in the footer */
38
+ footerButton: (config: {
39
+
40
+ /** Display label for the button */
41
+ label: string;
42
+
43
+ /** Icon identifier for the button */
44
+ icon: string;
45
+ }, onClick: Function) => void;
46
+ }
47
+
48
+
2
49
  /** Controlling common UI elements */
3
50
  export interface UiApi {
4
51
 
@@ -285,10 +332,10 @@ export interface ComputeApi {
285
332
 
286
333
  /** The target for the session player */
287
334
  inpaintingTarget: any[];
288
- }) => Promise<void>;
335
+ }) => Promise<any>;
289
336
 
290
337
  /** Gets the list of session player presets */
291
- sessionPlayerPresets: () => Promise<void>;
338
+ sessionPlayerPresets: () => void;
292
339
 
293
340
  /** Inpaints an audio file */
294
341
  sessionPlayerInpaint: (params: {
@@ -298,7 +345,7 @@ export interface ComputeApi {
298
345
 
299
346
  /** The mask for the inpainting */
300
347
  mask: any;
301
- }) => Promise<void>;
348
+ }) => Promise<any>;
302
349
 
303
350
  /** Runs a workflow */
304
351
  workflow: (params: {
@@ -306,26 +353,36 @@ export interface ComputeApi {
306
353
  /** The ID of the workflow to run */
307
354
  workflowId: string;
308
355
 
309
- /** The parameters for the workflow TODO: add type */
356
+ /** The parameters for the workflow */
310
357
  params: any;
311
- }) => Promise<void>;
358
+ }) => Promise<any>;
312
359
 
313
360
  /** Runs an automix job */
314
361
  automix: (params: {
315
362
 
316
- /** The ID of the workflow to run TODO: add type */
363
+ /** The ID of the workflow to run */
317
364
  workflowId: string;
318
365
 
319
- /** The parameters for the workflow TODO: add type */
366
+ /** The parameters for the workflow */
320
367
  params: any;
321
- }) => Promise<void>;
368
+ }) => Promise<any>;
369
+
370
+ /** Extracts stems from an audio file */
371
+ stems: (params: {
372
+
373
+ /** The input audio data */
374
+ input: string;
375
+
376
+ /** The stems to extract */
377
+ stemsToExtract: any[];
378
+ }) => Promise<any>;
322
379
 
323
380
  /** Detects instruments in an audio file */
324
381
  instruments: (params: {
325
382
 
326
383
  /** The input audio data */
327
- input: string;
328
- }) => Promise<void>;
384
+ inputUrl: string;
385
+ }) => Promise<any>;
329
386
 
330
387
  /** Detects chords in an audio file */
331
388
  chords: (params: {
@@ -354,16 +411,6 @@ export interface ComputeApi {
354
411
  /** The input audio data */
355
412
  input: string;
356
413
  }) => Promise<void>;
357
-
358
- /** Extracts stems from an audio file */
359
- stems: (params: {
360
-
361
- /** The input audio data */
362
- input: string;
363
-
364
- /** The stems to extract */
365
- stemsToExtract: any[];
366
- }) => void;
367
414
  }
368
415
 
369
416
 
@@ -379,6 +426,8 @@ export interface RegisterApi {
379
426
 
380
427
 
381
428
  export interface MoisesAPI {
429
+ /** Link API for managing extension links */
430
+ link: LinkApi;
382
431
  /** Controlling common UI elements */
383
432
  ui: UiApi;
384
433
  /** Session API for managing audio sessions, tracks, and playback controls */
@@ -422,6 +471,8 @@ export interface MoisesHook {
422
471
  isConnected: boolean;
423
472
  /** Modal layout component for plugin UI */
424
473
  ModalLayout: (props: { children: any; width?: number; height?: number; }) => any;
474
+ /** Modal layout component for plugin UI */
475
+ SidebarLayout: (props: { children: any; width?: number; title?: string; }) => any;
425
476
  }
426
477
 
427
478
  export interface ExtensionOptions {
package/dist/index.js CHANGED
@@ -1,134 +1,132 @@
1
- import { jsx as l, jsxs as b } from "react/jsx-runtime";
2
- import { useState as C, useEffect as g } from "react";
3
- import { M as k, R as M } from "./client-BuA0RRm3.js";
4
- import { Box as m, HeaderPanel as h } from "@moises.ai/design-system";
5
- import { Cross1Icon as S } from "@moises.ai/design-system/icons";
6
- function P(i) {
7
- i.id;
8
- let t = null, s = !1;
9
- function r() {
10
- const [c, o] = C({
1
+ import { jsxs as b, jsx as a } from "react/jsx-runtime";
2
+ import { useEffect as g, useState as k } from "react";
3
+ import { M as C, R as S } from "./client-BuA0RRm3.js";
4
+ import { Box as m, HeaderPanel as p } from "@moises.ai/design-system";
5
+ import { Cross1Icon as M } from "@moises.ai/design-system/icons";
6
+ function P({ state: r }) {
7
+ const { moises: n } = r;
8
+ function i({ children: s, title: c = "Sidebar Menu", width: u = "300" }) {
9
+ return g(() => {
10
+ n && n.ui.setPluginSize({ width: u, height: 0 });
11
+ }, [u, n]), /* @__PURE__ */ b(
12
+ m,
13
+ {
14
+ height: "100vh",
15
+ style: {
16
+ height: "100vh",
17
+ backgroundColor: "var(--gray-1)",
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ overflow: "hidden"
21
+ },
22
+ children: [
23
+ /* @__PURE__ */ a(
24
+ m,
25
+ {
26
+ p: "4",
27
+ style: {
28
+ position: "sticky",
29
+ top: 0,
30
+ zIndex: 10,
31
+ backgroundColor: "var(--neutral-2)"
32
+ },
33
+ children: /* @__PURE__ */ a(p, { title: c, children: /* @__PURE__ */ a(
34
+ p.Button,
35
+ {
36
+ onClick: () => {
37
+ n.ui.close();
38
+ },
39
+ children: /* @__PURE__ */ a(M, {})
40
+ }
41
+ ) })
42
+ }
43
+ ),
44
+ /* @__PURE__ */ a(
45
+ m,
46
+ {
47
+ px: "4",
48
+ style: {
49
+ flex: 1,
50
+ overflowY: "auto",
51
+ backgroundColor: "var(--neutral-2)"
52
+ },
53
+ children: s
54
+ }
55
+ )
56
+ ]
57
+ }
58
+ );
59
+ }
60
+ return i;
61
+ }
62
+ function z(r) {
63
+ r.id;
64
+ let n = null, i = !1;
65
+ function s() {
66
+ const [c, u] = k({
11
67
  plugin: null,
12
- isConnected: s,
68
+ isConnected: i,
13
69
  moises: null
14
70
  });
15
71
  g(() => {
16
- t || (t = k(i), o((n) => ({
17
- ...n,
18
- plugin: t.plugin,
19
- moises: t
72
+ n || (n = C(r), u((l) => ({
73
+ ...l,
74
+ plugin: n.plugin,
75
+ moises: n
20
76
  // The entire pluginInstance IS the moises API
21
77
  })));
22
- }, [i]), g(() => {
23
- t && !s && t.connect().then(() => {
24
- s = !0, o((n) => ({
25
- ...n,
78
+ }, [r]), g(() => {
79
+ n && !i && n.connect().then(() => {
80
+ i = !0, u((l) => ({
81
+ ...l,
26
82
  isConnected: !0
27
83
  }));
28
84
  });
29
85
  }, []);
30
- function p({ children: n, width: a, height: d }) {
31
- const { moises: e } = c;
86
+ const h = P({ state: c });
87
+ function o({ children: l, width: d, height: e }) {
88
+ const { moises: t } = c;
32
89
  return g(() => {
33
- e && e.ui.setPluginSize({ width: a, height: d });
34
- }, [a, d, e]), /* @__PURE__ */ l("div", { height: "100vh", style: { height: "100vh", backgroundColor: "var(--gray-1)" }, children: /* @__PURE__ */ l("div", { p: "4", children: n }) });
90
+ t && t.ui.setPluginSize({ width: d, height: e });
91
+ }, [d, e, t]), /* @__PURE__ */ a("div", { height: "100vh", style: { height: "100vh", backgroundColor: "var(--gray-1)" }, children: /* @__PURE__ */ a("div", { p: "4", children: l }) });
35
92
  }
36
93
  return {
37
94
  ...c,
38
- ModalLayout: p
95
+ ModalLayout: o,
96
+ SidebarLayout: h
39
97
  };
40
98
  }
41
- return r;
99
+ return s;
42
100
  }
43
- function I({ id: i, url: t, exposedAPI: s, iframeRef: r, onRegisterMetadata: c, onRegisterLink: o }) {
44
- const p = {
45
- id: i,
46
- url: t
101
+ function I({ id: r, url: n, exposedAPI: i, iframeRef: s, onRegisterMetadata: c, onRegisterLink: u }) {
102
+ const h = {
103
+ id: r,
104
+ url: n
47
105
  };
48
- r.current && (r.current.src = t);
49
- const n = new M({
50
- target: r.current.contentWindow
106
+ s.current && (s.current.src = n);
107
+ const o = new S({
108
+ target: s.current.contentWindow
51
109
  });
52
- n.on("register.extension", async (e) => {
110
+ o.on("register.extension", async (e) => {
53
111
  c(e);
54
- }), n.on("register.link", async ({ category: e, options: u }) => {
55
- const f = `link:${e}:${u.label}`;
56
- return o({ id: f, category: e, options: u }), { id: f };
112
+ }), o.on("register.link", async ({ category: e, options: t }) => {
113
+ const f = `link:${e}:${t.label}`;
114
+ return u({ id: f, category: e, options: t }), { id: f };
57
115
  });
58
- for (const [e, u] of Object.entries(s))
59
- for (const [f, x] of Object.entries(u)) {
116
+ for (const [e, t] of Object.entries(i))
117
+ for (const [f, y] of Object.entries(t)) {
60
118
  const v = `${e}.${f}`;
61
- n.on(v, async (y) => await x(y));
119
+ o.on(v, async (x) => await y(x));
62
120
  }
63
- function a(e, u) {
64
- return n.call(e, u);
121
+ function l(e, t) {
122
+ return o.call(e, t);
65
123
  }
66
124
  function d() {
67
- n.disconnect();
125
+ o.disconnect();
68
126
  }
69
- return { plugin: p, rpc: n, call: a, disconnect: d };
70
- }
71
- function B({
72
- children: i,
73
- init: t = {},
74
- title: s = "Sidebar Menu",
75
- width: r = "300px",
76
- height: c = "600px"
77
- }) {
78
- const { moises: o } = P(t);
79
- return g(() => {
80
- o && o.ui.setPluginSize({ width: r, height: c });
81
- }, [r, c, o]), /* @__PURE__ */ b(
82
- m,
83
- {
84
- height: "100vh",
85
- style: {
86
- height: "100vh",
87
- backgroundColor: "var(--gray-1)",
88
- display: "flex",
89
- flexDirection: "column",
90
- overflow: "hidden"
91
- },
92
- children: [
93
- /* @__PURE__ */ l(
94
- m,
95
- {
96
- p: "4",
97
- style: {
98
- position: "sticky",
99
- top: 0,
100
- zIndex: 10,
101
- backgroundColor: "var(--neutral-2)"
102
- },
103
- children: /* @__PURE__ */ l(h, { title: s, children: /* @__PURE__ */ l(
104
- h.Button,
105
- {
106
- onClick: () => {
107
- o.ui.close();
108
- },
109
- children: /* @__PURE__ */ l(S, {})
110
- }
111
- ) })
112
- }
113
- ),
114
- /* @__PURE__ */ l(
115
- m,
116
- {
117
- px: "4",
118
- style: {
119
- flex: 1,
120
- overflowY: "auto",
121
- backgroundColor: "var(--neutral-2)"
122
- },
123
- children: i
124
- }
125
- )
126
- ]
127
- }
128
- );
127
+ return { plugin: h, rpc: o, call: l, disconnect: d };
129
128
  }
130
129
  export {
131
130
  I as MoisesExtensionHost,
132
- B as SidebarMenu,
133
- P as initMoisesExtension
131
+ z as initMoisesExtension
134
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/extension",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SDK for Moises AI extensions",
5
5
  "private": false,
6
6
  "type": "module",
package/src/client.d.ts CHANGED
@@ -1,4 +1,51 @@
1
1
 
2
+ /** Link API for managing extension links */
3
+ export interface LinkApi {
4
+
5
+ /** Creates a context menu item for tracks */
6
+ trackContextMenu: (config: {
7
+
8
+ /** Display label for the menu item */
9
+ label: string;
10
+ }, onClick: {
11
+
12
+ /** Parameters passed to the onClick handler */
13
+ params: any;
14
+ }) => void;
15
+
16
+ /** Creates a context menu item for single track selections */
17
+ singleTrackSelectionContextMenu: (config: {
18
+
19
+ /** Display label for the menu item */
20
+ label: string;
21
+ }, onClick: {
22
+
23
+ /** Parameters passed to the onClick handler */
24
+ params: any;
25
+ }) => void;
26
+
27
+ /** Creates a button in the toolbar */
28
+ toolbarButton: (config: {
29
+
30
+ /** Display label for the button */
31
+ label: string;
32
+
33
+ /** Icon identifier for the button */
34
+ icon: string;
35
+ }, onClick: Function) => void;
36
+
37
+ /** Creates a button in the footer */
38
+ footerButton: (config: {
39
+
40
+ /** Display label for the button */
41
+ label: string;
42
+
43
+ /** Icon identifier for the button */
44
+ icon: string;
45
+ }, onClick: Function) => void;
46
+ }
47
+
48
+
2
49
  /** Controlling common UI elements */
3
50
  export interface UiApi {
4
51
 
@@ -285,10 +332,10 @@ export interface ComputeApi {
285
332
 
286
333
  /** The target for the session player */
287
334
  inpaintingTarget: any[];
288
- }) => Promise<void>;
335
+ }) => Promise<any>;
289
336
 
290
337
  /** Gets the list of session player presets */
291
- sessionPlayerPresets: () => Promise<void>;
338
+ sessionPlayerPresets: () => void;
292
339
 
293
340
  /** Inpaints an audio file */
294
341
  sessionPlayerInpaint: (params: {
@@ -298,7 +345,7 @@ export interface ComputeApi {
298
345
 
299
346
  /** The mask for the inpainting */
300
347
  mask: any;
301
- }) => Promise<void>;
348
+ }) => Promise<any>;
302
349
 
303
350
  /** Runs a workflow */
304
351
  workflow: (params: {
@@ -306,26 +353,36 @@ export interface ComputeApi {
306
353
  /** The ID of the workflow to run */
307
354
  workflowId: string;
308
355
 
309
- /** The parameters for the workflow TODO: add type */
356
+ /** The parameters for the workflow */
310
357
  params: any;
311
- }) => Promise<void>;
358
+ }) => Promise<any>;
312
359
 
313
360
  /** Runs an automix job */
314
361
  automix: (params: {
315
362
 
316
- /** The ID of the workflow to run TODO: add type */
363
+ /** The ID of the workflow to run */
317
364
  workflowId: string;
318
365
 
319
- /** The parameters for the workflow TODO: add type */
366
+ /** The parameters for the workflow */
320
367
  params: any;
321
- }) => Promise<void>;
368
+ }) => Promise<any>;
369
+
370
+ /** Extracts stems from an audio file */
371
+ stems: (params: {
372
+
373
+ /** The input audio data */
374
+ input: string;
375
+
376
+ /** The stems to extract */
377
+ stemsToExtract: any[];
378
+ }) => Promise<any>;
322
379
 
323
380
  /** Detects instruments in an audio file */
324
381
  instruments: (params: {
325
382
 
326
383
  /** The input audio data */
327
- input: string;
328
- }) => Promise<void>;
384
+ inputUrl: string;
385
+ }) => Promise<any>;
329
386
 
330
387
  /** Detects chords in an audio file */
331
388
  chords: (params: {
@@ -354,16 +411,6 @@ export interface ComputeApi {
354
411
  /** The input audio data */
355
412
  input: string;
356
413
  }) => Promise<void>;
357
-
358
- /** Extracts stems from an audio file */
359
- stems: (params: {
360
-
361
- /** The input audio data */
362
- input: string;
363
-
364
- /** The stems to extract */
365
- stemsToExtract: any[];
366
- }) => void;
367
414
  }
368
415
 
369
416
 
@@ -379,6 +426,8 @@ export interface RegisterApi {
379
426
 
380
427
 
381
428
  export interface MoisesAPI {
429
+ /** Link API for managing extension links */
430
+ link: LinkApi;
382
431
  /** Controlling common UI elements */
383
432
  ui: UiApi;
384
433
  /** Session API for managing audio sessions, tracks, and playback controls */
@@ -422,6 +471,8 @@ export interface MoisesHook {
422
471
  isConnected: boolean;
423
472
  /** Modal layout component for plugin UI */
424
473
  ModalLayout: (props: { children: any; width?: number; height?: number; }) => any;
474
+ /** Modal layout component for plugin UI */
475
+ SidebarLayout: (props: { children: any; width?: number; title?: string; }) => any;
425
476
  }
426
477
 
427
478
  export interface ExtensionOptions {
package/src/index.d.ts CHANGED
@@ -1,4 +1,51 @@
1
1
 
2
+ /** Link API for managing extension links */
3
+ export interface LinkApi {
4
+
5
+ /** Creates a context menu item for tracks */
6
+ trackContextMenu: (config: {
7
+
8
+ /** Display label for the menu item */
9
+ label: string;
10
+ }, onClick: {
11
+
12
+ /** Parameters passed to the onClick handler */
13
+ params: any;
14
+ }) => void;
15
+
16
+ /** Creates a context menu item for single track selections */
17
+ singleTrackSelectionContextMenu: (config: {
18
+
19
+ /** Display label for the menu item */
20
+ label: string;
21
+ }, onClick: {
22
+
23
+ /** Parameters passed to the onClick handler */
24
+ params: any;
25
+ }) => void;
26
+
27
+ /** Creates a button in the toolbar */
28
+ toolbarButton: (config: {
29
+
30
+ /** Display label for the button */
31
+ label: string;
32
+
33
+ /** Icon identifier for the button */
34
+ icon: string;
35
+ }, onClick: Function) => void;
36
+
37
+ /** Creates a button in the footer */
38
+ footerButton: (config: {
39
+
40
+ /** Display label for the button */
41
+ label: string;
42
+
43
+ /** Icon identifier for the button */
44
+ icon: string;
45
+ }, onClick: Function) => void;
46
+ }
47
+
48
+
2
49
  /** Controlling common UI elements */
3
50
  export interface UiApi {
4
51
 
@@ -285,10 +332,10 @@ export interface ComputeApi {
285
332
 
286
333
  /** The target for the session player */
287
334
  inpaintingTarget: any[];
288
- }) => Promise<void>;
335
+ }) => Promise<any>;
289
336
 
290
337
  /** Gets the list of session player presets */
291
- sessionPlayerPresets: () => Promise<void>;
338
+ sessionPlayerPresets: () => void;
292
339
 
293
340
  /** Inpaints an audio file */
294
341
  sessionPlayerInpaint: (params: {
@@ -298,7 +345,7 @@ export interface ComputeApi {
298
345
 
299
346
  /** The mask for the inpainting */
300
347
  mask: any;
301
- }) => Promise<void>;
348
+ }) => Promise<any>;
302
349
 
303
350
  /** Runs a workflow */
304
351
  workflow: (params: {
@@ -306,26 +353,36 @@ export interface ComputeApi {
306
353
  /** The ID of the workflow to run */
307
354
  workflowId: string;
308
355
 
309
- /** The parameters for the workflow TODO: add type */
356
+ /** The parameters for the workflow */
310
357
  params: any;
311
- }) => Promise<void>;
358
+ }) => Promise<any>;
312
359
 
313
360
  /** Runs an automix job */
314
361
  automix: (params: {
315
362
 
316
- /** The ID of the workflow to run TODO: add type */
363
+ /** The ID of the workflow to run */
317
364
  workflowId: string;
318
365
 
319
- /** The parameters for the workflow TODO: add type */
366
+ /** The parameters for the workflow */
320
367
  params: any;
321
- }) => Promise<void>;
368
+ }) => Promise<any>;
369
+
370
+ /** Extracts stems from an audio file */
371
+ stems: (params: {
372
+
373
+ /** The input audio data */
374
+ input: string;
375
+
376
+ /** The stems to extract */
377
+ stemsToExtract: any[];
378
+ }) => Promise<any>;
322
379
 
323
380
  /** Detects instruments in an audio file */
324
381
  instruments: (params: {
325
382
 
326
383
  /** The input audio data */
327
- input: string;
328
- }) => Promise<void>;
384
+ inputUrl: string;
385
+ }) => Promise<any>;
329
386
 
330
387
  /** Detects chords in an audio file */
331
388
  chords: (params: {
@@ -354,16 +411,6 @@ export interface ComputeApi {
354
411
  /** The input audio data */
355
412
  input: string;
356
413
  }) => Promise<void>;
357
-
358
- /** Extracts stems from an audio file */
359
- stems: (params: {
360
-
361
- /** The input audio data */
362
- input: string;
363
-
364
- /** The stems to extract */
365
- stemsToExtract: any[];
366
- }) => void;
367
414
  }
368
415
 
369
416
 
@@ -379,6 +426,8 @@ export interface RegisterApi {
379
426
 
380
427
 
381
428
  export interface MoisesAPI {
429
+ /** Link API for managing extension links */
430
+ link: LinkApi;
382
431
  /** Controlling common UI elements */
383
432
  ui: UiApi;
384
433
  /** Session API for managing audio sessions, tracks, and playback controls */
@@ -422,6 +471,8 @@ export interface MoisesHook {
422
471
  isConnected: boolean;
423
472
  /** Modal layout component for plugin UI */
424
473
  ModalLayout: (props: { children: any; width?: number; height?: number; }) => any;
474
+ /** Modal layout component for plugin UI */
475
+ SidebarLayout: (props: { children: any; width?: number; title?: string; }) => any;
425
476
  }
426
477
 
427
478
  export interface ExtensionOptions {