@stll/folio-react 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +2 -0
  2. package/dist/{CommentsSidebar-D7eTgHpL.js → CommentsSidebar-jIMSYslR.js} +22 -26
  3. package/dist/{FindReplaceDialog-CUd8xdgd.js → FindReplaceDialog-C3njN6OI.js} +114 -12
  4. package/dist/{InsertSymbolDialog-Drm40-9j.js → InsertSymbolDialog-CepZECp0.js} +2 -1
  5. package/dist/{TextContextMenu-DZ3AUFKh.js → TextContextMenu-DHe4vOW7.js} +0 -1
  6. package/dist/compat/eigenpal.d.ts +20 -20
  7. package/dist/compat/eigenpal.js +1 -1
  8. package/dist/{dialogs-BENP66Ly.d.ts → dialogs-CMAVdDEV.d.ts} +14 -8
  9. package/dist/dialogs.d.ts +1 -1
  10. package/dist/dialogs.js +2 -2
  11. package/dist/i18n/messages/ar.js +1 -2
  12. package/dist/i18n/messages/cs.js +1 -2
  13. package/dist/i18n/messages/de.js +1 -2
  14. package/dist/i18n/messages/en.js +1 -2
  15. package/dist/i18n/messages/es.js +1 -2
  16. package/dist/i18n/messages/et.js +1 -2
  17. package/dist/i18n/messages/fr.js +1 -2
  18. package/dist/i18n/messages/he.js +1 -2
  19. package/dist/i18n/messages/hi.js +1 -2
  20. package/dist/i18n/messages/hu.js +1 -2
  21. package/dist/i18n/messages/locales.js +1 -2
  22. package/dist/i18n/messages/lt.js +1 -2
  23. package/dist/i18n/messages/lv.js +1 -2
  24. package/dist/i18n/messages/pl.js +1 -2
  25. package/dist/i18n/messages/pt-BR.js +1 -2
  26. package/dist/i18n/messages/sk.js +1 -2
  27. package/dist/i18n/messages/tr.js +1 -2
  28. package/dist/i18n/messages/zh-CN.js +1 -2
  29. package/dist/index.d.ts +17 -16
  30. package/dist/index.js +4 -4
  31. package/dist/{renderAsync-D3Bxr14I.js → renderAsync-CXgKj7iM.js} +5575 -5344
  32. package/dist/{renderAsync-DsMKdbU5.d.ts → renderAsync-CZ_bTgOh.d.ts} +21 -12
  33. package/dist/standalone.css +1 -1
  34. package/package.json +12 -12
package/README.md CHANGED
@@ -107,3 +107,5 @@ original license and copyright are preserved in [`NOTICE.md`](./NOTICE.md).
107
107
  ## License
108
108
 
109
109
  [Apache-2.0](./LICENSE)
110
+
111
+ See [document search](../../docs/document-search.md) for highlighting, navigation, and result callbacks.
@@ -1,4 +1,4 @@
1
- import { f as containedHandler, u as useDrawerFocus } from "./renderAsync-D3Bxr14I.js";
1
+ import { a as useDrawerFocus, s as containedHandler } from "./renderAsync-CXgKj7iM.js";
2
2
  import { useCallback, useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { CheckIcon, MoreVerticalIcon } from "lucide-react";
4
4
  import { useLocale, useTranslations } from "use-intl";
@@ -6,6 +6,7 @@ import { scrollEditorTo } from "@stll/folio-core/paged-layout/editorScrollRoot";
6
6
  import { closestHtmlElement, queryHtmlElement } from "@stll/folio-core/utils/domGuards";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { sliceText } from "@stll/folio-core/utils/sliceText";
9
+ import { getFindParagraphText } from "@stll/folio-core/utils/findReplace";
9
10
  import { PANEL_METRICS } from "@stll/folio-core/panel-layout";
10
11
  import { commentAnchorSelector } from "@stll/folio-core/render-dom/commentAnchorAttributes";
11
12
  //#region src/components/CommentsSidebar.tsx
@@ -19,11 +20,11 @@ import { commentAnchorSelector } from "@stll/folio-core/render-dom/commentAnchor
19
20
  * Tracked changes are rendered purely inline (Word-style) and do not appear
20
21
  * in this sidebar.
21
22
  */
22
- /** Extract plain text from a Comment's paragraph content */
23
- function getCommentText(paragraphs) {
24
- if (!paragraphs?.length) return "";
25
- return paragraphs.flatMap((p) => p.content.filter((c) => c.type === "run").flatMap((r) => "content" in r ? r.content : []).filter((c) => c.type === "text").map((t) => "text" in t ? t.text : "")).join("");
26
- }
23
+ const renderCommentText = (comment) => comment.content.map((paragraph, index) => /* @__PURE__ */ jsx("span", {
24
+ "data-find-comment-id": comment.id,
25
+ "data-find-comment-paragraph": index,
26
+ children: getFindParagraphText(paragraph)
27
+ }, index));
27
28
  function formatDate(dateStr, locale) {
28
29
  if (!dateStr) return "";
29
30
  const d = new Date(dateStr);
@@ -36,12 +37,13 @@ function formatDate(dateStr, locale) {
36
37
  }).format(d);
37
38
  }
