nextjs-cms 0.9.40 → 0.9.42
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 +4 -3
- package/dist/api/actions/pages.d.ts.map +1 -1
- package/dist/api/actions/pages.js +11 -4
- package/dist/api/trpc/root.d.ts +4 -3
- package/dist/api/trpc/root.d.ts.map +1 -1
- package/dist/api/trpc/routers/config.d.ts.map +1 -1
- package/dist/api/trpc/routers/hasItemsSection.d.ts +1 -0
- package/dist/api/trpc/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/trpc/routers/navigation.d.ts +3 -3
- package/dist/api/trpc/server.d.ts +12 -9
- package/dist/api/trpc/server.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +43 -2
- package/dist/cli/utils/add-table-keys.d.ts.map +1 -1
- package/dist/cli/utils/add-table-keys.js +42 -6
- package/dist/cli/utils/schema-generator.d.ts +41 -0
- package/dist/cli/utils/schema-generator.d.ts.map +1 -1
- package/dist/cli/utils/schema-generator.js +41 -1
- package/dist/core/config/config-loader.d.ts +25 -6
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +9 -13
- package/dist/core/fields/photo.d.ts +86 -14
- package/dist/core/fields/photo.d.ts.map +1 -1
- package/dist/core/fields/photo.js +120 -23
- package/dist/core/fields/richText.d.ts +8 -8
- package/dist/core/fields/select.d.ts +1 -1
- package/dist/core/fields/select.d.ts.map +1 -1
- package/dist/core/fields/select.js +18 -2
- package/dist/core/fields/selectMultiple.d.ts.map +1 -1
- package/dist/core/fields/selectMultiple.js +9 -0
- package/dist/core/helpers/index.d.ts +2 -0
- package/dist/core/helpers/index.d.ts.map +1 -1
- package/dist/core/helpers/index.js +1 -0
- package/dist/core/helpers/watermark.d.ts +96 -0
- package/dist/core/helpers/watermark.d.ts.map +1 -0
- package/dist/core/helpers/watermark.js +61 -0
- package/dist/core/sections/category.d.ts +80 -44
- package/dist/core/sections/category.d.ts.map +1 -1
- package/dist/core/sections/hasItems.d.ts +140 -56
- package/dist/core/sections/hasItems.d.ts.map +1 -1
- package/dist/core/sections/section.d.ts +63 -26
- package/dist/core/sections/section.d.ts.map +1 -1
- package/dist/core/sections/section.js +2 -2
- package/dist/core/sections/simple.d.ts +44 -8
- package/dist/core/sections/simple.d.ts.map +1 -1
- package/dist/core/submit/gallery-order.d.ts +34 -0
- package/dist/core/submit/gallery-order.d.ts.map +1 -0
- package/dist/core/submit/gallery-order.js +50 -0
- package/dist/core/submit/submit.d.ts +8 -0
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +63 -3
- package/dist/core/types/index.d.ts +1 -0
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/translations/client.d.ts +4 -4
- package/dist/translations/server.d.ts +4 -4
- package/package.json +3 -3
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const watermarkPositionEnum: z.ZodEnum<{
|
|
3
|
+
"top-left": "top-left";
|
|
4
|
+
top: "top";
|
|
5
|
+
"top-right": "top-right";
|
|
6
|
+
left: "left";
|
|
7
|
+
center: "center";
|
|
8
|
+
right: "right";
|
|
9
|
+
"bottom-left": "bottom-left";
|
|
10
|
+
bottom: "bottom";
|
|
11
|
+
"bottom-right": "bottom-right";
|
|
12
|
+
}>;
|
|
13
|
+
export type WatermarkPosition = z.infer<typeof watermarkPositionEnum>;
|
|
14
|
+
/**
|
|
15
|
+
* Watermark object schema — shared by the global, gallery, and field config sites.
|
|
16
|
+
* `imagePath` is required; everything else falls back to WATERMARK_DEFAULTS.
|
|
17
|
+
*/
|
|
18
|
+
export declare const watermarkObjectSchema: z.ZodObject<{
|
|
19
|
+
/** Path to the watermark image, resolved relative to process.cwd() unless absolute. PNG w/ alpha recommended. */
|
|
20
|
+
imagePath: z.ZodString;
|
|
21
|
+
/** Placement, mapped to a sharp gravity. Default 'center'. */
|
|
22
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
"top-left": "top-left";
|
|
24
|
+
top: "top";
|
|
25
|
+
"top-right": "top-right";
|
|
26
|
+
left: "left";
|
|
27
|
+
center: "center";
|
|
28
|
+
right: "right";
|
|
29
|
+
"bottom-left": "bottom-left";
|
|
30
|
+
bottom: "bottom";
|
|
31
|
+
"bottom-right": "bottom-right";
|
|
32
|
+
}>>;
|
|
33
|
+
/** Watermark width as a fraction (0–1) of the output image width. Default 0.2. */
|
|
34
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
/** Overlay opacity (0–1). Default 0.5. */
|
|
36
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
/** Inset in px from the chosen edge/corner. Ignored for 'center' and when tiling. Default 0. */
|
|
38
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
/** Repeat the mark across the whole image (ignores position + margin). Default false. */
|
|
40
|
+
tile: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
/** Also composite the mark onto the generated thumbnail. Default false. */
|
|
42
|
+
applyToThumbnail: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export declare const watermarkConfigSchema: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
45
|
+
/** Path to the watermark image, resolved relative to process.cwd() unless absolute. PNG w/ alpha recommended. */
|
|
46
|
+
imagePath: z.ZodString;
|
|
47
|
+
/** Placement, mapped to a sharp gravity. Default 'center'. */
|
|
48
|
+
position: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
"top-left": "top-left";
|
|
50
|
+
top: "top";
|
|
51
|
+
"top-right": "top-right";
|
|
52
|
+
left: "left";
|
|
53
|
+
center: "center";
|
|
54
|
+
right: "right";
|
|
55
|
+
"bottom-left": "bottom-left";
|
|
56
|
+
bottom: "bottom";
|
|
57
|
+
"bottom-right": "bottom-right";
|
|
58
|
+
}>>;
|
|
59
|
+
/** Watermark width as a fraction (0–1) of the output image width. Default 0.2. */
|
|
60
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
/** Overlay opacity (0–1). Default 0.5. */
|
|
62
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
/** Inset in px from the chosen edge/corner. Ignored for 'center' and when tiling. Default 0. */
|
|
64
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
/** Repeat the mark across the whole image (ignores position + margin). Default false. */
|
|
66
|
+
tile: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
/** Also composite the mark onto the generated thumbnail. Default false. */
|
|
68
|
+
applyToThumbnail: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strict>]>;
|
|
70
|
+
export type WatermarkObject = z.infer<typeof watermarkObjectSchema>;
|
|
71
|
+
export type WatermarkConfig = z.infer<typeof watermarkConfigSchema>;
|
|
72
|
+
export type ResolvedWatermark = {
|
|
73
|
+
imagePath: string;
|
|
74
|
+
position: WatermarkPosition;
|
|
75
|
+
size: number;
|
|
76
|
+
opacity: number;
|
|
77
|
+
margin: number;
|
|
78
|
+
tile: boolean;
|
|
79
|
+
applyToThumbnail: boolean;
|
|
80
|
+
};
|
|
81
|
+
export declare const WATERMARK_DEFAULTS: {
|
|
82
|
+
position: WatermarkPosition;
|
|
83
|
+
size: number;
|
|
84
|
+
opacity: number;
|
|
85
|
+
margin: number;
|
|
86
|
+
tile: boolean;
|
|
87
|
+
applyToThumbnail: boolean;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a watermark config for one level against the global config.
|
|
91
|
+
* - undefined -> inherit `global`
|
|
92
|
+
* - false -> off (returns null)
|
|
93
|
+
* - object -> full replacement (imagePath required)
|
|
94
|
+
*/
|
|
95
|
+
export declare function resolveWatermark(level: WatermarkConfig | undefined, global: WatermarkConfig): ResolvedWatermark | null;
|
|
96
|
+
//# sourceMappingURL=watermark.d.ts.map
|
|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GAAG,IAAI,CAY1B"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export const watermarkPositionEnum = z.enum([
|
|
3
|
+
'top-left',
|
|
4
|
+
'top',
|
|
5
|
+
'top-right',
|
|
6
|
+
'left',
|
|
7
|
+
'center',
|
|
8
|
+
'right',
|
|
9
|
+
'bottom-left',
|
|
10
|
+
'bottom',
|
|
11
|
+
'bottom-right',
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Watermark object schema — shared by the global, gallery, and field config sites.
|
|
15
|
+
* `imagePath` is required; everything else falls back to WATERMARK_DEFAULTS.
|
|
16
|
+
*/
|
|
17
|
+
export const watermarkObjectSchema = z.strictObject({
|
|
18
|
+
/** Path to the watermark image, resolved relative to process.cwd() unless absolute. PNG w/ alpha recommended. */
|
|
19
|
+
imagePath: z.string(),
|
|
20
|
+
/** Placement, mapped to a sharp gravity. Default 'center'. */
|
|
21
|
+
position: watermarkPositionEnum.optional(),
|
|
22
|
+
/** Watermark width as a fraction (0–1) of the output image width. Default 0.2. */
|
|
23
|
+
size: z.number().min(0).max(1).optional(),
|
|
24
|
+
/** Overlay opacity (0–1). Default 0.5. */
|
|
25
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
26
|
+
/** Inset in px from the chosen edge/corner. Ignored for 'center' and when tiling. Default 0. */
|
|
27
|
+
margin: z.number().min(0).optional(),
|
|
28
|
+
/** Repeat the mark across the whole image (ignores position + margin). Default false. */
|
|
29
|
+
tile: z.boolean().optional(),
|
|
30
|
+
/** Also composite the mark onto the generated thumbnail. Default false. */
|
|
31
|
+
applyToThumbnail: z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
export const watermarkConfigSchema = z.union([z.literal(false), watermarkObjectSchema]);
|
|
34
|
+
export const WATERMARK_DEFAULTS = {
|
|
35
|
+
position: 'center',
|
|
36
|
+
size: 0.2,
|
|
37
|
+
opacity: 0.5,
|
|
38
|
+
margin: 0,
|
|
39
|
+
tile: false,
|
|
40
|
+
applyToThumbnail: false,
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a watermark config for one level against the global config.
|
|
44
|
+
* - undefined -> inherit `global`
|
|
45
|
+
* - false -> off (returns null)
|
|
46
|
+
* - object -> full replacement (imagePath required)
|
|
47
|
+
*/
|
|
48
|
+
export function resolveWatermark(level, global) {
|
|
49
|
+
const chosen = level ?? global;
|
|
50
|
+
if (chosen === false)
|
|
51
|
+
return null;
|
|
52
|
+
return {
|
|
53
|
+
imagePath: chosen.imagePath,
|
|
54
|
+
position: chosen.position ?? WATERMARK_DEFAULTS.position,
|
|
55
|
+
size: chosen.size ?? WATERMARK_DEFAULTS.size,
|
|
56
|
+
opacity: chosen.opacity ?? WATERMARK_DEFAULTS.opacity,
|
|
57
|
+
margin: chosen.margin ?? WATERMARK_DEFAULTS.margin,
|
|
58
|
+
tile: chosen.tile ?? WATERMARK_DEFAULTS.tile,
|
|
59
|
+
applyToThumbnail: chosen.applyToThumbnail ?? WATERMARK_DEFAULTS.applyToThumbnail,
|
|
60
|
+
};
|
|
61
|
+
}
|