@iclips/ui 4.1.0 → 4.1.1

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,32 +1,32 @@
1
- import { jsxs as u, jsx as e, Fragment as D } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as e, Fragment as H } from "react/jsx-runtime";
2
2
  import * as O from "react";
3
- import { useEditor as re, EditorContent as ne } from "@tiptap/react";
4
- import ae from "@tiptap/starter-kit";
5
- import K from "@tiptap/extension-image";
6
- import oe from "@tiptap/extension-placeholder";
7
- import le from "@tiptap/extension-text-align";
8
- import se from "@tiptap/extension-file-handler";
9
- import { TableKit as ce } from "@tiptap/extension-table";
3
+ import { useEditor as te, EditorContent as ie } from "@tiptap/react";
4
+ import re from "@tiptap/starter-kit";
5
+ import Q from "@tiptap/extension-image";
6
+ import ne from "@tiptap/extension-placeholder";
7
+ import ae from "@tiptap/extension-text-align";
8
+ import oe from "@tiptap/extension-file-handler";
9
+ import { TableKit as le } from "@tiptap/extension-table";
10
10
  import { cn as k } from "../utils.js";
11
- import { Button as U } from "../primitives/button.js";
12
- import { Separator as S } from "../primitives/separator.js";
13
- import { Undo as ue, Redo as me, Bold as he, Italic as de, Underline as ge, Strikethrough as fe, List as pe, ListOrdered as be, AlignLeft as Ae, AlignCenter as we, AlignRight as xe, Quote as ve, Link as Me, Table as Ne, Image as j, Minus as ke, Plus as Te } from "lucide-react";
14
- import { Toggle as Le } from "../forms/toggle.js";
15
- import { Select as Ie, SelectTrigger as Ce, SelectValue as Pe, SelectContent as _e, SelectItem as Re } from "../forms/select.js";
16
- import { DropdownMenu as Se, DropdownMenuTrigger as ye, DropdownMenuContent as Ee, DropdownMenuItem as N, DropdownMenuSeparator as W } from "../overlays/dropdown-menu.js";
17
- import { Tooltip as E, TooltipTrigger as z, TooltipContent as H } from "../overlays/tooltip.js";
18
- import { toast as F } from "../feedback/toast.js";
19
- const q = 96 / 2.54, ze = Math.round(5 * q), He = Math.round(2 * q), J = Math.round(1 * q), De = ["image/png", "image/jpeg", "image/webp"], Oe = 2 * 1024 * 1024, Q = 0.1, A = {
11
+ import { Button as F } from "../primitives/button.js";
12
+ import { Separator as R } from "../primitives/separator.js";
13
+ import { Undo as se, Redo as ce, Bold as ue, Italic as me, Underline as he, Strikethrough as de, List as ge, ListOrdered as fe, AlignLeft as pe, AlignCenter as be, AlignRight as Ae, Quote as we, Link as xe, Table as ve, Image as $, Minus as Me, Plus as Ne } from "lucide-react";
14
+ import { Toggle as ke } from "../forms/toggle.js";
15
+ import { Select as Te, SelectTrigger as Le, SelectValue as Ie, SelectContent as Pe, SelectItem as Ce } from "../forms/select.js";
16
+ import { DropdownMenu as _e, DropdownMenuTrigger as Re, DropdownMenuContent as Se, DropdownMenuItem as N, DropdownMenuSeparator as X } from "../overlays/dropdown-menu.js";
17
+ import { Tooltip as y, TooltipTrigger as E, TooltipContent as z } from "../overlays/tooltip.js";
18
+ import { toast as D } from "../feedback/toast.js";
19
+ const U = 96 / 2.54, ye = Math.round(5 * U), Ee = Math.round(2 * U), V = Math.round(1 * U), ze = ["image/png", "image/jpeg", "image/webp"], He = 2 * 1024 * 1024, j = 0.1, A = {
20
20
  larguraPx: 794,
21
21
  alturaMinPx: 1123,
22
22
  margemPx: 40 / 72 * 96
23
- }, b = Math.round(A.larguraPx - 2 * A.margemPx), Fe = `${(11 / 0.75 / A.larguraPx * 100).toFixed(3)}cqw`, Ue = `${((A.alturaMinPx - 2 * A.margemPx) / A.larguraPx * 100).toFixed(3)}cqw`, qe = `${(A.margemPx / A.larguraPx * 100).toFixed(3)}cqw`;
24
- function V(t) {
23
+ }, b = Math.round(A.larguraPx - 2 * A.margemPx), Oe = `${(11 / 0.75 / A.larguraPx * 100).toFixed(3)}cqw`, De = `${((A.alturaMinPx - 2 * A.margemPx) / A.larguraPx * 100).toFixed(3)}cqw`, Fe = `${(A.margemPx / A.larguraPx * 100).toFixed(3)}cqw`;
24
+ function W(t) {
25
25
  if (t == null) return null;
26
26
  const i = Number.parseInt(t, 10);
27
27
  return Number.isFinite(i) && i > 0 ? i : null;
28
28
  }
29
- const Be = ["left", "center", "right"], Ge = K.extend({
29
+ const Ue = ["left", "center", "right"], qe = Q.extend({
30
30
  addAttributes() {
31
31
  var t;
32
32
  return {
@@ -37,13 +37,13 @@ const Be = ["left", "center", "right"], Ge = K.extend({
37
37
  default: null,
38
38
  parseHTML: (i) => {
39
39
  const r = i.getAttribute("data-align");
40
- return Be.includes(r ?? "") && r !== "left" ? r : null;
40
+ return Ue.includes(r ?? "") && r !== "left" ? r : null;
41
41
  },
42
42
  renderHTML: (i) => i.align ? { "data-align": i.align } : {}
43
43
  },
44
44
  width: {
45
45
  default: null,
46
- parseHTML: (i) => V(i.getAttribute("width")),
46
+ parseHTML: (i) => W(i.getAttribute("width")),
47
47
  renderHTML: (i) => {
48
48
  const r = Number(i.width);
49
49
  return !Number.isFinite(r) || r <= 0 ? {} : { width: Math.min(Math.round(r), b) };
@@ -51,7 +51,7 @@ const Be = ["left", "center", "right"], Ge = K.extend({
51
51
  },
52
52
  height: {
53
53
  default: null,
54
- parseHTML: (i) => V(i.getAttribute("height")),
54
+ parseHTML: (i) => W(i.getAttribute("height")),
55
55
  renderHTML: (i) => {
56
56
  const r = Number(i.width), a = Number(i.height);
57
57
  if (!Number.isFinite(a) || a <= 0) return {};
@@ -73,28 +73,28 @@ const Be = ["left", "center", "right"], Ge = K.extend({
73
73
  "mousedown",
74
74
  () => {
75
75
  var l;
76
- const c = (l = a.dom.closest(".ProseMirror")) == null ? void 0 : l.clientWidth;
76
+ const s = (l = a.dom.closest(".ProseMirror")) == null ? void 0 : l.clientWidth;
77
77
  n.maxSize = {
78
78
  ...n.maxSize,
79
- width: c ? Math.min(b, c) : b
79
+ width: s ? Math.min(b, s) : b
80
80
  };
81
81
  },
82
82
  !0
83
83
  ));
84
- const m = (c, l) => {
84
+ const m = (s, l) => {
85
85
  const h = a.dom.querySelector("img");
86
- if (!h || !c || !l) return;
87
- const w = c > b ? b / c : 1;
88
- h.style.width = `${Math.round(c * w)}px`, h.style.height = `${Math.round(l * w)}px`;
86
+ if (!h || !s || !l) return;
87
+ const w = s > b ? b / s : 1;
88
+ h.style.width = `${Math.round(s * w)}px`, h.style.height = `${Math.round(l * w)}px`;
89
89
  }, p = (f = a.update) == null ? void 0 : f.bind(a);
90
- return a.update = (c, ...l) => {
91
- const h = p ? p(c, ...l) : !0;
92
- return h && m(c.attrs.width, c.attrs.height), h;
90
+ return a.update = (s, ...l) => {
91
+ const h = p ? p(s, ...l) : !0;
92
+ return h && m(s.attrs.width, s.attrs.height), h;
93
93
  }, a;
94
94
  } : null;
95
95
  }
96
96
  });
97
- async function $e(t) {
97
+ async function Be(t) {
98
98
  var i;
99
99
  if (typeof createImageBitmap != "function") return null;
100
100
  try {
@@ -104,7 +104,7 @@ async function $e(t) {
104
104
  return null;
105
105
  }
106
106
  }
107
- function Xe(t, i) {
107
+ function Ge(t, i) {
108
108
  const r = t.largura / t.altura, a = Math.min(t.largura, i.width, i.maxHeight * r), n = Math.max(1, Math.round(a));
109
109
  return { width: n, height: Math.max(1, Math.round(n / r)) };
110
110
  }
@@ -117,7 +117,7 @@ const g = ({
117
117
  tooltip: m = !1
118
118
  }) => {
119
119
  const p = /* @__PURE__ */ e(
120
- Le,
120
+ ke,
121
121
  {
122
122
  pressed: i,
123
123
  onPressedChange: t,
@@ -129,38 +129,38 @@ const g = ({
129
129
  children: a
130
130
  }
131
131
  );
132
- return !m || !n ? p : /* @__PURE__ */ u(E, { children: [
133
- /* @__PURE__ */ e(z, { asChild: !0, children: p }),
134
- /* @__PURE__ */ e(H, { children: n })
132
+ return !m || !n ? p : /* @__PURE__ */ u(y, { children: [
133
+ /* @__PURE__ */ e(E, { asChild: !0, children: p }),
134
+ /* @__PURE__ */ e(z, { children: n })
135
135
  ] });
136
- }, y = ({
136
+ }, S = ({
137
137
  onClick: t,
138
138
  disabled: i,
139
139
  label: r,
140
140
  tooltip: a,
141
141
  children: n
142
142
  }) => {
143
- const m = /* @__PURE__ */ e(U, { variant: "ghost", size: "icon", className: "h-8 w-8", onClick: t, disabled: i, "aria-label": r, children: n });
144
- return a ? /* @__PURE__ */ u(E, { children: [
145
- /* @__PURE__ */ e(z, { asChild: !0, children: m }),
146
- /* @__PURE__ */ e(H, { children: r })
143
+ const m = /* @__PURE__ */ e(F, { variant: "ghost", size: "icon", className: "h-8 w-8", onClick: t, disabled: i, "aria-label": r, children: n });
144
+ return a ? /* @__PURE__ */ u(y, { children: [
145
+ /* @__PURE__ */ e(E, { asChild: !0, children: m }),
146
+ /* @__PURE__ */ e(z, { children: r })
147
147
  ] }) : m;
148
- }, je = [
148
+ }, $e = [
149
149
  { valor: "paragraph", rotulo: "Parágrafo" },
150
150
  { valor: "h1", rotulo: "Título 1" },
151
151
  { valor: "h2", rotulo: "Título 2" },
152
152
  { valor: "h3", rotulo: "Título 3" }
153
153
  ];
154
- function We(t) {
154
+ function Xe(t) {
155
155
  for (const i of [1, 2, 3])
156
156
  if (t.isActive("heading", { level: i })) return `h${i}`;
157
157
  return "paragraph";
158
158
  }
159
- function Qe(t, i) {
159
+ function je(t, i) {
160
160
  const r = t.chain().focus();
161
161
  i === "paragraph" ? r.setParagraph().run() : r.setHeading({ level: Number(i.slice(1)) }).run();
162
162
  }
163
- const Ve = ({
163
+ const We = ({
164
164
  editor: t,
165
165
  variant: i,
166
166
  onPickImage: r,
@@ -168,22 +168,22 @@ const Ve = ({
168
168
  }) => {
169
169
  if (!t) return null;
170
170
  const n = i === "full", m = () => {
171
- const o = t.getAttributes("link").href, s = window.prompt("URL", o);
172
- if (s !== null) {
173
- if (s === "") {
171
+ const o = t.getAttributes("link").href, c = window.prompt("URL", o);
172
+ if (c !== null) {
173
+ if (c === "") {
174
174
  t.chain().focus().extendMarkRange("link").unsetLink().run();
175
175
  return;
176
176
  }
177
- t.chain().focus().extendMarkRange("link").setLink({ href: s }).run();
177
+ t.chain().focus().extendMarkRange("link").setLink({ href: c }).run();
178
178
  }
179
179
  }, p = () => {
180
180
  const o = window.prompt("URL da imagem");
181
181
  o && t.chain().focus().setImage({ src: o }).run();
182
- }, f = t.isActive("image"), c = (o) => {
183
- const { width: s, height: v } = t.getAttributes("image");
184
- if (!s || !v) return;
185
- const T = Math.min(b, Math.max(J, Math.round(s * o)));
186
- t.chain().focus().updateAttributes("image", { width: T, height: Math.round(v * T / s) }).run();
182
+ }, f = t.isActive("image"), s = (o) => {
183
+ const { width: c, height: v } = t.getAttributes("image");
184
+ if (!c || !v) return;
185
+ const T = Math.min(b, Math.max(V, Math.round(c * o)));
186
+ t.chain().focus().updateAttributes("image", { width: T, height: Math.round(v * T / c) }).run();
187
187
  }, l = t.isActive("table"), h = (o) => f ? (t.getAttributes("image").align ?? "left") === o : t.isActive({ textAlign: o }), w = (o) => {
188
188
  f ? t.chain().focus().updateAttributes("image", { align: o === "left" ? null : o }).run() : t.chain().focus().setTextAlign(o).run();
189
189
  };
@@ -192,60 +192,60 @@ const Ve = ({
192
192
  n ? "px-4 py-2" : "px-2 py-1"
193
193
  ), children: [
194
194
  /* @__PURE__ */ u("div", { className: "flex items-center gap-0.5 mr-2", children: [
195
- /* @__PURE__ */ e(y, { tooltip: n, label: "Desfazer", onClick: () => t.chain().focus().undo().run(), disabled: !t.can().undo(), children: /* @__PURE__ */ e(ue, { className: "h-4 w-4" }) }),
196
- /* @__PURE__ */ e(y, { tooltip: n, label: "Refazer", onClick: () => t.chain().focus().redo().run(), disabled: !t.can().redo(), children: /* @__PURE__ */ e(me, { className: "h-4 w-4" }) })
195
+ /* @__PURE__ */ e(S, { tooltip: n, label: "Desfazer", onClick: () => t.chain().focus().undo().run(), disabled: !t.can().undo(), children: /* @__PURE__ */ e(se, { className: "h-4 w-4" }) }),
196
+ /* @__PURE__ */ e(S, { tooltip: n, label: "Refazer", onClick: () => t.chain().focus().redo().run(), disabled: !t.can().redo(), children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" }) })
197
197
  ] }),
198
- /* @__PURE__ */ e(S, { orientation: "vertical", className: "h-6 mx-1" }),
199
- n && /* @__PURE__ */ u(D, { children: [
200
- /* @__PURE__ */ u(Ie, { value: We(t), onValueChange: (o) => Qe(t, o), children: [
201
- /* @__PURE__ */ e(Ce, { size: "sm", className: "w-[130px]", "aria-label": "Estilo do texto", children: /* @__PURE__ */ e(Pe, {}) }),
202
- /* @__PURE__ */ e(_e, { children: je.map((o) => /* @__PURE__ */ e(Re, { value: o.valor, children: o.rotulo }, o.valor)) })
198
+ /* @__PURE__ */ e(R, { orientation: "vertical", className: "h-6 mx-1" }),
199
+ n && /* @__PURE__ */ u(H, { children: [
200
+ /* @__PURE__ */ u(Te, { value: Xe(t), onValueChange: (o) => je(t, o), children: [
201
+ /* @__PURE__ */ e(Le, { size: "sm", className: "w-[130px]", "aria-label": "Estilo do texto", children: /* @__PURE__ */ e(Ie, {}) }),
202
+ /* @__PURE__ */ e(Pe, { children: $e.map((o) => /* @__PURE__ */ e(Ce, { value: o.valor, children: o.rotulo }, o.valor)) })
203
203
  ] }),
204
- /* @__PURE__ */ e(S, { orientation: "vertical", className: "h-6 mx-1" })
204
+ /* @__PURE__ */ e(R, { orientation: "vertical", className: "h-6 mx-1" })
205
205
  ] }),
206
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBold().run(), isActive: t.isActive("bold"), title: "Negrito", children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) }),
207
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleItalic().run(), isActive: t.isActive("italic"), title: "Itálico", children: /* @__PURE__ */ e(de, { className: "h-4 w-4" }) }),
208
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleUnderline().run(), isActive: t.isActive("underline"), title: "Sublinhado", children: /* @__PURE__ */ e(ge, { className: "h-4 w-4" }) }),
209
- n && /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => t.chain().focus().toggleStrike().run(), isActive: t.isActive("strike"), title: "Tachado", children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" }) }),
210
- /* @__PURE__ */ e(S, { orientation: "vertical", className: "h-6 mx-1" }),
211
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBulletList().run(), isActive: t.isActive("bulletList"), title: "Lista com marcadores", children: /* @__PURE__ */ e(pe, { className: "h-4 w-4" }) }),
212
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleOrderedList().run(), isActive: t.isActive("orderedList"), title: "Lista numerada", children: /* @__PURE__ */ e(be, { className: "h-4 w-4" }) }),
213
- n && /* @__PURE__ */ u(D, { children: [
214
- /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("left"), isActive: h("left"), title: "Alinhar à esquerda", children: /* @__PURE__ */ e(Ae, { className: "h-4 w-4" }) }),
215
- /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("center"), isActive: h("center"), title: "Centralizar", children: /* @__PURE__ */ e(we, { className: "h-4 w-4" }) }),
216
- /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("right"), isActive: h("right"), title: "Alinhar à direita", children: /* @__PURE__ */ e(xe, { className: "h-4 w-4" }) })
206
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBold().run(), isActive: t.isActive("bold"), title: "Negrito", children: /* @__PURE__ */ e(ue, { className: "h-4 w-4" }) }),
207
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleItalic().run(), isActive: t.isActive("italic"), title: "Itálico", children: /* @__PURE__ */ e(me, { className: "h-4 w-4" }) }),
208
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleUnderline().run(), isActive: t.isActive("underline"), title: "Sublinhado", children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) }),
209
+ n && /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => t.chain().focus().toggleStrike().run(), isActive: t.isActive("strike"), title: "Tachado", children: /* @__PURE__ */ e(de, { className: "h-4 w-4" }) }),
210
+ /* @__PURE__ */ e(R, { orientation: "vertical", className: "h-6 mx-1" }),
211
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBulletList().run(), isActive: t.isActive("bulletList"), title: "Lista com marcadores", children: /* @__PURE__ */ e(ge, { className: "h-4 w-4" }) }),
212
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleOrderedList().run(), isActive: t.isActive("orderedList"), title: "Lista numerada", children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" }) }),
213
+ n && /* @__PURE__ */ u(H, { children: [
214
+ /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("left"), isActive: h("left"), title: "Alinhar à esquerda", children: /* @__PURE__ */ e(pe, { className: "h-4 w-4" }) }),
215
+ /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("center"), isActive: h("center"), title: "Centralizar", children: /* @__PURE__ */ e(be, { className: "h-4 w-4" }) }),
216
+ /* @__PURE__ */ e(g, { tooltip: !0, onClick: () => w("right"), isActive: h("right"), title: "Alinhar à direita", children: /* @__PURE__ */ e(Ae, { className: "h-4 w-4" }) })
217
217
  ] }),
218
- /* @__PURE__ */ e(S, { orientation: "vertical", className: "h-6 mx-1" }),
219
- /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBlockquote().run(), isActive: t.isActive("blockquote"), title: "Citação", children: /* @__PURE__ */ e(ve, { className: "h-4 w-4" }) }),
220
- /* @__PURE__ */ e(g, { tooltip: n, onClick: m, isActive: t.isActive("link"), title: "Link", children: /* @__PURE__ */ e(Me, { className: "h-4 w-4" }) }),
221
- n && /* @__PURE__ */ u(Se, { children: [
222
- /* @__PURE__ */ u(E, { children: [
223
- /* @__PURE__ */ e(z, { asChild: !0, children: /* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(U, { variant: "ghost", size: "icon", className: k("h-8 w-8", l && "bg-secondary text-secondary-foreground"), "aria-label": "Tabela", children: /* @__PURE__ */ e(Ne, { className: "h-4 w-4" }) }) }) }),
224
- /* @__PURE__ */ e(H, { children: "Tabela" })
218
+ /* @__PURE__ */ e(R, { orientation: "vertical", className: "h-6 mx-1" }),
219
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: () => t.chain().focus().toggleBlockquote().run(), isActive: t.isActive("blockquote"), title: "Citação", children: /* @__PURE__ */ e(we, { className: "h-4 w-4" }) }),
220
+ /* @__PURE__ */ e(g, { tooltip: n, onClick: m, isActive: t.isActive("link"), title: "Link", children: /* @__PURE__ */ e(xe, { className: "h-4 w-4" }) }),
221
+ n && /* @__PURE__ */ u(_e, { children: [
222
+ /* @__PURE__ */ u(y, { children: [
223
+ /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "ghost", size: "icon", className: k("h-8 w-8", l && "bg-secondary text-secondary-foreground"), "aria-label": "Tabela", children: /* @__PURE__ */ e(ve, { className: "h-4 w-4" }) }) }) }),
224
+ /* @__PURE__ */ e(z, { children: "Tabela" })
225
225
  ] }),
226
- /* @__PURE__ */ u(Ee, { align: "start", children: [
226
+ /* @__PURE__ */ u(Se, { align: "start", children: [
227
227
  /* @__PURE__ */ e(N, { onSelect: () => t.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run(), children: "Inserir tabela" }),
228
- /* @__PURE__ */ e(W, {}),
228
+ /* @__PURE__ */ e(X, {}),
229
229
  /* @__PURE__ */ e(N, { disabled: !l, onSelect: () => t.chain().focus().addRowAfter().run(), children: "Adicionar linha" }),
230
230
  /* @__PURE__ */ e(N, { disabled: !l, onSelect: () => t.chain().focus().addColumnAfter().run(), children: "Adicionar coluna" }),
231
231
  /* @__PURE__ */ e(N, { disabled: !l, onSelect: () => t.chain().focus().deleteRow().run(), children: "Remover linha" }),
232
232
  /* @__PURE__ */ e(N, { disabled: !l, onSelect: () => t.chain().focus().deleteColumn().run(), children: "Remover coluna" }),
233
- /* @__PURE__ */ e(W, {}),
233
+ /* @__PURE__ */ e(X, {}),
234
234
  /* @__PURE__ */ e(N, { disabled: !l, onSelect: () => t.chain().focus().deleteTable().run(), children: "Remover tabela" })
235
235
  ] })
236
236
  ] }),
237
- n && r && /* @__PURE__ */ u(D, { children: [
238
- /* @__PURE__ */ u(E, { children: [
239
- /* @__PURE__ */ e(z, { asChild: !0, children: /* @__PURE__ */ e(U, { variant: "ghost", size: "icon", className: "h-8 w-8", onClick: r, "aria-label": "Inserir imagem", children: /* @__PURE__ */ e(j, { className: "h-4 w-4" }) }) }),
240
- /* @__PURE__ */ e(H, { className: "max-w-64", children: a ?? "Inserir imagem" })
237
+ n && r && /* @__PURE__ */ u(H, { children: [
238
+ /* @__PURE__ */ u(y, { children: [
239
+ /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "ghost", size: "icon", className: "h-8 w-8", onClick: r, "aria-label": "Inserir imagem", children: /* @__PURE__ */ e($, { className: "h-4 w-4" }) }) }),
240
+ /* @__PURE__ */ e(z, { className: "max-w-64", children: a ?? "Inserir imagem" })
241
241
  ] }),
242
- /* @__PURE__ */ e(y, { tooltip: !0, label: "Diminuir imagem", onClick: () => c(1 - Q), disabled: !f, children: /* @__PURE__ */ e(ke, { className: "h-4 w-4" }) }),
243
- /* @__PURE__ */ e(y, { tooltip: !0, label: "Aumentar imagem", onClick: () => c(1 + Q), disabled: !f, children: /* @__PURE__ */ e(Te, { className: "h-4 w-4" }) })
242
+ /* @__PURE__ */ e(S, { tooltip: !0, label: "Diminuir imagem", onClick: () => s(1 - j), disabled: !f, children: /* @__PURE__ */ e(Me, { className: "h-4 w-4" }) }),
243
+ /* @__PURE__ */ e(S, { tooltip: !0, label: "Aumentar imagem", onClick: () => s(1 + j), disabled: !f, children: /* @__PURE__ */ e(Ne, { className: "h-4 w-4" }) })
244
244
  ] }),
245
- n && !r && /* @__PURE__ */ e(g, { tooltip: !0, onClick: p, title: "Imagem", children: /* @__PURE__ */ e(j, { className: "h-4 w-4" }) })
245
+ n && !r && /* @__PURE__ */ e(g, { tooltip: !0, onClick: p, title: "Imagem", children: /* @__PURE__ */ e($, { className: "h-4 w-4" }) })
246
246
  ] });
247
247
  };
248
- function dt({
248
+ function mt({
249
249
  content: t = "",
250
250
  onChange: i,
251
251
  placeholder: r = "Comece a escrever...",
@@ -254,59 +254,58 @@ function dt({
254
254
  readOnly: m = !1,
255
255
  label: p,
256
256
  onImageUpload: f,
257
- imageDefaults: c,
258
- imageAcceptedTypes: l = De,
259
- imageMaxBytes: h = Oe,
257
+ imageDefaults: s,
258
+ imageAcceptedTypes: l = ze,
259
+ imageMaxBytes: h = He,
260
260
  imageHint: w,
261
261
  page: o
262
262
  }) {
263
- var _, $;
264
- const s = a === "full", v = s && o === "a4", T = c ?? { width: ze, maxHeight: He }, Y = T.width, Z = T.maxHeight, C = s && !!f, P = O.useRef(async () => {
263
+ const c = a === "full", v = c && o === "a4", T = s ?? { width: ye, maxHeight: Ee }, K = T.width, J = T.maxHeight, I = c && !!f, P = O.useRef(async () => {
265
264
  });
266
- P.current = async (d, x, I) => {
265
+ P.current = async (d, x, L) => {
267
266
  if (f)
268
267
  for (const M of x) {
269
268
  if (!l.includes(M.type)) {
270
- F.error("Imagem não inserida", { description: "Use uma imagem PNG, JPG ou WEBP." });
269
+ D.error("Imagem não inserida", { description: "Use uma imagem PNG, JPG ou WEBP." });
271
270
  continue;
272
271
  }
273
272
  if (M.size > h) {
274
- F.error("Imagem não inserida", {
273
+ D.error("Imagem não inserida", {
275
274
  description: `A imagem deve ter no máximo ${Math.round(h / 1024 / 1024)} MB.`
276
275
  });
277
276
  continue;
278
277
  }
279
278
  try {
280
- const [R, X] = await Promise.all([f(M), $e(M)]), ie = X ? Xe(X, { width: Y, maxHeight: Z }) : {};
281
- d.chain().insertContentAt(I ?? d.state.selection.anchor, { type: "image", attrs: { src: R, ...ie } }).focus().run();
282
- } catch (R) {
283
- F.error("Não foi possível inserir a imagem", { description: R instanceof Error ? R.message : void 0 });
279
+ const [_, G] = await Promise.all([f(M), Be(M)]), ee = G ? Ge(G, { width: K, maxHeight: J }) : {};
280
+ d.chain().insertContentAt(L ?? d.state.selection.anchor, { type: "image", attrs: { src: _, ...ee } }).focus().run();
281
+ } catch (_) {
282
+ D.error("Não foi possível inserir a imagem", { description: _ instanceof Error ? _.message : void 0 });
284
283
  }
285
284
  }
286
285
  };
287
- const ee = O.useMemo(() => {
288
- const d = s ? [
289
- Ge.configure({
286
+ const Y = O.useMemo(() => {
287
+ const d = c ? [
288
+ qe.configure({
290
289
  allowBase64: !0,
291
290
  HTMLAttributes: { class: "max-w-full h-auto" },
292
291
  resize: {
293
292
  enabled: !0,
294
293
  directions: ["top-left", "top-right", "bottom-left", "bottom-right"],
295
- minWidth: J,
294
+ minWidth: V,
296
295
  minHeight: 1,
297
296
  alwaysPreserveAspectRatio: !0
298
297
  }
299
298
  }),
300
- ce.configure({ table: { resizable: !0 } })
299
+ le.configure({ table: { resizable: !0 } })
301
300
  ] : [
302
- K.configure({
301
+ Q.configure({
303
302
  HTMLAttributes: {
304
303
  class: "rounded-lg border shadow-sm max-w-full"
305
304
  }
306
305
  })
307
306
  ];
308
307
  return [
309
- ae.configure({
308
+ re.configure({
310
309
  heading: {
311
310
  levels: [1, 2, 3]
312
311
  }
@@ -321,26 +320,26 @@ function dt({
321
320
  // },
322
321
  // }),
323
322
  ...d,
324
- oe.configure({
323
+ ne.configure({
325
324
  placeholder: r
326
325
  }),
327
- le.configure({
326
+ ae.configure({
328
327
  types: ["heading", "paragraph"]
329
328
  }),
330
- ...C ? [
331
- se.configure({
329
+ ...I ? [
330
+ oe.configure({
332
331
  allowedMimeTypes: l,
333
- onDrop: (x, I, M) => {
334
- P.current(x, I, M);
332
+ onDrop: (x, L, M) => {
333
+ P.current(x, L, M);
335
334
  },
336
- onPaste: (x, I) => {
337
- P.current(x, I);
335
+ onPaste: (x, L) => {
336
+ P.current(x, L);
338
337
  }
339
338
  })
340
339
  ] : []
341
340
  ];
342
- }, [r, s, C, l.join(",")]), L = re({
343
- extensions: ee,
341
+ }, [r, c, I, l.join(",")]), C = te({
342
+ extensions: Y,
344
343
  content: t,
345
344
  editable: !m,
346
345
  shouldRerenderOnTransaction: !0,
@@ -356,20 +355,20 @@ function dt({
356
355
  "prose-p:leading-7 prose-p:my-3",
357
356
  "prose-blockquote:border-l-4 prose-blockquote:border-primary/50 prose-blockquote:pl-4 prose-blockquote:italic",
358
357
  "prose-ul:list-disc prose-ul:pl-6 prose-ol:list-decimal prose-ol:pl-6",
359
- !s && "prose-img:rounded-lg prose-img:shadow-md prose-img:my-6",
358
+ !c && "prose-img:rounded-lg prose-img:shadow-md prose-img:my-6",
360
359
  // O contêiner do node view de redimensionamento é um flex: o alinhamento da imagem é dele.
361
- s && "[&_[data-resize-container]:has([data-align=center])]:justify-center [&_[data-resize-container]:has([data-align=right])]:justify-end",
362
- v ? void 0 : s ? "min-h-[400px] p-8" : "min-h-[120px] px-3 py-2"
360
+ c && "[&_[data-resize-container]:has([data-align=center])]:justify-center [&_[data-resize-container]:has([data-align=right])]:justify-end",
361
+ v ? void 0 : c ? "min-h-[400px] p-8" : "min-h-[120px] px-3 py-2"
363
362
  ),
364
- ...v ? { style: `font-size: ${Fe}; min-height: ${Ue}` } : {}
363
+ ...v ? { style: `font-size: ${Oe}; min-height: ${De}` } : {}
365
364
  }
366
365
  }
367
- }), B = O.useRef(null);
368
- if (!L) return null;
369
- const te = C ? () => {
366
+ }), q = O.useRef(null);
367
+ if (!C) return null;
368
+ const Z = I ? () => {
370
369
  var d;
371
- return (d = B.current) == null ? void 0 : d.click();
372
- } : void 0, G = /* @__PURE__ */ e(ne, { editor: L });
370
+ return (d = q.current) == null ? void 0 : d.click();
371
+ } : void 0, B = /* @__PURE__ */ e(ie, { editor: C });
373
372
  return /* @__PURE__ */ u("div", { "data-slot": "document-editor", className: k("flex flex-col w-full", n), children: [
374
373
  p && /* @__PURE__ */ e("label", { className: "text-sm font-medium mb-1.5 block", children: p }),
375
374
  /* @__PURE__ */ u("div", { className: k(
@@ -377,18 +376,18 @@ function dt({
377
376
  "flex flex-col flex-1 min-h-0 border rounded-lg bg-background overflow-hidden transition-shadow focus-within:ring-2 focus-within:ring-primary/20",
378
377
  m && "opacity-80 bg-muted/30 pointer-events-none border-transparent"
379
378
  ), children: [
380
- !m && /* @__PURE__ */ e(Ve, { editor: L, variant: a, onPickImage: te, imageHint: w }),
381
- C && /* @__PURE__ */ e(
379
+ !m && /* @__PURE__ */ e(We, { editor: C, variant: a, onPickImage: Z, imageHint: w }),
380
+ I && /* @__PURE__ */ e(
382
381
  "input",
383
382
  {
384
- ref: B,
383
+ ref: q,
385
384
  type: "file",
386
385
  className: "hidden",
387
386
  accept: l.join(","),
388
387
  "aria-label": "Escolher imagem",
389
388
  onChange: (d) => {
390
389
  const x = Array.from(d.target.files ?? []);
391
- d.target.value = "", x.length > 0 && P.current(L, x);
390
+ d.target.value = "", x.length > 0 && P.current(C, x);
392
391
  }
393
392
  }
394
393
  ),
@@ -400,22 +399,18 @@ function dt({
400
399
  "data-slot": "document-sheet",
401
400
  className: "mx-auto bg-white text-black shadow-md [container-type:inline-size]",
402
401
  style: { width: `min(100%, ${A.larguraPx}px)` },
403
- children: /* @__PURE__ */ e("div", { style: { padding: qe }, className: "[&_img]:max-w-full [&_img]:h-auto", children: G })
402
+ children: /* @__PURE__ */ e("div", { style: { padding: Fe }, className: "[&_img]:max-w-full [&_img]:h-auto", children: B })
404
403
  }
405
404
  ) })
406
405
  ) : /* @__PURE__ */ e("div", { className: k(
407
406
  "bg-background relative",
408
- s ? "bg-card" : ""
409
- ), children: G })
410
- ] }),
411
- !m && s && /* @__PURE__ */ u("div", { className: "text-xs text-muted-foreground mt-1.5 text-right px-1", children: [
412
- (($ = (_ = L.storage.characterCount) == null ? void 0 : _.words) == null ? void 0 : $.call(_)) || 0,
413
- " palavras"
407
+ c ? "bg-card" : ""
408
+ ), children: B })
414
409
  ] })
415
410
  ] });
416
411
  }
417
412
  export {
418
- dt as DocumentEditor,
419
- Xe as tamanhoDeEntrada
413
+ mt as DocumentEditor,
414
+ Ge as tamanhoDeEntrada
420
415
  };
421
416
  //# sourceMappingURL=document-editor.js.map