@velocity-astro/cms-admin 0.0.0-stage → 0.1.0-beta.11

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 (521) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/app-directory.d.mts +2 -0
  4. package/app-directory.mjs +8 -0
  5. package/app-dist/assets/RichTextEditor-UA2kIIOw.js +135 -0
  6. package/app-dist/assets/index-DkDHhCG6.css +2 -0
  7. package/app-dist/assets/index-DovlPZTn.js +80 -0
  8. package/app-dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  9. package/app-dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  10. package/app-dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  11. package/app-dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  12. package/app-dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  13. package/app-dist/assets/manrope-cyrillic-wght-normal-Dvxsihut.woff2 +0 -0
  14. package/app-dist/assets/manrope-greek-wght-normal-DL7QRZyv.woff2 +0 -0
  15. package/app-dist/assets/manrope-latin-ext-wght-normal-Ch3YOpNY.woff2 +0 -0
  16. package/app-dist/assets/manrope-latin-wght-normal-DHIcAJRg.woff2 +0 -0
  17. package/app-dist/assets/manrope-vietnamese-wght-normal-usUDDRr7.woff2 +0 -0
  18. package/app-dist/assets/outfit-latin-ext-wght-normal-DdQaqQDo.woff2 +0 -0
  19. package/app-dist/assets/outfit-latin-wght-normal-Bc-8i84L.woff2 +0 -0
  20. package/app-dist/index.html +29 -0
  21. package/dist/app/AdminApp.d.ts +34 -0
  22. package/dist/app/AdminApp.d.ts.map +1 -0
  23. package/dist/app/AdminApp.js +29 -0
  24. package/dist/app/AdminApp.js.map +1 -0
  25. package/dist/app/AdminLayout.d.ts +7 -0
  26. package/dist/app/AdminLayout.d.ts.map +1 -0
  27. package/dist/app/AdminLayout.js +183 -0
  28. package/dist/app/AdminLayout.js.map +1 -0
  29. package/dist/app/NavigationBridge.d.ts +6 -0
  30. package/dist/app/NavigationBridge.d.ts.map +1 -0
  31. package/dist/app/NavigationBridge.js +15 -0
  32. package/dist/app/NavigationBridge.js.map +1 -0
  33. package/dist/app/PasskeysDialog.d.ts +5 -0
  34. package/dist/app/PasskeysDialog.d.ts.map +1 -0
  35. package/dist/app/PasskeysDialog.js +51 -0
  36. package/dist/app/PasskeysDialog.js.map +1 -0
  37. package/dist/app/RequestState.d.ts +20 -0
  38. package/dist/app/RequestState.d.ts.map +1 -0
  39. package/dist/app/RequestState.js +37 -0
  40. package/dist/app/RequestState.js.map +1 -0
  41. package/dist/app/RouteError.d.ts +9 -0
  42. package/dist/app/RouteError.d.ts.map +1 -0
  43. package/dist/app/RouteError.js +16 -0
  44. package/dist/app/RouteError.js.map +1 -0
  45. package/dist/app/paths.d.ts +38 -0
  46. package/dist/app/paths.d.ts.map +1 -0
  47. package/dist/app/paths.js +37 -0
  48. package/dist/app/paths.js.map +1 -0
  49. package/dist/app/routes.d.ts +4 -0
  50. package/dist/app/routes.d.ts.map +1 -0
  51. package/dist/app/routes.js +68 -0
  52. package/dist/app/routes.js.map +1 -0
  53. package/dist/app/use-go.d.ts +7 -0
  54. package/dist/app/use-go.d.ts.map +1 -0
  55. package/dist/app/use-go.js +11 -0
  56. package/dist/app/use-go.js.map +1 -0
  57. package/dist/client/admin-client.d.ts +338 -0
  58. package/dist/client/admin-client.d.ts.map +1 -0
  59. package/dist/client/admin-client.js +2 -0
  60. package/dist/client/admin-client.js.map +1 -0
  61. package/dist/client/client-context.d.ts +10 -0
  62. package/dist/client/client-context.d.ts.map +1 -0
  63. package/dist/client/client-context.js +14 -0
  64. package/dist/client/client-context.js.map +1 -0
  65. package/dist/client/errors.d.ts +22 -0
  66. package/dist/client/errors.d.ts.map +1 -0
  67. package/dist/client/errors.js +17 -0
  68. package/dist/client/errors.js.map +1 -0
  69. package/dist/client/http-client.d.ts +133 -0
  70. package/dist/client/http-client.d.ts.map +1 -0
  71. package/dist/client/http-client.js +399 -0
  72. package/dist/client/http-client.js.map +1 -0
  73. package/dist/client/queries.d.ts +232 -0
  74. package/dist/client/queries.d.ts.map +1 -0
  75. package/dist/client/queries.js +780 -0
  76. package/dist/client/queries.js.map +1 -0
  77. package/dist/fields/BlocksControl.d.ts +14 -0
  78. package/dist/fields/BlocksControl.d.ts.map +1 -0
  79. package/dist/fields/BlocksControl.js +476 -0
  80. package/dist/fields/BlocksControl.js.map +1 -0
  81. package/dist/fields/CustomFieldsDialog.d.ts +7 -0
  82. package/dist/fields/CustomFieldsDialog.d.ts.map +1 -0
  83. package/dist/fields/CustomFieldsDialog.js +29 -0
  84. package/dist/fields/CustomFieldsDialog.js.map +1 -0
  85. package/dist/fields/FieldEditor.d.ts +17 -0
  86. package/dist/fields/FieldEditor.d.ts.map +1 -0
  87. package/dist/fields/FieldEditor.js +25 -0
  88. package/dist/fields/FieldEditor.js.map +1 -0
  89. package/dist/fields/FieldGrid.d.ts +31 -0
  90. package/dist/fields/FieldGrid.d.ts.map +1 -0
  91. package/dist/fields/FieldGrid.js +42 -0
  92. package/dist/fields/FieldGrid.js.map +1 -0
  93. package/dist/fields/FieldSetDialog.d.ts +11 -0
  94. package/dist/fields/FieldSetDialog.d.ts.map +1 -0
  95. package/dist/fields/FieldSetDialog.js +73 -0
  96. package/dist/fields/FieldSetDialog.js.map +1 -0
  97. package/dist/fields/FieldSetEditor.d.ts +9 -0
  98. package/dist/fields/FieldSetEditor.d.ts.map +1 -0
  99. package/dist/fields/FieldSetEditor.js +49 -0
  100. package/dist/fields/FieldSetEditor.js.map +1 -0
  101. package/dist/fields/FieldSummary.d.ts +9 -0
  102. package/dist/fields/FieldSummary.d.ts.map +1 -0
  103. package/dist/fields/FieldSummary.js +28 -0
  104. package/dist/fields/FieldSummary.js.map +1 -0
  105. package/dist/fields/LinkControl.d.ts +8 -0
  106. package/dist/fields/LinkControl.d.ts.map +1 -0
  107. package/dist/fields/LinkControl.js +54 -0
  108. package/dist/fields/LinkControl.js.map +1 -0
  109. package/dist/fields/SiteImagePicker.d.ts +22 -0
  110. package/dist/fields/SiteImagePicker.d.ts.map +1 -0
  111. package/dist/fields/SiteImagePicker.js +42 -0
  112. package/dist/fields/SiteImagePicker.js.map +1 -0
  113. package/dist/fields/block-icons.d.ts +4 -0
  114. package/dist/fields/block-icons.d.ts.map +1 -0
  115. package/dist/fields/block-icons.js +53 -0
  116. package/dist/fields/block-icons.js.map +1 -0
  117. package/dist/fields/carry.d.ts +19 -0
  118. package/dist/fields/carry.d.ts.map +1 -0
  119. package/dist/fields/carry.js +61 -0
  120. package/dist/fields/carry.js.map +1 -0
  121. package/dist/fields/controls.d.ts +4 -0
  122. package/dist/fields/controls.d.ts.map +1 -0
  123. package/dist/fields/controls.js +363 -0
  124. package/dist/fields/controls.js.map +1 -0
  125. package/dist/fields/custom-values.d.ts +23 -0
  126. package/dist/fields/custom-values.d.ts.map +1 -0
  127. package/dist/fields/custom-values.js +30 -0
  128. package/dist/fields/custom-values.js.map +1 -0
  129. package/dist/fields/field-control.d.ts +170 -0
  130. package/dist/fields/field-control.d.ts.map +1 -0
  131. package/dist/fields/field-control.js +19 -0
  132. package/dist/fields/field-control.js.map +1 -0
  133. package/dist/fields/field-set.d.ts +39 -0
  134. package/dist/fields/field-set.d.ts.map +1 -0
  135. package/dist/fields/field-set.js +24 -0
  136. package/dist/fields/field-set.js.map +1 -0
  137. package/dist/fields/index.d.ts +7 -0
  138. package/dist/fields/index.d.ts.map +1 -0
  139. package/dist/fields/index.js +7 -0
  140. package/dist/fields/index.js.map +1 -0
  141. package/dist/fields/page-focus.d.ts +82 -0
  142. package/dist/fields/page-focus.d.ts.map +1 -0
  143. package/dist/fields/page-focus.js +104 -0
  144. package/dist/fields/page-focus.js.map +1 -0
  145. package/dist/fields/settings.d.ts +40 -0
  146. package/dist/fields/settings.d.ts.map +1 -0
  147. package/dist/fields/settings.js +99 -0
  148. package/dist/fields/settings.js.map +1 -0
  149. package/dist/index.d.ts +8 -0
  150. package/dist/index.d.ts.map +1 -0
  151. package/dist/index.js +6 -0
  152. package/dist/index.js.map +1 -0
  153. package/dist/lib/arrangement.d.ts +20 -0
  154. package/dist/lib/arrangement.d.ts.map +1 -0
  155. package/dist/lib/arrangement.js +52 -0
  156. package/dist/lib/arrangement.js.map +1 -0
  157. package/dist/lib/boot.d.ts +25 -0
  158. package/dist/lib/boot.d.ts.map +1 -0
  159. package/dist/lib/boot.js +87 -0
  160. package/dist/lib/boot.js.map +1 -0
  161. package/dist/lib/content.d.ts +45 -0
  162. package/dist/lib/content.d.ts.map +1 -0
  163. package/dist/lib/content.js +99 -0
  164. package/dist/lib/content.js.map +1 -0
  165. package/dist/lib/csv.d.ts +10 -0
  166. package/dist/lib/csv.d.ts.map +1 -0
  167. package/dist/lib/csv.js +54 -0
  168. package/dist/lib/csv.js.map +1 -0
  169. package/dist/lib/day-part.d.ts +5 -0
  170. package/dist/lib/day-part.d.ts.map +1 -0
  171. package/dist/lib/day-part.js +10 -0
  172. package/dist/lib/day-part.js.map +1 -0
  173. package/dist/lib/download.d.ts +6 -0
  174. package/dist/lib/download.d.ts.map +1 -0
  175. package/dist/lib/download.js +13 -0
  176. package/dist/lib/download.js.map +1 -0
  177. package/dist/lib/keys.d.ts +5 -0
  178. package/dist/lib/keys.d.ts.map +1 -0
  179. package/dist/lib/keys.js +26 -0
  180. package/dist/lib/keys.js.map +1 -0
  181. package/dist/lib/load-fresh.d.ts +8 -0
  182. package/dist/lib/load-fresh.d.ts.map +1 -0
  183. package/dist/lib/load-fresh.js +51 -0
  184. package/dist/lib/load-fresh.js.map +1 -0
  185. package/dist/lib/open-site.d.ts +6 -0
  186. package/dist/lib/open-site.d.ts.map +1 -0
  187. package/dist/lib/open-site.js +8 -0
  188. package/dist/lib/open-site.js.map +1 -0
  189. package/dist/lib/prepare-image.d.ts +11 -0
  190. package/dist/lib/prepare-image.d.ts.map +1 -0
  191. package/dist/lib/prepare-image.js +50 -0
  192. package/dist/lib/prepare-image.js.map +1 -0
  193. package/dist/lib/preview-tab.d.ts +14 -0
  194. package/dist/lib/preview-tab.d.ts.map +1 -0
  195. package/dist/lib/preview-tab.js +24 -0
  196. package/dist/lib/preview-tab.js.map +1 -0
  197. package/dist/lib/relative-time.d.ts +3 -0
  198. package/dist/lib/relative-time.d.ts.map +1 -0
  199. package/dist/lib/relative-time.js +18 -0
  200. package/dist/lib/relative-time.js.map +1 -0
  201. package/dist/lib/rich-from-html.d.ts +9 -0
  202. package/dist/lib/rich-from-html.d.ts.map +1 -0
  203. package/dist/lib/rich-from-html.js +129 -0
  204. package/dist/lib/rich-from-html.js.map +1 -0
  205. package/dist/lib/sittings.d.ts +16 -0
  206. package/dist/lib/sittings.d.ts.map +1 -0
  207. package/dist/lib/sittings.js +29 -0
  208. package/dist/lib/sittings.js.map +1 -0
  209. package/dist/lib/slug.d.ts +3 -0
  210. package/dist/lib/slug.d.ts.map +1 -0
  211. package/dist/lib/slug.js +10 -0
  212. package/dist/lib/slug.js.map +1 -0
  213. package/dist/lib/small-image.d.ts +7 -0
  214. package/dist/lib/small-image.d.ts.map +1 -0
  215. package/dist/lib/small-image.js +6 -0
  216. package/dist/lib/small-image.js.map +1 -0
  217. package/dist/lib/type-icon.d.ts +3 -0
  218. package/dist/lib/type-icon.d.ts.map +1 -0
  219. package/dist/lib/type-icon.js +27 -0
  220. package/dist/lib/type-icon.js.map +1 -0
  221. package/dist/lib/use-closing.d.ts +19 -0
  222. package/dist/lib/use-closing.d.ts.map +1 -0
  223. package/dist/lib/use-closing.js +24 -0
  224. package/dist/lib/use-closing.js.map +1 -0
  225. package/dist/lib/use-command-key.d.ts +16 -0
  226. package/dist/lib/use-command-key.d.ts.map +1 -0
  227. package/dist/lib/use-command-key.js +30 -0
  228. package/dist/lib/use-command-key.js.map +1 -0
  229. package/dist/lib/use-escapes.d.ts +7 -0
  230. package/dist/lib/use-escapes.d.ts.map +1 -0
  231. package/dist/lib/use-escapes.js +19 -0
  232. package/dist/lib/use-escapes.js.map +1 -0
  233. package/dist/lib/use-history.d.ts +24 -0
  234. package/dist/lib/use-history.d.ts.map +1 -0
  235. package/dist/lib/use-history.js +48 -0
  236. package/dist/lib/use-history.js.map +1 -0
  237. package/dist/lib/use-leave-guard.d.ts +16 -0
  238. package/dist/lib/use-leave-guard.d.ts.map +1 -0
  239. package/dist/lib/use-leave-guard.js +29 -0
  240. package/dist/lib/use-leave-guard.js.map +1 -0
  241. package/dist/lib/use-narrow.d.ts +5 -0
  242. package/dist/lib/use-narrow.d.ts.map +1 -0
  243. package/dist/lib/use-narrow.js +19 -0
  244. package/dist/lib/use-narrow.js.map +1 -0
  245. package/dist/lib/use-panel-sizes.d.ts +7 -0
  246. package/dist/lib/use-panel-sizes.d.ts.map +1 -0
  247. package/dist/lib/use-panel-sizes.js +33 -0
  248. package/dist/lib/use-panel-sizes.js.map +1 -0
  249. package/dist/lib/use-save-key.d.ts +15 -0
  250. package/dist/lib/use-save-key.d.ts.map +1 -0
  251. package/dist/lib/use-save-key.js +27 -0
  252. package/dist/lib/use-save-key.js.map +1 -0
  253. package/dist/lib/use-undo-keys.d.ts +14 -0
  254. package/dist/lib/use-undo-keys.d.ts.map +1 -0
  255. package/dist/lib/use-undo-keys.js +46 -0
  256. package/dist/lib/use-undo-keys.js.map +1 -0
  257. package/dist/messages/en.d.ts +1334 -0
  258. package/dist/messages/en.d.ts.map +1 -0
  259. package/dist/messages/en.js +1280 -0
  260. package/dist/messages/en.js.map +1 -0
  261. package/dist/messages/messages-context.d.ts +17 -0
  262. package/dist/messages/messages-context.d.ts.map +1 -0
  263. package/dist/messages/messages-context.js +16 -0
  264. package/dist/messages/messages-context.js.map +1 -0
  265. package/dist/page-bridge/index.d.ts +7 -0
  266. package/dist/page-bridge/index.d.ts.map +1 -0
  267. package/dist/page-bridge/index.js +7 -0
  268. package/dist/page-bridge/index.js.map +1 -0
  269. package/dist/page-bridge/preview-bridge.d.ts +35 -0
  270. package/dist/page-bridge/preview-bridge.d.ts.map +1 -0
  271. package/dist/page-bridge/preview-bridge.js +1821 -0
  272. package/dist/page-bridge/preview-bridge.js.map +1 -0
  273. package/dist/plugins/PluginBoundary.d.ts +21 -0
  274. package/dist/plugins/PluginBoundary.d.ts.map +1 -0
  275. package/dist/plugins/PluginBoundary.js +20 -0
  276. package/dist/plugins/PluginBoundary.js.map +1 -0
  277. package/dist/plugins/plugin-editor.d.ts +114 -0
  278. package/dist/plugins/plugin-editor.d.ts.map +1 -0
  279. package/dist/plugins/plugin-editor.js +142 -0
  280. package/dist/plugins/plugin-editor.js.map +1 -0
  281. package/dist/plugins/plugin-ui.d.ts +45 -0
  282. package/dist/plugins/plugin-ui.d.ts.map +1 -0
  283. package/dist/plugins/plugin-ui.js +44 -0
  284. package/dist/plugins/plugin-ui.js.map +1 -0
  285. package/dist/screens/Contact/ContactDeals.d.ts +6 -0
  286. package/dist/screens/Contact/ContactDeals.d.ts.map +1 -0
  287. package/dist/screens/Contact/ContactDeals.js +41 -0
  288. package/dist/screens/Contact/ContactDeals.js.map +1 -0
  289. package/dist/screens/Contact/ContactScreen.d.ts +3 -0
  290. package/dist/screens/Contact/ContactScreen.d.ts.map +1 -0
  291. package/dist/screens/Contact/ContactScreen.js +165 -0
  292. package/dist/screens/Contact/ContactScreen.js.map +1 -0
  293. package/dist/screens/Contact/ContactWork.d.ts +6 -0
  294. package/dist/screens/Contact/ContactWork.d.ts.map +1 -0
  295. package/dist/screens/Contact/ContactWork.js +50 -0
  296. package/dist/screens/Contact/ContactWork.js.map +1 -0
  297. package/dist/screens/Contacts/ContactsScreen.d.ts +3 -0
  298. package/dist/screens/Contacts/ContactsScreen.d.ts.map +1 -0
  299. package/dist/screens/Contacts/ContactsScreen.js +133 -0
  300. package/dist/screens/Contacts/ContactsScreen.js.map +1 -0
  301. package/dist/screens/Contacts/ImportDialog.d.ts +5 -0
  302. package/dist/screens/Contacts/ImportDialog.d.ts.map +1 -0
  303. package/dist/screens/Contacts/ImportDialog.js +90 -0
  304. package/dist/screens/Contacts/ImportDialog.js.map +1 -0
  305. package/dist/screens/Contacts/PipelineBoard.d.ts +11 -0
  306. package/dist/screens/Contacts/PipelineBoard.d.ts.map +1 -0
  307. package/dist/screens/Contacts/PipelineBoard.js +74 -0
  308. package/dist/screens/Contacts/PipelineBoard.js.map +1 -0
  309. package/dist/screens/Contacts/StagesDialog.d.ts +8 -0
  310. package/dist/screens/Contacts/StagesDialog.d.ts.map +1 -0
  311. package/dist/screens/Contacts/StagesDialog.js +61 -0
  312. package/dist/screens/Contacts/StagesDialog.js.map +1 -0
  313. package/dist/screens/Contacts/contact-source.d.ts +4 -0
  314. package/dist/screens/Contacts/contact-source.d.ts.map +1 -0
  315. package/dist/screens/Contacts/contact-source.js +18 -0
  316. package/dist/screens/Contacts/contact-source.js.map +1 -0
  317. package/dist/screens/Contacts/pipeline.d.ts +23 -0
  318. package/dist/screens/Contacts/pipeline.d.ts.map +1 -0
  319. package/dist/screens/Contacts/pipeline.js +57 -0
  320. package/dist/screens/Contacts/pipeline.js.map +1 -0
  321. package/dist/screens/ContentList/ContentListScreen.d.ts +3 -0
  322. package/dist/screens/ContentList/ContentListScreen.d.ts.map +1 -0
  323. package/dist/screens/ContentList/ContentListScreen.js +112 -0
  324. package/dist/screens/ContentList/ContentListScreen.js.map +1 -0
  325. package/dist/screens/ContentType/ContentTypeScreen.d.ts +3 -0
  326. package/dist/screens/ContentType/ContentTypeScreen.d.ts.map +1 -0
  327. package/dist/screens/ContentType/ContentTypeScreen.js +140 -0
  328. package/dist/screens/ContentType/ContentTypeScreen.js.map +1 -0
  329. package/dist/screens/ContentType/FieldDialog.d.ts +12 -0
  330. package/dist/screens/ContentType/FieldDialog.d.ts.map +1 -0
  331. package/dist/screens/ContentType/FieldDialog.js +110 -0
  332. package/dist/screens/ContentType/FieldDialog.js.map +1 -0
  333. package/dist/screens/ContentType/SectionsDialog.d.ts +7 -0
  334. package/dist/screens/ContentType/SectionsDialog.d.ts.map +1 -0
  335. package/dist/screens/ContentType/SectionsDialog.js +67 -0
  336. package/dist/screens/ContentType/SectionsDialog.js.map +1 -0
  337. package/dist/screens/ContentType/SettingsDialog.d.ts +7 -0
  338. package/dist/screens/ContentType/SettingsDialog.d.ts.map +1 -0
  339. package/dist/screens/ContentType/SettingsDialog.js +75 -0
  340. package/dist/screens/ContentType/SettingsDialog.js.map +1 -0
  341. package/dist/screens/ContentTypes/ContentTypesScreen.d.ts +3 -0
  342. package/dist/screens/ContentTypes/ContentTypesScreen.d.ts.map +1 -0
  343. package/dist/screens/ContentTypes/ContentTypesScreen.js +103 -0
  344. package/dist/screens/ContentTypes/ContentTypesScreen.js.map +1 -0
  345. package/dist/screens/Deals/DealDialog.d.ts +16 -0
  346. package/dist/screens/Deals/DealDialog.d.ts.map +1 -0
  347. package/dist/screens/Deals/DealDialog.js +84 -0
  348. package/dist/screens/Deals/DealDialog.js.map +1 -0
  349. package/dist/screens/Deals/DealsScreen.d.ts +3 -0
  350. package/dist/screens/Deals/DealsScreen.d.ts.map +1 -0
  351. package/dist/screens/Deals/DealsScreen.js +117 -0
  352. package/dist/screens/Deals/DealsScreen.js.map +1 -0
  353. package/dist/screens/Deals/deal-subject.d.ts +30 -0
  354. package/dist/screens/Deals/deal-subject.d.ts.map +1 -0
  355. package/dist/screens/Deals/deal-subject.js +57 -0
  356. package/dist/screens/Deals/deal-subject.js.map +1 -0
  357. package/dist/screens/EntryEditor/EntryDeals.d.ts +11 -0
  358. package/dist/screens/EntryEditor/EntryDeals.d.ts.map +1 -0
  359. package/dist/screens/EntryEditor/EntryDeals.js +45 -0
  360. package/dist/screens/EntryEditor/EntryDeals.js.map +1 -0
  361. package/dist/screens/EntryEditor/EntryEditorScreen.d.ts +3 -0
  362. package/dist/screens/EntryEditor/EntryEditorScreen.d.ts.map +1 -0
  363. package/dist/screens/EntryEditor/EntryEditorScreen.js +70 -0
  364. package/dist/screens/EntryEditor/EntryEditorScreen.js.map +1 -0
  365. package/dist/screens/EntryEditor/EntryForm.d.ts +26 -0
  366. package/dist/screens/EntryEditor/EntryForm.d.ts.map +1 -0
  367. package/dist/screens/EntryEditor/EntryForm.js +480 -0
  368. package/dist/screens/EntryEditor/EntryForm.js.map +1 -0
  369. package/dist/screens/EntryEditor/HistoryDialog.d.ts +17 -0
  370. package/dist/screens/EntryEditor/HistoryDialog.d.ts.map +1 -0
  371. package/dist/screens/EntryEditor/HistoryDialog.js +71 -0
  372. package/dist/screens/EntryEditor/HistoryDialog.js.map +1 -0
  373. package/dist/screens/EntryEditor/PagePane.d.ts +45 -0
  374. package/dist/screens/EntryEditor/PagePane.d.ts.map +1 -0
  375. package/dist/screens/EntryEditor/PagePane.js +82 -0
  376. package/dist/screens/EntryEditor/PagePane.js.map +1 -0
  377. package/dist/screens/EntryEditor/ScheduleDialog.d.ts +15 -0
  378. package/dist/screens/EntryEditor/ScheduleDialog.d.ts.map +1 -0
  379. package/dist/screens/EntryEditor/ScheduleDialog.js +70 -0
  380. package/dist/screens/EntryEditor/ScheduleDialog.js.map +1 -0
  381. package/dist/screens/EntryEditor/SectionOutline.d.ts +11 -0
  382. package/dist/screens/EntryEditor/SectionOutline.d.ts.map +1 -0
  383. package/dist/screens/EntryEditor/SectionOutline.js +46 -0
  384. package/dist/screens/EntryEditor/SectionOutline.js.map +1 -0
  385. package/dist/screens/EntryEditor/ThemeCard.d.ts +32 -0
  386. package/dist/screens/EntryEditor/ThemeCard.d.ts.map +1 -0
  387. package/dist/screens/EntryEditor/ThemeCard.js +71 -0
  388. package/dist/screens/EntryEditor/ThemeCard.js.map +1 -0
  389. package/dist/screens/Form/FormFields.d.ts +9 -0
  390. package/dist/screens/Form/FormFields.d.ts.map +1 -0
  391. package/dist/screens/Form/FormFields.js +26 -0
  392. package/dist/screens/Form/FormFields.js.map +1 -0
  393. package/dist/screens/Form/FormScreen.d.ts +3 -0
  394. package/dist/screens/Form/FormScreen.d.ts.map +1 -0
  395. package/dist/screens/Form/FormScreen.js +66 -0
  396. package/dist/screens/Form/FormScreen.js.map +1 -0
  397. package/dist/screens/Form/FormSettingsDialog.d.ts +8 -0
  398. package/dist/screens/Form/FormSettingsDialog.d.ts.map +1 -0
  399. package/dist/screens/Form/FormSettingsDialog.js +78 -0
  400. package/dist/screens/Form/FormSettingsDialog.js.map +1 -0
  401. package/dist/screens/Form/Submissions.d.ts +6 -0
  402. package/dist/screens/Form/Submissions.d.ts.map +1 -0
  403. package/dist/screens/Form/Submissions.js +98 -0
  404. package/dist/screens/Form/Submissions.js.map +1 -0
  405. package/dist/screens/Form/form-fields.d.ts +3 -0
  406. package/dist/screens/Form/form-fields.d.ts.map +1 -0
  407. package/dist/screens/Form/form-fields.js +9 -0
  408. package/dist/screens/Form/form-fields.js.map +1 -0
  409. package/dist/screens/Forms/FormsScreen.d.ts +3 -0
  410. package/dist/screens/Forms/FormsScreen.d.ts.map +1 -0
  411. package/dist/screens/Forms/FormsScreen.js +142 -0
  412. package/dist/screens/Forms/FormsScreen.js.map +1 -0
  413. package/dist/screens/Home/FollowUps.d.ts +8 -0
  414. package/dist/screens/Home/FollowUps.d.ts.map +1 -0
  415. package/dist/screens/Home/FollowUps.js +43 -0
  416. package/dist/screens/Home/FollowUps.js.map +1 -0
  417. package/dist/screens/Home/HomeScreen.d.ts +6 -0
  418. package/dist/screens/Home/HomeScreen.d.ts.map +1 -0
  419. package/dist/screens/Home/HomeScreen.js +156 -0
  420. package/dist/screens/Home/HomeScreen.js.map +1 -0
  421. package/dist/screens/Media/MediaScreen.d.ts +3 -0
  422. package/dist/screens/Media/MediaScreen.d.ts.map +1 -0
  423. package/dist/screens/Media/MediaScreen.js +72 -0
  424. package/dist/screens/Media/MediaScreen.js.map +1 -0
  425. package/dist/screens/People/PeopleScreen.d.ts +3 -0
  426. package/dist/screens/People/PeopleScreen.d.ts.map +1 -0
  427. package/dist/screens/People/PeopleScreen.js +78 -0
  428. package/dist/screens/People/PeopleScreen.js.map +1 -0
  429. package/dist/screens/PluginScreen/PluginScreenScreen.d.ts +3 -0
  430. package/dist/screens/PluginScreen/PluginScreenScreen.d.ts.map +1 -0
  431. package/dist/screens/PluginScreen/PluginScreenScreen.js +16 -0
  432. package/dist/screens/PluginScreen/PluginScreenScreen.js.map +1 -0
  433. package/dist/screens/Plugins/PluginActivityDialog.d.ts +7 -0
  434. package/dist/screens/Plugins/PluginActivityDialog.d.ts.map +1 -0
  435. package/dist/screens/Plugins/PluginActivityDialog.js +49 -0
  436. package/dist/screens/Plugins/PluginActivityDialog.js.map +1 -0
  437. package/dist/screens/Plugins/PluginSecrets.d.ts +7 -0
  438. package/dist/screens/Plugins/PluginSecrets.d.ts.map +1 -0
  439. package/dist/screens/Plugins/PluginSecrets.js +44 -0
  440. package/dist/screens/Plugins/PluginSecrets.js.map +1 -0
  441. package/dist/screens/Plugins/PluginSettingsDialog.d.ts +7 -0
  442. package/dist/screens/Plugins/PluginSettingsDialog.d.ts.map +1 -0
  443. package/dist/screens/Plugins/PluginSettingsDialog.js +46 -0
  444. package/dist/screens/Plugins/PluginSettingsDialog.js.map +1 -0
  445. package/dist/screens/Plugins/PluginsScreen.d.ts +3 -0
  446. package/dist/screens/Plugins/PluginsScreen.d.ts.map +1 -0
  447. package/dist/screens/Plugins/PluginsScreen.js +68 -0
  448. package/dist/screens/Plugins/PluginsScreen.js.map +1 -0
  449. package/dist/screens/Settings/EmailSettings.d.ts +3 -0
  450. package/dist/screens/Settings/EmailSettings.d.ts.map +1 -0
  451. package/dist/screens/Settings/EmailSettings.js +76 -0
  452. package/dist/screens/Settings/EmailSettings.js.map +1 -0
  453. package/dist/screens/Settings/FormsSettings.d.ts +3 -0
  454. package/dist/screens/Settings/FormsSettings.d.ts.map +1 -0
  455. package/dist/screens/Settings/FormsSettings.js +91 -0
  456. package/dist/screens/Settings/FormsSettings.js.map +1 -0
  457. package/dist/screens/Settings/GeneralSettings.d.ts +3 -0
  458. package/dist/screens/Settings/GeneralSettings.d.ts.map +1 -0
  459. package/dist/screens/Settings/GeneralSettings.js +42 -0
  460. package/dist/screens/Settings/GeneralSettings.js.map +1 -0
  461. package/dist/screens/Settings/SettingsPage.d.ts +9 -0
  462. package/dist/screens/Settings/SettingsPage.d.ts.map +1 -0
  463. package/dist/screens/Settings/SettingsPage.js +42 -0
  464. package/dist/screens/Settings/SettingsPage.js.map +1 -0
  465. package/dist/screens/Settings/SettingsScreen.d.ts +7 -0
  466. package/dist/screens/Settings/SettingsScreen.d.ts.map +1 -0
  467. package/dist/screens/Settings/SettingsScreen.js +53 -0
  468. package/dist/screens/Settings/SettingsScreen.js.map +1 -0
  469. package/dist/screens/Settings/StorageSettings.d.ts +3 -0
  470. package/dist/screens/Settings/StorageSettings.d.ts.map +1 -0
  471. package/dist/screens/Settings/StorageSettings.js +82 -0
  472. package/dist/screens/Settings/StorageSettings.js.map +1 -0
  473. package/dist/screens/SignIn/SignInScreen.d.ts +6 -0
  474. package/dist/screens/SignIn/SignInScreen.d.ts.map +1 -0
  475. package/dist/screens/SignIn/SignInScreen.js +52 -0
  476. package/dist/screens/SignIn/SignInScreen.js.map +1 -0
  477. package/dist/screens/Trash/TrashScreen.d.ts +3 -0
  478. package/dist/screens/Trash/TrashScreen.d.ts.map +1 -0
  479. package/dist/screens/Trash/TrashScreen.js +73 -0
  480. package/dist/screens/Trash/TrashScreen.js.map +1 -0
  481. package/dist/standalone/config.d.ts +19 -0
  482. package/dist/standalone/config.d.ts.map +1 -0
  483. package/dist/standalone/config.js +20 -0
  484. package/dist/standalone/config.js.map +1 -0
  485. package/dist/standalone/main.d.ts +7 -0
  486. package/dist/standalone/main.d.ts.map +1 -0
  487. package/dist/standalone/main.js +26 -0
  488. package/dist/standalone/main.js.map +1 -0
  489. package/dist/testing/admin-client-contract.d.ts +24 -0
  490. package/dist/testing/admin-client-contract.d.ts.map +1 -0
  491. package/dist/testing/admin-client-contract.js +615 -0
  492. package/dist/testing/admin-client-contract.js.map +1 -0
  493. package/dist/testing/http-server.d.ts +18 -0
  494. package/dist/testing/http-server.d.ts.map +1 -0
  495. package/dist/testing/http-server.js +56 -0
  496. package/dist/testing/http-server.js.map +1 -0
  497. package/dist/testing/index.d.ts +3 -0
  498. package/dist/testing/index.d.ts.map +1 -0
  499. package/dist/testing/index.js +3 -0
  500. package/dist/testing/index.js.map +1 -0
  501. package/dist/testing/memory-client.d.ts +166 -0
  502. package/dist/testing/memory-client.d.ts.map +1 -0
  503. package/dist/testing/memory-client.js +449 -0
  504. package/dist/testing/memory-client.js.map +1 -0
  505. package/dist/testing/memory-mail.d.ts +48 -0
  506. package/dist/testing/memory-mail.d.ts.map +1 -0
  507. package/dist/testing/memory-mail.js +74 -0
  508. package/dist/testing/memory-mail.js.map +1 -0
  509. package/dist/testing/memory-people.d.ts +18 -0
  510. package/dist/testing/memory-people.d.ts.map +1 -0
  511. package/dist/testing/memory-people.js +70 -0
  512. package/dist/testing/memory-people.js.map +1 -0
  513. package/dist/testing/render-app.d.ts +8 -0
  514. package/dist/testing/render-app.d.ts.map +1 -0
  515. package/dist/testing/render-app.js +10 -0
  516. package/dist/testing/render-app.js.map +1 -0
  517. package/dist/testing/sample-content.d.ts +29 -0
  518. package/dist/testing/sample-content.d.ts.map +1 -0
  519. package/dist/testing/sample-content.js +258 -0
  520. package/dist/testing/sample-content.js.map +1 -0
  521. package/package.json +74 -3
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { EmptyState, Link } from '@velocity-astro/cms-ui';
3
+ import { isTrashed } from '@velocity-astro/cms-core';
4
+ import { FileQuestion, Trash2 } from 'lucide-react';
5
+ import { useState } from 'react';
6
+ import { Navigate, useLocation, useParams } from 'react-router';
7
+ import { useGo } from '../../app/use-go.js';
8
+ import { NEW_ENTRY, paths } from '../../app/paths.js';
9
+ import { ErrorState, LoadingState } from '../../app/RequestState.js';
10
+ import { AdminRequestError } from '../../client/errors.js';
11
+ import { useContentTypes, useEntries, useEntry, useFieldTypes } from '../../client/queries.js';
12
+ import { localized } from '../../lib/content.js';
13
+ import { useLocale, useMessages } from '../../messages/messages-context.js';
14
+ import { EntryForm } from './EntryForm.js';
15
+ /** One entry, open for editing: a new one, or one that exists. */
16
+ export function EntryEditorScreen() {
17
+ const messages = useMessages();
18
+ const locale = useLocale();
19
+ const go = useGo();
20
+ // What the address says beside the entry (the page having the whole window) goes along to its other language.
21
+ const { search } = useLocation();
22
+ const { typeKey = '', entryId = NEW_ENTRY } = useParams();
23
+ const isNew = entryId === NEW_ENTRY;
24
+ const types = useContentTypes();
25
+ const fieldTypes = useFieldTypes();
26
+ const entry = useEntry(isNew ? null : entryId);
27
+ // The same request the list makes, so it is usually answered already. Only used to find the
28
+ // entry's other languages: if it fails, the entry can still be edited.
29
+ const siblings = useEntries({ type: typeKey, limit: 200 });
30
+ // The entry this screen created, if any. Its form carries on, instead of starting again.
31
+ const [createdId, setCreatedId] = useState(null);
32
+ if (types.isPending || fieldTypes.isPending)
33
+ return _jsx(LoadingState, { shape: "form" });
34
+ if (types.isError)
35
+ return _jsx(ErrorState, { error: types.error, onRetry: () => void types.refetch() });
36
+ if (fieldTypes.isError)
37
+ return _jsx(ErrorState, { error: fieldTypes.error, onRetry: () => void fieldTypes.refetch() });
38
+ const type = types.data.find((candidate) => candidate.key === typeKey);
39
+ if (!type) {
40
+ return (_jsx(EmptyState, { icon: FileQuestion, title: messages.contentList.typeNotFoundTitle, description: messages.contentList.typeNotFoundDescription }));
41
+ }
42
+ // A page that is part of the settings is edited there, whatever address someone kept.
43
+ if (type.inSettings === true)
44
+ return _jsx(Navigate, { to: paths.settingsPage(type.key), replace: true });
45
+ const notFound = (_jsx(EmptyState, { icon: FileQuestion, title: messages.editor.notFoundTitle, description: messages.editor.notFoundDescription, action: _jsx(Link, { href: paths.contentList(type.key), children: messages.editor.back(localized(type.label, locale)) }) }));
46
+ if (!isNew) {
47
+ if (entry.isPending)
48
+ return _jsx(LoadingState, { shape: "form" });
49
+ if (entry.isError) {
50
+ const isMissing = entry.error instanceof AdminRequestError && entry.error.code === 'not_found';
51
+ return isMissing ? notFound : _jsx(ErrorState, { error: entry.error, onRetry: () => void entry.refetch() });
52
+ }
53
+ // An entry reached through another type's address is not at this address.
54
+ if (entry.data.typeId !== type.id)
55
+ return notFound;
56
+ if (isTrashed(entry.data)) {
57
+ return (_jsx(EmptyState, { icon: Trash2, title: messages.editor.inTrashTitle, description: messages.editor.inTrashDescription, action: _jsx(Link, { href: paths.trash, children: messages.editor.openTrash }) }));
58
+ }
59
+ }
60
+ return (_jsx(EntryForm, { type: type, entry: isNew ? null : (entry.data ?? null), versions: isNew || !entry.data
61
+ ? []
62
+ : (siblings.data?.items ?? [])
63
+ .filter((other) => other.translationGroup === entry.data.translationGroup)
64
+ // Always in the same order, whichever was saved last.
65
+ .sort((a, b) => a.locale.localeCompare(b.locale)), onSwitch: (id) => go(`${paths.entry(type.key, id)}${search}`), onTrashed: () => go(paths.contentList(type.key)), onCreated: (created) => {
66
+ setCreatedId(created.id);
67
+ go(`${paths.entry(type.key, created.id)}${search}`, { replace: true, viewTransition: false });
68
+ } }, entryId === createdId ? NEW_ENTRY : entryId));
69
+ }
70
+ //# sourceMappingURL=EntryEditorScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntryEditorScreen.js","sourceRoot":"","sources":["../../../src/screens/EntryEditor/EntryEditorScreen.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+ import type { ContentTypeDef, Entry } from '@velocity-astro/cms-core';
2
+ /** How long after the last change the draft is saved by itself, in milliseconds. */
3
+ export declare const AUTOSAVE_PAUSE_MS = 2500;
4
+ export interface EntryFormProps {
5
+ readonly type: ContentTypeDef;
6
+ /** The entry as the server has it, or `null` for one that has not been saved yet. */
7
+ readonly entry: Entry | null;
8
+ /** Called once, when a new entry is saved for the first time. */
9
+ readonly onCreated: (entry: Entry) => void;
10
+ /** The entry in every language it exists in, this one included. Fewer than two shows no switch. */
11
+ readonly versions?: readonly Entry[];
12
+ /** Called with the id of the version the person chose to open instead. */
13
+ readonly onSwitch?: (entryId: string) => void;
14
+ /** Called once the entry has gone to the trash, so the screen can move on. */
15
+ readonly onTrashed?: () => void;
16
+ /** Set when the form is one part of a screen that has its own frame, such as a part of the settings. */
17
+ readonly embedded?: boolean;
18
+ }
19
+ /**
20
+ * The fields of one entry, and the bar that saves and publishes it.
21
+ *
22
+ * It holds what the person has typed. The server holds what is saved, and what is published.
23
+ * Saving sends the first to the second; publishing is a separate step the person chooses.
24
+ */
25
+ export declare function EntryForm({ type, entry, onCreated, versions, onSwitch, onTrashed, embedded }: EntryFormProps): import("react").JSX.Element;
26
+ //# sourceMappingURL=EntryForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntryForm.d.ts","sourceRoot":"","sources":["../../../src/screens/EntryEditor/EntryForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAuB,MAAM,0BAA0B,CAAC;AA0C3F,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3C,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAgB,EAAE,EAAE,cAAc,+BAqpBzH"}
@@ -0,0 +1,480 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { HOME_SLUG, SLUG_PATH, hasOwnPages, isSlug, isSlugPath, liveFields, takesSlugPath } from '@velocity-astro/cms-core';
3
+ import { Box, Button, Card, ConfirmDialog, Form, IconButton, Menu, SaveBar, Split, Stack, Tag, TextField, Workbench, toast } from '@velocity-astro/cms-ui';
4
+ import { CalendarClock, Copy, Ellipsis, ExternalLink, Eye, EyeOff, History, Languages, Palette, PanelRightClose, PanelRightOpen, Redo2, Save, Trash2, Undo2 } from 'lucide-react';
5
+ import { useCallback, useEffect, useRef, useState } from 'react';
6
+ import { useNavigate, useSearchParams } from 'react-router';
7
+ import { paths } from '../../app/paths.js';
8
+ import { AdminRequestError } from '../../client/errors.js';
9
+ import { useCreateEntry, useDuplicateEntry, useSession, usePreviewEntry, usePublishEntry, useTrashEntry, useUnpublishEntry, useUpdateEntry } from '../../client/queries.js';
10
+ import { HistoryDialog } from './HistoryDialog.js';
11
+ import { ScheduleDialog, scheduledFor } from './ScheduleDialog.js';
12
+ import { FieldGrid, PageFocusProvider, useControlFor } from '../../fields/index.js';
13
+ import { entryAddress, entryState, entryTitle, languageName, localized, sameData, withValue } from '../../lib/content.js';
14
+ import { openPreviewTab } from '../../lib/preview-tab.js';
15
+ import { openSite } from '../../lib/open-site.js';
16
+ import { relativeTime } from '../../lib/relative-time.js';
17
+ import { slugify } from '../../lib/slug.js';
18
+ import { useHistory } from '../../lib/use-history.js';
19
+ import { useLeaveGuard } from '../../lib/use-leave-guard.js';
20
+ import { useSaveKey } from '../../lib/use-save-key.js';
21
+ import { NARROW, useNarrow } from '../../lib/use-narrow.js';
22
+ import { useUndoKeys } from '../../lib/use-undo-keys.js';
23
+ import { usePanelSizes } from '../../lib/use-panel-sizes.js';
24
+ import { useLocale, useMessages } from '../../messages/messages-context.js';
25
+ import { PluginBoundary } from '../../plugins/PluginBoundary.js';
26
+ import { usePluginExtensions } from '../../plugins/plugin-editor.js';
27
+ import { EntryDeals } from './EntryDeals.js';
28
+ import { PagePane, PageWidths } from './PagePane.js';
29
+ import { SectionOutline } from './SectionOutline.js';
30
+ import { ThemeCard, themeTried, useSiteLooks } from './ThemeCard.js';
31
+ const STATE_TONE = { draft: 'neutral', scheduled: 'info', published: 'success', unpublishedChanges: 'warning' };
32
+ const NO_PROBLEMS = new Map();
33
+ /** How the address says the page has the whole window. */
34
+ const VIEW = 'view';
35
+ const VISUAL = 'visual';
36
+ /** How long after the last change the draft is saved by itself, in milliseconds. */
37
+ export const AUTOSAVE_PAUSE_MS = 2500;
38
+ /**
39
+ * The fields of one entry, and the bar that saves and publishes it.
40
+ *
41
+ * It holds what the person has typed. The server holds what is saved, and what is published.
42
+ * Saving sends the first to the second; publishing is a separate step the person chooses.
43
+ */
44
+ export function EntryForm({ type, entry, onCreated, versions = [], onSwitch, onTrashed, embedded = false }) {
45
+ const messages = useMessages();
46
+ const locale = useLocale();
47
+ const create = useCreateEntry();
48
+ const update = useUpdateEntry();
49
+ const publish = usePublishEntry();
50
+ const unpublish = useUnpublishEntry();
51
+ const trash = useTrashEntry();
52
+ const duplicate = useDuplicateEntry();
53
+ const previewLink = usePreviewEntry();
54
+ const session = useSession();
55
+ // What the form holds, with the steps that led to it, so a change can be taken back.
56
+ const history = useHistory(entry?.data ?? {}, sameData);
57
+ const data = history.value;
58
+ // The slug as typed. Until someone types one, a new entry's slug follows its title.
59
+ const [typedSlug, setTypedSlug] = useState(null);
60
+ const [slugProblem, setSlugProblem] = useState(null);
61
+ const [problems, setProblems] = useState(NO_PROBLEMS);
62
+ const [running, setRunning] = useState(null);
63
+ // Counts the saves made by themselves, so what was typed during one is saved after it.
64
+ const [autosaveTurn, setAutosaveTurn] = useState(0);
65
+ const [isConfirmingUnpublish, setConfirmingUnpublish] = useState(false);
66
+ const [isConfirmingTrash, setConfirmingTrash] = useState(false);
67
+ const [isShowingHistory, setShowingHistory] = useState(false);
68
+ const [panelSizes, keepPanelSizes] = usePanelSizes();
69
+ const [isScheduling, setScheduling] = useState(false);
70
+ // The visual editor: the page has the whole window, and the form is a panel at its side.
71
+ // Which of the two is part of the address, so a reload keeps it, the browser's way back leads
72
+ // from the page to the form, and the entry's other language opens the same way.
73
+ const [address, setAddress] = useSearchParams();
74
+ const navigate = useNavigate();
75
+ const isVisual = address.get(VIEW) === VISUAL;
76
+ const openedHere = useRef(false);
77
+ const setVisual = (to) => {
78
+ if (to === isVisual)
79
+ return;
80
+ if (to) {
81
+ openedHere.current = true;
82
+ setAddress((before) => {
83
+ const next = new URLSearchParams(before);
84
+ next.set(VIEW, VISUAL);
85
+ return next;
86
+ });
87
+ }
88
+ else if (openedHere.current) {
89
+ // Opened from the form on this screen: the way back is the browser's own.
90
+ openedHere.current = false;
91
+ void navigate(-1);
92
+ }
93
+ else {
94
+ setAddress((before) => {
95
+ const next = new URLSearchParams(before);
96
+ next.delete(VIEW);
97
+ return next;
98
+ }, { replace: true });
99
+ }
100
+ };
101
+ const [isFormAway, setFormAway] = useState(true);
102
+ // On a phone the page is tried as a phone shows it: the desktop page, made to fit, would be too small to read.
103
+ const [pageWidth, setPageWidth] = useState(() => (window.innerWidth < NARROW ? 'phone' : 'full'));
104
+ // The site's theme, tried on the page beside the form: what is chosen and not published, and whether its card is in view.
105
+ const [themeDraft, setThemeDraft] = useState({});
106
+ const [isThemeShown, setThemeShown] = useState(false);
107
+ const looks = useSiteLooks(entry?.locale);
108
+ const themed = themeTried(looks, themeDraft);
109
+ const typeName = localized(type.label, locale);
110
+ const title = entryTitle(type, data);
111
+ // A single page is its type's one entry, so it is named after the type and nobody has to name it.
112
+ const isSingle = type.kind === 'single';
113
+ const slug = typedSlug ?? entry?.slug ?? (isSingle ? type.key : slugify(title ?? ''));
114
+ // A type whose address pattern says [...slug] has pages under other pages: services/roofing.
115
+ const isDeep = takesSlugPath(type);
116
+ const slugFits = isDeep ? isSlugPath(slug) : isSlug(slug);
117
+ const hasChanges = entry === null || slug !== entry.slug || !sameData(data, entry.data);
118
+ const state = entry ? entryState(entry) : 'draft';
119
+ // What would be lost by leaving now. A new entry nobody has typed in holds nothing, and a save
120
+ // under way moves on by itself.
121
+ const hasTyped = entry === null ? typedSlug !== null || Object.keys(data).length > 0 : hasChanges;
122
+ const guard = useLeaveGuard((hasTyped || themed.length > 0) && running === null);
123
+ // The draft saves itself once the typing pauses, so a closed tab or a lost connection costs a few
124
+ // seconds at most. Only a saved entry does: a new one is made when its person says so. Nothing is
125
+ // published by it, and it says nothing when it works: the bar does.
126
+ const revision = useRef(entry?.revision ?? 0);
127
+ revision.current = Math.max(revision.current, entry?.revision ?? 0);
128
+ const autosave = useRef(null);
129
+ const autosaved = useRef(null);
130
+ const held = useRef(data);
131
+ held.current = data;
132
+ const [autosaveFailed, setAutosaveFailed] = useState(false);
133
+ const settleNow = history.settle;
134
+ useEffect(() => {
135
+ if (entry === null || !hasChanges || running !== null || !slugFits)
136
+ return;
137
+ // What was tried is not tried again until something changes: a refusal would be met for ever.
138
+ if (autosaved.current?.data === data && autosaved.current.slug === slug)
139
+ return;
140
+ const waiting = setTimeout(() => {
141
+ if (autosave.current !== null)
142
+ return;
143
+ const sent = { data, slug };
144
+ autosaved.current = sent;
145
+ const done = keep(entry.id, slug, data).then((kept) => {
146
+ setAutosaveFailed(false);
147
+ // What the server made of it is taken only if nothing was typed meanwhile.
148
+ if (held.current === sent.data) {
149
+ // And only where it differs: the same words again would draw the page again under the caret.
150
+ if (!sameData(kept.data, sent.data))
151
+ settleNow(kept.data);
152
+ setTypedSlug(null);
153
+ }
154
+ return kept;
155
+ }, () => {
156
+ // Quietly: the bar says it is not saved, and "Save draft" says why.
157
+ setAutosaveFailed(true);
158
+ return null;
159
+ });
160
+ autosave.current = { ...sent, done };
161
+ void done.finally(() => {
162
+ autosave.current = null;
163
+ setAutosaveTurn((turn) => turn + 1);
164
+ });
165
+ }, AUTOSAVE_PAUSE_MS);
166
+ return () => clearTimeout(waiting);
167
+ // `keep` and the entry are read as they are when the pause ends.
168
+ }, [data, slug, hasChanges, running, slugFits, entry?.id, autosaveTurn]);
169
+ /** Shows why the server refused: on the fields when it named them, and always in a message. */
170
+ function report(what, error) {
171
+ const issues = error instanceof AdminRequestError ? error.issues : [];
172
+ const aboutSlug = issues.find((issue) => issue.path[0] === SLUG_PATH);
173
+ if (aboutSlug)
174
+ setSlugProblem(aboutSlug.message);
175
+ setProblems(new Map(issues.map((issue) => [issue.path.join('.'), issue.message])));
176
+ toast({
177
+ title: what,
178
+ description: issues.length > 0 ? messages.editor.fieldsNeedAttention(issues.length) : error instanceof Error ? error.message : String(error),
179
+ tone: 'danger',
180
+ });
181
+ }
182
+ /** Saves what has been typed, if anything has, and returns the entry as it now is. */
183
+ async function saved() {
184
+ if (entry === null) {
185
+ const created = await create.mutateAsync({ type: type.key, slug, data });
186
+ onCreated(created);
187
+ return created;
188
+ }
189
+ // A save made by itself may be on its way: it is waited for, and is the save when it sent just this.
190
+ const before = autosave.current;
191
+ if (before !== null) {
192
+ const kept = await before.done;
193
+ if (kept !== null && before.data === data && before.slug === slug)
194
+ return kept;
195
+ }
196
+ else if (!hasChanges)
197
+ return entry;
198
+ return keep(entry.id, slug, data);
199
+ }
200
+ /** Sends the working version to the server, as a save after the last one this form made. */
201
+ async function keep(id, slugNow, dataNow) {
202
+ const kept = await update.mutateAsync({ id, changes: { slug: slugNow, data: dataNow, expectedRevision: revision.current } });
203
+ revision.current = Math.max(revision.current, kept.revision);
204
+ return kept;
205
+ }
206
+ async function run(action) {
207
+ if (!slugFits) {
208
+ setSlugProblem(slug === '' ? messages.editor.slugMissing : isDeep ? messages.editor.slugPathInvalid : messages.editor.slugInvalid);
209
+ return;
210
+ }
211
+ setRunning(action);
212
+ setProblems(NO_PROBLEMS);
213
+ let current;
214
+ try {
215
+ current = await saved();
216
+ // The server's copy is now the starting point, so the form shows no changes.
217
+ history.settle(current.data);
218
+ setTypedSlug(null);
219
+ }
220
+ catch (error) {
221
+ report(messages.editor.notSaved, error);
222
+ setRunning(null);
223
+ return;
224
+ }
225
+ if (action === 'save') {
226
+ toast({ title: messages.editor.draftSaved, description: messages.editor.draftSavedDescription, tone: 'success' });
227
+ }
228
+ else {
229
+ try {
230
+ await publish.mutateAsync({ id: current.id, expectedRevision: current.revision });
231
+ toast({ title: messages.editor.published, description: messages.editor.publishedDescription, tone: 'success' });
232
+ }
233
+ catch (error) {
234
+ report(messages.editor.notPublished, error);
235
+ }
236
+ }
237
+ setRunning(null);
238
+ }
239
+ /** Saves what was typed, then shows the page as it would be in a new tab. */
240
+ async function preview() {
241
+ if (!slugFits) {
242
+ setSlugProblem(slug === '' ? messages.editor.slugMissing : isDeep ? messages.editor.slugPathInvalid : messages.editor.slugInvalid);
243
+ return;
244
+ }
245
+ // Opened now, while the browser still counts this as the person's own click.
246
+ const tab = openPreviewTab();
247
+ setRunning('preview');
248
+ setProblems(NO_PROBLEMS);
249
+ try {
250
+ const current = await saved();
251
+ history.settle(current.data);
252
+ setTypedSlug(null);
253
+ try {
254
+ tab.show((await previewLink.mutateAsync(current.id)).path);
255
+ }
256
+ catch (error) {
257
+ tab.close();
258
+ report(messages.editor.notPreviewed, error);
259
+ }
260
+ }
261
+ catch (error) {
262
+ tab.close();
263
+ report(messages.editor.notSaved, error);
264
+ }
265
+ setRunning(null);
266
+ }
267
+ async function takeOffSite(id) {
268
+ setRunning('unpublish');
269
+ try {
270
+ await unpublish.mutateAsync(id);
271
+ toast({ title: messages.editor.unpublished, description: messages.editor.unpublishedDescription });
272
+ }
273
+ catch (error) {
274
+ report(messages.editor.notUnpublished, error);
275
+ }
276
+ setConfirmingUnpublish(false);
277
+ setRunning(null);
278
+ }
279
+ async function moveToTrash(id) {
280
+ setRunning('trash');
281
+ try {
282
+ await trash.mutateAsync(id);
283
+ toast({ title: messages.editor.trashed(title ?? messages.contentList.untitled), description: messages.editor.trashedDescription });
284
+ // Still running, so the move away is not held up over what was typed.
285
+ onTrashed?.();
286
+ }
287
+ catch (error) {
288
+ report(messages.editor.notTrashed, error);
289
+ setConfirmingTrash(false);
290
+ setRunning(null);
291
+ }
292
+ }
293
+ /** Copies what was last saved, and opens the copy. */
294
+ async function makeCopy(id) {
295
+ setRunning('duplicate');
296
+ try {
297
+ const copy = await duplicate.mutateAsync(id);
298
+ toast({ title: messages.editor.duplicated(title ?? messages.contentList.untitled), description: messages.editor.duplicatedDescription, tone: 'success' });
299
+ onSwitch?.(copy.id);
300
+ }
301
+ catch (error) {
302
+ report(messages.editor.notDuplicated, error);
303
+ }
304
+ setRunning(null);
305
+ }
306
+ const isBusy = running !== null;
307
+ // The keys people save with everywhere else save the draft here, from the form and from the page.
308
+ const saveNow = () => {
309
+ if (!isBusy && hasChanges)
310
+ void run('save');
311
+ };
312
+ useSaveKey(saveNow);
313
+ // The theme is the whole site's, so choosing it is for those who may publish.
314
+ const canTheme = looks.length > 0 && session.data !== null && session.data !== undefined && session.data.role !== 'author';
315
+ // A step back or forward changes what the form holds, so what the server said of it no longer applies.
316
+ const { undo: stepBack, redo: stepForward } = history;
317
+ const undo = useCallback(() => {
318
+ stepBack();
319
+ setProblems(NO_PROBLEMS);
320
+ }, [stepBack]);
321
+ const redo = useCallback(() => {
322
+ stepForward();
323
+ setProblems(NO_PROBLEMS);
324
+ }, [stepForward]);
325
+ useUndoKeys(undo, redo);
326
+ // What fewer people come for sits behind one button, so the bar keeps to the main steps.
327
+ // Where visitors read this entry today, when it is published and has a page of its own.
328
+ const liveAddress = entry?.status === 'published' ? entryAddress(type, { locale: entry.locale, slug: entry.slug, data: entry.data }) : null;
329
+ // A type whose entries only show on other pages has nothing of its own to preview.
330
+ const hasPage = hasOwnPages(type);
331
+ // On a phone the bar keeps to what is pressed most: the rest is behind the one button.
332
+ const isPhone = useNarrow();
333
+ const more = [
334
+ ...(isPhone && hasPage ? [{ id: 'preview', label: messages.editor.preview, icon: Eye }] : []),
335
+ ...(liveAddress !== null ? [{ id: 'view', label: messages.editor.viewOnSite, icon: ExternalLink }] : []),
336
+ ...(entry?.status === 'published' ? [{ id: 'unpublish', label: messages.editor.unpublish, icon: EyeOff }] : []),
337
+ // A single page is its type's one entry: there is no second, and it is taken off the site, not thrown away.
338
+ // Setting a time is a publishing decision, which an author cannot make.
339
+ ...(entry !== null && session.data?.role !== 'author' ? [{ id: 'schedule', label: entry.publishAt !== undefined ? messages.editor.scheduleChange : messages.editor.schedule, icon: CalendarClock }] : []),
340
+ ...(entry !== null ? [{ id: 'history', label: messages.editor.history, icon: History }] : []),
341
+ ...(entry !== null && !isSingle ? [{ id: 'duplicate', label: messages.editor.duplicate, icon: Copy }] : []),
342
+ ...(entry !== null && !isSingle ? [{ id: 'trash', label: messages.editor.trash, icon: Trash2, tone: 'danger' }] : []),
343
+ ];
344
+ // The slug is part of the page's address only when the type's pattern says so. Otherwise it
345
+ // is a name other entries link by.
346
+ const slugName = isDeep ? '[...slug]' : '[slug]';
347
+ const slugPattern = type.urlPattern?.includes(slugName) ? type.urlPattern : undefined;
348
+ const slugHelp = (pattern) => {
349
+ // The page called index is the one at the top of the pattern: the home page.
350
+ if (isDeep && slug === HOME_SLUG)
351
+ return messages.editor.slugHomeDescription(pattern.replace(slugName, ''));
352
+ return (isDeep ? messages.editor.slugPathDescription : messages.editor.slugDescription)(pattern.replace(slugName, slug === '' ? '…' : slug));
353
+ };
354
+ const changeField = (field, value) => {
355
+ history.set((current) => withValue(current, field.id, value), field.id);
356
+ // A problem is about what was sent. Once the field changes, it no longer applies.
357
+ setProblems((current) => new Map([...current].filter(([path]) => path !== field.key && !path.startsWith(`${field.key}.`))));
358
+ };
359
+ // The type's own sections, then one for any field it left out of them. A type with no
360
+ // sections is one card.
361
+ const live = liveFields(type.fields);
362
+ const placed = new Set((type.sections ?? []).flatMap((section) => section.fieldIds));
363
+ const rest = live.filter((field) => !placed.has(field.id));
364
+ const sections = [
365
+ ...(type.sections ?? []).map((section) => ({
366
+ key: section.key,
367
+ title: localized(section.label, locale),
368
+ aside: section.aside === true,
369
+ fields: section.fieldIds.flatMap((id) => live.filter((field) => field.id === id)),
370
+ })),
371
+ ...(rest.length > 0 ? [{ key: '$rest', ...(type.sections?.length && { title: messages.editor.otherFields }), aside: false, fields: rest }] : []),
372
+ ];
373
+ // An entry whose fields include the page itself, and which has a page, is edited beside it.
374
+ const controlFor = useControlFor();
375
+ const showsPage = hasPage && live.some((field) => controlFor(field.type)?.showsPage === true);
376
+ // What plugins show beside this entry: a card each, which gets what is in the form now.
377
+ const panels = usePluginExtensions()
378
+ .panels.filter((panel) => (panel.types === undefined || panel.types.includes(type.key)) && (panel.pagesOnly !== true || hasPage))
379
+ .map((panel) => (_jsx(Card, { title: panel.title, children: _jsx(PluginBoundary, { children: _jsx(panel.Component, { type: type, entry: entry, data: data }) }) }, `${panel.plugin}/${panel.id}`)));
380
+ // Deals are as personal as contacts: the card is for those who may read them, on a saved entry.
381
+ const showsDeals = type.forDeals === true && entry !== null && session.data !== null && session.data !== undefined && session.data.role !== 'author';
382
+ // Right under the address, where it is seen without scrolling past the fields beside the content.
383
+ const dealsCard = showsDeals ? _jsx(EntryDeals, { type: type, entry: entry }) : null;
384
+ const savedNote = entry === null
385
+ ? messages.editor.notSavedYet
386
+ : hasChanges
387
+ ? autosaveFailed
388
+ ? messages.editor.notAutosaved
389
+ : messages.editor.unsavedChanges
390
+ : entry.publishAt !== undefined
391
+ ? messages.editor.goesOut(scheduledFor(entry.publishAt, locale))
392
+ : messages.editor.saved(relativeTime(entry.updatedAt, locale));
393
+ const card = (section) => (_jsx(Card, { ...(section.title !== undefined && { title: section.title }), children: _jsx(FieldGrid, { fields: section.fields, values: data, onChange: changeField, pathOf: (field) => field.key, problems: problems, ...(section.aside && { perRow: 1 }) }) }, section.key));
394
+ /** A card in the form's column beside the page, where there is room for one field per row. */
395
+ const narrowCard = (section) => card({ ...section, aside: true });
396
+ const heading = isSingle ? typeName : (title ?? (entry ? messages.contentList.untitled : messages.editor.newTitle));
397
+ const status = (_jsxs(_Fragment, { children: [_jsx(Tag, { tone: STATE_TONE[state], children: messages.status[state] }), entry?.publishProblem !== undefined && _jsx(Tag, { tone: "danger", children: messages.editor.missedSchedule })] }));
398
+ const onMore = (id) => {
399
+ if (id.startsWith('language:'))
400
+ return onSwitch?.(id.slice('language:'.length));
401
+ if (id === 'preview')
402
+ return void preview();
403
+ if (id === 'save')
404
+ return void run('save');
405
+ if (id === 'undo')
406
+ return undo();
407
+ if (id === 'redo')
408
+ return redo();
409
+ if (id === 'theme') {
410
+ if (!isThemeShown)
411
+ setFormAway(false);
412
+ return setThemeShown(!isThemeShown);
413
+ }
414
+ if (id === 'view')
415
+ return openSite(liveAddress ?? '/');
416
+ if (id === 'schedule')
417
+ return setScheduling(true);
418
+ if (id === 'history')
419
+ return setShowingHistory(true);
420
+ if (id === 'trash')
421
+ return setConfirmingTrash(true);
422
+ if (id === 'duplicate' && entry)
423
+ return void makeCopy(entry.id);
424
+ if (id === 'unpublish')
425
+ setConfirmingUnpublish(true);
426
+ };
427
+ // The entry in its other languages, for a menu where the bar has no room to show them all.
428
+ const languageMore = entry !== null ? versions.filter((version) => version.id !== entry.id).map((version) => ({ id: `language:${version.id}`, label: messages.editor.switchLanguage(languageName(version.locale, locale)), icon: Languages, isDisabled: isBusy })) : [];
429
+ // On a phone the bar's one row of buttons has no room for the languages either.
430
+ // A phone has one row for the bar, as on any phone: the way back, the name, this menu and Publish. Undo, redo
431
+ // and saving a draft are the menu's first items there.
432
+ const phoneSteps = isPhone
433
+ ? [
434
+ { id: 'undo', label: messages.editor.undo, icon: Undo2, isDisabled: !history.canUndo },
435
+ { id: 'redo', label: messages.editor.redo, icon: Redo2, isDisabled: !history.canRedo },
436
+ { id: 'save', label: messages.editor.saveDraft, icon: Save, isDisabled: !hasChanges },
437
+ ]
438
+ : [];
439
+ // A tab of the page as it would be published is asked for less than the page beside the form: it is in the menu.
440
+ const previewMore = hasPage && !isPhone ? [{ id: 'preview', label: messages.editor.preview, icon: Eye, isDisabled: running === 'preview' }] : [];
441
+ const formMore = isPhone ? [...phoneSteps, ...languageMore, ...more] : [...previewMore, ...more];
442
+ // The visual editor's menu holds what its bar has no room for: the entry's other languages and a preview tab first.
443
+ const visualMore = [
444
+ ...phoneSteps,
445
+ // The theme is tried now and then, not on every visit: it is in the menu, on every window.
446
+ ...(canTheme ? [{ id: 'theme', label: isThemeShown ? messages.editor.themeHide : messages.editor.theme, icon: Palette }] : []),
447
+ ...languageMore,
448
+ ...(hasPage && !more.some((action) => action.id === 'preview') ? [{ id: 'preview', label: messages.editor.preview, icon: Eye }] : []),
449
+ ...more,
450
+ ];
451
+ const actions = (_jsxs(_Fragment, { children: [entry !== null && versions.length > 1 && !isPhone && (_jsx(Menu, { trigger: _jsx(Button, { variant: "ghost", icon: Languages, isDisabled: isBusy, children: languageName(entry.locale, locale) }), actions: languageMore, onAction: onMore })), !isPhone && (_jsxs(_Fragment, { children: [_jsx(IconButton, { label: messages.editor.undo, icon: Undo2, isDisabled: isBusy || !history.canUndo, onPress: undo }), _jsx(IconButton, { label: messages.editor.redo, icon: Redo2, isDisabled: isBusy || !history.canRedo, onPress: redo })] })), formMore.length > 0 && (_jsx(Menu, { trigger: _jsx(IconButton, { label: messages.editor.more, icon: Ellipsis, isDisabled: isBusy }), actions: formMore, onAction: onMore })), !isPhone && (_jsx(Button, { variant: "secondary", isDisabled: isBusy || !hasChanges, isPending: running === 'save', onPress: () => void run('save'), children: messages.editor.saveDraft })), _jsx(Button, { isDisabled: isBusy || (state === 'published' && !hasChanges), isPending: running === 'publish', onPress: () => void run('publish'), children: entry?.status === 'published' && !isPhone ? messages.editor.publishChanges : messages.editor.publish })] }));
452
+ return (_jsxs(Stack, { gap: 0, fill: true, children: [!(showsPage && isVisual) && (_jsx(SaveBar, { label: messages.editor.saveBar,
453
+ // A form inside another screen (a page of the settings) keeps its bar with it: the screen has its own header.
454
+ across: embedded ? 'section' : 'screen', ...(!isSingle && { back: { href: paths.contentList(type.key), label: typeName } }), title: heading, status: status, note: savedNote, actions: actions })), _jsx(Box, { paddingX: embedded ? 0 : 12, paddingY: 8, grow: true, children: _jsx(Form, { label: messages.editor.form, gap: 5, onSubmit: () => void run('save'), children: showsPage ? (
455
+ // The page is beside the form, so everything else is in the form's one column.
456
+ _jsx(PageFocusProvider, { children: _jsxs(Workbench, { paneLabel: messages.editor.pagePane, view: isVisual ? 'whole' : 'beside', isFormAway: isFormAway, ...(panelSizes !== undefined && { sizes: panelSizes }), onSizesChange: keepPanelSizes, resizeLabels: { outline: messages.editor.resizeOutline, form: messages.editor.resizeForm }, outline: _jsx(SectionOutline, { onChosen: () => setFormAway(false) }), outlineLabel: messages.editor.outlineLabel, bar: _jsx(SaveBar, { across: "window", label: messages.editor.saveBar, back: { label: messages.editor.visualClose, onPress: () => setVisual(false) }, title: heading, status: status, note: savedNote, ...(!isPhone && { center: _jsx(PageWidths, { width: pageWidth, onChange: setPageWidth, isIconOnly: true }) }), actions: _jsxs(_Fragment, { children: [_jsx(IconButton, { label: isFormAway ? messages.editor.visualShowForm : messages.editor.visualHideForm, icon: isFormAway ? PanelRightOpen : PanelRightClose, onPress: () => setFormAway(!isFormAway) }), !isPhone && (_jsxs(_Fragment, { children: [_jsx(IconButton, { label: messages.editor.undo, icon: Undo2, isDisabled: isBusy || !history.canUndo, onPress: undo }), _jsx(IconButton, { label: messages.editor.redo, icon: Redo2, isDisabled: isBusy || !history.canRedo, onPress: redo })] })), _jsx(Menu, { trigger: _jsx(IconButton, { label: messages.editor.more, icon: Ellipsis, isDisabled: isBusy }), actions: visualMore, onAction: onMore }), !isPhone && (_jsx(Button, { variant: "secondary", isDisabled: isBusy || !hasChanges, isPending: running === 'save', onPress: () => void run('save'), children: messages.editor.saveDraft })), _jsx(Button, { variant: "brand", isDisabled: isBusy || (state === 'published' && !hasChanges), isPending: running === 'publish', onPress: () => void run('publish'), children: entry?.status === 'published' && !isPhone ? messages.editor.publishChanges : messages.editor.publish })] }) }), pane: _jsx(PagePane, { entry: entry, data: data, title: title ?? typeName, width: pageWidth, onWidthChange: setPageWidth, isWhole: isVisual, onWhole: () => {
457
+ setFormAway(true);
458
+ setVisual(true);
459
+ }, onFormWanted: () => setFormAway(false), also: themed, onUndo: undo, onRedo: redo, onSave: saveNow }), children: [canTheme && isThemeShown && _jsx(ThemeCard, { looks: looks, draft: themeDraft, onChange: setThemeDraft }), sections.filter((section) => !section.aside).map(narrowCard), !isSingle && (_jsx(Card, { title: slugPattern !== undefined ? messages.editor.addressSection : messages.editor.identifierSection, children: _jsx(TextField, { label: messages.editor.slug, value: slug, onChange: (next) => {
460
+ setTypedSlug(next);
461
+ setSlugProblem(null);
462
+ }, isRequired: true, description: slugPattern !== undefined
463
+ ? slugHelp(slugPattern)
464
+ : messages.editor.slugAsIdentifier, ...(slugProblem !== null && { errorMessage: slugProblem }) }) })), dealsCard, sections.filter((section) => section.aside).map(card), panels] }) })) : isSingle && panels.length === 0 && !showsDeals && !sections.some((section) => section.aside) ? (
465
+ // Nothing to show beside the content, so the content has the page.
466
+ _jsx(Stack, { gap: 6, children: sections.map(card) })) : (_jsx(Split, { asideLabel: messages.editor.aside, aside: _jsxs(_Fragment, { children: [!isSingle && (_jsx(Card, { title: slugPattern !== undefined ? messages.editor.addressSection : messages.editor.identifierSection, children: _jsx(TextField, { label: messages.editor.slug, value: slug, onChange: (next) => {
467
+ setTypedSlug(next);
468
+ setSlugProblem(null);
469
+ }, isRequired: true, description: slugPattern !== undefined
470
+ ? slugHelp(slugPattern)
471
+ : messages.editor.slugAsIdentifier, ...(slugProblem !== null && { errorMessage: slugProblem }) }) })), dealsCard, sections.filter((section) => section.aside).map(card), panels] }), children: sections.filter((section) => !section.aside).map(card) })) }) }), isScheduling && entry !== null && _jsx(ScheduleDialog, { entry: entry, hasChanges: hasChanges, onClose: () => setScheduling(false) }), isShowingHistory && entry !== null && (_jsx(HistoryDialog, { type: type, entry: entry, hasChanges: hasChanges, onReverted: (reverted) => {
472
+ // The form starts again from what was brought back.
473
+ history.restart(reverted.data);
474
+ setProblems(NO_PROBLEMS);
475
+ }, onClose: () => setShowingHistory(false) })), _jsx(ConfirmDialog, { isOpen: guard.isAsking, onOpenChange: (isOpen) => {
476
+ if (!isOpen)
477
+ guard.stay();
478
+ }, title: messages.editor.leaveTitle, confirmLabel: messages.editor.leave, cancelLabel: messages.editor.keepEditing, tone: "danger", onConfirm: guard.leave, children: messages.editor.leaveDescription }), entry !== null && (_jsx(ConfirmDialog, { isOpen: isConfirmingUnpublish, onOpenChange: setConfirmingUnpublish, title: messages.editor.unpublishTitle, confirmLabel: messages.editor.unpublish, cancelLabel: messages.editor.cancel, tone: "danger", isPending: running === 'unpublish', onConfirm: () => void takeOffSite(entry.id), children: messages.editor.unpublishDescription })), entry !== null && (_jsx(ConfirmDialog, { isOpen: isConfirmingTrash, onOpenChange: setConfirmingTrash, title: messages.editor.trashTitle, confirmLabel: messages.editor.trash, cancelLabel: messages.editor.cancel, tone: "danger", isPending: running === 'trash', onConfirm: () => void moveToTrash(entry.id), children: entry.status === 'published' ? messages.editor.trashDescriptionPublished : messages.editor.trashDescription }))] }));
479
+ }
480
+ //# sourceMappingURL=EntryForm.js.map