eddyter 1.3.72 → 1.3.74

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,6 +1,6 @@
1
- import { jsxs as B, jsx as p } from "react/jsx-runtime";
1
+ import { jsxs as B, jsx as m } from "react/jsx-runtime";
2
2
  import { calculateZoomLevel as C } from "@lexical/utils";
3
- import { useRef as P } from "react";
3
+ import { useRef as w } from "react";
4
4
  function $(f, x, z) {
5
5
  return Math.min(Math.max(f, x), z);
6
6
  }
@@ -10,7 +10,7 @@ const r = {
10
10
  south: 2,
11
11
  west: 4
12
12
  };
13
- function Z({
13
+ function F({
14
14
  onResizeStart: f,
15
15
  onResizeEnd: x,
16
16
  buttonRef: z,
@@ -19,12 +19,12 @@ function Z({
19
19
  editor: H,
20
20
  showCaption: R,
21
21
  setShowCaption: X,
22
- captionsEnabled: L
22
+ captionsEnabled: I
23
23
  }) {
24
- const W = P(null), g = P({
24
+ const W = w(null), g = w({
25
25
  priority: "",
26
26
  value: "default"
27
- }), b = P({
27
+ }), b = w({
28
28
  currentHeight: 0,
29
29
  currentWidth: 0,
30
30
  direction: 0,
@@ -34,9 +34,9 @@ function Z({
34
34
  startWidth: 0,
35
35
  startX: 0,
36
36
  startY: 0
37
- }), w = P({ imageWrapper: null, editorImageSpan: null, parentParagraph: null }), m = H.getRootElement(), c = m !== null ? m.getBoundingClientRect().width - 20 : 100, I = m !== null ? m.getBoundingClientRect().height - 20 : 100, D = 100, M = 100, S = (t) => {
38
- const i = t === r.east || t === r.west, e = t === r.north || t === r.south, d = t & r.north && t & r.west || t & r.south && t & r.east, l = i ? "ew" : e ? "ns" : d ? "nwse" : "nesw";
39
- m !== null && m.style.setProperty(
37
+ }), P = w({ imageWrapper: null, editorImageSpan: null, parentParagraph: null }), u = H.getRootElement(), c = u !== null ? u.getBoundingClientRect().width - 20 : 100, L = u !== null ? u.getBoundingClientRect().height - 20 : 100, D = 100, S = 100, M = (t) => {
38
+ const i = t === r.east || t === r.west, e = t === r.north || t === r.south, h = t & r.north && t & r.west || t & r.south && t & r.east, l = i ? "ew" : e ? "ns" : h ? "nwse" : "nesw";
39
+ u !== null && u.style.setProperty(
40
40
  "cursor",
41
41
  `${l}-resize`,
42
42
  "important"
@@ -54,27 +54,27 @@ function Z({
54
54
  "important"
55
55
  ));
56
56
  }, Y = () => {
57
- m !== null && m.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
57
+ u !== null && u.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
58
58
  "-webkit-user-select",
59
59
  g.current.value,
60
60
  g.current.priority
61
61
  ));
62
- }, u = (t, i) => {
62
+ }, d = (t, i) => {
63
63
  if (!H.isEditable())
64
64
  return;
65
- const e = v.current, d = W.current;
66
- if (e !== null && d !== null) {
65
+ const e = v.current, h = W.current;
66
+ if (e !== null && h !== null) {
67
67
  t.preventDefault();
68
- const { width: l, height: o } = e.getBoundingClientRect(), y = C(e), s = b.current;
69
- s.startWidth = l, s.startHeight = o, s.ratio = l / o, s.currentWidth = l, s.currentHeight = o, s.startX = t.clientX / y, s.startY = t.clientY / y, s.isResizing = !0, s.direction = i, S(i), f(), d.classList.add("image-control-wrapper--resizing"), e.style.setProperty(
68
+ const { width: l, height: s } = e.getBoundingClientRect(), p = C(e), o = b.current;
69
+ o.startWidth = l, o.startHeight = s, o.ratio = l / s, o.currentWidth = l, o.currentHeight = s, o.startX = t.clientX / p, o.startY = t.clientY / p, o.isResizing = !0, o.direction = i, M(i), f(), h.classList.add("image-control-wrapper--resizing"), e.style.setProperty(
70
70
  "max-width",
71
71
  `${c}px`,
72
72
  "important"
73
73
  );
74
- const h = e.parentElement, n = e.closest(
74
+ const y = e.parentElement, n = e.closest(
75
75
  ".editor-image"
76
76
  ), a = n?.parentElement ?? null;
77
- w.current = { imageWrapper: h, editorImageSpan: n, parentParagraph: a }, h && (h.style.setProperty("display", "inline-block", "important"), h.style.setProperty("width", "auto", "important"), h.style.setProperty(
77
+ P.current = { imageWrapper: y, editorImageSpan: n, parentParagraph: a }, y && (y.style.setProperty("display", "inline-block", "important"), y.style.setProperty("width", "auto", "important"), y.style.setProperty(
78
78
  "max-width",
79
79
  `${c}px`,
80
80
  "important"
@@ -86,30 +86,30 @@ function Z({
86
86
  "max-width",
87
87
  `${c}px`,
88
88
  "important"
89
- ), e.style.setProperty("height", `${o}px`, "important"), e.style.setProperty("width", `${l}px`, "important"), document.addEventListener("pointermove", E), document.addEventListener("pointerup", k);
89
+ ), e.style.setProperty("height", `${s}px`, "important"), e.style.setProperty("width", `${l}px`, "important"), document.addEventListener("pointermove", E), document.addEventListener("pointerup", k);
90
90
  }
91
91
  }, E = (t) => {
92
- const i = v.current, e = b.current, d = e.direction & (r.east | r.west), l = e.direction & (r.south | r.north);
92
+ const i = v.current, e = b.current, h = e.direction & (r.east | r.west), l = e.direction & (r.south | r.north);
93
93
  if (i !== null && e.isResizing) {
94
- const o = C(i), { imageWrapper: y, editorImageSpan: s, parentParagraph: h } = w.current;
94
+ const s = C(i), { imageWrapper: p, editorImageSpan: o, parentParagraph: y } = P.current;
95
95
  if (i.style.setProperty(
96
96
  "max-width",
97
97
  `${c}px`,
98
98
  "important"
99
- ), y && (y.style.setProperty("display", "inline-block", "important"), y.style.setProperty("width", "auto", "important"), y.style.setProperty(
99
+ ), p && (p.style.setProperty("display", "inline-block", "important"), p.style.setProperty("width", "auto", "important"), p.style.setProperty(
100
100
  "max-width",
101
101
  `${c}px`,
102
102
  "important"
103
- )), s && (s.style.setProperty("display", "inline-block", "important"), s.style.setProperty(
103
+ )), o && (o.style.setProperty("display", "inline-block", "important"), o.style.setProperty(
104
104
  "max-width",
105
105
  `${c}px`,
106
106
  "important"
107
- )), h && h.style.setProperty(
107
+ )), y && y.style.setProperty(
108
108
  "max-width",
109
109
  `${c}px`,
110
110
  "important"
111
- ), d && l) {
112
- let n = Math.floor(e.startX - t.clientX / o);
111
+ ), h && l) {
112
+ let n = Math.floor(e.startX - t.clientX / s);
113
113
  n = e.direction & r.east ? -n : n;
114
114
  const a = $(
115
115
  e.startWidth + n,
@@ -118,16 +118,16 @@ function Z({
118
118
  ), N = a / e.ratio;
119
119
  i.style.setProperty("width", `${a}px`, "important"), i.style.setProperty("height", `${N}px`, "important"), e.currentHeight = N, e.currentWidth = a;
120
120
  } else if (l) {
121
- let n = Math.floor(e.startY - t.clientY / o);
121
+ let n = Math.floor(e.startY - t.clientY / s);
122
122
  n = e.direction & r.south ? -n : n;
123
123
  const a = $(
124
124
  e.startHeight + n,
125
- M,
126
- I
125
+ S,
126
+ L
127
127
  );
128
128
  i.style.setProperty("height", `${a}px`, "important"), e.currentHeight = a;
129
129
  } else {
130
- let n = Math.floor(e.startX - t.clientX / o);
130
+ let n = Math.floor(e.startX - t.clientX / s);
131
131
  n = e.direction & r.east ? -n : n;
132
132
  const a = $(
133
133
  e.startWidth + n,
@@ -140,14 +140,20 @@ function Z({
140
140
  }, k = () => {
141
141
  const t = v.current, i = b.current, e = W.current;
142
142
  if (t !== null && e !== null && i.isResizing) {
143
- const d = i.currentWidth, l = i.currentHeight;
143
+ const h = i.currentWidth, l = i.currentHeight;
144
144
  i.startWidth = 0, i.startHeight = 0, i.ratio = 0, i.startX = 0, i.startY = 0, i.currentWidth = 0, i.currentHeight = 0, i.isResizing = !1, e.classList.remove("image-control-wrapper--resizing");
145
- const { imageWrapper: o } = w.current;
146
- o && (o.style.removeProperty("display"), o.style.removeProperty("width"), o.style.removeProperty("max-width")), w.current = { imageWrapper: null, editorImageSpan: null, parentParagraph: null }, Y(), x(d, l), document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", k);
145
+ const { imageWrapper: s, editorImageSpan: p, parentParagraph: o } = P.current;
146
+ s && (s.style.removeProperty("display"), s.style.removeProperty("width"), s.style.removeProperty("max-width")), Y(), x(h, l), requestAnimationFrame(() => {
147
+ t.style.removeProperty("max-width"), p && (p.style.removeProperty("display"), p.style.removeProperty("max-width")), o && o.style.removeProperty("max-width");
148
+ }), P.current = {
149
+ imageWrapper: null,
150
+ editorImageSpan: null,
151
+ parentParagraph: null
152
+ }, document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", k);
147
153
  }
148
154
  };
149
155
  return /* @__PURE__ */ B("div", { ref: W, children: [
150
- !R && L && /* @__PURE__ */ p(
156
+ !R && I && /* @__PURE__ */ m(
151
157
  "button",
152
158
  {
153
159
  className: "image-caption-button",
@@ -158,80 +164,80 @@ function Z({
158
164
  children: "Add Caption"
159
165
  }
160
166
  ),
161
- /* @__PURE__ */ p(
167
+ /* @__PURE__ */ m(
162
168
  "div",
163
169
  {
164
170
  className: "image-resizer image-resizer-n",
165
171
  onPointerDown: (t) => {
166
- u(t, r.north);
172
+ d(t, r.north);
167
173
  }
168
174
  }
169
175
  ),
170
- /* @__PURE__ */ p(
176
+ /* @__PURE__ */ m(
171
177
  "div",
172
178
  {
173
179
  className: "image-resizer image-resizer-ne",
174
180
  onPointerDown: (t) => {
175
- u(t, r.north | r.east);
181
+ d(t, r.north | r.east);
176
182
  }
177
183
  }
178
184
  ),
179
- /* @__PURE__ */ p(
185
+ /* @__PURE__ */ m(
180
186
  "div",
181
187
  {
182
188
  className: "image-resizer image-resizer-e",
183
189
  onPointerDown: (t) => {
184
- u(t, r.east);
190
+ d(t, r.east);
185
191
  }
186
192
  }
187
193
  ),
188
- /* @__PURE__ */ p(
194
+ /* @__PURE__ */ m(
189
195
  "div",
190
196
  {
191
197
  className: "image-resizer image-resizer-se",
192
198
  onPointerDown: (t) => {
193
- u(t, r.south | r.east);
199
+ d(t, r.south | r.east);
194
200
  }
195
201
  }
196
202
  ),
197
- /* @__PURE__ */ p(
203
+ /* @__PURE__ */ m(
198
204
  "div",
199
205
  {
200
206
  className: "image-resizer image-resizer-s",
201
207
  onPointerDown: (t) => {
202
- u(t, r.south);
208
+ d(t, r.south);
203
209
  }
204
210
  }
205
211
  ),
206
- /* @__PURE__ */ p(
212
+ /* @__PURE__ */ m(
207
213
  "div",
208
214
  {
209
215
  className: "image-resizer image-resizer-sw",
210
216
  onPointerDown: (t) => {
211
- u(t, r.south | r.west);
217
+ d(t, r.south | r.west);
212
218
  }
213
219
  }
214
220
  ),
215
- /* @__PURE__ */ p(
221
+ /* @__PURE__ */ m(
216
222
  "div",
217
223
  {
218
224
  className: "image-resizer image-resizer-w",
219
225
  onPointerDown: (t) => {
220
- u(t, r.west);
226
+ d(t, r.west);
221
227
  }
222
228
  }
223
229
  ),
224
- /* @__PURE__ */ p(
230
+ /* @__PURE__ */ m(
225
231
  "div",
226
232
  {
227
233
  className: "image-resizer image-resizer-nw",
228
234
  onPointerDown: (t) => {
229
- u(t, r.north | r.west);
235
+ d(t, r.north | r.west);
230
236
  }
231
237
  }
232
238
  )
233
239
  ] });
234
240
  }
235
241
  export {
236
- Z as I
242
+ F as I
237
243
  };
@@ -1,13 +1,26 @@
1
1
  import { LexicalEditor, RangeSelection } from '../../../node_modules/lexical';
2
2
  export type AIProvider = "chatgpt" | "claude" | "grok" | "gemini" | "deepseek";
3
3
  export type AIStatus = "idle" | "loading" | "success" | "error";
4
+ export type SavedSelection = RangeSelection | {
5
+ anchor: {
6
+ key: string;
7
+ offset: number;
8
+ type: "text" | "element";
9
+ };
10
+ focus: {
11
+ key: string;
12
+ offset: number;
13
+ type: "text" | "element";
14
+ };
15
+ };
4
16
  export interface AIAgentConfig {
5
17
  editor: LexicalEditor;
6
18
  query: string;
7
19
  model: AIProvider;
8
20
  apiKey: string;
9
21
  type?: string;
10
- savedSelection?: RangeSelection | null;
22
+ savedSelection?: SavedSelection | null;
23
+ originalPrompt?: string;
11
24
  onStatusChange?: (status: AIStatus) => void;
12
25
  onLoadingChange?: (isLoading: boolean) => void;
13
26
  onStreamStart?: () => void;
@@ -42,3 +55,11 @@ export declare function processAITransformation(config: AITransformConfig): Prom
42
55
  export declare function processAIRequest(config: AIAgentConfig & {
43
56
  secondaryPrompt?: string;
44
57
  }): Promise<void>;
58
+ /**
59
+ * Fetch the user's last 3 AI prompt history entries.
60
+ */
61
+ export declare function getAIPromptHistory(apiKey: string): Promise<Array<{
62
+ id: string;
63
+ prompt: string;
64
+ createdAt: string;
65
+ }>>;
@@ -22,4 +22,7 @@ export declare const apiEndpoints: {
22
22
  linkPreview: {
23
23
  getPreview: string;
24
24
  };
25
+ promptHistory: {
26
+ list: string;
27
+ };
25
28
  };