@delmaredigital/payload-puck 0.1.0

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 (128) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +1580 -0
  3. package/dist/AccordionClient.d.mts +24 -0
  4. package/dist/AccordionClient.d.ts +24 -0
  5. package/dist/AccordionClient.js +786 -0
  6. package/dist/AccordionClient.js.map +1 -0
  7. package/dist/AccordionClient.mjs +784 -0
  8. package/dist/AccordionClient.mjs.map +1 -0
  9. package/dist/AnimatedWrapper.d.mts +30 -0
  10. package/dist/AnimatedWrapper.d.ts +30 -0
  11. package/dist/AnimatedWrapper.js +379 -0
  12. package/dist/AnimatedWrapper.js.map +1 -0
  13. package/dist/AnimatedWrapper.mjs +377 -0
  14. package/dist/AnimatedWrapper.mjs.map +1 -0
  15. package/dist/admin/client.d.mts +108 -0
  16. package/dist/admin/client.d.ts +108 -0
  17. package/dist/admin/client.js +177 -0
  18. package/dist/admin/client.js.map +1 -0
  19. package/dist/admin/client.mjs +173 -0
  20. package/dist/admin/client.mjs.map +1 -0
  21. package/dist/admin/index.d.mts +157 -0
  22. package/dist/admin/index.d.ts +157 -0
  23. package/dist/admin/index.js +31 -0
  24. package/dist/admin/index.js.map +1 -0
  25. package/dist/admin/index.mjs +29 -0
  26. package/dist/admin/index.mjs.map +1 -0
  27. package/dist/api/index.d.mts +460 -0
  28. package/dist/api/index.d.ts +460 -0
  29. package/dist/api/index.js +588 -0
  30. package/dist/api/index.js.map +1 -0
  31. package/dist/api/index.mjs +578 -0
  32. package/dist/api/index.mjs.map +1 -0
  33. package/dist/components/index.css +339 -0
  34. package/dist/components/index.css.map +1 -0
  35. package/dist/components/index.d.mts +222 -0
  36. package/dist/components/index.d.ts +222 -0
  37. package/dist/components/index.js +9177 -0
  38. package/dist/components/index.js.map +1 -0
  39. package/dist/components/index.mjs +9130 -0
  40. package/dist/components/index.mjs.map +1 -0
  41. package/dist/config/config.editor.css +339 -0
  42. package/dist/config/config.editor.css.map +1 -0
  43. package/dist/config/config.editor.d.mts +153 -0
  44. package/dist/config/config.editor.d.ts +153 -0
  45. package/dist/config/config.editor.js +9400 -0
  46. package/dist/config/config.editor.js.map +1 -0
  47. package/dist/config/config.editor.mjs +9368 -0
  48. package/dist/config/config.editor.mjs.map +1 -0
  49. package/dist/config/index.d.mts +68 -0
  50. package/dist/config/index.d.ts +68 -0
  51. package/dist/config/index.js +2017 -0
  52. package/dist/config/index.js.map +1 -0
  53. package/dist/config/index.mjs +1991 -0
  54. package/dist/config/index.mjs.map +1 -0
  55. package/dist/editor/index.d.mts +784 -0
  56. package/dist/editor/index.d.ts +784 -0
  57. package/dist/editor/index.js +4517 -0
  58. package/dist/editor/index.js.map +1 -0
  59. package/dist/editor/index.mjs +4483 -0
  60. package/dist/editor/index.mjs.map +1 -0
  61. package/dist/fields/index.css +339 -0
  62. package/dist/fields/index.css.map +1 -0
  63. package/dist/fields/index.d.mts +600 -0
  64. package/dist/fields/index.d.ts +600 -0
  65. package/dist/fields/index.js +7739 -0
  66. package/dist/fields/index.js.map +1 -0
  67. package/dist/fields/index.mjs +7590 -0
  68. package/dist/fields/index.mjs.map +1 -0
  69. package/dist/index-CQu6SzDg.d.mts +327 -0
  70. package/dist/index-CoUQnyC3.d.ts +327 -0
  71. package/dist/index.d.mts +6 -0
  72. package/dist/index.d.ts +6 -0
  73. package/dist/index.js +569 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/index.mjs +555 -0
  76. package/dist/index.mjs.map +1 -0
  77. package/dist/layouts/index.d.mts +96 -0
  78. package/dist/layouts/index.d.ts +96 -0
  79. package/dist/layouts/index.js +394 -0
  80. package/dist/layouts/index.js.map +1 -0
  81. package/dist/layouts/index.mjs +378 -0
  82. package/dist/layouts/index.mjs.map +1 -0
  83. package/dist/plugin/index.d.mts +289 -0
  84. package/dist/plugin/index.d.ts +289 -0
  85. package/dist/plugin/index.js +569 -0
  86. package/dist/plugin/index.js.map +1 -0
  87. package/dist/plugin/index.mjs +555 -0
  88. package/dist/plugin/index.mjs.map +1 -0
  89. package/dist/render/index.d.mts +109 -0
  90. package/dist/render/index.d.ts +109 -0
  91. package/dist/render/index.js +2146 -0
  92. package/dist/render/index.js.map +1 -0
  93. package/dist/render/index.mjs +2123 -0
  94. package/dist/render/index.mjs.map +1 -0
  95. package/dist/shared-DMAF1AcH.d.mts +545 -0
  96. package/dist/shared-DMAF1AcH.d.ts +545 -0
  97. package/dist/theme/index.d.mts +155 -0
  98. package/dist/theme/index.d.ts +155 -0
  99. package/dist/theme/index.js +201 -0
  100. package/dist/theme/index.js.map +1 -0
  101. package/dist/theme/index.mjs +186 -0
  102. package/dist/theme/index.mjs.map +1 -0
  103. package/dist/types-D7D3rZ1J.d.mts +116 -0
  104. package/dist/types-D7D3rZ1J.d.ts +116 -0
  105. package/dist/types-_6MvjyKv.d.mts +104 -0
  106. package/dist/types-_6MvjyKv.d.ts +104 -0
  107. package/dist/utils/index.d.mts +267 -0
  108. package/dist/utils/index.d.ts +267 -0
  109. package/dist/utils/index.js +426 -0
  110. package/dist/utils/index.js.map +1 -0
  111. package/dist/utils/index.mjs +412 -0
  112. package/dist/utils/index.mjs.map +1 -0
  113. package/dist/utils-DaRs9t0J.d.mts +85 -0
  114. package/dist/utils-gAvt0Vhw.d.ts +85 -0
  115. package/examples/README.md +240 -0
  116. package/examples/api/puck/pages/[id]/route.ts +64 -0
  117. package/examples/api/puck/pages/[id]/versions/route.ts +47 -0
  118. package/examples/api/puck/pages/route.ts +45 -0
  119. package/examples/app/(frontend)/page.tsx +94 -0
  120. package/examples/app/[...slug]/page.tsx +101 -0
  121. package/examples/app/pages/[id]/edit/page.tsx +148 -0
  122. package/examples/components/CustomBanner.tsx +368 -0
  123. package/examples/config/custom-config.ts +223 -0
  124. package/examples/config/payload.config.example.ts +64 -0
  125. package/examples/lib/puck-layouts.ts +258 -0
  126. package/examples/lib/puck-theme.ts +94 -0
  127. package/examples/styles/puck-theme.css +171 -0
  128. package/package.json +157 -0
