@measured/puck 0.16.0-canary.e367dd4 → 0.16.0-canary.eb42734

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { U as UiState, D as Data, A as AppState, F as Field, a as FieldProps, C as Config, b as DefaultRootProps, I as ItemSelector, c as DropZoneProps, V as Viewports, d as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, e as RootData, f as ComponentData } from './Config-041c35a2.js';
1
+ import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DefaultRootProps, c as DropZoneProps, V as Viewports, d as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, e as RootData, f as ComponentData } from './Config-041c35a2.js';
2
2
  export { q as Adaptor, p as ArrayField, l as ArrayState, B as BaseData, m as BaseField, i as ComponentConfig, g as Content, s as CustomField, r as ExternalField, E as ExternalFieldWithAdaptor, t as Fields, k as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, h as PuckContext, o as RadioField, j as RootDataWithoutProps, S as SelectField, T as TextField, n as TextareaField } from './Config-041c35a2.js';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
  import * as react from 'react';
5
4
  import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { DragStart, DragUpdate } from '@measured/dnd';
7
7
 
8
8
  type InsertAction = {
@@ -64,6 +64,65 @@ type PuckAction = {
64
64
  recordHistory?: boolean;
65
65
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
66
66
 
67
+ type RenderFunc<Props extends {
68
+ [key: string]: any;
69
+ } = {
70
+ children: ReactNode;
71
+ }> = (props: Props) => ReactElement;
72
+ declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
73
+ type OverrideKey = (typeof overrideKeys)[number];
74
+ type OverridesGeneric<Shape extends {
75
+ [key in OverrideKey]: any;
76
+ }> = Shape;
77
+ type Overrides = OverridesGeneric<{
78
+ fieldTypes: Partial<FieldRenderFunctions>;
79
+ header: RenderFunc<{
80
+ actions: ReactNode;
81
+ children: ReactNode;
82
+ }>;
83
+ headerActions: RenderFunc<{
84
+ children: ReactNode;
85
+ }>;
86
+ preview: RenderFunc;
87
+ fields: RenderFunc<{
88
+ children: ReactNode;
89
+ isLoading: boolean;
90
+ itemSelector?: ItemSelector | null;
91
+ }>;
92
+ fieldLabel: RenderFunc<{
93
+ children?: ReactNode;
94
+ icon?: ReactNode;
95
+ label: string;
96
+ el?: "label" | "div";
97
+ readOnly?: boolean;
98
+ className?: string;
99
+ }>;
100
+ components: RenderFunc;
101
+ componentItem: RenderFunc<{
102
+ children: ReactNode;
103
+ name: string;
104
+ }>;
105
+ outline: RenderFunc;
106
+ puck: RenderFunc;
107
+ }>;
108
+ type FieldRenderFunctions = Omit<{
109
+ [Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
110
+ type: Type;
111
+ }>> & {
112
+ children: ReactNode;
113
+ name: string;
114
+ }>;
115
+ }, "custom"> & {
116
+ [key: string]: React.FunctionComponent<FieldProps<any> & {
117
+ children: ReactNode;
118
+ name: string;
119
+ }>;
120
+ };
121
+
122
+ type Plugin = {
123
+ overrides: Partial<Overrides>;
124
+ };
125
+
67
126
  declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
68
127
  children?: ReactNode;
69
128
  icon?: ReactNode;
@@ -181,65 +240,6 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
181
240
  title: string;
182
241
  }) => react_jsx_runtime.JSX.Element;
183
242
 
184
- type RenderFunc<Props extends {
185
- [key: string]: any;
186
- } = {
187
- children: ReactNode;
188
- }> = (props: Props) => ReactElement;
189
- declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
190
- type OverrideKey = (typeof overrideKeys)[number];
191
- type OverridesGeneric<Shape extends {
192
- [key in OverrideKey]: any;
193
- }> = Shape;
194
- type Overrides = OverridesGeneric<{
195
- fieldTypes: Partial<FieldRenderFunctions>;
196
- header: RenderFunc<{
197
- actions: ReactNode;
198
- children: ReactNode;
199
- }>;
200
- headerActions: RenderFunc<{
201
- children: ReactNode;
202
- }>;
203
- preview: RenderFunc;
204
- fields: RenderFunc<{
205
- children: ReactNode;
206
- isLoading: boolean;
207
- itemSelector?: ItemSelector | null;
208
- }>;
209
- fieldLabel: RenderFunc<{
210
- children?: ReactNode;
211
- icon?: ReactNode;
212
- label: string;
213
- el?: "label" | "div";
214
- readOnly?: boolean;
215
- className?: string;
216
- }>;
217
- components: RenderFunc;
218
- componentItem: RenderFunc<{
219
- children: ReactNode;
220
- name: string;
221
- }>;
222
- outline: RenderFunc;
223
- puck: RenderFunc;
224
- }>;
225
- type FieldRenderFunctions = Omit<{
226
- [Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
227
- type: Type;
228
- }>> & {
229
- children: ReactNode;
230
- name: string;
231
- }>;
232
- }, "custom"> & {
233
- [key: string]: React.FunctionComponent<FieldProps<any> & {
234
- children: ReactNode;
235
- name: string;
236
- }>;
237
- };
238
-
239
- type Plugin = {
240
- overrides: Partial<Overrides>;
241
- };
242
-
243
243
  type History<D = any> = {
244
244
  id: string;
245
245
  data: D;
@@ -342,4 +342,4 @@ declare const usePuck: () => {
342
342
  }> | null;
343
343
  };
344
344
 
345
- export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, FieldPropsInternal, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
345
+ export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, FieldPropsInternal, IconButton, MappedItem, Plugin, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
package/dist/index.js CHANGED
@@ -29167,6 +29167,9 @@ init_react_import();
29167
29167
  // types/Config.tsx
29168
29168
  init_react_import();
29169
29169
 
29170
+ // types/Plugin.ts
29171
+ init_react_import();
29172
+
29170
29173
  // types/Fields.ts
29171
29174
  init_react_import();
29172
29175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.16.0-canary.e367dd4",
3
+ "version": "0.16.0-canary.eb42734",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",