@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.
Files changed (141) hide show
  1. package/README.md +539 -0
  2. package/dist/chunk-5PM6EQE5.js +151 -0
  3. package/dist/chunk-5PM6EQE5.js.map +1 -0
  4. package/dist/chunk-7XU5X6CW.js +1331 -0
  5. package/dist/chunk-7XU5X6CW.js.map +1 -0
  6. package/dist/chunk-AAOQHQPU.js +574 -0
  7. package/dist/chunk-AAOQHQPU.js.map +1 -0
  8. package/dist/chunk-CF2XXJFF.js +1410 -0
  9. package/dist/chunk-CF2XXJFF.js.map +1 -0
  10. package/dist/chunk-CRPZUUDU.js +52 -0
  11. package/dist/chunk-CRPZUUDU.js.map +1 -0
  12. package/dist/chunk-CYLDJ3HZ.js +310 -0
  13. package/dist/chunk-CYLDJ3HZ.js.map +1 -0
  14. package/dist/chunk-KIKIPIFA.js +1 -0
  15. package/dist/chunk-KIKIPIFA.js.map +1 -0
  16. package/dist/chunk-XNTQTTJU.js +145 -0
  17. package/dist/chunk-XNTQTTJU.js.map +1 -0
  18. package/dist/client/index.css +2 -0
  19. package/dist/client/index.css.map +1 -0
  20. package/dist/client/index.js +375 -0
  21. package/dist/client/index.js.map +1 -0
  22. package/dist/client/styles.css +584 -0
  23. package/dist/client/variables.css +304 -0
  24. package/dist/config/index.d.ts +54 -0
  25. package/dist/config/index.js +38 -0
  26. package/dist/config/index.js.map +1 -0
  27. package/dist/config-BmEdBDo_.d.ts +220 -0
  28. package/dist/content-BWR52vD-.d.ts +64 -0
  29. package/dist/discovery/index.d.ts +310 -0
  30. package/dist/discovery/index.js +38 -0
  31. package/dist/discovery/index.js.map +1 -0
  32. package/dist/errors-C0iYiDTv.d.ts +107 -0
  33. package/dist/filesystem/index.d.ts +1292 -0
  34. package/dist/filesystem/index.js +203 -0
  35. package/dist/filesystem/index.js.map +1 -0
  36. package/dist/image-FP7w5ZIs.d.ts +47 -0
  37. package/dist/index.d.ts +64 -0
  38. package/dist/index.js +151 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/loader-55LWCXHA.js +12 -0
  41. package/dist/loader-55LWCXHA.js.map +1 -0
  42. package/dist/loader-CrdnaAWR.d.ts +327 -0
  43. package/dist/server/index.d.ts +357 -0
  44. package/dist/server/index.js +37 -0
  45. package/dist/server/index.js.map +1 -0
  46. package/package.json +94 -0
  47. package/src/client/App.tsx +900 -0
  48. package/src/client/components/ConfigPanel/ConfigPanel.css +553 -0
  49. package/src/client/components/ConfigPanel/ConfigPanel.tsx +396 -0
  50. package/src/client/components/ConfigPanel/index.ts +6 -0
  51. package/src/client/components/CreateContentModal/CreateContentModal.css +327 -0
  52. package/src/client/components/CreateContentModal/CreateContentModal.tsx +216 -0
  53. package/src/client/components/CreateContentModal/index.ts +7 -0
  54. package/src/client/components/Editor/Editor.css +885 -0
  55. package/src/client/components/Editor/Editor.tsx +484 -0
  56. package/src/client/components/Editor/ImageDialog.css +344 -0
  57. package/src/client/components/Editor/ImageDialog.tsx +367 -0
  58. package/src/client/components/Editor/LinkDialog.css +326 -0
  59. package/src/client/components/Editor/LinkDialog.tsx +332 -0
  60. package/src/client/components/Editor/index.ts +6 -0
  61. package/src/client/components/FrontmatterForm/FrontmatterForm.css +468 -0
  62. package/src/client/components/FrontmatterForm/FrontmatterForm.tsx +914 -0
  63. package/src/client/components/FrontmatterForm/index.ts +7 -0
  64. package/src/client/components/Header/Header.css +300 -0
  65. package/src/client/components/Header/Header.tsx +300 -0
  66. package/src/client/components/Header/index.ts +7 -0
  67. package/src/client/components/KeyboardShortcuts/KeyboardShortcuts.css +239 -0
  68. package/src/client/components/KeyboardShortcuts/KeyboardShortcuts.tsx +151 -0
  69. package/src/client/components/KeyboardShortcuts/index.ts +6 -0
  70. package/src/client/components/LazyEditor.tsx +75 -0
  71. package/src/client/components/LiveRegion/LiveRegion.css +19 -0
  72. package/src/client/components/LiveRegion/LiveRegion.tsx +60 -0
  73. package/src/client/components/LiveRegion/index.ts +7 -0
  74. package/src/client/components/SearchReplace/SearchReplacePanel.css +300 -0
  75. package/src/client/components/SearchReplace/SearchReplacePanel.tsx +332 -0
  76. package/src/client/components/SearchReplace/index.ts +7 -0
  77. package/src/client/components/SelectCollectionModal/SelectCollectionModal.css +308 -0
  78. package/src/client/components/SelectCollectionModal/SelectCollectionModal.tsx +223 -0
  79. package/src/client/components/SelectCollectionModal/index.ts +7 -0
  80. package/src/client/components/Sidebar/Sidebar.css +570 -0
  81. package/src/client/components/Sidebar/Sidebar.tsx +617 -0
  82. package/src/client/components/Sidebar/index.ts +7 -0
  83. package/src/client/components/SkipLink/SkipLink.css +51 -0
  84. package/src/client/components/SkipLink/SkipLink.tsx +67 -0
  85. package/src/client/components/SkipLink/index.ts +7 -0
  86. package/src/client/components/UnsavedChangesModal/UnsavedChangesModal.css +233 -0
  87. package/src/client/components/UnsavedChangesModal/UnsavedChangesModal.tsx +160 -0
  88. package/src/client/components/UnsavedChangesModal/index.ts +1 -0
  89. package/src/client/components/VersionHistory/DiffViewer.css +430 -0
  90. package/src/client/components/VersionHistory/DiffViewer.tsx +383 -0
  91. package/src/client/components/VersionHistory/VersionActions.css +318 -0
  92. package/src/client/components/VersionHistory/VersionActions.tsx +277 -0
  93. package/src/client/components/VersionHistory/VersionHistoryPanel.css +369 -0
  94. package/src/client/components/VersionHistory/VersionHistoryPanel.tsx +469 -0
  95. package/src/client/components/VersionHistory/index.ts +9 -0
  96. package/src/client/context/ApiContext.tsx +154 -0
  97. package/src/client/context/ThemeContext.tsx +172 -0
  98. package/src/client/hooks/useAnnounce.ts +201 -0
  99. package/src/client/hooks/useApi.ts +374 -0
  100. package/src/client/hooks/useArrowNavigation.ts +286 -0
  101. package/src/client/hooks/useAutosave.ts +241 -0
  102. package/src/client/hooks/useFocusTrap.ts +178 -0
  103. package/src/client/hooks/useKeyboardShortcuts.ts +203 -0
  104. package/src/client/hooks/useSearch.ts +206 -0
  105. package/src/client/hooks/useVersionHistory.ts +451 -0
  106. package/src/client/index.tsx +70 -0
  107. package/src/client/styles.css +584 -0
  108. package/src/client/utils/focus.ts +57 -0
  109. package/src/client/utils/openInEditor.ts +130 -0
  110. package/src/client/variables.css +304 -0
  111. package/src/config/defaults.ts +109 -0
  112. package/src/config/index.ts +32 -0
  113. package/src/config/loader.ts +174 -0
  114. package/src/config/schema.ts +161 -0
  115. package/src/core/constants.ts +39 -0
  116. package/src/core/errors.ts +739 -0
  117. package/src/core/index.ts +11 -0
  118. package/src/discovery/collections.ts +216 -0
  119. package/src/discovery/index.ts +33 -0
  120. package/src/discovery/patterns.ts +702 -0
  121. package/src/discovery/schema.ts +453 -0
  122. package/src/filesystem/images.ts +798 -0
  123. package/src/filesystem/index.ts +107 -0
  124. package/src/filesystem/reader.ts +452 -0
  125. package/src/filesystem/version-config.ts +390 -0
  126. package/src/filesystem/versions.ts +1339 -0
  127. package/src/filesystem/watcher.ts +226 -0
  128. package/src/filesystem/writer.ts +540 -0
  129. package/src/index.ts +61 -0
  130. package/src/integration.ts +228 -0
  131. package/src/server/assets.ts +254 -0
  132. package/src/server/cache.ts +355 -0
  133. package/src/server/index.ts +33 -0
  134. package/src/server/middleware.ts +209 -0
  135. package/src/server/routes.ts +1428 -0
  136. package/src/types/api.ts +61 -0
  137. package/src/types/config.ts +134 -0
  138. package/src/types/content.ts +64 -0
  139. package/src/types/image.ts +48 -0
  140. package/src/types/index.ts +58 -0
  141. package/src/types/version.ts +117 -0
