sveltekit-ui 1.0.42 → 1.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.
|
@@ -789,27 +789,26 @@ export function create_image_editor_manager(config) {
|
|
|
789
789
|
|
|
790
790
|
async function ai_image_generator(input) {
|
|
791
791
|
ai_error_message = null
|
|
792
|
-
if (typeof config?.ai_image_generator
|
|
792
|
+
if (typeof config?.ai_image_generator != "function") {
|
|
793
793
|
ai_error_message = "ai_image_generator function not provided to config"
|
|
794
794
|
return
|
|
795
795
|
}
|
|
796
796
|
ai_image_generator_is_loading = true
|
|
797
|
-
const res = await config
|
|
797
|
+
const res = await config.ai_image_generator(input)
|
|
798
798
|
if (res?.is_success) {
|
|
799
799
|
try {
|
|
800
|
-
const data_url =
|
|
800
|
+
const data_url = res?.data?.data_url
|
|
801
801
|
image_sources = [data_url, ...image_sources]
|
|
802
802
|
image_source_index = 0
|
|
803
803
|
set_base_image(data_url)
|
|
804
|
-
mime_type = "image/webp"
|
|
805
|
-
mime_type_input =
|
|
804
|
+
mime_type = res?.data?.mime_type || "image/webp"
|
|
805
|
+
mime_type_input = mime_type
|
|
806
806
|
set_file_data_base()
|
|
807
|
-
} catch (
|
|
808
|
-
|
|
809
|
-
ai_error_message = "Error generating image"
|
|
807
|
+
} catch (e) {
|
|
808
|
+
ai_error_message = "error generating image"
|
|
810
809
|
}
|
|
811
810
|
} else {
|
|
812
|
-
ai_error_message = res?.error_message ?? "
|
|
811
|
+
ai_error_message = res?.error_message ?? "error generating image"
|
|
813
812
|
}
|
|
814
813
|
ai_image_generator_is_loading = false
|
|
815
814
|
}
|
|
@@ -1520,7 +1519,7 @@ export function create_image_editor_manager(config) {
|
|
|
1520
1519
|
accept: ["image/png", "image/jpeg", "image/webp"],
|
|
1521
1520
|
})
|
|
1522
1521
|
ai_generate_image_from_text_button_manager = create_button_manager({
|
|
1523
|
-
text: "Generate Image
|
|
1522
|
+
text: "Generate Image",
|
|
1524
1523
|
is_compressed: true,
|
|
1525
1524
|
mt: 1,
|
|
1526
1525
|
is_loading: () => ai_image_generator_is_loading,
|
package/package.json
CHANGED
|
@@ -789,27 +789,26 @@ export function create_image_editor_manager(config) {
|
|
|
789
789
|
|
|
790
790
|
async function ai_image_generator(input) {
|
|
791
791
|
ai_error_message = null
|
|
792
|
-
if (typeof config?.ai_image_generator
|
|
792
|
+
if (typeof config?.ai_image_generator != "function") {
|
|
793
793
|
ai_error_message = "ai_image_generator function not provided to config"
|
|
794
794
|
return
|
|
795
795
|
}
|
|
796
796
|
ai_image_generator_is_loading = true
|
|
797
|
-
const res = await config
|
|
797
|
+
const res = await config.ai_image_generator(input)
|
|
798
798
|
if (res?.is_success) {
|
|
799
799
|
try {
|
|
800
|
-
const data_url =
|
|
800
|
+
const data_url = res?.data?.data_url
|
|
801
801
|
image_sources = [data_url, ...image_sources]
|
|
802
802
|
image_source_index = 0
|
|
803
803
|
set_base_image(data_url)
|
|
804
|
-
mime_type = "image/webp"
|
|
805
|
-
mime_type_input =
|
|
804
|
+
mime_type = res?.data?.mime_type || "image/webp"
|
|
805
|
+
mime_type_input = mime_type
|
|
806
806
|
set_file_data_base()
|
|
807
|
-
} catch (
|
|
808
|
-
|
|
809
|
-
ai_error_message = "Error generating image"
|
|
807
|
+
} catch (e) {
|
|
808
|
+
ai_error_message = "error generating image"
|
|
810
809
|
}
|
|
811
810
|
} else {
|
|
812
|
-
ai_error_message = res?.error_message ?? "
|
|
811
|
+
ai_error_message = res?.error_message ?? "error generating image"
|
|
813
812
|
}
|
|
814
813
|
ai_image_generator_is_loading = false
|
|
815
814
|
}
|
|
@@ -1520,7 +1519,7 @@ export function create_image_editor_manager(config) {
|
|
|
1520
1519
|
accept: ["image/png", "image/jpeg", "image/webp"],
|
|
1521
1520
|
})
|
|
1522
1521
|
ai_generate_image_from_text_button_manager = create_button_manager({
|
|
1523
|
-
text: "Generate Image
|
|
1522
|
+
text: "Generate Image",
|
|
1524
1523
|
is_compressed: true,
|
|
1525
1524
|
mt: 1,
|
|
1526
1525
|
is_loading: () => ai_image_generator_is_loading,
|