@zeke-02/docx-editor 0.5.3 → 0.5.4
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/{KeyboardShortcutsDialog-5D_FoAp6.d.ts → KeyboardShortcutsDialog-B0UFuR4w.d.ts} +2 -2
- package/dist/{KeyboardShortcutsDialog-D7ihAj18.d.mts → KeyboardShortcutsDialog-t6JKL4Aj.d.mts} +2 -2
- package/dist/PageSetupDialog-642IAVG2.js +1 -1
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -1
- package/dist/PluginHost-HS31VIuo.d.mts +16 -0
- package/dist/PluginHost-zILZO7zX.d.ts +16 -0
- package/dist/{agentApi-D4AZmNfB.d.ts → agentApi-B2Y7kexW.d.ts} +1 -1
- package/dist/{agentApi-C41hiW-n.d.mts → agentApi-BzUJ_kao.d.mts} +1 -1
- package/dist/{chunk-E6MQXELR.js → chunk-HXDMASAR.js} +1 -1
- package/dist/chunk-JFRDFK7V.mjs +260 -0
- package/dist/{chunk-LUJ6HCMH.mjs → chunk-LWOHVYKW.mjs} +1 -1
- package/dist/chunk-MDTA25AN.mjs +60 -0
- package/dist/chunk-NOLMVQNN.mjs +40 -0
- package/dist/chunk-SGTUE33R.js +260 -0
- package/dist/chunk-WO3FIV4B.js +40 -0
- package/dist/{chunk-ONNHQWAX.mjs → chunk-XGJ2EORY.mjs} +1 -1
- package/dist/{chunk-AYMGSTNG.js → chunk-Y3SEHWZ2.js} +1 -1
- package/dist/chunk-YBEVHQCT.js +60 -0
- package/dist/{content-B2MzIMwA.d.mts → content-REFGFfEH.d.mts} +1 -1
- package/dist/{content-B2MzIMwA.d.ts → content-REFGFfEH.d.ts} +1 -1
- package/dist/dialogs.d.mts +4 -4
- package/dist/dialogs.d.ts +4 -4
- package/dist/dialogs.js +1 -1
- package/dist/dialogs.mjs +1 -1
- package/dist/{document-Di1qGqLS.d.mts → document-Cu2vq_wS.d.mts} +1 -1
- package/dist/{document-DZ_ZeZEH.d.ts → document-CxOagoLQ.d.ts} +1 -1
- package/dist/executor-WBHID2RK.mjs +1 -0
- package/dist/{executor-EPEB53SJ.js → executor-Y5VUOAHY.js} +1 -1
- package/dist/{findReplace-pkMskVJU.d.ts → findReplace-Bue0JaXh.d.ts} +1 -1
- package/dist/{findReplace-CpIoILbP.d.mts → findReplace-shXbOjFQ.d.mts} +1 -1
- package/dist/fork.css +1 -0
- package/dist/fork.d.mts +535 -0
- package/dist/fork.d.ts +535 -0
- package/dist/fork.js +1 -0
- package/dist/fork.mjs +1 -0
- package/dist/hooks.d.mts +6 -6
- package/dist/hooks.d.ts +6 -6
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index-B5A-J9GC.d.ts +1119 -0
- package/dist/index-bw-PaozF.d.mts +1119 -0
- package/dist/index.d.mts +11 -1120
- package/dist/index.d.ts +11 -1120
- package/dist/index.js +1 -40
- package/dist/index.mjs +1 -40
- package/dist/plugin-api.d.mts +5 -16
- package/dist/plugin-api.d.ts +5 -16
- package/dist/plugin-api.js +1 -260
- package/dist/plugin-api.mjs +1 -260
- package/dist/{types-DZUhB7Ao.d.mts → types-BF48VxkC.d.mts} +1 -1
- package/dist/{types-DZUhB7Ao.d.ts → types-BF48VxkC.d.ts} +1 -1
- package/dist/{types-Bd_YzkhG.d.mts → types-BnIs4sE7.d.mts} +1 -1
- package/dist/{types-Bd_YzkhG.d.ts → types-BnIs4sE7.d.ts} +1 -1
- package/dist/{types-DcxHFUSc.d.ts → types-CW6HFAX6.d.ts} +1 -1
- package/dist/{types-CkfDgB0O.d.mts → types-DIsDCwTG.d.mts} +1 -1
- package/dist/ui.d.mts +9 -9
- package/dist/ui.d.ts +9 -9
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/dist/{useFindReplace-eyhMSZZf.d.ts → useFindReplace-DKy-s3gS.d.ts} +2 -2
- package/dist/{useFindReplace-DDs533b-.d.mts → useFindReplace-vuoKpDKE.d.mts} +2 -2
- package/package.json +7 -7
- package/dist/chunk-47VJOBJD.mjs +0 -60
- package/dist/chunk-IP5NAYHL.js +0 -60
- package/dist/executor-TVJ6K6MW.mjs +0 -1
|
@@ -15,4 +15,4 @@ type DotPath<T, Prefix extends string = ''> = {
|
|
|
15
15
|
}[keyof T & string];
|
|
16
16
|
type TranslationKey = DotPath<LocaleStrings>;
|
|
17
17
|
|
|
18
|
-
export type { LocaleStrings as L, PartialLocaleStrings as P,
|
|
18
|
+
export type { LocaleStrings as L, PartialLocaleStrings as P, TranslationKey as T, Translations as a };
|
|
@@ -278,4 +278,4 @@ interface PluginHostRef {
|
|
|
278
278
|
refreshPluginStates: () => void;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export type { EditorPlugin as E,
|
|
281
|
+
export type { EditorPlugin as E, PositionCoordinates as P, RenderedDomContext as R, SidebarItem as S, ReactSidebarItem as a, ReactEditorPlugin as b, PanelConfig as c, PluginContext as d, PluginHostProps as e, PluginHostRef as f, PluginPanelProps as g, SidebarItemContext as h, SidebarItemRenderProps as i };
|
|
@@ -278,4 +278,4 @@ interface PluginHostRef {
|
|
|
278
278
|
refreshPluginStates: () => void;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export type { EditorPlugin as E,
|
|
281
|
+
export type { EditorPlugin as E, PositionCoordinates as P, RenderedDomContext as R, SidebarItem as S, ReactSidebarItem as a, ReactEditorPlugin as b, PanelConfig as c, PluginContext as d, PluginHostProps as e, PluginHostRef as f, PluginPanelProps as g, SidebarItemContext as h, SidebarItemRenderProps as i };
|
package/dist/ui.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { a as ParagraphAlignment,
|
|
4
|
-
import { S as Style, T as Theme, a as StyleType, D as Document } from './document-
|
|
5
|
-
import { F as FontOption, c as SelectionContext, d as AIAction, e as AgentResponse } from './agentApi-
|
|
6
|
-
export { f as PrintButton, g as PrintButtonProps, b as PrintOptions, h as PrintStyles, i as formatPrintPageRange, j as getDefaultPrintOptions, k as isPrintSupported, o as openPrintWindow, p as parsePageRange, t as triggerPrint } from './agentApi-
|
|
7
|
-
import { T as TableAction } from './useFindReplace-
|
|
8
|
-
export { F as FindReplaceOptions, a as FindReplaceState, b as TableContext, c as TableSelection, d as TableSplitConfig, e as TableToolbar, f as TableToolbarProps, U as UseFindReplaceReturn, g as addColumn, h as addRow, i as createTableContext, j as deleteColumn, k as deleteRow, l as getCellAt, m as getColumnCount, n as getTableSplitCellDialogConfig, o as mergeCells, s as splitCell, p as splitTableCell, u as useFindReplace } from './useFindReplace-
|
|
9
|
-
import {
|
|
10
|
-
export { K as DialogKeyboardShortcut, F as FindReplaceDialog, a as FindReplaceDialogProps, H as HyperlinkData, b as HyperlinkDialog, c as HyperlinkDialogProps, d as KeyboardShortcutsDialog, e as KeyboardShortcutsDialogProps, P as PasteOption, f as PasteSpecialDialog, g as PasteSpecialDialogProps, S as ShortcutCategory, U as UseKeyboardShortcutsDialogOptions, h as UseKeyboardShortcutsDialogReturn, i as UsePasteSpecialOptions, j as UsePasteSpecialReturn, k as formatShortcutKeys, l as getAllCategories, m as getAllPasteOptions, n as getCategoryLabel, o as getCommonShortcuts, p as getDefaultPasteOption, q as getDefaultShortcuts, r as getPasteOption, s as getShortcutsByCategory, t as isPasteSpecialShortcut, u as useHyperlinkDialog, v as useKeyboardShortcutsDialog, w as usePasteSpecial } from './KeyboardShortcutsDialog-
|
|
11
|
-
export { F as FindMatch, a as FindOptions, b as FindResult, H as HighlightOptions, c as createDefaultFindOptions, d as createSearchPattern, e as escapeRegexString, f as findAllMatches, g as findInDocument, h as findInParagraph, i as getDefaultHighlightOptions, j as getMatchCountText, k as isEmptySearch, r as replaceAllInContent, l as replaceFirstInContent, s as scrollToMatch } from './findReplace-
|
|
3
|
+
import { a as ParagraphAlignment, d as ColorValue, S as SectionProperties, e as TabStop } from './content-REFGFfEH.mjs';
|
|
4
|
+
import { S as Style, T as Theme, a as StyleType, D as Document } from './document-Cu2vq_wS.mjs';
|
|
5
|
+
import { F as FontOption, c as SelectionContext, d as AIAction, e as AgentResponse } from './agentApi-BzUJ_kao.mjs';
|
|
6
|
+
export { f as PrintButton, g as PrintButtonProps, b as PrintOptions, h as PrintStyles, i as formatPrintPageRange, j as getDefaultPrintOptions, k as isPrintSupported, o as openPrintWindow, p as parsePageRange, t as triggerPrint } from './agentApi-BzUJ_kao.mjs';
|
|
7
|
+
import { T as TableAction } from './useFindReplace-vuoKpDKE.mjs';
|
|
8
|
+
export { F as FindReplaceOptions, a as FindReplaceState, b as TableContext, c as TableSelection, d as TableSplitConfig, e as TableToolbar, f as TableToolbarProps, U as UseFindReplaceReturn, g as addColumn, h as addRow, i as createTableContext, j as deleteColumn, k as deleteRow, l as getCellAt, m as getColumnCount, n as getTableSplitCellDialogConfig, o as mergeCells, s as splitCell, p as splitTableCell, u as useFindReplace } from './useFindReplace-vuoKpDKE.mjs';
|
|
9
|
+
import { T as TranslationKey } from './types-BF48VxkC.mjs';
|
|
10
|
+
export { K as DialogKeyboardShortcut, F as FindReplaceDialog, a as FindReplaceDialogProps, H as HyperlinkData, b as HyperlinkDialog, c as HyperlinkDialogProps, d as KeyboardShortcutsDialog, e as KeyboardShortcutsDialogProps, P as PasteOption, f as PasteSpecialDialog, g as PasteSpecialDialogProps, S as ShortcutCategory, U as UseKeyboardShortcutsDialogOptions, h as UseKeyboardShortcutsDialogReturn, i as UsePasteSpecialOptions, j as UsePasteSpecialReturn, k as formatShortcutKeys, l as getAllCategories, m as getAllPasteOptions, n as getCategoryLabel, o as getCommonShortcuts, p as getDefaultPasteOption, q as getDefaultShortcuts, r as getPasteOption, s as getShortcutsByCategory, t as isPasteSpecialShortcut, u as useHyperlinkDialog, v as useKeyboardShortcutsDialog, w as usePasteSpecial } from './KeyboardShortcutsDialog-t6JKL4Aj.mjs';
|
|
11
|
+
export { F as FindMatch, a as FindOptions, b as FindResult, H as HighlightOptions, c as createDefaultFindOptions, d as createSearchPattern, e as escapeRegexString, f as findAllMatches, g as findInDocument, h as findInParagraph, i as getDefaultHighlightOptions, j as getMatchCountText, k as isEmptySearch, r as replaceAllInContent, l as replaceFirstInContent, s as scrollToMatch } from './findReplace-shXbOjFQ.mjs';
|
|
12
12
|
import '@eigenpal/docx-editor-i18n/en.json';
|
|
13
13
|
|
|
14
14
|
interface FontPickerProps {
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { a as ParagraphAlignment,
|
|
4
|
-
import { S as Style, T as Theme, a as StyleType, D as Document } from './document-
|
|
5
|
-
import { F as FontOption, c as SelectionContext, d as AIAction, e as AgentResponse } from './agentApi-
|
|
6
|
-
export { f as PrintButton, g as PrintButtonProps, b as PrintOptions, h as PrintStyles, i as formatPrintPageRange, j as getDefaultPrintOptions, k as isPrintSupported, o as openPrintWindow, p as parsePageRange, t as triggerPrint } from './agentApi-
|
|
7
|
-
import { T as TableAction } from './useFindReplace-
|
|
8
|
-
export { F as FindReplaceOptions, a as FindReplaceState, b as TableContext, c as TableSelection, d as TableSplitConfig, e as TableToolbar, f as TableToolbarProps, U as UseFindReplaceReturn, g as addColumn, h as addRow, i as createTableContext, j as deleteColumn, k as deleteRow, l as getCellAt, m as getColumnCount, n as getTableSplitCellDialogConfig, o as mergeCells, s as splitCell, p as splitTableCell, u as useFindReplace } from './useFindReplace-
|
|
9
|
-
import {
|
|
10
|
-
export { K as DialogKeyboardShortcut, F as FindReplaceDialog, a as FindReplaceDialogProps, H as HyperlinkData, b as HyperlinkDialog, c as HyperlinkDialogProps, d as KeyboardShortcutsDialog, e as KeyboardShortcutsDialogProps, P as PasteOption, f as PasteSpecialDialog, g as PasteSpecialDialogProps, S as ShortcutCategory, U as UseKeyboardShortcutsDialogOptions, h as UseKeyboardShortcutsDialogReturn, i as UsePasteSpecialOptions, j as UsePasteSpecialReturn, k as formatShortcutKeys, l as getAllCategories, m as getAllPasteOptions, n as getCategoryLabel, o as getCommonShortcuts, p as getDefaultPasteOption, q as getDefaultShortcuts, r as getPasteOption, s as getShortcutsByCategory, t as isPasteSpecialShortcut, u as useHyperlinkDialog, v as useKeyboardShortcutsDialog, w as usePasteSpecial } from './KeyboardShortcutsDialog-
|
|
11
|
-
export { F as FindMatch, a as FindOptions, b as FindResult, H as HighlightOptions, c as createDefaultFindOptions, d as createSearchPattern, e as escapeRegexString, f as findAllMatches, g as findInDocument, h as findInParagraph, i as getDefaultHighlightOptions, j as getMatchCountText, k as isEmptySearch, r as replaceAllInContent, l as replaceFirstInContent, s as scrollToMatch } from './findReplace-
|
|
3
|
+
import { a as ParagraphAlignment, d as ColorValue, S as SectionProperties, e as TabStop } from './content-REFGFfEH.js';
|
|
4
|
+
import { S as Style, T as Theme, a as StyleType, D as Document } from './document-CxOagoLQ.js';
|
|
5
|
+
import { F as FontOption, c as SelectionContext, d as AIAction, e as AgentResponse } from './agentApi-B2Y7kexW.js';
|
|
6
|
+
export { f as PrintButton, g as PrintButtonProps, b as PrintOptions, h as PrintStyles, i as formatPrintPageRange, j as getDefaultPrintOptions, k as isPrintSupported, o as openPrintWindow, p as parsePageRange, t as triggerPrint } from './agentApi-B2Y7kexW.js';
|
|
7
|
+
import { T as TableAction } from './useFindReplace-DKy-s3gS.js';
|
|
8
|
+
export { F as FindReplaceOptions, a as FindReplaceState, b as TableContext, c as TableSelection, d as TableSplitConfig, e as TableToolbar, f as TableToolbarProps, U as UseFindReplaceReturn, g as addColumn, h as addRow, i as createTableContext, j as deleteColumn, k as deleteRow, l as getCellAt, m as getColumnCount, n as getTableSplitCellDialogConfig, o as mergeCells, s as splitCell, p as splitTableCell, u as useFindReplace } from './useFindReplace-DKy-s3gS.js';
|
|
9
|
+
import { T as TranslationKey } from './types-BF48VxkC.js';
|
|
10
|
+
export { K as DialogKeyboardShortcut, F as FindReplaceDialog, a as FindReplaceDialogProps, H as HyperlinkData, b as HyperlinkDialog, c as HyperlinkDialogProps, d as KeyboardShortcutsDialog, e as KeyboardShortcutsDialogProps, P as PasteOption, f as PasteSpecialDialog, g as PasteSpecialDialogProps, S as ShortcutCategory, U as UseKeyboardShortcutsDialogOptions, h as UseKeyboardShortcutsDialogReturn, i as UsePasteSpecialOptions, j as UsePasteSpecialReturn, k as formatShortcutKeys, l as getAllCategories, m as getAllPasteOptions, n as getCategoryLabel, o as getCommonShortcuts, p as getDefaultPasteOption, q as getDefaultShortcuts, r as getPasteOption, s as getShortcutsByCategory, t as isPasteSpecialShortcut, u as useHyperlinkDialog, v as useKeyboardShortcutsDialog, w as usePasteSpecial } from './KeyboardShortcutsDialog-B0UFuR4w.js';
|
|
11
|
+
export { F as FindMatch, a as FindOptions, b as FindResult, H as HighlightOptions, c as createDefaultFindOptions, d as createSearchPattern, e as escapeRegexString, f as findAllMatches, g as findInDocument, h as findInParagraph, i as getDefaultHighlightOptions, j as getMatchCountText, k as isEmptySearch, r as replaceAllInContent, l as replaceFirstInContent, s as scrollToMatch } from './findReplace-Bue0JaXh.js';
|
|
12
12
|
import '@eigenpal/docx-editor-i18n/en.json';
|
|
13
13
|
|
|
14
14
|
interface FontPickerProps {
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkAW5TISUL_js=require('./chunk-AW5TISUL.js'),chunkD47GTKGU_js=require('./chunk-D47GTKGU.js'),chunkTYPGB4KF_js=require('./chunk-TYPGB4KF.js'),chunkSNZ57XBI_js=require('./chunk-SNZ57XBI.js'),chunkNIBCC7WQ_js=require('./chunk-NIBCC7WQ.js'),chunkBRMTZRLJ_js=require('./chunk-BRMTZRLJ.js');require('./chunk-MKNSJOCN.js');var chunk35DG3R42_js=require('./chunk-35DG3R42.js'),chunkNLFXR2VH_js=require('./chunk-NLFXR2VH.js');require('./chunk-GGQK26JO.js'),require('./chunk-ZXPCJWVY.js'),require('./chunk-ESZ6JRTW.js'),require('./chunk-ILYKDR3C.js'),require('./chunk-H5NTJZO4.js');var nn=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var nn__default=/*#__PURE__*/_interopDefault(nn);var No={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},zo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Wo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Yo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Uo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Fo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Vo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),$o=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ho=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),Ko=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function jo(e){switch(e){case "askAI":return jsxRuntime.jsx(zo,{});case "rewrite":return jsxRuntime.jsx(Wo,{});case "expand":return jsxRuntime.jsx(Yo,{});case "summarize":return jsxRuntime.jsx(Uo,{});case "translate":return jsxRuntime.jsx(Fo,{});case "explain":return jsxRuntime.jsx(Vo,{});case "fixGrammar":return jsxRuntime.jsx($o,{});case "makeFormal":return jsxRuntime.jsx(Go,{});case "makeCasual":return jsxRuntime.jsx(Ho,{});case "custom":return jsxRuntime.jsx(Ko,{});default:return null}}var Zo=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:r}=chunkNLFXR2VH_js.c(),n=r(No[e]),s=chunkAW5TISUL_js.y(e),a=jo(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:n})]})},Xo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[r,n]=nn.useState(""),s=nn.useRef(null),{t:a}=chunkNLFXR2VH_js.c();nn.useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=p=>{p.preventDefault(),r.trim()&&(t(r.trim()),n(""));},c=p=>{p.key==="Escape"&&o();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:l,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:s,type:"text",value:r,onChange:p=>n(p.target.value),onKeyDown:c,placeholder:a("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:a("common.send")})]})]})}):null},Qo=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:r,onClose:n,actions:s=chunkAW5TISUL_js.z,showCustomPrompt:a=true,className:l=""})=>{let c=nn.useRef(null),[p,g]=nn.useState(0),[d,m]=nn.useState(false),{t:x}=chunkNLFXR2VH_js.c(),b=a?[...s,"custom"]:s;nn.useEffect(()=>{if(!e)return;let u=h=>{c.current&&!c.current.contains(h.target)&&n();};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,n]),nn.useEffect(()=>{if(!e)return;let u=h=>{switch(h.key){case "Escape":d?m(false):n();break;case "ArrowDown":h.preventDefault(),g(P=>(P+1)%b.length);break;case "ArrowUp":h.preventDefault(),g(P=>(P-1+b.length)%b.length);break;case "Enter":h.preventDefault();let I=b[p];I==="custom"?m(true):(r(I),n());break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,p,b,r,n,d]),nn.useEffect(()=>{e&&(g(0),m(false));},[e]);let f=nn.useCallback(()=>{let h=b.length*36+16,I=t.x,P=t.y;return typeof window<"u"&&(I+200>window.innerWidth&&(I=window.innerWidth-200-10),P+h>window.innerHeight&&(P=window.innerHeight-h-10),I<10&&(I=10),P<10&&(P=10)),{position:"fixed",top:P,left:I,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:chunkAW5TISUL_js.F.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,b.length]),k=u=>{u==="custom"?m(true):(r(u),n());},T=u=>{r("custom",u),n();};return !e||!o?null:jsxRuntime.jsxs("div",{ref:c,className:`docx-context-menu ${l}`,style:f(),role:"menu","aria-label":x("contextMenu.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:b.map((u,h)=>jsxRuntime.jsx(Zo,{action:u,onClick:()=>k(u),isHighlighted:h===p,onMouseEnter:()=>g(h)},u))}),a&&jsxRuntime.jsx(Xo,{isOpen:d,onSubmit:T,onClose:()=>m(false),selectedText:o})]})};function Jo(){let[e,t]=nn.useState(false),[o,i]=nn.useState({x:0,y:0}),[r,n]=nn.useState(""),[s,a]=nn.useState(),l=nn.useCallback((p,g,d)=>{p.preventDefault(),i({x:p.clientX,y:p.clientY}),n(g),a(d),t(true);},[]),c=nn.useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:s,openMenu:l,closeMenu:c}}function qo(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function er(e,t,o){return !(!t||t.trim().length===0)}function tr(){return [...chunkAW5TISUL_js.z]}function or(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var rr=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),nr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ir=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sr=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var chunkAW5TISUL_js=require('./chunk-AW5TISUL.js'),chunkD47GTKGU_js=require('./chunk-D47GTKGU.js'),chunkTYPGB4KF_js=require('./chunk-TYPGB4KF.js'),chunkSNZ57XBI_js=require('./chunk-SNZ57XBI.js'),chunkNIBCC7WQ_js=require('./chunk-NIBCC7WQ.js'),chunkBRMTZRLJ_js=require('./chunk-BRMTZRLJ.js');require('./chunk-MKNSJOCN.js');var chunk35DG3R42_js=require('./chunk-35DG3R42.js'),chunkNLFXR2VH_js=require('./chunk-NLFXR2VH.js');require('./chunk-GGQK26JO.js'),require('./chunk-ZXPCJWVY.js'),require('./chunk-ILYKDR3C.js'),require('./chunk-ESZ6JRTW.js'),require('./chunk-H5NTJZO4.js');var nn=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var nn__default=/*#__PURE__*/_interopDefault(nn);var No={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},zo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Wo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Yo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Uo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Fo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Vo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),$o=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ho=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),Ko=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function jo(e){switch(e){case "askAI":return jsxRuntime.jsx(zo,{});case "rewrite":return jsxRuntime.jsx(Wo,{});case "expand":return jsxRuntime.jsx(Yo,{});case "summarize":return jsxRuntime.jsx(Uo,{});case "translate":return jsxRuntime.jsx(Fo,{});case "explain":return jsxRuntime.jsx(Vo,{});case "fixGrammar":return jsxRuntime.jsx($o,{});case "makeFormal":return jsxRuntime.jsx(Go,{});case "makeCasual":return jsxRuntime.jsx(Ho,{});case "custom":return jsxRuntime.jsx(Ko,{});default:return null}}var Zo=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:r}=chunkNLFXR2VH_js.c(),n=r(No[e]),s=chunkAW5TISUL_js.y(e),a=jo(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:n})]})},Xo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[r,n]=nn.useState(""),s=nn.useRef(null),{t:a}=chunkNLFXR2VH_js.c();nn.useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=p=>{p.preventDefault(),r.trim()&&(t(r.trim()),n(""));},c=p=>{p.key==="Escape"&&o();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:l,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:s,type:"text",value:r,onChange:p=>n(p.target.value),onKeyDown:c,placeholder:a("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:a("common.send")})]})]})}):null},Qo=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:r,onClose:n,actions:s=chunkAW5TISUL_js.z,showCustomPrompt:a=true,className:l=""})=>{let c=nn.useRef(null),[p,g]=nn.useState(0),[d,m]=nn.useState(false),{t:x}=chunkNLFXR2VH_js.c(),b=a?[...s,"custom"]:s;nn.useEffect(()=>{if(!e)return;let u=h=>{c.current&&!c.current.contains(h.target)&&n();};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,n]),nn.useEffect(()=>{if(!e)return;let u=h=>{switch(h.key){case "Escape":d?m(false):n();break;case "ArrowDown":h.preventDefault(),g(P=>(P+1)%b.length);break;case "ArrowUp":h.preventDefault(),g(P=>(P-1+b.length)%b.length);break;case "Enter":h.preventDefault();let I=b[p];I==="custom"?m(true):(r(I),n());break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,p,b,r,n,d]),nn.useEffect(()=>{e&&(g(0),m(false));},[e]);let f=nn.useCallback(()=>{let h=b.length*36+16,I=t.x,P=t.y;return typeof window<"u"&&(I+200>window.innerWidth&&(I=window.innerWidth-200-10),P+h>window.innerHeight&&(P=window.innerHeight-h-10),I<10&&(I=10),P<10&&(P=10)),{position:"fixed",top:P,left:I,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:chunkAW5TISUL_js.F.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,b.length]),k=u=>{u==="custom"?m(true):(r(u),n());},T=u=>{r("custom",u),n();};return !e||!o?null:jsxRuntime.jsxs("div",{ref:c,className:`docx-context-menu ${l}`,style:f(),role:"menu","aria-label":x("contextMenu.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:b.map((u,h)=>jsxRuntime.jsx(Zo,{action:u,onClick:()=>k(u),isHighlighted:h===p,onMouseEnter:()=>g(h)},u))}),a&&jsxRuntime.jsx(Xo,{isOpen:d,onSubmit:T,onClose:()=>m(false),selectedText:o})]})};function Jo(){let[e,t]=nn.useState(false),[o,i]=nn.useState({x:0,y:0}),[r,n]=nn.useState(""),[s,a]=nn.useState(),l=nn.useCallback((p,g,d)=>{p.preventDefault(),i({x:p.clientX,y:p.clientY}),n(g),a(d),t(true);},[]),c=nn.useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:s,openMenu:l,closeMenu:c}}function qo(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function er(e,t,o){return !(!t||t.trim().length===0)}function tr(){return [...chunkAW5TISUL_js.z]}function or(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var rr=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),nr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ir=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sr=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
package/dist/ui.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {z,F,x,c as c$1,b,a,y}from'./chunk-ZVAFVHWR.mjs';export{g as AlignmentButtons,f as ColorPicker,w as EditorToolbar,d as FontPicker,e as FontSizePicker,A as HorizontalRuler,j as LineSpacingPicker,i as ListButtons,k as StylePicker,n as TableBorderColorPicker,m as TableBorderPicker,o as TableBorderWidthPicker,p as TableCellFillPicker,q as TableMoreDropdown,G as TextContextMenu,v as Toolbar,s as ToolbarButton,t as ToolbarGroup,u as ToolbarSeparator,l as ZoomControl,h as createDefaultListState,K as getDefaultTextContextMenuItems,D as getMarginInUnits,C as getRulerDimensions,I as getTextActionLabel,J as getTextActionShortcut,L as isTextActionAvailable,E as parseMarginFromUnits,B as positionToMargin,H as useTextContextMenu}from'./chunk-ZVAFVHWR.mjs';export{g as KeyboardShortcutsDialog,a as PasteSpecialDialog,n as formatShortcutKeys,m as getAllCategories,d as getAllPasteOptions,l as getCategoryLabel,k as getCommonShortcuts,e as getDefaultPasteOption,i as getDefaultShortcuts,c as getPasteOption,j as getShortcutsByCategory,f as isPasteSpecialShortcut,h as useKeyboardShortcutsDialog,b as usePasteSpecial}from'./chunk-KRLNX56Y.mjs';export{a as FindReplaceDialog}from'./chunk-JPF5R2ZM.mjs';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-WPI3YRFO.mjs';import {a as a$1}from'./chunk-GM2S2WMT.mjs';import {b as b$1}from'./chunk-U7ZW2DOO.mjs';export{d as TableToolbar,l as addColumn,j as addRow,e as createTableContext,m as deleteColumn,k as deleteRow,g as getCellAt,f as getColumnCount,h as getTableSplitCellDialogConfig,n as mergeCells,o as splitCell,i as splitTableCell}from'./chunk-U7ZW2DOO.mjs';import'./chunk-RCIZ7OM3.mjs';export{a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch,m as useFindReplace}from'./chunk-F5SERL7X.mjs';import {c}from'./chunk-7QQSDIWK.mjs';import'./chunk-B7CCL7SL.mjs';import'./chunk-ONIYA2FU.mjs';import'./chunk-TZMMD6RR.mjs';import'./chunk-FWPVBFKQ.mjs';import'./chunk-TAUMSKRE.mjs';import nn,{useRef,useState,useEffect,useCallback,useLayoutEffect,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var No={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},zo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Wo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Yo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Uo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Fo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Vo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),$o=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ho=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),Ko=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function jo(e){switch(e){case "askAI":return jsx(zo,{});case "rewrite":return jsx(Wo,{});case "expand":return jsx(Yo,{});case "summarize":return jsx(Uo,{});case "translate":return jsx(Fo,{});case "explain":return jsx(Vo,{});case "fixGrammar":return jsx($o,{});case "makeFormal":return jsx(Go,{});case "makeCasual":return jsx(Ho,{});case "custom":return jsx(Ko,{});default:return null}}var Zo=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:r}=c(),n=r(No[e]),s=y(e),a=jo(e);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsx("span",{children:n})]})},Xo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[r,n]=useState(""),s=useRef(null),{t:a}=c();useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=p=>{p.preventDefault(),r.trim()&&(t(r.trim()),n(""));},c$1=p=>{p.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:l,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsx("input",{ref:s,type:"text",value:r,onChange:p=>n(p.target.value),onKeyDown:c$1,placeholder:a("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:a("common.cancel")}),jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:a("common.send")})]})]})}):null},Qo=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:r,onClose:n,actions:s=z,showCustomPrompt:a=true,className:l=""})=>{let c$1=useRef(null),[p,g]=useState(0),[d,m]=useState(false),{t:x}=c(),b=a?[...s,"custom"]:s;useEffect(()=>{if(!e)return;let u=h=>{c$1.current&&!c$1.current.contains(h.target)&&n();};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,n]),useEffect(()=>{if(!e)return;let u=h=>{switch(h.key){case "Escape":d?m(false):n();break;case "ArrowDown":h.preventDefault(),g(P=>(P+1)%b.length);break;case "ArrowUp":h.preventDefault(),g(P=>(P-1+b.length)%b.length);break;case "Enter":h.preventDefault();let I=b[p];I==="custom"?m(true):(r(I),n());break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,p,b,r,n,d]),useEffect(()=>{e&&(g(0),m(false));},[e]);let f=useCallback(()=>{let h=b.length*36+16,I=t.x,P=t.y;return typeof window<"u"&&(I+200>window.innerWidth&&(I=window.innerWidth-200-10),P+h>window.innerHeight&&(P=window.innerHeight-h-10),I<10&&(I=10),P<10&&(P=10)),{position:"fixed",top:P,left:I,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:F.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,b.length]),k=u=>{u==="custom"?m(true):(r(u),n());},T=u=>{r("custom",u),n();};return !e||!o?null:jsxs("div",{ref:c$1,className:`docx-context-menu ${l}`,style:f(),role:"menu","aria-label":x("contextMenu.ariaLabel"),children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:b.map((u,h)=>jsx(Zo,{action:u,onClick:()=>k(u),isHighlighted:h===p,onMouseEnter:()=>g(h)},u))}),a&&jsx(Xo,{isOpen:d,onSubmit:T,onClose:()=>m(false),selectedText:o})]})};function Jo(){let[e,t]=useState(false),[o,i]=useState({x:0,y:0}),[r,n]=useState(""),[s,a]=useState(),l=useCallback((p,g,d)=>{p.preventDefault(),i({x:p.clientX,y:p.clientY}),n(g),a(d),t(true);},[]),c=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:s,openMenu:l,closeMenu:c}}function qo(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function er(e,t,o){return !(!t||t.trim().length===0)}function tr(){return [...z]}function or(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var rr=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),nr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ir=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sr=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
|
|
1
|
+
import {z,F,x,c as c$1,b,a,y}from'./chunk-ZVAFVHWR.mjs';export{g as AlignmentButtons,f as ColorPicker,w as EditorToolbar,d as FontPicker,e as FontSizePicker,A as HorizontalRuler,j as LineSpacingPicker,i as ListButtons,k as StylePicker,n as TableBorderColorPicker,m as TableBorderPicker,o as TableBorderWidthPicker,p as TableCellFillPicker,q as TableMoreDropdown,G as TextContextMenu,v as Toolbar,s as ToolbarButton,t as ToolbarGroup,u as ToolbarSeparator,l as ZoomControl,h as createDefaultListState,K as getDefaultTextContextMenuItems,D as getMarginInUnits,C as getRulerDimensions,I as getTextActionLabel,J as getTextActionShortcut,L as isTextActionAvailable,E as parseMarginFromUnits,B as positionToMargin,H as useTextContextMenu}from'./chunk-ZVAFVHWR.mjs';export{g as KeyboardShortcutsDialog,a as PasteSpecialDialog,n as formatShortcutKeys,m as getAllCategories,d as getAllPasteOptions,l as getCategoryLabel,k as getCommonShortcuts,e as getDefaultPasteOption,i as getDefaultShortcuts,c as getPasteOption,j as getShortcutsByCategory,f as isPasteSpecialShortcut,h as useKeyboardShortcutsDialog,b as usePasteSpecial}from'./chunk-KRLNX56Y.mjs';export{a as FindReplaceDialog}from'./chunk-JPF5R2ZM.mjs';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-WPI3YRFO.mjs';import {a as a$1}from'./chunk-GM2S2WMT.mjs';import {b as b$1}from'./chunk-U7ZW2DOO.mjs';export{d as TableToolbar,l as addColumn,j as addRow,e as createTableContext,m as deleteColumn,k as deleteRow,g as getCellAt,f as getColumnCount,h as getTableSplitCellDialogConfig,n as mergeCells,o as splitCell,i as splitTableCell}from'./chunk-U7ZW2DOO.mjs';import'./chunk-RCIZ7OM3.mjs';export{a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch,m as useFindReplace}from'./chunk-F5SERL7X.mjs';import {c}from'./chunk-7QQSDIWK.mjs';import'./chunk-B7CCL7SL.mjs';import'./chunk-ONIYA2FU.mjs';import'./chunk-FWPVBFKQ.mjs';import'./chunk-TZMMD6RR.mjs';import'./chunk-TAUMSKRE.mjs';import nn,{useRef,useState,useEffect,useCallback,useLayoutEffect,useMemo}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var No={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},zo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Wo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Yo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Uo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Fo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Vo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),$o=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Ho=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),Ko=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function jo(e){switch(e){case "askAI":return jsx(zo,{});case "rewrite":return jsx(Wo,{});case "expand":return jsx(Yo,{});case "summarize":return jsx(Uo,{});case "translate":return jsx(Fo,{});case "explain":return jsx(Vo,{});case "fixGrammar":return jsx($o,{});case "makeFormal":return jsx(Go,{});case "makeCasual":return jsx(Ho,{});case "custom":return jsx(Ko,{});default:return null}}var Zo=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:r}=c(),n=r(No[e]),s=y(e),a=jo(e);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsx("span",{children:n})]})},Xo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[r,n]=useState(""),s=useRef(null),{t:a}=c();useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=p=>{p.preventDefault(),r.trim()&&(t(r.trim()),n(""));},c$1=p=>{p.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:l,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsx("input",{ref:s,type:"text",value:r,onChange:p=>n(p.target.value),onKeyDown:c$1,placeholder:a("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:a("common.cancel")}),jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:a("common.send")})]})]})}):null},Qo=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:r,onClose:n,actions:s=z,showCustomPrompt:a=true,className:l=""})=>{let c$1=useRef(null),[p,g]=useState(0),[d,m]=useState(false),{t:x}=c(),b=a?[...s,"custom"]:s;useEffect(()=>{if(!e)return;let u=h=>{c$1.current&&!c$1.current.contains(h.target)&&n();};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,n]),useEffect(()=>{if(!e)return;let u=h=>{switch(h.key){case "Escape":d?m(false):n();break;case "ArrowDown":h.preventDefault(),g(P=>(P+1)%b.length);break;case "ArrowUp":h.preventDefault(),g(P=>(P-1+b.length)%b.length);break;case "Enter":h.preventDefault();let I=b[p];I==="custom"?m(true):(r(I),n());break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,p,b,r,n,d]),useEffect(()=>{e&&(g(0),m(false));},[e]);let f=useCallback(()=>{let h=b.length*36+16,I=t.x,P=t.y;return typeof window<"u"&&(I+200>window.innerWidth&&(I=window.innerWidth-200-10),P+h>window.innerHeight&&(P=window.innerHeight-h-10),I<10&&(I=10),P<10&&(P=10)),{position:"fixed",top:P,left:I,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:F.contextMenu,padding:"4px 0",overflow:"hidden"}},[t,b.length]),k=u=>{u==="custom"?m(true):(r(u),n());},T=u=>{r("custom",u),n();};return !e||!o?null:jsxs("div",{ref:c$1,className:`docx-context-menu ${l}`,style:f(),role:"menu","aria-label":x("contextMenu.ariaLabel"),children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:b.map((u,h)=>jsx(Zo,{action:u,onClick:()=>k(u),isHighlighted:h===p,onMouseEnter:()=>g(h)},u))}),a&&jsx(Xo,{isOpen:d,onSubmit:T,onClose:()=>m(false),selectedText:o})]})};function Jo(){let[e,t]=useState(false),[o,i]=useState({x:0,y:0}),[r,n]=useState(""),[s,a]=useState(),l=useCallback((p,g,d)=>{p.preventDefault(),i({x:p.clientX,y:p.clientY}),n(g),a(d),t(true);},[]),c=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:s,openMenu:l,closeMenu:c}}function qo(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function er(e,t,o){return !(!t||t.trim().length===0)}function tr(){return [...z]}function or(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var rr=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Ve=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),nr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ir=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sr=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { F as FindMatch, a as FindOptions } from './findReplace-
|
|
2
|
+
import { f as Table, g as TableCell } from './content-REFGFfEH.js';
|
|
3
|
+
import { F as FindMatch, a as FindOptions } from './findReplace-Bue0JaXh.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TableToolbar Component
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { F as FindMatch, a as FindOptions } from './findReplace-
|
|
2
|
+
import { f as Table, g as TableCell } from './content-REFGFfEH.mjs';
|
|
3
|
+
import { F as FindMatch, a as FindOptions } from './findReplace-shXbOjFQ.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TableToolbar Component
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeke-02/docx-editor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "React DOCX editor adapter for @eigenpal/docx-editor-core.",
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"module": "./dist/
|
|
7
|
-
"types": "./dist/
|
|
5
|
+
"main": "./dist/fork.js",
|
|
6
|
+
"module": "./dist/fork.mjs",
|
|
7
|
+
"types": "./dist/fork.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/
|
|
11
|
-
"import": "./dist/
|
|
12
|
-
"require": "./dist/
|
|
10
|
+
"types": "./dist/fork.d.ts",
|
|
11
|
+
"import": "./dist/fork.mjs",
|
|
12
|
+
"require": "./dist/fork.js"
|
|
13
13
|
},
|
|
14
14
|
"./ui": {
|
|
15
15
|
"types": "./dist/ui.d.ts",
|