@@ -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,54 @@
1
+ export { L as LoadConfigResult, c as contentDirectoryExists, d as defineConfig, f as findConfigFile, l as loadConfig, v as validateConfig, w as writenexConfigSchema, a as writenexOptionsSchema } from '../loader-CrdnaAWR.js';
2
+ import { a as WritenexConfig, C as CollectionConfig, I as ImageConfig, E as EditorConfig, D as DiscoveryConfig, V as VersionHistoryConfig } from '../config-BmEdBDo_.js';
3
+ import 'zod';
4
+
5
+ /**
6
+ * @fileoverview Default configuration values for @writenex/astro
7
+ *
8
+ * This module provides default values for all configuration options.
9
+ * These defaults are applied when loading configuration to ensure
10
+ * all required values are present.
11
+ *
12
+ * @module @writenex/astro/config/defaults
13
+ */
14
+
15
+ /**
16
+ * Default image configuration
17
+ */
18
+ declare const DEFAULT_IMAGE_CONFIG: Required<ImageConfig>;
19
+ /**
20
+ * Default editor configuration
21
+ */
22
+ declare const DEFAULT_EDITOR_CONFIG: Required<EditorConfig>;
23
+ /**
24
+ * Default discovery configuration
25
+ */
26
+ declare const DEFAULT_DISCOVERY_CONFIG: Required<DiscoveryConfig>;
27
+ /**
28
+ * Default version history configuration
29
+ */
30
+ declare const DEFAULT_VERSION_HISTORY_CONFIG: Required<VersionHistoryConfig>;
31
+ /**
32
+ * Default file pattern for content files
33
+ */
34
+ declare const DEFAULT_FILE_PATTERN = "{slug}.md";
35
+ /**
36
+ * Default content directory path
37
+ */
38
+ declare const DEFAULT_CONTENT_PATH = "src/content";
39
+ /**
40
+ * Apply defaults to a collection configuration
41
+ *
42
+ * @param collection - Partial collection configuration
43
+ * @returns Collection configuration with defaults applied
44
+ */
45
+ declare function applyCollectionDefaults(collection: CollectionConfig): Required<CollectionConfig>;
46
+ /**
47
+ * Apply defaults to the main Writenex configuration
48
+ *
49
+ * @param config - Partial Writenex configuration
50
+ * @returns Configuration with all defaults applied
51
+ */
52
+ declare function applyConfigDefaults(config?: WritenexConfig): Required<WritenexConfig>;
53
+
54
+ export { DEFAULT_CONTENT_PATH, DEFAULT_DISCOVERY_CONFIG, DEFAULT_EDITOR_CONFIG, DEFAULT_FILE_PATTERN, DEFAULT_IMAGE_CONFIG, DEFAULT_VERSION_HISTORY_CONFIG, applyCollectionDefaults, applyConfigDefaults };
@@ -0,0 +1,38 @@
1
+ import "../chunk-KIKIPIFA.js";
2
+ import {
3
+ contentDirectoryExists,
4
+ defineConfig,
5
+ findConfigFile,
6
+ loadConfig,
7
+ validateConfig,
8
+ writenexConfigSchema,
9
+ writenexOptionsSchema
10
+ } from "../chunk-5PM6EQE5.js";
11
+ import {
12
+ DEFAULT_CONTENT_PATH,
13
+ DEFAULT_DISCOVERY_CONFIG,
14
+ DEFAULT_EDITOR_CONFIG,
15
+ DEFAULT_FILE_PATTERN,
16
+ DEFAULT_IMAGE_CONFIG,
17
+ DEFAULT_VERSION_HISTORY_CONFIG,
18
+ applyCollectionDefaults,
19
+ applyConfigDefaults
20
+ } from "../chunk-CRPZUUDU.js";
21
+ export {
22
+ DEFAULT_CONTENT_PATH,
23
+ DEFAULT_DISCOVERY_CONFIG,
24
+ DEFAULT_EDITOR_CONFIG,
25
+ DEFAULT_FILE_PATTERN,
26
+ DEFAULT_IMAGE_CONFIG,
27
+ DEFAULT_VERSION_HISTORY_CONFIG,
28
+ applyCollectionDefaults,
29
+ applyConfigDefaults,
30
+ contentDirectoryExists,
31
+ defineConfig,
32
+ findConfigFile,
33
+ loadConfig,
34
+ validateConfig,
35
+ writenexConfigSchema,
36
+ writenexOptionsSchema
37
+ };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @fileoverview Version history type definitions for @writenex/astro
3
+ *
4
+ * This file contains all TypeScript type definitions related to version history,
5
+ * including version entries, manifests, and operation results.
6
+ *
7
+ * @module @writenex/astro/types/version
8
+ */
9
+ /**
10
+ * Version entry metadata stored in manifest
11
+ *
12
+ * Represents a single version snapshot of a content item.
13
+ */
14
+ interface VersionEntry {
15
+ /** Unique version ID (ISO timestamp with hyphens instead of colons) */
16
+ id: string;
17
+ /** When this version was created (ISO string for JSON serialization) */
18
+ timestamp: string;
19
+ /** First 100 characters of content for preview */
20
+ preview: string;
21
+ /** File size in bytes */
22
+ size: number;
23
+ /** Optional label for manual snapshots */
24
+ label?: string;
25
+ }
26
+ /**
27
+ * Version manifest for a content item
28
+ *
29
+ * Tracks all versions for a specific content item in a JSON file.
30
+ */
31
+ interface VersionManifest {
32
+ /** Content item identifier (slug) */
33
+ contentId: string;
34
+ /** Collection name */
35
+ collection: string;
36
+ /** List of version entries */
37
+ versions: VersionEntry[];
38
+ /** When manifest was last updated (ISO string for JSON serialization) */
39
+ updatedAt: string;
40
+ }
41
+ /**
42
+ * Full version data including content
43
+ *
44
+ * Extends VersionEntry with the actual content of the version.
45
+ */
46
+ interface Version extends VersionEntry {
47
+ /** Full markdown content */
48
+ content: string;
49
+ /** Parsed frontmatter */
50
+ frontmatter: Record<string, unknown>;
51
+ /** Markdown body */
52
+ body: string;
53
+ }
54
+ /**
55
+ * Version history configuration
56
+ *
57
+ * Controls how version history behaves for the project.
58
+ * All fields are optional - defaults are applied via applyConfigDefaults().
59
+ */
60
+ interface VersionHistoryConfig {
61
+ /** Enable/disable version history (default: true) */
62
+ enabled?: boolean;
63
+ /** Maximum versions to keep per content item, unlabeled only (default: 20) */
64
+ maxVersions?: number;
65
+ /** Storage path relative to project root (default: ".writenex/versions") */
66
+ storagePath?: string;
67
+ }
68
+ /**
69
+ * Result of version operations
70
+ *
71
+ * Returned by version CRUD operations to indicate success/failure.
72
+ */
73
+ interface VersionResult {
74
+ /** Whether the operation succeeded */
75
+ success: boolean;
76
+ /** Version entry if operation created/retrieved one */
77
+ version?: VersionEntry;
78
+ /** Error message if operation failed */
79
+ error?: string;
80
+ }
81
+ /**
82
+ * Options for saving a version
83
+ */
84
+ interface SaveVersionOptions {
85
+ /** Optional label for the version */
86
+ label?: string;
87
+ /** Skip if content is identical to last version */
88
+ skipIfIdentical?: boolean;
89
+ }
90
+ /**
91
+ * Options for restoring a version
92
+ */
93
+ interface RestoreVersionOptions {
94
+ /** Label for the safety snapshot created before restore */
95
+ safetySnapshotLabel?: string;
96
+ /** Skip creating safety snapshot (not recommended) */
97
+ skipSafetySnapshot?: boolean;
98
+ }
99
+ /**
100
+ * Result of a restore operation
101
+ *
102
+ * Extends VersionResult with additional restore-specific fields.
103
+ */
104
+ interface RestoreResult extends VersionResult {
105
+ /** The restored content */
106
+ content?: string;
107
+ /** The safety snapshot version entry (if created) */
108
+ safetySnapshot?: VersionEntry;
109
+ }
110
+
111
+ /**
112
+ * @fileoverview Configuration-related type definitions for @writenex/astro
113
+ *
114
+ * This file contains all TypeScript type definitions related to configuration,
115
+ * including collection config, image config, editor config, and discovery config.
116
+ *
117
+ * @module @writenex/astro/types/config
118
+ */
119
+
120
+ /**
121
+ * Field type definitions for frontmatter schema
122
+ */
123
+ type FieldType = "string" | "number" | "boolean" | "date" | "array" | "image" | "object";
124
+ /**
125
+ * Schema field definition for frontmatter
126
+ */
127
+ interface SchemaField {
128
+ /** The type of the field */
129
+ type: FieldType;
130
+ /** Whether the field is required */
131
+ required?: boolean;
132
+ /** Default value for the field */
133
+ default?: unknown;
134
+ /** For array types, the type of items */
135
+ items?: string;
136
+ /** Description shown in the editor */
137
+ description?: string;
138
+ }
139
+ /**
140
+ * Collection schema definition
141
+ */
142
+ type CollectionSchema = Record<string, SchemaField>;
143
+ /**
144
+ * Image handling strategy
145
+ */
146
+ type ImageStrategy = "colocated" | "public" | "custom";
147
+ /**
148
+ * Image configuration for a collection
149
+ */
150
+ interface ImageConfig {
151
+ /** Where to store uploaded images */
152
+ strategy: ImageStrategy;
153
+ /** URL path prefix for images */
154
+ publicPath?: string;
155
+ /** Filesystem path for storing images (for 'public' and 'custom' strategies) */
156
+ storagePath?: string;
157
+ }
158
+ /**
159
+ * Collection configuration
160
+ */
161
+ interface CollectionConfig {
162
+ /** Unique name of the collection */
163
+ name: string;
164
+ /** Filesystem path to the collection (relative to project root) */
165
+ path: string;
166
+ /** File naming pattern using tokens like {slug}, {date}, {year}, etc. */
167
+ filePattern?: string;
168
+ /** URL pattern for preview links */
169
+ previewUrl?: string;
170
+ /** Frontmatter schema definition */
171
+ schema?: CollectionSchema;
172
+ /** Image handling configuration for this collection */
173
+ images?: ImageConfig;
174
+ }
175
+ /**
176
+ * Discovery configuration for auto-detecting collections
177
+ */
178
+ interface DiscoveryConfig {
179
+ /** Whether auto-discovery is enabled */
180
+ enabled: boolean;
181
+ /** Glob patterns to ignore during discovery */
182
+ ignore?: string[];
183
+ }
184
+ /**
185
+ * Editor behavior configuration
186
+ */
187
+ interface EditorConfig {
188
+ /** Whether autosave is enabled */
189
+ autosave?: boolean;
190
+ /** Autosave interval in milliseconds */
191
+ autosaveInterval?: number;
192
+ }
193
+ /**
194
+ * Main Writenex configuration
195
+ */
196
+ interface WritenexConfig {
197
+ /** Collection definitions */
198
+ collections?: CollectionConfig[];
199
+ /** Global image configuration */
200
+ images?: ImageConfig;
201
+ /** Editor behavior configuration */
202
+ editor?: EditorConfig;
203
+ /** Auto-discovery configuration */
204
+ discovery?: DiscoveryConfig;
205
+ /** Version history configuration */
206
+ versionHistory?: VersionHistoryConfig;
207
+ }
208
+ /**
209
+ * Options passed to the Writenex integration
210
+ */
211
+ interface WritenexOptions {
212
+ /**
213
+ * Allow the integration to run in production builds.
214
+ * Use with caution - only enable for staging/preview environments.
215
+ * @default false
216
+ */
217
+ allowProduction?: boolean;
218
+ }
219
+
220
+ export type { CollectionConfig as C, DiscoveryConfig as D, EditorConfig as E, FieldType as F, ImageConfig as I, RestoreVersionOptions as R, SchemaField as S, VersionHistoryConfig as V, WritenexOptions as W, WritenexConfig as a, CollectionSchema as b, ImageStrategy as c, SaveVersionOptions as d, VersionResult as e, VersionEntry as f, Version as g, RestoreResult as h, VersionManifest as i };
@@ -0,0 +1,64 @@
1
+ import { b as CollectionSchema } from './config-BmEdBDo_.js';
2
+
3
+ /**
4
+ * @fileoverview Content and collection type definitions for @writenex/astro
5
+ *
6
+ * This file contains all TypeScript type definitions related to content items,
7
+ * content summaries, and discovered collections.
8
+ *
9
+ * @module @writenex/astro/types/content
10
+ */
11
+
12
+ /**
13
+ * Parsed content item with frontmatter and body
14
+ */
15
+ interface ContentItem {
16
+ /** Unique identifier (typically the slug) */
17
+ id: string;
18
+ /** Filesystem path to the content file */
19
+ path: string;
20
+ /** Parsed frontmatter data */
21
+ frontmatter: Record<string, unknown>;
22
+ /** Markdown body content */
23
+ body: string;
24
+ /** Raw file content (frontmatter + body) */
25
+ raw: string;
26
+ /** File modification time in milliseconds (for conflict detection) */
27
+ mtime?: number;
28
+ }
29
+ /**
30
+ * Content item summary for listing
31
+ */
32
+ interface ContentSummary {
33
+ /** Unique identifier */
34
+ id: string;
35
+ /** Filesystem path */
36
+ path: string;
37
+ /** Title from frontmatter */
38
+ title: string;
39
+ /** Publication date */
40
+ pubDate?: string;
41
+ /** Draft status */
42
+ draft?: boolean;
43
+ /** Content excerpt */
44
+ excerpt?: string;
45
+ }
46
+ /**
47
+ * Discovered collection with metadata
48
+ */
49
+ interface DiscoveredCollection {
50
+ /** Collection name */
51
+ name: string;
52
+ /** Filesystem path */
53
+ path: string;
54
+ /** Detected file pattern */
55
+ filePattern: string;
56
+ /** Number of content files */
57
+ count: number;
58
+ /** Detected/configured schema */
59
+ schema?: CollectionSchema;
60
+ /** URL pattern for preview links */
61
+ previewUrl?: string;
62
+ }
63
+
64
+ export type { ContentItem as C, DiscoveredCollection as D, ContentSummary as a };