@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.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/internal/config.d.ts +24 -0
- package/dist/auth/internal/config.d.ts.map +1 -0
- package/dist/auth/internal/config.js +2 -0
- package/dist/auth/internal/config.js.map +1 -0
- package/dist/auth/internal/draft-mode.d.ts +17 -0
- package/dist/auth/internal/draft-mode.d.ts.map +1 -0
- package/dist/auth/internal/draft-mode.js +73 -0
- package/dist/auth/internal/draft-mode.js.map +1 -0
- package/dist/auth/internal/editor-locale.d.ts +4 -0
- package/dist/auth/internal/editor-locale.d.ts.map +1 -0
- package/dist/auth/internal/editor-locale.js +14 -0
- package/dist/auth/internal/editor-locale.js.map +1 -0
- package/dist/auth/internal/handoff.d.ts +11 -0
- package/dist/auth/internal/handoff.d.ts.map +1 -0
- package/dist/auth/internal/handoff.js +44 -0
- package/dist/auth/internal/handoff.js.map +1 -0
- package/dist/auth/internal/has-session.d.ts +7 -0
- package/dist/auth/internal/has-session.d.ts.map +1 -0
- package/dist/auth/internal/has-session.js +11 -0
- package/dist/auth/internal/has-session.js.map +1 -0
- package/dist/auth/internal/logout.d.ts +12 -0
- package/dist/auth/internal/logout.d.ts.map +1 -0
- package/dist/auth/internal/logout.js +48 -0
- package/dist/auth/internal/logout.js.map +1 -0
- package/dist/auth/internal/next-cookie-storage.d.ts +28 -0
- package/dist/auth/internal/next-cookie-storage.d.ts.map +1 -0
- package/dist/auth/internal/next-cookie-storage.js +103 -0
- package/dist/auth/internal/next-cookie-storage.js.map +1 -0
- package/dist/auth/internal/nodehive-client.d.ts +6 -0
- package/dist/auth/internal/nodehive-client.d.ts.map +1 -0
- package/dist/auth/internal/nodehive-client.js +64 -0
- package/dist/auth/internal/nodehive-client.js.map +1 -0
- package/dist/auth/internal/oauth-config.d.ts +37 -0
- package/dist/auth/internal/oauth-config.d.ts.map +1 -0
- package/dist/auth/internal/oauth-config.js +70 -0
- package/dist/auth/internal/oauth-config.js.map +1 -0
- package/dist/auth/internal/proxy-helpers.d.ts +15 -0
- package/dist/auth/internal/proxy-helpers.d.ts.map +1 -0
- package/dist/auth/internal/proxy-helpers.js +43 -0
- package/dist/auth/internal/proxy-helpers.js.map +1 -0
- package/dist/auth/internal/refresh.d.ts +13 -0
- package/dist/auth/internal/refresh.d.ts.map +1 -0
- package/dist/auth/internal/refresh.js +170 -0
- package/dist/auth/internal/refresh.js.map +1 -0
- package/dist/auth/internal/require-auth.d.ts +2 -0
- package/dist/auth/internal/require-auth.d.ts.map +1 -0
- package/dist/auth/internal/require-auth.js +11 -0
- package/dist/auth/internal/require-auth.js.map +1 -0
- package/dist/auth/internal/return-to.d.ts +16 -0
- package/dist/auth/internal/return-to.d.ts.map +1 -0
- package/dist/auth/internal/return-to.js +31 -0
- package/dist/auth/internal/return-to.js.map +1 -0
- package/dist/auth/internal/routes/callback.d.ts +11 -0
- package/dist/auth/internal/routes/callback.d.ts.map +1 -0
- package/dist/auth/internal/routes/callback.js +93 -0
- package/dist/auth/internal/routes/callback.js.map +1 -0
- package/dist/auth/internal/routes/chips-exchange.d.ts +4 -0
- package/dist/auth/internal/routes/chips-exchange.d.ts.map +1 -0
- package/dist/auth/internal/routes/chips-exchange.js +64 -0
- package/dist/auth/internal/routes/chips-exchange.js.map +1 -0
- package/dist/auth/internal/routes/draft.d.ts +4 -0
- package/dist/auth/internal/routes/draft.d.ts.map +1 -0
- package/dist/auth/internal/routes/draft.js +34 -0
- package/dist/auth/internal/routes/draft.js.map +1 -0
- package/dist/auth/internal/routes/index.d.ts +25 -0
- package/dist/auth/internal/routes/index.d.ts.map +1 -0
- package/dist/auth/internal/routes/index.js +66 -0
- package/dist/auth/internal/routes/index.js.map +1 -0
- package/dist/auth/internal/routes/login.d.ts +3 -0
- package/dist/auth/internal/routes/login.d.ts.map +1 -0
- package/dist/auth/internal/routes/login.js +47 -0
- package/dist/auth/internal/routes/login.js.map +1 -0
- package/dist/auth/internal/routes/popup-done.d.ts +3 -0
- package/dist/auth/internal/routes/popup-done.d.ts.map +1 -0
- package/dist/auth/internal/routes/popup-done.js +24 -0
- package/dist/auth/internal/routes/popup-done.js.map +1 -0
- package/dist/auth/internal/routes/refresh.d.ts +6 -0
- package/dist/auth/internal/routes/refresh.d.ts.map +1 -0
- package/dist/auth/internal/routes/refresh.js +44 -0
- package/dist/auth/internal/routes/refresh.js.map +1 -0
- package/dist/auth/internal/same-origin.d.ts +8 -0
- package/dist/auth/internal/same-origin.d.ts.map +1 -0
- package/dist/auth/internal/same-origin.js +9 -0
- package/dist/auth/internal/same-origin.js.map +1 -0
- package/dist/auth/internal/session-gates.d.ts +7 -0
- package/dist/auth/internal/session-gates.d.ts.map +1 -0
- package/dist/auth/internal/session-gates.js +12 -0
- package/dist/auth/internal/session-gates.js.map +1 -0
- package/dist/auth/internal/update-session.d.ts +17 -0
- package/dist/auth/internal/update-session.d.ts.map +1 -0
- package/dist/auth/internal/update-session.js +39 -0
- package/dist/auth/internal/update-session.js.map +1 -0
- package/dist/auth/internal/use-editor-login.d.ts +33 -0
- package/dist/auth/internal/use-editor-login.d.ts.map +1 -0
- package/dist/auth/internal/use-editor-login.js +143 -0
- package/dist/auth/internal/use-editor-login.js.map +1 -0
- package/dist/auth/proxy.d.ts +8 -0
- package/dist/auth/proxy.d.ts.map +1 -0
- package/dist/auth/proxy.js +8 -0
- package/dist/auth/proxy.js.map +1 -0
- package/dist/auth/react.d.ts +2 -0
- package/dist/auth/react.d.ts.map +1 -0
- package/dist/auth/react.js +3 -0
- package/dist/auth/react.js.map +1 -0
- package/dist/auth/routes.d.ts +3 -0
- package/dist/auth/routes.d.ts.map +1 -0
- package/dist/auth/routes.js +3 -0
- package/dist/auth/routes.js.map +1 -0
- package/dist/auth/server.d.ts +23 -0
- package/dist/auth/server.d.ts.map +1 -0
- package/dist/auth/server.js +61 -0
- package/dist/auth/server.js.map +1 -0
- package/dist/puck-editor/fields.d.ts +7 -0
- package/dist/puck-editor/fields.d.ts.map +1 -0
- package/dist/puck-editor/fields.js +4 -0
- package/dist/puck-editor/fields.js.map +1 -0
- package/dist/puck-editor/index.d.ts +14 -0
- package/dist/puck-editor/index.d.ts.map +1 -0
- package/dist/puck-editor/index.js +12 -0
- package/dist/puck-editor/index.js.map +1 -0
- package/dist/puck-editor/internal/api/client.d.ts +32 -0
- package/dist/puck-editor/internal/api/client.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/client.js +128 -0
- package/dist/puck-editor/internal/api/client.js.map +1 -0
- package/dist/puck-editor/internal/api/config.d.ts +29 -0
- package/dist/puck-editor/internal/api/config.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/config.js +2 -0
- package/dist/puck-editor/internal/api/config.js.map +1 -0
- package/dist/puck-editor/internal/api/create-puck-api.d.ts +26 -0
- package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/create-puck-api.js +124 -0
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts +13 -0
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/create-page.js +125 -0
- package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/entities.d.ts +17 -0
- package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/entities.js +166 -0
- package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/publish.d.ts +6 -0
- package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/publish.js +115 -0
- package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/template.d.ts +15 -0
- package/dist/puck-editor/internal/api/handlers/template.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/template.js +222 -0
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -0
- package/dist/puck-editor/internal/api/handlers/upload.d.ts +13 -0
- package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/handlers/upload.js +129 -0
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -0
- package/dist/puck-editor/internal/api/media-params.d.ts +4 -0
- package/dist/puck-editor/internal/api/media-params.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/media-params.js +38 -0
- package/dist/puck-editor/internal/api/media-params.js.map +1 -0
- package/dist/puck-editor/internal/api/media-upload.d.ts +24 -0
- package/dist/puck-editor/internal/api/media-upload.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/media-upload.js +171 -0
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -0
- package/dist/puck-editor/internal/api/space.d.ts +4 -0
- package/dist/puck-editor/internal/api/space.d.ts.map +1 -0
- package/dist/puck-editor/internal/api/space.js +11 -0
- package/dist/puck-editor/internal/api/space.js.map +1 -0
- package/dist/puck-editor/internal/content-model.d.ts +55 -0
- package/dist/puck-editor/internal/content-model.d.ts.map +1 -0
- package/dist/puck-editor/internal/content-model.js +73 -0
- package/dist/puck-editor/internal/content-model.js.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts +4 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.js +6 -0
- package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +9 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.js +231 -0
- package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +6 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.js +85 -0
- package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +2 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.js +844 -0
- package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +3 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.js +16 -0
- package/dist/puck-editor/internal/editor/canvas-scroll.js.map +1 -0
- package/dist/puck-editor/internal/editor/component-icons.d.ts +14 -0
- package/dist/puck-editor/internal/editor/component-icons.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/component-icons.js +35 -0
- package/dist/puck-editor/internal/editor/component-icons.js.map +1 -0
- package/dist/puck-editor/internal/editor/component-item.d.ts +6 -0
- package/dist/puck-editor/internal/editor/component-item.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/component-item.js +42 -0
- package/dist/puck-editor/internal/editor/component-item.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +6 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.js +249 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +7 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.js +120 -0
- package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +15 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.js +61 -0
- package/dist/puck-editor/internal/editor/find-missing-required-fields.js.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +15 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +147 -0
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +17 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.js +125 -0
- package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -0
- package/dist/puck-editor/internal/editor/header-save-button.d.ts +5 -0
- package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/header-save-button.js +60 -0
- package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts +4 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.js +140 -0
- package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +6 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.js +79 -0
- package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -0
- package/dist/puck-editor/internal/editor/picker-model.d.ts +62 -0
- package/dist/puck-editor/internal/editor/picker-model.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/picker-model.js +489 -0
- package/dist/puck-editor/internal/editor/picker-model.js.map +1 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +30 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.js +30 -0
- package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -0
- package/dist/puck-editor/internal/editor/puck-editor.d.ts +15 -0
- package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/puck-editor.js +333 -0
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts +4 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.js +71 -0
- package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +15 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js +93 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.js.map +1 -0
- package/dist/puck-editor/internal/editor-config.d.ts +30 -0
- package/dist/puck-editor/internal/editor-config.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor-config.js +57 -0
- package/dist/puck-editor/internal/editor-config.js.map +1 -0
- package/dist/puck-editor/internal/editor-query-client.d.ts +4 -0
- package/dist/puck-editor/internal/editor-query-client.d.ts.map +1 -0
- package/dist/puck-editor/internal/editor-query-client.js +8 -0
- package/dist/puck-editor/internal/editor-query-client.js.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +14 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +120 -0
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +21 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +24 -0
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +16 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +20 -0
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +8 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js +151 -0
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -0
- package/dist/puck-editor/internal/fields/index.d.ts +10 -0
- package/dist/puck-editor/internal/fields/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/index.js +10 -0
- package/dist/puck-editor/internal/fields/index.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +33 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.js +83 -0
- package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +24 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +31 -0
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +2 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.js +4 -0
- package/dist/puck-editor/internal/fields/link-picker/humanize.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +27 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +564 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +9 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +189 -0
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +72 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.js +114 -0
- package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +14 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +667 -0
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +11 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js +34 -0
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +40 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +146 -0
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts +34 -0
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/link-picker/types.js +2 -0
- package/dist/puck-editor/internal/fields/link-picker/types.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +27 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +32 -0
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +13 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js +372 -0
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +2 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.js +8 -0
- package/dist/puck-editor/internal/fields/media-array/reorder.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +27 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +32 -0
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +11 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +219 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +24 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.js +8 -0
- package/dist/puck-editor/internal/fields/media-selector/crop-types.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +8 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.js +51 -0
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +7 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +147 -0
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +30 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +358 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +14 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +355 -0
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +2 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js +55 -0
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +24 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +229 -0
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +7 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +120 -0
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +31 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +39 -0
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/fields/required-field-label.d.ts +16 -0
- package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/required-field-label.js +89 -0
- package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -0
- package/dist/puck-editor/internal/fields/required.d.ts +19 -0
- package/dist/puck-editor/internal/fields/required.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/required.js +20 -0
- package/dist/puck-editor/internal/fields/required.js.map +1 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +37 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +1 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +26 -0
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -0
- package/dist/puck-editor/internal/i18n.d.ts +188 -0
- package/dist/puck-editor/internal/i18n.d.ts.map +1 -0
- package/dist/puck-editor/internal/i18n.js +414 -0
- package/dist/puck-editor/internal/i18n.js.map +1 -0
- package/dist/puck-editor/internal/locale.d.ts +13 -0
- package/dist/puck-editor/internal/locale.d.ts.map +1 -0
- package/dist/puck-editor/internal/locale.js +20 -0
- package/dist/puck-editor/internal/locale.js.map +1 -0
- package/dist/puck-editor/internal/localize.d.ts +11 -0
- package/dist/puck-editor/internal/localize.d.ts.map +1 -0
- package/dist/puck-editor/internal/localize.js +42 -0
- package/dist/puck-editor/internal/localize.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +21 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +197 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +131 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +46 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +46 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +176 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js +39 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.js +3 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +17 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js +35 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +19 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js +79 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.js +243 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/help.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +19 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +31 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +23 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +72 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +20 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js +34 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +17 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +70 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +37 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +18 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +861 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +16 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +53 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js +145 -0
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +69 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +18 -0
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +178 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +3 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +55 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +12 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +125 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +8 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +582 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js +6 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +4 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +54 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +11 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +92 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +7 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +30 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +2 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +471 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +5 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +16 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +43 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +115 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +9 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +152 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +16 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +1 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +134 -0
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -0
- package/dist/puck-editor/internal/puck-augmentation.d.ts +28 -0
- package/dist/puck-editor/internal/puck-augmentation.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-augmentation.js +7 -0
- package/dist/puck-editor/internal/puck-augmentation.js.map +1 -0
- package/dist/puck-editor/internal/puck-editor-provider.d.ts +12 -0
- package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-editor-provider.js +69 -0
- package/dist/puck-editor/internal/puck-editor-provider.js.map +1 -0
- package/dist/puck-editor/internal/puck-node.d.ts +29 -0
- package/dist/puck-editor/internal/puck-node.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-node.js +2 -0
- package/dist/puck-editor/internal/puck-node.js.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts +19 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.js +270 -0
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -0
- package/dist/puck-editor/internal/render/cropped-image.d.ts +19 -0
- package/dist/puck-editor/internal/render/cropped-image.d.ts.map +1 -0
- package/dist/puck-editor/internal/render/cropped-image.js +126 -0
- package/dist/puck-editor/internal/render/cropped-image.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts +13 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.js +29 -0
- package/dist/puck-editor/internal/smart-actions/index.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts +13 -0
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/new-page.js +80 -0
- package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +2 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +1 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +65 -0
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -0
- package/dist/puck-editor/internal/ui/calendar.d.ts +9 -0
- package/dist/puck-editor/internal/ui/calendar.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/calendar.js +147 -0
- package/dist/puck-editor/internal/ui/calendar.js.map +1 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +13 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.js +93 -0
- package/dist/puck-editor/internal/ui/component-list-accordion.js.map +1 -0
- package/dist/puck-editor/internal/ui/dialog.d.ts +20 -0
- package/dist/puck-editor/internal/ui/dialog.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/dialog.js +286 -0
- package/dist/puck-editor/internal/ui/dialog.js.map +1 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +11 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.js +109 -0
- package/dist/puck-editor/internal/ui/drawer-item-content.js.map +1 -0
- package/dist/puck-editor/internal/ui/icon-button.d.ts +10 -0
- package/dist/puck-editor/internal/ui/icon-button.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/icon-button.js +72 -0
- package/dist/puck-editor/internal/ui/icon-button.js.map +1 -0
- package/dist/puck-editor/internal/ui/popover.d.ts +9 -0
- package/dist/puck-editor/internal/ui/popover.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/popover.js +165 -0
- package/dist/puck-editor/internal/ui/popover.js.map +1 -0
- package/dist/puck-editor/internal/ui/required-mark.d.ts +2 -0
- package/dist/puck-editor/internal/ui/required-mark.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/required-mark.js +12 -0
- package/dist/puck-editor/internal/ui/required-mark.js.map +1 -0
- package/dist/puck-editor/internal/ui/search-control.d.ts +20 -0
- package/dist/puck-editor/internal/ui/search-control.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/search-control.js +156 -0
- package/dist/puck-editor/internal/ui/search-control.js.map +1 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +2 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +1 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.js +40 -0
- package/dist/puck-editor/internal/ui/use-panel-search-focus.js.map +1 -0
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +16 -0
- package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +1 -0
- package/dist/puck-editor/internal/use-puck-overlay.js +121 -0
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -0
- package/dist/puck-editor/internal/utils.d.ts +6 -0
- package/dist/puck-editor/internal/utils.d.ts.map +1 -0
- package/dist/puck-editor/internal/utils.js +57 -0
- package/dist/puck-editor/internal/utils.js.map +1 -0
- package/dist/puck-editor/puck-theme.css +110 -0
- package/dist/puck-editor/render.d.ts +3 -0
- package/dist/puck-editor/render.d.ts.map +1 -0
- package/dist/puck-editor/render.js +2 -0
- package/dist/puck-editor/render.js.map +1 -0
- package/dist/puck-editor/server.d.ts +4 -0
- package/dist/puck-editor/server.d.ts.map +1 -0
- package/dist/puck-editor/server.js +4 -0
- package/dist/puck-editor/server.js.map +1 -0
- package/dist/puck-editor/smart-actions.d.ts +2 -0
- package/dist/puck-editor/smart-actions.d.ts.map +1 -0
- package/dist/puck-editor/smart-actions.js +2 -0
- package/dist/puck-editor/smart-actions.js.map +1 -0
- package/dist/shared/cn.d.ts +3 -0
- package/dist/shared/cn.d.ts.map +1 -0
- package/dist/shared/cn.js +9 -0
- package/dist/shared/cn.js.map +1 -0
- package/dist/shared/i18n.d.ts +5 -0
- package/dist/shared/i18n.d.ts.map +1 -0
- package/dist/shared/i18n.js +18 -0
- package/dist/shared/i18n.js.map +1 -0
- package/dist/shared/toolbar-action.d.ts +9 -0
- package/dist/shared/toolbar-action.d.ts.map +1 -0
- package/dist/shared/toolbar-action.js +2 -0
- package/dist/shared/toolbar-action.js.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts +19 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.js +24 -0
- package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -0
- package/dist/smart-actions/internal/i18n.d.ts +20 -0
- package/dist/smart-actions/internal/i18n.d.ts.map +1 -0
- package/dist/smart-actions/internal/i18n.js +35 -0
- package/dist/smart-actions/internal/i18n.js.map +1 -0
- package/dist/smart-actions/internal/logout-form.d.ts +8 -0
- package/dist/smart-actions/internal/logout-form.d.ts.map +1 -0
- package/dist/smart-actions/internal/logout-form.js +88 -0
- package/dist/smart-actions/internal/logout-form.js.map +1 -0
- package/dist/smart-actions/internal/refresh-page.d.ts +2 -0
- package/dist/smart-actions/internal/refresh-page.d.ts.map +1 -0
- package/dist/smart-actions/internal/refresh-page.js +126 -0
- package/dist/smart-actions/internal/refresh-page.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-button.d.ts +24 -0
- package/dist/smart-actions/internal/smart-actions-button.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-button.js +41 -0
- package/dist/smart-actions/internal/smart-actions-button.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-config.d.ts +13 -0
- package/dist/smart-actions/internal/smart-actions-config.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-config.js +101 -0
- package/dist/smart-actions/internal/smart-actions-config.js.map +1 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +15 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +1 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js +71 -0
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +13 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +323 -0
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/storage.d.ts +7 -0
- package/dist/smart-actions/internal/toolbar/storage.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/storage.js +29 -0
- package/dist/smart-actions/internal/toolbar/storage.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/types.d.ts +4 -0
- package/dist/smart-actions/internal/toolbar/types.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/types.js +2 -0
- package/dist/smart-actions/internal/toolbar/types.js.map +1 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +6 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +1 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +43 -0
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -0
- package/dist/smart-actions/internal/ui/tooltip.d.ts +8 -0
- package/dist/smart-actions/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/smart-actions/internal/ui/tooltip.js +156 -0
- package/dist/smart-actions/internal/ui/tooltip.js.map +1 -0
- package/dist/smart-actions/internal/user-profile.d.ts +8 -0
- package/dist/smart-actions/internal/user-profile.d.ts.map +1 -0
- package/dist/smart-actions/internal/user-profile.js +30 -0
- package/dist/smart-actions/internal/user-profile.js.map +1 -0
- package/dist/smart-actions/server.d.ts +4 -0
- package/dist/smart-actions/server.d.ts.map +1 -0
- package/dist/smart-actions/server.js +4 -0
- package/dist/smart-actions/server.js.map +1 -0
- package/dist/theme.css +2 -0
- package/dist/visual-editor/index.d.ts +4 -0
- package/dist/visual-editor/index.d.ts.map +1 -0
- package/dist/visual-editor/index.js +4 -0
- package/dist/visual-editor/index.js.map +1 -0
- package/dist/visual-editor/internal/bridge/connector.d.ts +7 -0
- package/dist/visual-editor/internal/bridge/connector.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/connector.js +72 -0
- package/dist/visual-editor/internal/bridge/connector.js.map +1 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +8 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js +44 -0
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.js.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +16 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +43 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +15 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +1 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js +146 -0
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -0
- package/dist/visual-editor/internal/i18n.d.ts +29 -0
- package/dist/visual-editor/internal/i18n.d.ts.map +1 -0
- package/dist/visual-editor/internal/i18n.js +51 -0
- package/dist/visual-editor/internal/i18n.js.map +1 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +7 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.js +15 -0
- package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-button.d.ts +10 -0
- package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-button.js +138 -0
- package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts +3 -0
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/edit-icon.js +19 -0
- package/dist/visual-editor/internal/overlays/edit-icon.js.map +1 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +15 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +52 -0
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +6 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js +42 -0
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +9 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +33 -0
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +13 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.js +17 -0
- package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +8 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js +25 -0
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +18 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +1 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +58 -0
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -0
- package/dist/visual-editor/internal/revalidate-route.d.ts +19 -0
- package/dist/visual-editor/internal/revalidate-route.d.ts.map +1 -0
- package/dist/visual-editor/internal/revalidate-route.js +51 -0
- package/dist/visual-editor/internal/revalidate-route.js.map +1 -0
- package/dist/visual-editor/server.d.ts +7 -0
- package/dist/visual-editor/server.d.ts.map +1 -0
- package/dist/visual-editor/server.js +8 -0
- package/dist/visual-editor/server.js.map +1 -0
- package/package.json +154 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { walkTree } from '@puckeditor/core';
|
|
2
|
+
import { puckFetch } from "../../api/client.js";
|
|
3
|
+
import { getPathLocale } from "../../locale.js";
|
|
4
|
+
import { generateId } from "../../utils.js";
|
|
5
|
+
import { ICON_PROP, NAME_PROP } from "../outline-plugin/outline-tree.js";
|
|
6
|
+
const asString = value => typeof value === 'string' && value ? value : undefined;
|
|
7
|
+
const parseCategory = value => value === 'page' || value === 'section' || value === 'block' ? value : null;
|
|
8
|
+
export const templateKey = template => template.source === 'custom' ? template.id : `builtin-${template.id}`;
|
|
9
|
+
export const isRootLevelTemplate = template => template.category === 'section' || template.category === 'page';
|
|
10
|
+
export const templateLabel = (template, locale) => {
|
|
11
|
+
const name = template.name;
|
|
12
|
+
if (typeof name === 'string') return name;
|
|
13
|
+
if (!name) return '';
|
|
14
|
+
return name[locale] ?? name[locale.split('-')[0]] ?? name.en ?? Object.values(name)[0] ?? '';
|
|
15
|
+
};
|
|
16
|
+
export const templateMatchesQuery = (template, locale, query) => templateLabel(template, locale).toLowerCase().includes(query.trim().toLowerCase());
|
|
17
|
+
export const asBuiltinTemplates = builtins => builtins.map(template => ({
|
|
18
|
+
...template,
|
|
19
|
+
source: 'builtin'
|
|
20
|
+
}));
|
|
21
|
+
export const mergeTemplates = (builtins, custom) => [...asBuiltinTemplates(builtins), ...custom];
|
|
22
|
+
export const isBrokenTemplate = template => 'broken' in template;
|
|
23
|
+
const mapFragment = (raw, config) => {
|
|
24
|
+
const broken = () => ({
|
|
25
|
+
source: 'custom',
|
|
26
|
+
broken: true,
|
|
27
|
+
id: raw.id,
|
|
28
|
+
name: raw.title
|
|
29
|
+
});
|
|
30
|
+
let data;
|
|
31
|
+
try {
|
|
32
|
+
const parsed = JSON.parse(String(raw[config.dataField] ?? ''));
|
|
33
|
+
data = Array.isArray(parsed) ? parsed : [parsed];
|
|
34
|
+
} catch {
|
|
35
|
+
console.warn(`puck-editor: template fragment "${raw.id}" has unparseable data`);
|
|
36
|
+
return broken();
|
|
37
|
+
}
|
|
38
|
+
const category = parseCategory(raw[config.categoryField]);
|
|
39
|
+
if (!category) {
|
|
40
|
+
console.warn(`puck-editor: template fragment "${raw.id}" has an invalid category`);
|
|
41
|
+
return broken();
|
|
42
|
+
}
|
|
43
|
+
const description = asString(raw[config.aiDescriptionField]);
|
|
44
|
+
const instructions = asString(raw[config.aiInstructionsField]);
|
|
45
|
+
const ai = description || instructions ? {
|
|
46
|
+
description,
|
|
47
|
+
instructions
|
|
48
|
+
} : undefined;
|
|
49
|
+
return {
|
|
50
|
+
source: 'custom',
|
|
51
|
+
id: raw.id,
|
|
52
|
+
name: asString(raw.title) ?? raw.id,
|
|
53
|
+
category,
|
|
54
|
+
...(ai ? {
|
|
55
|
+
ai
|
|
56
|
+
} : {}),
|
|
57
|
+
data
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const fetchTemplates = async config => {
|
|
61
|
+
const language = getPathLocale(window.location.pathname);
|
|
62
|
+
const {
|
|
63
|
+
data
|
|
64
|
+
} = await puckFetch(`/fragment/${config.fragmentType}?lang=${language}&limit=100`);
|
|
65
|
+
const valid = [];
|
|
66
|
+
const broken = [];
|
|
67
|
+
for (const raw of data) {
|
|
68
|
+
const mapped = mapFragment(raw, config);
|
|
69
|
+
if (isBrokenTemplate(mapped)) broken.push(mapped);else valid.push(mapped);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
valid,
|
|
73
|
+
broken
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export const expandTemplate = (template, config, outlineLabel) => {
|
|
77
|
+
const raw = template.data;
|
|
78
|
+
let skipped = 0;
|
|
79
|
+
const expanded = walkTree({
|
|
80
|
+
root: {
|
|
81
|
+
props: {}
|
|
82
|
+
},
|
|
83
|
+
content: raw,
|
|
84
|
+
zones: {}
|
|
85
|
+
}, config, content => content.filter(component => {
|
|
86
|
+
const known = Boolean(config.components[component.type]);
|
|
87
|
+
if (!known) skipped++;
|
|
88
|
+
return known;
|
|
89
|
+
}).map(component => ({
|
|
90
|
+
...component,
|
|
91
|
+
props: {
|
|
92
|
+
...config.components[component.type]?.defaultProps,
|
|
93
|
+
...component.props,
|
|
94
|
+
id: generateId(component.type)
|
|
95
|
+
}
|
|
96
|
+
})));
|
|
97
|
+
const content = expanded.content;
|
|
98
|
+
if (outlineLabel && template.category !== 'page' && template.data.length === 1 && content.length === 1) {
|
|
99
|
+
content[0] = {
|
|
100
|
+
...content[0],
|
|
101
|
+
props: {
|
|
102
|
+
...content[0].props,
|
|
103
|
+
[NAME_PROP]: outlineLabel,
|
|
104
|
+
...(template.icon ? {
|
|
105
|
+
[ICON_PROP]: template.icon
|
|
106
|
+
} : {})
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
content,
|
|
112
|
+
skipped
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","names":["walkTree","puckFetch","getPathLocale","generateId","ICON_PROP","NAME_PROP","asString","value","undefined","parseCategory","templateKey","template","source","id","isRootLevelTemplate","category","templateLabel","locale","name","split","en","Object","values","templateMatchesQuery","query","toLowerCase","includes","trim","asBuiltinTemplates","builtins","map","mergeTemplates","custom","isBrokenTemplate","mapFragment","raw","config","broken","title","data","parsed","JSON","parse","String","dataField","Array","isArray","console","warn","categoryField","description","aiDescriptionField","instructions","aiInstructionsField","ai","fetchTemplates","language","window","location","pathname","fragmentType","valid","mapped","push","expandTemplate","outlineLabel","skipped","expanded","root","props","content","zones","filter","component","known","Boolean","components","type","defaultProps","length","icon"],"sources":["../../../../../src/puck-editor/internal/plugins/templates-plugin/templates.ts"],"sourcesContent":["import { walkTree } from '@puckeditor/core';\nimport type { ComponentData, Config } from '@puckeditor/core';\n\nimport { puckFetch } from '../../api/client.ts';\nimport type { PuckTemplatesConfig } from '../../content-model.ts';\nimport { getPathLocale } from '../../locale.ts';\nimport { generateId } from '../../utils.ts';\nimport { ICON_PROP, NAME_PROP } from '../outline-plugin/outline-tree.ts';\n\nexport type TemplateCategory = 'page' | 'section' | 'block';\n\nexport type TemplateAi = {\n description?: string;\n instructions?: string;\n};\n\nexport type TemplateEnvelope = {\n id: string;\n name: string | Record<string, string>;\n category: TemplateCategory;\n icon?: string;\n ai?: TemplateAi;\n group?: string;\n data: ComponentData[];\n};\n\nexport type BuiltinTemplate = TemplateEnvelope;\n\nexport type Template = TemplateEnvelope & {\n source: 'builtin' | 'custom';\n};\n\nexport type BrokenTemplate = {\n source: 'custom';\n broken: true;\n id: string;\n name: string;\n};\n\nexport type FetchedTemplates = {\n valid: Template[];\n broken: BrokenTemplate[];\n};\n\ntype RawFragment = { id: string; title: string } & Record<string, unknown>;\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === 'string' && value ? value : undefined;\n\nconst parseCategory = (value: unknown): TemplateCategory | null =>\n value === 'page' || value === 'section' || value === 'block' ? value : null;\n\nexport const templateKey = (template: Template): string =>\n template.source === 'custom' ? template.id : `builtin-${template.id}`;\n\nexport const isRootLevelTemplate = (\n template: Template | BuiltinTemplate\n): boolean => template.category === 'section' || template.category === 'page';\n\nexport const templateLabel = (\n template: Template | BuiltinTemplate,\n locale: string\n): string => {\n const name = template.name;\n if (typeof name === 'string') return name;\n if (!name) return '';\n return (\n name[locale] ??\n name[locale.split('-')[0]] ??\n name.en ??\n Object.values(name)[0] ??\n ''\n );\n};\n\nexport const templateMatchesQuery = (\n template: Template,\n locale: string,\n query: string\n): boolean =>\n templateLabel(template, locale)\n .toLowerCase()\n .includes(query.trim().toLowerCase());\n\nexport const asBuiltinTemplates = (builtins: BuiltinTemplate[]): Template[] =>\n builtins.map((template) => ({ ...template, source: 'builtin' as const }));\n\nexport const mergeTemplates = (\n builtins: BuiltinTemplate[],\n custom: Template[]\n): Template[] => [...asBuiltinTemplates(builtins), ...custom];\n\nexport const isBrokenTemplate = (\n template: Template | BrokenTemplate\n): template is BrokenTemplate => 'broken' in template;\n\nconst mapFragment = (\n raw: RawFragment,\n config: PuckTemplatesConfig\n): Template | BrokenTemplate => {\n const broken = (): BrokenTemplate => ({\n source: 'custom',\n broken: true,\n id: raw.id,\n name: raw.title,\n });\n\n let data: ComponentData[];\n try {\n const parsed = JSON.parse(String(raw[config.dataField] ?? ''));\n data = Array.isArray(parsed) ? parsed : [parsed];\n } catch {\n console.warn(\n `puck-editor: template fragment \"${raw.id}\" has unparseable data`\n );\n return broken();\n }\n\n const category = parseCategory(raw[config.categoryField]);\n if (!category) {\n console.warn(\n `puck-editor: template fragment \"${raw.id}\" has an invalid category`\n );\n return broken();\n }\n\n const description = asString(raw[config.aiDescriptionField]);\n const instructions = asString(raw[config.aiInstructionsField]);\n const ai =\n description || instructions ? { description, instructions } : undefined;\n\n return {\n source: 'custom',\n id: raw.id,\n name: asString(raw.title) ?? raw.id,\n category,\n ...(ai ? { ai } : {}),\n data,\n };\n};\n\nexport const fetchTemplates = async (\n config: PuckTemplatesConfig\n): Promise<FetchedTemplates> => {\n const language = getPathLocale(window.location.pathname);\n const { data } = await puckFetch<{ data: RawFragment[] }>(\n `/fragment/${config.fragmentType}?lang=${language}&limit=100`\n );\n const valid: Template[] = [];\n const broken: BrokenTemplate[] = [];\n for (const raw of data) {\n const mapped = mapFragment(raw, config);\n if (isBrokenTemplate(mapped)) broken.push(mapped);\n else valid.push(mapped);\n }\n return { valid, broken };\n};\n\nexport const expandTemplate = (\n template: Template,\n config: Config,\n outlineLabel?: string\n): { content: ComponentData[]; skipped: number } => {\n const raw = template.data;\n\n let skipped = 0;\n const expanded = walkTree(\n { root: { props: {} }, content: raw, zones: {} },\n config,\n (content) =>\n content\n .filter((component) => {\n const known = Boolean(config.components[component.type]);\n if (!known) skipped++;\n return known;\n })\n .map((component) => ({\n ...component,\n props: {\n ...config.components[component.type]?.defaultProps,\n ...component.props,\n id: generateId(component.type),\n },\n }))\n );\n\n const content = expanded.content;\n if (\n outlineLabel &&\n template.category !== 'page' &&\n template.data.length === 1 &&\n content.length === 1\n ) {\n content[0] = {\n ...content[0],\n props: {\n ...content[0].props,\n [NAME_PROP]: outlineLabel,\n ...(template.icon ? { [ICON_PROP]: template.icon } : {}),\n },\n };\n }\n return { content, skipped };\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,kBAAkB;AAG3C,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,SAAS,EAAEC,SAAS,QAAQ,mCAAmC;AAuCxE,MAAMC,QAAQ,GAAIC,KAAc,IAC9B,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,GAAGA,KAAK,GAAGC,SAAS;AAExD,MAAMC,aAAa,GAAIF,KAAc,IACnCA,KAAK,KAAK,MAAM,IAAIA,KAAK,KAAK,SAAS,IAAIA,KAAK,KAAK,OAAO,GAAGA,KAAK,GAAG,IAAI;AAE7E,OAAO,MAAMG,WAAW,GAAIC,QAAkB,IAC5CA,QAAQ,CAACC,MAAM,KAAK,QAAQ,GAAGD,QAAQ,CAACE,EAAE,GAAG,WAAWF,QAAQ,CAACE,EAAE,EAAE;AAEvE,OAAO,MAAMC,mBAAmB,GAC9BH,QAAoC,IACxBA,QAAQ,CAACI,QAAQ,KAAK,SAAS,IAAIJ,QAAQ,CAACI,QAAQ,KAAK,MAAM;AAE7E,OAAO,MAAMC,aAAa,GAAGA,CAC3BL,QAAoC,EACpCM,MAAc,KACH;EACX,MAAMC,IAAI,GAAGP,QAAQ,CAACO,IAAI;EAC1B,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE,OAAOA,IAAI;EACzC,IAAI,CAACA,IAAI,EAAE,OAAO,EAAE;EACpB,OACEA,IAAI,CAACD,MAAM,CAAC,IACZC,IAAI,CAACD,MAAM,CAACE,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ACEL,YAAY,IACZtD,QAAQ,CAACI,QAAQ,KAAK,MAAM,IAC5BJ,QAAQ,CAAC4B,IAAI,CAACwC,MAAM,KAAK,CAAC,IAC1BT,OAAO,CAACS,MAAM,KAAK,CAAC,EACpB;IACAT,OAAO,CAAC,CAAC,CAAC,GAAG;MACX,GAAGA,OAAO,CAAC,CAAC,CAAC;MACbD,KAAK,EAAE;QACL,GAAGC,OAAO,CAAC,CAAC,CAAC,CAACD,KAAK;QACnB,CAAChE,SAAS,GAAG4D,YAAY;QACzB,IAAItD,QAAQ,CAACqE,IAAI,GAAG;UAAE,CAAC5E,SAAS,GAAGO,QAAQ,CAACqE;QAAK,CAAC,GAAG,CAAC,CAAC;MACzD;IACF,CAAC;EACH;EACA,OAAO;IAAEV,OAAO;IAAEJ;EAAQ,CAAC;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config, PuckAction } from '@puckeditor/core';
|
|
2
|
+
type Dispatch = (action: PuckAction) => void;
|
|
3
|
+
export declare function useTemplateDnd(config: Config): {
|
|
4
|
+
configWithTemplates: Config;
|
|
5
|
+
onAction: (action: PuckAction) => void;
|
|
6
|
+
captureDispatch: (dispatch: Dispatch) => void;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=use-template-dnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-template-dnd.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/plugins/templates-plugin/use-template-dnd.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwBtD,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;AAE7C,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM;;uBA4BjB,UAAU;gCAJD,QAAQ;EAiE5C"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
import { useQuery } from '@tanstack/react-query';
|
|
6
|
+
import { toast } from 'sonner';
|
|
7
|
+
import { useBuiltinTemplates, usePuckContentModel } from '../../editor-config';
|
|
8
|
+
import { TEMPLATES_QUERY_KEY } from '../../editor-query-client';
|
|
9
|
+
import { usePuckDictionary, usePuckLocale } from '../../i18n';
|
|
10
|
+
import { appendComponents } from '../../utils';
|
|
11
|
+
import { ROOT_ZONE } from '../outline-plugin/outline-tree';
|
|
12
|
+
import { applyVehicleSlotConstraints } from './apply-vehicle-slot-constraints';
|
|
13
|
+
import { buildTemplateVehicles, rootLevelVehicleTypes, TEMPLATE_PREFIX } from './template-vehicles';
|
|
14
|
+
import { expandTemplate, fetchTemplates, isRootLevelTemplate, mergeTemplates, templateKey, templateLabel } from './templates';
|
|
15
|
+
export function useTemplateDnd(config) {
|
|
16
|
+
const $ = _c(18);
|
|
17
|
+
const t = usePuckDictionary().templates;
|
|
18
|
+
const locale = usePuckLocale();
|
|
19
|
+
const templatesConfig = usePuckContentModel().templates;
|
|
20
|
+
const builtins = useBuiltinTemplates();
|
|
21
|
+
let t0;
|
|
22
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t0 = [...TEMPLATES_QUERY_KEY];
|
|
24
|
+
$[0] = t0;
|
|
25
|
+
} else {
|
|
26
|
+
t0 = $[0];
|
|
27
|
+
}
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[1] !== templatesConfig) {
|
|
30
|
+
t1 = {
|
|
31
|
+
queryKey: t0,
|
|
32
|
+
queryFn: () => fetchTemplates(templatesConfig)
|
|
33
|
+
};
|
|
34
|
+
$[1] = templatesConfig;
|
|
35
|
+
$[2] = t1;
|
|
36
|
+
} else {
|
|
37
|
+
t1 = $[2];
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
data
|
|
41
|
+
} = useQuery(t1);
|
|
42
|
+
let t2;
|
|
43
|
+
let templates;
|
|
44
|
+
if ($[3] !== builtins || $[4] !== config || $[5] !== data?.valid || $[6] !== locale) {
|
|
45
|
+
templates = mergeTemplates(builtins, data?.valid ?? []);
|
|
46
|
+
const withVehicles = {
|
|
47
|
+
...config,
|
|
48
|
+
components: {
|
|
49
|
+
...config.components,
|
|
50
|
+
...buildTemplateVehicles(templates, locale)
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
t2 = applyVehicleSlotConstraints(withVehicles, rootLevelVehicleTypes(templates));
|
|
54
|
+
$[3] = builtins;
|
|
55
|
+
$[4] = config;
|
|
56
|
+
$[5] = data?.valid;
|
|
57
|
+
$[6] = locale;
|
|
58
|
+
$[7] = t2;
|
|
59
|
+
$[8] = templates;
|
|
60
|
+
} else {
|
|
61
|
+
t2 = $[7];
|
|
62
|
+
templates = $[8];
|
|
63
|
+
}
|
|
64
|
+
const configWithTemplates = t2;
|
|
65
|
+
const dispatchRef = useRef(null);
|
|
66
|
+
let t3;
|
|
67
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
|
+
t3 = dispatch => {
|
|
69
|
+
dispatchRef.current = dispatch;
|
|
70
|
+
};
|
|
71
|
+
$[9] = t3;
|
|
72
|
+
} else {
|
|
73
|
+
t3 = $[9];
|
|
74
|
+
}
|
|
75
|
+
const captureDispatch = t3;
|
|
76
|
+
let t4;
|
|
77
|
+
if ($[10] !== config || $[11] !== locale || $[12] !== t || $[13] !== templates) {
|
|
78
|
+
t4 = action => {
|
|
79
|
+
if (action.type !== "insert") {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!action.componentType.startsWith(TEMPLATE_PREFIX)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const dispatch_0 = dispatchRef.current;
|
|
86
|
+
if (!dispatch_0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const zone = action.destinationZone;
|
|
90
|
+
const index = action.destinationIndex;
|
|
91
|
+
const key = action.componentType.slice(TEMPLATE_PREFIX.length);
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
const removeVehicle = () => dispatch_0({
|
|
94
|
+
type: "remove",
|
|
95
|
+
zone,
|
|
96
|
+
index
|
|
97
|
+
});
|
|
98
|
+
const template = templates.find(tpl => templateKey(tpl) === key);
|
|
99
|
+
if (!template) {
|
|
100
|
+
removeVehicle();
|
|
101
|
+
toast.error(t.unavailable);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const isRootZone = zone === ROOT_ZONE;
|
|
105
|
+
if (isRootLevelTemplate(template) !== isRootZone) {
|
|
106
|
+
removeVehicle();
|
|
107
|
+
toast.error(t.wrongZone);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let expanded;
|
|
111
|
+
;
|
|
112
|
+
try {
|
|
113
|
+
expanded = expandTemplate(template, config, templateLabel(template, locale));
|
|
114
|
+
} catch (t5) {
|
|
115
|
+
const error = t5;
|
|
116
|
+
console.error("Failed to expand template:", error);
|
|
117
|
+
removeVehicle();
|
|
118
|
+
toast.error(t.insertFailed);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
removeVehicle();
|
|
122
|
+
appendComponents(dispatch_0, zone, index, expanded.content);
|
|
123
|
+
if (expanded.skipped > 0) {
|
|
124
|
+
toast.warning(t.partiallyInserted.replace("{skipped}", String(expanded.skipped)).replace("{total}", String(expanded.content.length + expanded.skipped)));
|
|
125
|
+
}
|
|
126
|
+
}, 0);
|
|
127
|
+
};
|
|
128
|
+
$[10] = config;
|
|
129
|
+
$[11] = locale;
|
|
130
|
+
$[12] = t;
|
|
131
|
+
$[13] = templates;
|
|
132
|
+
$[14] = t4;
|
|
133
|
+
} else {
|
|
134
|
+
t4 = $[14];
|
|
135
|
+
}
|
|
136
|
+
const onAction = t4;
|
|
137
|
+
let t5;
|
|
138
|
+
if ($[15] !== configWithTemplates || $[16] !== onAction) {
|
|
139
|
+
t5 = {
|
|
140
|
+
configWithTemplates,
|
|
141
|
+
onAction,
|
|
142
|
+
captureDispatch
|
|
143
|
+
};
|
|
144
|
+
$[15] = configWithTemplates;
|
|
145
|
+
$[16] = onAction;
|
|
146
|
+
$[17] = t5;
|
|
147
|
+
} else {
|
|
148
|
+
t5 = $[17];
|
|
149
|
+
}
|
|
150
|
+
return t5;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=use-template-dnd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-template-dnd.js","names":["c","_c","useRef","useQuery","toast","useBuiltinTemplates","usePuckContentModel","TEMPLATES_QUERY_KEY","usePuckDictionary","usePuckLocale","appendComponents","ROOT_ZONE","applyVehicleSlotConstraints","buildTemplateVehicles","rootLevelVehicleTypes","TEMPLATE_PREFIX","expandTemplate","fetchTemplates","isRootLevelTemplate","mergeTemplates","templateKey","templateLabel","useTemplateDnd","config","$","t","templates","locale","templatesConfig","builtins","t0","Symbol","for","t1","queryKey","queryFn","data","t2","valid","withVehicles","components","configWithTemplates","dispatchRef","t3","dispatch","current","captureDispatch","t4","action","type","componentType","startsWith","dispatch_0","zone","destinationZone","index","destinationIndex","key","slice","length","setTimeout","removeVehicle","template","find","tpl","error","unavailable","isRootZone","wrongZone","expanded","t5","console","insertFailed","content","skipped","warning","partiallyInserted","replace","String","onAction"],"sources":["../../../../../src/puck-editor/internal/plugins/templates-plugin/use-template-dnd.ts"],"sourcesContent":["'use client';\n\nimport { useRef } from 'react';\nimport { Config, PuckAction } from '@puckeditor/core';\nimport { useQuery } from '@tanstack/react-query';\nimport { toast } from 'sonner';\n\nimport { useBuiltinTemplates, usePuckContentModel } from '../../editor-config';\nimport { TEMPLATES_QUERY_KEY } from '../../editor-query-client';\nimport { usePuckDictionary, usePuckLocale } from '../../i18n';\nimport { appendComponents } from '../../utils';\nimport { ROOT_ZONE } from '../outline-plugin/outline-tree';\nimport { applyVehicleSlotConstraints } from './apply-vehicle-slot-constraints';\nimport {\n buildTemplateVehicles,\n rootLevelVehicleTypes,\n TEMPLATE_PREFIX,\n} from './template-vehicles';\nimport {\n expandTemplate,\n fetchTemplates,\n isRootLevelTemplate,\n mergeTemplates,\n templateKey,\n templateLabel,\n} from './templates';\n\ntype Dispatch = (action: PuckAction) => void;\n\nexport function useTemplateDnd(config: Config) {\n const t = usePuckDictionary().templates;\n const locale = usePuckLocale();\n const templatesConfig = usePuckContentModel().templates;\n const builtins = useBuiltinTemplates();\n const { data } = useQuery({\n queryKey: [...TEMPLATES_QUERY_KEY],\n queryFn: () => fetchTemplates(templatesConfig),\n });\n const templates = mergeTemplates(builtins, data?.valid ?? []);\n\n const withVehicles = {\n ...config,\n components: {\n ...config.components,\n ...buildTemplateVehicles(templates, locale),\n },\n };\n const configWithTemplates = applyVehicleSlotConstraints(\n withVehicles,\n rootLevelVehicleTypes(templates)\n );\n\n const dispatchRef = useRef<Dispatch | null>(null);\n const captureDispatch = (dispatch: Dispatch) => {\n dispatchRef.current = dispatch;\n };\n\n const onAction = (action: PuckAction) => {\n if (action.type !== 'insert') return;\n if (!action.componentType.startsWith(TEMPLATE_PREFIX)) return;\n\n const dispatch = dispatchRef.current;\n if (!dispatch) return;\n\n const zone = action.destinationZone;\n const index = action.destinationIndex;\n const key = action.componentType.slice(TEMPLATE_PREFIX.length);\n\n // onAction runs inside Puck's dispatch cycle; re-entrant dispatch is\n // swallowed, so defer the swap to the next tick.\n setTimeout(() => {\n const removeVehicle = () => dispatch({ type: 'remove', zone, index });\n const template = templates.find((tpl) => templateKey(tpl) === key);\n\n if (!template) {\n removeVehicle();\n toast.error(t.unavailable);\n return;\n }\n\n const isRootZone = zone === ROOT_ZONE;\n if (isRootLevelTemplate(template) !== isRootZone) {\n removeVehicle();\n toast.error(t.wrongZone);\n return;\n }\n\n let expanded;\n try {\n expanded = expandTemplate(\n template,\n config,\n templateLabel(template, locale)\n );\n } catch (error) {\n console.error('Failed to expand template:', error);\n removeVehicle();\n toast.error(t.insertFailed);\n return;\n }\n\n removeVehicle();\n appendComponents(dispatch, zone, index, expanded.content);\n\n if (expanded.skipped > 0) {\n toast.warning(\n t.partiallyInserted\n .replace('{skipped}', String(expanded.skipped))\n .replace(\n '{total}',\n String(expanded.content.length + expanded.skipped)\n )\n );\n }\n }, 0);\n };\n\n return { configWithTemplates, onAction, captureDispatch };\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,MAAM,QAAQ,OAAO;AAE9B,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,KAAK,QAAQ,QAAQ;AAE9B,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,qBAAqB;AAC9E,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,YAAY;AAC7D,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,SAAS,QAAQ,gCAAgC;AAC1D,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,eAAe,QACV,qBAAqB;AAC5B,SACEC,cAAc,EACdC,cAAc,EACdC,mBAAmB,EACnBC,cAAc,EACdC,WAAW,EACXC,aAAa,QACR,aAAa;AAIpB,OAAO,SAAAC,eAAAC,MAAA;EAAA,MAAAC,CAAA,GAAAvB,EAAA;EACL,MAAAwB,CAAA,GAAUjB,iBAAiB,CAAC,CAAC,CAAAkB,SAAU;EACvC,MAAAC,MAAA,GAAelB,aAAa,CAAC,CAAC;EAC9B,MAAAmB,eAAA,GAAwBtB,mBAAmB,CAAC,CAAC,CAAAoB,SAAU;EACvD,MAAAG,QAAA,GAAiBxB,mBAAmB,CAAC,CAAC;EAAC,IAAAyB,EAAA;EAAA,IAAAN,CAAA,QAAAO,MAAA,CAAAC,GAAA;IAE3BF,EAAA,OAAIvB,mBAAmB,CAAC;IAAAiB,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,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AiB,mBAAA,IAAAjB,CAAA,SAAAuD,QAAA;IAEKT,EAAA;MAAA7B,mBAAA;MAAAsC,QAAA;MAAAjC;IAAiD,CAAC;IAAAtB,CAAA,OAAAiB,mBAAA;IAAAjB,CAAA,OAAAuD,QAAA;IAAAvD,CAAA,OAAA8C,EAAA;EAAA;IAAAA,EAAA,GAAA9C,CAAA;EAAA;EAAA,OAAlD8C,EAAkD;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TemplateUpdate } from '../../api/client';
|
|
2
|
+
import { BrokenTemplate, Template } from './templates';
|
|
3
|
+
type RemovableTemplate = {
|
|
4
|
+
source: 'builtin' | 'custom';
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useTemplates(): {
|
|
8
|
+
templates: Template[];
|
|
9
|
+
brokenTemplates: BrokenTemplate[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
invalidate: () => Promise<void>;
|
|
12
|
+
update: (template: RemovableTemplate, fields: TemplateUpdate) => Promise<import("../../api/client").PuckApiResult>;
|
|
13
|
+
remove: (template: RemovableTemplate) => Promise<import("../../api/client").PuckApiResult>;
|
|
14
|
+
};
|
|
15
|
+
export type { Template };
|
|
16
|
+
//# sourceMappingURL=use-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-templates.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/plugins/templates-plugin/use-templates.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EAGd,QAAQ,EACT,MAAM,aAAa,CAAC;AAIrB,KAAK,iBAAiB,GAAG;IAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,wBAAgB,YAAY;;;;;uBAgBd,iBAAiB,UACnB,cAAc;uBAiBQ,iBAAiB;EAuBlD;AAED,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
import { deleteTemplate, updateTemplate } from '../../api/client';
|
|
6
|
+
import { useBuiltinTemplates, usePuckContentModel } from '../../editor-config';
|
|
7
|
+
import { TEMPLATES_QUERY_KEY } from '../../editor-query-client';
|
|
8
|
+
import { fetchTemplates, mergeTemplates } from './templates';
|
|
9
|
+
const QUERY_KEY = [...TEMPLATES_QUERY_KEY];
|
|
10
|
+
export function useTemplates() {
|
|
11
|
+
const $ = _c(24);
|
|
12
|
+
const queryClient = useQueryClient();
|
|
13
|
+
const templatesConfig = usePuckContentModel().templates;
|
|
14
|
+
const builtins = useBuiltinTemplates();
|
|
15
|
+
let t0;
|
|
16
|
+
if ($[0] !== templatesConfig) {
|
|
17
|
+
t0 = {
|
|
18
|
+
queryKey: QUERY_KEY,
|
|
19
|
+
queryFn: () => fetchTemplates(templatesConfig)
|
|
20
|
+
};
|
|
21
|
+
$[0] = templatesConfig;
|
|
22
|
+
$[1] = t0;
|
|
23
|
+
} else {
|
|
24
|
+
t0 = $[1];
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
data,
|
|
28
|
+
isLoading
|
|
29
|
+
} = useQuery(t0);
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[2] !== data?.valid) {
|
|
32
|
+
t1 = data?.valid ?? [];
|
|
33
|
+
$[2] = data?.valid;
|
|
34
|
+
$[3] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[3];
|
|
37
|
+
}
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[4] !== builtins || $[5] !== t1) {
|
|
40
|
+
t2 = mergeTemplates(builtins, t1);
|
|
41
|
+
$[4] = builtins;
|
|
42
|
+
$[5] = t1;
|
|
43
|
+
$[6] = t2;
|
|
44
|
+
} else {
|
|
45
|
+
t2 = $[6];
|
|
46
|
+
}
|
|
47
|
+
const templates = t2;
|
|
48
|
+
let t3;
|
|
49
|
+
if ($[7] !== data?.broken) {
|
|
50
|
+
t3 = data?.broken ?? [];
|
|
51
|
+
$[7] = data?.broken;
|
|
52
|
+
$[8] = t3;
|
|
53
|
+
} else {
|
|
54
|
+
t3 = $[8];
|
|
55
|
+
}
|
|
56
|
+
const brokenTemplates = t3;
|
|
57
|
+
let t4;
|
|
58
|
+
if ($[9] !== queryClient) {
|
|
59
|
+
t4 = () => queryClient.invalidateQueries({
|
|
60
|
+
queryKey: QUERY_KEY
|
|
61
|
+
});
|
|
62
|
+
$[9] = queryClient;
|
|
63
|
+
$[10] = t4;
|
|
64
|
+
} else {
|
|
65
|
+
t4 = $[10];
|
|
66
|
+
}
|
|
67
|
+
const invalidate = t4;
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[11] !== invalidate || $[12] !== templatesConfig) {
|
|
70
|
+
t5 = async (template, fields) => {
|
|
71
|
+
if (template.source !== "custom" || !template.id) {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
message: "Built-in templates cannot be edited"
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const result = await updateTemplate(templatesConfig.fragmentType, template.id, fields);
|
|
78
|
+
if (result.success) {
|
|
79
|
+
invalidate();
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
$[11] = invalidate;
|
|
84
|
+
$[12] = templatesConfig;
|
|
85
|
+
$[13] = t5;
|
|
86
|
+
} else {
|
|
87
|
+
t5 = $[13];
|
|
88
|
+
}
|
|
89
|
+
const update = t5;
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[14] !== invalidate || $[15] !== templatesConfig) {
|
|
92
|
+
t6 = async template_0 => {
|
|
93
|
+
if (template_0.source !== "custom" || !template_0.id) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
message: "Built-in templates cannot be deleted"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const result_0 = await deleteTemplate(templatesConfig.fragmentType, template_0.id);
|
|
100
|
+
if (result_0.success) {
|
|
101
|
+
invalidate();
|
|
102
|
+
}
|
|
103
|
+
return result_0;
|
|
104
|
+
};
|
|
105
|
+
$[14] = invalidate;
|
|
106
|
+
$[15] = templatesConfig;
|
|
107
|
+
$[16] = t6;
|
|
108
|
+
} else {
|
|
109
|
+
t6 = $[16];
|
|
110
|
+
}
|
|
111
|
+
const remove = t6;
|
|
112
|
+
let t7;
|
|
113
|
+
if ($[17] !== brokenTemplates || $[18] !== invalidate || $[19] !== isLoading || $[20] !== remove || $[21] !== templates || $[22] !== update) {
|
|
114
|
+
t7 = {
|
|
115
|
+
templates,
|
|
116
|
+
brokenTemplates,
|
|
117
|
+
isLoading,
|
|
118
|
+
invalidate,
|
|
119
|
+
update,
|
|
120
|
+
remove
|
|
121
|
+
};
|
|
122
|
+
$[17] = brokenTemplates;
|
|
123
|
+
$[18] = invalidate;
|
|
124
|
+
$[19] = isLoading;
|
|
125
|
+
$[20] = remove;
|
|
126
|
+
$[21] = templates;
|
|
127
|
+
$[22] = update;
|
|
128
|
+
$[23] = t7;
|
|
129
|
+
} else {
|
|
130
|
+
t7 = $[23];
|
|
131
|
+
}
|
|
132
|
+
return t7;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=use-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-templates.js","names":["c","_c","useQuery","useQueryClient","deleteTemplate","updateTemplate","useBuiltinTemplates","usePuckContentModel","TEMPLATES_QUERY_KEY","fetchTemplates","mergeTemplates","QUERY_KEY","useTemplates","$","queryClient","templatesConfig","templates","builtins","t0","queryKey","queryFn","data","isLoading","t1","valid","t2","t3","broken","brokenTemplates","t4","invalidateQueries","invalidate","t5","template","fields","source","id","success","message","result","fragmentType","update","t6","template_0","result_0","remove","t7"],"sources":["../../../../../src/puck-editor/internal/plugins/templates-plugin/use-templates.ts"],"sourcesContent":["'use client';\n\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport {\n deleteTemplate,\n updateTemplate,\n type TemplateUpdate,\n} from '../../api/client';\nimport { useBuiltinTemplates, usePuckContentModel } from '../../editor-config';\nimport { TEMPLATES_QUERY_KEY } from '../../editor-query-client';\nimport {\n BrokenTemplate,\n fetchTemplates,\n mergeTemplates,\n Template,\n} from './templates';\n\nconst QUERY_KEY = [...TEMPLATES_QUERY_KEY];\n\ntype RemovableTemplate = { source: 'builtin' | 'custom'; id?: string };\n\nexport function useTemplates() {\n const queryClient = useQueryClient();\n const templatesConfig = usePuckContentModel().templates;\n const builtins = useBuiltinTemplates();\n const { data, isLoading } = useQuery({\n queryKey: QUERY_KEY,\n queryFn: () => fetchTemplates(templatesConfig),\n });\n\n const templates = mergeTemplates(builtins, data?.valid ?? []);\n const brokenTemplates: BrokenTemplate[] = data?.broken ?? [];\n\n const invalidate = () =>\n queryClient.invalidateQueries({ queryKey: QUERY_KEY });\n\n const update = async (\n template: RemovableTemplate,\n fields: TemplateUpdate\n ) => {\n if (template.source !== 'custom' || !template.id) {\n return {\n success: false,\n message: 'Built-in templates cannot be edited',\n };\n }\n const result = await updateTemplate(\n templatesConfig.fragmentType,\n template.id,\n fields\n );\n if (result.success) invalidate();\n return result;\n };\n\n const remove = async (template: RemovableTemplate) => {\n if (template.source !== 'custom' || !template.id) {\n return {\n success: false,\n message: 'Built-in templates cannot be deleted',\n };\n }\n const result = await deleteTemplate(\n templatesConfig.fragmentType,\n template.id\n );\n if (result.success) invalidate();\n return result;\n };\n\n return {\n templates,\n brokenTemplates,\n isLoading,\n invalidate,\n update,\n remove,\n };\n}\n\nexport type { Template };\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,QAAQ,EAAEC,cAAc,QAAQ,uBAAuB;AAEhE,SACEC,cAAc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ode } from 'react';
|
|
2
|
+
import '@puckeditor/core';
|
|
3
|
+
declare module '@puckeditor/core' {
|
|
4
|
+
interface ComponentConfigExtensions {
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface ComponentMetadata {
|
|
8
|
+
group?: string;
|
|
9
|
+
ai?: {
|
|
10
|
+
description?: string;
|
|
11
|
+
instructions?: string;
|
|
12
|
+
exclude?: boolean;
|
|
13
|
+
};
|
|
14
|
+
picker?: {
|
|
15
|
+
label?: string;
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
pinned?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface FieldMetadata {
|
|
21
|
+
ai?: {
|
|
22
|
+
instructions?: string;
|
|
23
|
+
bind?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=puck-augmentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puck-augmentation.d.ts","sourceRoot":"","sources":["../../../src/puck-editor/internal/puck-augmentation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,kBAAkB,CAAC;AAE1B,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,yBAAyB;QACjC,IAAI,CAAC,EAAE,SAAS,CAAC;KAClB;IAED,UAAU,iBAAiB;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,EAAE,CAAC,EAAE;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,SAAS,CAAC;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;SAClB,CAAC;KACH;IAED,UAAU,aAAa;QACrB,EAAE,CAAC,EAAE;YACH,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH;CACF;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Puck metadata augmentation (agent-bridge `ai` hints). A real module (not an
|
|
2
|
+
// ambient .d.ts) imported from the index entry, so it also loads when the
|
|
3
|
+
// module is consumed as an npm dependency.
|
|
4
|
+
|
|
5
|
+
import '@puckeditor/core';
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=puck-augmentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puck-augmentation.js","names":[],"sources":["../../../src/puck-editor/internal/puck-augmentation.ts"],"sourcesContent":["// Puck metadata augmentation (agent-bridge `ai` hints). A real module (not an\n// ambient .d.ts) imported from the index entry, so it also loads when the\n// module is consumed as an npm dependency.\nimport type { ReactNode } from 'react';\n\nimport '@puckeditor/core';\n\ndeclare module '@puckeditor/core' {\n interface ComponentConfigExtensions {\n icon?: ReactNode;\n }\n\n interface ComponentMetadata {\n group?: string;\n ai?: {\n description?: string;\n instructions?: string;\n exclude?: boolean;\n };\n picker?: {\n label?: string;\n icon?: ReactNode;\n pinned?: boolean;\n };\n }\n\n interface FieldMetadata {\n ai?: {\n instructions?: string;\n bind?: string;\n };\n }\n}\n\nexport {};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,OAAO,kBAAkB;AA6BzB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type PuckEditorContextType = {
|
|
2
|
+
openEditor: () => void;
|
|
3
|
+
registerEditor: (openFn: () => void) => void;
|
|
4
|
+
isHighlighted: boolean;
|
|
5
|
+
setIsHighlighted: (value: boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function PuckEditorProvider({ children, }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export declare function usePuckEditor(): PuckEditorContextType;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=puck-editor-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puck-editor-provider.d.ts","sourceRoot":"","sources":["../../../src/puck-editor/internal/puck-editor-provider.tsx"],"names":[],"mappings":"AAIA,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAAC;AASF,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,+BAmBA;AAED,wBAAgB,aAAa,0BAE5B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { createContext, useContext, useRef, useState } from 'react';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const PuckEditorContext = /*#__PURE__*/createContext({
|
|
7
|
+
openEditor: () => {},
|
|
8
|
+
registerEditor: () => {},
|
|
9
|
+
isHighlighted: false,
|
|
10
|
+
setIsHighlighted: () => {}
|
|
11
|
+
});
|
|
12
|
+
export function PuckEditorProvider(t0) {
|
|
13
|
+
const $ = _c(7);
|
|
14
|
+
const {
|
|
15
|
+
children
|
|
16
|
+
} = t0;
|
|
17
|
+
const openFnRef = useRef(null);
|
|
18
|
+
const [isHighlighted, setIsHighlighted] = useState(false);
|
|
19
|
+
let t1;
|
|
20
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
21
|
+
t1 = openFn => {
|
|
22
|
+
openFnRef.current = openFn;
|
|
23
|
+
};
|
|
24
|
+
$[0] = t1;
|
|
25
|
+
} else {
|
|
26
|
+
t1 = $[0];
|
|
27
|
+
}
|
|
28
|
+
const registerEditor = t1;
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t2 = () => {
|
|
32
|
+
openFnRef.current?.();
|
|
33
|
+
};
|
|
34
|
+
$[1] = t2;
|
|
35
|
+
} else {
|
|
36
|
+
t2 = $[1];
|
|
37
|
+
}
|
|
38
|
+
const openEditor = t2;
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[2] !== isHighlighted) {
|
|
41
|
+
t3 = {
|
|
42
|
+
openEditor,
|
|
43
|
+
registerEditor,
|
|
44
|
+
isHighlighted,
|
|
45
|
+
setIsHighlighted
|
|
46
|
+
};
|
|
47
|
+
$[2] = isHighlighted;
|
|
48
|
+
$[3] = t3;
|
|
49
|
+
} else {
|
|
50
|
+
t3 = $[3];
|
|
51
|
+
}
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[4] !== children || $[5] !== t3) {
|
|
54
|
+
t4 = /*#__PURE__*/_jsx(PuckEditorContext.Provider, {
|
|
55
|
+
value: t3,
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
$[4] = children;
|
|
59
|
+
$[5] = t3;
|
|
60
|
+
$[6] = t4;
|
|
61
|
+
} else {
|
|
62
|
+
t4 = $[6];
|
|
63
|
+
}
|
|
64
|
+
return t4;
|
|
65
|
+
}
|
|
66
|
+
export function usePuckEditor() {
|
|
67
|
+
return useContext(PuckEditorContext);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=puck-editor-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puck-editor-provider.js","names":["c","_c","createContext","useContext","useRef","useState","jsx","_jsx","PuckEditorContext","openEditor","registerEditor","isHighlighted","setIsHighlighted","PuckEditorProvider","t0","$","children","openFnRef","t1","Symbol","for","openFn","current","t2","t3","t4","Provider","value","usePuckEditor"],"sources":["../../../src/puck-editor/internal/puck-editor-provider.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useRef, useState } from 'react';\n\ntype PuckEditorContextType = {\n openEditor: () => void;\n registerEditor: (openFn: () => void) => void;\n isHighlighted: boolean;\n setIsHighlighted: (value: boolean) => void;\n};\n\nconst PuckEditorContext = createContext<PuckEditorContextType>({\n openEditor: () => {},\n registerEditor: () => {},\n isHighlighted: false,\n setIsHighlighted: () => {},\n});\n\nexport function PuckEditorProvider({\n children,\n}: {\n children: React.ReactNode;\n}) {\n const openFnRef = useRef<(() => void) | null>(null);\n const [isHighlighted, setIsHighlighted] = useState(false);\n\n const registerEditor = (openFn: () => void) => {\n openFnRef.current = openFn;\n };\n\n const openEditor = () => {\n openFnRef.current?.();\n };\n\n return (\n <PuckEditorContext.Provider\n value={{ openEditor, registerEditor, isHighlighted, setIsHighlighted }}\n >\n {children}\n </PuckEditorContext.Provider>\n );\n}\n\nexport function usePuckEditor() {\n return useContext(PuckEditorContext);\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,aAAa,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASpE,MAAMC,iBAAiB,gBAAGN,aAAa,CAAwB;EAC7DO,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,aAAa,EAAE,KAAK;EACpBC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;AAC3B,CAAC,CAAC;AAEF,OAAO,SAAAC,mBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAA4B;IAAAe;EAAA,IAAAF,EAIlC;EACC,MAAAG,SAAA,GAAkBb,MAAM,CAAsB,IAAI,CAAC;EACnD,OAAAO,aAAA,EAAAC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