@measured/puck 0.21.0-canary.b818cb1f → 0.21.0-canary.c0db75c1
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/{walk-tree-DkTSFbz_.d.mts → actions-CaYAKtsG.d.mts} +79 -81
- package/dist/{walk-tree-DkTSFbz_.d.ts → actions-CaYAKtsG.d.ts} +79 -81
- package/dist/{chunk-CBXRJMRZ.mjs → chunk-E4BOPJJV.mjs} +2771 -2922
- package/dist/chunk-J32NOAUF.mjs +524 -0
- package/dist/chunk-PJYARUPI.mjs +477 -0
- package/dist/chunk-S3RM5GHZ.mjs +503 -0
- package/dist/index-C6QwyW4B.d.ts +109 -0
- package/dist/index-IMRjDHZk.d.mts +109 -0
- package/dist/index.css +649 -270
- package/dist/index.d.mts +19 -109
- package/dist/index.d.ts +19 -109
- package/dist/index.js +2284 -1944
- package/dist/index.mjs +13 -4
- package/dist/internal.d.mts +12 -0
- package/dist/internal.d.ts +12 -0
- package/dist/internal.js +906 -0
- package/dist/internal.mjs +12 -0
- package/dist/no-external.css +649 -270
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +2281 -1941
- package/dist/no-external.mjs +13 -4
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +15 -12
- package/dist/rsc.mjs +7 -5
- package/dist/walk-tree-B-Q2gpMX.d.mts +29 -0
- package/dist/walk-tree-ksvZ7C4q.d.ts +29 -0
- package/package.json +7 -2
- package/dist/chunk-VBJEDLUM.mjs +0 -965
package/dist/no-external.mjs
CHANGED
|
@@ -11,21 +11,27 @@ import {
|
|
|
11
11
|
Label,
|
|
12
12
|
Puck,
|
|
13
13
|
Render,
|
|
14
|
+
blocksPlugin,
|
|
14
15
|
createUsePuck,
|
|
16
|
+
fieldsPlugin,
|
|
17
|
+
outlinePlugin,
|
|
15
18
|
overrideKeys,
|
|
16
19
|
registerOverlayPortal,
|
|
17
20
|
renderContext,
|
|
18
21
|
setDeep,
|
|
19
22
|
useGetPuck,
|
|
20
23
|
usePuck
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-E4BOPJJV.mjs";
|
|
25
|
+
import "./chunk-J32NOAUF.mjs";
|
|
22
26
|
import {
|
|
23
|
-
init_react_import,
|
|
24
27
|
migrate,
|
|
25
28
|
resolveAllData,
|
|
26
|
-
transformProps
|
|
29
|
+
transformProps
|
|
30
|
+
} from "./chunk-PJYARUPI.mjs";
|
|
31
|
+
import {
|
|
32
|
+
init_react_import,
|
|
27
33
|
walkTree
|
|
28
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-S3RM5GHZ.mjs";
|
|
29
35
|
|
|
30
36
|
// bundle/no-external.ts
|
|
31
37
|
init_react_import();
|
|
@@ -42,8 +48,11 @@ export {
|
|
|
42
48
|
Label,
|
|
43
49
|
Puck,
|
|
44
50
|
Render,
|
|
51
|
+
blocksPlugin,
|
|
45
52
|
createUsePuck,
|
|
53
|
+
fieldsPlugin,
|
|
46
54
|
migrate,
|
|
55
|
+
outlinePlugin,
|
|
47
56
|
overrideKeys,
|
|
48
57
|
registerOverlayPortal,
|
|
49
58
|
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 './
|
|
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 './actions-CaYAKtsG.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-B-Q2gpMX.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 './
|
|
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 './actions-CaYAKtsG.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-ksvZ7C4q.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
|
@@ -346,8 +346,9 @@ var Item = ({
|
|
|
346
346
|
);
|
|
347
347
|
};
|
|
348
348
|
var SlotRender = (0, import_react3.forwardRef)(
|
|
349
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
|
350
|
-
|
|
349
|
+
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
350
|
+
const El = as != null ? as : "div";
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
351
352
|
if (!config.components[item.type]) {
|
|
352
353
|
return null;
|
|
353
354
|
}
|
|
@@ -474,7 +475,7 @@ var getChanged = (newItem, oldItem) => {
|
|
|
474
475
|
// lib/resolve-component-data.ts
|
|
475
476
|
var import_fast_equals2 = require("fast-equals");
|
|
476
477
|
var cache = { lastChange: {} };
|
|
477
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
478
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
478
479
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
479
480
|
const resolvedItem = __spreadValues({}, item);
|
|
480
481
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -502,11 +503,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
502
503
|
let itemWithResolvedChildren = yield mapFields(
|
|
503
504
|
resolvedItem,
|
|
504
505
|
{
|
|
505
|
-
slot: (_02) => __async(
|
|
506
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
506
507
|
const content = value;
|
|
507
508
|
return yield Promise.all(
|
|
508
509
|
content.map(
|
|
509
|
-
(childItem) => __async(
|
|
510
|
+
(childItem) => __async(null, null, function* () {
|
|
510
511
|
return (yield resolveComponentData(
|
|
511
512
|
childItem,
|
|
512
513
|
config,
|
|
@@ -554,7 +555,7 @@ function resolveAllData(_0, _1) {
|
|
|
554
555
|
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
555
556
|
var _a;
|
|
556
557
|
const defaultedData = defaultData(data);
|
|
557
|
-
const resolveNode = (_node) => __async(
|
|
558
|
+
const resolveNode = (_node) => __async(null, null, function* () {
|
|
558
559
|
const node = toComponent(_node);
|
|
559
560
|
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
560
561
|
const resolved = (yield resolveComponentData(
|
|
@@ -575,13 +576,13 @@ function resolveAllData(_0, _1) {
|
|
|
575
576
|
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
576
577
|
return resolvedDeep;
|
|
577
578
|
});
|
|
578
|
-
const processContent = (content) => __async(
|
|
579
|
+
const processContent = (content) => __async(null, null, function* () {
|
|
579
580
|
return Promise.all(content.map(resolveNode));
|
|
580
581
|
});
|
|
581
|
-
const processZones = () => __async(
|
|
582
|
+
const processZones = () => __async(null, null, function* () {
|
|
582
583
|
var _a2;
|
|
583
584
|
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
584
|
-
Object.entries(zones).forEach((_02) => __async(
|
|
585
|
+
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
585
586
|
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
586
587
|
}));
|
|
587
588
|
return zones;
|
|
@@ -591,7 +592,7 @@ function resolveAllData(_0, _1) {
|
|
|
591
592
|
content: yield processContent(defaultedData.content),
|
|
592
593
|
zones: yield processZones()
|
|
593
594
|
};
|
|
594
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(
|
|
595
|
+
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
|
|
595
596
|
const content = defaultedData.zones[zoneKey];
|
|
596
597
|
dynamic.zones[zoneKey] = yield processContent(content);
|
|
597
598
|
}), {});
|
|
@@ -671,7 +672,8 @@ function transformProps(data, propTransforms, config = { components: {} }) {
|
|
|
671
672
|
var defaultViewports = [
|
|
672
673
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
673
674
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
674
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
675
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" },
|
|
676
|
+
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
675
677
|
];
|
|
676
678
|
|
|
677
679
|
// store/default-app-state.ts
|
|
@@ -693,7 +695,8 @@ var defaultAppState = {
|
|
|
693
695
|
options: [],
|
|
694
696
|
controlsVisible: true
|
|
695
697
|
},
|
|
696
|
-
field: { focus: null }
|
|
698
|
+
field: { focus: null },
|
|
699
|
+
plugin: { current: null }
|
|
697
700
|
},
|
|
698
701
|
indexes: {
|
|
699
702
|
nodes: {},
|
package/dist/rsc.mjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SlotRenderPure,
|
|
3
|
+
migrate,
|
|
4
|
+
resolveAllData,
|
|
5
|
+
transformProps,
|
|
6
|
+
useSlots
|
|
7
|
+
} from "./chunk-PJYARUPI.mjs";
|
|
8
|
+
import {
|
|
3
9
|
__spreadProps,
|
|
4
10
|
__spreadValues,
|
|
5
11
|
init_react_import,
|
|
6
|
-
migrate,
|
|
7
|
-
resolveAllData,
|
|
8
12
|
rootAreaId,
|
|
9
13
|
rootDroppableId,
|
|
10
14
|
rootZone,
|
|
11
15
|
setupZone,
|
|
12
|
-
transformProps,
|
|
13
|
-
useSlots,
|
|
14
16
|
walkTree
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-S3RM5GHZ.mjs";
|
|
16
18
|
|
|
17
19
|
// bundle/rsc.tsx
|
|
18
20
|
init_react_import();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-CaYAKtsG.mjs';
|
|
2
|
+
|
|
3
|
+
type MigrationOptions<UserConfig extends Config> = {
|
|
4
|
+
migrateDynamicZonesForComponent?: {
|
|
5
|
+
[ComponentName in keyof UserConfig["components"]]: (props: WithId<UserGenerics<UserConfig>["UserProps"][ComponentName]>, zones: Record<string, Content>) => ComponentData["props"];
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
declare function migrate<UserConfig extends Config = Config>(data: Data, config?: UserConfig, migrationOptions?: MigrationOptions<UserConfig>): Data;
|
|
9
|
+
|
|
10
|
+
type PropTransform<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
|
11
|
+
[ComponentName in keyof Components]: (props: Components[ComponentName] & {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}) => Components[ComponentName];
|
|
14
|
+
} & {
|
|
15
|
+
root: (props: RootProps & {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}) => RootProps;
|
|
18
|
+
}>;
|
|
19
|
+
declare function transformProps<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Components, RootProps>, config?: Config): Data;
|
|
20
|
+
|
|
21
|
+
declare function resolveAllData<Components extends DefaultComponents = DefaultComponents, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Components, RootProps>>;
|
|
22
|
+
|
|
23
|
+
type WalkTreeOptions = {
|
|
24
|
+
parentId: string;
|
|
25
|
+
propName: string;
|
|
26
|
+
};
|
|
27
|
+
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;
|
|
28
|
+
|
|
29
|
+
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { C as Config, D as Data, W as WithId, U as UserGenerics, b as Content, c as ComponentData, d as DefaultComponents, e as DefaultComponentProps, f as DefaultRootFieldProps, M as Metadata, R as RootData } from './actions-CaYAKtsG.js';
|
|
2
|
+
|
|
3
|
+
type MigrationOptions<UserConfig extends Config> = {
|
|
4
|
+
migrateDynamicZonesForComponent?: {
|
|
5
|
+
[ComponentName in keyof UserConfig["components"]]: (props: WithId<UserGenerics<UserConfig>["UserProps"][ComponentName]>, zones: Record<string, Content>) => ComponentData["props"];
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
declare function migrate<UserConfig extends Config = Config>(data: Data, config?: UserConfig, migrationOptions?: MigrationOptions<UserConfig>): Data;
|
|
9
|
+
|
|
10
|
+
type PropTransform<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
|
11
|
+
[ComponentName in keyof Components]: (props: Components[ComponentName] & {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}) => Components[ComponentName];
|
|
14
|
+
} & {
|
|
15
|
+
root: (props: RootProps & {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}) => RootProps;
|
|
18
|
+
}>;
|
|
19
|
+
declare function transformProps<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Components, RootProps>, config?: Config): Data;
|
|
20
|
+
|
|
21
|
+
declare function resolveAllData<Components extends DefaultComponents = DefaultComponents, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Components, RootProps>>;
|
|
22
|
+
|
|
23
|
+
type WalkTreeOptions = {
|
|
24
|
+
parentId: string;
|
|
25
|
+
propName: string;
|
|
26
|
+
};
|
|
27
|
+
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;
|
|
28
|
+
|
|
29
|
+
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@measured/puck",
|
|
3
|
-
"version": "0.21.0-canary.
|
|
3
|
+
"version": "0.21.0-canary.c0db75c1",
|
|
4
4
|
"description": "The open-source visual editor for React",
|
|
5
5
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
6
6
|
"repository": "measuredco/puck",
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
"import": "./dist/rsc.mjs",
|
|
46
46
|
"require": "./dist/rsc.js"
|
|
47
47
|
},
|
|
48
|
+
"./internal": {
|
|
49
|
+
"types": "./dist/internal.d.ts",
|
|
50
|
+
"import": "./dist/internal.mjs",
|
|
51
|
+
"require": "./dist/internal.js"
|
|
52
|
+
},
|
|
48
53
|
"./puck.css": "./dist/index.css",
|
|
49
54
|
"./no-external.css": "./dist/no-external.css",
|
|
50
55
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -60,7 +65,7 @@
|
|
|
60
65
|
"license": "MIT",
|
|
61
66
|
"scripts": {
|
|
62
67
|
"lint": "eslint \"**/*.ts*\"",
|
|
63
|
-
"build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts",
|
|
68
|
+
"build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts bundle/internal.ts",
|
|
64
69
|
"test": "jest",
|
|
65
70
|
"prepare": "cp ../../README.md . && yarn build",
|
|
66
71
|
"postpublish": "rm README.md"
|