@puckeditor/core 0.21.0-canary.d1c0d6a2
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 +114 -0
- package/dist/Editor-32UYWE6W.mjs +204 -0
- package/dist/Editor-IQP25PUX.css +404 -0
- package/dist/Render-3OV4N4MT.css +102 -0
- package/dist/Render-FXZX6NFH.mjs +55 -0
- package/dist/actions-BkBoKAc5.d.mts +838 -0
- package/dist/actions-BkBoKAc5.d.ts +838 -0
- package/dist/chunk-3VQHXASI.mjs +33 -0
- package/dist/chunk-6KNQXLQR.mjs +708 -0
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/chunk-GVKHZNTR.mjs +53 -0
- package/dist/chunk-K562SEXI.mjs +1813 -0
- package/dist/chunk-KN3XDS7U.mjs +528 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MEL7FUSF.mjs +63 -0
- package/dist/chunk-NYGQH27S.mjs +445 -0
- package/dist/chunk-PSLS3ZEH.mjs +8074 -0
- package/dist/chunk-Q3TJ2VYO.mjs +436 -0
- package/dist/chunk-REWRIUGR.mjs +156 -0
- package/dist/chunk-V2IQTPPK.mjs +111 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-4OS3O57Y.mjs +93 -0
- package/dist/index-bqD1SEOb.d.mts +118 -0
- package/dist/index-lt1zf5WR.d.ts +118 -0
- package/dist/index.css +2629 -0
- package/dist/index.d.mts +309 -0
- package/dist/index.d.ts +309 -0
- package/dist/index.js +14177 -0
- package/dist/index.mjs +78 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-DCQVLO7I.mjs +57 -0
- package/dist/loaded-JGRO7BH7.mjs +57 -0
- package/dist/loaded-KKVJE5KH.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.css +2631 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +14180 -0
- package/dist/no-external.mjs +83 -0
- package/dist/rsc.css +102 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1445 -0
- package/dist/rsc.mjs +130 -0
- package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
- package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
- package/package.json +137 -0
package/dist/rsc.mjs
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SlotRenderPure,
|
|
3
|
+
migrate,
|
|
4
|
+
resolveAllData,
|
|
5
|
+
transformProps,
|
|
6
|
+
useRichtextProps,
|
|
7
|
+
useSlots
|
|
8
|
+
} from "./chunk-NYGQH27S.mjs";
|
|
9
|
+
import "./chunk-AOEDIUVK.mjs";
|
|
10
|
+
import "./chunk-REWRIUGR.mjs";
|
|
11
|
+
import "./chunk-Y2EFNT5P.mjs";
|
|
12
|
+
import {
|
|
13
|
+
rootAreaId,
|
|
14
|
+
rootDroppableId,
|
|
15
|
+
rootZone,
|
|
16
|
+
setupZone,
|
|
17
|
+
walkTree
|
|
18
|
+
} from "./chunk-Q3TJ2VYO.mjs";
|
|
19
|
+
import {
|
|
20
|
+
__spreadProps,
|
|
21
|
+
__spreadValues,
|
|
22
|
+
init_react_import
|
|
23
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
24
|
+
|
|
25
|
+
// bundle/rsc.tsx
|
|
26
|
+
init_react_import();
|
|
27
|
+
|
|
28
|
+
// components/ServerRender/index.tsx
|
|
29
|
+
init_react_import();
|
|
30
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
31
|
+
function DropZoneRender({
|
|
32
|
+
zone,
|
|
33
|
+
data,
|
|
34
|
+
areaId = "root",
|
|
35
|
+
config,
|
|
36
|
+
metadata = {}
|
|
37
|
+
}) {
|
|
38
|
+
let zoneCompound = rootDroppableId;
|
|
39
|
+
let content = (data == null ? void 0 : data.content) || [];
|
|
40
|
+
if (!data || !config) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (areaId !== rootAreaId && zone !== rootZone) {
|
|
44
|
+
zoneCompound = `${areaId}:${zone}`;
|
|
45
|
+
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsx(Fragment, { children: content.map((item) => {
|
|
48
|
+
const Component = config.components[item.type];
|
|
49
|
+
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
50
|
+
puck: {
|
|
51
|
+
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ jsx(
|
|
52
|
+
DropZoneRender,
|
|
53
|
+
{
|
|
54
|
+
zone: zone2,
|
|
55
|
+
data,
|
|
56
|
+
areaId: item.props.id,
|
|
57
|
+
config,
|
|
58
|
+
metadata
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
metadata,
|
|
62
|
+
dragRef: null,
|
|
63
|
+
isEditing: false
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
67
|
+
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ jsx(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
68
|
+
if (Component) {
|
|
69
|
+
return /* @__PURE__ */ jsx(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}) });
|
|
73
|
+
}
|
|
74
|
+
function Render({
|
|
75
|
+
config,
|
|
76
|
+
data,
|
|
77
|
+
metadata = {}
|
|
78
|
+
}) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const rootProps = "props" in data.root ? data.root.props : data.root;
|
|
81
|
+
const title = rootProps.title || "";
|
|
82
|
+
const props = __spreadProps(__spreadValues({}, rootProps), {
|
|
83
|
+
puck: {
|
|
84
|
+
renderDropZone: ({ zone }) => /* @__PURE__ */ jsx(
|
|
85
|
+
DropZoneRender,
|
|
86
|
+
{
|
|
87
|
+
zone,
|
|
88
|
+
data,
|
|
89
|
+
config,
|
|
90
|
+
metadata
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
isEditing: false,
|
|
94
|
+
dragRef: null,
|
|
95
|
+
metadata
|
|
96
|
+
},
|
|
97
|
+
title,
|
|
98
|
+
editMode: false,
|
|
99
|
+
id: "puck-root"
|
|
100
|
+
});
|
|
101
|
+
const propsWithSlots = useSlots(config, { type: "root", props }, (props2) => /* @__PURE__ */ jsx(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
|
102
|
+
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, props);
|
|
103
|
+
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
104
|
+
return /* @__PURE__ */ jsx(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ jsx(
|
|
105
|
+
DropZoneRender,
|
|
106
|
+
{
|
|
107
|
+
config,
|
|
108
|
+
data,
|
|
109
|
+
zone: rootZone,
|
|
110
|
+
metadata
|
|
111
|
+
}
|
|
112
|
+
) }));
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
DropZoneRender,
|
|
116
|
+
{
|
|
117
|
+
config,
|
|
118
|
+
data,
|
|
119
|
+
zone: rootZone,
|
|
120
|
+
metadata
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
Render,
|
|
126
|
+
migrate,
|
|
127
|
+
resolveAllData,
|
|
128
|
+
transformProps,
|
|
129
|
+
walkTree
|
|
130
|
+
};
|
|
@@ -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-BkBoKAc5.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-BkBoKAc5.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
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@puckeditor/core",
|
|
3
|
+
"version": "0.21.0-canary.d1c0d6a2",
|
|
4
|
+
"description": "The open-source visual editor for React",
|
|
5
|
+
"author": "Chris Villa <chris@puckeditor.com>",
|
|
6
|
+
"repository": "puckeditor/puck",
|
|
7
|
+
"bugs": "https://github.com/puckeditor/puck/issues",
|
|
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
|
+
],
|
|
27
|
+
"private": false,
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"react-server": {
|
|
33
|
+
"types": "./dist/rsc.d.ts",
|
|
34
|
+
"import": "./dist/rsc.mjs",
|
|
35
|
+
"require": "./dist/rsc.js"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.mjs",
|
|
40
|
+
"require": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"./rsc": {
|
|
44
|
+
"types": "./dist/rsc.d.ts",
|
|
45
|
+
"import": "./dist/rsc.mjs",
|
|
46
|
+
"require": "./dist/rsc.js"
|
|
47
|
+
},
|
|
48
|
+
"./internal": {
|
|
49
|
+
"types": "./dist/internal.d.ts",
|
|
50
|
+
"import": "./dist/internal.mjs",
|
|
51
|
+
"require": "./dist/internal.js"
|
|
52
|
+
},
|
|
53
|
+
"./puck.css": "./dist/index.css",
|
|
54
|
+
"./no-external.css": "./dist/no-external.css",
|
|
55
|
+
"./dist/index.css": "./dist/index.css",
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"typesVersions": {
|
|
59
|
+
"*": {
|
|
60
|
+
"rsc": [
|
|
61
|
+
"./dist/rsc.js"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"scripts": {
|
|
67
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
68
|
+
"build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts bundle/internal.ts",
|
|
69
|
+
"test": "jest",
|
|
70
|
+
"prepare": "cp ../../README.md . && yarn build",
|
|
71
|
+
"postpublish": "rm README.md"
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"dist"
|
|
75
|
+
],
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@juggle/resize-observer": "^3.4.0",
|
|
78
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
79
|
+
"@testing-library/react": "^16.1.0",
|
|
80
|
+
"@types/deep-diff": "^1.0.3",
|
|
81
|
+
"@types/flat": "^5.0.5",
|
|
82
|
+
"@types/jest": "^29.5.14",
|
|
83
|
+
"@types/object-hash": "^3.0.6",
|
|
84
|
+
"@types/react": "^19.2.7",
|
|
85
|
+
"@types/react-dom": "^19.2.3",
|
|
86
|
+
"@types/uuid": "^10.0.0",
|
|
87
|
+
"css-box-model": "^1.2.1",
|
|
88
|
+
"eslint": "^7.32.0",
|
|
89
|
+
"eslint-config-custom": "*",
|
|
90
|
+
"identity-obj-proxy": "^3.0.0",
|
|
91
|
+
"jest": "^29.7.0",
|
|
92
|
+
"jest-environment-jsdom": "^30.0.0-beta.3",
|
|
93
|
+
"lucide-react": "^0.468.0",
|
|
94
|
+
"ts-jest": "^29.3.4",
|
|
95
|
+
"tsconfig": "*",
|
|
96
|
+
"tsup": "^8.2.4",
|
|
97
|
+
"tsup-config": "*",
|
|
98
|
+
"typescript": "^5.5.4"
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"@dnd-kit/helpers": "0.1.18",
|
|
102
|
+
"@dnd-kit/react": "0.1.18",
|
|
103
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
104
|
+
"@tiptap/core": "^3.11.1",
|
|
105
|
+
"@tiptap/extension-blockquote": "^3.11.1",
|
|
106
|
+
"@tiptap/extension-bold": "^3.11.1",
|
|
107
|
+
"@tiptap/extension-code": "^3.11.1",
|
|
108
|
+
"@tiptap/extension-code-block": "^3.11.1",
|
|
109
|
+
"@tiptap/extension-document": "^3.11.1",
|
|
110
|
+
"@tiptap/extension-hard-break": "^3.11.1",
|
|
111
|
+
"@tiptap/extension-heading": "^3.11.1",
|
|
112
|
+
"@tiptap/extension-horizontal-rule": "^3.11.1",
|
|
113
|
+
"@tiptap/extension-italic": "^3.11.1",
|
|
114
|
+
"@tiptap/extension-link": "^3.11.1",
|
|
115
|
+
"@tiptap/extension-list": "^3.11.1",
|
|
116
|
+
"@tiptap/extension-paragraph": "^3.11.1",
|
|
117
|
+
"@tiptap/extension-strike": "^3.11.1",
|
|
118
|
+
"@tiptap/extension-text": "^3.11.1",
|
|
119
|
+
"@tiptap/extension-text-align": "^3.11.1",
|
|
120
|
+
"@tiptap/extension-underline": "^3.11.1",
|
|
121
|
+
"@tiptap/html": "^3.11.1",
|
|
122
|
+
"@tiptap/pm": "^3.11.1",
|
|
123
|
+
"@tiptap/react": "^3.11.1",
|
|
124
|
+
"deep-diff": "^1.0.2",
|
|
125
|
+
"fast-equals": "5.2.2",
|
|
126
|
+
"flat": "^5.0.2",
|
|
127
|
+
"happy-dom": "^20.0.10",
|
|
128
|
+
"object-hash": "^3.0.0",
|
|
129
|
+
"react-hotkeys-hook": "^4.6.1",
|
|
130
|
+
"use-debounce": "^9.0.4",
|
|
131
|
+
"uuid": "^9.0.1",
|
|
132
|
+
"zustand": "^5.0.3"
|
|
133
|
+
},
|
|
134
|
+
"peerDependencies": {
|
|
135
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
136
|
+
}
|
|
137
|
+
}
|