@windoc/react 0.2.3 → 0.2.5

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.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/Editor.tsx
2
- import { useEffect as useEffect5, useRef as useRef5, useState as useState12 } from "react";
2
+ import { useEffect as useEffect4, useRef as useRef4, useState as useState21 } from "react";
3
3
 
4
4
  // src/EditorContext.tsx
5
5
  import { createContext, useContext, useEffect, useState } from "react";
@@ -100,60 +100,13 @@ function RedoTool() {
100
100
  }
101
101
 
102
102
  // src/toolbar/ColumnTool.tsx
103
- import { useState as useState4 } from "react";
104
-
105
- // src/utils/useDropdown.ts
106
- import { useState as useState3, useRef, useEffect as useEffect2 } from "react";
107
- function useDropdown() {
108
- const [isOpen, setIsOpen] = useState3(false);
109
- const [position, setPosition] = useState3({ top: 0, left: 0 });
110
- const triggerRef = useRef(null);
111
- const open = () => {
112
- if (triggerRef.current) {
113
- const rect = triggerRef.current.getBoundingClientRect();
114
- setPosition({ top: rect.bottom + 2, left: rect.left });
115
- }
116
- setIsOpen(true);
117
- };
118
- const close = () => setIsOpen(false);
119
- const toggle = () => isOpen ? close() : open();
120
- const portalStyle = {
121
- position: "fixed",
122
- top: position.top,
123
- left: position.left,
124
- zIndex: 9999
125
- };
126
- useEffect2(() => {
127
- if (!isOpen) return;
128
- const handler = (e) => {
129
- if (triggerRef.current && !triggerRef.current.contains(e.target)) {
130
- close();
131
- }
132
- };
133
- document.addEventListener("mousedown", handler);
134
- return () => document.removeEventListener("mousedown", handler);
135
- }, [isOpen]);
136
- return { triggerRef, isOpen, toggle, open, close, portalStyle };
137
- }
138
-
139
- // src/utils/DropdownPortal.tsx
140
- import { createPortal } from "react-dom";
141
- import { jsx as jsx5 } from "react/jsx-runtime";
142
- function DropdownPortal({ isOpen, style, className, wrapperClassName, children }) {
143
- if (!isOpen) return null;
144
- return createPortal(
145
- /* @__PURE__ */ jsx5("div", { className: `menu-item menu-item-portal${wrapperClassName ? ` ${wrapperClassName}` : ""}`, style, children: /* @__PURE__ */ jsx5("div", { className, children }) }),
146
- document.body
147
- );
148
- }
149
-
150
- // src/toolbar/ColumnTool.tsx
151
- import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
103
+ import { useState as useState3 } from "react";
104
+ import { Fragment, jsx as jsx5, jsxs } from "react/jsx-runtime";
152
105
  function ColumnTool() {
153
106
  const { editorRef } = useEditor();
154
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
155
- const [currentColumns, setCurrentColumns] = useState4(1);
156
- const [gap, setGap] = useState4(20);
107
+ const [isOpen, setIsOpen] = useState3(false);
108
+ const [currentColumns, setCurrentColumns] = useState3(1);
109
+ const [gap, setGap] = useState3(20);
157
110
  const handleColumn = (col) => {
158
111
  editorRef.current?.command.executeColumnCount(col);
159
112
  setCurrentColumns(col);
@@ -163,18 +116,18 @@ function ColumnTool() {
163
116
  setGap(clampedValue);
164
117
  editorRef.current?.command.executeColumnGap(clampedValue);
165
118
  };
166
- return /* @__PURE__ */ jsxs("div", { className: "menu-item__column", ref: triggerRef, onClick: toggle, children: [
167
- /* @__PURE__ */ jsx6("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
168
- /* @__PURE__ */ jsx6(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__column", children: /* @__PURE__ */ jsxs("div", { onClick: (e) => e.stopPropagation(), children: [
119
+ return /* @__PURE__ */ jsxs("div", { className: "menu-item__column", onClick: () => setIsOpen(!isOpen), children: [
120
+ /* @__PURE__ */ jsx5("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
121
+ /* @__PURE__ */ jsx5("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsxs("div", { onClick: (e) => e.stopPropagation(), children: [
169
122
  /* @__PURE__ */ jsxs("ul", { children: [
170
- /* @__PURE__ */ jsx6("li", { onClick: () => handleColumn(1), children: "1 Column" }),
171
- /* @__PURE__ */ jsx6("li", { onClick: () => handleColumn(2), children: "2 Columns" })
123
+ /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(1), children: "1 Column" }),
124
+ /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(2), children: "2 Columns" })
172
125
  ] }),
173
126
  currentColumns > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
174
- /* @__PURE__ */ jsx6("div", { className: "option-divider" }),
127
+ /* @__PURE__ */ jsx5("div", { className: "option-divider" }),
175
128
  /* @__PURE__ */ jsxs("div", { className: "option-row", children: [
176
- /* @__PURE__ */ jsx6("label", { children: "Gap (px)" }),
177
- /* @__PURE__ */ jsx6(
129
+ /* @__PURE__ */ jsx5("label", { children: "Gap (px)" }),
130
+ /* @__PURE__ */ jsx5(
178
131
  "input",
179
132
  {
180
133
  type: "number",
@@ -192,16 +145,16 @@ function ColumnTool() {
192
145
  }
193
146
 
194
147
  // src/toolbar/TableTool.tsx
195
- import { useState as useState5, useEffect as useEffect3, useRef as useRef2 } from "react";
148
+ import { useState as useState4, useEffect as useEffect2, useRef } from "react";
196
149
  import { Table } from "lucide-react";
197
- import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
150
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
198
151
  function TableTool() {
199
152
  const { editorRef } = useEditor();
200
- const [visible, setVisible] = useState5(false);
201
- const [hoverRow, setHoverRow] = useState5(0);
202
- const [hoverCol, setHoverCol] = useState5(0);
203
- const containerRef = useRef2(null);
204
- useEffect3(() => {
153
+ const [visible, setVisible] = useState4(false);
154
+ const [hoverRow, setHoverRow] = useState4(0);
155
+ const [hoverCol, setHoverCol] = useState4(0);
156
+ const containerRef = useRef(null);
157
+ useEffect2(() => {
205
158
  if (!visible) return;
206
159
  const handleClickOutside = (e) => {
207
160
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -222,10 +175,10 @@ function TableTool() {
222
175
  setHoverCol(0);
223
176
  };
224
177
  return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "menu-item__table", title: "Table", children: [
225
- /* @__PURE__ */ jsx7(Table, { size: 16, onClick: () => setVisible(!visible), style: { cursor: "pointer" } }),
178
+ /* @__PURE__ */ jsx6(Table, { size: 16, onClick: () => setVisible(!visible), style: { cursor: "pointer" } }),
226
179
  visible && /* @__PURE__ */ jsxs2("div", { className: "table-dropdown", children: [
227
- /* @__PURE__ */ jsx7("div", { className: "table-dropdown-header", children: /* @__PURE__ */ jsx7("span", { children: hoverRow > 0 ? `${hoverRow} \xD7 ${hoverCol}` : "Insert Table" }) }),
228
- /* @__PURE__ */ jsx7("div", { className: "table-dropdown-grid", onClick: handleInsertTable, children: Array.from({ length: 8 }).map((_, rowIdx) => /* @__PURE__ */ jsx7("div", { className: "table-dropdown-row", children: Array.from({ length: 8 }).map((_2, colIdx) => /* @__PURE__ */ jsx7(
180
+ /* @__PURE__ */ jsx6("div", { className: "table-dropdown-header", children: /* @__PURE__ */ jsx6("span", { children: hoverRow > 0 ? `${hoverRow} \xD7 ${hoverCol}` : "Insert Table" }) }),
181
+ /* @__PURE__ */ jsx6("div", { className: "table-dropdown-grid", onClick: handleInsertTable, children: Array.from({ length: 8 }).map((_, rowIdx) => /* @__PURE__ */ jsx6("div", { className: "table-dropdown-row", children: Array.from({ length: 8 }).map((_2, colIdx) => /* @__PURE__ */ jsx6(
229
182
  "div",
230
183
  {
231
184
  className: `table-dropdown-cell ${rowIdx < hoverRow && colIdx < hoverCol ? "active" : ""}`,
@@ -241,7 +194,8 @@ function TableTool() {
241
194
  }
242
195
 
243
196
  // src/toolbar/TitleTool.tsx
244
- import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
197
+ import { useState as useState5 } from "react";
198
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
245
199
  var LEVELS = [
246
200
  { level: null, label: "Body" },
247
201
  { level: "first", label: "Heading 1" },
@@ -253,15 +207,15 @@ var LEVELS = [
253
207
  ];
254
208
  function TitleTool() {
255
209
  const { editorRef, rangeStyle } = useEditor();
256
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
210
+ const [isOpen, setIsOpen] = useState5(false);
257
211
  const activeLevel = rangeStyle?.level || null;
258
212
  const activeLabel = LEVELS.find((l) => l.level === activeLevel)?.label || "Body";
259
213
  const handleTitle = (level) => {
260
214
  editorRef.current?.command.executeTitle(level);
261
215
  };
262
- return /* @__PURE__ */ jsxs3("div", { className: "menu-item__title", ref: triggerRef, onClick: toggle, children: [
263
- /* @__PURE__ */ jsx8("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
264
- /* @__PURE__ */ jsx8(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__title", children: /* @__PURE__ */ jsx8("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ jsx8(
216
+ return /* @__PURE__ */ jsxs3("div", { className: "menu-item__title", onClick: () => setIsOpen(!isOpen), children: [
217
+ /* @__PURE__ */ jsx7("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
218
+ /* @__PURE__ */ jsx7("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx7("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ jsx7(
265
219
  "li",
266
220
  {
267
221
  className: activeLevel === level ? "active" : "",
@@ -275,22 +229,23 @@ function TitleTool() {
275
229
  }
276
230
 
277
231
  // src/toolbar/FontTool.tsx
278
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
232
+ import { useState as useState6 } from "react";
233
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
279
234
  var FONTS = [
280
235
  { family: "Arial", label: "Sans Serif" },
281
236
  { family: "Times New Roman", label: "Serif" }
282
237
  ];
283
238
  function FontTool() {
284
239
  const { editorRef, rangeStyle } = useEditor();
285
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
240
+ const [isOpen, setIsOpen] = useState6(false);
286
241
  const activeFont = rangeStyle?.font || "Arial";
287
242
  const activeLabel = FONTS.find((f) => f.family === activeFont)?.label || activeFont;
288
243
  const handleFont = (family) => {
289
244
  editorRef.current?.command.executeFont(family);
290
245
  };
291
- return /* @__PURE__ */ jsxs4("div", { className: "menu-item__font", ref: triggerRef, onClick: toggle, children: [
292
- /* @__PURE__ */ jsx9("span", { className: "select", title: "Font", children: activeLabel }),
293
- /* @__PURE__ */ jsx9(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__font", children: /* @__PURE__ */ jsx9("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ jsx9(
246
+ return /* @__PURE__ */ jsxs4("div", { className: "menu-item__font", onClick: () => setIsOpen(!isOpen), children: [
247
+ /* @__PURE__ */ jsx8("span", { className: "select", title: "Font", children: activeLabel }),
248
+ /* @__PURE__ */ jsx8("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx8("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ jsx8(
294
249
  "li",
295
250
  {
296
251
  "data-family": family,
@@ -305,18 +260,19 @@ function FontTool() {
305
260
  }
306
261
 
307
262
  // src/toolbar/FontSizeTool.tsx
308
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
263
+ import { useState as useState7 } from "react";
264
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
309
265
  var SIZES = [56, 48, 34, 32, 29, 24, 21, 20, 18, 16, 14, 12, 10, 8];
310
266
  function FontSizeTool() {
311
267
  const { editorRef, rangeStyle } = useEditor();
312
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
268
+ const [isOpen, setIsOpen] = useState7(false);
313
269
  const activeSize = rangeStyle?.size ?? 16;
314
270
  const handleSize = (size) => {
315
271
  editorRef.current?.command.executeSize(size);
316
272
  };
317
- return /* @__PURE__ */ jsxs5("div", { className: "menu-item__size", ref: triggerRef, onClick: toggle, children: [
318
- /* @__PURE__ */ jsx10("span", { className: "select", title: "Font Size", children: activeSize }),
319
- /* @__PURE__ */ jsx10(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__size", children: /* @__PURE__ */ jsx10("ul", { children: SIZES.map((size) => /* @__PURE__ */ jsx10(
273
+ return /* @__PURE__ */ jsxs5("div", { className: "menu-item__size", onClick: () => setIsOpen(!isOpen), children: [
274
+ /* @__PURE__ */ jsx9("span", { className: "select", title: "Font Size", children: activeSize }),
275
+ /* @__PURE__ */ jsx9("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx9("ul", { children: SIZES.map((size) => /* @__PURE__ */ jsx9(
320
276
  "li",
321
277
  {
322
278
  className: activeSize === size ? "active" : "",
@@ -329,19 +285,20 @@ function FontSizeTool() {
329
285
  }
330
286
 
331
287
  // src/toolbar/LineHeightTool.tsx
332
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
288
+ import { useState as useState8 } from "react";
289
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
333
290
  var LINE_HEIGHTS = ["1.0", "1.15", "1.5", "2.0", "2.5"];
334
291
  function LineHeightTool() {
335
292
  const { editorRef, rangeStyle } = useEditor();
336
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
293
+ const [isOpen, setIsOpen] = useState8(false);
337
294
  const activeMargin = rangeStyle?.rowMargin ?? 1;
338
295
  const activeLabel = Number.isInteger(activeMargin) ? `${activeMargin}.0` : String(activeMargin);
339
296
  const handleLineHeight = (value) => {
340
297
  editorRef.current?.command.executeRowMargin(Number(value));
341
298
  };
342
- return /* @__PURE__ */ jsxs6("div", { className: "menu-item__line-height", ref: triggerRef, onClick: toggle, children: [
343
- /* @__PURE__ */ jsx11("span", { className: "select", title: "Line Height", children: activeLabel }),
344
- /* @__PURE__ */ jsx11(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__line-height", children: /* @__PURE__ */ jsx11("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ jsx11(
299
+ return /* @__PURE__ */ jsxs6("div", { className: "menu-item__line-height", onClick: () => setIsOpen(!isOpen), children: [
300
+ /* @__PURE__ */ jsx10("span", { className: "select", title: "Line Height", children: activeLabel }),
301
+ /* @__PURE__ */ jsx10("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx10("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ jsx10(
345
302
  "li",
346
303
  {
347
304
  className: String(activeMargin) === h || activeLabel === h ? "active" : "",
@@ -354,8 +311,9 @@ function LineHeightTool() {
354
311
  }
355
312
 
356
313
  // src/toolbar/ColorTool.tsx
314
+ import { useState as useState9 } from "react";
357
315
  import { Baseline, RotateCcw } from "lucide-react";
358
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
316
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
359
317
  var COLOR_PALETTE = [
360
318
  ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
361
319
  ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
@@ -368,7 +326,7 @@ var COLOR_PALETTE = [
368
326
  ];
369
327
  function ColorTool() {
370
328
  const { editorRef, rangeStyle } = useEditor();
371
- const { triggerRef, isOpen: visible, toggle, portalStyle } = useDropdown();
329
+ const [visible, setVisible] = useState9(false);
372
330
  const activeColor = rangeStyle?.color || "#000000";
373
331
  const handleColor = (color) => {
374
332
  editorRef.current?.command.executeColor(color);
@@ -376,16 +334,16 @@ function ColorTool() {
376
334
  const handleReset = () => {
377
335
  editorRef.current?.command.executeColor(null);
378
336
  };
379
- return /* @__PURE__ */ jsxs7("div", { className: "menu-item__color", ref: triggerRef, title: "Font Color", onClick: toggle, children: [
380
- /* @__PURE__ */ jsx12(Baseline, { size: 16 }),
381
- /* @__PURE__ */ jsx12("span", { style: { backgroundColor: activeColor } }),
382
- /* @__PURE__ */ jsx12("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
383
- /* @__PURE__ */ jsx12(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", wrapperClassName: "menu-item__color", children: /* @__PURE__ */ jsxs7("div", { onClick: (e) => e.stopPropagation(), children: [
337
+ return /* @__PURE__ */ jsxs7("div", { className: "menu-item__color", title: "Font Color", onClick: () => setVisible(!visible), children: [
338
+ /* @__PURE__ */ jsx11(Baseline, { size: 16 }),
339
+ /* @__PURE__ */ jsx11("span", { style: { backgroundColor: activeColor } }),
340
+ /* @__PURE__ */ jsx11("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
341
+ /* @__PURE__ */ jsx11("div", { className: "color-palette-dropdown" + (visible ? " visible" : ""), children: /* @__PURE__ */ jsxs7("div", { onClick: (e) => e.stopPropagation(), children: [
384
342
  /* @__PURE__ */ jsxs7("button", { className: "color-palette-reset", onClick: handleReset, children: [
385
- /* @__PURE__ */ jsx12(RotateCcw, { size: 12 }),
343
+ /* @__PURE__ */ jsx11(RotateCcw, { size: 12 }),
386
344
  "Reset"
387
345
  ] }),
388
- /* @__PURE__ */ jsx12("div", { className: "color-palette-grid", children: COLOR_PALETTE.map((row, ri) => /* @__PURE__ */ jsx12("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx12(
346
+ /* @__PURE__ */ jsx11("div", { className: "color-palette-grid", children: COLOR_PALETTE.map((row, ri) => /* @__PURE__ */ jsx11("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx11(
389
347
  "div",
390
348
  {
391
349
  className: `color-palette-swatch${activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
@@ -400,8 +358,9 @@ function ColorTool() {
400
358
  }
401
359
 
402
360
  // src/toolbar/HighlightTool.tsx
361
+ import { useState as useState10 } from "react";
403
362
  import { Highlighter, RotateCcw as RotateCcw2 } from "lucide-react";
404
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
363
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
405
364
  var HIGHLIGHT_PALETTE = [
406
365
  ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
407
366
  ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
@@ -414,7 +373,7 @@ var HIGHLIGHT_PALETTE = [
414
373
  ];
415
374
  function HighlightTool() {
416
375
  const { editorRef, rangeStyle } = useEditor();
417
- const { triggerRef, isOpen: visible, toggle, portalStyle } = useDropdown();
376
+ const [visible, setVisible] = useState10(false);
418
377
  const activeColor = rangeStyle?.highlight || "";
419
378
  const handleColor = (color) => {
420
379
  editorRef.current?.command.executeHighlight(color);
@@ -422,16 +381,16 @@ function HighlightTool() {
422
381
  const handleReset = () => {
423
382
  editorRef.current?.command.executeHighlight(null);
424
383
  };
425
- return /* @__PURE__ */ jsxs8("div", { className: "menu-item__highlight", ref: triggerRef, title: "Highlight", onClick: toggle, children: [
426
- /* @__PURE__ */ jsx13(Highlighter, { size: 16 }),
427
- /* @__PURE__ */ jsx13("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
428
- /* @__PURE__ */ jsx13("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
429
- /* @__PURE__ */ jsx13(DropdownPortal, { isOpen: visible, style: portalStyle, className: "color-palette-dropdown", wrapperClassName: "menu-item__highlight", children: /* @__PURE__ */ jsxs8("div", { onClick: (e) => e.stopPropagation(), children: [
384
+ return /* @__PURE__ */ jsxs8("div", { className: "menu-item__highlight", title: "Highlight", onClick: () => setVisible(!visible), children: [
385
+ /* @__PURE__ */ jsx12(Highlighter, { size: 16 }),
386
+ /* @__PURE__ */ jsx12("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
387
+ /* @__PURE__ */ jsx12("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
388
+ /* @__PURE__ */ jsx12("div", { className: "color-palette-dropdown" + (visible ? " visible" : ""), children: /* @__PURE__ */ jsxs8("div", { onClick: (e) => e.stopPropagation(), children: [
430
389
  /* @__PURE__ */ jsxs8("button", { className: "color-palette-reset", onClick: handleReset, children: [
431
- /* @__PURE__ */ jsx13(RotateCcw2, { size: 12 }),
390
+ /* @__PURE__ */ jsx12(RotateCcw2, { size: 12 }),
432
391
  "None"
433
392
  ] }),
434
- /* @__PURE__ */ jsx13("div", { className: "color-palette-grid", children: HIGHLIGHT_PALETTE.map((row, ri) => /* @__PURE__ */ jsx13("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx13(
393
+ /* @__PURE__ */ jsx12("div", { className: "color-palette-grid", children: HIGHLIGHT_PALETTE.map((row, ri) => /* @__PURE__ */ jsx12("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx12(
435
394
  "div",
436
395
  {
437
396
  className: `color-palette-swatch${activeColor && activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
@@ -447,87 +406,89 @@ function HighlightTool() {
447
406
 
448
407
  // src/toolbar/BoldTool.tsx
449
408
  import { Bold } from "lucide-react";
450
- import { jsx as jsx14 } from "react/jsx-runtime";
409
+ import { jsx as jsx13 } from "react/jsx-runtime";
451
410
  function BoldTool() {
452
411
  const { editorRef, isApple, rangeStyle } = useEditor();
453
412
  const isActive = rangeStyle?.bold === true;
454
- return /* @__PURE__ */ jsx14("div", { className: `menu-item__bold ${isActive ? "active" : ""}`, title: `Bold(${isApple ? "\u2318" : "Ctrl"}+B)`, onClick: () => editorRef.current?.command.executeBold(), children: /* @__PURE__ */ jsx14(Bold, { size: 16 }) });
413
+ return /* @__PURE__ */ jsx13("div", { className: `menu-item__bold ${isActive ? "active" : ""}`, title: `Bold(${isApple ? "\u2318" : "Ctrl"}+B)`, onClick: () => editorRef.current?.command.executeBold(), children: /* @__PURE__ */ jsx13(Bold, { size: 16 }) });
455
414
  }
456
415
 
457
416
  // src/toolbar/ItalicTool.tsx
458
417
  import { Italic } from "lucide-react";
459
- import { jsx as jsx15 } from "react/jsx-runtime";
418
+ import { jsx as jsx14 } from "react/jsx-runtime";
460
419
  function ItalicTool() {
461
420
  const { editorRef, isApple, rangeStyle } = useEditor();
462
421
  const isActive = rangeStyle?.italic === true;
463
- return /* @__PURE__ */ jsx15("div", { className: `menu-item__italic ${isActive ? "active" : ""}`, title: `Italic(${isApple ? "\u2318" : "Ctrl"}+I)`, onClick: () => editorRef.current?.command.executeItalic(), children: /* @__PURE__ */ jsx15(Italic, { size: 16 }) });
422
+ return /* @__PURE__ */ jsx14("div", { className: `menu-item__italic ${isActive ? "active" : ""}`, title: `Italic(${isApple ? "\u2318" : "Ctrl"}+I)`, onClick: () => editorRef.current?.command.executeItalic(), children: /* @__PURE__ */ jsx14(Italic, { size: 16 }) });
464
423
  }
465
424
 
466
425
  // src/toolbar/UnderlineTool.tsx
426
+ import { useState as useState11 } from "react";
467
427
  import { Underline as UnderlineIcon } from "lucide-react";
468
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
428
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
469
429
  var STYLES = ["solid", "double", "dashed", "dotted", "wavy"];
470
430
  function UnderlineTool() {
471
431
  const { editorRef, isApple, rangeStyle } = useEditor();
472
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
432
+ const [isOpen, setIsOpen] = useState11(false);
473
433
  const isActive = rangeStyle?.underline === true;
474
- return /* @__PURE__ */ jsxs9("div", { className: `menu-item__underline ${isActive ? "active" : ""}`, ref: triggerRef, title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`, children: [
475
- /* @__PURE__ */ jsx16(UnderlineIcon, { size: 16, onClick: () => editorRef.current?.command.executeUnderline(), style: { cursor: "pointer" } }),
476
- /* @__PURE__ */ jsx16("span", { className: "select", onClick: toggle }),
477
- /* @__PURE__ */ jsx16(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__underline", children: /* @__PURE__ */ jsx16("ul", { children: STYLES.map((style) => /* @__PURE__ */ jsx16("li", { "data-decoration-style": style, onClick: () => {
434
+ return /* @__PURE__ */ jsxs9("div", { className: `menu-item__underline ${isActive ? "active" : ""}`, title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`, children: [
435
+ /* @__PURE__ */ jsx15(UnderlineIcon, { size: 16, onClick: () => editorRef.current?.command.executeUnderline(), style: { cursor: "pointer" } }),
436
+ /* @__PURE__ */ jsx15("span", { className: "select", onClick: () => setIsOpen(!isOpen) }),
437
+ /* @__PURE__ */ jsx15("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx15("ul", { children: STYLES.map((style) => /* @__PURE__ */ jsx15("li", { "data-decoration-style": style, onClick: () => {
478
438
  editorRef.current?.command.executeUnderline({ style });
479
- }, children: /* @__PURE__ */ jsx16("i", {}) }, style)) }) })
439
+ }, children: /* @__PURE__ */ jsx15("i", {}) }, style)) }) })
480
440
  ] });
481
441
  }
482
442
 
483
443
  // src/toolbar/StrikeoutTool.tsx
484
444
  import { Strikethrough } from "lucide-react";
485
- import { jsx as jsx17 } from "react/jsx-runtime";
445
+ import { jsx as jsx16 } from "react/jsx-runtime";
486
446
  function StrikeoutTool() {
487
447
  const { editorRef, rangeStyle } = useEditor();
488
448
  const isActive = rangeStyle?.strikeout === true;
489
- return /* @__PURE__ */ jsx17("div", { className: `menu-item__strikeout ${isActive ? "active" : ""}`, title: "Strikethrough", onClick: () => editorRef.current?.command.executeStrikeout(), children: /* @__PURE__ */ jsx17(Strikethrough, { size: 16 }) });
449
+ return /* @__PURE__ */ jsx16("div", { className: `menu-item__strikeout ${isActive ? "active" : ""}`, title: "Strikethrough", onClick: () => editorRef.current?.command.executeStrikeout(), children: /* @__PURE__ */ jsx16(Strikethrough, { size: 16 }) });
490
450
  }
491
451
 
492
452
  // src/toolbar/LeftAlignTool.tsx
493
453
  import { AlignLeft } from "lucide-react";
494
- import { jsx as jsx18 } from "react/jsx-runtime";
454
+ import { jsx as jsx17 } from "react/jsx-runtime";
495
455
  function LeftAlignTool() {
496
456
  const { editorRef, isApple, rangeStyle } = useEditor();
497
457
  const isActive = !rangeStyle?.rowFlex || rangeStyle.rowFlex === "left";
498
- return /* @__PURE__ */ jsx18("div", { className: `menu-item__left ${isActive ? "active" : ""}`, title: `Left align(${isApple ? "\u2318" : "Ctrl"}+L)`, onClick: () => editorRef.current?.command.executeRowFlex("left"), children: /* @__PURE__ */ jsx18(AlignLeft, { size: 16 }) });
458
+ return /* @__PURE__ */ jsx17("div", { className: `menu-item__left ${isActive ? "active" : ""}`, title: `Left align(${isApple ? "\u2318" : "Ctrl"}+L)`, onClick: () => editorRef.current?.command.executeRowFlex("left"), children: /* @__PURE__ */ jsx17(AlignLeft, { size: 16 }) });
499
459
  }
500
460
 
501
461
  // src/toolbar/CenterAlignTool.tsx
502
462
  import { AlignCenter } from "lucide-react";
503
- import { jsx as jsx19 } from "react/jsx-runtime";
463
+ import { jsx as jsx18 } from "react/jsx-runtime";
504
464
  function CenterAlignTool() {
505
465
  const { editorRef, isApple, rangeStyle } = useEditor();
506
466
  const isActive = rangeStyle?.rowFlex === "center";
507
- return /* @__PURE__ */ jsx19("div", { className: `menu-item__center ${isActive ? "active" : ""}`, title: `Center align(${isApple ? "\u2318" : "Ctrl"}+E)`, onClick: () => editorRef.current?.command.executeRowFlex("center"), children: /* @__PURE__ */ jsx19(AlignCenter, { size: 16 }) });
467
+ return /* @__PURE__ */ jsx18("div", { className: `menu-item__center ${isActive ? "active" : ""}`, title: `Center align(${isApple ? "\u2318" : "Ctrl"}+E)`, onClick: () => editorRef.current?.command.executeRowFlex("center"), children: /* @__PURE__ */ jsx18(AlignCenter, { size: 16 }) });
508
468
  }
509
469
 
510
470
  // src/toolbar/RightAlignTool.tsx
511
471
  import { AlignRight } from "lucide-react";
512
- import { jsx as jsx20 } from "react/jsx-runtime";
472
+ import { jsx as jsx19 } from "react/jsx-runtime";
513
473
  function RightAlignTool() {
514
474
  const { editorRef, isApple, rangeStyle } = useEditor();
515
475
  const isActive = rangeStyle?.rowFlex === "right";
516
- return /* @__PURE__ */ jsx20("div", { className: `menu-item__right ${isActive ? "active" : ""}`, title: `Right align(${isApple ? "\u2318" : "Ctrl"}+R)`, onClick: () => editorRef.current?.command.executeRowFlex("right"), children: /* @__PURE__ */ jsx20(AlignRight, { size: 16 }) });
476
+ return /* @__PURE__ */ jsx19("div", { className: `menu-item__right ${isActive ? "active" : ""}`, title: `Right align(${isApple ? "\u2318" : "Ctrl"}+R)`, onClick: () => editorRef.current?.command.executeRowFlex("right"), children: /* @__PURE__ */ jsx19(AlignRight, { size: 16 }) });
517
477
  }
518
478
 
519
479
  // src/toolbar/JustifyTool.tsx
520
480
  import { AlignJustify } from "lucide-react";
521
- import { jsx as jsx21 } from "react/jsx-runtime";
481
+ import { jsx as jsx20 } from "react/jsx-runtime";
522
482
  function JustifyTool() {
523
483
  const { editorRef, isApple, rangeStyle } = useEditor();
524
484
  const isActive = rangeStyle?.rowFlex === "justify" || rangeStyle?.rowFlex === "alignment";
525
- return /* @__PURE__ */ jsx21("div", { className: `menu-item__justify ${isActive ? "active" : ""}`, title: `Distribute(${isApple ? "\u2318" : "Ctrl"}+Shift+J)`, onClick: () => editorRef.current?.command.executeRowFlex("justify"), children: /* @__PURE__ */ jsx21(AlignJustify, { size: 16 }) });
485
+ return /* @__PURE__ */ jsx20("div", { className: `menu-item__justify ${isActive ? "active" : ""}`, title: `Distribute(${isApple ? "\u2318" : "Ctrl"}+Shift+J)`, onClick: () => editorRef.current?.command.executeRowFlex("justify"), children: /* @__PURE__ */ jsx20(AlignJustify, { size: 16 }) });
526
486
  }
527
487
 
528
488
  // src/toolbar/ListTool.tsx
489
+ import { useState as useState12 } from "react";
529
490
  import { List, ListOrdered, Indent, Outdent } from "lucide-react";
530
- import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
491
+ import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
531
492
  var OL_PRESETS = [
532
493
  { preset: "olDefault", label: "Default", preview: ["1.", "a.", "i."] },
533
494
  { preset: "olParen", label: "Parenthesis", preview: ["1)", "a)", "i)"] },
@@ -545,22 +506,22 @@ var UL_PRESETS = [
545
506
  { preset: "ulCheckArr", label: "Check Arrow", preview: ["\u27A4", "\u25CB", "\u25A0"] }
546
507
  ];
547
508
  function PresetCell({ option, onClick }) {
548
- return /* @__PURE__ */ jsx22(
509
+ return /* @__PURE__ */ jsx21(
549
510
  "div",
550
511
  {
551
512
  onClick,
552
513
  className: "list-preset-cell",
553
514
  title: option.label,
554
515
  children: option.preview.map((item, i) => /* @__PURE__ */ jsxs10("div", { className: "list-preset-line", style: { paddingLeft: `${i * 10}px` }, children: [
555
- /* @__PURE__ */ jsx22("span", { className: "list-preset-marker", children: item }),
556
- /* @__PURE__ */ jsx22("span", { className: "list-preset-text" })
516
+ /* @__PURE__ */ jsx21("span", { className: "list-preset-marker", children: item }),
517
+ /* @__PURE__ */ jsx21("span", { className: "list-preset-text" })
557
518
  ] }, i))
558
519
  }
559
520
  );
560
521
  }
561
522
  function ListTool() {
562
523
  const { editorRef, isApple, rangeStyle } = useEditor();
563
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
524
+ const [isOpen, setIsOpen] = useState12(false);
564
525
  const isActive = !!rangeStyle?.listType;
565
526
  const handleList = (type, style) => {
566
527
  editorRef.current?.command.executeList(type, style);
@@ -577,11 +538,11 @@ function ListTool() {
577
538
  e.stopPropagation();
578
539
  editorRef.current?.command.executeListOutdent();
579
540
  };
580
- return /* @__PURE__ */ jsxs10("div", { ref: triggerRef, className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
581
- /* @__PURE__ */ jsx22(List, { size: 16, onClick: toggle, style: { cursor: "pointer" } }),
582
- /* @__PURE__ */ jsx22(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__list", children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px", width: "320px" }, children: [
541
+ return /* @__PURE__ */ jsxs10("div", { className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
542
+ /* @__PURE__ */ jsx21(List, { size: 16, onClick: () => setIsOpen(!isOpen), style: { cursor: "pointer" } }),
543
+ /* @__PURE__ */ jsx21("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px", width: "320px" }, children: [
583
544
  /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
584
- /* @__PURE__ */ jsx22(
545
+ /* @__PURE__ */ jsx21(
585
546
  "button",
586
547
  {
587
548
  onClick: () => handleList("ul", "checkbox"),
@@ -589,15 +550,15 @@ function ListTool() {
589
550
  children: "Checkbox"
590
551
  }
591
552
  ),
592
- /* @__PURE__ */ jsx22("button", { onClick: handleIndent, className: "list-quick-btn", title: "Indent (Tab)", children: /* @__PURE__ */ jsx22(Indent, { size: 14 }) }),
593
- /* @__PURE__ */ jsx22("button", { onClick: handleOutdent, className: "list-quick-btn", title: "Outdent (Shift+Tab)", children: /* @__PURE__ */ jsx22(Outdent, { size: 14 }) })
553
+ /* @__PURE__ */ jsx21("button", { onClick: handleIndent, className: "list-quick-btn", title: "Indent (Tab)", children: /* @__PURE__ */ jsx21(Indent, { size: 14 }) }),
554
+ /* @__PURE__ */ jsx21("button", { onClick: handleOutdent, className: "list-quick-btn", title: "Outdent (Shift+Tab)", children: /* @__PURE__ */ jsx21(Outdent, { size: 14 }) })
594
555
  ] }),
595
556
  /* @__PURE__ */ jsxs10("div", { style: { marginBottom: "8px" }, children: [
596
557
  /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
597
- /* @__PURE__ */ jsx22(ListOrdered, { size: 12 }),
558
+ /* @__PURE__ */ jsx21(ListOrdered, { size: 12 }),
598
559
  "Ordered List"
599
560
  ] }),
600
- /* @__PURE__ */ jsx22("div", { className: "list-preset-grid", children: OL_PRESETS.map((option) => /* @__PURE__ */ jsx22(
561
+ /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: OL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
601
562
  PresetCell,
602
563
  {
603
564
  option,
@@ -608,10 +569,10 @@ function ListTool() {
608
569
  ] }),
609
570
  /* @__PURE__ */ jsxs10("div", { children: [
610
571
  /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
611
- /* @__PURE__ */ jsx22(List, { size: 12 }),
572
+ /* @__PURE__ */ jsx21(List, { size: 12 }),
612
573
  "Unordered List"
613
574
  ] }),
614
- /* @__PURE__ */ jsx22("div", { className: "list-preset-grid", children: UL_PRESETS.map((option) => /* @__PURE__ */ jsx22(
575
+ /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: UL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
615
576
  PresetCell,
616
577
  {
617
578
  option,
@@ -626,7 +587,7 @@ function ListTool() {
626
587
 
627
588
  // src/toolbar/ImageTool.tsx
628
589
  import { Image as ImageIcon } from "lucide-react";
629
- import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
590
+ import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
630
591
  function ImageTool() {
631
592
  const { editorRef } = useEditor();
632
593
  const handleImageUpload = (e) => {
@@ -648,15 +609,15 @@ function ImageTool() {
648
609
  e.target.value = "";
649
610
  };
650
611
  return /* @__PURE__ */ jsxs11("div", { className: "menu-item__image", onClick: () => document.getElementById("image")?.click(), children: [
651
- /* @__PURE__ */ jsx23(ImageIcon, { size: 16 }),
652
- /* @__PURE__ */ jsx23("input", { type: "file", id: "image", accept: ".png, .jpg, .jpeg, .svg, .gif", onChange: handleImageUpload })
612
+ /* @__PURE__ */ jsx22(ImageIcon, { size: 16 }),
613
+ /* @__PURE__ */ jsx22("input", { type: "file", id: "image", accept: ".png, .jpg, .jpeg, .svg, .gif", onChange: handleImageUpload })
653
614
  ] });
654
615
  }
655
616
 
656
617
  // src/toolbar/SeparatorTool.tsx
657
- import { useState as useState6 } from "react";
618
+ import { useState as useState13 } from "react";
658
619
  import { Minus } from "lucide-react";
659
- import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
620
+ import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
660
621
  var DASH_STYLES = [
661
622
  { label: "Solid", dashArray: [] },
662
623
  { label: "Dotted", dashArray: [1, 1] },
@@ -670,22 +631,22 @@ var LINE_WIDTHS = [
670
631
  ];
671
632
  function SeparatorTool() {
672
633
  const { editorRef } = useEditor();
673
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
674
- const [selectedWidth, setSelectedWidth] = useState6(1);
634
+ const [isOpen, setIsOpen] = useState13(false);
635
+ const [selectedWidth, setSelectedWidth] = useState13(1);
675
636
  const lineColor = "#344054";
676
637
  const handleSeparator = (dashArray) => {
677
638
  editorRef.current?.command.executeSeparator(dashArray, { lineWidth: selectedWidth });
678
639
  };
679
- return /* @__PURE__ */ jsxs12("div", { className: "menu-item__separator", ref: triggerRef, title: "Separator", children: [
680
- /* @__PURE__ */ jsx24(Minus, { size: 16, onClick: toggle, style: { cursor: "pointer" } }),
681
- /* @__PURE__ */ jsx24(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__separator", children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
682
- /* @__PURE__ */ jsx24("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ jsxs12(
640
+ return /* @__PURE__ */ jsxs12("div", { className: "menu-item__separator", title: "Separator", children: [
641
+ /* @__PURE__ */ jsx23(Minus, { size: 16, onClick: () => setIsOpen(!isOpen), style: { cursor: "pointer" } }),
642
+ /* @__PURE__ */ jsx23("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
643
+ /* @__PURE__ */ jsx23("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ jsxs12(
683
644
  "li",
684
645
  {
685
646
  onClick: () => handleSeparator(dashArray),
686
647
  style: { display: "flex", alignItems: "center", gap: "10px", padding: "5px 6px", cursor: "pointer", borderRadius: "4px" },
687
648
  children: [
688
- /* @__PURE__ */ jsx24("svg", { style: { flex: 1, minWidth: 0, overflow: "hidden" }, height: "8", children: /* @__PURE__ */ jsx24(
649
+ /* @__PURE__ */ jsx23("svg", { style: { flex: 1, minWidth: 0, overflow: "hidden" }, height: "8", children: /* @__PURE__ */ jsx23(
689
650
  "line",
690
651
  {
691
652
  x1: "0",
@@ -697,14 +658,14 @@ function SeparatorTool() {
697
658
  strokeDasharray: dashArray.length ? dashArray.join(",") : "none"
698
659
  }
699
660
  ) }),
700
- /* @__PURE__ */ jsx24("span", { style: { fontSize: "11px", color: "#475467", whiteSpace: "nowrap", flexShrink: 0 }, children: label })
661
+ /* @__PURE__ */ jsx23("span", { style: { fontSize: "11px", color: "#475467", whiteSpace: "nowrap", flexShrink: 0 }, children: label })
701
662
  ]
702
663
  },
703
664
  label
704
665
  )) }),
705
666
  /* @__PURE__ */ jsxs12("div", { style: { borderTop: "1px solid #e4e7ec", marginTop: "8px", paddingTop: "8px" }, children: [
706
- /* @__PURE__ */ jsx24("div", { style: { fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: "Line Width" }),
707
- /* @__PURE__ */ jsx24("div", { style: { display: "flex", gap: "4px" }, children: LINE_WIDTHS.map(({ label, value }) => /* @__PURE__ */ jsx24(
667
+ /* @__PURE__ */ jsx23("div", { style: { fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: "Line Width" }),
668
+ /* @__PURE__ */ jsx23("div", { style: { display: "flex", gap: "4px" }, children: LINE_WIDTHS.map(({ label, value }) => /* @__PURE__ */ jsx23(
708
669
  "button",
709
670
  {
710
671
  onClick: (e) => {
@@ -732,10 +693,11 @@ function SeparatorTool() {
732
693
  }
733
694
 
734
695
  // src/toolbar/WatermarkTool.tsx
735
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
696
+ import { useState as useState14 } from "react";
697
+ import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
736
698
  function InsertElementTool() {
737
699
  const { editorRef } = useEditor();
738
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
700
+ const [isOpen, setIsOpen] = useState14(false);
739
701
  const handleHeader = () => {
740
702
  if (!editorRef.current) return;
741
703
  const options = editorRef.current.command.getOptions();
@@ -745,17 +707,18 @@ function InsertElementTool() {
745
707
  }
746
708
  editorRef.current.command.executeSetZone("header");
747
709
  };
748
- return /* @__PURE__ */ jsxs13("div", { className: "menu-item__insert-element", ref: triggerRef, onClick: toggle, children: [
749
- /* @__PURE__ */ jsx25("i", { title: "Insert Element" }),
750
- /* @__PURE__ */ jsx25(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__insert-element", children: /* @__PURE__ */ jsx25("ul", { children: /* @__PURE__ */ jsx25("li", { onClick: handleHeader, children: "Add Header" }) }) })
710
+ return /* @__PURE__ */ jsxs13("div", { className: "menu-item__insert-element", onClick: () => setIsOpen(!isOpen), children: [
711
+ /* @__PURE__ */ jsx24("i", { title: "Insert Element" }),
712
+ /* @__PURE__ */ jsx24("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsx24("ul", { children: /* @__PURE__ */ jsx24("li", { onClick: handleHeader, children: "Add Header" }) }) })
751
713
  ] });
752
714
  }
753
715
 
754
716
  // src/toolbar/PageBreakTool.tsx
755
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
717
+ import { useState as useState15 } from "react";
718
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
756
719
  function PageBreakTool() {
757
720
  const { editorRef } = useEditor();
758
- const { triggerRef, isOpen, toggle, portalStyle } = useDropdown();
721
+ const [isOpen, setIsOpen] = useState15(false);
759
722
  const handlePageBreak = () => {
760
723
  editorRef.current?.command.executePageBreak();
761
724
  };
@@ -766,13 +729,12 @@ function PageBreakTool() {
766
729
  "div",
767
730
  {
768
731
  className: "menu-item__page-break",
769
- ref: triggerRef,
770
- onClick: toggle,
732
+ onClick: () => setIsOpen(!isOpen),
771
733
  children: [
772
- /* @__PURE__ */ jsx26("i", { title: "Break" }),
773
- /* @__PURE__ */ jsx26(DropdownPortal, { isOpen, style: portalStyle, className: "options visible", wrapperClassName: "menu-item__page-break", children: /* @__PURE__ */ jsxs14("ul", { children: [
774
- /* @__PURE__ */ jsx26("li", { onClick: handlePageBreak, children: "Page Break" }),
775
- /* @__PURE__ */ jsx26("li", { onClick: handleColumnBreak, children: "Column Break" })
734
+ /* @__PURE__ */ jsx25("i", { title: "Break" }),
735
+ /* @__PURE__ */ jsx25("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ jsxs14("ul", { children: [
736
+ /* @__PURE__ */ jsx25("li", { onClick: handlePageBreak, children: "Page Break" }),
737
+ /* @__PURE__ */ jsx25("li", { onClick: handleColumnBreak, children: "Column Break" })
776
738
  ] }) })
777
739
  ]
778
740
  }
@@ -780,116 +742,116 @@ function PageBreakTool() {
780
742
  }
781
743
 
782
744
  // src/EditorToolbar.tsx
783
- import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
745
+ import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
784
746
  function EditorToolbar() {
785
747
  return /* @__PURE__ */ jsxs15("div", { className: "menu", "editor-component": "menu", children: [
786
748
  /* @__PURE__ */ jsxs15("div", { className: "menu-item", children: [
787
- /* @__PURE__ */ jsx27(UndoTool, {}),
788
- /* @__PURE__ */ jsx27(RedoTool, {})
749
+ /* @__PURE__ */ jsx26(UndoTool, {}),
750
+ /* @__PURE__ */ jsx26(RedoTool, {})
789
751
  ] }),
790
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
791
- /* @__PURE__ */ jsx27("div", { className: "menu-item", children: /* @__PURE__ */ jsx27(ColumnTool, {}) }),
792
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
752
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
753
+ /* @__PURE__ */ jsx26("div", { className: "menu-item", children: /* @__PURE__ */ jsx26(ColumnTool, {}) }),
754
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
793
755
  /* @__PURE__ */ jsxs15("div", { className: "menu-item", children: [
794
- /* @__PURE__ */ jsx27(PageBreakTool, {}),
795
- /* @__PURE__ */ jsx27(SeparatorTool, {})
756
+ /* @__PURE__ */ jsx26(PageBreakTool, {}),
757
+ /* @__PURE__ */ jsx26(SeparatorTool, {})
796
758
  ] }),
797
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
798
- /* @__PURE__ */ jsx27("div", { className: "menu-item", children: /* @__PURE__ */ jsx27(TableTool, {}) }),
799
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
759
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
760
+ /* @__PURE__ */ jsx26("div", { className: "menu-item", children: /* @__PURE__ */ jsx26(TableTool, {}) }),
761
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
800
762
  /* @__PURE__ */ jsxs15("div", { className: "menu-item", children: [
801
- /* @__PURE__ */ jsx27(TitleTool, {}),
802
- /* @__PURE__ */ jsx27(FontTool, {}),
803
- /* @__PURE__ */ jsx27(FontSizeTool, {}),
804
- /* @__PURE__ */ jsx27(LineHeightTool, {})
763
+ /* @__PURE__ */ jsx26(TitleTool, {}),
764
+ /* @__PURE__ */ jsx26(FontTool, {}),
765
+ /* @__PURE__ */ jsx26(FontSizeTool, {}),
766
+ /* @__PURE__ */ jsx26(LineHeightTool, {})
805
767
  ] }),
806
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
768
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
807
769
  /* @__PURE__ */ jsxs15("div", { className: "menu-item", children: [
808
- /* @__PURE__ */ jsx27(ColorTool, {}),
809
- /* @__PURE__ */ jsx27(HighlightTool, {}),
810
- /* @__PURE__ */ jsx27(BoldTool, {}),
811
- /* @__PURE__ */ jsx27(ItalicTool, {}),
812
- /* @__PURE__ */ jsx27(UnderlineTool, {}),
813
- /* @__PURE__ */ jsx27(StrikeoutTool, {})
770
+ /* @__PURE__ */ jsx26(ColorTool, {}),
771
+ /* @__PURE__ */ jsx26(HighlightTool, {}),
772
+ /* @__PURE__ */ jsx26(BoldTool, {}),
773
+ /* @__PURE__ */ jsx26(ItalicTool, {}),
774
+ /* @__PURE__ */ jsx26(UnderlineTool, {}),
775
+ /* @__PURE__ */ jsx26(StrikeoutTool, {})
814
776
  ] }),
815
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
777
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
816
778
  /* @__PURE__ */ jsxs15("div", { className: "menu-item", children: [
817
- /* @__PURE__ */ jsx27(LeftAlignTool, {}),
818
- /* @__PURE__ */ jsx27(CenterAlignTool, {}),
819
- /* @__PURE__ */ jsx27(RightAlignTool, {}),
820
- /* @__PURE__ */ jsx27(JustifyTool, {})
779
+ /* @__PURE__ */ jsx26(LeftAlignTool, {}),
780
+ /* @__PURE__ */ jsx26(CenterAlignTool, {}),
781
+ /* @__PURE__ */ jsx26(RightAlignTool, {}),
782
+ /* @__PURE__ */ jsx26(JustifyTool, {})
821
783
  ] }),
822
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
823
- /* @__PURE__ */ jsx27("div", { className: "menu-item", children: /* @__PURE__ */ jsx27(ListTool, {}) }),
824
- /* @__PURE__ */ jsx27("div", { className: "menu-divider" }),
825
- /* @__PURE__ */ jsx27("div", { className: "menu-item", children: /* @__PURE__ */ jsx27(ImageTool, {}) }),
826
- /* @__PURE__ */ jsx27("div", { className: "menu-item", children: /* @__PURE__ */ jsx27(InsertElementTool, {}) })
784
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
785
+ /* @__PURE__ */ jsx26("div", { className: "menu-item", children: /* @__PURE__ */ jsx26(ListTool, {}) }),
786
+ /* @__PURE__ */ jsx26("div", { className: "menu-divider" }),
787
+ /* @__PURE__ */ jsx26("div", { className: "menu-item", children: /* @__PURE__ */ jsx26(ImageTool, {}) }),
788
+ /* @__PURE__ */ jsx26("div", { className: "menu-item", children: /* @__PURE__ */ jsx26(InsertElementTool, {}) })
827
789
  ] });
828
790
  }
829
791
 
830
792
  // src/footer/CatalogToggleTool.tsx
831
- import { jsx as jsx28 } from "react/jsx-runtime";
793
+ import { jsx as jsx27 } from "react/jsx-runtime";
832
794
  function CatalogToggleTool() {
833
795
  const { handleToggleCatalogAction } = useFooter();
834
- return /* @__PURE__ */ jsx28("div", { className: "catalog-mode", title: "Catalog", onClick: handleToggleCatalogAction, children: /* @__PURE__ */ jsx28("i", {}) });
796
+ return /* @__PURE__ */ jsx27("div", { className: "catalog-mode", title: "Catalog", onClick: handleToggleCatalogAction, children: /* @__PURE__ */ jsx27("i", {}) });
835
797
  }
836
798
 
837
799
  // src/footer/PageModeTool.tsx
838
- import { useState as useState7 } from "react";
839
- import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
800
+ import { useState as useState16 } from "react";
801
+ import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
840
802
  function PageModeTool() {
841
803
  const { editorRef } = useEditor();
842
- const [visible, setVisible] = useState7(false);
804
+ const [visible, setVisible] = useState16(false);
843
805
  const handlePageMode = (mode) => {
844
806
  editorRef.current?.command.executePageMode(mode);
845
807
  setVisible(false);
846
808
  };
847
809
  return /* @__PURE__ */ jsxs16("div", { className: "page-mode", onClick: () => setVisible(!visible), children: [
848
- /* @__PURE__ */ jsx29("i", { title: "Page Mode" }),
849
- /* @__PURE__ */ jsx29("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsxs16("ul", { children: [
850
- /* @__PURE__ */ jsx29("li", { onClick: () => handlePageMode("paging"), className: "active", children: "Paging" }),
851
- /* @__PURE__ */ jsx29("li", { onClick: () => handlePageMode("continuity"), children: "Continuity" })
810
+ /* @__PURE__ */ jsx28("i", { title: "Page Mode" }),
811
+ /* @__PURE__ */ jsx28("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsxs16("ul", { children: [
812
+ /* @__PURE__ */ jsx28("li", { onClick: () => handlePageMode("paging"), className: "active", children: "Paging" }),
813
+ /* @__PURE__ */ jsx28("li", { onClick: () => handlePageMode("continuity"), children: "Continuity" })
852
814
  ] }) })
853
815
  ] });
854
816
  }
855
817
 
856
818
  // src/footer/FooterStatus.tsx
857
- import { Fragment as Fragment2, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
819
+ import { Fragment as Fragment2, jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
858
820
  function FooterStatus() {
859
821
  const { pageNoList, pageNo, pageSize, wordCount, rowNo, colNo } = useFooter();
860
822
  return /* @__PURE__ */ jsxs17(Fragment2, { children: [
861
823
  /* @__PURE__ */ jsxs17("span", { children: [
862
824
  "Visible Pages: ",
863
- /* @__PURE__ */ jsx30("span", { className: "page-no-list", children: pageNoList })
825
+ /* @__PURE__ */ jsx29("span", { className: "page-no-list", children: pageNoList })
864
826
  ] }),
865
- /* @__PURE__ */ jsx30("span", { className: "footer-divider" }),
827
+ /* @__PURE__ */ jsx29("span", { className: "footer-divider" }),
866
828
  /* @__PURE__ */ jsxs17("span", { children: [
867
829
  "Pages: ",
868
- /* @__PURE__ */ jsx30("span", { className: "page-no", children: pageNo }),
830
+ /* @__PURE__ */ jsx29("span", { className: "page-no", children: pageNo }),
869
831
  "/",
870
- /* @__PURE__ */ jsx30("span", { className: "page-size", children: pageSize })
832
+ /* @__PURE__ */ jsx29("span", { className: "page-size", children: pageSize })
871
833
  ] }),
872
- /* @__PURE__ */ jsx30("span", { className: "footer-divider" }),
834
+ /* @__PURE__ */ jsx29("span", { className: "footer-divider" }),
873
835
  /* @__PURE__ */ jsxs17("span", { children: [
874
836
  "Words: ",
875
- /* @__PURE__ */ jsx30("span", { className: "word-count", children: wordCount })
837
+ /* @__PURE__ */ jsx29("span", { className: "word-count", children: wordCount })
876
838
  ] }),
877
- /* @__PURE__ */ jsx30("span", { className: "footer-divider" }),
839
+ /* @__PURE__ */ jsx29("span", { className: "footer-divider" }),
878
840
  /* @__PURE__ */ jsxs17("span", { children: [
879
841
  "Row: ",
880
- /* @__PURE__ */ jsx30("span", { className: "row-no", children: rowNo })
842
+ /* @__PURE__ */ jsx29("span", { className: "row-no", children: rowNo })
881
843
  ] }),
882
- /* @__PURE__ */ jsx30("span", { className: "footer-divider" }),
844
+ /* @__PURE__ */ jsx29("span", { className: "footer-divider" }),
883
845
  /* @__PURE__ */ jsxs17("span", { children: [
884
846
  "Column: ",
885
- /* @__PURE__ */ jsx30("span", { className: "col-no", children: colNo })
847
+ /* @__PURE__ */ jsx29("span", { className: "col-no", children: colNo })
886
848
  ] })
887
849
  ] });
888
850
  }
889
851
 
890
852
  // src/footer/EditorModeTool.tsx
891
- import { useState as useState8, useRef as useRef3 } from "react";
892
- import { jsx as jsx31 } from "react/jsx-runtime";
853
+ import { useState as useState17, useRef as useRef2 } from "react";
854
+ import { jsx as jsx30 } from "react/jsx-runtime";
893
855
  var MODE_LIST = [
894
856
  { mode: "edit", name: "Edit Mode" },
895
857
  { mode: "clean", name: "Clean Mode" },
@@ -901,8 +863,8 @@ var MODE_LIST = [
901
863
  ];
902
864
  function EditorModeTool() {
903
865
  const { editorRef } = useEditor();
904
- const [editorMode, setEditorMode] = useState8("Edit Mode");
905
- const modeIndexRef = useRef3(0);
866
+ const [editorMode, setEditorMode] = useState17("Edit Mode");
867
+ const modeIndexRef = useRef2(0);
906
868
  const handleModeChange = () => {
907
869
  modeIndexRef.current = modeIndexRef.current === MODE_LIST.length - 1 ? 0 : modeIndexRef.current + 1;
908
870
  const { name, mode } = MODE_LIST[modeIndexRef.current];
@@ -919,14 +881,14 @@ function EditorModeTool() {
919
881
  }
920
882
  });
921
883
  };
922
- return /* @__PURE__ */ jsx31("div", { className: "editor-mode", title: "Click to change mode", onClick: handleModeChange, children: editorMode });
884
+ return /* @__PURE__ */ jsx30("div", { className: "editor-mode", title: "Click to change mode", onClick: handleModeChange, children: editorMode });
923
885
  }
924
886
 
925
887
  // src/footer/PageScaleMinusTool.tsx
926
- import { jsx as jsx32 } from "react/jsx-runtime";
888
+ import { jsx as jsx31 } from "react/jsx-runtime";
927
889
  function PageScaleMinusTool() {
928
890
  const { editorRef } = useEditor();
929
- return /* @__PURE__ */ jsx32("div", { className: "page-scale-minus", title: "Zoom Out (Ctrl+-)", onClick: () => editorRef.current?.command.executePageScaleMinus(), children: /* @__PURE__ */ jsx32("i", {}) });
891
+ return /* @__PURE__ */ jsx31("div", { className: "page-scale-minus", title: "Zoom Out (Ctrl+-)", onClick: () => editorRef.current?.command.executePageScaleMinus(), children: /* @__PURE__ */ jsx31("i", {}) });
930
892
  }
931
893
 
932
894
  // src/footer/PageScalePercentageTool.tsx
@@ -941,15 +903,15 @@ function PageScalePercentageTool() {
941
903
  }
942
904
 
943
905
  // src/footer/PageScaleAddTool.tsx
944
- import { jsx as jsx33 } from "react/jsx-runtime";
906
+ import { jsx as jsx32 } from "react/jsx-runtime";
945
907
  function PageScaleAddTool() {
946
908
  const { editorRef } = useEditor();
947
- return /* @__PURE__ */ jsx33("div", { className: "page-scale-add", title: "Zoom In (Ctrl+=)", onClick: () => editorRef.current?.command.executePageScaleAdd(), children: /* @__PURE__ */ jsx33("i", {}) });
909
+ return /* @__PURE__ */ jsx32("div", { className: "page-scale-add", title: "Zoom In (Ctrl+=)", onClick: () => editorRef.current?.command.executePageScaleAdd(), children: /* @__PURE__ */ jsx32("i", {}) });
948
910
  }
949
911
 
950
912
  // src/footer/PaperSizeTool.tsx
951
- import { useState as useState9 } from "react";
952
- import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
913
+ import { useState as useState18 } from "react";
914
+ import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
953
915
  var SIZES2 = [
954
916
  { label: "A4", width: 794, height: 1123, active: true },
955
917
  { label: "A2", width: 1593, height: 2251 },
@@ -958,38 +920,38 @@ var SIZES2 = [
958
920
  ];
959
921
  function PaperSizeTool() {
960
922
  const { editorRef } = useEditor();
961
- const [visible, setVisible] = useState9(false);
923
+ const [visible, setVisible] = useState18(false);
962
924
  const handlePaperSize = (width, height) => {
963
925
  editorRef.current?.command.executePaperSize(width, height);
964
926
  setVisible(false);
965
927
  };
966
928
  return /* @__PURE__ */ jsxs19("div", { className: "paper-size", onClick: () => setVisible(!visible), children: [
967
- /* @__PURE__ */ jsx34("i", { title: "Paper Type" }),
968
- /* @__PURE__ */ jsx34("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsx34("ul", { children: SIZES2.map(({ label, width, height, active }) => /* @__PURE__ */ jsx34("li", { onClick: () => handlePaperSize(width, height), className: active ? "active" : "", children: label }, label)) }) })
929
+ /* @__PURE__ */ jsx33("i", { title: "Paper Type" }),
930
+ /* @__PURE__ */ jsx33("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsx33("ul", { children: SIZES2.map(({ label, width, height, active }) => /* @__PURE__ */ jsx33("li", { onClick: () => handlePaperSize(width, height), className: active ? "active" : "", children: label }, label)) }) })
969
931
  ] });
970
932
  }
971
933
 
972
934
  // src/footer/PaperDirectionTool.tsx
973
- import { useState as useState10 } from "react";
974
- import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
935
+ import { useState as useState19 } from "react";
936
+ import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
975
937
  function PaperDirectionTool() {
976
938
  const { editorRef } = useEditor();
977
- const [visible, setVisible] = useState10(false);
939
+ const [visible, setVisible] = useState19(false);
978
940
  const handlePaperDirection = (direction) => {
979
941
  editorRef.current?.command.executePaperDirection(direction);
980
942
  setVisible(false);
981
943
  };
982
944
  return /* @__PURE__ */ jsxs20("div", { className: "paper-direction", onClick: () => setVisible(!visible), children: [
983
- /* @__PURE__ */ jsx35("i", { title: "Paper Direction" }),
984
- /* @__PURE__ */ jsx35("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsxs20("ul", { children: [
985
- /* @__PURE__ */ jsx35("li", { onClick: () => handlePaperDirection("vertical"), className: "active", children: "Portrait" }),
986
- /* @__PURE__ */ jsx35("li", { onClick: () => handlePaperDirection("horizontal"), children: "Landscape" })
945
+ /* @__PURE__ */ jsx34("i", { title: "Paper Direction" }),
946
+ /* @__PURE__ */ jsx34("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsxs20("ul", { children: [
947
+ /* @__PURE__ */ jsx34("li", { onClick: () => handlePaperDirection("vertical"), className: "active", children: "Portrait" }),
948
+ /* @__PURE__ */ jsx34("li", { onClick: () => handlePaperDirection("horizontal"), children: "Landscape" })
987
949
  ] }) })
988
950
  ] });
989
951
  }
990
952
 
991
953
  // src/footer/PaperMarginTool.tsx
992
- import { jsx as jsx36 } from "react/jsx-runtime";
954
+ import { jsx as jsx35 } from "react/jsx-runtime";
993
955
  function PaperMarginTool() {
994
956
  const { editorRef } = useEditor();
995
957
  const handlePaperMargin = async () => {
@@ -1022,11 +984,11 @@ function PaperMarginTool() {
1022
984
  }
1023
985
  });
1024
986
  };
1025
- return /* @__PURE__ */ jsx36("div", { className: "paper-margin", title: "Page Margins", onClick: handlePaperMargin, children: /* @__PURE__ */ jsx36("i", {}) });
987
+ return /* @__PURE__ */ jsx35("div", { className: "paper-margin", title: "Page Margins", onClick: handlePaperMargin, children: /* @__PURE__ */ jsx35("i", {}) });
1026
988
  }
1027
989
 
1028
990
  // src/footer/FullscreenTool.tsx
1029
- import { jsx as jsx37 } from "react/jsx-runtime";
991
+ import { jsx as jsx36 } from "react/jsx-runtime";
1030
992
  function FullscreenTool() {
1031
993
  const handleFullscreen = () => {
1032
994
  if (!document.fullscreenElement) {
@@ -1035,11 +997,11 @@ function FullscreenTool() {
1035
997
  document.exitFullscreen();
1036
998
  }
1037
999
  };
1038
- return /* @__PURE__ */ jsx37("div", { className: "fullscreen", title: "Fullscreen", onClick: handleFullscreen, children: /* @__PURE__ */ jsx37("i", {}) });
1000
+ return /* @__PURE__ */ jsx36("div", { className: "fullscreen", title: "Fullscreen", onClick: handleFullscreen, children: /* @__PURE__ */ jsx36("i", {}) });
1039
1001
  }
1040
1002
 
1041
1003
  // src/footer/EditorOptionTool.tsx
1042
- import { jsx as jsx38 } from "react/jsx-runtime";
1004
+ import { jsx as jsx37 } from "react/jsx-runtime";
1043
1005
  function EditorOptionTool() {
1044
1006
  const { editorRef } = useEditor();
1045
1007
  const handleEditorOption = async () => {
@@ -1067,12 +1029,12 @@ function EditorOptionTool() {
1067
1029
  }
1068
1030
  });
1069
1031
  };
1070
- return /* @__PURE__ */ jsx38("div", { className: "editor-option", title: "Editor Settings", onClick: handleEditorOption, children: /* @__PURE__ */ jsx38("i", {}) });
1032
+ return /* @__PURE__ */ jsx37("div", { className: "editor-option", title: "Editor Settings", onClick: handleEditorOption, children: /* @__PURE__ */ jsx37("i", {}) });
1071
1033
  }
1072
1034
 
1073
1035
  // src/footer/WatermarkFooterTool.tsx
1074
- import { useState as useState11, useRef as useRef4, useEffect as useEffect4, useCallback } from "react";
1075
- import { Fragment as Fragment3, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
1036
+ import { useState as useState20, useRef as useRef3, useEffect as useEffect3, useCallback } from "react";
1037
+ import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
1076
1038
  var COLOR_PALETTE2 = [
1077
1039
  ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc"],
1078
1040
  ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff"],
@@ -1084,21 +1046,21 @@ var FONTS2 = [
1084
1046
  ];
1085
1047
  function WatermarkFooterTool() {
1086
1048
  const { editorRef } = useEditor();
1087
- const [visible, setVisible] = useState11(false);
1088
- const [tab, setTab] = useState11("text");
1089
- const containerRef = useRef4(null);
1090
- const panelRef = useRef4(null);
1091
- const fileInputRef = useRef4(null);
1092
- const [text, setText] = useState11("WATERMARK");
1093
- const [font, setFont] = useState11("Arial");
1094
- const [color, setColor] = useState11("#AEB5C0");
1095
- const [opacity, setOpacity] = useState11(30);
1096
- const [rotation, setRotation] = useState11(-45);
1097
- const [inFront, setInFront] = useState11(false);
1098
- const [imageData, setImageData] = useState11("");
1099
- const [imgWidth, setImgWidth] = useState11(200);
1100
- const [imgHeight, setImgHeight] = useState11(200);
1101
- useEffect4(() => {
1049
+ const [visible, setVisible] = useState20(false);
1050
+ const [tab, setTab] = useState20("text");
1051
+ const containerRef = useRef3(null);
1052
+ const panelRef = useRef3(null);
1053
+ const fileInputRef = useRef3(null);
1054
+ const [text, setText] = useState20("WATERMARK");
1055
+ const [font, setFont] = useState20("Arial");
1056
+ const [color, setColor] = useState20("#AEB5C0");
1057
+ const [opacity, setOpacity] = useState20(30);
1058
+ const [rotation, setRotation] = useState20(-45);
1059
+ const [inFront, setInFront] = useState20(false);
1060
+ const [imageData, setImageData] = useState20("");
1061
+ const [imgWidth, setImgWidth] = useState20(200);
1062
+ const [imgHeight, setImgHeight] = useState20(200);
1063
+ useEffect3(() => {
1102
1064
  if (!visible) return;
1103
1065
  const handler = (e) => {
1104
1066
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -1108,7 +1070,7 @@ function WatermarkFooterTool() {
1108
1070
  document.addEventListener("mousedown", handler);
1109
1071
  return () => document.removeEventListener("mousedown", handler);
1110
1072
  }, [visible]);
1111
- useEffect4(() => {
1073
+ useEffect3(() => {
1112
1074
  if (!visible || !panelRef.current) return;
1113
1075
  const el = panelRef.current;
1114
1076
  el.style.right = "";
@@ -1179,25 +1141,25 @@ function WatermarkFooterTool() {
1179
1141
  setVisible(false);
1180
1142
  };
1181
1143
  return /* @__PURE__ */ jsxs21("div", { className: "watermark-footer", ref: containerRef, onClick: () => setVisible(!visible), children: [
1182
- /* @__PURE__ */ jsx39("i", { title: "Watermark" }),
1144
+ /* @__PURE__ */ jsx38("i", { title: "Watermark" }),
1183
1145
  visible && /* @__PURE__ */ jsxs21("div", { className: "watermark-footer-panel", ref: panelRef, onClick: (e) => e.stopPropagation(), children: [
1184
1146
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-tabs", children: [
1185
- /* @__PURE__ */ jsx39("button", { className: `wm-panel-tab ${tab === "text" ? "active" : ""}`, onClick: () => setTab("text"), children: "Text" }),
1186
- /* @__PURE__ */ jsx39("button", { className: `wm-panel-tab ${tab === "image" ? "active" : ""}`, onClick: () => setTab("image"), children: "Image" })
1147
+ /* @__PURE__ */ jsx38("button", { className: `wm-panel-tab ${tab === "text" ? "active" : ""}`, onClick: () => setTab("text"), children: "Text" }),
1148
+ /* @__PURE__ */ jsx38("button", { className: `wm-panel-tab ${tab === "image" ? "active" : ""}`, onClick: () => setTab("image"), children: "Image" })
1187
1149
  ] }),
1188
1150
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-body", children: [
1189
1151
  tab === "text" ? /* @__PURE__ */ jsxs21(Fragment3, { children: [
1190
1152
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1191
- /* @__PURE__ */ jsx39("label", { children: "Text" }),
1192
- /* @__PURE__ */ jsx39("input", { type: "text", value: text, onChange: (e) => setText(e.target.value), placeholder: "Watermark text" })
1153
+ /* @__PURE__ */ jsx38("label", { children: "Text" }),
1154
+ /* @__PURE__ */ jsx38("input", { type: "text", value: text, onChange: (e) => setText(e.target.value), placeholder: "Watermark text" })
1193
1155
  ] }),
1194
1156
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1195
- /* @__PURE__ */ jsx39("label", { children: "Font" }),
1196
- /* @__PURE__ */ jsx39("select", { value: font, onChange: (e) => setFont(e.target.value), children: FONTS2.map((f) => /* @__PURE__ */ jsx39("option", { value: f.family, children: f.label }, f.family)) })
1157
+ /* @__PURE__ */ jsx38("label", { children: "Font" }),
1158
+ /* @__PURE__ */ jsx38("select", { value: font, onChange: (e) => setFont(e.target.value), children: FONTS2.map((f) => /* @__PURE__ */ jsx38("option", { value: f.family, children: f.label }, f.family)) })
1197
1159
  ] }),
1198
1160
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1199
- /* @__PURE__ */ jsx39("label", { children: "Color" }),
1200
- /* @__PURE__ */ jsx39("div", { className: "wm-panel-colors", children: COLOR_PALETTE2.flat().map((c) => /* @__PURE__ */ jsx39(
1161
+ /* @__PURE__ */ jsx38("label", { children: "Color" }),
1162
+ /* @__PURE__ */ jsx38("div", { className: "wm-panel-colors", children: COLOR_PALETTE2.flat().map((c) => /* @__PURE__ */ jsx38(
1201
1163
  "div",
1202
1164
  {
1203
1165
  className: `wm-panel-color ${color.toLowerCase() === c.toLowerCase() ? "active" : ""}`,
@@ -1209,22 +1171,22 @@ function WatermarkFooterTool() {
1209
1171
  ] })
1210
1172
  ] }) : /* @__PURE__ */ jsxs21(Fragment3, { children: [
1211
1173
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1212
- /* @__PURE__ */ jsx39("label", { children: "Image" }),
1174
+ /* @__PURE__ */ jsx38("label", { children: "Image" }),
1213
1175
  /* @__PURE__ */ jsxs21("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1214
- /* @__PURE__ */ jsx39("button", { className: "wm-panel-upload", onClick: () => fileInputRef.current?.click(), children: "Choose File" }),
1215
- /* @__PURE__ */ jsx39("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: handleFileUpload }),
1216
- imageData && /* @__PURE__ */ jsx39("span", { style: { fontSize: "11px", color: "#667085" }, children: "Loaded" })
1176
+ /* @__PURE__ */ jsx38("button", { className: "wm-panel-upload", onClick: () => fileInputRef.current?.click(), children: "Choose File" }),
1177
+ /* @__PURE__ */ jsx38("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: handleFileUpload }),
1178
+ imageData && /* @__PURE__ */ jsx38("span", { style: { fontSize: "11px", color: "#667085" }, children: "Loaded" })
1217
1179
  ] })
1218
1180
  ] }),
1219
- imageData && /* @__PURE__ */ jsx39("div", { className: "wm-panel-field", children: /* @__PURE__ */ jsx39("div", { className: "wm-panel-preview", children: /* @__PURE__ */ jsx39("img", { src: imageData, alt: "preview", style: { maxWidth: "100%", maxHeight: "48px", objectFit: "contain" } }) }) }),
1181
+ imageData && /* @__PURE__ */ jsx38("div", { className: "wm-panel-field", children: /* @__PURE__ */ jsx38("div", { className: "wm-panel-preview", children: /* @__PURE__ */ jsx38("img", { src: imageData, alt: "preview", style: { maxWidth: "100%", maxHeight: "48px", objectFit: "contain" } }) }) }),
1220
1182
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field-row", children: [
1221
1183
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1222
- /* @__PURE__ */ jsx39("label", { children: "W" }),
1223
- /* @__PURE__ */ jsx39("input", { type: "number", value: imgWidth, min: 10, onChange: (e) => setImgWidth(Number(e.target.value)) })
1184
+ /* @__PURE__ */ jsx38("label", { children: "W" }),
1185
+ /* @__PURE__ */ jsx38("input", { type: "number", value: imgWidth, min: 10, onChange: (e) => setImgWidth(Number(e.target.value)) })
1224
1186
  ] }),
1225
1187
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1226
- /* @__PURE__ */ jsx39("label", { children: "H" }),
1227
- /* @__PURE__ */ jsx39("input", { type: "number", value: imgHeight, min: 10, onChange: (e) => setImgHeight(Number(e.target.value)) })
1188
+ /* @__PURE__ */ jsx38("label", { children: "H" }),
1189
+ /* @__PURE__ */ jsx38("input", { type: "number", value: imgHeight, min: 10, onChange: (e) => setImgHeight(Number(e.target.value)) })
1228
1190
  ] })
1229
1191
  ] })
1230
1192
  ] }),
@@ -1236,7 +1198,7 @@ function WatermarkFooterTool() {
1236
1198
  "%"
1237
1199
  ] })
1238
1200
  ] }),
1239
- /* @__PURE__ */ jsx39("input", { type: "range", min: 0, max: 100, value: opacity, onChange: (e) => setOpacity(Number(e.target.value)), className: "wm-panel-slider" })
1201
+ /* @__PURE__ */ jsx38("input", { type: "range", min: 0, max: 100, value: opacity, onChange: (e) => setOpacity(Number(e.target.value)), className: "wm-panel-slider" })
1240
1202
  ] }),
1241
1203
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1242
1204
  /* @__PURE__ */ jsxs21("label", { children: [
@@ -1246,50 +1208,50 @@ function WatermarkFooterTool() {
1246
1208
  "\xB0"
1247
1209
  ] })
1248
1210
  ] }),
1249
- /* @__PURE__ */ jsx39("input", { type: "range", min: -90, max: 90, value: rotation, onChange: (e) => setRotation(Number(e.target.value)), className: "wm-panel-slider" })
1211
+ /* @__PURE__ */ jsx38("input", { type: "range", min: -90, max: 90, value: rotation, onChange: (e) => setRotation(Number(e.target.value)), className: "wm-panel-slider" })
1250
1212
  ] }),
1251
1213
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1252
- /* @__PURE__ */ jsx39("label", { children: "Position" }),
1214
+ /* @__PURE__ */ jsx38("label", { children: "Position" }),
1253
1215
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-toggle", children: [
1254
- /* @__PURE__ */ jsx39("button", { className: !inFront ? "active" : "", onClick: () => setInFront(false), children: "Behind" }),
1255
- /* @__PURE__ */ jsx39("button", { className: inFront ? "active" : "", onClick: () => setInFront(true), children: "In Front" })
1216
+ /* @__PURE__ */ jsx38("button", { className: !inFront ? "active" : "", onClick: () => setInFront(false), children: "Behind" }),
1217
+ /* @__PURE__ */ jsx38("button", { className: inFront ? "active" : "", onClick: () => setInFront(true), children: "In Front" })
1256
1218
  ] })
1257
1219
  ] })
1258
1220
  ] }),
1259
1221
  /* @__PURE__ */ jsxs21("div", { className: "wm-panel-actions", children: [
1260
- /* @__PURE__ */ jsx39("button", { className: "wm-panel-btn-delete", onClick: handleDelete, children: "Remove" }),
1261
- /* @__PURE__ */ jsx39("button", { className: "wm-panel-btn-apply", onClick: handleApply, children: "Apply" })
1222
+ /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-delete", onClick: handleDelete, children: "Remove" }),
1223
+ /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-apply", onClick: handleApply, children: "Apply" })
1262
1224
  ] })
1263
1225
  ] })
1264
1226
  ] });
1265
1227
  }
1266
1228
 
1267
1229
  // src/EditorFooter.tsx
1268
- import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
1230
+ import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
1269
1231
  function EditorFooter() {
1270
1232
  return /* @__PURE__ */ jsxs22("div", { className: "footer", "editor-component": "footer", children: [
1271
1233
  /* @__PURE__ */ jsxs22("div", { children: [
1272
- /* @__PURE__ */ jsx40(CatalogToggleTool, {}),
1273
- /* @__PURE__ */ jsx40(PageModeTool, {}),
1274
- /* @__PURE__ */ jsx40(FooterStatus, {})
1234
+ /* @__PURE__ */ jsx39(CatalogToggleTool, {}),
1235
+ /* @__PURE__ */ jsx39(PageModeTool, {}),
1236
+ /* @__PURE__ */ jsx39(FooterStatus, {})
1275
1237
  ] }),
1276
- /* @__PURE__ */ jsx40(EditorModeTool, {}),
1238
+ /* @__PURE__ */ jsx39(EditorModeTool, {}),
1277
1239
  /* @__PURE__ */ jsxs22("div", { children: [
1278
- /* @__PURE__ */ jsx40(PageScaleMinusTool, {}),
1279
- /* @__PURE__ */ jsx40(PageScalePercentageTool, {}),
1280
- /* @__PURE__ */ jsx40(PageScaleAddTool, {}),
1281
- /* @__PURE__ */ jsx40(PaperSizeTool, {}),
1282
- /* @__PURE__ */ jsx40(PaperDirectionTool, {}),
1283
- /* @__PURE__ */ jsx40(PaperMarginTool, {}),
1284
- /* @__PURE__ */ jsx40(WatermarkFooterTool, {}),
1285
- /* @__PURE__ */ jsx40(FullscreenTool, {}),
1286
- /* @__PURE__ */ jsx40(EditorOptionTool, {})
1240
+ /* @__PURE__ */ jsx39(PageScaleMinusTool, {}),
1241
+ /* @__PURE__ */ jsx39(PageScalePercentageTool, {}),
1242
+ /* @__PURE__ */ jsx39(PageScaleAddTool, {}),
1243
+ /* @__PURE__ */ jsx39(PaperSizeTool, {}),
1244
+ /* @__PURE__ */ jsx39(PaperDirectionTool, {}),
1245
+ /* @__PURE__ */ jsx39(PaperMarginTool, {}),
1246
+ /* @__PURE__ */ jsx39(WatermarkFooterTool, {}),
1247
+ /* @__PURE__ */ jsx39(FullscreenTool, {}),
1248
+ /* @__PURE__ */ jsx39(EditorOptionTool, {})
1287
1249
  ] })
1288
1250
  ] });
1289
1251
  }
1290
1252
 
1291
1253
  // src/Editor.tsx
1292
- import { jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
1254
+ import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
1293
1255
  function Editor({
1294
1256
  defaultValue,
1295
1257
  options: userOptions,
@@ -1304,7 +1266,7 @@ function Editor({
1304
1266
  style,
1305
1267
  onDrop: userOnDrop
1306
1268
  }) {
1307
- return /* @__PURE__ */ jsx41(FooterProvider, { children: /* @__PURE__ */ jsx41(
1269
+ return /* @__PURE__ */ jsx40(FooterProvider, { children: /* @__PURE__ */ jsx40(
1308
1270
  EditorInner,
1309
1271
  {
1310
1272
  defaultValue,
@@ -1336,9 +1298,9 @@ function EditorInner({
1336
1298
  style,
1337
1299
  onDrop: userOnDrop
1338
1300
  }) {
1339
- const containerRef = useRef5(null);
1340
- const editorRef = useRef5(null);
1341
- const [rangeStyle, setRangeStyle] = useState12(null);
1301
+ const containerRef = useRef4(null);
1302
+ const editorRef = useRef4(null);
1303
+ const [rangeStyle, setRangeStyle] = useState21(null);
1342
1304
  const {
1343
1305
  setPageNoList,
1344
1306
  setPageNo,
@@ -1348,7 +1310,7 @@ function EditorInner({
1348
1310
  setColNo,
1349
1311
  setPageScale
1350
1312
  } = useFooter();
1351
- useEffect5(() => {
1313
+ useEffect4(() => {
1352
1314
  let instance = null;
1353
1315
  const initEditor = async () => {
1354
1316
  if (!containerRef.current) return;
@@ -1485,10 +1447,10 @@ function EditorInner({
1485
1447
  e.dataTransfer.dropEffect = "copy";
1486
1448
  };
1487
1449
  return /* @__PURE__ */ jsxs23(EditorProvider, { editorRef, rangeStyle, children: [
1488
- toolbar && !renderToolbar && /* @__PURE__ */ jsx41(EditorToolbar, {}),
1450
+ toolbar && !renderToolbar && /* @__PURE__ */ jsx40(EditorToolbar, {}),
1489
1451
  renderToolbar,
1490
1452
  children,
1491
- /* @__PURE__ */ jsx41(
1453
+ /* @__PURE__ */ jsx40(
1492
1454
  "div",
1493
1455
  {
1494
1456
  className: className ?? "editor",
@@ -1498,7 +1460,7 @@ function EditorInner({
1498
1460
  onDragOver: handleDragOver
1499
1461
  }
1500
1462
  ),
1501
- footer && !renderFooter && /* @__PURE__ */ jsx41(EditorFooter, {}),
1463
+ footer && !renderFooter && /* @__PURE__ */ jsx40(EditorFooter, {}),
1502
1464
  renderFooter
1503
1465
  ] });
1504
1466
  }