@delmaredigital/payload-puck 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/LICENSE +73 -0
- package/README.md +1580 -0
- package/dist/AccordionClient.d.mts +24 -0
- package/dist/AccordionClient.d.ts +24 -0
- package/dist/AccordionClient.js +786 -0
- package/dist/AccordionClient.js.map +1 -0
- package/dist/AccordionClient.mjs +784 -0
- package/dist/AccordionClient.mjs.map +1 -0
- package/dist/AnimatedWrapper.d.mts +30 -0
- package/dist/AnimatedWrapper.d.ts +30 -0
- package/dist/AnimatedWrapper.js +379 -0
- package/dist/AnimatedWrapper.js.map +1 -0
- package/dist/AnimatedWrapper.mjs +377 -0
- package/dist/AnimatedWrapper.mjs.map +1 -0
- package/dist/admin/client.d.mts +108 -0
- package/dist/admin/client.d.ts +108 -0
- package/dist/admin/client.js +177 -0
- package/dist/admin/client.js.map +1 -0
- package/dist/admin/client.mjs +173 -0
- package/dist/admin/client.mjs.map +1 -0
- package/dist/admin/index.d.mts +157 -0
- package/dist/admin/index.d.ts +157 -0
- package/dist/admin/index.js +31 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +29 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/api/index.d.mts +460 -0
- package/dist/api/index.d.ts +460 -0
- package/dist/api/index.js +588 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +578 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/components/index.css +339 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.d.mts +222 -0
- package/dist/components/index.d.ts +222 -0
- package/dist/components/index.js +9177 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +9130 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/config.editor.css +339 -0
- package/dist/config/config.editor.css.map +1 -0
- package/dist/config/config.editor.d.mts +153 -0
- package/dist/config/config.editor.d.ts +153 -0
- package/dist/config/config.editor.js +9400 -0
- package/dist/config/config.editor.js.map +1 -0
- package/dist/config/config.editor.mjs +9368 -0
- package/dist/config/config.editor.mjs.map +1 -0
- package/dist/config/index.d.mts +68 -0
- package/dist/config/index.d.ts +68 -0
- package/dist/config/index.js +2017 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +1991 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/editor/index.d.mts +784 -0
- package/dist/editor/index.d.ts +784 -0
- package/dist/editor/index.js +4517 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/index.mjs +4483 -0
- package/dist/editor/index.mjs.map +1 -0
- package/dist/fields/index.css +339 -0
- package/dist/fields/index.css.map +1 -0
- package/dist/fields/index.d.mts +600 -0
- package/dist/fields/index.d.ts +600 -0
- package/dist/fields/index.js +7739 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/index.mjs +7590 -0
- package/dist/fields/index.mjs.map +1 -0
- package/dist/index-CQu6SzDg.d.mts +327 -0
- package/dist/index-CoUQnyC3.d.ts +327 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +569 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +555 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layouts/index.d.mts +96 -0
- package/dist/layouts/index.d.ts +96 -0
- package/dist/layouts/index.js +394 -0
- package/dist/layouts/index.js.map +1 -0
- package/dist/layouts/index.mjs +378 -0
- package/dist/layouts/index.mjs.map +1 -0
- package/dist/plugin/index.d.mts +289 -0
- package/dist/plugin/index.d.ts +289 -0
- package/dist/plugin/index.js +569 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/index.mjs +555 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/render/index.d.mts +109 -0
- package/dist/render/index.d.ts +109 -0
- package/dist/render/index.js +2146 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/index.mjs +2123 -0
- package/dist/render/index.mjs.map +1 -0
- package/dist/shared-DMAF1AcH.d.mts +545 -0
- package/dist/shared-DMAF1AcH.d.ts +545 -0
- package/dist/theme/index.d.mts +155 -0
- package/dist/theme/index.d.ts +155 -0
- package/dist/theme/index.js +201 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/index.mjs +186 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/types-D7D3rZ1J.d.mts +116 -0
- package/dist/types-D7D3rZ1J.d.ts +116 -0
- package/dist/types-_6MvjyKv.d.mts +104 -0
- package/dist/types-_6MvjyKv.d.ts +104 -0
- package/dist/utils/index.d.mts +267 -0
- package/dist/utils/index.d.ts +267 -0
- package/dist/utils/index.js +426 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +412 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils-DaRs9t0J.d.mts +85 -0
- package/dist/utils-gAvt0Vhw.d.ts +85 -0
- package/examples/README.md +240 -0
- package/examples/api/puck/pages/[id]/route.ts +64 -0
- package/examples/api/puck/pages/[id]/versions/route.ts +47 -0
- package/examples/api/puck/pages/route.ts +45 -0
- package/examples/app/(frontend)/page.tsx +94 -0
- package/examples/app/[...slug]/page.tsx +101 -0
- package/examples/app/pages/[id]/edit/page.tsx +148 -0
- package/examples/components/CustomBanner.tsx +368 -0
- package/examples/config/custom-config.ts +223 -0
- package/examples/config/payload.config.example.ts +64 -0
- package/examples/lib/puck-layouts.ts +258 -0
- package/examples/lib/puck-theme.ts +94 -0
- package/examples/styles/puck-theme.css +171 -0
- package/package.json +157 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { L as LayoutDefinition } from '../types-D7D3rZ1J.mjs';
|
|
2
|
+
export { c as LayoutClasses, a as LayoutConfig, b as LayoutOption, d as LayoutStyles, e as LayoutWrapperProps } from '../types-D7D3rZ1J.mjs';
|
|
3
|
+
export { D as DEFAULT_LAYOUTS, a as DEFAULT_LAYOUT_CONFIG, E as EXTENDED_LAYOUTS, c as createLayout, d as defaultLayout, f as fullWidthLayout, g as getLayout, l as landingLayout, b as layoutsToOptions, e as layoutsToPayloadOptions, m as mergeLayouts, n as narrowLayout, r as resolveLayoutConfig, w as wideLayout } from '../utils-DaRs9t0J.mjs';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
interface MediaReference {
|
|
8
|
+
id: string | number;
|
|
9
|
+
url: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ColorValue {
|
|
16
|
+
hex: string;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
}
|
|
19
|
+
interface GradientStop {
|
|
20
|
+
color: ColorValue;
|
|
21
|
+
position: number;
|
|
22
|
+
}
|
|
23
|
+
interface GradientValue {
|
|
24
|
+
type: 'linear' | 'radial';
|
|
25
|
+
angle: number;
|
|
26
|
+
stops: GradientStop[];
|
|
27
|
+
radialShape?: 'circle' | 'ellipse';
|
|
28
|
+
radialPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gradient mask for fading images to transparent
|
|
32
|
+
*/
|
|
33
|
+
interface GradientMask {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
direction: 'to-top' | 'to-bottom' | 'to-left' | 'to-right' | 'to-top-left' | 'to-top-right' | 'to-bottom-left' | 'to-bottom-right' | 'from-center';
|
|
36
|
+
startOpacity: number;
|
|
37
|
+
endOpacity: number;
|
|
38
|
+
startPosition: number;
|
|
39
|
+
endPosition: number;
|
|
40
|
+
}
|
|
41
|
+
interface BackgroundImageValue {
|
|
42
|
+
media: MediaReference | null;
|
|
43
|
+
size: 'cover' | 'contain' | 'auto';
|
|
44
|
+
position: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
45
|
+
repeat: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
46
|
+
attachment: 'scroll' | 'fixed';
|
|
47
|
+
/** Overall image opacity 0-100 (default 100) */
|
|
48
|
+
opacity?: number;
|
|
49
|
+
/** Gradient mask for fade to transparent effect */
|
|
50
|
+
mask?: GradientMask;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Overlay layer for images (Divi-style)
|
|
54
|
+
* Renders a color or gradient on top of the background image
|
|
55
|
+
*/
|
|
56
|
+
interface BackgroundOverlay {
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
type: 'solid' | 'gradient';
|
|
59
|
+
solid?: ColorValue | null;
|
|
60
|
+
gradient?: GradientValue | null;
|
|
61
|
+
}
|
|
62
|
+
interface BackgroundValue {
|
|
63
|
+
type: 'none' | 'solid' | 'gradient' | 'image';
|
|
64
|
+
solid?: ColorValue | null;
|
|
65
|
+
gradient?: GradientValue | null;
|
|
66
|
+
image?: BackgroundImageValue | null;
|
|
67
|
+
/** Overlay layer, only used when type === 'image' */
|
|
68
|
+
overlay?: BackgroundOverlay | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Page-level overrides for layout settings
|
|
73
|
+
*/
|
|
74
|
+
interface PageOverrides {
|
|
75
|
+
/** Override header visibility: 'default' uses layout, 'show'/'hide' overrides */
|
|
76
|
+
showHeader?: 'default' | 'show' | 'hide';
|
|
77
|
+
/** Override footer visibility: 'default' uses layout, 'show'/'hide' overrides */
|
|
78
|
+
showFooter?: 'default' | 'show' | 'hide';
|
|
79
|
+
/** Page background (overrides any layout background) */
|
|
80
|
+
background?: BackgroundValue | null;
|
|
81
|
+
/** Page max width: 'default' uses layout, otherwise uses the value */
|
|
82
|
+
maxWidth?: string;
|
|
83
|
+
}
|
|
84
|
+
interface LayoutWrapperProps {
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
layout?: LayoutDefinition;
|
|
87
|
+
className?: string;
|
|
88
|
+
/** Page-level overrides from Puck root props */
|
|
89
|
+
overrides?: PageOverrides;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Applies layout configuration to page content
|
|
93
|
+
*/
|
|
94
|
+
declare function LayoutWrapper({ children, layout, className, overrides }: LayoutWrapperProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
|
|
96
|
+
export { LayoutDefinition, LayoutWrapper, type LayoutWrapperProps as LayoutWrapperComponentProps, type PageOverrides };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { L as LayoutDefinition } from '../types-D7D3rZ1J.js';
|
|
2
|
+
export { c as LayoutClasses, a as LayoutConfig, b as LayoutOption, d as LayoutStyles, e as LayoutWrapperProps } from '../types-D7D3rZ1J.js';
|
|
3
|
+
export { D as DEFAULT_LAYOUTS, a as DEFAULT_LAYOUT_CONFIG, E as EXTENDED_LAYOUTS, c as createLayout, d as defaultLayout, f as fullWidthLayout, g as getLayout, l as landingLayout, b as layoutsToOptions, e as layoutsToPayloadOptions, m as mergeLayouts, n as narrowLayout, r as resolveLayoutConfig, w as wideLayout } from '../utils-gAvt0Vhw.js';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
interface MediaReference {
|
|
8
|
+
id: string | number;
|
|
9
|
+
url: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ColorValue {
|
|
16
|
+
hex: string;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
}
|
|
19
|
+
interface GradientStop {
|
|
20
|
+
color: ColorValue;
|
|
21
|
+
position: number;
|
|
22
|
+
}
|
|
23
|
+
interface GradientValue {
|
|
24
|
+
type: 'linear' | 'radial';
|
|
25
|
+
angle: number;
|
|
26
|
+
stops: GradientStop[];
|
|
27
|
+
radialShape?: 'circle' | 'ellipse';
|
|
28
|
+
radialPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gradient mask for fading images to transparent
|
|
32
|
+
*/
|
|
33
|
+
interface GradientMask {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
direction: 'to-top' | 'to-bottom' | 'to-left' | 'to-right' | 'to-top-left' | 'to-top-right' | 'to-bottom-left' | 'to-bottom-right' | 'from-center';
|
|
36
|
+
startOpacity: number;
|
|
37
|
+
endOpacity: number;
|
|
38
|
+
startPosition: number;
|
|
39
|
+
endPosition: number;
|
|
40
|
+
}
|
|
41
|
+
interface BackgroundImageValue {
|
|
42
|
+
media: MediaReference | null;
|
|
43
|
+
size: 'cover' | 'contain' | 'auto';
|
|
44
|
+
position: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
45
|
+
repeat: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
46
|
+
attachment: 'scroll' | 'fixed';
|
|
47
|
+
/** Overall image opacity 0-100 (default 100) */
|
|
48
|
+
opacity?: number;
|
|
49
|
+
/** Gradient mask for fade to transparent effect */
|
|
50
|
+
mask?: GradientMask;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Overlay layer for images (Divi-style)
|
|
54
|
+
* Renders a color or gradient on top of the background image
|
|
55
|
+
*/
|
|
56
|
+
interface BackgroundOverlay {
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
type: 'solid' | 'gradient';
|
|
59
|
+
solid?: ColorValue | null;
|
|
60
|
+
gradient?: GradientValue | null;
|
|
61
|
+
}
|
|
62
|
+
interface BackgroundValue {
|
|
63
|
+
type: 'none' | 'solid' | 'gradient' | 'image';
|
|
64
|
+
solid?: ColorValue | null;
|
|
65
|
+
gradient?: GradientValue | null;
|
|
66
|
+
image?: BackgroundImageValue | null;
|
|
67
|
+
/** Overlay layer, only used when type === 'image' */
|
|
68
|
+
overlay?: BackgroundOverlay | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Page-level overrides for layout settings
|
|
73
|
+
*/
|
|
74
|
+
interface PageOverrides {
|
|
75
|
+
/** Override header visibility: 'default' uses layout, 'show'/'hide' overrides */
|
|
76
|
+
showHeader?: 'default' | 'show' | 'hide';
|
|
77
|
+
/** Override footer visibility: 'default' uses layout, 'show'/'hide' overrides */
|
|
78
|
+
showFooter?: 'default' | 'show' | 'hide';
|
|
79
|
+
/** Page background (overrides any layout background) */
|
|
80
|
+
background?: BackgroundValue | null;
|
|
81
|
+
/** Page max width: 'default' uses layout, otherwise uses the value */
|
|
82
|
+
maxWidth?: string;
|
|
83
|
+
}
|
|
84
|
+
interface LayoutWrapperProps {
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
layout?: LayoutDefinition;
|
|
87
|
+
className?: string;
|
|
88
|
+
/** Page-level overrides from Puck root props */
|
|
89
|
+
overrides?: PageOverrides;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Applies layout configuration to page content
|
|
93
|
+
*/
|
|
94
|
+
declare function LayoutWrapper({ children, layout, className, overrides }: LayoutWrapperProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
|
|
96
|
+
export { LayoutDefinition, LayoutWrapper, type LayoutWrapperProps as LayoutWrapperComponentProps, type PageOverrides };
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
// src/layouts/defaults.ts
|
|
6
|
+
var defaultLayout = {
|
|
7
|
+
value: "default",
|
|
8
|
+
label: "Default",
|
|
9
|
+
description: "Standard page layout with contained content width",
|
|
10
|
+
classes: {
|
|
11
|
+
wrapper: "",
|
|
12
|
+
container: "mx-auto px-4 sm:px-6 lg:px-8",
|
|
13
|
+
content: ""
|
|
14
|
+
},
|
|
15
|
+
maxWidth: "1200px",
|
|
16
|
+
fullWidth: false
|
|
17
|
+
};
|
|
18
|
+
var landingLayout = {
|
|
19
|
+
value: "landing",
|
|
20
|
+
label: "Landing",
|
|
21
|
+
description: "Full-width sections with no global container constraints",
|
|
22
|
+
classes: {
|
|
23
|
+
wrapper: "",
|
|
24
|
+
container: "",
|
|
25
|
+
content: ""
|
|
26
|
+
},
|
|
27
|
+
fullWidth: true
|
|
28
|
+
};
|
|
29
|
+
var fullWidthLayout = {
|
|
30
|
+
value: "full-width",
|
|
31
|
+
label: "Full Width",
|
|
32
|
+
description: "Content spans the full viewport width",
|
|
33
|
+
classes: {
|
|
34
|
+
wrapper: "w-full",
|
|
35
|
+
container: "w-full",
|
|
36
|
+
content: ""
|
|
37
|
+
},
|
|
38
|
+
maxWidth: "100%",
|
|
39
|
+
fullWidth: true
|
|
40
|
+
};
|
|
41
|
+
var narrowLayout = {
|
|
42
|
+
value: "narrow",
|
|
43
|
+
label: "Narrow",
|
|
44
|
+
description: "Narrow content width for optimal reading experience",
|
|
45
|
+
classes: {
|
|
46
|
+
wrapper: "",
|
|
47
|
+
container: "mx-auto px-4 sm:px-6",
|
|
48
|
+
content: ""
|
|
49
|
+
},
|
|
50
|
+
maxWidth: "768px",
|
|
51
|
+
fullWidth: false
|
|
52
|
+
};
|
|
53
|
+
var wideLayout = {
|
|
54
|
+
value: "wide",
|
|
55
|
+
label: "Wide",
|
|
56
|
+
description: "Wider content area for dashboards or galleries",
|
|
57
|
+
classes: {
|
|
58
|
+
wrapper: "",
|
|
59
|
+
container: "mx-auto px-4 sm:px-6 lg:px-8",
|
|
60
|
+
content: ""
|
|
61
|
+
},
|
|
62
|
+
maxWidth: "1440px",
|
|
63
|
+
fullWidth: false
|
|
64
|
+
};
|
|
65
|
+
var DEFAULT_LAYOUTS = [
|
|
66
|
+
defaultLayout,
|
|
67
|
+
landingLayout,
|
|
68
|
+
fullWidthLayout
|
|
69
|
+
];
|
|
70
|
+
var EXTENDED_LAYOUTS = [
|
|
71
|
+
defaultLayout,
|
|
72
|
+
landingLayout,
|
|
73
|
+
fullWidthLayout,
|
|
74
|
+
narrowLayout,
|
|
75
|
+
wideLayout
|
|
76
|
+
];
|
|
77
|
+
var DEFAULT_LAYOUT_CONFIG = {
|
|
78
|
+
layouts: DEFAULT_LAYOUTS,
|
|
79
|
+
defaultLayout: "default"
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/layouts/utils.ts
|
|
83
|
+
function resolveLayoutConfig(config) {
|
|
84
|
+
if (!config) return DEFAULT_LAYOUT_CONFIG;
|
|
85
|
+
return {
|
|
86
|
+
layouts: config.layouts ?? DEFAULT_LAYOUTS,
|
|
87
|
+
defaultLayout: config.defaultLayout ?? "default"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function getLayout(layouts, value, fallback = "default") {
|
|
91
|
+
const layout = layouts.find((l) => l.value === value);
|
|
92
|
+
if (layout) return layout;
|
|
93
|
+
if (value !== fallback) {
|
|
94
|
+
return layouts.find((l) => l.value === fallback);
|
|
95
|
+
}
|
|
96
|
+
return layouts[0];
|
|
97
|
+
}
|
|
98
|
+
function layoutsToOptions(layouts) {
|
|
99
|
+
return layouts.map(({ value, label, description }) => ({
|
|
100
|
+
value,
|
|
101
|
+
label,
|
|
102
|
+
description
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
function layoutsToPayloadOptions(layouts) {
|
|
106
|
+
return layouts.map(({ value, label }) => ({
|
|
107
|
+
label,
|
|
108
|
+
value
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
function createLayout(config) {
|
|
112
|
+
return {
|
|
113
|
+
...config
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function mergeLayouts(base, custom, options) {
|
|
117
|
+
if (options?.replace) {
|
|
118
|
+
return custom;
|
|
119
|
+
}
|
|
120
|
+
let result = [...base];
|
|
121
|
+
if (options?.exclude) {
|
|
122
|
+
result = result.filter((l) => !options.exclude.includes(l.value));
|
|
123
|
+
}
|
|
124
|
+
for (const customLayout of custom) {
|
|
125
|
+
const existingIndex = result.findIndex((l) => l.value === customLayout.value);
|
|
126
|
+
if (existingIndex >= 0) {
|
|
127
|
+
result[existingIndex] = customLayout;
|
|
128
|
+
} else {
|
|
129
|
+
result.push(customLayout);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/fields/shared.ts
|
|
136
|
+
function hexToRgb(hex) {
|
|
137
|
+
const clean = hex.replace(/^#/, "");
|
|
138
|
+
if (clean.length !== 6) return null;
|
|
139
|
+
const r = parseInt(clean.substring(0, 2), 16);
|
|
140
|
+
const g = parseInt(clean.substring(2, 4), 16);
|
|
141
|
+
const b = parseInt(clean.substring(4, 6), 16);
|
|
142
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
|
|
143
|
+
return { r, g, b };
|
|
144
|
+
}
|
|
145
|
+
function colorValueToCSS(color) {
|
|
146
|
+
if (!color?.hex) return void 0;
|
|
147
|
+
const rgb = hexToRgb(color.hex);
|
|
148
|
+
if (!rgb) return color.hex;
|
|
149
|
+
const opacity = (color.opacity ?? 100) / 100;
|
|
150
|
+
if (opacity === 1) {
|
|
151
|
+
return color.hex;
|
|
152
|
+
}
|
|
153
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
|
154
|
+
}
|
|
155
|
+
function gradientValueToCSS(gradient) {
|
|
156
|
+
if (!gradient?.stops || gradient.stops.length === 0) {
|
|
157
|
+
return "transparent";
|
|
158
|
+
}
|
|
159
|
+
const sortedStops = [...gradient.stops].sort((a, b) => a.position - b.position);
|
|
160
|
+
const stopsCSS = sortedStops.map((stop) => {
|
|
161
|
+
const color = colorValueToCSS(stop.color) || "transparent";
|
|
162
|
+
return `${color} ${stop.position}%`;
|
|
163
|
+
}).join(", ");
|
|
164
|
+
if (gradient.type === "radial") {
|
|
165
|
+
const shape = gradient.radialShape || "circle";
|
|
166
|
+
const position = gradient.radialPosition || "center";
|
|
167
|
+
return `radial-gradient(${shape} at ${position}, ${stopsCSS})`;
|
|
168
|
+
}
|
|
169
|
+
return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
|
|
170
|
+
}
|
|
171
|
+
function positionToCSS(position) {
|
|
172
|
+
const positionMap = {
|
|
173
|
+
center: "center",
|
|
174
|
+
top: "top",
|
|
175
|
+
bottom: "bottom",
|
|
176
|
+
left: "left",
|
|
177
|
+
right: "right",
|
|
178
|
+
"top-left": "top left",
|
|
179
|
+
"top-right": "top right",
|
|
180
|
+
"bottom-left": "bottom left",
|
|
181
|
+
"bottom-right": "bottom right"
|
|
182
|
+
};
|
|
183
|
+
return position ? positionMap[position] || "center" : "center";
|
|
184
|
+
}
|
|
185
|
+
function maskDirectionToCSS(direction) {
|
|
186
|
+
const directionMap = {
|
|
187
|
+
"to-top": "to top",
|
|
188
|
+
"to-bottom": "to bottom",
|
|
189
|
+
"to-left": "to left",
|
|
190
|
+
"to-right": "to right",
|
|
191
|
+
"to-top-left": "to top left",
|
|
192
|
+
"to-top-right": "to top right",
|
|
193
|
+
"to-bottom-left": "to bottom left",
|
|
194
|
+
"to-bottom-right": "to bottom right",
|
|
195
|
+
"from-center": "radial"
|
|
196
|
+
// Not used for linear, handled separately in maskToCSS
|
|
197
|
+
};
|
|
198
|
+
return directionMap[direction] || "to bottom";
|
|
199
|
+
}
|
|
200
|
+
function maskToCSS(mask) {
|
|
201
|
+
const startAlpha = (mask.startOpacity ?? 100) / 100;
|
|
202
|
+
const endAlpha = (mask.endOpacity ?? 0) / 100;
|
|
203
|
+
if (mask.direction === "from-center") {
|
|
204
|
+
return `radial-gradient(circle at center, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
205
|
+
}
|
|
206
|
+
const direction = maskDirectionToCSS(mask.direction);
|
|
207
|
+
return `linear-gradient(${direction}, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
208
|
+
}
|
|
209
|
+
function backgroundValueToCSS(bg) {
|
|
210
|
+
if (!bg || bg.type === "none") {
|
|
211
|
+
return {};
|
|
212
|
+
}
|
|
213
|
+
const style = {};
|
|
214
|
+
switch (bg.type) {
|
|
215
|
+
case "solid":
|
|
216
|
+
if (bg.solid?.hex) {
|
|
217
|
+
style.backgroundColor = colorValueToCSS(bg.solid);
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
case "gradient":
|
|
221
|
+
if (bg.gradient && bg.gradient.stops && bg.gradient.stops.length > 0) {
|
|
222
|
+
style.background = gradientValueToCSS(bg.gradient);
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case "image":
|
|
226
|
+
if (bg.image?.media?.url) {
|
|
227
|
+
const imageUrl = bg.image.media.url;
|
|
228
|
+
const size = bg.image.size || "cover";
|
|
229
|
+
const position = positionToCSS(bg.image.position);
|
|
230
|
+
const repeat = bg.image.repeat || "no-repeat";
|
|
231
|
+
const attachment = bg.image.attachment || "scroll";
|
|
232
|
+
if (bg.overlay?.enabled) {
|
|
233
|
+
const overlayCSS = bg.overlay.type === "solid" ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
|
|
234
|
+
if (bg.overlay.type === "solid" && overlayCSS) {
|
|
235
|
+
style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
|
|
236
|
+
} else {
|
|
237
|
+
style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
|
|
238
|
+
}
|
|
239
|
+
style.backgroundSize = `auto, ${size}`;
|
|
240
|
+
style.backgroundPosition = `center, ${position}`;
|
|
241
|
+
style.backgroundRepeat = `no-repeat, ${repeat}`;
|
|
242
|
+
style.backgroundAttachment = `scroll, ${attachment}`;
|
|
243
|
+
} else {
|
|
244
|
+
style.backgroundImage = `url(${imageUrl})`;
|
|
245
|
+
style.backgroundSize = size;
|
|
246
|
+
style.backgroundPosition = position;
|
|
247
|
+
style.backgroundRepeat = repeat;
|
|
248
|
+
style.backgroundAttachment = attachment;
|
|
249
|
+
}
|
|
250
|
+
if (bg.image.mask?.enabled) {
|
|
251
|
+
const maskCSS = maskToCSS(bg.image.mask);
|
|
252
|
+
style.maskImage = maskCSS;
|
|
253
|
+
style.WebkitMaskImage = maskCSS;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
return style;
|
|
259
|
+
}
|
|
260
|
+
var stickyFooterContainerStyle = {
|
|
261
|
+
minHeight: "100vh",
|
|
262
|
+
display: "flex",
|
|
263
|
+
flexDirection: "column"
|
|
264
|
+
};
|
|
265
|
+
var stickyFooterMainStyle = {
|
|
266
|
+
flex: 1
|
|
267
|
+
};
|
|
268
|
+
function LayoutWrapper({ children, layout, className, overrides }) {
|
|
269
|
+
if (!layout) {
|
|
270
|
+
if (overrides?.background) {
|
|
271
|
+
const bgStyles = backgroundValueToCSS(overrides.background);
|
|
272
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...bgStyles }, children });
|
|
273
|
+
}
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
275
|
+
}
|
|
276
|
+
const Header = layout.header;
|
|
277
|
+
const Footer = layout.footer;
|
|
278
|
+
const shouldShowHeader = overrides?.showHeader === "hide" ? false : overrides?.showHeader === "show" ? true : !!Header;
|
|
279
|
+
const shouldShowFooter = overrides?.showFooter === "hide" ? false : overrides?.showFooter === "show" ? true : !!Footer;
|
|
280
|
+
const useStickyFooter = layout.stickyFooter !== false;
|
|
281
|
+
const mainStyle = {
|
|
282
|
+
...layout.stickyHeaderHeight && shouldShowHeader ? { paddingTop: layout.stickyHeaderHeight } : {},
|
|
283
|
+
...useStickyFooter ? stickyFooterMainStyle : {}
|
|
284
|
+
};
|
|
285
|
+
const outerBackgroundStyles = overrides?.background ? backgroundValueToCSS(overrides.background) : {
|
|
286
|
+
...layout.styles?.wrapper?.background !== void 0 ? { background: layout.styles.wrapper.background } : {},
|
|
287
|
+
...layout.styles?.wrapper?.backgroundAttachment !== void 0 ? { backgroundAttachment: layout.styles.wrapper.backgroundAttachment } : {}
|
|
288
|
+
};
|
|
289
|
+
const effectiveMaxWidth = overrides?.maxWidth && overrides.maxWidth !== "default" ? overrides.maxWidth : layout.maxWidth;
|
|
290
|
+
const wrapWithStickyFooter = (content) => {
|
|
291
|
+
if (useStickyFooter) {
|
|
292
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...stickyFooterContainerStyle, ...outerBackgroundStyles }, children: content });
|
|
293
|
+
}
|
|
294
|
+
const hasBackground = Object.keys(outerBackgroundStyles).length > 0;
|
|
295
|
+
if (hasBackground) {
|
|
296
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...outerBackgroundStyles }, children: content });
|
|
297
|
+
}
|
|
298
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content });
|
|
299
|
+
};
|
|
300
|
+
if (layout.wrapper) {
|
|
301
|
+
const CustomWrapper = layout.wrapper;
|
|
302
|
+
return wrapWithStickyFooter(
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
304
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { style: Object.keys(mainStyle).length > 0 ? mainStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CustomWrapper, { children }) }),
|
|
306
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
307
|
+
] })
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
const wrapperStyle = {
|
|
311
|
+
...layout.styles?.wrapper
|
|
312
|
+
};
|
|
313
|
+
const containerStyle = {
|
|
314
|
+
...effectiveMaxWidth && !layout.fullWidth ? { maxWidth: effectiveMaxWidth } : {},
|
|
315
|
+
...layout.styles?.container
|
|
316
|
+
};
|
|
317
|
+
const contentStyle = {
|
|
318
|
+
...layout.styles?.content
|
|
319
|
+
};
|
|
320
|
+
const dataAttrs = {
|
|
321
|
+
"data-layout": layout.value,
|
|
322
|
+
...layout.dataAttributes
|
|
323
|
+
};
|
|
324
|
+
if (layout.fullWidth) {
|
|
325
|
+
return wrapWithStickyFooter(
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
327
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
328
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
329
|
+
"main",
|
|
330
|
+
{
|
|
331
|
+
className: [layout.classes?.wrapper, className].filter(Boolean).join(" ") || void 0,
|
|
332
|
+
style: {
|
|
333
|
+
...mainStyle,
|
|
334
|
+
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
335
|
+
},
|
|
336
|
+
...dataAttrs,
|
|
337
|
+
children
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
341
|
+
] })
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
return wrapWithStickyFooter(
|
|
345
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
346
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
347
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
348
|
+
"main",
|
|
349
|
+
{
|
|
350
|
+
className: layout.classes?.wrapper || void 0,
|
|
351
|
+
style: {
|
|
352
|
+
...mainStyle,
|
|
353
|
+
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
354
|
+
},
|
|
355
|
+
...dataAttrs,
|
|
356
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
357
|
+
"div",
|
|
358
|
+
{
|
|
359
|
+
className: [layout.classes?.container, className].filter(Boolean).join(" ") || void 0,
|
|
360
|
+
style: Object.keys(containerStyle).length > 0 ? containerStyle : void 0,
|
|
361
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
className: layout.classes?.content || void 0,
|
|
365
|
+
style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
|
|
366
|
+
children
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
374
|
+
] })
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
exports.DEFAULT_LAYOUTS = DEFAULT_LAYOUTS;
|
|
379
|
+
exports.DEFAULT_LAYOUT_CONFIG = DEFAULT_LAYOUT_CONFIG;
|
|
380
|
+
exports.EXTENDED_LAYOUTS = EXTENDED_LAYOUTS;
|
|
381
|
+
exports.LayoutWrapper = LayoutWrapper;
|
|
382
|
+
exports.createLayout = createLayout;
|
|
383
|
+
exports.defaultLayout = defaultLayout;
|
|
384
|
+
exports.fullWidthLayout = fullWidthLayout;
|
|
385
|
+
exports.getLayout = getLayout;
|
|
386
|
+
exports.landingLayout = landingLayout;
|
|
387
|
+
exports.layoutsToOptions = layoutsToOptions;
|
|
388
|
+
exports.layoutsToPayloadOptions = layoutsToPayloadOptions;
|
|
389
|
+
exports.mergeLayouts = mergeLayouts;
|
|
390
|
+
exports.narrowLayout = narrowLayout;
|
|
391
|
+
exports.resolveLayoutConfig = resolveLayoutConfig;
|
|
392
|
+
exports.wideLayout = wideLayout;
|
|
393
|
+
//# sourceMappingURL=index.js.map
|
|
394
|
+
//# sourceMappingURL=index.js.map
|