@questpie/admin 1.1.1 → 3.0.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 +256 -488
- package/dist/augmentation.d.mts +414 -0
- package/dist/client/blocks/block-renderer.d.mts +45 -0
- package/dist/client/blocks/block-renderer.mjs +105 -0
- package/dist/client/blocks/index.d.mts +2 -0
- package/dist/client/blocks/types.d.mts +68 -0
- package/dist/client/blocks/types.mjs +19 -0
- package/dist/client/builder/admin-types.d.mts +40 -0
- package/dist/client/builder/admin.d.mts +110 -0
- package/dist/client/builder/admin.mjs +151 -0
- package/dist/client/builder/field/field.d.mts +51 -0
- package/dist/client/builder/field/field.mjs +37 -0
- package/dist/client/builder/index.d.mts +31 -0
- package/dist/client/builder/page/page.d.mts +24 -0
- package/dist/client/builder/page/page.mjs +31 -0
- package/dist/client/builder/registry.d.mts +50 -0
- package/dist/client/builder/types/action-registry.mjs +276 -0
- package/dist/client/builder/types/action-types.d.mts +226 -0
- package/dist/client/builder/types/collection-types.mjs +10 -0
- package/dist/client/builder/types/common.d.mts +46 -0
- package/dist/client/builder/types/field-types.d.mts +592 -0
- package/dist/client/builder/types/field-types.mjs +18 -0
- package/dist/client/builder/types/ui-config.d.mts +158 -0
- package/dist/client/builder/types/widget-types.d.mts +562 -0
- package/dist/client/builder/validation.d.mts +33 -0
- package/dist/client/builder/validation.mjs +227 -0
- package/dist/client/builder/view/view.d.mts +49 -0
- package/dist/client/builder/view/view.mjs +27 -0
- package/dist/client/builder/widget/widget.d.mts +27 -0
- package/dist/client/builder/widget/widget.mjs +21 -0
- package/dist/client/components/actions/action-button.mjs +245 -0
- package/dist/client/components/actions/action-dialog.mjs +559 -0
- package/dist/client/components/actions/confirmation-dialog.mjs +201 -0
- package/dist/client/components/actions/header-actions.mjs +210 -0
- package/dist/client/components/admin-link.d.mts +66 -0
- package/dist/client/components/admin-link.mjs +171 -0
- package/dist/client/components/auth/auth-guard.d.mts +50 -0
- package/dist/client/components/auth/auth-guard.mjs +60 -0
- package/dist/client/components/auth/auth-loading.d.mts +35 -0
- package/dist/client/components/auth/auth-loading.mjs +55 -0
- package/dist/client/components/blocks/block-canvas.mjs +159 -0
- package/dist/client/components/blocks/block-editor-context.mjs +125 -0
- package/dist/client/components/blocks/block-editor-layout.mjs +199 -0
- package/dist/client/components/blocks/block-editor-provider.mjs +235 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs +240 -0
- package/dist/client/components/blocks/block-insert-button.mjs +189 -0
- package/dist/client/components/blocks/block-item-menu.mjs +363 -0
- package/dist/client/components/blocks/block-item.mjs +434 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs +285 -0
- package/dist/client/components/blocks/block-tree.mjs +103 -0
- package/dist/client/components/blocks/block-type-icon.mjs +95 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs +185 -0
- package/dist/client/components/component-renderer.d.mts +114 -0
- package/dist/client/components/component-renderer.mjs +258 -0
- package/dist/client/components/error-boundary.mjs +144 -0
- package/dist/client/components/fields/array-field.mjs +506 -0
- package/dist/client/components/fields/asset-preview-field.mjs +159 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +209 -0
- package/dist/client/components/fields/boolean-field.mjs +77 -0
- package/dist/client/components/fields/date-field.mjs +76 -0
- package/dist/client/components/fields/datetime-field.mjs +74 -0
- package/dist/client/components/fields/email-field.mjs +67 -0
- package/dist/client/components/fields/field-utils.mjs +64 -0
- package/dist/client/components/fields/field-wrapper.mjs +124 -0
- package/dist/client/components/fields/json-field.mjs +461 -0
- package/dist/client/components/fields/locale-badge.mjs +25 -0
- package/dist/client/components/fields/number-field.mjs +73 -0
- package/dist/client/components/fields/object-array-field.mjs +707 -0
- package/dist/client/components/fields/object-field.mjs +686 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs +254 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs +173 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs +209 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs +247 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs +309 -0
- package/dist/client/components/fields/relation/displays/types.mjs +72 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs +143 -0
- package/dist/client/components/fields/relation-field.mjs +161 -0
- package/dist/client/components/fields/relation-picker.mjs +296 -0
- package/dist/client/components/fields/relation-select.mjs +232 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +105 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +144 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +221 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +520 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +85 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs +123 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +188 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +433 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +541 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs +30 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs +50 -0
- package/dist/client/components/fields/rich-text-field.mjs +64 -0
- package/dist/client/components/fields/select-field.mjs +88 -0
- package/dist/client/components/fields/text-field.mjs +72 -0
- package/dist/client/components/fields/textarea-field.mjs +71 -0
- package/dist/client/components/fields/time-field.mjs +67 -0
- package/dist/client/components/fields/upload-field.mjs +621 -0
- package/dist/client/components/filter-builder/columns-tab.mjs +325 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +456 -0
- package/dist/client/components/filter-builder/filters-tab.mjs +663 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs +278 -0
- package/dist/client/components/history-sidebar.mjs +496 -0
- package/dist/client/components/layout/field-layout-renderer.mjs +301 -0
- package/dist/client/components/locale-switcher.mjs +251 -0
- package/dist/client/components/media/media-grid.mjs +314 -0
- package/dist/client/components/media/media-picker-dialog.mjs +563 -0
- package/dist/client/components/preview/live-preview-mode.mjs +503 -0
- package/dist/client/components/preview/preview-pane.mjs +388 -0
- package/dist/client/components/primitives/asset-preview.mjs +771 -0
- package/dist/client/components/primitives/checkbox-input.mjs +59 -0
- package/dist/client/components/primitives/date-input.mjs +461 -0
- package/dist/client/components/primitives/dropzone.mjs +368 -0
- package/dist/client/components/primitives/number-input.mjs +117 -0
- package/dist/client/components/primitives/select-multi.mjs +590 -0
- package/dist/client/components/primitives/select-single.mjs +473 -0
- package/dist/client/components/primitives/text-input.mjs +45 -0
- package/dist/client/components/primitives/textarea-input.mjs +43 -0
- package/dist/client/components/primitives/time-input.mjs +145 -0
- package/dist/client/components/primitives/toggle-input.mjs +51 -0
- package/dist/client/components/primitives/types.mjs +12 -0
- package/dist/client/components/sheets/resource-sheet.mjs +86 -0
- package/dist/client/components/ui/accordion.mjs +169 -0
- package/dist/client/components/ui/alert.mjs +85 -0
- package/dist/client/components/ui/badge.mjs +76 -0
- package/dist/client/components/ui/button.mjs +84 -0
- package/dist/client/components/ui/card.mjs +206 -0
- package/dist/client/components/ui/checkbox.mjs +82 -0
- package/dist/client/components/ui/command.mjs +239 -0
- package/dist/client/components/ui/dialog.mjs +296 -0
- package/dist/client/components/ui/drawer.mjs +278 -0
- package/dist/client/components/ui/dropdown-menu.mjs +315 -0
- package/dist/client/components/ui/empty-state.mjs +99 -0
- package/dist/client/components/ui/field.mjs +354 -0
- package/dist/client/components/ui/input-group.mjs +201 -0
- package/dist/client/components/ui/input.mjs +46 -0
- package/dist/client/components/ui/kbd.mjs +53 -0
- package/dist/client/components/ui/label.mjs +45 -0
- package/dist/client/components/ui/popover.mjs +176 -0
- package/dist/client/components/ui/responsive-dialog.mjs +308 -0
- package/dist/client/components/ui/search-input.mjs +139 -0
- package/dist/client/components/ui/select.mjs +325 -0
- package/dist/client/components/ui/separator.mjs +47 -0
- package/dist/client/components/ui/sheet.mjs +280 -0
- package/dist/client/components/ui/sidebar.mjs +774 -0
- package/dist/client/components/ui/skeleton.mjs +40 -0
- package/dist/client/components/ui/sonner.d.mts +13 -0
- package/dist/client/components/ui/sonner.mjs +85 -0
- package/dist/client/components/ui/spinner.mjs +52 -0
- package/dist/client/components/ui/switch.mjs +58 -0
- package/dist/client/components/ui/table.mjs +276 -0
- package/dist/client/components/ui/tabs.mjs +160 -0
- package/dist/client/components/ui/textarea.mjs +40 -0
- package/dist/client/components/ui/toolbar.mjs +136 -0
- package/dist/client/components/ui/tooltip.mjs +146 -0
- package/dist/client/components/widgets/chart-widget.mjs +582 -0
- package/dist/client/components/widgets/progress-widget.mjs +200 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs +209 -0
- package/dist/client/components/widgets/recent-items-widget.mjs +196 -0
- package/dist/client/components/widgets/stats-widget.mjs +261 -0
- package/dist/client/components/widgets/table-widget.mjs +273 -0
- package/dist/client/components/widgets/timeline-widget.mjs +279 -0
- package/dist/client/components/widgets/value-widget.mjs +312 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +427 -0
- package/dist/client/contexts/breadcrumb-context.mjs +60 -0
- package/dist/client/contexts/focus-context.d.mts +87 -0
- package/dist/client/contexts/focus-context.mjs +250 -0
- package/dist/client/hooks/typed-hooks.d.mts +110 -0
- package/dist/client/hooks/typed-hooks.mjs +888 -0
- package/dist/client/hooks/use-action.mjs +329 -0
- package/dist/client/hooks/use-admin-config.mjs +69 -0
- package/dist/client/hooks/use-admin-preferences.mjs +171 -0
- package/dist/client/hooks/use-admin-routes.mjs +130 -0
- package/dist/client/hooks/use-audit-history.mjs +157 -0
- package/dist/client/hooks/use-auth.d.mts +97 -0
- package/dist/{use-auth-BoLmWtmU.mjs → client/hooks/use-auth.mjs} +9 -10
- package/dist/client/hooks/use-collection-fields.mjs +71 -0
- package/dist/client/hooks/use-collection-meta.mjs +153 -0
- package/dist/client/hooks/use-collection-schema.mjs +90 -0
- package/dist/client/hooks/use-collection-validation.mjs +88 -0
- package/dist/client/hooks/use-collection.d.mts +96 -0
- package/dist/client/hooks/use-collection.mjs +673 -0
- package/dist/client/hooks/use-current-user.d.mts +60 -0
- package/dist/client/hooks/use-current-user.mjs +79 -0
- package/dist/client/hooks/use-field-hooks.mjs +199 -0
- package/dist/client/hooks/use-field-options.d.mts +57 -0
- package/dist/client/hooks/use-field-options.mjs +269 -0
- package/dist/client/hooks/use-global-fields.mjs +58 -0
- package/dist/client/hooks/use-global-meta.mjs +105 -0
- package/dist/client/hooks/use-global-schema.mjs +53 -0
- package/dist/client/hooks/use-global.d.mts +51 -0
- package/dist/client/hooks/use-global.mjs +284 -0
- package/dist/client/hooks/use-locks.mjs +452 -0
- package/dist/client/hooks/use-media-query.d.mts +22 -0
- package/dist/client/hooks/use-media-query.mjs +81 -0
- package/dist/client/hooks/use-prefill-params.mjs +47 -0
- package/dist/client/hooks/use-questpie-query-options.mjs +50 -0
- package/dist/client/hooks/use-reactive-fields.d.mts +78 -0
- package/dist/client/hooks/use-reactive-fields.mjs +201 -0
- package/dist/client/hooks/use-realtime-highlight.mjs +158 -0
- package/dist/client/hooks/use-saved-views.mjs +140 -0
- package/dist/client/hooks/use-search-param-toggle.d.mts +12 -0
- package/dist/client/hooks/use-search-param-toggle.mjs +115 -0
- package/dist/client/hooks/use-search.mjs +258 -0
- package/dist/client/hooks/use-server-actions.mjs +191 -0
- package/dist/client/hooks/use-server-validation.mjs +291 -0
- package/dist/client/hooks/use-server-widget-data.d.mts +25 -0
- package/dist/client/hooks/use-server-widget-data.mjs +65 -0
- package/dist/client/hooks/use-setup-status.d.mts +38 -0
- package/dist/client/hooks/use-setup-status.mjs +62 -0
- package/dist/client/hooks/use-sidebar-search-param.d.mts +9 -0
- package/dist/client/hooks/use-sidebar-search-param.mjs +104 -0
- package/dist/client/hooks/use-transition-stage.mjs +125 -0
- package/dist/client/hooks/use-upload-collection.mjs +31 -0
- package/dist/client/hooks/use-upload.mjs +209 -0
- package/dist/client/hooks/use-validation-error-map.mjs +57 -0
- package/dist/client/hooks/use-view-state.mjs +479 -0
- package/dist/client/i18n/hooks.mjs +284 -0
- package/dist/client/i18n/intl-cache.mjs +64 -0
- package/dist/client/i18n/messages.mjs +6 -0
- package/dist/client/i18n/simple.d.mts +21 -0
- package/dist/client/i18n/simple.mjs +156 -0
- package/dist/client/i18n/types.d.mts +109 -0
- package/dist/client/lib/cookies.mjs +9 -0
- package/dist/client/lib/events.mjs +5 -0
- package/dist/client/lib/render-profiler.mjs +51 -0
- package/dist/client/lib/utils.mjs +23 -0
- package/dist/client/preview/block-scope-context.d.mts +73 -0
- package/dist/client/preview/block-scope-context.mjs +116 -0
- package/dist/client/preview/index.d.mts +5 -0
- package/dist/client/preview/preview-banner.d.mts +45 -0
- package/dist/client/preview/preview-banner.mjs +134 -0
- package/dist/client/preview/preview-field.d.mts +107 -0
- package/dist/client/preview/preview-field.mjs +227 -0
- package/dist/client/preview/types.d.mts +114 -0
- package/dist/client/preview/types.mjs +20 -0
- package/dist/client/preview/use-collection-preview.d.mts +70 -0
- package/dist/client/preview/use-collection-preview.mjs +163 -0
- package/dist/client/runtime/content-locales-provider.d.mts +1 -0
- package/dist/client/runtime/content-locales-provider.mjs +136 -0
- package/dist/client/runtime/index.d.mts +5 -0
- package/dist/client/runtime/index.mjs +6 -0
- package/dist/client/runtime/locale-scope.d.mts +2 -0
- package/dist/client/runtime/locale-scope.mjs +108 -0
- package/dist/client/runtime/provider.d.mts +203 -0
- package/dist/client/runtime/provider.mjs +393 -0
- package/dist/client/runtime/routes.d.mts +49 -0
- package/dist/client/runtime/routes.mjs +91 -0
- package/dist/client/runtime/translations-provider.mjs +242 -0
- package/dist/client/scope/index.d.mts +3 -0
- package/dist/client/scope/picker.d.mts +53 -0
- package/dist/client/scope/picker.mjs +395 -0
- package/dist/client/scope/provider.d.mts +103 -0
- package/dist/client/scope/provider.mjs +167 -0
- package/dist/client/scope/types.d.mts +111 -0
- package/dist/client/styles/index.css +344 -188
- package/dist/client/utils/auto-expand-fields.mjs +83 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs +259 -0
- package/dist/client/utils/dependency-tracker.mjs +61 -0
- package/dist/client/utils/detect-relations.mjs +45 -0
- package/dist/client/utils/locale-to-flag.d.mts +119 -0
- package/dist/client/utils/locale-to-flag.mjs +129 -0
- package/dist/client/utils/routes.mjs +195 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +72 -0
- package/dist/client/views/auth/accept-invite-form.mjs +473 -0
- package/dist/client/views/auth/auth-layout.d.mts +43 -0
- package/dist/client/views/auth/auth-layout.mjs +116 -0
- package/dist/client/views/auth/forgot-password-form.d.mts +58 -0
- package/dist/client/views/auth/forgot-password-form.mjs +386 -0
- package/dist/client/views/auth/invite-form.mjs +497 -0
- package/dist/client/views/auth/login-form.d.mts +75 -0
- package/dist/client/views/auth/login-form.mjs +387 -0
- package/dist/client/views/auth/reset-password-form.d.mts +65 -0
- package/dist/client/views/auth/reset-password-form.mjs +515 -0
- package/dist/client/views/auth/setup-form.d.mts +60 -0
- package/dist/client/views/auth/setup-form.mjs +526 -0
- package/dist/client/views/collection/auto-form-fields.mjs +873 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs +480 -0
- package/dist/client/views/collection/cells/complex-cells.mjs +746 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs +395 -0
- package/dist/client/views/collection/cells/relation-cells.mjs +260 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +509 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs +125 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +121 -0
- package/dist/client/views/collection/cells/upload-cells.mjs +28 -0
- package/dist/client/views/collection/columns/build-columns.mjs +195 -0
- package/dist/client/views/collection/columns/column-defaults.mjs +123 -0
- package/dist/client/views/collection/field-context.mjs +126 -0
- package/dist/client/views/collection/field-renderer.mjs +368 -0
- package/dist/client/views/collection/form-view.mjs +1566 -0
- package/dist/client/views/collection/table-view.mjs +832 -0
- package/dist/client/views/collection/view-skeletons.mjs +215 -0
- package/dist/client/views/common/global-search.mjs +700 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs +881 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs +265 -0
- package/dist/client/views/dashboard/widget-card.mjs +372 -0
- package/dist/client/views/globals/global-form-view.mjs +1306 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts +137 -0
- package/dist/client/views/layout/admin-layout-provider.mjs +193 -0
- package/dist/client/views/layout/admin-layout.d.mts +133 -0
- package/dist/client/views/layout/admin-layout.mjs +302 -0
- package/dist/client/views/layout/admin-router.d.mts +93 -0
- package/dist/client/views/layout/admin-router.mjs +1254 -0
- package/dist/client/views/layout/admin-sidebar.d.mts +99 -0
- package/dist/client/views/layout/admin-sidebar.mjs +1379 -0
- package/dist/client/views/layout/admin-topbar.mjs +236 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +66 -0
- package/dist/client/views/pages/accept-invite-page.mjs +349 -0
- package/dist/client/views/pages/dashboard-page.d.mts +43 -0
- package/dist/client/views/pages/dashboard-page.mjs +84 -0
- package/dist/client/views/pages/forgot-password-page.d.mts +56 -0
- package/dist/client/views/pages/forgot-password-page.mjs +152 -0
- package/dist/client/views/pages/invite-page.d.mts +70 -0
- package/dist/client/views/pages/invite-page.mjs +161 -0
- package/dist/client/views/pages/login-page.d.mts +69 -0
- package/dist/client/views/pages/login-page.mjs +193 -0
- package/dist/client/views/pages/reset-password-page.d.mts +63 -0
- package/dist/client/views/pages/reset-password-page.mjs +257 -0
- package/dist/client/views/pages/setup-page.d.mts +61 -0
- package/dist/client/views/pages/setup-page.mjs +156 -0
- package/dist/client-module.d.mts +3 -0
- package/dist/client-module.mjs +3 -0
- package/dist/client.d.mts +99 -3
- package/dist/client.mjs +52 -12
- package/dist/components/rich-text/index.d.mts +1 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts +103 -0
- package/dist/components/rich-text/rich-text-renderer.mjs +237 -0
- package/dist/index.d.mts +59 -3
- package/dist/index.mjs +52 -12
- package/dist/plugin.d.mts +2 -0
- package/dist/plugin.mjs +3 -0
- package/dist/server/adapters/nextjs.d.mts +120 -0
- package/dist/server/adapters/nextjs.mjs +110 -0
- package/dist/server/adapters/tanstack.d.mts +132 -0
- package/dist/server/adapters/tanstack.mjs +89 -0
- package/dist/server/augmentation/actions.d.mts +279 -0
- package/dist/server/augmentation/common.d.mts +76 -0
- package/dist/server/augmentation/dashboard.d.mts +547 -0
- package/dist/server/augmentation/form-layout.d.mts +303 -0
- package/dist/server/augmentation/index.d.mts +44 -0
- package/dist/server/augmentation/index.mjs +10 -0
- package/dist/server/augmentation/sidebar.d.mts +181 -0
- package/dist/server/augmentation/views.d.mts +237 -0
- package/dist/server/augmentation.d.mts +7 -0
- package/dist/server/block/index.d.mts +4 -0
- package/dist/server/codegen/admin-client-template.mjs +93 -0
- package/dist/server/codegen/projection-validator.mjs +67 -0
- package/dist/server/fields/blocks.d.mts +71 -0
- package/dist/server/fields/blocks.mjs +151 -0
- package/dist/server/fields/index.d.mts +15 -0
- package/dist/server/fields/index.mjs +15 -0
- package/dist/server/fields/rich-text.d.mts +68 -0
- package/dist/server/fields/rich-text.mjs +147 -0
- package/dist/server/i18n/index.mjs +43 -0
- package/dist/server/i18n/messages/cs.mjs +461 -0
- package/dist/server/i18n/messages/de.mjs +461 -0
- package/dist/server/i18n/messages/en.mjs +707 -0
- package/dist/server/i18n/messages/es.mjs +461 -0
- package/dist/server/i18n/messages/fr.mjs +461 -0
- package/dist/server/i18n/messages/index.mjs +23 -0
- package/dist/server/i18n/messages/pl.mjs +461 -0
- package/dist/server/i18n/messages/pt.mjs +464 -0
- package/dist/server/i18n/messages/sk.mjs +689 -0
- package/dist/server/modules/admin/.generated/module.d.mts +52 -0
- package/dist/server/modules/admin/.generated/module.mjs +78 -0
- package/dist/server/modules/admin/.generated/registries.d.mts +22 -0
- package/dist/server/modules/admin/auth-helpers.d.mts +142 -0
- package/dist/server/modules/admin/auth-helpers.mjs +107 -0
- package/dist/server/modules/admin/block/block-builder.d.mts +383 -0
- package/dist/server/modules/admin/block/block-builder.mjs +315 -0
- package/dist/server/modules/admin/block/index.d.mts +3 -0
- package/dist/server/modules/admin/block/introspection.d.mts +89 -0
- package/dist/server/modules/admin/block/introspection.mjs +100 -0
- package/dist/server/modules/admin/block/prefetch.d.mts +78 -0
- package/dist/server/modules/admin/block/prefetch.mjs +241 -0
- package/dist/server/modules/admin/client/.generated/module.d.mts +94 -0
- package/dist/server/modules/admin/client/.generated/module.mjs +91 -0
- package/dist/server/modules/admin/client/components/badge.d.mts +1 -0
- package/dist/server/modules/admin/client/components/icon.d.mts +1 -0
- package/dist/server/modules/admin/client/fields/array.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/array.mjs +12 -0
- package/dist/server/modules/admin/client/fields/assetPreview.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/assetPreview.mjs +18 -0
- package/dist/server/modules/admin/client/fields/blocks.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/blocks.mjs +12 -0
- package/dist/server/modules/admin/client/fields/boolean.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/boolean.mjs +12 -0
- package/dist/server/modules/admin/client/fields/date.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/date.mjs +12 -0
- package/dist/server/modules/admin/client/fields/datetime.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/datetime.mjs +12 -0
- package/dist/server/modules/admin/client/fields/email.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/email.mjs +12 -0
- package/dist/server/modules/admin/client/fields/json.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/json.mjs +11 -0
- package/dist/server/modules/admin/client/fields/number.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/number.mjs +12 -0
- package/dist/server/modules/admin/client/fields/object.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/object.mjs +12 -0
- package/dist/server/modules/admin/client/fields/relation.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/relation.mjs +12 -0
- package/dist/server/modules/admin/client/fields/richText.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/richText.mjs +11 -0
- package/dist/server/modules/admin/client/fields/select.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/select.mjs +12 -0
- package/dist/server/modules/admin/client/fields/text.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/text.mjs +12 -0
- package/dist/server/modules/admin/client/fields/textarea.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/textarea.mjs +12 -0
- package/dist/server/modules/admin/client/fields/time.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/time.mjs +12 -0
- package/dist/server/modules/admin/client/fields/upload.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/upload.mjs +12 -0
- package/dist/server/modules/admin/client/fields/url.d.mts +6 -0
- package/dist/server/modules/admin/client/fields/url.mjs +12 -0
- package/dist/server/modules/admin/client/index.d.mts +1 -0
- package/dist/server/modules/admin/client/pages/dashboard.d.mts +6 -0
- package/dist/server/modules/admin/client/pages/dashboard.mjs +11 -0
- package/dist/server/modules/admin/client/pages/forgotPassword.d.mts +6 -0
- package/dist/server/modules/admin/client/pages/forgotPassword.mjs +11 -0
- package/dist/server/modules/admin/client/pages/login.d.mts +6 -0
- package/dist/server/modules/admin/client/pages/login.mjs +11 -0
- package/dist/server/modules/admin/client/pages/resetPassword.d.mts +6 -0
- package/dist/server/modules/admin/client/pages/resetPassword.mjs +11 -0
- package/dist/server/modules/admin/client/pages/setup.d.mts +6 -0
- package/dist/server/modules/admin/client/pages/setup.mjs +11 -0
- package/dist/server/modules/admin/client/views/collection-form.mjs +10 -0
- package/dist/server/modules/admin/client/views/collection-table.mjs +10 -0
- package/dist/server/modules/admin/client/views/global-form.mjs +10 -0
- package/dist/server/modules/admin/client/widgets/chart.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/chart.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/progress.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/progress.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/quickActions.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/quickActions.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/recentItems.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/recentItems.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/stats.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/stats.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/table.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/table.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/timeline.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/timeline.mjs +7 -0
- package/dist/server/modules/admin/client/widgets/value.d.mts +6 -0
- package/dist/server/modules/admin/client/widgets/value.mjs +7 -0
- package/dist/server/modules/admin/collections/account.d.mts +77 -0
- package/dist/server/modules/admin/collections/account.mjs +23 -0
- package/dist/server/modules/admin/collections/admin-locks.d.mts +90 -0
- package/dist/server/modules/admin/collections/admin-locks.mjs +16 -0
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +69 -0
- package/dist/server/modules/admin/collections/admin-preferences.mjs +16 -0
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +83 -0
- package/dist/server/modules/admin/collections/admin-saved-views.mjs +16 -0
- package/dist/server/modules/admin/collections/apikey.d.mts +99 -0
- package/dist/server/modules/admin/collections/apikey.mjs +15 -0
- package/dist/server/modules/admin/collections/assets.d.mts +72 -0
- package/dist/server/modules/admin/collections/assets.mjs +71 -0
- package/dist/server/modules/admin/collections/session.d.mts +69 -0
- package/dist/server/modules/admin/collections/session.mjs +15 -0
- package/dist/server/modules/admin/collections/user.d.mts +85 -0
- package/dist/server/modules/admin/collections/user.mjs +204 -0
- package/dist/server/modules/admin/collections/verification.d.mts +63 -0
- package/dist/server/modules/admin/collections/verification.mjs +15 -0
- package/dist/server/modules/admin/components/badge.d.mts +10 -0
- package/dist/server/modules/admin/components/badge.mjs +10 -0
- package/dist/server/modules/admin/components/icon.d.mts +9 -0
- package/dist/server/modules/admin/components/icon.mjs +11 -0
- package/dist/server/modules/admin/config/admin.mjs +34 -0
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +102 -0
- package/dist/server/modules/admin/factories.mjs +172 -0
- package/dist/server/modules/admin/index.d.mts +1093 -0
- package/dist/server/modules/admin/index.mjs +26 -0
- package/dist/server/modules/admin/modules.mjs +11 -0
- package/dist/server/modules/admin/plugin.mjs +13 -0
- package/dist/server/modules/admin/routes/admin-config.d.mts +28 -0
- package/dist/server/modules/admin/routes/admin-config.mjs +552 -0
- package/dist/server/modules/admin/routes/execute-action.d.mts +92 -0
- package/dist/server/modules/admin/routes/execute-action.mjs +433 -0
- package/dist/server/modules/admin/routes/locales.d.mts +18 -0
- package/dist/server/modules/admin/routes/locales.mjs +69 -0
- package/dist/server/modules/admin/routes/preview.d.mts +80 -0
- package/dist/server/modules/admin/routes/preview.mjs +230 -0
- package/dist/server/modules/admin/routes/reactive.d.mts +74 -0
- package/dist/server/modules/admin/routes/reactive.mjs +350 -0
- package/dist/server/modules/admin/routes/route-helpers.d.mts +23 -0
- package/dist/server/modules/admin/routes/route-helpers.mjs +76 -0
- package/dist/server/modules/admin/routes/setup.d.mts +63 -0
- package/dist/server/modules/admin/routes/setup.mjs +114 -0
- package/dist/server/modules/admin/routes/translations.d.mts +26 -0
- package/dist/server/modules/admin/routes/translations.mjs +114 -0
- package/dist/server/modules/admin/routes/widget-data.d.mts +32 -0
- package/dist/server/modules/admin/routes/widget-data.mjs +62 -0
- package/dist/server/modules/admin/views/form.d.mts +8 -0
- package/dist/server/modules/admin/views/form.mjs +7 -0
- package/dist/server/modules/admin/views/global-form.d.mts +8 -0
- package/dist/server/modules/admin/views/global-form.mjs +7 -0
- package/dist/server/modules/admin/views/table.d.mts +8 -0
- package/dist/server/modules/admin/views/table.mjs +7 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +37 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs +55 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +99 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.mjs +38 -0
- package/dist/server/modules/audit/.generated/module.d.mts +60 -0
- package/dist/server/modules/audit/.generated/module.mjs +30 -0
- package/dist/server/modules/audit/collections/audit-log.d.mts +214 -0
- package/dist/server/modules/audit/collections/audit-log.mjs +107 -0
- package/dist/server/modules/audit/config/admin.mjs +21 -0
- package/dist/server/modules/audit/config/app.mjs +262 -0
- package/dist/server/modules/audit/index.d.mts +2 -0
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +13 -0
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +28 -0
- package/dist/server/plugin.d.mts +26 -0
- package/dist/server/plugin.mjs +385 -0
- package/dist/server/proxy-factories.d.mts +85 -0
- package/dist/server/proxy-factories.mjs +302 -0
- package/dist/server/registry-helpers.d.mts +83 -0
- package/dist/server/registry-helpers.mjs +104 -0
- package/dist/server.d.mts +33 -250
- package/dist/server.mjs +22 -832
- package/dist/shared/preview-utils.d.mts +53 -0
- package/dist/{preview-utils-BKQ9-TMa.mjs → shared/preview-utils.mjs} +2 -3
- package/dist/{saved-views.types-BMsz5mCy.d.mts → shared/types/saved-views.types.d.mts} +7 -2
- package/dist/shared.d.mts +3 -57
- package/dist/shared.mjs +1 -1
- package/package.json +56 -51
- package/skills/questpie-admin/SKILL.md +397 -0
- package/skills/questpie-admin/blocks/SKILL.md +305 -0
- package/skills/questpie-admin/custom-ui/SKILL.md +307 -0
- package/skills/questpie-admin/views/SKILL.md +442 -0
- package/dist/auth-layout-M8K8_q5R.mjs +0 -181
- package/dist/auth-layout-M8K8_q5R.mjs.map +0 -1
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs +0 -273
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs.map +0 -1
- package/dist/card-BKHjBQfw.mjs +0 -58
- package/dist/card-BKHjBQfw.mjs.map +0 -1
- package/dist/client-D1DqawtP.d.mts +0 -13403
- package/dist/client-D1DqawtP.d.mts.map +0 -1
- package/dist/client-njX1rZmi.mjs +0 -22612
- package/dist/client-njX1rZmi.mjs.map +0 -1
- package/dist/content-locales-provider-BXvuIgfg.mjs +0 -1650
- package/dist/content-locales-provider-BXvuIgfg.mjs.map +0 -1
- package/dist/dashboard-page-B4PGEdc2.mjs +0 -2500
- package/dist/dashboard-page-B4PGEdc2.mjs.map +0 -1
- package/dist/dashboard-page-mCY0pgZv.mjs +0 -3
- package/dist/dropzone-Do3awXKd.mjs +0 -634
- package/dist/dropzone-Do3awXKd.mjs.map +0 -1
- package/dist/forgot-password-page-Bcp-An4Y.mjs +0 -221
- package/dist/forgot-password-page-Bcp-An4Y.mjs.map +0 -1
- package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
- package/dist/index-B4H3amCD.d.mts +0 -2753
- package/dist/index-B4H3amCD.d.mts.map +0 -1
- package/dist/login-page-BUnpCbCa.mjs +0 -3
- package/dist/login-page-CP4gA-dl.mjs +0 -298
- package/dist/login-page-CP4gA-dl.mjs.map +0 -1
- package/dist/preview-utils-BKQ9-TMa.mjs.map +0 -1
- package/dist/reset-password-page-BqfDmLxA.mjs +0 -281
- package/dist/reset-password-page-BqfDmLxA.mjs.map +0 -1
- package/dist/reset-password-page-CufHz3h3.mjs +0 -3
- package/dist/runtime-6VZM878K.mjs +0 -69
- package/dist/runtime-6VZM878K.mjs.map +0 -1
- package/dist/saved-views.types-BMsz5mCy.d.mts.map +0 -1
- package/dist/server.d.mts.map +0 -1
- package/dist/server.mjs.map +0 -1
- package/dist/setup-page-BNNzt_Z6.mjs +0 -3
- package/dist/setup-page-YAP_fzqh.mjs +0 -264
- package/dist/setup-page-YAP_fzqh.mjs.map +0 -1
- package/dist/shared.d.mts.map +0 -1
- package/dist/use-auth-BoLmWtmU.mjs.map +0 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils.mjs";
|
|
4
|
+
import { useBlockScope, useResolveFieldPath } from "./block-scope-context.mjs";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/client/preview/preview-field.tsx
|
|
10
|
+
/**
|
|
11
|
+
* PreviewField Component
|
|
12
|
+
*
|
|
13
|
+
* Wrapper component that makes fields clickable in preview mode.
|
|
14
|
+
* When clicked, signals to admin to focus that field in the form.
|
|
15
|
+
*/
|
|
16
|
+
const PreviewContext = React.createContext(null);
|
|
17
|
+
/**
|
|
18
|
+
* Provider for preview mode context.
|
|
19
|
+
* Use this at the root of your preview page.
|
|
20
|
+
*/
|
|
21
|
+
function PreviewProvider(t0) {
|
|
22
|
+
const $ = c(7);
|
|
23
|
+
const { isPreviewMode, focusedField, onFieldClick, children } = t0;
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[0] !== focusedField || $[1] !== isPreviewMode || $[2] !== onFieldClick) {
|
|
26
|
+
t1 = {
|
|
27
|
+
isPreviewMode,
|
|
28
|
+
focusedField,
|
|
29
|
+
handleFieldClick: onFieldClick
|
|
30
|
+
};
|
|
31
|
+
$[0] = focusedField;
|
|
32
|
+
$[1] = isPreviewMode;
|
|
33
|
+
$[2] = onFieldClick;
|
|
34
|
+
$[3] = t1;
|
|
35
|
+
} else t1 = $[3];
|
|
36
|
+
const value = t1;
|
|
37
|
+
let t2;
|
|
38
|
+
if ($[4] !== children || $[5] !== value) {
|
|
39
|
+
t2 = /* @__PURE__ */ jsx(PreviewContext.Provider, {
|
|
40
|
+
value,
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
$[4] = children;
|
|
44
|
+
$[5] = value;
|
|
45
|
+
$[6] = t2;
|
|
46
|
+
} else t2 = $[6];
|
|
47
|
+
return t2;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Hook to access preview context.
|
|
51
|
+
*/
|
|
52
|
+
function usePreviewContext() {
|
|
53
|
+
return React.useContext(PreviewContext);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Wrapper that makes a field clickable in preview mode.
|
|
57
|
+
*
|
|
58
|
+
* When clicked in preview, signals to admin to focus that field in the form.
|
|
59
|
+
* Automatically resolves field paths using block scope context if available.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Regular field
|
|
64
|
+
* <PreviewField field="title" as="h1" className="text-4xl">
|
|
65
|
+
* {data.title}
|
|
66
|
+
* </PreviewField>
|
|
67
|
+
*
|
|
68
|
+
* // Relation field
|
|
69
|
+
* <PreviewField field="author" fieldType="relation">
|
|
70
|
+
* {data.author.name}
|
|
71
|
+
* </PreviewField>
|
|
72
|
+
*
|
|
73
|
+
* // Inside a block (auto-resolves to content._values.{blockId}.title)
|
|
74
|
+
* <PreviewField field="title">
|
|
75
|
+
* {values.title}
|
|
76
|
+
* </PreviewField>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
function PreviewField(t0) {
|
|
80
|
+
const $ = c(21);
|
|
81
|
+
const { field, fieldType: t1, children, as: t2, className, onClick } = t0;
|
|
82
|
+
const fieldType = t1 === void 0 ? "regular" : t1;
|
|
83
|
+
const Component = t2 === void 0 ? "div" : t2;
|
|
84
|
+
const context = usePreviewContext();
|
|
85
|
+
const blockScope = useBlockScope();
|
|
86
|
+
const fullPath = useResolveFieldPath(field);
|
|
87
|
+
if (!context?.isPreviewMode) {
|
|
88
|
+
let t3$1;
|
|
89
|
+
if ($[0] !== Component || $[1] !== children || $[2] !== className) {
|
|
90
|
+
t3$1 = /* @__PURE__ */ jsx(Component, {
|
|
91
|
+
className,
|
|
92
|
+
children
|
|
93
|
+
});
|
|
94
|
+
$[0] = Component;
|
|
95
|
+
$[1] = children;
|
|
96
|
+
$[2] = className;
|
|
97
|
+
$[3] = t3$1;
|
|
98
|
+
} else t3$1 = $[3];
|
|
99
|
+
return t3$1;
|
|
100
|
+
}
|
|
101
|
+
const { handleFieldClick, focusedField } = context;
|
|
102
|
+
const isFocused = focusedField === fullPath;
|
|
103
|
+
let t3;
|
|
104
|
+
if ($[4] !== blockScope?.blockId || $[5] !== fieldType || $[6] !== fullPath || $[7] !== handleFieldClick || $[8] !== onClick) {
|
|
105
|
+
t3 = (e) => {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
if (onClick) onClick(fullPath, {
|
|
108
|
+
blockId: blockScope?.blockId,
|
|
109
|
+
fieldType
|
|
110
|
+
});
|
|
111
|
+
else handleFieldClick(fullPath, {
|
|
112
|
+
blockId: blockScope?.blockId,
|
|
113
|
+
fieldType
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
$[4] = blockScope?.blockId;
|
|
117
|
+
$[5] = fieldType;
|
|
118
|
+
$[6] = fullPath;
|
|
119
|
+
$[7] = handleFieldClick;
|
|
120
|
+
$[8] = onClick;
|
|
121
|
+
$[9] = t3;
|
|
122
|
+
} else t3 = $[9];
|
|
123
|
+
const handleClick = t3;
|
|
124
|
+
const t4 = blockScope?.blockId;
|
|
125
|
+
const t5 = isFocused && "outline-primary outline outline-2 outline-offset-2";
|
|
126
|
+
let t6;
|
|
127
|
+
if ($[10] !== className || $[11] !== t5) {
|
|
128
|
+
t6 = cn(className, "group relative cursor-pointer transition-all duration-150", "hover:outline-primary/60 hover:hover:outline hover:outline-2 hover:outline-offset-2 hover:outline-dashed", t5);
|
|
129
|
+
$[10] = className;
|
|
130
|
+
$[11] = t5;
|
|
131
|
+
$[12] = t6;
|
|
132
|
+
} else t6 = $[12];
|
|
133
|
+
let t7;
|
|
134
|
+
if ($[13] !== Component || $[14] !== children || $[15] !== fieldType || $[16] !== fullPath || $[17] !== handleClick || $[18] !== t4 || $[19] !== t6) {
|
|
135
|
+
t7 = /* @__PURE__ */ jsx(Component, {
|
|
136
|
+
"data-preview-field": fullPath,
|
|
137
|
+
"data-block-id": t4,
|
|
138
|
+
"data-field-type": fieldType,
|
|
139
|
+
onClick: handleClick,
|
|
140
|
+
className: t6,
|
|
141
|
+
children
|
|
142
|
+
});
|
|
143
|
+
$[13] = Component;
|
|
144
|
+
$[14] = children;
|
|
145
|
+
$[15] = fieldType;
|
|
146
|
+
$[16] = fullPath;
|
|
147
|
+
$[17] = handleClick;
|
|
148
|
+
$[18] = t4;
|
|
149
|
+
$[19] = t6;
|
|
150
|
+
$[20] = t7;
|
|
151
|
+
} else t7 = $[20];
|
|
152
|
+
return t7;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Standalone PreviewField that works without context.
|
|
156
|
+
* Useful when you can't use PreviewProvider.
|
|
157
|
+
*/
|
|
158
|
+
function StandalonePreviewField(t0) {
|
|
159
|
+
const $ = c(20);
|
|
160
|
+
const { field, fieldType: t1, children, as: t2, className, isPreviewMode, isFocused, onFieldClick } = t0;
|
|
161
|
+
const fieldType = t1 === void 0 ? "regular" : t1;
|
|
162
|
+
const Component = t2 === void 0 ? "div" : t2;
|
|
163
|
+
const blockScope = useBlockScope();
|
|
164
|
+
const fullPath = useResolveFieldPath(field);
|
|
165
|
+
if (!isPreviewMode) {
|
|
166
|
+
let t3$1;
|
|
167
|
+
if ($[0] !== Component || $[1] !== children || $[2] !== className) {
|
|
168
|
+
t3$1 = /* @__PURE__ */ jsx(Component, {
|
|
169
|
+
className,
|
|
170
|
+
children
|
|
171
|
+
});
|
|
172
|
+
$[0] = Component;
|
|
173
|
+
$[1] = children;
|
|
174
|
+
$[2] = className;
|
|
175
|
+
$[3] = t3$1;
|
|
176
|
+
} else t3$1 = $[3];
|
|
177
|
+
return t3$1;
|
|
178
|
+
}
|
|
179
|
+
let t3;
|
|
180
|
+
if ($[4] !== blockScope?.blockId || $[5] !== fieldType || $[6] !== fullPath || $[7] !== onFieldClick) {
|
|
181
|
+
t3 = (e) => {
|
|
182
|
+
e.stopPropagation();
|
|
183
|
+
onFieldClick(fullPath, {
|
|
184
|
+
blockId: blockScope?.blockId,
|
|
185
|
+
fieldType
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
$[4] = blockScope?.blockId;
|
|
189
|
+
$[5] = fieldType;
|
|
190
|
+
$[6] = fullPath;
|
|
191
|
+
$[7] = onFieldClick;
|
|
192
|
+
$[8] = t3;
|
|
193
|
+
} else t3 = $[8];
|
|
194
|
+
const handleClick = t3;
|
|
195
|
+
const t4 = blockScope?.blockId;
|
|
196
|
+
const t5 = isFocused && "outline-primary outline outline-2 outline-offset-2";
|
|
197
|
+
let t6;
|
|
198
|
+
if ($[9] !== className || $[10] !== t5) {
|
|
199
|
+
t6 = cn(className, "group relative cursor-pointer transition-all duration-150", "hover:outline-primary/60 hover:hover:outline hover:outline-2 hover:outline-offset-2 hover:outline-dashed", t5);
|
|
200
|
+
$[9] = className;
|
|
201
|
+
$[10] = t5;
|
|
202
|
+
$[11] = t6;
|
|
203
|
+
} else t6 = $[11];
|
|
204
|
+
let t7;
|
|
205
|
+
if ($[12] !== Component || $[13] !== children || $[14] !== fieldType || $[15] !== fullPath || $[16] !== handleClick || $[17] !== t4 || $[18] !== t6) {
|
|
206
|
+
t7 = /* @__PURE__ */ jsx(Component, {
|
|
207
|
+
"data-preview-field": fullPath,
|
|
208
|
+
"data-block-id": t4,
|
|
209
|
+
"data-field-type": fieldType,
|
|
210
|
+
onClick: handleClick,
|
|
211
|
+
className: t6,
|
|
212
|
+
children
|
|
213
|
+
});
|
|
214
|
+
$[12] = Component;
|
|
215
|
+
$[13] = children;
|
|
216
|
+
$[14] = fieldType;
|
|
217
|
+
$[15] = fullPath;
|
|
218
|
+
$[16] = handleClick;
|
|
219
|
+
$[17] = t4;
|
|
220
|
+
$[18] = t6;
|
|
221
|
+
$[19] = t7;
|
|
222
|
+
} else t7 = $[19];
|
|
223
|
+
return t7;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
export { PreviewField, PreviewProvider, StandalonePreviewField, usePreviewContext };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
//#region src/client/preview/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Collection Preview Types
|
|
4
|
+
*
|
|
5
|
+
* PostMessage protocol and types for live preview communication
|
|
6
|
+
* between admin and preview iframe.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Signal preview to refresh (invalidate and re-run loader).
|
|
10
|
+
*/
|
|
11
|
+
type PreviewRefreshMessage = {
|
|
12
|
+
type: "PREVIEW_REFRESH";
|
|
13
|
+
/** Optional hint about which field changed */
|
|
14
|
+
changedField?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Select a block in the preview.
|
|
18
|
+
*/
|
|
19
|
+
type SelectBlockMessage = {
|
|
20
|
+
type: "SELECT_BLOCK";
|
|
21
|
+
/** Block ID to select */
|
|
22
|
+
blockId: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Focus a field in the preview.
|
|
26
|
+
*/
|
|
27
|
+
type FocusFieldMessage = {
|
|
28
|
+
type: "FOCUS_FIELD";
|
|
29
|
+
/** Field path to focus (supports full scoped paths) */
|
|
30
|
+
fieldPath: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* All messages from Admin to Preview.
|
|
34
|
+
*/
|
|
35
|
+
type AdminToPreviewMessage = PreviewRefreshMessage | SelectBlockMessage | FocusFieldMessage;
|
|
36
|
+
/**
|
|
37
|
+
* Preview is ready to receive data.
|
|
38
|
+
*/
|
|
39
|
+
type PreviewReadyMessage = {
|
|
40
|
+
type: "PREVIEW_READY";
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A field was clicked in the preview.
|
|
44
|
+
*/
|
|
45
|
+
type FieldClickedMessage = {
|
|
46
|
+
type: "FIELD_CLICKED";
|
|
47
|
+
/** Full scoped field path */
|
|
48
|
+
fieldPath: string;
|
|
49
|
+
/** Block context hint */
|
|
50
|
+
blockId?: string;
|
|
51
|
+
/** Field type for routing */
|
|
52
|
+
fieldType?: "regular" | "block" | "relation";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* A block was clicked in the preview.
|
|
56
|
+
*/
|
|
57
|
+
type BlockClickedMessage = {
|
|
58
|
+
type: "BLOCK_CLICKED";
|
|
59
|
+
/** Block ID that was clicked */
|
|
60
|
+
blockId: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Preview refresh completed.
|
|
64
|
+
* Sent after preview successfully re-runs loader.
|
|
65
|
+
*/
|
|
66
|
+
type RefreshCompleteMessage = {
|
|
67
|
+
type: "REFRESH_COMPLETE";
|
|
68
|
+
/** Timestamp of completion */
|
|
69
|
+
timestamp: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* All messages from Preview to Admin.
|
|
73
|
+
*/
|
|
74
|
+
type PreviewToAdminMessage = PreviewReadyMessage | FieldClickedMessage | BlockClickedMessage | RefreshCompleteMessage;
|
|
75
|
+
/**
|
|
76
|
+
* Preview configuration for a collection.
|
|
77
|
+
*/
|
|
78
|
+
type PreviewConfig = {
|
|
79
|
+
/**
|
|
80
|
+
* URL builder for preview iframe.
|
|
81
|
+
* Receives current form values and locale.
|
|
82
|
+
*/
|
|
83
|
+
url: (values: Record<string, unknown>, locale: string) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Enable/disable preview.
|
|
86
|
+
* @default true if url is defined
|
|
87
|
+
*/
|
|
88
|
+
enabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Preview pane position.
|
|
91
|
+
* @default "right"
|
|
92
|
+
*/
|
|
93
|
+
position?: "right" | "bottom" | "modal";
|
|
94
|
+
/**
|
|
95
|
+
* Default preview pane size (percentage).
|
|
96
|
+
* @default 50
|
|
97
|
+
*/
|
|
98
|
+
defaultSize?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Minimum pane size (percentage).
|
|
101
|
+
* @default 30
|
|
102
|
+
*/
|
|
103
|
+
minSize?: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Check if a message is from admin to preview.
|
|
107
|
+
*/
|
|
108
|
+
declare function isAdminToPreviewMessage(data: unknown): data is AdminToPreviewMessage;
|
|
109
|
+
/**
|
|
110
|
+
* Check if a message is from preview to admin.
|
|
111
|
+
*/
|
|
112
|
+
declare function isPreviewToAdminMessage(data: unknown): data is PreviewToAdminMessage;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { AdminToPreviewMessage, BlockClickedMessage, FieldClickedMessage, FocusFieldMessage, PreviewConfig, PreviewReadyMessage, PreviewRefreshMessage, PreviewToAdminMessage, RefreshCompleteMessage, SelectBlockMessage, isAdminToPreviewMessage, isPreviewToAdminMessage };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/client/preview/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a message is from admin to preview.
|
|
4
|
+
*/
|
|
5
|
+
function isAdminToPreviewMessage(data) {
|
|
6
|
+
if (!data || typeof data !== "object") return false;
|
|
7
|
+
const msg = data;
|
|
8
|
+
return msg.type === "PREVIEW_REFRESH" || msg.type === "SELECT_BLOCK" || msg.type === "FOCUS_FIELD";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if a message is from preview to admin.
|
|
12
|
+
*/
|
|
13
|
+
function isPreviewToAdminMessage(data) {
|
|
14
|
+
if (!data || typeof data !== "object") return false;
|
|
15
|
+
const msg = data;
|
|
16
|
+
return msg.type === "PREVIEW_READY" || msg.type === "FIELD_CLICKED" || msg.type === "BLOCK_CLICKED" || msg.type === "REFRESH_COMPLETE";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isAdminToPreviewMessage, isPreviewToAdminMessage };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/client/preview/use-collection-preview.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* useCollectionPreview Hook
|
|
4
|
+
*
|
|
5
|
+
* Hook for frontend pages to receive live preview data from admin.
|
|
6
|
+
* Handles postMessage communication with the admin iframe parent.
|
|
7
|
+
*/
|
|
8
|
+
type UseCollectionPreviewOptions<TData> = {
|
|
9
|
+
/** Server-loaded data (from loader/SSR) */
|
|
10
|
+
initialData: TData;
|
|
11
|
+
/**
|
|
12
|
+
* Callback to refresh data (e.g., router.invalidate()).
|
|
13
|
+
* Required for preview functionality.
|
|
14
|
+
*/
|
|
15
|
+
onRefresh: () => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
type UseCollectionPreviewResult<TData> = {
|
|
18
|
+
/** Current data (from initialData, refreshed via onRefresh) */
|
|
19
|
+
data: TData;
|
|
20
|
+
/** Whether we're in preview mode (inside admin iframe) */
|
|
21
|
+
isPreviewMode: boolean;
|
|
22
|
+
/** Currently selected block ID */
|
|
23
|
+
selectedBlockId: string | null;
|
|
24
|
+
/** Focused field path */
|
|
25
|
+
focusedField: string | null;
|
|
26
|
+
/** Call when a field is clicked in preview */
|
|
27
|
+
handleFieldClick: (fieldPath: string, context?: {
|
|
28
|
+
blockId?: string;
|
|
29
|
+
fieldType?: "regular" | "block" | "relation";
|
|
30
|
+
}) => void;
|
|
31
|
+
/** Call when a block is clicked in preview */
|
|
32
|
+
handleBlockClick: (blockId: string) => void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Hook for receiving live preview data from admin.
|
|
36
|
+
*
|
|
37
|
+
* Use this in your frontend page components to enable live preview.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* function PageRoute() {
|
|
42
|
+
* const loaderData = Route.useLoaderData();
|
|
43
|
+
* const router = useRouter();
|
|
44
|
+
*
|
|
45
|
+
* const { data, isPreviewMode, selectedBlockId, handleBlockClick } =
|
|
46
|
+
* useCollectionPreview({
|
|
47
|
+
* initialData: loaderData.page,
|
|
48
|
+
* onRefresh: () => router.invalidate(),
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* return (
|
|
52
|
+
* <article>
|
|
53
|
+
* <PreviewField field="title" as="h1">{data.title}</PreviewField>
|
|
54
|
+
* <BlockRenderer
|
|
55
|
+
* content={data.content}
|
|
56
|
+
* blocks={blocks}
|
|
57
|
+
* selectedBlockId={selectedBlockId}
|
|
58
|
+
* onBlockClick={handleBlockClick}
|
|
59
|
+
* />
|
|
60
|
+
* </article>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function useCollectionPreview<TData extends Record<string, unknown>>({
|
|
66
|
+
initialData,
|
|
67
|
+
onRefresh
|
|
68
|
+
}: UseCollectionPreviewOptions<TData>): UseCollectionPreviewResult<TData>;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { UseCollectionPreviewOptions, UseCollectionPreviewResult, useCollectionPreview };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/client/preview/use-collection-preview.ts
|
|
7
|
+
/**
|
|
8
|
+
* useCollectionPreview Hook
|
|
9
|
+
*
|
|
10
|
+
* Hook for frontend pages to receive live preview data from admin.
|
|
11
|
+
* Handles postMessage communication with the admin iframe parent.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Hook for receiving live preview data from admin.
|
|
15
|
+
*
|
|
16
|
+
* Use this in your frontend page components to enable live preview.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* function PageRoute() {
|
|
21
|
+
* const loaderData = Route.useLoaderData();
|
|
22
|
+
* const router = useRouter();
|
|
23
|
+
*
|
|
24
|
+
* const { data, isPreviewMode, selectedBlockId, handleBlockClick } =
|
|
25
|
+
* useCollectionPreview({
|
|
26
|
+
* initialData: loaderData.page,
|
|
27
|
+
* onRefresh: () => router.invalidate(),
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* return (
|
|
31
|
+
* <article>
|
|
32
|
+
* <PreviewField field="title" as="h1">{data.title}</PreviewField>
|
|
33
|
+
* <BlockRenderer
|
|
34
|
+
* content={data.content}
|
|
35
|
+
* blocks={blocks}
|
|
36
|
+
* selectedBlockId={selectedBlockId}
|
|
37
|
+
* onBlockClick={handleBlockClick}
|
|
38
|
+
* />
|
|
39
|
+
* </article>
|
|
40
|
+
* );
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
function useCollectionPreview(t0) {
|
|
45
|
+
const $ = c(11);
|
|
46
|
+
const { initialData, onRefresh } = t0;
|
|
47
|
+
const [selectedBlockId, setSelectedBlockId] = React.useState(null);
|
|
48
|
+
const [focusedField, setFocusedField] = React.useState(null);
|
|
49
|
+
let t1;
|
|
50
|
+
bb0: {
|
|
51
|
+
if (typeof window === "undefined") {
|
|
52
|
+
t1 = false;
|
|
53
|
+
break bb0;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
t1 = window.self !== window.top;
|
|
57
|
+
} catch {
|
|
58
|
+
t1 = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const isPreviewMode = t1;
|
|
62
|
+
const onRefreshRef = React.useRef(onRefresh);
|
|
63
|
+
let t2;
|
|
64
|
+
let t3;
|
|
65
|
+
if ($[0] !== onRefresh) {
|
|
66
|
+
t2 = () => {
|
|
67
|
+
onRefreshRef.current = onRefresh;
|
|
68
|
+
};
|
|
69
|
+
t3 = [onRefresh];
|
|
70
|
+
$[0] = onRefresh;
|
|
71
|
+
$[1] = t2;
|
|
72
|
+
$[2] = t3;
|
|
73
|
+
} else {
|
|
74
|
+
t2 = $[1];
|
|
75
|
+
t3 = $[2];
|
|
76
|
+
}
|
|
77
|
+
React.useEffect(t2, t3);
|
|
78
|
+
let t4;
|
|
79
|
+
let t5;
|
|
80
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
81
|
+
t4 = () => {
|
|
82
|
+
if (!isPreviewMode) return;
|
|
83
|
+
window.parent.postMessage({ type: "PREVIEW_READY" }, "*");
|
|
84
|
+
const handleMessage = async (event) => {
|
|
85
|
+
const message = event.data;
|
|
86
|
+
if (!message || typeof message !== "object" || !message.type) return;
|
|
87
|
+
bb32: switch (message.type) {
|
|
88
|
+
case "PREVIEW_REFRESH":
|
|
89
|
+
await onRefreshRef.current();
|
|
90
|
+
window.parent.postMessage({
|
|
91
|
+
type: "REFRESH_COMPLETE",
|
|
92
|
+
timestamp: Date.now()
|
|
93
|
+
}, "*");
|
|
94
|
+
break bb32;
|
|
95
|
+
case "SELECT_BLOCK":
|
|
96
|
+
setSelectedBlockId(message.blockId);
|
|
97
|
+
break bb32;
|
|
98
|
+
case "FOCUS_FIELD":
|
|
99
|
+
setFocusedField(message.fieldPath);
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
const element = document.querySelector(`[data-preview-field="${message.fieldPath}"]`);
|
|
102
|
+
if (element) element.scrollIntoView({
|
|
103
|
+
behavior: "smooth",
|
|
104
|
+
block: "center"
|
|
105
|
+
});
|
|
106
|
+
}, 150);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
window.addEventListener("message", handleMessage);
|
|
110
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
111
|
+
};
|
|
112
|
+
t5 = [isPreviewMode];
|
|
113
|
+
$[3] = t4;
|
|
114
|
+
$[4] = t5;
|
|
115
|
+
} else {
|
|
116
|
+
t4 = $[3];
|
|
117
|
+
t5 = $[4];
|
|
118
|
+
}
|
|
119
|
+
React.useEffect(t4, t5);
|
|
120
|
+
let t6;
|
|
121
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
122
|
+
t6 = (fieldPath, context) => {
|
|
123
|
+
if (isPreviewMode) window.parent.postMessage({
|
|
124
|
+
type: "FIELD_CLICKED",
|
|
125
|
+
fieldPath,
|
|
126
|
+
blockId: context?.blockId,
|
|
127
|
+
fieldType: context?.fieldType
|
|
128
|
+
}, "*");
|
|
129
|
+
};
|
|
130
|
+
$[5] = t6;
|
|
131
|
+
} else t6 = $[5];
|
|
132
|
+
const handleFieldClick = t6;
|
|
133
|
+
let t7;
|
|
134
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t7 = (blockId) => {
|
|
136
|
+
if (isPreviewMode) window.parent.postMessage({
|
|
137
|
+
type: "BLOCK_CLICKED",
|
|
138
|
+
blockId
|
|
139
|
+
}, "*");
|
|
140
|
+
};
|
|
141
|
+
$[6] = t7;
|
|
142
|
+
} else t7 = $[6];
|
|
143
|
+
const handleBlockClick = t7;
|
|
144
|
+
let t8;
|
|
145
|
+
if ($[7] !== focusedField || $[8] !== initialData || $[9] !== selectedBlockId) {
|
|
146
|
+
t8 = {
|
|
147
|
+
data: initialData,
|
|
148
|
+
isPreviewMode,
|
|
149
|
+
selectedBlockId,
|
|
150
|
+
focusedField,
|
|
151
|
+
handleFieldClick,
|
|
152
|
+
handleBlockClick
|
|
153
|
+
};
|
|
154
|
+
$[7] = focusedField;
|
|
155
|
+
$[8] = initialData;
|
|
156
|
+
$[9] = selectedBlockId;
|
|
157
|
+
$[10] = t8;
|
|
158
|
+
} else t8 = $[10];
|
|
159
|
+
return t8;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { useCollectionPreview };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|