@measured/puck 0.21.0-canary.d32e582b → 0.21.0-canary.e4131567
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/{chunk-VVS2EUKT.mjs → chunk-KNAV6QTS.mjs} +1993 -2455
- package/dist/{chunk-XYKLHT4R.mjs → chunk-X7YZ3YE7.mjs} +8 -10
- package/dist/index.css +273 -649
- package/dist/index.d.mts +4 -15
- package/dist/index.d.ts +4 -15
- package/dist/index.js +1898 -2355
- package/dist/index.mjs +2 -8
- package/dist/no-external.css +273 -649
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +1898 -2355
- package/dist/no-external.mjs +2 -8
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +8 -10
- package/dist/rsc.mjs +1 -1
- package/dist/{walk-tree-DiatHoF-.d.mts → walk-tree-Ctf3FZQI.d.mts} +13 -25
- package/dist/{walk-tree-DiatHoF-.d.ts → walk-tree-Ctf3FZQI.d.ts} +13 -25
- package/package.json +21 -2
package/dist/no-external.mjs
CHANGED
|
@@ -11,24 +11,21 @@ import {
|
|
|
11
11
|
Label,
|
|
12
12
|
Puck,
|
|
13
13
|
Render,
|
|
14
|
-
blocksPlugin,
|
|
15
14
|
createUsePuck,
|
|
16
|
-
fieldsPlugin,
|
|
17
|
-
outlinePlugin,
|
|
18
15
|
overrideKeys,
|
|
19
16
|
registerOverlayPortal,
|
|
20
17
|
renderContext,
|
|
21
18
|
setDeep,
|
|
22
19
|
useGetPuck,
|
|
23
20
|
usePuck
|
|
24
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KNAV6QTS.mjs";
|
|
25
22
|
import {
|
|
26
23
|
init_react_import,
|
|
27
24
|
migrate,
|
|
28
25
|
resolveAllData,
|
|
29
26
|
transformProps,
|
|
30
27
|
walkTree
|
|
31
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-X7YZ3YE7.mjs";
|
|
32
29
|
|
|
33
30
|
// bundle/no-external.ts
|
|
34
31
|
init_react_import();
|
|
@@ -45,11 +42,8 @@ export {
|
|
|
45
42
|
Label,
|
|
46
43
|
Puck,
|
|
47
44
|
Render,
|
|
48
|
-
blocksPlugin,
|
|
49
45
|
createUsePuck,
|
|
50
|
-
fieldsPlugin,
|
|
51
46
|
migrate,
|
|
52
|
-
outlinePlugin,
|
|
53
47
|
overrideKeys,
|
|
54
48
|
registerOverlayPortal,
|
|
55
49
|
renderContext,
|
package/dist/rsc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-Ctf3FZQI.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Ctf3FZQI.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 { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-Ctf3FZQI.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Ctf3FZQI.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, }: {
|
package/dist/rsc.js
CHANGED
|
@@ -157,7 +157,7 @@ var walkField = ({
|
|
|
157
157
|
return map({
|
|
158
158
|
value: mappedContent,
|
|
159
159
|
parentId: id,
|
|
160
|
-
propName:
|
|
160
|
+
propName: propPath,
|
|
161
161
|
field: fields[propKey],
|
|
162
162
|
propPath
|
|
163
163
|
});
|
|
@@ -460,19 +460,19 @@ function Render({
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
// lib/get-changed.ts
|
|
463
|
-
var
|
|
463
|
+
var import_fast_equals = require("fast-equals");
|
|
464
464
|
var getChanged = (newItem, oldItem) => {
|
|
465
465
|
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
|
466
466
|
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
|
467
467
|
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
|
468
468
|
return __spreadProps(__spreadValues({}, acc), {
|
|
469
|
-
[item]: !(0,
|
|
469
|
+
[item]: !(0, import_fast_equals.deepEqual)(oldItemProps[item], newItemProps[item])
|
|
470
470
|
});
|
|
471
471
|
}, {}) : {};
|
|
472
472
|
};
|
|
473
473
|
|
|
474
474
|
// lib/resolve-component-data.ts
|
|
475
|
-
var
|
|
475
|
+
var import_fast_equals2 = require("fast-equals");
|
|
476
476
|
var cache = { lastChange: {} };
|
|
477
477
|
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
478
478
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
@@ -481,7 +481,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
481
481
|
const id = "id" in item.props ? item.props.id : "root";
|
|
482
482
|
if (shouldRunResolver) {
|
|
483
483
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
|
484
|
-
if (item && (0,
|
|
484
|
+
if (trigger !== "force" && item && (0, import_fast_equals2.deepEqual)(item, oldItem)) {
|
|
485
485
|
return { node: resolved, didChange: false };
|
|
486
486
|
}
|
|
487
487
|
const changed = getChanged(item, oldItem);
|
|
@@ -531,7 +531,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
531
531
|
};
|
|
532
532
|
return {
|
|
533
533
|
node: itemWithResolvedChildren,
|
|
534
|
-
didChange: !(0,
|
|
534
|
+
didChange: !(0, import_fast_equals2.deepEqual)(item, itemWithResolvedChildren)
|
|
535
535
|
};
|
|
536
536
|
});
|
|
537
537
|
|
|
@@ -671,8 +671,7 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
671
671
|
var defaultViewports = [
|
|
672
672
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
673
673
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
674
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
675
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
674
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
676
675
|
];
|
|
677
676
|
|
|
678
677
|
// store/default-app-state.ts
|
|
@@ -694,8 +693,7 @@ var defaultAppState = {
|
|
|
694
693
|
options: [],
|
|
695
694
|
controlsVisible: true
|
|
696
695
|
},
|
|
697
|
-
field: { focus: null }
|
|
698
|
-
plugin: { current: null }
|
|
696
|
+
field: { focus: null }
|
|
699
697
|
},
|
|
700
698
|
indexes: {
|
|
701
699
|
nodes: {},
|
package/dist/rsc.mjs
CHANGED
|
@@ -72,7 +72,7 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
|
72
72
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
73
73
|
mapProp?: (value: TableShape) => PropShape;
|
|
74
74
|
};
|
|
75
|
-
type NotUndefined<T> = T extends undefined ?
|
|
75
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
76
76
|
type ExternalFieldWithAdaptor<Props extends any = {
|
|
77
77
|
[key: string]: any;
|
|
78
78
|
}> = BaseField & {
|
|
@@ -122,7 +122,7 @@ type SlotField = BaseField & {
|
|
|
122
122
|
};
|
|
123
123
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
124
124
|
[key: string]: any;
|
|
125
|
-
}[] ? ValueType :
|
|
125
|
+
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
126
126
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps, UserField extends {} = {}> = {
|
|
127
127
|
[PropName in keyof Omit<ComponentProps, "editMode">]: UserField extends {
|
|
128
128
|
type: PropertyKey;
|
|
@@ -212,6 +212,7 @@ UserField extends BaseField = {}> = {
|
|
|
212
212
|
fields: Fields<FieldProps>;
|
|
213
213
|
lastFields: Fields<FieldProps>;
|
|
214
214
|
lastData: DataShape | null;
|
|
215
|
+
metadata: Metadata;
|
|
215
216
|
appState: AppState;
|
|
216
217
|
parent: ComponentData | null;
|
|
217
218
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -255,7 +256,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
|
255
256
|
root?: RootConfigInternal<RootProps, UserField>;
|
|
256
257
|
};
|
|
257
258
|
type DefaultComponents = Record<string, any>;
|
|
258
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
|
259
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
|
259
260
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
|
260
261
|
props: PropsOrParams;
|
|
261
262
|
rootProps: RootProps & DefaultRootFieldProps;
|
|
@@ -308,7 +309,6 @@ type Metadata = {
|
|
|
308
309
|
type ItemWithId = {
|
|
309
310
|
_arrayId: string;
|
|
310
311
|
_originalIndex: number;
|
|
311
|
-
_currentIndex: number;
|
|
312
312
|
};
|
|
313
313
|
type ArrayState = {
|
|
314
314
|
items: ItemWithId[];
|
|
@@ -319,7 +319,6 @@ type UiState = {
|
|
|
319
319
|
rightSideBarVisible: boolean;
|
|
320
320
|
leftSideBarWidth?: number | null;
|
|
321
321
|
rightSideBarWidth?: number | null;
|
|
322
|
-
mobilePanelExpanded?: boolean;
|
|
323
322
|
itemSelector: ItemSelector | null;
|
|
324
323
|
arrayState: Record<string, ArrayState | undefined>;
|
|
325
324
|
previewMode: "interactive" | "edit";
|
|
@@ -332,7 +331,7 @@ type UiState = {
|
|
|
332
331
|
isDragging: boolean;
|
|
333
332
|
viewports: {
|
|
334
333
|
current: {
|
|
335
|
-
width: number
|
|
334
|
+
width: number;
|
|
336
335
|
height: number | "auto";
|
|
337
336
|
};
|
|
338
337
|
controlsVisible: boolean;
|
|
@@ -341,9 +340,6 @@ type UiState = {
|
|
|
341
340
|
field: {
|
|
342
341
|
focus?: string | null;
|
|
343
342
|
};
|
|
344
|
-
plugin: {
|
|
345
|
-
current: string | null;
|
|
346
|
-
};
|
|
347
343
|
};
|
|
348
344
|
type AppState<UserData extends Data = Data> = {
|
|
349
345
|
data: UserData;
|
|
@@ -377,7 +373,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
377
373
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
378
374
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
379
375
|
} : T;
|
|
380
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
|
376
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
381
377
|
components?: Components;
|
|
382
378
|
root?: RootProps;
|
|
383
379
|
categories?: CategoryNames;
|
|
@@ -397,14 +393,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
397
393
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
398
394
|
never
|
|
399
395
|
] ? False : True;
|
|
400
|
-
type RenderFunc<Props extends {
|
|
401
|
-
[key: string]: any;
|
|
402
|
-
} = {
|
|
403
|
-
children: ReactNode;
|
|
404
|
-
}> = (props: Props) => ReactElement;
|
|
405
|
-
type PluginInternal = Plugin & {
|
|
406
|
-
mobileOnly?: boolean;
|
|
407
|
-
};
|
|
408
396
|
|
|
409
397
|
type MapFnParams<ThisField = Field> = {
|
|
410
398
|
value: any;
|
|
@@ -428,6 +416,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
428
416
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
429
417
|
}>;
|
|
430
418
|
|
|
419
|
+
type RenderFunc<Props extends {
|
|
420
|
+
[key: string]: any;
|
|
421
|
+
} = {
|
|
422
|
+
children: ReactNode;
|
|
423
|
+
}> = (props: Props) => ReactElement;
|
|
431
424
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
432
425
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
433
426
|
type OverridesGeneric<Shape extends {
|
|
@@ -499,7 +492,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
499
492
|
|
|
500
493
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
501
494
|
type Viewport = {
|
|
502
|
-
width: number
|
|
495
|
+
width: number;
|
|
503
496
|
height?: number | "auto";
|
|
504
497
|
label?: string;
|
|
505
498
|
icon?: iconTypes | ReactNode;
|
|
@@ -519,13 +512,8 @@ type IframeConfig = {
|
|
|
519
512
|
};
|
|
520
513
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
521
514
|
type Plugin<UserConfig extends Config = Config> = {
|
|
522
|
-
name?: string;
|
|
523
|
-
label?: string;
|
|
524
|
-
icon?: ReactNode;
|
|
525
|
-
render?: () => ReactElement;
|
|
526
515
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
527
516
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
528
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
|
529
517
|
};
|
|
530
518
|
type History<D = any> = {
|
|
531
519
|
state: D;
|
|
@@ -643,4 +631,4 @@ type WalkTreeOptions = {
|
|
|
643
631
|
};
|
|
644
632
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
645
633
|
|
|
646
|
-
export { type
|
|
634
|
+
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type ExternalField as a9, type CustomFieldRender as aa, type CustomField as ab, type SlotField as ac, type PuckContext as ad, type DefaultRootFieldProps as ae, type DefaultRootRenderProps as af, type DefaultRootProps as ag, type DefaultComponentProps as ah, type WithId as ai, type WithPuckProps as aj, type AsFieldProps as ak, type WithChildren as al, type ExtractField as am, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type Field as h, type FieldProps as i, type Data as j, type OnAction as k, type InitialHistory as l, migrate as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, resolveAllData as r, type FieldTransformFnParams as s, transformProps as t, type FieldTransformFn as u, overrideKeys as v, walkTree as w, type OverrideKey as x, type FieldRenderFunctions as y, type ItemWithId as z };
|
|
@@ -72,7 +72,7 @@ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, Pr
|
|
|
72
72
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
73
73
|
mapProp?: (value: TableShape) => PropShape;
|
|
74
74
|
};
|
|
75
|
-
type NotUndefined<T> = T extends undefined ?
|
|
75
|
+
type NotUndefined<T> = T extends undefined ? never : T;
|
|
76
76
|
type ExternalFieldWithAdaptor<Props extends any = {
|
|
77
77
|
[key: string]: any;
|
|
78
78
|
}> = BaseField & {
|
|
@@ -122,7 +122,7 @@ type SlotField = BaseField & {
|
|
|
122
122
|
};
|
|
123
123
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
124
124
|
[key: string]: any;
|
|
125
|
-
}[] ? ValueType :
|
|
125
|
+
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
126
126
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps, UserField extends {} = {}> = {
|
|
127
127
|
[PropName in keyof Omit<ComponentProps, "editMode">]: UserField extends {
|
|
128
128
|
type: PropertyKey;
|
|
@@ -212,6 +212,7 @@ UserField extends BaseField = {}> = {
|
|
|
212
212
|
fields: Fields<FieldProps>;
|
|
213
213
|
lastFields: Fields<FieldProps>;
|
|
214
214
|
lastData: DataShape | null;
|
|
215
|
+
metadata: Metadata;
|
|
215
216
|
appState: AppState;
|
|
216
217
|
parent: ComponentData | null;
|
|
217
218
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -255,7 +256,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
|
255
256
|
root?: RootConfigInternal<RootProps, UserField>;
|
|
256
257
|
};
|
|
257
258
|
type DefaultComponents = Record<string, any>;
|
|
258
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
|
259
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
|
259
260
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
|
260
261
|
props: PropsOrParams;
|
|
261
262
|
rootProps: RootProps & DefaultRootFieldProps;
|
|
@@ -308,7 +309,6 @@ type Metadata = {
|
|
|
308
309
|
type ItemWithId = {
|
|
309
310
|
_arrayId: string;
|
|
310
311
|
_originalIndex: number;
|
|
311
|
-
_currentIndex: number;
|
|
312
312
|
};
|
|
313
313
|
type ArrayState = {
|
|
314
314
|
items: ItemWithId[];
|
|
@@ -319,7 +319,6 @@ type UiState = {
|
|
|
319
319
|
rightSideBarVisible: boolean;
|
|
320
320
|
leftSideBarWidth?: number | null;
|
|
321
321
|
rightSideBarWidth?: number | null;
|
|
322
|
-
mobilePanelExpanded?: boolean;
|
|
323
322
|
itemSelector: ItemSelector | null;
|
|
324
323
|
arrayState: Record<string, ArrayState | undefined>;
|
|
325
324
|
previewMode: "interactive" | "edit";
|
|
@@ -332,7 +331,7 @@ type UiState = {
|
|
|
332
331
|
isDragging: boolean;
|
|
333
332
|
viewports: {
|
|
334
333
|
current: {
|
|
335
|
-
width: number
|
|
334
|
+
width: number;
|
|
336
335
|
height: number | "auto";
|
|
337
336
|
};
|
|
338
337
|
controlsVisible: boolean;
|
|
@@ -341,9 +340,6 @@ type UiState = {
|
|
|
341
340
|
field: {
|
|
342
341
|
focus?: string | null;
|
|
343
342
|
};
|
|
344
|
-
plugin: {
|
|
345
|
-
current: string | null;
|
|
346
|
-
};
|
|
347
343
|
};
|
|
348
344
|
type AppState<UserData extends Data = Data> = {
|
|
349
345
|
data: UserData;
|
|
@@ -377,7 +373,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
377
373
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
378
374
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
379
375
|
} : T;
|
|
380
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
|
376
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
381
377
|
components?: Components;
|
|
382
378
|
root?: RootProps;
|
|
383
379
|
categories?: CategoryNames;
|
|
@@ -397,14 +393,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
|
397
393
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
398
394
|
never
|
|
399
395
|
] ? False : True;
|
|
400
|
-
type RenderFunc<Props extends {
|
|
401
|
-
[key: string]: any;
|
|
402
|
-
} = {
|
|
403
|
-
children: ReactNode;
|
|
404
|
-
}> = (props: Props) => ReactElement;
|
|
405
|
-
type PluginInternal = Plugin & {
|
|
406
|
-
mobileOnly?: boolean;
|
|
407
|
-
};
|
|
408
396
|
|
|
409
397
|
type MapFnParams<ThisField = Field> = {
|
|
410
398
|
value: any;
|
|
@@ -428,6 +416,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
428
416
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
429
417
|
}>;
|
|
430
418
|
|
|
419
|
+
type RenderFunc<Props extends {
|
|
420
|
+
[key: string]: any;
|
|
421
|
+
} = {
|
|
422
|
+
children: ReactNode;
|
|
423
|
+
}> = (props: Props) => ReactElement;
|
|
431
424
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
432
425
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
433
426
|
type OverridesGeneric<Shape extends {
|
|
@@ -499,7 +492,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
499
492
|
|
|
500
493
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
501
494
|
type Viewport = {
|
|
502
|
-
width: number
|
|
495
|
+
width: number;
|
|
503
496
|
height?: number | "auto";
|
|
504
497
|
label?: string;
|
|
505
498
|
icon?: iconTypes | ReactNode;
|
|
@@ -519,13 +512,8 @@ type IframeConfig = {
|
|
|
519
512
|
};
|
|
520
513
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
521
514
|
type Plugin<UserConfig extends Config = Config> = {
|
|
522
|
-
name?: string;
|
|
523
|
-
label?: string;
|
|
524
|
-
icon?: ReactNode;
|
|
525
|
-
render?: () => ReactElement;
|
|
526
515
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
527
516
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
528
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
|
529
517
|
};
|
|
530
518
|
type History<D = any> = {
|
|
531
519
|
state: D;
|
|
@@ -643,4 +631,4 @@ type WalkTreeOptions = {
|
|
|
643
631
|
};
|
|
644
632
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
645
633
|
|
|
646
|
-
export { type
|
|
634
|
+
export { type BaseField as $, type AppState as A, type ArrayState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Fields as F, type PuckComponent as G, type History as H, type IframeConfig as I, type RootConfig as J, type DefaultComponents as K, type ExtractConfigParams as L, type Metadata as M, type BaseData as N, type Overrides as O, type Permissions as P, type RootDataWithoutProps as Q, type RootDataWithProps as R, type Slot as S, type RootData as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ComponentDataOptionalId as X, type MappedItem as Y, type ComponentDataMap as Z, type Content as _, type ComponentData as a, type TextField as a0, type NumberField as a1, type TextareaField as a2, type SelectField as a3, type RadioField as a4, type ArrayField as a5, type ObjectField as a6, type Adaptor as a7, type ExternalFieldWithAdaptor as a8, type ExternalField as a9, type CustomFieldRender as aa, type CustomField as ab, type SlotField as ac, type PuckContext as ad, type DefaultRootFieldProps as ae, type DefaultRootRenderProps as af, type DefaultRootProps as ag, type DefaultComponentProps as ah, type WithId as ai, type WithPuckProps as aj, type AsFieldProps as ak, type WithChildren as al, type ExtractField as am, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type FieldTransforms as g, type Field as h, type FieldProps as i, type Data as j, type OnAction as k, type InitialHistory as l, migrate as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, resolveAllData as r, type FieldTransformFnParams as s, transformProps as t, type FieldTransformFn as u, overrideKeys as v, walkTree as w, type OverrideKey as x, type FieldRenderFunctions as y, type ItemWithId as z };
|
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@measured/puck",
|
|
3
|
-
"version": "0.21.0-canary.
|
|
3
|
+
"version": "0.21.0-canary.e4131567",
|
|
4
|
+
"description": "The open-source visual editor for React",
|
|
4
5
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
6
|
"repository": "measuredco/puck",
|
|
6
7
|
"bugs": "https://github.com/measuredco/puck/issues",
|
|
7
8
|
"homepage": "https://puckeditor.com",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"puck",
|
|
11
|
+
"visual",
|
|
12
|
+
"editor",
|
|
13
|
+
"react",
|
|
14
|
+
"drag and drop",
|
|
15
|
+
"dnd",
|
|
16
|
+
"page",
|
|
17
|
+
"website",
|
|
18
|
+
"builder",
|
|
19
|
+
"headless",
|
|
20
|
+
"cms",
|
|
21
|
+
"low-code",
|
|
22
|
+
"no-code",
|
|
23
|
+
"javascript",
|
|
24
|
+
"typescript",
|
|
25
|
+
"WYSIWYG"
|
|
26
|
+
],
|
|
8
27
|
"private": false,
|
|
9
28
|
"main": "./dist/index.js",
|
|
10
29
|
"types": "./dist/index.d.ts",
|
|
@@ -77,7 +96,7 @@
|
|
|
77
96
|
"@dnd-kit/helpers": "0.1.18",
|
|
78
97
|
"@dnd-kit/react": "0.1.18",
|
|
79
98
|
"deep-diff": "^1.0.2",
|
|
80
|
-
"fast-
|
|
99
|
+
"fast-equals": "5.2.2",
|
|
81
100
|
"flat": "^5.0.2",
|
|
82
101
|
"object-hash": "^3.0.0",
|
|
83
102
|
"react-hotkeys-hook": "^4.6.1",
|