38
39
  function getInitials(name) {
40
+ const initials = name.split(/\s+/u).map((word) => sliceText({
41
+ text: word,
42
+ units: "graphemes",
43
+ end: 1
44
+ })).join("").toUpperCase();
39
45
  return sliceText({
40
- text: name.split(/\s+/u).map((word) => sliceText({
41
- text: word,
42
- units: "graphemes",
43
- end: 1
44
- })).join("").toUpperCase(),
46
+ text: initials,
45
47
  units: "graphemes",
46
48
  end: 2
47
49
  });
@@ -108,13 +110,13 @@ const CANCEL_BUTTON_STYLE = {
108
110
  fontWeight: 500,
109
111
  fontFamily: "inherit"
110
112
  };
111
- const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onCommentReply, onCommentResolve, onCommentDelete, onAddComment, onCancelAddComment, onAcceptChange: _onAcceptChange, onRejectChange: _onRejectChange, onTrackedChangeReply: _onTrackedChangeReply, topOffset = 0, showResolved = false, isAddingComment = false, addCommentYPosition = null, pageWidth = 816, editorContainerRef, anchorPositions, surface = "column", onDismiss }) => {
113
+ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId, onCommentReply, onCommentResolve, onCommentDelete, onAddComment, onCancelAddComment, onAcceptChange: _onAcceptChange, onRejectChange: _onRejectChange, onTrackedChangeReply: _onTrackedChangeReply, topOffset = 0, showResolved = false, isAddingComment = false, addCommentYPosition = null, pageWidth = 816, editorContainerRef, anchorPositions, surface = "column", onDismiss }) => {
112
114
  const t = useTranslations("folio");
113
115
  const locale = useLocale();
114
116
  const [replyingTo, setReplyingTo] = useState(null);
115
117
  const [replyText, setReplyText] = useState("");
116
118
  const [newCommentText, setNewCommentText] = useState("");
117
- const [expandedCard, setExpandedCard] = useState(activeCommentId === null ? null : `comment-${activeCommentId}`);
119
+ const expandedCard = activeCommentId === null ? null : `comment-${activeCommentId}`;
118
120
  const [menuOpenFor, setMenuOpenFor] = useState(null);
119
121
  const [{ positions: cardPositions, knownCards }, setCardGeometry] = useState(() => ({
120
122
  positions: /* @__PURE__ */ new Map(),
@@ -304,12 +306,11 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
304
306
  if (pagesEl_0.contains(target)) {
305
307
  const commentEl = closestHtmlElement(target, "[data-comment-id]");
306
308
  if (commentEl?.dataset["commentId"]) {
307
- setExpandedCard(`comment-${commentEl.dataset["commentId"]}`);
308
- onCommentClick?.(Number(commentEl.dataset["commentId"]));
309
+ onCommentClick(Number(commentEl.dataset["commentId"]));
309
310
  return;
310
311
  }
311
312
  }
312
- setExpandedCard(null);
313
+ onCommentClick(null);
313
314
  setMenuOpenFor(null);
314
315
  };
315
316
  container_0.addEventListener("click", handleDocClick);
@@ -387,17 +388,11 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
387
388
  if (onAddComment?.(newCommentText.trim()) !== false) setNewCommentText("");
388
389
  }
389
390
  };
390
- const [previousActiveCommentId, setPreviousActiveCommentId] = useState(activeCommentId);
391
- if (previousActiveCommentId !== activeCommentId) {
392
- setPreviousActiveCommentId(activeCommentId);
393
- if (activeCommentId !== null) setExpandedCard(`comment-${activeCommentId}`);
394
- }
395
391
  const handleCardClick = (cardId_1, commentId_0) => {
396
392
  const nextExpandedCard = expandedCard === cardId_1 ? null : cardId_1;
397
- setExpandedCard(nextExpandedCard);
398
393
  setMenuOpenFor(null);
399
- if (commentId_0 !== void 0) onCommentClick?.(nextExpandedCard === null && activeCommentId === commentId_0 ? null : commentId_0);
400
- if (isDrawer && commentId_0 !== void 0 && nextExpandedCard !== null) revealAnchor(cardId_1);
394
+ onCommentClick(nextExpandedCard === null ? null : commentId_0);
395
+ if (isDrawer && nextExpandedCard !== null) revealAnchor(cardId_1);
401
396
  };
402
397
  const revealAnchor = (cardId_2) => {
403
398
  const scrollEl_1 = editorContainerRef?.current;
@@ -520,7 +515,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
520
515
  WebkitBoxOrient: "vertical"
521
516
  } : {}
522
517
  },
