nextjs-cms 0.9.42 → 0.10.1
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/dist/api/actions/pages.d.ts +3 -3
- package/dist/api/trpc/root.d.ts +3 -3
- package/dist/api/trpc/routers/navigation.d.ts +3 -3
- package/dist/api/trpc/server.d.ts +9 -9
- package/dist/core/config/config-loader.d.ts +2 -2
- package/dist/core/fields/date-range.d.ts +4 -4
- package/dist/core/fields/inline-image.d.ts +45 -0
- package/dist/core/fields/inline-image.d.ts.map +1 -0
- package/dist/core/fields/inline-image.js +30 -0
- package/dist/core/fields/photo.d.ts.map +1 -1
- package/dist/core/fields/photo.js +1 -9
- package/dist/core/fields/richText.d.ts +162 -42
- package/dist/core/fields/richText.d.ts.map +1 -1
- package/dist/core/fields/richText.js +104 -35
- package/dist/core/fields/select.d.ts +1 -1
- package/dist/core/helpers/background.d.ts +18 -0
- package/dist/core/helpers/background.d.ts.map +1 -0
- package/dist/core/helpers/background.js +18 -0
- package/dist/core/helpers/index.d.ts +5 -1
- package/dist/core/helpers/index.d.ts.map +1 -1
- package/dist/core/helpers/index.js +3 -1
- package/dist/core/helpers/inline-image.d.ts +46 -0
- package/dist/core/helpers/inline-image.d.ts.map +1 -0
- package/dist/core/helpers/inline-image.js +30 -0
- package/dist/core/sections/category.d.ts +4 -4
- package/dist/core/sections/hasItems.d.ts +4 -4
- package/dist/core/sections/section.d.ts +3 -3
- package/dist/core/sections/simple.d.ts +4 -4
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/utils.d.ts +13 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +15 -0
- package/dist/validators/richText.d.ts.map +1 -1
- package/dist/validators/richText.js +35 -1
- package/package.json +3 -3
|
@@ -70,13 +70,13 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
70
70
|
maxDate: z.ZodOptional<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"now">]>>;
|
|
71
71
|
defaultStartValue: z.ZodOptional<z.ZodDate>;
|
|
72
72
|
defaultEndValue: z.ZodOptional<z.ZodDate>;
|
|
73
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
73
75
|
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
74
76
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
75
77
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
76
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
77
78
|
conditionalRules: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>], null>, z.ZodCustom<import("../types/index.js").ConditionalRuleGroup, import("../types/index.js").ConditionalRuleGroup>]>>;
|
|
78
79
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
79
|
-
localized: z.ZodOptional<z.ZodBoolean>;
|
|
80
80
|
}, z.core.$strict>;
|
|
81
81
|
declare const dateRangeFieldConfigSchema: z.ZodObject<{
|
|
82
82
|
/**
|
|
@@ -97,13 +97,13 @@ declare const dateRangeFieldConfigSchema: z.ZodObject<{
|
|
|
97
97
|
maxDate: z.ZodOptional<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"now">]>>;
|
|
98
98
|
defaultStartValue: z.ZodOptional<z.ZodDate>;
|
|
99
99
|
defaultEndValue: z.ZodOptional<z.ZodDate>;
|
|
100
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
100
102
|
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
101
103
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
102
104
|
defaultValue: z.ZodOptional<z.ZodAny>;
|
|
103
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
104
105
|
conditionalRules: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>], null>, z.ZodCustom<import("../types/index.js").ConditionalRuleGroup, import("../types/index.js").ConditionalRuleGroup>]>>;
|
|
105
106
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
106
|
-
localized: z.ZodOptional<z.ZodBoolean>;
|
|
107
107
|
}, z.core.$strict>;
|
|
108
108
|
export type DateRangeFieldConfig = z.infer<typeof dateRangeFieldConfigSchema>;
|
|
109
109
|
/**
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type sharp from 'sharp';
|
|
2
|
+
import type { Background } from '../helpers/background.js';
|
|
3
|
+
/**
|
|
4
|
+
* Inline-image sizing shared by the rich-text field, the editor upload route, and the client-side
|
|
5
|
+
* validator.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately a leaf module with type-only imports: the validator runs in the browser, and
|
|
8
|
+
* reaching these through `core/fields/index.js` would pull the whole field barrel — and with it
|
|
9
|
+
* the database client, sharp, and fs — into the client bundle.
|
|
10
|
+
*/
|
|
11
|
+
export type InlineImageSize = {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
fit: 'inside';
|
|
15
|
+
} | {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
fit: 'cover';
|
|
19
|
+
} | {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
fit: 'contain';
|
|
23
|
+
background?: Background;
|
|
24
|
+
};
|
|
25
|
+
export type InlineImageMaxFileSize = {
|
|
26
|
+
size: number;
|
|
27
|
+
unit: 'kb' | 'mb';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Bounds every inline image is fitted into unless the field overrides `size`.
|
|
31
|
+
* 1200x675 is 16:9 at a width that covers typical article body content, scaled down to fit so a
|
|
32
|
+
* body image is never cropped or padded unless the field asks for it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const DEFAULT_INLINE_IMAGE_SIZE: InlineImageSize;
|
|
35
|
+
/** Largest accepted inline image unless the field overrides `maxFileSize`. */
|
|
36
|
+
export declare const DEFAULT_MAX_FILE_SIZE: InlineImageMaxFileSize;
|
|
37
|
+
/** Same shape `extractInlineImages` looks for, so every side agrees on what an inline image is. */
|
|
38
|
+
export declare const INLINE_IMAGE_REGEX: RegExp;
|
|
39
|
+
/**
|
|
40
|
+
* Sharp resize options for an inline image, so every place that writes one — the field on save and
|
|
41
|
+
* the editor upload route — sizes it identically. `background` is the CMS-config fallback, used
|
|
42
|
+
* only when the field asks for `contain` without naming its own.
|
|
43
|
+
*/
|
|
44
|
+
export declare function inlineImageResizeOptions(size: InlineImageSize, background: Background): sharp.ResizeOptions;
|
|
45
|
+
//# sourceMappingURL=inline-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-image.d.ts","sourceRoot":"","sources":["../../../src/core/fields/inline-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;GAOG;AAEH,MAAM,MAAM,eAAe,GACrB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAChD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GAC/C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,UAAU,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAA;AAExE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,EAAE,sBAAgD,CAAA;AAEpF,mGAAmG;AACnG,eAAO,MAAM,kBAAkB,QAAmD,CAAA;AAElF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,aAAa,CAU3G"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds every inline image is fitted into unless the field overrides `size`.
|
|
3
|
+
* 1200x675 is 16:9 at a width that covers typical article body content, scaled down to fit so a
|
|
4
|
+
* body image is never cropped or padded unless the field asks for it.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_INLINE_IMAGE_SIZE = {
|
|
7
|
+
width: 1200,
|
|
8
|
+
height: 675,
|
|
9
|
+
fit: 'inside',
|
|
10
|
+
};
|
|
11
|
+
/** Largest accepted inline image unless the field overrides `maxFileSize`. */
|
|
12
|
+
export const DEFAULT_MAX_FILE_SIZE = { size: 1, unit: 'mb' };
|
|
13
|
+
/** Same shape `extractInlineImages` looks for, so every side agrees on what an inline image is. */
|
|
14
|
+
export const INLINE_IMAGE_REGEX = /<img.*?src="(data:image\/.*?;base64,.*?)".*?>/g;
|
|
15
|
+
/**
|
|
16
|
+
* Sharp resize options for an inline image, so every place that writes one — the field on save and
|
|
17
|
+
* the editor upload route — sizes it identically. `background` is the CMS-config fallback, used
|
|
18
|
+
* only when the field asks for `contain` without naming its own.
|
|
19
|
+
*/
|
|
20
|
+
export function inlineImageResizeOptions(size, background) {
|
|
21
|
+
return {
|
|
22
|
+
width: size.width,
|
|
23
|
+
height: size.height,
|
|
24
|
+
fit: size.fit,
|
|
25
|
+
// `inside` only ever scales down — enlarging a smaller image to fill the box would cost
|
|
26
|
+
// quality for nothing. `cover` and `contain` produce the exact box, so they may enlarge.
|
|
27
|
+
withoutEnlargement: size.fit === 'inside',
|
|
28
|
+
...(size.fit === 'contain' ? { background: size.background ?? background } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"photo.d.ts","sourceRoot":"","sources":["../../../src/core/fields/photo.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,OAAO,
|
|
1
|
+
{"version":3,"file":"photo.d.ts","sourceRoot":"","sources":["../../../src/core/fields/photo.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,OAAO,EAAoB,UAAU,EAA2C,MAAM,qBAAqB,CAAA;AAE3G,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAkC1C,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;IAPZ;;;OAGG;;;;;;;6BAI0G,CAAA;AAEjH,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAkC5C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EA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;;;QAyBC;;;WAGG;;;;;;;;IAqGP;;;;;;;OAOG;;;;;;;;IAEH;;;;;;;OAOG;;;;;;;IAEH;;;OAGG;;;;;;;;;;kBAmcL,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,gBAAgB,CAmBjF"}
|
|
@@ -6,17 +6,9 @@ import * as z from 'zod';
|
|
|
6
6
|
import getString from '../../translations/index.js';
|
|
7
7
|
import { humanReadableFileSize } from '../../utils/index.js';
|
|
8
8
|
import { getCMSConfig } from '../config/index.js';
|
|
9
|
-
import { entityKind, resolveWatermark, watermarkConfigSchema } from '../helpers/index.js';
|
|
9
|
+
import { backgroundSchema, entityKind, resolveWatermark, watermarkConfigSchema } from '../helpers/index.js';
|
|
10
10
|
import { baseFieldConfigSchema } from './field.js';
|
|
11
11
|
import { FileField } from './fileField.js';
|
|
12
|
-
const backgroundSchema = z
|
|
13
|
-
.strictObject({
|
|
14
|
-
r: z.number().min(0).max(255).describe('Red channel (0-255)'),
|
|
15
|
-
g: z.number().min(0).max(255).describe('Green channel (0-255)'),
|
|
16
|
-
b: z.number().min(0).max(255).describe('Blue channel (0-255)'),
|
|
17
|
-
alpha: z.number().min(0).max(1).describe('Alpha channel (0-1)'),
|
|
18
|
-
})
|
|
19
|
-
.describe('Background color for image padding (used with fit: contain)');
|
|
20
12
|
/**
|
|
21
13
|
* Size schema — discriminated union of three variants:
|
|
22
14
|
* - strict: true — user must upload exact dimensions, no server resize
|
|
@@ -1,20 +1,54 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
1
2
|
import type { BaseFieldConfig, FieldClientConfig } from './field.js';
|
|
2
|
-
import { Field } from './field.js';
|
|
3
3
|
import { entityKind } from '../helpers/index.js';
|
|
4
|
-
import
|
|
4
|
+
import { Field } from './field.js';
|
|
5
5
|
declare const allowImageUploadsSchema: z.ZodObject<{
|
|
6
6
|
/**
|
|
7
|
-
* The public URL
|
|
7
|
+
* The public URL template for inline photos.
|
|
8
8
|
* This url should be handled by the website app, not the NextJS-CMS app
|
|
9
9
|
* This is the URL that will be used to access the photos publicly on the website
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* `{name}` marks where the generated filename goes, so it can sit anywhere in the URL —
|
|
12
|
+
* a path segment (`https://site.com/photos/{name}`) or a query parameter
|
|
13
|
+
* (`https://site.com/api/photo?folder=posts&name={name}`).
|
|
14
|
+
*/
|
|
15
|
+
publicURL: z.ZodURL;
|
|
16
|
+
/**
|
|
17
|
+
* Bounds applied to each inline image before it is written to disk.
|
|
18
|
+
* Defaults to {@link DEFAULT_INLINE_IMAGE_SIZE}.
|
|
19
|
+
*
|
|
20
|
+
* `fit: 'inside'` scales the image down to fit within the box, keeping its aspect ratio and
|
|
21
|
+
* never enlarging a smaller image. `fit: 'cover'` fills the box exactly, cropping the overflow.
|
|
22
|
+
* `fit: 'contain'` pads the image out to the full box with `background`.
|
|
11
23
|
*/
|
|
12
|
-
|
|
13
|
-
size: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
size: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
25
|
width: z.ZodNumber;
|
|
15
26
|
height: z.ZodNumber;
|
|
16
|
-
|
|
17
|
-
}, z.core.$strict
|
|
27
|
+
fit: z.ZodLiteral<"inside">;
|
|
28
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
29
|
+
width: z.ZodNumber;
|
|
30
|
+
height: z.ZodNumber;
|
|
31
|
+
fit: z.ZodLiteral<"cover">;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
width: z.ZodNumber;
|
|
34
|
+
height: z.ZodNumber;
|
|
35
|
+
fit: z.ZodLiteral<"contain">;
|
|
36
|
+
/**
|
|
37
|
+
* Falls back to `media.images.background` from the CMS config, which is transparent by
|
|
38
|
+
* default. Transparency needs an alpha-capable `format` (webp or png) — jpeg flattens it
|
|
39
|
+
* to black, so set an opaque colour when writing jpeg.
|
|
40
|
+
*/
|
|
41
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
r: z.ZodNumber;
|
|
43
|
+
g: z.ZodNumber;
|
|
44
|
+
b: z.ZodNumber;
|
|
45
|
+
alpha: z.ZodNumber;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
}, z.core.$strict>], "fit">>;
|
|
48
|
+
/**
|
|
49
|
+
* Largest accepted inline image, measured on the decoded image rather than the base64 text.
|
|
50
|
+
* Rejected during submission, before the item is saved. Defaults to {@link DEFAULT_MAX_FILE_SIZE}.
|
|
51
|
+
*/
|
|
18
52
|
maxFileSize: z.ZodOptional<z.ZodObject<{
|
|
19
53
|
size: z.ZodNumber;
|
|
20
54
|
unit: z.ZodEnum<{
|
|
@@ -22,10 +56,6 @@ declare const allowImageUploadsSchema: z.ZodObject<{
|
|
|
22
56
|
mb: "mb";
|
|
23
57
|
}>;
|
|
24
58
|
}, z.core.$strict>>;
|
|
25
|
-
handleMethod: z.ZodOptional<z.ZodEnum<{
|
|
26
|
-
base64: "base64";
|
|
27
|
-
tempSave: "tempSave";
|
|
28
|
-
}>>;
|
|
29
59
|
/**
|
|
30
60
|
* Omit the extension of the image when saving it to disk
|
|
31
61
|
*/
|
|
@@ -46,17 +76,51 @@ declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
46
76
|
allowMedia: z.ZodLiteral<true>;
|
|
47
77
|
allowImageUploads: z.ZodOptional<z.ZodObject<{
|
|
48
78
|
/**
|
|
49
|
-
* The public URL
|
|
79
|
+
* The public URL template for inline photos.
|
|
50
80
|
* This url should be handled by the website app, not the NextJS-CMS app
|
|
51
81
|
* This is the URL that will be used to access the photos publicly on the website
|
|
52
|
-
*
|
|
82
|
+
*
|
|
83
|
+
* `{name}` marks where the generated filename goes, so it can sit anywhere in the URL —
|
|
84
|
+
* a path segment (`https://site.com/photos/{name}`) or a query parameter
|
|
85
|
+
* (`https://site.com/api/photo?folder=posts&name={name}`).
|
|
86
|
+
*/
|
|
87
|
+
publicURL: z.ZodURL;
|
|
88
|
+
/**
|
|
89
|
+
* Bounds applied to each inline image before it is written to disk.
|
|
90
|
+
* Defaults to {@link DEFAULT_INLINE_IMAGE_SIZE}.
|
|
91
|
+
*
|
|
92
|
+
* `fit: 'inside'` scales the image down to fit within the box, keeping its aspect ratio and
|
|
93
|
+
* never enlarging a smaller image. `fit: 'cover'` fills the box exactly, cropping the overflow.
|
|
94
|
+
* `fit: 'contain'` pads the image out to the full box with `background`.
|
|
53
95
|
*/
|
|
54
|
-
|
|
55
|
-
size: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
size: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
97
|
width: z.ZodNumber;
|
|
57
98
|
height: z.ZodNumber;
|
|
58
|
-
|
|
59
|
-
}, z.core.$strict
|
|
99
|
+
fit: z.ZodLiteral<"inside">;
|
|
100
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
101
|
+
width: z.ZodNumber;
|
|
102
|
+
height: z.ZodNumber;
|
|
103
|
+
fit: z.ZodLiteral<"cover">;
|
|
104
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
105
|
+
width: z.ZodNumber;
|
|
106
|
+
height: z.ZodNumber;
|
|
107
|
+
fit: z.ZodLiteral<"contain">;
|
|
108
|
+
/**
|
|
109
|
+
* Falls back to `media.images.background` from the CMS config, which is transparent by
|
|
110
|
+
* default. Transparency needs an alpha-capable `format` (webp or png) — jpeg flattens it
|
|
111
|
+
* to black, so set an opaque colour when writing jpeg.
|
|
112
|
+
*/
|
|
113
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
r: z.ZodNumber;
|
|
115
|
+
g: z.ZodNumber;
|
|
116
|
+
b: z.ZodNumber;
|
|
117
|
+
alpha: z.ZodNumber;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
}, z.core.$strict>], "fit">>;
|
|
120
|
+
/**
|
|
121
|
+
* Largest accepted inline image, measured on the decoded image rather than the base64 text.
|
|
122
|
+
* Rejected during submission, before the item is saved. Defaults to {@link DEFAULT_MAX_FILE_SIZE}.
|
|
123
|
+
*/
|
|
60
124
|
maxFileSize: z.ZodOptional<z.ZodObject<{
|
|
61
125
|
size: z.ZodNumber;
|
|
62
126
|
unit: z.ZodEnum<{
|
|
@@ -64,10 +128,6 @@ declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
64
128
|
mb: "mb";
|
|
65
129
|
}>;
|
|
66
130
|
}, z.core.$strict>>;
|
|
67
|
-
handleMethod: z.ZodOptional<z.ZodEnum<{
|
|
68
|
-
base64: "base64";
|
|
69
|
-
tempSave: "tempSave";
|
|
70
|
-
}>>;
|
|
71
131
|
/**
|
|
72
132
|
* Omit the extension of the image when saving it to disk
|
|
73
133
|
*/
|
|
@@ -144,17 +204,51 @@ declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
144
204
|
allowMedia: z.ZodLiteral<true>;
|
|
145
205
|
allowImageUploads: z.ZodOptional<z.ZodObject<{
|
|
146
206
|
/**
|
|
147
|
-
* The public URL
|
|
207
|
+
* The public URL template for inline photos.
|
|
148
208
|
* This url should be handled by the website app, not the NextJS-CMS app
|
|
149
209
|
* This is the URL that will be used to access the photos publicly on the website
|
|
150
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* `{name}` marks where the generated filename goes, so it can sit anywhere in the URL —
|
|
212
|
+
* a path segment (`https://site.com/photos/{name}`) or a query parameter
|
|
213
|
+
* (`https://site.com/api/photo?folder=posts&name={name}`).
|
|
151
214
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
215
|
+
publicURL: z.ZodURL;
|
|
216
|
+
/**
|
|
217
|
+
* Bounds applied to each inline image before it is written to disk.
|
|
218
|
+
* Defaults to {@link DEFAULT_INLINE_IMAGE_SIZE}.
|
|
219
|
+
*
|
|
220
|
+
* `fit: 'inside'` scales the image down to fit within the box, keeping its aspect ratio and
|
|
221
|
+
* never enlarging a smaller image. `fit: 'cover'` fills the box exactly, cropping the overflow.
|
|
222
|
+
* `fit: 'contain'` pads the image out to the full box with `background`.
|
|
223
|
+
*/
|
|
224
|
+
size: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
154
225
|
width: z.ZodNumber;
|
|
155
226
|
height: z.ZodNumber;
|
|
156
|
-
|
|
157
|
-
}, z.core.$strict
|
|
227
|
+
fit: z.ZodLiteral<"inside">;
|
|
228
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
229
|
+
width: z.ZodNumber;
|
|
230
|
+
height: z.ZodNumber;
|
|
231
|
+
fit: z.ZodLiteral<"cover">;
|
|
232
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
233
|
+
width: z.ZodNumber;
|
|
234
|
+
height: z.ZodNumber;
|
|
235
|
+
fit: z.ZodLiteral<"contain">;
|
|
236
|
+
/**
|
|
237
|
+
* Falls back to `media.images.background` from the CMS config, which is transparent by
|
|
238
|
+
* default. Transparency needs an alpha-capable `format` (webp or png) — jpeg flattens it
|
|
239
|
+
* to black, so set an opaque colour when writing jpeg.
|
|
240
|
+
*/
|
|
241
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
242
|
+
r: z.ZodNumber;
|
|
243
|
+
g: z.ZodNumber;
|
|
244
|
+
b: z.ZodNumber;
|
|
245
|
+
alpha: z.ZodNumber;
|
|
246
|
+
}, z.core.$strict>>;
|
|
247
|
+
}, z.core.$strict>], "fit">>;
|
|
248
|
+
/**
|
|
249
|
+
* Largest accepted inline image, measured on the decoded image rather than the base64 text.
|
|
250
|
+
* Rejected during submission, before the item is saved. Defaults to {@link DEFAULT_MAX_FILE_SIZE}.
|
|
251
|
+
*/
|
|
158
252
|
maxFileSize: z.ZodOptional<z.ZodObject<{
|
|
159
253
|
size: z.ZodNumber;
|
|
160
254
|
unit: z.ZodEnum<{
|
|
@@ -162,10 +256,6 @@ declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
162
256
|
mb: "mb";
|
|
163
257
|
}>;
|
|
164
258
|
}, z.core.$strict>>;
|
|
165
|
-
handleMethod: z.ZodOptional<z.ZodEnum<{
|
|
166
|
-
base64: "base64";
|
|
167
|
-
tempSave: "tempSave";
|
|
168
|
-
}>>;
|
|
169
259
|
/**
|
|
170
260
|
* Omit the extension of the image when saving it to disk
|
|
171
261
|
*/
|
|
@@ -210,17 +300,51 @@ declare const richTextFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUni
|
|
|
210
300
|
allowMedia: z.ZodLiteral<true>;
|
|
211
301
|
allowImageUploads: z.ZodOptional<z.ZodObject<{
|
|
212
302
|
/**
|
|
213
|
-
* The public URL
|
|
303
|
+
* The public URL template for inline photos.
|
|
214
304
|
* This url should be handled by the website app, not the NextJS-CMS app
|
|
215
305
|
* This is the URL that will be used to access the photos publicly on the website
|
|
216
|
-
*
|
|
306
|
+
*
|
|
307
|
+
* `{name}` marks where the generated filename goes, so it can sit anywhere in the URL —
|
|
308
|
+
* a path segment (`https://site.com/photos/{name}`) or a query parameter
|
|
309
|
+
* (`https://site.com/api/photo?folder=posts&name={name}`).
|
|
310
|
+
*/
|
|
311
|
+
publicURL: z.ZodURL;
|
|
312
|
+
/**
|
|
313
|
+
* Bounds applied to each inline image before it is written to disk.
|
|
314
|
+
* Defaults to {@link DEFAULT_INLINE_IMAGE_SIZE}.
|
|
315
|
+
*
|
|
316
|
+
* `fit: 'inside'` scales the image down to fit within the box, keeping its aspect ratio and
|
|
317
|
+
* never enlarging a smaller image. `fit: 'cover'` fills the box exactly, cropping the overflow.
|
|
318
|
+
* `fit: 'contain'` pads the image out to the full box with `background`.
|
|
217
319
|
*/
|
|
218
|
-
|
|
219
|
-
size: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
size: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
220
321
|
width: z.ZodNumber;
|
|
221
322
|
height: z.ZodNumber;
|
|
222
|
-
|
|
223
|
-
}, z.core.$strict
|
|
323
|
+
fit: z.ZodLiteral<"inside">;
|
|
324
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
325
|
+
width: z.ZodNumber;
|
|
326
|
+
height: z.ZodNumber;
|
|
327
|
+
fit: z.ZodLiteral<"cover">;
|
|
328
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
329
|
+
width: z.ZodNumber;
|
|
330
|
+
height: z.ZodNumber;
|
|
331
|
+
fit: z.ZodLiteral<"contain">;
|
|
332
|
+
/**
|
|
333
|
+
* Falls back to `media.images.background` from the CMS config, which is transparent by
|
|
334
|
+
* default. Transparency needs an alpha-capable `format` (webp or png) — jpeg flattens it
|
|
335
|
+
* to black, so set an opaque colour when writing jpeg.
|
|
336
|
+
*/
|
|
337
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
338
|
+
r: z.ZodNumber;
|
|
339
|
+
g: z.ZodNumber;
|
|
340
|
+
b: z.ZodNumber;
|
|
341
|
+
alpha: z.ZodNumber;
|
|
342
|
+
}, z.core.$strict>>;
|
|
343
|
+
}, z.core.$strict>], "fit">>;
|
|
344
|
+
/**
|
|
345
|
+
* Largest accepted inline image, measured on the decoded image rather than the base64 text.
|
|
346
|
+
* Rejected during submission, before the item is saved. Defaults to {@link DEFAULT_MAX_FILE_SIZE}.
|
|
347
|
+
*/
|
|
224
348
|
maxFileSize: z.ZodOptional<z.ZodObject<{
|
|
225
349
|
size: z.ZodNumber;
|
|
226
350
|
unit: z.ZodEnum<{
|
|
@@ -228,10 +352,6 @@ declare const richTextFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUni
|
|
|
228
352
|
mb: "mb";
|
|
229
353
|
}>;
|
|
230
354
|
}, z.core.$strict>>;
|
|
231
|
-
handleMethod: z.ZodOptional<z.ZodEnum<{
|
|
232
|
-
base64: "base64";
|
|
233
|
-
tempSave: "tempSave";
|
|
234
|
-
}>>;
|
|
235
355
|
/**
|
|
236
356
|
* Omit the extension of the image when saving it to disk
|
|
237
357
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.d.ts","sourceRoot":"","sources":["../../../src/core/fields/richText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"richText.d.ts","sourceRoot":"","sources":["../../../src/core/fields/richText.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAMpE,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGlE,OAAO,EAAyB,KAAK,EAAE,MAAM,YAAY,CAAA;AA4CzD,QAAA,MAAM,uBAAuB;IACzB;;;;;;;;OAQG;;IAOH;;;;;;;OAOG;;;;;;;;;;;;;QA1CC;;;;WAIG;;;;;;;;IAwCP;;;OAGG;;;;;;;;IAQH;;OAEG;;;;;;;;kBAGL,CAAA;AAwCF,QAAA,MAAM,YAAY;;;;;;;;QAhFd;;;;;;;;WAQG;;QAOH;;;;;;;WAOG;;;;;;;;;;;;;YA1CC;;;;eAIG;;;;;;;;QAwCP;;;WAGG;;;;;;;;QAQH;;WAEG;;;;;;;;;;;;;;;;kCA8CL,CAAA;AAEF,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,qBAAa,aAAc,SAAQ,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC;IACzD,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAkB;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,QAAQ,C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