@nodehive/nextjs 0.1.3 → 0.2.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/README.md +1 -1
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/internal/config.d.ts +15 -5
- package/dist/auth/internal/config.js.map +1 -1
- package/dist/auth/internal/draft-mode.d.ts +2 -3
- package/dist/auth/internal/draft-mode.js +3 -20
- package/dist/auth/internal/draft-mode.js.map +1 -1
- package/dist/auth/internal/editor-locale.d.ts +0 -1
- package/dist/auth/internal/handoff.d.ts +0 -1
- package/dist/auth/internal/has-session.d.ts +0 -1
- package/dist/auth/internal/has-session.js +1 -1
- package/dist/auth/internal/has-session.js.map +1 -1
- package/dist/auth/internal/i18n.d.ts +10 -0
- package/dist/auth/internal/i18n.js +25 -0
- package/dist/auth/internal/i18n.js.map +1 -0
- package/dist/auth/internal/logout.d.ts +1 -2
- package/dist/auth/internal/logout.js +3 -3
- package/dist/auth/internal/logout.js.map +1 -1
- package/dist/auth/internal/next-cookie-storage.d.ts +5 -2
- package/dist/auth/internal/next-cookie-storage.js +8 -1
- package/dist/auth/internal/next-cookie-storage.js.map +1 -1
- package/dist/auth/internal/nodehive-client.d.ts +6 -4
- package/dist/auth/internal/nodehive-client.js +6 -4
- package/dist/auth/internal/nodehive-client.js.map +1 -1
- package/dist/auth/internal/oauth-config.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.js +4 -4
- package/dist/auth/internal/proxy-helpers.js.map +1 -1
- package/dist/auth/internal/refresh.d.ts +1 -2
- package/dist/auth/internal/refresh.js +4 -4
- package/dist/auth/internal/refresh.js.map +1 -1
- package/dist/auth/internal/require-auth.d.ts +0 -1
- package/dist/auth/internal/require-auth.js +1 -1
- package/dist/auth/internal/require-auth.js.map +1 -1
- package/dist/auth/internal/return-to.d.ts +0 -1
- package/dist/auth/internal/roles.d.ts +17 -0
- package/dist/auth/internal/roles.js +39 -0
- package/dist/auth/internal/roles.js.map +1 -0
- package/dist/auth/internal/routes/callback.d.ts +1 -2
- package/dist/auth/internal/routes/callback.js +6 -6
- package/dist/auth/internal/routes/callback.js.map +1 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts +1 -2
- package/dist/auth/internal/routes/chips-exchange.js +5 -5
- package/dist/auth/internal/routes/chips-exchange.js.map +1 -1
- package/dist/auth/internal/routes/draft.d.ts +1 -2
- package/dist/auth/internal/routes/draft.js +3 -3
- package/dist/auth/internal/routes/draft.js.map +1 -1
- package/dist/auth/internal/routes/index.d.ts +4 -2
- package/dist/auth/internal/routes/index.js +7 -7
- package/dist/auth/internal/routes/index.js.map +1 -1
- package/dist/auth/internal/routes/login.d.ts +0 -1
- package/dist/auth/internal/routes/login.js +3 -3
- package/dist/auth/internal/routes/login.js.map +1 -1
- package/dist/auth/internal/routes/popup-done.d.ts +2 -2
- package/dist/auth/internal/routes/popup-done.js +9 -7
- package/dist/auth/internal/routes/popup-done.js.map +1 -1
- package/dist/auth/internal/routes/refresh.d.ts +2 -5
- package/dist/auth/internal/routes/refresh.js +8 -2
- package/dist/auth/internal/routes/refresh.js.map +1 -1
- package/dist/auth/internal/same-origin.d.ts +0 -1
- package/dist/auth/internal/session-gates.d.ts +27 -3
- package/dist/auth/internal/session-gates.js +35 -3
- package/dist/auth/internal/session-gates.js.map +1 -1
- package/dist/auth/internal/update-session.d.ts +1 -2
- package/dist/auth/internal/update-session.js +1 -1
- package/dist/auth/internal/update-session.js.map +1 -1
- package/dist/auth/internal/use-editor-login.d.ts +0 -1
- package/dist/auth/internal/use-editor-login.js +2 -3
- package/dist/auth/internal/use-editor-login.js.map +1 -1
- package/dist/auth/proxy.d.ts +7 -8
- package/dist/auth/proxy.js +6 -6
- package/dist/auth/proxy.js.map +1 -1
- package/dist/auth/react.d.ts +1 -2
- package/dist/auth/react.js +1 -1
- package/dist/auth/react.js.map +1 -1
- package/dist/auth/routes.d.ts +3 -3
- package/dist/auth/routes.js +1 -1
- package/dist/auth/routes.js.map +1 -1
- package/dist/auth/server.d.ts +14 -12
- package/dist/auth/server.js +14 -9
- package/dist/auth/server.js.map +1 -1
- package/dist/bridge-protocol/index.d.ts +50 -0
- package/dist/bridge-protocol/index.js +25 -0
- package/dist/bridge-protocol/index.js.map +1 -0
- package/dist/puck-editor/editor.d.ts +8 -0
- package/dist/puck-editor/editor.js +9 -0
- package/dist/puck-editor/editor.js.map +1 -0
- package/dist/puck-editor/fields.d.ts +6 -7
- package/dist/puck-editor/fields.js +3 -3
- package/dist/puck-editor/fields.js.map +1 -1
- package/dist/puck-editor/index.d.ts +17 -14
- package/dist/puck-editor/index.js +13 -11
- package/dist/puck-editor/index.js.map +1 -1
- package/dist/puck-editor/internal/api/client.d.ts +19 -4
- package/dist/puck-editor/internal/api/client.js +56 -19
- package/dist/puck-editor/internal/api/client.js.map +1 -1
- package/dist/puck-editor/internal/api/config.d.ts +36 -3
- package/dist/puck-editor/internal/api/config.js.map +1 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts +1 -2
- package/dist/puck-editor/internal/api/create-puck-api.js +10 -13
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts +1 -2
- package/dist/puck-editor/internal/api/handlers/create-page.js +6 -4
- package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts +6 -5
- package/dist/puck-editor/internal/api/handlers/entities.js +60 -15
- package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts +3 -6
- package/dist/puck-editor/internal/api/handlers/publish.js +57 -14
- package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts +5 -2
- package/dist/puck-editor/internal/api/handlers/template.js +28 -60
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts +10 -2
- package/dist/puck-editor/internal/api/handlers/upload.js +93 -28
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -1
- package/dist/puck-editor/internal/api/localize-message.d.ts +15 -0
- package/dist/puck-editor/internal/api/localize-message.js +15 -0
- package/dist/puck-editor/internal/api/localize-message.js.map +1 -0
- package/dist/puck-editor/internal/api/media-params.d.ts +3 -3
- package/dist/puck-editor/internal/api/media-params.js +23 -19
- package/dist/puck-editor/internal/api/media-params.js.map +1 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts +5 -3
- package/dist/puck-editor/internal/api/media-upload.js +33 -22
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -1
- package/dist/puck-editor/internal/api/message-codes.d.ts +2 -0
- package/dist/puck-editor/internal/api/message-codes.js +2 -0
- package/dist/puck-editor/internal/api/message-codes.js.map +1 -0
- package/dist/puck-editor/internal/api/space.d.ts +0 -1
- package/dist/puck-editor/internal/api/type-segment.d.ts +2 -0
- package/dist/puck-editor/internal/api/type-segment.js +9 -0
- package/dist/puck-editor/internal/api/type-segment.js.map +1 -0
- package/dist/puck-editor/internal/content-model.d.ts +31 -3
- package/dist/puck-editor/internal/content-model.js +76 -6
- package/dist/puck-editor/internal/content-model.js.map +1 -1
- package/dist/puck-editor/internal/dictionaries.d.ts +225 -0
- package/dist/puck-editor/internal/dictionaries.js +673 -0
- package/dist/puck-editor/internal/dictionaries.js.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts +1 -2
- package/dist/puck-editor/internal/editor/allowed-types.js +2 -2
- package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.js +5 -5
- package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.js +4 -4
- package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.js +8 -8
- package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts +1 -2
- package/dist/puck-editor/internal/editor/component-icons.js.map +1 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-item.js +2 -2
- package/dist/puck-editor/internal/editor/component-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/compose-save-issues.d.ts +15 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js +16 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js.map +1 -0
- package/dist/puck-editor/internal/editor/dirty-state.d.ts +3 -0
- package/dist/puck-editor/internal/editor/dirty-state.js +7 -0
- package/dist/puck-editor/internal/editor/dirty-state.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.d.ts +9 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js +289 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-storage.d.ts +41 -0
- package/dist/puck-editor/internal/editor/draft-storage.js +129 -0
- package/dist/puck-editor/internal/editor/draft-storage.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.js +4 -4
- package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +6 -4
- package/dist/puck-editor/internal/editor/editor-header-actions.js +119 -60
- package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +1 -2
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +6 -6
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +1 -2
- package/dist/puck-editor/internal/editor/grouped-entry-list.js +3 -3
- package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts +4 -4
- package/dist/puck-editor/internal/editor/header-save-button.js +66 -27
- package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -1
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.d.ts +5 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js +140 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.js +5 -5
- package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +1 -2
- package/dist/puck-editor/internal/editor/picker-entry-item.js +4 -4
- package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts +14 -5
- package/dist/puck-editor/internal/editor/picker-model.js +157 -132
- package/dist/puck-editor/internal/editor/picker-model.js.map +1 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +18 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js +25 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts +6 -4
- package/dist/puck-editor/internal/editor/puck-editor.js +270 -209
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/editor/save-guard.d.ts +15 -0
- package/dist/puck-editor/internal/editor/save-guard.js +30 -0
- package/dist/puck-editor/internal/editor/save-guard.js.map +1 -0
- package/dist/puck-editor/internal/editor/save-page-context.d.ts +8 -0
- package/dist/puck-editor/internal/editor/save-page-context.js +34 -0
- package/dist/puck-editor/internal/editor/save-page-context.js.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.js +2 -2
- package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.d.ts +3 -0
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.js +38 -0
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.d.ts +5 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.js +72 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.d.ts +16 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js +194 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-frame-zoom.d.ts +0 -1
- package/dist/puck-editor/internal/editor/use-is-dirty.d.ts +1 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js +32 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts +16 -3
- package/dist/puck-editor/internal/editor-config.js +8 -1
- package/dist/puck-editor/internal/editor-config.js.map +1 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +2 -2
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js +90 -73
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -1
- package/dist/puck-editor/internal/fields/index.d.ts +10 -10
- package/dist/puck-editor/internal/fields/index.js +10 -9
- package/dist/puck-editor/internal/fields/index.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +208 -140
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +6 -6
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +25 -5
- package/dist/puck-editor/internal/fields/link-picker/link-value.js +56 -6
- package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +4 -4
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +3 -3
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js +100 -88
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +4 -4
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +19 -10
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +7 -3
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +29 -22
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +281 -255
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +15 -2
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +23 -18
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +12 -6
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +2 -2
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.js +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -1
- package/dist/puck-editor/internal/fields/required.d.ts +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +13 -3
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +32 -22
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -1
- package/dist/puck-editor/internal/i18n.d.ts +2 -181
- package/dist/puck-editor/internal/i18n.js +2 -358
- package/dist/puck-editor/internal/i18n.js.map +1 -1
- package/dist/puck-editor/internal/locale.d.ts +0 -1
- package/dist/puck-editor/internal/localize.d.ts +1 -2
- package/dist/puck-editor/internal/localize.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +41 -32
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +4 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +3 -3
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +8 -8
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +5 -5
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +2 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +224 -219
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js +5 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +17 -16
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +171 -161
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +2 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +9 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +22 -20
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +14 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +23 -15
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts +0 -1
- package/dist/puck-editor/internal/puck-props.d.ts +13 -0
- package/dist/puck-editor/internal/puck-props.js +2 -0
- package/dist/puck-editor/internal/puck-props.js.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts +25 -6
- package/dist/puck-editor/internal/puck-wrapper.js +124 -115
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts +1 -2
- package/dist/puck-editor/internal/render/cropped-image.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/action-selection.d.ts +8 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js +10 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts +10 -4
- package/dist/puck-editor/internal/smart-actions/index.js +27 -12
- package/dist/puck-editor/internal/smart-actions/index.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/new-page.js +6 -6
- package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +49 -37
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts +0 -1
- package/dist/puck-editor/internal/ui/calendar.js +1 -1
- package/dist/puck-editor/internal/ui/calendar.js.map +1 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.js +33 -20
- package/dist/puck-editor/internal/ui/dialog.js.map +1 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.js +1 -1
- package/dist/puck-editor/internal/ui/icon-button.js.map +1 -1
- package/dist/puck-editor/internal/ui/load-error-notice.d.ts +6 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js +81 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js.map +1 -0
- package/dist/puck-editor/internal/ui/popover.d.ts +0 -1
- package/dist/puck-editor/internal/ui/popover.js +1 -1
- package/dist/puck-editor/internal/ui/popover.js.map +1 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts +0 -1
- package/dist/puck-editor/internal/ui/search-control.d.ts +0 -1
- package/dist/puck-editor/internal/ui/search-control.js +3 -3
- package/dist/puck-editor/internal/ui/search-control.js.map +1 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +1 -2
- package/dist/puck-editor/internal/use-puck-overlay.js +6 -5
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -1
- package/dist/puck-editor/internal/utils.d.ts +0 -1
- package/dist/puck-editor/render.d.ts +2 -3
- package/dist/puck-editor/render.js +1 -1
- package/dist/puck-editor/render.js.map +1 -1
- package/dist/puck-editor/server.d.ts +3 -4
- package/dist/puck-editor/server.js +1 -1
- package/dist/puck-editor/server.js.map +1 -1
- package/dist/puck-editor/smart-actions.d.ts +1 -2
- package/dist/puck-editor/smart-actions.js +1 -1
- package/dist/puck-editor/smart-actions.js.map +1 -1
- package/dist/shared/cn.d.ts +0 -1
- package/dist/shared/i18n.d.ts +0 -1
- package/dist/shared/revalidate-path.d.ts +1 -0
- package/dist/shared/revalidate-path.js +2 -0
- package/dist/shared/revalidate-path.js.map +1 -0
- package/dist/shared/toolbar-action.d.ts +0 -1
- package/dist/shared/use-is-hydrated.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.js +1 -1
- package/dist/shared/use-is-in-iframe.js.map +1 -1
- package/dist/smart-actions/internal/assemble-smart-actions.d.ts +14 -0
- package/dist/smart-actions/internal/assemble-smart-actions.js +11 -0
- package/dist/smart-actions/internal/assemble-smart-actions.js.map +1 -0
- package/dist/smart-actions/internal/backend-edit-link.d.ts +6 -0
- package/dist/smart-actions/internal/backend-edit-link.js +60 -0
- package/dist/smart-actions/internal/backend-edit-link.js.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts +1 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js +2 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -1
- package/dist/smart-actions/internal/i18n.d.ts +1 -2
- package/dist/smart-actions/internal/i18n.js +16 -2
- package/dist/smart-actions/internal/i18n.js.map +1 -1
- package/dist/smart-actions/internal/logout-form.d.ts +2 -2
- package/dist/smart-actions/internal/logout-form.js +47 -40
- package/dist/smart-actions/internal/logout-form.js.map +1 -1
- package/dist/smart-actions/internal/refresh-page.d.ts +3 -2
- package/dist/smart-actions/internal/refresh-page.js +60 -53
- package/dist/smart-actions/internal/refresh-page.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts +22 -4
- package/dist/smart-actions/internal/smart-actions-button.js +36 -13
- package/dist/smart-actions/internal/smart-actions-button.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts +12 -4
- package/dist/smart-actions/internal/smart-actions-config.js +36 -80
- package/dist/smart-actions/internal/smart-actions-config.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +5 -11
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js +13 -53
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +4 -4
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/storage.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/types.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts +0 -1
- package/dist/smart-actions/internal/ui/tooltip.js +1 -1
- package/dist/smart-actions/internal/ui/tooltip.js.map +1 -1
- package/dist/smart-actions/internal/user-profile.d.ts +0 -1
- package/dist/smart-actions/internal/user-profile.js +71 -24
- package/dist/smart-actions/internal/user-profile.js.map +1 -1
- package/dist/smart-actions/server.d.ts +5 -4
- package/dist/smart-actions/server.js +2 -2
- package/dist/smart-actions/server.js.map +1 -1
- package/dist/theme.css +1 -1
- package/dist/visual-editor/index.d.ts +3 -4
- package/dist/visual-editor/index.js +3 -3
- package/dist/visual-editor/index.js.map +1 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts +4 -3
- package/dist/visual-editor/internal/bridge/connector.js +22 -21
- package/dist/visual-editor/internal/bridge/connector.js.map +1 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +5 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +7 -8
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +3 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js +4 -2
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -1
- package/dist/visual-editor/internal/i18n.d.ts +3 -2
- package/dist/visual-editor/internal/i18n.js +32 -4
- package/dist/visual-editor/internal/i18n.js.map +1 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +1 -7
- package/dist/visual-editor/internal/overlays/drupal-origin.js +16 -3
- package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts +5 -4
- package/dist/visual-editor/internal/overlays/edit-button.js +46 -44
- package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +12 -3
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +14 -5
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +4 -2
- package/dist/visual-editor/internal/overlays/node/node-metadata.js +10 -4
- package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +5 -3
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js +4 -2
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts +0 -1
- package/dist/visual-editor/internal/revalidate-route.js +1 -1
- package/dist/visual-editor/internal/revalidate-route.js.map +1 -1
- package/dist/visual-editor/server.d.ts +6 -7
- package/dist/visual-editor/server.js +6 -6
- package/dist/visual-editor/server.js.map +1 -1
- package/package.json +19 -3
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/internal/config.d.ts.map +0 -1
- package/dist/auth/internal/draft-mode.d.ts.map +0 -1
- package/dist/auth/internal/editor-locale.d.ts.map +0 -1
- package/dist/auth/internal/handoff.d.ts.map +0 -1
- package/dist/auth/internal/has-session.d.ts.map +0 -1
- package/dist/auth/internal/logout.d.ts.map +0 -1
- package/dist/auth/internal/next-cookie-storage.d.ts.map +0 -1
- package/dist/auth/internal/nodehive-client.d.ts.map +0 -1
- package/dist/auth/internal/oauth-config.d.ts.map +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts.map +0 -1
- package/dist/auth/internal/refresh.d.ts.map +0 -1
- package/dist/auth/internal/require-auth.d.ts.map +0 -1
- package/dist/auth/internal/return-to.d.ts.map +0 -1
- package/dist/auth/internal/routes/callback.d.ts.map +0 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts.map +0 -1
- package/dist/auth/internal/routes/draft.d.ts.map +0 -1
- package/dist/auth/internal/routes/index.d.ts.map +0 -1
- package/dist/auth/internal/routes/login.d.ts.map +0 -1
- package/dist/auth/internal/routes/popup-done.d.ts.map +0 -1
- package/dist/auth/internal/routes/refresh.d.ts.map +0 -1
- package/dist/auth/internal/same-origin.d.ts.map +0 -1
- package/dist/auth/internal/session-gates.d.ts.map +0 -1
- package/dist/auth/internal/update-session.d.ts.map +0 -1
- package/dist/auth/internal/use-editor-login.d.ts.map +0 -1
- package/dist/auth/proxy.d.ts.map +0 -1
- package/dist/auth/react.d.ts.map +0 -1
- package/dist/auth/routes.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/puck-editor/fields.d.ts.map +0 -1
- package/dist/puck-editor/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/client.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/config.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-params.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/space.d.ts.map +0 -1
- package/dist/puck-editor/internal/content-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/use-frame-zoom.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/i18n.d.ts.map +0 -1
- package/dist/puck-editor/internal/locale.d.ts.map +0 -1
- package/dist/puck-editor/internal/localize.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-wrapper.d.ts.map +0 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/popover.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/search-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +0 -1
- package/dist/puck-editor/internal/utils.d.ts.map +0 -1
- package/dist/puck-editor/render.d.ts.map +0 -1
- package/dist/puck-editor/server.d.ts.map +0 -1
- package/dist/puck-editor/smart-actions.d.ts.map +0 -1
- package/dist/shared/cn.d.ts.map +0 -1
- package/dist/shared/i18n.d.ts.map +0 -1
- package/dist/shared/toolbar-action.d.ts.map +0 -1
- package/dist/shared/use-is-hydrated.d.ts.map +0 -1
- package/dist/shared/use-is-in-iframe.d.ts.map +0 -1
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +0 -1
- package/dist/smart-actions/internal/i18n.d.ts.map +0 -1
- package/dist/smart-actions/internal/logout-form.d.ts.map +0 -1
- package/dist/smart-actions/internal/refresh-page.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +0 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts.map +0 -1
- package/dist/smart-actions/internal/user-profile.d.ts.map +0 -1
- package/dist/smart-actions/server.d.ts.map +0 -1
- package/dist/visual-editor/index.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +0 -1
- package/dist/visual-editor/internal/i18n.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts.map +0 -1
- package/dist/visual-editor/server.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":["c","_c","createContext","useContext","resolveDictionary","jsx","_jsx","en","common","clearSearch","back","defaultGroup","mediaSelector","selectMedia","addImage","addRemoteVideo","searchPlaceholder","search","mediaType","remoteVideo","noMediaFound","loadingMedia","page","uploadImage","uploadRemoteVideo","uploadVideo","uploading","name","chooseImage","maxFileSize","altText","videoUrl","cancel","imageTooLarge","uploadImageFailed","addRemoteVideoFailed","selectedCount","addSelected","refreshMedia","remove","templates","saveAsTemplate","saveDialogDescription","saveAsComponentTemplate","saveComponentDialogDescription","noTemplatesFound","editTemplate","editDialogDescription","deleteTemplate","deleteDialogDescription","aiOptions","aiDescription","aiInstructions","savedAsLabel","scopePage","scopeSection","save","saving","delete","deleting","saved","updated","deleted","saveFailed","unavailable","wrongZone","broken","brokenHint","insertFailed","partiallyInserted","collapse","expand","customPageTemplates","sections","noSectionsFound","customSections","blocks","noBlocksFound","addBlock","noBlockTarget","outline","empty","noElements","expandAll","collapseAll","rename","duplicate","addSection","noResults","canvas","emptyDescription","startWithTemplate","noPageTemplates","fields","media","date","selectDate","link","options","crop","title","editCrop","desktop","format","original","zoom","usesDesktop","defineOverride","removeOverride","removeCrop","apply","editor","savePageFailed","pageSaved","pageCreateFailed","requiredFieldsMissing","preview","edit","close","add","sectionsTab","blocksTab","templatesTab","outlineTab","agentTab","moveUp","moveDown","linkPicker","internal","external","anchor","all","externalPlaceholder","anchorPlaceholder","loading","loadFailed","linkTarget","editLink","addLink","updateLink","removeLink","otherAnchor","target","targetHelp","displayedText","linkMode","targetAuto","targetSelf","targetBlank","agent","connect","description","copied","copyPrompt","de","dictionaries","getPuckDictionary","locale","overrides","PuckI18nContext","PuckLocaleContext","PuckI18nProvider","t0","$","children","t1","t2","Provider","value","t3","usePuckDictionary","usePuckLocale"],"sources":["../../../src/puck-editor/internal/i18n.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport { resolveDictionary, type DictionaryOverrides } from '../../shared/i18n';\n\nconst en = {\n common: {\n clearSearch: 'Clear search',\n back: 'Back',\n defaultGroup: 'General',\n },\n mediaSelector: {\n selectMedia: 'Select Media',\n addImage: 'Add Image',\n addRemoteVideo: 'Add Remote Video',\n searchPlaceholder: 'Search media',\n search: 'Search',\n clearSearch: 'Clear search',\n mediaType: 'Media Type',\n remoteVideo: 'Remote Video',\n noMediaFound: 'No media found',\n loadingMedia: 'Loading media',\n page: 'Page',\n uploadImage: 'Upload Image',\n uploadRemoteVideo: 'Upload Remote Video',\n uploadVideo: 'Upload Video',\n uploading: 'Uploading...',\n name: 'Name',\n chooseImage: 'Choose Image',\n maxFileSize: 'max. 5MB',\n altText: 'Alt Text',\n videoUrl: 'Video URL (YouTube or Vimeo)',\n cancel: 'Cancel',\n imageTooLarge: 'Image is too large. Maximum file size is 5MB.',\n uploadImageFailed: 'Failed to upload image',\n addRemoteVideoFailed: 'Failed to add remote video',\n selectedCount: '{count} selected',\n addSelected: 'Add selection',\n refreshMedia: 'Refresh media',\n remove: 'Remove',\n },\n templates: {\n saveAsTemplate: 'Save as Page template',\n saveDialogDescription: 'Save the current page as a reusable Page template',\n saveAsComponentTemplate: 'Save as template',\n saveComponentDialogDescription:\n 'Save the selected component as a reusable template',\n searchPlaceholder: 'Search templates...',\n noTemplatesFound: 'No templates found',\n editTemplate: 'Edit template',\n editDialogDescription: 'Change the name and AI options of this template.',\n deleteTemplate: 'Delete template',\n deleteDialogDescription:\n 'Delete \"{title}\"? This cannot be undone. Pages that already use this template stay unchanged.',\n name: 'Name',\n aiOptions: 'AI options',\n aiDescription: 'AI description (optional)',\n aiInstructions: 'AI instructions (optional)',\n savedAsLabel: 'Will be saved as:',\n scopePage: 'Page template',\n scopeSection: 'Section template',\n cancel: 'Cancel',\n save: 'Save',\n saving: 'Saving...',\n delete: 'Delete',\n deleting: 'Deleting...',\n saved: 'Template saved',\n updated: 'Template updated',\n deleted: 'Template deleted',\n saveFailed: 'Failed to save template',\n unavailable: 'Template no longer available',\n wrongZone: 'This template does not belong in this area',\n broken: 'Broken templates',\n brokenHint: 'These templates could not be loaded and can only be deleted.',\n insertFailed: 'Could not insert template',\n partiallyInserted: '{skipped} of {total} elements could not be inserted',\n collapse: 'Collapse',\n expand: 'Expand',\n customPageTemplates: 'Custom page templates',\n },\n sections: {\n searchPlaceholder: 'Search sections...',\n noSectionsFound: 'No sections found',\n customSections: 'Custom sections',\n },\n blocks: {\n searchPlaceholder: 'Search blocks...',\n noBlocksFound: 'No blocks found',\n addBlock: 'Add block',\n noBlockTarget: 'Add a section first',\n },\n outline: {\n empty: 'Empty',\n noElements: 'No elements',\n expand: 'Expand',\n collapse: 'Collapse',\n expandAll: 'Expand all',\n collapseAll: 'Collapse all',\n rename: 'Rename',\n duplicate: 'Duplicate',\n delete: 'Delete',\n addSection: 'Add section',\n searchPlaceholder: 'Search elements …',\n noResults: 'No results',\n },\n canvas: {\n emptyDescription: 'Start from a page template or add a section.',\n startWithTemplate: 'Start with a template',\n noPageTemplates: 'No page templates available',\n },\n fields: {\n media: 'Media',\n date: 'Date',\n selectDate: 'Select date',\n link: 'Link',\n options: 'Options',\n },\n crop: {\n title: 'Image crop',\n editCrop: 'Edit crop',\n desktop: 'Desktop',\n format: 'Format',\n original: 'Original',\n zoom: 'Zoom',\n usesDesktop: 'This breakpoint uses the desktop crop.',\n defineOverride: 'Set custom crop',\n removeOverride: 'Remove override',\n removeCrop: 'Remove crop',\n cancel: 'Cancel',\n apply: 'Apply',\n },\n editor: {\n savePageFailed: 'Failed to save page',\n pageSaved: 'Successfully saved page',\n pageCreateFailed: 'Failed to create page',\n requiredFieldsMissing: 'Cannot publish: required fields are empty',\n save: 'Save',\n preview: 'Preview',\n edit: 'Edit',\n close: 'Close',\n add: 'Add',\n saveAsTemplate: 'Save as template',\n sectionsTab: 'Sections',\n blocksTab: 'Blocks',\n templatesTab: 'Pages',\n outlineTab: 'Structure',\n agentTab: 'Agent',\n moveUp: 'Move up',\n moveDown: 'Move down',\n },\n linkPicker: {\n internal: 'Internal',\n external: 'External',\n anchor: 'Anchor',\n all: 'All',\n searchPlaceholder: 'Search …',\n externalPlaceholder: 'https://… or mailto:…',\n anchorPlaceholder: '/page#anchor or https://…#anchor',\n loading: 'Loading …',\n loadFailed: 'Could not load links.',\n noResults: 'No results.',\n linkTarget: 'Link target',\n editLink: 'Edit link',\n addLink: 'Add link',\n updateLink: 'Update link',\n removeLink: 'Remove link',\n otherAnchor: 'Other …',\n target: 'Target',\n targetHelp:\n '«Automatic»: internal links open in the same window, external links in a new tab.',\n displayedText: 'Displayed text',\n linkMode: 'Link mode',\n targetAuto: 'Automatic',\n targetSelf: 'Same tab',\n targetBlank: 'New tab',\n },\n agent: {\n connect: 'Connect an agent',\n description:\n 'An agent with a browser tool can edit this page live through the window.puckAgent handle. Copy the prompt below and paste it to your agent to get started.',\n copied: 'Copied',\n copyPrompt: 'Copy prompt',\n },\n};\n\nconst de: PuckDictionary = {\n common: {\n clearSearch: 'Suche zurücksetzen',\n back: 'Zurück',\n defaultGroup: 'Allgemein',\n },\n mediaSelector: {\n selectMedia: 'Medien auswählen',\n addImage: 'Bild hinzufügen',\n addRemoteVideo: 'Remote-Video hinzufügen',\n searchPlaceholder: 'Medien suchen',\n search: 'Suchen',\n clearSearch: 'Suche zurücksetzen',\n mediaType: 'Medientyp',\n remoteVideo: 'Remote-Video',\n noMediaFound: 'Keine Medien gefunden',\n loadingMedia: 'Lädt Medien',\n page: 'Seite',\n uploadImage: 'Bild hochladen',\n uploadRemoteVideo: 'Remote-Video hochladen',\n uploadVideo: 'Video hochladen',\n uploading: 'Wird hochgeladen …',\n name: 'Name',\n chooseImage: 'Bild auswählen',\n maxFileSize: 'max. 5MB',\n altText: 'Alt-Text',\n videoUrl: 'Video-URL (YouTube oder Vimeo)',\n cancel: 'Abbrechen',\n imageTooLarge: 'Bild ist zu gross. Maximale Dateigrösse ist 5MB.',\n uploadImageFailed: 'Bild konnte nicht hochgeladen werden',\n addRemoteVideoFailed: 'Remote-Video konnte nicht hinzugefügt werden',\n selectedCount: '{count} ausgewählt',\n addSelected: 'Auswahl übernehmen',\n refreshMedia: 'Medien aktualisieren',\n remove: 'Entfernen',\n },\n templates: {\n saveAsTemplate: 'Seiten-Template speichern',\n saveDialogDescription:\n 'Speichert die aktuelle Seite als wiederverwendbares Seiten-Template',\n saveAsComponentTemplate: 'Als Vorlage speichern',\n saveComponentDialogDescription:\n 'Speichert die ausgewählte Komponente als wiederverwendbare Vorlage',\n searchPlaceholder: 'Seiten-Templates suchen …',\n noTemplatesFound: 'Keine Templates gefunden',\n editTemplate: 'Template bearbeiten',\n editDialogDescription: 'Passe Name und AI-Optionen dieser Vorlage an.',\n deleteTemplate: 'Template löschen',\n deleteDialogDescription:\n '\"{title}\" löschen? Das kann nicht rückgängig gemacht werden. Seiten, die dieses Template bereits verwenden, bleiben unverändert.',\n name: 'Name',\n aiOptions: 'AI-Optionen',\n aiDescription: 'AI-Beschreibung (optional)',\n aiInstructions: 'AI-Anweisungen (optional)',\n savedAsLabel: 'Wird gespeichert als:',\n scopePage: 'Seitenvorlage',\n scopeSection: 'Abschnitt-Vorlage',\n cancel: 'Abbrechen',\n save: 'Speichern',\n saving: 'Speichert …',\n delete: 'Löschen',\n deleting: 'Löscht …',\n saved: 'Template gespeichert',\n updated: 'Template aktualisiert',\n deleted: 'Template gelöscht',\n saveFailed: 'Template konnte nicht gespeichert werden',\n unavailable: 'Template nicht mehr verfügbar',\n wrongZone: 'Diese Vorlage gehört nicht in diesen Bereich',\n broken: 'Defekte Vorlagen',\n brokenHint:\n 'Diese Vorlagen konnten nicht geladen werden und können nur gelöscht werden.',\n insertFailed: 'Template konnte nicht eingefügt werden',\n partiallyInserted:\n '{skipped} von {total} Elementen konnten nicht eingefügt werden',\n collapse: 'Einklappen',\n expand: 'Ausklappen',\n customPageTemplates: 'Eigene Seitenvorlagen',\n },\n sections: {\n searchPlaceholder: 'Abschnitte suchen …',\n noSectionsFound: 'Keine Abschnitte gefunden',\n customSections: 'Eigene Abschnitte',\n },\n blocks: {\n searchPlaceholder: 'Blöcke suchen …',\n noBlocksFound: 'Keine Blöcke gefunden',\n addBlock: 'Block hinzufügen',\n noBlockTarget: 'Zuerst einen Abschnitt hinzufügen',\n },\n outline: {\n empty: 'Leer',\n noElements: 'Keine Elemente',\n expand: 'Ausklappen',\n collapse: 'Einklappen',\n expandAll: 'Alle ausklappen',\n collapseAll: 'Alle einklappen',\n rename: 'Umbenennen',\n duplicate: 'Duplizieren',\n delete: 'Löschen',\n addSection: 'Abschnitt hinzufügen',\n searchPlaceholder: 'Elemente suchen …',\n noResults: 'Keine Treffer',\n },\n canvas: {\n emptyDescription:\n 'Starte mit einer Seitenvorlage oder füge einen Abschnitt hinzu.',\n startWithTemplate: 'Mit Vorlage starten',\n noPageTemplates: 'Keine Seitenvorlagen verfügbar',\n },\n fields: {\n media: 'Medien',\n date: 'Datum',\n selectDate: 'Datum auswählen',\n link: 'Link',\n options: 'Optionen',\n },\n crop: {\n title: 'Bildausschnitt',\n editCrop: 'Bildausschnitt bearbeiten',\n desktop: 'Desktop',\n format: 'Format',\n original: 'Original',\n zoom: 'Zoom',\n usesDesktop: 'Dieser Breakpoint verwendet den Desktop-Ausschnitt.',\n defineOverride: 'Eigenen Ausschnitt festlegen',\n removeOverride: 'Override entfernen',\n removeCrop: 'Ausschnitt entfernen',\n cancel: 'Abbrechen',\n apply: 'Übernehmen',\n },\n editor: {\n savePageFailed: 'Seite konnte nicht gespeichert werden',\n pageSaved: 'Seite gespeichert',\n pageCreateFailed: 'Seite konnte nicht erstellt werden',\n requiredFieldsMissing:\n 'Publizieren nicht möglich: Pflichtfelder sind nicht ausgefüllt',\n save: 'Speichern',\n preview: 'Vorschau',\n edit: 'Bearbeiten',\n close: 'Schliessen',\n add: 'Hinzufügen',\n saveAsTemplate: 'Als Template speichern',\n sectionsTab: 'Abschnitte',\n blocksTab: 'Blöcke',\n templatesTab: 'Seiten',\n outlineTab: 'Struktur',\n agentTab: 'Agent',\n moveUp: 'Nach oben',\n moveDown: 'Nach unten',\n },\n linkPicker: {\n internal: 'Intern',\n external: 'Extern',\n anchor: 'Anker',\n all: 'Alle',\n searchPlaceholder: 'Suchen …',\n externalPlaceholder: 'https://… oder mailto:…',\n anchorPlaceholder: '/seite#anker oder https://…#anker',\n loading: 'Lädt …',\n loadFailed: 'Links konnten nicht geladen werden.',\n noResults: 'Keine Treffer.',\n linkTarget: 'Link-Ziel',\n editLink: 'Link bearbeiten',\n addLink: 'Link hinzufügen',\n updateLink: 'Link aktualisieren',\n removeLink: 'Link entfernen',\n otherAnchor: 'Andere …',\n target: 'Ziel',\n targetHelp:\n '«Automatisch»: interne Links öffnen im gleichen Fenster, externe Links in einem neuen Tab.',\n displayedText: 'Angezeigter Text',\n linkMode: 'Link-Modus',\n targetAuto: 'Automatisch',\n targetSelf: 'Gleicher Tab',\n targetBlank: 'Neuer Tab',\n },\n agent: {\n connect: 'Agent verbinden',\n description:\n 'Ein Agent mit Browser-Tool kann diese Seite live über den window.puckAgent-Handle bearbeiten. Kopiere den Prompt unten und übergib ihn deinem Agenten, um zu starten.',\n copied: 'Kopiert',\n copyPrompt: 'Prompt kopieren',\n },\n};\n\nexport type PuckDictionary = typeof en;\n\nexport type PuckDictionaryOverrides = DictionaryOverrides<PuckDictionary>;\n\nconst dictionaries: Record<string, PuckDictionary> = { en, de };\n\nexport function getPuckDictionary(\n locale: string,\n overrides?: PuckDictionaryOverrides\n): PuckDictionary {\n return resolveDictionary(dictionaries, en, locale, overrides);\n}\n\nconst PuckI18nContext = createContext<PuckDictionary>(en);\nconst PuckLocaleContext = createContext<string>('en');\n\nexport function PuckI18nProvider({\n locale,\n overrides,\n children,\n}: {\n locale: string;\n overrides?: PuckDictionaryOverrides;\n children: React.ReactNode;\n}) {\n return (\n <PuckLocaleContext.Provider value={locale}>\n <PuckI18nContext.Provider value={getPuckDictionary(locale, overrides)}>\n {children}\n </PuckI18nContext.Provider>\n </PuckLocaleContext.Provider>\n );\n}\n\nexport function usePuckDictionary(): PuckDictionary {\n return useContext(PuckI18nContext);\n}\n\nexport function usePuckLocale(): string {\n return useContext(PuckLocaleContext);\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AA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A,GAAAH,CAAA;EAAA;EAAA,IAAAM,EAAA;EAAA,IAAAN,CAAA,QAAAN,MAAA,IAAAM,CAAA,QAAAG,EAAA;IAH7BG,EAAA,gBAAAnK,IAAA,CAAA0J,iBAAA,CAAAO,QAAA;MAAmCV,KAAM,EAANA,MAAM;MAAAO,QAAA,EACvCE;IAE2B,CACD,CAAC;IAAAH,CAAA,MAAAN,MAAA;IAAAM,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAAA,OAJ7BM,EAI6B;AAAA;AAIjC,OAAO,SAAAC,kBAAA;EAAA,OACEvK,UAAU,CAAC4J,eAAe,CAAC;AAAA;AAGpC,OAAO,SAAAY,cAAA;EAAA,OACExK,UAAU,CAAC6J,iBAAiB,CAAC;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["c","_c","createContext","useContext","en","getPuckDictionary","jsx","_jsx","PuckI18nContext","PuckLocaleContext","PuckI18nProvider","t0","$","locale","overrides","children","t1","t2","Provider","value","t3","usePuckDictionary","usePuckLocale"],"sources":["../../../src/puck-editor/internal/i18n.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport {\n en,\n getPuckDictionary,\n type PuckDictionary,\n type PuckDictionaryOverrides,\n} from './dictionaries.ts';\n\nexport {\n getPuckDictionary,\n type PuckDictionary,\n type PuckDictionaryOverrides,\n} from './dictionaries.ts';\n\nconst PuckI18nContext = createContext<PuckDictionary>(en);\nconst PuckLocaleContext = createContext<string>('en');\n\nexport function PuckI18nProvider({\n locale,\n overrides,\n children,\n}: {\n locale: string;\n overrides?: PuckDictionaryOverrides;\n children: React.ReactNode;\n}) {\n return (\n <PuckLocaleContext.Provider value={locale}>\n <PuckI18nContext.Provider value={getPuckDictionary(locale, overrides)}>\n {children}\n </PuckI18nContext.Provider>\n </PuckLocaleContext.Provider>\n );\n}\n\nexport function usePuckDictionary(): PuckDictionary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A,CAAAS,QAAA;MAAmCL,KAAM,EAANA,MAAM;MAAAE,QAAA,EACvCE;IAE2B,CACD,CAAC;IAAAL,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAK,EAAA;IAAAL,CAAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAAA,OAJ7BQ,EAI6B;AAAA;AAIjC,OAAO,SAAAC,kBAAA;EAAA,OACElB,UAAU,CAACK,eAAe,CAAC;AAAA;AAGpC,OAAO,SAAAc,cAAA;EAAA,OACEnB,UAAU,CAACM,iBAAiB,CAAC;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from '@puckeditor/core';
|
|
2
|
-
import type { BuiltinTemplate } from './plugins/templates-plugin/templates';
|
|
2
|
+
import type { BuiltinTemplate } from './plugins/templates-plugin/templates.js';
|
|
3
3
|
export type PuckLabelCatalog = {
|
|
4
4
|
components?: Record<string, string>;
|
|
5
5
|
templates?: Record<string, string>;
|
|
@@ -8,4 +8,3 @@ export type PuckLabelCatalog = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function localizeConfig(config: Config, labels: PuckLabelCatalog): Config;
|
|
10
10
|
export declare function localizeTemplates(templates: BuiltinTemplate[], labels: PuckLabelCatalog): BuiltinTemplate[];
|
|
11
|
-
//# sourceMappingURL=localize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize.js","names":["localizeConfig","config","labels","components","Object","fromEntries","entries","map","type","component","label","pickerLabel","picker","metadata","categories","id","title","groups","visible","localizeTemplates","templates","template","name"],"sources":["../../../src/puck-editor/internal/localize.ts"],"sourcesContent":["import type { Config } from '@puckeditor/core';\n\nimport type { BuiltinTemplate } from './plugins/templates-plugin/templates';\n\nexport type PuckLabelCatalog = {\n components?: Record<string, string>;\n templates?: Record<string, string>;\n groups?: Record<string, string>;\n picker?: Record<string, string>;\n};\n\nexport function localizeConfig(\n config: Config,\n labels: PuckLabelCatalog\n): Config {\n const components = Object.fromEntries(\n Object.entries(config.components).map(([type, component]) => {\n const label = labels.components?.[type] ?? component.label;\n const pickerLabel = labels.picker?.[type];\n const metadata = pickerLabel\n ? {\n ...component.metadata,\n picker: { ...component.metadata?.picker, label: pickerLabel },\n }\n : component.metadata;\n return [type, { ...component, label, metadata }];\n })\n );\n\n const categories = { ...config.categories };\n for (const [id, title] of Object.entries(labels.groups ?? {})) {\n categories[id] =\n id in categories\n ? { ...categories[id], title }\n : { visible: false, title };\n }\n\n return { ...config, components, categories };\n}\n\nexport function localizeTemplates(\n templates: BuiltinTemplate[],\n labels: PuckLabelCatalog\n): BuiltinTemplate[] {\n return templates.map((template) => ({\n ...template,\n name: labels.templates?.[template.id] ?? template.name,\n }));\n}\n"],"mappings":"AAWA,OAAO,SAASA,cAAcA,CAC5BC,MAAc,EACdC,MAAwB,EAChB;EACR,MAAMC,UAAU,GAAGC,MAAM,CAACC,WAAW,CACnCD,MAAM,CAACE,OAAO,CAACL,MAAM,CAACE,UAAU,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,IAAI,EAAEC,SAAS,CAAC,KAAK;IAC3D,MAAMC,KAAK,GAAGR,MAAM,CAACC,UAAU,GAAGK,IAAI,CAAC,IAAIC,SAAS,CAACC,KAAK;IAC1D,MAAMC,WAAW,GAAGT,MAAM,CAACU,MAAM,GAAGJ,IAAI,CAAC;IACzC,MAAMK,QAAQ,GAAGF,WAAW,GACxB;MACE,GAAGF,SAAS,CAACI,QAAQ;MACrBD,MAAM,EAAE;QAAE,GAAGH,SAAS,CAACI,QAAQ,EAAED,MAAM;QAAEF,KAAK,EAAEC;MAAY;IAC9D,CAAC,GACDF,SAAS,CAACI,QAAQ;IACtB,OAAO,CAACL,IAAI,EAAE;MAAE,GAAGC,SAAS;MAAEC,KAAK;MAAEG;IAAS,CAAC,CAAC;EAClD,CAAC,CACH,CAAC;EAED,MAAMC,UAAU,GAAG;IAAE,GAAGb,MAAM,CAACa;EAAW,CAAC;EAC3C,KAAK,MAAM,CAACC,EAAE,EAAEC,KAAK,CAAC,IAAIZ,MAAM,CAACE,OAAO,CAACJ,MAAM,CAACe,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;IAC7DH,UAAU,CAACC,EAAE,CAAC,GACZA,EAAE,IAAID,UAAU,GACZ;MAAE,GAAGA,UAAU,CAACC,EAAE,CAAC;MAAEC;IAAM,CAAC,GAC5B;MAAEE,OAAO,EAAE,KAAK;MAAEF;IAAM,CAAC;EACjC;EAEA,OAAO;IAAE,GAAGf,MAAM;IAAEE,UAAU;IAAEW;EAAW,CAAC;AAC9C;AAEA,OAAO,SAASK,iBAAiBA,CAC/BC,SAA4B,EAC5BlB,MAAwB,EACL;EACnB,OAAOkB,SAAS,CAACb,GAAG,CAAEc,QAAQ,KAAM;IAClC,GAAGA,QAAQ;IACXC,IAAI,EAAEpB,MAAM,CAACkB,SAAS,GAAGC,QAAQ,CAACN,EAAE,CAAC,IAAIM,QAAQ,CAACC;EACpD,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"localize.js","names":["localizeConfig","config","labels","components","Object","fromEntries","entries","map","type","component","label","pickerLabel","picker","metadata","categories","id","title","groups","visible","localizeTemplates","templates","template","name"],"sources":["../../../src/puck-editor/internal/localize.ts"],"sourcesContent":["import type { Config } from '@puckeditor/core';\n\nimport type { BuiltinTemplate } from './plugins/templates-plugin/templates.ts';\n\nexport type PuckLabelCatalog = {\n components?: Record<string, string>;\n templates?: Record<string, string>;\n groups?: Record<string, string>;\n picker?: Record<string, string>;\n};\n\nexport function localizeConfig(\n config: Config,\n labels: PuckLabelCatalog\n): Config {\n const components = Object.fromEntries(\n Object.entries(config.components).map(([type, component]) => {\n const label = labels.components?.[type] ?? component.label;\n const pickerLabel = labels.picker?.[type];\n const metadata = pickerLabel\n ? {\n ...component.metadata,\n picker: { ...component.metadata?.picker, label: pickerLabel },\n }\n : component.metadata;\n return [type, { ...component, label, metadata }];\n })\n );\n\n const categories = { ...config.categories };\n for (const [id, title] of Object.entries(labels.groups ?? {})) {\n categories[id] =\n id in categories\n ? { ...categories[id], title }\n : { visible: false, title };\n }\n\n return { ...config, components, categories };\n}\n\nexport function localizeTemplates(\n templates: BuiltinTemplate[],\n labels: PuckLabelCatalog\n): BuiltinTemplate[] {\n return templates.map((template) => ({\n ...template,\n name: labels.templates?.[template.id] ?? template.name,\n }));\n}\n"],"mappings":"AAWA,OAAO,SAASA,cAAcA,CAC5BC,MAAc,EACdC,MAAwB,EAChB;EACR,MAAMC,UAAU,GAAGC,MAAM,CAACC,WAAW,CACnCD,MAAM,CAACE,OAAO,CAACL,MAAM,CAACE,UAAU,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,IAAI,EAAEC,SAAS,CAAC,KAAK;IAC3D,MAAMC,KAAK,GAAGR,MAAM,CAACC,UAAU,GAAGK,IAAI,CAAC,IAAIC,SAAS,CAACC,KAAK;IAC1D,MAAMC,WAAW,GAAGT,MAAM,CAACU,MAAM,GAAGJ,IAAI,CAAC;IACzC,MAAMK,QAAQ,GAAGF,WAAW,GACxB;MACE,GAAGF,SAAS,CAACI,QAAQ;MACrBD,MAAM,EAAE;QAAE,GAAGH,SAAS,CAACI,QAAQ,EAAED,MAAM;QAAEF,KAAK,EAAEC;MAAY;IAC9D,CAAC,GACDF,SAAS,CAACI,QAAQ;IACtB,OAAO,CAACL,IAAI,EAAE;MAAE,GAAGC,SAAS;MAAEC,KAAK;MAAEG;IAAS,CAAC,CAAC;EAClD,CAAC,CACH,CAAC;EAED,MAAMC,UAAU,GAAG;IAAE,GAAGb,MAAM,CAACa;EAAW,CAAC;EAC3C,KAAK,MAAM,CAACC,EAAE,EAAEC,KAAK,CAAC,IAAIZ,MAAM,CAACE,OAAO,CAACJ,MAAM,CAACe,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;IAC7DH,UAAU,CAACC,EAAE,CAAC,GACZA,EAAE,IAAID,UAAU,GACZ;MAAE,GAAGA,UAAU,CAACC,EAAE,CAAC;MAAEC;IAAM,CAAC,GAC5B;MAAEE,OAAO,EAAE,KAAK;MAAEF;IAAM,CAAC;EACjC;EAEA,OAAO;IAAE,GAAGf,MAAM;IAAEE,UAAU;IAAEW;EAAW,CAAC;AAC9C;AAEA,OAAO,SAASK,iBAAiBA,CAC/BC,SAA4B,EAC5BlB,MAAwB,EACL;EACnB,OAAOkB,SAAS,CAACb,GAAG,CAAEc,QAAQ,KAAM;IAClC,GAAGA,QAAQ;IACXC,IAAI,EAAEpB,MAAM,CAACkB,SAAS,GAAGC,QAAQ,CAACN,EAAE,CAAC,IAAIM,QAAQ,CAACC;EACpD,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Config
|
|
1
|
+
import { Config } from '@puckeditor/core';
|
|
2
|
+
import { PuckSaveHandler } from '../../editor/save-guard.js';
|
|
2
3
|
declare global {
|
|
3
4
|
interface Window {
|
|
4
5
|
puckAgent?: Record<string, unknown>;
|
|
@@ -16,6 +17,5 @@ declare global {
|
|
|
16
17
|
export declare function AgentBridge({ config, lang, onSave, }: {
|
|
17
18
|
config: Config;
|
|
18
19
|
lang?: string;
|
|
19
|
-
onSave?:
|
|
20
|
+
onSave?: PuckSaveHandler;
|
|
20
21
|
}): null;
|
|
21
|
-
//# sourceMappingURL=agent-bridge.d.ts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useEffect, useRef } from 'react';
|
|
5
5
|
import { createUsePuck } from '@puckeditor/core';
|
|
6
|
-
import { useBuiltinTemplates, usePuckContentModel, usePuckEditorConfig } from
|
|
6
|
+
import { useBuiltinTemplates, usePuckContentModel, usePuckEditorConfig, usePuckPropTransforms } from "../../editor-config.js";
|
|
7
7
|
import { applyPatchToPuck } from "./apply-patch-to-puck.js";
|
|
8
8
|
import { describeComponent, listComponents } from "./catalog.js";
|
|
9
9
|
import { PAGE_META_FIELDS } from "./constants.js";
|
|
@@ -23,7 +23,7 @@ const usePuck = createUsePuck();
|
|
|
23
23
|
* exposed methods never close over a stale first-render dispatch.
|
|
24
24
|
*/
|
|
25
25
|
export function AgentBridge(t0) {
|
|
26
|
-
const $ = _c(
|
|
26
|
+
const $ = _c(24);
|
|
27
27
|
const {
|
|
28
28
|
config,
|
|
29
29
|
lang,
|
|
@@ -31,14 +31,18 @@ export function AgentBridge(t0) {
|
|
|
31
31
|
} = t0;
|
|
32
32
|
const appState = usePuck(_temp);
|
|
33
33
|
const dispatch = usePuck(_temp2);
|
|
34
|
-
const
|
|
34
|
+
const {
|
|
35
|
+
templates,
|
|
36
|
+
media
|
|
37
|
+
} = usePuckContentModel();
|
|
35
38
|
const builtinTemplates = useBuiltinTemplates();
|
|
36
39
|
const {
|
|
37
40
|
drupalBaseUrl: t1
|
|
38
41
|
} = usePuckEditorConfig();
|
|
39
42
|
const drupalBaseUrl = t1 === undefined ? "" : t1;
|
|
43
|
+
const propTransforms = usePuckPropTransforms();
|
|
40
44
|
let t2;
|
|
41
|
-
if ($[0] !== appState || $[1] !== builtinTemplates || $[2] !== config || $[3] !== dispatch || $[4] !== drupalBaseUrl || $[5] !== lang || $[6] !==
|
|
45
|
+
if ($[0] !== appState || $[1] !== builtinTemplates || $[2] !== config || $[3] !== dispatch || $[4] !== drupalBaseUrl || $[5] !== lang || $[6] !== media || $[7] !== onSave || $[8] !== propTransforms || $[9] !== templates) {
|
|
42
46
|
t2 = {
|
|
43
47
|
appState,
|
|
44
48
|
dispatch,
|
|
@@ -46,8 +50,10 @@ export function AgentBridge(t0) {
|
|
|
46
50
|
lang,
|
|
47
51
|
onSave,
|
|
48
52
|
templates,
|
|
53
|
+
media,
|
|
49
54
|
builtinTemplates,
|
|
50
|
-
drupalBaseUrl
|
|
55
|
+
drupalBaseUrl,
|
|
56
|
+
propTransforms
|
|
51
57
|
};
|
|
52
58
|
$[0] = appState;
|
|
53
59
|
$[1] = builtinTemplates;
|
|
@@ -55,15 +61,17 @@ export function AgentBridge(t0) {
|
|
|
55
61
|
$[3] = dispatch;
|
|
56
62
|
$[4] = drupalBaseUrl;
|
|
57
63
|
$[5] = lang;
|
|
58
|
-
$[6] =
|
|
59
|
-
$[7] =
|
|
60
|
-
$[8] =
|
|
64
|
+
$[6] = media;
|
|
65
|
+
$[7] = onSave;
|
|
66
|
+
$[8] = propTransforms;
|
|
67
|
+
$[9] = templates;
|
|
68
|
+
$[10] = t2;
|
|
61
69
|
} else {
|
|
62
|
-
t2 = $[
|
|
70
|
+
t2 = $[10];
|
|
63
71
|
}
|
|
64
72
|
const live = useRef(t2);
|
|
65
73
|
let t3;
|
|
66
|
-
if ($[
|
|
74
|
+
if ($[11] !== appState || $[12] !== builtinTemplates || $[13] !== config || $[14] !== dispatch || $[15] !== drupalBaseUrl || $[16] !== lang || $[17] !== media || $[18] !== onSave || $[19] !== propTransforms || $[20] !== templates) {
|
|
67
75
|
t3 = () => {
|
|
68
76
|
live.current = {
|
|
69
77
|
appState,
|
|
@@ -72,26 +80,30 @@ export function AgentBridge(t0) {
|
|
|
72
80
|
lang,
|
|
73
81
|
onSave,
|
|
74
82
|
templates,
|
|
83
|
+
media,
|
|
75
84
|
builtinTemplates,
|
|
76
|
-
drupalBaseUrl
|
|
85
|
+
drupalBaseUrl,
|
|
86
|
+
propTransforms
|
|
77
87
|
};
|
|
78
88
|
};
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
89
|
+
$[11] = appState;
|
|
90
|
+
$[12] = builtinTemplates;
|
|
91
|
+
$[13] = config;
|
|
92
|
+
$[14] = dispatch;
|
|
93
|
+
$[15] = drupalBaseUrl;
|
|
94
|
+
$[16] = lang;
|
|
95
|
+
$[17] = media;
|
|
96
|
+
$[18] = onSave;
|
|
97
|
+
$[19] = propTransforms;
|
|
98
|
+
$[20] = templates;
|
|
99
|
+
$[21] = t3;
|
|
88
100
|
} else {
|
|
89
|
-
t3 = $[
|
|
101
|
+
t3 = $[21];
|
|
90
102
|
}
|
|
91
103
|
useEffect(t3);
|
|
92
104
|
let t4;
|
|
93
105
|
let t5;
|
|
94
|
-
if ($[
|
|
106
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
95
107
|
t4 = () => {
|
|
96
108
|
if (typeof window === "undefined") {
|
|
97
109
|
return;
|
|
@@ -102,13 +114,13 @@ export function AgentBridge(t0) {
|
|
|
102
114
|
listComponents: () => listComponents(get().config),
|
|
103
115
|
describeComponent: type => describeComponent(get().config, type),
|
|
104
116
|
getPage: () => data(),
|
|
105
|
-
listMedia: (type_0, query, limit, offset) => listMedia(get().lang, get().drupalBaseUrl, type_0, query, limit, offset),
|
|
117
|
+
listMedia: (type_0, query, limit, offset) => listMedia(get().lang, get().drupalBaseUrl, get().media, type_0, query, limit, offset),
|
|
106
118
|
uploadMedia: options => uploadMedia({
|
|
107
119
|
lang: get().lang,
|
|
108
120
|
...options
|
|
109
121
|
}),
|
|
110
122
|
listTemplates: () => listTemplates(get().templates, get().builtinTemplates),
|
|
111
|
-
insertTemplate: (id, dest) => insertTemplate(get().dispatch, data(), get().config, get().templates, get().builtinTemplates, id, dest),
|
|
123
|
+
insertTemplate: (id, dest) => insertTemplate(get().dispatch, data(), get().config, get().templates, get().builtinTemplates, id, dest, get().propTransforms),
|
|
112
124
|
addComponent: (type_1, options_0) => applyPatchToPuck(get().dispatch, data(), get().config, {
|
|
113
125
|
action: "add",
|
|
114
126
|
type: type_1,
|
|
@@ -161,10 +173,7 @@ export function AgentBridge(t0) {
|
|
|
161
173
|
};
|
|
162
174
|
}
|
|
163
175
|
console.info("[puckAgent] save \u2192 publishing current page");
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
ok: true
|
|
167
|
-
};
|
|
176
|
+
return persist(current);
|
|
168
177
|
}
|
|
169
178
|
};
|
|
170
179
|
window.puckAgent = Object.assign(window.puckAgent || {}, content);
|
|
@@ -179,11 +188,11 @@ export function AgentBridge(t0) {
|
|
|
179
188
|
};
|
|
180
189
|
};
|
|
181
190
|
t5 = [];
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
191
|
+
$[22] = t4;
|
|
192
|
+
$[23] = t5;
|
|
184
193
|
} else {
|
|
185
|
-
t4 = $[
|
|
186
|
-
t5 = $[
|
|
194
|
+
t4 = $[22];
|
|
195
|
+
t5 = $[23];
|
|
187
196
|
}
|
|
188
197
|
useEffect(t4, t5);
|
|
189
198
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-bridge.js","names":["c","_c","useEffect","useRef","createUsePuck","useBuiltinTemplates","usePuckContentModel","usePuckEditorConfig","applyPatchToPuck","describeComponent","listComponents","PAGE_META_FIELDS","listMedia","insertTemplate","listTemplates","uploadMedia","PAGE_META","Set","usePuck","AgentBridge","t0","$","config","lang","onSave","appState","_temp","dispatch","_temp2","templates","builtinTemplates","drupalBaseUrl","t1","undefined","t2","live","t3","current","t4","t5","Symbol","for","window","get","data","content","type","getPage","type_0","query","limit","offset","options","id","dest","addComponent","type_1","options_0","action","props","destinationId","destinationSlot","destinationIndex","updateComponent","id_0","newProps","removeComponent","id_1","setPageMeta","fields","clean","ignored","key","value","Object","entries","has","push","keys","length","ok","error","join","result","save","persist","console","info","puckAgent","assign","handle","key_0","s_0","s"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-bridge.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { Config, createUsePuck, Data, PuckAction } from '@puckeditor/core';\n\nimport {\n useBuiltinTemplates,\n usePuckContentModel,\n usePuckEditorConfig,\n} from '../../editor-config';\nimport { applyPatchToPuck } from './apply-patch-to-puck.ts';\nimport { describeComponent, listComponents } from './catalog.ts';\nimport { MediaType, PAGE_META_FIELDS } from './constants.ts';\nimport { listMedia } from './list-media.ts';\nimport {\n insertTemplate,\n listTemplates,\n TemplateDestination,\n} from './templates.ts';\nimport { uploadMedia } from './upload-media.ts';\n\ntype Dispatch = (action: PuckAction) => void;\n\ntype AddOptions = TemplateDestination & { props?: Record<string, unknown> };\n\nconst PAGE_META = new Set<string>(PAGE_META_FIELDS);\n\ndeclare global {\n interface Window {\n puckAgent?: Record<string, unknown>;\n }\n}\n\nconst usePuck = createUsePuck();\n\n/**\n * Mounts the mechanical `window.puckAgent` handle for a local agent driving the\n * editor via browser automation. Renders nothing. Only mounts inside the Puck\n * editor (already behind requireAuth). Edits are ephemeral dispatches until\n * save(), which persists through the same PATCH as the editor's Save button.\n *\n * Reads live appState/dispatch through a ref (updated every render) so the\n * exposed methods never close over a stale first-render dispatch.\n */\nexport function AgentBridge({\n config,\n lang,\n onSave,\n}: {\n config: Config;\n lang?: string;\n onSave?: (data: Partial<Data>) => Promise<void> | void;\n}) {\n const appState = usePuck((s) => s.appState);\n const dispatch = usePuck((s) => s.dispatch) as Dispatch;\n const templates = usePuckContentModel().templates;\n const builtinTemplates = useBuiltinTemplates();\n const { drupalBaseUrl = '' } = usePuckEditorConfig();\n\n const live = useRef({\n appState,\n dispatch,\n config,\n lang,\n onSave,\n templates,\n builtinTemplates,\n drupalBaseUrl,\n });\n useEffect(() => {\n live.current = {\n appState,\n dispatch,\n config,\n lang,\n onSave,\n templates,\n builtinTemplates,\n drupalBaseUrl,\n };\n });\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const get = () => live.current;\n const data = () => get().appState?.data as Data | undefined;\n\n // Content methods, attached to the shared handle (lifecycle methods\n // open/close/isOpen/isReady are owned by PuckWrapper and stay mounted).\n const content = {\n // Palette (aus der Config: was kann ich einsetzen)\n listComponents: () => listComponents(get().config),\n describeComponent: (type: string) =>\n describeComponent(get().config, type),\n // Dokument (was ist gerade auf der Seite)\n getPage: () => data(),\n // Assets\n listMedia: (\n type: string,\n query?: string,\n limit?: number,\n offset?: number\n ) =>\n listMedia(get().lang, get().drupalBaseUrl, type, query, limit, offset),\n uploadMedia: (options: {\n url: string;\n type?: MediaType;\n name?: string;\n alt?: string;\n }) => uploadMedia({ lang: get().lang, ...options }),\n // Templates\n listTemplates: () =>\n listTemplates(get().templates, get().builtinTemplates),\n insertTemplate: (id: string, dest?: TemplateDestination) =>\n insertTemplate(\n get().dispatch,\n data(),\n get().config,\n get().templates,\n get().builtinTemplates,\n id,\n dest\n ),\n // Writes (benannte Methoden, je ein Job)\n addComponent: (type: string, options?: AddOptions) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'add',\n type,\n props: options?.props,\n destinationId: options?.destinationId,\n destinationSlot: options?.destinationSlot,\n destinationIndex: options?.destinationIndex,\n }),\n updateComponent: (id: string, newProps: Record<string, unknown>) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'modify',\n id,\n newProps,\n }),\n removeComponent: (id: string) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'remove',\n id,\n }),\n setPageMeta: (fields: Record<string, unknown>) => {\n const clean: Record<string, unknown> = {};\n const ignored: string[] = [];\n for (const [key, value] of Object.entries(fields)) {\n if (PAGE_META.has(key)) {\n clean[key] = value;\n } else {\n ignored.push(key);\n }\n }\n if (!Object.keys(clean).length) {\n return {\n ok: false as const,\n error: `no known fields. Known: ${[...PAGE_META].join(', ')}`,\n };\n }\n const result = applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'setRoot',\n fields: clean,\n });\n return ignored.length && result.ok ? { ...result, ignored } : result;\n },\n // Persist — same human-gated PATCH as the editor's Save button.\n save: async () => {\n const persist = get().onSave;\n const current = data();\n if (!persist || !current) {\n return {\n ok: false as const,\n error: 'nothing to save: editor not ready',\n };\n }\n console.info('[puckAgent] save → publishing current page');\n await persist(current);\n return { ok: true as const };\n },\n };\n\n window.puckAgent = Object.assign(window.puckAgent || {}, content);\n\n return () => {\n const handle = window.puckAgent;\n if (!handle) return;\n for (const key of Object.keys(content)) delete handle[key];\n };\n }, []);\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C,EAAE3C,OAAO,CAAhD;MAAA,OAET;QACL,MAAA6C,MAAA,GAAehD,MAAM,CAAA8C,SAAU;QAC/B,IAAI,CAACE,MAAM;UAAA;QAAA;QACX,KAAK,MAAAC,KAAS,IAAIjB,MAAM,CAAAI,IAAK,CAACjC,OAAO,CAAC;UAAE,OAAO6C,MAAM,CAAClB,KAAG,CAAC;QAAA;MAAC,CAC5D;IAAA,CACF;IAAEjC,EAAA,KAAE;IAAAlB,CAAA,OAAAiB,EAAA;IAAAjB,CAAA,OAAAkB,EAAA;EAAA;IAAAD,EAAA,GAAAjB,CAAA;IAAAkB,EAAA,GAAAlB,CAAA;EAAA;EA5GLnB,SAAS,CAACoC,EA4GT,EAAEC,EAAE,CAAC;EAAA,OAEC,IAAI;AAAA;AApJN,SAAAX,OAAAgE,GAAA;EAAA,OAU2BC,GAAC,CAAAlE,QAAS;AAAA;AAVrC,SAAAD,MAAAmE,CAAA;EAAA,OAS2BA,CAAC,CAAApE,QAAS;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"agent-bridge.js","names":["c","_c","useEffect","useRef","createUsePuck","useBuiltinTemplates","usePuckContentModel","usePuckEditorConfig","usePuckPropTransforms","applyPatchToPuck","describeComponent","listComponents","PAGE_META_FIELDS","listMedia","insertTemplate","listTemplates","uploadMedia","PAGE_META","Set","usePuck","AgentBridge","t0","$","config","lang","onSave","appState","_temp","dispatch","_temp2","templates","media","builtinTemplates","drupalBaseUrl","t1","undefined","propTransforms","t2","live","t3","current","t4","t5","Symbol","for","window","get","data","content","type","getPage","type_0","query","limit","offset","options","id","dest","addComponent","type_1","options_0","action","props","destinationId","destinationSlot","destinationIndex","updateComponent","id_0","newProps","removeComponent","id_1","setPageMeta","fields","clean","ignored","key","value","Object","entries","has","push","keys","length","ok","error","join","result","save","persist","console","info","puckAgent","assign","handle","key_0","s_0","s"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-bridge.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { Config, createUsePuck, Data, PuckAction } from '@puckeditor/core';\n\nimport {\n useBuiltinTemplates,\n usePuckContentModel,\n usePuckEditorConfig,\n usePuckPropTransforms,\n} from '../../editor-config.tsx';\nimport { PuckSaveHandler } from '../../editor/save-guard.ts';\nimport { applyPatchToPuck } from './apply-patch-to-puck.ts';\nimport { describeComponent, listComponents } from './catalog.ts';\nimport { MediaType, PAGE_META_FIELDS } from './constants.ts';\nimport { listMedia } from './list-media.ts';\nimport {\n insertTemplate,\n listTemplates,\n TemplateDestination,\n} from './templates.ts';\nimport { uploadMedia } from './upload-media.ts';\n\ntype Dispatch = (action: PuckAction) => void;\n\ntype AddOptions = TemplateDestination & { props?: Record<string, unknown> };\n\nconst PAGE_META = new Set<string>(PAGE_META_FIELDS);\n\ndeclare global {\n interface Window {\n puckAgent?: Record<string, unknown>;\n }\n}\n\nconst usePuck = createUsePuck();\n\n/**\n * Mounts the mechanical `window.puckAgent` handle for a local agent driving the\n * editor via browser automation. Renders nothing. Only mounts inside the Puck\n * editor (already behind requireAuth). Edits are ephemeral dispatches until\n * save(), which persists through the same PATCH as the editor's Save button.\n *\n * Reads live appState/dispatch through a ref (updated every render) so the\n * exposed methods never close over a stale first-render dispatch.\n */\nexport function AgentBridge({\n config,\n lang,\n onSave,\n}: {\n config: Config;\n lang?: string;\n onSave?: PuckSaveHandler;\n}) {\n const appState = usePuck((s) => s.appState);\n const dispatch = usePuck((s) => s.dispatch) as Dispatch;\n const { templates, media } = usePuckContentModel();\n const builtinTemplates = useBuiltinTemplates();\n const { drupalBaseUrl = '' } = usePuckEditorConfig();\n const propTransforms = usePuckPropTransforms();\n\n const live = useRef({\n appState,\n dispatch,\n config,\n lang,\n onSave,\n templates,\n media,\n builtinTemplates,\n drupalBaseUrl,\n propTransforms,\n });\n useEffect(() => {\n live.current = {\n appState,\n dispatch,\n config,\n lang,\n onSave,\n templates,\n media,\n builtinTemplates,\n drupalBaseUrl,\n propTransforms,\n };\n });\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const get = () => live.current;\n const data = () => get().appState?.data as Data | undefined;\n\n // Content methods, attached to the shared handle (lifecycle methods\n // open/close/isOpen/isReady are owned by PuckWrapper and stay mounted).\n const content = {\n // Palette (aus der Config: was kann ich einsetzen)\n listComponents: () => listComponents(get().config),\n describeComponent: (type: string) =>\n describeComponent(get().config, type),\n // Dokument (was ist gerade auf der Seite)\n getPage: () => data(),\n // Assets\n listMedia: (\n type: string,\n query?: string,\n limit?: number,\n offset?: number\n ) =>\n listMedia(\n get().lang,\n get().drupalBaseUrl,\n get().media,\n type,\n query,\n limit,\n offset\n ),\n uploadMedia: (options: {\n url: string;\n type?: MediaType;\n name?: string;\n alt?: string;\n }) => uploadMedia({ lang: get().lang, ...options }),\n // Templates\n listTemplates: () =>\n listTemplates(get().templates, get().builtinTemplates),\n insertTemplate: (id: string, dest?: TemplateDestination) =>\n insertTemplate(\n get().dispatch,\n data(),\n get().config,\n get().templates,\n get().builtinTemplates,\n id,\n dest,\n get().propTransforms\n ),\n // Writes (benannte Methoden, je ein Job)\n addComponent: (type: string, options?: AddOptions) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'add',\n type,\n props: options?.props,\n destinationId: options?.destinationId,\n destinationSlot: options?.destinationSlot,\n destinationIndex: options?.destinationIndex,\n }),\n updateComponent: (id: string, newProps: Record<string, unknown>) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'modify',\n id,\n newProps,\n }),\n removeComponent: (id: string) =>\n applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'remove',\n id,\n }),\n setPageMeta: (fields: Record<string, unknown>) => {\n const clean: Record<string, unknown> = {};\n const ignored: string[] = [];\n for (const [key, value] of Object.entries(fields)) {\n if (PAGE_META.has(key)) {\n clean[key] = value;\n } else {\n ignored.push(key);\n }\n }\n if (!Object.keys(clean).length) {\n return {\n ok: false as const,\n error: `no known fields. Known: ${[...PAGE_META].join(', ')}`,\n };\n }\n const result = applyPatchToPuck(get().dispatch, data(), get().config, {\n action: 'setRoot',\n fields: clean,\n });\n return ignored.length && result.ok ? { ...result, ignored } : result;\n },\n // Persist — same human-gated PATCH as the editor's Save button.\n save: async () => {\n const persist = get().onSave;\n const current = data();\n if (!persist || !current) {\n return {\n ok: false as const,\n error: 'nothing to save: editor not ready',\n };\n }\n console.info('[puckAgent] save → publishing current page');\n return persist(current);\n },\n };\n\n window.puckAgent = Object.assign(window.puckAgent || {}, content);\n\n return () => {\n const handle = window.puckAgent;\n if (!handle) return;\n for (const key of Object.keys(content)) delete handle[key];\n };\n }, []);\n\n return null;\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAAiBC,aAAa,QAA0B,kBAAkB;AAE1E,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,mBAAmB,EACnBC,qBAAqB,QAChB,wBAAyB;AAEhC,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,iBAAiB,EAAEC,cAAc,QAAQ,cAAc;AAChE,SAAoBC,gBAAgB,QAAQ,gBAAgB;AAC5D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACEC,cAAc,EACdC,aAAa,QAER,gBAAgB;AACvB,SAASC,WAAW,QAAQ,mBAAmB;AAM/C,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAASN,gBAAgB,CAAC;AAQnD,MAAMO,OAAO,GAAGf,aAAa,CAAC,CAAC;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAAgB,YAAAC,EAAA;EAAA,MAAAC,CAAA,GAAArB,EAAA;EAAqB;IAAAsB,MAAA;IAAAC,IAAA;IAAAC;EAAA,IAAAJ,EAQ3B;EACC,MAAAK,QAAA,GAAiBP,OAAO,CAACQ,KAAiB,CAAC;EAC3C,MAAAC,QAAA,GAAiBT,OAAO,CAACU,MAAiB,C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jKN,SAAAb,OAAAkE,GAAA;EAAA,OAU2BC,GAAC,CAAApE,QAAS;AAAA;AAVrC,SAAAD,MAAAqE,CAAA;EAAA,OAS2BA,CAAC,CAAAtE,QAAS;AAAA","ignoreList":[]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { CheckIcon, CopyIcon } from 'lucide-react';
|
|
6
|
-
import { usePuckDictionary } from
|
|
7
|
-
import { IconButton } from
|
|
6
|
+
import { usePuckDictionary } from "../../i18n.js";
|
|
7
|
+
import { IconButton } from "../../ui/icon-button.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
function buildPrompt(pageUrl) {
|
|
10
10
|
return `Use a browser tool that can run JavaScript to open this page:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-info-panel.js","names":["c","_c","useState","CheckIcon","CopyIcon","usePuckDictionary","IconButton","jsx","_jsx","jsxs","_jsxs","buildPrompt","pageUrl","AgentInfoPanel","$","t","agent","window","location","origin","pathname","t0","Symbol","for","prompt","copied","setCopied","t1","navigator","clipboard","writeText","setTimeout","copyPrompt","t2","connect","className","children","t3","description","t4","t5","t6","t7","t8","t9"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-info-panel.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\n\nimport { usePuckDictionary } from '../../i18n';\nimport { IconButton } from '../../ui/icon-button';\n\nfunction buildPrompt(pageUrl: string) {\n return `Use a browser tool that can run JavaScript to open this page:\n${pageUrl}\n\nIn the page, run: window.puckAgent.help() to list the options that are available to you.`;\n}\n\nexport function AgentInfoPanel() {\n const t = usePuckDictionary().agent;\n const pageUrl =\n typeof window !== 'undefined'\n ? window.location.origin + window.location.pathname\n : 'the current page';\n const prompt = buildPrompt(pageUrl);\n const [copied, setCopied] = useState(false);\n\n const copyPrompt = async () => {\n try {\n await navigator.clipboard.writeText(prompt);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch {\n // ponytail: clipboard blocked (insecure context / denied); no-op\n }\n };\n\n return (\n <div className=\"nh:flex nh:flex-col nh:gap-4 nh:p-4 nh:text-sm\">\n <div>\n <p className=\"nh:font-medium\">{t.connect}</p>\n <p className=\"nh:text-gray-500\">{t.description}</p>\n </div>\n\n <div className=\"nh:relative\">\n <pre className=\"nh:max-h-80 nh:overflow-auto nh:rounded-md nh:bg-slate-900 nh:p-3 nh:pr-12 nh:text-xs nh:whitespace-pre-wrap nh:text-slate-50\">\n <code>{prompt}</code>\n </pre>\n <IconButton\n onClick={copyPrompt}\n aria-label={copied ? t.copied : t.copyPrompt}\n className=\"nh:absolute nh:top-2 nh:right-2 nh:rounded-full nh:bg-white/10 nh:px-2 nh:py-1 nh:text-slate-50 nh:hover:bg-white/20 nh:hover:text-slate-50\"\n >\n {copied ? (\n <CheckIcon className=\"nh:size-4\" />\n ) : (\n <CopyIcon className=\"nh:size-4\" />\n )}\n </IconButton>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,cAAc;AAElD,SAASC,iBAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"agent-info-panel.js","names":["c","_c","useState","CheckIcon","CopyIcon","usePuckDictionary","IconButton","jsx","_jsx","jsxs","_jsxs","buildPrompt","pageUrl","AgentInfoPanel","$","t","agent","window","location","origin","pathname","t0","Symbol","for","prompt","copied","setCopied","t1","navigator","clipboard","writeText","setTimeout","copyPrompt","t2","connect","className","children","t3","description","t4","t5","t6","t7","t8","t9"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-info-panel.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { CheckIcon, CopyIcon } from 'lucide-react';\n\nimport { usePuckDictionary } from '../../i18n.tsx';\nimport { IconButton } from '../../ui/icon-button.tsx';\n\nfunction buildPrompt(pageUrl: string) {\n return `Use a browser tool that can run JavaScript to open this page:\n${pageUrl}\n\nIn the page, run: window.puckAgent.help() to list the options that are available to you.`;\n}\n\nexport function AgentInfoPanel() {\n const t = usePuckDictionary().agent;\n const pageUrl =\n typeof window !== 'undefined'\n ? window.location.origin + window.location.pathname\n : 'the current page';\n const prompt = buildPrompt(pageUrl);\n const [copied, setCopied] = useState(false);\n\n const copyPrompt = async () => {\n try {\n await navigator.clipboard.writeText(prompt);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n } catch {\n // ponytail: clipboard blocked (insecure context / denied); no-op\n }\n };\n\n return (\n <div className=\"nh:flex nh:flex-col nh:gap-4 nh:p-4 nh:text-sm\">\n <div>\n <p className=\"nh:font-medium\">{t.connect}</p>\n <p className=\"nh:text-gray-500\">{t.description}</p>\n </div>\n\n <div className=\"nh:relative\">\n <pre className=\"nh:max-h-80 nh:overflow-auto nh:rounded-md nh:bg-slate-900 nh:p-3 nh:pr-12 nh:text-xs nh:whitespace-pre-wrap nh:text-slate-50\">\n <code>{prompt}</code>\n </pre>\n <IconButton\n onClick={copyPrompt}\n aria-label={copied ? t.copied : t.copyPrompt}\n className=\"nh:absolute nh:top-2 nh:right-2 nh:rounded-full nh:bg-white/10 nh:px-2 nh:py-1 nh:text-slate-50 nh:hover:bg-white/20 nh:hover:text-slate-50\"\n >\n {copied ? (\n <CheckIcon className=\"nh:size-4\" />\n ) : (\n <CopyIcon className=\"nh:size-4\" />\n )}\n </IconButton>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,CAAA,IAAAC,EAAA;AAEb,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,cAAc;AAElD,SAASC,iBAAiB,QAAQ,eAAgB;AAClD,SAASC,U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,SAAW,EAAX;IAAW,CAGlC,CAAC,gBAJA3B,IAAA,CAGEJ,QAAQ;MAAW+B,SAAW,EAAX;IAAW,CACjC,CAAC;IAAArB,CAAA,OAAAW,MAAA;IAAAX,CAAA,OAAA4B,EAAA;EAAA;IAAAA,EAAA,GAAA5B,CAAA;EAAA;EAAA,IAAA6B,EAAA;EAAA,IAAA7B,CAAA,SAAA2B,EAAA,IAAA3B,CAAA,SAAA4B,EAAA;IAbLC,EAAA,gBAAAjC,KAAA;MAAeyB,SAAa,EAAb,aAAa;MAAAC,QAAA,GAC1BI,EAEM,eACNhC,IAAA,CAACF,UAAU;QACA0B,OAAU,EAAVA,UAAU;QACP,cAAAS,EAAgC;QAClCN,SAA6I,EAA7I,6IAA6I;QAAAC,QAAA,EAEtJM;MAIA,CACS,CAAC;IAAA,CACV,CAAC;IAAA5B,CAAA,OAAA2B,EAAA;IAAA3B,CAAA,OAAA4B,EAAA;IAAA5B,CAAA,OAAA6B,EAAA;EAAA;IAAAA,EAAA,GAAA7B,CAAA;EAAA;EAAA,IAAA8B,EAAA;EAAA,IAAA9B,CAAA,SAAAyB,EAAA,IAAAzB,CAAA,SAAA6B,EAAA;IArBRC,EAAA,gBAAAlC,KAAA;MAAeyB,SAAgD,EAAhD,gDAAgD;MAAAC,QAAA,GAC7DG,EAGM,EAENI,EAeM;IAAA,CACH,CAAC;IAAA7B,CAAA,OAAAyB,EAAA;IAAAzB,CAAA,OAAA6B,EAAA;IAAA7B,CAAA,OAAA8B,EAAA;EAAA;IAAAA,EAAA,GAAA9B,CAAA;EAAA;EAAA,OAtBN8B,EAsBM;AAAA","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Config,
|
|
1
|
+
import { Config, Plugin } from '@puckeditor/core';
|
|
2
|
+
import { PuckSaveHandler } from '../../editor/save-guard.js';
|
|
2
3
|
/**
|
|
3
4
|
* Puck plugin that hosts the local-agent bridge. Always registered; the
|
|
4
5
|
* wrapper-level handle (open/close/help via useAgentHandle) attaches for
|
|
@@ -14,7 +15,6 @@ import { Config, Data, Plugin } from '@puckeditor/core';
|
|
|
14
15
|
export declare function createAgentPlugin({ config, lang, onSave, label, }: {
|
|
15
16
|
config: Config;
|
|
16
17
|
lang?: string;
|
|
17
|
-
onSave?:
|
|
18
|
+
onSave?: PuckSaveHandler;
|
|
18
19
|
label?: string;
|
|
19
20
|
}): Plugin;
|
|
20
|
-
//# sourceMappingURL=agent-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-plugin.js","names":["BotIcon","AgentBridge","AgentInfoPanel","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","createAgentPlugin","config","lang","onSave","label","name","icon","className","render","overrides","puck","children"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-plugin.tsx"],"sourcesContent":["'use client';\n\nimport { Config,
|
|
1
|
+
{"version":3,"file":"agent-plugin.js","names":["BotIcon","AgentBridge","AgentInfoPanel","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","createAgentPlugin","config","lang","onSave","label","name","icon","className","render","overrides","puck","children"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/agent-plugin.tsx"],"sourcesContent":["'use client';\n\nimport { Config, Plugin } from '@puckeditor/core';\nimport { BotIcon } from 'lucide-react';\n\nimport { PuckSaveHandler } from '../../editor/save-guard.ts';\nimport { AgentBridge } from './agent-bridge.tsx';\nimport { AgentInfoPanel } from './agent-info-panel.tsx';\n\n/**\n * Puck plugin that hosts the local-agent bridge. Always registered; the\n * wrapper-level handle (open/close/help via useAgentHandle) attaches for\n * logged-in editors, so `window.puckAgent` exists only during an editor session.\n *\n * The bridge mounts via the `puck` override (wraps the whole editor UI), so the\n * content methods are active whenever the plugin is installed — independent of\n * whether the Agent panel/tab is open. The `render` panel only shows the\n * copy-paste agent prompt. The lifecycle methods (open/close/isOpen/isReady/\n * createPage) live in useAgentHandle because open() must work before the editor\n * (and thus this plugin) mounts.\n */\nexport function createAgentPlugin({\n config,\n lang,\n onSave,\n label,\n}: {\n config: Config;\n lang?: string;\n onSave?: PuckSaveHandler;\n label?: string;\n}): Plugin {\n return {\n name: 'agent',\n label: label ?? 'Agent',\n icon: <BotIcon className=\"nh:size-6\" />,\n render: () => <AgentInfoPanel />,\n overrides: {\n puck: ({ children }) => (\n <>\n {children}\n <AgentBridge config={config} lang={lang} onSave={onSave} />\n </>\n ),\n },\n };\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,OAAO,QAAQ,cAAc;AAGtC,SAASC,WAAW,QAAQ,mBAAoB;AAChD,SAASC,cAAc,QAAQ,uBAAwB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAYA,OAAO,SAASC,iBAAiBA,CAAC;EAChCC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC;AAMF,CAAC,EAAU;EACT,OAAO;IACLC,IAAI,EAAE,OAAO;IACbD,KAAK,EAAEA,KAAK,IAAI,OAAO;IACvBE,IAAI,eAAEX,IAAA,CAACJ,OAAO;MAACgB,SAAS,EAAC;IAAW,CAAE,CAAC;IACvCC,MAAM,EAAEA,CAAA,kBAAMb,IAAA,CAACF,cAAc,IAAE,CAAC;IAChCgB,SAAS,EAAE;MACTC,IAAI,EAAEA,CAAC;QAAEC;MAAS,CAAC,kBACjBZ,KAAA,CAAAF,SAAA;QAAAc,QAAA,GACGA,QAAQ,eACThB,IAAA,CAACH,WAAW;UAACS,MAAM,EAAEA,MAAO;UAACC,IAAI,EAAEA,IAAK;UAACC,MAAM,EAAEA;QAAO,CAAE,CAAC;MAAA,CAC3D;IAEN;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { appendComponents, generateTemplateIds } from
|
|
1
|
+
import { appendComponents, generateTemplateIds } from "../../utils.js";
|
|
2
2
|
import { isSectionType } from "../outline-plugin/outline-tree.js";
|
|
3
3
|
import { findComponentLocation, getZoneLength, ROOT_ZONE } from "./find-component-location.js";
|
|
4
4
|
const rootRejects = type => `only section-type components are allowed at the page root; "${type}" is not one`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-patch-to-puck.js","names":["appendComponents","generateTemplateIds","isSectionType","findComponentLocation","getZoneLength","ROOT_ZONE","rootRejects","type","slotAllows","config","parentType","slot","childType","field","components","fields","Array","isArray","allow","includes","disallow","resolveZone","destinationId","destinationSlot","applyPatchToPuck","dispatch","data","patch","ok","error","action","parent","component","zone","props","defaultProps","id","index","destinationIndex","destinationZone","offending","find","c","ids","map","loc","newProps","root"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.ts"],"sourcesContent":["import type { ComponentData, Config, Data, PuckAction } from '@puckeditor/core';\n\nimport { appendComponents, generateTemplateIds } from '../../utils';\nimport { isSectionType } from '../outline-plugin/outline-tree.ts';\nimport {\n findComponentLocation,\n getZoneLength,\n ROOT_ZONE,\n} from './find-component-location.ts';\n\nconst rootRejects = (type: string): string =>\n `only section-type components are allowed at the page root; \"${type}\" is not one`;\n\ntype Dispatch = (action: PuckAction) => void;\n\n/**\n * Whether a slot field on `parentType` permits `childType`, per the config's\n * allow/disallow. Enforced deterministically so callers can't build an invalid\n * tree — no need to document \"respect slot rules\". Unknown parent/slot → allowed\n * (let Puck decide).\n */\nfunction slotAllows(\n config: Config,\n parentType: string,\n slot: string,\n childType: string\n): boolean {\n const field = config.components?.[parentType]?.fields?.[slot] as\n { type?: string; allow?: string[]; disallow?: string[] } | undefined;\n if (!field || field.type !== 'slot') return true;\n if (Array.isArray(field.allow)) return field.allow.includes(childType);\n if (Array.isArray(field.disallow)) return !field.disallow.includes(childType);\n return true;\n}\n\n/**\n * Internal patch shape the engine translates into live Puck dispatches. The\n * public handle exposes named methods (addComponent/updateComponent/...) that\n * build these; `addMany` is internal only (template insertion).\n */\nexport type PatchResult =\n { ok: true; id?: string; ids?: string[] } | { ok: false; error: string };\n\nexport type EnginePatch =\n | {\n action: 'add';\n type: string;\n props?: Record<string, unknown>;\n destinationId?: string;\n destinationSlot?: string;\n destinationIndex?: number;\n }\n | {\n action: 'addMany';\n components: ComponentData[];\n destinationZone?: string;\n destinationIndex?: number;\n }\n | { action: 'modify'; id: string; newProps: Record<string, unknown> }\n | { action: 'remove'; id: string }\n | { action: 'setRoot'; fields: Record<string, unknown> };\n\nconst resolveZone = (\n destinationId?: string,\n destinationSlot?: string\n): string =>\n destinationId && destinationSlot\n ? `${destinationId}:${destinationSlot}`\n : ROOT_ZONE;\n\n/**\n * Translate a single patch into live Puck store dispatches (the only path that\n * re-renders the editor). Returns a structured result so a driving agent can\n * tell success from failure without re-reading the page.\n */\nexport function applyPatchToPuck(\n dispatch: Dispatch,\n data: Data | undefined,\n config: Config,\n patch: EnginePatch\n): PatchResult {\n if (!data) return { ok: false, error: 'editor not ready: no page data' };\n\n switch (patch.action) {\n case 'add': {\n if (!config.components[patch.type]) {\n return { ok: false, error: `unknown component type \"${patch.type}\"` };\n }\n if (!patch.destinationId !== !patch.destinationSlot) {\n return {\n ok: false,\n error: 'destinationId and destinationSlot are required together',\n };\n }\n if (patch.destinationId && patch.destinationSlot) {\n const parent = findComponentLocation(\n data,\n config,\n patch.destinationId\n )?.component;\n if (!parent) {\n return {\n ok: false,\n error: `destination \"${patch.destinationId}\" not found`,\n };\n }\n if (\n !slotAllows(config, parent.type, patch.destinationSlot, patch.type)\n ) {\n return {\n ok: false,\n error: `\"${patch.type}\" is not allowed in ${parent.type}.${patch.destinationSlot}`,\n };\n }\n }\n const zone = resolveZone(patch.destinationId, patch.destinationSlot);\n if (zone === ROOT_ZONE && !isSectionType(config, patch.type)) {\n return { ok: false, error: rootRejects(patch.type) };\n }\n // generateTemplateIds regenerates ids for the component and any nested\n // children — the caller can never set or collide an id.\n const [component] = generateTemplateIds(\n [\n {\n type: patch.type,\n props: {\n ...config.components[patch.type]?.defaultProps,\n ...patch.props,\n id: '',\n },\n } as ComponentData,\n ],\n config\n );\n const index = patch.destinationIndex ?? getZoneLength(data, config, zone);\n appendComponents(dispatch, zone, index, [component]);\n return { ok: true, id: component.props.id as string };\n }\n case 'addMany': {\n const zone = patch.destinationZone || ROOT_ZONE;\n if (zone === ROOT_ZONE) {\n const offending = patch.components.find(\n (c) => !isSectionType(config, c.type)\n );\n if (offending) {\n return { ok: false, error: rootRejects(offending.type) };\n }\n }\n const index = patch.destinationIndex ?? getZoneLength(data, config, zone);\n appendComponents(dispatch, zone, index, patch.components);\n return {\n ok: true,\n ids: patch.components.map((c) => c.props.id as string),\n };\n }\n case 'modify': {\n const loc = findComponentLocation(data, config, patch.id);\n if (!loc) {\n return { ok: false, error: `id \"${patch.id}\" not found` };\n }\n dispatch({\n type: 'replace',\n destinationZone: loc.zone,\n destinationIndex: loc.index,\n data: {\n ...loc.component,\n props: { ...loc.component.props, ...patch.newProps, id: patch.id },\n },\n });\n return { ok: true, id: patch.id };\n }\n case 'remove': {\n const loc = findComponentLocation(data, config, patch.id);\n if (!loc) {\n return { ok: false, error: `id \"${patch.id}\" not found` };\n }\n dispatch({ type: 'remove', zone: loc.zone, index: loc.index });\n return { ok: true, id: patch.id };\n }\n case 'setRoot': {\n dispatch({\n type: 'replaceRoot',\n root: {\n ...(data.root || { props: {} }),\n props: { ...(data.root?.props || {}), ...patch.fields },\n },\n });\n return { ok: true };\n }\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,mBAAmB,QAAQ,aAAa;AACnE,SAASC,aAAa,QAAQ,mCAAmC;AACjE,SACEC,qBAAqB,EACrBC,aAAa,EACbC,SAAS,QACJ,8BAA8B;AAErC,MAAMC,WAAW,GAAIC,IAAY,IAC/B,+DAA+DA,IAAI,cAAc;AAInF;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CACjBC,MAAc,EACdC,UAAkB,EAClB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xD;QACF,CAAC,CAAC;QACF,OAAO;UAAEa,EAAE,EAAE;QAAK,CAAC;MACrB;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"apply-patch-to-puck.js","names":["appendComponents","generateTemplateIds","isSectionType","findComponentLocation","getZoneLength","ROOT_ZONE","rootRejects","type","slotAllows","config","parentType","slot","childType","field","components","fields","Array","isArray","allow","includes","disallow","resolveZone","destinationId","destinationSlot","applyPatchToPuck","dispatch","data","patch","ok","error","action","parent","component","zone","props","defaultProps","id","index","destinationIndex","destinationZone","offending","find","c","ids","map","loc","newProps","root"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.ts"],"sourcesContent":["import type { ComponentData, Config, Data, PuckAction } from '@puckeditor/core';\n\nimport { appendComponents, generateTemplateIds } from '../../utils.ts';\nimport { isSectionType } from '../outline-plugin/outline-tree.ts';\nimport {\n findComponentLocation,\n getZoneLength,\n ROOT_ZONE,\n} from './find-component-location.ts';\n\nconst rootRejects = (type: string): string =>\n `only section-type components are allowed at the page root; \"${type}\" is not one`;\n\ntype Dispatch = (action: PuckAction) => void;\n\n/**\n * Whether a slot field on `parentType` permits `childType`, per the config's\n * allow/disallow. Enforced deterministically so callers can't build an invalid\n * tree — no need to document \"respect slot rules\". Unknown parent/slot → allowed\n * (let Puck decide).\n */\nfunction slotAllows(\n config: Config,\n parentType: string,\n slot: string,\n childType: string\n): boolean {\n const field = config.components?.[parentType]?.fields?.[slot] as\n { type?: string; allow?: string[]; disallow?: string[] } | undefined;\n if (!field || field.type !== 'slot') return true;\n if (Array.isArray(field.allow)) return field.allow.includes(childType);\n if (Array.isArray(field.disallow)) return !field.disallow.includes(childType);\n return true;\n}\n\n/**\n * Internal patch shape the engine translates into live Puck dispatches. The\n * public handle exposes named methods (addComponent/updateComponent/...) that\n * build these; `addMany` is internal only (template insertion).\n */\nexport type PatchResult =\n { ok: true; id?: string; ids?: string[] } | { ok: false; error: string };\n\nexport type EnginePatch =\n | {\n action: 'add';\n type: string;\n props?: Record<string, unknown>;\n destinationId?: string;\n destinationSlot?: string;\n destinationIndex?: number;\n }\n | {\n action: 'addMany';\n components: ComponentData[];\n destinationZone?: string;\n destinationIndex?: number;\n }\n | { action: 'modify'; id: string; newProps: Record<string, unknown> }\n | { action: 'remove'; id: string }\n | { action: 'setRoot'; fields: Record<string, unknown> };\n\nconst resolveZone = (\n destinationId?: string,\n destinationSlot?: string\n): string =>\n destinationId && destinationSlot\n ? `${destinationId}:${destinationSlot}`\n : ROOT_ZONE;\n\n/**\n * Translate a single patch into live Puck store dispatches (the only path that\n * re-renders the editor). Returns a structured result so a driving agent can\n * tell success from failure without re-reading the page.\n */\nexport function applyPatchToPuck(\n dispatch: Dispatch,\n data: Data | undefined,\n config: Config,\n patch: EnginePatch\n): PatchResult {\n if (!data) return { ok: false, error: 'editor not ready: no page data' };\n\n switch (patch.action) {\n case 'add': {\n if (!config.components[patch.type]) {\n return { ok: false, error: `unknown component type \"${patch.type}\"` };\n }\n if (!patch.destinationId !== !patch.destinationSlot) {\n return {\n ok: false,\n error: 'destinationId and destinationSlot are required together',\n };\n }\n if (patch.destinationId && patch.destinationSlot) {\n const parent = findComponentLocation(\n data,\n config,\n patch.destinationId\n )?.component;\n if (!parent) {\n return {\n ok: false,\n error: `destination \"${patch.destinationId}\" not found`,\n };\n }\n if (\n !slotAllows(config, parent.type, patch.destinationSlot, patch.type)\n ) {\n return {\n ok: false,\n error: `\"${patch.type}\" is not allowed in ${parent.type}.${patch.destinationSlot}`,\n };\n }\n }\n const zone = resolveZone(patch.destinationId, patch.destinationSlot);\n if (zone === ROOT_ZONE && !isSectionType(config, patch.type)) {\n return { ok: false, error: rootRejects(patch.type) };\n }\n // generateTemplateIds regenerates ids for the component and any nested\n // children — the caller can never set or collide an id.\n const [component] = generateTemplateIds(\n [\n {\n type: patch.type,\n props: {\n ...config.components[patch.type]?.defaultProps,\n ...patch.props,\n id: '',\n },\n } as ComponentData,\n ],\n config\n );\n const index = patch.destinationIndex ?? getZoneLength(data, config, zone);\n appendComponents(dispatch, zone, index, [component]);\n return { ok: true, id: component.props.id as string };\n }\n case 'addMany': {\n const zone = patch.destinationZone || ROOT_ZONE;\n if (zone === ROOT_ZONE) {\n const offending = patch.components.find(\n (c) => !isSectionType(config, c.type)\n );\n if (offending) {\n return { ok: false, error: rootRejects(offending.type) };\n }\n }\n const index = patch.destinationIndex ?? getZoneLength(data, config, zone);\n appendComponents(dispatch, zone, index, patch.components);\n return {\n ok: true,\n ids: patch.components.map((c) => c.props.id as string),\n };\n }\n case 'modify': {\n const loc = findComponentLocation(data, config, patch.id);\n if (!loc) {\n return { ok: false, error: `id \"${patch.id}\" not found` };\n }\n dispatch({\n type: 'replace',\n destinationZone: loc.zone,\n destinationIndex: loc.index,\n data: {\n ...loc.component,\n props: { ...loc.component.props, ...patch.newProps, id: patch.id },\n },\n });\n return { ok: true, id: patch.id };\n }\n case 'remove': {\n const loc = findComponentLocation(data, config, patch.id);\n if (!loc) {\n return { ok: false, error: `id \"${patch.id}\" not found` };\n }\n dispatch({ type: 'remove', zone: loc.zone, index: loc.index });\n return { ok: true, id: patch.id };\n }\n case 'setRoot': {\n dispatch({\n type: 'replaceRoot',\n root: {\n ...(data.root || { props: {} }),\n props: { ...(data.root?.props || {}), ...patch.fields },\n },\n });\n return { ok: true };\n }\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,mBAAmB,QAAQ,gBAAgB;AACtE,SAASC,aAAa,QAAQ,mCAAmC;AACjE,SACEC,qBAAqB,EACrBC,aAAa,EACbC,SAAS,QACJ,8BAA8B;AAErC,MAAMC,WAAW,GAAIC,IAAY,IAC/B,+DAA+DA,IAAI,cAAc;AAInF;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CACjBC,MAAc,EACdC,UAAkB,EAClBC,IAAY,EACZC,SAAiB,EACR;EACT,MAAMC,KAAK,GAAGJ,MAAM,CAACK,UAAU,GAAGJ,UAAU,CAAC,EAAEK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 -2,4 +2,3 @@ export declare const MEDIA_TYPES: readonly ["image", "remote_video"];
|
|
|
2
2
|
export type MediaType = (typeof MEDIA_TYPES)[number];
|
|
3
3
|
export declare const PAGE_META_FIELDS: readonly ["title", "metadataTitle", "metadataDescription", "metadataImage", "publishedState", "urlAlias"];
|
|
4
4
|
export type PageMetaField = (typeof PAGE_META_FIELDS)[number];
|
|
5
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -16,4 +16,3 @@ export declare function findComponentLocation(data: Data, config: Config, id: st
|
|
|
16
16
|
* for incremental insert actions).
|
|
17
17
|
*/
|
|
18
18
|
export declare function getZoneLength(data: Data, config: Config, zone: string): number;
|
|
19
|
-
//# sourceMappingURL=find-component-location.d.ts.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { createAgentPlugin } from './agent-plugin';
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { createAgentPlugin } from './agent-plugin.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createAgentPlugin } from
|
|
1
|
+
export { createAgentPlugin } from "./agent-plugin.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createAgentPlugin"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/index.ts"],"sourcesContent":["export { createAgentPlugin } from './agent-plugin';\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","names":["createAgentPlugin"],"sources":["../../../../../src/puck-editor/internal/plugins/agent-plugin/index.ts"],"sourcesContent":["export { createAgentPlugin } from './agent-plugin.tsx';\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,mBAAoB","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PuckMediaConfig } from '../../content-model.js';
|
|
1
2
|
export type AgentMediaItem = {
|
|
2
3
|
id: string;
|
|
3
4
|
type: string;
|
|
@@ -15,5 +16,4 @@ export type AgentMediaItem = {
|
|
|
15
16
|
* verbatim — never invented; items keep id/type/name/thumbnailImage so they
|
|
16
17
|
* drop into media fields unchanged.
|
|
17
18
|
*/
|
|
18
|
-
export declare function listMedia(lang: string | undefined, drupalBaseUrl: string, type: string, query?: string, limit?: number, offset?: number): Promise<AgentMediaItem[]>;
|
|
19
|
-
//# sourceMappingURL=list-media.d.ts.map
|
|
19
|
+
export declare function listMedia(lang: string | undefined, drupalBaseUrl: string, media: PuckMediaConfig, type: string, query?: string, limit?: number, offset?: number): Promise<AgentMediaItem[]>;
|
|
@@ -5,7 +5,7 @@ import { absolutizeMediaUrl, fetchMediaList } from "../../api/client.js";
|
|
|
5
5
|
* verbatim — never invented; items keep id/type/name/thumbnailImage so they
|
|
6
6
|
* drop into media fields unchanged.
|
|
7
7
|
*/
|
|
8
|
-
export async function listMedia(lang, drupalBaseUrl, type, query, limit, offset) {
|
|
8
|
+
export async function listMedia(lang, drupalBaseUrl, media, type, query, limit, offset) {
|
|
9
9
|
const body = await fetchMediaList(type, {
|
|
10
10
|
lang,
|
|
11
11
|
query,
|
|
@@ -14,13 +14,14 @@ export async function listMedia(lang, drupalBaseUrl, type, query, limit, offset)
|
|
|
14
14
|
});
|
|
15
15
|
const items = Array.isArray(body?.data) ? body.data : [];
|
|
16
16
|
return items.map(item => {
|
|
17
|
-
const file = item.
|
|
17
|
+
const file = item[media.imageFileField] ?? item[media.videoFileField];
|
|
18
|
+
const oembed = item[media.remoteVideoUrlField];
|
|
18
19
|
return {
|
|
19
20
|
id: item.id,
|
|
20
21
|
type: item.type,
|
|
21
22
|
name: item.name,
|
|
22
23
|
title: item.name,
|
|
23
|
-
url: absolutizeMediaUrl(drupalBaseUrl, file?.uri?.url) ??
|
|
24
|
+
url: absolutizeMediaUrl(drupalBaseUrl, file?.uri?.url) ?? (typeof oembed === 'string' ? oembed : undefined),
|
|
24
25
|
alt: file?.meta?.alt ?? undefined,
|
|
25
26
|
width: file?.meta?.width,
|
|
26
27
|
height: file?.meta?.height,
|