@chai-ui/vue 0.11.2 → 0.11.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/Composer.vue.d.ts +2 -2
- package/dist/Composer.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -29
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Composer.vue +14 -17
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chai-ui/vue",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Chai UI Vue components — smart, drop-in UI for AI apps: Composer, Media Analyzer, Result Card, Edit Card, and the useComposer composable.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kazarazat",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@fontsource/roboto": "^5.3.0",
|
|
49
49
|
"@material/web": "^2.5.0",
|
|
50
|
-
"@chai-ui/core": "0.11.
|
|
51
|
-
"@chai-ui/tokens": "0.11.
|
|
50
|
+
"@chai-ui/core": "0.11.3",
|
|
51
|
+
"@chai-ui/tokens": "0.11.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@vitejs/plugin-vue": "^6.0.9",
|
package/src/Composer.vue
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
type GenerationUseCase,
|
|
28
28
|
type ComposerSubmitPayload,
|
|
29
29
|
type ComposerUseCase,
|
|
30
|
+
type ComposerView,
|
|
30
31
|
type EditRegion,
|
|
31
32
|
type MediaKind,
|
|
32
33
|
type MenuPlacement,
|
|
@@ -58,13 +59,13 @@ const props = withDefaults(
|
|
|
58
59
|
onClearUseCase?: () => void;
|
|
59
60
|
/** What a submit means with no use case picked. Defaults to `TEXT_USE_CASE`. Never shown as a chip. */
|
|
60
61
|
defaultUseCase?: ComposerUseCase;
|
|
61
|
-
/**
|
|
62
|
+
/** Image and Video from one prompt, with `useCases`, `modelsByKind` and `modelIds`: a Model menu each, and a model needed in each. Other use cases run alone (`nextUseCases`). */
|
|
62
63
|
multiSelectUseCases?: boolean;
|
|
63
64
|
useCases?: ComposerUseCase[];
|
|
64
65
|
"onUpdate:useCases"?: (next: ComposerUseCase[]) => void;
|
|
65
66
|
/** Models per use-case kind, for `multiSelectUseCases`. A kind left out gets Chai's suggested models. */
|
|
66
67
|
modelsByKind?: Partial<Record<OutputKind, ModelOption[]>>;
|
|
67
|
-
/** The end user can pick several models, each producing its own result, with `modelIds`. */
|
|
68
|
+
/** The end user can pick several models, each producing its own result, with `modelIds`. With `multiSelectUseCases`, several per use case. */
|
|
68
69
|
multiSelectModels?: boolean;
|
|
69
70
|
modelIds?: string[];
|
|
70
71
|
"onUpdate:modelIds"?: (ids: string[]) => void;
|
|
@@ -166,11 +167,6 @@ const menuItems = computed(() =>
|
|
|
166
167
|
canSelect: Boolean(props.onAttachMenuSelect),
|
|
167
168
|
})
|
|
168
169
|
);
|
|
169
|
-
const modelMenuOptions = computed(() =>
|
|
170
|
-
props.multiSelectUseCases
|
|
171
|
-
? { sections: view.value.modelSections.map((s) => ({ label: s.label, options: s.options })) }
|
|
172
|
-
: { options: view.value.modelSections[0]?.options }
|
|
173
|
-
);
|
|
174
170
|
const toMenuOption = (o: { value: string; label: string }) => ({ id: o.value, label: o.label });
|
|
175
171
|
const voiceMenuOptions = computed(() =>
|
|
176
172
|
view.value.voiceSections
|
|
@@ -199,8 +195,8 @@ watch(
|
|
|
199
195
|
}
|
|
200
196
|
);
|
|
201
197
|
|
|
202
|
-
function
|
|
203
|
-
if (view.value.multiModel) props["onUpdate:modelIds"]?.(
|
|
198
|
+
function pickModel(menu: ComposerView["modelMenus"][number], id: string) {
|
|
199
|
+
if (view.value.multiModel) props["onUpdate:modelIds"]?.(menu.next(id));
|
|
204
200
|
else props["onUpdate:modelId"]?.(id);
|
|
205
201
|
}
|
|
206
202
|
|
|
@@ -338,25 +334,26 @@ function onSubmitClick() {
|
|
|
338
334
|
@remove="removeUseCase(u)"
|
|
339
335
|
/>
|
|
340
336
|
|
|
341
|
-
<!-- The auto-select switch lives inside
|
|
337
|
+
<!-- One Model menu, or one per use case with multi-use-case select. The auto-select switch lives inside each, so with it shown the trigger stays enabled: it's the only way back to the switch. -->
|
|
342
338
|
<SearchMenu
|
|
339
|
+
v-for="menu in view.canPickModel ? view.modelMenus : []"
|
|
340
|
+
:key="menu.key"
|
|
343
341
|
:placement="menuPlacement"
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
:
|
|
347
|
-
:multiple="view.multiModel"
|
|
342
|
+
:options="menu.options"
|
|
343
|
+
:value="menu.value"
|
|
344
|
+
:multiple="menu.multiple"
|
|
348
345
|
:toggle-header="
|
|
349
346
|
showAutoSelectToggle
|
|
350
347
|
? { label: 'Auto-select model', value: autoSelectModel, onChange: (v: boolean) => props['onUpdate:autoSelectModel']?.(v) }
|
|
351
348
|
: undefined
|
|
352
349
|
"
|
|
353
|
-
:trigger-label="
|
|
354
|
-
:menu-label="
|
|
350
|
+
:trigger-label="menu.triggerLabel"
|
|
351
|
+
:menu-label="menu.menuLabel"
|
|
355
352
|
:searchable="false"
|
|
356
353
|
trigger-variant="text"
|
|
357
354
|
:disabled="disabled || (autoSelectModel && !showAutoSelectToggle)"
|
|
358
355
|
:panel-width="showAutoSelectToggle ? 320 : undefined"
|
|
359
|
-
@select="
|
|
356
|
+
@select="pickModel(menu, $event.id)"
|
|
360
357
|
/>
|
|
361
358
|
|
|
362
359
|
<SearchMenu
|