@innovastudio/contentbuilder 1.5.180 → 1.5.182
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/index.d.ts
CHANGED
|
@@ -337,5 +337,10 @@ declare class ContentBuilder {
|
|
|
337
337
|
btn?: HTMLElement
|
|
338
338
|
): void;
|
|
339
339
|
openIconPicker(callback: (iconHtml: string) => void): void;
|
|
340
|
+
|
|
341
|
+
createImage(
|
|
342
|
+
prompt: string,
|
|
343
|
+
options?: Record<string, any>
|
|
344
|
+
): Promise<string>;
|
|
340
345
|
}
|
|
341
346
|
export default ContentBuilder;
|
package/package.json
CHANGED
|
@@ -51143,11 +51143,12 @@ class SettingsUIGenerator {
|
|
|
51143
51143
|
const values = this.getFormValues(form);
|
|
51144
51144
|
onChange(values, element);
|
|
51145
51145
|
});
|
|
51146
|
-
form.addEventListener('change', () => {
|
|
51147
|
-
|
|
51148
|
-
|
|
51149
|
-
});
|
|
51146
|
+
// form.addEventListener('change', () => {
|
|
51147
|
+
// const values = this.getFormValues(form);
|
|
51148
|
+
// onChange(values, element);
|
|
51149
|
+
// });
|
|
51150
51150
|
}
|
|
51151
|
+
|
|
51151
51152
|
return form;
|
|
51152
51153
|
}
|
|
51153
51154
|
|
|
@@ -85218,6 +85219,7 @@ class Dictation {
|
|
|
85218
85219
|
label: 'Nano Banana',
|
|
85219
85220
|
sizes: [],
|
|
85220
85221
|
// no size options
|
|
85222
|
+
// sizes: ['21:9', '16:9', '3:2', '4:3', '5:4', '1:1', '4:5', '3:4', '2:3', '9:16'], // no size options
|
|
85221
85223
|
output_format: 'jpeg'
|
|
85222
85224
|
}, {
|
|
85223
85225
|
id: 'fal-ai/imagen4/preview/fast',
|
|
@@ -100637,14 +100639,42 @@ Please obtain a license at: https://innovastudio.com/contentbox`);
|
|
|
100637
100639
|
}
|
|
100638
100640
|
}
|
|
100639
100641
|
|
|
100642
|
+
async createImage(prompt, options) {
|
|
100643
|
+
if (options) this.imageGenerationSettings = options;
|
|
100644
|
+
return new Promise((resolve, reject) => {
|
|
100645
|
+
try {
|
|
100646
|
+
this.generateImage(prompt, imageUrl => {
|
|
100647
|
+
resolve(imageUrl);
|
|
100648
|
+
});
|
|
100649
|
+
} catch (err) {
|
|
100650
|
+
reject(err);
|
|
100651
|
+
}
|
|
100652
|
+
});
|
|
100653
|
+
}
|
|
100640
100654
|
async generateImage_Fal(prompt, callback) {
|
|
100641
|
-
|
|
100655
|
+
let modelId;
|
|
100656
|
+
let imageSize;
|
|
100657
|
+
let outputFormat;
|
|
100658
|
+
const modal = this.builderStuff.querySelector('.commandconfig');
|
|
100659
|
+
if (modal) {
|
|
100660
|
+
const inpImageModelSelect = modal.querySelector('#inpImageModelSelect');
|
|
100661
|
+
const inpImageSizeSelect = modal.querySelector('#inpImageSizeSelect');
|
|
100662
|
+
const outputFormatField = modal.querySelector('#inpImageOutputFormat');
|
|
100663
|
+
modelId = inpImageModelSelect.value;
|
|
100664
|
+
imageSize = inpImageSizeSelect.value;
|
|
100665
|
+
outputFormat = outputFormatField.value;
|
|
100666
|
+
} else if (this.imageGenerationSettings) {
|
|
100667
|
+
modelId = this.imageGenerationSettings.modelId;
|
|
100668
|
+
imageSize = this.imageGenerationSettings.imageSize;
|
|
100669
|
+
outputFormat = this.imageGenerationSettings.outputFormat;
|
|
100670
|
+
} else {
|
|
100671
|
+
modelId = 'fal-ai/flux-1/schnell';
|
|
100672
|
+
imageSize = 'landscape_4_3';
|
|
100673
|
+
outputFormat = 'jpeg';
|
|
100674
|
+
}
|
|
100642
100675
|
|
|
100643
100676
|
// Construct inputs: model, prompt, size, output format
|
|
100644
|
-
|
|
100645
|
-
const inpImageSizeSelect = modal.querySelector('#inpImageSizeSelect');
|
|
100646
|
-
const outputFormatField = modal.querySelector('#inpImageOutputFormat');
|
|
100647
|
-
const modelId = inpImageModelSelect.value;
|
|
100677
|
+
|
|
100648
100678
|
const modelDef = this.dictation.imageModels.find(m => m.id === modelId) || {};
|
|
100649
100679
|
|
|
100650
100680
|
// Build options dynamically
|
|
@@ -100654,18 +100684,15 @@ Please obtain a license at: https://innovastudio.com/contentbox`);
|
|
|
100654
100684
|
if (modelDef && modelDef.sizes !== undefined) {
|
|
100655
100685
|
if (modelDef.sizes !== null && modelDef.sizes.length !== 0) {
|
|
100656
100686
|
const sizeParam = modelDef.size_param || 'image_size'; // default
|
|
100657
|
-
const imageSize = inpImageSizeSelect.value;
|
|
100658
100687
|
options[sizeParam] = imageSize;
|
|
100659
100688
|
}
|
|
100660
100689
|
// if sizes = [] => no size options => exclude size.
|
|
100661
100690
|
} else {
|
|
100662
100691
|
// if sizes not defined, use default set
|
|
100663
|
-
const imageSize = inpImageSizeSelect.value;
|
|
100664
100692
|
options['image_size'] = imageSize;
|
|
100665
100693
|
}
|
|
100666
100694
|
|
|
100667
100695
|
// Handle output_format if present
|
|
100668
|
-
const outputFormat = outputFormatField.value;
|
|
100669
100696
|
if (outputFormat) {
|
|
100670
100697
|
const outputParam = modelDef.output_param || 'output_format'; // default
|
|
100671
100698
|
options[outputParam] = outputFormat;
|