merong-docs 0.1.11 → 1.0.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/OVERVIEW.md +19 -19
- package/OVERVIEW.zh-CN.md +19 -22
- package/README.md +77 -77
- package/README.zh-CN.md +81 -81
- package/client/android-file-share.ts +25 -25
- package/client/controls.tsx +163 -163
- package/client/document-panel.tsx +166 -166
- package/client/external-file.tsx +78 -78
- package/client/file-reader.tsx +43 -43
- package/client/markdown-panel.tsx +737 -737
- package/client/markdown-scroll.ts +122 -122
- package/client/messages.ts +224 -224
- package/client/native-contacts.ts +145 -145
- package/client/page-render-queue.ts +12 -12
- package/client/page-selection.tsx +227 -227
- package/client/page-tools.tsx +72 -72
- package/client/pdf-geometry.ts +96 -96
- package/client/pdf-panel.tsx +477 -477
- package/client/reader-find.tsx +190 -190
- package/client/reader-notice.tsx +46 -46
- package/client/settings.tsx +143 -143
- package/client/syntax.tsx +55 -55
- package/client/viewport-geometry.ts +61 -61
- package/client/web.ts +462 -462
- package/client/worksheet-panel.tsx +631 -631
- package/client/zoom-controls.tsx +140 -140
- package/index.client.tsx +36 -36
- package/index.server.ts +73 -73
- package/node_modules/markdown-it/bin/markdown-it.mjs +0 -0
- package/node_modules/yaml/bin.mjs +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/scripts/prepare-office.mjs +20 -20
- package/server/engine.ts +89 -89
- package/server/external-file.ts +42 -42
- package/server/generated/document-worker.ts +1 -1
- package/server/generated/rust-reader_bg.wasm +0 -0
- package/server/markdown-index.ts +305 -305
- package/server/markdown-links.ts +51 -51
- package/server/markdown-page.ts +120 -120
- package/server/office-fonts.cjs +824 -824
- package/server/office-location.ts +41 -41
- package/server/office-preview.ts +186 -186
- package/server/office-worker.cjs +49 -49
- package/server/office-xml.ts +79 -79
- package/server/pdf-engine.ts +168 -168
- package/server/pdf-text-geometry.ts +60 -60
- package/server/rust-reader.ts +40 -40
- package/server/structured-document.ts +69 -69
- package/server/text-search.ts +15 -15
- package/server/worker-entry.ts +42 -42
- package/server/worker-protocol.ts +38 -38
- package/server/worksheet.ts +67 -67
- package/server/workspace-file.ts +63 -63
- package/shared/contracts.ts +187 -187
- package/shared/file-limits.ts +5 -5
- package/shared/markdown-constants.ts +4 -4
- package/shared/markdown-math.ts +198 -198
- package/shared/markdown-references.ts +83 -83
- package/shared/markdown-source-location.ts +8 -8
- package/shared/reader-settings.ts +15 -15
- package/shared/reader-shortcuts.ts +132 -132
- package/vendor/office2pdf/office2pdf_bg.wasm +2 -2
package/client/controls.tsx
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
import { useSettings, useTranslation, type PluginFilePanelProps, type PluginHostProps } from "@getpaseo/plugin/client";
|
|
2
|
-
import { Icon, WorkspaceRowBadge } from "@getpaseo/plugin/client/ui";
|
|
3
|
-
import { Platform, Pressable, Text, TextInput, View, type TextInputProps, type ViewStyle } from "react-native";
|
|
4
|
-
import { memo, useEffect, useRef, useState, type ReactNode } from "react";
|
|
5
|
-
import { readerSettings } from "../shared/reader-settings";
|
|
6
|
-
import type { ReaderShortcuts } from "../shared/reader-shortcuts";
|
|
7
|
-
import { messages } from "./messages";
|
|
8
|
-
import { setWebTitle } from "./web";
|
|
9
|
-
|
|
10
|
-
export type Theme = PluginHostProps["theme"];
|
|
11
|
-
|
|
12
|
-
const defaultShortcuts: ReaderShortcuts = {};
|
|
13
|
-
const decimalFormatters = new Map<string, Intl.NumberFormat>();
|
|
14
|
-
const integerFormatters = new Map<string, Intl.NumberFormat>();
|
|
15
|
-
|
|
16
|
-
function formatNumber(locale: string, value: number, decimals: boolean) {
|
|
17
|
-
const cache = decimals ? decimalFormatters : integerFormatters;
|
|
18
|
-
let formatter = cache.get(locale);
|
|
19
|
-
if (!formatter) {
|
|
20
|
-
formatter = new Intl.NumberFormat(locale, decimals ? { maximumFractionDigits: 2 } : undefined);
|
|
21
|
-
cache.set(locale, formatter);
|
|
22
|
-
}
|
|
23
|
-
return formatter.format(value);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isTabActive(tab: PluginFilePanelProps["tab"]) {
|
|
27
|
-
return (tab as typeof tab & { active?: boolean }).active !== false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function useReaderShortcuts() {
|
|
31
|
-
const settings = useSettings(readerSettings);
|
|
32
|
-
const current = useRef(defaultShortcuts);
|
|
33
|
-
current.current = settings.status === "ready" ? settings.values.shortcuts : defaultShortcuts;
|
|
34
|
-
return current;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function useWebTitle<T = View>(value?: string) {
|
|
38
|
-
const ref = useRef<T>(null);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (Platform.OS === "web" && value) return setWebTitle(ref.current, value);
|
|
41
|
-
}, [value]);
|
|
42
|
-
return ref;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function Control({ title, icon, label, theme, compact, disabled = false, selected, small, onPress }: {
|
|
46
|
-
title: string;
|
|
47
|
-
icon?: string;
|
|
48
|
-
label?: string;
|
|
49
|
-
theme: Theme;
|
|
50
|
-
compact: boolean;
|
|
51
|
-
disabled?: boolean;
|
|
52
|
-
selected?: boolean;
|
|
53
|
-
small?: boolean;
|
|
54
|
-
onPress: () => void;
|
|
55
|
-
}) {
|
|
56
|
-
const hint = useWebTitle(icon || label ? title : undefined);
|
|
57
|
-
const size = small ? 25 : compact ? 40 : 32;
|
|
58
|
-
return (
|
|
59
|
-
<Pressable
|
|
60
|
-
ref={hint}
|
|
61
|
-
onPress={onPress}
|
|
62
|
-
hitSlop={small ? 4 : undefined}
|
|
63
|
-
disabled={disabled}
|
|
64
|
-
accessibilityRole="button"
|
|
65
|
-
accessibilityLabel={title}
|
|
66
|
-
accessibilityState={{ disabled, selected }}
|
|
67
|
-
{...(Platform.OS === "web" && selected !== undefined ? { "aria-pressed": selected } : {})}
|
|
68
|
-
style={({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => ({
|
|
69
|
-
height: size,
|
|
70
|
-
minWidth: size,
|
|
71
|
-
paddingHorizontal: icon ? 0 : 8,
|
|
72
|
-
borderRadius: 6,
|
|
73
|
-
alignItems: "center",
|
|
74
|
-
justifyContent: "center",
|
|
75
|
-
backgroundColor: selected || pressed || hovered ? theme.colors.surface2 : "transparent",
|
|
76
|
-
opacity: disabled ? 0.45 : 1,
|
|
77
|
-
})}
|
|
78
|
-
>
|
|
79
|
-
{icon ? <Icon name={icon} size={small ? 14 : 18} color={small ? theme.colors.foregroundMuted : theme.colors.foreground} /> : (
|
|
80
|
-
<Text style={{ color: theme.colors.foreground, fontSize: 13, fontWeight: selected ? "600" : "500" }}>
|
|
81
|
-
{label ?? title}
|
|
82
|
-
</Text>
|
|
83
|
-
)}
|
|
84
|
-
</Pressable>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const ReaderFileBadge = memo(function ReaderFileBadge({ size, lines }: { size?: number; lines?: number }) {
|
|
89
|
-
const { t, locale } = useTranslation(messages);
|
|
90
|
-
const labels: string[] = [];
|
|
91
|
-
if (size !== undefined) {
|
|
92
|
-
const [unit, divisor]: [string, number] = size < 1024 ? ["B", 1] : size < 1024 ** 2 ? ["KiB", 1024]
|
|
93
|
-
: size < 1024 ** 3 ? ["MiB", 1024 ** 2] : ["GiB", 1024 ** 3];
|
|
94
|
-
labels.push(`${formatNumber(locale, size / divisor, true)} ${unit}`);
|
|
95
|
-
}
|
|
96
|
-
if (lines !== undefined) labels.push(t("fileLines", { lines: formatNumber(locale, lines, false) }));
|
|
97
|
-
if (!labels.length) return null;
|
|
98
|
-
return <WorkspaceRowBadge label={labels.join(" · ")} />;
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export function Toolbar({ theme, children, filePanel, lines, nativePrimary }: {
|
|
102
|
-
theme: Theme; children: ReactNode; filePanel?: PluginFilePanelProps; lines?: number; nativePrimary?: ReactNode;
|
|
103
|
-
}) {
|
|
104
|
-
const { t } = useTranslation(messages);
|
|
105
|
-
const row: ViewStyle = {
|
|
106
|
-
alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 4, paddingHorizontal: 8, paddingVertical: 4,
|
|
107
|
-
};
|
|
108
|
-
const background = { borderBottomWidth: 1, borderBottomColor: theme.colors.border, backgroundColor: theme.colors.surface0 };
|
|
109
|
-
const tab = filePanel?.tab as (PluginFilePanelProps["tab"] & { close?: () => void }) | undefined;
|
|
110
|
-
const native = Platform.OS !== "web";
|
|
111
|
-
const close = !native && filePanel && !filePanel.layout.compact ? tab?.close : undefined;
|
|
112
|
-
return (
|
|
113
|
-
<View style={background}>
|
|
114
|
-
{native && nativePrimary && (
|
|
115
|
-
<View style={[row, { paddingBottom: 0 }]}>{nativePrimary}</View>
|
|
116
|
-
)}
|
|
117
|
-
<View style={row}>
|
|
118
|
-
{children}
|
|
119
|
-
{filePanel && (
|
|
120
|
-
<View testID={lines === undefined ? "merong-file-metadata" : "merong-markdown-metadata"}
|
|
121
|
-
style={{ marginLeft: "auto", flexShrink: 1, minWidth: 0 }}>
|
|
122
|
-
<ReaderFileBadge size={filePanel.file.size} lines={lines} />
|
|
123
|
-
</View>
|
|
124
|
-
)}
|
|
125
|
-
{close && <Control icon="X" title={t("closeReader")} theme={theme} compact={false} onPress={close} />}
|
|
126
|
-
</View>
|
|
127
|
-
</View>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function ReaderInput({ theme, style, ...props }: TextInputProps & { theme: Theme }) {
|
|
132
|
-
return <TextInput {...props} style={[{
|
|
133
|
-
flexGrow: 1, flexShrink: 1, minWidth: 84, paddingHorizontal: 8, paddingVertical: 5,
|
|
134
|
-
color: theme.colors.foreground, borderColor: theme.colors.border, borderWidth: 1, borderRadius: 6,
|
|
135
|
-
}, style]} placeholderTextColor={theme.colors.foregroundMuted} />;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function ReadError({ theme, label, error, retry, onRetry, compact }: {
|
|
139
|
-
theme: Theme; label: string; error: unknown; retry: string; onRetry: () => void; compact: boolean;
|
|
140
|
-
}) {
|
|
141
|
-
const { t } = useTranslation(messages);
|
|
142
|
-
const message = error instanceof Error ? error.message : "";
|
|
143
|
-
const detail = message.includes("PDF exceeds the preview limit") ? t("pdfTooLarge")
|
|
144
|
-
: message.includes("Document exceeds the preview limit") ? t("documentTooLarge")
|
|
145
|
-
: message.includes("supports UTF-8") ? t("textEncoding")
|
|
146
|
-
: message.includes("File changed") || message.includes("File ended") ? t("fileChanged")
|
|
147
|
-
: message.includes("outside the workspace") ? t("outsideWorkspace")
|
|
148
|
-
: message.includes("File is no longer available") || message.includes("ENOENT") ? t("fileUnavailable")
|
|
149
|
-
: undefined;
|
|
150
|
-
return (
|
|
151
|
-
<View accessibilityRole="alert" style={{ alignItems: "flex-start", gap: 6, padding: 16 }}>
|
|
152
|
-
<Text style={{ color: theme.colors.foreground, fontWeight: "600" }}>{label}</Text>
|
|
153
|
-
{detail && <Text selectable style={{ color: theme.colors.foregroundMuted }}>{detail}</Text>}
|
|
154
|
-
<Control title={retry} onPress={onRetry} theme={theme} compact={compact} />
|
|
155
|
-
</View>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function useFileGeneration(file: PluginFilePanelProps["file"]) {
|
|
160
|
-
const [generation, setGeneration] = useState(0);
|
|
161
|
-
useEffect(() => file.watch(() => setGeneration((value) => value + 1)), [file]);
|
|
162
|
-
return generation;
|
|
163
|
-
}
|
|
1
|
+
import { useSettings, useTranslation, type PluginFilePanelProps, type PluginHostProps } from "@getpaseo/plugin/client";
|
|
2
|
+
import { Icon, WorkspaceRowBadge } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { Platform, Pressable, Text, TextInput, View, type TextInputProps, type ViewStyle } from "react-native";
|
|
4
|
+
import { memo, useEffect, useRef, useState, type ReactNode } from "react";
|
|
5
|
+
import { readerSettings } from "../shared/reader-settings";
|
|
6
|
+
import type { ReaderShortcuts } from "../shared/reader-shortcuts";
|
|
7
|
+
import { messages } from "./messages";
|
|
8
|
+
import { setWebTitle } from "./web";
|
|
9
|
+
|
|
10
|
+
export type Theme = PluginHostProps["theme"];
|
|
11
|
+
|
|
12
|
+
const defaultShortcuts: ReaderShortcuts = {};
|
|
13
|
+
const decimalFormatters = new Map<string, Intl.NumberFormat>();
|
|
14
|
+
const integerFormatters = new Map<string, Intl.NumberFormat>();
|
|
15
|
+
|
|
16
|
+
function formatNumber(locale: string, value: number, decimals: boolean) {
|
|
17
|
+
const cache = decimals ? decimalFormatters : integerFormatters;
|
|
18
|
+
let formatter = cache.get(locale);
|
|
19
|
+
if (!formatter) {
|
|
20
|
+
formatter = new Intl.NumberFormat(locale, decimals ? { maximumFractionDigits: 2 } : undefined);
|
|
21
|
+
cache.set(locale, formatter);
|
|
22
|
+
}
|
|
23
|
+
return formatter.format(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function isTabActive(tab: PluginFilePanelProps["tab"]) {
|
|
27
|
+
return (tab as typeof tab & { active?: boolean }).active !== false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function useReaderShortcuts() {
|
|
31
|
+
const settings = useSettings(readerSettings);
|
|
32
|
+
const current = useRef(defaultShortcuts);
|
|
33
|
+
current.current = settings.status === "ready" ? settings.values.shortcuts : defaultShortcuts;
|
|
34
|
+
return current;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useWebTitle<T = View>(value?: string) {
|
|
38
|
+
const ref = useRef<T>(null);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (Platform.OS === "web" && value) return setWebTitle(ref.current, value);
|
|
41
|
+
}, [value]);
|
|
42
|
+
return ref;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function Control({ title, icon, label, theme, compact, disabled = false, selected, small, onPress }: {
|
|
46
|
+
title: string;
|
|
47
|
+
icon?: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
theme: Theme;
|
|
50
|
+
compact: boolean;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
selected?: boolean;
|
|
53
|
+
small?: boolean;
|
|
54
|
+
onPress: () => void;
|
|
55
|
+
}) {
|
|
56
|
+
const hint = useWebTitle(icon || label ? title : undefined);
|
|
57
|
+
const size = small ? 25 : compact ? 40 : 32;
|
|
58
|
+
return (
|
|
59
|
+
<Pressable
|
|
60
|
+
ref={hint}
|
|
61
|
+
onPress={onPress}
|
|
62
|
+
hitSlop={small ? 4 : undefined}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
accessibilityRole="button"
|
|
65
|
+
accessibilityLabel={title}
|
|
66
|
+
accessibilityState={{ disabled, selected }}
|
|
67
|
+
{...(Platform.OS === "web" && selected !== undefined ? { "aria-pressed": selected } : {})}
|
|
68
|
+
style={({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => ({
|
|
69
|
+
height: size,
|
|
70
|
+
minWidth: size,
|
|
71
|
+
paddingHorizontal: icon ? 0 : 8,
|
|
72
|
+
borderRadius: 6,
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
backgroundColor: selected || pressed || hovered ? theme.colors.surface2 : "transparent",
|
|
76
|
+
opacity: disabled ? 0.45 : 1,
|
|
77
|
+
})}
|
|
78
|
+
>
|
|
79
|
+
{icon ? <Icon name={icon} size={small ? 14 : 18} color={small ? theme.colors.foregroundMuted : theme.colors.foreground} /> : (
|
|
80
|
+
<Text style={{ color: theme.colors.foreground, fontSize: 13, fontWeight: selected ? "600" : "500" }}>
|
|
81
|
+
{label ?? title}
|
|
82
|
+
</Text>
|
|
83
|
+
)}
|
|
84
|
+
</Pressable>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const ReaderFileBadge = memo(function ReaderFileBadge({ size, lines }: { size?: number; lines?: number }) {
|
|
89
|
+
const { t, locale } = useTranslation(messages);
|
|
90
|
+
const labels: string[] = [];
|
|
91
|
+
if (size !== undefined) {
|
|
92
|
+
const [unit, divisor]: [string, number] = size < 1024 ? ["B", 1] : size < 1024 ** 2 ? ["KiB", 1024]
|
|
93
|
+
: size < 1024 ** 3 ? ["MiB", 1024 ** 2] : ["GiB", 1024 ** 3];
|
|
94
|
+
labels.push(`${formatNumber(locale, size / divisor, true)} ${unit}`);
|
|
95
|
+
}
|
|
96
|
+
if (lines !== undefined) labels.push(t("fileLines", { lines: formatNumber(locale, lines, false) }));
|
|
97
|
+
if (!labels.length) return null;
|
|
98
|
+
return <WorkspaceRowBadge label={labels.join(" · ")} />;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export function Toolbar({ theme, children, filePanel, lines, nativePrimary }: {
|
|
102
|
+
theme: Theme; children: ReactNode; filePanel?: PluginFilePanelProps; lines?: number; nativePrimary?: ReactNode;
|
|
103
|
+
}) {
|
|
104
|
+
const { t } = useTranslation(messages);
|
|
105
|
+
const row: ViewStyle = {
|
|
106
|
+
alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 4, paddingHorizontal: 8, paddingVertical: 4,
|
|
107
|
+
};
|
|
108
|
+
const background = { borderBottomWidth: 1, borderBottomColor: theme.colors.border, backgroundColor: theme.colors.surface0 };
|
|
109
|
+
const tab = filePanel?.tab as (PluginFilePanelProps["tab"] & { close?: () => void }) | undefined;
|
|
110
|
+
const native = Platform.OS !== "web";
|
|
111
|
+
const close = !native && filePanel && !filePanel.layout.compact ? tab?.close : undefined;
|
|
112
|
+
return (
|
|
113
|
+
<View style={background}>
|
|
114
|
+
{native && nativePrimary && (
|
|
115
|
+
<View style={[row, { paddingBottom: 0 }]}>{nativePrimary}</View>
|
|
116
|
+
)}
|
|
117
|
+
<View style={row}>
|
|
118
|
+
{children}
|
|
119
|
+
{filePanel && (
|
|
120
|
+
<View testID={lines === undefined ? "merong-file-metadata" : "merong-markdown-metadata"}
|
|
121
|
+
style={{ marginLeft: "auto", flexShrink: 1, minWidth: 0 }}>
|
|
122
|
+
<ReaderFileBadge size={filePanel.file.size} lines={lines} />
|
|
123
|
+
</View>
|
|
124
|
+
)}
|
|
125
|
+
{close && <Control icon="X" title={t("closeReader")} theme={theme} compact={false} onPress={close} />}
|
|
126
|
+
</View>
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function ReaderInput({ theme, style, ...props }: TextInputProps & { theme: Theme }) {
|
|
132
|
+
return <TextInput {...props} style={[{
|
|
133
|
+
flexGrow: 1, flexShrink: 1, minWidth: 84, paddingHorizontal: 8, paddingVertical: 5,
|
|
134
|
+
color: theme.colors.foreground, borderColor: theme.colors.border, borderWidth: 1, borderRadius: 6,
|
|
135
|
+
}, style]} placeholderTextColor={theme.colors.foregroundMuted} />;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function ReadError({ theme, label, error, retry, onRetry, compact }: {
|
|
139
|
+
theme: Theme; label: string; error: unknown; retry: string; onRetry: () => void; compact: boolean;
|
|
140
|
+
}) {
|
|
141
|
+
const { t } = useTranslation(messages);
|
|
142
|
+
const message = error instanceof Error ? error.message : "";
|
|
143
|
+
const detail = message.includes("PDF exceeds the preview limit") ? t("pdfTooLarge")
|
|
144
|
+
: message.includes("Document exceeds the preview limit") ? t("documentTooLarge")
|
|
145
|
+
: message.includes("supports UTF-8") ? t("textEncoding")
|
|
146
|
+
: message.includes("File changed") || message.includes("File ended") ? t("fileChanged")
|
|
147
|
+
: message.includes("outside the workspace") ? t("outsideWorkspace")
|
|
148
|
+
: message.includes("File is no longer available") || message.includes("ENOENT") ? t("fileUnavailable")
|
|
149
|
+
: undefined;
|
|
150
|
+
return (
|
|
151
|
+
<View accessibilityRole="alert" style={{ alignItems: "flex-start", gap: 6, padding: 16 }}>
|
|
152
|
+
<Text style={{ color: theme.colors.foreground, fontWeight: "600" }}>{label}</Text>
|
|
153
|
+
{detail && <Text selectable style={{ color: theme.colors.foregroundMuted }}>{detail}</Text>}
|
|
154
|
+
<Control title={retry} onPress={onRetry} theme={theme} compact={compact} />
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function useFileGeneration(file: PluginFilePanelProps["file"]) {
|
|
160
|
+
const [generation, setGeneration] = useState(0);
|
|
161
|
+
useEffect(() => file.watch(() => setGeneration((value) => value + 1)), [file]);
|
|
162
|
+
return generation;
|
|
163
|
+
}
|