523
- children: getCommentText(reply.content)
518
+ children: renderCommentText(reply)
524
519
  })]
525
520
  }, reply.id)), !isExpanded_0 && replies.length > 1 && /* @__PURE__ */ jsx("div", {
526
521
  style: {
@@ -765,7 +760,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
765
760
  lineHeight: "17px",
766
761
  marginTop: 5
767
762
  },
768
- children: getCommentText(comment_0.content)
763
+ children: renderCommentText(comment_0)
769
764
  }),
770
765
  renderReplies(replies_0, isExpanded_1),
771
766
  isExpanded_1 && !comment_0.done && renderReplySection(comment_0.id, onCommentReply)
@@ -796,6 +791,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
796
791
  },
797
792
  onMouseDown: containedHandler((e_20) => e_20.stopPropagation()),
798
793
  children: /* @__PURE__ */ jsxs("div", {
794
+ "data-folio-scroll": isDrawer ? "" : void 0,
799
795
  style: isDrawer ? {
800
796
  position: "sticky",
801
797
  top: 0,
@@ -5,7 +5,9 @@ import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from
5
5
  import { ChevronDownIcon, ChevronUpIcon, SearchIcon, XIcon } from "lucide-react";
6
6
  import { useTranslations } from "use-intl";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { replaceEligibility } from "@stll/folio-core/utils/findReplace";
8
9
  import "@stll/folio-core/managers/FindReplaceManager";
10
+ import { createFindQueryKey } from "@stll/folio-core/utils/findSearchKey";
9
11
  //#region src/components/dialogs/findReplaceDialogLayout.ts
10
12
  const FIND_REPLACE_DIALOG_TOP = "var(--folio-find-replace-top, 7rem)";
11
13
  const FIND_REPLACE_DIALOG_LEFT = "var(--folio-find-replace-left, 5.5rem)";
@@ -78,11 +80,6 @@ function FindReplaceDialog(props) {
78
80
  } else t2 = $[7];
79
81
  return t2;
80
82
  }
81
- const getFindQueryKey = (text, { matchCase, matchWholeWord }) => JSON.stringify([
82
- text,
83
- matchCase,
84
- matchWholeWord
85
- ]);
86
83
  const getQueryResult = (state, queryKey) => {
87
84
  switch (state.status) {
88
85
  case "cleared": return null;
@@ -90,12 +87,16 @@ const getQueryResult = (state, queryKey) => {
90
87
  default: return state;
91
88
  }
92
89
  };
93
- function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrevious, onHighlightMatches, onClearHighlights, initialSearchText = "", currentResult, className, style, matchCase, matchWholeWord, onMatchCaseChange, onMatchWholeWordChange }) {
90
+ function FindReplaceDialogForm({ isOpen, onClose, onFind, onQueryChange, onFindNext, onFindPrevious, onReplace, onReplaceAll, replaceMode = false, readOnly = false, onHighlightMatches, onClearHighlights, initialSearchText = "", currentSearch, className, style, matchCase, matchWholeWord, onMatchCaseChange, onMatchWholeWordChange }) {
94
91
  const id = React.useId();
95
92
  const t = useTranslations("folio");
96
93
  const { Button, Input, Checkbox } = useFolioUI();
97
94
  const [searchText, setSearchText] = useState(initialSearchText);
98
- const queryKey = getFindQueryKey(searchText, {
95
+ const [replaceText, setReplaceText] = useState("");
96
+ const [replacementSummary, setReplacementSummary] = useState(null);
97
+ const currentResult = currentSearch === null ? null : currentSearch?.result;
98
+ const currentQueryKey = currentSearch?.queryKey;
99
+ const queryKey = createFindQueryKey(searchText, {
99
100
  matchCase,
100
101
  matchWholeWord
101
102
  });
@@ -103,13 +104,24 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
103
104
  const [previousCurrentResult, setPreviousCurrentResult] = useState(currentResult);
104
105
  if (currentResult !== previousCurrentResult) {
105
106
  setPreviousCurrentResult(currentResult);
106
- if (findResult.status === "ready" && findResult.queryKey === queryKey && currentResult !== void 0) setFindResult(currentResult ? {
107
+ if (findResult.status === "ready" && findResult.queryKey === queryKey && currentQueryKey === queryKey && currentResult !== void 0) setFindResult(currentResult ? {
107
108
  status: "ready",
108
109
  queryKey,
109
110
  result: currentResult
110
111
  } : { status: "cleared" });
111
112
  }
112
- const result = getQueryResult(findResult, queryKey);
113
+ const result = currentResult !== void 0 && currentQueryKey !== queryKey ? null : getQueryResult(findResult, queryKey);
114
+ useLayoutEffect(() => {
115
+ onQueryChange?.(searchText, {
116
+ matchCase,
117
+ matchWholeWord
118
+ });
119
+ }, [
120
+ onQueryChange,
121
+ searchText,
122
+ matchCase,
123
+ matchWholeWord
124
+ ]);
113
125
  const searchInputRef = useRef(null);
114
126
  useEffect(() => {
115
127
  const timeout = setTimeout(() => {
@@ -130,7 +142,7 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
130
142
  const searchResult = onFind(text, options);
131
143
  setFindResult(searchResult ? {
132
144
  status: "ready",
133
- queryKey: getFindQueryKey(text, options),
145
+ queryKey: createFindQueryKey(text, options),
134
146
  result: searchResult
135
147
  } : { status: "cleared" });
136
148
  if (searchResult?.matches && onHighlightMatches) onHighlightMatches(searchResult.matches);
@@ -166,17 +178,44 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
166
178
  matchWholeWord
167
179
  ]);
168
180
  const handleMatchCaseChange = useCallback((value) => {
181
+ setReplacementSummary(null);
169
182
  setFindResult({ status: "cleared" });
183
+ onQueryChange?.(searchText, {
184
+ matchCase: value,
185
+ matchWholeWord
186
+ });
170
187
  onMatchCaseChange(value);
171
- }, [onMatchCaseChange, setFindResult]);
188
+ }, [
189
+ onMatchCaseChange,
190
+ onQueryChange,
191
+ searchText,
192
+ matchWholeWord,
193
+ setFindResult
194
+ ]);
172
195
  const handleMatchWholeWordChange = useCallback((value_0) => {
196
+ setReplacementSummary(null);
173
197
  setFindResult({ status: "cleared" });
198
+ onQueryChange?.(searchText, {
199
+ matchCase,
200
+ matchWholeWord: value_0
201
+ });
174
202
  onMatchWholeWordChange(value_0);
175
- }, [onMatchWholeWordChange, setFindResult]);
203
+ }, [
204
+ onMatchWholeWordChange,
205
+ onQueryChange,
206
+ searchText,
207
+ matchCase,
208
+ setFindResult
209
+ ]);
176
210
  const handleSearchChange = useCallback((e) => {
177
211
  const text_0 = e.target.value;
212
+ setReplacementSummary(null);
178
213
  setSearchText(text_0);
179
214
  setFindResult({ status: "cleared" });
215
+ onQueryChange?.(text_0, {
216
+ matchCase,
217
+ matchWholeWord
218
+ });
180
219
  if (!text_0.trim()) {
181
220
  onFind(text_0, {
182
221
  matchCase,
@@ -186,6 +225,7 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
186
225
  }
187
226
  }, [
188
227
  onFind,
228
+ onQueryChange,
189
229
  matchCase,
190
230
  matchWholeWord,
191
231
  onClearHighlights,
@@ -283,12 +323,41 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
283
323
  const handleOverlayClick = useCallback((e_1) => {
284
324
  if (e_1.target === e_1.currentTarget) {}
285
325
  }, []);
326
+ const handleReplacementChange = useCallback((event) => {
327
+ setReplaceText(event.target.value);
328
+ setReplacementSummary(null);
329
+ }, []);
330
+ const handleReplaceCurrent = useCallback(() => {
331
+ setReplacementSummary(null);
332
+ if (onReplace(replaceText)) performSearch();
333
+ }, [
334
+ onReplace,
335
+ replaceText,
336
+ performSearch
337
+ ]);
338
+ const handleReplaceAll = useCallback(() => {
339
+ const summary = onReplaceAll(searchText, replaceText, {
340
+ matchCase,
341
+ matchWholeWord
342
+ });
343
+ performSearch();
344
+ setReplacementSummary(summary);
345
+ }, [
346
+ onReplaceAll,
347
+ searchText,
348
+ replaceText,
349
+ matchCase,
350
+ matchWholeWord,
351
+ performSearch
352
+ ]);
286
353
  const handleDialogKeyDown = useCallback((e_2) => {
287
354
  if (e_2.key === "Escape") onClose();
288
355
  }, [onClose]);
289
356
  if (!isOpen) return null;
290
357
  const hasMatches = result && result.totalCount > 0;
291
358
  const noMatches = result && result.totalCount === 0 && searchText.trim();
359
+ const currentMatch = result?.matches.at(result.currentIndex);
360
+ const canReplaceCurrent = !readOnly && currentMatch !== void 0 && replaceEligibility(currentMatch).status === "allowed";
292
361
  const overlayStyle = getFindReplaceOverlayStyle(style);
293
362
  const titleId = `${id}-find-replace-dialog-title`;
294
363
  const findTextId = `${id}-find-text`;
@@ -380,6 +449,39 @@ function FindReplaceDialogForm({ isOpen, onClose, onFind, onFindNext, onFindPrev
380
449
  className: "text-destructive ms-20 text-xs",
381
450
  children: t("findReplace.noResults")
382
451
  }),
452
+ replaceMode && /* @__PURE__ */ jsxs("div", {
453
+ className: "ms-20 flex flex-col gap-2",
454
+ children: [
455
+ /* @__PURE__ */ jsx(Input, {
456
+ value: replaceText,
457
+ onChange: handleReplacementChange,
458
+ "aria-label": t("findReplace.replaceText"),
459
+ placeholder: t("findReplace.replacePlaceholder"),
460
+ disabled: readOnly
461
+ }),
462
+ /* @__PURE__ */ jsxs("div", {
463
+ className: "flex gap-2",
464
+ children: [/* @__PURE__ */ jsx(Button, {
465
+ disabled: !canReplaceCurrent,
466
+ onClick: handleReplaceCurrent,
467
+ children: t("findReplace.replaceCurrent")
468
+ }), /* @__PURE__ */ jsx(Button, {
469
+ disabled: readOnly || !hasMatches,
470
+ onClick: handleReplaceAll,
471
+ children: t("findReplace.replaceAll")
472
+ })]
473
+ }),
474
+ replacementSummary && /* @__PURE__ */ jsx("div", {
475
+ role: "status",
476
+ "aria-live": "polite",
477
+ className: "text-muted-foreground text-xs",
478
+ children: t("findReplace.replaceAllSummary", {
479
+ replacedCount: String(replacementSummary.replacedCount),
480
+ skippedCount: String(replacementSummary.skippedCount)
481
+ })
482
+ })
483
+ ]
484
+ }),
383
485
  /* @__PURE__ */ jsxs("div", {
384
486
  className: "ms-20 flex flex-wrap items-center gap-x-4 gap-y-2",
385
487
  children: [/* @__PURE__ */ jsxs("label", {
@@ -120,10 +120,11 @@ function InsertSymbolDialog(t0) {
120
120
  t6 = !search && /* @__PURE__ */ jsx("div", {
121
121
  className: "flex flex-wrap gap-0.5",
122
122
  children: SYMBOL_CATEGORIES.map((category_0) => {
123
+ const active = activeCategory === category_0.name;
123
124
  return /* @__PURE__ */ jsx("button", {
124
125
  type: "button",
125
126
  onClick: () => setActiveCategory(category_0.name),
126
- className: `rounded px-2 py-1 text-[11px] ${activeCategory === category_0.name ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-muted"}`,
127
+ className: `rounded px-2 py-1 text-[11px] ${active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-muted"}`,
127
128
  children: t(category_0.nameKey)
128
129
  }, category_0.name);
129
130
  })
@@ -367,7 +367,6 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
367
367
  }
368
368
  break;
369
369
  }
370
- default: break;
371
370
  }
372
371
  };
373
372
  document.addEventListener("keydown", handleKeyDown);
@@ -1,19 +1,19 @@
1
- import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-DsMKdbU5.js";
1
+ import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-CZ_bTgOh.js";
2
2
  import { ReactNode } from "react";
3
3
  import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
4
4
  //#region src/compat/eigenpal.d.ts
5
- declare const VERSION = "folio-compat-eigenpal";
5
+ export declare const VERSION = "folio-compat-eigenpal";
6
6
  type LegacyTranslations = {
7
7
  _lang?: string;
8
8
  };
9
- type LocaleCode = "en" | "de" | "fr" | "he" | "hi" | "pl" | "pt-BR" | "tr" | "zh-CN";
10
- type LocaleProviderProps = {
9
+ export type LocaleCode = "en" | "de" | "fr" | "he" | "hi" | "pl" | "pt-BR" | "tr" | "zh-CN";
10
+ export type LocaleProviderProps = {
11
11
  children?: ReactNode | undefined;
12
12
  i18n?: LegacyTranslations | undefined;
13
13
  locale?: string | undefined;
14
14
  };
15
- type TFunction = (key: string, vars?: Record<string, string | number>) => string;
16
- type LegacyDocxEditorProps = DocxEditorProps & {
15
+ export type TFunction = (key: string, vars?: Record<string, string | number>) => string;
16
+ export type LegacyDocxEditorProps = DocxEditorProps & {
17
17
  agentPanel?: unknown;
18
18
  colorMode?: "light" | "dark" | "system";
19
19
  commentsSidebarOpen?: boolean;
@@ -43,39 +43,39 @@ type LegacyDocxEditorProps = DocxEditorProps & {
43
43
  showOutlineButton?: boolean;
44
44
  watermarkPresets?: readonly string[];
45
45
  };
46
- declare const en: {
46
+ export declare const en: {
47
47
  _lang: string;
48
48
  };
49
- declare const de: {
49
+ export declare const de: {
50
50
  _lang: string;
51
51
  };
52
- declare const fr: {
52
+ export declare const fr: {
53
53
  _lang: string;
54
54
  };
55
- declare const he: {
55
+ export declare const he: {
56
56
  _lang: string;
57
57
  };
58
- declare const hi: {
58
+ export declare const hi: {
59
59
  _lang: string;
60
60
  };
61
- declare const pl: {
61
+ export declare const pl: {
62
62
  _lang: string;
63
63
  };
64
- declare const ptBR: {
64
+ export declare const ptBR: {
65
65
  _lang: string;
66
66
  };
67
- declare const tr: {
67
+ export declare const tr: {
68
68
  _lang: string;
69
69
  };
70
- declare const zhCN: {
70
+ export declare const zhCN: {
71
71
  _lang: string;
72
72
  };
73
- declare const locales: Record<LocaleCode, LegacyTranslations>;
74
- declare const LocaleProvider: ({ children, i18n, locale }: LocaleProviderProps) => import("react").JSX.Element;
75
- declare const useTranslation: () => {
73
+ export declare const locales: Record<LocaleCode, LegacyTranslations>;
74
+ export declare const LocaleProvider: ({ children, i18n, locale }: LocaleProviderProps) => import("react").JSX.Element;
75
+ export declare const useTranslation: () => {
76
76
  t: TFunction;
77
77
  };
78
- declare const DocxEditor: import("react").ForwardRefExoticComponent<DocxEditorProps & {
78
+ export declare const DocxEditor: import("react").ForwardRefExoticComponent<DocxEditorProps & {
79
79
  agentPanel?: unknown;
80
80
  colorMode?: "light" | "dark" | "system";
81
81
  commentsSidebarOpen?: boolean;
@@ -106,4 +106,4 @@ declare const DocxEditor: import("react").ForwardRefExoticComponent<DocxEditorPr
106
106
  watermarkPresets?: readonly string[];
107
107
  } & import("react").RefAttributes<DocxEditorRef>>;
108
108
  //#endregion
109
- export { type CreateEmptyDocumentOptions, DocxEditor, type DocxEditorHandle, type DocxEditorRef, type EditorHandle, LegacyDocxEditorProps, LocaleCode, LocaleProvider, LocaleProviderProps, type RenderAsyncOptions, TFunction, VERSION, createDocumentWithText, createEmptyDocument, de, en, fr, he, hi, locales, pl, ptBR, renderAsync, tr, useTranslation, zhCN };
109
+ export { type CreateEmptyDocumentOptions, type DocxEditorHandle, type DocxEditorRef, type EditorHandle, type RenderAsyncOptions, createDocumentWithText, createEmptyDocument, renderAsync };
@@ -1,4 +1,4 @@
1
- import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-D3Bxr14I.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-CXgKj7iM.js";
2
2
  import { t as messages_exports } from "../messages.js";
3
3
  import { c } from "react-compiler-runtime";
4
4
  import { forwardRef } from "react";
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties } from "react";
2
2
  import { EndnoteProperties, FootnoteProperties, SectionProperties } from "@stll/folio-core/types/document";
3
+ import { FindMatch as FindMatch$1, FindOptions as FindOptions$1, FindResult as FindResult$1, ReplaceAllSummary } from "@stll/folio-core/utils/findReplace";
3
4
  import { TablePropertiesCommand } from "@stll/folio-core/utils/tableOperations";
4
- import { FindMatch, FindOptions, FindResult } from "@stll/folio-core/utils/findReplace";
5
5
  import { Watermark } from "@stll/folio-core/watermark";
6
6
  //#region src/components/dialogs/FindReplaceDialog.d.ts
7
7
  /**
@@ -13,25 +13,31 @@ type FindReplaceDialogProps = {
13
13
  /** Callback when dialog is closed */
14
14
  onClose: () => void;
15
15
  /** Callback when searching for text */
16
- onFind: (searchText: string, options: FindOptions) => FindResult | null;
16
+ onFind: (searchText: string, options: FindOptions$1) => FindResult$1 | null;
17
+ /** Publish edits immediately, before the delayed search. */
18
+ onQueryChange?: (searchText: string, options: FindOptions$1) => void;
17
19
  /** Callback when navigating to next match */
18
- onFindNext: () => FindMatch | null;
20
+ onFindNext: () => FindMatch$1 | null;
19
21
  /** Callback when navigating to previous match */
20
- onFindPrevious: () => FindMatch | null;
22
+ onFindPrevious: () => FindMatch$1 | null;
21
23
  /** Callback when replacing current match */
22
24
  onReplace: (replaceText: string) => boolean;
23
25
  /** Callback when replacing all matches */
24
- onReplaceAll: (searchText: string, replaceText: string, options: FindOptions) => number;
26
+ onReplaceAll: (searchText: string, replaceText: string, options: FindOptions$1) => ReplaceAllSummary;
27
+ readOnly?: boolean;
25
28
  /** Callback to highlight matches in document */
26
- onHighlightMatches?: (matches: FindMatch[]) => void;
29
+ onHighlightMatches?: (matches: FindMatch$1[]) => void;
27
30
  /** Callback to clear highlights */
28
31
  onClearHighlights?: () => void;
29
32
  /** Initial search text (e.g., from selected text) */
30
33
  initialSearchText?: string;
31
34
  /** Whether to start in replace mode */
32
35
  replaceMode?: boolean;
33
- /** Current match result (from external state) */
34
- currentResult?: FindResult | null;
36
+ /** External result paired with the query that produced it. */
37
+ currentSearch?: {
38
+ queryKey: string;
39
+ result: FindResult$1;
40
+ } | null;
35
41
  /** Additional CSS class */
36
42
  className?: string;
37
43
  /** Additional inline styles */
package/dist/dialogs.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as HyperlinkDialog, C as ImagePropertiesData, D as ImagePositionDialog, E as ImagePositionData, F as FindReplaceDialog, I as FindReplaceDialogProps, M as HyperlinkDialogProps, N as FootnotePropertiesDialog, O as ImagePositionDialogProps, P as FootnotePropertiesDialogProps, S as InsertImageDialogProps, T as ImagePropertiesDialogProps, _ as InsertTableStyleOption, a as TablePropertiesDialogProps, b as InsertImageDialog, c as SplitCellDialogProps, d as PasteSpecialMode, f as PageSetupDialog, g as InsertTableDialogProps, h as InsertTableDialogData, i as TablePropertiesDialog, j as HyperlinkDialogData, k as HyperlinkBookmarkOption, l as PasteSpecialDialog, m as InsertTableDialog, n as WatermarkDialogProps, o as SplitCellDialog, p as PageSetupDialogProps, r as TableProperties, s as SplitCellDialogData, t as WatermarkDialog, u as PasteSpecialDialogProps, v as InsertSymbolDialog, w as ImagePropertiesDialog, x as InsertImageDialogData, y as InsertSymbolDialogProps } from "./dialogs-BENP66Ly.js";
1
+ import { A as HyperlinkDialog, C as ImagePropertiesData, D as ImagePositionDialog, E as ImagePositionData, F as FindReplaceDialog, I as FindReplaceDialogProps, M as HyperlinkDialogProps, N as FootnotePropertiesDialog, O as ImagePositionDialogProps, P as FootnotePropertiesDialogProps, S as InsertImageDialogProps, T as ImagePropertiesDialogProps, _ as InsertTableStyleOption, a as TablePropertiesDialogProps, b as InsertImageDialog, c as SplitCellDialogProps, d as PasteSpecialMode, f as PageSetupDialog, g as InsertTableDialogProps, h as InsertTableDialogData, i as TablePropertiesDialog, j as HyperlinkDialogData, k as HyperlinkBookmarkOption, l as PasteSpecialDialog, m as InsertTableDialog, n as WatermarkDialogProps, o as SplitCellDialog, p as PageSetupDialogProps, r as TableProperties, s as SplitCellDialogData, t as WatermarkDialog, u as PasteSpecialDialogProps, v as InsertSymbolDialog, w as ImagePropertiesDialog, x as InsertImageDialogData, y as InsertSymbolDialogProps } from "./dialogs-CMAVdDEV.js";
2
2
  export { FindReplaceDialog, type FindReplaceDialogProps, FootnotePropertiesDialog, type FootnotePropertiesDialogProps, type HyperlinkBookmarkOption, HyperlinkDialog, type HyperlinkDialogData, type HyperlinkDialogProps, type ImagePositionData, ImagePositionDialog, type ImagePositionDialogProps, type ImagePropertiesData, ImagePropertiesDialog, type ImagePropertiesDialogProps, InsertImageDialog, type InsertImageDialogData, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogData, type InsertTableDialogProps, type InsertTableStyleOption, PageSetupDialog, type PageSetupDialogProps, PasteSpecialDialog, type PasteSpecialDialogProps, type PasteSpecialMode, SplitCellDialog, type SplitCellDialogData, type SplitCellDialogProps, type TableProperties, TablePropertiesDialog, type TablePropertiesDialogProps, WatermarkDialog, type WatermarkDialogProps };
package/dist/dialogs.js CHANGED
@@ -1,9 +1,9 @@
1
- import { t as FindReplaceDialog } from "./FindReplaceDialog-CUd8xdgd.js";
1
+ import { t as FindReplaceDialog } from "./FindReplaceDialog-C3njN6OI.js";
2
2
  import { t as FootnotePropertiesDialog } from "./FootnotePropertiesDialog-BEs7N62_.js";
3
3
  import { a as InsertImageDialog, i as InsertTableDialog, n as SplitCellDialog, o as HyperlinkDialog, r as PasteSpecialDialog, t as WatermarkDialog } from "./dialogs-DGrcp10A.js";
4
4
  import { t as ImagePositionDialog } from "./ImagePositionDialog-Oap9knQ-.js";
5
5
  import { t as ImagePropertiesDialog } from "./ImagePropertiesDialog-lLMKHv0u.js";
6
- import { t as InsertSymbolDialog } from "./InsertSymbolDialog-Drm40-9j.js";
6
+ import { t as InsertSymbolDialog } from "./InsertSymbolDialog-CepZECp0.js";
7
7
  import { t as PageSetupDialog } from "./PageSetupDialog-DTWCdPkX.js";
8
8
  import { t as TablePropertiesDialog } from "./TablePropertiesDialog-uSTmyEcu.js";
9
9
  export { FindReplaceDialog, FootnotePropertiesDialog, HyperlinkDialog, ImagePositionDialog, ImagePropertiesDialog, InsertImageDialog, InsertSymbolDialog, InsertTableDialog, PageSetupDialog, PasteSpecialDialog, SplitCellDialog, TablePropertiesDialog, WatermarkDialog };
@@ -1,2 +1 @@
1
- import ar_default, { messages } from "@stll/folio-core/i18n/messages/ar";
2
- export { ar_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/ar";
@@ -1,2 +1 @@
1
- import cs_default, { messages } from "@stll/folio-core/i18n/messages/cs";
2
- export { cs_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/cs";
@@ -1,2 +1 @@
1
- import de_default, { messages } from "@stll/folio-core/i18n/messages/de";
2
- export { de_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/de";
@@ -1,2 +1 @@
1
- import en_default, { messages } from "@stll/folio-core/i18n/messages/en";
2
- export { en_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/en";
@@ -1,2 +1 @@
1
- import es_default, { messages } from "@stll/folio-core/i18n/messages/es";
2
- export { es_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/es";
@@ -1,2 +1 @@
1
- import et_default, { messages } from "@stll/folio-core/i18n/messages/et";
2
- export { et_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/et";
@@ -1,2 +1 @@
1
- import fr_default, { messages } from "@stll/folio-core/i18n/messages/fr";
2
- export { fr_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/fr";
@@ -1,2 +1 @@
1
- import he_default, { messages } from "@stll/folio-core/i18n/messages/he";
2
- export { he_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/he";
@@ -1,2 +1 @@
1
- import hi_default, { messages } from "@stll/folio-core/i18n/messages/hi";
2
- export { hi_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/hi";
@@ -1,2 +1 @@
1
- import hu_default, { messages } from "@stll/folio-core/i18n/messages/hu";
2
- export { hu_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/hu";
@@ -1,2 +1 @@
1
- import { FOLIO_LOCALES } from "@stll/folio-core/i18n/messages/locales";
2
- export { FOLIO_LOCALES };
1
+ export { FOLIO_LOCALES } from "@stll/folio-core/i18n/messages/locales";
@@ -1,2 +1 @@
1
- import lt_default, { messages } from "@stll/folio-core/i18n/messages/lt";
2
- export { lt_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/lt";
@@ -1,2 +1 @@
1
- import lv_default, { messages } from "@stll/folio-core/i18n/messages/lv";
2
- export { lv_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/lv";
@@ -1,2 +1 @@
1
- import pl_default, { messages } from "@stll/folio-core/i18n/messages/pl";
2
- export { pl_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/pl";
@@ -1,2 +1 @@
1
- import pt_BR_default, { messages } from "@stll/folio-core/i18n/messages/pt-BR";
2
- export { pt_BR_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/pt-BR";
@@ -1,2 +1 @@
1
- import sk_default, { messages } from "@stll/folio-core/i18n/messages/sk";
2
- export { sk_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/sk";
@@ -1,2 +1 @@
1
- import tr_default, { messages } from "@stll/folio-core/i18n/messages/tr";
2
- export { tr_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/tr";
@@ -1,2 +1 @@
1
- import zh_CN_default, { messages } from "@stll/folio-core/i18n/messages/zh-CN";
2
- export { zh_CN_default as default, messages };
1
+ export { default, messages } from "@stll/folio-core/i18n/messages/zh-CN";