@@ -0,0 +1,157 @@
1
+ import { Config, Plugin, Data } from '@measured/puck';
2
+ import { Field } from 'payload';
3
+
4
+ /**
5
+ * Props for the PuckEditorView component
6
+ */
7
+ interface PuckEditorViewProps {
8
+ /**
9
+ * Puck configuration with components and settings
10
+ */
11
+ config: Config;
12
+ /**
13
+ * Collection slug for API endpoints
14
+ * @default 'pages'
15
+ */
16
+ collectionSlug?: string;
17
+ /**
18
+ * Base API path for Puck operations
19
+ * @default '/api/puck'
20
+ */
21
+ apiBasePath?: string;
22
+ /**
23
+ * URL to navigate to when back button is clicked
24
+ * Falls back to /admin/collections/{collectionSlug}
25
+ */
26
+ backUrl?: string;
27
+ /**
28
+ * Preview URL or function to generate preview URL from slug
29
+ */
30
+ previewUrl?: string | ((slug: string) => string);
31
+ /**
32
+ * Layout styles for theme-aware preview
33
+ */
34
+ layoutStyles?: Record<string, {
35
+ background: string;
36
+ isDark: boolean;
37
+ }>;
38
+ /**
39
+ * Key in root.props to read layout value from
40
+ * @default 'pageLayout'
41
+ */
42
+ layoutKey?: string;
43
+ /**
44
+ * Additional Puck plugins to use.
45
+ * The headingAnalyzer plugin is included by default.
46
+ * Set to `false` to disable all default plugins.
47
+ */
48
+ plugins?: Plugin[] | false;
49
+ /**
50
+ * Callback on successful save
51
+ */
52
+ onSaveSuccess?: (data: Data) => void;
53
+ /**
54
+ * Callback on save error
55
+ */
56
+ onSaveError?: (error: Error) => void;
57
+ }
58
+
59
+ /**
60
+ * Props for EditWithPuckButton when used standalone
61
+ */
62
+ interface EditWithPuckButtonProps {
63
+ /**
64
+ * Document ID to edit
65
+ */
66
+ id?: string;
67
+ /**
68
+ * Collection slug
69
+ * @default 'pages'
70
+ */
71
+ collectionSlug?: string;
72
+ /**
73
+ * Custom path pattern for the Puck editor
74
+ * Use {id} as placeholder for the document ID
75
+ * @default '/pages/{id}/edit'
76
+ */
77
+ editorPathPattern?: string;
78
+ /**
79
+ * Button label
80
+ * @default 'Edit with Puck'
81
+ */
82
+ label?: string;
83
+ /**
84
+ * Whether to show as icon only
85
+ * @default false
86
+ */
87
+ iconOnly?: boolean;
88
+ }
89
+
90
+ /**
91
+ * Props for configuring the EditWithPuckCell component
92
+ */
93
+ interface EditWithPuckCellConfig {
94
+ /**
95
+ * Collection slug for building the editor URL
96
+ * @default 'pages'
97
+ */
98
+ collectionSlug?: string;
99
+ /**
100
+ * Custom editor path pattern
101
+ * Use {id} as placeholder for the document ID
102
+ * @default '/admin/puck/{collectionSlug}/{id}/edit'
103
+ */
104
+ editorPathPattern?: string;
105
+ }
106
+
107
+ /**
108
+ * Configuration for generating the edit button field
109
+ */
110
+ interface AdminComponentsConfig {
111
+ /**
112
+ * Collection slug for the pages collection
113
+ * @default 'pages'
114
+ */
115
+ collectionSlug?: string;
116
+ /**
117
+ * URL pattern for the Puck editor page
118
+ * Use {id} as placeholder for document ID
119
+ * @default '/pages/{id}/edit'
120
+ */
121
+ editorPathPattern?: string;
122
+ /**
123
+ * Button label text
124
+ * @default 'Edit with Puck'
125
+ */
126
+ buttonLabel?: string;
127
+ /**
128
+ * Position of the edit button in admin
129
+ * @default 'sidebar'
130
+ */
131
+ buttonPosition?: 'sidebar' | 'main';
132
+ }
133
+ /**
134
+ * Generates the UI field configuration for the Edit with Puck button
135
+ *
136
+ * Use this if you want to manually add the edit button field to your
137
+ * collection instead of using the plugin's auto-generation.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * import { generatePuckEditField } from '@delmaredigital/payload-puck/admin'
142
+ *
143
+ * const Pages: CollectionConfig = {
144
+ * slug: 'pages',
145
+ * fields: [
146
+ * // ... other fields
147
+ * generatePuckEditField({
148
+ * editorPathPattern: '/pages/{id}/edit',
149
+ * buttonLabel: 'Visual Editor',
150
+ * }),
151
+ * ],
152
+ * }
153
+ * ```
154
+ */
155
+ declare function generatePuckEditField(config?: AdminComponentsConfig): Field;
156
+
157
+ export { type AdminComponentsConfig, type EditWithPuckButtonProps, type EditWithPuckCellConfig, type PuckEditorViewProps, generatePuckEditField };
@@ -0,0 +1,157 @@
1
+ import { Config, Plugin, Data } from '@measured/puck';
2
+ import { Field } from 'payload';
3
+
4
+ /**
5
+ * Props for the PuckEditorView component
6
+ */
7
+ interface PuckEditorViewProps {
8
+ /**
9
+ * Puck configuration with components and settings
10
+ */
11
+ config: Config;
12
+ /**
13
+ * Collection slug for API endpoints
14
+ * @default 'pages'
15
+ */
16
+ collectionSlug?: string;
17
+ /**
18
+ * Base API path for Puck operations
19
+ * @default '/api/puck'
20
+ */
21
+ apiBasePath?: string;
22
+ /**
23
+ * URL to navigate to when back button is clicked
24
+ * Falls back to /admin/collections/{collectionSlug}
25
+ */
26
+ backUrl?: string;
27
+ /**
28
+ * Preview URL or function to generate preview URL from slug
29
+ */
30
+ previewUrl?: string | ((slug: string) => string);
31
+ /**
32
+ * Layout styles for theme-aware preview
33
+ */
34
+ layoutStyles?: Record<string, {
35
+ background: string;
36
+ isDark: boolean;
37
+ }>;
38
+ /**
39
+ * Key in root.props to read layout value from
40
+ * @default 'pageLayout'
41
+ */
42
+ layoutKey?: string;
43
+ /**
44
+ * Additional Puck plugins to use.
45
+ * The headingAnalyzer plugin is included by default.
46
+ * Set to `false` to disable all default plugins.
47
+ */
48
+ plugins?: Plugin[] | false;
49
+ /**
50
+ * Callback on successful save
51
+ */
52
+ onSaveSuccess?: (data: Data) => void;
53
+ /**
54
+ * Callback on save error
55
+ */
56
+ onSaveError?: (error: Error) => void;
57
+ }
58
+
59
+ /**
60
+ * Props for EditWithPuckButton when used standalone
61
+ */
62
+ interface EditWithPuckButtonProps {
63
+ /**
64
+ * Document ID to edit
65
+ */
66
+ id?: string;
67
+ /**
68
+ * Collection slug
69
+ * @default 'pages'
70
+ */
71
+ collectionSlug?: string;
72
+ /**
73
+ * Custom path pattern for the Puck editor
74
+ * Use {id} as placeholder for the document ID
75
+ * @default '/pages/{id}/edit'
76
+ */
77
+ editorPathPattern?: string;
78
+ /**
79
+ * Button label
80
+ * @default 'Edit with Puck'
81
+ */
82
+ label?: string;
83
+ /**
84
+ * Whether to show as icon only
85
+ * @default false
86
+ */
87
+ iconOnly?: boolean;
88
+ }
89
+
90
+ /**
91
+ * Props for configuring the EditWithPuckCell component
92
+ */
93
+ interface EditWithPuckCellConfig {
94
+ /**
95
+ * Collection slug for building the editor URL
96
+ * @default 'pages'
97
+ */
98
+ collectionSlug?: string;
99
+ /**
100
+ * Custom editor path pattern
101
+ * Use {id} as placeholder for the document ID
102
+ * @default '/admin/puck/{collectionSlug}/{id}/edit'
103
+ */
104
+ editorPathPattern?: string;
105
+ }
106
+
107
+ /**
108
+ * Configuration for generating the edit button field
109
+ */
110
+ interface AdminComponentsConfig {
111
+ /**
112
+ * Collection slug for the pages collection
113
+ * @default 'pages'
114
+ */
115
+ collectionSlug?: string;
116
+ /**
117
+ * URL pattern for the Puck editor page
118
+ * Use {id} as placeholder for document ID
119
+ * @default '/pages/{id}/edit'
120
+ */
121
+ editorPathPattern?: string;
122
+ /**
123
+ * Button label text
124
+ * @default 'Edit with Puck'
125
+ */
126
+ buttonLabel?: string;
127
+ /**
128
+ * Position of the edit button in admin
129
+ * @default 'sidebar'
130
+ */
131
+ buttonPosition?: 'sidebar' | 'main';
132
+ }
133
+ /**
134
+ * Generates the UI field configuration for the Edit with Puck button
135
+ *
136
+ * Use this if you want to manually add the edit button field to your
137
+ * collection instead of using the plugin's auto-generation.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * import { generatePuckEditField } from '@delmaredigital/payload-puck/admin'
142
+ *
143
+ * const Pages: CollectionConfig = {
144
+ * slug: 'pages',
145
+ * fields: [
146
+ * // ... other fields
147
+ * generatePuckEditField({
148
+ * editorPathPattern: '/pages/{id}/edit',
149
+ * buttonLabel: 'Visual Editor',
150
+ * }),
151
+ * ],
152
+ * }
153
+ * ```
154
+ */
155
+ declare function generatePuckEditField(config?: AdminComponentsConfig): Field;
156
+
157
+ export { type AdminComponentsConfig, type EditWithPuckButtonProps, type EditWithPuckCellConfig, type PuckEditorViewProps, generatePuckEditField };
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ // src/admin/generateAdminComponents.ts
4
+ function generatePuckEditField(config = {}) {
5
+ const {
6
+ collectionSlug = "pages",
7
+ editorPathPattern = "/pages/{id}/edit",
8
+ buttonLabel = "Edit with Puck",
9
+ buttonPosition = "sidebar"
10
+ } = config;
11
+ return {
12
+ name: "puckEdit",
13
+ type: "ui",
14
+ admin: {
15
+ position: buttonPosition,
16
+ components: {
17
+ Field: "@delmaredigital/payload-puck/admin/client#EditWithPuckButton",
18
+ Cell: "@delmaredigital/payload-puck/admin/client#EditWithPuckCell"
19
+ },
20
+ custom: {
21
+ collectionSlug,
22
+ editorPathPattern,
23
+ label: buttonLabel
24
+ }
25
+ }
26
+ };
27
+ }
28
+
29
+ exports.generatePuckEditField = generatePuckEditField;
30
+ //# sourceMappingURL=index.js.map
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/admin/generateAdminComponents.ts"],"names":[],"mappings":";;;AAmDO,SAAS,qBAAA,CAAsB,MAAA,GAAgC,EAAC,EAAU;AAC/E,EAAA,MAAM;AAAA,IACJ,cAAA,GAAiB,OAAA;AAAA,IACjB,iBAAA,GAAoB,kBAAA;AAAA,IACpB,WAAA,GAAc,gBAAA;AAAA,IACd,cAAA,GAAiB;AAAA,GACnB,GAAI,MAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM,IAAA;AAAA,IACN,KAAA,EAAO;AAAA,MACL,QAAA,EAAU,cAAA;AAAA,MACV,UAAA,EAAY;AAAA,QACV,KAAA,EAAO,8DAAA;AAAA,QACP,IAAA,EAAM;AAAA,OACR;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,cAAA;AAAA,QACA,iBAAA;AAAA,QACA,KAAA,EAAO;AAAA;AACT;AACF,GACF;AACF","file":"index.js","sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Configuration for generating the edit button field\n */\nexport interface AdminComponentsConfig {\n /**\n * Collection slug for the pages collection\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * URL pattern for the Puck editor page\n * Use {id} as placeholder for document ID\n * @default '/pages/{id}/edit'\n */\n editorPathPattern?: string\n /**\n * Button label text\n * @default 'Edit with Puck'\n */\n buttonLabel?: string\n /**\n * Position of the edit button in admin\n * @default 'sidebar'\n */\n buttonPosition?: 'sidebar' | 'main'\n}\n\n/**\n * Generates the UI field configuration for the Edit with Puck button\n *\n * Use this if you want to manually add the edit button field to your\n * collection instead of using the plugin's auto-generation.\n *\n * @example\n * ```ts\n * import { generatePuckEditField } from '@delmaredigital/payload-puck/admin'\n *\n * const Pages: CollectionConfig = {\n * slug: 'pages',\n * fields: [\n * // ... other fields\n * generatePuckEditField({\n * editorPathPattern: '/pages/{id}/edit',\n * buttonLabel: 'Visual Editor',\n * }),\n * ],\n * }\n * ```\n */\nexport function generatePuckEditField(config: AdminComponentsConfig = {}): Field {\n const {\n collectionSlug = 'pages',\n editorPathPattern = '/pages/{id}/edit',\n buttonLabel = 'Edit with Puck',\n buttonPosition = 'sidebar',\n } = config\n\n return {\n name: 'puckEdit',\n type: 'ui',\n admin: {\n position: buttonPosition,\n components: {\n Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',\n Cell: '@delmaredigital/payload-puck/admin/client#EditWithPuckCell',\n },\n custom: {\n collectionSlug,\n editorPathPattern,\n label: buttonLabel,\n },\n },\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ // src/admin/generateAdminComponents.ts
2
+ function generatePuckEditField(config = {}) {
3
+ const {
4
+ collectionSlug = "pages",
5
+ editorPathPattern = "/pages/{id}/edit",
6
+ buttonLabel = "Edit with Puck",
7
+ buttonPosition = "sidebar"
8
+ } = config;
9
+ return {
10
+ name: "puckEdit",
11
+ type: "ui",
12
+ admin: {
13
+ position: buttonPosition,
14
+ components: {
15
+ Field: "@delmaredigital/payload-puck/admin/client#EditWithPuckButton",
16
+ Cell: "@delmaredigital/payload-puck/admin/client#EditWithPuckCell"
17
+ },
18
+ custom: {
19
+ collectionSlug,
20
+ editorPathPattern,
21
+ label: buttonLabel
22
+ }
23
+ }
24
+ };
25
+ }
26
+
27
+ export { generatePuckEditField };
28
+ //# sourceMappingURL=index.mjs.map
29
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/admin/generateAdminComponents.ts"],"names":[],"mappings":";AAmDO,SAAS,qBAAA,CAAsB,MAAA,GAAgC,EAAC,EAAU;AAC/E,EAAA,MAAM;AAAA,IACJ,cAAA,GAAiB,OAAA;AAAA,IACjB,iBAAA,GAAoB,kBAAA;AAAA,IACpB,WAAA,GAAc,gBAAA;AAAA,IACd,cAAA,GAAiB;AAAA,GACnB,GAAI,MAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM,IAAA;AAAA,IACN,KAAA,EAAO;AAAA,MACL,QAAA,EAAU,cAAA;AAAA,MACV,UAAA,EAAY;AAAA,QACV,KAAA,EAAO,8DAAA;AAAA,QACP,IAAA,EAAM;AAAA,OACR;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,cAAA;AAAA,QACA,iBAAA;AAAA,QACA,KAAA,EAAO;AAAA;AACT;AACF,GACF;AACF","file":"index.mjs","sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Configuration for generating the edit button field\n */\nexport interface AdminComponentsConfig {\n /**\n * Collection slug for the pages collection\n * @default 'pages'\n */\n collectionSlug?: string\n /**\n * URL pattern for the Puck editor page\n * Use {id} as placeholder for document ID\n * @default '/pages/{id}/edit'\n */\n editorPathPattern?: string\n /**\n * Button label text\n * @default 'Edit with Puck'\n */\n buttonLabel?: string\n /**\n * Position of the edit button in admin\n * @default 'sidebar'\n */\n buttonPosition?: 'sidebar' | 'main'\n}\n\n/**\n * Generates the UI field configuration for the Edit with Puck button\n *\n * Use this if you want to manually add the edit button field to your\n * collection instead of using the plugin's auto-generation.\n *\n * @example\n * ```ts\n * import { generatePuckEditField } from '@delmaredigital/payload-puck/admin'\n *\n * const Pages: CollectionConfig = {\n * slug: 'pages',\n * fields: [\n * // ... other fields\n * generatePuckEditField({\n * editorPathPattern: '/pages/{id}/edit',\n * buttonLabel: 'Visual Editor',\n * }),\n * ],\n * }\n * ```\n */\nexport function generatePuckEditField(config: AdminComponentsConfig = {}): Field {\n const {\n collectionSlug = 'pages',\n editorPathPattern = '/pages/{id}/edit',\n buttonLabel = 'Edit with Puck',\n buttonPosition = 'sidebar',\n } = config\n\n return {\n name: 'puckEdit',\n type: 'ui',\n admin: {\n position: buttonPosition,\n components: {\n Field: '@delmaredigital/payload-puck/admin/client#EditWithPuckButton',\n Cell: '@delmaredigital/payload-puck/admin/client#EditWithPuckCell',\n },\n custom: {\n collectionSlug,\n editorPathPattern,\n label: buttonLabel,\n },\n },\n }\n}\n"]}