@orion-studios/payload-studio 0.6.0-beta.43 → 0.6.0-beta.44
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/admin/client.mjs +1 -1
- package/dist/admin-app/client.mjs +1 -1
- package/dist/builder-v2/client.js +753 -0
- package/dist/builder-v2/client.mjs +628 -0
- package/dist/builder-v2/index.d.mts +156 -0
- package/dist/builder-v2/index.d.ts +156 -0
- package/dist/builder-v2/index.js +449 -0
- package/dist/builder-v2/index.mjs +403 -0
- package/dist/builder-v2/styles.css +165 -0
- package/dist/{chunk-2XH7X34N.mjs → chunk-MJEOSRFT.mjs} +144 -144
- package/dist/index.mjs +3 -3
- package/package.json +22 -3
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Field, Payload } from 'payload';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type BuilderV2FieldOptions = {
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const createBuilderV2PageFields: (options?: BuilderV2FieldOptions) => Field[];
|
|
9
|
+
declare const appendBuilderV2PageFields: (fields: Field[], options?: BuilderV2FieldOptions) => Field[];
|
|
10
|
+
|
|
11
|
+
type BuilderV2Mode = 'grapes-v2';
|
|
12
|
+
type BuilderV2ValidationIssue = {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
path: string;
|
|
16
|
+
severity: 'error' | 'warning';
|
|
17
|
+
};
|
|
18
|
+
type BuilderV2CompiledOutput = {
|
|
19
|
+
css: string;
|
|
20
|
+
dynamicComponents: BuilderV2DynamicComponentInstance[];
|
|
21
|
+
html: string;
|
|
22
|
+
};
|
|
23
|
+
type BuilderV2ProjectData = Record<string, unknown>;
|
|
24
|
+
type BuilderV2PageData = {
|
|
25
|
+
builderDynamicComponents?: BuilderV2DynamicComponentInstance[];
|
|
26
|
+
builderMode?: string;
|
|
27
|
+
builderProjectData?: BuilderV2ProjectData | null;
|
|
28
|
+
builderPublishedProjectData?: BuilderV2ProjectData | null;
|
|
29
|
+
builderValidationIssues?: BuilderV2ValidationIssue[];
|
|
30
|
+
compiledCss?: string;
|
|
31
|
+
compiledHtml?: string;
|
|
32
|
+
id?: number | string;
|
|
33
|
+
slug?: string;
|
|
34
|
+
title?: string;
|
|
35
|
+
};
|
|
36
|
+
type BuilderV2Asset = {
|
|
37
|
+
alt?: string;
|
|
38
|
+
filename?: string;
|
|
39
|
+
id: number | string;
|
|
40
|
+
src: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
};
|
|
43
|
+
type BuilderV2DynamicComponentInstance = {
|
|
44
|
+
component: string;
|
|
45
|
+
id: string;
|
|
46
|
+
props: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
type BuilderV2RuntimeComponentProps = {
|
|
49
|
+
instance: BuilderV2DynamicComponentInstance;
|
|
50
|
+
page?: BuilderV2PageData;
|
|
51
|
+
};
|
|
52
|
+
type BuilderV2RuntimeComponent = ComponentType<BuilderV2RuntimeComponentProps>;
|
|
53
|
+
type BuilderV2ProjectComponentDefinition = {
|
|
54
|
+
editorPreview?: (props: Record<string, unknown>) => string;
|
|
55
|
+
label: string;
|
|
56
|
+
render: BuilderV2RuntimeComponent;
|
|
57
|
+
traits?: BuilderV2TraitDefinition[];
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
type BuilderV2TraitDefinition = {
|
|
61
|
+
label: string;
|
|
62
|
+
name: string;
|
|
63
|
+
options?: Array<{
|
|
64
|
+
label: string;
|
|
65
|
+
value: string;
|
|
66
|
+
}>;
|
|
67
|
+
placeholder?: string;
|
|
68
|
+
type: 'checkbox' | 'number' | 'select' | 'text' | 'textarea';
|
|
69
|
+
};
|
|
70
|
+
type BuilderV2ProjectAdapter = {
|
|
71
|
+
components?: Record<string, BuilderV2ProjectComponentDefinition | BuilderV2RuntimeComponent>;
|
|
72
|
+
dataProviders?: Record<string, unknown>;
|
|
73
|
+
id: string;
|
|
74
|
+
label?: string;
|
|
75
|
+
themeTokens?: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
type BuilderV2EditorInitialData = {
|
|
78
|
+
projectData?: BuilderV2ProjectData | null;
|
|
79
|
+
title?: string;
|
|
80
|
+
};
|
|
81
|
+
type BuilderV2RuntimeProps = {
|
|
82
|
+
adapter?: BuilderV2ProjectAdapter;
|
|
83
|
+
className?: string;
|
|
84
|
+
page: BuilderV2PageData;
|
|
85
|
+
};
|
|
86
|
+
type BuilderV2RenderableChunk = {
|
|
87
|
+
html: string;
|
|
88
|
+
kind: 'html';
|
|
89
|
+
} | {
|
|
90
|
+
instance: BuilderV2DynamicComponentInstance;
|
|
91
|
+
kind: 'component';
|
|
92
|
+
};
|
|
93
|
+
type BuilderV2RenderResult = {
|
|
94
|
+
css: string;
|
|
95
|
+
nodes: ReactNode;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare const compileBuilderV2Output: (input: {
|
|
99
|
+
css?: unknown;
|
|
100
|
+
html?: unknown;
|
|
101
|
+
}) => BuilderV2CompiledOutput;
|
|
102
|
+
|
|
103
|
+
type BuilderV2PagePayloadDoc = BuilderV2PageData & {
|
|
104
|
+
id: number | string;
|
|
105
|
+
};
|
|
106
|
+
type CreateBuilderV2PageServiceArgs = {
|
|
107
|
+
collectionSlug?: string;
|
|
108
|
+
payload: Payload;
|
|
109
|
+
user: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
type SaveBuilderV2PageInput = {
|
|
112
|
+
compiled: {
|
|
113
|
+
css?: string;
|
|
114
|
+
html?: string;
|
|
115
|
+
};
|
|
116
|
+
projectData: BuilderV2ProjectData;
|
|
117
|
+
title?: string;
|
|
118
|
+
validationIssues?: BuilderV2ValidationIssue[];
|
|
119
|
+
};
|
|
120
|
+
declare const toBuilderV2EditorInitialData: (page: BuilderV2PageData) => {
|
|
121
|
+
projectData: BuilderV2ProjectData;
|
|
122
|
+
title: string;
|
|
123
|
+
};
|
|
124
|
+
declare const createBuilderV2PageService: ({ collectionSlug, payload, user, }: CreateBuilderV2PageServiceArgs) => {
|
|
125
|
+
getPageForBuilder: (pageID: string) => Promise<{
|
|
126
|
+
id: string;
|
|
127
|
+
initialData: {
|
|
128
|
+
projectData: BuilderV2ProjectData;
|
|
129
|
+
title: string;
|
|
130
|
+
};
|
|
131
|
+
page: BuilderV2PagePayloadDoc;
|
|
132
|
+
}>;
|
|
133
|
+
saveDraft: (pageID: string, input: SaveBuilderV2PageInput) => Promise<{
|
|
134
|
+
compiled: BuilderV2CompiledOutput;
|
|
135
|
+
id: string;
|
|
136
|
+
status: "draft";
|
|
137
|
+
}>;
|
|
138
|
+
publish: (pageID: string, input: SaveBuilderV2PageInput) => Promise<{
|
|
139
|
+
compiled: BuilderV2CompiledOutput;
|
|
140
|
+
id: string;
|
|
141
|
+
status: "published";
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare const createEmptyBuilderV2ProjectData: (title?: string) => BuilderV2ProjectData;
|
|
146
|
+
declare const normalizeBuilderV2ProjectData: (value: unknown, fallbackTitle?: string) => BuilderV2ProjectData;
|
|
147
|
+
|
|
148
|
+
declare function BuilderPageRuntime({ adapter, className, page }: BuilderV2RuntimeProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
declare const parseBuilderV2DynamicComponents: (html: string) => BuilderV2DynamicComponentInstance[];
|
|
151
|
+
declare const splitBuilderV2HtmlIntoChunks: (html: string) => BuilderV2RenderableChunk[];
|
|
152
|
+
|
|
153
|
+
declare const sanitizeBuilderHtml: (value: unknown) => string;
|
|
154
|
+
declare const sanitizeBuilderCss: (value: unknown) => string;
|
|
155
|
+
|
|
156
|
+
export { BuilderPageRuntime, type BuilderV2Asset, type BuilderV2CompiledOutput, type BuilderV2DynamicComponentInstance, type BuilderV2EditorInitialData, type BuilderV2FieldOptions, type BuilderV2Mode, type BuilderV2PageData, type BuilderV2PagePayloadDoc, type BuilderV2ProjectAdapter, type BuilderV2ProjectComponentDefinition, type BuilderV2ProjectData, type BuilderV2RenderResult, type BuilderV2RenderableChunk, type BuilderV2RuntimeComponent, type BuilderV2RuntimeComponentProps, type BuilderV2RuntimeProps, type BuilderV2TraitDefinition, type BuilderV2ValidationIssue, type CreateBuilderV2PageServiceArgs, type SaveBuilderV2PageInput, appendBuilderV2PageFields, compileBuilderV2Output, createBuilderV2PageFields, createBuilderV2PageService, createEmptyBuilderV2ProjectData, normalizeBuilderV2ProjectData, parseBuilderV2DynamicComponents, sanitizeBuilderCss, sanitizeBuilderHtml, splitBuilderV2HtmlIntoChunks, toBuilderV2EditorInitialData };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Field, Payload } from 'payload';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type BuilderV2FieldOptions = {
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const createBuilderV2PageFields: (options?: BuilderV2FieldOptions) => Field[];
|
|
9
|
+
declare const appendBuilderV2PageFields: (fields: Field[], options?: BuilderV2FieldOptions) => Field[];
|
|
10
|
+
|
|
11
|
+
type BuilderV2Mode = 'grapes-v2';
|
|
12
|
+
type BuilderV2ValidationIssue = {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
path: string;
|
|
16
|
+
severity: 'error' | 'warning';
|
|
17
|
+
};
|
|
18
|
+
type BuilderV2CompiledOutput = {
|
|
19
|
+
css: string;
|
|
20
|
+
dynamicComponents: BuilderV2DynamicComponentInstance[];
|
|
21
|
+
html: string;
|
|
22
|
+
};
|
|
23
|
+
type BuilderV2ProjectData = Record<string, unknown>;
|
|
24
|
+
type BuilderV2PageData = {
|
|
25
|
+
builderDynamicComponents?: BuilderV2DynamicComponentInstance[];
|
|
26
|
+
builderMode?: string;
|
|
27
|
+
builderProjectData?: BuilderV2ProjectData | null;
|
|
28
|
+
builderPublishedProjectData?: BuilderV2ProjectData | null;
|
|
29
|
+
builderValidationIssues?: BuilderV2ValidationIssue[];
|
|
30
|
+
compiledCss?: string;
|
|
31
|
+
compiledHtml?: string;
|
|
32
|
+
id?: number | string;
|
|
33
|
+
slug?: string;
|
|
34
|
+
title?: string;
|
|
35
|
+
};
|
|
36
|
+
type BuilderV2Asset = {
|
|
37
|
+
alt?: string;
|
|
38
|
+
filename?: string;
|
|
39
|
+
id: number | string;
|
|
40
|
+
src: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
};
|
|
43
|
+
type BuilderV2DynamicComponentInstance = {
|
|
44
|
+
component: string;
|
|
45
|
+
id: string;
|
|
46
|
+
props: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
type BuilderV2RuntimeComponentProps = {
|
|
49
|
+
instance: BuilderV2DynamicComponentInstance;
|
|
50
|
+
page?: BuilderV2PageData;
|
|
51
|
+
};
|
|
52
|
+
type BuilderV2RuntimeComponent = ComponentType<BuilderV2RuntimeComponentProps>;
|
|
53
|
+
type BuilderV2ProjectComponentDefinition = {
|
|
54
|
+
editorPreview?: (props: Record<string, unknown>) => string;
|
|
55
|
+
label: string;
|
|
56
|
+
render: BuilderV2RuntimeComponent;
|
|
57
|
+
traits?: BuilderV2TraitDefinition[];
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
type BuilderV2TraitDefinition = {
|
|
61
|
+
label: string;
|
|
62
|
+
name: string;
|
|
63
|
+
options?: Array<{
|
|
64
|
+
label: string;
|
|
65
|
+
value: string;
|
|
66
|
+
}>;
|
|
67
|
+
placeholder?: string;
|
|
68
|
+
type: 'checkbox' | 'number' | 'select' | 'text' | 'textarea';
|
|
69
|
+
};
|
|
70
|
+
type BuilderV2ProjectAdapter = {
|
|
71
|
+
components?: Record<string, BuilderV2ProjectComponentDefinition | BuilderV2RuntimeComponent>;
|
|
72
|
+
dataProviders?: Record<string, unknown>;
|
|
73
|
+
id: string;
|
|
74
|
+
label?: string;
|
|
75
|
+
themeTokens?: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
type BuilderV2EditorInitialData = {
|
|
78
|
+
projectData?: BuilderV2ProjectData | null;
|
|
79
|
+
title?: string;
|
|
80
|
+
};
|
|
81
|
+
type BuilderV2RuntimeProps = {
|
|
82
|
+
adapter?: BuilderV2ProjectAdapter;
|
|
83
|
+
className?: string;
|
|
84
|
+
page: BuilderV2PageData;
|
|
85
|
+
};
|
|
86
|
+
type BuilderV2RenderableChunk = {
|
|
87
|
+
html: string;
|
|
88
|
+
kind: 'html';
|
|
89
|
+
} | {
|
|
90
|
+
instance: BuilderV2DynamicComponentInstance;
|
|
91
|
+
kind: 'component';
|
|
92
|
+
};
|
|
93
|
+
type BuilderV2RenderResult = {
|
|
94
|
+
css: string;
|
|
95
|
+
nodes: ReactNode;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
declare const compileBuilderV2Output: (input: {
|
|
99
|
+
css?: unknown;
|
|
100
|
+
html?: unknown;
|
|
101
|
+
}) => BuilderV2CompiledOutput;
|
|
102
|
+
|
|
103
|
+
type BuilderV2PagePayloadDoc = BuilderV2PageData & {
|
|
104
|
+
id: number | string;
|
|
105
|
+
};
|
|
106
|
+
type CreateBuilderV2PageServiceArgs = {
|
|
107
|
+
collectionSlug?: string;
|
|
108
|
+
payload: Payload;
|
|
109
|
+
user: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
type SaveBuilderV2PageInput = {
|
|
112
|
+
compiled: {
|
|
113
|
+
css?: string;
|
|
114
|
+
html?: string;
|
|
115
|
+
};
|
|
116
|
+
projectData: BuilderV2ProjectData;
|
|
117
|
+
title?: string;
|
|
118
|
+
validationIssues?: BuilderV2ValidationIssue[];
|
|
119
|
+
};
|
|
120
|
+
declare const toBuilderV2EditorInitialData: (page: BuilderV2PageData) => {
|
|
121
|
+
projectData: BuilderV2ProjectData;
|
|
122
|
+
title: string;
|
|
123
|
+
};
|
|
124
|
+
declare const createBuilderV2PageService: ({ collectionSlug, payload, user, }: CreateBuilderV2PageServiceArgs) => {
|
|
125
|
+
getPageForBuilder: (pageID: string) => Promise<{
|
|
126
|
+
id: string;
|
|
127
|
+
initialData: {
|
|
128
|
+
projectData: BuilderV2ProjectData;
|
|
129
|
+
title: string;
|
|
130
|
+
};
|
|
131
|
+
page: BuilderV2PagePayloadDoc;
|
|
132
|
+
}>;
|
|
133
|
+
saveDraft: (pageID: string, input: SaveBuilderV2PageInput) => Promise<{
|
|
134
|
+
compiled: BuilderV2CompiledOutput;
|
|
135
|
+
id: string;
|
|
136
|
+
status: "draft";
|
|
137
|
+
}>;
|
|
138
|
+
publish: (pageID: string, input: SaveBuilderV2PageInput) => Promise<{
|
|
139
|
+
compiled: BuilderV2CompiledOutput;
|
|
140
|
+
id: string;
|
|
141
|
+
status: "published";
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare const createEmptyBuilderV2ProjectData: (title?: string) => BuilderV2ProjectData;
|
|
146
|
+
declare const normalizeBuilderV2ProjectData: (value: unknown, fallbackTitle?: string) => BuilderV2ProjectData;
|
|
147
|
+
|
|
148
|
+
declare function BuilderPageRuntime({ adapter, className, page }: BuilderV2RuntimeProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
declare const parseBuilderV2DynamicComponents: (html: string) => BuilderV2DynamicComponentInstance[];
|
|
151
|
+
declare const splitBuilderV2HtmlIntoChunks: (html: string) => BuilderV2RenderableChunk[];
|
|
152
|
+
|
|
153
|
+
declare const sanitizeBuilderHtml: (value: unknown) => string;
|
|
154
|
+
declare const sanitizeBuilderCss: (value: unknown) => string;
|
|
155
|
+
|
|
156
|
+
export { BuilderPageRuntime, type BuilderV2Asset, type BuilderV2CompiledOutput, type BuilderV2DynamicComponentInstance, type BuilderV2EditorInitialData, type BuilderV2FieldOptions, type BuilderV2Mode, type BuilderV2PageData, type BuilderV2PagePayloadDoc, type BuilderV2ProjectAdapter, type BuilderV2ProjectComponentDefinition, type BuilderV2ProjectData, type BuilderV2RenderResult, type BuilderV2RenderableChunk, type BuilderV2RuntimeComponent, type BuilderV2RuntimeComponentProps, type BuilderV2RuntimeProps, type BuilderV2TraitDefinition, type BuilderV2ValidationIssue, type CreateBuilderV2PageServiceArgs, type SaveBuilderV2PageInput, appendBuilderV2PageFields, compileBuilderV2Output, createBuilderV2PageFields, createBuilderV2PageService, createEmptyBuilderV2ProjectData, normalizeBuilderV2ProjectData, parseBuilderV2DynamicComponents, sanitizeBuilderCss, sanitizeBuilderHtml, splitBuilderV2HtmlIntoChunks, toBuilderV2EditorInitialData };
|