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