@imjp/writenex-astro 0.1.0 → 1.3.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 +13 -13
- package/dist/{chunk-CYLDJ3HZ.js → chunk-GIS7XEJF.js} +4 -4
- package/dist/{chunk-CYLDJ3HZ.js.map → chunk-GIS7XEJF.js.map} +1 -1
- package/dist/{chunk-7XU5X6CW.js → chunk-GUUSVFBP.js} +12 -12
- package/dist/chunk-GUUSVFBP.js.map +1 -0
- package/dist/{chunk-XNTQTTJU.js → chunk-JFQQJPDF.js} +2 -2
- package/dist/{chunk-XNTQTTJU.js.map → chunk-JFQQJPDF.js.map} +1 -1
- package/dist/{chunk-CF2XXJFF.js → chunk-OWYFIQFK.js} +436 -436
- package/dist/chunk-OWYFIQFK.js.map +1 -0
- package/dist/{chunk-5PM6EQE5.js → chunk-S2OUQLMK.js} +7 -5
- package/dist/chunk-S2OUQLMK.js.map +1 -0
- package/dist/{chunk-AAOQHQPU.js → chunk-TQAYIZOA.js} +5 -5
- package/dist/{chunk-AAOQHQPU.js.map → chunk-TQAYIZOA.js.map} +1 -1
- package/dist/{chunk-CRPZUUDU.js → chunk-YBCPOLMY.js} +1 -1
- package/dist/{chunk-CRPZUUDU.js.map → chunk-YBCPOLMY.js.map} +1 -1
- package/dist/client/index.css +1 -1
- package/dist/client/index.css.map +1 -1
- package/dist/client/index.d.ts +19 -0
- package/dist/client/index.js +159 -147
- package/dist/client/index.js.map +1 -1
- package/dist/client/styles.css +2 -8
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -2
- package/dist/{config-BmEdBDo_.d.ts → config-CliL0CoN.d.ts} +1 -1
- package/dist/{content-BWR52vD-.d.ts → content-TuL3GT66.d.ts} +1 -1
- package/dist/discovery/index.d.ts +2 -2
- package/dist/discovery/index.js +3 -3
- package/dist/filesystem/index.d.ts +703 -703
- package/dist/filesystem/index.js +4 -4
- package/dist/filesystem/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{loader-55LWCXHA.js → loader-VGNXC2XJ.js} +3 -3
- package/dist/schema-DDJyoVkj.d.ts +189 -0
- package/dist/server/index.d.ts +37 -37
- package/dist/server/index.js +5 -5
- package/package.json +17 -18
- package/src/client/App.tsx +18 -18
- package/src/client/components/ConfigPanel/ConfigPanel.tsx +14 -13
- package/src/client/components/CreateContentModal/CreateContentModal.tsx +1 -1
- package/src/client/components/Editor/Editor.tsx +27 -27
- package/src/client/components/Editor/ImageDialog.tsx +4 -3
- package/src/client/components/Editor/LinkDialog.tsx +7 -6
- package/src/client/components/Editor/index.ts +1 -1
- package/src/client/components/FrontmatterForm/FrontmatterForm.css +1 -1
- package/src/client/components/FrontmatterForm/FrontmatterForm.tsx +1 -1
- package/src/client/components/Header/Header.tsx +8 -8
- package/src/client/components/KeyboardShortcuts/KeyboardShortcuts.tsx +1 -1
- package/src/client/components/LazyEditor.tsx +1 -1
- package/src/client/components/LiveRegion/index.ts +1 -1
- package/src/client/components/SearchReplace/SearchReplacePanel.tsx +5 -5
- package/src/client/components/SearchReplace/index.ts +1 -1
- package/src/client/components/SelectCollectionModal/SelectCollectionModal.tsx +2 -2
- package/src/client/components/Sidebar/Sidebar.tsx +6 -6
- package/src/client/components/SkipLink/index.ts +1 -1
- package/src/client/components/UnsavedChangesModal/UnsavedChangesModal.tsx +1 -1
- package/src/client/components/VersionHistory/DiffViewer.tsx +18 -11
- package/src/client/components/VersionHistory/VersionActions.tsx +6 -6
- package/src/client/components/VersionHistory/VersionHistoryPanel.tsx +10 -10
- package/src/client/components/VersionHistory/index.ts +2 -2
- package/src/client/context/ApiContext.tsx +2 -2
- package/src/client/context/ThemeContext.tsx +2 -2
- package/src/client/hooks/useApi.ts +1 -1
- package/src/client/hooks/useFocusTrap.ts +1 -1
- package/src/client/hooks/useSearch.ts +1 -1
- package/src/client/hooks/useVersionHistory.ts +2 -2
- package/src/client/index.tsx +1 -1
- package/src/client/styles.css +2 -8
- package/src/config/defaults.ts +4 -4
- package/src/config/index.ts +14 -16
- package/src/config/loader.ts +6 -4
- package/src/config/schema.ts +8 -4
- package/src/core/index.ts +1 -1
- package/src/discovery/collections.ts +3 -3
- package/src/discovery/index.ts +9 -11
- package/src/discovery/patterns.ts +2 -2
- package/src/discovery/schema.ts +1 -1
- package/src/filesystem/images.ts +3 -3
- package/src/filesystem/index.ts +74 -79
- package/src/filesystem/reader.ts +2 -2
- package/src/filesystem/version-config.ts +10 -10
- package/src/filesystem/versions.ts +9 -9
- package/src/filesystem/watcher.ts +1 -1
- package/src/filesystem/writer.ts +6 -6
- package/src/global.d.ts +39 -0
- package/src/index.ts +10 -10
- package/src/integration.ts +2 -2
- package/src/server/assets.ts +3 -3
- package/src/server/cache.ts +1 -1
- package/src/server/index.ts +12 -15
- package/src/server/middleware.ts +3 -3
- package/src/server/routes.ts +28 -28
- package/src/types/index.ts +24 -28
- package/dist/chunk-5PM6EQE5.js.map +0 -1
- package/dist/chunk-7XU5X6CW.js.map +0 -1
- package/dist/chunk-CF2XXJFF.js.map +0 -1
- package/dist/loader-CrdnaAWR.d.ts +0 -327
- /package/dist/{loader-55LWCXHA.js.map → loader-VGNXC2XJ.js.map} +0 -0
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/ConfigPanel
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Check,
|
|
13
|
+
ChevronDown,
|
|
14
|
+
Copy,
|
|
15
|
+
ExternalLink,
|
|
15
16
|
Folder,
|
|
16
17
|
Image,
|
|
17
18
|
Info,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Check,
|
|
21
|
-
ChevronDown,
|
|
19
|
+
Settings,
|
|
20
|
+
X,
|
|
22
21
|
} from "lucide-react";
|
|
23
|
-
import {
|
|
24
|
-
import type { Collection, WritenexClientConfig } from "../../hooks/useApi";
|
|
22
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
25
23
|
import { useSharedApi } from "../../context/ApiContext";
|
|
24
|
+
import type { Collection, WritenexClientConfig } from "../../hooks/useApi";
|
|
25
|
+
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
26
26
|
import {
|
|
27
|
-
|
|
27
|
+
type EditorType,
|
|
28
28
|
getAvailableEditors,
|
|
29
29
|
getPreferredEditor,
|
|
30
|
+
openInEditor,
|
|
30
31
|
setPreferredEditor,
|
|
31
|
-
type EditorType,
|
|
32
32
|
} from "../../utils/openInEditor";
|
|
33
33
|
import "./ConfigPanel.css";
|
|
34
34
|
|
|
@@ -71,8 +71,9 @@ export function ConfigPanel({
|
|
|
71
71
|
const [configPath, setConfigPath] = useState<string | null>(null);
|
|
72
72
|
const [hasConfigFile, setHasConfigFile] = useState(false);
|
|
73
73
|
const [copied, setCopied] = useState(false);
|
|
74
|
-
const [selectedEditor, setSelectedEditor] =
|
|
75
|
-
|
|
74
|
+
const [selectedEditor, setSelectedEditor] = useState<EditorType>(
|
|
75
|
+
getPreferredEditor()
|
|
76
|
+
);
|
|
76
77
|
const [showEditorDropdown, setShowEditorDropdown] = useState(false);
|
|
77
78
|
|
|
78
79
|
// Fetch config path when modal opens
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/CreateContentModal
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { FileText, X } from "lucide-react";
|
|
11
12
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
|
-
import { X, FileText } from "lucide-react";
|
|
13
13
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
14
14
|
import "./CreateContentModal.css";
|
|
15
15
|
|
|
@@ -8,42 +8,42 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/Editor
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
|
-
import { FileText, Plus } from "lucide-react";
|
|
13
11
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
markdownShortcutPlugin,
|
|
20
|
-
linkPlugin,
|
|
21
|
-
linkDialogPlugin,
|
|
22
|
-
imagePlugin,
|
|
23
|
-
tablePlugin,
|
|
12
|
+
addComposerChild$,
|
|
13
|
+
BlockTypeSelect,
|
|
14
|
+
BoldItalicUnderlineToggles,
|
|
15
|
+
CodeToggle,
|
|
16
|
+
CreateLink,
|
|
24
17
|
codeBlockPlugin,
|
|
25
18
|
codeMirrorPlugin,
|
|
26
|
-
|
|
19
|
+
DiffSourceToggleWrapper,
|
|
27
20
|
diffSourcePlugin,
|
|
28
|
-
frontmatterPlugin,
|
|
29
|
-
searchPlugin,
|
|
30
|
-
editorSearchTerm$,
|
|
31
21
|
editorSearchCursor$,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
CreateLink,
|
|
22
|
+
editorSearchTerm$,
|
|
23
|
+
frontmatterPlugin,
|
|
24
|
+
headingsPlugin,
|
|
25
|
+
InsertCodeBlock,
|
|
37
26
|
InsertImage,
|
|
38
27
|
InsertTable,
|
|
39
|
-
ListsToggle,
|
|
40
|
-
UndoRedo,
|
|
41
|
-
CodeToggle,
|
|
42
28
|
InsertThematicBreak,
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
imagePlugin,
|
|
30
|
+
ListsToggle,
|
|
31
|
+
linkDialogPlugin,
|
|
32
|
+
linkPlugin,
|
|
33
|
+
listsPlugin,
|
|
34
|
+
MDXEditor,
|
|
45
35
|
type MDXEditorMethods,
|
|
36
|
+
markdownShortcutPlugin,
|
|
37
|
+
quotePlugin,
|
|
38
|
+
searchPlugin,
|
|
39
|
+
tablePlugin,
|
|
40
|
+
thematicBreakPlugin,
|
|
41
|
+
toolbarPlugin,
|
|
42
|
+
UndoRedo,
|
|
43
|
+
usePublisher,
|
|
46
44
|
} from "@mdxeditor/editor";
|
|
45
|
+
import { FileText, Plus } from "lucide-react";
|
|
46
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
47
47
|
import "@mdxeditor/editor/style.css";
|
|
48
48
|
import "./Editor.css";
|
|
49
49
|
import { ImageDialog } from "./ImageDialog";
|
|
@@ -138,7 +138,7 @@ function SearchBridge(): null {
|
|
|
138
138
|
*/
|
|
139
139
|
function createSearchBridgePlugin() {
|
|
140
140
|
return {
|
|
141
|
-
//
|
|
141
|
+
// biome-ignore lint/suspicious/noExplicitAny: third party type
|
|
142
142
|
init: (realm: any) => {
|
|
143
143
|
realm.pub(addComposerChild$, SearchBridge);
|
|
144
144
|
},
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
* @module @writenex/astro/client/components/Editor/ImageDialog
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { useState, useRef, useEffect, useCallback } from "react";
|
|
21
|
-
import { usePublisher, useCellValue } from "@mdxeditor/editor";
|
|
22
20
|
import {
|
|
23
|
-
insertImage$,
|
|
24
21
|
closeImageDialog$,
|
|
25
22
|
imageDialogState$,
|
|
23
|
+
insertImage$,
|
|
26
24
|
saveImage$,
|
|
25
|
+
useCellValue,
|
|
26
|
+
usePublisher,
|
|
27
27
|
} from "@mdxeditor/editor";
|
|
28
28
|
import { Image as ImageIcon, Link as LinkIcon, Upload, X } from "lucide-react";
|
|
29
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
29
30
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
30
31
|
import "./ImageDialog.css";
|
|
31
32
|
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
* @module @writenex/astro/client/components/Editor/LinkDialog
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { useState, useCallback, useEffect, useRef } from "react";
|
|
21
|
-
import { usePublisher, useCellValue } from "@mdxeditor/editor";
|
|
22
20
|
import {
|
|
23
|
-
linkDialogState$,
|
|
24
21
|
cancelLinkEdit$,
|
|
25
|
-
|
|
26
|
-
switchFromPreviewToLinkEdit$,
|
|
22
|
+
linkDialogState$,
|
|
27
23
|
removeLink$,
|
|
24
|
+
switchFromPreviewToLinkEdit$,
|
|
25
|
+
updateLink$,
|
|
26
|
+
useCellValue,
|
|
27
|
+
usePublisher,
|
|
28
28
|
} from "@mdxeditor/editor";
|
|
29
|
-
import { Link as LinkIcon, Trash2,
|
|
29
|
+
import { Copy, Edit2, Link as LinkIcon, Trash2, X } from "lucide-react";
|
|
30
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
30
31
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
31
32
|
import "./LinkDialog.css";
|
|
32
33
|
|
|
@@ -409,7 +409,7 @@
|
|
|
409
409
|
|
|
410
410
|
/* Date input calendar icon - no invert for light mode */
|
|
411
411
|
.wn-light
|
|
412
|
-
|
|
412
|
+
.wn-frontmatter-input[type="date"]::-webkit-calendar-picker-indicator {
|
|
413
413
|
filter: none;
|
|
414
414
|
opacity: 0.6;
|
|
415
415
|
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/FrontmatterForm
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { AlertCircle, Info, X } from "lucide-react";
|
|
11
12
|
import { useCallback, useState } from "react";
|
|
12
|
-
import { X, Info, AlertCircle } from "lucide-react";
|
|
13
13
|
import type { CollectionSchema, SchemaField } from "../../../types";
|
|
14
14
|
import "./FrontmatterForm.css";
|
|
15
15
|
|
|
@@ -7,20 +7,20 @@
|
|
|
7
7
|
* @module @writenex/astro/client/components/Header
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { useState, useRef, useEffect } from "react";
|
|
11
10
|
import {
|
|
12
|
-
Keyboard,
|
|
13
|
-
Settings,
|
|
14
11
|
Folder,
|
|
12
|
+
History,
|
|
15
13
|
Info,
|
|
16
|
-
|
|
17
|
-
Sun,
|
|
18
|
-
Moon,
|
|
14
|
+
Keyboard,
|
|
19
15
|
Monitor,
|
|
20
|
-
|
|
16
|
+
Moon,
|
|
21
17
|
Plus,
|
|
18
|
+
Search,
|
|
19
|
+
Settings,
|
|
20
|
+
Sun,
|
|
22
21
|
} from "lucide-react";
|
|
23
|
-
import {
|
|
22
|
+
import { useEffect, useRef, useState } from "react";
|
|
23
|
+
import { type Theme, useTheme } from "../../context/ThemeContext";
|
|
24
24
|
import "./Header.css";
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/KeyboardShortcuts
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useEffect, useRef } from "react";
|
|
12
11
|
import { X } from "lucide-react";
|
|
12
|
+
import { useEffect, useRef } from "react";
|
|
13
13
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
14
14
|
import {
|
|
15
15
|
formatShortcut,
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* @module @writenex/astro/client/components/SearchReplace
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { useState, useCallback, useEffect, useRef } from "react";
|
|
11
10
|
import {
|
|
12
|
-
X,
|
|
13
|
-
ChevronUp,
|
|
14
|
-
ChevronDown,
|
|
15
11
|
CaseSensitive,
|
|
16
|
-
|
|
12
|
+
ChevronDown,
|
|
13
|
+
ChevronUp,
|
|
17
14
|
Regex,
|
|
18
15
|
Replace,
|
|
19
16
|
ReplaceAll,
|
|
17
|
+
WholeWord,
|
|
18
|
+
X,
|
|
20
19
|
} from "lucide-react";
|
|
20
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
21
21
|
import "./SearchReplacePanel.css";
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* @module @writenex/astro/client/components/SelectCollectionModal
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { ChevronRight, Folder, X } from "lucide-react";
|
|
10
11
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
11
|
-
import { X, Folder, ChevronRight } from "lucide-react";
|
|
12
|
-
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
13
12
|
import type { Collection } from "../../hooks/useApi";
|
|
13
|
+
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
14
14
|
import "./SelectCollectionModal.css";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -13,19 +13,19 @@
|
|
|
13
13
|
* @module @writenex/astro/client/components/Sidebar
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
16
|
import {
|
|
18
|
-
|
|
17
|
+
CheckCircle,
|
|
19
18
|
FileEdit,
|
|
20
19
|
Folder,
|
|
21
20
|
Plus,
|
|
22
|
-
CheckCircle,
|
|
23
21
|
RefreshCw,
|
|
24
22
|
Search,
|
|
23
|
+
X,
|
|
25
24
|
} from "lucide-react";
|
|
25
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
+
import { useAnnounce } from "../../hooks/useAnnounce";
|
|
26
27
|
import type { Collection, ContentSummary } from "../../hooks/useApi";
|
|
27
28
|
import { useArrowNavigation } from "../../hooks/useArrowNavigation";
|
|
28
|
-
import { useAnnounce } from "../../hooks/useAnnounce";
|
|
29
29
|
import "./Sidebar.css";
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -233,7 +233,7 @@ export function Sidebar({
|
|
|
233
233
|
|
|
234
234
|
useEffect(() => {
|
|
235
235
|
setSearchQuery("");
|
|
236
|
-
}, [
|
|
236
|
+
}, []);
|
|
237
237
|
|
|
238
238
|
const draftCount = useMemo(
|
|
239
239
|
() => contentItems.filter((item) => item.draft).length,
|
|
@@ -344,7 +344,7 @@ export function Sidebar({
|
|
|
344
344
|
// Reset content focus index when filtered items change
|
|
345
345
|
useEffect(() => {
|
|
346
346
|
setContentFocusIndex(0);
|
|
347
|
-
}, [
|
|
347
|
+
}, []);
|
|
348
348
|
|
|
349
349
|
// Announce search results when they change
|
|
350
350
|
useEffect(() => {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* @module @writenex/astro/client/components/UnsavedChangesModal
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { AlertTriangle, X } from "lucide-react";
|
|
12
13
|
import { useCallback, useEffect, useRef } from "react";
|
|
13
|
-
import { X, AlertTriangle } from "lucide-react";
|
|
14
14
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
15
15
|
import "./UnsavedChangesModal.css";
|
|
16
16
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/VersionHistory/DiffViewer
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { AlignLeft, Columns, X } from "lucide-react";
|
|
12
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
13
13
|
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
14
14
|
import "./DiffViewer.css";
|
|
15
15
|
|
|
@@ -56,16 +56,20 @@ function computeDiff(oldText: string, newText: string): DiffLine[] {
|
|
|
56
56
|
// Build LCS table
|
|
57
57
|
const m = oldLines.length;
|
|
58
58
|
const n = newLines.length;
|
|
59
|
-
const dp: number[][] = Array(
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const dp: number[][] = Array.from(
|
|
60
|
+
{ length: m + 1 },
|
|
61
|
+
() => Array(n + 1).fill(0) as number[]
|
|
62
|
+
) as number[][];
|
|
62
63
|
|
|
63
64
|
for (let i = 1; i <= m; i++) {
|
|
64
65
|
for (let j = 1; j <= n; j++) {
|
|
66
|
+
const prevDiag = (dp[i - 1]?.[j - 1] ?? 0) as number;
|
|
67
|
+
const prevUp = (dp[i - 1]?.[j] ?? 0) as number;
|
|
68
|
+
const prevLeft = (dp[i]?.[j - 1] ?? 0) as number;
|
|
65
69
|
if (oldLines[i - 1] === newLines[j - 1]) {
|
|
66
|
-
dp[i][j] =
|
|
70
|
+
dp[i]![j] = prevDiag + 1;
|
|
67
71
|
} else {
|
|
68
|
-
dp[i][j] = Math.max(
|
|
72
|
+
dp[i]![j] = Math.max(prevUp, prevLeft);
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
}
|
|
@@ -79,23 +83,26 @@ function computeDiff(oldText: string, newText: string): DiffLine[] {
|
|
|
79
83
|
if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {
|
|
80
84
|
stack.push({
|
|
81
85
|
type: "unchanged",
|
|
82
|
-
content: oldLines[i - 1],
|
|
86
|
+
content: oldLines[i - 1] ?? "",
|
|
83
87
|
oldLineNum: i,
|
|
84
88
|
newLineNum: j,
|
|
85
89
|
});
|
|
86
90
|
i--;
|
|
87
91
|
j--;
|
|
88
|
-
} else if (
|
|
92
|
+
} else if (
|
|
93
|
+
j > 0 &&
|
|
94
|
+
(i === 0 || (dp[i]?.[j - 1] ?? 0) >= (dp[i - 1]?.[j] ?? 0))
|
|
95
|
+
) {
|
|
89
96
|
stack.push({
|
|
90
97
|
type: "added",
|
|
91
|
-
content: newLines[j - 1],
|
|
98
|
+
content: newLines[j - 1] ?? "",
|
|
92
99
|
newLineNum: j,
|
|
93
100
|
});
|
|
94
101
|
j--;
|
|
95
102
|
} else if (i > 0) {
|
|
96
103
|
stack.push({
|
|
97
104
|
type: "removed",
|
|
98
|
-
content: oldLines[i - 1],
|
|
105
|
+
content: oldLines[i - 1] ?? "",
|
|
99
106
|
oldLineNum: i,
|
|
100
107
|
});
|
|
101
108
|
i--;
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
* @module @writenex/astro/client/components/VersionHistory/VersionActions
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useState, useEffect, useRef } from "react";
|
|
12
11
|
import {
|
|
13
|
-
|
|
14
|
-
GitCompare,
|
|
12
|
+
AlertTriangle,
|
|
15
13
|
Download,
|
|
16
|
-
|
|
14
|
+
GitCompare,
|
|
17
15
|
Loader2,
|
|
18
|
-
|
|
16
|
+
RotateCcw,
|
|
17
|
+
Trash2,
|
|
19
18
|
X,
|
|
20
19
|
} from "lucide-react";
|
|
21
|
-
import {
|
|
20
|
+
import { useEffect, useRef, useState } from "react";
|
|
22
21
|
import type { VersionEntry } from "../../../types";
|
|
22
|
+
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
23
23
|
import "./VersionActions.css";
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
* @module @writenex/astro/client/components/VersionHistory/VersionHistoryPanel
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { useEffect, useState, useRef } from "react";
|
|
11
10
|
import {
|
|
12
|
-
|
|
13
|
-
History,
|
|
11
|
+
AlertTriangle,
|
|
14
12
|
Clock,
|
|
15
|
-
|
|
16
|
-
RefreshCw,
|
|
13
|
+
History,
|
|
17
14
|
Loader2,
|
|
15
|
+
RefreshCw,
|
|
16
|
+
Tag,
|
|
18
17
|
Trash2,
|
|
19
|
-
|
|
18
|
+
X,
|
|
20
19
|
} from "lucide-react";
|
|
20
|
+
import { useEffect, useRef, useState } from "react";
|
|
21
21
|
import type { VersionEntry } from "../../../types";
|
|
22
|
+
import { useSharedVersionApi } from "../../context/ApiContext";
|
|
23
|
+
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
22
24
|
import {
|
|
23
|
-
useVersionHistory,
|
|
24
25
|
type DiffData,
|
|
26
|
+
useVersionHistory,
|
|
25
27
|
} from "../../hooks/useVersionHistory";
|
|
26
|
-
import { useSharedVersionApi } from "../../context/ApiContext";
|
|
27
|
-
import { useFocusTrap } from "../../hooks/useFocusTrap";
|
|
28
|
-
import { VersionActions } from "./VersionActions";
|
|
29
28
|
import { DiffViewer } from "./DiffViewer";
|
|
29
|
+
import { VersionActions } from "./VersionActions";
|
|
30
30
|
import "./VersionHistoryPanel.css";
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* @module @writenex/astro/client/components/VersionHistory
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export { VersionHistoryPanel } from "./VersionHistoryPanel";
|
|
8
|
-
export { VersionActions } from "./VersionActions";
|
|
9
7
|
export { DiffViewer } from "./DiffViewer";
|
|
8
|
+
export { VersionActions } from "./VersionActions";
|
|
9
|
+
export { VersionHistoryPanel } from "./VersionHistoryPanel";
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
createContext,
|
|
12
|
+
type ReactElement,
|
|
13
|
+
type ReactNode,
|
|
12
14
|
useContext,
|
|
13
15
|
useMemo,
|
|
14
|
-
type ReactNode,
|
|
15
|
-
type ReactElement,
|
|
16
16
|
} from "react";
|
|
17
17
|
import { createApiClient } from "../hooks/useApi";
|
|
18
18
|
import { createVersionApiClient } from "../hooks/useVersionHistory";
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @module @writenex/astro/client/hooks/useVersionHistory
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import type {
|
|
10
|
+
import { useCallback, useMemo, useState } from "react";
|
|
11
|
+
import type { Version, VersionEntry } from "../../types";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Version history API client configuration
|
package/src/client/index.tsx
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
import { StrictMode } from "react";
|
|
11
11
|
import { createRoot } from "react-dom/client";
|
|
12
12
|
import { App } from "./App";
|
|
13
|
-
import { ThemeProvider } from "./context/ThemeContext";
|
|
14
13
|
import { ApiProvider } from "./context/ApiContext";
|
|
14
|
+
import { ThemeProvider } from "./context/ThemeContext";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Configuration injected by the server
|
package/src/client/styles.css
CHANGED
|
@@ -35,14 +35,8 @@ body,
|
|
|
35
35
|
|
|
36
36
|
body {
|
|
37
37
|
font-family:
|
|
38
|
-
"Plus Jakarta Sans",
|
|
39
|
-
|
|
40
|
-
-apple-system,
|
|
41
|
-
"Segoe UI",
|
|
42
|
-
Roboto,
|
|
43
|
-
"Helvetica Neue",
|
|
44
|
-
Arial,
|
|
45
|
-
sans-serif;
|
|
38
|
+
"Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto,
|
|
39
|
+
"Helvetica Neue", Arial, sans-serif;
|
|
46
40
|
font-size: var(--wn-font-base);
|
|
47
41
|
line-height: 1.5;
|
|
48
42
|
background-color: var(--wn-zinc-950);
|
package/src/config/defaults.ts
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
|
-
WritenexConfig,
|
|
13
|
-
ImageConfig,
|
|
14
|
-
EditorConfig,
|
|
15
|
-
DiscoveryConfig,
|
|
16
12
|
CollectionConfig,
|
|
13
|
+
DiscoveryConfig,
|
|
14
|
+
EditorConfig,
|
|
15
|
+
ImageConfig,
|
|
17
16
|
VersionHistoryConfig,
|
|
17
|
+
WritenexConfig,
|
|
18
18
|
} from "@/types";
|
|
19
19
|
|
|
20
20
|
/**
|