@nodehive/nextjs 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (777) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/dist/auth/index.d.ts +6 -0
  4. package/dist/auth/index.d.ts.map +1 -0
  5. package/dist/auth/index.js +7 -0
  6. package/dist/auth/index.js.map +1 -0
  7. package/dist/auth/internal/config.d.ts +24 -0
  8. package/dist/auth/internal/config.d.ts.map +1 -0
  9. package/dist/auth/internal/config.js +2 -0
  10. package/dist/auth/internal/config.js.map +1 -0
  11. package/dist/auth/internal/draft-mode.d.ts +17 -0
  12. package/dist/auth/internal/draft-mode.d.ts.map +1 -0
  13. package/dist/auth/internal/draft-mode.js +73 -0
  14. package/dist/auth/internal/draft-mode.js.map +1 -0
  15. package/dist/auth/internal/editor-locale.d.ts +4 -0
  16. package/dist/auth/internal/editor-locale.d.ts.map +1 -0
  17. package/dist/auth/internal/editor-locale.js +14 -0
  18. package/dist/auth/internal/editor-locale.js.map +1 -0
  19. package/dist/auth/internal/handoff.d.ts +11 -0
  20. package/dist/auth/internal/handoff.d.ts.map +1 -0
  21. package/dist/auth/internal/handoff.js +44 -0
  22. package/dist/auth/internal/handoff.js.map +1 -0
  23. package/dist/auth/internal/has-session.d.ts +7 -0
  24. package/dist/auth/internal/has-session.d.ts.map +1 -0
  25. package/dist/auth/internal/has-session.js +11 -0
  26. package/dist/auth/internal/has-session.js.map +1 -0
  27. package/dist/auth/internal/logout.d.ts +12 -0
  28. package/dist/auth/internal/logout.d.ts.map +1 -0
  29. package/dist/auth/internal/logout.js +48 -0
  30. package/dist/auth/internal/logout.js.map +1 -0
  31. package/dist/auth/internal/next-cookie-storage.d.ts +28 -0
  32. package/dist/auth/internal/next-cookie-storage.d.ts.map +1 -0
  33. package/dist/auth/internal/next-cookie-storage.js +103 -0
  34. package/dist/auth/internal/next-cookie-storage.js.map +1 -0
  35. package/dist/auth/internal/nodehive-client.d.ts +6 -0
  36. package/dist/auth/internal/nodehive-client.d.ts.map +1 -0
  37. package/dist/auth/internal/nodehive-client.js +64 -0
  38. package/dist/auth/internal/nodehive-client.js.map +1 -0
  39. package/dist/auth/internal/oauth-config.d.ts +37 -0
  40. package/dist/auth/internal/oauth-config.d.ts.map +1 -0
  41. package/dist/auth/internal/oauth-config.js +70 -0
  42. package/dist/auth/internal/oauth-config.js.map +1 -0
  43. package/dist/auth/internal/proxy-helpers.d.ts +15 -0
  44. package/dist/auth/internal/proxy-helpers.d.ts.map +1 -0
  45. package/dist/auth/internal/proxy-helpers.js +43 -0
  46. package/dist/auth/internal/proxy-helpers.js.map +1 -0
  47. package/dist/auth/internal/refresh.d.ts +13 -0
  48. package/dist/auth/internal/refresh.d.ts.map +1 -0
  49. package/dist/auth/internal/refresh.js +170 -0
  50. package/dist/auth/internal/refresh.js.map +1 -0
  51. package/dist/auth/internal/require-auth.d.ts +2 -0
  52. package/dist/auth/internal/require-auth.d.ts.map +1 -0
  53. package/dist/auth/internal/require-auth.js +11 -0
  54. package/dist/auth/internal/require-auth.js.map +1 -0
  55. package/dist/auth/internal/return-to.d.ts +16 -0
  56. package/dist/auth/internal/return-to.d.ts.map +1 -0
  57. package/dist/auth/internal/return-to.js +31 -0
  58. package/dist/auth/internal/return-to.js.map +1 -0
  59. package/dist/auth/internal/routes/callback.d.ts +11 -0
  60. package/dist/auth/internal/routes/callback.d.ts.map +1 -0
  61. package/dist/auth/internal/routes/callback.js +93 -0
  62. package/dist/auth/internal/routes/callback.js.map +1 -0
  63. package/dist/auth/internal/routes/chips-exchange.d.ts +4 -0
  64. package/dist/auth/internal/routes/chips-exchange.d.ts.map +1 -0
  65. package/dist/auth/internal/routes/chips-exchange.js +64 -0
  66. package/dist/auth/internal/routes/chips-exchange.js.map +1 -0
  67. package/dist/auth/internal/routes/draft.d.ts +4 -0
  68. package/dist/auth/internal/routes/draft.d.ts.map +1 -0
  69. package/dist/auth/internal/routes/draft.js +34 -0
  70. package/dist/auth/internal/routes/draft.js.map +1 -0
  71. package/dist/auth/internal/routes/index.d.ts +25 -0
  72. package/dist/auth/internal/routes/index.d.ts.map +1 -0
  73. package/dist/auth/internal/routes/index.js +66 -0
  74. package/dist/auth/internal/routes/index.js.map +1 -0
  75. package/dist/auth/internal/routes/login.d.ts +3 -0
  76. package/dist/auth/internal/routes/login.d.ts.map +1 -0
  77. package/dist/auth/internal/routes/login.js +47 -0
  78. package/dist/auth/internal/routes/login.js.map +1 -0
  79. package/dist/auth/internal/routes/popup-done.d.ts +3 -0
  80. package/dist/auth/internal/routes/popup-done.d.ts.map +1 -0
  81. package/dist/auth/internal/routes/popup-done.js +24 -0
  82. package/dist/auth/internal/routes/popup-done.js.map +1 -0
  83. package/dist/auth/internal/routes/refresh.d.ts +6 -0
  84. package/dist/auth/internal/routes/refresh.d.ts.map +1 -0
  85. package/dist/auth/internal/routes/refresh.js +44 -0
  86. package/dist/auth/internal/routes/refresh.js.map +1 -0
  87. package/dist/auth/internal/same-origin.d.ts +8 -0
  88. package/dist/auth/internal/same-origin.d.ts.map +1 -0
  89. package/dist/auth/internal/same-origin.js +9 -0
  90. package/dist/auth/internal/same-origin.js.map +1 -0
  91. package/dist/auth/internal/session-gates.d.ts +7 -0
  92. package/dist/auth/internal/session-gates.d.ts.map +1 -0
  93. package/dist/auth/internal/session-gates.js +12 -0
  94. package/dist/auth/internal/session-gates.js.map +1 -0
  95. package/dist/auth/internal/update-session.d.ts +17 -0
  96. package/dist/auth/internal/update-session.d.ts.map +1 -0
  97. package/dist/auth/internal/update-session.js +39 -0
  98. package/dist/auth/internal/update-session.js.map +1 -0
  99. package/dist/auth/internal/use-editor-login.d.ts +33 -0
  100. package/dist/auth/internal/use-editor-login.d.ts.map +1 -0
  101. package/dist/auth/internal/use-editor-login.js +143 -0
  102. package/dist/auth/internal/use-editor-login.js.map +1 -0
  103. package/dist/auth/proxy.d.ts +8 -0
  104. package/dist/auth/proxy.d.ts.map +1 -0
  105. package/dist/auth/proxy.js +8 -0
  106. package/dist/auth/proxy.js.map +1 -0
  107. package/dist/auth/react.d.ts +2 -0
  108. package/dist/auth/react.d.ts.map +1 -0
  109. package/dist/auth/react.js +3 -0
  110. package/dist/auth/react.js.map +1 -0
  111. package/dist/auth/routes.d.ts +3 -0
  112. package/dist/auth/routes.d.ts.map +1 -0
  113. package/dist/auth/routes.js +3 -0
  114. package/dist/auth/routes.js.map +1 -0
  115. package/dist/auth/server.d.ts +23 -0
  116. package/dist/auth/server.d.ts.map +1 -0
  117. package/dist/auth/server.js +61 -0
  118. package/dist/auth/server.js.map +1 -0
  119. package/dist/puck-editor/fields.d.ts +7 -0
  120. package/dist/puck-editor/fields.d.ts.map +1 -0
  121. package/dist/puck-editor/fields.js +4 -0
  122. package/dist/puck-editor/fields.js.map +1 -0
  123. package/dist/puck-editor/index.d.ts +14 -0
  124. package/dist/puck-editor/index.d.ts.map +1 -0
  125. package/dist/puck-editor/index.js +12 -0
  126. package/dist/puck-editor/index.js.map +1 -0
  127. package/dist/puck-editor/internal/api/client.d.ts +32 -0
  128. package/dist/puck-editor/internal/api/client.d.ts.map +1 -0
  129. package/dist/puck-editor/internal/api/client.js +128 -0
  130. package/dist/puck-editor/internal/api/client.js.map +1 -0
  131. package/dist/puck-editor/internal/api/config.d.ts +29 -0
  132. package/dist/puck-editor/internal/api/config.d.ts.map +1 -0
  133. package/dist/puck-editor/internal/api/config.js +2 -0
  134. package/dist/puck-editor/internal/api/config.js.map +1 -0
  135. package/dist/puck-editor/internal/api/create-puck-api.d.ts +26 -0
  136. package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +1 -0
  137. package/dist/puck-editor/internal/api/create-puck-api.js +124 -0
  138. package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -0
  139. package/dist/puck-editor/internal/api/handlers/create-page.d.ts +13 -0
  140. package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +1 -0
  141. package/dist/puck-editor/internal/api/handlers/create-page.js +125 -0
  142. package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -0
  143. package/dist/puck-editor/internal/api/handlers/entities.d.ts +17 -0
  144. package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +1 -0
  145. package/dist/puck-editor/internal/api/handlers/entities.js +166 -0
  146. package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -0
  147. package/dist/puck-editor/internal/api/handlers/publish.d.ts +6 -0
  148. package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +1 -0
  149. package/dist/puck-editor/internal/api/handlers/publish.js +115 -0
  150. package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -0
  151. package/dist/puck-editor/internal/api/handlers/template.d.ts +15 -0
  152. package/dist/puck-editor/internal/api/handlers/template.d.ts.map +1 -0
  153. package/dist/puck-editor/internal/api/handlers/template.js +222 -0
  154. package/dist/puck-editor/internal/api/handlers/template.js.map +1 -0
  155. package/dist/puck-editor/internal/api/handlers/upload.d.ts +13 -0
  156. package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +1 -0
  157. package/dist/puck-editor/internal/api/handlers/upload.js +129 -0
  158. package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -0
  159. package/dist/puck-editor/internal/api/media-params.d.ts +4 -0
  160. package/dist/puck-editor/internal/api/media-params.d.ts.map +1 -0
  161. package/dist/puck-editor/internal/api/media-params.js +38 -0
  162. package/dist/puck-editor/internal/api/media-params.js.map +1 -0
  163. package/dist/puck-editor/internal/api/media-upload.d.ts +24 -0
  164. package/dist/puck-editor/internal/api/media-upload.d.ts.map +1 -0
  165. package/dist/puck-editor/internal/api/media-upload.js +171 -0
  166. package/dist/puck-editor/internal/api/media-upload.js.map +1 -0
  167. package/dist/puck-editor/internal/api/space.d.ts +4 -0
  168. package/dist/puck-editor/internal/api/space.d.ts.map +1 -0
  169. package/dist/puck-editor/internal/api/space.js +11 -0
  170. package/dist/puck-editor/internal/api/space.js.map +1 -0
  171. package/dist/puck-editor/internal/content-model.d.ts +55 -0
  172. package/dist/puck-editor/internal/content-model.d.ts.map +1 -0
  173. package/dist/puck-editor/internal/content-model.js +73 -0
  174. package/dist/puck-editor/internal/content-model.js.map +1 -0
  175. package/dist/puck-editor/internal/editor/allowed-types.d.ts +4 -0
  176. package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +1 -0
  177. package/dist/puck-editor/internal/editor/allowed-types.js +6 -0
  178. package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -0
  179. package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +9 -0
  180. package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +1 -0
  181. package/dist/puck-editor/internal/editor/canvas-add-picker.js +231 -0
  182. package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -0
  183. package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +6 -0
  184. package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +1 -0
  185. package/dist/puck-editor/internal/editor/canvas-empty-state.js +85 -0
  186. package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -0
  187. package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +2 -0
  188. package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +1 -0
  189. package/dist/puck-editor/internal/editor/canvas-quick-add.js +844 -0
  190. package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -0
  191. package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +3 -0
  192. package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +1 -0
  193. package/dist/puck-editor/internal/editor/canvas-scroll.js +16 -0
  194. package/dist/puck-editor/internal/editor/canvas-scroll.js.map +1 -0
  195. package/dist/puck-editor/internal/editor/component-icons.d.ts +14 -0
  196. package/dist/puck-editor/internal/editor/component-icons.d.ts.map +1 -0
  197. package/dist/puck-editor/internal/editor/component-icons.js +35 -0
  198. package/dist/puck-editor/internal/editor/component-icons.js.map +1 -0
  199. package/dist/puck-editor/internal/editor/component-item.d.ts +6 -0
  200. package/dist/puck-editor/internal/editor/component-item.d.ts.map +1 -0
  201. package/dist/puck-editor/internal/editor/component-item.js +42 -0
  202. package/dist/puck-editor/internal/editor/component-item.js.map +1 -0
  203. package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +6 -0
  204. package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +1 -0
  205. package/dist/puck-editor/internal/editor/editor-action-bar.js +249 -0
  206. package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -0
  207. package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +7 -0
  208. package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +1 -0
  209. package/dist/puck-editor/internal/editor/editor-header-actions.js +120 -0
  210. package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -0
  211. package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +15 -0
  212. package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +1 -0
  213. package/dist/puck-editor/internal/editor/find-missing-required-fields.js +61 -0
  214. package/dist/puck-editor/internal/editor/find-missing-required-fields.js.map +1 -0
  215. package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +15 -0
  216. package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +1 -0
  217. package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +147 -0
  218. package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -0
  219. package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +17 -0
  220. package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +1 -0
  221. package/dist/puck-editor/internal/editor/grouped-entry-list.js +125 -0
  222. package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -0
  223. package/dist/puck-editor/internal/editor/header-save-button.d.ts +5 -0
  224. package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +1 -0
  225. package/dist/puck-editor/internal/editor/header-save-button.js +60 -0
  226. package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -0
  227. package/dist/puck-editor/internal/editor/page-template-picker.d.ts +4 -0
  228. package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +1 -0
  229. package/dist/puck-editor/internal/editor/page-template-picker.js +140 -0
  230. package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -0
  231. package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +6 -0
  232. package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +1 -0
  233. package/dist/puck-editor/internal/editor/picker-entry-item.js +79 -0
  234. package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -0
  235. package/dist/puck-editor/internal/editor/picker-model.d.ts +62 -0
  236. package/dist/puck-editor/internal/editor/picker-model.d.ts.map +1 -0
  237. package/dist/puck-editor/internal/editor/picker-model.js +489 -0
  238. package/dist/puck-editor/internal/editor/picker-model.js.map +1 -0
  239. package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +30 -0
  240. package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +1 -0
  241. package/dist/puck-editor/internal/editor/publish-puck-data.js +30 -0
  242. package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -0
  243. package/dist/puck-editor/internal/editor/puck-editor.d.ts +15 -0
  244. package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +1 -0
  245. package/dist/puck-editor/internal/editor/puck-editor.js +333 -0
  246. package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -0
  247. package/dist/puck-editor/internal/editor/section-template-modal.d.ts +4 -0
  248. package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +1 -0
  249. package/dist/puck-editor/internal/editor/section-template-modal.js +71 -0
  250. package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -0
  251. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +15 -0
  252. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +1 -0
  253. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js +93 -0
  254. package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js.map +1 -0
  255. package/dist/puck-editor/internal/editor-config.d.ts +30 -0
  256. package/dist/puck-editor/internal/editor-config.d.ts.map +1 -0
  257. package/dist/puck-editor/internal/editor-config.js +57 -0
  258. package/dist/puck-editor/internal/editor-config.js.map +1 -0
  259. package/dist/puck-editor/internal/editor-query-client.d.ts +4 -0
  260. package/dist/puck-editor/internal/editor-query-client.d.ts.map +1 -0
  261. package/dist/puck-editor/internal/editor-query-client.js +8 -0
  262. package/dist/puck-editor/internal/editor-query-client.js.map +1 -0
  263. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +14 -0
  264. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +1 -0
  265. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +120 -0
  266. package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -0
  267. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +21 -0
  268. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +1 -0
  269. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +24 -0
  270. package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -0
  271. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +16 -0
  272. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +1 -0
  273. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +20 -0
  274. package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -0
  275. package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +8 -0
  276. package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +1 -0
  277. package/dist/puck-editor/internal/fields/date-picker/date-picker.js +151 -0
  278. package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -0
  279. package/dist/puck-editor/internal/fields/index.d.ts +10 -0
  280. package/dist/puck-editor/internal/fields/index.d.ts.map +1 -0
  281. package/dist/puck-editor/internal/fields/index.js +10 -0
  282. package/dist/puck-editor/internal/fields/index.js.map +1 -0
  283. package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +33 -0
  284. package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +1 -0
  285. package/dist/puck-editor/internal/fields/link-picker/anchor.js +83 -0
  286. package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -0
  287. package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +24 -0
  288. package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +1 -0
  289. package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +31 -0
  290. package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -0
  291. package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +2 -0
  292. package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +1 -0
  293. package/dist/puck-editor/internal/fields/link-picker/humanize.js +4 -0
  294. package/dist/puck-editor/internal/fields/link-picker/humanize.js.map +1 -0
  295. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +27 -0
  296. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +1 -0
  297. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +564 -0
  298. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -0
  299. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +9 -0
  300. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +1 -0
  301. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +189 -0
  302. package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -0
  303. package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +72 -0
  304. package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +1 -0
  305. package/dist/puck-editor/internal/fields/link-picker/link-value.js +114 -0
  306. package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -0
  307. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +14 -0
  308. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +1 -0
  309. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +667 -0
  310. package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -0
  311. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +11 -0
  312. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +1 -0
  313. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js +34 -0
  314. package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js.map +1 -0
  315. package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +40 -0
  316. package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +1 -0
  317. package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +146 -0
  318. package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -0
  319. package/dist/puck-editor/internal/fields/link-picker/types.d.ts +34 -0
  320. package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +1 -0
  321. package/dist/puck-editor/internal/fields/link-picker/types.js +2 -0
  322. package/dist/puck-editor/internal/fields/link-picker/types.js.map +1 -0
  323. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +27 -0
  324. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +1 -0
  325. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +32 -0
  326. package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -0
  327. package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +13 -0
  328. package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +1 -0
  329. package/dist/puck-editor/internal/fields/media-array/media-array-field.js +372 -0
  330. package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -0
  331. package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +2 -0
  332. package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +1 -0
  333. package/dist/puck-editor/internal/fields/media-array/reorder.js +8 -0
  334. package/dist/puck-editor/internal/fields/media-array/reorder.js.map +1 -0
  335. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +27 -0
  336. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +1 -0
  337. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +32 -0
  338. package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -0
  339. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +11 -0
  340. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +1 -0
  341. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +219 -0
  342. package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -0
  343. package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +24 -0
  344. package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +1 -0
  345. package/dist/puck-editor/internal/fields/media-selector/crop-types.js +8 -0
  346. package/dist/puck-editor/internal/fields/media-selector/crop-types.js.map +1 -0
  347. package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +8 -0
  348. package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +1 -0
  349. package/dist/puck-editor/internal/fields/media-selector/extract-fields.js +51 -0
  350. package/dist/puck-editor/internal/fields/media-selector/extract-fields.js.map +1 -0
  351. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +7 -0
  352. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +1 -0
  353. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +147 -0
  354. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -0
  355. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +30 -0
  356. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +1 -0
  357. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +358 -0
  358. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -0
  359. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +14 -0
  360. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +1 -0
  361. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +355 -0
  362. package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -0
  363. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +2 -0
  364. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +1 -0
  365. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js +55 -0
  366. package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js.map +1 -0
  367. package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +24 -0
  368. package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +1 -0
  369. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +229 -0
  370. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -0
  371. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +7 -0
  372. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +1 -0
  373. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +120 -0
  374. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -0
  375. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +31 -0
  376. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +1 -0
  377. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +39 -0
  378. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -0
  379. package/dist/puck-editor/internal/fields/required-field-label.d.ts +16 -0
  380. package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +1 -0
  381. package/dist/puck-editor/internal/fields/required-field-label.js +89 -0
  382. package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -0
  383. package/dist/puck-editor/internal/fields/required.d.ts +19 -0
  384. package/dist/puck-editor/internal/fields/required.d.ts.map +1 -0
  385. package/dist/puck-editor/internal/fields/required.js +20 -0
  386. package/dist/puck-editor/internal/fields/required.js.map +1 -0
  387. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +37 -0
  388. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +1 -0
  389. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +26 -0
  390. package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -0
  391. package/dist/puck-editor/internal/i18n.d.ts +188 -0
  392. package/dist/puck-editor/internal/i18n.d.ts.map +1 -0
  393. package/dist/puck-editor/internal/i18n.js +414 -0
  394. package/dist/puck-editor/internal/i18n.js.map +1 -0
  395. package/dist/puck-editor/internal/locale.d.ts +13 -0
  396. package/dist/puck-editor/internal/locale.d.ts.map +1 -0
  397. package/dist/puck-editor/internal/locale.js +20 -0
  398. package/dist/puck-editor/internal/locale.js.map +1 -0
  399. package/dist/puck-editor/internal/localize.d.ts +11 -0
  400. package/dist/puck-editor/internal/localize.d.ts.map +1 -0
  401. package/dist/puck-editor/internal/localize.js +42 -0
  402. package/dist/puck-editor/internal/localize.js.map +1 -0
  403. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +21 -0
  404. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +1 -0
  405. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +197 -0
  406. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -0
  407. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +2 -0
  408. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +1 -0
  409. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +131 -0
  410. package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -0
  411. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +20 -0
  412. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +1 -0
  413. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +46 -0
  414. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -0
  415. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +46 -0
  416. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +1 -0
  417. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +176 -0
  418. package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -0
  419. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +20 -0
  420. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +1 -0
  421. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js +39 -0
  422. package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js.map +1 -0
  423. package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +5 -0
  424. package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +1 -0
  425. package/dist/puck-editor/internal/plugins/agent-plugin/constants.js +3 -0
  426. package/dist/puck-editor/internal/plugins/agent-plugin/constants.js.map +1 -0
  427. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +17 -0
  428. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +1 -0
  429. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js +35 -0
  430. package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js.map +1 -0
  431. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +19 -0
  432. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +1 -0
  433. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js +79 -0
  434. package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js.map +1 -0
  435. package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +2 -0
  436. package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +1 -0
  437. package/dist/puck-editor/internal/plugins/agent-plugin/help.js +243 -0
  438. package/dist/puck-editor/internal/plugins/agent-plugin/help.js.map +1 -0
  439. package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +2 -0
  440. package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +1 -0
  441. package/dist/puck-editor/internal/plugins/agent-plugin/index.js +2 -0
  442. package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -0
  443. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +19 -0
  444. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +1 -0
  445. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +31 -0
  446. package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -0
  447. package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +23 -0
  448. package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +1 -0
  449. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +72 -0
  450. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -0
  451. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +20 -0
  452. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +1 -0
  453. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js +34 -0
  454. package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js.map +1 -0
  455. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +17 -0
  456. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +1 -0
  457. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +70 -0
  458. package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -0
  459. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +2 -0
  460. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +1 -0
  461. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +37 -0
  462. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -0
  463. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +7 -0
  464. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +1 -0
  465. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +18 -0
  466. package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -0
  467. package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +2 -0
  468. package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +1 -0
  469. package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +2 -0
  470. package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -0
  471. package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +2 -0
  472. package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +1 -0
  473. package/dist/puck-editor/internal/plugins/outline-plugin/index.js +2 -0
  474. package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -0
  475. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +2 -0
  476. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +1 -0
  477. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +861 -0
  478. package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -0
  479. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +5 -0
  480. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +1 -0
  481. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +16 -0
  482. package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -0
  483. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +53 -0
  484. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +1 -0
  485. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js +145 -0
  486. package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js.map +1 -0
  487. package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +2 -0
  488. package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +1 -0
  489. package/dist/puck-editor/internal/plugins/sections-plugin/index.js +2 -0
  490. package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -0
  491. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +2 -0
  492. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +1 -0
  493. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +69 -0
  494. package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -0
  495. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +7 -0
  496. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +1 -0
  497. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +18 -0
  498. package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -0
  499. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +6 -0
  500. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +1 -0
  501. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +178 -0
  502. package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -0
  503. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +3 -0
  504. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +1 -0
  505. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +55 -0
  506. package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -0
  507. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +12 -0
  508. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +1 -0
  509. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +125 -0
  510. package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -0
  511. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +8 -0
  512. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +1 -0
  513. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +582 -0
  514. package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -0
  515. package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +6 -0
  516. package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +1 -0
  517. package/dist/puck-editor/internal/plugins/templates-plugin/index.js +6 -0
  518. package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -0
  519. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +4 -0
  520. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +1 -0
  521. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +54 -0
  522. package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -0
  523. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +11 -0
  524. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +1 -0
  525. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +92 -0
  526. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -0
  527. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +7 -0
  528. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +1 -0
  529. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +30 -0
  530. package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -0
  531. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +2 -0
  532. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +1 -0
  533. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +471 -0
  534. package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -0
  535. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +5 -0
  536. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +1 -0
  537. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +16 -0
  538. package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -0
  539. package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +43 -0
  540. package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +1 -0
  541. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +115 -0
  542. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -0
  543. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +9 -0
  544. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +1 -0
  545. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +152 -0
  546. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -0
  547. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +16 -0
  548. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +1 -0
  549. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +134 -0
  550. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -0
  551. package/dist/puck-editor/internal/puck-augmentation.d.ts +28 -0
  552. package/dist/puck-editor/internal/puck-augmentation.d.ts.map +1 -0
  553. package/dist/puck-editor/internal/puck-augmentation.js +7 -0
  554. package/dist/puck-editor/internal/puck-augmentation.js.map +1 -0
  555. package/dist/puck-editor/internal/puck-editor-provider.d.ts +12 -0
  556. package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +1 -0
  557. package/dist/puck-editor/internal/puck-editor-provider.js +69 -0
  558. package/dist/puck-editor/internal/puck-editor-provider.js.map +1 -0
  559. package/dist/puck-editor/internal/puck-node.d.ts +29 -0
  560. package/dist/puck-editor/internal/puck-node.d.ts.map +1 -0
  561. package/dist/puck-editor/internal/puck-node.js +2 -0
  562. package/dist/puck-editor/internal/puck-node.js.map +1 -0
  563. package/dist/puck-editor/internal/puck-wrapper.d.ts +19 -0
  564. package/dist/puck-editor/internal/puck-wrapper.d.ts.map +1 -0
  565. package/dist/puck-editor/internal/puck-wrapper.js +270 -0
  566. package/dist/puck-editor/internal/puck-wrapper.js.map +1 -0
  567. package/dist/puck-editor/internal/render/cropped-image.d.ts +19 -0
  568. package/dist/puck-editor/internal/render/cropped-image.d.ts.map +1 -0
  569. package/dist/puck-editor/internal/render/cropped-image.js +126 -0
  570. package/dist/puck-editor/internal/render/cropped-image.js.map +1 -0
  571. package/dist/puck-editor/internal/smart-actions/index.d.ts +13 -0
  572. package/dist/puck-editor/internal/smart-actions/index.d.ts.map +1 -0
  573. package/dist/puck-editor/internal/smart-actions/index.js +29 -0
  574. package/dist/puck-editor/internal/smart-actions/index.js.map +1 -0
  575. package/dist/puck-editor/internal/smart-actions/new-page.d.ts +13 -0
  576. package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +1 -0
  577. package/dist/puck-editor/internal/smart-actions/new-page.js +80 -0
  578. package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -0
  579. package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +2 -0
  580. package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +1 -0
  581. package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +65 -0
  582. package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -0
  583. package/dist/puck-editor/internal/ui/calendar.d.ts +9 -0
  584. package/dist/puck-editor/internal/ui/calendar.d.ts.map +1 -0
  585. package/dist/puck-editor/internal/ui/calendar.js +147 -0
  586. package/dist/puck-editor/internal/ui/calendar.js.map +1 -0
  587. package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +13 -0
  588. package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +1 -0
  589. package/dist/puck-editor/internal/ui/component-list-accordion.js +93 -0
  590. package/dist/puck-editor/internal/ui/component-list-accordion.js.map +1 -0
  591. package/dist/puck-editor/internal/ui/dialog.d.ts +20 -0
  592. package/dist/puck-editor/internal/ui/dialog.d.ts.map +1 -0
  593. package/dist/puck-editor/internal/ui/dialog.js +286 -0
  594. package/dist/puck-editor/internal/ui/dialog.js.map +1 -0
  595. package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +11 -0
  596. package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +1 -0
  597. package/dist/puck-editor/internal/ui/drawer-item-content.js +109 -0
  598. package/dist/puck-editor/internal/ui/drawer-item-content.js.map +1 -0
  599. package/dist/puck-editor/internal/ui/icon-button.d.ts +10 -0
  600. package/dist/puck-editor/internal/ui/icon-button.d.ts.map +1 -0
  601. package/dist/puck-editor/internal/ui/icon-button.js +72 -0
  602. package/dist/puck-editor/internal/ui/icon-button.js.map +1 -0
  603. package/dist/puck-editor/internal/ui/popover.d.ts +9 -0
  604. package/dist/puck-editor/internal/ui/popover.d.ts.map +1 -0
  605. package/dist/puck-editor/internal/ui/popover.js +165 -0
  606. package/dist/puck-editor/internal/ui/popover.js.map +1 -0
  607. package/dist/puck-editor/internal/ui/required-mark.d.ts +2 -0
  608. package/dist/puck-editor/internal/ui/required-mark.d.ts.map +1 -0
  609. package/dist/puck-editor/internal/ui/required-mark.js +12 -0
  610. package/dist/puck-editor/internal/ui/required-mark.js.map +1 -0
  611. package/dist/puck-editor/internal/ui/search-control.d.ts +20 -0
  612. package/dist/puck-editor/internal/ui/search-control.d.ts.map +1 -0
  613. package/dist/puck-editor/internal/ui/search-control.js +156 -0
  614. package/dist/puck-editor/internal/ui/search-control.js.map +1 -0
  615. package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +2 -0
  616. package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +1 -0
  617. package/dist/puck-editor/internal/ui/use-panel-search-focus.js +40 -0
  618. package/dist/puck-editor/internal/ui/use-panel-search-focus.js.map +1 -0
  619. package/dist/puck-editor/internal/use-puck-overlay.d.ts +16 -0
  620. package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +1 -0
  621. package/dist/puck-editor/internal/use-puck-overlay.js +121 -0
  622. package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -0
  623. package/dist/puck-editor/internal/utils.d.ts +6 -0
  624. package/dist/puck-editor/internal/utils.d.ts.map +1 -0
  625. package/dist/puck-editor/internal/utils.js +57 -0
  626. package/dist/puck-editor/internal/utils.js.map +1 -0
  627. package/dist/puck-editor/puck-theme.css +110 -0
  628. package/dist/puck-editor/render.d.ts +3 -0
  629. package/dist/puck-editor/render.d.ts.map +1 -0
  630. package/dist/puck-editor/render.js +2 -0
  631. package/dist/puck-editor/render.js.map +1 -0
  632. package/dist/puck-editor/server.d.ts +4 -0
  633. package/dist/puck-editor/server.d.ts.map +1 -0
  634. package/dist/puck-editor/server.js +4 -0
  635. package/dist/puck-editor/server.js.map +1 -0
  636. package/dist/puck-editor/smart-actions.d.ts +2 -0
  637. package/dist/puck-editor/smart-actions.d.ts.map +1 -0
  638. package/dist/puck-editor/smart-actions.js +2 -0
  639. package/dist/puck-editor/smart-actions.js.map +1 -0
  640. package/dist/shared/cn.d.ts +3 -0
  641. package/dist/shared/cn.d.ts.map +1 -0
  642. package/dist/shared/cn.js +9 -0
  643. package/dist/shared/cn.js.map +1 -0
  644. package/dist/shared/i18n.d.ts +5 -0
  645. package/dist/shared/i18n.d.ts.map +1 -0
  646. package/dist/shared/i18n.js +18 -0
  647. package/dist/shared/i18n.js.map +1 -0
  648. package/dist/shared/toolbar-action.d.ts +9 -0
  649. package/dist/shared/toolbar-action.d.ts.map +1 -0
  650. package/dist/shared/toolbar-action.js +2 -0
  651. package/dist/shared/toolbar-action.js.map +1 -0
  652. package/dist/smart-actions/internal/get-smart-actions-context.d.ts +19 -0
  653. package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +1 -0
  654. package/dist/smart-actions/internal/get-smart-actions-context.js +24 -0
  655. package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -0
  656. package/dist/smart-actions/internal/i18n.d.ts +20 -0
  657. package/dist/smart-actions/internal/i18n.d.ts.map +1 -0
  658. package/dist/smart-actions/internal/i18n.js +35 -0
  659. package/dist/smart-actions/internal/i18n.js.map +1 -0
  660. package/dist/smart-actions/internal/logout-form.d.ts +8 -0
  661. package/dist/smart-actions/internal/logout-form.d.ts.map +1 -0
  662. package/dist/smart-actions/internal/logout-form.js +88 -0
  663. package/dist/smart-actions/internal/logout-form.js.map +1 -0
  664. package/dist/smart-actions/internal/refresh-page.d.ts +2 -0
  665. package/dist/smart-actions/internal/refresh-page.d.ts.map +1 -0
  666. package/dist/smart-actions/internal/refresh-page.js +126 -0
  667. package/dist/smart-actions/internal/refresh-page.js.map +1 -0
  668. package/dist/smart-actions/internal/smart-actions-button.d.ts +24 -0
  669. package/dist/smart-actions/internal/smart-actions-button.d.ts.map +1 -0
  670. package/dist/smart-actions/internal/smart-actions-button.js +41 -0
  671. package/dist/smart-actions/internal/smart-actions-button.js.map +1 -0
  672. package/dist/smart-actions/internal/smart-actions-config.d.ts +13 -0
  673. package/dist/smart-actions/internal/smart-actions-config.d.ts.map +1 -0
  674. package/dist/smart-actions/internal/smart-actions-config.js +101 -0
  675. package/dist/smart-actions/internal/smart-actions-config.js.map +1 -0
  676. package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +15 -0
  677. package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +1 -0
  678. package/dist/smart-actions/internal/smart-actions-toolbar-client.js +71 -0
  679. package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -0
  680. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +13 -0
  681. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +1 -0
  682. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +323 -0
  683. package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -0
  684. package/dist/smart-actions/internal/toolbar/storage.d.ts +7 -0
  685. package/dist/smart-actions/internal/toolbar/storage.d.ts.map +1 -0
  686. package/dist/smart-actions/internal/toolbar/storage.js +29 -0
  687. package/dist/smart-actions/internal/toolbar/storage.js.map +1 -0
  688. package/dist/smart-actions/internal/toolbar/types.d.ts +4 -0
  689. package/dist/smart-actions/internal/toolbar/types.d.ts.map +1 -0
  690. package/dist/smart-actions/internal/toolbar/types.js +2 -0
  691. package/dist/smart-actions/internal/toolbar/types.js.map +1 -0
  692. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +6 -0
  693. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +1 -0
  694. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +43 -0
  695. package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -0
  696. package/dist/smart-actions/internal/ui/tooltip.d.ts +8 -0
  697. package/dist/smart-actions/internal/ui/tooltip.d.ts.map +1 -0
  698. package/dist/smart-actions/internal/ui/tooltip.js +156 -0
  699. package/dist/smart-actions/internal/ui/tooltip.js.map +1 -0
  700. package/dist/smart-actions/internal/user-profile.d.ts +8 -0
  701. package/dist/smart-actions/internal/user-profile.d.ts.map +1 -0
  702. package/dist/smart-actions/internal/user-profile.js +30 -0
  703. package/dist/smart-actions/internal/user-profile.js.map +1 -0
  704. package/dist/smart-actions/server.d.ts +4 -0
  705. package/dist/smart-actions/server.d.ts.map +1 -0
  706. package/dist/smart-actions/server.js +4 -0
  707. package/dist/smart-actions/server.js.map +1 -0
  708. package/dist/theme.css +2 -0
  709. package/dist/visual-editor/index.d.ts +4 -0
  710. package/dist/visual-editor/index.d.ts.map +1 -0
  711. package/dist/visual-editor/index.js +4 -0
  712. package/dist/visual-editor/index.js.map +1 -0
  713. package/dist/visual-editor/internal/bridge/connector.d.ts +7 -0
  714. package/dist/visual-editor/internal/bridge/connector.d.ts.map +1 -0
  715. package/dist/visual-editor/internal/bridge/connector.js +72 -0
  716. package/dist/visual-editor/internal/bridge/connector.js.map +1 -0
  717. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +8 -0
  718. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +1 -0
  719. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js +44 -0
  720. package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js.map +1 -0
  721. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +16 -0
  722. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +1 -0
  723. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +43 -0
  724. package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -0
  725. package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +15 -0
  726. package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +1 -0
  727. package/dist/visual-editor/internal/bridge/editor-auth-gate.js +146 -0
  728. package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -0
  729. package/dist/visual-editor/internal/i18n.d.ts +29 -0
  730. package/dist/visual-editor/internal/i18n.d.ts.map +1 -0
  731. package/dist/visual-editor/internal/i18n.js +51 -0
  732. package/dist/visual-editor/internal/i18n.js.map +1 -0
  733. package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +7 -0
  734. package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +1 -0
  735. package/dist/visual-editor/internal/overlays/drupal-origin.js +15 -0
  736. package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -0
  737. package/dist/visual-editor/internal/overlays/edit-button.d.ts +10 -0
  738. package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +1 -0
  739. package/dist/visual-editor/internal/overlays/edit-button.js +138 -0
  740. package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -0
  741. package/dist/visual-editor/internal/overlays/edit-icon.d.ts +3 -0
  742. package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +1 -0
  743. package/dist/visual-editor/internal/overlays/edit-icon.js +19 -0
  744. package/dist/visual-editor/internal/overlays/edit-icon.js.map +1 -0
  745. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +15 -0
  746. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +1 -0
  747. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +52 -0
  748. package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -0
  749. package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +6 -0
  750. package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +1 -0
  751. package/dist/visual-editor/internal/overlays/iframe-wrapper.js +42 -0
  752. package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -0
  753. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +9 -0
  754. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +1 -0
  755. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +33 -0
  756. package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -0
  757. package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +13 -0
  758. package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +1 -0
  759. package/dist/visual-editor/internal/overlays/node/node-metadata.js +17 -0
  760. package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -0
  761. package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +8 -0
  762. package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +1 -0
  763. package/dist/visual-editor/internal/overlays/node/node-wrapper.js +25 -0
  764. package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -0
  765. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +18 -0
  766. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +1 -0
  767. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +58 -0
  768. package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -0
  769. package/dist/visual-editor/internal/revalidate-route.d.ts +19 -0
  770. package/dist/visual-editor/internal/revalidate-route.d.ts.map +1 -0
  771. package/dist/visual-editor/internal/revalidate-route.js +51 -0
  772. package/dist/visual-editor/internal/revalidate-route.js.map +1 -0
  773. package/dist/visual-editor/server.d.ts +7 -0
  774. package/dist/visual-editor/server.d.ts.map +1 -0
  775. package/dist/visual-editor/server.js +8 -0
  776. package/dist/visual-editor/server.js.map +1 -0
  777. package/package.json +154 -0
