@stll/folio-react 0.4.0 → 0.6.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
@@ -48,7 +48,7 @@ layout engine, DOCX ↔ Markdown), depend on `@stll/folio-core` directly.
48
48
 
49
49
  ## Peer dependencies
50
50
 
51
- `react` ^19 · `react-dom` ^19 · `use-intl` >=4
51
+ `react` ^18 or ^19 · `react-dom` ^18 or ^19 · `use-intl` >=4
52
52
 
53
53
  ## Acknowledgements
54
54
 
@@ -1,4 +1,4 @@
1
- import { t as containedHandler } from "./contained-handler-4uiqUVRn.js";
1
+ import { d as containedHandler } from "./renderAsync-CwHTsxBN.js";
2
2
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { CheckIcon, MoreVerticalIcon } from "lucide-react";
4
4
  import { useLocale, useTranslations } from "use-intl";
@@ -1,5 +1,5 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
2
- import "./useFindReplace-MZ8wi31A.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
3
3
  import React, { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { ChevronDownIcon, ChevronUpIcon, SearchIcon, XIcon } from "lucide-react";
5
5
  import { useTranslations } from "use-intl";
@@ -49,6 +49,7 @@ function getFindEnterAction({ searchText, result, shiftKey }) {
49
49
  * - findReplaceUtils.ts — Pure search/replace functions and types
50
50
  * - useFindReplace.ts — React hook for dialog state management
51
51
  */
52
+ var FindReplaceDialog_exports = /* @__PURE__ */ __exportAll({ FindReplaceDialog: () => FindReplaceDialog });
52
53
  /**
53
54
  * FindReplaceDialog component - Modal for finding and replacing text
54
55
  */
@@ -355,4 +356,4 @@ function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious
355
356
  });
356
357
  }
357
358
  //#endregion
