@8wave/ai-elements 0.125.0-beta.27 → 0.125.0-beta.28

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.
Files changed (121) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-CFGqa-tX.js → PkChatbotFilePreview-CqxtVySb.js} +100 -59
  2. package/dist/_chunks/PkChatbotFilePreview-CqxtVySb.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreview-BPsD2P7s.js → PkFilePreview-DiLMoL-6.js} +32 -32
  4. package/dist/_chunks/{PkFilePreview-BPsD2P7s.js.map → PkFilePreview-DiLMoL-6.js.map} +1 -1
  5. package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js → PkFilePreviewDialog-CHBtxpoB.js} +2 -2
  6. package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js.map → PkFilePreviewDialog-CHBtxpoB.js.map} +1 -1
  7. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js +555 -0
  8. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js.map +1 -0
  9. package/dist/_chunks/{PkSelectionActions-DkETXtSL.js → PkSelectionActions-DFyvcEyl.js} +2 -2
  10. package/dist/_chunks/{PkSelectionActions-DkETXtSL.js.map → PkSelectionActions-DFyvcEyl.js.map} +1 -1
  11. package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js → PkStreamingMarkdown-0hE_Cx4W.js} +2 -2
  12. package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js.map → PkStreamingMarkdown-0hE_Cx4W.js.map} +1 -1
  13. package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js → PkToolChatFile-DtQ9xY4w.js} +3 -3
  14. package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js.map → PkToolChatFile-DtQ9xY4w.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js → PkToolShareDocument-BvHklbzb.js} +2 -2
  16. package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js.map → PkToolShareDocument-BvHklbzb.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js → PkToolShowArtifact-BdkKU6P1.js} +2 -2
  18. package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js.map → PkToolShowArtifact-BdkKU6P1.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js → PkToolShowContactForm-BmM2MbOK.js} +2 -2
  20. package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js.map → PkToolShowContactForm-BmM2MbOK.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowForm-DcPccCEU.js → PkToolShowForm-CoFlgA-I.js} +3 -3
  22. package/dist/_chunks/{PkToolShowForm-DcPccCEU.js.map → PkToolShowForm-CoFlgA-I.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js → PkToolShowSources-DDBlLBt6.js} +2 -2
  24. package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js.map → PkToolShowSources-DDBlLBt6.js.map} +1 -1
  25. package/dist/_chunks/{utils-BZuri2jT.js → utils-ChmRkK0t.js} +12 -5
  26. package/dist/_chunks/utils-ChmRkK0t.js.map +1 -0
  27. package/dist/ai-elements.es.js +3196 -3114
  28. package/dist/ai-elements.es.js.map +1 -1
  29. package/dist-vue/PkChatbot.js +1 -1
  30. package/dist-vue/PkChatbotEmptyState.js +1 -1
  31. package/dist-vue/PkChatbotFilePreview.js +1 -1
  32. package/dist-vue/PkChatbotInput.js +1 -1
  33. package/dist-vue/PkChatbotMessages.js +1 -1
  34. package/dist-vue/PkChatbotStepPayload.js +1 -1
  35. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  36. package/dist-vue/PkChatbotSteps.js +1 -1
  37. package/dist-vue/PkChatbotViewChat.js +1 -1
  38. package/dist-vue/PkChatbotViewConversations.js +1 -1
  39. package/dist-vue/PkChatbotViewFiles.js +1 -1
  40. package/dist-vue/PkChatbotViewProfile.js +1 -1
  41. package/dist-vue/_chunks/{PkChatbot-N5lgU3-k.js → PkChatbot-BjJzskl7.js} +8 -8
  42. package/dist-vue/_chunks/{PkChatbot-N5lgU3-k.js.map → PkChatbot-BjJzskl7.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js → PkChatbotEmptyState-CZC2gP3I.js} +2 -2
  44. package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js.map → PkChatbotEmptyState-CZC2gP3I.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotFilePreview-BsvT6orx.js → PkChatbotFilePreview-j_8sDZUE.js} +112 -71
  46. package/dist-vue/_chunks/PkChatbotFilePreview-j_8sDZUE.js.map +1 -0
  47. package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js +509 -0
  48. package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js.map +1 -0
  49. package/dist-vue/_chunks/PkChatbotMessages-b2lupEv9.js +1049 -0
  50. package/dist-vue/_chunks/{PkChatbotMessages-BISaZu4z.js.map → PkChatbotMessages-b2lupEv9.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js → PkChatbotStepPayload-D4w1XlF2.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js.map → PkChatbotStepPayload-D4w1XlF2.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js → PkChatbotStepToolDetail-DFTcjzoX.js} +3 -3
  54. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js.map → PkChatbotStepToolDetail-DFTcjzoX.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js → PkChatbotSteps-D3zLulMo.js} +5 -5
  56. package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js.map → PkChatbotSteps-D3zLulMo.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkChatbotViewChat-B3Nr7-kY.js → PkChatbotViewChat-DawyiUjq.js} +322 -344
  58. package/dist-vue/_chunks/PkChatbotViewChat-DawyiUjq.js.map +1 -0
  59. package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js → PkChatbotViewConversations-Bs246dtL.js} +3 -3
  60. package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js.map → PkChatbotViewConversations-Bs246dtL.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js → PkChatbotViewFiles-uzZ5H4Fd.js} +2 -2
  62. package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js.map → PkChatbotViewFiles-uzZ5H4Fd.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js → PkChatbotViewProfile-BhIvfT_n.js} +2 -2
  64. package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js.map → PkChatbotViewProfile-BhIvfT_n.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkFilePreview-D-BGFp9C.js → PkFilePreview-DfD48QQ_.js} +48 -48
  66. package/dist-vue/_chunks/{PkFilePreview-D-BGFp9C.js.map → PkFilePreview-DfD48QQ_.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkFilePreviewDialog-By2TQolA.js → PkFilePreviewDialog-DFCBpQf3.js} +2 -2
  68. package/dist-vue/_chunks/{PkFilePreviewDialog-By2TQolA.js.map → PkFilePreviewDialog-DFCBpQf3.js.map} +1 -1
  69. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js +550 -0
  70. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js.map +1 -0
  71. package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js → PkStreamingMarkdown-ChMbSviw.js} +2 -2
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js.map → PkStreamingMarkdown-ChMbSviw.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js → PkToolChatFile-DQtABEaI.js} +3 -3
  74. package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js.map → PkToolChatFile-DQtABEaI.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js → PkToolShareDocument-cMUqik6v.js} +2 -2
  76. package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js.map → PkToolShareDocument-cMUqik6v.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js → PkToolShowArtifact-w6SxjLPW.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js.map → PkToolShowArtifact-w6SxjLPW.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js → PkToolShowContactForm-BQ7bBTQU.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js.map → PkToolShowContactForm-BQ7bBTQU.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js → PkToolShowDiagram-D-yQgdOL.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js.map → PkToolShowDiagram-D-yQgdOL.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js → PkToolShowForm-CF00JLpa.js} +3 -3
  84. package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js.map → PkToolShowForm-CF00JLpa.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js → PkToolShowImageGallery-ZJMWOWHq.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js.map → PkToolShowImageGallery-ZJMWOWHq.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js → PkToolShowProductList-CeKI9H36.js} +2 -2
  88. package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js.map → PkToolShowProductList-CeKI9H36.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js → PkToolShowSources-CXZqanmw.js} +2 -2
  90. package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js.map → PkToolShowSources-CXZqanmw.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js → PkToolShowVideo-BCs-i6xQ.js} +2 -2
  92. package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js.map → PkToolShowVideo-BCs-i6xQ.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js → PkToolShowWebPages-Bixa0CjQ.js} +2 -2
  94. package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js.map → PkToolShowWebPages-Bixa0CjQ.js.map} +1 -1
  95. package/dist-vue/_chunks/{useChatbotStore-BZ1n3Hyx.js → useChatbotStore-BIjCGX0B.js} +858 -835
  96. package/dist-vue/_chunks/useChatbotStore-BIjCGX0B.js.map +1 -0
  97. package/dist-vue/_chunks/{utils-RwaXl9-x.js → utils-CaYEz-0A.js} +11 -4
  98. package/dist-vue/_chunks/utils-CaYEz-0A.js.map +1 -0
  99. package/dist-vue/composables.js +56 -4
  100. package/dist-vue/composables.js.map +1 -1
  101. package/dist-vue/index.js +49 -49
  102. package/dist-vue/index.js.map +1 -1
  103. package/dist-vue/locales.js +56 -0
  104. package/dist-vue/packages/components/src/chat/PkChatbotFilePreview.d.ts +14 -0
  105. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
  106. package/dist-vue/packages/components/src/chat/PkImageEditor.d.ts +37 -0
  107. package/dist-vue/packages/components/src/chat/PkImageEditorDialog.d.ts +19 -0
  108. package/dist-vue/packages/components/src/chat/imageEdits.d.ts +106 -0
  109. package/dist-vue/packages/components/src/chat/utils.d.ts +7 -0
  110. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +7 -1
  111. package/dist-vue/style.css +1 -1
  112. package/package.json +1 -1
  113. package/dist/_chunks/PkChatbotFilePreview-CFGqa-tX.js.map +0 -1
  114. package/dist/_chunks/utils-BZuri2jT.js.map +0 -1
  115. package/dist-vue/_chunks/PkChatbotFilePreview-BsvT6orx.js.map +0 -1
  116. package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js +0 -478
  117. package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +0 -1
  118. package/dist-vue/_chunks/PkChatbotMessages-BISaZu4z.js +0 -1049
  119. package/dist-vue/_chunks/PkChatbotViewChat-B3Nr7-kY.js.map +0 -1
  120. package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +0 -1
  121. package/dist-vue/_chunks/utils-RwaXl9-x.js.map +0 -1
