@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,219 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from '@puckeditor/core';
|
|
5
|
+
import Cropper from 'react-easy-crop';
|
|
6
|
+
import { cn } from '../../../../shared/cn';
|
|
7
|
+
import { usePuckDictionary } from '../../i18n';
|
|
8
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '../../ui/dialog';
|
|
9
|
+
import { DEFAULT_ASPECT_RATIOS, parseAspectRatio } from './crop-types';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
const BASE_TAB = 'base';
|
|
12
|
+
const round = n => Math.round(n * 10000) / 10000;
|
|
13
|
+
export function CropEditorDialog({
|
|
14
|
+
imageSrc,
|
|
15
|
+
config,
|
|
16
|
+
value,
|
|
17
|
+
onSave,
|
|
18
|
+
onClose
|
|
19
|
+
}) {
|
|
20
|
+
const t = usePuckDictionary().crop;
|
|
21
|
+
const aspectRatios = config.aspectRatios?.length ? config.aspectRatios : DEFAULT_ASPECT_RATIOS;
|
|
22
|
+
const breakpoints = config.breakpoints ?? [];
|
|
23
|
+
const [draft, setDraft] = useState(value);
|
|
24
|
+
const [tab, setTab] = useState(BASE_TAB);
|
|
25
|
+
const [ratio, setRatio] = useState(value?.base.ratio && aspectRatios.includes(value.base.ratio) ? value.base.ratio : aspectRatios[0]);
|
|
26
|
+
const [position, setPosition] = useState({
|
|
27
|
+
x: 0,
|
|
28
|
+
y: 0
|
|
29
|
+
});
|
|
30
|
+
const [zoom, setZoom] = useState(1);
|
|
31
|
+
const [mediaSize, setMediaSize] = useState(null);
|
|
32
|
+
const activeRegion = tab === BASE_TAB ? draft?.base : draft?.overrides?.[tab];
|
|
33
|
+
const isOverrideTab = tab !== BASE_TAB;
|
|
34
|
+
const showCropper = !isOverrideTab || !!activeRegion;
|
|
35
|
+
const aspect = ratio === 'original' ? mediaSize ? mediaSize.naturalWidth / mediaSize.naturalHeight : 1 : parseAspectRatio(ratio) ?? 1;
|
|
36
|
+
const initialArea = activeRegion && activeRegion.ratio === ratio ? {
|
|
37
|
+
x: activeRegion.x * 100,
|
|
38
|
+
y: activeRegion.y * 100,
|
|
39
|
+
width: activeRegion.width * 100,
|
|
40
|
+
height: activeRegion.height * 100
|
|
41
|
+
} : undefined;
|
|
42
|
+
const resetCropper = nextRatio => {
|
|
43
|
+
setRatio(nextRatio);
|
|
44
|
+
setPosition({
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0
|
|
47
|
+
});
|
|
48
|
+
setZoom(1);
|
|
49
|
+
};
|
|
50
|
+
const switchTab = key => {
|
|
51
|
+
setTab(key);
|
|
52
|
+
const region = key === BASE_TAB ? draft?.base : draft?.overrides?.[key];
|
|
53
|
+
resetCropper(region?.ratio && aspectRatios.includes(region.ratio) ? region.ratio : draft?.base.ratio ?? aspectRatios[0]);
|
|
54
|
+
};
|
|
55
|
+
const handleCropComplete = (area, areaPixels) => {
|
|
56
|
+
const region_0 = {
|
|
57
|
+
x: round(area.x / 100),
|
|
58
|
+
y: round(area.y / 100),
|
|
59
|
+
width: round(area.width / 100),
|
|
60
|
+
height: round(area.height / 100),
|
|
61
|
+
aspect: round(areaPixels.width / areaPixels.height) || 1,
|
|
62
|
+
ratio
|
|
63
|
+
};
|
|
64
|
+
setDraft(prev => tab === BASE_TAB ? {
|
|
65
|
+
base: region_0,
|
|
66
|
+
...(prev?.overrides && {
|
|
67
|
+
overrides: prev.overrides
|
|
68
|
+
})
|
|
69
|
+
} : prev ? {
|
|
70
|
+
...prev,
|
|
71
|
+
overrides: {
|
|
72
|
+
...prev.overrides,
|
|
73
|
+
[tab]: region_0
|
|
74
|
+
}
|
|
75
|
+
} : prev);
|
|
76
|
+
};
|
|
77
|
+
const defineOverride = () => {
|
|
78
|
+
if (!draft?.base) return;
|
|
79
|
+
setDraft({
|
|
80
|
+
...draft,
|
|
81
|
+
overrides: {
|
|
82
|
+
...draft.overrides,
|
|
83
|
+
[tab]: {
|
|
84
|
+
...draft.base
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
resetCropper(aspectRatios.includes(draft.base.ratio) ? draft.base.ratio : aspectRatios[0]);
|
|
89
|
+
};
|
|
90
|
+
const removeOverride = () => {
|
|
91
|
+
setDraft(prev_0 => {
|
|
92
|
+
if (!prev_0?.overrides) return prev_0;
|
|
93
|
+
const {
|
|
94
|
+
[tab]: _removed,
|
|
95
|
+
...rest
|
|
96
|
+
} = prev_0.overrides;
|
|
97
|
+
return {
|
|
98
|
+
base: prev_0.base,
|
|
99
|
+
...(Object.keys(rest).length && {
|
|
100
|
+
overrides: rest
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
return /*#__PURE__*/_jsx(Dialog, {
|
|
106
|
+
open: true,
|
|
107
|
+
onOpenChange: open => !open && onClose(),
|
|
108
|
+
children: /*#__PURE__*/_jsxs(DialogContent, {
|
|
109
|
+
className: "nh:max-w-2xl",
|
|
110
|
+
children: [/*#__PURE__*/_jsx(DialogHeader, {
|
|
111
|
+
children: /*#__PURE__*/_jsx(DialogTitle, {
|
|
112
|
+
children: t.title
|
|
113
|
+
})
|
|
114
|
+
}), breakpoints.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
115
|
+
className: "nh:flex nh:items-center nh:gap-1 nh:border-b nh:border-gray-200",
|
|
116
|
+
children: [{
|
|
117
|
+
key: BASE_TAB,
|
|
118
|
+
label: t.desktop
|
|
119
|
+
}, ...breakpoints.map(bp => ({
|
|
120
|
+
key: bp.key,
|
|
121
|
+
label: bp.label ?? bp.key
|
|
122
|
+
}))].map(({
|
|
123
|
+
key: key_0,
|
|
124
|
+
label
|
|
125
|
+
}) => /*#__PURE__*/_jsxs("button", {
|
|
126
|
+
type: "button",
|
|
127
|
+
onClick: () => switchTab(key_0),
|
|
128
|
+
className: cn('nh:flex nh:cursor-pointer nh:items-center nh:gap-1.5 nh:border-b-2 nh:px-3 nh:py-1.5 nh:text-sm nh:capitalize', {
|
|
129
|
+
'nh:border-(--nh-primary) nh:font-semibold': tab === key_0,
|
|
130
|
+
'nh:border-transparent nh:text-gray-500 nh:hover:text-gray-900': tab !== key_0
|
|
131
|
+
}),
|
|
132
|
+
children: [label, key_0 !== BASE_TAB && draft?.overrides?.[key_0] && /*#__PURE__*/_jsx("span", {
|
|
133
|
+
className: "nh:size-1.5 nh:rounded-full nh:bg-(--nh-primary)"
|
|
134
|
+
})]
|
|
135
|
+
}, key_0))
|
|
136
|
+
}), showCropper ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
137
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
138
|
+
className: "nh:flex nh:flex-wrap nh:items-center nh:gap-4",
|
|
139
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
|
140
|
+
className: "nh:flex nh:items-center nh:gap-2 nh:text-sm",
|
|
141
|
+
children: [t.format, /*#__PURE__*/_jsx("select", {
|
|
142
|
+
value: ratio,
|
|
143
|
+
onChange: e => resetCropper(e.target.value),
|
|
144
|
+
className: "nh:block nh:rounded-md nh:border nh:border-gray-300 nh:px-3 nh:py-1.5 nh:text-sm nh:shadow-sm",
|
|
145
|
+
children: aspectRatios.map(r => /*#__PURE__*/_jsx("option", {
|
|
146
|
+
value: r,
|
|
147
|
+
children: r === 'original' ? t.original : r.replace('/', ':')
|
|
148
|
+
}, r))
|
|
149
|
+
})]
|
|
150
|
+
}), /*#__PURE__*/_jsxs("label", {
|
|
151
|
+
className: "nh:flex nh:grow nh:items-center nh:gap-2 nh:text-sm",
|
|
152
|
+
children: [t.zoom, /*#__PURE__*/_jsx("input", {
|
|
153
|
+
type: "range",
|
|
154
|
+
min: 1,
|
|
155
|
+
max: 3,
|
|
156
|
+
step: 0.01,
|
|
157
|
+
value: zoom,
|
|
158
|
+
onChange: e_0 => setZoom(Number(e_0.target.value)),
|
|
159
|
+
className: "nh:grow nh:accent-(--nh-primary)"
|
|
160
|
+
})]
|
|
161
|
+
})]
|
|
162
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
163
|
+
className: "nh:relative nh:h-80 nh:w-full nh:overflow-hidden nh:rounded-md nh:bg-neutral-900",
|
|
164
|
+
children: /*#__PURE__*/_jsx(Cropper, {
|
|
165
|
+
image: imageSrc,
|
|
166
|
+
crop: position,
|
|
167
|
+
zoom: zoom,
|
|
168
|
+
aspect: aspect,
|
|
169
|
+
onCropChange: setPosition,
|
|
170
|
+
onZoomChange: setZoom,
|
|
171
|
+
onCropComplete: handleCropComplete,
|
|
172
|
+
onMediaLoaded: setMediaSize,
|
|
173
|
+
initialCroppedAreaPercentages: initialArea,
|
|
174
|
+
showGrid: true
|
|
175
|
+
}, `${tab}:${ratio}`)
|
|
176
|
+
})]
|
|
177
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
178
|
+
className: "nh:flex nh:h-80 nh:flex-col nh:items-center nh:justify-center nh:gap-3 nh:rounded-md nh:border nh:border-dashed nh:border-gray-300 nh:text-sm nh:text-gray-500",
|
|
179
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
180
|
+
children: t.usesDesktop
|
|
181
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
182
|
+
type: "button",
|
|
183
|
+
variant: "secondary",
|
|
184
|
+
onClick: defineOverride,
|
|
185
|
+
children: t.defineOverride
|
|
186
|
+
})]
|
|
187
|
+
}), /*#__PURE__*/_jsxs(DialogFooter, {
|
|
188
|
+
className: "nh:sm:justify-between",
|
|
189
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
190
|
+
children: isOverrideTab ? activeRegion && /*#__PURE__*/_jsx(Button, {
|
|
191
|
+
type: "button",
|
|
192
|
+
variant: "secondary",
|
|
193
|
+
onClick: removeOverride,
|
|
194
|
+
children: t.removeOverride
|
|
195
|
+
}) : value && /*#__PURE__*/_jsx(Button, {
|
|
196
|
+
type: "button",
|
|
197
|
+
variant: "secondary",
|
|
198
|
+
onClick: () => onSave(undefined),
|
|
199
|
+
children: t.removeCrop
|
|
200
|
+
})
|
|
201
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
202
|
+
className: "nh:flex nh:gap-2",
|
|
203
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
204
|
+
type: "button",
|
|
205
|
+
variant: "secondary",
|
|
206
|
+
onClick: onClose,
|
|
207
|
+
children: t.cancel
|
|
208
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
209
|
+
type: "button",
|
|
210
|
+
onClick: () => onSave(draft),
|
|
211
|
+
disabled: !draft?.base,
|
|
212
|
+
children: t.apply
|
|
213
|
+
})]
|
|
214
|
+
})]
|
|
215
|
+
})]
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=crop-editor-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-editor-dialog.js","names":["useState","Button","Cropper","cn","usePuckDictionary","Dialog","DialogContent","DialogFooter","DialogHeader","DialogTitle","DEFAULT_ASPECT_RATIOS","parseAspectRatio","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","BASE_TAB","round","n","Math","CropEditorDialog","imageSrc","config","value","onSave","onClose","t","crop","aspectRatios","length","breakpoints","draft","setDraft","tab","setTab","ratio","setRatio","base","includes","position","setPosition","x","y","zoom","setZoom","mediaSize","setMediaSize","activeRegion","overrides","isOverrideTab","showCropper","aspect","naturalWidth","naturalHeight","initialArea","width","height","undefined","resetCropper","nextRatio","switchTab","key","region","handleCropComplete","area","areaPixels","prev","defineOverride","removeOverride","_removed","rest","Object","keys","open","onOpenChange","children","className","title","label","desktop","map","bp","type","onClick","format","onChange","e","target","r","original","replace","min","max","step","Number","image","onCropChange","onZoomChange","onCropComplete","onMediaLoaded","initialCroppedAreaPercentages","showGrid","usesDesktop","variant","removeCrop","cancel","disabled","apply"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-editor-dialog.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Button } from '@puckeditor/core';\nimport Cropper, { type Area, type MediaSize } from 'react-easy-crop';\n\nimport { cn } from '../../../../shared/cn';\nimport { usePuckDictionary } from '../../i18n';\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '../../ui/dialog';\nimport {\n CropRegion,\n DEFAULT_ASPECT_RATIOS,\n MediaCrop,\n MediaCropConfig,\n parseAspectRatio,\n} from './crop-types';\n\nconst BASE_TAB = 'base';\nconst round = (n: number) => Math.round(n * 10000) / 10000;\n\ntype CropEditorDialogProps = {\n imageSrc: string;\n config: MediaCropConfig;\n value: MediaCrop | undefined;\n onSave: (crop: MediaCrop | undefined) => void;\n onClose: () => void;\n};\n\nexport function CropEditorDialog({\n imageSrc,\n config,\n value,\n onSave,\n onClose,\n}: CropEditorDialogProps) {\n const t = usePuckDictionary().crop;\n const aspectRatios = config.aspectRatios?.length\n ? config.aspectRatios\n : DEFAULT_ASPECT_RATIOS;\n const breakpoints = config.breakpoints ?? [];\n\n const [draft, setDraft] = useState<MediaCrop | undefined>(value);\n const [tab, setTab] = useState(BASE_TAB);\n const [ratio, setRatio] = useState(\n value?.base.ratio && aspectRatios.includes(value.base.ratio)\n ? value.base.ratio\n : aspectRatios[0]\n );\n const [position, setPosition] = useState({ x: 0, y: 0 });\n const [zoom, setZoom] = useState(1);\n const [mediaSize, setMediaSize] = useState<MediaSize | null>(null);\n\n const activeRegion = tab === BASE_TAB ? draft?.base : draft?.overrides?.[tab];\n const isOverrideTab = tab !== BASE_TAB;\n const showCropper = !isOverrideTab || !!activeRegion;\n\n const aspect =\n ratio === 'original'\n ? mediaSize\n ? mediaSize.naturalWidth / mediaSize.naturalHeight\n : 1\n : (parseAspectRatio(ratio) ?? 1);\n\n const initialArea =\n activeRegion && activeRegion.ratio === ratio\n ? {\n x: activeRegion.x * 100,\n y: activeRegion.y * 100,\n width: activeRegion.width * 100,\n height: activeRegion.height * 100,\n }\n : undefined;\n\n const resetCropper = (nextRatio: string) => {\n setRatio(nextRatio);\n setPosition({ x: 0, y: 0 });\n setZoom(1);\n };\n\n const switchTab = (key: string) => {\n setTab(key);\n const region = key === BASE_TAB ? draft?.base : draft?.overrides?.[key];\n resetCropper(\n region?.ratio && aspectRatios.includes(region.ratio)\n ? region.ratio\n : (draft?.base.ratio ?? aspectRatios[0])\n );\n };\n\n const handleCropComplete = (area: Area, areaPixels: Area) => {\n const region: CropRegion = {\n x: round(area.x / 100),\n y: round(area.y / 100),\n width: round(area.width / 100),\n height: round(area.height / 100),\n aspect: round(areaPixels.width / areaPixels.height) || 1,\n ratio,\n };\n setDraft((prev) =>\n tab === BASE_TAB\n ? {\n base: region,\n ...(prev?.overrides && { overrides: prev.overrides }),\n }\n : prev\n ? { ...prev, overrides: { ...prev.overrides, [tab]: region } }\n : prev\n );\n };\n\n const defineOverride = () => {\n if (!draft?.base) return;\n setDraft({\n ...draft,\n overrides: { ...draft.overrides, [tab]: { ...draft.base } },\n });\n resetCropper(\n aspectRatios.includes(draft.base.ratio)\n ? draft.base.ratio\n : aspectRatios[0]\n );\n };\n\n const removeOverride = () => {\n setDraft((prev) => {\n if (!prev?.overrides) return prev;\n const { [tab]: _removed, ...rest } = prev.overrides;\n return {\n base: prev.base,\n ...(Object.keys(rest).length && { overrides: rest }),\n };\n });\n };\n\n return (\n <Dialog open onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"nh:max-w-2xl\">\n <DialogHeader>\n <DialogTitle>{t.title}</DialogTitle>\n </DialogHeader>\n\n {breakpoints.length > 0 && (\n <div className=\"nh:flex nh:items-center nh:gap-1 nh:border-b nh:border-gray-200\">\n {[\n { key: BASE_TAB, label: t.desktop },\n ...breakpoints.map((bp) => ({\n key: bp.key,\n label: bp.label ?? bp.key,\n })),\n ].map(({ key, label }) => (\n <button\n key={key}\n type=\"button\"\n onClick={() => switchTab(key)}\n className={cn(\n 'nh:flex nh:cursor-pointer nh:items-center nh:gap-1.5 nh:border-b-2 nh:px-3 nh:py-1.5 nh:text-sm nh:capitalize',\n {\n 'nh:border-(--nh-primary) nh:font-semibold': tab === key,\n 'nh:border-transparent nh:text-gray-500 nh:hover:text-gray-900':\n tab !== key,\n }\n )}\n >\n {label}\n {key !== BASE_TAB && draft?.overrides?.[key] && (\n <span className=\"nh:size-1.5 nh:rounded-full nh:bg-(--nh-primary)\" />\n )}\n </button>\n ))}\n </div>\n )}\n\n {showCropper ? (\n <>\n <div className=\"nh:flex nh:flex-wrap nh:items-center nh:gap-4\">\n <label className=\"nh:flex nh:items-center nh:gap-2 nh:text-sm\">\n {t.format}\n <select\n value={ratio}\n onChange={(e) => resetCropper(e.target.value)}\n className=\"nh:block nh:rounded-md nh:border nh:border-gray-300 nh:px-3 nh:py-1.5 nh:text-sm nh:shadow-sm\"\n >\n {aspectRatios.map((r) => (\n <option key={r} value={r}>\n {r === 'original' ? t.original : r.replace('/', ':')}\n </option>\n ))}\n </select>\n </label>\n <label className=\"nh:flex nh:grow nh:items-center nh:gap-2 nh:text-sm\">\n {t.zoom}\n <input\n type=\"range\"\n min={1}\n max={3}\n step={0.01}\n value={zoom}\n onChange={(e) => setZoom(Number(e.target.value))}\n className=\"nh:grow nh:accent-(--nh-primary)\"\n />\n </label>\n </div>\n <div className=\"nh:relative nh:h-80 nh:w-full nh:overflow-hidden nh:rounded-md nh:bg-neutral-900\">\n <Cropper\n key={`${tab}:${ratio}`}\n image={imageSrc}\n crop={position}\n zoom={zoom}\n aspect={aspect}\n onCropChange={setPosition}\n onZoomChange={setZoom}\n onCropComplete={handleCropComplete}\n onMediaLoaded={setMediaSize}\n initialCroppedAreaPercentages={initialArea}\n showGrid\n />\n </div>\n </>\n ) : (\n <div className=\"nh:flex nh:h-80 nh:flex-col nh:items-center nh:justify-center nh:gap-3 nh:rounded-md nh:border nh:border-dashed nh:border-gray-300 nh:text-sm nh:text-gray-500\">\n <p>{t.usesDesktop}</p>\n <Button type=\"button\" variant=\"secondary\" onClick={defineOverride}>\n {t.defineOverride}\n </Button>\n </div>\n )}\n\n <DialogFooter className=\"nh:sm:justify-between\">\n <div>\n {isOverrideTab\n ? activeRegion && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={removeOverride}\n >\n {t.removeOverride}\n </Button>\n )\n : value && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={() => onSave(undefined)}\n >\n {t.removeCrop}\n </Button>\n )}\n </div>\n <div className=\"nh:flex nh:gap-2\">\n <Button type=\"button\" variant=\"secondary\" onClick={onClose}>\n {t.cancel}\n </Button>\n <Button\n type=\"button\"\n onClick={() => onSave(draft)}\n disabled={!draft?.base}\n >\n {t.apply}\n </Button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,OAAOC,OAAO,MAAqC,iBAAiB;AAEpE,SAASC,EAAE,QAAQ,uBAAuB;AAC1C,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SACEC,MAAM,EACNC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,WAAW,QACN,iBAAiB;AACxB,SAEEC,qBAAqB,EAGrBC,gBAAgB,QACX,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEtB,MAAMC,QAAQ,GAAG,MAAM;AACvB,MAAMC,KAAK,GAAIC,CAAS,IAAKC,IAAI,CAACF,KAAK,CAACC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK;AAU1D,OAAO,SAASE,gBAAgBA,CAAC;EAC/BC,QAAQ;EACRC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACqB,CAAC,EAAE;EACxB,MAAMC,CAAC,GAAGxB,iBAAiB,CAAC,CAAC,CAACyB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AAA;UAAK+D,SAAS,EAAC,kBAAkB;UAAAD,QAAA,gBAC/BhE,IAAA,CAACZ,MAAM;YAACmF,IAAI,EAAC,QAAQ;YAACqB,OAAO,EAAC,WAAW;YAACpB,OAAO,EAAE1D,OAAQ;YAAAkD,QAAA,EACxDjD,CAAC,CAAC+E;UAAM,CACH,CAAC,eACT9F,IAAA,CAACZ,MAAM;YACLmF,IAAI,EAAC,QAAQ;YACbC,OAAO,EAAEA,CAAA,KAAM3D,MAAM,CAACO,KAAK,CAAE;YAC7B2E,QAAQ,EAAE,CAAC3E,KAAK,EAAEM,IAAK;YAAAsC,QAAA,EAEtBjD,CAAC,CAACiF;UAAK,CACF,CAAC;QAAA,CACN,CAAC;MAAA,CACM,CAAC;IAAA,CACF;EAAC,CACV,CAAC;AAEb","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type CropRegion = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
aspect: number;
|
|
7
|
+
ratio: string;
|
|
8
|
+
};
|
|
9
|
+
export type MediaCrop = {
|
|
10
|
+
base: CropRegion;
|
|
11
|
+
overrides?: Record<string, CropRegion>;
|
|
12
|
+
};
|
|
13
|
+
export type CropBreakpoint = {
|
|
14
|
+
key: string;
|
|
15
|
+
maxWidth: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
export type MediaCropConfig = {
|
|
19
|
+
aspectRatios?: string[];
|
|
20
|
+
breakpoints?: CropBreakpoint[];
|
|
21
|
+
};
|
|
22
|
+
export declare const DEFAULT_ASPECT_RATIOS: string[];
|
|
23
|
+
export declare function parseAspectRatio(ratio: string): number | undefined;
|
|
24
|
+
//# sourceMappingURL=crop-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-types.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAqC,CAAC;AAExE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKlE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const DEFAULT_ASPECT_RATIOS = ['16/9', '4/3', '1/1', 'original'];
|
|
2
|
+
export function parseAspectRatio(ratio) {
|
|
3
|
+
if (ratio === 'original') return undefined;
|
|
4
|
+
const [w, h] = ratio.split('/').map(Number);
|
|
5
|
+
if (!w || !h) return undefined;
|
|
6
|
+
return w / h;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=crop-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crop-types.js","names":["DEFAULT_ASPECT_RATIOS","parseAspectRatio","ratio","undefined","w","h","split","map","Number"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/crop-types.ts"],"sourcesContent":["export type CropRegion = {\n x: number;\n y: number;\n width: number;\n height: number;\n aspect: number;\n ratio: string;\n};\n\nexport type MediaCrop = {\n base: CropRegion;\n overrides?: Record<string, CropRegion>;\n};\n\nexport type CropBreakpoint = {\n key: string;\n maxWidth: number;\n label?: string;\n};\n\nexport type MediaCropConfig = {\n aspectRatios?: string[];\n breakpoints?: CropBreakpoint[];\n};\n\nexport const DEFAULT_ASPECT_RATIOS = ['16/9', '4/3', '1/1', 'original'];\n\nexport function parseAspectRatio(ratio: string): number | undefined {\n if (ratio === 'original') return undefined;\n const [w, h] = ratio.split('/').map(Number);\n if (!w || !h) return undefined;\n return w / h;\n}\n"],"mappings":"AAyBA,OAAO,MAAMA,qBAAqB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;AAEvE,OAAO,SAASC,gBAAgBA,CAACC,KAAa,EAAsB;EAClE,IAAIA,KAAK,KAAK,UAAU,EAAE,OAAOC,SAAS;EAC1C,MAAM,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAC3C,IAAI,CAACJ,CAAC,IAAI,CAACC,CAAC,EAAE,OAAOF,SAAS;EAC9B,OAAOC,CAAC,GAAGC,CAAC;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts specified fields from an object using dot notation paths
|
|
3
|
+
* @param obj - The source object
|
|
4
|
+
* @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])
|
|
5
|
+
* @returns Object containing only the specified fields, or the original object if no fields specified
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractFields(obj: any, fields?: string[]): any;
|
|
8
|
+
//# sourceMappingURL=extract-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-fields.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/extract-fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAgB9D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts specified fields from an object using dot notation paths
|
|
3
|
+
* @param obj - The source object
|
|
4
|
+
* @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])
|
|
5
|
+
* @returns Object containing only the specified fields, or the original object if no fields specified
|
|
6
|
+
*/
|
|
7
|
+
export function extractFields(obj, fields) {
|
|
8
|
+
// If no fields specified, return the entire object
|
|
9
|
+
if (!fields || fields.length === 0) {
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const field of fields) {
|
|
14
|
+
const value = getNestedProperty(obj, field);
|
|
15
|
+
if (value !== undefined) {
|
|
16
|
+
setNestedProperty(result, field, value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets a nested property from an object using dot notation
|
|
24
|
+
* @param obj - The source object
|
|
25
|
+
* @param path - The property path (e.g., 'field_media_image.meta.alt')
|
|
26
|
+
* @returns The property value or undefined if not found
|
|
27
|
+
*/
|
|
28
|
+
function getNestedProperty(obj, path) {
|
|
29
|
+
return path.split('.').reduce((current, key) => {
|
|
30
|
+
return current && current[key] !== undefined ? current[key] : undefined;
|
|
31
|
+
}, obj);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Sets a nested property in an object using dot notation
|
|
36
|
+
* @param obj - The target object
|
|
37
|
+
* @param path - The property path (e.g., 'field_media_image.meta.alt')
|
|
38
|
+
* @param value - The value to set
|
|
39
|
+
*/
|
|
40
|
+
function setNestedProperty(obj, path, value) {
|
|
41
|
+
const keys = path.split('.');
|
|
42
|
+
const lastKey = keys.pop();
|
|
43
|
+
const target = keys.reduce((current, key) => {
|
|
44
|
+
if (!current[key] || typeof current[key] !== 'object') {
|
|
45
|
+
current[key] = {};
|
|
46
|
+
}
|
|
47
|
+
return current[key];
|
|
48
|
+
}, obj);
|
|
49
|
+
target[lastKey] = value;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=extract-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-fields.js","names":["extractFields","obj","fields","length","result","field","value","getNestedProperty","undefined","setNestedProperty","path","split","reduce","current","key","keys","lastKey","pop","target"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/extract-fields.ts"],"sourcesContent":["/**\n * Extracts specified fields from an object using dot notation paths\n * @param obj - The source object\n * @param fields - Array of property paths to extract (e.g., ['id', 'field_media_image.meta.alt'])\n * @returns Object containing only the specified fields, or the original object if no fields specified\n */\nexport function extractFields(obj: any, fields?: string[]): any {\n // If no fields specified, return the entire object\n if (!fields || fields.length === 0) {\n return obj;\n }\n\n const result: any = {};\n\n for (const field of fields) {\n const value = getNestedProperty(obj, field);\n if (value !== undefined) {\n setNestedProperty(result, field, value);\n }\n }\n\n return result;\n}\n\n/**\n * Gets a nested property from an object using dot notation\n * @param obj - The source object\n * @param path - The property path (e.g., 'field_media_image.meta.alt')\n * @returns The property value or undefined if not found\n */\nfunction getNestedProperty(obj: any, path: string): any {\n return path.split('.').reduce((current, key) => {\n return current && current[key] !== undefined ? current[key] : undefined;\n }, obj);\n}\n\n/**\n * Sets a nested property in an object using dot notation\n * @param obj - The target object\n * @param path - The property path (e.g., 'field_media_image.meta.alt')\n * @param value - The value to set\n */\nfunction setNestedProperty(obj: any, path: string, value: any): void {\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n\n const target = keys.reduce((current, key) => {\n if (!current[key] || typeof current[key] !== 'object') {\n current[key] = {};\n }\n return current[key];\n }, obj);\n\n target[lastKey] = value;\n}\n"],"mappings":"AAAA;AACA;AACA;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AC;IACnB;IACA,OAAOD,OAAO,CAACC,GAAG,CAAC;EACrB,CAAC,EAAEb,GAAG,CAAC;EAEPiB,MAAM,CAACF,OAAO,CAAC,GAAGV,KAAK;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ImageUploadFormProps {
|
|
2
|
+
onCancel?: () => void;
|
|
3
|
+
onMediaAdded?: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function ImageUploadForm({ onMediaAdded, onCancel, }: ImageUploadFormProps): import("react").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=image-upload-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-upload-form.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/image-upload-form.tsx"],"names":[],"mappings":"AAaA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,QAAQ,GACT,EAAE,oBAAoB,+BA4JtB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from '@puckeditor/core';
|
|
5
|
+
import { uploadImageMedia } from '../../api/client';
|
|
6
|
+
import { usePuckDictionary } from '../../i18n';
|
|
7
|
+
import { RequiredMark } from '../../ui/required-mark';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const MAX_IMAGE_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
10
|
+
export function ImageUploadForm({
|
|
11
|
+
onMediaAdded,
|
|
12
|
+
onCancel
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
mediaSelector
|
|
16
|
+
} = usePuckDictionary();
|
|
17
|
+
const [isPending, setIsPending] = useState(false);
|
|
18
|
+
const [message, setMessage] = useState('');
|
|
19
|
+
const [messageType, setMessageType] = useState(null);
|
|
20
|
+
const [formData, setFormData] = useState({
|
|
21
|
+
alt: '',
|
|
22
|
+
name: ''
|
|
23
|
+
});
|
|
24
|
+
const handleSubmit = async e => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
setIsPending(true);
|
|
27
|
+
setMessage('');
|
|
28
|
+
setMessageType(null);
|
|
29
|
+
try {
|
|
30
|
+
const formElement = e.currentTarget;
|
|
31
|
+
const formData_0 = new FormData(formElement);
|
|
32
|
+
const result = await uploadImageMedia(formData_0);
|
|
33
|
+
if (result) {
|
|
34
|
+
setMessage(result.message);
|
|
35
|
+
if (result.success) {
|
|
36
|
+
setMessageType('success');
|
|
37
|
+
formElement.reset();
|
|
38
|
+
setFormData({
|
|
39
|
+
alt: '',
|
|
40
|
+
name: ''
|
|
41
|
+
});
|
|
42
|
+
if (onMediaAdded) {
|
|
43
|
+
onMediaAdded();
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
setMessageType('error');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
} catch (error) {
|
|
50
|
+
setMessage(mediaSelector.uploadImageFailed);
|
|
51
|
+
setMessageType('error');
|
|
52
|
+
console.error(error);
|
|
53
|
+
} finally {
|
|
54
|
+
setIsPending(false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleChange = e_0 => {
|
|
58
|
+
const {
|
|
59
|
+
name,
|
|
60
|
+
value
|
|
61
|
+
} = e_0.target;
|
|
62
|
+
setFormData(prev => ({
|
|
63
|
+
...prev,
|
|
64
|
+
[name]: value
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
return /*#__PURE__*/_jsxs("form", {
|
|
68
|
+
onSubmit: handleSubmit,
|
|
69
|
+
className: "nh:space-y-4",
|
|
70
|
+
children: [message && /*#__PURE__*/_jsx("div", {
|
|
71
|
+
className: `nh:rounded nh:p-2 nh:text-sm nh:font-medium ${messageType === 'success' ? 'nh:border nh:border-green-200 nh:bg-green-100 text-green-700' : 'nh:border nh:border-red-200 nh:bg-red-100 text-red-700'}`,
|
|
72
|
+
children: message
|
|
73
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
74
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
|
75
|
+
htmlFor: "name",
|
|
76
|
+
className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
|
|
77
|
+
children: [mediaSelector.name, /*#__PURE__*/_jsx(RequiredMark, {})]
|
|
78
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
79
|
+
type: "text",
|
|
80
|
+
id: "name",
|
|
81
|
+
name: "name",
|
|
82
|
+
value: formData.name,
|
|
83
|
+
onChange: handleChange,
|
|
84
|
+
className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm",
|
|
85
|
+
required: true
|
|
86
|
+
})]
|
|
87
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
88
|
+
children: [/*#__PURE__*/_jsxs("label", {
|
|
89
|
+
htmlFor: "file",
|
|
90
|
+
className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
|
|
91
|
+
children: [mediaSelector.chooseImage, /*#__PURE__*/_jsx(RequiredMark, {})]
|
|
92
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
93
|
+
type: "file",
|
|
94
|
+
id: "file",
|
|
95
|
+
name: "file",
|
|
96
|
+
accept: "image/*",
|
|
97
|
+
className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border nh:border-gray-300 nh:p-2 nh:shadow-sm",
|
|
98
|
+
required: true,
|
|
99
|
+
onChange: e_1 => {
|
|
100
|
+
const file = e_1.target.files?.[0];
|
|
101
|
+
if (!file) return;
|
|
102
|
+
if (file.size > MAX_IMAGE_FILE_SIZE_BYTES) {
|
|
103
|
+
e_1.target.setCustomValidity(mediaSelector.imageTooLarge);
|
|
104
|
+
e_1.target.reportValidity();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
e_1.target.setCustomValidity('');
|
|
108
|
+
},
|
|
109
|
+
onClick: e_2 => {
|
|
110
|
+
e_2.stopPropagation();
|
|
111
|
+
}
|
|
112
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
113
|
+
className: "nh:mt-1 nh:text-sm nh:text-gray-500",
|
|
114
|
+
children: mediaSelector.maxFileSize
|
|
115
|
+
})]
|
|
116
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
117
|
+
children: [/*#__PURE__*/_jsx("label", {
|
|
118
|
+
htmlFor: "alt",
|
|
119
|
+
className: "nh:block nh:text-sm nh:font-medium nh:text-gray-700",
|
|
120
|
+
children: mediaSelector.altText
|
|
121
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
122
|
+
type: "text",
|
|
123
|
+
id: "alt",
|
|
124
|
+
name: "alt",
|
|
125
|
+
value: formData.alt,
|
|
126
|
+
onChange: handleChange,
|
|
127
|
+
className: "nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm"
|
|
128
|
+
})]
|
|
129
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
130
|
+
className: "nh:mt-6 nh:flex nh:justify-between nh:gap-2",
|
|
131
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
132
|
+
type: "button",
|
|
133
|
+
variant: "secondary",
|
|
134
|
+
onClick: onCancel,
|
|
135
|
+
children: mediaSelector.cancel
|
|
136
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
137
|
+
type: "submit",
|
|
138
|
+
disabled: isPending,
|
|
139
|
+
onClick: e_3 => {
|
|
140
|
+
e_3.stopPropagation();
|
|
141
|
+
},
|
|
142
|
+
children: isPending ? mediaSelector.uploading : mediaSelector.uploadImage
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=image-upload-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-upload-form.js","names":["useState","Button","uploadImageMedia","usePuckDictionary","RequiredMark","jsx","_jsx","jsxs","_jsxs","MAX_IMAGE_FILE_SIZE_BYTES","ImageUploadForm","onMediaAdded","onCancel","mediaSelector","isPending","setIsPending","message","setMessage","messageType","setMessageType","formData","setFormData","alt","name","handleSubmit","e","preventDefault","formElement","currentTarget","FormData","result","success","reset","error","uploadImageFailed","console","handleChange","value","target","prev","onSubmit","className","children","htmlFor","type","id","onChange","required","chooseImage","accept","file","files","size","setCustomValidity","imageTooLarge","reportValidity","onClick","stopPropagation","maxFileSize","altText","variant","cancel","disabled","uploading","uploadImage"],"sources":["../../../../../src/puck-editor/internal/fields/media-selector/image-upload-form.tsx"],"sourcesContent":["'use client';\n\nimport { FormEvent, useState } from 'react';\nimport { Button } from '@puckeditor/core';\n\nimport { uploadImageMedia } from '../../api/client';\nimport { usePuckDictionary } from '../../i18n';\nimport { RequiredMark } from '../../ui/required-mark';\n\nconst MAX_IMAGE_FILE_SIZE_BYTES = 5 * 1024 * 1024;\n\ntype MessageType = 'success' | 'error' | null;\n\ninterface ImageUploadFormProps {\n onCancel?: () => void;\n onMediaAdded?: () => void;\n}\n\nexport function ImageUploadForm({\n onMediaAdded,\n onCancel,\n}: ImageUploadFormProps) {\n const { mediaSelector } = usePuckDictionary();\n const [isPending, setIsPending] = useState(false);\n const [message, setMessage] = useState('');\n const [messageType, setMessageType] = useState<MessageType>(null);\n const [formData, setFormData] = useState({\n alt: '',\n name: '',\n });\n\n const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n setIsPending(true);\n setMessage('');\n setMessageType(null);\n\n try {\n const formElement = e.currentTarget;\n const formData = new FormData(formElement);\n\n const result = await uploadImageMedia(formData);\n\n if (result) {\n setMessage(result.message);\n if (result.success) {\n setMessageType('success');\n formElement.reset();\n setFormData({ alt: '', name: '' });\n if (onMediaAdded) {\n onMediaAdded();\n }\n } else {\n setMessageType('error');\n }\n }\n } catch (error) {\n setMessage(mediaSelector.uploadImageFailed);\n setMessageType('error');\n console.error(error);\n } finally {\n setIsPending(false);\n }\n };\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n ) => {\n const { name, value } = e.target;\n setFormData((prev) => ({\n ...prev,\n [name]: value,\n }));\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"nh:space-y-4\">\n {message && (\n <div\n className={`nh:rounded nh:p-2 nh:text-sm nh:font-medium ${\n messageType === 'success'\n ? 'nh:border nh:border-green-200 nh:bg-green-100 text-green-700'\n : 'nh:border nh:border-red-200 nh:bg-red-100 text-red-700'\n }`}\n >\n {message}\n </div>\n )}\n\n <div>\n <label\n htmlFor=\"name\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.name}\n <RequiredMark />\n </label>\n <input\n type=\"text\"\n id=\"name\"\n name=\"name\"\n value={formData.name}\n onChange={handleChange}\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm\"\n required\n />\n </div>\n\n <div>\n <label\n htmlFor=\"file\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.chooseImage}\n <RequiredMark />\n </label>\n <input\n type=\"file\"\n id=\"file\"\n name=\"file\"\n accept=\"image/*\"\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border nh:border-gray-300 nh:p-2 nh:shadow-sm\"\n required\n onChange={(e) => {\n const file = e.target.files?.[0];\n if (!file) return;\n\n if (file.size > MAX_IMAGE_FILE_SIZE_BYTES) {\n e.target.setCustomValidity(mediaSelector.imageTooLarge);\n e.target.reportValidity();\n return;\n }\n\n e.target.setCustomValidity('');\n }}\n onClick={(e) => {\n e.stopPropagation();\n }}\n />\n <p className=\"nh:mt-1 nh:text-sm nh:text-gray-500\">\n {mediaSelector.maxFileSize}\n </p>\n </div>\n\n <div>\n <label\n htmlFor=\"alt\"\n className=\"nh:block nh:text-sm nh:font-medium nh:text-gray-700\"\n >\n {mediaSelector.altText}\n </label>\n <input\n type=\"text\"\n id=\"alt\"\n name=\"alt\"\n value={formData.alt}\n onChange={handleChange}\n className=\"nh:mt-1 nh:block nh:w-full nh:max-w-3xl nh:rounded-md nh:border-gray-300 nh:shadow-sm\"\n />\n </div>\n\n <div className=\"nh:mt-6 nh:flex nh:justify-between nh:gap-2\">\n <Button type=\"button\" variant=\"secondary\" onClick={onCancel}>\n {mediaSelector.cancel}\n </Button>\n <Button\n type=\"submit\"\n disabled={isPending}\n onClick={(e) => {\n e.stopPropagation();\n }}\n >\n {isPending ? mediaSelector.uploading : mediaSelector.uploadImage}\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAoBA,QAAQ,QAAQ,OAAO;AAC3C,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,YAAY,QAAQ,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,MAAMC,yBAAyB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;AASjD,OAAO,SAASC,eAAeA,CAAC;EAC9BC,YAAY;EACZC;AACoB,CAAC,EAAE;EACvB,MAAM;IAAEC;EAAc,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EAC7C,MAAM,CAACW,SAAS,EAAEC,YAAY,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACgB,OAAO,EAAEC,UAAU,CAAC,GAAGjB,QAAQ,CAAC,EAAE,CAAC;EAC1C,MAAM,CAACkB,WAAW,EAAEC,cAAc,CAAC,GAAGnB,QAAQ,CAAc,IAAI,CAAC;EACjE,MAAM,CAACoB,QAAQ,EAAEC,WAAW,CAAC,GA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AW,CAC1D,CAAC;IAAA,CACN,CAAC;EAAA,CACF,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MediaCrop, MediaCropConfig } from './crop-types';
|
|
2
|
+
export type MediaItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
thumbnailImage?: string;
|
|
7
|
+
thumbnail?: {
|
|
8
|
+
uri?: {
|
|
9
|
+
url?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
field_media_image?: {
|
|
13
|
+
uri?: {
|
|
14
|
+
url?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
crop?: MediaCrop;
|
|
18
|
+
};
|
|
19
|
+
export declare function deriveThumbnailImage(value: MediaItem | null, drupalBaseUrl: string): string | undefined;
|
|
20
|
+
type MediaSelectorFieldProps = {
|
|
21
|
+
onChange: (value: MediaItem | null) => void;
|
|
22
|
+
value: MediaItem | null;
|
|
23
|
+
mediaTypes: string[];
|
|
24
|
+
label?: string;
|
|
25
|
+
fields?: string[];
|
|
26
|
+
cropConfig?: MediaCropConfig;
|
|
27
|
+
};
|
|
28
|
+
export declare function MediaSelectorField({ onChange, value, mediaTypes, label, fields, cropConfig, }: MediaSelectorFieldProps): import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=media-selector-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-selector-field.d.ts","sourceRoot":"","sources":["../../../../../src/puck-editor/internal/fields/media-selector/media-selector-field.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/D,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACvC,iBAAiB,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAMpB;AAED,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,GACX,EAAE,uBAAuB,+BAkYzB"}
|