@@ -0,0 +1,129 @@
1
+ import { NextResponse } from 'next/server';
2
+ import { MEDIA_TYPES } from '../../plugins/agent-plugin/constants';
3
+ import { uploadImage, uploadRemoteVideo } from '../media-upload';
4
+ const ALLOWED_TYPES = new Set(MEDIA_TYPES);
5
+ function decodeDataUrl(url) {
6
+ const match = /^data:([^;,]*)(;base64)?,([\s\S]*)$/.exec(url);
7
+ if (!match) return null;
8
+ const mime = match[1] || 'image/png';
9
+ const bytes = match[2] ? Buffer.from(match[3], 'base64') : Buffer.from(decodeURIComponent(match[3]));
10
+ return {
11
+ bytes,
12
+ mime
13
+ };
14
+ }
15
+ function imageFilename(mime, name) {
16
+ const ext = mime.split('/')[1]?.split('+')[0] || 'bin';
17
+ const base = name?.replace(/\.[^.]+$/, '') || 'image';
18
+ return `${base}.${ext}`;
19
+ }
20
+ function errorJson(message, status) {
21
+ return NextResponse.json({
22
+ status: 'error',
23
+ message
24
+ }, {
25
+ status
26
+ });
27
+ }
28
+ function resultJson(result) {
29
+ if (!result.success) {
30
+ return errorJson(result.message, 502);
31
+ }
32
+ const data = result.data;
33
+ return NextResponse.json({
34
+ status: 'ok',
35
+ message: result.message,
36
+ id: data?.id ?? null,
37
+ data: result.data
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Editor upload forms send multipart form data (file/videoUrl + name/alt);
43
+ * the agent bridge sends JSON with an inline data: URL for images or a
44
+ * YouTube/Vimeo page URL for remote_video. The server never fetches
45
+ * external URLs.
46
+ */
47
+ export async function handleUpload(config, request) {
48
+ const maxUploadBytes = config.model.maxUploadBytes;
49
+ const maxUploadMb = maxUploadBytes / 1024 / 1024;
50
+ const declared = Number(request.headers.get('content-length') || 0);
51
+ if (declared > maxUploadBytes * 1.4) {
52
+ return errorJson(`payload too large (max ${maxUploadMb} MB)`, 413);
53
+ }
54
+ const client = config.createUserClient();
55
+ if (request.headers.get('content-type')?.includes('multipart/form-data')) {
56
+ const form = await request.formData();
57
+ const type = String(form.get('type') || 'image');
58
+ const name = form.get('name') || undefined;
59
+ const lang = form.get('lang') || undefined;
60
+ if (!ALLOWED_TYPES.has(type)) {
61
+ return errorJson('invalid media type', 400);
62
+ }
63
+ if (type === 'remote_video') {
64
+ const videoUrl = form.get('videoUrl');
65
+ if (typeof videoUrl !== 'string' || !/^https?:\/\//i.test(videoUrl)) {
66
+ return errorJson('remote_video expects a http(s) page url', 400);
67
+ }
68
+ return resultJson(await uploadRemoteVideo(client, {
69
+ videoUrl,
70
+ name,
71
+ lang
72
+ }));
73
+ }
74
+ const file = form.get('file');
75
+ if (!(file instanceof File)) {
76
+ return errorJson('file is required', 400);
77
+ }
78
+ if (file.size > maxUploadBytes) {
79
+ return errorJson(`image too large (max ${maxUploadMb} MB)`, 413);
80
+ }
81
+ const alt = form.get('alt') || undefined;
82
+ return resultJson(await uploadImage(client, {
83
+ file,
84
+ alt,
85
+ name,
86
+ lang
87
+ }));
88
+ }
89
+ const {
90
+ type = 'image',
91
+ url,
92
+ name,
93
+ alt,
94
+ lang
95
+ } = await request.json();
96
+ if (!ALLOWED_TYPES.has(type)) {
97
+ return errorJson('invalid media type', 400);
98
+ }
99
+ if (typeof url !== 'string') {
100
+ return errorJson('url is required', 400);
101
+ }
102
+ if (type === 'remote_video') {
103
+ if (!/^https?:\/\//i.test(url)) {
104
+ return errorJson('remote_video expects a http(s) page url', 400);
105
+ }
106
+ return resultJson(await uploadRemoteVideo(client, {
107
+ videoUrl: url,
108
+ name,
109
+ lang
110
+ }));
111
+ }
112
+ const decoded = url.startsWith('data:') ? decodeDataUrl(url) : null;
113
+ if (!decoded) {
114
+ return errorJson('image expects an inline data: URL (base64-encode the file)', 400);
115
+ }
116
+ if (decoded.bytes.byteLength > maxUploadBytes) {
117
+ return errorJson(`image too large (max ${maxUploadMb} MB)`, 413);
118
+ }
119
+ const file = new File([new Uint8Array(decoded.bytes)], imageFilename(decoded.mime, name), {
120
+ type: decoded.mime
121
+ });
122
+ return resultJson(await uploadImage(client, {
123
+ file,
124
+ alt,
125
+ name,
126
+ lang
127
+ }));
128
+ }
129
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","names":["NextResponse","MEDIA_TYPES","uploadImage","uploadRemoteVideo","ALLOWED_TYPES","Set","decodeDataUrl","url","match","exec","mime","bytes","Buffer","from","decodeURIComponent","imageFilename","name","ext","split","base","replace","errorJson","message","status","json","resultJson","result","success","data","id","handleUpload","config","request","maxUploadBytes","model","maxUploadMb","declared","Number","headers","get","client","createUserClient","includes","form","formData","type","String","undefined","lang","has","videoUrl","test","file","File","size","alt","decoded","startsWith","byteLength","Uint8Array"],"sources":["../../../../../src/puck-editor/internal/api/handlers/upload.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\n\nimport { MEDIA_TYPES } from '../../plugins/agent-plugin/constants';\nimport type { PuckApiRuntime } from '../config';\nimport {\n uploadImage,\n uploadRemoteVideo,\n type MediaUploadResult,\n} from '../media-upload';\n\nconst ALLOWED_TYPES = new Set<string>(MEDIA_TYPES);\n\nfunction decodeDataUrl(url: string): { bytes: Buffer; mime: string } | null {\n const match = /^data:([^;,]*)(;base64)?,([\\s\\S]*)$/.exec(url);\n if (!match) return null;\n const mime = match[1] || 'image/png';\n const bytes = match[2]\n ? Buffer.from(match[3], 'base64')\n : Buffer.from(decodeURIComponent(match[3]));\n return { bytes, mime };\n}\n\nfunction imageFilename(mime: string, name?: string): string {\n const ext = mime.split('/')[1]?.split('+')[0] || 'bin';\n const base = name?.replace(/\\.[^.]+$/, '') || 'image';\n return `${base}.${ext}`;\n}\n\nfunction errorJson(message: string, status: number) {\n return NextResponse.json({ status: 'error', message }, { status });\n}\n\nfunction resultJson(result: MediaUploadResult) {\n if (!result.success) {\n return errorJson(result.message, 502);\n }\n const data = result.data as { id?: string } | undefined;\n return NextResponse.json({\n status: 'ok',\n message: result.message,\n id: data?.id ?? null,\n data: result.data,\n });\n}\n\n/**\n * Editor upload forms send multipart form data (file/videoUrl + name/alt);\n * the agent bridge sends JSON with an inline data: URL for images or a\n * YouTube/Vimeo page URL for remote_video. The server never fetches\n * external URLs.\n */\nexport async function handleUpload(\n config: PuckApiRuntime,\n request: NextRequest\n) {\n const maxUploadBytes = config.model.maxUploadBytes;\n const maxUploadMb = maxUploadBytes / 1024 / 1024;\n const declared = Number(request.headers.get('content-length') || 0);\n if (declared > maxUploadBytes * 1.4) {\n return errorJson(`payload too large (max ${maxUploadMb} MB)`, 413);\n }\n\n const client = config.createUserClient();\n\n if (request.headers.get('content-type')?.includes('multipart/form-data')) {\n const form = await request.formData();\n const type = String(form.get('type') || 'image');\n const name = (form.get('name') as string) || undefined;\n const lang = (form.get('lang') as string) || undefined;\n\n if (!ALLOWED_TYPES.has(type)) {\n return errorJson('invalid media type', 400);\n }\n\n if (type === 'remote_video') {\n const videoUrl = form.get('videoUrl');\n if (typeof videoUrl !== 'string' || !/^https?:\\/\\//i.test(videoUrl)) {\n return errorJson('remote_video expects a http(s) page url', 400);\n }\n return resultJson(\n await uploadRemoteVideo(client, { videoUrl, name, lang })\n );\n }\n\n const file = form.get('file');\n if (!(file instanceof File)) {\n return errorJson('file is required', 400);\n }\n if (file.size > maxUploadBytes) {\n return errorJson(`image too large (max ${maxUploadMb} MB)`, 413);\n }\n const alt = (form.get('alt') as string) || undefined;\n return resultJson(await uploadImage(client, { file, alt, name, lang }));\n }\n\n const { type = 'image', url, name, alt, lang } = await request.json();\n\n if (!ALLOWED_TYPES.has(type)) {\n return errorJson('invalid media type', 400);\n }\n if (typeof url !== 'string') {\n return errorJson('url is required', 400);\n }\n\n if (type === 'remote_video') {\n if (!/^https?:\\/\\//i.test(url)) {\n return errorJson('remote_video expects a http(s) page url', 400);\n }\n return resultJson(\n await uploadRemoteVideo(client, { videoUrl: url, name, lang })\n );\n }\n\n const decoded = url.startsWith('data:') ? decodeDataUrl(url) : null;\n if (!decoded) {\n return errorJson(\n 'image expects an inline data: URL (base64-encode the file)',\n 400\n );\n }\n if (decoded.bytes.byteLength > maxUploadBytes) {\n return errorJson(`image too large (max ${maxUploadMb} MB)`, 413);\n }\n const file = new File(\n [new Uint8Array(decoded.bytes)],\n imageFilename(decoded.mime, name),\n { type: decoded.mime }\n );\n return resultJson(await uploadImage(client, { file, alt, name, lang }));\n}\n"],"mappings":"AAAA,SAAsBA,YAAY,QAAQ,aAAa;AAEvD,SAASC,WAAW,QAAQ,sCAAsC;AAElE,SACEC,WAAW,EACXC,iBAAiB,QAEZ,iBAAiB;AAExB,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAASJ,WAAW,CAAC;AAElD,SAASK,aAAaA,CAACC,GAAW,EAA0C;EAC1E,MAAMC,KAAK,GAAG,qCAAqC,CAACC,IAAI,CAACF,GAAG,CAAC;EAC7D,IAAI,CAACC,KAAK,EAAE,OAAO,IAAI;EACvB,MAAME,IAAI,GAAGF,KAAK,CAAC,CAAC,CAAC,I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AACqC,MAAM,EAAE;MAAEU,QAAQ,EAAE3C,GAAG;MAAES,IAAI;MAAEgC;IAAK,CAAC,CAC/D,CAAC;EACH;EAEA,MAAMQ,OAAO,GAAGjD,GAAG,CAACkD,UAAU,CAAC,OAAO,CAAC,GAAGnD,aAAa,CAACC,GAAG,CAAC,GAAG,IAAI;EACnE,IAAI,CAACiD,OAAO,EAAE;IACZ,OAAOnC,SAAS,CACd,4DAA4D,EAC5D,GACF,CAAC;EACH;EACA,IAAImC,OAAO,CAAC7C,KAAK,CAAC+C,UAAU,GAAGzB,cAAc,EAAE;IAC7C,OAAOZ,SAAS,CAAC,wBAAwBc,WAAW,MAAM,EAAE,GAAG,CAAC;EAClE;EACA,MAAMiB,IAAI,GAAG,IAAIC,IAAI,CACnB,CAAC,IAAIM,UAAU,CAACH,OAAO,CAAC7C,KAAK,CAAC,CAAC,EAC/BI,aAAa,CAACyC,OAAO,CAAC9C,IAAI,EAAEM,IAAI,CAAC,EACjC;IAAE6B,IAAI,EAAEW,OAAO,CAAC9C;EAAK,CACvB,CAAC;EACD,OAAOe,UAAU,CAAC,MAAMvB,WAAW,CAACsC,MAAM,EAAE;IAAEY,IAAI;IAAEG,GAAG;IAAEvC,IAAI;IAAEgC;EAAK,CAAC,CAAC,CAAC;AACzE","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
+ export declare function buildMediaParams(type: string): DrupalJsonApiParams;
3
+ export declare function buildMediaListParams(type: string, query?: string, offset?: string, limit?: string): DrupalJsonApiParams;
4
+ //# sourceMappingURL=media-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-params.d.ts","sourceRoot":"","sources":["../../../../src/puck-editor/internal/api/media-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,uBA0B5C;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,uBA8Bf"}
@@ -0,0 +1,38 @@
1
+ import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
+ export function buildMediaParams(type) {
3
+ const apiParams = new DrupalJsonApiParams();
4
+ if (type === 'image') {
5
+ apiParams.addInclude(['field_media_image', 'thumbnail']);
6
+ apiParams.addFields('media--image', ['name', 'thumbnail', 'field_media_image']);
7
+ apiParams.addFields('file--image', ['uri']);
8
+ } else if (type === 'remote_video') {
9
+ apiParams.addInclude(['thumbnail']);
10
+ apiParams.addFields('media--remote_video', ['name', 'thumbnail', 'field_media_oembed_video']);
11
+ } else if (type === 'video') {
12
+ apiParams.addInclude(['field_media_image']);
13
+ apiParams.addFields('media--video', ['name', 'field_media_image', 'field_media_video_file']);
14
+ }
15
+ return apiParams;
16
+ }
17
+ export function buildMediaListParams(type, query, offset, limit) {
18
+ const apiParams = new DrupalJsonApiParams().addSort('created', 'DESC');
19
+ if (query) {
20
+ apiParams.addFilter('name', query, 'CONTAINS');
21
+ }
22
+ if (offset) {
23
+ apiParams.addPageOffset(Number(offset));
24
+ }
25
+ if (limit) {
26
+ apiParams.addPageLimit(Number(limit));
27
+ }
28
+ if (type === 'image') {
29
+ apiParams.addInclude(['field_media_image', 'thumbnail']);
30
+ apiParams.addFields('media--image', ['name', 'thumbnail', 'field_media_image']);
31
+ apiParams.addFields('file--image', ['uri']);
32
+ } else if (type === 'remote_video') {
33
+ apiParams.addInclude(['thumbnail']);
34
+ apiParams.addFields('media--remote_video', ['name', 'thumbnail', 'field_media_oembed_video']);
35
+ }
36
+ return apiParams;
37
+ }
38
+ //# sourceMappingURL=media-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-params.js","names":["DrupalJsonApiParams","buildMediaParams","type","apiParams","addInclude","addFields","buildMediaListParams","query","offset","limit","addSort","addFilter","addPageOffset","Number","addPageLimit"],"sources":["../../../../src/puck-editor/internal/api/media-params.ts"],"sourcesContent":["import { DrupalJsonApiParams } from 'drupal-jsonapi-params';\n\nexport function buildMediaParams(type: string) {\n const apiParams = new DrupalJsonApiParams();\n if (type === 'image') {\n apiParams.addInclude(['field_media_image', 'thumbnail']);\n apiParams.addFields('media--image', [\n 'name',\n 'thumbnail',\n 'field_media_image',\n ]);\n apiParams.addFields('file--image', ['uri']);\n } else if (type === 'remote_video') {\n apiParams.addInclude(['thumbnail']);\n apiParams.addFields('media--remote_video', [\n 'name',\n 'thumbnail',\n 'field_media_oembed_video',\n ]);\n } else if (type === 'video') {\n apiParams.addInclude(['field_media_image']);\n apiParams.addFields('media--video', [\n 'name',\n 'field_media_image',\n 'field_media_video_file',\n ]);\n }\n return apiParams;\n}\n\nexport function buildMediaListParams(\n type: string,\n query?: string,\n offset?: string,\n limit?: string\n) {\n const apiParams = new DrupalJsonApiParams().addSort('created', 'DESC');\n if (query) {\n apiParams.addFilter('name', query, 'CONTAINS');\n }\n if (offset) {\n apiParams.addPageOffset(Number(offset));\n }\n if (limit) {\n apiParams.addPageLimit(Number(limit));\n }\n\n if (type === 'image') {\n apiParams.addInclude(['field_media_image', 'thumbnail']);\n apiParams.addFields('media--image', [\n 'name',\n 'thumbnail',\n 'field_media_image',\n ]);\n apiParams.addFields('file--image', ['uri']);\n } else if (type === 'remote_video') {\n apiParams.addInclude(['thumbnail']);\n apiParams.addFields('media--remote_video', [\n 'name',\n 'thumbnail',\n 'field_media_oembed_video',\n ]);\n }\n return apiParams;\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,uBAAuB;AAE3D,OAAO,SAASC,gBAAgBA,CAACC,IAAY,EAAE;EAC7C,MAAMC,SAAS,GAAG,IAAIH,mBAAmB,CAAC,CAAC;EAC3C,IAAIE,IAAI,KAAK,OAAO,EAAE;IACpBC,SAAS,CAACC,UAAU,CAAC,CAAC,mBAAmB,EAAE,WAAW,CAAC,C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EACX,mBAAmB,CACpB,CAAC;IACFF,SAAS,CAACE,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;EAC7C,CAAC,MAAM,IAAIH,IAAI,KAAK,cAAc,EAAE;IAClCC,SAAS,CAACC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;IACnCD,SAAS,CAACE,SAAS,CAAC,qBAAqB,EAAE,CACzC,MAAM,EACN,WAAW,EACX,0BAA0B,CAC3B,CAAC;EACJ;EACA,OAAOF,SAAS;AAClB","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ import type { NodeHiveClient } from 'nodehive-js';
2
+ export type MediaUploadResult = {
3
+ success: boolean;
4
+ message: string;
5
+ data?: unknown;
6
+ };
7
+ /**
8
+ * Uploads an image file to Drupal and creates a media entity, using Flow 2 of
9
+ * the JSON:API file upload process: upload the binary to create a file entity,
10
+ * then create a media entity referencing it.
11
+ */
12
+ export declare function uploadImage(client: NodeHiveClient, { file, alt, name, lang, }: {
13
+ file: File;
14
+ alt?: string;
15
+ name?: string;
16
+ lang?: string;
17
+ }): Promise<MediaUploadResult>;
18
+ /** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */
19
+ export declare function uploadRemoteVideo(client: NodeHiveClient, { videoUrl, name, lang }: {
20
+ videoUrl: string;
21
+ name?: string;
22
+ lang?: string;
23
+ }): Promise<MediaUploadResult>;
24
+ //# sourceMappingURL=media-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-upload.d.ts","sourceRoot":"","sources":["../../../../src/puck-editor/internal/api/media-upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAoBF;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,cAAc,EACtB,EACE,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,GACL,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D,OAAO,CAAC,iBAAiB,CAAC,CAwF5B;AAED,mFAAmF;AACnF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,EACtB,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E,OAAO,CAAC,iBAAiB,CAAC,CAwD5B"}
@@ -0,0 +1,171 @@
1
+ import { buildMediaParams } from './media-params';
2
+ async function enrichCreatedMedia(client, created, type, lang) {
3
+ try {
4
+ const enriched = await client.getMedia(created.id, type, {
5
+ lang: created?.attributes?.langcode || lang || 'en',
6
+ params: buildMediaParams(type)
7
+ });
8
+ return enriched?.data || created;
9
+ } catch (error) {
10
+ console.error('Error enriching created media:', error);
11
+ return created;
12
+ }
13
+ }
14
+
15
+ /**
16
+ * Uploads an image file to Drupal and creates a media entity, using Flow 2 of
17
+ * the JSON:API file upload process: upload the binary to create a file entity,
18
+ * then create a media entity referencing it.
19
+ */
20
+ export async function uploadImage(client, {
21
+ file,
22
+ alt,
23
+ name,
24
+ lang
25
+ }) {
26
+ const token = await client.getToken();
27
+ if (!token) {
28
+ return {
29
+ success: false,
30
+ message: 'Authentication required'
31
+ };
32
+ }
33
+ const mediaName = name || file.name || 'Image';
34
+ try {
35
+ const fileBuffer = Buffer.from(await file.arrayBuffer());
36
+ const fileUploadUrl = `${client.baseUrl}/jsonapi/media/image/field_media_image`;
37
+ const asciiFilename = file.name.replace(/[^\x20-\x7e]/g, '_').replace(/"/g, '');
38
+ const contentDisposition = `attachment; filename="${asciiFilename}"; filename*=UTF-8''${encodeURIComponent(file.name)}`;
39
+ const fileUploadResponse = await fetch(fileUploadUrl, {
40
+ method: 'POST',
41
+ headers: {
42
+ Accept: 'application/vnd.api+json',
43
+ 'Content-Type': 'application/octet-stream',
44
+ 'Content-Disposition': contentDisposition,
45
+ Authorization: `Bearer ${token}`
46
+ },
47
+ body: fileBuffer
48
+ });
49
+ if (!fileUploadResponse.ok) {
50
+ console.error('File upload failed:', await fileUploadResponse.text());
51
+ return {
52
+ success: false,
53
+ message: 'File upload failed'
54
+ };
55
+ }
56
+ const fileResult = await fileUploadResponse.json();
57
+ const fileUuid = fileResult.data.id;
58
+ const mediaData = {
59
+ data: {
60
+ type: 'media--image',
61
+ attributes: {
62
+ name: mediaName,
63
+ status: true
64
+ },
65
+ relationships: {
66
+ field_media_image: {
67
+ data: {
68
+ type: 'file--file',
69
+ id: fileUuid,
70
+ meta: {
71
+ alt: alt || mediaName
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ };
78
+ const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/image`, {
79
+ method: 'POST',
80
+ body: JSON.stringify(mediaData),
81
+ headers: {
82
+ 'Content-Type': 'application/vnd.api+json',
83
+ Accept: 'application/vnd.api+json',
84
+ Authorization: `Bearer ${token}`
85
+ }
86
+ });
87
+ if (!mediaResponse.ok) {
88
+ console.error('Media entity creation failed:', await mediaResponse.text());
89
+ return {
90
+ success: false,
91
+ message: 'Media entity creation failed'
92
+ };
93
+ }
94
+ const mediaResult = await mediaResponse.json();
95
+ const data = await enrichCreatedMedia(client, mediaResult.data, 'image', lang);
96
+ return {
97
+ success: true,
98
+ message: 'Image uploaded successfully',
99
+ data
100
+ };
101
+ } catch (error) {
102
+ console.error('Error uploading image media:', error);
103
+ return {
104
+ success: false,
105
+ message: 'An unexpected error occurred'
106
+ };
107
+ }
108
+ }
109
+
110
+ /** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */
111
+ export async function uploadRemoteVideo(client, {
112
+ videoUrl,
113
+ name,
114
+ lang
115
+ }) {
116
+ const token = await client.getToken();
117
+ if (!token) {
118
+ return {
119
+ success: false,
120
+ message: 'Authentication required'
121
+ };
122
+ }
123
+ if (!videoUrl) {
124
+ return {
125
+ success: false,
126
+ message: 'No video URL provided'
127
+ };
128
+ }
129
+ try {
130
+ const mediaData = {
131
+ data: {
132
+ type: 'media--remote_video',
133
+ attributes: {
134
+ name: name,
135
+ status: true,
136
+ field_media_oembed_video: videoUrl
137
+ }
138
+ }
139
+ };
140
+ const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/remote_video`, {
141
+ method: 'POST',
142
+ body: JSON.stringify(mediaData),
143
+ headers: {
144
+ 'Content-Type': 'application/vnd.api+json',
145
+ Accept: 'application/vnd.api+json',
146
+ Authorization: `Bearer ${token}`
147
+ }
148
+ });
149
+ if (!mediaResponse.ok) {
150
+ console.error('Remote video entity creation failed:', await mediaResponse.text());
151
+ return {
152
+ success: false,
153
+ message: 'Remote video entity creation failed'
154
+ };
155
+ }
156
+ const mediaResult = await mediaResponse.json();
157
+ const data = await enrichCreatedMedia(client, mediaResult.data, 'remote_video', lang);
158
+ return {
159
+ success: true,
160
+ message: 'Remote video added successfully',
161
+ data
162
+ };
163
+ } catch (error) {
164
+ console.error('Error adding remote video:', error);
165
+ return {
166
+ success: false,
167
+ message: 'An unexpected error occurred'
168
+ };
169
+ }
170
+ }
171
+ //# sourceMappingURL=media-upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-upload.js","names":["buildMediaParams","enrichCreatedMedia","client","created","type","lang","enriched","getMedia","id","attributes","langcode","params","data","error","console","uploadImage","file","alt","name","token","getToken","success","message","mediaName","fileBuffer","Buffer","from","arrayBuffer","fileUploadUrl","baseUrl","asciiFilename","replace","contentDisposition","encodeURIComponent","fileUploadResponse","fetch","method","headers","Accept","Authorization","body","ok","text","fileResult","json","fileUuid","mediaData","status","relationships","field_media_image","meta","mediaResponse","JSON","stringify","mediaResult","uploadRemoteVideo","videoUrl","field_media_oembed_video"],"sources":["../../../../src/puck-editor/internal/api/media-upload.ts"],"sourcesContent":["import type { NodeHiveClient } from 'nodehive-js';\n\nimport { buildMediaParams } from './media-params';\n\nexport type MediaUploadResult = {\n success: boolean;\n message: string;\n data?: unknown;\n};\n\nasync function enrichCreatedMedia(\n client: NodeHiveClient,\n created: { id: string; attributes?: { langcode?: string } },\n type: string,\n lang?: string\n) {\n try {\n const enriched = await client.getMedia(created.id, type, {\n lang: created?.attributes?.langcode || lang || 'en',\n params: buildMediaParams(type),\n });\n return enriched?.data || created;\n } catch (error) {\n console.error('Error enriching created media:', error);\n return created;\n }\n}\n\n/**\n * Uploads an image file to Drupal and creates a media entity, using Flow 2 of\n * the JSON:API file upload process: upload the binary to create a file entity,\n * then create a media entity referencing it.\n */\nexport async function uploadImage(\n client: NodeHiveClient,\n {\n file,\n alt,\n name,\n lang,\n }: { file: File; alt?: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return { success: false, message: 'Authentication required' };\n }\n\n const mediaName = name || file.name || 'Image';\n\n try {\n const fileBuffer = Buffer.from(await file.arrayBuffer());\n const fileUploadUrl = `${client.baseUrl}/jsonapi/media/image/field_media_image`;\n\n const asciiFilename = file.name\n .replace(/[^\\x20-\\x7e]/g, '_')\n .replace(/\"/g, '');\n const contentDisposition = `attachment; filename=\"${asciiFilename}\"; filename*=UTF-8''${encodeURIComponent(file.name)}`;\n\n const fileUploadResponse = await fetch(fileUploadUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/vnd.api+json',\n 'Content-Type': 'application/octet-stream',\n 'Content-Disposition': contentDisposition,\n Authorization: `Bearer ${token}`,\n },\n body: fileBuffer,\n });\n\n if (!fileUploadResponse.ok) {\n console.error('File upload failed:', await fileUploadResponse.text());\n return { success: false, message: 'File upload failed' };\n }\n\n const fileResult = await fileUploadResponse.json();\n const fileUuid = fileResult.data.id;\n\n const mediaData = {\n data: {\n type: 'media--image',\n attributes: {\n name: mediaName,\n status: true,\n },\n relationships: {\n field_media_image: {\n data: {\n type: 'file--file',\n id: fileUuid,\n meta: {\n alt: alt || mediaName,\n },\n },\n },\n },\n },\n };\n\n const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/image`, {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!mediaResponse.ok) {\n console.error(\n 'Media entity creation failed:',\n await mediaResponse.text()\n );\n return { success: false, message: 'Media entity creation failed' };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n 'image',\n lang\n );\n\n return { success: true, message: 'Image uploaded successfully', data };\n } catch (error) {\n console.error('Error uploading image media:', error);\n return { success: false, message: 'An unexpected error occurred' };\n }\n}\n\n/** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */\nexport async function uploadRemoteVideo(\n client: NodeHiveClient,\n { videoUrl, name, lang }: { videoUrl: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return { success: false, message: 'Authentication required' };\n }\n\n if (!videoUrl) {\n return { success: false, message: 'No video URL provided' };\n }\n\n try {\n const mediaData = {\n data: {\n type: 'media--remote_video',\n attributes: {\n name: name,\n status: true,\n field_media_oembed_video: videoUrl,\n },\n },\n };\n\n const mediaResponse = await fetch(\n `${client.baseUrl}/jsonapi/media/remote_video`,\n {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n }\n );\n\n if (!mediaResponse.ok) {\n console.error(\n 'Remote video entity creation failed:',\n await mediaResponse.text()\n );\n return { success: false, message: 'Remote video entity creation failed' };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n 'remote_video',\n lang\n );\n\n return { success: true, message: 'Remote video added successfully', data };\n } catch (error) {\n console.error('Error adding remote video:', error);\n return { success: false, message: 'An unexpected error occurred' };\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,gBAAgB;AAQjD,eAAeC,kBAAkBA,CAC/BC,MAAsB,EACtBC,OAA2D,EAC3DC,IAAY,EACZC,IAAa,EACb;EACA,IAAI;IACF,MAAMC,QAAQ,GAAG,MAAMJ,MAAM,CAACK,QAAQ,CAACJ,OAAO,CAACK,EAAE,EAAEJ,IAAI,EAAE;MACvDC,IAAI,EAAEF,OAAO,EAAEM,UAAU,EAAEC,QAAQ,IAAIL,IAAI,IAAI,IAAI;MACnDM,MAAM,EAAEX,gBAAgB,CAACI,IAAI;IAC/B,CAAC,CAAC;IACF,OAAOE,QAAQ,EAAEM,IAAI,IAAIT,OAAO;EAClC,CAAC,CAAC,OAAOU,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;IACtD,OAAOV,OAAO;EAChB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeY,WAAWA,CAC/Bb,MAAsB,EACtB;EACEc,IAAI;EACJC,GAAG;EACHC,IAAI;EACJb;AAC0D,CAAC,EACjC;EAC5B,MAAMc,KAAK,GAAG,MAAMjB,MAAM,CAACkB,QAAQ,CAAC,CAAC;EACrC,IAAI,CAACD,KAAK,EAAE;IACV,OAAO;MAAEE,OAAO,EAAE,KAAK;MAAEC,OAAO,EAAE;IAA0B,CAAC;EAC/D;EAEA,MAAMC,SAAS,GAAGL,IAAI,IAAIF,IAAI,CAACE,IAAI,IAAI,OAAO;EAE9C,IAAI;IACF,MAAMM,UAAU,GAAGC,MAAM,CAACC,IAAI,CAAC,MAAMV,IAAI,CAACW,WAAW,CAAC,CAAC,CAAC;IACxD,MAAMC,aAAa,GAAG,GAAG1B,MAAM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+B,CAAC;EACpE;AACF","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { NodeHiveClient } from 'nodehive-js';
2
+ export declare const SPACE_TYPE = "nodehive_space--nodehive_space";
3
+ export declare function resolveSpaceUuid(client: NodeHiveClient, spaceId: string): Promise<string | undefined>;
4
+ //# sourceMappingURL=space.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../src/puck-editor/internal/api/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,UAAU,mCAAmC,CAAC;AAE3D,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7B"}
@@ -0,0 +1,11 @@
1
+ export const SPACE_TYPE = 'nodehive_space--nodehive_space';
2
+ export async function resolveSpaceUuid(client, spaceId) {
3
+ try {
4
+ const res = await client.request(`/jsonapi/nodehive_space/nodehive_space?filter[drupal_internal__id]=${spaceId}`);
5
+ return res?.data?.[0]?.id;
6
+ } catch (error) {
7
+ console.error('Error resolving space:', error);
8
+ return undefined;
9
+ }
10
+ }
11
+ //# sourceMappingURL=space.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.js","names":["SPACE_TYPE","resolveSpaceUuid","client","spaceId","res","request","data","id","error","console","undefined"],"sources":["../../../../src/puck-editor/internal/api/space.ts"],"sourcesContent":["import type { NodeHiveClient } from 'nodehive-js';\n\nexport const SPACE_TYPE = 'nodehive_space--nodehive_space';\n\nexport async function resolveSpaceUuid(\n client: NodeHiveClient,\n spaceId: string\n): Promise<string | undefined> {\n try {\n const res = await client.request(\n `/jsonapi/nodehive_space/nodehive_space?filter[drupal_internal__id]=${spaceId}`\n );\n return res?.data?.[0]?.id;\n } catch (error) {\n console.error('Error resolving space:', error);\n return undefined;\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,UAAU,GAAG,gCAAgC;AAE1D,OAAO,eAAeC,gBAAgBA,CACpCC,MAAsB,EACtBC,OAAe,EACc;EAC7B,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMF,MAAM,CAACG,OAAO,CAC9B,sEAAsEF,OAAO,EAC/E,CAAC;IACD,OAAOC,GAAG,EAAEE,IAAI,GAAG,CAAC,CAAC,EAAEC,EAAE;EAC3B,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAC9C,OAAOE,SAAS;EAClB;AACF","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ import type { Data } from '@puckeditor/core';
2
+ export type PuckMetadataFields = {
3
+ /** Node field for the SEO title; false when the bundle has no such field. */
4
+ title?: string | false;
5
+ description?: string | false;
6
+ image?: string | false;
7
+ };
8
+ export type PuckBundleConfig = {
9
+ /** JSON:API resource type, e.g. 'node--puck_page'. */
10
+ type: string;
11
+ /** Node field holding the serialized Puck data. */
12
+ dataField: string;
13
+ /** Shown in the new-page type chooser; defaults to a humanized type. */
14
+ label?: string;
15
+ /** Offered by the new-page action; defaults to true. */
16
+ creatable?: boolean;
17
+ createDefaults?: {
18
+ title?: string;
19
+ };
20
+ metadataFields?: PuckMetadataFields;
21
+ };
22
+ export type PuckTemplatesConfig = {
23
+ /** NodeHive fragment type storing editor templates. */
24
+ fragmentType: string;
25
+ dataField: string;
26
+ categoryField: string;
27
+ aiDescriptionField: string;
28
+ aiInstructionsField: string;
29
+ };
30
+ export type PuckContentModelInput = {
31
+ bundles?: PuckBundleConfig[];
32
+ templates?: Partial<PuckTemplatesConfig>;
33
+ maxUploadBytes?: number;
34
+ };
35
+ export type ResolvedPuckBundle = {
36
+ type: string;
37
+ dataField: string;
38
+ label: string;
39
+ creatable: boolean;
40
+ createDefaults: {
41
+ title?: string;
42
+ };
43
+ metadataFields: Required<PuckMetadataFields>;
44
+ };
45
+ export type PuckContentModel = {
46
+ bundles: ResolvedPuckBundle[];
47
+ templates: PuckTemplatesConfig;
48
+ maxUploadBytes: number;
49
+ };
50
+ export declare const DEFAULT_METADATA_FIELDS: Required<PuckMetadataFields>;
51
+ export declare function resolveContentModel(input?: PuckContentModelInput): PuckContentModel;
52
+ export declare function getBundle(model: PuckContentModel, type: string | undefined): ResolvedPuckBundle | undefined;
53
+ export declare function parsePuckData(raw: unknown, nodeId?: string): Data;
54
+ export declare function creatableBundles(model: PuckContentModel): ResolvedPuckBundle[];
55
+ //# sourceMappingURL=content-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-model.d.ts","sourceRoot":"","sources":["../../../src/puck-editor/internal/content-model.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,cAAc,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,kBAAkB,CAIhE,CAAC;AAqBF,wBAAgB,mBAAmB,CACjC,KAAK,CAAC,EAAE,qBAAqB,GAC5B,gBAAgB,CAgBlB;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,kBAAkB,GAAG,SAAS,CAEhC;AAWD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAWjE;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,gBAAgB,GACtB,kBAAkB,EAAE,CAEtB"}
@@ -0,0 +1,73 @@
1
+ // Single source for everything the module assumes about the Drupal content
2
+ // model. The same resolved model drives the server handlers (createPuckApi)
3
+ // and the client editor (PuckEditorConfigProvider); passing different values
4
+ // to the two sides makes publish validation drift from the editor UI.
5
+
6
+ export const DEFAULT_METADATA_FIELDS = {
7
+ title: 'field_metadata_title',
8
+ description: 'field_metadata_description',
9
+ image: 'field_metadata_image'
10
+ };
11
+ const DEFAULT_BUNDLES = [{
12
+ type: 'node--puck_page',
13
+ dataField: 'field_puck_data'
14
+ }];
15
+ const DEFAULT_TEMPLATES = {
16
+ fragmentType: 'puck_template',
17
+ dataField: 'field_puck_template_data',
18
+ categoryField: 'field_puck_template_category',
19
+ aiDescriptionField: 'field_puck_ai_description',
20
+ aiInstructionsField: 'field_puck_ai_instructions'
21
+ };
22
+ const DEFAULT_MAX_UPLOAD_BYTES = 8 * 1024 * 1024;
23
+ function humanizeType(type) {
24
+ const slug = type.replace(/^node--/, '').replace(/[_-]+/g, ' ');
25
+ return slug.charAt(0).toUpperCase() + slug.slice(1);
26
+ }
27
+ export function resolveContentModel(input) {
28
+ const bundles = (input?.bundles?.length ? input.bundles : DEFAULT_BUNDLES).map(bundle => ({
29
+ type: bundle.type,
30
+ dataField: bundle.dataField,
31
+ label: bundle.label ?? humanizeType(bundle.type),
32
+ creatable: bundle.creatable ?? true,
33
+ createDefaults: {
34
+ title: bundle.createDefaults?.title
35
+ },
36
+ metadataFields: {
37
+ ...DEFAULT_METADATA_FIELDS,
38
+ ...bundle.metadataFields
39
+ }
40
+ }));
41
+ return {
42
+ bundles,
43
+ templates: {
44
+ ...DEFAULT_TEMPLATES,
45
+ ...input?.templates
46
+ },
47
+ maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES
48
+ };
49
+ }
50
+ export function getBundle(model, type) {
51
+ return model.bundles.find(bundle => bundle.type === type);
52
+ }
53
+ const normalizePuckData = parsed => ({
54
+ root: parsed?.root ?? {
55
+ props: {}
56
+ },
57
+ content: parsed?.content ?? [],
58
+ zones: parsed?.zones ?? {}
59
+ });
60
+ const emptyPuckData = () => normalizePuckData(null);
61
+ export function parsePuckData(raw, nodeId) {
62
+ if (typeof raw !== 'string' || !raw) return emptyPuckData();
63
+ try {
64
+ return normalizePuckData(JSON.parse(raw));
65
+ } catch (error) {
66
+ console.error(`puck-editor: failed to parse Puck data for node "${nodeId ?? 'unknown'}"`, error);
67
+ return emptyPuckData();
68
+ }
69
+ }
70
+ export function creatableBundles(model) {
71
+ return model.bundles.filter(bundle => bundle.creatable);
72
+ }
73
+ //# sourceMappingURL=content-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-model.js","names":["DEFAULT_METADATA_FIELDS","title","description","image","DEFAULT_BUNDLES","type","dataField","DEFAULT_TEMPLATES","fragmentType","categoryField","aiDescriptionField","aiInstructionsField","DEFAULT_MAX_UPLOAD_BYTES","humanizeType","slug","replace","charAt","toUpperCase","slice","resolveContentModel","input","bundles","length","map","bundle","label","creatable","createDefaults","metadataFields","templates","maxUploadBytes","getBundle","model","find","normalizePuckData","parsed","root","props","content","zones","emptyPuckData","parsePuckData","raw","nodeId","JSON","parse","error","console","creatableBundles","filter"],"sources":["../../../src/puck-editor/internal/content-model.ts"],"sourcesContent":["// Single source for everything the module assumes about the Drupal content\n// model. The same resolved model drives the server handlers (createPuckApi)\n// and the client editor (PuckEditorConfigProvider); passing different values\n// to the two sides makes publish validation drift from the editor UI.\n\nimport type { Data } from '@puckeditor/core';\n\nexport type PuckMetadataFields = {\n /** Node field for the SEO title; false when the bundle has no such field. */\n title?: string | false;\n description?: string | false;\n image?: string | false;\n};\n\nexport type PuckBundleConfig = {\n /** JSON:API resource type, e.g. 'node--puck_page'. */\n type: string;\n /** Node field holding the serialized Puck data. */\n dataField: string;\n /** Shown in the new-page type chooser; defaults to a humanized type. */\n label?: string;\n /** Offered by the new-page action; defaults to true. */\n creatable?: boolean;\n createDefaults?: { title?: string };\n metadataFields?: PuckMetadataFields;\n};\n\nexport type PuckTemplatesConfig = {\n /** NodeHive fragment type storing editor templates. */\n fragmentType: string;\n dataField: string;\n categoryField: string;\n aiDescriptionField: string;\n aiInstructionsField: string;\n};\n\nexport type PuckContentModelInput = {\n bundles?: PuckBundleConfig[];\n templates?: Partial<PuckTemplatesConfig>;\n maxUploadBytes?: number;\n};\n\nexport type ResolvedPuckBundle = {\n type: string;\n dataField: string;\n label: string;\n creatable: boolean;\n createDefaults: { title?: string };\n metadataFields: Required<PuckMetadataFields>;\n};\n\nexport type PuckContentModel = {\n bundles: ResolvedPuckBundle[];\n templates: PuckTemplatesConfig;\n maxUploadBytes: number;\n};\n\nexport const DEFAULT_METADATA_FIELDS: Required<PuckMetadataFields> = {\n title: 'field_metadata_title',\n description: 'field_metadata_description',\n image: 'field_metadata_image',\n};\n\nconst DEFAULT_BUNDLES: PuckBundleConfig[] = [\n { type: 'node--puck_page', dataField: 'field_puck_data' },\n];\n\nconst DEFAULT_TEMPLATES: PuckTemplatesConfig = {\n fragmentType: 'puck_template',\n dataField: 'field_puck_template_data',\n categoryField: 'field_puck_template_category',\n aiDescriptionField: 'field_puck_ai_description',\n aiInstructionsField: 'field_puck_ai_instructions',\n};\n\nconst DEFAULT_MAX_UPLOAD_BYTES = 8 * 1024 * 1024;\n\nfunction humanizeType(type: string): string {\n const slug = type.replace(/^node--/, '').replace(/[_-]+/g, ' ');\n return slug.charAt(0).toUpperCase() + slug.slice(1);\n}\n\nexport function resolveContentModel(\n input?: PuckContentModelInput\n): PuckContentModel {\n const bundles = (\n input?.bundles?.length ? input.bundles : DEFAULT_BUNDLES\n ).map((bundle) => ({\n type: bundle.type,\n dataField: bundle.dataField,\n label: bundle.label ?? humanizeType(bundle.type),\n creatable: bundle.creatable ?? true,\n createDefaults: { title: bundle.createDefaults?.title },\n metadataFields: { ...DEFAULT_METADATA_FIELDS, ...bundle.metadataFields },\n }));\n return {\n bundles,\n templates: { ...DEFAULT_TEMPLATES, ...input?.templates },\n maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES,\n };\n}\n\nexport function getBundle(\n model: PuckContentModel,\n type: string | undefined\n): ResolvedPuckBundle | undefined {\n return model.bundles.find((bundle) => bundle.type === type);\n}\n\nconst normalizePuckData = (parsed: Partial<Data> | null): Data =>\n ({\n root: parsed?.root ?? { props: {} },\n content: parsed?.content ?? [],\n zones: parsed?.zones ?? {},\n }) as Data;\n\nconst emptyPuckData = (): Data => normalizePuckData(null);\n\nexport function parsePuckData(raw: unknown, nodeId?: string): Data {\n if (typeof raw !== 'string' || !raw) return emptyPuckData();\n try {\n return normalizePuckData(JSON.parse(raw) as Partial<Data> | null);\n } catch (error) {\n console.error(\n `puck-editor: failed to parse Puck data for node \"${nodeId ?? 'unknown'}\"`,\n error\n );\n return emptyPuckData();\n }\n}\n\nexport function creatableBundles(\n model: PuckContentModel\n): ResolvedPuckBundle[] {\n return model.bundles.filter((bundle) => bundle.creatable);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAsDA,OAAO,MAAMA,uBAAqD,GAAG;EACnEC,KAAK,EAAE,sBAAsB;EAC7BC,WAAW,EAAE,4BAA4B;EACzCC,KAAK,EAAE;AACT,CAAC;AAED,MAAMC,eAAmC,GAAG,CAC1C;EAAEC,IAAI,EAAE,iBAAiB;EAAEC,SAAS,EAAE;AAAkB,CAAC,CAC1D;AAED,MAAMC,iBAAsC,GAAG;EAC7CC,YAAY,EAAE,eAAe;EAC7BF,SAAS,EAAE,0BAA0B;EACrCG,aAAa,EAAE,8BAA8B;EAC7CC,kBAAkB,EAAE,2BAA2B;EAC/CC,mBAAmB,EAAE;AACvB,CAAC;AAED,MAAMC,wBAAwB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;AAEhD,SAASC,YAAYA,CAACR,IAAY,EAAU;EAC1C,MAAMS,IAAI,GAAGT,IAAI,CAACU,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;EAC/D,OAAOD,IAAI,CAACE,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGH,IAAI,CAACI,KAAK,CAAC,CAAC,CAAC;AACrD;AAEA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AC;AAEzD,OAAO,SAASO,aAAaA,CAACC,GAAY,EAAEC,MAAe,EAAQ;EACjE,IAAI,OAAOD,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE,OAAOF,aAAa,CAAC,CAAC;EAC3D,IAAI;IACF,OAAON,iBAAiB,CAACU,IAAI,CAACC,KAAK,CAACH,GAAG,CAAyB,CAAC;EACnE,CAAC,CAAC,OAAOI,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CACX,oDAAoDH,MAAM,IAAI,SAAS,GAAG,EAC1EG,KACF,CAAC;IACD,OAAON,aAAa,CAAC,CAAC;EACxB;AACF;AAEA,OAAO,SAASQ,gBAAgBA,CAC9BhB,KAAuB,EACD;EACtB,OAAOA,KAAK,CAACX,OAAO,CAAC4B,MAAM,CAAEzB,MAAM,IAAKA,MAAM,CAACE,SAAS,CAAC;AAC3D","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { Config } from '@puckeditor/core';
2
+ import { TreeZone } from '../plugins/outline-plugin/outline-tree';
3
+ export declare function allowedTypesForZone(config: Config, zone: TreeZone): string[];
4
+ //# sourceMappingURL=allowed-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-types.d.ts","sourceRoot":"","sources":["../../../../src/puck-editor/internal/editor/allowed-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAEL,QAAQ,EACT,MAAM,wCAAwC,CAAC;AAGhD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAI5E"}
@@ -0,0 +1,6 @@
1
+ import { isTypeAllowed } from '../plugins/outline-plugin/outline-tree';
2
+ import { TEMPLATE_PREFIX } from '../plugins/templates-plugin/template-vehicles';
3
+ export function allowedTypesForZone(config, zone) {
4
+ return Object.keys(config.components).filter(type => !type.startsWith(TEMPLATE_PREFIX) && isTypeAllowed(zone, type));
5
+ }
6
+ //# sourceMappingURL=allowed-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-types.js","names":["isTypeAllowed","TEMPLATE_PREFIX","allowedTypesForZone","config","zone","Object","keys","components","filter","type","startsWith"],"sources":["../../../../src/puck-editor/internal/editor/allowed-types.ts"],"sourcesContent":["import type { Config } from '@puckeditor/core';\n\nimport {\n isTypeAllowed,\n TreeZone,\n} from '../plugins/outline-plugin/outline-tree';\nimport { TEMPLATE_PREFIX } from '../plugins/templates-plugin/template-vehicles';\n\nexport function allowedTypesForZone(config: Config, zone: TreeZone): string[] {\n return Object.keys(config.components).filter(\n (type) => !type.startsWith(TEMPLATE_PREFIX) && isTypeAllowed(zone, type)\n );\n}\n"],"mappings":"AAEA,SACEA,aAAa,QAER,wCAAwC;AAC/C,SAASC,eAAe,QAAQ,+CAA+C;AAE/E,OAAO,SAASC,mBAAmBA,CAACC,MAAc,EAAEC,IAAc,EAAY;EAC5E,OAAOC,MAAM,CAACC,IAAI,CAACH,MAAM,CAACI,UAAU,CAAC,CAACC,MAAM,CACzCC,IAAI,IAAK,CAACA,IAAI,CAACC,UAAU,CAACT,eAAe,CAAC,IAAID,aAAa,CAACI,IAAI,EAAEK,IAAI,CACzE,CAAC;AACH","ignoreList":[]}