@imjp/writenex-astro 1.3.6 → 1.5.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 (54) hide show
  1. package/dist/chunk-E4PQLKAH.js +282 -0
  2. package/dist/chunk-E4PQLKAH.js.map +1 -0
  3. package/dist/{chunk-NSW7AIVF.js → chunk-EEUN46Q2.js} +3 -3
  4. package/dist/{chunk-YBCPOLMY.js → chunk-P5KMSHFP.js} +2 -1
  5. package/dist/{chunk-YBCPOLMY.js.map → chunk-P5KMSHFP.js.map} +1 -1
  6. package/dist/{chunk-JMNCPNQX.js → chunk-XVQNYPOI.js} +65 -3
  7. package/dist/chunk-XVQNYPOI.js.map +1 -0
  8. package/dist/chunk-YRSIZLHE.js +1 -0
  9. package/dist/{chunk-N37EPLKG.js → chunk-ZWUGHWHD.js} +79 -10
  10. package/dist/chunk-ZWUGHWHD.js.map +1 -0
  11. package/dist/client/index.css +1 -1
  12. package/dist/client/index.css.map +1 -1
  13. package/dist/client/index.js +114 -114
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/config/index.d.ts +3 -2
  16. package/dist/config/index.js +11 -3
  17. package/dist/{config-CliL0CoN.d.ts → config-B7t8CjL1.d.ts} +38 -60
  18. package/dist/{content-TuL3GT66.d.ts → content-CwcgR8P6.d.ts} +1 -1
  19. package/dist/discovery/index.d.ts +2 -2
  20. package/dist/discovery/index.js +2 -2
  21. package/dist/fields/index.d.ts +16 -0
  22. package/dist/fields/index.js +13 -0
  23. package/dist/fields-DUSm13nm.d.ts +223 -0
  24. package/dist/filesystem/index.d.ts +2 -2
  25. package/dist/filesystem/index.js +1 -1
  26. package/dist/index.d.ts +5 -4
  27. package/dist/index.js +13 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/{loader-53VVP2IN.js → loader-B5WZCVBC.js} +3 -3
  30. package/dist/loader-B5WZCVBC.js.map +1 -0
  31. package/dist/{schema-DDJyoVkj.d.ts → schema-nLMfZ9-o.d.ts} +79 -53
  32. package/dist/server/index.d.ts +2 -2
  33. package/dist/server/index.js +3 -3
  34. package/package.json +5 -1
  35. package/src/client/components/FrontmatterForm/FrontmatterForm.css +104 -0
  36. package/src/client/components/FrontmatterForm/FrontmatterForm.tsx +452 -26
  37. package/src/config/defaults.ts +1 -0
  38. package/src/config/index.ts +3 -0
  39. package/src/config/schema.ts +114 -73
  40. package/src/discovery/schema.ts +120 -1
  41. package/src/fields/collection.ts +67 -0
  42. package/src/fields/fields.ts +150 -0
  43. package/src/fields/index.ts +42 -0
  44. package/src/fields/resolve.ts +203 -0
  45. package/src/fields/types.ts +179 -0
  46. package/src/index.ts +3 -0
  47. package/src/types/config.ts +87 -63
  48. package/src/types/index.ts +3 -0
  49. package/dist/chunk-JMNCPNQX.js.map +0 -1
  50. package/dist/chunk-KIKIPIFA.js +0 -1
  51. package/dist/chunk-N37EPLKG.js.map +0 -1
  52. /package/dist/{chunk-NSW7AIVF.js.map → chunk-EEUN46Q2.js.map} +0 -0
  53. /package/dist/{chunk-KIKIPIFA.js.map → chunk-YRSIZLHE.js.map} +0 -0
  54. /package/dist/{loader-53VVP2IN.js.map → fields/index.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { c as WritenexConfig } from './config-CliL0CoN.js';
1
+ import { e as WritenexConfig } from './config-B7t8CjL1.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -82,30 +82,91 @@ declare function contentDirectoryExists(projectRoot: string, contentPath?: strin
82
82
  * @module @writenex/astro/config/schema
83
83
  */
84
84
 
85
- /**
86
- * Main Writenex configuration schema
87
- */
85
+ declare const fieldTypeSchema: z.ZodEnum<{
86
+ string: "string";
87
+ number: "number";
88
+ boolean: "boolean";
89
+ object: "object";
90
+ slug: "slug";
91
+ url: "url";
92
+ integer: "integer";
93
+ select: "select";
94
+ multiselect: "multiselect";
95
+ checkbox: "checkbox";
96
+ date: "date";
97
+ datetime: "datetime";
98
+ image: "image";
99
+ file: "file";
100
+ array: "array";
101
+ blocks: "blocks";
102
+ relationship: "relationship";
103
+ "path-reference": "path-reference";
104
+ markdoc: "markdoc";
105
+ mdx: "mdx";
106
+ conditional: "conditional";
107
+ child: "child";
108
+ "cloud-image": "cloud-image";
109
+ empty: "empty";
110
+ "empty-content": "empty-content";
111
+ "empty-document": "empty-document";
112
+ ignored: "ignored";
113
+ }>;
114
+ declare const validationSchema: z.ZodOptional<z.ZodObject<{
115
+ isRequired: z.ZodOptional<z.ZodBoolean>;
116
+ min: z.ZodOptional<z.ZodNumber>;
117
+ max: z.ZodOptional<z.ZodNumber>;
118
+ minLength: z.ZodOptional<z.ZodNumber>;
119
+ maxLength: z.ZodOptional<z.ZodNumber>;
120
+ pattern: z.ZodOptional<z.ZodString>;
121
+ patternDescription: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>>;
123
+ type SchemaFieldInput = {
124
+ type: z.infer<typeof fieldTypeSchema>;
125
+ required?: boolean;
126
+ default?: unknown;
127
+ items?: string;
128
+ description?: string;
129
+ label?: string;
130
+ options?: string[];
131
+ directory?: string;
132
+ publicPath?: string;
133
+ validation?: z.infer<typeof validationSchema>;
134
+ fields?: Record<string, SchemaFieldInput>;
135
+ itemField?: SchemaFieldInput;
136
+ blockTypes?: Record<string, SchemaFieldInput>;
137
+ collection?: string;
138
+ multiline?: boolean;
139
+ format?: string;
140
+ itemLabel?: string;
141
+ matchField?: string;
142
+ matchValue?: unknown;
143
+ showField?: SchemaFieldInput;
144
+ accept?: string;
145
+ allowExternal?: boolean;
146
+ inline?: boolean;
147
+ };
88
148
  declare const writenexConfigSchema: z.ZodObject<{
89
149
  collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
150
  name: z.ZodString;
91
151
  path: z.ZodString;
92
152
  filePattern: z.ZodOptional<z.ZodString>;
93
153
  previewUrl: z.ZodOptional<z.ZodString>;
94
- schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
95
- type: z.ZodEnum<{
96
- string: "string";
97
- number: "number";
98
- boolean: "boolean";
99
- object: "object";
100
- date: "date";
101
- array: "array";
102
- image: "image";
154
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SchemaFieldInput, unknown, z.core.$ZodTypeInternals<SchemaFieldInput, unknown>>>>;
155
+ images: z.ZodOptional<z.ZodObject<{
156
+ strategy: z.ZodEnum<{
157
+ colocated: "colocated";
158
+ public: "public";
159
+ custom: "custom";
103
160
  }>;
104
- required: z.ZodOptional<z.ZodBoolean>;
105
- default: z.ZodOptional<z.ZodUnknown>;
106
- items: z.ZodOptional<z.ZodString>;
107
- description: z.ZodOptional<z.ZodString>;
108
- }, z.core.$strip>>>;
161
+ publicPath: z.ZodOptional<z.ZodString>;
162
+ storagePath: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strip>>;
164
+ }, z.core.$strip>>>;
165
+ singletons: z.ZodOptional<z.ZodArray<z.ZodObject<{
166
+ name: z.ZodString;
167
+ path: z.ZodString;
168
+ previewUrl: z.ZodOptional<z.ZodString>;
169
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SchemaFieldInput, unknown, z.core.$ZodTypeInternals<SchemaFieldInput, unknown>>>>;
109
170
  images: z.ZodOptional<z.ZodObject<{
110
171
  strategy: z.ZodEnum<{
111
172
  colocated: "colocated";
@@ -139,45 +200,10 @@ declare const writenexConfigSchema: z.ZodObject<{
139
200
  storagePath: z.ZodOptional<z.ZodString>;
140
201
  }, z.core.$strip>>;
141
202
  }, z.core.$strip>;
142
- /**
143
- * Schema for integration options
144
- */
145
203
  declare const writenexOptionsSchema: z.ZodObject<{
146
204
  allowProduction: z.ZodOptional<z.ZodBoolean>;
147
205
  }, z.core.$strip>;
148
- /**
149
- * Helper function for defining type-safe Writenex configuration.
150
- *
151
- * This function provides IDE autocompletion and type checking for
152
- * the configuration object. It's the recommended way to create
153
- * a writenex.config.ts file.
154
- *
155
- * @param config - The Writenex configuration object
156
- * @returns The same configuration object (identity function for type safety)
157
- *
158
- * @example
159
- * ```typescript
160
- * // writenex.config.ts
161
- * import { defineConfig } from '@writenex/astro';
162
- *
163
- * export default defineConfig({
164
- * collections: [
165
- * {
166
- * name: 'blog',
167
- * path: 'src/content/blog',
168
- * filePattern: '{slug}.md',
169
- * },
170
- * ],
171
- * });
172
- * ```
173
- */
174
206
  declare function defineConfig(config: WritenexConfig): WritenexConfig;
175
- /**
176
- * Validate a Writenex configuration object
177
- *
178
- * @param config - The configuration to validate
179
- * @returns Validation result with success status and parsed data or errors
180
- */
181
207
  declare function validateConfig(config: unknown): {
182
208
  success: true;
183
209
  data: WritenexConfig;
@@ -1,8 +1,8 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import { Connect } from 'vite';
3
3
  import { W as WritenexError } from '../errors-C0iYiDTv.js';
4
- import { c as WritenexConfig } from '../config-CliL0CoN.js';
5
- import { D as DiscoveredCollection, a as ContentSummary } from '../content-TuL3GT66.js';
4
+ import { e as WritenexConfig } from '../config-B7t8CjL1.js';
5
+ import { D as DiscoveredCollection, a as ContentSummary } from '../content-CwcgR8P6.js';
6
6
  import { D as DiscoveredImage } from '../image-FP7w5ZIs.js';
7
7
 
8
8
  /**
@@ -13,11 +13,11 @@ import {
13
13
  sendWritenexError,
14
14
  serveAsset,
15
15
  serveEditorHtml
16
- } from "../chunk-NSW7AIVF.js";
17
- import "../chunk-JMNCPNQX.js";
16
+ } from "../chunk-EEUN46Q2.js";
17
+ import "../chunk-XVQNYPOI.js";
18
18
  import "../chunk-4H63L4YO.js";
19
19
  import "../chunk-GYAFIVVI.js";
20
- import "../chunk-YBCPOLMY.js";
20
+ import "../chunk-P5KMSHFP.js";
21
21
  export {
22
22
  ServerCache,
23
23
  createApiRouter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imjp/writenex-astro",
3
- "version": "1.3.6",
3
+ "version": "1.5.0",
4
4
  "description": "Visual editor for Astro content collections - WYSIWYG editing for your Astro site.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,6 +29,10 @@
29
29
  "./server": {
30
30
  "types": "./dist/server/index.d.ts",
31
31
  "import": "./dist/server/index.js"
32
+ },
33
+ "./fields": {
34
+ "types": "./dist/fields/index.d.ts",
35
+ "import": "./dist/fields/index.js"
32
36
  }
33
37
  },
34
38
  "files": [
@@ -347,6 +347,79 @@
347
347
  margin: var(--wn-space-1) 0;
348
348
  }
349
349
 
350
+ /* Checkbox Group (Multiselect) */
351
+ .wn-frontmatter-checkbox-group {
352
+ display: flex;
353
+ flex-direction: column;
354
+ gap: var(--wn-space-2);
355
+ padding: var(--wn-space-2) 0;
356
+ }
357
+
358
+ .wn-frontmatter-checkbox-group .wn-frontmatter-checkbox-label {
359
+ display: flex;
360
+ align-items: center;
361
+ gap: var(--wn-space-2);
362
+ font-size: var(--wn-font-sm);
363
+ color: var(--wn-zinc-50);
364
+ cursor: pointer;
365
+ }
366
+
367
+ .wn-frontmatter-checkbox-group .wn-frontmatter-checkbox {
368
+ width: 14px;
369
+ height: 14px;
370
+ }
371
+
372
+ /* Field Group (Object) */
373
+ .wn-frontmatter-field-group {
374
+ border: 1px solid var(--wn-overlay-10);
375
+ border-radius: var(--wn-radius-md);
376
+ padding: var(--wn-space-3);
377
+ }
378
+
379
+ .wn-frontmatter-group-toggle {
380
+ display: flex;
381
+ align-items: center;
382
+ justify-content: space-between;
383
+ width: 100%;
384
+ padding: var(--wn-space-2);
385
+ background: transparent;
386
+ border: none;
387
+ color: var(--wn-zinc-400);
388
+ cursor: pointer;
389
+ font-size: var(--wn-font-xs);
390
+ }
391
+
392
+ .wn-frontmatter-group-toggle:hover {
393
+ color: var(--wn-zinc-50);
394
+ }
395
+
396
+ .wn-frontmatter-group-content {
397
+ display: flex;
398
+ flex-direction: column;
399
+ gap: var(--wn-space-3);
400
+ padding-top: var(--wn-space-3);
401
+ border-top: 1px solid var(--wn-overlay-10);
402
+ margin-top: var(--wn-space-2);
403
+ }
404
+
405
+ /* Rich Text Area */
406
+ .wn-frontmatter-textarea--rich {
407
+ min-height: 150px;
408
+ font-family: monospace;
409
+ line-height: 1.6;
410
+ }
411
+
412
+ /* Datetime input calendar icon */
413
+ .wn-frontmatter-input[type="datetime-local"]::-webkit-calendar-picker-indicator {
414
+ filter: invert(1);
415
+ opacity: 0.5;
416
+ cursor: pointer;
417
+ }
418
+
419
+ .wn-frontmatter-input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
420
+ opacity: 0.8;
421
+ }
422
+
350
423
  /* ============================================================================
351
424
  LIGHT MODE OVERRIDES
352
425
  ============================================================================ */
@@ -466,3 +539,34 @@
466
539
  .wn-light .wn-frontmatter-divider {
467
540
  background: var(--wn-overlay-light-10);
468
541
  }
542
+
543
+ .wn-light .wn-frontmatter-checkbox-group .wn-frontmatter-checkbox-label {
544
+ color: var(--wn-zinc-900);
545
+ }
546
+
547
+ .wn-light .wn-frontmatter-field-group {
548
+ border-color: var(--wn-overlay-light-10);
549
+ }
550
+
551
+ .wn-light .wn-frontmatter-group-toggle {
552
+ color: var(--wn-zinc-500);
553
+ }
554
+
555
+ .wn-light .wn-frontmatter-group-toggle:hover {
556
+ color: var(--wn-zinc-900);
557
+ }
558
+
559
+ .wn-light .wn-frontmatter-group-content {
560
+ border-top-color: var(--wn-overlay-light-10);
561
+ }
562
+
563
+ .wn-light
564
+ .wn-frontmatter-input[type="datetime-local"]::-webkit-calendar-picker-indicator {
565
+ filter: none;
566
+ opacity: 0.6;
567
+ }
568
+
569
+ .wn-light
570
+ .wn-frontmatter-input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
571
+ opacity: 1;
572
+ }