@hackbuild/ai-views 0.1.2 → 0.1.5
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/README.md +3 -3
- package/dist/chat.d.ts +35 -2
- package/dist/chat.js +47 -3
- package/dist/elements.d.ts +3 -1
- package/dist/elements.js +2 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -1
- package/dist/loaders.js +40 -7
- package/dist/mount-mask.d.ts +56 -6
- package/dist/mount-mask.js +334 -36
- package/dist/mount-talk.d.ts +92 -0
- package/dist/mount-talk.js +502 -0
- package/dist/mount-transcribe.d.ts +22 -0
- package/dist/mount-transcribe.js +90 -4
- package/dist/pick.d.ts +23 -0
- package/dist/pick.js +51 -0
- package/dist/single/elements.iife.js +1784 -627
- package/dist/single/elements.js +1774 -628
- package/dist/single/index.iife.js +1478 -56
- package/dist/single/index.js +1473 -57
- package/dist/single/vue.iife.js +1720 -622
- package/dist/single/vue.js +1714 -623
- package/dist/speaker.d.ts +55 -0
- package/dist/speaker.js +109 -0
- package/dist/talk.d.ts +89 -0
- package/dist/talk.js +121 -0
- package/dist/transcribe.d.ts +36 -1
- package/dist/transcribe.js +19 -3
- package/dist/vue.d.ts +137 -5
- package/dist/vue.js +80 -9
- package/llms.md +376 -14
- package/package.json +5 -5
package/dist/vue.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ import type { Job } from "./jobs.js";
|
|
|
11
11
|
import { type JobsPick, type Loader, type ModelPick } from "./pick.js";
|
|
12
12
|
import type { TranscribeQueue as Queue } from "./transcribe.js";
|
|
13
13
|
import type { FrameResults } from "./frame.js";
|
|
14
|
+
import { type MemoryLike, type MemoryPaneOptions, type SourcesDropOptions } from "./mount-talk.js";
|
|
15
|
+
import type { Speaker } from "./speaker.js";
|
|
16
|
+
import type { PersonaRack as PersonaState, VoiceRow as VoiceState } from "./talk.js";
|
|
14
17
|
import { type MaskModels, type MaskStudio as Studio } from "./mount-mask.js";
|
|
15
18
|
import { type RecallLike } from "./memory.js";
|
|
16
19
|
/** Vue component for a model picker of one job; emits `pick`, `choose`, `loaded` and `failed`. */
|
|
@@ -73,23 +76,142 @@ export declare const Composer: import("vue").DefineComponent<{
|
|
|
73
76
|
}> & Readonly<{}>, {
|
|
74
77
|
placeholder: string;
|
|
75
78
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
76
|
-
/** Vue component for the drop zone that becomes the transcript; emits `sample
|
|
79
|
+
/** Vue component for the drop zone that becomes the transcript; emits `sample` and `drop` (the handle, whose `pick` opens the file picker). */
|
|
77
80
|
export declare const TranscribeDrop: import("vue").DefineComponent<{
|
|
78
81
|
queue: Queue;
|
|
79
82
|
accept: string;
|
|
80
83
|
sampleLabel: string;
|
|
84
|
+
title: string;
|
|
85
|
+
note: string;
|
|
86
|
+
folders: boolean;
|
|
87
|
+
showDropped: boolean;
|
|
81
88
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
82
89
|
[key: string]: any;
|
|
83
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "sample"[], "sample", import("vue").PublicProps, Readonly<{
|
|
90
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("drop" | "sample")[], "drop" | "sample", import("vue").PublicProps, Readonly<{
|
|
84
91
|
queue: Queue;
|
|
85
92
|
accept: string;
|
|
86
93
|
sampleLabel: string;
|
|
94
|
+
title: string;
|
|
95
|
+
note: string;
|
|
96
|
+
folders: boolean;
|
|
97
|
+
showDropped: boolean;
|
|
87
98
|
}> & Readonly<{
|
|
99
|
+
onDrop?: (...args: any[]) => any;
|
|
88
100
|
onSample?: (...args: any[]) => any;
|
|
89
101
|
}>, {
|
|
90
102
|
accept: string;
|
|
91
103
|
sampleLabel: string;
|
|
104
|
+
title: string;
|
|
105
|
+
note: string;
|
|
106
|
+
folders: boolean;
|
|
107
|
+
showDropped: boolean;
|
|
92
108
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
109
|
+
/** Vue component for the export menu of a transcribe queue: four formats, copy, all as zip, undo and redo. */
|
|
110
|
+
export declare const ExportMenu: import("vue").DefineComponent<{
|
|
111
|
+
queue: Queue;
|
|
112
|
+
tool: string;
|
|
113
|
+
go: boolean;
|
|
114
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
117
|
+
queue: Queue;
|
|
118
|
+
tool: string;
|
|
119
|
+
go: boolean;
|
|
120
|
+
}> & Readonly<{}>, {
|
|
121
|
+
tool: string;
|
|
122
|
+
go: boolean;
|
|
123
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
124
|
+
/** Vue component for a memory pane over a store; emits `pane` with the handle (refresh, used). */
|
|
125
|
+
export declare const MemoryPane: import("vue").DefineComponent<{
|
|
126
|
+
memory: MemoryLike;
|
|
127
|
+
name: string;
|
|
128
|
+
by: "source" | "kind";
|
|
129
|
+
kinds?: Record<string, string> | undefined;
|
|
130
|
+
exportLabel: string;
|
|
131
|
+
acts?: MemoryPaneOptions["acts"] | undefined;
|
|
132
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
133
|
+
[key: string]: any;
|
|
134
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("act" | "change" | "pane")[], "act" | "change" | "pane", import("vue").PublicProps, Readonly<{
|
|
135
|
+
memory: MemoryLike;
|
|
136
|
+
name: string;
|
|
137
|
+
by: "source" | "kind";
|
|
138
|
+
kinds?: Record<string, string> | undefined;
|
|
139
|
+
exportLabel: string;
|
|
140
|
+
acts?: MemoryPaneOptions["acts"] | undefined;
|
|
141
|
+
}> & Readonly<{
|
|
142
|
+
onAct?: (...args: any[]) => any;
|
|
143
|
+
onChange?: (...args: any[]) => any;
|
|
144
|
+
onPane?: (...args: any[]) => any;
|
|
145
|
+
}>, {
|
|
146
|
+
name: string;
|
|
147
|
+
by: "kind" | "source";
|
|
148
|
+
kinds: Record<string, string>;
|
|
149
|
+
exportLabel: string;
|
|
150
|
+
acts: readonly {
|
|
151
|
+
id: string;
|
|
152
|
+
label: string;
|
|
153
|
+
}[] | undefined;
|
|
154
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
155
|
+
/** Vue component for a sources drop: files and folders into memory through `ingest`. */
|
|
156
|
+
export declare const SourcesDrop: import("vue").DefineComponent<{
|
|
157
|
+
ingest: SourcesDropOptions["ingest"];
|
|
158
|
+
accept: string;
|
|
159
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
160
|
+
[key: string]: any;
|
|
161
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
162
|
+
ingest: SourcesDropOptions["ingest"];
|
|
163
|
+
accept: string;
|
|
164
|
+
}> & Readonly<{}>, {
|
|
165
|
+
accept: string;
|
|
166
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
167
|
+
/** Vue component for a persona rack. */
|
|
168
|
+
export declare const PersonaRack: import("vue").DefineComponent<{
|
|
169
|
+
rack: PersonaState;
|
|
170
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
171
|
+
[key: string]: any;
|
|
172
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
173
|
+
rack: PersonaState;
|
|
174
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
175
|
+
/** Vue component for a voice row. */
|
|
176
|
+
export declare const VoiceRow: import("vue").DefineComponent<{
|
|
177
|
+
row: VoiceState;
|
|
178
|
+
test: string;
|
|
179
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
180
|
+
[key: string]: any;
|
|
181
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
182
|
+
row: VoiceState;
|
|
183
|
+
test: string;
|
|
184
|
+
}> & Readonly<{}>, {
|
|
185
|
+
test: string;
|
|
186
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
187
|
+
/** Vue component for the voice clone row of a speaker; `can` says the loaded voice clones. */
|
|
188
|
+
export declare const VoiceClone: import("vue").DefineComponent<{
|
|
189
|
+
speaker: Speaker;
|
|
190
|
+
can: boolean;
|
|
191
|
+
seconds: number;
|
|
192
|
+
hint: string;
|
|
193
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
196
|
+
speaker: Speaker;
|
|
197
|
+
can: boolean;
|
|
198
|
+
seconds: number;
|
|
199
|
+
hint: string;
|
|
200
|
+
}> & Readonly<{}>, {
|
|
201
|
+
can: boolean;
|
|
202
|
+
seconds: number;
|
|
203
|
+
hint: string;
|
|
204
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
205
|
+
/** Vue component for the session menu of a chat list; emits `import` with the number of chats. */
|
|
206
|
+
export declare const SessionMenu: import("vue").DefineComponent<{
|
|
207
|
+
list: ChatListState;
|
|
208
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
209
|
+
[key: string]: any;
|
|
210
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "import"[], "import", import("vue").PublicProps, Readonly<{
|
|
211
|
+
list: ChatListState;
|
|
212
|
+
}> & Readonly<{
|
|
213
|
+
onImport?: (...args: any[]) => any;
|
|
214
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
215
|
/** Vue component for the selected transcript, or its export buttons when `exports` is set. */
|
|
94
216
|
export declare const TranscriptView: import("vue").DefineComponent<{
|
|
95
217
|
queue: Queue;
|
|
@@ -103,8 +225,8 @@ export declare const TranscriptView: import("vue").DefineComponent<{
|
|
|
103
225
|
exports: boolean;
|
|
104
226
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
105
227
|
/**
|
|
106
|
-
* Vue component for a mask studio; emits `studio` with the mounted studio
|
|
107
|
-
* sample button is pressed.
|
|
228
|
+
* Vue component for a mask studio; emits `studio` with the mounted studio, `sample` when the
|
|
229
|
+
* sample button is pressed, and with `demand` set, `want` when a tool needs a model not loaded yet.
|
|
108
230
|
*/
|
|
109
231
|
export declare const MaskStudio: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
110
232
|
models: {
|
|
@@ -115,9 +237,13 @@ export declare const MaskStudio: import("vue").DefineComponent<import("vue").Ext
|
|
|
115
237
|
type: StringConstructor;
|
|
116
238
|
default: string;
|
|
117
239
|
};
|
|
240
|
+
demand: {
|
|
241
|
+
type: BooleanConstructor;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
118
244
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
119
245
|
[key: string]: any;
|
|
120
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("sample" | "studio")[], "sample" | "studio", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
246
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("sample" | "studio" | "want")[], "sample" | "studio" | "want", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
121
247
|
models: {
|
|
122
248
|
type: PropType<MaskModels>;
|
|
123
249
|
default: () => {};
|
|
@@ -126,12 +252,18 @@ export declare const MaskStudio: import("vue").DefineComponent<import("vue").Ext
|
|
|
126
252
|
type: StringConstructor;
|
|
127
253
|
default: string;
|
|
128
254
|
};
|
|
255
|
+
demand: {
|
|
256
|
+
type: BooleanConstructor;
|
|
257
|
+
default: boolean;
|
|
258
|
+
};
|
|
129
259
|
}>> & Readonly<{
|
|
130
260
|
onSample?: (...args: any[]) => any;
|
|
131
261
|
onStudio?: (...args: any[]) => any;
|
|
262
|
+
onWant?: (...args: any[]) => any;
|
|
132
263
|
}>, {
|
|
133
264
|
models: MaskModels;
|
|
134
265
|
sampleLabel: string;
|
|
266
|
+
demand: boolean;
|
|
135
267
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
136
268
|
/** Vue component for the tool rail of a mask studio. */
|
|
137
269
|
export declare const MaskTools: import("vue").DefineComponent<{
|
package/dist/vue.js
CHANGED
|
@@ -8,7 +8,8 @@ import { defineComponent, h, onBeforeUnmount, onMounted, ref, shallowRef, watch
|
|
|
8
8
|
import { useModelPick } from "./pick.js";
|
|
9
9
|
import { mountModelJobs, mountModelSelect } from "./mount-model.js";
|
|
10
10
|
import { mountChatList, mountChatPane, mountComposer, mountContextMeter } from "./mount-chat.js";
|
|
11
|
-
import { mountTranscribeDrop, mountTranscribeQueue, mountTranscriptExports, mountTranscriptView } from "./mount-transcribe.js";
|
|
11
|
+
import { mountExportMenu, mountTranscribeDrop, mountTranscribeQueue, mountTranscriptExports, mountTranscriptView } from "./mount-transcribe.js";
|
|
12
|
+
import { mountMemoryPane, mountPersonaRack, mountSessionMenu, mountSourcesDrop, mountVoiceClone, mountVoiceRow } from "./mount-talk.js";
|
|
12
13
|
import { mountMaskRack, mountMaskStudio, mountMaskTools, mountMaskVerbs } from "./mount-mask.js";
|
|
13
14
|
import { mountMemoryInspector } from "./memory.js";
|
|
14
15
|
import { mountCameraFeed, mountFrameView } from "./mount-frame.js";
|
|
@@ -76,16 +77,86 @@ export const Composer = defineComponent({
|
|
|
76
77
|
props: { thread: { type: Object, required: true }, placeholder: { type: String, default: "say something" } },
|
|
77
78
|
setup: hosted((host, p) => mountComposer(host, p.thread, { placeholder: p.placeholder }), (p) => [p.thread]),
|
|
78
79
|
});
|
|
79
|
-
/** Vue component for the drop zone that becomes the transcript; emits `sample
|
|
80
|
+
/** Vue component for the drop zone that becomes the transcript; emits `sample` and `drop` (the handle, whose `pick` opens the file picker). */
|
|
80
81
|
export const TranscribeDrop = defineComponent({
|
|
81
82
|
name: "TranscribeDrop",
|
|
82
83
|
props: {
|
|
83
84
|
queue: { type: Object, required: true },
|
|
84
85
|
accept: { type: String, default: "audio/*,video/*" },
|
|
85
86
|
sampleLabel: { type: String, default: "" },
|
|
87
|
+
title: { type: String, default: "" },
|
|
88
|
+
note: { type: String, default: "" },
|
|
89
|
+
folders: { type: Boolean, default: false },
|
|
90
|
+
showDropped: { type: Boolean, default: false },
|
|
86
91
|
},
|
|
87
|
-
emits: ["sample"],
|
|
88
|
-
setup: hosted((host, p, emit) =>
|
|
92
|
+
emits: ["sample", "drop"],
|
|
93
|
+
setup: hosted((host, p, emit) => {
|
|
94
|
+
const d = mountTranscribeDrop(host, p.queue, {
|
|
95
|
+
accept: p.accept,
|
|
96
|
+
folders: p.folders,
|
|
97
|
+
showDropped: p.showDropped,
|
|
98
|
+
...(p.title ? { title: p.title } : {}),
|
|
99
|
+
...(p.note ? { note: p.note } : {}),
|
|
100
|
+
...(p.sampleLabel ? { sampleLabel: p.sampleLabel, onSample: () => emit("sample") } : {}),
|
|
101
|
+
});
|
|
102
|
+
emit("drop", d);
|
|
103
|
+
return d;
|
|
104
|
+
}, (p) => [p.queue, p.showDropped]),
|
|
105
|
+
});
|
|
106
|
+
/** Vue component for the export menu of a transcribe queue: four formats, copy, all as zip, undo and redo. */
|
|
107
|
+
export const ExportMenu = defineComponent({
|
|
108
|
+
name: "ExportMenu",
|
|
109
|
+
props: { queue: { type: Object, required: true }, tool: { type: String, default: "" }, go: { type: Boolean, default: false } },
|
|
110
|
+
setup: hosted((host, p) => mountExportMenu(host, p.queue, { go: p.go, ...(p.tool ? { tool: p.tool } : {}) }), (p) => [p.queue, p.go]),
|
|
111
|
+
});
|
|
112
|
+
/** Vue component for a memory pane over a store; emits `pane` with the handle (refresh, used). */
|
|
113
|
+
export const MemoryPane = defineComponent({
|
|
114
|
+
name: "MemoryPane",
|
|
115
|
+
props: {
|
|
116
|
+
memory: { type: Object, required: true },
|
|
117
|
+
name: { type: String, default: "memory" },
|
|
118
|
+
by: { type: String, default: "source" },
|
|
119
|
+
kinds: { type: Object, default: undefined },
|
|
120
|
+
exportLabel: { type: String, default: "export" },
|
|
121
|
+
acts: { type: Array, default: undefined },
|
|
122
|
+
},
|
|
123
|
+
emits: ["pane", "change", "act"],
|
|
124
|
+
setup: hosted((host, p, emit) => {
|
|
125
|
+
const m = mountMemoryPane(host, p.memory, { name: p.name, by: p.by, exportLabel: p.exportLabel, onChange: () => emit("change"), onAct: (id) => emit("act", id), ...(p.kinds ? { kinds: p.kinds } : {}), ...(p.acts ? { acts: p.acts } : {}) });
|
|
126
|
+
emit("pane", m);
|
|
127
|
+
return m;
|
|
128
|
+
}, (p) => [p.memory]),
|
|
129
|
+
});
|
|
130
|
+
/** Vue component for a sources drop: files and folders into memory through `ingest`. */
|
|
131
|
+
export const SourcesDrop = defineComponent({
|
|
132
|
+
name: "SourcesDrop",
|
|
133
|
+
props: { ingest: { type: Function, required: true }, accept: { type: String, default: "" } },
|
|
134
|
+
setup: hosted((host, p) => mountSourcesDrop(host, { ingest: p.ingest, ...(p.accept ? { accept: p.accept } : {}) }), (p) => [p.ingest]),
|
|
135
|
+
});
|
|
136
|
+
/** Vue component for a persona rack. */
|
|
137
|
+
export const PersonaRack = defineComponent({
|
|
138
|
+
name: "PersonaRack",
|
|
139
|
+
props: { rack: { type: Object, required: true } },
|
|
140
|
+
setup: hosted((host, p) => mountPersonaRack(host, p.rack), (p) => [p.rack]),
|
|
141
|
+
});
|
|
142
|
+
/** Vue component for a voice row. */
|
|
143
|
+
export const VoiceRow = defineComponent({
|
|
144
|
+
name: "VoiceRow",
|
|
145
|
+
props: { row: { type: Object, required: true }, test: { type: String, default: "" } },
|
|
146
|
+
setup: hosted((host, p) => mountVoiceRow(host, p.row, p.test ? { test: p.test } : {}), (p) => [p.row]),
|
|
147
|
+
});
|
|
148
|
+
/** Vue component for the voice clone row of a speaker; `can` says the loaded voice clones. */
|
|
149
|
+
export const VoiceClone = defineComponent({
|
|
150
|
+
name: "VoiceClone",
|
|
151
|
+
props: { speaker: { type: Object, required: true }, can: { type: Boolean, default: true }, seconds: { type: Number, default: 10 }, hint: { type: String, default: "" } },
|
|
152
|
+
setup: hosted((host, p) => mountVoiceClone(host, p.speaker, { seconds: p.seconds, can: () => p.can, ...(p.hint ? { hint: p.hint } : {}) }), (p) => [p.speaker, p.can]),
|
|
153
|
+
});
|
|
154
|
+
/** Vue component for the session menu of a chat list; emits `import` with the number of chats. */
|
|
155
|
+
export const SessionMenu = defineComponent({
|
|
156
|
+
name: "SessionMenu",
|
|
157
|
+
props: { list: { type: Object, required: true } },
|
|
158
|
+
emits: ["import"],
|
|
159
|
+
setup: hosted((host, p, emit) => mountSessionMenu(host, p.list, { onImport: (n) => emit("import", n) }), (p) => [p.list]),
|
|
89
160
|
});
|
|
90
161
|
/** Vue component for the selected transcript, or its export buttons when `exports` is set. */
|
|
91
162
|
export const TranscriptView = defineComponent({
|
|
@@ -94,18 +165,18 @@ export const TranscriptView = defineComponent({
|
|
|
94
165
|
setup: hosted((host, p) => (p.exports ? mountTranscriptExports(host, p.queue) : mountTranscriptView(host, p.queue)), (p) => [p.queue, p.exports]),
|
|
95
166
|
});
|
|
96
167
|
/**
|
|
97
|
-
* Vue component for a mask studio; emits `studio` with the mounted studio
|
|
98
|
-
* sample button is pressed.
|
|
168
|
+
* Vue component for a mask studio; emits `studio` with the mounted studio, `sample` when the
|
|
169
|
+
* sample button is pressed, and with `demand` set, `want` when a tool needs a model not loaded yet.
|
|
99
170
|
*/
|
|
100
171
|
export const MaskStudio = defineComponent({
|
|
101
172
|
name: "MaskStudio",
|
|
102
|
-
props: { models: { type: Object, default: () => ({}) }, sampleLabel: { type: String, default: "" } },
|
|
103
|
-
emits: ["studio", "sample"],
|
|
173
|
+
props: { models: { type: Object, default: () => ({}) }, sampleLabel: { type: String, default: "" }, demand: { type: Boolean, default: false } },
|
|
174
|
+
emits: ["studio", "sample", "want"],
|
|
104
175
|
setup(props, { emit }) {
|
|
105
176
|
const el = ref(null);
|
|
106
177
|
const studio = shallowRef(null);
|
|
107
178
|
onMounted(() => {
|
|
108
|
-
studio.value = mountMaskStudio(el.value, { models: props.models, ...(props.sampleLabel ? { sampleLabel: props.sampleLabel, onSample: () => emit("sample") } : {}) });
|
|
179
|
+
studio.value = mountMaskStudio(el.value, { models: props.models, ...(props.sampleLabel ? { sampleLabel: props.sampleLabel, onSample: () => emit("sample") } : {}), ...(props.demand ? { onWant: (k) => emit("want", k) } : {}) });
|
|
109
180
|
emit("studio", studio.value);
|
|
110
181
|
});
|
|
111
182
|
watch(() => props.models, (m) => studio.value?.setModels(m));
|