@measured/puck 0.19.0-canary.896a6279 → 0.19.0-canary.8d459e4e
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/README.md +2 -4
- package/dist/chunk-D6ENWNOG.mjs +543 -0
- package/dist/index.css +44 -38
- package/dist/index.d.mts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +485 -262
- package/dist/index.mjs +6596 -1623
- package/dist/{resolve-all-data-Cs8PfTrg.d.mts → resolve-all-data-DtB0OZRl.d.mts} +20 -15
- package/dist/{resolve-all-data-Cs8PfTrg.d.ts → resolve-all-data-DtB0OZRl.d.ts} +20 -15
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +195 -3703
- package/dist/rsc.mjs +3 -103
- package/package.json +2 -2
- package/dist/chunk-LT6HN46T.mjs +0 -5350
- package/dist/rsc.css +0 -338
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSProperties, ReactElement,
|
1
|
+
import { CSSProperties, ReactElement, ReactNode, JSX } from 'react';
|
2
2
|
|
3
3
|
type ItemSelector = {
|
4
4
|
index: number;
|
@@ -23,6 +23,7 @@ type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
23
23
|
type BaseField = {
|
24
24
|
label?: string;
|
25
25
|
labelIcon?: ReactElement;
|
26
|
+
metadata?: Metadata;
|
26
27
|
};
|
27
28
|
type TextField = BaseField & {
|
28
29
|
type: "text";
|
@@ -109,19 +110,22 @@ type ExternalField<Props extends {
|
|
109
110
|
filterFields?: Record<string, Field>;
|
110
111
|
initialFilters?: Record<string, any>;
|
111
112
|
};
|
112
|
-
type
|
113
|
+
type CustomFieldRender<Value extends any> = (props: {
|
114
|
+
field: CustomField<Value>;
|
115
|
+
name: string;
|
116
|
+
id: string;
|
117
|
+
value: Value;
|
118
|
+
onChange: (value: Value) => void;
|
119
|
+
readOnly?: boolean;
|
120
|
+
}) => ReactElement;
|
121
|
+
type CustomField<Value extends any> = BaseField & {
|
113
122
|
type: "custom";
|
114
|
-
render:
|
115
|
-
field: CustomField<Props>;
|
116
|
-
name: string;
|
117
|
-
id: string;
|
118
|
-
value: Props;
|
119
|
-
onChange: (value: Props) => void;
|
120
|
-
readOnly?: boolean;
|
121
|
-
}) => ReactElement;
|
123
|
+
render: CustomFieldRender<Value>;
|
122
124
|
};
|
123
125
|
type SlotField = BaseField & {
|
124
126
|
type: "slot";
|
127
|
+
allow?: string[];
|
128
|
+
disallow?: string[];
|
125
129
|
};
|
126
130
|
type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
|
127
131
|
[key: string]: any;
|
@@ -143,12 +147,12 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
143
147
|
readOnly?: boolean;
|
144
148
|
};
|
145
149
|
|
146
|
-
type PuckComponent<Props> = (props: WithId<WithPuckProps<
|
150
|
+
type PuckComponent<Props> = (props: WithId<WithPuckProps<{
|
151
|
+
[PropName in keyof Props]: Props[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : Props[PropName];
|
152
|
+
}>>) => JSX.Element;
|
147
153
|
type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
148
154
|
type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
|
149
|
-
render: PuckComponent<
|
150
|
-
[PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
|
151
|
-
}>;
|
155
|
+
render: PuckComponent<RenderProps>;
|
152
156
|
label?: string;
|
153
157
|
defaultProps?: FieldProps;
|
154
158
|
fields?: Fields<FieldProps>;
|
@@ -187,6 +191,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
187
191
|
appState: AppState;
|
188
192
|
lastData: DataShape | null;
|
189
193
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
194
|
+
metadata?: Metadata;
|
190
195
|
};
|
191
196
|
type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
192
197
|
type Category<ComponentName> = {
|
@@ -522,4 +527,4 @@ declare function transformProps<Props extends DefaultComponentProps = DefaultCom
|
|
522
527
|
|
523
528
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
524
529
|
|
525
|
-
export { type
|
530
|
+
export { type CustomField as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataMap as E, type Fields as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type SelectField as K, type RadioField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type ArrayField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ObjectField as W, type Adaptor as X, type ExternalFieldWithAdaptor as Y, type ExternalField as Z, type CustomFieldRender as _, type Config as a, type SlotField as a0, type PuckContext as a1, type DefaultRootFieldProps as a2, type DefaultRootRenderProps as a3, type DefaultRootProps as a4, type DefaultComponentProps as a5, type WithId as a6, type WithPuckProps as a7, type AsFieldProps as a8, type WithChildren as a9, type ExtractPropsFromConfig as aa, type ExtractRootPropsFromConfig as ab, transformProps as ac, resolveAllData as ad, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type RootData as l, type Content as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, overrideKeys as r, type OverrideKey as s, type FieldRenderFunctions as t, type ItemWithId as u, type ArrayState as v, type PuckComponent as w, type RootConfig as x, type RootDataWithoutProps as y, type MappedItem as z };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSProperties, ReactElement,
|
1
|
+
import { CSSProperties, ReactElement, ReactNode, JSX } from 'react';
|
2
2
|
|
3
3
|
type ItemSelector = {
|
4
4
|
index: number;
|
@@ -23,6 +23,7 @@ type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
23
23
|
type BaseField = {
|
24
24
|
label?: string;
|
25
25
|
labelIcon?: ReactElement;
|
26
|
+
metadata?: Metadata;
|
26
27
|
};
|
27
28
|
type TextField = BaseField & {
|
28
29
|
type: "text";
|
@@ -109,19 +110,22 @@ type ExternalField<Props extends {
|
|
109
110
|
filterFields?: Record<string, Field>;
|
110
111
|
initialFilters?: Record<string, any>;
|
111
112
|
};
|
112
|
-
type
|
113
|
+
type CustomFieldRender<Value extends any> = (props: {
|
114
|
+
field: CustomField<Value>;
|
115
|
+
name: string;
|
116
|
+
id: string;
|
117
|
+
value: Value;
|
118
|
+
onChange: (value: Value) => void;
|
119
|
+
readOnly?: boolean;
|
120
|
+
}) => ReactElement;
|
121
|
+
type CustomField<Value extends any> = BaseField & {
|
113
122
|
type: "custom";
|
114
|
-
render:
|
115
|
-
field: CustomField<Props>;
|
116
|
-
name: string;
|
117
|
-
id: string;
|
118
|
-
value: Props;
|
119
|
-
onChange: (value: Props) => void;
|
120
|
-
readOnly?: boolean;
|
121
|
-
}) => ReactElement;
|
123
|
+
render: CustomFieldRender<Value>;
|
122
124
|
};
|
123
125
|
type SlotField = BaseField & {
|
124
126
|
type: "slot";
|
127
|
+
allow?: string[];
|
128
|
+
disallow?: string[];
|
125
129
|
};
|
126
130
|
type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
|
127
131
|
[key: string]: any;
|
@@ -143,12 +147,12 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
143
147
|
readOnly?: boolean;
|
144
148
|
};
|
145
149
|
|
146
|
-
type PuckComponent<Props> = (props: WithId<WithPuckProps<
|
150
|
+
type PuckComponent<Props> = (props: WithId<WithPuckProps<{
|
151
|
+
[PropName in keyof Props]: Props[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : Props[PropName];
|
152
|
+
}>>) => JSX.Element;
|
147
153
|
type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
148
154
|
type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
|
149
|
-
render: PuckComponent<
|
150
|
-
[PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
|
151
|
-
}>;
|
155
|
+
render: PuckComponent<RenderProps>;
|
152
156
|
label?: string;
|
153
157
|
defaultProps?: FieldProps;
|
154
158
|
fields?: Fields<FieldProps>;
|
@@ -187,6 +191,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
187
191
|
appState: AppState;
|
188
192
|
lastData: DataShape | null;
|
189
193
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
194
|
+
metadata?: Metadata;
|
190
195
|
};
|
191
196
|
type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
192
197
|
type Category<ComponentName> = {
|
@@ -522,4 +527,4 @@ declare function transformProps<Props extends DefaultComponentProps = DefaultCom
|
|
522
527
|
|
523
528
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
524
529
|
|
525
|
-
export { type
|
530
|
+
export { type CustomField as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataMap as E, type Fields as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type SelectField as K, type RadioField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type ArrayField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ObjectField as W, type Adaptor as X, type ExternalFieldWithAdaptor as Y, type ExternalField as Z, type CustomFieldRender as _, type Config as a, type SlotField as a0, type PuckContext as a1, type DefaultRootFieldProps as a2, type DefaultRootRenderProps as a3, type DefaultRootProps as a4, type DefaultComponentProps as a5, type WithId as a6, type WithPuckProps as a7, type AsFieldProps as a8, type WithChildren as a9, type ExtractPropsFromConfig as aa, type ExtractRootPropsFromConfig as ab, transformProps as ac, resolveAllData as ad, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type RootData as l, type Content as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, overrideKeys as r, type OverrideKey as s, type FieldRenderFunctions as t, type ItemWithId as u, type ArrayState as v, type PuckComponent as w, type RootConfig as x, type RootDataWithoutProps as y, type MappedItem as z };
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import {
|
3
|
-
export {
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './resolve-all-data-DtB0OZRl.mjs';
|
3
|
+
export { ad as resolveAllData, ac as transformProps } from './resolve-all-data-DtB0OZRl.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import {
|
3
|
-
export {
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './resolve-all-data-DtB0OZRl.js';
|
3
|
+
export { ad as resolveAllData, ac as transformProps } from './resolve-all-data-DtB0OZRl.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|