@rnaga/wp-next-admin 1.0.1

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 (405) hide show
  1. package/README.md +292 -0
  2. package/client/components/RootLayout.d.ts +13 -0
  3. package/client/components/RootLayout.d.ts.map +1 -0
  4. package/client/components/RootLayout.js +13 -0
  5. package/client/components/WrapperRootLayout.d.ts +9 -0
  6. package/client/components/WrapperRootLayout.d.ts.map +1 -0
  7. package/client/components/WrapperRootLayout.js +5 -0
  8. package/client/components/contents/blogs/Create.d.ts +2 -0
  9. package/client/components/contents/blogs/Create.d.ts.map +1 -0
  10. package/client/components/contents/blogs/Create.js +67 -0
  11. package/client/components/contents/blogs/Edit.d.ts +2 -0
  12. package/client/components/contents/blogs/Edit.d.ts.map +1 -0
  13. package/client/components/contents/blogs/Edit.js +144 -0
  14. package/client/components/contents/blogs/List.d.ts +2 -0
  15. package/client/components/contents/blogs/List.d.ts.map +1 -0
  16. package/client/components/contents/blogs/List.js +56 -0
  17. package/client/components/contents/blogs/index.d.ts +6 -0
  18. package/client/components/contents/blogs/index.d.ts.map +1 -0
  19. package/client/components/contents/blogs/index.js +8 -0
  20. package/client/components/contents/comments/ActionLink.d.ts +5 -0
  21. package/client/components/contents/comments/ActionLink.d.ts.map +1 -0
  22. package/client/components/contents/comments/ActionLink.js +67 -0
  23. package/client/components/contents/comments/List/Reply.d.ts +5 -0
  24. package/client/components/contents/comments/List/Reply.d.ts.map +1 -0
  25. package/client/components/contents/comments/List/Reply.js +33 -0
  26. package/client/components/contents/comments/List/Row.d.ts +5 -0
  27. package/client/components/contents/comments/List/Row.d.ts.map +1 -0
  28. package/client/components/contents/comments/List/Row.js +30 -0
  29. package/client/components/contents/comments/List/Toolbar.d.ts +8 -0
  30. package/client/components/contents/comments/List/Toolbar.d.ts.map +1 -0
  31. package/client/components/contents/comments/List/Toolbar.js +14 -0
  32. package/client/components/contents/comments/List/index.d.ts +5 -0
  33. package/client/components/contents/comments/List/index.d.ts.map +1 -0
  34. package/client/components/contents/comments/List/index.js +38 -0
  35. package/client/components/contents/comments/index.d.ts +7 -0
  36. package/client/components/contents/comments/index.d.ts.map +1 -0
  37. package/client/components/contents/comments/index.js +6 -0
  38. package/client/components/contents/dashboard/index.d.ts +2 -0
  39. package/client/components/contents/dashboard/index.d.ts.map +1 -0
  40. package/client/components/contents/dashboard/index.js +123 -0
  41. package/client/components/contents/index.d.ts +46 -0
  42. package/client/components/contents/index.d.ts.map +1 -0
  43. package/client/components/contents/index.js +28 -0
  44. package/client/components/contents/media/Edit.d.ts +2 -0
  45. package/client/components/contents/media/Edit.d.ts.map +1 -0
  46. package/client/components/contents/media/Edit.js +86 -0
  47. package/client/components/contents/media/List/ActionLink.d.ts +5 -0
  48. package/client/components/contents/media/List/ActionLink.d.ts.map +1 -0
  49. package/client/components/contents/media/List/ActionLink.js +24 -0
  50. package/client/components/contents/media/List/Table.d.ts +5 -0
  51. package/client/components/contents/media/List/Table.d.ts.map +1 -0
  52. package/client/components/contents/media/List/Table.js +38 -0
  53. package/client/components/contents/media/List/Thumbnail.d.ts +5 -0
  54. package/client/components/contents/media/List/Thumbnail.d.ts.map +1 -0
  55. package/client/components/contents/media/List/Thumbnail.js +28 -0
  56. package/client/components/contents/media/List/index.d.ts +2 -0
  57. package/client/components/contents/media/List/index.d.ts.map +1 -0
  58. package/client/components/contents/media/List/index.js +66 -0
  59. package/client/components/contents/media/index.d.ts +5 -0
  60. package/client/components/contents/media/index.d.ts.map +1 -0
  61. package/client/components/contents/media/index.js +6 -0
  62. package/client/components/contents/pages/Edit/Settings.d.ts +2 -0
  63. package/client/components/contents/pages/Edit/Settings.d.ts.map +1 -0
  64. package/client/components/contents/pages/Edit/Settings.js +17 -0
  65. package/client/components/contents/pages/Edit/Toolbar.d.ts +2 -0
  66. package/client/components/contents/pages/Edit/Toolbar.d.ts.map +1 -0
  67. package/client/components/contents/pages/Edit/Toolbar.js +72 -0
  68. package/client/components/contents/pages/Edit/index.d.ts +2 -0
  69. package/client/components/contents/pages/Edit/index.d.ts.map +1 -0
  70. package/client/components/contents/pages/Edit/index.js +43 -0
  71. package/client/components/contents/pages/List/ActionLink.d.ts +5 -0
  72. package/client/components/contents/pages/List/ActionLink.d.ts.map +1 -0
  73. package/client/components/contents/pages/List/ActionLink.js +12 -0
  74. package/client/components/contents/pages/List/Statuses.d.ts +2 -0
  75. package/client/components/contents/pages/List/Statuses.d.ts.map +1 -0
  76. package/client/components/contents/pages/List/Statuses.js +24 -0
  77. package/client/components/contents/pages/List/Toolbar.d.ts +8 -0
  78. package/client/components/contents/pages/List/Toolbar.d.ts.map +1 -0
  79. package/client/components/contents/pages/List/Toolbar.js +14 -0
  80. package/client/components/contents/pages/List/index.d.ts +2 -0
  81. package/client/components/contents/pages/List/index.d.ts.map +1 -0
  82. package/client/components/contents/pages/List/index.js +45 -0
  83. package/client/components/contents/pages/index.d.ts +5 -0
  84. package/client/components/contents/pages/index.d.ts.map +1 -0
  85. package/client/components/contents/pages/index.js +6 -0
  86. package/client/components/contents/posts/Edit/Settings.d.ts +2 -0
  87. package/client/components/contents/posts/Edit/Settings.d.ts.map +1 -0
  88. package/client/components/contents/posts/Edit/Settings.js +19 -0
  89. package/client/components/contents/posts/Edit/Toolbar.d.ts +2 -0
  90. package/client/components/contents/posts/Edit/Toolbar.d.ts.map +1 -0
  91. package/client/components/contents/posts/Edit/Toolbar.js +72 -0
  92. package/client/components/contents/posts/Edit/index.d.ts +2 -0
  93. package/client/components/contents/posts/Edit/index.d.ts.map +1 -0
  94. package/client/components/contents/posts/Edit/index.js +43 -0
  95. package/client/components/contents/posts/List/ActionLink.d.ts +5 -0
  96. package/client/components/contents/posts/List/ActionLink.d.ts.map +1 -0
  97. package/client/components/contents/posts/List/ActionLink.js +12 -0
  98. package/client/components/contents/posts/List/Statuses.d.ts +2 -0
  99. package/client/components/contents/posts/List/Statuses.d.ts.map +1 -0
  100. package/client/components/contents/posts/List/Statuses.js +32 -0
  101. package/client/components/contents/posts/List/Toolbar.d.ts +8 -0
  102. package/client/components/contents/posts/List/Toolbar.d.ts.map +1 -0
  103. package/client/components/contents/posts/List/Toolbar.js +14 -0
  104. package/client/components/contents/posts/List/index.d.ts +2 -0
  105. package/client/components/contents/posts/List/index.d.ts.map +1 -0
  106. package/client/components/contents/posts/List/index.js +46 -0
  107. package/client/components/contents/posts/index.d.ts +5 -0
  108. package/client/components/contents/posts/index.d.ts.map +1 -0
  109. package/client/components/contents/posts/index.js +6 -0
  110. package/client/components/contents/profile/index.d.ts +2 -0
  111. package/client/components/contents/profile/index.d.ts.map +1 -0
  112. package/client/components/contents/profile/index.js +7 -0
  113. package/client/components/contents/revisions/List/History.d.ts +7 -0
  114. package/client/components/contents/revisions/List/History.d.ts.map +1 -0
  115. package/client/components/contents/revisions/List/History.js +37 -0
  116. package/client/components/contents/revisions/List/diff2html.css +11 -0
  117. package/client/components/contents/revisions/List/index.d.ts +9 -0
  118. package/client/components/contents/revisions/List/index.d.ts.map +1 -0
  119. package/client/components/contents/revisions/List/index.js +145 -0
  120. package/client/components/contents/revisions/index.d.ts +2 -0
  121. package/client/components/contents/revisions/index.d.ts.map +1 -0
  122. package/client/components/contents/revisions/index.js +1 -0
  123. package/client/components/contents/roles/List/EditModal.d.ts +8 -0
  124. package/client/components/contents/roles/List/EditModal.d.ts.map +1 -0
  125. package/client/components/contents/roles/List/EditModal.js +153 -0
  126. package/client/components/contents/roles/List/index.d.ts +7 -0
  127. package/client/components/contents/roles/List/index.d.ts.map +1 -0
  128. package/client/components/contents/roles/List/index.js +111 -0
  129. package/client/components/contents/roles/index.d.ts +2 -0
  130. package/client/components/contents/roles/index.d.ts.map +1 -0
  131. package/client/components/contents/roles/index.js +1 -0
  132. package/client/components/contents/settings/index.d.ts +2 -0
  133. package/client/components/contents/settings/index.d.ts.map +1 -0
  134. package/client/components/contents/settings/index.js +67 -0
  135. package/client/components/contents/sites/Create.d.ts +2 -0
  136. package/client/components/contents/sites/Create.d.ts.map +1 -0
  137. package/client/components/contents/sites/Create.js +53 -0
  138. package/client/components/contents/sites/Delete.d.ts +2 -0
  139. package/client/components/contents/sites/Delete.d.ts.map +1 -0
  140. package/client/components/contents/sites/Delete.js +125 -0
  141. package/client/components/contents/sites/Edit.d.ts +2 -0
  142. package/client/components/contents/sites/Edit.d.ts.map +1 -0
  143. package/client/components/contents/sites/Edit.js +120 -0
  144. package/client/components/contents/sites/List.d.ts +2 -0
  145. package/client/components/contents/sites/List.d.ts.map +1 -0
  146. package/client/components/contents/sites/List.js +33 -0
  147. package/client/components/contents/sites/index.d.ts +7 -0
  148. package/client/components/contents/sites/index.d.ts.map +1 -0
  149. package/client/components/contents/sites/index.js +10 -0
  150. package/client/components/contents/terms/List/ActionLink.d.ts +5 -0
  151. package/client/components/contents/terms/List/ActionLink.d.ts.map +1 -0
  152. package/client/components/contents/terms/List/ActionLink.js +44 -0
  153. package/client/components/contents/terms/List/Toolbar.d.ts +8 -0
  154. package/client/components/contents/terms/List/Toolbar.d.ts.map +1 -0
  155. package/client/components/contents/terms/List/Toolbar.js +20 -0
  156. package/client/components/contents/terms/List/index.d.ts +18 -0
  157. package/client/components/contents/terms/List/index.d.ts.map +1 -0
  158. package/client/components/contents/terms/List/index.js +94 -0
  159. package/client/components/contents/terms/index.d.ts +2 -0
  160. package/client/components/contents/terms/index.d.ts.map +1 -0
  161. package/client/components/contents/terms/index.js +1 -0
  162. package/client/components/contents/users/Create.d.ts +2 -0
  163. package/client/components/contents/users/Create.d.ts.map +1 -0
  164. package/client/components/contents/users/Create.js +47 -0
  165. package/client/components/contents/users/Delete.d.ts +2 -0
  166. package/client/components/contents/users/Delete.d.ts.map +1 -0
  167. package/client/components/contents/users/Delete.js +113 -0
  168. package/client/components/contents/users/Edit/Profile/GenerateResetLinkModal.d.ts +6 -0
  169. package/client/components/contents/users/Edit/Profile/GenerateResetLinkModal.d.ts.map +1 -0
  170. package/client/components/contents/users/Edit/Profile/GenerateResetLinkModal.js +40 -0
  171. package/client/components/contents/users/Edit/Profile/ResetPasswordModal.d.ts +6 -0
  172. package/client/components/contents/users/Edit/Profile/ResetPasswordModal.d.ts.map +1 -0
  173. package/client/components/contents/users/Edit/Profile/ResetPasswordModal.js +41 -0
  174. package/client/components/contents/users/Edit/Profile/index.d.ts +4 -0
  175. package/client/components/contents/users/Edit/Profile/index.d.ts.map +1 -0
  176. package/client/components/contents/users/Edit/Profile/index.js +111 -0
  177. package/client/components/contents/users/Edit/Roles/ActionLink.d.ts +6 -0
  178. package/client/components/contents/users/Edit/Roles/ActionLink.d.ts.map +1 -0
  179. package/client/components/contents/users/Edit/Roles/ActionLink.js +63 -0
  180. package/client/components/contents/users/Edit/Roles/Add.d.ts +5 -0
  181. package/client/components/contents/users/Edit/Roles/Add.d.ts.map +1 -0
  182. package/client/components/contents/users/Edit/Roles/Add.js +60 -0
  183. package/client/components/contents/users/Edit/Roles/Edit.d.ts +8 -0
  184. package/client/components/contents/users/Edit/Roles/Edit.d.ts.map +1 -0
  185. package/client/components/contents/users/Edit/Roles/Edit.js +53 -0
  186. package/client/components/contents/users/Edit/Roles/Roles.d.ts +4 -0
  187. package/client/components/contents/users/Edit/Roles/Roles.d.ts.map +1 -0
  188. package/client/components/contents/users/Edit/Roles/Roles.js +41 -0
  189. package/client/components/contents/users/Edit/Roles/context.d.ts +9 -0
  190. package/client/components/contents/users/Edit/Roles/context.d.ts.map +1 -0
  191. package/client/components/contents/users/Edit/Roles/context.js +2 -0
  192. package/client/components/contents/users/Edit/Roles/index.d.ts +3 -0
  193. package/client/components/contents/users/Edit/Roles/index.d.ts.map +1 -0
  194. package/client/components/contents/users/Edit/Roles/index.js +2 -0
  195. package/client/components/contents/users/Edit/index.d.ts +4 -0
  196. package/client/components/contents/users/Edit/index.d.ts.map +1 -0
  197. package/client/components/contents/users/Edit/index.js +66 -0
  198. package/client/components/contents/users/List/CountRoles.d.ts +2 -0
  199. package/client/components/contents/users/List/CountRoles.d.ts.map +1 -0
  200. package/client/components/contents/users/List/CountRoles.js +68 -0
  201. package/client/components/contents/users/List/Toolbar.d.ts +10 -0
  202. package/client/components/contents/users/List/Toolbar.d.ts.map +1 -0
  203. package/client/components/contents/users/List/Toolbar.js +32 -0
  204. package/client/components/contents/users/List/index.d.ts +2 -0
  205. package/client/components/contents/users/List/index.d.ts.map +1 -0
  206. package/client/components/contents/users/List/index.js +30 -0
  207. package/client/components/contents/users/index.d.ts +9 -0
  208. package/client/components/contents/users/index.d.ts.map +1 -0
  209. package/client/components/contents/users/index.js +10 -0
  210. package/client/components/layout/Layout.d.ts +3 -0
  211. package/client/components/layout/Layout.d.ts.map +1 -0
  212. package/client/components/layout/Layout.js +69 -0
  213. package/client/components/layout/Main.d.ts +2 -0
  214. package/client/components/layout/Main.d.ts.map +1 -0
  215. package/client/components/layout/Main.js +12 -0
  216. package/client/components/layout/Overlay.d.ts +2 -0
  217. package/client/components/layout/Overlay.d.ts.map +1 -0
  218. package/client/components/layout/Overlay.js +49 -0
  219. package/client/components/layout/Title.d.ts +2 -0
  220. package/client/components/layout/Title.d.ts.map +1 -0
  221. package/client/components/layout/Title.js +19 -0
  222. package/client/components/layout/WrapperLayout.d.ts +2 -0
  223. package/client/components/layout/WrapperLayout.d.ts.map +1 -0
  224. package/client/components/layout/WrapperLayout.js +5 -0
  225. package/client/components/layout/header/Profile.d.ts +2 -0
  226. package/client/components/layout/header/Profile.d.ts.map +1 -0
  227. package/client/components/layout/header/Profile.js +66 -0
  228. package/client/components/layout/header/index.d.ts +2 -0
  229. package/client/components/layout/header/index.d.ts.map +1 -0
  230. package/client/components/layout/header/index.js +176 -0
  231. package/client/components/layout/sidebar/Collapse.d.ts +4 -0
  232. package/client/components/layout/sidebar/Collapse.d.ts.map +1 -0
  233. package/client/components/layout/sidebar/Collapse.js +53 -0
  234. package/client/components/layout/sidebar/Menus.d.ts +5 -0
  235. package/client/components/layout/sidebar/Menus.d.ts.map +1 -0
  236. package/client/components/layout/sidebar/Menus.js +76 -0
  237. package/client/components/layout/sidebar/index.d.ts +2 -0
  238. package/client/components/layout/sidebar/index.d.ts.map +1 -0
  239. package/client/components/layout/sidebar/index.js +86 -0
  240. package/client/components/utils/ErrorFallback.d.ts +6 -0
  241. package/client/components/utils/ErrorFallback.d.ts.map +1 -0
  242. package/client/components/utils/ErrorFallback.js +36 -0
  243. package/client/components/utils/dropdown/SelectWPAvailableSite.d.ts +7 -0
  244. package/client/components/utils/dropdown/SelectWPAvailableSite.d.ts.map +1 -0
  245. package/client/components/utils/dropdown/SelectWPAvailableSite.js +58 -0
  246. package/client/components/utils/dropdown/SelectWPSite.d.ts +5 -0
  247. package/client/components/utils/dropdown/SelectWPSite.d.ts.map +1 -0
  248. package/client/components/utils/dropdown/SelectWPSite.js +27 -0
  249. package/client/components/utils/dropdown/index.d.ts +2 -0
  250. package/client/components/utils/dropdown/index.d.ts.map +1 -0
  251. package/client/components/utils/dropdown/index.js +1 -0
  252. package/client/components/utils/index.d.ts +2 -0
  253. package/client/components/utils/index.d.ts.map +1 -0
  254. package/client/components/utils/index.js +1 -0
  255. package/client/components/utils/link/AdminLink.d.ts +46 -0
  256. package/client/components/utils/link/AdminLink.d.ts.map +1 -0
  257. package/client/components/utils/link/AdminLink.js +61 -0
  258. package/client/components/utils/link/index.d.ts +2 -0
  259. package/client/components/utils/link/index.d.ts.map +1 -0
  260. package/client/components/utils/link/index.js +2 -0
  261. package/client/components/utils/modal/CommentModal.d.ts +2 -0
  262. package/client/components/utils/modal/CommentModal.d.ts.map +1 -0
  263. package/client/components/utils/modal/CommentModal.js +53 -0
  264. package/client/components/utils/modal/TermModal.d.ts +10 -0
  265. package/client/components/utils/modal/TermModal.d.ts.map +1 -0
  266. package/client/components/utils/modal/TermModal.js +70 -0
  267. package/client/components/utils/modal/index.d.ts +3 -0
  268. package/client/components/utils/modal/index.d.ts.map +1 -0
  269. package/client/components/utils/modal/index.js +2 -0
  270. package/client/components/utils/post/PostPanel.d.ts +15 -0
  271. package/client/components/utils/post/PostPanel.d.ts.map +1 -0
  272. package/client/components/utils/post/PostPanel.js +70 -0
  273. package/client/components/utils/post/index.d.ts +4 -0
  274. package/client/components/utils/post/index.d.ts.map +1 -0
  275. package/client/components/utils/post/index.js +3 -0
  276. package/client/components/utils/post/link/PostActionLink.d.ts +9 -0
  277. package/client/components/utils/post/link/PostActionLink.d.ts.map +1 -0
  278. package/client/components/utils/post/link/PostActionLink.js +90 -0
  279. package/client/components/utils/post/link/PostRowLinks.d.ts +8 -0
  280. package/client/components/utils/post/link/PostRowLinks.d.ts.map +1 -0
  281. package/client/components/utils/post/link/PostRowLinks.js +30 -0
  282. package/client/components/utils/post/link/index.d.ts +3 -0
  283. package/client/components/utils/post/link/index.d.ts.map +1 -0
  284. package/client/components/utils/post/link/index.js +2 -0
  285. package/client/components/utils/post/settings/Categories.d.ts +2 -0
  286. package/client/components/utils/post/settings/Categories.d.ts.map +1 -0
  287. package/client/components/utils/post/settings/Categories.js +23 -0
  288. package/client/components/utils/post/settings/Discussion.d.ts +2 -0
  289. package/client/components/utils/post/settings/Discussion.d.ts.map +1 -0
  290. package/client/components/utils/post/settings/Discussion.js +25 -0
  291. package/client/components/utils/post/settings/Excerpt.d.ts +2 -0
  292. package/client/components/utils/post/settings/Excerpt.d.ts.map +1 -0
  293. package/client/components/utils/post/settings/Excerpt.js +9 -0
  294. package/client/components/utils/post/settings/FeaturedImage.d.ts +2 -0
  295. package/client/components/utils/post/settings/FeaturedImage.d.ts.map +1 -0
  296. package/client/components/utils/post/settings/FeaturedImage.js +63 -0
  297. package/client/components/utils/post/settings/PageAttributes.d.ts +2 -0
  298. package/client/components/utils/post/settings/PageAttributes.d.ts.map +1 -0
  299. package/client/components/utils/post/settings/PageAttributes.js +23 -0
  300. package/client/components/utils/post/settings/Revisions.d.ts +2 -0
  301. package/client/components/utils/post/settings/Revisions.d.ts.map +1 -0
  302. package/client/components/utils/post/settings/Revisions.js +44 -0
  303. package/client/components/utils/post/settings/Summary.d.ts +2 -0
  304. package/client/components/utils/post/settings/Summary.d.ts.map +1 -0
  305. package/client/components/utils/post/settings/Summary.js +58 -0
  306. package/client/components/utils/post/settings/Tags.d.ts +2 -0
  307. package/client/components/utils/post/settings/Tags.d.ts.map +1 -0
  308. package/client/components/utils/post/settings/Tags.js +11 -0
  309. package/client/components/utils/post/settings/index.d.ts +9 -0
  310. package/client/components/utils/post/settings/index.d.ts.map +1 -0
  311. package/client/components/utils/post/settings/index.js +8 -0
  312. package/client/hooks/index.d.ts +6 -0
  313. package/client/hooks/index.d.ts.map +1 -0
  314. package/client/hooks/index.js +5 -0
  315. package/client/hooks/use-admin-navigation.d.ts +39 -0
  316. package/client/hooks/use-admin-navigation.d.ts.map +1 -0
  317. package/client/hooks/use-admin-navigation.js +61 -0
  318. package/client/hooks/use-admin-server-actions.d.ts +49 -0
  319. package/client/hooks/use-admin-server-actions.d.ts.map +1 -0
  320. package/client/hooks/use-admin-server-actions.js +13 -0
  321. package/client/hooks/use-admin-user.d.ts +130 -0
  322. package/client/hooks/use-admin-user.d.ts.map +1 -0
  323. package/client/hooks/use-admin-user.js +19 -0
  324. package/client/hooks/use-current-menu.d.ts +3 -0
  325. package/client/hooks/use-current-menu.d.ts.map +1 -0
  326. package/client/hooks/use-current-menu.js +37 -0
  327. package/client/hooks/use-sidebar.d.ts +27 -0
  328. package/client/hooks/use-sidebar.d.ts.map +1 -0
  329. package/client/hooks/use-sidebar.js +51 -0
  330. package/client/hooks/use-sites.d.ts +136 -0
  331. package/client/hooks/use-sites.d.ts.map +1 -0
  332. package/client/hooks/use-sites.js +43 -0
  333. package/client/utils/get-default-admin-hooks.d.ts +3 -0
  334. package/client/utils/get-default-admin-hooks.d.ts.map +1 -0
  335. package/client/utils/get-default-admin-hooks.js +3 -0
  336. package/client/utils/index.d.ts +2 -0
  337. package/client/utils/index.d.ts.map +1 -0
  338. package/client/utils/index.js +1 -0
  339. package/client/wp-admin/initial-global-state.d.ts +5 -0
  340. package/client/wp-admin/initial-global-state.d.ts.map +1 -0
  341. package/client/wp-admin/initial-global-state.js +46 -0
  342. package/client/wp-admin/use-comment.d.ts +55 -0
  343. package/client/wp-admin/use-comment.d.ts.map +1 -0
  344. package/client/wp-admin/use-comment.js +32 -0
  345. package/client/wp-admin/use-overlay.d.ts +28 -0
  346. package/client/wp-admin/use-overlay.d.ts.map +1 -0
  347. package/client/wp-admin/use-overlay.js +89 -0
  348. package/client/wp-admin.d.ts +27 -0
  349. package/client/wp-admin.d.ts.map +1 -0
  350. package/client/wp-admin.js +49 -0
  351. package/client/wp-hooks/index.d.ts +5 -0
  352. package/client/wp-hooks/index.d.ts.map +1 -0
  353. package/client/wp-hooks/index.js +5 -0
  354. package/client/wp-hooks/menu-blog.hook.d.ts +11 -0
  355. package/client/wp-hooks/menu-blog.hook.d.ts.map +1 -0
  356. package/client/wp-hooks/menu-blog.hook.js +236 -0
  357. package/client/wp-hooks/menu-site.hook.d.ts +11 -0
  358. package/client/wp-hooks/menu-site.hook.d.ts.map +1 -0
  359. package/client/wp-hooks/menu-site.hook.js +171 -0
  360. package/client/wp-hooks/preload-modal.hook.d.ts +10 -0
  361. package/client/wp-hooks/preload-modal.hook.d.ts.map +1 -0
  362. package/client/wp-hooks/preload-modal.hook.js +45 -0
  363. package/client/wp-hooks/themes.hook.d.ts +9 -0
  364. package/client/wp-hooks/themes.hook.d.ts.map +1 -0
  365. package/client/wp-hooks/themes.hook.js +32 -0
  366. package/package.json +64 -0
  367. package/server/actions/dashboard.d.ts +141 -0
  368. package/server/actions/dashboard.d.ts.map +1 -0
  369. package/server/actions/dashboard.js +52 -0
  370. package/server/components/Page.d.ts +2 -0
  371. package/server/components/Page.d.ts.map +1 -0
  372. package/server/components/Page.js +3 -0
  373. package/server/components/RootLayout.d.ts +5 -0
  374. package/server/components/RootLayout.d.ts.map +1 -0
  375. package/server/components/RootLayout.js +57 -0
  376. package/server/components/RootPage.d.ts +2 -0
  377. package/server/components/RootPage.d.ts.map +1 -0
  378. package/server/components/RootPage.js +19 -0
  379. package/server/utils/get-default-admin-hooks.d.ts +3 -0
  380. package/server/utils/get-default-admin-hooks.d.ts.map +1 -0
  381. package/server/utils/get-default-admin-hooks.js +4 -0
  382. package/server/utils/index.d.ts +2 -0
  383. package/server/utils/index.d.ts.map +1 -0
  384. package/server/utils/index.js +1 -0
  385. package/server/wp-admin.d.ts +40 -0
  386. package/server/wp-admin.d.ts.map +1 -0
  387. package/server/wp-admin.js +58 -0
  388. package/server/wp-hooks/index.d.ts +3 -0
  389. package/server/wp-hooks/index.d.ts.map +1 -0
  390. package/server/wp-hooks/index.js +3 -0
  391. package/server/wp-hooks/next-admin-init.hook.d.ts +15 -0
  392. package/server/wp-hooks/next-admin-init.hook.d.ts.map +1 -0
  393. package/server/wp-hooks/next-admin-init.hook.js +65 -0
  394. package/types/client/form-data.d.ts +27 -0
  395. package/types/client/global-ref.d.ts +7 -0
  396. package/types/client/global-state.d.ts +78 -0
  397. package/types/client/index.d.ts +5 -0
  398. package/types/client/menus.d.ts +39 -0
  399. package/types/client.d.ts +40 -0
  400. package/types/hooks/actions.d.ts +4 -0
  401. package/types/hooks/filters.d.ts +39 -0
  402. package/types/hooks/index.d.ts +2 -0
  403. package/types/index.d.ts +4 -0
  404. package/types/server-actions.d.ts +21 -0
  405. package/types/theme.d.ts +33 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/media/List/Table.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAC9D,eAAO,MAAM,KAAK,GAAI,OAAO;IAC3B,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAC9C,mDAgGA,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AccordionDetails } from "@mui/material";
