@stll/folio-react 0.29.0 → 0.30.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.
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 { f as containedHandler, u as useDrawerFocus } from "./renderAsync-D6N8PUZ_.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);
@@ -108,13 +109,13 @@ const CANCEL_BUTTON_STYLE = {
108
109
  fontWeight: 500,
109
110
  fontFamily: "inherit"
110
111
  };
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 }) => {
112
+ 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
113
  const t = useTranslations("folio");
113
114
  const locale = useLocale();
114
115
  const [replyingTo, setReplyingTo] = useState(null);
115
116
  const [replyText, setReplyText] = useState("");
116
117
  const [newCommentText, setNewCommentText] = useState("");
117
- const [expandedCard, setExpandedCard] = useState(activeCommentId === null ? null : `comment-${activeCommentId}`);
118
+ const expandedCard = activeCommentId === null ? null : `comment-${activeCommentId}`;
118
119
  const [menuOpenFor, setMenuOpenFor] = useState(null);
119
120
  const [{ positions: cardPositions, knownCards }, setCardGeometry] = useState(() => ({
120
121
  positions: /* @__PURE__ */ new Map(),
@@ -304,12 +305,11 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
304
305
  if (pagesEl_0.contains(target)) {
305
306
  const commentEl = closestHtmlElement(target, "[data-comment-id]");
306
307
  if (commentEl?.dataset["commentId"]) {
307
- setExpandedCard(`comment-${commentEl.dataset["commentId"]}`);
308
- onCommentClick?.(Number(commentEl.dataset["commentId"]));
308
+ onCommentClick(Number(commentEl.dataset["commentId"]));
309
309
  return;
310
310
  }
311
311
  }
312
- setExpandedCard(null);
312
+ onCommentClick(null);
313
313
  setMenuOpenFor(null);
314
314
  };
315
315
  container_0.addEventListener("click", handleDocClick);
@@ -387,17 +387,11 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
387
387
  if (onAddComment?.(newCommentText.trim()) !== false) setNewCommentText("");
388
388
  }
389
389
  };
390
- const [previousActiveCommentId, setPreviousActiveCommentId] = useState(activeCommentId);
391
- if (previousActiveCommentId !== activeCommentId) {
392
- setPreviousActiveCommentId(activeCommentId);
393
- if (activeCommentId !== null) setExpandedCard(`comment-${activeCommentId}`);
394
- }
395
390
  const handleCardClick = (cardId_1, commentId_0) => {
396
391
  const nextExpandedCard = expandedCard === cardId_1 ? null : cardId_1;
397
- setExpandedCard(nextExpandedCard);
398
392
  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);
393
+ onCommentClick(nextExpandedCard === null ? null : commentId_0);
394
+ if (isDrawer && nextExpandedCard !== null) revealAnchor(cardId_1);
401
395
  };
402
396
  const revealAnchor = (cardId_2) => {
403
397
  const scrollEl_1 = editorContainerRef?.current;
@@ -520,7 +514,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
520
514
  WebkitBoxOrient: "vertical"
521
515
  } : {}
522
516
  },
523
- children: getCommentText(reply.content)
517
+ children: renderCommentText(reply)
524
518
  })]
525
519
  }, reply.id)), !isExpanded_0 && replies.length > 1 && /* @__PURE__ */ jsx("div", {
526
520
  style: {
@@ -765,7 +759,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
765
759
  lineHeight: "17px",
766
760
  marginTop: 5
767
761
  },
768
- children: getCommentText(comment_0.content)
762
+ children: renderCommentText(comment_0)
769
763
  }),
770
764
  renderReplies(replies_0, isExpanded_1),
771
765
  isExpanded_1 && !comment_0.done && renderReplySection(comment_0.id, onCommentReply)
