@questpie/admin 1.1.0 → 2.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 +245 -474
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/augmentation.d.mts +315 -0
- package/dist/augmentation.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.d.mts +199 -0
- package/dist/client/blocks/block-registry.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.mjs +88 -0
- package/dist/client/blocks/block-registry.mjs.map +1 -0
- package/dist/client/blocks/block-renderer.d.mts +52 -0
- package/dist/client/blocks/block-renderer.d.mts.map +1 -0
- package/dist/client/blocks/block-renderer.mjs +71 -0
- package/dist/client/blocks/block-renderer.mjs.map +1 -0
- package/dist/client/blocks/index.d.mts +4 -0
- package/dist/client/blocks/prefetch.d.mts +45 -0
- package/dist/client/blocks/prefetch.d.mts.map +1 -0
- package/dist/client/blocks/prefetch.mjs +26 -0
- package/dist/client/blocks/prefetch.mjs.map +1 -0
- package/dist/client/blocks/types.d.mts +69 -0
- package/dist/client/blocks/types.d.mts.map +1 -0
- package/dist/client/blocks/types.mjs +20 -0
- package/dist/client/blocks/types.mjs.map +1 -0
- package/dist/client/builder/admin-builder.d.mts +112 -0
- package/dist/client/builder/admin-builder.d.mts.map +1 -0
- package/dist/client/builder/admin-builder.mjs +185 -0
- package/dist/client/builder/admin-builder.mjs.map +1 -0
- package/dist/client/builder/admin-types.d.mts +73 -0
- package/dist/client/builder/admin-types.d.mts.map +1 -0
- package/dist/client/builder/admin.d.mts +121 -0
- package/dist/client/builder/admin.d.mts.map +1 -0
- package/dist/client/builder/admin.mjs +160 -0
- package/dist/client/builder/admin.mjs.map +1 -0
- package/dist/client/builder/defaults/components.mjs +20 -0
- package/dist/client/builder/defaults/components.mjs.map +1 -0
- package/dist/client/builder/defaults/core.d.mts +354 -0
- package/dist/client/builder/defaults/core.d.mts.map +1 -0
- package/dist/client/builder/defaults/core.mjs +49 -0
- package/dist/client/builder/defaults/core.mjs.map +1 -0
- package/dist/client/builder/defaults/fields.mjs +328 -0
- package/dist/client/builder/defaults/fields.mjs.map +1 -0
- package/dist/client/builder/defaults/pages.mjs +58 -0
- package/dist/client/builder/defaults/pages.mjs.map +1 -0
- package/dist/client/builder/defaults/starter.d.mts +351 -0
- package/dist/client/builder/defaults/starter.d.mts.map +1 -0
- package/dist/client/builder/defaults/starter.mjs +28 -0
- package/dist/client/builder/defaults/starter.mjs.map +1 -0
- package/dist/client/builder/defaults/views.mjs +27 -0
- package/dist/client/builder/defaults/views.mjs.map +1 -0
- package/dist/client/builder/defaults/widgets.mjs +31 -0
- package/dist/client/builder/defaults/widgets.mjs.map +1 -0
- package/dist/client/builder/field/field.d.mts +229 -0
- package/dist/client/builder/field/field.d.mts.map +1 -0
- package/dist/client/builder/field/field.mjs +83 -0
- package/dist/client/builder/field/field.mjs.map +1 -0
- package/dist/client/builder/index.d.mts +36 -0
- package/dist/client/builder/index.d.mts.map +1 -0
- package/dist/client/builder/page/page.d.mts +36 -0
- package/dist/client/builder/page/page.d.mts.map +1 -0
- package/dist/client/builder/page/page.mjs +27 -0
- package/dist/client/builder/page/page.mjs.map +1 -0
- package/dist/client/builder/proxies.d.mts +2 -0
- package/dist/client/builder/proxies.mjs +24 -0
- package/dist/client/builder/proxies.mjs.map +1 -0
- package/dist/client/builder/qa.d.mts +50 -0
- package/dist/client/builder/qa.d.mts.map +1 -0
- package/dist/client/builder/qa.mjs +42 -0
- package/dist/client/builder/qa.mjs.map +1 -0
- package/dist/client/builder/registry.d.mts +70 -0
- package/dist/client/builder/registry.d.mts.map +1 -0
- package/dist/client/builder/types/action-registry.d.mts +2 -0
- package/dist/client/builder/types/action-registry.mjs +142 -0
- package/dist/client/builder/types/action-registry.mjs.map +1 -0
- package/dist/client/builder/types/action-types.d.mts +253 -0
- package/dist/client/builder/types/action-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.d.mts +199 -0
- package/dist/client/builder/types/collection-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.mjs +11 -0
- package/dist/client/builder/types/collection-types.mjs.map +1 -0
- package/dist/client/builder/types/common.d.mts +60 -0
- package/dist/client/builder/types/common.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.d.mts +593 -0
- package/dist/client/builder/types/field-types.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.mjs +19 -0
- package/dist/client/builder/types/field-types.mjs.map +1 -0
- package/dist/client/builder/types/global-types.d.mts +22 -0
- package/dist/client/builder/types/global-types.d.mts.map +1 -0
- package/dist/client/builder/types/ui-config.d.mts +160 -0
- package/dist/client/builder/types/ui-config.d.mts.map +1 -0
- package/dist/client/builder/types/views.d.mts +89 -0
- package/dist/client/builder/types/views.d.mts.map +1 -0
- package/dist/client/builder/types/widget-types.d.mts +563 -0
- package/dist/client/builder/types/widget-types.d.mts.map +1 -0
- package/dist/client/builder/validation.d.mts +3 -0
- package/dist/client/builder/validation.mjs +208 -0
- package/dist/client/builder/validation.mjs.map +1 -0
- package/dist/client/builder/view/view.d.mts +129 -0
- package/dist/client/builder/view/view.d.mts.map +1 -0
- package/dist/client/builder/view/view.mjs +109 -0
- package/dist/client/builder/view/view.mjs.map +1 -0
- package/dist/client/builder/widget/widget.d.mts +33 -0
- package/dist/client/builder/widget/widget.d.mts.map +1 -0
- package/dist/client/builder/widget/widget.mjs +26 -0
- package/dist/client/builder/widget/widget.mjs.map +1 -0
- package/dist/client/components/actions/action-button.d.mts +2 -0
- package/dist/client/components/actions/action-button.mjs +135 -0
- package/dist/client/components/actions/action-button.mjs.map +1 -0
- package/dist/client/components/actions/action-dialog.d.mts +2 -0
- package/dist/client/components/actions/action-dialog.mjs +264 -0
- package/dist/client/components/actions/action-dialog.mjs.map +1 -0
- package/dist/client/components/actions/confirmation-dialog.d.mts +2 -0
- package/dist/client/components/actions/confirmation-dialog.mjs +82 -0
- package/dist/client/components/actions/confirmation-dialog.mjs.map +1 -0
- package/dist/client/components/actions/header-actions.d.mts +2 -0
- package/dist/client/components/actions/header-actions.mjs +117 -0
- package/dist/client/components/actions/header-actions.mjs.map +1 -0
- package/dist/client/components/actions/index.d.mts +4 -0
- package/dist/client/components/admin-link.d.mts +67 -0
- package/dist/client/components/admin-link.d.mts.map +1 -0
- package/dist/client/components/admin-link.mjs +92 -0
- package/dist/client/components/admin-link.mjs.map +1 -0
- package/dist/client/components/auth/auth-guard.d.mts +51 -0
- package/dist/client/components/auth/auth-guard.d.mts.map +1 -0
- package/dist/client/components/auth/auth-guard.mjs +60 -0
- package/dist/client/components/auth/auth-guard.mjs.map +1 -0
- package/dist/client/components/auth/auth-loading.d.mts +36 -0
- package/dist/client/components/auth/auth-loading.d.mts.map +1 -0
- package/dist/client/components/auth/auth-loading.mjs +27 -0
- package/dist/client/components/auth/auth-loading.mjs.map +1 -0
- package/dist/client/components/auth/index.d.mts +2 -0
- package/dist/client/components/blocks/block-canvas.mjs +90 -0
- package/dist/client/components/blocks/block-canvas.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-context.mjs +58 -0
- package/dist/client/components/blocks/block-editor-context.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-layout.mjs +82 -0
- package/dist/client/components/blocks/block-editor-layout.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-provider.mjs +155 -0
- package/dist/client/components/blocks/block-editor-provider.mjs.map +1 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs +70 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs.map +1 -0
- package/dist/client/components/blocks/block-insert-button.mjs +72 -0
- package/dist/client/components/blocks/block-insert-button.mjs.map +1 -0
- package/dist/client/components/blocks/block-item-menu.mjs +161 -0
- package/dist/client/components/blocks/block-item-menu.mjs.map +1 -0
- package/dist/client/components/blocks/block-item.mjs +187 -0
- package/dist/client/components/blocks/block-item.mjs.map +1 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs +190 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs.map +1 -0
- package/dist/client/components/blocks/block-tree.mjs +45 -0
- package/dist/client/components/blocks/block-tree.mjs.map +1 -0
- package/dist/client/components/blocks/block-type-icon.mjs +50 -0
- package/dist/client/components/blocks/block-type-icon.mjs.map +1 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs +186 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs.map +1 -0
- package/dist/client/components/component-renderer.d.mts +125 -0
- package/dist/client/components/component-renderer.d.mts.map +1 -0
- package/dist/client/components/component-renderer.mjs +145 -0
- package/dist/client/components/component-renderer.mjs.map +1 -0
- package/dist/client/components/error-boundary.mjs +92 -0
- package/dist/client/components/error-boundary.mjs.map +1 -0
- package/dist/client/components/fields/array-field.d.mts +44 -0
- package/dist/client/components/fields/array-field.d.mts.map +1 -0
- package/dist/client/components/fields/array-field.mjs +231 -0
- package/dist/client/components/fields/array-field.mjs.map +1 -0
- package/dist/client/components/fields/asset-preview-field.d.mts +52 -0
- package/dist/client/components/fields/asset-preview-field.d.mts.map +1 -0
- package/dist/client/components/fields/asset-preview-field.mjs +60 -0
- package/dist/client/components/fields/asset-preview-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts +41 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +101 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/index.d.mts +1 -0
- package/dist/client/components/fields/boolean-field.d.mts +30 -0
- package/dist/client/components/fields/boolean-field.d.mts.map +1 -0
- package/dist/client/components/fields/boolean-field.mjs +47 -0
- package/dist/client/components/fields/boolean-field.mjs.map +1 -0
- package/dist/client/components/fields/custom-field.d.mts +3 -0
- package/dist/client/components/fields/date-field.d.mts +22 -0
- package/dist/client/components/fields/date-field.d.mts.map +1 -0
- package/dist/client/components/fields/date-field.mjs +42 -0
- package/dist/client/components/fields/date-field.mjs.map +1 -0
- package/dist/client/components/fields/datetime-field.d.mts +23 -0
- package/dist/client/components/fields/datetime-field.d.mts.map +1 -0
- package/dist/client/components/fields/datetime-field.mjs +43 -0
- package/dist/client/components/fields/datetime-field.mjs.map +1 -0
- package/dist/client/components/fields/email-field.d.mts +19 -0
- package/dist/client/components/fields/email-field.d.mts.map +1 -0
- package/dist/client/components/fields/email-field.mjs +38 -0
- package/dist/client/components/fields/email-field.mjs.map +1 -0
- package/dist/client/components/fields/embedded-collection.d.mts +3 -0
- package/dist/client/components/fields/field-types.d.mts +571 -0
- package/dist/client/components/fields/field-types.d.mts.map +1 -0
- package/dist/client/components/fields/field-utils.d.mts +1 -0
- package/dist/client/components/fields/field-utils.mjs +65 -0
- package/dist/client/components/fields/field-utils.mjs.map +1 -0
- package/dist/client/components/fields/field-wrapper.d.mts +3 -0
- package/dist/client/components/fields/field-wrapper.mjs +49 -0
- package/dist/client/components/fields/field-wrapper.mjs.map +1 -0
- package/dist/client/components/fields/index.d.mts +33 -0
- package/dist/client/components/fields/json-field.d.mts +84 -0
- package/dist/client/components/fields/json-field.d.mts.map +1 -0
- package/dist/client/components/fields/json-field.mjs +248 -0
- package/dist/client/components/fields/json-field.mjs.map +1 -0
- package/dist/client/components/fields/locale-badge.d.mts +1 -0
- package/dist/client/components/fields/locale-badge.mjs +17 -0
- package/dist/client/components/fields/locale-badge.mjs.map +1 -0
- package/dist/client/components/fields/number-field.d.mts +23 -0
- package/dist/client/components/fields/number-field.d.mts.map +1 -0
- package/dist/client/components/fields/number-field.mjs +40 -0
- package/dist/client/components/fields/number-field.mjs.map +1 -0
- package/dist/client/components/fields/object-array-field.d.mts +2 -0
- package/dist/client/components/fields/object-array-field.mjs +313 -0
- package/dist/client/components/fields/object-array-field.mjs.map +1 -0
- package/dist/client/components/fields/object-field.d.mts +32 -0
- package/dist/client/components/fields/object-field.d.mts.map +1 -0
- package/dist/client/components/fields/object-field.mjs +128 -0
- package/dist/client/components/fields/object-field.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/cards-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs +140 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/chips-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs +100 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/grid-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs +114 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/index.d.mts +6 -0
- package/dist/client/components/fields/relation/displays/list-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs +128 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/table-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs +134 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/types.d.mts +22 -0
- package/dist/client/components/fields/relation/displays/types.d.mts.map +1 -0
- package/dist/client/components/fields/relation/displays/types.mjs +73 -0
- package/dist/client/components/fields/relation/displays/types.mjs.map +1 -0
- package/dist/client/components/fields/relation/index.d.mts +3 -0
- package/dist/client/components/fields/relation/relation-items-display.d.mts +5 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs +47 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs.map +1 -0
- package/dist/client/components/fields/relation-field.d.mts +134 -0
- package/dist/client/components/fields/relation-field.d.mts.map +1 -0
- package/dist/client/components/fields/relation-field.mjs +106 -0
- package/dist/client/components/fields/relation-field.mjs.map +1 -0
- package/dist/client/components/fields/relation-picker.d.mts +4 -0
- package/dist/client/components/fields/relation-picker.mjs +301 -0
- package/dist/client/components/fields/relation-picker.mjs.map +1 -0
- package/dist/client/components/fields/relation-select.d.mts +3 -0
- package/dist/client/components/fields/relation-select.mjs +219 -0
- package/dist/client/components/fields/relation-select.mjs.map +1 -0
- package/dist/client/components/fields/reverse-relation-field.d.mts +2 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +56 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +118 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +196 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +4 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +187 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +86 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +11 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +145 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +280 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts +78 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs +31 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs +51 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/variants.d.mts +2 -0
- package/dist/client/components/fields/rich-text-field.d.mts +14 -0
- package/dist/client/components/fields/rich-text-field.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-field.mjs +26 -0
- package/dist/client/components/fields/rich-text-field.mjs.map +1 -0
- package/dist/client/components/fields/select-field.d.mts +25 -0
- package/dist/client/components/fields/select-field.d.mts.map +1 -0
- package/dist/client/components/fields/select-field.mjs +53 -0
- package/dist/client/components/fields/select-field.mjs.map +1 -0
- package/dist/client/components/fields/status-field.d.mts +2 -0
- package/dist/client/components/fields/text-field.d.mts +22 -0
- package/dist/client/components/fields/text-field.d.mts.map +1 -0
- package/dist/client/components/fields/text-field.mjs +39 -0
- package/dist/client/components/fields/text-field.mjs.map +1 -0
- package/dist/client/components/fields/textarea-field.d.mts +22 -0
- package/dist/client/components/fields/textarea-field.d.mts.map +1 -0
- package/dist/client/components/fields/textarea-field.mjs +39 -0
- package/dist/client/components/fields/textarea-field.mjs.map +1 -0
- package/dist/client/components/fields/time-field.d.mts +20 -0
- package/dist/client/components/fields/time-field.d.mts.map +1 -0
- package/dist/client/components/fields/time-field.mjs +39 -0
- package/dist/client/components/fields/time-field.mjs.map +1 -0
- package/dist/client/components/fields/upload-field.d.mts +97 -0
- package/dist/client/components/fields/upload-field.d.mts.map +1 -0
- package/dist/client/components/fields/upload-field.mjs +497 -0
- package/dist/client/components/fields/upload-field.mjs.map +1 -0
- package/dist/client/components/filter-builder/columns-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/columns-tab.mjs +131 -0
- package/dist/client/components/filter-builder/columns-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.d.mts +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +157 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs.map +1 -0
- package/dist/client/components/filter-builder/filters-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/filters-tab.mjs +380 -0
- package/dist/client/components/filter-builder/filters-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/index.d.mts +5 -0
- package/dist/client/components/filter-builder/saved-views-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs +125 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs.map +1 -0
- package/dist/client/components/index.d.mts +80 -0
- package/dist/client/components/locale-switcher.d.mts +2 -0
- package/dist/client/components/locale-switcher.mjs +128 -0
- package/dist/client/components/locale-switcher.mjs.map +1 -0
- package/dist/client/components/media/media-grid.mjs +139 -0
- package/dist/client/components/media/media-grid.mjs.map +1 -0
- package/dist/client/components/media/media-picker-dialog.mjs +255 -0
- package/dist/client/components/media/media-picker-dialog.mjs.map +1 -0
- package/dist/client/components/preview/live-preview-mode.mjs +211 -0
- package/dist/client/components/preview/live-preview-mode.mjs.map +1 -0
- package/dist/client/components/preview/preview-pane.mjs +179 -0
- package/dist/client/components/preview/preview-pane.mjs.map +1 -0
- package/dist/client/components/primitives/asset-preview.mjs +363 -0
- package/dist/client/components/primitives/asset-preview.mjs.map +1 -0
- package/dist/client/components/primitives/checkbox-input.mjs +33 -0
- package/dist/client/components/primitives/checkbox-input.mjs.map +1 -0
- package/dist/client/components/primitives/date-input.mjs +218 -0
- package/dist/client/components/primitives/date-input.mjs.map +1 -0
- package/dist/client/components/primitives/dropzone.mjs +239 -0
- package/dist/client/components/primitives/dropzone.mjs.map +1 -0
- package/dist/client/components/primitives/number-input.mjs +113 -0
- package/dist/client/components/primitives/number-input.mjs.map +1 -0
- package/dist/client/components/primitives/select-multi.mjs +256 -0
- package/dist/client/components/primitives/select-multi.mjs.map +1 -0
- package/dist/client/components/primitives/select-single.mjs +183 -0
- package/dist/client/components/primitives/select-single.mjs.map +1 -0
- package/dist/client/components/primitives/text-input.mjs +40 -0
- package/dist/client/components/primitives/text-input.mjs.map +1 -0
- package/dist/client/components/primitives/textarea-input.mjs +38 -0
- package/dist/client/components/primitives/textarea-input.mjs.map +1 -0
- package/dist/client/components/primitives/time-input.mjs +72 -0
- package/dist/client/components/primitives/time-input.mjs.map +1 -0
- package/dist/client/components/primitives/toggle-input.mjs +31 -0
- package/dist/client/components/primitives/toggle-input.mjs.map +1 -0
- package/dist/client/components/primitives/types.d.mts +14 -0
- package/dist/client/components/primitives/types.d.mts.map +1 -0
- package/dist/client/components/primitives/types.mjs +13 -0
- package/dist/client/components/primitives/types.mjs.map +1 -0
- package/dist/client/components/sheets/index.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.mjs +78 -0
- package/dist/client/components/sheets/resource-sheet.mjs.map +1 -0
- package/dist/client/components/ui/accordion.d.mts +2 -0
- package/dist/client/components/ui/accordion.mjs +50 -0
- package/dist/client/components/ui/accordion.mjs.map +1 -0
- package/dist/client/components/ui/alert.mjs +32 -0
- package/dist/client/components/ui/alert.mjs.map +1 -0
- package/dist/client/components/ui/avatar.d.mts +3 -0
- package/dist/client/components/ui/badge.d.mts +3 -0
- package/dist/client/components/ui/badge.mjs +35 -0
- package/dist/client/components/ui/badge.mjs.map +1 -0
- package/dist/client/components/ui/button.d.mts +3 -0
- package/dist/client/components/ui/button.mjs +49 -0
- package/dist/client/components/ui/button.mjs.map +1 -0
- package/dist/client/components/ui/card.d.mts +2 -0
- package/dist/{card-BKHjBQfw.mjs → client/components/ui/card.mjs} +3 -10
- package/dist/{card-BKHjBQfw.mjs.map → client/components/ui/card.mjs.map} +1 -1
- package/dist/client/components/ui/checkbox.d.mts +2 -0
- package/dist/client/components/ui/checkbox.mjs +27 -0
- package/dist/client/components/ui/checkbox.mjs.map +1 -0
- package/dist/client/components/ui/combobox.d.mts +3 -0
- package/dist/client/components/ui/command.mjs +69 -0
- package/dist/client/components/ui/command.mjs.map +1 -0
- package/dist/client/components/ui/dialog.d.mts +3 -0
- package/dist/client/components/ui/dialog.mjs +83 -0
- package/dist/client/components/ui/dialog.mjs.map +1 -0
- package/dist/client/components/ui/drawer.mjs +75 -0
- package/dist/client/components/ui/drawer.mjs.map +1 -0
- package/dist/client/components/ui/dropdown-menu.d.mts +3 -0
- package/dist/client/components/ui/dropdown-menu.mjs +89 -0
- package/dist/client/components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/client/components/ui/empty-state.mjs +53 -0
- package/dist/client/components/ui/empty-state.mjs.map +1 -0
- package/dist/client/components/ui/field.d.mts +3 -0
- package/dist/client/components/ui/field.mjs +78 -0
- package/dist/client/components/ui/field.mjs.map +1 -0
- package/dist/client/components/ui/input-group.d.mts +4 -0
- package/dist/client/components/ui/input-group.mjs +68 -0
- package/dist/client/components/ui/input-group.mjs.map +1 -0
- package/dist/client/components/ui/input.d.mts +2 -0
- package/dist/client/components/ui/input.mjs +17 -0
- package/dist/client/components/ui/input.mjs.map +1 -0
- package/dist/client/components/ui/kbd.mjs +24 -0
- package/dist/client/components/ui/kbd.mjs.map +1 -0
- package/dist/client/components/ui/label.d.mts +2 -0
- package/dist/client/components/ui/label.mjs +15 -0
- package/dist/client/components/ui/label.mjs.map +1 -0
- package/dist/client/components/ui/popover.d.mts +3 -0
- package/dist/client/components/ui/popover.mjs +49 -0
- package/dist/client/components/ui/popover.mjs.map +1 -0
- package/dist/client/components/ui/responsive-dialog.mjs +102 -0
- package/dist/client/components/ui/responsive-dialog.mjs.map +1 -0
- package/dist/client/components/ui/scroll-area.d.mts +2 -0
- package/dist/client/components/ui/search-input.mjs +74 -0
- package/dist/client/components/ui/search-input.mjs.map +1 -0
- package/dist/client/components/ui/select.d.mts +3 -0
- package/dist/client/components/ui/select.mjs +85 -0
- package/dist/client/components/ui/select.mjs.map +1 -0
- package/dist/client/components/ui/separator.d.mts +2 -0
- package/dist/client/components/ui/separator.mjs +17 -0
- package/dist/client/components/ui/separator.mjs.map +1 -0
- package/dist/client/components/ui/sheet.d.mts +3 -0
- package/dist/client/components/ui/sheet.mjs +78 -0
- package/dist/client/components/ui/sheet.mjs.map +1 -0
- package/dist/client/components/ui/sidebar.d.mts +8 -0
- package/dist/client/components/ui/sidebar.mjs +256 -0
- package/dist/client/components/ui/sidebar.mjs.map +1 -0
- package/dist/client/components/ui/skeleton.d.mts +1 -0
- package/dist/client/components/ui/skeleton.mjs +15 -0
- package/dist/client/components/ui/skeleton.mjs.map +1 -0
- package/dist/client/components/ui/sonner.d.mts +14 -0
- package/dist/client/components/ui/sonner.d.mts.map +1 -0
- package/dist/client/components/ui/sonner.mjs +55 -0
- package/dist/client/components/ui/sonner.mjs.map +1 -0
- package/dist/client/components/ui/spinner.d.mts +1 -0
- package/dist/client/components/ui/spinner.mjs +18 -0
- package/dist/client/components/ui/spinner.mjs.map +1 -0
- package/dist/client/components/ui/switch.d.mts +2 -0
- package/dist/client/components/ui/switch.mjs +23 -0
- package/dist/client/components/ui/switch.mjs.map +1 -0
- package/dist/client/components/ui/table.d.mts +2 -0
- package/dist/client/components/ui/table.mjs +66 -0
- package/dist/client/components/ui/table.mjs.map +1 -0
- package/dist/client/components/ui/tabs.d.mts +3 -0
- package/dist/client/components/ui/tabs.mjs +49 -0
- package/dist/client/components/ui/tabs.mjs.map +1 -0
- package/dist/client/components/ui/textarea.d.mts +2 -0
- package/dist/client/components/ui/textarea.mjs +15 -0
- package/dist/client/components/ui/textarea.mjs.map +1 -0
- package/dist/client/components/ui/toolbar.mjs +54 -0
- package/dist/client/components/ui/toolbar.mjs.map +1 -0
- package/dist/client/components/ui/tooltip.d.mts +2 -0
- package/dist/client/components/ui/tooltip.mjs +45 -0
- package/dist/client/components/ui/tooltip.mjs.map +1 -0
- package/dist/client/components/widgets/chart-widget.d.mts +57 -0
- package/dist/client/components/widgets/chart-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/chart-widget.mjs +282 -0
- package/dist/client/components/widgets/chart-widget.mjs.map +1 -0
- package/dist/client/components/widgets/progress-widget.d.mts +41 -0
- package/dist/client/components/widgets/progress-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/progress-widget.mjs +110 -0
- package/dist/client/components/widgets/progress-widget.mjs.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts +29 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs +121 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts +51 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.mjs +101 -0
- package/dist/client/components/widgets/recent-items-widget.mjs.map +1 -0
- package/dist/client/components/widgets/stats-widget.d.mts +55 -0
- package/dist/client/components/widgets/stats-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/stats-widget.mjs +150 -0
- package/dist/client/components/widgets/stats-widget.mjs.map +1 -0
- package/dist/client/components/widgets/table-widget.d.mts +31 -0
- package/dist/client/components/widgets/table-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/table-widget.mjs +139 -0
- package/dist/client/components/widgets/table-widget.mjs.map +1 -0
- package/dist/client/components/widgets/timeline-widget.d.mts +51 -0
- package/dist/client/components/widgets/timeline-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/timeline-widget.mjs +168 -0
- package/dist/client/components/widgets/timeline-widget.mjs.map +1 -0
- package/dist/client/components/widgets/value-widget.d.mts +39 -0
- package/dist/client/components/widgets/value-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/value-widget.mjs +111 -0
- package/dist/client/components/widgets/value-widget.mjs.map +1 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +145 -0
- package/dist/client/components/widgets/widget-skeletons.mjs.map +1 -0
- package/dist/client/context/focus-context.d.mts +88 -0
- package/dist/client/context/focus-context.d.mts.map +1 -0
- package/dist/client/context/focus-context.mjs +178 -0
- package/dist/client/context/focus-context.mjs.map +1 -0
- package/dist/client/contexts/breadcrumb-context.mjs +32 -0
- package/dist/client/contexts/breadcrumb-context.mjs.map +1 -0
- package/dist/client/hooks/typed-hooks.d.mts +84 -0
- package/dist/client/hooks/typed-hooks.d.mts.map +1 -0
- package/dist/client/hooks/typed-hooks.mjs +272 -0
- package/dist/client/hooks/typed-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-action.mjs +201 -0
- package/dist/client/hooks/use-action.mjs.map +1 -0
- package/dist/client/hooks/use-admin-config.mjs +40 -0
- package/dist/client/hooks/use-admin-config.mjs.map +1 -0
- package/dist/client/hooks/use-admin-preferences.mjs +68 -0
- package/dist/client/hooks/use-admin-preferences.mjs.map +1 -0
- package/dist/client/hooks/use-admin-routes.mjs +97 -0
- package/dist/client/hooks/use-admin-routes.mjs.map +1 -0
- package/dist/client/hooks/use-auth.d.mts +98 -0
- package/dist/client/hooks/use-auth.d.mts.map +1 -0
- package/dist/{use-auth-BoLmWtmU.mjs → client/hooks/use-auth.mjs} +3 -3
- package/dist/client/hooks/use-auth.mjs.map +1 -0
- package/dist/client/hooks/use-collection-fields.mjs +32 -0
- package/dist/client/hooks/use-collection-fields.mjs.map +1 -0
- package/dist/client/hooks/use-collection-meta.mjs +121 -0
- package/dist/client/hooks/use-collection-meta.mjs.map +1 -0
- package/dist/client/hooks/use-collection-schema.mjs +67 -0
- package/dist/client/hooks/use-collection-schema.mjs.map +1 -0
- package/dist/client/hooks/use-collection-validation.mjs +74 -0
- package/dist/client/hooks/use-collection-validation.mjs.map +1 -0
- package/dist/client/hooks/use-collection.d.mts +86 -0
- package/dist/client/hooks/use-collection.d.mts.map +1 -0
- package/dist/client/hooks/use-collection.mjs +214 -0
- package/dist/client/hooks/use-collection.mjs.map +1 -0
- package/dist/client/hooks/use-current-user.d.mts +57 -0
- package/dist/client/hooks/use-current-user.d.mts.map +1 -0
- package/dist/client/hooks/use-current-user.mjs +79 -0
- package/dist/client/hooks/use-current-user.mjs.map +1 -0
- package/dist/client/hooks/use-field-hooks.mjs +191 -0
- package/dist/client/hooks/use-field-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-field-options.d.mts +90 -0
- package/dist/client/hooks/use-field-options.d.mts.map +1 -0
- package/dist/client/hooks/use-field-options.mjs +184 -0
- package/dist/client/hooks/use-field-options.mjs.map +1 -0
- package/dist/client/hooks/use-global-fields.mjs +27 -0
- package/dist/client/hooks/use-global-fields.mjs.map +1 -0
- package/dist/client/hooks/use-global-meta.mjs +59 -0
- package/dist/client/hooks/use-global-meta.mjs.map +1 -0
- package/dist/client/hooks/use-global-schema.mjs +33 -0
- package/dist/client/hooks/use-global-schema.mjs.map +1 -0
- package/dist/client/hooks/use-global.d.mts +40 -0
- package/dist/client/hooks/use-global.d.mts.map +1 -0
- package/dist/client/hooks/use-global.mjs +74 -0
- package/dist/client/hooks/use-global.mjs.map +1 -0
- package/dist/client/hooks/use-locks.mjs +245 -0
- package/dist/client/hooks/use-locks.mjs.map +1 -0
- package/dist/client/hooks/use-media-query.d.mts +23 -0
- package/dist/client/hooks/use-media-query.d.mts.map +1 -0
- package/dist/client/hooks/use-media-query.mjs +62 -0
- package/dist/client/hooks/use-media-query.mjs.map +1 -0
- package/dist/client/hooks/use-prefill-params.mjs +47 -0
- package/dist/client/hooks/use-prefill-params.mjs.map +1 -0
- package/dist/client/hooks/use-questpie-query-options.mjs +28 -0
- package/dist/client/hooks/use-questpie-query-options.mjs.map +1 -0
- package/dist/client/hooks/use-reactive-fields.d.mts +75 -0
- package/dist/client/hooks/use-reactive-fields.d.mts.map +1 -0
- package/dist/client/hooks/use-reactive-fields.mjs +164 -0
- package/dist/client/hooks/use-reactive-fields.mjs.map +1 -0
- package/dist/client/hooks/use-realtime-highlight.mjs +96 -0
- package/dist/client/hooks/use-realtime-highlight.mjs.map +1 -0
- package/dist/client/hooks/use-saved-views.mjs +65 -0
- package/dist/client/hooks/use-saved-views.mjs.map +1 -0
- package/dist/client/hooks/use-search.mjs +147 -0
- package/dist/client/hooks/use-search.mjs.map +1 -0
- package/dist/client/hooks/use-server-validation.mjs +199 -0
- package/dist/client/hooks/use-server-validation.mjs.map +1 -0
- package/dist/client/hooks/use-server-widget-data.d.mts +26 -0
- package/dist/client/hooks/use-server-widget-data.d.mts.map +1 -0
- package/dist/client/hooks/use-server-widget-data.mjs +40 -0
- package/dist/client/hooks/use-server-widget-data.mjs.map +1 -0
- package/dist/client/hooks/use-setup-status.d.mts +39 -0
- package/dist/client/hooks/use-setup-status.d.mts.map +1 -0
- package/dist/client/hooks/use-setup-status.mjs +50 -0
- package/dist/client/hooks/use-setup-status.mjs.map +1 -0
- package/dist/client/hooks/use-upload-collection.mjs +32 -0
- package/dist/client/hooks/use-upload-collection.mjs.map +1 -0
- package/dist/client/hooks/use-upload.d.mts +23 -0
- package/dist/client/hooks/use-upload.d.mts.map +1 -0
- package/dist/client/hooks/use-upload.mjs +145 -0
- package/dist/client/hooks/use-upload.mjs.map +1 -0
- package/dist/client/hooks/use-validation-error-map.mjs +53 -0
- package/dist/client/hooks/use-validation-error-map.mjs.map +1 -0
- package/dist/client/hooks/use-view-state.mjs +261 -0
- package/dist/client/hooks/use-view-state.mjs.map +1 -0
- package/dist/client/i18n/hooks.mjs +160 -0
- package/dist/client/i18n/hooks.mjs.map +1 -0
- package/dist/client/i18n/intl-cache.mjs +65 -0
- package/dist/client/i18n/intl-cache.mjs.map +1 -0
- package/dist/client/i18n/messages.mjs +7 -0
- package/dist/client/i18n/messages.mjs.map +1 -0
- package/dist/client/i18n/simple.d.mts +22 -0
- package/dist/client/i18n/simple.d.mts.map +1 -0
- package/dist/client/i18n/simple.mjs +157 -0
- package/dist/client/i18n/simple.mjs.map +1 -0
- package/dist/client/i18n/types.d.mts +110 -0
- package/dist/client/i18n/types.d.mts.map +1 -0
- package/dist/client/lib/utils.d.mts +1 -0
- package/dist/client/lib/utils.mjs +28 -0
- package/dist/client/lib/utils.mjs.map +1 -0
- package/dist/client/preview/block-scope-context.d.mts +74 -0
- package/dist/client/preview/block-scope-context.d.mts.map +1 -0
- package/dist/client/preview/block-scope-context.mjs +93 -0
- package/dist/client/preview/block-scope-context.mjs.map +1 -0
- package/dist/client/preview/index.d.mts +5 -0
- package/dist/client/preview/preview-banner.d.mts +46 -0
- package/dist/client/preview/preview-banner.d.mts.map +1 -0
- package/dist/client/preview/preview-banner.mjs +95 -0
- package/dist/client/preview/preview-banner.mjs.map +1 -0
- package/dist/client/preview/preview-field.d.mts +108 -0
- package/dist/client/preview/preview-field.d.mts.map +1 -0
- package/dist/client/preview/preview-field.mjs +125 -0
- package/dist/client/preview/preview-field.mjs.map +1 -0
- package/dist/client/preview/types.d.mts +115 -0
- package/dist/client/preview/types.d.mts.map +1 -0
- package/dist/client/preview/types.mjs +21 -0
- package/dist/client/preview/types.mjs.map +1 -0
- package/dist/client/preview/use-collection-preview.d.mts +71 -0
- package/dist/client/preview/use-collection-preview.d.mts.map +1 -0
- package/dist/client/preview/use-collection-preview.mjs +114 -0
- package/dist/client/preview/use-collection-preview.mjs.map +1 -0
- package/dist/client/runtime/content-locales-provider.d.mts +1 -0
- package/dist/client/runtime/content-locales-provider.mjs +85 -0
- package/dist/client/runtime/content-locales-provider.mjs.map +1 -0
- package/dist/client/runtime/index.d.mts +7 -0
- package/dist/client/runtime/index.mjs +8 -0
- package/dist/client/runtime/locale-scope.d.mts +2 -0
- package/dist/{runtime-6VZM878K.mjs → client/runtime/locale-scope.mjs} +3 -4
- package/dist/client/runtime/locale-scope.mjs.map +1 -0
- package/dist/client/runtime/provider.d.mts +10107 -0
- package/dist/client/runtime/provider.d.mts.map +1 -0
- package/dist/client/runtime/provider.mjs +229 -0
- package/dist/client/runtime/provider.mjs.map +1 -0
- package/dist/client/runtime/routes.d.mts +49 -0
- package/dist/client/runtime/routes.d.mts.map +1 -0
- package/dist/client/runtime/routes.mjs +107 -0
- package/dist/client/runtime/routes.mjs.map +1 -0
- package/dist/client/runtime/translations-provider.d.mts +2 -0
- package/dist/client/runtime/translations-provider.mjs +181 -0
- package/dist/client/runtime/translations-provider.mjs.map +1 -0
- package/dist/client/scope/index.d.mts +3 -0
- package/dist/client/scope/picker.d.mts +54 -0
- package/dist/client/scope/picker.d.mts.map +1 -0
- package/dist/client/scope/picker.mjs +161 -0
- package/dist/client/scope/picker.mjs.map +1 -0
- package/dist/client/scope/provider.d.mts +104 -0
- package/dist/client/scope/provider.d.mts.map +1 -0
- package/dist/client/scope/provider.mjs +159 -0
- package/dist/client/scope/provider.mjs.map +1 -0
- package/dist/client/scope/types.d.mts +112 -0
- package/dist/client/scope/types.d.mts.map +1 -0
- package/dist/client/styles/index.css +80 -0
- package/dist/client/utils/auto-expand-fields.mjs +65 -0
- package/dist/client/utils/auto-expand-fields.mjs.map +1 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs +256 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs.map +1 -0
- package/dist/client/utils/detect-relations.mjs +46 -0
- package/dist/client/utils/detect-relations.mjs.map +1 -0
- package/dist/client/utils/locale-to-flag.d.mts +118 -0
- package/dist/client/utils/locale-to-flag.d.mts.map +1 -0
- package/dist/client/utils/locale-to-flag.mjs +130 -0
- package/dist/client/utils/locale-to-flag.mjs.map +1 -0
- package/dist/client/utils/routes.mjs +196 -0
- package/dist/client/utils/routes.mjs.map +1 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +73 -0
- package/dist/client/views/auth/accept-invite-form.d.mts.map +1 -0
- package/dist/client/views/auth/accept-invite-form.mjs +180 -0
- package/dist/client/views/auth/accept-invite-form.mjs.map +1 -0
- package/dist/client/views/auth/auth-layout.d.mts +44 -0
- package/dist/client/views/auth/auth-layout.d.mts.map +1 -0
- package/dist/client/views/auth/auth-layout.mjs +53 -0
- package/dist/client/views/auth/auth-layout.mjs.map +1 -0
- package/dist/client/views/auth/forgot-password-form.d.mts +59 -0
- package/dist/client/views/auth/forgot-password-form.d.mts.map +1 -0
- package/dist/{forgot-password-page-Bcp-An4Y.mjs → client/views/auth/forgot-password-form.mjs} +22 -89
- package/dist/client/views/auth/forgot-password-form.mjs.map +1 -0
- package/dist/client/views/auth/index.d.mts +7 -0
- package/dist/client/views/auth/invite-form.d.mts +1 -0
- package/dist/client/views/auth/invite-form.mjs +155 -0
- package/dist/client/views/auth/invite-form.mjs.map +1 -0
- package/dist/client/views/auth/login-form.d.mts +76 -0
- package/dist/client/views/auth/login-form.d.mts.map +1 -0
- package/dist/client/views/auth/login-form.mjs +167 -0
- package/dist/client/views/auth/login-form.mjs.map +1 -0
- package/dist/client/views/auth/reset-password-form.d.mts +66 -0
- package/dist/client/views/auth/reset-password-form.d.mts.map +1 -0
- package/dist/client/views/auth/reset-password-form.mjs +188 -0
- package/dist/client/views/auth/reset-password-form.mjs.map +1 -0
- package/dist/client/views/auth/setup-form.d.mts +61 -0
- package/dist/client/views/auth/setup-form.d.mts.map +1 -0
- package/dist/{setup-page-YAP_fzqh.mjs → client/views/auth/setup-form.mjs} +46 -124
- package/dist/client/views/auth/setup-form.mjs.map +1 -0
- package/dist/client/views/collection/auto-form-fields.d.mts +4 -0
- package/dist/client/views/collection/auto-form-fields.mjs +453 -0
- package/dist/client/views/collection/auto-form-fields.mjs.map +1 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs +291 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts +46 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.mjs +327 -0
- package/dist/client/views/collection/cells/complex-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/index.d.mts +7 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts +76 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs +165 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts +21 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.mjs +105 -0
- package/dist/client/views/collection/cells/relation-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +189 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.d.mts +2 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs +78 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +37 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts +25 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.mjs +20 -0
- package/dist/client/views/collection/cells/upload-cells.mjs.map +1 -0
- package/dist/client/views/collection/columns/build-columns.d.mts +2 -0
- package/dist/client/views/collection/columns/build-columns.mjs +156 -0
- package/dist/client/views/collection/columns/build-columns.mjs.map +1 -0
- package/dist/client/views/collection/columns/column-defaults.d.mts +2 -0
- package/dist/client/views/collection/columns/column-defaults.mjs +108 -0
- package/dist/client/views/collection/columns/column-defaults.mjs.map +1 -0
- package/dist/client/views/collection/columns/index.d.mts +3 -0
- package/dist/client/views/collection/columns/types.d.mts +2 -0
- package/dist/client/views/collection/field-context.mjs +127 -0
- package/dist/client/views/collection/field-context.mjs.map +1 -0
- package/dist/client/views/collection/field-renderer.mjs +171 -0
- package/dist/client/views/collection/field-renderer.mjs.map +1 -0
- package/dist/client/views/collection/form-view.d.mts +112 -0
- package/dist/client/views/collection/form-view.d.mts.map +1 -0
- package/dist/client/views/collection/form-view.mjs +903 -0
- package/dist/client/views/collection/form-view.mjs.map +1 -0
- package/dist/client/views/collection/index.d.mts +9 -0
- package/dist/client/views/collection/table-view.d.mts +102 -0
- package/dist/client/views/collection/table-view.d.mts.map +1 -0
- package/dist/client/views/collection/table-view.mjs +695 -0
- package/dist/client/views/collection/table-view.mjs.map +1 -0
- package/dist/client/views/collection/view-skeletons.mjs +121 -0
- package/dist/client/views/collection/view-skeletons.mjs.map +1 -0
- package/dist/client/views/common/global-search.d.mts +1 -0
- package/dist/client/views/common/global-search.mjs +376 -0
- package/dist/client/views/common/global-search.mjs.map +1 -0
- package/dist/client/views/common/index.d.mts +1 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs +385 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs.map +1 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs +178 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs.map +1 -0
- package/dist/client/views/dashboard/widget-card.mjs +159 -0
- package/dist/client/views/dashboard/widget-card.mjs.map +1 -0
- package/dist/client/views/globals/global-form-view.d.mts +74 -0
- package/dist/client/views/globals/global-form-view.d.mts.map +1 -0
- package/dist/client/views/globals/global-form-view.mjs +181 -0
- package/dist/client/views/globals/global-form-view.mjs.map +1 -0
- package/dist/client/views/index.d.mts +28 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts +140 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout-provider.mjs +90 -0
- package/dist/client/views/layout/admin-layout-provider.mjs.map +1 -0
- package/dist/client/views/layout/admin-layout.d.mts +151 -0
- package/dist/client/views/layout/admin-layout.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout.mjs +144 -0
- package/dist/client/views/layout/admin-layout.mjs.map +1 -0
- package/dist/client/views/layout/admin-root.d.mts +7 -0
- package/dist/client/views/layout/admin-router.d.mts +125 -0
- package/dist/client/views/layout/admin-router.d.mts.map +1 -0
- package/dist/client/views/layout/admin-router.mjs +594 -0
- package/dist/client/views/layout/admin-router.mjs.map +1 -0
- package/dist/client/views/layout/admin-sidebar.d.mts +105 -0
- package/dist/client/views/layout/admin-sidebar.d.mts.map +1 -0
- package/dist/client/views/layout/admin-sidebar.mjs +550 -0
- package/dist/client/views/layout/admin-sidebar.mjs.map +1 -0
- package/dist/client/views/layout/admin-topbar.mjs +128 -0
- package/dist/client/views/layout/admin-topbar.mjs.map +1 -0
- package/dist/client/views/layout/index.d.mts +5 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +67 -0
- package/dist/client/views/pages/accept-invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/accept-invite-page.mjs +143 -0
- package/dist/client/views/pages/accept-invite-page.mjs.map +1 -0
- package/dist/client/views/pages/dashboard-page.d.mts +52 -0
- package/dist/client/views/pages/dashboard-page.d.mts.map +1 -0
- package/dist/client/views/pages/dashboard-page.mjs +45 -0
- package/dist/client/views/pages/dashboard-page.mjs.map +1 -0
- package/dist/client/views/pages/forgot-password-page.d.mts +59 -0
- package/dist/client/views/pages/forgot-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/forgot-password-page.mjs +80 -0
- package/dist/client/views/pages/forgot-password-page.mjs.map +1 -0
- package/dist/client/views/pages/index.d.mts +7 -0
- package/dist/client/views/pages/invite-page.d.mts +71 -0
- package/dist/client/views/pages/invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/invite-page.mjs +86 -0
- package/dist/client/views/pages/invite-page.mjs.map +1 -0
- package/dist/client/views/pages/login-page.d.mts +76 -0
- package/dist/client/views/pages/login-page.d.mts.map +1 -0
- package/dist/client/views/pages/login-page.mjs +98 -0
- package/dist/client/views/pages/login-page.mjs.map +1 -0
- package/dist/client/views/pages/reset-password-page.d.mts +66 -0
- package/dist/client/views/pages/reset-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/reset-password-page.mjs +105 -0
- package/dist/client/views/pages/reset-password-page.mjs.map +1 -0
- package/dist/client/views/pages/setup-page.d.mts +64 -0
- package/dist/client/views/pages/setup-page.d.mts.map +1 -0
- package/dist/client/views/pages/setup-page.mjs +91 -0
- package/dist/client/views/pages/setup-page.mjs.map +1 -0
- package/dist/client.d.mts +92 -3
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +54 -12
- package/dist/components/rich-text/index.d.mts +1 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts +104 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts.map +1 -0
- package/dist/components/rich-text/rich-text-renderer.mjs +210 -0
- package/dist/components/rich-text/rich-text-renderer.mjs.map +1 -0
- package/dist/index.d.mts +62 -3
- package/dist/index.mjs +54 -12
- package/dist/server/adapters/nextjs.d.mts +121 -0
- package/dist/server/adapters/nextjs.d.mts.map +1 -0
- package/dist/server/adapters/nextjs.mjs +111 -0
- package/dist/server/adapters/nextjs.mjs.map +1 -0
- package/dist/server/adapters/tanstack.d.mts +133 -0
- package/dist/server/adapters/tanstack.d.mts.map +1 -0
- package/dist/server/adapters/tanstack.mjs +90 -0
- package/dist/server/adapters/tanstack.mjs.map +1 -0
- package/dist/server/augmentation.d.mts +1523 -0
- package/dist/server/augmentation.d.mts.map +1 -0
- package/dist/server/auth-helpers.d.mts +143 -0
- package/dist/server/auth-helpers.d.mts.map +1 -0
- package/dist/server/auth-helpers.mjs +108 -0
- package/dist/server/auth-helpers.mjs.map +1 -0
- package/dist/server/block/block-builder.d.mts +319 -0
- package/dist/server/block/block-builder.d.mts.map +1 -0
- package/dist/server/block/block-builder.mjs +217 -0
- package/dist/server/block/block-builder.mjs.map +1 -0
- package/dist/server/block/index.d.mts +3 -0
- package/dist/server/block/introspection.d.mts +84 -0
- package/dist/server/block/introspection.d.mts.map +1 -0
- package/dist/server/block/introspection.mjs +89 -0
- package/dist/server/block/introspection.mjs.map +1 -0
- package/dist/server/block/prefetch.d.mts +78 -0
- package/dist/server/block/prefetch.d.mts.map +1 -0
- package/dist/server/block/prefetch.mjs +240 -0
- package/dist/server/block/prefetch.mjs.map +1 -0
- package/dist/server/fields/blocks.d.mts +139 -0
- package/dist/server/fields/blocks.d.mts.map +1 -0
- package/dist/server/fields/blocks.mjs +192 -0
- package/dist/server/fields/blocks.mjs.map +1 -0
- package/dist/server/fields/index.d.mts +48 -0
- package/dist/server/fields/index.d.mts.map +1 -0
- package/dist/server/fields/index.mjs +16 -0
- package/dist/server/fields/index.mjs.map +1 -0
- package/dist/server/fields/rich-text.d.mts +135 -0
- package/dist/server/fields/rich-text.d.mts.map +1 -0
- package/dist/server/fields/rich-text.mjs +188 -0
- package/dist/server/fields/rich-text.mjs.map +1 -0
- package/dist/server/i18n/index.d.mts +16 -0
- package/dist/server/i18n/index.d.mts.map +1 -0
- package/dist/server/i18n/index.mjs +44 -0
- package/dist/server/i18n/index.mjs.map +1 -0
- package/dist/server/i18n/messages/cs.mjs +461 -0
- package/dist/server/i18n/messages/cs.mjs.map +1 -0
- package/dist/server/i18n/messages/de.mjs +461 -0
- package/dist/server/i18n/messages/de.mjs.map +1 -0
- package/dist/server/i18n/messages/en.mjs +493 -0
- package/dist/server/i18n/messages/en.mjs.map +1 -0
- package/dist/server/i18n/messages/es.mjs +461 -0
- package/dist/server/i18n/messages/es.mjs.map +1 -0
- package/dist/server/i18n/messages/fr.mjs +461 -0
- package/dist/server/i18n/messages/fr.mjs.map +1 -0
- package/dist/server/i18n/messages/index.mjs +24 -0
- package/dist/server/i18n/messages/index.mjs.map +1 -0
- package/dist/server/i18n/messages/pl.mjs +461 -0
- package/dist/server/i18n/messages/pl.mjs.map +1 -0
- package/dist/server/i18n/messages/pt.mjs +464 -0
- package/dist/server/i18n/messages/pt.mjs.map +1 -0
- package/dist/server/i18n/messages/sk.mjs +490 -0
- package/dist/server/i18n/messages/sk.mjs.map +1 -0
- package/dist/server/index.d.mts +20 -0
- package/dist/server/modules/admin/functions/admin-config.mjs +348 -0
- package/dist/server/modules/admin/functions/admin-config.mjs.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts +107 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.mjs +331 -0
- package/dist/server/modules/admin/functions/execute-action.mjs.map +1 -0
- package/dist/server/modules/admin/functions/locales.mjs +80 -0
- package/dist/server/modules/admin/functions/locales.mjs.map +1 -0
- package/dist/server/modules/admin/functions/preview.d.mts +70 -0
- package/dist/server/modules/admin/functions/preview.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/preview.mjs +243 -0
- package/dist/server/modules/admin/functions/preview.mjs.map +1 -0
- package/dist/server/modules/admin/functions/reactive.d.mts +99 -0
- package/dist/server/modules/admin/functions/reactive.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/reactive.mjs +378 -0
- package/dist/server/modules/admin/functions/reactive.mjs.map +1 -0
- package/dist/server/modules/admin/functions/setup.d.mts +84 -0
- package/dist/server/modules/admin/functions/setup.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/setup.mjs +131 -0
- package/dist/server/modules/admin/functions/setup.mjs.map +1 -0
- package/dist/server/modules/admin/functions/translations.mjs +125 -0
- package/dist/server/modules/admin/functions/translations.mjs.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts +33 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.mjs +70 -0
- package/dist/server/modules/admin/functions/widget-data.mjs.map +1 -0
- package/dist/server/modules/admin/index.d.mts +16879 -0
- package/dist/server/modules/admin/index.d.mts.map +1 -0
- package/dist/server/modules/admin/index.mjs +249 -0
- package/dist/server/modules/admin/index.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs +48 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs +79 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts +1490 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs +57 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs.map +1 -0
- package/dist/server/patch.d.mts +100 -0
- package/dist/server/patch.d.mts.map +1 -0
- package/dist/server/patch.mjs +1062 -0
- package/dist/server/patch.mjs.map +1 -0
- package/dist/server.d.mts +21 -250
- package/dist/server.mjs +19 -832
- package/dist/shared/preview-utils.d.mts +54 -0
- package/dist/shared/preview-utils.d.mts.map +1 -0
- package/dist/{preview-utils-BKQ9-TMa.mjs → shared/preview-utils.mjs} +2 -2
- package/dist/shared/preview-utils.mjs.map +1 -0
- package/dist/{saved-views.types-BMsz5mCy.d.mts → shared/types/saved-views.types.d.mts} +7 -2
- package/dist/shared/types/saved-views.types.d.mts.map +1 -0
- package/dist/shared.d.mts +3 -57
- package/dist/shared.mjs +1 -1
- package/package.json +12 -17
- 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/client-B7r47hEd.d.mts +0 -13403
- package/dist/client-B7r47hEd.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.map +0 -1
- package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
- package/dist/index-BYyqkWtn.d.mts +0 -2753
- package/dist/index-BYyqkWtn.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.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.map +0 -1
- package/dist/shared.d.mts.map +0 -1
- package/dist/use-auth-BoLmWtmU.mjs.map +0 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
//#region src/server/block/block-builder.ts
|
|
2
|
+
/**
|
|
3
|
+
* Create a component proxy for type-safe icon and UI element references.
|
|
4
|
+
* Used in .admin() config functions.
|
|
5
|
+
*/
|
|
6
|
+
function createComponentProxy(registeredComponentNames = []) {
|
|
7
|
+
const registered = new Set(registeredComponentNames);
|
|
8
|
+
const hasRegistry = registered.size > 0;
|
|
9
|
+
return new Proxy({}, {
|
|
10
|
+
get: (_target, prop) => {
|
|
11
|
+
if (typeof prop !== "string") return;
|
|
12
|
+
if (prop === "then") return;
|
|
13
|
+
if (hasRegistry && !registered.has(prop)) throw new Error(`Unknown component "${prop}" for block admin config. Available components: ${[...registered].sort().join(", ")}`);
|
|
14
|
+
return (props) => {
|
|
15
|
+
if (prop === "icon" && typeof props === "string") return {
|
|
16
|
+
type: "icon",
|
|
17
|
+
props: { name: props }
|
|
18
|
+
};
|
|
19
|
+
if (typeof props === "object" && props !== null) return {
|
|
20
|
+
type: prop,
|
|
21
|
+
props
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
type: prop,
|
|
25
|
+
props: { value: props }
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
has: (_target, prop) => {
|
|
30
|
+
if (typeof prop !== "string") return false;
|
|
31
|
+
return hasRegistry ? registered.has(prop) : true;
|
|
32
|
+
},
|
|
33
|
+
ownKeys: () => hasRegistry ? [...registered] : [],
|
|
34
|
+
getOwnPropertyDescriptor: (_target, prop) => {
|
|
35
|
+
if (typeof prop !== "string") return;
|
|
36
|
+
if (hasRegistry && !registered.has(prop)) return;
|
|
37
|
+
return {
|
|
38
|
+
configurable: true,
|
|
39
|
+
enumerable: hasRegistry,
|
|
40
|
+
writable: false,
|
|
41
|
+
value: (props) => {
|
|
42
|
+
if (prop === "icon" && typeof props === "string") return {
|
|
43
|
+
type: "icon",
|
|
44
|
+
props: { name: props }
|
|
45
|
+
};
|
|
46
|
+
if (typeof props === "object" && props !== null) return {
|
|
47
|
+
type: prop,
|
|
48
|
+
props
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
type: prop,
|
|
52
|
+
props: { value: props }
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Builder class for defining block types.
|
|
61
|
+
*
|
|
62
|
+
* @template TState - Block builder state
|
|
63
|
+
* @template TFieldMap - Field type map for typed field proxy (from builder's registered fields)
|
|
64
|
+
* @template TData - Prefetch data type (set by .prefetch(), preserved through chain)
|
|
65
|
+
*/
|
|
66
|
+
var BlockBuilder = class BlockBuilder {
|
|
67
|
+
_state;
|
|
68
|
+
constructor(state) {
|
|
69
|
+
this._state = state;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Set admin metadata for the block.
|
|
73
|
+
* Follows the same pattern as collection .admin() method.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* block("hero")
|
|
78
|
+
* .admin(({ c }) => ({
|
|
79
|
+
* label: { en: "Hero Section", sk: "Hero sekcia" },
|
|
80
|
+
* icon: c.icon("ph:image"),
|
|
81
|
+
* description: { en: "Full-width hero with background image" },
|
|
82
|
+
* category: {
|
|
83
|
+
* label: { en: "Sections", sk: "Sekcie" },
|
|
84
|
+
* icon: c.icon("ph:layout"),
|
|
85
|
+
* order: 1,
|
|
86
|
+
* },
|
|
87
|
+
* order: 1,
|
|
88
|
+
* hidden: false,
|
|
89
|
+
* }))
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
admin(configOrFn) {
|
|
93
|
+
const registeredComponents = this._state["~components"] ?? [];
|
|
94
|
+
const config = typeof configOrFn === "function" ? configOrFn({ c: createComponentProxy(registeredComponents) }) : configOrFn;
|
|
95
|
+
return new BlockBuilder({
|
|
96
|
+
...this._state,
|
|
97
|
+
admin: config
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Define fields for the block.
|
|
102
|
+
* Uses the same field builder as collections.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* block("hero").fields((f) => ({
|
|
107
|
+
* title: f.text({ required: true }),
|
|
108
|
+
* subtitle: f.text(),
|
|
109
|
+
* image: f.upload({ accept: "image/*" }),
|
|
110
|
+
* }))
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
fields(factory) {
|
|
114
|
+
return new BlockBuilder({
|
|
115
|
+
...this._state,
|
|
116
|
+
_fieldsFactory: factory
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Allow child blocks (for layout blocks).
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* block("columns").allowChildren()
|
|
125
|
+
* block("columns").allowChildren(4) // max 4 children
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
allowChildren(maxChildren) {
|
|
129
|
+
return new BlockBuilder({
|
|
130
|
+
...this._state,
|
|
131
|
+
allowChildren: true,
|
|
132
|
+
maxChildren
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
prefetch(fnOrConfig) {
|
|
136
|
+
if (typeof fnOrConfig === "function") return new BlockBuilder({
|
|
137
|
+
...this._state,
|
|
138
|
+
prefetch: fnOrConfig
|
|
139
|
+
});
|
|
140
|
+
const { with: withFields, loader } = fnOrConfig;
|
|
141
|
+
return new BlockBuilder({
|
|
142
|
+
...this._state,
|
|
143
|
+
prefetchWith: withFields,
|
|
144
|
+
_prefetchLoader: loader
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Build the block definition.
|
|
149
|
+
* Called automatically when registering with .blocks().
|
|
150
|
+
*/
|
|
151
|
+
build() {
|
|
152
|
+
const state = this._state;
|
|
153
|
+
return {
|
|
154
|
+
name: state.name,
|
|
155
|
+
state,
|
|
156
|
+
getFieldMetadata() {
|
|
157
|
+
if (!state.fields) return {};
|
|
158
|
+
const fields = {};
|
|
159
|
+
for (const [name, fieldDef] of Object.entries(state.fields)) fields[name] = {
|
|
160
|
+
name,
|
|
161
|
+
metadata: fieldDef.getMetadata()
|
|
162
|
+
};
|
|
163
|
+
return fields;
|
|
164
|
+
},
|
|
165
|
+
async executePrefetch(values, ctx) {
|
|
166
|
+
if (!state.prefetch) return {};
|
|
167
|
+
return state.prefetch({
|
|
168
|
+
values,
|
|
169
|
+
ctx
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get the current state (for internal use).
|
|
176
|
+
*/
|
|
177
|
+
get state() {
|
|
178
|
+
return this._state;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Create a new server-side block builder.
|
|
183
|
+
*
|
|
184
|
+
* Defines block types with fields, validation, and prefetch logic.
|
|
185
|
+
* Blocks are server-only - the frontend handles rendering independently.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { block } from "@questpie/admin/server";
|
|
190
|
+
*
|
|
191
|
+
* const heroBlock = block("hero")
|
|
192
|
+
* .admin(({ c }) => ({
|
|
193
|
+
* label: { en: "Hero Section" },
|
|
194
|
+
* icon: c.icon("ph:image"),
|
|
195
|
+
* category: {
|
|
196
|
+
* label: { en: "Layout" },
|
|
197
|
+
* },
|
|
198
|
+
* }))
|
|
199
|
+
* .fields((f) => ({
|
|
200
|
+
* title: f.text({ required: true }),
|
|
201
|
+
* subtitle: f.text(),
|
|
202
|
+
* }));
|
|
203
|
+
*
|
|
204
|
+
* // Register blocks on CMS
|
|
205
|
+
* const cms = q({ name: "my-app" })
|
|
206
|
+
* .use(adminModule)
|
|
207
|
+
* .blocks({ hero: heroBlock })
|
|
208
|
+
* .build({ ... });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
function block(name) {
|
|
212
|
+
return new BlockBuilder({ name });
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
export { BlockBuilder, block };
|
|
217
|
+
//# sourceMappingURL=block-builder.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-builder.mjs","names":["fields: Record<string, FieldSchema>"],"sources":["../../../src/server/block/block-builder.ts"],"sourcesContent":["/**\n * Block Builder\n *\n * Defines block types for the visual block editor.\n * Blocks are registered on the CMS builder and can be used in blocks fields.\n *\n * Each block has:\n * - Admin metadata (label, description, icon, category) via .admin()\n * - Fields (using the same field system as collections)\n * - Optional prefetch function (runs on CRUD read to fetch related data)\n * - Optional children configuration (for nested blocks)\n *\n * @example\n * ```ts\n * import { block } from \"@questpie/admin/server\";\n *\n * const heroBlock = block(\"hero\")\n * .admin(({ c }) => ({\n * label: { en: \"Hero Section\", sk: \"Hero sekcia\" },\n * icon: c.icon(\"ph:image\"),\n * category: {\n * label: { en: \"Sections\", sk: \"Sekcie\" },\n * icon: c.icon(\"ph:layout\"),\n * },\n * }))\n * .fields((f) => ({\n * title: f.text({ required: true }),\n * subtitle: f.text(),\n * backgroundImage: f.upload({ accept: \"image/*\" }),\n * }))\n * .prefetch({ with: { backgroundImage: true } });\n * ```\n */\n\nimport type {\n\tFieldBuilderProxy,\n\tFieldDefinition,\n\tFieldDefinitionState,\n\tFieldSchema,\n\tRegisteredApp,\n} from \"questpie\";\nimport type { AdminBlockConfig, AdminConfigContext } from \"../augmentation.js\";\n\n// ============================================================================\n// Block Types\n// ============================================================================\n\n/**\n * Block prefetch context.\n * Provided to prefetch functions to fetch related data.\n *\n * When you register your app via `Register.app`, `ctx.app` is automatically typed.\n * For module-scoped typing, use `getApp<T>(ctx.app)`.\n *\n * @example\n * ```ts\n * // questpie.gen.ts - register your app for automatic typing\n * declare module \"questpie\" {\n * interface Register {\n * app: typeof import(\"./cms\").baseCms.$inferCms;\n * }\n * }\n *\n * // blocks.ts - ctx.app is now typed\n * .prefetch(async ({ values, ctx }) => {\n * const res = await ctx.app.api.collections.posts.find({ limit: 5 });\n * return { posts: res.docs };\n * })\n * ```\n */\nexport interface BlockPrefetchContext {\n\t/** Block instance ID */\n\tblockId: string;\n\t/** Block type name */\n\tblockType: string;\n\t/** CMS app instance — typed via Register.app */\n\tapp: RegisteredApp;\n\t/** Current locale */\n\tlocale?: string;\n\t/** Database client */\n\tdb: unknown;\n}\n\n/**\n * Block prefetch function.\n * Runs during CRUD read to fetch related data for the block.\n * The returned data is attached to `_data[blockId]` in the response.\n */\nexport type BlockPrefetchFn<TValues = Record<string, unknown>> = (params: {\n\t/** Block field values */\n\tvalues: TValues;\n\t/** Prefetch context */\n\tctx: BlockPrefetchContext;\n}) => Promise<Record<string, unknown>> | Record<string, unknown>;\n\n/**\n * Expanded record from expansion of relation/upload fields.\n * Contains at minimum an `id` field plus any other fields from the referenced record.\n */\nexport type ExpandedRecord = Record<string, unknown> & { id: string };\n\n/**\n * Options for a single relation inside a block prefetch `with` clause.\n * Same syntax as find's `with`, but only nested `with` is supported —\n * query options (where, orderBy, limit, etc.) don't apply to block field expansion.\n *\n * Nested `with` is passed through to the collection's `find` call,\n * reusing the existing relation resolution machinery.\n */\nexport type BlockPrefetchWithOptions = {\n\twith?: Record<string, true | BlockPrefetchWithOptions>;\n};\n\n/**\n * Block prefetch `with` clause.\n * Same object syntax as `with` in find operations.\n *\n * Each key is a relation/upload field name. Value can be:\n * - `true` — expand the field to a full record\n * - `{ with: { ... } }` — expand with nested relation loading\n *\n * @example\n * ```ts\n * // Simple expansion\n * .prefetch({ with: { backgroundImage: true } })\n *\n * // Nested expansion (e.g., expand author and their avatar)\n * .prefetch({ with: { author: { with: { avatar: true } } } })\n * ```\n */\nexport type BlockPrefetchWith<TFields = Record<string, unknown>> = {\n\t[K in keyof TFields]?: true | BlockPrefetchWithOptions;\n};\n\n/**\n * Compute the expanded data type from a `with` config object.\n * Each key that is `true` or `{ with: ... }` produces `ExpandedRecord | null`.\n */\nexport type ExpandWithResult<TWith> = {\n\t[K in keyof TWith as TWith[K] extends false | undefined\n\t\t? never\n\t\t: K]: ExpandedRecord | null;\n};\n\n/**\n * Block builder state.\n */\nexport interface BlockBuilderState<\n\tTName extends string = string,\n\tTFields extends Record<\n\t\tstring,\n\t\tFieldDefinition<FieldDefinitionState>\n\t> = Record<string, FieldDefinition<FieldDefinitionState>>,\n> {\n\t/** Block type name */\n\tname: TName;\n\t/** Admin configuration (label, icon, description, category, etc.) */\n\tadmin?: AdminBlockConfig;\n\t/** Field definitions */\n\tfields?: TFields;\n\t/** Allow child blocks */\n\tallowChildren?: boolean;\n\t/** Maximum number of child blocks */\n\tmaxChildren?: number;\n\t/** Prefetch function (Shape 1: pure function) */\n\tprefetch?: BlockPrefetchFn<any>;\n\t/** Relation fields to expand via `.prefetch({ with: { ... } })` */\n\tprefetchWith?: BlockPrefetchWith;\n\t/** Loader function for `.prefetch({ with, loader })` (Shape 3) */\n\t_prefetchLoader?: (params: {\n\t\tvalues: any;\n\t\texpanded: Record<string, unknown>;\n\t\tctx: BlockPrefetchContext;\n\t}) => Promise<Record<string, unknown>> | Record<string, unknown>;\n\t/** Type-level marker for prefetch data type (not used at runtime) */\n\t\"~prefetchData\"?: unknown;\n\t/** Optional registered component names from Questpie builder registry */\n\t\"~components\"?: string[];\n}\n\n/**\n * Block definition - the built block ready for registration.\n */\nexport interface BlockDefinition<\n\tTState extends BlockBuilderState = BlockBuilderState,\n> {\n\t/** Block type name */\n\treadonly name: TState[\"name\"];\n\t/** Full state */\n\treadonly state: TState;\n\t/** Get field metadata for introspection */\n\tgetFieldMetadata(): Record<string, FieldSchema>;\n\t/** Execute prefetch if defined */\n\texecutePrefetch(\n\t\tvalues: Record<string, unknown>,\n\t\tctx: BlockPrefetchContext,\n\t): Promise<Record<string, unknown>>;\n}\n\n// ============================================================================\n// Component Proxy Factory (same pattern as collections)\n// ============================================================================\n\n/**\n * Create a component proxy for type-safe icon and UI element references.\n * Used in .admin() config functions.\n */\nfunction createComponentProxy(\n\tregisteredComponentNames: string[] = [],\n): AdminConfigContext[\"c\"] {\n\tconst registered = new Set(registeredComponentNames);\n\tconst hasRegistry = registered.size > 0;\n\n\treturn new Proxy(\n\t\t{} as Record<string, (props: Record<string, unknown> | string) => unknown>,\n\t\t{\n\t\t\tget: (_target, prop: string | symbol) => {\n\t\t\t\tif (typeof prop !== \"string\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tif (prop === \"then\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tif (hasRegistry && !registered.has(prop)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Unknown component \"${prop}\" for block admin config. ` +\n\t\t\t\t\t\t\t`Available components: ${[...registered].sort().join(\", \")}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (props: Record<string, unknown> | string) => {\n\t\t\t\t\tif (prop === \"icon\" && typeof props === \"string\") {\n\t\t\t\t\t\treturn { type: \"icon\", props: { name: props } } as const;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof props === \"object\" && props !== null) {\n\t\t\t\t\t\treturn { type: prop, props } as const;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { type: prop, props: { value: props } } as const;\n\t\t\t\t};\n\t\t\t},\n\t\t\thas: (_target, prop: string | symbol) => {\n\t\t\t\tif (typeof prop !== \"string\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn hasRegistry ? registered.has(prop) : true;\n\t\t\t},\n\t\t\townKeys: () => (hasRegistry ? [...registered] : []),\n\t\t\tgetOwnPropertyDescriptor: (_target, prop: string | symbol) => {\n\t\t\t\tif (typeof prop !== \"string\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tif (hasRegistry && !registered.has(prop)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: hasRegistry,\n\t\t\t\t\twritable: false,\n\t\t\t\t\tvalue: (props: Record<string, unknown> | string) => {\n\t\t\t\t\t\tif (prop === \"icon\" && typeof props === \"string\") {\n\t\t\t\t\t\t\treturn { type: \"icon\", props: { name: props } } as const;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof props === \"object\" && props !== null) {\n\t\t\t\t\t\t\treturn { type: prop, props } as const;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn { type: prop, props: { value: props } } as const;\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t) as AdminConfigContext[\"c\"];\n}\n\n// ============================================================================\n// Block Builder Class\n// ============================================================================\n\n/**\n * Builder class for defining block types.\n *\n * @template TState - Block builder state\n * @template TFieldMap - Field type map for typed field proxy (from builder's registered fields)\n * @template TData - Prefetch data type (set by .prefetch(), preserved through chain)\n */\nexport class BlockBuilder<\n\tTState extends BlockBuilderState = BlockBuilderState,\n\tTFieldMap extends Record<string, any> = Record<string, any>,\n\tTData = Record<string, unknown>,\n> {\n\tprivate _state: TState;\n\n\tconstructor(state: TState) {\n\t\tthis._state = state;\n\t}\n\n\t/**\n\t * Set admin metadata for the block.\n\t * Follows the same pattern as collection .admin() method.\n\t *\n\t * @example\n\t * ```ts\n\t * block(\"hero\")\n\t * .admin(({ c }) => ({\n\t * label: { en: \"Hero Section\", sk: \"Hero sekcia\" },\n\t * icon: c.icon(\"ph:image\"),\n\t * description: { en: \"Full-width hero with background image\" },\n\t * category: {\n\t * label: { en: \"Sections\", sk: \"Sekcie\" },\n\t * icon: c.icon(\"ph:layout\"),\n\t * order: 1,\n\t * },\n\t * order: 1,\n\t * hidden: false,\n\t * }))\n\t * ```\n\t */\n\tadmin(\n\t\tconfigOrFn:\n\t\t\t| AdminBlockConfig\n\t\t\t| ((ctx: AdminConfigContext) => AdminBlockConfig),\n\t): BlockBuilder<TState & { admin: AdminBlockConfig }, TFieldMap, TData> {\n\t\tconst registeredComponents =\n\t\t\t(this._state as any)[\"~components\"] ?? ([] as string[]);\n\n\t\tconst config =\n\t\t\ttypeof configOrFn === \"function\"\n\t\t\t\t? configOrFn({ c: createComponentProxy(registeredComponents) })\n\t\t\t\t: configOrFn;\n\n\t\treturn new BlockBuilder<\n\t\t\tTState & { admin: AdminBlockConfig },\n\t\t\tTFieldMap,\n\t\t\tTData\n\t\t>({\n\t\t\t...this._state,\n\t\t\tadmin: config,\n\t\t} as TState & { admin: AdminBlockConfig });\n\t}\n\n\t/**\n\t * Define fields for the block.\n\t * Uses the same field builder as collections.\n\t *\n\t * @example\n\t * ```ts\n\t * block(\"hero\").fields((f) => ({\n\t * title: f.text({ required: true }),\n\t * subtitle: f.text(),\n\t * image: f.upload({ accept: \"image/*\" }),\n\t * }))\n\t * ```\n\t */\n\tfields<\n\t\tTNewFields extends Record<string, FieldDefinition<FieldDefinitionState>>,\n\t>(\n\t\tfactory: (f: FieldBuilderProxy<TFieldMap>) => TNewFields,\n\t): BlockBuilder<\n\t\tOmit<TState, \"fields\"> & { fields: TNewFields },\n\t\tTFieldMap,\n\t\tTData\n\t> {\n\t\t// Store the factory for later resolution when CMS is built\n\t\t// The actual field definitions are created when block is registered\n\t\treturn new BlockBuilder({\n\t\t\t...this._state,\n\t\t\t_fieldsFactory: factory,\n\t\t} as any);\n\t}\n\n\t/**\n\t * Allow child blocks (for layout blocks).\n\t *\n\t * @example\n\t * ```ts\n\t * block(\"columns\").allowChildren()\n\t * block(\"columns\").allowChildren(4) // max 4 children\n\t * ```\n\t */\n\tallowChildren(\n\t\tmaxChildren?: number,\n\t): BlockBuilder<\n\t\tTState & { allowChildren: true; maxChildren?: number },\n\t\tTFieldMap,\n\t\tTData\n\t> {\n\t\treturn new BlockBuilder({\n\t\t\t...this._state,\n\t\t\tallowChildren: true,\n\t\t\tmaxChildren,\n\t\t} as TState & { allowChildren: true; maxChildren?: number });\n\t}\n\n\t/**\n\t * Add prefetch configuration for server-side data fetching.\n\t * Runs during CRUD read to fetch related data for the block.\n\t *\n\t * Supports three shapes:\n\t *\n\t * **Shape 1: Pure function** — return data directly, `TData` inferred from return type.\n\t * ```ts\n\t * .prefetch(async ({ values, ctx }) => {\n\t * return { services: res.docs };\n\t * })\n\t * ```\n\t *\n\t * **Shape 2: Expand relation/upload fields** — same `with` syntax as find operations.\n\t * ```ts\n\t * .prefetch({ with: { backgroundImage: true } })\n\t *\n\t * // Nested expansion (passes through to collection find's `with`)\n\t * .prefetch({ with: { author: { with: { avatar: true } } } })\n\t * ```\n\t *\n\t * **Shape 3: Expand + custom loader** — expand fields, then run a loader with the expanded data.\n\t * ```ts\n\t * .prefetch({\n\t * with: { backgroundImage: true },\n\t * loader: async ({ values, expanded, ctx }) => {\n\t * return { analytics: await getStats() };\n\t * },\n\t * })\n\t * ```\n\t */\n\t// Overload 1: Pure function (Shape 1)\n\tprefetch<TNewData extends Record<string, unknown>>(\n\t\tfn: (params: {\n\t\t\tvalues: InferBlockValues<TState>;\n\t\t\tctx: BlockPrefetchContext;\n\t\t}) => Promise<TNewData> | TNewData,\n\t): BlockBuilder<\n\t\tOmit<TState, \"prefetch\" | \"~prefetchData\"> & {\n\t\t\tprefetch: typeof fn;\n\t\t\t\"~prefetchData\": TNewData;\n\t\t},\n\t\tTFieldMap,\n\t\tTNewData\n\t>;\n\t// Overload 2: Config object with `with` and optional `loader` (Shape 2 & 3)\n\tprefetch<\n\t\tconst TWith extends BlockPrefetchWith<InferBlockValues<TState>>,\n\t\tTLoaderData extends Record<string, unknown> = {},\n\t>(config: {\n\t\twith: TWith;\n\t\tloader?: (params: {\n\t\t\tvalues: InferBlockValues<TState>;\n\t\t\texpanded: ExpandWithResult<TWith>;\n\t\t\tctx: BlockPrefetchContext;\n\t\t}) => Promise<TLoaderData> | TLoaderData;\n\t}): BlockBuilder<\n\t\tOmit<\n\t\t\tTState,\n\t\t\t\"prefetch\" | \"prefetchWith\" | \"_prefetchLoader\" | \"~prefetchData\"\n\t\t> & {\n\t\t\tprefetchWith: TWith;\n\t\t\t\"~prefetchData\": ExpandWithResult<TWith> & TLoaderData;\n\t\t},\n\t\tTFieldMap,\n\t\tExpandWithResult<TWith> & TLoaderData\n\t>;\n\t// Implementation\n\tprefetch(fnOrConfig: any): any {\n\t\tif (typeof fnOrConfig === \"function\") {\n\t\t\treturn new BlockBuilder({\n\t\t\t\t...this._state,\n\t\t\t\tprefetch: fnOrConfig,\n\t\t\t} as any);\n\t\t}\n\n\t\tconst { with: withFields, loader } = fnOrConfig;\n\t\treturn new BlockBuilder({\n\t\t\t...this._state,\n\t\t\tprefetchWith: withFields,\n\t\t\t_prefetchLoader: loader,\n\t\t} as any);\n\t}\n\n\t/**\n\t * Build the block definition.\n\t * Called automatically when registering with .blocks().\n\t */\n\tbuild(): BlockDefinition<TState> {\n\t\tconst state = this._state;\n\n\t\treturn {\n\t\t\tname: state.name,\n\t\t\tstate,\n\t\t\tgetFieldMetadata() {\n\t\t\t\tif (!state.fields) return {};\n\t\t\t\tconst fields: Record<string, FieldSchema> = {};\n\t\t\t\tfor (const [name, fieldDef] of Object.entries(state.fields)) {\n\t\t\t\t\tfields[name] = {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmetadata: fieldDef.getMetadata(),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn fields;\n\t\t\t},\n\t\t\tasync executePrefetch(values, ctx) {\n\t\t\t\tif (!state.prefetch) return {};\n\t\t\t\treturn state.prefetch({ values, ctx });\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Get the current state (for internal use).\n\t */\n\tget state(): TState {\n\t\treturn this._state;\n\t}\n}\n\n// ============================================================================\n// Factory Function\n// ============================================================================\n\n/**\n * Create a new server-side block builder.\n *\n * Defines block types with fields, validation, and prefetch logic.\n * Blocks are server-only - the frontend handles rendering independently.\n *\n * @example\n * ```ts\n * import { block } from \"@questpie/admin/server\";\n *\n * const heroBlock = block(\"hero\")\n * .admin(({ c }) => ({\n * label: { en: \"Hero Section\" },\n * icon: c.icon(\"ph:image\"),\n * category: {\n * label: { en: \"Layout\" },\n * },\n * }))\n * .fields((f) => ({\n * title: f.text({ required: true }),\n * subtitle: f.text(),\n * }));\n *\n * // Register blocks on CMS\n * const cms = q({ name: \"my-app\" })\n * .use(adminModule)\n * .blocks({ hero: heroBlock })\n * .build({ ... });\n * ```\n */\nexport function block<TName extends string>(\n\tname: TName,\n): BlockBuilder<{ name: TName }> {\n\treturn new BlockBuilder({ name });\n}\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\n/**\n * Extract field values type from block state.\n * Infers value type per-field to produce heterogeneous types\n * (e.g., { title: string, count: number, showPrices: boolean }).\n */\nexport type InferBlockValues<TState extends BlockBuilderState> =\n\tTState[\"fields\"] extends Record<string, FieldDefinition<FieldDefinitionState>>\n\t\t? {\n\t\t\t\t[K in keyof TState[\"fields\"]]: TState[\"fields\"][K] extends FieldDefinition<\n\t\t\t\t\tinfer TFieldState\n\t\t\t\t>\n\t\t\t\t\t? TFieldState[\"value\"]\n\t\t\t\t\t: unknown;\n\t\t\t}\n\t\t: Record<string, unknown>;\n\n/**\n * Extract prefetch data type from a block builder or block state.\n * Infers the `data` type based on `.prefetch()` configuration:\n * - Shape 1 (function): return type of the prefetch function\n * - Shape 2 (`{ with }` ): expanded fields as `{ [field]: ExpandedRecord | null }`\n * - Shape 3 (`{ with, loader }`): expanded fields merged with loader return type\n * - No prefetch: `Record<string, unknown>`\n *\n * Accepts either a `BlockBuilder` instance or a `BlockBuilderState`.\n * Prefer passing the builder — state-level extraction may fail when\n * `as any` casts are present in the builder chain.\n */\nexport type InferBlockData<T> =\n\tT extends BlockBuilder<any, any, infer TData>\n\t\t? TData\n\t\t: T extends BlockBuilderState\n\t\t\t? T[\"~prefetchData\"] extends Record<string, unknown>\n\t\t\t\t? T[\"~prefetchData\"]\n\t\t\t\t: Record<string, unknown>\n\t\t\t: Record<string, unknown>;\n\n/**\n * Any block builder (for generic usage).\n */\nexport type AnyBlockBuilder = BlockBuilder<BlockBuilderState, any, any>;\n\n/**\n * Any block definition (for generic usage).\n */\nexport type AnyBlockDefinition = BlockDefinition<BlockBuilderState>;\n"],"mappings":";;;;;AA+MA,SAAS,qBACR,2BAAqC,EAAE,EACb;CAC1B,MAAM,aAAa,IAAI,IAAI,yBAAyB;CACpD,MAAM,cAAc,WAAW,OAAO;AAEtC,QAAO,IAAI,MACV,EAAE,EACF;EACC,MAAM,SAAS,SAA0B;AACxC,OAAI,OAAO,SAAS,SACnB;AAGD,OAAI,SAAS,OACZ;AAGD,OAAI,eAAe,CAAC,WAAW,IAAI,KAAK,CACvC,OAAM,IAAI,MACT,sBAAsB,KAAK,kDACD,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,KAAK,GAC3D;AAGF,WAAQ,UAA4C;AACnD,QAAI,SAAS,UAAU,OAAO,UAAU,SACvC,QAAO;KAAE,MAAM;KAAQ,OAAO,EAAE,MAAM,OAAO;KAAE;AAGhD,QAAI,OAAO,UAAU,YAAY,UAAU,KAC1C,QAAO;KAAE,MAAM;KAAM;KAAO;AAG7B,WAAO;KAAE,MAAM;KAAM,OAAO,EAAE,OAAO,OAAO;KAAE;;;EAGhD,MAAM,SAAS,SAA0B;AACxC,OAAI,OAAO,SAAS,SACnB,QAAO;AAER,UAAO,cAAc,WAAW,IAAI,KAAK,GAAG;;EAE7C,eAAgB,cAAc,CAAC,GAAG,WAAW,GAAG,EAAE;EAClD,2BAA2B,SAAS,SAA0B;AAC7D,OAAI,OAAO,SAAS,SACnB;AAGD,OAAI,eAAe,CAAC,WAAW,IAAI,KAAK,CACvC;AAGD,UAAO;IACN,cAAc;IACd,YAAY;IACZ,UAAU;IACV,QAAQ,UAA4C;AACnD,SAAI,SAAS,UAAU,OAAO,UAAU,SACvC,QAAO;MAAE,MAAM;MAAQ,OAAO,EAAE,MAAM,OAAO;MAAE;AAGhD,SAAI,OAAO,UAAU,YAAY,UAAU,KAC1C,QAAO;MAAE,MAAM;MAAM;MAAO;AAG7B,YAAO;MAAE,MAAM;MAAM,OAAO,EAAE,OAAO,OAAO;MAAE;;IAE/C;;EAEF,CACD;;;;;;;;;AAcF,IAAa,eAAb,MAAa,aAIX;CACD,AAAQ;CAER,YAAY,OAAe;AAC1B,OAAK,SAAS;;;;;;;;;;;;;;;;;;;;;;;CAwBf,MACC,YAGuE;EACvE,MAAM,uBACJ,KAAK,OAAe,kBAAmB,EAAE;EAE3C,MAAM,SACL,OAAO,eAAe,aACnB,WAAW,EAAE,GAAG,qBAAqB,qBAAqB,EAAE,CAAC,GAC7D;AAEJ,SAAO,IAAI,aAIT;GACD,GAAG,KAAK;GACR,OAAO;GACP,CAAyC;;;;;;;;;;;;;;;CAgB3C,OAGC,SAKC;AAGD,SAAO,IAAI,aAAa;GACvB,GAAG,KAAK;GACR,gBAAgB;GAChB,CAAQ;;;;;;;;;;;CAYV,cACC,aAKC;AACD,SAAO,IAAI,aAAa;GACvB,GAAG,KAAK;GACR,eAAe;GACf;GACA,CAA2D;;CAuE7D,SAAS,YAAsB;AAC9B,MAAI,OAAO,eAAe,WACzB,QAAO,IAAI,aAAa;GACvB,GAAG,KAAK;GACR,UAAU;GACV,CAAQ;EAGV,MAAM,EAAE,MAAM,YAAY,WAAW;AACrC,SAAO,IAAI,aAAa;GACvB,GAAG,KAAK;GACR,cAAc;GACd,iBAAiB;GACjB,CAAQ;;;;;;CAOV,QAAiC;EAChC,MAAM,QAAQ,KAAK;AAEnB,SAAO;GACN,MAAM,MAAM;GACZ;GACA,mBAAmB;AAClB,QAAI,CAAC,MAAM,OAAQ,QAAO,EAAE;IAC5B,MAAMA,SAAsC,EAAE;AAC9C,SAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,MAAM,OAAO,CAC1D,QAAO,QAAQ;KACd;KACA,UAAU,SAAS,aAAa;KAChC;AAEF,WAAO;;GAER,MAAM,gBAAgB,QAAQ,KAAK;AAClC,QAAI,CAAC,MAAM,SAAU,QAAO,EAAE;AAC9B,WAAO,MAAM,SAAS;KAAE;KAAQ;KAAK,CAAC;;GAEvC;;;;;CAMF,IAAI,QAAgB;AACnB,SAAO,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCd,SAAgB,MACf,MACgC;AAChC,QAAO,IAAI,aAAa,EAAE,MAAM,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AnyBlockBuilder, AnyBlockDefinition, BlockBuilder, BlockBuilderState, BlockDefinition, BlockPrefetchContext, BlockPrefetchFn, BlockPrefetchWith, BlockPrefetchWithOptions, ExpandWithResult, ExpandedRecord, InferBlockData, InferBlockValues, block } from "./block-builder.mjs";
|
|
2
|
+
import { BlockSchema, getBlocksByCategory, introspectBlock, introspectBlocks } from "./introspection.mjs";
|
|
3
|
+
import { BlocksPrefetchContext, createBlocksPrefetchHook, processBlocksDocument, processDocumentBlocksPrefetch } from "./prefetch.mjs";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AnyBlockDefinition } from "./block-builder.mjs";
|
|
2
|
+
import { BlockCategoryConfig, ComponentReference } from "../augmentation.mjs";
|
|
3
|
+
import { I18nText } from "questpie/shared";
|
|
4
|
+
import { FieldSchema } from "questpie";
|
|
5
|
+
|
|
6
|
+
//#region src/server/block/introspection.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Introspected block schema for admin consumption.
|
|
10
|
+
* All admin metadata comes from the .admin() configuration.
|
|
11
|
+
*/
|
|
12
|
+
interface BlockSchema {
|
|
13
|
+
/** Block type name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Admin configuration */
|
|
16
|
+
admin?: {
|
|
17
|
+
/** Display label */
|
|
18
|
+
label?: I18nText;
|
|
19
|
+
/** Description */
|
|
20
|
+
description?: I18nText;
|
|
21
|
+
/** Icon reference */
|
|
22
|
+
icon?: ComponentReference;
|
|
23
|
+
/** Category for grouping in block picker */
|
|
24
|
+
category?: BlockCategoryConfig;
|
|
25
|
+
/** Order within category in block picker */
|
|
26
|
+
order?: number;
|
|
27
|
+
/** Hide from block picker */
|
|
28
|
+
hidden?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Allow child blocks */
|
|
31
|
+
allowChildren?: boolean;
|
|
32
|
+
/** Maximum number of child blocks */
|
|
33
|
+
maxChildren?: number;
|
|
34
|
+
/** Has prefetch function */
|
|
35
|
+
hasPrefetch: boolean;
|
|
36
|
+
/** Field schemas - unified format using FieldSchema */
|
|
37
|
+
fields: Record<string, FieldSchema>;
|
|
38
|
+
/** Validation schemas */
|
|
39
|
+
validation?: {
|
|
40
|
+
insert?: unknown;
|
|
41
|
+
update?: unknown;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Category info extracted from blocks for UI rendering.
|
|
46
|
+
*/
|
|
47
|
+
interface CategoryInfo {
|
|
48
|
+
/** Category key (derived from label or auto-generated) */
|
|
49
|
+
key: string;
|
|
50
|
+
/** Category configuration */
|
|
51
|
+
config: BlockCategoryConfig;
|
|
52
|
+
/** Blocks in this category */
|
|
53
|
+
blocks: BlockSchema[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Introspect a single block definition.
|
|
57
|
+
* Handles both server BlockBuilder definitions and client BlockDefinition objects
|
|
58
|
+
* that were converted via the `.blocks()` patch.
|
|
59
|
+
*/
|
|
60
|
+
declare function introspectBlock(blockDef: AnyBlockDefinition): BlockSchema;
|
|
61
|
+
/**
|
|
62
|
+
* Introspect all registered blocks.
|
|
63
|
+
*
|
|
64
|
+
* @param blocks - Record of registered block definitions
|
|
65
|
+
* @returns Record of block schemas
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { introspectBlocks } from "@questpie/admin/server";
|
|
70
|
+
*
|
|
71
|
+
* // In an API route
|
|
72
|
+
* const blocks = introspectBlocks(cms.state.blocks);
|
|
73
|
+
* return Response.json({ blocks });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function introspectBlocks(blocks: Record<string, AnyBlockDefinition> | undefined): Record<string, BlockSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* Get blocks grouped by category with full category info.
|
|
79
|
+
* Useful for block picker UI.
|
|
80
|
+
*/
|
|
81
|
+
declare function getBlocksByCategory(blocks: Record<string, BlockSchema>): CategoryInfo[];
|
|
82
|
+
//#endregion
|
|
83
|
+
export { BlockSchema, getBlocksByCategory, introspectBlock, introspectBlocks };
|
|
84
|
+
//# sourceMappingURL=introspection.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.d.mts","names":[],"sources":["../../../src/server/block/introspection.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAqDe,UA9BE,WAAA,CA8BF;EAYE;EAkBD,IAAA,EAAA,MAAA;EA4BA;EACQ,KAAA,CAAA,EAAA;IAAf;IACS,KAAA,CAAA,EAnFR,QAmFQ;IAAf;IAAM,WAAA,CAAA,EAjFO,QAiFP;IAwCO;IACQ,IAAA,CAAA,EAxHf,kBAwHe;IAAf;IACN,QAAA,CAAA,EAvHU,mBAuHV;IAAY;;;;;;;;;;;;UAtGN,eAAe;;;;;;;;;;UAYP,YAAA;;;;UAIR;;UAEA;;;;;;;iBAYO,eAAA,WAA0B,qBAAqB;;;;;;;;;;;;;;;;iBA4B/C,gBAAA,SACP,eAAe,kCACrB,eAAe;;;;;iBAwCF,mBAAA,SACP,eAAe,eACrB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { isI18nLocaleMap } from "questpie/shared";
|
|
2
|
+
|
|
3
|
+
//#region src/server/block/introspection.ts
|
|
4
|
+
/**
|
|
5
|
+
* Introspect a single block definition.
|
|
6
|
+
* Handles both server BlockBuilder definitions and client BlockDefinition objects
|
|
7
|
+
* that were converted via the `.blocks()` patch.
|
|
8
|
+
*/
|
|
9
|
+
function introspectBlock(blockDef) {
|
|
10
|
+
const state = blockDef.state;
|
|
11
|
+
return {
|
|
12
|
+
name: state.name ?? blockDef.name,
|
|
13
|
+
admin: state.admin,
|
|
14
|
+
allowChildren: state.allowChildren,
|
|
15
|
+
maxChildren: state.maxChildren,
|
|
16
|
+
hasPrefetch: typeof state.prefetch === "function",
|
|
17
|
+
fields: blockDef.getFieldMetadata()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Introspect all registered blocks.
|
|
22
|
+
*
|
|
23
|
+
* @param blocks - Record of registered block definitions
|
|
24
|
+
* @returns Record of block schemas
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { introspectBlocks } from "@questpie/admin/server";
|
|
29
|
+
*
|
|
30
|
+
* // In an API route
|
|
31
|
+
* const blocks = introspectBlocks(cms.state.blocks);
|
|
32
|
+
* return Response.json({ blocks });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
function introspectBlocks(blocks) {
|
|
36
|
+
if (!blocks) return {};
|
|
37
|
+
const schemas = {};
|
|
38
|
+
for (const [name, blockDef] of Object.entries(blocks)) schemas[name] = introspectBlock(blockDef);
|
|
39
|
+
return schemas;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generate a category key from category config.
|
|
43
|
+
* Uses English label as key, falling back to first available label.
|
|
44
|
+
*/
|
|
45
|
+
function getCategoryKey(category) {
|
|
46
|
+
const { label } = category;
|
|
47
|
+
if (typeof label === "string") return label.toLowerCase().replace(/\s+/g, "-");
|
|
48
|
+
if (isI18nLocaleMap(label)) return (label.en ?? Object.values(label)[0] ?? "").toLowerCase().replace(/\s+/g, "-");
|
|
49
|
+
return label.key.toLowerCase().replace(/[.:]/g, "-");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get blocks grouped by category with full category info.
|
|
53
|
+
* Useful for block picker UI.
|
|
54
|
+
*/
|
|
55
|
+
function getBlocksByCategory(blocks) {
|
|
56
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
57
|
+
const uncategorizedKey = "uncategorized";
|
|
58
|
+
const uncategorizedConfig = {
|
|
59
|
+
label: { en: "Uncategorized" },
|
|
60
|
+
order: 999
|
|
61
|
+
};
|
|
62
|
+
for (const block of Object.values(blocks)) {
|
|
63
|
+
if (block.admin?.hidden) continue;
|
|
64
|
+
const categoryConfig = block.admin?.category;
|
|
65
|
+
let key;
|
|
66
|
+
let config;
|
|
67
|
+
if (categoryConfig) {
|
|
68
|
+
key = getCategoryKey(categoryConfig);
|
|
69
|
+
config = categoryConfig;
|
|
70
|
+
} else {
|
|
71
|
+
key = uncategorizedKey;
|
|
72
|
+
config = uncategorizedConfig;
|
|
73
|
+
}
|
|
74
|
+
if (!categoryMap.has(key)) categoryMap.set(key, {
|
|
75
|
+
key,
|
|
76
|
+
config,
|
|
77
|
+
blocks: []
|
|
78
|
+
});
|
|
79
|
+
categoryMap.get(key).blocks.push(block);
|
|
80
|
+
}
|
|
81
|
+
const categories = Array.from(categoryMap.values());
|
|
82
|
+
categories.sort((a, b) => (a.config.order ?? 999) - (b.config.order ?? 999));
|
|
83
|
+
for (const category of categories) category.blocks.sort((a, b) => (a.admin?.order ?? 999) - (b.admin?.order ?? 999));
|
|
84
|
+
return categories;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { getBlocksByCategory, introspectBlock, introspectBlocks };
|
|
89
|
+
//# sourceMappingURL=introspection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.mjs","names":["schemas: Record<string, BlockSchema>","uncategorizedConfig: BlockCategoryConfig","key: string","config: BlockCategoryConfig"],"sources":["../../../src/server/block/introspection.ts"],"sourcesContent":["/**\n * Block Introspection\n *\n * Provides introspection of registered blocks for admin UI consumption.\n */\n\nimport type { FieldSchema } from \"questpie\";\nimport { type I18nText, isI18nLocaleMap } from \"questpie/shared\";\nimport type {\n\tAdminBlockConfig,\n\tBlockCategoryConfig,\n\tComponentReference,\n} from \"../augmentation.js\";\nimport type { AnyBlockDefinition, BlockBuilderState } from \"./block-builder.js\";\n\n// ============================================================================\n// Block Schema Types\n// ============================================================================\n\n/**\n * Introspected block schema for admin consumption.\n * All admin metadata comes from the .admin() configuration.\n */\nexport interface BlockSchema {\n\t/** Block type name */\n\tname: string;\n\n\t/** Admin configuration */\n\tadmin?: {\n\t\t/** Display label */\n\t\tlabel?: I18nText;\n\t\t/** Description */\n\t\tdescription?: I18nText;\n\t\t/** Icon reference */\n\t\ticon?: ComponentReference;\n\t\t/** Category for grouping in block picker */\n\t\tcategory?: BlockCategoryConfig;\n\t\t/** Order within category in block picker */\n\t\torder?: number;\n\t\t/** Hide from block picker */\n\t\thidden?: boolean;\n\t};\n\n\t/** Allow child blocks */\n\tallowChildren?: boolean;\n\n\t/** Maximum number of child blocks */\n\tmaxChildren?: number;\n\n\t/** Has prefetch function */\n\thasPrefetch: boolean;\n\n\t/** Field schemas - unified format using FieldSchema */\n\tfields: Record<string, FieldSchema>;\n\n\t/** Validation schemas */\n\tvalidation?: {\n\t\tinsert?: unknown;\n\t\tupdate?: unknown;\n\t};\n}\n\n/**\n * Category info extracted from blocks for UI rendering.\n */\nexport interface CategoryInfo {\n\t/** Category key (derived from label or auto-generated) */\n\tkey: string;\n\t/** Category configuration */\n\tconfig: BlockCategoryConfig;\n\t/** Blocks in this category */\n\tblocks: BlockSchema[];\n}\n\n// ============================================================================\n// Introspection Functions\n// ============================================================================\n\n/**\n * Introspect a single block definition.\n * Handles both server BlockBuilder definitions and client BlockDefinition objects\n * that were converted via the `.blocks()` patch.\n */\nexport function introspectBlock(blockDef: AnyBlockDefinition): BlockSchema {\n\tconst state = blockDef.state;\n\n\treturn {\n\t\tname: state.name ?? blockDef.name,\n\t\tadmin: state.admin,\n\t\tallowChildren: state.allowChildren,\n\t\tmaxChildren: state.maxChildren,\n\t\thasPrefetch: typeof state.prefetch === \"function\",\n\t\tfields: blockDef.getFieldMetadata(),\n\t};\n}\n\n/**\n * Introspect all registered blocks.\n *\n * @param blocks - Record of registered block definitions\n * @returns Record of block schemas\n *\n * @example\n * ```ts\n * import { introspectBlocks } from \"@questpie/admin/server\";\n *\n * // In an API route\n * const blocks = introspectBlocks(cms.state.blocks);\n * return Response.json({ blocks });\n * ```\n */\nexport function introspectBlocks(\n\tblocks: Record<string, AnyBlockDefinition> | undefined,\n): Record<string, BlockSchema> {\n\tif (!blocks) {\n\t\treturn {};\n\t}\n\n\tconst schemas: Record<string, BlockSchema> = {};\n\n\tfor (const [name, blockDef] of Object.entries(blocks)) {\n\t\tschemas[name] = introspectBlock(blockDef);\n\t}\n\n\treturn schemas;\n}\n\n/**\n * Generate a category key from category config.\n * Uses English label as key, falling back to first available label.\n */\nfunction getCategoryKey(category: BlockCategoryConfig): string {\n\tconst { label } = category;\n\n\tif (typeof label === \"string\") {\n\t\treturn label.toLowerCase().replace(/\\s+/g, \"-\");\n\t}\n\n\t// For locale map or translation key\n\tif (isI18nLocaleMap(label)) {\n\t\t// Use English label as key, or first available\n\t\tconst text = label.en ?? Object.values(label)[0] ?? \"\";\n\t\treturn text.toLowerCase().replace(/\\s+/g, \"-\");\n\t}\n\n\t// Translation key - use the key itself\n\treturn label.key.toLowerCase().replace(/[.:]/g, \"-\");\n}\n\n/**\n * Get blocks grouped by category with full category info.\n * Useful for block picker UI.\n */\nexport function getBlocksByCategory(\n\tblocks: Record<string, BlockSchema>,\n): CategoryInfo[] {\n\tconst categoryMap = new Map<string, CategoryInfo>();\n\n\t// Default uncategorized category\n\tconst uncategorizedKey = \"uncategorized\";\n\tconst uncategorizedConfig: BlockCategoryConfig = {\n\t\tlabel: { en: \"Uncategorized\" },\n\t\torder: 999,\n\t};\n\n\tfor (const block of Object.values(blocks)) {\n\t\t// Skip hidden blocks\n\t\tif (block.admin?.hidden) continue;\n\n\t\tconst categoryConfig = block.admin?.category;\n\t\tlet key: string;\n\t\tlet config: BlockCategoryConfig;\n\n\t\tif (categoryConfig) {\n\t\t\tkey = getCategoryKey(categoryConfig);\n\t\t\tconfig = categoryConfig;\n\t\t} else {\n\t\t\tkey = uncategorizedKey;\n\t\t\tconfig = uncategorizedConfig;\n\t\t}\n\n\t\tif (!categoryMap.has(key)) {\n\t\t\tcategoryMap.set(key, {\n\t\t\t\tkey,\n\t\t\t\tconfig,\n\t\t\t\tblocks: [],\n\t\t\t});\n\t\t}\n\n\t\tcategoryMap.get(key)!.blocks.push(block);\n\t}\n\n\t// Convert to array and sort\n\tconst categories = Array.from(categoryMap.values());\n\n\t// Sort categories by order\n\tcategories.sort((a, b) => (a.config.order ?? 999) - (b.config.order ?? 999));\n\n\t// Sort blocks within each category by order\n\tfor (const category of categories) {\n\t\tcategory.blocks.sort(\n\t\t\t(a, b) => (a.admin?.order ?? 999) - (b.admin?.order ?? 999),\n\t\t);\n\t}\n\n\treturn categories;\n}\n"],"mappings":";;;;;;;;AAmFA,SAAgB,gBAAgB,UAA2C;CAC1E,MAAM,QAAQ,SAAS;AAEvB,QAAO;EACN,MAAM,MAAM,QAAQ,SAAS;EAC7B,OAAO,MAAM;EACb,eAAe,MAAM;EACrB,aAAa,MAAM;EACnB,aAAa,OAAO,MAAM,aAAa;EACvC,QAAQ,SAAS,kBAAkB;EACnC;;;;;;;;;;;;;;;;;AAkBF,SAAgB,iBACf,QAC8B;AAC9B,KAAI,CAAC,OACJ,QAAO,EAAE;CAGV,MAAMA,UAAuC,EAAE;AAE/C,MAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,OAAO,CACpD,SAAQ,QAAQ,gBAAgB,SAAS;AAG1C,QAAO;;;;;;AAOR,SAAS,eAAe,UAAuC;CAC9D,MAAM,EAAE,UAAU;AAElB,KAAI,OAAO,UAAU,SACpB,QAAO,MAAM,aAAa,CAAC,QAAQ,QAAQ,IAAI;AAIhD,KAAI,gBAAgB,MAAM,CAGzB,SADa,MAAM,MAAM,OAAO,OAAO,MAAM,CAAC,MAAM,IACxC,aAAa,CAAC,QAAQ,QAAQ,IAAI;AAI/C,QAAO,MAAM,IAAI,aAAa,CAAC,QAAQ,SAAS,IAAI;;;;;;AAOrD,SAAgB,oBACf,QACiB;CACjB,MAAM,8BAAc,IAAI,KAA2B;CAGnD,MAAM,mBAAmB;CACzB,MAAMC,sBAA2C;EAChD,OAAO,EAAE,IAAI,iBAAiB;EAC9B,OAAO;EACP;AAED,MAAK,MAAM,SAAS,OAAO,OAAO,OAAO,EAAE;AAE1C,MAAI,MAAM,OAAO,OAAQ;EAEzB,MAAM,iBAAiB,MAAM,OAAO;EACpC,IAAIC;EACJ,IAAIC;AAEJ,MAAI,gBAAgB;AACnB,SAAM,eAAe,eAAe;AACpC,YAAS;SACH;AACN,SAAM;AACN,YAAS;;AAGV,MAAI,CAAC,YAAY,IAAI,IAAI,CACxB,aAAY,IAAI,KAAK;GACpB;GACA;GACA,QAAQ,EAAE;GACV,CAAC;AAGH,cAAY,IAAI,IAAI,CAAE,OAAO,KAAK,MAAM;;CAIzC,MAAM,aAAa,MAAM,KAAK,YAAY,QAAQ,CAAC;AAGnD,YAAW,MAAM,GAAG,OAAO,EAAE,OAAO,SAAS,QAAQ,EAAE,OAAO,SAAS,KAAK;AAG5E,MAAK,MAAM,YAAY,WACtB,UAAS,OAAO,MACd,GAAG,OAAO,EAAE,OAAO,SAAS,QAAQ,EAAE,OAAO,SAAS,KACvD;AAGF,QAAO"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AnyBlockDefinition } from "./block-builder.mjs";
|
|
2
|
+
import { BlocksDocument } from "../fields/blocks.mjs";
|
|
3
|
+
import { RegisteredApp } from "questpie";
|
|
4
|
+
|
|
5
|
+
//#region src/server/block/prefetch.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for blocks prefetch processing.
|
|
9
|
+
* Typed via Register.app when registered.
|
|
10
|
+
*/
|
|
11
|
+
interface BlocksPrefetchContext {
|
|
12
|
+
/** CMS app instance — typed via Register.app */
|
|
13
|
+
app: RegisteredApp;
|
|
14
|
+
/** Database client */
|
|
15
|
+
db: unknown;
|
|
16
|
+
/** Current locale */
|
|
17
|
+
locale?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Process blocks data for a single blocks document.
|
|
21
|
+
*
|
|
22
|
+
* This function does two things:
|
|
23
|
+
* 1. **Expands declared fields** from `.prefetch({ with: [...] })` (batch-fetched)
|
|
24
|
+
* 2. **Executes prefetch functions/loaders** for blocks that have them
|
|
25
|
+
*
|
|
26
|
+
* The results are merged into `_data[blockId]`. Prefetch function / loader data
|
|
27
|
+
* takes precedence over expanded data on key conflicts.
|
|
28
|
+
*
|
|
29
|
+
* @param blocks - The blocks document to process
|
|
30
|
+
* @param blockDefinitions - Registered block definitions
|
|
31
|
+
* @param ctx - Prefetch context
|
|
32
|
+
* @returns The blocks document with `_data` populated
|
|
33
|
+
*/
|
|
34
|
+
declare function processBlocksDocument(blocks: BlocksDocument | null | undefined, blockDefinitions: Record<string, AnyBlockDefinition>, ctx: BlocksPrefetchContext): Promise<BlocksDocument | null | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* Process blocks prefetch for a document.
|
|
37
|
+
* Finds all blocks fields in the document and processes them.
|
|
38
|
+
*
|
|
39
|
+
* @param doc - The document containing blocks fields
|
|
40
|
+
* @param fieldDefinitions - Field definitions to identify blocks fields
|
|
41
|
+
* @param blockDefinitions - Registered block definitions
|
|
42
|
+
* @param ctx - Prefetch context
|
|
43
|
+
* @returns The document with blocks prefetch data attached
|
|
44
|
+
*/
|
|
45
|
+
declare function processDocumentBlocksPrefetch<T extends Record<string, unknown>>(doc: T, fieldDefinitions: Record<string, {
|
|
46
|
+
state: {
|
|
47
|
+
config: {
|
|
48
|
+
type?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}>, blockDefinitions: Record<string, AnyBlockDefinition>, ctx: BlocksPrefetchContext): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Create an afterRead hook for processing blocks prefetch.
|
|
54
|
+
* This hook can be added to collections that have blocks fields.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { createBlocksPrefetchHook } from "@questpie/admin/server";
|
|
59
|
+
*
|
|
60
|
+
* const pages = q.collection("pages")
|
|
61
|
+
* .fields((f) => ({
|
|
62
|
+
* title: f.text({ required: true }),
|
|
63
|
+
* content: f.blocks({ allowedBlocks: ["hero", "text"] }),
|
|
64
|
+
* }))
|
|
65
|
+
* .hooks({
|
|
66
|
+
* afterRead: createBlocksPrefetchHook(),
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function createBlocksPrefetchHook(): (ctx: {
|
|
71
|
+
data: Record<string, unknown>;
|
|
72
|
+
app: any;
|
|
73
|
+
db: unknown;
|
|
74
|
+
locale?: string;
|
|
75
|
+
}) => Promise<void>;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { BlocksPrefetchContext, createBlocksPrefetchHook, processBlocksDocument, processDocumentBlocksPrefetch };
|
|
78
|
+
//# sourceMappingURL=prefetch.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefetch.d.mts","names":[],"sources":["../../../src/server/block/prefetch.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAiDiB,qBAAA;;OAEX;;;;;;;;;;;;;;;;;;;;;iBAoNgB,qBAAA,SACb,qDACU,eAAe,0BAC5B,wBACH,QAAQ;;;;;;;;;;;iBAuJW,wCACX,8BAEL,qBACa;;;;;;sBACA,eAAe,0BAC5B,wBACH,QAAQ;;;;;;;;;;;;;;;;;;;iBAyCK,wBAAA,CAAA;QAER;;;;MAIN"}
|