4
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
5
+ import { Accordion, AccordionSummary } from "@rnaga/wp-next-ui/Accordion";
6
+ import { CardImage } from "@rnaga/wp-next-ui/CardImage";
7
+ import { Viewport } from "@rnaga/wp-next-ui/Viewport";
8
+ import { formatting } from "@rnaga/wp-node/common/formatting";
9
+ import { AdminLink } from "../../../../components/utils/link";
10
+ import { ActionTd, ListGrid, ListGridItem, SortableTh, Table as TableList, Td, Th, THead, Tr, } from "@rnaga/wp-next-ui/list";
11
+ import { PostRowLinks } from "../../../../components/utils/post";
12
+ import { useWPAdmin } from "../../../../wp-admin";
13
+ import { ActionLink } from "./ActionLink";
14
+ export const Table = (props) => {
15
+ const { posts } = props;
16
+ const { wp: { viewport, globalState }, } = useWPAdmin();
17
+ const { user } = useUser();
18
+ const handleClick = (post) => () => {
19
+ globalState.set({
20
+ "media-edit-modal": {
21
+ open: true,
22
+ },
23
+ "media-target-item": {
24
+ post,
25
+ },
26
+ });
27
+ };
28
+ const canEdit = (post) => user?.ID == post.author.ID ||
29
+ user?.role.capabilities.has("edit_others_posts");
30
+ if (!posts) {
31
+ return null;
32
+ }
33
+ return (_jsxs(TableList, { children: [_jsxs(THead, { children: [_jsx(Th, { style: { width: "25%" }, children: "File" }), _jsx(SortableTh, { style: { width: viewport.isDesktop ? "35%" : "75%" }, name: "Title", orderby: "post_name" }), _jsx(Th, { viewport: "desktop", children: "Author" }), _jsx(Th, { viewport: "desktop", children: " " }), _jsx(SortableTh, { viewport: "desktop", name: "Date", orderby: "post_date" })] }), _jsx("tbody", { children: posts.map((post) => (_jsxs(Tr, { children: [_jsx(Td, { children: _jsx(CardImage, { src: post.guid, alt: post.post_title, sx: {
34
+ minWidth: 150,
35
+ maxWidth: 200,
36
+ cursor: canEdit(post) ? "pointer" : "inherit",
37
+ }, onClick: canEdit(post) ? handleClick(post) : undefined }) }), _jsxs(ActionTd, { children: [_jsx(Viewport, { device: "desktop", children: post.post_title }), _jsx(Viewport, { device: "desktop", children: _jsx(ActionLink, { post: post }) })] }), _jsx(Td, { viewport: "mobile", children: _jsxs(Accordion, { disableGutters: true, elevation: 0, square: true, expanded: true, children: [_jsxs(AccordionSummary, { children: [" ", _jsx(AdminLink, { subPage: "/edit", queryParams: { id: post.ID }, disabled: !canEdit(post), children: post.post_title })] }), _jsxs(AccordionDetails, { children: [_jsx(ActionLink, { post: post }), _jsxs(ListGrid, { children: [_jsx(ListGridItem, { title: "Author", children: _jsx(PostRowLinks, { row: post, field: "actor" }) }), _jsx(ListGridItem, { title: "Date", children: formatting.date(post.post_date) })] })] })] }) }), _jsx(Td, { viewport: "desktop", children: _jsx(PostRowLinks, { row: post, field: "actor" }) }), _jsx(Td, { viewport: "desktop", children: post.comment_count }), _jsx(Td, { viewport: "desktop", children: formatting.date(post.post_date) })] }, post.ID))) })] }));
38
+ };
@@ -0,0 +1,5 @@
1
+ import type * as wpCoreTypes from "@rnaga/wp-next-core/types";
2
+ export declare const Thumbnail: (props: {
3
+ posts: wpCoreTypes.actions.Posts | undefined;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=Thumbnail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thumbnail.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/media/List/Thumbnail.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAE9D,eAAO,MAAM,SAAS,GAAI,OAAO;IAC/B,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAC9C,4CAyCA,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Grid } from "@mui/material";
4
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
5
+ import { CardImage } from "@rnaga/wp-next-ui/CardImage";
6
+ import { useWPAdmin } from "../../../../wp-admin";
7
+ export const Thumbnail = (props) => {
8
+ const { posts } = props;
9
+ const { wp: { globalState }, } = useWPAdmin();
10
+ const { user } = useUser();
11
+ const handleClick = (post) => () => {
12
+ globalState.set({
13
+ "media-edit-modal": {
14
+ open: true,
15
+ },
16
+ "media-target-item": {
17
+ post,
18
+ },
19
+ });
20
+ };
21
+ const canEdit = (post) => user?.ID == post.author.ID ||
22
+ user?.role.capabilities.has("edit_others_posts");
23
+ return (_jsx(Grid, { container: true, spacing: 1, columns: { xs: 2, sm: 12, md: 12, xl: 12 }, children: posts?.map((post) => (_jsx(Grid, { gap: 0, size: { xs: 1, sm: 4, md: 3, xl: 2 }, children: _jsx(CardImage, { src: post.guid, alt: post.post_title, sx: {
24
+ width: "100%",
25
+ maxHeight: 150,
26
+ cursor: canEdit(post) ? "pointer" : "inherit",
27
+ }, onClick: canEdit(post) ? handleClick(post) : undefined }) }, post.ID))) }));
28
+ };
@@ -0,0 +1,2 @@
1
+ export declare const List: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/media/List/index.tsx"],"names":[],"mappings":"AAuBA,eAAO,MAAM,IAAI,+CAmHhB,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState, useTransition } from "react";
4
+ import FileUploadIcon from "@mui/icons-material/FileUpload";
5
+ import SearchIcon from "@mui/icons-material/Search";
6
+ import TableViewIcon from "@mui/icons-material/TableView";
7
+ import ViewListIcon from "@mui/icons-material/ViewList";
8
+ import { Box, IconButton, Stack } from "@mui/material";
9
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
10
+ import { Button } from "@rnaga/wp-next-ui/Button";
11
+ import { Input } from "@rnaga/wp-next-ui/Input";
12
+ import { Pagination } from "@rnaga/wp-next-ui/list/Pagination";
13
+ import { Loading } from "@rnaga/wp-next-ui/Loading";
14
+ import { MediaUpload } from "@rnaga/wp-next-ui/media/MediaUpload";
15
+ import { useAdminNavigation } from "../../../../hooks/use-admin-navigation";
16
+ import { useAdminServerActions } from "../../../../hooks/use-admin-server-actions";
17
+ import { useWPAdmin } from "../../../../wp-admin";
18
+ import { Table } from "./Table";
19
+ import { Thumbnail } from "./Thumbnail";
20
+ export const List = () => {
21
+ const { wp: { viewport, globalState }, } = useWPAdmin();
22
+ const { user } = useUser();
23
+ const { actions, parse } = useAdminServerActions();
24
+ const { updateRouter, queryObject, navigationStatus, refreshValue, refresh } = useAdminNavigation();
25
+ const { overlay } = useWPAdmin();
26
+ const [listType, setListType] = useState("thumbnail");
27
+ const mediaTargetItemState = globalState.get("media-target-item");
28
+ const mediaUploadState = globalState.get("media-upload");
29
+ const [{ posts, info }, setPosts] = useState({
30
+ posts: undefined,
31
+ info: undefined,
32
+ });
33
+ const [loading, startTransition] = useTransition();
34
+ useEffect(() => {
35
+ startTransition(async () => {
36
+ const [posts, info] = await actions.post
37
+ .list({ ...queryObject, status: ["inherit"], per_page: 20 }, { postTypes: ["attachment"] })
38
+ .then(parse);
39
+ setPosts({ posts, info });
40
+ });
41
+ }, [navigationStatus, refreshValue().content]);
42
+ useEffect(() => {
43
+ if (!mediaTargetItemState?.post || !posts) {
44
+ return;
45
+ }
46
+ for (const [index, post] of Object.entries(posts)) {
47
+ if (post.ID === mediaTargetItemState.post.ID) {
48
+ posts[parseInt(index)] = {
49
+ ...post,
50
+ ...mediaTargetItemState.post,
51
+ };
52
+ }
53
+ }
54
+ setPosts({ posts, info });
55
+ }, [mediaTargetItemState?.post]);
56
+ return (_jsxs(Stack, { spacing: 2, children: [user?.role.capabilities.has("upload_files") && (_jsx(Box, { children: _jsx(Button, { startIcon: _jsx(FileUploadIcon, {}), onClick: () => {
57
+ globalState.set("media-upload", {
58
+ open: !mediaUploadState?.open,
59
+ });
60
+ }, children: "Upload Media File" }) })), globalState.get("media-upload")?.open && (_jsx(MediaUpload, { showCloseButton: true, onUploadComplete: () => {
61
+ overlay.snackbar.open("success", "New media has been successfully added");
62
+ refresh(["main"]);
63
+ } })), _jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [_jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(IconButton, { onClick: () => setListType("thumbnail"), children: _jsx(ViewListIcon, {}) }), _jsx(IconButton, { onClick: () => setListType("table"), children: _jsx(TableViewIcon, {}) })] }), _jsx(Input, { size: "medium", placeholder: "Search", startAdornment: _jsx(SearchIcon, { sx: {
64
+ opacity: 0.5,
65
+ } }), sx: { flexGrow: viewport.isMobile ? 1 : 0, mr: 1 }, onChange: (value) => updateRouter({ search: value, page: 1 }) }), _jsx(Pagination, { pagination: info?.pagination })] }), _jsx(Loading, { loading: loading, children: listType == "thumbnail" ? (_jsx(Thumbnail, { posts: posts })) : (_jsx(Table, { posts: posts })) })] }));
66
+ };
@@ -0,0 +1,5 @@
1
+ export declare const Media: {
2
+ List: () => import("react/jsx-runtime").JSX.Element;
3
+ Edit: () => import("react/jsx-runtime").JSX.Element | null;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/media/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;CAGjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { List } from "./List";
2
+ import { Edit } from "./Edit";
3
+ export const Media = {
4
+ List,
5
+ Edit,
6
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Settings: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=Settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/Edit/Settings.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,+CAqBpB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Box } from "@mui/material";
4
+ import { Accordions } from "@rnaga/wp-next-ui/Accordions";
5
+ import { Discussion, FeaturedImage, PageAttributes, Revisions, Summary, } from "../../../../components/utils/post/settings/";
6
+ export const Settings = () => {
7
+ return (_jsx(Box, { sx: {
8
+ height: "95%",
9
+ overflowY: "auto",
10
+ }, children: _jsx(Accordions, { size: "medium", defaultExpanded: [0], items: [
11
+ { title: "Summary", content: _jsx(Summary, {}) },
12
+ { title: "Revisions", content: _jsx(Revisions, {}) },
13
+ { title: "Feature Image", content: _jsx(FeaturedImage, {}) },
14
+ { title: "Discussion", content: _jsx(Discussion, {}) },
15
+ { title: "Page Attributes", content: _jsx(PageAttributes, {}) },
16
+ ] }) }));
17
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Toolbar: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/Edit/Toolbar.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO,+CA4FnB,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import SettingIcon from "@mui/icons-material/Settings";
4
+ import { Box, IconButton, Tooltip } from "@mui/material";
5
+ import { useServerActions } from "@rnaga/wp-next-core/client/hooks/use-server-actions";
6
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
7
+ import { Button } from "@rnaga/wp-next-ui/Button";
8
+ import { useFormDataContext } from "@rnaga/wp-next-ui/hooks/use-form-data";
9
+ import { IconButtonDelete } from "@rnaga/wp-next-ui/IconButtonDelete";
10
+ import { Input } from "@rnaga/wp-next-ui/Input";
11
+ import { formatting } from "@rnaga/wp-node/common/formatting";
12
+ import { usePanelContext } from "../../../../components/utils/post";
13
+ import { useAdminNavigation } from "../../../../hooks";
14
+ import { useWPAdmin } from "../../../../wp-admin";
15
+ export const Toolbar = () => {
16
+ const { overlay } = useWPAdmin();
17
+ const { user } = useUser();
18
+ const { formData, setFormData } = useFormDataContext("post");
19
+ const { router, gotoPath, refresh } = useAdminNavigation();
20
+ const { actions, safeParse, parse } = useServerActions();
21
+ const { toggle, ref: panelRef } = usePanelContext();
22
+ const [iconVarient, setIconVarient] = useState("solid");
23
+ const postId = formData.ID;
24
+ const handleSave = async () => {
25
+ if (!formData.post_author) {
26
+ formData.post_author = user?.ID;
27
+ }
28
+ // Covert Date object to string
29
+ formData.post_date = formatting.dateMySQL(formData.post_date, {
30
+ withGMTOffset: true,
31
+ });
32
+ formData.post_date_gmt = formatting.dateMySQL(formData.post_date);
33
+ const serverAction = postId
34
+ ? actions.post.update(postId, formData)
35
+ : actions.post.create({ ...formData, post_type: "page" });
36
+ const result = await overlay.circular.promise(serverAction).then(safeParse);
37
+ if (!result.success) {
38
+ overlay.snackbar.open("error", result.error);
39
+ return;
40
+ }
41
+ overlay.snackbar.open("success", "Page has been saved");
42
+ // After saving, the post may have changed (e.g., post_status could be "future" if the date is in the future).
43
+ // Fetch the latest post data to ensure formData reflects any updates from the server.
44
+ if (formData.ID) {
45
+ // Get the updated post data
46
+ const [updatedPost] = await actions.post.get(result.data).then(parse);
47
+ setFormData(updatedPost);
48
+ refresh(["content"]);
49
+ return;
50
+ }
51
+ // If it's a new post, redirect to the edit page with the new post ID
52
+ gotoPath("/pages/edit", {
53
+ segment: "blog",
54
+ queryParams: {
55
+ id: result.data,
56
+ },
57
+ });
58
+ };
59
+ const handleTrash = async () => {
60
+ if (!postId) {
61
+ overlay.snackbar.open("error", "Invalid post");
62
+ return;
63
+ }
64
+ await overlay.circular.promise(actions.post.trash(postId)).then(parse);
65
+ router.back();
66
+ };
67
+ const handleToggle = () => {
68
+ toggle();
69
+ setIconVarient(iconVarient === "plain" ? "solid" : "plain");
70
+ };
71
+ return (_jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [_jsx(Input, { size: "large", value: formData?.post_title, onChange: (value) => setFormData({ post_title: value }), placeholder: "Title", sx: { fontWeight: 500, flexGrow: 1 } }, formData?.ID ?? 0), _jsx(Button, { onClick: handleSave, children: "Save" }), formData.ID && _jsx(IconButtonDelete, { onClick: handleTrash }), _jsx(Tooltip, { title: "Settings", placement: "top", children: _jsx(IconButton, { onClick: handleToggle, children: _jsx(SettingIcon, {}) }) })] }));
72
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Edit: () => import("react/jsx-runtime").JSX.Element | null;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/Edit/index.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,IAAI,sDAsDhB,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { z } from "zod";
5
+ import { Divider, Stack } from "@mui/material";
6
+ import { useServerActions } from "@rnaga/wp-next-core/client/hooks/use-server-actions";
7
+ import { Tiptap } from "@rnaga/wp-next-rte/tiptap/Tiptap";
8
+ import { useFormData } from "@rnaga/wp-next-ui/hooks/use-form-data";
9
+ import { PostPanel, PostPanelWrapper } from "../../../../components/utils/post";
10
+ import { useAdminNavigation } from "../../../../hooks/use-admin-navigation";
11
+ import { useWPAdmin } from "../../../../wp-admin";
12
+ import { Settings } from "./Settings";
13
+ import { Toolbar } from "./Toolbar";
14
+ export const Edit = () => {
15
+ const { overlay, wp: { error }, } = useWPAdmin();
16
+ const { actions, parse } = useServerActions();
17
+ const { formData, setFormData, setFormReady, formReady } = useFormData("post");
18
+ const { searchParams } = useAdminNavigation();
19
+ const parsed = z
20
+ .string()
21
+ .transform((v) => parseInt(v))
22
+ .safeParse(searchParams.get("id"));
23
+ const postId = parsed.success ? parsed.data : undefined;
24
+ useEffect(() => {
25
+ if (!postId) {
26
+ setFormReady(true);
27
+ return;
28
+ }
29
+ overlay.circular.promise(actions.post.get(postId)).then((response) => {
30
+ const [post] = parse(response);
31
+ if (post?.post_status === "trash") {
32
+ error.throw("You cannot edit this item because it is in the Trash. Please restore it and try again.");
33
+ return;
34
+ }
35
+ setFormData(post, { ready: true });
36
+ });
37
+ }, []);
38
+ if (!formReady)
39
+ return null;
40
+ return (_jsx(Stack, { spacing: 1, children: _jsxs(PostPanelWrapper, { children: [_jsx(Toolbar, {}), _jsx(Divider, {}), _jsxs(PostPanel, { children: [_jsx(Tiptap, { defaultContent: formData?.post_content, onUpdate: (editor) => {
41
+ setFormData({ post_content: editor.getHTML() });
42
+ } }), _jsx(Settings, {})] })] }) }));
43
+ };
@@ -0,0 +1,5 @@
1
+ import type * as wpCoreTypes from "@rnaga/wp-next-core/types";
2
+ export declare const ActionLink: (props: {
3
+ post: wpCoreTypes.actions.Posts[number];
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
5
+ //# sourceMappingURL=ActionLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionLink.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/List/ActionLink.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAE9D,eAAO,MAAM,UAAU,GAAI,OAAO;IAChC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CACzC,mDAiBA,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PostActionLink } from "../../../../components/utils/post/link";
3
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
4
+ export const ActionLink = (props) => {
5
+ const { post } = props;
6
+ const { userCan } = useUser();
7
+ // Check if user has permission to edit other posts
8
+ if (!userCan("edit_page", post)) {
9
+ return null;
10
+ }
11
+ return (_jsx(PostActionLink, { actionLinks: post.post_status === "trash" ? ["restore", "delete"] : ["edit", "trash"], post: post }));
12
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Statuses: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=Statuses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Statuses.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/List/Statuses.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,+CAoDpB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment, useEffect, useState } from "react";
3
+ import { useServerActions } from "@rnaga/wp-next-core/client/hooks/use-server-actions";
4
+ import { Link } from "@rnaga/wp-next-ui/Link";
5
+ import { useAdminNavigation } from "../../../../hooks/use-admin-navigation";
6
+ import { Typography } from "@rnaga/wp-next-ui/Typography";
7
+ export const Statuses = () => {
8
+ const { actions } = useServerActions();
9
+ const { pushRouter, searchParams, refreshValue } = useAdminNavigation();
10
+ const [countStatuses, setCountStatuses] = useState();
11
+ useEffect(() => {
12
+ actions.post.countByStatuses("page").then((response) => {
13
+ setCountStatuses(response.info?.countGroupBy ?? []);
14
+ });
15
+ }, [refreshValue().content]);
16
+ if (!countStatuses) {
17
+ return _jsx(Typography, { children: "Loading..." });
18
+ }
19
+ const totalCount = countStatuses.reduce((total, item) => total + (item.count || 0), 0);
20
+ const createLink = (status, count) => {
21
+ return searchParams.get("status") === status ? (_jsxs(_Fragment, { children: [status, " (", count, ")"] })) : (_jsxs(Link, { onClick: () => pushRouter({ status: [status], page: 1 }), children: [status, " (", count, ")"] }));
22
+ };
23
+ return (_jsxs(Typography, { size: "medium", children: [searchParams.size > 0 ? (_jsxs(Link, { component: "button", onClick: () => pushRouter({}), children: ["All (", totalCount, ")"] })) : (_jsxs(_Fragment, { children: ["All (", totalCount, ")"] })), " ", countStatuses.map((status, index) => (_jsxs(Fragment, { children: [" | ", createLink(status.post_status ?? "Unknown", status.count ?? 0)] }, index)))] }));
24
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+ import type * as wpCoreTypes from "@rnaga/wp-next-core/types";
3
+ export declare const Toolbar: (props: {
4
+ posts?: wpCoreTypes.actions.Posts;
5
+ info?: wpCoreTypes.actions.PostsInfo;
6
+ children?: ReactNode;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/List/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOlC,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAG9D,eAAO,MAAM,OAAO,GAAI,OAAO;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,4CAqBA,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ import { Pagination } from "@rnaga/wp-next-ui/list/Pagination";
4
+ import { useWPAdmin } from "../../../../wp-admin";
5
+ import { InputSearch } from "@rnaga/wp-next-ui/InputSearch";
6
+ export const Toolbar = (props) => {
7
+ const { info, children } = props;
8
+ const { wp: { viewport }, } = useWPAdmin();
9
+ return (_jsxs(_Fragment, { children: [children, _jsxs(Box, { sx: {
10
+ display: "grid",
11
+ gap: 1,
12
+ gridTemplateColumns: viewport.isMobile ? "1fr" : "repeat(2, 1fr)",
13
+ }, children: [_jsx(InputSearch, { size: "medium", sx: { flexGrow: 1 } }), _jsx(Pagination, { pagination: info?.pagination })] })] }));
14
+ };
@@ -0,0 +1,2 @@
1
+ export declare const List: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/pages/List/index.tsx"],"names":[],"mappings":"AAoCA,eAAO,MAAM,IAAI,+CAmGhB,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /* eslint-disable jsx-a11y/anchor-is-valid */
4
+ import { useCallback, useEffect, useState, useTransition } from "react";
5
+ import CommentIcon from "@mui/icons-material/Comment";
6
+ import { AccordionDetails, Box, Stack } from "@mui/material";
7
+ import { useServerActions } from "@rnaga/wp-next-core/client/hooks/use-server-actions";
8
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
9
+ import { Accordion } from "@rnaga/wp-next-ui/Accordion";
10
+ import { Chip } from "@rnaga/wp-next-ui/Chip";
11
+ import { ActionTd, ListGrid, ListGridItem, ListGridTitle, SortableTh, Table, Td, Th, THead, Tr, } from "@rnaga/wp-next-ui/list";
12
+ import { Loading } from "@rnaga/wp-next-ui/Loading";
13
+ import { Typography } from "@rnaga/wp-next-ui/Typography";
14
+ import { formatting } from "@rnaga/wp-node/common/formatting";
15
+ import { AdminLink } from "../../../../components/utils/link";
16
+ import { PostRowLinks } from "../../../../components/utils/post/link";
17
+ import { useAdminNavigation } from "../../../../hooks/use-admin-navigation";
18
+ import { useWPAdmin } from "../../../../wp-admin";
19
+ import { ActionLink } from "./ActionLink";
20
+ import { Statuses } from "./Statuses";
21
+ import { Toolbar } from "./Toolbar";
22
+ export const List = () => {
23
+ const { wp: { viewport }, } = useWPAdmin();
24
+ const { userCan } = useUser();
25
+ const { actions, parse } = useServerActions();
26
+ const [loading, startTransition] = useTransition();
27
+ const { navigationStatus, queryObject, refreshValue } = useAdminNavigation();
28
+ const [{ posts, info }, setPosts] = useState({
29
+ posts: undefined,
30
+ info: undefined,
31
+ });
32
+ const fetchPosts = useCallback(async () => {
33
+ const [posts, info] = await actions.post
34
+ .list(queryObject, { postTypes: ["page"] })
35
+ .then(parse);
36
+ setPosts({ posts, info });
37
+ }, [navigationStatus, refreshValue().content]);
38
+ useEffect(() => {
39
+ startTransition(fetchPosts);
40
+ }, [navigationStatus]);
41
+ useEffect(() => {
42
+ fetchPosts();
43
+ }, [refreshValue().content]);
44
+ return (_jsxs(Stack, { spacing: 2, children: [_jsx(Toolbar, { posts: posts, info: info, children: _jsx(Statuses, {}) }), _jsx(Loading, { loading: loading, children: _jsxs(Table, { children: [_jsxs(THead, { children: [_jsx(SortableTh, { name: "Title", orderby: "post_name" }), _jsx(Th, { viewport: "desktop", children: "Author" }), _jsx(Th, { viewport: "desktop", style: { width: "40px" }, children: _jsx(Box, { sx: { display: "flex", alignItems: "center" }, children: _jsx(CommentIcon, { fontSize: "small" }) }) }), _jsx(SortableTh, { show: viewport.isDesktop, name: "Date", orderby: "post_date" })] }), _jsx("tbody", { children: posts?.map((post) => (_jsxs(Tr, { children: [_jsxs(ActionTd, { viewport: "desktop", children: [_jsx(AdminLink, { subPage: "/edit", queryParams: { id: post.ID }, disabled: !userCan("edit_post", post), children: post.post_title }), _jsx(ActionLink, { post: post })] }), _jsx(Td, { viewport: "mobile", children: _jsxs(Accordion, { children: [_jsx(ListGridTitle, { title: post.post_title }), _jsxs(AccordionDetails, { children: [_jsx(ActionLink, { post: post }), _jsxs(ListGrid, { children: [_jsx(ListGridItem, { title: "Author", children: _jsx(PostRowLinks, { row: post, field: "actor" }) }), _jsx(ListGridItem, { title: "Date", children: _jsx(Typography, { children: formatting.date(post.post_date) }) })] })] })] }) }), _jsx(Td, { viewport: "desktop", children: _jsx(PostRowLinks, { row: post, field: "actor" }) }), _jsx(Td, { viewport: "desktop", children: _jsx(Chip, { label: post.comment_count }) }), _jsx(Td, { viewport: "desktop", children: formatting.date(post.post_date) })] }, `${post.ID}`))) })] }) })] }));
45
+ };
@@ -0,0 +1,5 @@
1
+ export declare const Pages: {
2
+ Edit: () => import("react/jsx-runtime").JSX.Element | null;
3
+ List: () => import("react/jsx-runtime").JSX.Element;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/contents/pages/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;CAGjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Edit } from "./Edit";
2
+ import { List } from "./List";
3
+ export const Pages = {
4
+ Edit,
5
+ List,
6
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Settings: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=Settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/posts/Edit/Settings.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,QAAQ,+CAuBpB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Accordions } from "@rnaga/wp-next-ui/Accordions";
4
+ import { Categories, Discussion, Excerpt, FeaturedImage, Revisions, Summary, Tags, } from "../../../../components/utils/post/settings/";
5
+ import { Box } from "@mui/material";
6
+ export const Settings = () => {
7
+ return (_jsx(Box, { sx: {
8
+ height: "95%",
9
+ overflowY: "auto",
10
+ }, children: _jsx(Accordions, { size: "medium", defaultExpanded: [0], items: [
11
+ { title: "Summary", content: _jsx(Summary, {}) },
12
+ { title: "Revisions", content: _jsx(Revisions, {}) },
13
+ { title: "Categories", content: _jsx(Categories, {}) },
14
+ { title: "Tags", content: _jsx(Tags, {}) },
15
+ { title: "Feature Image", content: _jsx(FeaturedImage, {}) },
16
+ { title: "Excerpt", content: _jsx(Excerpt, {}) },
17
+ { title: "Discussion", content: _jsx(Discussion, {}) },
18
+ ] }) }));
19
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Toolbar: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/posts/Edit/Toolbar.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,OAAO,+CA+FnB,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import SettingIcon from "@mui/icons-material/Settings";
4
+ import { Box, IconButton, Tooltip } from "@mui/material";
5
+ import { useServerActions } from "@rnaga/wp-next-core/client/hooks/use-server-actions";
6
+ import { useUser } from "@rnaga/wp-next-core/client/hooks/use-user";
7
+ import { Button } from "@rnaga/wp-next-ui/Button";
8
+ import { useFormDataContext } from "@rnaga/wp-next-ui/hooks/use-form-data";
9
+ import { IconButtonDelete } from "@rnaga/wp-next-ui/IconButtonDelete";
10
+ import { Input } from "@rnaga/wp-next-ui/Input";
11
+ import { formatting } from "@rnaga/wp-node/common/formatting";
12
+ import { usePanelContext } from "../../../../components/utils/post";
13
+ import { useAdminNavigation } from "../../../../hooks";
14
+ import { useWPAdmin } from "../../../../wp-admin";
15
+ export const Toolbar = () => {
16
+ const { overlay } = useWPAdmin();
17
+ const { user } = useUser();
18
+ const { formData, setFormData } = useFormDataContext("post");
19
+ const { router, gotoPath, refresh } = useAdminNavigation();
20
+ const { actions, safeParse, parse } = useServerActions();
21
+ const { toggle } = usePanelContext();
22
+ const [iconVarient, setIconVarient] = useState("solid");
23
+ const postId = formData.ID;
24
+ const handleSave = async () => {
25
+ if (!formData.post_author) {
26
+ formData.post_author = user?.ID;
27
+ }
28
+ // Covert Date object to string
29
+ formData.post_date = formatting.dateMySQL(formData.post_date, {
30
+ withGMTOffset: true,
31
+ });
32
+ formData.post_date_gmt = formatting.dateMySQL(formData.post_date);
33
+ const serverAction = postId
34
+ ? actions.post.update(postId, formData)
35
+ : actions.post.create({ ...formData, post_type: "post" });
36
+ const result = await overlay.circular.promise(serverAction).then(safeParse);
37
+ if (!result.success) {
38
+ overlay.snackbar.open("error", result.error);
39
+ return;
40
+ }
41
+ overlay.snackbar.open("success", "Post has been saved");
42
+ // After saving, the post may have changed (e.g., post_status could be "future" if the date is in the future).
43
+ // Fetch the latest post data to ensure formData reflects any updates from the server.
44
+ if (formData.ID) {
45
+ // Get the updated post data
46
+ const [updatedPost] = await actions.post.get(result.data).then(parse);
47
+ setFormData(updatedPost);
48
+ refresh(["content"]);
49
+ return;
50
+ }
51
+ // If it's a new post, we navigate to the edit page with the new post ID
52
+ gotoPath("/posts/edit", {
53
+ segment: "blog",
54
+ queryParams: {
55
+ id: result.data,
56
+ },
57
+ });
58
+ };
59
+ const handleTrash = async () => {
60
+ if (!postId) {
61
+ overlay.snackbar.open("error", "Invalid post");
62
+ return;
63
+ }
64
+ await overlay.circular.promise(actions.post.trash(postId)).then(parse);
65
+ router.back();
66
+ };
67
+ const handleToggle = () => {
68
+ toggle();
69
+ setIconVarient(iconVarient === "plain" ? "solid" : "plain");
70
+ };
71
+ return (_jsxs(Box, { sx: { display: "flex", gap: 2 }, children: [_jsx(Input, { size: "large", value: formData?.post_title ?? "", onChange: (value) => setFormData({ post_title: value }), placeholder: "Title", removeBorderOnFocus: true, sx: { fontWeight: 500, flexGrow: 1 } }, formData?.ID ?? 0), _jsx(Button, { onClick: handleSave, size: "medium", children: "Save" }), formData.ID && _jsx(IconButtonDelete, { onClick: handleTrash }), _jsx(Tooltip, { title: "Settings", placement: "top", children: _jsx(IconButton, { onClick: handleToggle, children: _jsx(SettingIcon, {}) }) })] }));
72
+ };
@@ -0,0 +1,2 @@
1
+ export declare const Edit: () => import("react/jsx-runtime").JSX.Element | null;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/client/components/contents/posts/Edit/index.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,IAAI,sDA+DhB,CAAC"}