payload-nested-docs-page-tree 1.2.3 → 1.4.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 (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +136 -47
  3. package/dist/components/PageTreeContext.d.ts +13 -1
  4. package/dist/components/PageTreeContext.js +11 -1
  5. package/dist/components/PageTreeContext.js.map +1 -1
  6. package/dist/components/PageTreeListView.client.d.ts +3 -4
  7. package/dist/components/PageTreeListView.client.js +645 -381
  8. package/dist/components/PageTreeListView.client.js.map +1 -1
  9. package/dist/components/PageTreeListView.module.css +90 -67
  10. package/dist/components/PageTreeListView.server.js +18 -28
  11. package/dist/components/PageTreeListView.server.js.map +1 -1
  12. package/dist/components/PageTreeTitleCell.js +80 -18
  13. package/dist/components/PageTreeTitleCell.js.map +1 -1
  14. package/dist/endpoints/createMovePageEndpoint.d.ts +2 -0
  15. package/dist/endpoints/createMovePageEndpoint.js +166 -123
  16. package/dist/endpoints/createMovePageEndpoint.js.map +1 -1
  17. package/dist/endpoints/createReorderPageEndpoint.d.ts +8 -0
  18. package/dist/endpoints/createReorderPageEndpoint.js +703 -0
  19. package/dist/endpoints/createReorderPageEndpoint.js.map +1 -0
  20. package/dist/endpoints/shared.d.ts +40 -0
  21. package/dist/endpoints/shared.js +93 -0
  22. package/dist/endpoints/shared.js.map +1 -0
  23. package/dist/exports/client.js.map +1 -1
  24. package/dist/exports/rsc.js.map +1 -1
  25. package/dist/index.js +105 -26
  26. package/dist/index.js.map +1 -1
  27. package/dist/types.d.ts +9 -2
  28. package/dist/types.js +0 -2
  29. package/dist/types.js.map +1 -1
  30. package/dist/utilities/badgeConfig.js.map +1 -1
  31. package/dist/utilities/diagnostics.d.ts +42 -0
  32. package/dist/utilities/diagnostics.js +83 -0
  33. package/dist/utilities/diagnostics.js.map +1 -0
  34. package/dist/utilities/dropTargets.d.ts +2 -2
  35. package/dist/utilities/dropTargets.js +9 -7
  36. package/dist/utilities/dropTargets.js.map +1 -1
  37. package/dist/utilities/pageTree.js +4 -6
  38. package/dist/utilities/pageTree.js.map +1 -1
  39. package/dist/utilities/pageTreeCollision.d.ts +6 -0
  40. package/dist/utilities/pageTreeCollision.js +39 -4
  41. package/dist/utilities/pageTreeCollision.js.map +1 -1
  42. package/dist/utilities/pageTreeConfig.js.map +1 -1
  43. package/dist/utilities/status.d.ts +1 -1
  44. package/dist/utilities/status.js +7 -3
  45. package/dist/utilities/status.js.map +1 -1
  46. package/package.json +13 -12
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 WLF Studios
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WLF Studios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # Payload Nested Docs Page Tree
1
+ # payload-nested-docs-page-tree
2
2
 
3
3
  Companion admin plugin for [`@payloadcms/plugin-nested-docs`](https://payloadcms.com/docs/plugins/nested-docs).
4
4
 
5
- <p align="center">
6
- <img alt="Page tree demo" src="assets/page-tree.gif" width="100%" />
7
- </p>
5
+ <p align="center">
6
+ <img alt="Page tree admin overview" src="assets/page-tree-admin-overview.png" width="100%" />
7
+ </p>
8
8
 
9
- Adds a nested tree list view for nested docs collections in Payload admin, with drag-and-drop parent changes and status badges for published / changed / draft documents.
9
+ Adds a nested tree list view for nested docs collections in Payload admin, with visual hierarchy shading, live URL path previews, separate reorder and parent-move interactions, and status badges for published / changed / draft documents.
10
10
 
11
11
  It works alongside `@payloadcms/plugin-nested-docs`. It does not replace nested docs persistence, breadcrumbs generation, or routing.
12
12
 
13
- Tested with Payload `3.84.1` and Next.js `16.2`.
13
+ Tested with Payload `3.81` and Next.js `16.2`.
14
14
 
15
15
 
16
16
  ## Install
@@ -43,23 +43,67 @@ export const plugins = [
43
43
  ]
44
44
  ```
45
45
 
46
- If needed, refresh the admin import map:
46
+ Refresh the admin import map:
47
47
 
48
48
  ```bash
49
49
  payload generate:importmap
50
50
  ```
51
51
 
52
- ## What It Adds
53
-
54
- - replaces the collection list view with a nested tree table
55
- - preserves sorting, filters, pagination, bulk selection, and row actions
56
- - adds `POST /:id/move` for drag-and-drop parent changes
57
- - marks the root page with slug `home` using a home icon on the title link
58
- - hides the read-only breadcrumbs field by default
59
-
60
- ## Home Indicator
61
-
62
- By default, the home icon is enabled only for the `pages` collection.
52
+ ## What It Adds
53
+
54
+ - replaces the collection list view with a nested tree table
55
+ - adds visual hierarchy shading for nested pages
56
+ - shows the live URL path for each page
57
+ - preserves sorting, filters, pagination, bulk selection, and row actions
58
+ - adds `POST /:id/move` for intentional parent changes
59
+ - adds `POST /:id/reorder` for orderable-only sibling reordering
60
+ - keeps reorder drags scoped to the same parent or root level
61
+ - marks the root page with slug `home` using a home icon on the title link
62
+ - hides the read-only breadcrumbs field by default
63
+
64
+ ## Feature Preview
65
+
66
+ ### Visual hierarchy shading
67
+
68
+ <p align="center">
69
+ <img alt="Visual hierarchy shading for nested pages" src="assets/visual-hierarchy-shading.png" width="100%" />
70
+ </p>
71
+
72
+ ### Homepage icon
73
+
74
+ <p align="center">
75
+ <img alt="Homepage icon in the page tree" src="assets/homepage-icon.png" width="100%" />
76
+ </p>
77
+
78
+ ### Live URL path preview
79
+
80
+ <p align="center">
81
+ <img alt="Live URL path preview in the page tree" src="assets/live-url-path-preview.png" width="100%" />
82
+ </p>
83
+
84
+ ## Drag-And-Drop Modes
85
+
86
+ Parent moves and orderable reordering are separate interactions.
87
+
88
+ For collections using Payload `orderable`, the reorder handle is shown only when the current sort is the orderable field. Reordering only changes the order key and is limited to documents under the same parent, or documents at the root level. A reorder drag cannot change a document's parent.
89
+
90
+ [Watch the orderable-only reorder handle demo](assets/orderable-reorder-handle.mp4)
91
+
92
+ Parent moves are hidden by default because they change the page hierarchy. Editors can enable the parent-move handle with the `Edit Hierarchy` button when they intentionally want to move pages between parents. Drag a page onto another page to make it a child of that page. Drag it between root pages to move it back to the root level.
93
+
94
+ [Watch the edit hierarchy mode demo](assets/edit-hierarchy-mode.mp4)
95
+
96
+ [Watch the parent move to child demo](assets/parent-move-to-child.mp4)
97
+
98
+ [Watch the parent move back to root demo](assets/parent-move-to-root.mp4)
99
+
100
+ [Watch the same-parent reorder guard demo](assets/reorder-same-parent-only.mp4)
101
+
102
+ Internally, parent moves call this plugin's `/:id/move` endpoint. That endpoint updates the nested docs parent field through Payload's local API, while `@payloadcms/plugin-nested-docs` continues to own parent and breadcrumb behavior through its normal fields and hooks.
103
+
104
+ ## Home Indicator
105
+
106
+ By default, the home icon is enabled only for the `pages` collection.
63
107
 
64
108
  ```ts
65
109
  nestedDocsPageTreePlugin({
@@ -95,35 +139,90 @@ The tree view supports three document states:
95
139
  - `changed`: live, but has unpublished changes
96
140
  - `draft`: not published
97
141
 
98
- To override badge labels or colors, pass a `badges` object:
99
-
100
- ```ts
101
- nestedDocsPageTreePlugin({
142
+ Badge colors use Payload theme colors by default. To override badge labels or status colors, pass a `badges` object. Custom colors are treated as one base color per status and are adapted for both light and dark Payload themes:
143
+
144
+ <p align="center">
145
+ <img alt="Custom status badges in the page tree" src="assets/custom-status-badges.png" width="100%" />
146
+ </p>
147
+
148
+ ```ts
149
+ nestedDocsPageTreePlugin({
102
150
  collections: ['pages'],
103
151
  badges: {
104
- labels: {
105
- published: 'Live',
106
- changed: 'Has Changes',
107
- draft: 'Draft Only',
108
- },
109
152
  colors: {
110
- published: '#1e90ff',
111
- changed: '#9333ea',
112
- draft: '#dc2626',
153
+ // Example: use a custom green / blue / orange palette.
154
+ published: '#bbf3b0',
155
+ changed: '#b9eaf3',
156
+ draft: '#f8d5a7',
157
+ },
158
+ labels: {
159
+ // Example: use custom labels for states.
160
+ published: 'Live',
161
+ changed: 'Has Changes',
162
+ draft: 'Draft Only',
113
163
  },
114
164
  },
115
165
  }),
116
166
  ```
117
167
 
118
- `labels` and `colors` are optional partial overrides. Missing entries fall back to the built-in defaults.
168
+ `labels` and `colors` are optional partial overrides. Missing entries fall back to the built-in Payload-themed defaults for published, changed, and draft states.
169
+
170
+ ## Configuration
171
+
172
+ - `collections`: target collection slugs
173
+ - `parentFieldSlug`: defaults to `'parent'`
174
+ - `breadcrumbsFieldSlug`: defaults to `'breadcrumbs'`
175
+ - `defaultLimit`: defaults to `100`
176
+ - `hideBreadcrumbs`: defaults to `true`
177
+ - `disabled`: defaults to `false`
178
+ - `homeIndicator`: defaults to `{ collections: ['pages'] }`; set to `false` to disable
179
+ - `badges`: optional label and color overrides for `published`, `changed`, and `draft`
180
+ - `diagnostics`: defaults to `false`. Enables structured diagnostic logging for tree-related publish/draft regressions; see below.
181
+
182
+ ## Diagnostics Mode
183
+
184
+ If a page-tree move or reorder is doing something unexpected, enable diagnostics and reproduce. Each page-tree-triggered write emits one or more structured events on the dev server stdout:
185
+
186
+ <p align="center">
187
+ <img alt="Diagnostics mode structured logs" src="assets/diagnostics-mode-logs.png" width="100%" />
188
+ </p>
189
+
190
+ ```ts
191
+ nestedDocsPageTreePlugin({
192
+ collections: ['pages'],
193
+ diagnostics: true,
194
+ })
195
+ ```
196
+
197
+ Or with a custom sink:
198
+
199
+ ```ts
200
+ nestedDocsPageTreePlugin({
201
+ collections: ['pages'],
202
+ diagnostics: {
203
+ enabled: true,
204
+ logger: (event) => req.payload.logger.info({ pageTree: event }),
205
+ },
206
+ })
207
+ ```
208
+
209
+ Each event is one line tagged `[payload-nested-docs-page-tree]` followed by the event source (`move-endpoint:enter`, `move-endpoint:ok`, `move-endpoint:error`, `reorder-endpoint:enter`, `reorder-endpoint:ok`, `reorder-endpoint:error`, `page-tree-change:after`, `page-tree-change:status-flip`) and a JSON payload that includes:
210
+
211
+ - `flow`: id shared by every event for one logical operation
212
+ - `publishedMainRowBefore` / `publishedMainRowAfter`: fresh reads of the public/published row (`draft: false`)
213
+ - `before` / `after` / `changed`: projected diffs for `_status`, the parent field, and the orderable field when present
214
+
215
+ If the published main row goes from `published` to anything else as a result of a page-tree change, the plugin additionally emits a `page-tree-change:status-flip` WARN line.
216
+
217
+ Diagnostics is opt-in and adds extra reads per operation. Leave it off in production unless you are actively investigating.
119
218
 
120
219
  ## Drag-And-Drop Is Triggering A Deploy?
121
220
 
122
- A drag-and-drop move calls `payload.update()` on the draft only. The published version of the live site is never touched. So in most setups, dragging a page does not trigger any rebuild and you can skip this section.
221
+ A drag-and-drop parent move calls `payload.update()` on the draft only. The published version of the live site is never touched. So in most setups, dragging a page does not trigger any rebuild and you can skip this section.
123
222
 
124
223
  ### When you can skip this section
125
224
 
126
- - The default Payload website template on Vercel (or any host using Next.js ISR), with drafts and autosave on. The template's `afterChange` hook only calls `revalidatePath` and `revalidateTag` from `next/cache`. Those just clear the edge cache. They do not trigger a Vercel build, do not consume build minutes, and do not change what visitors see when the published HTML hasn't changed.
225
+ - The default Payload website template on Vercel (or any host using Next.js ISR), with drafts and autosave on. The template's `afterChange` hook only calls `revalidatePath` and `revalidateTag` from `next/cache`. Those just clear the edge cache. They do not trigger a Vercel build, do not consume build minutes, and do not change what visitors see when the published HTML has not changed.
127
226
  - Any setup where your `afterChange` hooks only do in-process cache work (`revalidatePath`, `revalidateTag`, in-memory caches, etc.).
128
227
 
129
228
  ### When you need the one-line fix
@@ -136,11 +235,11 @@ You need the fix if **you** wrote an `afterChange` hook that calls something ext
136
235
  - **Publish notifications** (email, Slack) on status transitions.
137
236
  - **Heavy search reindex jobs** (Algolia, Meilisearch full-document push).
138
237
 
139
- Why a tree move trips these: a typical deploy hook fires when `previousDoc?._status === 'published'` so that it catches unpublish events too. A tree move on a published doc matches that condition (the previous draft state was published) - but the live site hasn't actually changed. Without the fix, every drag fires your deploy.
238
+ Why a tree move trips these: a typical deploy hook fires when `previousDoc?._status === 'published'` so that it catches unpublish events too. A tree move on a published doc can match that condition, but the live site has not actually changed. Without the fix, every drag can fire your deploy.
140
239
 
141
240
  ### The fix
142
241
 
143
- Add one line at the top of your hook. The plugin sets a flag on Payload's [hook context](https://payloadcms.com/docs/hooks/context) for every move, and your hook reads it to bail out early:
242
+ Add one line at the top of your hook. The plugin sets a flag on Payload's [hook context](https://payloadcms.com/docs/hooks/context) for every page-tree parent move, and your hook reads it to bail out early:
144
243
 
145
244
  ```ts
146
245
  import { pageTreeMoveContextKey } from 'payload-nested-docs-page-tree'
@@ -155,6 +254,7 @@ Full example:
155
254
 
156
255
  ```ts
157
256
  import type { CollectionAfterChangeHook } from 'payload'
257
+
158
258
  import { pageTreeMoveContextKey } from 'payload-nested-docs-page-tree'
159
259
 
160
260
  export const triggerDeployOnPublishedChange: CollectionAfterChangeHook = async ({
@@ -173,18 +273,7 @@ export const triggerDeployOnPublishedChange: CollectionAfterChangeHook = async (
173
273
  }
174
274
  ```
175
275
 
176
- See `dev/lib/rebuild.ts` for the full reference example.
177
-
178
- ## Configuration
179
-
180
- - `collections`: target collection slugs
181
- - `parentFieldSlug`: defaults to `'parent'`
182
- - `breadcrumbsFieldSlug`: defaults to `'breadcrumbs'`
183
- - `defaultLimit`: defaults to `100`
184
- - `hideBreadcrumbs`: defaults to `true`
185
- - `homeIndicator`: defaults to `{ collections: ['pages'] }`; set to `false` to disable
186
- - `disabled`: defaults to `false`
187
- - `badges`: optional label and color overrides for `published`, `changed`, and `draft`
276
+ See `dev/lib/rebuild.ts` for the full Cloudflare deploy hook example used by the dev playground.
188
277
 
189
278
  ## Development
190
279
 
@@ -1,15 +1,27 @@
1
+ import type { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core';
1
2
  import React from 'react';
2
3
  type PageTreeContextValue = {
3
4
  activeDragRowID: null | string;
4
5
  canMoveDocs: boolean;
5
6
  collapsedIDs: ReadonlySet<string>;
6
- disableMoveDrag?: boolean;
7
+ parentMoveEnabled: boolean;
7
8
  pendingMoveRowID: null | string;
8
9
  toggleRow: (rowID: string) => void;
9
10
  };
11
+ type PageTreeRowDndContextValue = {
12
+ isOrderDragging: boolean;
13
+ orderHandleAttributes: DraggableAttributes;
14
+ orderHandleListeners: DraggableSyntheticListeners;
15
+ orderHandleRef: (element: HTMLElement | null) => void;
16
+ };
10
17
  export declare function PageTreeProvider({ children, value, }: {
11
18
  children: React.ReactNode;
12
19
  value: PageTreeContextValue;
13
20
  }): import("react/jsx-runtime").JSX.Element;
21
+ export declare function PageTreeRowDndProvider({ children, value, }: {
22
+ children: React.ReactNode;
23
+ value: PageTreeRowDndContextValue;
24
+ }): import("react/jsx-runtime").JSX.Element;
14
25
  export declare function usePageTree(): PageTreeContextValue;
26
+ export declare function usePageTreeRowDnd(): null | PageTreeRowDndContextValue;
15
27
  export {};
@@ -2,12 +2,19 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from 'react';
4
4
  const PageTreeContext = /*#__PURE__*/ React.createContext(null);
5
+ const PageTreeRowDndContext = /*#__PURE__*/ React.createContext(null);
5
6
  export function PageTreeProvider({ children, value }) {
6
7
  return /*#__PURE__*/ _jsx(PageTreeContext.Provider, {
7
8
  value: value,
8
9
  children: children
9
10
  });
10
11
  }
12
+ export function PageTreeRowDndProvider({ children, value }) {
13
+ return /*#__PURE__*/ _jsx(PageTreeRowDndContext.Provider, {
14
+ value: value,
15
+ children: children
16
+ });
17
+ }
11
18
  export function usePageTree() {
12
19
  const context = React.useContext(PageTreeContext);
13
20
  if (!context) {
@@ -15,12 +22,15 @@ export function usePageTree() {
15
22
  activeDragRowID: null,
16
23
  canMoveDocs: false,
17
24
  collapsedIDs: new Set(),
18
- disableMoveDrag: false,
25
+ parentMoveEnabled: false,
19
26
  pendingMoveRowID: null,
20
27
  toggleRow: ()=>{}
21
28
  };
22
29
  }
23
30
  return context;
24
31
  }
32
+ export function usePageTreeRowDnd() {
33
+ return React.useContext(PageTreeRowDndContext);
34
+ }
25
35
 
26
36
  //# sourceMappingURL=PageTreeContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/PageTreeContext.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\ntype PageTreeContextValue = {\n activeDragRowID: null | string\n canMoveDocs: boolean\n collapsedIDs: ReadonlySet<string>\n disableMoveDrag?: boolean\n pendingMoveRowID: null | string\n toggleRow: (rowID: string) => void\n}\n\nconst PageTreeContext = React.createContext<null | PageTreeContextValue>(null)\n\nexport function PageTreeProvider({\n children,\n value,\n}: {\n children: React.ReactNode\n value: PageTreeContextValue\n}) {\n return <PageTreeContext.Provider value={value}>{children}</PageTreeContext.Provider>\n}\n\nexport function usePageTree(): PageTreeContextValue {\n const context = React.useContext(PageTreeContext)\n\n if (!context) {\n return {\n activeDragRowID: null,\n canMoveDocs: false,\n collapsedIDs: new Set<string>(),\n disableMoveDrag: false,\n pendingMoveRowID: null,\n toggleRow: () => {},\n }\n }\n\n return context\n}\n"],"names":["React","PageTreeContext","createContext","PageTreeProvider","children","value","Provider","usePageTree","context","useContext","activeDragRowID","canMoveDocs","collapsedIDs","Set","disableMoveDrag","pendingMoveRowID","toggleRow"],"mappings":"AAAA;;AAEA,OAAOA,WAAW,QAAO;AAWzB,MAAMC,gCAAkBD,MAAME,aAAa,CAA8B;AAEzE,OAAO,SAASC,iBAAiB,EAC/BC,QAAQ,EACRC,KAAK,EAIN;IACC,qBAAO,KAACJ,gBAAgBK,QAAQ;QAACD,OAAOA;kBAAQD;;AAClD;AAEA,OAAO,SAASG;IACd,MAAMC,UAAUR,MAAMS,UAAU,CAACR;IAEjC,IAAI,CAACO,SAAS;QACZ,OAAO;YACLE,iBAAiB;YACjBC,aAAa;YACbC,cAAc,IAAIC;YAClBC,iBAAiB;YACjBC,kBAAkB;YAClBC,WAAW,KAAO;QACpB;IACF;IAEA,OAAOR;AACT"}
1
+ {"version":3,"sources":["../../src/components/PageTreeContext.tsx"],"sourcesContent":["'use client'\r\n\r\nimport type { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core'\r\n\r\nimport React from 'react'\r\n\r\ntype PageTreeContextValue = {\r\n activeDragRowID: null | string\r\n canMoveDocs: boolean\r\n collapsedIDs: ReadonlySet<string>\r\n parentMoveEnabled: boolean\r\n pendingMoveRowID: null | string\r\n toggleRow: (rowID: string) => void\r\n}\r\n\r\ntype PageTreeRowDndContextValue = {\r\n isOrderDragging: boolean\r\n orderHandleAttributes: DraggableAttributes\r\n orderHandleListeners: DraggableSyntheticListeners\r\n orderHandleRef: (element: HTMLElement | null) => void\r\n}\r\n\r\nconst PageTreeContext = React.createContext<null | PageTreeContextValue>(null)\r\nconst PageTreeRowDndContext = React.createContext<null | PageTreeRowDndContextValue>(null)\r\n\r\nexport function PageTreeProvider({\r\n children,\r\n value,\r\n}: {\r\n children: React.ReactNode\r\n value: PageTreeContextValue\r\n}) {\r\n return <PageTreeContext.Provider value={value}>{children}</PageTreeContext.Provider>\r\n}\r\n\r\nexport function PageTreeRowDndProvider({\r\n children,\r\n value,\r\n}: {\r\n children: React.ReactNode\r\n value: PageTreeRowDndContextValue\r\n}) {\r\n return <PageTreeRowDndContext.Provider value={value}>{children}</PageTreeRowDndContext.Provider>\r\n}\r\n\r\nexport function usePageTree(): PageTreeContextValue {\r\n const context = React.useContext(PageTreeContext)\r\n\r\n if (!context) {\r\n return {\r\n activeDragRowID: null,\r\n canMoveDocs: false,\r\n collapsedIDs: new Set<string>(),\r\n parentMoveEnabled: false,\r\n pendingMoveRowID: null,\r\n toggleRow: () => {},\r\n }\r\n }\r\n\r\n return context\r\n}\r\n\r\nexport function usePageTreeRowDnd(): null | PageTreeRowDndContextValue {\r\n return React.useContext(PageTreeRowDndContext)\r\n}\r\n"],"names":["React","PageTreeContext","createContext","PageTreeRowDndContext","PageTreeProvider","children","value","Provider","PageTreeRowDndProvider","usePageTree","context","useContext","activeDragRowID","canMoveDocs","collapsedIDs","Set","parentMoveEnabled","pendingMoveRowID","toggleRow","usePageTreeRowDnd"],"mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAkBzB,MAAMC,gCAAkBD,MAAME,aAAa,CAA8B;AACzE,MAAMC,sCAAwBH,MAAME,aAAa,CAAoC;AAErF,OAAO,SAASE,iBAAiB,EAC/BC,QAAQ,EACRC,KAAK,EAIN;IACC,qBAAO,KAACL,gBAAgBM,QAAQ;QAACD,OAAOA;kBAAQD;;AAClD;AAEA,OAAO,SAASG,uBAAuB,EACrCH,QAAQ,EACRC,KAAK,EAIN;IACC,qBAAO,KAACH,sBAAsBI,QAAQ;QAACD,OAAOA;kBAAQD;;AACxD;AAEA,OAAO,SAASI;IACd,MAAMC,UAAUV,MAAMW,UAAU,CAACV;IAEjC,IAAI,CAACS,SAAS;QACZ,OAAO;YACLE,iBAAiB;YACjBC,aAAa;YACbC,cAAc,IAAIC;YAClBC,mBAAmB;YACnBC,kBAAkB;YAClBC,WAAW,KAAO;QACpB;IACF;IAEA,OAAOR;AACT;AAEA,OAAO,SAASS;IACd,OAAOnB,MAAMW,UAAU,CAACR;AAC1B"}
@@ -1,7 +1,7 @@
1
1
  import type { Column, ListQuery, ListViewClientProps } from 'payload';
2
- import { type NestedDocsPageTreePluginResolvedBadgeConfig, type PageTreeSourceDoc } from '../types.js';
2
+ import type { NestedDocsPageTreePluginResolvedBadgeConfig, PageTreeSourceDoc } from '../types.js';
3
3
  import { type PageTreeDoc } from '../utilities/pageTree.js';
4
- type PageTreeListViewClientOwnProps = {
4
+ type PageTreeListViewClientProps = {
5
5
  allDocs: PageTreeDoc[];
6
6
  badgeConfig: NestedDocsPageTreePluginResolvedBadgeConfig;
7
7
  canMoveDocs: boolean;
@@ -12,7 +12,6 @@ type PageTreeListViewClientOwnProps = {
12
12
  query: ListQuery;
13
13
  sourceDocs: PageTreeSourceDoc[];
14
14
  useAsTitle: string;
15
- };
16
- type PageTreeListViewClientProps = Omit<ListViewClientProps, 'columnState' | 'Table'> & PageTreeListViewClientOwnProps;
15
+ } & Omit<ListViewClientProps, 'columnState' | 'Table'>;
17
16
  export default function PageTreeListViewClient({ allDocs, badgeConfig, canMoveDocs, columnState, homeIndicatorEnabled, orderableFieldName, parentFieldSlug, query, sourceDocs, useAsTitle, ...props }: PageTreeListViewClientProps): import("react/jsx-runtime").JSX.Element;
18
17
  export {};