@measured/puck 0.18.3-canary.9e8e47b → 0.18.3
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-CHWFBYEM.mjs → chunk-4QIG6FWS.mjs} +44 -8
- package/dist/index.css +13 -0
- package/dist/index.d.mts +3 -14
- package/dist/index.d.ts +3 -14
- package/dist/index.js +355 -340
- package/dist/index.mjs +211 -230
- package/dist/{resolve-all-data-ppm982Jh.d.mts → resolve-all-data-ChsqfT2w.d.mts} +12 -1
- package/dist/{resolve-all-data-ppm982Jh.d.ts → resolve-all-data-ChsqfT2w.d.ts} +12 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +37 -2
- package/dist/rsc.mjs +5 -3
- package/package.json +2 -2
@@ -457,6 +457,17 @@ type PuckAction = {
|
|
457
457
|
recordHistory?: boolean;
|
458
458
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
459
459
|
|
460
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
461
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
462
|
+
[key: string]: any;
|
463
|
+
}) => Props[ComponentName];
|
464
|
+
} & {
|
465
|
+
root: (props: RootProps & {
|
466
|
+
[key: string]: any;
|
467
|
+
}) => RootProps;
|
468
|
+
}>;
|
469
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
470
|
+
|
460
471
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
461
472
|
|
462
|
-
export { type
|
473
|
+
export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type ArrayField as G, type History as H, type IframeConfig as I, type ObjectField as J, type Adaptor as K, type ExternalFieldWithAdaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ExternalField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type CustomField as W, type Fields as X, type PuckContext as Y, type DefaultRootFieldProps as Z, type DefaultRootRenderProps as _, type Field as a, type DefaultComponentProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, transformProps as a5, resolveAllData as a6, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type ExtractRootPropsFromConfig as h, type ComponentDataMap as i, type Direction as j, type DragAxis as k, type Viewport as l, type OverrideKey as m, type FieldRenderFunctions as n, overrideKeys as o, type ItemWithId as p, type ArrayState as q, type PuckComponent as r, type ComponentConfig as s, type RootDataWithoutProps as t, type RootData as u, type ComponentData as v, type Content as w, type BaseField as x, type TextareaField as y, type RadioField as z };
|
@@ -457,6 +457,17 @@ type PuckAction = {
|
|
457
457
|
recordHistory?: boolean;
|
458
458
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
459
459
|
|
460
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
461
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
462
|
+
[key: string]: any;
|
463
|
+
}) => Props[ComponentName];
|
464
|
+
} & {
|
465
|
+
root: (props: RootProps & {
|
466
|
+
[key: string]: any;
|
467
|
+
}) => RootProps;
|
468
|
+
}>;
|
469
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
470
|
+
|
460
471
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
461
472
|
|
462
|
-
export { type
|
473
|
+
export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type ArrayField as G, type History as H, type IframeConfig as I, type ObjectField as J, type Adaptor as K, type ExternalFieldWithAdaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ExternalField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type CustomField as W, type Fields as X, type PuckContext as Y, type DefaultRootFieldProps as Z, type DefaultRootRenderProps as _, type Field as a, type DefaultComponentProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, transformProps as a5, resolveAllData as a6, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type ExtractRootPropsFromConfig as h, type ComponentDataMap as i, type Direction as j, type DragAxis as k, type Viewport as l, type OverrideKey as m, type FieldRenderFunctions as n, overrideKeys as o, type ItemWithId as p, type ArrayState as q, type PuckComponent as r, type ComponentConfig as s, type RootDataWithoutProps as t, type RootData as u, type ComponentData as v, type Content as w, type BaseField as x, type TextareaField as y, type RadioField 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 { C as Config, U as UserGenerics } from './resolve-all-data-
|
3
|
-
export {
|
2
|
+
import { C as Config, U as UserGenerics } from './resolve-all-data-ChsqfT2w.mjs';
|
3
|
+
export { a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
|
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 } from './resolve-all-data-
|
3
|
-
export {
|
2
|
+
import { C as Config, U as UserGenerics } from './resolve-all-data-ChsqfT2w.js';
|
3
|
+
export { a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
|
package/dist/rsc.js
CHANGED
@@ -68,7 +68,8 @@ var __async = (__this, __arguments, generator) => {
|
|
68
68
|
var rsc_exports = {};
|
69
69
|
__export(rsc_exports, {
|
70
70
|
Render: () => Render,
|
71
|
-
resolveAllData: () => resolveAllData
|
71
|
+
resolveAllData: () => resolveAllData,
|
72
|
+
transformProps: () => transformProps
|
72
73
|
});
|
73
74
|
module.exports = __toCommonJS(rsc_exports);
|
74
75
|
|
@@ -271,8 +272,42 @@ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
|
|
271
272
|
});
|
272
273
|
});
|
273
274
|
}
|
275
|
+
|
276
|
+
// lib/transform-props.ts
|
277
|
+
function transformProps(data, propTransforms) {
|
278
|
+
const mapItem = (item) => {
|
279
|
+
if (propTransforms[item.type]) {
|
280
|
+
return __spreadProps(__spreadValues({}, item), {
|
281
|
+
props: propTransforms[item.type](item.props)
|
282
|
+
});
|
283
|
+
}
|
284
|
+
return item;
|
285
|
+
};
|
286
|
+
const defaultedData = defaultData(data);
|
287
|
+
const rootProps = defaultedData.root.props || defaultedData.root;
|
288
|
+
let newRoot = __spreadValues({}, defaultedData.root);
|
289
|
+
if (propTransforms["root"]) {
|
290
|
+
if (defaultedData.root.props) {
|
291
|
+
newRoot.props = propTransforms["root"](rootProps);
|
292
|
+
} else {
|
293
|
+
newRoot = propTransforms["root"](rootProps);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
|
297
|
+
root: newRoot,
|
298
|
+
content: defaultedData.content.map(mapItem),
|
299
|
+
zones: Object.keys(data.zones || {}).reduce(
|
300
|
+
(acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
|
301
|
+
[zoneKey]: data.zones[zoneKey].map(mapItem)
|
302
|
+
}),
|
303
|
+
{}
|
304
|
+
)
|
305
|
+
});
|
306
|
+
return afterPropTransforms;
|
307
|
+
}
|
274
308
|
// Annotate the CommonJS export names for ESM import in node:
|
275
309
|
0 && (module.exports = {
|
276
310
|
Render,
|
277
|
-
resolveAllData
|
311
|
+
resolveAllData,
|
312
|
+
transformProps
|
278
313
|
});
|
package/dist/rsc.mjs
CHANGED
@@ -4,8 +4,9 @@ import {
|
|
4
4
|
init_react_import,
|
5
5
|
resolveAllData,
|
6
6
|
rootDroppableId,
|
7
|
-
setupZone
|
8
|
-
|
7
|
+
setupZone,
|
8
|
+
transformProps
|
9
|
+
} from "./chunk-4QIG6FWS.mjs";
|
9
10
|
|
10
11
|
// rsc.tsx
|
11
12
|
init_react_import();
|
@@ -76,5 +77,6 @@ function Render({ config, data }) {
|
|
76
77
|
}
|
77
78
|
export {
|
78
79
|
Render,
|
79
|
-
resolveAllData
|
80
|
+
resolveAllData,
|
81
|
+
transformProps
|
80
82
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.18.3
|
3
|
+
"version": "0.18.3",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -78,6 +78,6 @@
|
|
78
78
|
"zustand": "^5.0.2"
|
79
79
|
},
|
80
80
|
"peerDependencies": {
|
81
|
-
"react": "^
|
81
|
+
"react": "^18.0.0 || ^19.0.0"
|
82
82
|
}
|
83
83
|
}
|