@8wave/ai-elements 0.125.0-beta.31 → 0.125.0-beta.33

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 (103) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-CqxtVySb.js → PkChatbotFilePreview-DsRAk1js.js} +2 -2
  2. package/dist/_chunks/{PkChatbotFilePreview-CqxtVySb.js.map → PkChatbotFilePreview-DsRAk1js.js.map} +1 -1
  3. package/dist/_chunks/PkImageEditorDialog-BQwM06kT.js +939 -0
  4. package/dist/_chunks/PkImageEditorDialog-BQwM06kT.js.map +1 -0
  5. package/dist/_chunks/{PkStreamingMarkdown-BqDooeUU.js → PkStreamingMarkdown-CjL7l_3E.js} +2 -2
  6. package/dist/_chunks/{PkStreamingMarkdown-BqDooeUU.js.map → PkStreamingMarkdown-CjL7l_3E.js.map} +1 -1
  7. package/dist/_chunks/{PkToolChatFile-DpStX3wS.js → PkToolChatFile-weptM8iA.js} +2 -2
  8. package/dist/_chunks/{PkToolChatFile-DpStX3wS.js.map → PkToolChatFile-weptM8iA.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShareDocument-BvHklbzb.js → PkToolShareDocument-D5K3uJ2x.js} +2 -2
  10. package/dist/_chunks/{PkToolShareDocument-BvHklbzb.js.map → PkToolShareDocument-D5K3uJ2x.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowArtifact-YPwJLLlW.js → PkToolShowArtifact-Bm2zS5YS.js} +2 -2
  12. package/dist/_chunks/{PkToolShowArtifact-YPwJLLlW.js.map → PkToolShowArtifact-Bm2zS5YS.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowContactForm-CTc1mbA8.js → PkToolShowContactForm-BKJCv5To.js} +2 -2
  14. package/dist/_chunks/{PkToolShowContactForm-CTc1mbA8.js.map → PkToolShowContactForm-BKJCv5To.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowDiagram-COt1Z3q9.js → PkToolShowDiagram-jpaEAi2X.js} +2 -2
  16. package/dist/_chunks/{PkToolShowDiagram-COt1Z3q9.js.map → PkToolShowDiagram-jpaEAi2X.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowForm-DT5EyYVY.js → PkToolShowForm-DvAcJgDP.js} +2 -2
  18. package/dist/_chunks/{PkToolShowForm-DT5EyYVY.js.map → PkToolShowForm-DvAcJgDP.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowImageGallery-DKrCrrB5.js → PkToolShowImageGallery-D0htuXNL.js} +4 -4
  20. package/dist/_chunks/{PkToolShowImageGallery-DKrCrrB5.js.map → PkToolShowImageGallery-D0htuXNL.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowSources-CzSknPo6.js → PkToolShowSources-Cfj6iRGj.js} +2 -2
  22. package/dist/_chunks/{PkToolShowSources-CzSknPo6.js.map → PkToolShowSources-Cfj6iRGj.js.map} +1 -1
  23. package/dist/_chunks/{useLightbox-D2Zi-Fpe.js → useLightbox-C54BCSbU.js} +130 -89
  24. package/dist/_chunks/useLightbox-C54BCSbU.js.map +1 -0
  25. package/dist/ai-elements.es.js +2774 -2721
  26. package/dist/ai-elements.es.js.map +1 -1
  27. package/dist-vue/PkChatbot.js +1 -1
  28. package/dist-vue/PkChatbotEmptyState.js +1 -1
  29. package/dist-vue/PkChatbotFilePreview.js +1 -1
  30. package/dist-vue/PkChatbotInput.js +1 -1
  31. package/dist-vue/PkChatbotMessages.js +1 -1
  32. package/dist-vue/PkChatbotSteps.js +1 -1
  33. package/dist-vue/PkChatbotViewChat.js +1 -1
  34. package/dist-vue/_chunks/{PkChatbot-DLgPqMWd.js → PkChatbot-Bc2hlwFO.js} +3 -3
  35. package/dist-vue/_chunks/{PkChatbot-DLgPqMWd.js.map → PkChatbot-Bc2hlwFO.js.map} +1 -1
  36. package/dist-vue/_chunks/{PkChatbotEmptyState-DMPEj1Qa.js → PkChatbotEmptyState-NHarCaDm.js} +2 -2
  37. package/dist-vue/_chunks/{PkChatbotEmptyState-DMPEj1Qa.js.map → PkChatbotEmptyState-NHarCaDm.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotFilePreview-j_8sDZUE.js → PkChatbotFilePreview-BIta8Yg-.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotFilePreview-j_8sDZUE.js.map → PkChatbotFilePreview-BIta8Yg-.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotInput-TamSYiA7.js → PkChatbotInput-BSzDRoDD.js} +192 -181
  41. package/dist-vue/_chunks/PkChatbotInput-BSzDRoDD.js.map +1 -0
  42. package/dist-vue/_chunks/{PkChatbotMessages-bPBOSAv7.js → PkChatbotMessages-DEMKZDCb.js} +17 -17
  43. package/dist-vue/_chunks/{PkChatbotMessages-bPBOSAv7.js.map → PkChatbotMessages-DEMKZDCb.js.map} +1 -1
  44. package/dist-vue/_chunks/{PkChatbotSteps-pibgqxus.js → PkChatbotSteps-DGQoYxJ9.js} +2 -2
  45. package/dist-vue/_chunks/{PkChatbotSteps-pibgqxus.js.map → PkChatbotSteps-DGQoYxJ9.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotViewChat-y60IA9aQ.js → PkChatbotViewChat-aKi08vCz.js} +440 -431
  47. package/dist-vue/_chunks/PkChatbotViewChat-aKi08vCz.js.map +1 -0
  48. package/dist-vue/_chunks/{PkFilePreview-CPSYaOV7.js → PkFilePreview-D2HInDoA.js} +2 -2
  49. package/dist-vue/_chunks/{PkFilePreview-CPSYaOV7.js.map → PkFilePreview-D2HInDoA.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkFilePreviewDialog-D6zFO_H_.js → PkFilePreviewDialog-jxcUSzPx.js} +2 -2
  51. package/dist-vue/_chunks/{PkFilePreviewDialog-D6zFO_H_.js.map → PkFilePreviewDialog-jxcUSzPx.js.map} +1 -1
  52. package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js +934 -0
  53. package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js.map +1 -0
  54. package/dist-vue/_chunks/{PkStreamingMarkdown-B3VWOaWb.js → PkStreamingMarkdown-DdOv86Eb.js} +11 -11
  55. package/dist-vue/_chunks/{PkStreamingMarkdown-B3VWOaWb.js.map → PkStreamingMarkdown-DdOv86Eb.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkSvgViewer-BsdSOBpH.js → PkSvgViewer-vkd5Dluw.js} +2 -2
  57. package/dist-vue/_chunks/{PkSvgViewer-BsdSOBpH.js.map → PkSvgViewer-vkd5Dluw.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkToolChatFile-PXpiJLZ6.js → PkToolChatFile-8nx166iM.js} +2 -2
  59. package/dist-vue/_chunks/{PkToolChatFile-PXpiJLZ6.js.map → PkToolChatFile-8nx166iM.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkToolShareDocument-cMUqik6v.js → PkToolShareDocument-CspvFwRR.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShareDocument-cMUqik6v.js.map → PkToolShareDocument-CspvFwRR.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowArtifact-DouCz_dZ.js → PkToolShowArtifact-BppP_xSN.js} +2 -2
  63. package/dist-vue/_chunks/{PkToolShowArtifact-DouCz_dZ.js.map → PkToolShowArtifact-BppP_xSN.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowContactForm-BmiNlFfx.js → PkToolShowContactForm-Bm0icz24.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowContactForm-BmiNlFfx.js.map → PkToolShowContactForm-Bm0icz24.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowDiagram-D6mYTDU-.js → PkToolShowDiagram-CgukB1Ss.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowDiagram-D6mYTDU-.js.map → PkToolShowDiagram-CgukB1Ss.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowForm-CksTiimD.js → PkToolShowForm-CyyN7GQP.js} +2 -2
  69. package/dist-vue/_chunks/{PkToolShowForm-CksTiimD.js.map → PkToolShowForm-CyyN7GQP.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowImageGallery-B-lVY0xH.js → PkToolShowImageGallery-zQF_lsxI.js} +5 -5
  71. package/dist-vue/_chunks/{PkToolShowImageGallery-B-lVY0xH.js.map → PkToolShowImageGallery-zQF_lsxI.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowLocation-B8FE_Sqd.js → PkToolShowLocation-WdRqG8Wi.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowLocation-B8FE_Sqd.js.map → PkToolShowLocation-WdRqG8Wi.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolShowProductList-Dcq3Kdse.js → PkToolShowProductList-DW_P0gC2.js} +2 -2
  75. package/dist-vue/_chunks/{PkToolShowProductList-Dcq3Kdse.js.map → PkToolShowProductList-DW_P0gC2.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowSources-DApWmwvk.js → PkToolShowSources-BugMybUx.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowSources-DApWmwvk.js.map → PkToolShowSources-BugMybUx.js.map} +1 -1
  78. package/dist-vue/_chunks/{PkToolShowVideo-CjrYh9-q.js → PkToolShowVideo-BW7aRKs_.js} +2 -2
  79. package/dist-vue/_chunks/{PkToolShowVideo-CjrYh9-q.js.map → PkToolShowVideo-BW7aRKs_.js.map} +1 -1
  80. package/dist-vue/_chunks/{PkToolShowWebPages-DSIAizw-.js → PkToolShowWebPages-DxKimT-2.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowWebPages-DSIAizw-.js.map → PkToolShowWebPages-DxKimT-2.js.map} +1 -1
  82. package/dist-vue/_chunks/{useLightbox-FDyQrPWe.js → useLightbox-Ctl9zaMX.js} +132 -91
  83. package/dist-vue/_chunks/useLightbox-Ctl9zaMX.js.map +1 -0
  84. package/dist-vue/composables.js +36 -2
  85. package/dist-vue/composables.js.map +1 -1
  86. package/dist-vue/index.js +22 -22
  87. package/dist-vue/index.js.map +1 -1
  88. package/dist-vue/locales.js +34 -0
  89. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +5 -0
  90. package/dist-vue/packages/components/src/chat/PkImageEditor.d.ts +11 -9
  91. package/dist-vue/packages/components/src/chat/PkImageEditorDialog.d.ts +12 -5
  92. package/dist-vue/packages/components/src/chat/imageEdits.d.ts +77 -1
  93. package/dist-vue/packages/components/src/composables/useLightbox.d.ts +26 -0
  94. package/dist-vue/style.css +1 -1
  95. package/package.json +1 -1
  96. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js +0 -555
  97. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js.map +0 -1
  98. package/dist/_chunks/useLightbox-D2Zi-Fpe.js.map +0 -1
  99. package/dist-vue/_chunks/PkChatbotInput-TamSYiA7.js.map +0 -1
  100. package/dist-vue/_chunks/PkChatbotViewChat-y60IA9aQ.js.map +0 -1
  101. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js +0 -550
  102. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js.map +0 -1
  103. package/dist-vue/_chunks/useLightbox-FDyQrPWe.js.map +0 -1
