@puckeditor/core 0.21.0-canary.08cd0aca

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.
Files changed (52) hide show
  1. package/README.md +114 -0
  2. package/dist/Editor-IQP25PUX.css +404 -0
  3. package/dist/Editor-L7XD2QW3.mjs +204 -0
  4. package/dist/Render-3OV4N4MT.css +102 -0
  5. package/dist/Render-FXZX6NFH.mjs +55 -0
  6. package/dist/actions-BkBoKAc5.d.mts +838 -0
  7. package/dist/actions-BkBoKAc5.d.ts +838 -0
  8. package/dist/chunk-7TZD3NRP.mjs +450 -0
  9. package/dist/chunk-AHX7X7NZ.mjs +156 -0
  10. package/dist/chunk-AOEDIUVK.mjs +11 -0
  11. package/dist/chunk-GLWC4QRX.mjs +8074 -0
  12. package/dist/chunk-HLB66X4S.mjs +1813 -0
  13. package/dist/chunk-M6W7YEVX.mjs +95 -0
  14. package/dist/chunk-MNNPATDB.mjs +63 -0
  15. package/dist/chunk-QIJR53IK.mjs +528 -0
  16. package/dist/chunk-RYILZVCB.mjs +708 -0
  17. package/dist/chunk-UFXHMVJE.mjs +53 -0
  18. package/dist/chunk-V5I7CVLT.mjs +103 -0
  19. package/dist/chunk-WB2EIKOA.mjs +445 -0
  20. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  21. package/dist/chunk-YBJ32VYI.mjs +33 -0
  22. package/dist/chunk-ZPR7EC3T.mjs +111 -0
  23. package/dist/full-2GJTAAZE.css +301 -0
  24. package/dist/full-4UGAOTTB.mjs +93 -0
  25. package/dist/index-bqD1SEOb.d.mts +118 -0
  26. package/dist/index-lt1zf5WR.d.ts +118 -0
  27. package/dist/index.css +2629 -0
  28. package/dist/index.d.mts +309 -0
  29. package/dist/index.d.ts +309 -0
  30. package/dist/index.js +14191 -0
  31. package/dist/index.mjs +78 -0
  32. package/dist/internal.d.mts +27 -0
  33. package/dist/internal.d.ts +27 -0
  34. package/dist/internal.js +926 -0
  35. package/dist/internal.mjs +13 -0
  36. package/dist/loaded-5AM4V5PV.mjs +57 -0
  37. package/dist/loaded-G2WSQZO7.mjs +57 -0
  38. package/dist/loaded-MYALJBRK.mjs +60 -0
  39. package/dist/loaded-RVWBFK7L.css +87 -0
  40. package/dist/no-external.css +2631 -0
  41. package/dist/no-external.d.mts +21 -0
  42. package/dist/no-external.d.ts +21 -0
  43. package/dist/no-external.js +14194 -0
  44. package/dist/no-external.mjs +83 -0
  45. package/dist/rsc.css +102 -0
  46. package/dist/rsc.d.mts +27 -0
  47. package/dist/rsc.d.ts +27 -0
  48. package/dist/rsc.js +1444 -0
  49. package/dist/rsc.mjs +130 -0
  50. package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
  51. package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
  52. 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-WB2EIKOA.mjs";
9
+ import "./chunk-AOEDIUVK.mjs";
10
+ import "./chunk-AHX7X7NZ.mjs";
11
+ import "./chunk-Y2EFNT5P.mjs";
12
+ import {
13
+ rootAreaId,
14
+ rootDroppableId,
15
+ rootZone,
16
+ setupZone,
17
+ walkTree
18
+ } from "./chunk-7TZD3NRP.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.08cd0aca",
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
+ }