@stll/folio-react 0.4.0 → 0.5.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 { y as containedHandler } from "./renderAsync-B4SrVWHb.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,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
2
- import "./useFindReplace-MZ8wi31A.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
3
2
  import React, { useCallback, useEffect, useRef, useState } from "react";
4
3
  import { ChevronDownIcon, ChevronUpIcon, SearchIcon, XIcon } from "lucide-react";
5
4
  import { useTranslations } from "use-intl";
@@ -1,4 +1,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
2
2
  import { useId, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/components/dialogs/FootnotePropertiesDialog.tsx
@@ -1,4 +1,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
2
2
  import { useEffect, useId, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/components/dialogs/ImagePositionDialog.tsx
@@ -1,4 +1,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
2
2
  import { useEffect, useId, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/components/dialogs/ImagePropertiesDialog.tsx
@@ -1,4 +1,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
2
2
  import { useEffect, useId, useState } from "react";
3
3
  import { TWIPS_PER_INCH } from "@stll/folio-core/utils/units";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { r as useFolioUI } from "./folio-ui-CA59webC.js";
1
+ import { _ as useFolioUI } from "./renderAsync-B4SrVWHb.js";
2
2
  import { useCallback, useEffect, useId, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/components/dialogs/TablePropertiesDialog.tsx
@@ -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-C_Jb8BBI.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-B4SrVWHb.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 };