@@ -75,6 +75,7 @@ var e = {
75
75
  copied: "Copied",
76
76
  copy: "Copy",
77
77
  proceed: "Proceed",
78
+ apply: "Apply",
78
79
  clear: "Clear",
79
80
  send: "Send",
80
81
  showLess: "Show less",
@@ -130,6 +131,7 @@ var e = {
130
131
  chatErrorInternalServer: "A server error occurred. Start a new chat to continue.",
131
132
  feedbackSubmittedTitle: "Thank you!",
132
133
  feedbackSubmittedMessage: "Your feedback has been submitted successfully.",
134
+ attachmentUploadFailed: "An attachment did not upload: retry it or remove it to send the message.",
133
135
  fileLimitPerChat: "You have reached the limit of {max} files for this conversation.",
134
136
  fileLimitPerMessage: "You can attach at most {max} files per message.",
135
137
  backgroundAnswerReady: "The agent answered in “{title}”",
@@ -791,6 +793,32 @@ var e = {
791
793
  resetSentTitle: "Check your email",
792
794
  resetSent: "If an account exists with this email, you will receive a password reset link."
793
795
  },
796
+ imageEditor: {
797
+ edit: "Edit image",
798
+ crop: "Crop",
799
+ cover: "Cover",
800
+ aspectFree: "Free",
801
+ coverSolid: "Solid box",
802
+ coverPixelate: "Pixels",
803
+ canvasLabel: "Image being edited",
804
+ tool: "Tool",
805
+ rotateLeft: "Rotate left",
806
+ rotateRight: "Rotate right",
807
+ undo: "Undo the last change",
808
+ redo: "Redo",
809
+ aspect: "Aspect ratio",
810
+ cropHint: "Drag on the image, then press Apply.",
811
+ coverStyle: "How to cover",
812
+ coverHint: "Drag on the image. On a text a solid box is the only safe cover; pixels are fine for a face.",
813
+ exportFailed: "The edited image could not be saved.",
814
+ drawFailed: "The image is too large to edit in this browser.",
815
+ loadFailed: "The image could not be opened.",
816
+ title: "Edit image",
817
+ loading: "Opening the image",
818
+ sizeScaledDown: "{width} × {height} px, scaled down to fit the browser",
819
+ size: "{width} × {height} px",
820
+ use: "Use the image"
821
+ },
794
822
  chatFilePreview: {
795
823
  restore: "Restore this version",
796
824
  open: "Open",
@@ -1027,6 +1055,7 @@ var e = {
1027
1055
  copied: "Copiato",
1028
1056
  copy: "Copia",
1029
1057
  proceed: "Procedi",
1058
+ apply: "Applica",
1030
1059
  clear: "Pulisci",
1031
1060
  send: "Invia",
1032
1061
  showLess: "Mostra di meno",
@@ -1082,6 +1111,7 @@ var e = {
1082
1111
  chatErrorInternalServer: "Si è verificato un errore del server. Inizia una nuova chat per continuare.",
1083
1112
  feedbackSubmittedTitle: "Grazie!",
1084
1113
  feedbackSubmittedMessage: "Il tuo feedback è stato inviato con successo.",
1114
+ attachmentUploadFailed: "Un allegato non è stato caricato: riprova o toglilo per inviare il messaggio.",
1085
1115
  fileLimitPerChat: "Hai raggiunto il limite di {max} file per questa conversazione.",
1086
1116
  fileLimitPerMessage: "Puoi allegare al massimo {max} file per messaggio.",
1087
1117
  backgroundAnswerReady: "L'agente ha risposto in «{title}»",
@@ -1743,6 +1773,32 @@ var e = {
1743
1773
  resetSentTitle: "Controlla la tua email",
1744
1774
  resetSent: "Se esiste un account con questa email, riceverai un link per reimpostare la password."
1745
1775
  },
1776
+ imageEditor: {
1777
+ edit: "Modifica immagine",
1778
+ crop: "Ritaglia",
1779
+ cover: "Copri",
1780
+ aspectFree: "Libere",
1781
+ coverSolid: "Riquadro pieno",
1782
+ coverPixelate: "Pixel",
1783
+ canvasLabel: "Immagine in modifica",
1784
+ tool: "Strumento",
1785
+ rotateLeft: "Ruota a sinistra",
1786
+ rotateRight: "Ruota a destra",
1787
+ undo: "Annulla l'ultima modifica",
1788
+ redo: "Ripeti",
1789
+ aspect: "Proporzioni",
1790
+ cropHint: "Trascina sull'immagine, poi premi Applica.",
1791
+ coverStyle: "Come coprire",
1792
+ coverHint: "Trascina sull'immagine. Per un testo il riquadro pieno è l'unica copertura sicura; i pixel vanno bene per un volto.",
1793
+ exportFailed: "Non è stato possibile salvare l'immagine modificata.",
1794
+ drawFailed: "L'immagine è troppo grande per essere modificata in questo browser.",
1795
+ loadFailed: "Non è stato possibile aprire l'immagine.",
1796
+ title: "Modifica immagine",
1797
+ loading: "Apertura dell'immagine",
1798
+ sizeScaledDown: "{width} × {height} px, ridotta per stare nel browser",
1799
+ size: "{width} × {height} px",
1800
+ use: "Usa l'immagine"
1801
+ },
1746
1802
  chatFilePreview: {
1747
1803
  restore: "Ripristina questa versione",
1748
1804
  open: "Apri",
@@ -8,6 +8,16 @@ type __VLS_Props = {
8
8
  loading?: boolean;
9
9
  error?: string;
10
10
  removable?: boolean;
11
+ /**
12
+ * Shows the "Edit" button on an image of the composer (`compact`),
13
+ * opposite the remove one: the host opens the image editor on `edit`.
14
+ */
15
+ editable?: boolean;
16
+ /**
17
+ * The upload failed (`error`) and can be tried again: the failure
18
+ * mark becomes a "Retry" button, and the host uploads again on `retry`.
19
+ */
20
+ retryable?: boolean;
11
21
  /**
12
22
  * Dense layout for the composer: a small square thumbnail / slim row,
13
23
  * without the metadata caption. The full card is reserved for the
@@ -44,8 +54,12 @@ type __VLS_Props = {
44
54
  };
45
55
  declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
46
56
  remove: () => any;
57
+ retry: () => any;
58
+ edit: () => any;
47
59
  }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
48
60
  onRemove?: (() => any) | undefined;
61
+ onRetry?: (() => any) | undefined;
62
+ onEdit?: (() => any) | undefined;
49
63
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
50
64
  declare const _default: typeof __VLS_export;
51
65
  export default _default;
@@ -41,17 +41,27 @@ type __VLS_Props = {
41
41
  * takes them back to manual.
42
42
  */
43
43
  automaticConfirmations?: boolean;
44
+ /**
45
+ * The host replaces an edited image (`replace-attachment`): the
46
+ * images of the composer show "Edit" and open the image editor.
47
+ */
48
+ editableImages?: boolean;
49
+ /**
50
+ * The host uploads a failed attachment again (`retry-attachment`):
51
+ * its chip shows "Retry".
52
+ */
53
+ retryableAttachments?: boolean;
44
54
  };
45
55
  type __VLS_ModelProps = {
46
56
  modelValue?: string | undefined;
47
57
  'pendingAttachments'?: PendingAttachment[];
48
58
  };
49
59
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
50
- declare var __VLS_54: {}, __VLS_95: {};
60
+ declare var __VLS_56: {}, __VLS_97: {};
51
61
  type __VLS_Slots = {} & {
52
- prepend?: (props: typeof __VLS_54) => any;
62
+ prepend?: (props: typeof __VLS_56) => any;
53
63
  } & {
54
- 'additional-actions'?: (props: typeof __VLS_95) => any;
64
+ 'additional-actions'?: (props: typeof __VLS_97) => any;
55
65
  };
56
66
  declare const __VLS_base: DefineComponent<__VLS_PublicProps, {
57
67
  /** Move the focus to the message field */
@@ -63,6 +73,8 @@ declare const __VLS_base: DefineComponent<__VLS_PublicProps, {
63
73
  "stop-generation": () => any;
64
74
  "file-select": (file: File) => any;
65
75
  "remove-attachment": (attachment: PendingAttachment) => any;
76
+ "replace-attachment": (attachment: PendingAttachment, file: File) => any;
77
+ "retry-attachment": (attachment: PendingAttachment) => any;
66
78
  "dismiss-attachment-notice": () => any;
67
79
  "dismiss-page-notice": () => any;
68
80
  "open-answer-notice": (id: string) => any;
@@ -78,6 +90,8 @@ declare const __VLS_base: DefineComponent<__VLS_PublicProps, {
78
90
  "onStop-generation"?: (() => any) | undefined;
79
91
  "onFile-select"?: ((file: File) => any) | undefined;
80
92
  "onRemove-attachment"?: ((attachment: PendingAttachment) => any) | undefined;
93
+ "onReplace-attachment"?: ((attachment: PendingAttachment, file: File) => any) | undefined;
94
+ "onRetry-attachment"?: ((attachment: PendingAttachment) => any) | undefined;
81
95
  "onDismiss-attachment-notice"?: (() => any) | undefined;
82
96
  "onDismiss-page-notice"?: (() => any) | undefined;
83
97
  "onOpen-answer-notice"?: ((id: string) => any) | undefined;
@@ -0,0 +1,37 @@
1
+ import { ImageEdit } from './imageEdits';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ /**
4
+ * The tools of the image editor over the image they change (spec
5
+ * `chat-image-editor.md`, F1): crop and cover by dragging on the image,
6
+ * quarter turns, undo and redo. The edits are the model, the image stays
7
+ * as it was loaded. Dragging needs a mouse, a pen or a finger; the rest
8
+ * works from the keyboard.
9
+ */
10
+ type __VLS_Props = {
11
+ /** The image the edits start from. */
12
+ image: HTMLCanvasElement;
13
+ };
14
+ declare function applyCrop(): void;
15
+ type __VLS_ModelProps = {
16
+ 'edits': ImageEdit[];
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {
20
+ /** A crop is drawn and not applied yet. */
21
+ pendingCrop: globalThis.ComputedRef<boolean>;
22
+ /** Applies the crop drawn, as Apply does: "Use the image" calls it first. */
23
+ applyCrop: typeof applyCrop;
24
+ /**
25
+ * The canvas on screen, every edit drawn, which the host writes as
26
+ * the file: it stays the editor's, released when the editor goes.
27
+ */
28
+ shownCanvas: () => HTMLCanvasElement | undefined;
29
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
30
+ error: () => any;
31
+ "update:edits": (value: ImageEdit[]) => any;
32
+ }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
33
+ onError?: (() => any) | undefined;
34
+ "onUpdate:edits"?: ((value: ImageEdit[]) => any) | undefined;
35
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ /**
3
+ * The image editor in a dialog (spec `chat-image-editor.md`, F1): opens
4
+ * on an image file and gives back the edited copy, same name and type.
5
+ * Open while it is mounted: `close` asks the host to drop it. It keeps
6
+ * open on a click outside and on `Esc`, which would throw the edits away.
7
+ */
8
+ type __VLS_Props = {
9
+ file: File;
10
+ };
11
+ declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
12
+ close: () => any;
13
+ apply: (file: File) => any;
14
+ }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onClose?: (() => any) | undefined;
16
+ onApply?: ((file: File) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The model of the image editor (spec `chat-image-editor.md`): a list of
3
+ * edits applied in order to the original, so every draw starts again from
4
+ * the original and undo drops the last edit. The geometry is pure; the
5
+ * drawing needs a canvas, which only a browser has.
6
+ */
7
+ /** A point in the pixels of the image an edit applies to. */
8
+ export interface ImagePoint {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ export interface ImageSize {
13
+ width: number;
14
+ height: number;
15
+ }
16
+ /** A rectangle in the pixels of the image an edit applies to. */
17
+ export interface ImageRect extends ImagePoint, ImageSize {
18
+ }
19
+ /**
20
+ * How a covered area is drawn: a black box, the only cover a text cannot be
21
+ * read back through, or large blocks of its average color, for a face.
22
+ */
23
+ export type CoverStyle = 'solid' | 'pixelate';
24
+ /**
25
+ * One change, in the coordinates of the image the edits before it left: a
26
+ * crop changes the size, a quarter turn swaps the sides.
27
+ */
28
+ export type ImageEdit =
29
+ /** A quarter turn, `1` clockwise and `-1` counterclockwise. */
30
+ {
31
+ kind: 'rotate';
32
+ turn: 1 | -1;
33
+ } | {
34
+ kind: 'crop';
35
+ rect: ImageRect;
36
+ } | {
37
+ kind: 'cover';
38
+ rect: ImageRect;
39
+ style: CoverStyle;
40
+ };
41
+ /**
42
+ * Safari on iOS refuses a canvas larger than this area: a larger image is
43
+ * scaled down to fit before it is edited.
44
+ */
45
+ export declare const MAX_CANVAS_AREA: number;
46
+ /** The quality of a JPEG or WebP written back. */
47
+ export declare const EXPORT_QUALITY = 0.92;
48
+ /**
49
+ * The size an image is edited at: its own, or the largest with the same
50
+ * proportions whose area fits `maxArea`.
51
+ */
52
+ export declare function fitToArea(size: ImageSize, maxArea?: number): ImageSize;
53
+ /** The size of the image once `edits` are applied to one of `size`. */
54
+ export declare function sizeAfterEdits(size: ImageSize, edits: readonly ImageEdit[]): ImageSize;
55
+ /** The side of a block of a pixelated cover on an image of `size`. */
56
+ export declare function pixelBlock(size: ImageSize): number;
57
+ /**
58
+ * The rectangle a drag from `from` to `to` draws, in any direction, inside
59
+ * `bounds`. With an `aspect` (width over height) the longer side of the drag
60
+ * leads, and both sides shrink together to stay inside the image.
61
+ */
62
+ export declare function dragRect(from: ImagePoint, to: ImagePoint, bounds: ImageSize, aspect?: number): ImageRect;
63
+ /**
64
+ * Pixelates RGBA pixels in place: each `block` square takes the average
65
+ * color of the pixels it covers, weighted by their opacity, so the
66
+ * transparent pixels of a PNG do not darken it. The blocks start at the top
67
+ * left corner. What is left on the right and bottom edges, less than a
68
+ * block, joins the last block: a strip of a few pixels would keep a detail
69
+ * finer than the block promises.
70
+ */
71
+ export declare function pixelateData(data: Uint8ClampedArray, width: number, height: number, block: number): void;
72
+ /**
73
+ * The name of the edited file: the original one, with the extension of the
74
+ * type written when the browser could not write the original type (Safari
75
+ * writes no WebP and gives a PNG instead).
76
+ */
77
+ export declare function editedFileName(name: string, originalType: string, writtenType: string): string;
78
+ export interface LoadedImage {
79
+ /** The image as it is edited, at most `MAX_CANVAS_AREA` pixels. */
80
+ image: HTMLCanvasElement;
81
+ /** The size of the file, larger than `image` when it was scaled down. */
82
+ original: ImageSize;
83
+ }
84
+ /**
85
+ * Decodes an image file into the canvas the edits start from, upright as
86
+ * the photo's orientation says and scaled down if it is too large for a
87
+ * canvas.
88
+ */
89
+ export declare function loadEditableImage(file: Blob): Promise<LoadedImage>;
90
+ /**
91
+ * Draws `edits` over a copy of `image`, which stays untouched. The canvas
92
+ * returned is new: the caller releases it with `releaseCanvas` when it
93
+ * draws the next one.
94
+ */
95
+ export declare function renderEdits(image: HTMLCanvasElement, edits: readonly ImageEdit[]): HTMLCanvasElement;
96
+ /**
97
+ * Writes the canvas as a file of `type`, or as a PNG where the browser
98
+ * cannot write that type. A canvas writes no metadata: the EXIF of a photo,
99
+ * its position included, does not survive.
100
+ */
101
+ export declare function exportCanvas(canvas: HTMLCanvasElement, type: string): Promise<Blob>;
102
+ /**
103
+ * Frees the memory of a canvas no longer shown: Safari counts every canvas
104
+ * until it is collected, and refuses new ones past its total.
105
+ */
106
+ export declare function releaseCanvas(canvas: HTMLCanvasElement): void;
@@ -342,6 +342,13 @@ export type ChatFileRestoreTarget = {
342
342
  * of `listino.xlsx`.
343
343
  */
344
344
  export declare const chatFileName: (filename: string, version?: number) => string;
345
+ /**
346
+ * Whether the image editor (spec `chat-image-editor.md`) opens on a file of
347
+ * this type: one a canvas reads and writes back as the same type, so not a
348
+ * GIF, an SVG or a HEIC. Here and not in `imageEdits.ts`, which the
349
+ * composer would otherwise pull into the main bundle of the widget.
350
+ */
351
+ export declare function isEditableImage(mediaType: string): boolean;
345
352
  /**
346
353
  * Whether a chat stands in front of the place of the bar that shows the
347
354
  * agent acting on the page (`PkPageControlBar`): the top centre of the
@@ -2179,6 +2179,8 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
2179
2179
  }) => void;
2180
2180
  handleFileSelect: (file: File) => Promise<void>;
2181
2181
  discardPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
2182
+ replacePendingAttachment: (attachment: PendingAttachment, file: File) => Promise<void>;
2183
+ retryPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
2182
2184
  clearFileLimitError: () => void;
2183
2185
  clearPendingAttachments: (revokeAll?: boolean) => void;
2184
2186
  onUpvote: (message: UIChatMessage) => Promise<void>;
@@ -4323,6 +4325,8 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
4323
4325
  }) => void;
4324
4326
  handleFileSelect: (file: File) => Promise<void>;
4325
4327
  discardPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
4328
+ replacePendingAttachment: (attachment: PendingAttachment, file: File) => Promise<void>;
4329
+ retryPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
4326
4330
  clearFileLimitError: () => void;
4327
4331
  clearPendingAttachments: (revokeAll?: boolean) => void;
4328
4332
  onUpvote: (message: UIChatMessage) => Promise<void>;
@@ -6467,6 +6471,8 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
6467
6471
  }) => void;
6468
6472
  handleFileSelect: (file: File) => Promise<void>;
6469
6473
  discardPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
6474
+ replacePendingAttachment: (attachment: PendingAttachment, file: File) => Promise<void>;
6475
+ retryPendingAttachment: (attachment: PendingAttachment) => Promise<void>;
6470
6476
  clearFileLimitError: () => void;
6471
6477
  clearPendingAttachments: (revokeAll?: boolean) => void;
6472
6478
  onUpvote: (message: UIChatMessage) => Promise<void>;
@@ -6478,4 +6484,4 @@ export declare function useChatbotStore(agentId: string): Store<`chatbot-${strin
6478
6484
  focusInput: () => void;
6479
6485
  renameChatTitle: (chatId: string, title: string) => Promise<void>;
6480
6486
  deleteChat: (chatId: string) => Promise<void>;
6481
- }, "regenerate" | "sendMessage" | "addToolOutput" | "addToolApprovalResponse" | "stopHostActions" | "voicePageTools" | "cancelVoicePageCalls" | "closePageNotice" | "respondHostConfirmation" | "setPageAccessOff" | "sendSelection" | "setConfirmationMode" | "openBackgroundAnswer" | "dismissBackgroundAnswer" | "removeQueuedMessage" | "editQueuedMessage" | "buildDeviceContext" | "initialize" | "loadConversations" | "loadMoreConversations" | "searchConversations" | "loadChatFiles" | "refreshMessages" | "appendMessage" | "getChatFileUrl" | "getChatFilePreviewUrl" | "deleteChatFile" | "handleSubmit" | "stopGeneration" | "startNewChat" | "handleFileSelect" | "discardPendingAttachment" | "clearFileLimitError" | "clearPendingAttachments" | "onUpvote" | "onDownvote" | "onFeedback" | "onFeedbackSubmit" | "onLeadSubmit" | "navigate" | "focusInput" | "renameChatTitle" | "deleteChat">>;
6487
+ }, "regenerate" | "sendMessage" | "addToolOutput" | "addToolApprovalResponse" | "stopHostActions" | "voicePageTools" | "cancelVoicePageCalls" | "closePageNotice" | "respondHostConfirmation" | "setPageAccessOff" | "sendSelection" | "setConfirmationMode" | "openBackgroundAnswer" | "dismissBackgroundAnswer" | "removeQueuedMessage" | "editQueuedMessage" | "buildDeviceContext" | "initialize" | "loadConversations" | "loadMoreConversations" | "searchConversations" | "loadChatFiles" | "refreshMessages" | "appendMessage" | "getChatFileUrl" | "getChatFilePreviewUrl" | "deleteChatFile" | "handleSubmit" | "stopGeneration" | "startNewChat" | "handleFileSelect" | "discardPendingAttachment" | "replacePendingAttachment" | "retryPendingAttachment" | "clearFileLimitError" | "clearPendingAttachments" | "onUpvote" | "onDownvote" | "onFeedback" | "onFeedbackSubmit" | "onLeadSubmit" | "navigate" | "focusInput" | "renameChatTitle" | "deleteChat">>;