358
- export { FindReplaceDialog };
359
+ export { FindReplaceDialog_exports as n, FindReplaceDialog as t };
@@ -1,4 +1,5 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
3
  import { useId, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/components/dialogs/FootnotePropertiesDialog.tsx
@@ -7,6 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
7
8
  *
8
9
  * Edits position, numbering format, start number, and restart rules.
9
10
  */
11
+ var FootnotePropertiesDialog_exports = /* @__PURE__ */ __exportAll({ FootnotePropertiesDialog: () => FootnotePropertiesDialog });
10
12
  const numberFormatOptions = [
11
13
  {
12
14
  value: "decimal",
@@ -262,4 +264,4 @@ function FootnotePropertiesDialog({ isOpen, onClose, onApply, footnotePr, endnot
262
264
  });
263
265
  }
264
266
  //#endregion
265
- export { FootnotePropertiesDialog };
267
+ export { FootnotePropertiesDialog_exports as n, FootnotePropertiesDialog as t };
@@ -1,4 +1,5 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
3
  import { useEffect, useId, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/components/dialogs/ImagePositionDialog.tsx
@@ -10,6 +11,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
10
11
  * - Vertical: alignment or offset, relative to page/margin/paragraph/line
11
12
  * - Distance from text (top/bottom/left/right)
12
13
  */
14
+ var ImagePositionDialog_exports = /* @__PURE__ */ __exportAll({ ImagePositionDialog: () => ImagePositionDialog });
13
15
  function ImagePositionDialog({ isOpen, onClose, onApply, currentData }) {
14
16
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
15
17
  const id = useId();
@@ -390,4 +392,4 @@ function ImagePositionDialog({ isOpen, onClose, onApply, currentData }) {
390
392
  });
391
393
  }
392
394
  //#endregion
393
- export { ImagePositionDialog };
395
+ export { ImagePositionDialog_exports as n, ImagePositionDialog as t };
@@ -1,4 +1,5 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
3
  import { useEffect, useId, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/components/dialogs/ImagePropertiesDialog.tsx
@@ -9,6 +10,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
9
10
  * - Alt text for accessibility
10
11
  * - Border/outline style, color, and width
11
12
  */
13
+ var ImagePropertiesDialog_exports = /* @__PURE__ */ __exportAll({ ImagePropertiesDialog: () => ImagePropertiesDialog });
12
14
  function ImagePropertiesDialog({ isOpen, onClose, onApply, currentData }) {
13
15
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
14
16
  const id = useId();
@@ -193,4 +195,4 @@ function ImagePropertiesDialog({ isOpen, onClose, onApply, currentData }) {
193
195
  });
194
196
  }
195
197
  //#endregion
196
- export { ImagePropertiesDialog };
198
+ export { ImagePropertiesDialog_exports as n, ImagePropertiesDialog as t };
@@ -1,4 +1,5 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
3
  import { useEffect, useId, useState } from "react";
3
4
  import { TWIPS_PER_INCH } from "@stll/folio-core/utils/units";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -11,6 +12,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
11
12
  * - Orientation (portrait/landscape)
12
13
  * - Margins (top, bottom, left, right) in inches
13
14
  */
15
+ var PageSetupDialog_exports = /* @__PURE__ */ __exportAll({ PageSetupDialog: () => PageSetupDialog });
14
16
  /** Common page sizes in twips (width x height in portrait orientation) */
15
17
  const PAGE_SIZES = [
16
18
  {
@@ -307,4 +309,4 @@ function PageSetupDialog({ isOpen, onClose, onApply, currentProps }) {
307
309
  });
308
310
  }
309
311
  //#endregion
310
- export { PageSetupDialog };
312
+ export { PageSetupDialog_exports as n, PageSetupDialog as t };
@@ -1,10 +1,12 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { o as useFolioUI } from "./useFindReplace-BPBpMWS9.js";
2
3
  import { useCallback, useEffect, useId, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/components/dialogs/TablePropertiesDialog.tsx
5
6
  /**
6
7
  * Table Properties Dialog — width type, width value, alignment.
7
8
  */
9
+ var TablePropertiesDialog_exports = /* @__PURE__ */ __exportAll({ TablePropertiesDialog: () => TablePropertiesDialog });
8
10
  function TablePropertiesDialog({ isOpen, onClose, onApply, currentProps }) {
9
11
  const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
10
12
  const id = useId();
@@ -154,4 +156,4 @@ function TablePropertiesDialog({ isOpen, onClose, onApply, currentProps }) {
154
156
  });
155
157
  }
156
158
  //#endregion
157
- export { TablePropertiesDialog };
159
+ export { TablePropertiesDialog_exports as n, TablePropertiesDialog as t };
@@ -0,0 +1,114 @@
1
+ import { i as renderAsync, n as EditorHandle, o as DocxEditorProps, r as RenderAsyncOptions, s as DocxEditorRef, t as DocxEditorHandle } from "../renderAsync-B7UJsZye.js";
2
+ import { ReactNode } from "react";
3
+ import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
4
+
5
+ //#region src/compat/eigenpal.d.ts
6
+ declare const VERSION = "folio-compat-eigenpal";
7
+ type LegacyTranslations = {
8
+ _lang?: string;
9
+ };
10
+ type LocaleCode = "en" | "de" | "fr" | "he" | "hi" | "pl" | "pt-BR" | "tr" | "zh-CN";
11
+ type LocaleProviderProps = {
12
+ children?: ReactNode | undefined;
13
+ i18n?: LegacyTranslations | undefined;
14
+ locale?: string | undefined;
15
+ };
16
+ type TFunction = (key: string, vars?: Record<string, string | number>) => string;
17
+ type LegacyDocxEditorProps = DocxEditorProps & {
18
+ agentPanel?: unknown;
19
+ colorMode?: "light" | "dark" | "system";
20
+ commentsSidebarOpen?: boolean;
21
+ disableFindReplaceShortcuts?: boolean;
22
+ documentName?: string;
23
+ documentNameEditable?: boolean;
24
+ externalContent?: boolean;
25
+ externalPlugins?: unknown[];
26
+ i18n?: LegacyTranslations;
27
+ locale?: string;
28
+ onCommentAdd?: unknown;
29
+ onCommentDelete?: unknown;
30
+ onCommentReply?: unknown;
31
+ onCommentResolve?: unknown;
32
+ onCommentsSidebarOpenChange?: unknown;
33
+ onDocumentNameChange?: unknown;
34
+ onOpen?: unknown;
35
+ onRenderedDomContextReady?: unknown;
36
+ pluginOverlays?: ReactNode;
37
+ pluginRenderedDomContext?: unknown;
38
+ pluginSidebarItems?: unknown[];
39
+ printOptions?: unknown;
40
+ renderLogo?: unknown;
41
+ renderTitleBarRight?: unknown;
42
+ showFileOpen?: boolean;
43
+ showHelpMenu?: boolean;
44
+ showOutlineButton?: boolean;
45
+ watermarkPresets?: readonly string[];
46
+ };
47
+ declare const en: {
48
+ _lang: string;
49
+ };
50
+ declare const de: {
51
+ _lang: string;
52
+ };
53
+ declare const fr: {
54
+ _lang: string;
55
+ };
56
+ declare const he: {
57
+ _lang: string;
58
+ };
59
+ declare const hi: {
60
+ _lang: string;
61
+ };
62
+ declare const pl: {
63
+ _lang: string;
64
+ };
65
+ declare const ptBR: {
66
+ _lang: string;
67
+ };
68
+ declare const tr: {
69
+ _lang: string;
70
+ };
71
+ declare const zhCN: {
72
+ _lang: string;
73
+ };
74
+ declare const locales: Record<LocaleCode, LegacyTranslations>;
75
+ declare const LocaleProvider: ({
76
+ children,
77
+ i18n,
78
+ locale
79
+ }: LocaleProviderProps) => import("react").JSX.Element;
80
+ declare const useTranslation: () => {
81
+ t: TFunction;
82
+ };
83
+ declare const DocxEditor: import("react").ForwardRefExoticComponent<DocxEditorProps & {
84
+ agentPanel?: unknown;
85
+ colorMode?: "light" | "dark" | "system";
86
+ commentsSidebarOpen?: boolean;
87
+ disableFindReplaceShortcuts?: boolean;
88
+ documentName?: string;
89
+ documentNameEditable?: boolean;
90
+ externalContent?: boolean;
91
+ externalPlugins?: unknown[];
92
+ i18n?: LegacyTranslations;
93
+ locale?: string;
94
+ onCommentAdd?: unknown;
95
+ onCommentDelete?: unknown;
96
+ onCommentReply?: unknown;
97
+ onCommentResolve?: unknown;
98
+ onCommentsSidebarOpenChange?: unknown;
99
+ onDocumentNameChange?: unknown;
100
+ onOpen?: unknown;
101
+ onRenderedDomContextReady?: unknown;
102
+ pluginOverlays?: ReactNode;
103
+ pluginRenderedDomContext?: unknown;
104
+ pluginSidebarItems?: unknown[];
105
+ printOptions?: unknown;
106
+ renderLogo?: unknown;
107
+ renderTitleBarRight?: unknown;
108
+ showFileOpen?: boolean;
109
+ showHelpMenu?: boolean;
110
+ showOutlineButton?: boolean;
111
+ watermarkPresets?: readonly string[];
112
+ } & import("react").RefAttributes<DocxEditorRef>>;
113
+ //#endregion
114
+ 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 };
@@ -0,0 +1,51 @@
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-CwHTsxBN.js";
2
+ import { t as messages_exports } from "../messages.js";
3
+ import { forwardRef } from "react";
4
+ import { IntlProvider, useTranslations } from "use-intl";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
7
+ //#region src/compat/eigenpal.tsx
8
+ const VERSION = "folio-compat-eigenpal";
9
+ const en = { _lang: "en" };
10
+ const de = { _lang: "de" };
11
+ const fr = { _lang: "fr" };
12
+ const he = { _lang: "he" };
13
+ const hi = { _lang: "hi" };
14
+ const pl = { _lang: "pl" };
15
+ const ptBR = { _lang: "pt-BR" };
16
+ const tr = { _lang: "tr" };
17
+ const zhCN = { _lang: "zh-CN" };
18
+ const locales = {
19
+ en,
20
+ de,
21
+ fr,
22
+ he,
23
+ hi,
24
+ pl,
25
+ "pt-BR": ptBR,
26
+ tr,
27
+ "zh-CN": zhCN
28
+ };
29
+ const LocaleProvider = ({ children, i18n, locale }) => {
30
+ const resolvedLocale = resolveLocale(locale, i18n);
31
+ return /* @__PURE__ */ jsx(IntlProvider, {
32
+ locale: resolvedLocale,
33
+ messages: (0, messages_exports.getFolioMessages)(resolvedLocale),
34
+ children
35
+ });
36
+ };
37
+ const useTranslation = () => {
38
+ return { t: useTranslations("folio") };
39
+ };
40
+ const DocxEditor = forwardRef(({ agentPanel: _agentPanel, colorMode: _colorMode, commentsSidebarOpen: _commentsSidebarOpen, disableFindReplaceShortcuts: _disableFindReplaceShortcuts, documentName: _documentName, documentNameEditable: _documentNameEditable, externalContent: _externalContent, externalPlugins: _externalPlugins, i18n, locale, onCommentAdd: _onCommentAdd, onCommentDelete: _onCommentDelete, onCommentReply: _onCommentReply, onCommentResolve: _onCommentResolve, onCommentsSidebarOpenChange: _onCommentsSidebarOpenChange, onDocumentNameChange: _onDocumentNameChange, onOpen: _onOpen, onRenderedDomContextReady: _onRenderedDomContextReady, pluginOverlays: _pluginOverlays, pluginRenderedDomContext: _pluginRenderedDomContext, pluginSidebarItems: _pluginSidebarItems, printOptions: _printOptions, renderLogo: _renderLogo, renderTitleBarRight: _renderTitleBarRight, showFileOpen: _showFileOpen, showHelpMenu: _showHelpMenu, showOutlineButton: _showOutlineButton, watermarkPresets: _watermarkPresets, ...props }, ref) => /* @__PURE__ */ jsx(LocaleProvider, {
41
+ i18n,
42
+ locale,
43
+ children: /* @__PURE__ */ jsx(DocxEditor$1, {
44
+ ...props,
45
+ ref
46
+ })
47
+ }));
48
+ DocxEditor.displayName = "EigenpalCompatDocxEditor";
49
+ const resolveLocale = (locale, i18n) => locale ?? i18n?._lang ?? "en";
50
+ //#endregion
51
+ export { DocxEditor, LocaleProvider, VERSION, createDocumentWithText, createEmptyDocument, de, en, fr, he, hi, locales, pl, ptBR, renderAsync, tr, useTranslation, zhCN };