@@ -801,9 +801,23 @@ var e = {
801
801
  edit: "Edit image",
802
802
  crop: "Crop",
803
803
  cover: "Cover",
804
+ arrow: "Arrow",
805
+ rect: "Rectangle",
806
+ path: "Freehand",
807
+ text: "Text",
804
808
  aspectFree: "Free",
805
809
  coverSolid: "Solid box",
806
810
  coverPixelate: "Pixels",
811
+ colorRed: "Red",
812
+ colorYellow: "Yellow",
813
+ colorGreen: "Green",
814
+ colorBlue: "Blue",
815
+ colorWhite: "White",
816
+ colorBlack: "Black",
817
+ arrowHint: "Drag from the tail to the tip.",
818
+ rectHint: "Drag around what you want to point out.",
819
+ pathHint: "Hold down and draw.",
820
+ textHint: "Click where to write, then press Enter.",
807
821
  canvasLabel: "Image being edited",
808
822
  tool: "Tool",
809
823
  rotateLeft: "Rotate left",
@@ -814,6 +828,8 @@ var e = {
814
828
  cropHint: "Drag on the image, then press Apply.",
815
829
  coverStyle: "How to cover",
816
830
  coverHint: "Drag on the image. On a text a solid box is the only safe cover; pixels are fine for a face.",
831
+ color: "Color",
832
+ textLabel: "Text on the image",
817
833
  exportFailed: "The edited image could not be saved.",
818
834
  drawFailed: "The image is too large to edit in this browser.",
819
835
  loadFailed: "The image could not be opened.",
@@ -978,6 +994,7 @@ var e = {
978
994
  },
979
995
  lightbox: {
980
996
  zoom: "Zoom in or out",
997
+ annotate: "Annotate and ask",
981
998
  copy: "Copy image",
982
999
  copied: "Image copied",
983
1000
  copyFailed: "The image could not be copied",
@@ -1785,9 +1802,23 @@ var e = {
1785
1802
  edit: "Modifica immagine",
1786
1803
  crop: "Ritaglia",
1787
1804
  cover: "Copri",
1805
+ arrow: "Freccia",
1806
+ rect: "Rettangolo",
1807
+ path: "Mano libera",
1808
+ text: "Testo",
1788
1809
  aspectFree: "Libere",
1789
1810
  coverSolid: "Riquadro pieno",
1790
1811
  coverPixelate: "Pixel",
1812
+ colorRed: "Rosso",
1813
+ colorYellow: "Giallo",
1814
+ colorGreen: "Verde",
1815
+ colorBlue: "Blu",
1816
+ colorWhite: "Bianco",
1817
+ colorBlack: "Nero",
1818
+ arrowHint: "Trascina dalla coda alla punta.",
1819
+ rectHint: "Trascina intorno a quello che vuoi indicare.",
1820
+ pathHint: "Disegna tenendo premuto.",
1821
+ textHint: "Fai clic dove scrivere, poi premi Invio.",
1791
1822
  canvasLabel: "Immagine in modifica",
1792
1823
  tool: "Strumento",
1793
1824
  rotateLeft: "Ruota a sinistra",
@@ -1798,6 +1829,8 @@ var e = {
1798
1829
  cropHint: "Trascina sull'immagine, poi premi Applica.",
1799
1830
  coverStyle: "Come coprire",
1800
1831
  coverHint: "Trascina sull'immagine. Per un testo il riquadro pieno è l'unica copertura sicura; i pixel vanno bene per un volto.",
1832
+ color: "Colore",
1833
+ textLabel: "Testo sull'immagine",
1801
1834
  exportFailed: "Non è stato possibile salvare l'immagine modificata.",
1802
1835
  drawFailed: "L'immagine è troppo grande per essere modificata in questo browser.",
1803
1836
  loadFailed: "Non è stato possibile aprire l'immagine.",
@@ -1962,6 +1995,7 @@ var e = {
1962
1995
  },
1963
1996
  lightbox: {
1964
1997
  zoom: "Ingrandisci o riduci",
1998
+ annotate: "Annota e chiedi",
1965
1999
  copy: "Copia immagine",
1966
2000
  copied: "Immagine copiata",
1967
2001
  copyFailed: "Non è stato possibile copiare l'immagine",
@@ -66,6 +66,11 @@ type __VLS_Slots = {} & {
66
66
  declare const __VLS_base: DefineComponent<__VLS_PublicProps, {
67
67
  /** Move the focus to the message field */
68
68
  focus: () => void | undefined;
69
+ /**
70
+ * Opens the editor on an image of the conversation, whose bytes are
71
+ * on their way; the copy made of it joins the attachments.
72
+ */
73
+ annotateImage: (file: Promise<File>) => void;
69
74
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
70
75
  "update:modelValue": (value: string | undefined) => any;
71
76
  submit: () => any;
@@ -1,26 +1,28 @@
1
- import { ImageEdit } from './imageEdits';
1
+ import { EditorTool, ImageEdit } from './imageEdits';
2
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
3
  /**
4
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
5
+ * `chat-image-editor.md`, F1 and F2): crop and cover by dragging on the
6
+ * image, quarter turns, arrows, rectangles, freehand strokes and texts in
7
+ * a few colors, undo and redo. The edits are the model, the image stays
8
+ * as it was loaded. Drawing needs a mouse, a pen or a finger; the rest
8
9
  * works from the keyboard.
9
10
  */
10
11
  type __VLS_Props = {
11
12
  /** The image the edits start from. */
12
13
  image: HTMLCanvasElement;
14
+ /** The tool picked on opening: crop, unless the host says otherwise. */
15
+ initialTool?: EditorTool;
13
16
  };
14
- declare function applyCrop(): void;
15
17
  type __VLS_ModelProps = {
16
18
  'edits': ImageEdit[];
17
19
  };
18
20
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
21
  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;
22
+ /** Something is drawn and not added yet: a crop, a text being typed. */
23
+ pending: globalThis.ComputedRef<boolean>;
24
+ /** Adds it, as Apply and Enter do: "Use the image" calls it first. */
25
+ applyPending: () => void;
24
26
  /**
25
27
  * The canvas on screen, every edit drawn, which the host writes as
26
28
  * the file: it stays the editor's, released when the editor goes.
@@ -1,12 +1,19 @@
1
+ import { EditorTool } from './imageEdits';
1
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
3
  /**
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.
4
+ * The image editor in a dialog (spec `chat-image-editor.md`): opens on an
5
+ * image file and gives back the edited copy, same name and type. Open
6
+ * while it is mounted: `close` asks the host to drop it. It keeps open on
7
+ * a click outside and on `Esc`, which would throw the edits away.
7
8
  */
8
9
  type __VLS_Props = {
9
- file: File;
10
+ /**
11
+ * The image: a file of the composer, or one still on its way, such
12
+ * as an image of the conversation the lightbox reads.
13
+ */
14
+ file: File | Promise<File>;
15
+ /** The tool picked on opening, crop if none. */
16
+ initialTool?: EditorTool;
10
17
  };
11
18
  declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
12
19
  close: () => any;
@@ -21,6 +21,51 @@ export interface ImageRect extends ImagePoint, ImageSize {
21
21
  * read back through, or large blocks of its average color, for a face.
22
22
  */
23
23
  export type CoverStyle = 'solid' | 'pixelate';
24
+ /** The colors an annotation is drawn in, the same in both themes. */
25
+ export type AnnotationColor = 'red' | 'yellow' | 'green' | 'blue' | 'white' | 'black';
26
+ /**
27
+ * Each color with the edge drawn around it, which keeps a mark readable on a
28
+ * background of its own color: a red arrow on a red chart, a white text on a
29
+ * white page.
30
+ */
31
+ export declare const ANNOTATION_COLORS: Record<AnnotationColor, {
32
+ fill: string;
33
+ edge: string;
34
+ }>;
35
+ /** The font of a text annotation: the system's, loaded on every page. */
36
+ export declare const ANNOTATION_FONT = "system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
37
+ /** The tools of the editor, each the kind of edit it adds. */
38
+ export type EditorTool = 'crop' | 'cover' | 'arrow' | 'rect' | 'path' | 'text';
39
+ /**
40
+ * A mark drawn over the image. Its line `width` (the font size of a text) is
41
+ * fixed when it is drawn, so a crop afterwards does not thicken it.
42
+ */
43
+ export type AnnotationEdit = {
44
+ kind: 'arrow';
45
+ from: ImagePoint;
46
+ to: ImagePoint;
47
+ color: AnnotationColor;
48
+ width: number;
49
+ } | {
50
+ kind: 'rect';
51
+ rect: ImageRect;
52
+ color: AnnotationColor;
53
+ width: number;
54
+ } | {
55
+ kind: 'path';
56
+ points: ImagePoint[];
57
+ color: AnnotationColor;
58
+ width: number;
59
+ } | {
60
+ kind: 'text';
61
+ /** The top left corner of the first line. */
62
+ at: ImagePoint;
63
+ text: string;
64
+ color: AnnotationColor;
65
+ size: number;
66
+ /** The width its lines wrap in: from `at` to the right edge. */
67
+ maxWidth: number;
68
+ };
24
69
  /**
25
70
  * One change, in the coordinates of the image the edits before it left: a
26
71
  * crop changes the size, a quarter turn swaps the sides.
@@ -37,7 +82,7 @@ export type ImageEdit =
37
82
  kind: 'cover';
38
83
  rect: ImageRect;
39
84
  style: CoverStyle;
40
- };
85
+ } | AnnotationEdit;
41
86
  /**
42
87
  * Safari on iOS refuses a canvas larger than this area: a larger image is
43
88
  * scaled down to fit before it is edited.
@@ -45,6 +90,8 @@ export type ImageEdit =
45
90
  export declare const MAX_CANVAS_AREA: number;
46
91
  /** The quality of a JPEG or WebP written back. */
47
92
  export declare const EXPORT_QUALITY = 0.92;
93
+ /** The lines of a text, in font sizes: the field the text is typed in too. */
94
+ export declare const TEXT_LINE_HEIGHT = 1.2;
48
95
  /**
49
96
  * The size an image is edited at: its own, or the largest with the same
50
97
  * proportions whose area fits `maxArea`.
@@ -54,6 +101,27 @@ export declare function fitToArea(size: ImageSize, maxArea?: number): ImageSize;
54
101
  export declare function sizeAfterEdits(size: ImageSize, edits: readonly ImageEdit[]): ImageSize;
55
102
  /** The side of a block of a pixelated cover on an image of `size`. */
56
103
  export declare function pixelBlock(size: ImageSize): number;
104
+ /** The line width of an arrow, a rectangle or a stroke on an image of `size`. */
105
+ export declare function strokeWidth(size: ImageSize): number;
106
+ /** The font size of a text on an image of `size`. */
107
+ export declare function textSize(size: ImageSize): number;
108
+ /** The edge on each side of a line `width` wide. */
109
+ export declare function edgeWidth(width: number): number;
110
+ /**
111
+ * The lines a text takes in `maxWidth`, broken between words as the field
112
+ * it is typed in breaks them, and a word longer than a line where it meets
113
+ * the edge. `measure` gives the width of a string in the text's font.
114
+ */
115
+ export declare function wrapText(text: string, maxWidth: number, measure: (part: string) => number): string[];
116
+ /**
117
+ * An arrow from `from` to its tip `to`: the line stops where the head
118
+ * starts, so its round end does not show past the tip. On a short arrow the
119
+ * head shrinks to stay an arrow and not a triangle.
120
+ */
121
+ export declare function arrowShape(from: ImagePoint, to: ImagePoint, width: number): {
122
+ lineEnd: ImagePoint;
123
+ head: [ImagePoint, ImagePoint, ImagePoint];
124
+ };
57
125
  /**
58
126
  * The rectangle a drag from `from` to `to` draws, in any direction, inside
59
127
  * `bounds`. With an `aspect` (width over height) the longer side of the drag
@@ -93,6 +161,12 @@ export declare function loadEditableImage(file: Blob): Promise<LoadedImage>;
93
161
  * draws the next one.
94
162
  */
95
163
  export declare function renderEdits(image: HTMLCanvasElement, edits: readonly ImageEdit[]): HTMLCanvasElement;
164
+ /**
165
+ * Draws an annotation in the coordinates `g` is set to: the edited image's
166
+ * on a copy of it, the screen's scaled to the image while it is drawn. The
167
+ * edge goes first, all of it, then the color over it.
168
+ */
169
+ export declare function drawAnnotation(g: CanvasRenderingContext2D, edit: AnnotationEdit): void;
96
170
  /**
97
171
  * Writes the canvas as a file of `type`, or as a PNG where the browser
98
172
  * cannot write that type. A canvas writes no metadata: the EXIF of a photo,
@@ -104,3 +178,5 @@ export declare function exportCanvas(canvas: HTMLCanvasElement, type: string): P
104
178
  * until it is collected, and refuses new ones past its total.
105
179
  */
106
180
  export declare function releaseCanvas(canvas: HTMLCanvasElement): void;
181
+ /** `point`, moved inside an image of `size` when it is past an edge. */
182
+ export declare function pointIn(point: ImagePoint, size: ImageSize): ImagePoint;
@@ -5,6 +5,21 @@ export interface SharedLightbox {
5
5
  /** An item joined: the first one starts the lightbox. */
6
6
  join: () => void;
7
7
  }
8
+ /**
9
+ * "Annota e chiedi" (spec `chat-image-editor.md`, F3): a conversation with a
10
+ * composer takes an annotated copy of one of its images as an attachment.
11
+ */
12
+ export interface ImageAnnotation {
13
+ /** The composer takes an image now: it is shown, uploads on, not full. */
14
+ available: () => boolean;
15
+ /** Opens the editor on the image, whose bytes arrive in `file`. */
16
+ annotate: (file: Promise<File>) => void;
17
+ }
18
+ /**
19
+ * Gives the lightboxes inside the "Annota e chiedi" button: only the chat
20
+ * with a composer calls it, so a log of conversations shows none.
21
+ */
22
+ export declare function provideImageAnnotation(annotation: ImageAnnotation): void;
8
23
  export interface LightboxImage {
9
24
  url: string;
10
25
  caption?: string;
@@ -83,3 +98,14 @@ export interface UseImageSizesReturn {
83
98
  * otherwise the image is loaded in the background to read `naturalWidth`/`naturalHeight`.
84
99
  */
85
100
  export declare function useImageSizes(): UseImageSizesReturn;
101
+ /**
102
+ * Where the editor may read the bytes of a slide: one a page may read
103
+ * (`readableImageUrl`) that the canvas decodes, so not an inline drawing,
104
+ * such as the SVG of a diagram.
105
+ */
106
+ export declare function annotatableImageUrl(url: string): string | undefined;
107
+ /**
108
+ * The name of the copy of an image: its caption when that is a file name,
109
+ * as an attachment's is, else `image` with the extension of its type.
110
+ */
111
+ export declare function imageFileName(caption: string | undefined, type: string): string;