@@ -796,6 +790,7 @@ const CommentsSidebar = ({ comments, onCommentClick, activeCommentId = null, onC
796
790
  },
797
791
  onMouseDown: containedHandler((e_20) => e_20.stopPropagation()),
798
792
  children: /* @__PURE__ */ jsxs("div", {
793
+ "data-folio-scroll": isDrawer ? "" : void 0,
799
794
  style: isDrawer ? {
800
795
  position: "sticky",
801
796
  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", {
@@ -1,4 +1,4 @@
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-EOS7mrGK.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
@@ -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-D6N8PUZ_.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,4 +1,4 @@
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";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as FolioUIProvider, a as DocxEditorApplyDocumentOperationsOptions, c as DocxEditorRef, d as ToolbarProps, f as EditorMode, g as FolioUIComponents, h as FolioButtonProps, i as renderAsync, l as HighlightPassageOptions, m as ColorPreset, n as EditorHandle, o as DocxEditorCollaboration, p as FontOption, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle, u as HighlightPassageResult, v as OutlineItem, y as FontDefinition } from "./renderAsync-DsMKdbU5.js";
2
- 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 { _ as FolioUIProvider, a as DocxEditorApplyDocumentOperationsOptions, c as DocxEditorRef, d as ToolbarProps, f as EditorMode, g as FolioUIComponents, h as FolioButtonProps, i as renderAsync, l as HighlightPassageOptions, m as ColorPreset, n as EditorHandle, o as DocxEditorCollaboration, p as FontOption, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle, u as HighlightPassageResult, v as OutlineItem, y as FontDefinition } from "./renderAsync-EOS7mrGK.js";
2
+ 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";
3
3
  import React, { CSSProperties, ReactNode, RefObject } from "react";
4
4
  import { CreateEmptyDocumentOptions, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
5
5
  import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAISignatureParty, WordDiffSegment, applyFolioAIEditOperations, createFolioAIEditSnapshot, diffWordSegments, hashFolioAIBlockText, normalizeFolioAIBlockText } from "@stll/folio-core/ai-edits";
@@ -15,6 +15,7 @@ import { Document } from "@stll/folio-core/types/document";
15
15
  import { ScrollToParaIdOptions } from "@stll/folio-core/paged-layout/paragraphFlash";
16
16
  import { BlockRect } from "@stll/folio-core/paged-layout/blockGeometry";
17
17
  import { OutlineDepth } from "@stll/folio-core/utils/outlineDepth";
18
+ import { FindMatch, FindOptions, FindResult, ReplaceAllSummary, ReplaceEligibility } from "@stll/folio-core/utils/findReplace";
18
19
  import { PictureWatermark, TextWatermark, Watermark, getDocumentWatermark, setDocumentWatermark } from "@stll/folio-core/watermark";
19
20
  import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSetOptions, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "@stll/folio-core/style-sets/extract";
20
21
  import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "@stll/folio-core/style-sets/stellaStyle";
@@ -203,4 +204,4 @@ type AutocompleteCaretOverlayProps = {
203
204
  };
204
205
  declare const AutocompleteCaretOverlay: ({ caret, text, isStreaming }: AutocompleteCaretOverlayProps) => React.JSX.Element | null;
205
206
  //#endregion
206
- export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyResult, AutocompleteCaretOverlay, type AutocompleteCaretOverlayProps, type AutocompleteCaretRect, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, type ColorPreset, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, DocxEditor, type DocxEditorApplyDocumentOperationsOptions, type DocxEditorCollaboration, type DocxEditorHandle, type DocxEditorProps, type DocxEditorRef, type EditorHandle, type EditorMode, type EditorReadOnlyReason, type ExtractDocumentStyleSetOptions, FindReplaceDialog, type FindReplaceDialogProps, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioButtonProps, type FolioSuggestion, type FolioUIComponents, FolioUIProvider, type FontDefinition, type FontOption, FootnotePropertiesDialog, type FootnotePropertiesDialogProps, FormattingBar, type FormattingBarProps, type HighlightPassageOptions, type HighlightPassageResult, type HyperlinkBookmarkOption, HyperlinkDialog, type HyperlinkDialogData, type HyperlinkDialogProps, type ImageMeta, type ImagePositionData, ImagePositionDialog, type ImagePositionDialogProps, type ImagePropertiesData, ImagePropertiesDialog, type ImagePropertiesDialogProps, type ImageRef, InsertImageDialog, type InsertImageDialogData, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogData, type InsertTableDialogProps, type InsertTableStyleOption, type KeyboardShortcutScope, type MarkdownOptions, type MarkdownResult, type OutlineDepth, type OutlineItem, PageSetupDialog, type PageSetupDialogProps, PasteSpecialDialog, type PasteSpecialDialogProps, type PasteSpecialMode, type PictureWatermark, type PositionalText, type RenderAsyncOptions, type ResolvedAnchor, type ReviewDisplayMode, STELLA_STYLE_SET_NAME, type ScrollToParaIdOptions, SplitCellDialog, type SplitCellDialogData, type SplitCellDialogProps, type SuggestionAppliedAs, type SuggestionKind, type TableProperties, TablePropertiesDialog, type TablePropertiesDialogProps, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextWatermark, type UseWheelZoomOptions, type UseWheelZoomReturn, type Watermark, WatermarkDialog, type WatermarkDialogProps, type WordDiffSegment, ZOOM_PRESETS, ZoomControl, type ZoomControlProps, type ZoomLevel, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clampZoom, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, finishAutocompleteSuggestion, formatZoom, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getDocumentWatermark, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, insertImageFromFile, insertPageBreakInView, insertTableInView, insertTableOfContentsInView, inspectDocumentStyles, inspectDocumentStylesFromDocx, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, parseZoom, renderAsync, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setDocumentWatermark, setFocusedSuggestionMeta, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult, useWheelZoom };
207
+ export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyResult, AutocompleteCaretOverlay, type AutocompleteCaretOverlayProps, type AutocompleteCaretRect, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, type ColorPreset, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, DocxEditor, type DocxEditorApplyDocumentOperationsOptions, type DocxEditorCollaboration, type DocxEditorHandle, type DocxEditorProps, type DocxEditorRef, type EditorHandle, type EditorMode, type EditorReadOnlyReason, type ExtractDocumentStyleSetOptions, type FindMatch, type FindOptions, FindReplaceDialog, type FindReplaceDialogProps, type FindResult, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioButtonProps, type FolioSuggestion, type FolioUIComponents, FolioUIProvider, type FontDefinition, type FontOption, FootnotePropertiesDialog, type FootnotePropertiesDialogProps, FormattingBar, type FormattingBarProps, type HighlightPassageOptions, type HighlightPassageResult, type HyperlinkBookmarkOption, HyperlinkDialog, type HyperlinkDialogData, type HyperlinkDialogProps, type ImageMeta, type ImagePositionData, ImagePositionDialog, type ImagePositionDialogProps, type ImagePropertiesData, ImagePropertiesDialog, type ImagePropertiesDialogProps, type ImageRef, InsertImageDialog, type InsertImageDialogData, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogData, type InsertTableDialogProps, type InsertTableStyleOption, type KeyboardShortcutScope, type MarkdownOptions, type MarkdownResult, type OutlineDepth, type OutlineItem, PageSetupDialog, type PageSetupDialogProps, PasteSpecialDialog, type PasteSpecialDialogProps, type PasteSpecialMode, type PictureWatermark, type PositionalText, type RenderAsyncOptions, type ReplaceAllSummary, type ReplaceEligibility, type ResolvedAnchor, type ReviewDisplayMode, STELLA_STYLE_SET_NAME, type ScrollToParaIdOptions, SplitCellDialog, type SplitCellDialogData, type SplitCellDialogProps, type SuggestionAppliedAs, type SuggestionKind, type TableProperties, TablePropertiesDialog, type TablePropertiesDialogProps, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextWatermark, type UseWheelZoomOptions, type UseWheelZoomReturn, type Watermark, WatermarkDialog, type WatermarkDialogProps, type WordDiffSegment, ZOOM_PRESETS, ZoomControl, type ZoomControlProps, type ZoomLevel, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clampZoom, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, finishAutocompleteSuggestion, formatZoom, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getDocumentWatermark, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, insertImageFromFile, insertPageBreakInView, insertTableInView, insertTableOfContentsInView, inspectDocumentStyles, inspectDocumentStylesFromDocx, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, parseZoom, renderAsync, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setDocumentWatermark, setFocusedSuggestionMeta, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult, useWheelZoom };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as formatZoom, c as FormattingBar, d as AutocompleteCaretOverlay, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync } from "./renderAsync-D3Bxr14I.js";
1
+ import { a as formatZoom, c as FormattingBar, d as AutocompleteCaretOverlay, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync } from "./renderAsync-D6N8PUZ_.js";
2
2
  import { n as FolioUIProvider } from "./folio-ui-ruRywxeb.js";
3
- import { t as FindReplaceDialog } from "./FindReplaceDialog-CUd8xdgd.js";
3
+ import { t as FindReplaceDialog } from "./FindReplaceDialog-C3njN6OI.js";
4
4
  import { t as FootnotePropertiesDialog } from "./FootnotePropertiesDialog-BEs7N62_.js";
5
5
  import { a as InsertImageDialog, i as InsertTableDialog, n as SplitCellDialog, o as HyperlinkDialog, r as PasteSpecialDialog, t as WatermarkDialog } from "./dialogs-DGrcp10A.js";
6
6
  import { t as ImagePositionDialog } from "./ImagePositionDialog-Oap9knQ-.js";