@anvilkit/puck-studio 0.0.1 → 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.
@@ -0,0 +1,212 @@
1
+ import { Overrides, Field } from '@puckeditor/core';
2
+ import * as React from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ declare function EditorDrawer({ children, }: {
6
+ children: React.ReactNode;
7
+ }): React.ReactElement;
8
+ declare function EditorComponents({ children, }: {
9
+ children: React.ReactNode;
10
+ }): React.ReactElement;
11
+
12
+ declare function DrawerItem({ children, name, }: {
13
+ children: React.ReactNode;
14
+ name: string;
15
+ }): React.ReactElement;
16
+
17
+ declare function EditorOutline({ children, }: {
18
+ children: React.ReactNode;
19
+ }): React.ReactElement;
20
+
21
+ declare function CanvasIframe({ children, document: iframeDoc, }: {
22
+ children: React.ReactNode;
23
+ document?: Document;
24
+ }): React.ReactElement;
25
+
26
+ declare function CanvasPreview({ children, }: {
27
+ children: React.ReactNode;
28
+ }): React.ReactElement;
29
+
30
+ declare function ComponentOverlay({ children, hover, isSelected, }: {
31
+ children: React.ReactNode;
32
+ hover: boolean;
33
+ isSelected: boolean;
34
+ componentId: string;
35
+ componentType: string;
36
+ }): React.ReactElement;
37
+
38
+ declare function ActionBar({ children, label, parentAction, }: {
39
+ children: React.ReactNode;
40
+ label?: string;
41
+ parentAction: React.ReactNode;
42
+ }): React.ReactElement;
43
+
44
+ type FieldWrapperProps = Parameters<NonNullable<Overrides["fields"]>>[0];
45
+ type BaseFieldLabelProps = Parameters<NonNullable<Overrides["fieldLabel"]>>[0];
46
+ type FieldLabelProps = Omit<BaseFieldLabelProps, "icon"> & {
47
+ icon?: React.ReactNode;
48
+ labelIcon?: React.ReactNode;
49
+ };
50
+ declare function FieldWrapper({ children, }: FieldWrapperProps): React.ReactElement;
51
+ declare function FieldLabel({ children, label, icon, labelIcon, el, readOnly, className, }: FieldLabelProps): React.ReactElement;
52
+
53
+ interface TextFieldProps {
54
+ field?: {
55
+ ai?: {
56
+ instructions?: string;
57
+ };
58
+ };
59
+ value: string;
60
+ onChange: (value: string) => void;
61
+ readOnly?: boolean;
62
+ placeholder?: string;
63
+ label?: string;
64
+ labelIcon?: React.ReactNode;
65
+ }
66
+ declare function TextField({ field, value, onChange, readOnly, placeholder, label, labelIcon, }: TextFieldProps): react_jsx_runtime.JSX.Element;
67
+
68
+ interface TextareaFieldProps {
69
+ value: string;
70
+ onChange: (value: string) => void;
71
+ readOnly?: boolean;
72
+ placeholder?: string;
73
+ label?: string;
74
+ }
75
+ declare function TextareaField({ value, onChange, readOnly, placeholder, label }: TextareaFieldProps): react_jsx_runtime.JSX.Element;
76
+
77
+ interface NumberFieldProps {
78
+ value: number;
79
+ onChange: (value: number) => void;
80
+ readOnly?: boolean;
81
+ min?: number;
82
+ max?: number;
83
+ step?: number;
84
+ label?: string;
85
+ }
86
+ declare function NumberField({ value, onChange, readOnly, min, max, step, label }: NumberFieldProps): react_jsx_runtime.JSX.Element;
87
+
88
+ interface SelectOption {
89
+ label: string;
90
+ value: string | number | boolean;
91
+ }
92
+ interface SelectFieldProps {
93
+ field: {
94
+ type: "select";
95
+ options: SelectOption[];
96
+ };
97
+ value: string | number | boolean;
98
+ onChange: (value: string | number | boolean) => void;
99
+ id?: string;
100
+ readOnly?: boolean;
101
+ label?: string;
102
+ }
103
+ declare function SelectField({ field, value, onChange, id, readOnly, label }: SelectFieldProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface RadioOption {
106
+ label: string;
107
+ value: string | number | boolean;
108
+ }
109
+ interface RadioFieldProps {
110
+ field: {
111
+ type: "radio";
112
+ options: RadioOption[];
113
+ };
114
+ value: string | number | boolean;
115
+ onChange: (value: string | number | boolean) => void;
116
+ id?: string;
117
+ readOnly?: boolean;
118
+ label?: string;
119
+ }
120
+ declare function RadioField({ field, value, onChange, readOnly, label }: RadioFieldProps): react_jsx_runtime.JSX.Element;
121
+
122
+ interface ArrayItem {
123
+ _id?: string;
124
+ [key: string]: unknown;
125
+ }
126
+ type ArraySubField = Field & {
127
+ label?: string;
128
+ };
129
+ interface ArrayFieldDef {
130
+ type: "array";
131
+ arrayFields: Record<string, ArraySubField>;
132
+ getItemSummary?: (item: unknown, index: number) => string;
133
+ defaultItemProps?: Record<string, unknown> | ((index: number) => Record<string, unknown>);
134
+ max?: number;
135
+ min?: number;
136
+ label?: string;
137
+ }
138
+ interface ArrayFieldProps {
139
+ field: ArrayFieldDef;
140
+ value: ArrayItem[];
141
+ onChange: (value: ArrayItem[]) => void;
142
+ id?: string;
143
+ readOnly?: boolean;
144
+ label?: string;
145
+ name?: string;
146
+ children?: React.ReactNode;
147
+ }
148
+ declare function ArrayField({ field, value, onChange, readOnly, label, id, }: ArrayFieldProps): react_jsx_runtime.JSX.Element;
149
+
150
+ interface ObjectFieldProps {
151
+ field: {
152
+ type: "object";
153
+ objectFields: Record<string, unknown>;
154
+ };
155
+ value: Record<string, unknown>;
156
+ onChange: (value: Record<string, unknown>) => void;
157
+ id?: string;
158
+ readOnly?: boolean;
159
+ name: string;
160
+ children?: React.ReactNode;
161
+ }
162
+ declare function ObjectField({ children, name, readOnly }: ObjectFieldProps): react_jsx_runtime.JSX.Element;
163
+
164
+ interface SlotFieldProps {
165
+ children?: React.ReactNode;
166
+ label?: string;
167
+ }
168
+ declare function SlotField({ children, label }: SlotFieldProps): react_jsx_runtime.JSX.Element;
169
+
170
+ interface CustomFieldProps {
171
+ children?: React.ReactNode;
172
+ label?: string;
173
+ }
174
+ declare function CustomField({ children, label }: CustomFieldProps): react_jsx_runtime.JSX.Element;
175
+
176
+ interface RichtextFieldProps {
177
+ value: string;
178
+ onChange: (value: string) => void;
179
+ readOnly?: boolean;
180
+ label?: string;
181
+ }
182
+ declare function RichtextField({ value, onChange, readOnly, label }: RichtextFieldProps): react_jsx_runtime.JSX.Element;
183
+
184
+ interface ExternalFieldProps {
185
+ value: unknown;
186
+ onChange: (value: unknown) => void;
187
+ fetchList?: (query: string) => Promise<{
188
+ label: string;
189
+ value: unknown;
190
+ }[]>;
191
+ readOnly?: boolean;
192
+ label?: string;
193
+ }
194
+ declare function ExternalField({ value, onChange, fetchList, readOnly, label }: ExternalFieldProps): react_jsx_runtime.JSX.Element;
195
+
196
+ declare const fieldTypesRegistry: {
197
+ text: typeof TextField;
198
+ textarea: typeof TextareaField;
199
+ number: typeof NumberField;
200
+ select: typeof SelectField;
201
+ radio: typeof RadioField;
202
+ array: typeof ArrayField;
203
+ object: typeof ObjectField;
204
+ slot: typeof SlotField;
205
+ custom: typeof CustomField;
206
+ richtext: typeof RichtextField;
207
+ external: typeof ExternalField;
208
+ };
209
+
210
+ declare const puckOverrides: Partial<Overrides>;
211
+
212
+ export { ActionBar, CanvasIframe, CanvasPreview, ComponentOverlay, DrawerItem, EditorComponents, EditorDrawer, EditorOutline, FieldLabel, FieldWrapper, fieldTypesRegistry, puckOverrides };
@@ -0,0 +1,212 @@
1
+ import { Overrides, Field } from '@puckeditor/core';
2
+ import * as React from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ declare function EditorDrawer({ children, }: {
6
+ children: React.ReactNode;
7
+ }): React.ReactElement;
8
+ declare function EditorComponents({ children, }: {
9
+ children: React.ReactNode;
10
+ }): React.ReactElement;
11
+
12
+ declare function DrawerItem({ children, name, }: {
13
+ children: React.ReactNode;
14
+ name: string;
15
+ }): React.ReactElement;
16
+
17
+ declare function EditorOutline({ children, }: {
18
+ children: React.ReactNode;
19
+ }): React.ReactElement;
20
+
21
+ declare function CanvasIframe({ children, document: iframeDoc, }: {
22
+ children: React.ReactNode;
23
+ document?: Document;
24
+ }): React.ReactElement;
25
+
26
+ declare function CanvasPreview({ children, }: {
27
+ children: React.ReactNode;
28
+ }): React.ReactElement;
29
+
30
+ declare function ComponentOverlay({ children, hover, isSelected, }: {
31
+ children: React.ReactNode;
32
+ hover: boolean;
33
+ isSelected: boolean;
34
+ componentId: string;
35
+ componentType: string;
36
+ }): React.ReactElement;
37
+
38
+ declare function ActionBar({ children, label, parentAction, }: {
39
+ children: React.ReactNode;
40
+ label?: string;
41
+ parentAction: React.ReactNode;
42
+ }): React.ReactElement;
43
+
44
+ type FieldWrapperProps = Parameters<NonNullable<Overrides["fields"]>>[0];
45
+ type BaseFieldLabelProps = Parameters<NonNullable<Overrides["fieldLabel"]>>[0];
46
+ type FieldLabelProps = Omit<BaseFieldLabelProps, "icon"> & {
47
+ icon?: React.ReactNode;
48
+ labelIcon?: React.ReactNode;
49
+ };
50
+ declare function FieldWrapper({ children, }: FieldWrapperProps): React.ReactElement;
51
+ declare function FieldLabel({ children, label, icon, labelIcon, el, readOnly, className, }: FieldLabelProps): React.ReactElement;
52
+
53
+ interface TextFieldProps {
54
+ field?: {
55
+ ai?: {
56
+ instructions?: string;
57
+ };
58
+ };
59
+ value: string;
60
+ onChange: (value: string) => void;
61
+ readOnly?: boolean;
62
+ placeholder?: string;
63
+ label?: string;
64
+ labelIcon?: React.ReactNode;
65
+ }
66
+ declare function TextField({ field, value, onChange, readOnly, placeholder, label, labelIcon, }: TextFieldProps): react_jsx_runtime.JSX.Element;
67
+
68
+ interface TextareaFieldProps {
69
+ value: string;
70
+ onChange: (value: string) => void;
71
+ readOnly?: boolean;
72
+ placeholder?: string;
73
+ label?: string;
74
+ }
75
+ declare function TextareaField({ value, onChange, readOnly, placeholder, label }: TextareaFieldProps): react_jsx_runtime.JSX.Element;
76
+
77
+ interface NumberFieldProps {
78
+ value: number;
79
+ onChange: (value: number) => void;
80
+ readOnly?: boolean;
81
+ min?: number;
82
+ max?: number;
83
+ step?: number;
84
+ label?: string;
85
+ }
86
+ declare function NumberField({ value, onChange, readOnly, min, max, step, label }: NumberFieldProps): react_jsx_runtime.JSX.Element;
87
+
88
+ interface SelectOption {
89
+ label: string;
90
+ value: string | number | boolean;
91
+ }
92
+ interface SelectFieldProps {
93
+ field: {
94
+ type: "select";
95
+ options: SelectOption[];
96
+ };
97
+ value: string | number | boolean;
98
+ onChange: (value: string | number | boolean) => void;
99
+ id?: string;
100
+ readOnly?: boolean;
101
+ label?: string;
102
+ }
103
+ declare function SelectField({ field, value, onChange, id, readOnly, label }: SelectFieldProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface RadioOption {
106
+ label: string;
107
+ value: string | number | boolean;
108
+ }
109
+ interface RadioFieldProps {
110
+ field: {
111
+ type: "radio";
112
+ options: RadioOption[];
113
+ };
114
+ value: string | number | boolean;
115
+ onChange: (value: string | number | boolean) => void;
116
+ id?: string;
117
+ readOnly?: boolean;
118
+ label?: string;
119
+ }
120
+ declare function RadioField({ field, value, onChange, readOnly, label }: RadioFieldProps): react_jsx_runtime.JSX.Element;
121
+
122
+ interface ArrayItem {
123
+ _id?: string;
124
+ [key: string]: unknown;
125
+ }
126
+ type ArraySubField = Field & {
127
+ label?: string;
128
+ };
129
+ interface ArrayFieldDef {
130
+ type: "array";
131
+ arrayFields: Record<string, ArraySubField>;
132
+ getItemSummary?: (item: unknown, index: number) => string;
133
+ defaultItemProps?: Record<string, unknown> | ((index: number) => Record<string, unknown>);
134
+ max?: number;
135
+ min?: number;
136
+ label?: string;
137
+ }
138
+ interface ArrayFieldProps {
139
+ field: ArrayFieldDef;
140
+ value: ArrayItem[];
141
+ onChange: (value: ArrayItem[]) => void;
142
+ id?: string;
143
+ readOnly?: boolean;
144
+ label?: string;
145
+ name?: string;
146
+ children?: React.ReactNode;
147
+ }
148
+ declare function ArrayField({ field, value, onChange, readOnly, label, id, }: ArrayFieldProps): react_jsx_runtime.JSX.Element;
149
+
150
+ interface ObjectFieldProps {
151
+ field: {
152
+ type: "object";
153
+ objectFields: Record<string, unknown>;
154
+ };
155
+ value: Record<string, unknown>;
156
+ onChange: (value: Record<string, unknown>) => void;
157
+ id?: string;
158
+ readOnly?: boolean;
159
+ name: string;
160
+ children?: React.ReactNode;
161
+ }
162
+ declare function ObjectField({ children, name, readOnly }: ObjectFieldProps): react_jsx_runtime.JSX.Element;
163
+
164
+ interface SlotFieldProps {
165
+ children?: React.ReactNode;
166
+ label?: string;
167
+ }
168
+ declare function SlotField({ children, label }: SlotFieldProps): react_jsx_runtime.JSX.Element;
169
+
170
+ interface CustomFieldProps {
171
+ children?: React.ReactNode;
172
+ label?: string;
173
+ }
174
+ declare function CustomField({ children, label }: CustomFieldProps): react_jsx_runtime.JSX.Element;
175
+
176
+ interface RichtextFieldProps {
177
+ value: string;
178
+ onChange: (value: string) => void;
179
+ readOnly?: boolean;
180
+ label?: string;
181
+ }
182
+ declare function RichtextField({ value, onChange, readOnly, label }: RichtextFieldProps): react_jsx_runtime.JSX.Element;
183
+
184
+ interface ExternalFieldProps {
185
+ value: unknown;
186
+ onChange: (value: unknown) => void;
187
+ fetchList?: (query: string) => Promise<{
188
+ label: string;
189
+ value: unknown;
190
+ }[]>;
191
+ readOnly?: boolean;
192
+ label?: string;
193
+ }
194
+ declare function ExternalField({ value, onChange, fetchList, readOnly, label }: ExternalFieldProps): react_jsx_runtime.JSX.Element;
195
+
196
+ declare const fieldTypesRegistry: {
197
+ text: typeof TextField;
198
+ textarea: typeof TextareaField;
199
+ number: typeof NumberField;
200
+ select: typeof SelectField;
201
+ radio: typeof RadioField;
202
+ array: typeof ArrayField;
203
+ object: typeof ObjectField;
204
+ slot: typeof SlotField;
205
+ custom: typeof CustomField;
206
+ richtext: typeof RichtextField;
207
+ external: typeof ExternalField;
208
+ };
209
+
210
+ declare const puckOverrides: Partial<Overrides>;
211
+
212
+ export { ActionBar, CanvasIframe, CanvasPreview, ComponentOverlay, DrawerItem, EditorComponents, EditorDrawer, EditorOutline, FieldLabel, FieldWrapper, fieldTypesRegistry, puckOverrides };