@f-office/docs-react 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/chrome.d.ts +3 -1
- package/dist/docs-provider.d.ts +4 -0
- package/dist/f-office-docs.d.ts +3 -2
- package/dist/fidelity.d.ts +15 -0
- package/dist/header.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1053 -635
- package/dist/styles.css +1 -1
- package/dist/ui/popover.d.ts +7 -0
- package/dist/use-docs-commands.d.ts +16 -0
- package/dist/use-docs-exports.d.ts +11 -0
- package/dist/use-docs-persistence.d.ts +18 -0
- package/dist/use-docs-theme.d.ts +9 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,12 +27,13 @@ export function Page() {
|
|
|
27
27
|
|
|
28
28
|
## Custom header & navigation (`<DocsProvider>`)
|
|
29
29
|
|
|
30
|
-
Compose your own header (brand links, Next.js / React Router `<Link>`, site navigation) using `<DocsProvider>` and the exported header primitives:
|
|
30
|
+
Compose your own header (brand links, Next.js / React Router `<Link>`, site navigation) using `<DocsProvider>` and the exported header primitives (add `<DocsFidelityBanner />` below your `<header>` to show the dismissible banner when fonts fall back or content is degraded; `<DocsTitle />` includes the header fidelity indicator automatically):
|
|
31
31
|
|
|
32
32
|
```tsx
|
|
33
33
|
import {
|
|
34
34
|
DocsCanvas,
|
|
35
35
|
DocsDialogs,
|
|
36
|
+
DocsFidelityBanner,
|
|
36
37
|
DocsMark,
|
|
37
38
|
DocsOpenButton,
|
|
38
39
|
DocsOutlineButton,
|
|
@@ -57,6 +58,7 @@ export function DocsRoute() {
|
|
|
57
58
|
<DocsThemeButton />
|
|
58
59
|
<DocsOpenButton />
|
|
59
60
|
</header>
|
|
61
|
+
<DocsFidelityBanner />
|
|
60
62
|
<DocsCanvas />
|
|
61
63
|
<DocsDialogs />
|
|
62
64
|
</DocsProvider>
|
|
@@ -67,7 +69,7 @@ export function DocsRoute() {
|
|
|
67
69
|
|
|
68
70
|
## Headless React 19 wrapper (`<FOfficeDocs />`)
|
|
69
71
|
|
|
70
|
-
For zero UI chrome (no header, menus, floating outline button, dialogs, or stylesheet required; pass `outlineButton` if you want the floating outline toggle), with optional `onProgress` and `
|
|
72
|
+
For zero UI chrome (no header, menus, floating outline button, dialogs, or stylesheet required; pass `outlineButton` if you want the floating outline toggle), with optional `onProgress`, `onPagesChange`, and `onFidelityChange` callbacks:
|
|
71
73
|
|
|
72
74
|
```tsx
|
|
73
75
|
import { FOfficeDocs } from "@f-office/docs-react";
|
|
@@ -82,6 +84,7 @@ export function EmbeddedDoc({ file }: { file: File }) {
|
|
|
82
84
|
onPagesChange={({ pageCount, complete }) =>
|
|
83
85
|
console.log(`${pageCount}${complete ? "" : "…"} pages`)
|
|
84
86
|
}
|
|
87
|
+
onFidelityChange={(report) => console.log(report?.level)}
|
|
85
88
|
/>
|
|
86
89
|
</div>
|
|
87
90
|
);
|
package/dist/chrome.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CommandId, type FontMode, type OpenProgress } from "@f-office/docs/chrome";
|
|
1
|
+
import { type CommandId, type FidelityReport, type FontMode, type OpenProgress } from "@f-office/docs/chrome";
|
|
2
2
|
import type { Theme } from "./theme.js";
|
|
3
3
|
/** Dialogs opened from the menu bar. */
|
|
4
4
|
export type DialogKind = "shortcuts" | "about" | "advanced";
|
|
@@ -20,6 +20,8 @@ export type ChromeState = {
|
|
|
20
20
|
readonly layoutComplete: boolean;
|
|
21
21
|
/** Active loading/pagination progress snapshot, or `null` when idle. */
|
|
22
22
|
readonly progress: OpenProgress | null;
|
|
23
|
+
/** Typed rendering fidelity report once layout completes, or `null` when unavailable. */
|
|
24
|
+
readonly fidelity: FidelityReport | null;
|
|
23
25
|
readonly theme: Theme;
|
|
24
26
|
readonly fonts: FontMode;
|
|
25
27
|
/** Whether the browser supports reading locally installed fonts. */
|
package/dist/docs-provider.d.ts
CHANGED
|
@@ -44,6 +44,10 @@ export type DocsContextValue = {
|
|
|
44
44
|
readonly setTarget: (id: string) => void;
|
|
45
45
|
readonly dialog: ShownDialog | null;
|
|
46
46
|
readonly closeDialog: () => void;
|
|
47
|
+
readonly fidelityOpen: boolean;
|
|
48
|
+
readonly setFidelityOpen: (open: boolean) => void;
|
|
49
|
+
readonly fidelityBannerDismissed: boolean;
|
|
50
|
+
readonly dismissFidelityBanner: () => void;
|
|
47
51
|
};
|
|
48
52
|
/** Internal wiring shared between {@link DocsProvider} and {@link DocsCanvas}. */
|
|
49
53
|
export type DocsInternalValue = {
|
package/dist/f-office-docs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type Ref } from "react";
|
|
2
|
-
import { type DocsChrome, type DocsEvents, type DocsSource, type FOfficeDocsElement, type FontSource, type HighlightItem, type OpenProgress, type ZoomSetting } from "@f-office/docs";
|
|
2
|
+
import { type DocsChrome, type DocsEvents, type DocsSource, type FidelityReport, type FOfficeDocsElement, type FontSource, type HighlightItem, type OpenProgress, type ZoomSetting } from "@f-office/docs";
|
|
3
3
|
import type { MenuRequest, View, ViewerFiles } from "@f-office/docs/chrome";
|
|
4
4
|
export type FOfficeDocsProps = {
|
|
5
5
|
/** Ref to the underlying `<f-office-docs>` Custom Element (React 19 plain ref prop). */
|
|
@@ -31,6 +31,7 @@ export type FOfficeDocsProps = {
|
|
|
31
31
|
onOpen?: (detail: DocsEvents["open"]) => void;
|
|
32
32
|
onPagesChange?: (detail: DocsEvents["pageschange"]) => void;
|
|
33
33
|
onProgress?: (progress: OpenProgress) => void;
|
|
34
|
+
onFidelityChange?: (fidelity: FidelityReport | null) => void;
|
|
34
35
|
onViewChange?: (view: View) => void;
|
|
35
36
|
onPageChange?: (detail: DocsEvents["pagechange"]) => void;
|
|
36
37
|
onOutlineChange?: (detail: DocsEvents["outlinechange"]) => void;
|
|
@@ -43,4 +44,4 @@ export type FOfficeDocsProps = {
|
|
|
43
44
|
* Unopinionated React 19 wrapper around the `<f-office-docs>` Web Component.
|
|
44
45
|
* Assumes zero UI chrome, menus, or styling framework.
|
|
45
46
|
*/
|
|
46
|
-
export declare function FOfficeDocs({ ref, source, name, zoom, target, chrome, outlineButton, readOnly, outlineOpen, fontSource, highlights, moduleUrls, className, style, onOpen, onPagesChange, onProgress, onViewChange, onPageChange, onOutlineChange, onSelectionChange, onMenu, onError, }: FOfficeDocsProps): import("react").JSX.Element;
|
|
47
|
+
export declare function FOfficeDocs({ ref, source, name, zoom, target, chrome, outlineButton, readOnly, outlineOpen, fontSource, highlights, moduleUrls, className, style, onOpen, onPagesChange, onProgress, onFidelityChange, onViewChange, onPageChange, onOutlineChange, onSelectionChange, onMenu, onError, }: FOfficeDocsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document Fidelity indicator in the header beside the document title:
|
|
3
|
+
* a quiet check icon when everything matches exactly, or a warning pill when
|
|
4
|
+
* fonts are substituted or content is degraded. Clicking opens the Document Fidelity popover.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DocsFidelityPill({ className }: {
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Dismissible single-line fidelity banner directly below the header.
|
|
11
|
+
* Shown ONLY for `approximate` and `degraded` documents — never for `exact` stand-ins.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DocsFidelityBanner({ className }: {
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react").JSX.Element | null;
|
package/dist/header.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function DocsMark({ className, alt, }: {
|
|
|
7
7
|
export declare function DocsOutlineButton({ className }: {
|
|
8
8
|
className?: string;
|
|
9
9
|
}): import("react").JSX.Element | null;
|
|
10
|
-
/** Document title heading + {@link DocsMenuBar}, bound to {@link useDocs}. */
|
|
10
|
+
/** Document title heading + {@link DocsFidelityPill} + {@link DocsMenuBar}, bound to {@link useDocs}. */
|
|
11
11
|
export declare function DocsTitle({ fallback, className, }: {
|
|
12
12
|
fallback?: string;
|
|
13
13
|
className?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { DocsCanvas } from "./docs-canvas.js";
|
|
|
3
3
|
export { DocsProvider, useDocs, type DocsContextValue, type DocsProviderProps, } from "./docs-provider.js";
|
|
4
4
|
export { DocsDialogs, DocsWordmark } from "./dialogs.js";
|
|
5
5
|
export { FOfficeDocs, type FOfficeDocsProps } from "./f-office-docs.js";
|
|
6
|
+
export { DocsFidelityBanner, DocsFidelityPill } from "./fidelity.js";
|
|
6
7
|
export { DocsHeader, DocsMark, DocsOpenButton, DocsOutlineButton, DocsPageControls, DocsThemeButton, DocsTitle, } from "./header.js";
|
|
7
8
|
export { DocsMenuBar } from "./menus.js";
|
|
8
9
|
export { DocsStart } from "./start.js";
|