@imjp/writenex-astro 0.1.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 +539 -0
- package/dist/chunk-5PM6EQE5.js +151 -0
- package/dist/chunk-5PM6EQE5.js.map +1 -0
- package/dist/chunk-7XU5X6CW.js +1331 -0
- package/dist/chunk-7XU5X6CW.js.map +1 -0
- package/dist/chunk-AAOQHQPU.js +574 -0
- package/dist/chunk-AAOQHQPU.js.map +1 -0
- package/dist/chunk-CF2XXJFF.js +1410 -0
- package/dist/chunk-CF2XXJFF.js.map +1 -0
- package/dist/chunk-CRPZUUDU.js +52 -0
- package/dist/chunk-CRPZUUDU.js.map +1 -0
- package/dist/chunk-CYLDJ3HZ.js +310 -0
- package/dist/chunk-CYLDJ3HZ.js.map +1 -0
- package/dist/chunk-KIKIPIFA.js +1 -0
- package/dist/chunk-KIKIPIFA.js.map +1 -0
- package/dist/chunk-XNTQTTJU.js +145 -0
- package/dist/chunk-XNTQTTJU.js.map +1 -0
- package/dist/client/index.css +2 -0
- package/dist/client/index.css.map +1 -0
- package/dist/client/index.js +375 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/styles.css +584 -0
- package/dist/client/variables.css +304 -0
- package/dist/config/index.d.ts +54 -0
- package/dist/config/index.js +38 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config-BmEdBDo_.d.ts +220 -0
- package/dist/content-BWR52vD-.d.ts +64 -0
- package/dist/discovery/index.d.ts +310 -0
- package/dist/discovery/index.js +38 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/errors-C0iYiDTv.d.ts +107 -0
- package/dist/filesystem/index.d.ts +1292 -0
- package/dist/filesystem/index.js +203 -0
- package/dist/filesystem/index.js.map +1 -0
- package/dist/image-FP7w5ZIs.d.ts +47 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +151 -0
- package/dist/index.js.map +1 -0
- package/dist/loader-55LWCXHA.js +12 -0
- package/dist/loader-55LWCXHA.js.map +1 -0
- package/dist/loader-CrdnaAWR.d.ts +327 -0
- package/dist/server/index.d.ts +357 -0
- package/dist/server/index.js +37 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +94 -0
- package/src/client/App.tsx +900 -0
- package/src/client/components/ConfigPanel/ConfigPanel.css +553 -0
- package/src/client/components/ConfigPanel/ConfigPanel.tsx +396 -0
- package/src/client/components/ConfigPanel/index.ts +6 -0
- package/src/client/components/CreateContentModal/CreateContentModal.css +327 -0
- package/src/client/components/CreateContentModal/CreateContentModal.tsx +216 -0
- package/src/client/components/CreateContentModal/index.ts +7 -0
- package/src/client/components/Editor/Editor.css +885 -0
- package/src/client/components/Editor/Editor.tsx +484 -0
- package/src/client/components/Editor/ImageDialog.css +344 -0
- package/src/client/components/Editor/ImageDialog.tsx +367 -0
- package/src/client/components/Editor/LinkDialog.css +326 -0
- package/src/client/components/Editor/LinkDialog.tsx +332 -0
- package/src/client/components/Editor/index.ts +6 -0
- package/src/client/components/FrontmatterForm/FrontmatterForm.css +468 -0
- package/src/client/components/FrontmatterForm/FrontmatterForm.tsx +914 -0
- package/src/client/components/FrontmatterForm/index.ts +7 -0
- package/src/client/components/Header/Header.css +300 -0
- package/src/client/components/Header/Header.tsx +300 -0
- package/src/client/components/Header/index.ts +7 -0
- package/src/client/components/KeyboardShortcuts/KeyboardShortcuts.css +239 -0
- package/src/client/components/KeyboardShortcuts/KeyboardShortcuts.tsx +151 -0
- package/src/client/components/KeyboardShortcuts/index.ts +6 -0
- package/src/client/components/LazyEditor.tsx +75 -0
- package/src/client/components/LiveRegion/LiveRegion.css +19 -0
- package/src/client/components/LiveRegion/LiveRegion.tsx +60 -0
- package/src/client/components/LiveRegion/index.ts +7 -0
- package/src/client/components/SearchReplace/SearchReplacePanel.css +300 -0
- package/src/client/components/SearchReplace/SearchReplacePanel.tsx +332 -0
- package/src/client/components/SearchReplace/index.ts +7 -0
- package/src/client/components/SelectCollectionModal/SelectCollectionModal.css +308 -0
- package/src/client/components/SelectCollectionModal/SelectCollectionModal.tsx +223 -0
- package/src/client/components/SelectCollectionModal/index.ts +7 -0
- package/src/client/components/Sidebar/Sidebar.css +570 -0
- package/src/client/components/Sidebar/Sidebar.tsx +617 -0
- package/src/client/components/Sidebar/index.ts +7 -0
- package/src/client/components/SkipLink/SkipLink.css +51 -0
- package/src/client/components/SkipLink/SkipLink.tsx +67 -0
- package/src/client/components/SkipLink/index.ts +7 -0
- package/src/client/components/UnsavedChangesModal/UnsavedChangesModal.css +233 -0
- package/src/client/components/UnsavedChangesModal/UnsavedChangesModal.tsx +160 -0
- package/src/client/components/UnsavedChangesModal/index.ts +1 -0
- package/src/client/components/VersionHistory/DiffViewer.css +430 -0
- package/src/client/components/VersionHistory/DiffViewer.tsx +383 -0
- package/src/client/components/VersionHistory/VersionActions.css +318 -0
- package/src/client/components/VersionHistory/VersionActions.tsx +277 -0
- package/src/client/components/VersionHistory/VersionHistoryPanel.css +369 -0
- package/src/client/components/VersionHistory/VersionHistoryPanel.tsx +469 -0
- package/src/client/components/VersionHistory/index.ts +9 -0
- package/src/client/context/ApiContext.tsx +154 -0
- package/src/client/context/ThemeContext.tsx +172 -0
- package/src/client/hooks/useAnnounce.ts +201 -0
- package/src/client/hooks/useApi.ts +374 -0
- package/src/client/hooks/useArrowNavigation.ts +286 -0
- package/src/client/hooks/useAutosave.ts +241 -0
- package/src/client/hooks/useFocusTrap.ts +178 -0
- package/src/client/hooks/useKeyboardShortcuts.ts +203 -0
- package/src/client/hooks/useSearch.ts +206 -0
- package/src/client/hooks/useVersionHistory.ts +451 -0
- package/src/client/index.tsx +70 -0
- package/src/client/styles.css +584 -0
- package/src/client/utils/focus.ts +57 -0
- package/src/client/utils/openInEditor.ts +130 -0
- package/src/client/variables.css +304 -0
- package/src/config/defaults.ts +109 -0
- package/src/config/index.ts +32 -0
- package/src/config/loader.ts +174 -0
- package/src/config/schema.ts +161 -0
- package/src/core/constants.ts +39 -0
- package/src/core/errors.ts +739 -0
- package/src/core/index.ts +11 -0
- package/src/discovery/collections.ts +216 -0
- package/src/discovery/index.ts +33 -0
- package/src/discovery/patterns.ts +702 -0
- package/src/discovery/schema.ts +453 -0
- package/src/filesystem/images.ts +798 -0
- package/src/filesystem/index.ts +107 -0
- package/src/filesystem/reader.ts +452 -0
- package/src/filesystem/version-config.ts +390 -0
- package/src/filesystem/versions.ts +1339 -0
- package/src/filesystem/watcher.ts +226 -0
- package/src/filesystem/writer.ts +540 -0
- package/src/index.ts +61 -0
- package/src/integration.ts +228 -0
- package/src/server/assets.ts +254 -0
- package/src/server/cache.ts +355 -0
- package/src/server/index.ts +33 -0
- package/src/server/middleware.ts +209 -0
- package/src/server/routes.ts +1428 -0
- package/src/types/api.ts +61 -0
- package/src/types/config.ts +134 -0
- package/src/types/content.ts +64 -0
- package/src/types/image.ts +48 -0
- package/src/types/index.ts +58 -0
- package/src/types/version.ts +117 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility for opening files in external editors
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to open files in VS Code, Cursor, and other
|
|
5
|
+
* editors that support URL protocols.
|
|
6
|
+
*
|
|
7
|
+
* @module @writenex/astro/client/utils/openInEditor
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Supported editor types
|
|
12
|
+
*/
|
|
13
|
+
export type EditorType = "vscode" | "cursor" | "vscode-insiders" | "windsurf";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Editor configuration
|
|
17
|
+
*/
|
|
18
|
+
interface EditorConfig {
|
|
19
|
+
name: string;
|
|
20
|
+
protocol: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Map of supported editors and their URL protocols
|
|
26
|
+
*/
|
|
27
|
+
const EDITORS: Record<EditorType, EditorConfig> = {
|
|
28
|
+
vscode: {
|
|
29
|
+
name: "vscode",
|
|
30
|
+
protocol: "vscode://file",
|
|
31
|
+
displayName: "VS Code",
|
|
32
|
+
},
|
|
33
|
+
"vscode-insiders": {
|
|
34
|
+
name: "vscode-insiders",
|
|
35
|
+
protocol: "vscode-insiders://file",
|
|
36
|
+
displayName: "VS Code Insiders",
|
|
37
|
+
},
|
|
38
|
+
cursor: {
|
|
39
|
+
name: "cursor",
|
|
40
|
+
protocol: "cursor://file",
|
|
41
|
+
displayName: "Cursor",
|
|
42
|
+
},
|
|
43
|
+
windsurf: {
|
|
44
|
+
name: "windsurf",
|
|
45
|
+
protocol: "windsurf://file",
|
|
46
|
+
displayName: "Windsurf",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get list of available editors
|
|
52
|
+
*/
|
|
53
|
+
export function getAvailableEditors(): EditorConfig[] {
|
|
54
|
+
return Object.values(EDITORS);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Build editor URL for opening a file
|
|
59
|
+
*
|
|
60
|
+
* @param filePath - Absolute path to the file
|
|
61
|
+
* @param editor - Editor type to use
|
|
62
|
+
* @param line - Optional line number to jump to
|
|
63
|
+
* @param column - Optional column number
|
|
64
|
+
* @returns URL string for opening the file
|
|
65
|
+
*/
|
|
66
|
+
export function buildEditorUrl(
|
|
67
|
+
filePath: string,
|
|
68
|
+
editor: EditorType = "vscode",
|
|
69
|
+
line?: number,
|
|
70
|
+
column?: number
|
|
71
|
+
): string {
|
|
72
|
+
const editorConfig = EDITORS[editor];
|
|
73
|
+
if (!editorConfig) {
|
|
74
|
+
throw new Error(`Unknown editor: ${editor}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let url = `${editorConfig.protocol}${filePath}`;
|
|
78
|
+
|
|
79
|
+
// Add line and column if provided
|
|
80
|
+
if (line !== undefined) {
|
|
81
|
+
url += `:${line}`;
|
|
82
|
+
if (column !== undefined) {
|
|
83
|
+
url += `:${column}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return url;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Open a file in the specified editor
|
|
92
|
+
*
|
|
93
|
+
* @param filePath - Absolute path to the file
|
|
94
|
+
* @param editor - Editor type to use (default: vscode)
|
|
95
|
+
* @param line - Optional line number to jump to
|
|
96
|
+
* @returns true if the URL was opened, false otherwise
|
|
97
|
+
*/
|
|
98
|
+
export function openInEditor(
|
|
99
|
+
filePath: string,
|
|
100
|
+
editor: EditorType = "vscode",
|
|
101
|
+
line?: number
|
|
102
|
+
): boolean {
|
|
103
|
+
try {
|
|
104
|
+
const url = buildEditorUrl(filePath, editor, line);
|
|
105
|
+
window.open(url, "_self");
|
|
106
|
+
return true;
|
|
107
|
+
} catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get the preferred editor from localStorage
|
|
114
|
+
*/
|
|
115
|
+
export function getPreferredEditor(): EditorType {
|
|
116
|
+
if (typeof window === "undefined") return "vscode";
|
|
117
|
+
const stored = localStorage.getItem("writenex-preferred-editor");
|
|
118
|
+
if (stored && stored in EDITORS) {
|
|
119
|
+
return stored as EditorType;
|
|
120
|
+
}
|
|
121
|
+
return "vscode";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Save the preferred editor to localStorage
|
|
126
|
+
*/
|
|
127
|
+
export function setPreferredEditor(editor: EditorType): void {
|
|
128
|
+
if (typeof window === "undefined") return;
|
|
129
|
+
localStorage.setItem("writenex-preferred-editor", editor);
|
|
130
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CSS Custom Properties (Variables) for @writenex/astro
|
|
3
|
+
*
|
|
4
|
+
* Consolidated color system for the Astro Integration.
|
|
5
|
+
* All colors should reference these variables for consistency.
|
|
6
|
+
*
|
|
7
|
+
* Color Philosophy:
|
|
8
|
+
* - Minimal palette: fewer colors = more consistency
|
|
9
|
+
* - Brand colors for primary actions and accents
|
|
10
|
+
* - Zinc neutrals for UI chrome
|
|
11
|
+
* - Semantic colors only for status indicators
|
|
12
|
+
* - Alpha variants for overlays and subtle backgrounds
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
:root {
|
|
16
|
+
/* ==========================================================================
|
|
17
|
+
Writenex Brand Colors (Blue Palette)
|
|
18
|
+
Primary brand identity - use for CTAs, links, focus states, selections
|
|
19
|
+
|
|
20
|
+
Base RGB values for alpha generation:
|
|
21
|
+
- brand-500: #335dff = rgb(51, 93, 255)
|
|
22
|
+
========================================================================== */
|
|
23
|
+
|
|
24
|
+
--wn-brand-rgb: 51 93 255;
|
|
25
|
+
--wn-brand-400: #5c7cff; /* Secondary/hover - lighter brand */
|
|
26
|
+
--wn-brand-500: #335dff; /* Primary brand - logo color */
|
|
27
|
+
--wn-brand-600: #2a4ecc; /* Pressed/active states */
|
|
28
|
+
|
|
29
|
+
/* Brand with alpha - derived from --wn-brand-rgb */
|
|
30
|
+
--wn-brand-alpha-10: rgb(var(--wn-brand-rgb) / 0.1);
|
|
31
|
+
--wn-brand-alpha-15: rgb(var(--wn-brand-rgb) / 0.15);
|
|
32
|
+
--wn-brand-alpha-20: rgb(var(--wn-brand-rgb) / 0.2);
|
|
33
|
+
--wn-brand-alpha-30: rgb(var(--wn-brand-rgb) / 0.3);
|
|
34
|
+
|
|
35
|
+
/* ==========================================================================
|
|
36
|
+
Neutral Colors (Zinc Palette)
|
|
37
|
+
UI chrome, backgrounds, borders, text
|
|
38
|
+
========================================================================== */
|
|
39
|
+
|
|
40
|
+
--wn-zinc-50: #fafafa;
|
|
41
|
+
--wn-zinc-100: #f4f4f5;
|
|
42
|
+
--wn-zinc-150: #ececef;
|
|
43
|
+
--wn-zinc-200: #e4e4e7;
|
|
44
|
+
--wn-zinc-300: #d4d4d8;
|
|
45
|
+
--wn-zinc-400: #a1a1aa;
|
|
46
|
+
--wn-zinc-500: #71717a;
|
|
47
|
+
--wn-zinc-600: #52525b;
|
|
48
|
+
--wn-zinc-700: #3f3f46;
|
|
49
|
+
--wn-zinc-800: #27272a;
|
|
50
|
+
--wn-zinc-850: #1f1f23;
|
|
51
|
+
--wn-zinc-900: #18181b;
|
|
52
|
+
--wn-zinc-950: #09090b;
|
|
53
|
+
|
|
54
|
+
/* ==========================================================================
|
|
55
|
+
Semantic Colors (Status Indicators)
|
|
56
|
+
Status indicators - success, warning, error, info
|
|
57
|
+
|
|
58
|
+
Each color has:
|
|
59
|
+
- RGB base for alpha generation
|
|
60
|
+
- 400 shade (lighter, for dark mode text/icons)
|
|
61
|
+
- 500 shade (base)
|
|
62
|
+
- Alpha variants derived from RGB base
|
|
63
|
+
========================================================================== */
|
|
64
|
+
|
|
65
|
+
/* Success (Emerald) - saved, published, added
|
|
66
|
+
Base: #10b981 = rgb(16, 185, 129) */
|
|
67
|
+
--wn-success-rgb: 16 185 129;
|
|
68
|
+
--wn-success-400: #34d399;
|
|
69
|
+
--wn-success-500: #10b981;
|
|
70
|
+
--wn-success-alpha-10: rgb(var(--wn-success-rgb) / 0.1);
|
|
71
|
+
--wn-success-alpha-15: rgb(var(--wn-success-rgb) / 0.15);
|
|
72
|
+
--wn-success-alpha-20: rgb(var(--wn-success-rgb) / 0.2);
|
|
73
|
+
--wn-success-alpha-30: rgb(var(--wn-success-rgb) / 0.3);
|
|
74
|
+
--wn-success-alpha-40: rgb(var(--wn-success-rgb) / 0.4);
|
|
75
|
+
|
|
76
|
+
/* Warning (Amber) - draft, pending, caution
|
|
77
|
+
Base: #f59e0b = rgb(245, 158, 11) */
|
|
78
|
+
--wn-warning-rgb: 245 158 11;
|
|
79
|
+
--wn-warning-400: #fbbf24;
|
|
80
|
+
--wn-warning-500: #f59e0b;
|
|
81
|
+
--wn-warning-alpha-10: rgb(var(--wn-warning-rgb) / 0.1);
|
|
82
|
+
--wn-warning-alpha-30: rgb(var(--wn-warning-rgb) / 0.3);
|
|
83
|
+
--wn-warning-alpha-40: rgb(var(--wn-warning-rgb) / 0.4);
|
|
84
|
+
|
|
85
|
+
/* Error (Red) - errors, destructive actions, removed
|
|
86
|
+
Base: #ef4444 = rgb(239, 68, 68) */
|
|
87
|
+
--wn-error-rgb: 239 68 68;
|
|
88
|
+
--wn-error-400: #f87171;
|
|
89
|
+
--wn-error-500: #ef4444;
|
|
90
|
+
--wn-error-600: #dc2626;
|
|
91
|
+
--wn-error-alpha-10: rgb(var(--wn-error-rgb) / 0.1);
|
|
92
|
+
--wn-error-alpha-15: rgb(var(--wn-error-rgb) / 0.15);
|
|
93
|
+
--wn-error-alpha-20: rgb(var(--wn-error-rgb) / 0.2);
|
|
94
|
+
|
|
95
|
+
/* Info (Violet) - labels, badges, metadata
|
|
96
|
+
Base: #8b5cf6 = rgb(139, 92, 246) */
|
|
97
|
+
--wn-info-rgb: 139 92 246;
|
|
98
|
+
--wn-info-400: #a78bfa;
|
|
99
|
+
--wn-info-500: #8b5cf6;
|
|
100
|
+
--wn-info-alpha-15: rgb(var(--wn-info-rgb) / 0.15);
|
|
101
|
+
--wn-info-alpha-20: rgb(var(--wn-info-rgb) / 0.2);
|
|
102
|
+
|
|
103
|
+
/* ==========================================================================
|
|
104
|
+
Overlay & Backdrop Colors
|
|
105
|
+
For modal backdrops, hover states, subtle backgrounds
|
|
106
|
+
========================================================================== */
|
|
107
|
+
|
|
108
|
+
/* Dark mode overlays (white-based) */
|
|
109
|
+
--wn-overlay-3: rgba(255, 255, 255, 0.03);
|
|
110
|
+
--wn-overlay-5: rgba(255, 255, 255, 0.05);
|
|
111
|
+
--wn-overlay-10: rgba(255, 255, 255, 0.1);
|
|
112
|
+
--wn-overlay-15: rgba(255, 255, 255, 0.15);
|
|
113
|
+
|
|
114
|
+
/* Light mode overlays (black-based) */
|
|
115
|
+
--wn-overlay-light-3: rgba(0, 0, 0, 0.03);
|
|
116
|
+
--wn-overlay-light-5: rgba(0, 0, 0, 0.05);
|
|
117
|
+
--wn-overlay-light-8: rgba(0, 0, 0, 0.08);
|
|
118
|
+
--wn-overlay-light-10: rgba(0, 0, 0, 0.1);
|
|
119
|
+
--wn-overlay-light-20: rgba(0, 0, 0, 0.2);
|
|
120
|
+
--wn-overlay-light-30: rgba(0, 0, 0, 0.3);
|
|
121
|
+
|
|
122
|
+
/* Modal/dialog backdrops */
|
|
123
|
+
--wn-backdrop: rgba(0, 0, 0, 0.7);
|
|
124
|
+
--wn-backdrop-light: rgba(0, 0, 0, 0.5);
|
|
125
|
+
--wn-backdrop-heavy: rgba(0, 0, 0, 0.8);
|
|
126
|
+
|
|
127
|
+
/* ==========================================================================
|
|
128
|
+
Special Purpose Colors
|
|
129
|
+
Specific use cases that don't fit other categories
|
|
130
|
+
========================================================================== */
|
|
131
|
+
|
|
132
|
+
/* Search/highlight */
|
|
133
|
+
--wn-highlight: #fde047;
|
|
134
|
+
--wn-highlight-alpha-25: rgba(253, 224, 71, 0.25);
|
|
135
|
+
|
|
136
|
+
/* Selection */
|
|
137
|
+
--wn-selection: rgba(99, 102, 241, 0.3);
|
|
138
|
+
--wn-selection-light: rgba(99, 102, 241, 0.2);
|
|
139
|
+
|
|
140
|
+
/* ==========================================================================
|
|
141
|
+
Semantic Aliases
|
|
142
|
+
Contextual names for common use cases (optional, for clarity)
|
|
143
|
+
========================================================================== */
|
|
144
|
+
|
|
145
|
+
/* Backgrounds */
|
|
146
|
+
--wn-bg-app: var(--wn-zinc-950);
|
|
147
|
+
--wn-bg-surface: var(--wn-zinc-900);
|
|
148
|
+
--wn-bg-elevated: var(--wn-zinc-800);
|
|
149
|
+
--wn-bg-input: var(--wn-zinc-950);
|
|
150
|
+
|
|
151
|
+
/* Borders */
|
|
152
|
+
--wn-border: var(--wn-zinc-700);
|
|
153
|
+
--wn-border-subtle: var(--wn-zinc-800);
|
|
154
|
+
--wn-border-strong: var(--wn-zinc-600);
|
|
155
|
+
|
|
156
|
+
/* Text */
|
|
157
|
+
--wn-text-primary: var(--wn-zinc-50);
|
|
158
|
+
--wn-text-secondary: var(--wn-zinc-400);
|
|
159
|
+
--wn-text-muted: var(--wn-zinc-500);
|
|
160
|
+
--wn-text-subtle: var(--wn-zinc-600);
|
|
161
|
+
|
|
162
|
+
/* Interactive states */
|
|
163
|
+
--wn-focus-ring: var(--wn-brand-500);
|
|
164
|
+
--wn-hover-bg: var(--wn-overlay-10);
|
|
165
|
+
--wn-active-bg: var(--wn-overlay-15);
|
|
166
|
+
|
|
167
|
+
/* ==========================================================================
|
|
168
|
+
Font Size Scale
|
|
169
|
+
UI Text Sizes - Fixed sizes for interface elements
|
|
170
|
+
========================================================================== */
|
|
171
|
+
|
|
172
|
+
--wn-font-xs: 0.75rem; /* 12px - badges, hints, kbd */
|
|
173
|
+
--wn-font-sm: 0.8125rem; /* 13px - secondary text */
|
|
174
|
+
--wn-font-base: 0.875rem; /* 14px - default UI text */
|
|
175
|
+
--wn-font-md: 1rem; /* 16px - panel titles */
|
|
176
|
+
--wn-font-lg: 1.125rem; /* 18px - section titles */
|
|
177
|
+
|
|
178
|
+
/* Editor Content Sizes - Fluid for readability */
|
|
179
|
+
--wn-font-prose: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
|
|
180
|
+
--wn-font-h1: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
|
|
181
|
+
--wn-font-h2: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
|
|
182
|
+
--wn-font-h3: clamp(1.125rem, 1rem + 0.3vw, 1.25rem);
|
|
183
|
+
--wn-font-h4: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
|
|
184
|
+
--wn-font-h5: var(--wn-font-prose);
|
|
185
|
+
--wn-font-h6: var(--wn-font-base);
|
|
186
|
+
|
|
187
|
+
/* ==========================================================================
|
|
188
|
+
Spacing Scale
|
|
189
|
+
Consistent spacing for padding, margin, and gap
|
|
190
|
+
========================================================================== */
|
|
191
|
+
|
|
192
|
+
--wn-space-1: 0.25rem; /* 4px */
|
|
193
|
+
--wn-space-2: 0.375rem; /* 6px */
|
|
194
|
+
--wn-space-3: 0.5rem; /* 8px */
|
|
195
|
+
--wn-space-4: 0.75rem; /* 12px */
|
|
196
|
+
--wn-space-5: 1rem; /* 16px */
|
|
197
|
+
--wn-space-6: 1.25rem; /* 20px */
|
|
198
|
+
--wn-space-7: 1.5rem; /* 24px */
|
|
199
|
+
--wn-space-8: 2rem; /* 32px */
|
|
200
|
+
--wn-space-9: 3rem; /* 48px */
|
|
201
|
+
|
|
202
|
+
/* ==========================================================================
|
|
203
|
+
Border Radius Scale
|
|
204
|
+
Consistent rounding for UI elements
|
|
205
|
+
========================================================================== */
|
|
206
|
+
|
|
207
|
+
--wn-radius-sm: 0.25rem; /* 4px - badges, small elements */
|
|
208
|
+
--wn-radius-md: 0.375rem; /* 6px - buttons, inputs */
|
|
209
|
+
--wn-radius-lg: 0.5rem; /* 8px - modals, panels, cards */
|
|
210
|
+
--wn-radius-full: 9999px; /* pills, circles */
|
|
211
|
+
|
|
212
|
+
/* ==========================================================================
|
|
213
|
+
Icon Button Sizes
|
|
214
|
+
Standard sizes for icon-only buttons
|
|
215
|
+
========================================================================== */
|
|
216
|
+
|
|
217
|
+
--wn-icon-btn-sm: 1.5rem; /* 24px */
|
|
218
|
+
--wn-icon-btn-md: 1.75rem; /* 28px - close buttons */
|
|
219
|
+
--wn-icon-btn-lg: 2rem; /* 32px - toolbar buttons */
|
|
220
|
+
|
|
221
|
+
/* ==========================================================================
|
|
222
|
+
Transition Durations
|
|
223
|
+
Consistent animation timing
|
|
224
|
+
========================================================================== */
|
|
225
|
+
|
|
226
|
+
--wn-transition-fast: 150ms;
|
|
227
|
+
--wn-transition-normal: 200ms;
|
|
228
|
+
--wn-transition-slow: 300ms;
|
|
229
|
+
|
|
230
|
+
/* ==========================================================================
|
|
231
|
+
Modal Sizes
|
|
232
|
+
Standard max-width for modal dialogs
|
|
233
|
+
========================================================================== */
|
|
234
|
+
|
|
235
|
+
--wn-modal-sm: 24rem; /* 384px - confirmations, shortcuts */
|
|
236
|
+
--wn-modal-md: 28rem; /* 448px - forms, create content */
|
|
237
|
+
--wn-modal-lg: 36rem; /* 576px - config panels */
|
|
238
|
+
--wn-modal-xl: 72rem; /* 1152px - diff viewer */
|
|
239
|
+
|
|
240
|
+
/* ==========================================================================
|
|
241
|
+
Panel Widths
|
|
242
|
+
Standard widths for side panels
|
|
243
|
+
========================================================================== */
|
|
244
|
+
|
|
245
|
+
--wn-panel-sm: 280px; /* sidebar */
|
|
246
|
+
--wn-panel-md: 320px; /* side panels (frontmatter, version history) */
|
|
247
|
+
|
|
248
|
+
/* ==========================================================================
|
|
249
|
+
Z-Index Scale
|
|
250
|
+
Layering system for overlays and modals
|
|
251
|
+
========================================================================== */
|
|
252
|
+
|
|
253
|
+
--wn-z-panel: 40; /* side panels (version history) */
|
|
254
|
+
--wn-z-modal: 50; /* standard modals */
|
|
255
|
+
--wn-z-modal-nested: 55; /* nested modals (diff viewer) */
|
|
256
|
+
--wn-z-confirm: 60; /* confirmation dialogs */
|
|
257
|
+
--wn-z-dropdown: 100; /* dropdowns, popovers */
|
|
258
|
+
--wn-z-dialog: 1000; /* floating dialogs (link, image) */
|
|
259
|
+
--wn-z-tooltip: 1001; /* tooltips */
|
|
260
|
+
--wn-z-skip: 9999; /* skip link (always on top) */
|
|
261
|
+
|
|
262
|
+
/* ==========================================================================
|
|
263
|
+
Box Shadows
|
|
264
|
+
Elevation system for depth
|
|
265
|
+
========================================================================== */
|
|
266
|
+
|
|
267
|
+
--wn-shadow-sm: 0 1px 2px var(--wn-overlay-light-10);
|
|
268
|
+
--wn-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
269
|
+
--wn-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
|
270
|
+
--wn-shadow-panel: -4px 0 16px rgba(0, 0, 0, 0.3);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* ==========================================================================
|
|
274
|
+
LIGHT MODE OVERRIDES
|
|
275
|
+
========================================================================== */
|
|
276
|
+
|
|
277
|
+
.wn-light {
|
|
278
|
+
/* Backgrounds */
|
|
279
|
+
--wn-bg-app: var(--wn-zinc-50);
|
|
280
|
+
--wn-bg-surface: #ffffff;
|
|
281
|
+
--wn-bg-elevated: var(--wn-zinc-100);
|
|
282
|
+
--wn-bg-input: var(--wn-zinc-100);
|
|
283
|
+
|
|
284
|
+
/* Borders */
|
|
285
|
+
--wn-border: var(--wn-zinc-200);
|
|
286
|
+
--wn-border-subtle: var(--wn-zinc-100);
|
|
287
|
+
--wn-border-strong: var(--wn-zinc-300);
|
|
288
|
+
|
|
289
|
+
/* Text */
|
|
290
|
+
--wn-text-primary: var(--wn-zinc-900);
|
|
291
|
+
--wn-text-secondary: var(--wn-zinc-600);
|
|
292
|
+
--wn-text-muted: var(--wn-zinc-500);
|
|
293
|
+
--wn-text-subtle: var(--wn-zinc-400);
|
|
294
|
+
|
|
295
|
+
/* Interactive states */
|
|
296
|
+
--wn-hover-bg: var(--wn-overlay-light-5);
|
|
297
|
+
--wn-active-bg: var(--wn-overlay-light-10);
|
|
298
|
+
|
|
299
|
+
/* Box Shadows - Light mode */
|
|
300
|
+
--wn-shadow-sm: 0 1px 2px var(--wn-overlay-light-5);
|
|
301
|
+
--wn-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
302
|
+
--wn-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
|
|
303
|
+
--wn-shadow-panel: -4px 0 16px rgba(0, 0, 0, 0.1);
|
|
304
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Default configuration values for @writenex/astro
|
|
3
|
+
*
|
|
4
|
+
* This module provides default values for all configuration options.
|
|
5
|
+
* These defaults are applied when loading configuration to ensure
|
|
6
|
+
* all required values are present.
|
|
7
|
+
*
|
|
8
|
+
* @module @writenex/astro/config/defaults
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
WritenexConfig,
|
|
13
|
+
ImageConfig,
|
|
14
|
+
EditorConfig,
|
|
15
|
+
DiscoveryConfig,
|
|
16
|
+
CollectionConfig,
|
|
17
|
+
VersionHistoryConfig,
|
|
18
|
+
} from "@/types";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default image configuration
|
|
22
|
+
*/
|
|
23
|
+
export const DEFAULT_IMAGE_CONFIG: Required<ImageConfig> = {
|
|
24
|
+
strategy: "colocated",
|
|
25
|
+
publicPath: "/images",
|
|
26
|
+
storagePath: "public/images",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Default editor configuration
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_EDITOR_CONFIG: Required<EditorConfig> = {
|
|
33
|
+
autosave: true,
|
|
34
|
+
autosaveInterval: 3000,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Default discovery configuration
|
|
39
|
+
*/
|
|
40
|
+
export const DEFAULT_DISCOVERY_CONFIG: Required<DiscoveryConfig> = {
|
|
41
|
+
enabled: true,
|
|
42
|
+
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Default version history configuration
|
|
47
|
+
*/
|
|
48
|
+
export const DEFAULT_VERSION_HISTORY_CONFIG: Required<VersionHistoryConfig> = {
|
|
49
|
+
enabled: true,
|
|
50
|
+
maxVersions: 20,
|
|
51
|
+
storagePath: ".writenex/versions",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Default file pattern for content files
|
|
56
|
+
*/
|
|
57
|
+
export const DEFAULT_FILE_PATTERN = "{slug}.md";
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Default content directory path
|
|
61
|
+
*/
|
|
62
|
+
export const DEFAULT_CONTENT_PATH = "src/content";
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Apply defaults to a collection configuration
|
|
66
|
+
*
|
|
67
|
+
* @param collection - Partial collection configuration
|
|
68
|
+
* @returns Collection configuration with defaults applied
|
|
69
|
+
*/
|
|
70
|
+
export function applyCollectionDefaults(
|
|
71
|
+
collection: CollectionConfig
|
|
72
|
+
): Required<CollectionConfig> {
|
|
73
|
+
return {
|
|
74
|
+
name: collection.name,
|
|
75
|
+
path: collection.path,
|
|
76
|
+
filePattern: collection.filePattern ?? DEFAULT_FILE_PATTERN,
|
|
77
|
+
previewUrl: collection.previewUrl ?? `/${collection.name}/{slug}`,
|
|
78
|
+
schema: collection.schema ?? {},
|
|
79
|
+
images: collection.images
|
|
80
|
+
? { ...DEFAULT_IMAGE_CONFIG, ...collection.images }
|
|
81
|
+
: DEFAULT_IMAGE_CONFIG,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Apply defaults to the main Writenex configuration
|
|
87
|
+
*
|
|
88
|
+
* @param config - Partial Writenex configuration
|
|
89
|
+
* @returns Configuration with all defaults applied
|
|
90
|
+
*/
|
|
91
|
+
export function applyConfigDefaults(
|
|
92
|
+
config: WritenexConfig = {}
|
|
93
|
+
): Required<WritenexConfig> {
|
|
94
|
+
return {
|
|
95
|
+
collections: (config.collections ?? []).map(applyCollectionDefaults),
|
|
96
|
+
images: config.images
|
|
97
|
+
? { ...DEFAULT_IMAGE_CONFIG, ...config.images }
|
|
98
|
+
: DEFAULT_IMAGE_CONFIG,
|
|
99
|
+
editor: config.editor
|
|
100
|
+
? { ...DEFAULT_EDITOR_CONFIG, ...config.editor }
|
|
101
|
+
: DEFAULT_EDITOR_CONFIG,
|
|
102
|
+
discovery: config.discovery
|
|
103
|
+
? { ...DEFAULT_DISCOVERY_CONFIG, ...config.discovery }
|
|
104
|
+
: DEFAULT_DISCOVERY_CONFIG,
|
|
105
|
+
versionHistory: config.versionHistory
|
|
106
|
+
? { ...DEFAULT_VERSION_HISTORY_CONFIG, ...config.versionHistory }
|
|
107
|
+
: DEFAULT_VERSION_HISTORY_CONFIG,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Configuration module exports for @writenex/astro
|
|
3
|
+
*
|
|
4
|
+
* This module provides the public API for configuration handling,
|
|
5
|
+
* including schema validation, config loading, and default values.
|
|
6
|
+
*
|
|
7
|
+
* @module @writenex/astro/config
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Schema and validation
|
|
11
|
+
export {
|
|
12
|
+
defineConfig,
|
|
13
|
+
validateConfig,
|
|
14
|
+
writenexConfigSchema,
|
|
15
|
+
writenexOptionsSchema,
|
|
16
|
+
} from "./schema";
|
|
17
|
+
|
|
18
|
+
// Config loader
|
|
19
|
+
export { loadConfig, findConfigFile, contentDirectoryExists } from "./loader";
|
|
20
|
+
export type { LoadConfigResult } from "./loader";
|
|
21
|
+
|
|
22
|
+
// Defaults and constants
|
|
23
|
+
export {
|
|
24
|
+
applyConfigDefaults,
|
|
25
|
+
applyCollectionDefaults,
|
|
26
|
+
DEFAULT_IMAGE_CONFIG,
|
|
27
|
+
DEFAULT_EDITOR_CONFIG,
|
|
28
|
+
DEFAULT_DISCOVERY_CONFIG,
|
|
29
|
+
DEFAULT_VERSION_HISTORY_CONFIG,
|
|
30
|
+
DEFAULT_FILE_PATTERN,
|
|
31
|
+
DEFAULT_CONTENT_PATH,
|
|
32
|
+
} from "./defaults";
|