@questpie/admin 1.1.1 → 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-D1DqawtP.d.mts +0 -13403
- package/dist/client-D1DqawtP.d.mts.map +0 -1
- package/dist/client-njX1rZmi.mjs +0 -22612
- package/dist/client-njX1rZmi.mjs.map +0 -1
- package/dist/content-locales-provider-BXvuIgfg.mjs +0 -1650
- package/dist/content-locales-provider-BXvuIgfg.mjs.map +0 -1
- package/dist/dashboard-page-B4PGEdc2.mjs +0 -2500
- package/dist/dashboard-page-B4PGEdc2.mjs.map +0 -1
- package/dist/dashboard-page-mCY0pgZv.mjs +0 -3
- package/dist/dropzone-Do3awXKd.mjs +0 -634
- package/dist/dropzone-Do3awXKd.mjs.map +0 -1
- package/dist/forgot-password-page-Bcp-An4Y.mjs.map +0 -1
- package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
- package/dist/index-B4H3amCD.d.mts +0 -2753
- package/dist/index-B4H3amCD.d.mts.map +0 -1
- package/dist/login-page-BUnpCbCa.mjs +0 -3
- package/dist/login-page-CP4gA-dl.mjs +0 -298
- package/dist/login-page-CP4gA-dl.mjs.map +0 -1
- package/dist/preview-utils-BKQ9-TMa.mjs.map +0 -1
- package/dist/reset-password-page-BqfDmLxA.mjs +0 -281
- package/dist/reset-password-page-BqfDmLxA.mjs.map +0 -1
- package/dist/reset-password-page-CufHz3h3.mjs +0 -3
- package/dist/runtime-6VZM878K.mjs.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,84 @@
|
|
|
1
|
+
import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Questpie } from "questpie";
|
|
3
|
+
|
|
4
|
+
//#region src/client/hooks/typed-hooks.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extract collection names from a Questpie app
|
|
8
|
+
*/
|
|
9
|
+
type CollectionNames<TApp extends Questpie<any>> = keyof TApp["config"]["collections"] & string;
|
|
10
|
+
/**
|
|
11
|
+
* Extract global names from a Questpie app
|
|
12
|
+
*/
|
|
13
|
+
type GlobalNames<TApp extends Questpie<any>> = TApp extends Questpie<infer TConfig> ? keyof TConfig["globals"] & string : never;
|
|
14
|
+
interface TypedHooks<TApp extends Questpie<any>> {
|
|
15
|
+
/**
|
|
16
|
+
* Hook to fetch collection list with filters, sorting, pagination
|
|
17
|
+
*/
|
|
18
|
+
useCollectionList: <K extends CollectionNames<TApp>>(collection: K, options?: any, queryOptions?: Omit<UseQueryOptions, "queryKey" | "queryFn">) => any;
|
|
19
|
+
/**
|
|
20
|
+
* Hook to count collection items with optional filters
|
|
21
|
+
*/
|
|
22
|
+
useCollectionCount: <K extends CollectionNames<TApp>>(collection: K, options?: {
|
|
23
|
+
where?: any;
|
|
24
|
+
includeDeleted?: boolean;
|
|
25
|
+
}, queryOptions?: Omit<UseQueryOptions, "queryKey" | "queryFn">) => any;
|
|
26
|
+
/**
|
|
27
|
+
* Hook to fetch single collection item
|
|
28
|
+
*/
|
|
29
|
+
useCollectionItem: <K extends CollectionNames<TApp>>(collection: K, id: string, options?: {
|
|
30
|
+
localeFallback?: boolean;
|
|
31
|
+
with?: Record<string, boolean>;
|
|
32
|
+
}, queryOptions?: Omit<UseQueryOptions, "queryKey" | "queryFn">) => any;
|
|
33
|
+
/**
|
|
34
|
+
* Hook to create collection item
|
|
35
|
+
*/
|
|
36
|
+
useCollectionCreate: <K extends CollectionNames<TApp>>(collection: K, mutationOptions?: Omit<UseMutationOptions, "mutationFn">) => any;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to update collection item
|
|
39
|
+
*/
|
|
40
|
+
useCollectionUpdate: <K extends CollectionNames<TApp>>(collection: K, mutationOptions?: Omit<UseMutationOptions, "mutationFn">) => any;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to delete collection item
|
|
43
|
+
*/
|
|
44
|
+
useCollectionDelete: <K extends CollectionNames<TApp>>(collection: K, mutationOptions?: Omit<UseMutationOptions, "mutationFn">) => any;
|
|
45
|
+
/**
|
|
46
|
+
* Hook to fetch global settings
|
|
47
|
+
*/
|
|
48
|
+
useGlobal: <K extends GlobalNames<TApp>>(globalName: K, options?: any, queryOptions?: Omit<UseQueryOptions, "queryKey" | "queryFn">) => any;
|
|
49
|
+
/**
|
|
50
|
+
* Hook to update global settings
|
|
51
|
+
*/
|
|
52
|
+
useGlobalUpdate: <K extends GlobalNames<TApp>>(globalName: K, mutationOptions?: Omit<UseMutationOptions, "mutationFn">) => any;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create type-safe hooks for collections and globals.
|
|
56
|
+
*
|
|
57
|
+
* This factory creates hooks that are typed to your specific CMS configuration,
|
|
58
|
+
* providing autocomplete for collection/global names without module augmentation.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import type { AppCMS } from './server/cms';
|
|
63
|
+
* import { createTypedHooks } from '@questpie/admin/client';
|
|
64
|
+
*
|
|
65
|
+
* // Create typed hooks
|
|
66
|
+
* export const {
|
|
67
|
+
* useCollectionList,
|
|
68
|
+
* useCollectionItem,
|
|
69
|
+
* useCollectionCreate,
|
|
70
|
+
* useCollectionUpdate,
|
|
71
|
+
* useCollectionDelete,
|
|
72
|
+
* useGlobal,
|
|
73
|
+
* useGlobalUpdate,
|
|
74
|
+
* } = createTypedHooks<AppCMS>();
|
|
75
|
+
*
|
|
76
|
+
* // Usage - collection names are autocompleted!
|
|
77
|
+
* const { data } = useCollectionList("barbers");
|
|
78
|
+
* const { data: settings } = useGlobal("siteSettings");
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare function createTypedHooks<TApp extends Questpie<any>>(): TypedHooks<TApp>;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { TypedHooks, createTypedHooks };
|
|
84
|
+
//# sourceMappingURL=typed-hooks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-hooks.d.mts","names":[],"sources":["../../../src/client/hooks/typed-hooks.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6CK,eAkD4C,CAAA,aAlDf,QAkDe,CAAA,GAAA,CAAA,CAAA,GAAA,MAjD1C,IAiD0C,CAAA,QAAA,CAAA,CAAA,aAAA,CAAA,GAAA,MAAA;;;;KA5C5C,WA8Ce,CAAA,aA9CU,QA8CV,CAAA,GAAA,CAAA,CAAA,GA7CnB,IA6CmB,SA7CN,QA6CM,CAAA,KAAA,QAAA,CAAA,GAAA,MA5CV,OA4CU,CAAA,SAAA,CAAA,GAAA,MAAA,GAAA,KAAA;AAM6B,UA3ChC,UA2CgC,CAAA,aA3CR,QA2CQ,CAAA,GAAA,CAAA,CAAA,CAAA;EAAhB;;;EAEb,iBAAA,EAAA,CAAA,UAzCW,eAyCX,CAzC2B,IAyC3B,CAAA,CAAA,CAAA,UAAA,EAxCN,CAwCM,EAAA,OAAA,CAAA,EAAA,GAAA,EAAA,YAAA,CAAA,EAtCH,IAsCG,CAtCE,eAsCF,EAAA,UAAA,GAAA,SAAA,CAAA,EAAA,GAAA,GAAA;EAM6B;;;EAExB,kBAAA,EAAA,CAAA,UAxCO,eAwCP,CAxCuB,IAwCvB,CAAA,CAAA,CAAA,UAAA,EAvCX,CAuCW,EAAA,OAMF,CANE,EAAA;IAAL,KAAA,CAAA,EAAA,GAAA;IAMe,cAAA,CAAA,EAAA,OAAA;EAAZ,CAAA,EAAA,YAAA,CAAA,EA3CN,IA2CM,CA3CD,eA2CC,EAAA,UAAA,GAAA,SAAA,CAAA,EAAA,GAAA,GAAA;EACT;;;EAQ2B,iBAAA,EAAA,CAAA,UA9CV,eA8CU,CA9CM,IA8CN,CAAA,CAAA,CAAA,UAAA,EA7C3B,CA6C2B,EAAA,EAAA,EAAA,MAAA,EAAA,OAEhB,CAFgB,EAAA;IAAZ,cAAA,CAAA,EAAA,OAAA;IACf,IAAA,CAAA,EA1CJ,MA0CI,CAAA,MAAA,EAAA,OAAA,CAAA;EACW,CAAA,EAAA,YAAA,CAAA,EAzCR,IAyCQ,CAzCH,eAyCG,EAAA,UAAA,GAAA,SAAA,CAAA,EAAA,GAAA,GAAA;EAAL;;AAmCpB;EACc,mBAAA,EAAA,CAAA,UAvEmB,eAuEnB,CAvEmC,IAuEnC,CAAA,CAAA,CAAA,UAAA,EAtEA,CAsEA,EAAA,eAAA,CAAA,EArEM,IAqEN,CArEW,kBAqEX,EAAA,YAAA,CAAA,EAAA,GAAA,GAAA;EACE;;;kCAhEiB,gBAAgB,mBACnC,qBACM,KAAK;;;;kCAMQ,gBAAgB,mBACnC,qBACM,KAAK;;;;wBAMF,YAAY,mBACrB,iCAEG,KAAK;;;;8BAMO,YAAY,mBAC3B,qBACM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCT,8BACF,kBACT,WAAW"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { selectClient, selectContentLocale, useAdminStore } from "../runtime/provider.mjs";
|
|
2
|
+
import { useScopedLocale } from "../runtime/locale-scope.mjs";
|
|
3
|
+
import { createQuestpieQueryOptions } from "@questpie/tanstack-query";
|
|
4
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
//#region src/client/hooks/typed-hooks.ts
|
|
7
|
+
/**
|
|
8
|
+
* Typed Hooks Factory
|
|
9
|
+
*
|
|
10
|
+
* Creates type-safe React hooks for collections and globals without module augmentation.
|
|
11
|
+
* This is the recommended approach for new projects.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // In your admin setup file:
|
|
16
|
+
* import type { AppCMS } from './server/cms';
|
|
17
|
+
* import { createTypedHooks } from '@questpie/admin/client';
|
|
18
|
+
*
|
|
19
|
+
* export const {
|
|
20
|
+
* useCollectionList,
|
|
21
|
+
* useCollectionItem,
|
|
22
|
+
* useCollectionCreate,
|
|
23
|
+
* useCollectionUpdate,
|
|
24
|
+
* useCollectionDelete,
|
|
25
|
+
* useCollectionCount,
|
|
26
|
+
* useGlobal,
|
|
27
|
+
* useGlobalUpdate,
|
|
28
|
+
* } = createTypedHooks<AppCMS>();
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Create type-safe hooks for collections and globals.
|
|
33
|
+
*
|
|
34
|
+
* This factory creates hooks that are typed to your specific CMS configuration,
|
|
35
|
+
* providing autocomplete for collection/global names without module augmentation.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import type { AppCMS } from './server/cms';
|
|
40
|
+
* import { createTypedHooks } from '@questpie/admin/client';
|
|
41
|
+
*
|
|
42
|
+
* // Create typed hooks
|
|
43
|
+
* export const {
|
|
44
|
+
* useCollectionList,
|
|
45
|
+
* useCollectionItem,
|
|
46
|
+
* useCollectionCreate,
|
|
47
|
+
* useCollectionUpdate,
|
|
48
|
+
* useCollectionDelete,
|
|
49
|
+
* useGlobal,
|
|
50
|
+
* useGlobalUpdate,
|
|
51
|
+
* } = createTypedHooks<AppCMS>();
|
|
52
|
+
*
|
|
53
|
+
* // Usage - collection names are autocompleted!
|
|
54
|
+
* const { data } = useCollectionList("barbers");
|
|
55
|
+
* const { data: settings } = useGlobal("siteSettings");
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function createTypedHooks() {
|
|
59
|
+
function useCollectionList(collection, options, queryOptions) {
|
|
60
|
+
const client = useAdminStore(selectClient);
|
|
61
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
62
|
+
return useQuery({
|
|
63
|
+
...createQuestpieQueryOptions(client, {
|
|
64
|
+
keyPrefix: ["questpie", "collections"],
|
|
65
|
+
locale: contentLocale
|
|
66
|
+
}).collections[collection].find({
|
|
67
|
+
...options,
|
|
68
|
+
locale: contentLocale
|
|
69
|
+
}),
|
|
70
|
+
...queryOptions
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function useCollectionCount(collection, options, queryOptions) {
|
|
74
|
+
const client = useAdminStore(selectClient);
|
|
75
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
76
|
+
return useQuery({
|
|
77
|
+
...createQuestpieQueryOptions(client, {
|
|
78
|
+
keyPrefix: ["questpie", "collections"],
|
|
79
|
+
locale: contentLocale
|
|
80
|
+
}).collections[collection].count({
|
|
81
|
+
...options,
|
|
82
|
+
locale: contentLocale
|
|
83
|
+
}),
|
|
84
|
+
...queryOptions
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function useCollectionItem(collection, id, options, queryOptions) {
|
|
88
|
+
const client = useAdminStore(selectClient);
|
|
89
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
90
|
+
return useQuery({
|
|
91
|
+
...createQuestpieQueryOptions(client, {
|
|
92
|
+
keyPrefix: ["questpie", "collections"],
|
|
93
|
+
locale: contentLocale
|
|
94
|
+
}).collections[collection].findOne({
|
|
95
|
+
where: { id },
|
|
96
|
+
locale: contentLocale,
|
|
97
|
+
...options
|
|
98
|
+
}),
|
|
99
|
+
...queryOptions
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function useCollectionCreate(collection, mutationOptions) {
|
|
103
|
+
const client = useAdminStore(selectClient);
|
|
104
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
105
|
+
const queryClient = useQueryClient();
|
|
106
|
+
const queryOpts = createQuestpieQueryOptions(client, {
|
|
107
|
+
keyPrefix: ["questpie", "collections"],
|
|
108
|
+
locale: contentLocale
|
|
109
|
+
});
|
|
110
|
+
const baseOptions = queryOpts.collections[collection].create();
|
|
111
|
+
const listQueryKey = queryOpts.key([
|
|
112
|
+
"collections",
|
|
113
|
+
collection,
|
|
114
|
+
"find",
|
|
115
|
+
contentLocale
|
|
116
|
+
]);
|
|
117
|
+
const countQueryKey = queryOpts.key([
|
|
118
|
+
"collections",
|
|
119
|
+
collection,
|
|
120
|
+
"count",
|
|
121
|
+
contentLocale
|
|
122
|
+
]);
|
|
123
|
+
return useMutation({
|
|
124
|
+
...baseOptions,
|
|
125
|
+
onSuccess: (data, variables, context) => {
|
|
126
|
+
(mutationOptions?.onSuccess)?.(data, variables, context);
|
|
127
|
+
},
|
|
128
|
+
onSettled: (data, error, variables, context) => {
|
|
129
|
+
queryClient.invalidateQueries({ queryKey: listQueryKey });
|
|
130
|
+
queryClient.invalidateQueries({ queryKey: countQueryKey });
|
|
131
|
+
(mutationOptions?.onSettled)?.(data, error, variables, context);
|
|
132
|
+
},
|
|
133
|
+
...mutationOptions
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function useCollectionUpdate(collection, mutationOptions) {
|
|
137
|
+
const client = useAdminStore(selectClient);
|
|
138
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
139
|
+
const queryClient = useQueryClient();
|
|
140
|
+
const queryOpts = createQuestpieQueryOptions(client, {
|
|
141
|
+
keyPrefix: ["questpie", "collections"],
|
|
142
|
+
locale: contentLocale
|
|
143
|
+
});
|
|
144
|
+
const baseOptions = queryOpts.collections[collection].update();
|
|
145
|
+
const listQueryKey = queryOpts.key([
|
|
146
|
+
"collections",
|
|
147
|
+
collection,
|
|
148
|
+
"find",
|
|
149
|
+
contentLocale
|
|
150
|
+
]);
|
|
151
|
+
const countQueryKey = queryOpts.key([
|
|
152
|
+
"collections",
|
|
153
|
+
collection,
|
|
154
|
+
"count",
|
|
155
|
+
contentLocale
|
|
156
|
+
]);
|
|
157
|
+
const itemQueryKey = queryOpts.key([
|
|
158
|
+
"collections",
|
|
159
|
+
collection,
|
|
160
|
+
"findOne",
|
|
161
|
+
contentLocale
|
|
162
|
+
]);
|
|
163
|
+
return useMutation({
|
|
164
|
+
...baseOptions,
|
|
165
|
+
onSuccess: (data, variables, context) => {
|
|
166
|
+
(mutationOptions?.onSuccess)?.(data, variables, context);
|
|
167
|
+
},
|
|
168
|
+
onSettled: (data, error, variables, context) => {
|
|
169
|
+
queryClient.invalidateQueries({ queryKey: listQueryKey });
|
|
170
|
+
queryClient.invalidateQueries({ queryKey: countQueryKey });
|
|
171
|
+
queryClient.invalidateQueries({ queryKey: itemQueryKey });
|
|
172
|
+
(mutationOptions?.onSettled)?.(data, error, variables, context);
|
|
173
|
+
},
|
|
174
|
+
...mutationOptions
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function useCollectionDelete(collection, mutationOptions) {
|
|
178
|
+
const client = useAdminStore(selectClient);
|
|
179
|
+
const { locale: contentLocale } = useScopedLocale();
|
|
180
|
+
const queryClient = useQueryClient();
|
|
181
|
+
const queryOpts = createQuestpieQueryOptions(client, {
|
|
182
|
+
keyPrefix: ["questpie", "collections"],
|
|
183
|
+
locale: contentLocale
|
|
184
|
+
});
|
|
185
|
+
const baseOptions = queryOpts.collections[collection].delete();
|
|
186
|
+
const listQueryKey = queryOpts.key([
|
|
187
|
+
"collections",
|
|
188
|
+
collection,
|
|
189
|
+
"find",
|
|
190
|
+
contentLocale
|
|
191
|
+
]);
|
|
192
|
+
const countQueryKey = queryOpts.key([
|
|
193
|
+
"collections",
|
|
194
|
+
collection,
|
|
195
|
+
"count",
|
|
196
|
+
contentLocale
|
|
197
|
+
]);
|
|
198
|
+
const itemQueryKey = queryOpts.key([
|
|
199
|
+
"collections",
|
|
200
|
+
collection,
|
|
201
|
+
"findOne",
|
|
202
|
+
contentLocale
|
|
203
|
+
]);
|
|
204
|
+
return useMutation({
|
|
205
|
+
...baseOptions,
|
|
206
|
+
onSuccess: (data, variables, context) => {
|
|
207
|
+
(mutationOptions?.onSuccess)?.(data, variables, context);
|
|
208
|
+
},
|
|
209
|
+
onSettled: (data, error, variables, context) => {
|
|
210
|
+
queryClient.invalidateQueries({ queryKey: listQueryKey });
|
|
211
|
+
queryClient.invalidateQueries({ queryKey: countQueryKey });
|
|
212
|
+
queryClient.invalidateQueries({ queryKey: itemQueryKey });
|
|
213
|
+
(mutationOptions?.onSettled)?.(data, error, variables, context);
|
|
214
|
+
},
|
|
215
|
+
...mutationOptions
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function useGlobal(globalName, options, queryOptions) {
|
|
219
|
+
const client = useAdminStore(selectClient);
|
|
220
|
+
const contentLocale = useAdminStore(selectContentLocale);
|
|
221
|
+
return useQuery({
|
|
222
|
+
...createQuestpieQueryOptions(client, {
|
|
223
|
+
keyPrefix: ["questpie", "globals"],
|
|
224
|
+
locale: contentLocale
|
|
225
|
+
}).globals[globalName].get({
|
|
226
|
+
...options,
|
|
227
|
+
locale: contentLocale
|
|
228
|
+
}),
|
|
229
|
+
...queryOptions
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function useGlobalUpdate(globalName, mutationOptions) {
|
|
233
|
+
const client = useAdminStore(selectClient);
|
|
234
|
+
const contentLocale = useAdminStore(selectContentLocale);
|
|
235
|
+
const queryClient = useQueryClient();
|
|
236
|
+
const queryOpts = createQuestpieQueryOptions(client, {
|
|
237
|
+
keyPrefix: ["questpie", "globals"],
|
|
238
|
+
locale: contentLocale
|
|
239
|
+
});
|
|
240
|
+
const globalQueryKey = queryOpts.key([
|
|
241
|
+
"globals",
|
|
242
|
+
globalName,
|
|
243
|
+
"get",
|
|
244
|
+
contentLocale
|
|
245
|
+
]);
|
|
246
|
+
return useMutation({
|
|
247
|
+
...queryOpts.globals[globalName].update(),
|
|
248
|
+
onSuccess: (data, variables, context) => {
|
|
249
|
+
(mutationOptions?.onSuccess)?.(data, variables, context);
|
|
250
|
+
},
|
|
251
|
+
onSettled: (data, error, variables, context) => {
|
|
252
|
+
queryClient.invalidateQueries({ queryKey: globalQueryKey });
|
|
253
|
+
(mutationOptions?.onSettled)?.(data, error, variables, context);
|
|
254
|
+
},
|
|
255
|
+
...mutationOptions
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
useCollectionList,
|
|
260
|
+
useCollectionCount,
|
|
261
|
+
useCollectionItem,
|
|
262
|
+
useCollectionCreate,
|
|
263
|
+
useCollectionUpdate,
|
|
264
|
+
useCollectionDelete,
|
|
265
|
+
useGlobal,
|
|
266
|
+
useGlobalUpdate
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
//#endregion
|
|
271
|
+
export { createTypedHooks };
|
|
272
|
+
//# sourceMappingURL=typed-hooks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-hooks.mjs","names":[],"sources":["../../../src/client/hooks/typed-hooks.ts"],"sourcesContent":["/**\n * Typed Hooks Factory\n *\n * Creates type-safe React hooks for collections and globals without module augmentation.\n * This is the recommended approach for new projects.\n *\n * @example\n * ```ts\n * // In your admin setup file:\n * import type { AppCMS } from './server/cms';\n * import { createTypedHooks } from '@questpie/admin/client';\n *\n * export const {\n * useCollectionList,\n * useCollectionItem,\n * useCollectionCreate,\n * useCollectionUpdate,\n * useCollectionDelete,\n * useCollectionCount,\n * useGlobal,\n * useGlobalUpdate,\n * } = createTypedHooks<AppCMS>();\n * ```\n */\n\nimport { createQuestpieQueryOptions } from \"@questpie/tanstack-query\";\nimport {\n\ttype UseMutationOptions,\n\ttype UseQueryOptions,\n\tuseMutation,\n\tuseQuery,\n\tuseQueryClient,\n} from \"@tanstack/react-query\";\nimport type { Questpie } from \"questpie\";\nimport type { QuestpieClient } from \"questpie/client\";\nimport { selectClient, useAdminStore, useScopedLocale } from \"../runtime\";\nimport { selectContentLocale } from \"../runtime/provider\";\n\n// ============================================================================\n// Type Helpers\n// ============================================================================\n\n/**\n * Extract collection names from a Questpie app\n */\ntype CollectionNames<TApp extends Questpie<any>> =\n\tkeyof TApp[\"config\"][\"collections\"] & string;\n\n/**\n * Extract global names from a Questpie app\n */\ntype GlobalNames<TApp extends Questpie<any>> =\n\tTApp extends Questpie<infer TConfig>\n\t\t? keyof TConfig[\"globals\"] & string\n\t\t: never;\n\n// ============================================================================\n// Typed Hooks Interface\n// ============================================================================\n\nexport interface TypedHooks<TApp extends Questpie<any>> {\n\t/**\n\t * Hook to fetch collection list with filters, sorting, pagination\n\t */\n\tuseCollectionList: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\toptions?: any,\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to count collection items with optional filters\n\t */\n\tuseCollectionCount: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\toptions?: { where?: any; includeDeleted?: boolean },\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to fetch single collection item\n\t */\n\tuseCollectionItem: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tid: string,\n\t\toptions?: {\n\t\t\tlocaleFallback?: boolean;\n\t\t\twith?: Record<string, boolean>;\n\t\t},\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to create collection item\n\t */\n\tuseCollectionCreate: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to update collection item\n\t */\n\tuseCollectionUpdate: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to delete collection item\n\t */\n\tuseCollectionDelete: <K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to fetch global settings\n\t */\n\tuseGlobal: <K extends GlobalNames<TApp>>(\n\t\tglobalName: K,\n\t\toptions?: any,\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t) => any;\n\n\t/**\n\t * Hook to update global settings\n\t */\n\tuseGlobalUpdate: <K extends GlobalNames<TApp>>(\n\t\tglobalName: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t) => any;\n}\n\n// ============================================================================\n// Factory Implementation\n// ============================================================================\n\n/**\n * Create type-safe hooks for collections and globals.\n *\n * This factory creates hooks that are typed to your specific CMS configuration,\n * providing autocomplete for collection/global names without module augmentation.\n *\n * @example\n * ```ts\n * import type { AppCMS } from './server/cms';\n * import { createTypedHooks } from '@questpie/admin/client';\n *\n * // Create typed hooks\n * export const {\n * useCollectionList,\n * useCollectionItem,\n * useCollectionCreate,\n * useCollectionUpdate,\n * useCollectionDelete,\n * useGlobal,\n * useGlobalUpdate,\n * } = createTypedHooks<AppCMS>();\n *\n * // Usage - collection names are autocompleted!\n * const { data } = useCollectionList(\"barbers\");\n * const { data: settings } = useGlobal(\"siteSettings\");\n * ```\n */\nexport function createTypedHooks<\n\tTApp extends Questpie<any>,\n>(): TypedHooks<TApp> {\n\t// Collection list hook\n\tfunction useCollectionList<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\toptions?: any,\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(\n\t\t\tclient as any,\n\t\t\t{\n\t\t\t\tkeyPrefix,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any,\n\t\t);\n\n\t\treturn useQuery({\n\t\t\t...(queryOpts as any).collections[collection as string].find({\n\t\t\t\t...options,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any),\n\t\t\t...queryOptions,\n\t\t});\n\t}\n\n\t// Collection count hook\n\tfunction useCollectionCount<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\toptions?: { where?: any; includeDeleted?: boolean },\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(\n\t\t\tclient as any,\n\t\t\t{\n\t\t\t\tkeyPrefix,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any,\n\t\t);\n\n\t\treturn useQuery({\n\t\t\t...(queryOpts as any).collections[collection as string].count({\n\t\t\t\t...options,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any),\n\t\t\t...queryOptions,\n\t\t});\n\t}\n\n\t// Collection item hook\n\tfunction useCollectionItem<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tid: string,\n\t\toptions?: {\n\t\t\tlocaleFallback?: boolean;\n\t\t\twith?: Record<string, boolean>;\n\t\t},\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(client as any, {\n\t\t\tkeyPrefix,\n\t\t\tlocale: contentLocale,\n\t\t});\n\n\t\treturn useQuery({\n\t\t\t...(queryOpts as any).collections[collection as string].findOne({\n\t\t\t\twhere: { id },\n\t\t\t\tlocale: contentLocale,\n\t\t\t\t...options,\n\t\t\t}),\n\t\t\t...queryOptions,\n\t\t});\n\t}\n\n\t// Collection create hook\n\tfunction useCollectionCreate<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst queryClient = useQueryClient();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(client as any, {\n\t\t\tkeyPrefix,\n\t\t\tlocale: contentLocale,\n\t\t});\n\n\t\tconst baseOptions = queryOpts.collections[collection as string].create();\n\t\tconst listQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"find\",\n\t\t\tcontentLocale,\n\t\t]);\n\t\tconst countQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"count\",\n\t\t\tcontentLocale,\n\t\t]);\n\n\t\treturn useMutation({\n\t\t\t...baseOptions,\n\t\t\tonSuccess: (data: any, variables: any, context: any) => {\n\t\t\t\t(mutationOptions?.onSuccess as any)?.(data, variables, context);\n\t\t\t},\n\t\t\tonSettled: (data: any, error: any, variables: any, context: any) => {\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: listQueryKey,\n\t\t\t\t});\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: countQueryKey,\n\t\t\t\t});\n\t\t\t\t(mutationOptions?.onSettled as any)?.(data, error, variables, context);\n\t\t\t},\n\t\t\t...mutationOptions,\n\t\t} as any);\n\t}\n\n\t// Collection update hook\n\tfunction useCollectionUpdate<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst queryClient = useQueryClient();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(client as any, {\n\t\t\tkeyPrefix,\n\t\t\tlocale: contentLocale,\n\t\t});\n\n\t\tconst baseOptions = queryOpts.collections[collection as string].update();\n\t\tconst listQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"find\",\n\t\t\tcontentLocale,\n\t\t]);\n\t\tconst countQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"count\",\n\t\t\tcontentLocale,\n\t\t]);\n\t\tconst itemQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"findOne\",\n\t\t\tcontentLocale,\n\t\t]);\n\n\t\treturn useMutation({\n\t\t\t...baseOptions,\n\t\t\tonSuccess: (data: any, variables: any, context: any) => {\n\t\t\t\t(mutationOptions?.onSuccess as any)?.(data, variables, context);\n\t\t\t},\n\t\t\tonSettled: (data: any, error: any, variables: any, context: any) => {\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: listQueryKey,\n\t\t\t\t});\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: countQueryKey,\n\t\t\t\t});\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: itemQueryKey,\n\t\t\t\t});\n\t\t\t\t(mutationOptions?.onSettled as any)?.(data, error, variables, context);\n\t\t\t},\n\t\t\t...mutationOptions,\n\t\t} as any);\n\t}\n\n\t// Collection delete hook\n\tfunction useCollectionDelete<K extends CollectionNames<TApp>>(\n\t\tcollection: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst { locale: contentLocale } = useScopedLocale();\n\t\tconst queryClient = useQueryClient();\n\t\tconst keyPrefix = [\"questpie\", \"collections\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(client as any, {\n\t\t\tkeyPrefix,\n\t\t\tlocale: contentLocale,\n\t\t});\n\n\t\tconst baseOptions = queryOpts.collections[collection as string].delete();\n\t\tconst listQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"find\",\n\t\t\tcontentLocale,\n\t\t]);\n\t\tconst countQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"count\",\n\t\t\tcontentLocale,\n\t\t]);\n\t\tconst itemQueryKey = queryOpts.key([\n\t\t\t\"collections\",\n\t\t\tcollection as string,\n\t\t\t\"findOne\",\n\t\t\tcontentLocale,\n\t\t]);\n\n\t\treturn useMutation({\n\t\t\t...baseOptions,\n\t\t\tonSuccess: (data: any, variables: any, context: any) => {\n\t\t\t\t(mutationOptions?.onSuccess as any)?.(data, variables, context);\n\t\t\t},\n\t\t\tonSettled: (data: any, error: any, variables: any, context: any) => {\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: listQueryKey,\n\t\t\t\t});\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: countQueryKey,\n\t\t\t\t});\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: itemQueryKey,\n\t\t\t\t});\n\t\t\t\t(mutationOptions?.onSettled as any)?.(data, error, variables, context);\n\t\t\t},\n\t\t\t...mutationOptions,\n\t\t} as any);\n\t}\n\n\t// Global hook\n\tfunction useGlobal<K extends GlobalNames<TApp>>(\n\t\tglobalName: K,\n\t\toptions?: any,\n\t\tqueryOptions?: Omit<UseQueryOptions, \"queryKey\" | \"queryFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst contentLocale = useAdminStore(selectContentLocale);\n\t\tconst keyPrefix = [\"questpie\", \"globals\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(\n\t\t\tclient as any,\n\t\t\t{\n\t\t\t\tkeyPrefix,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any,\n\t\t);\n\n\t\treturn useQuery({\n\t\t\t...(queryOpts as any).globals[globalName as string].get({\n\t\t\t\t...options,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any),\n\t\t\t...queryOptions,\n\t\t});\n\t}\n\n\t// Global update hook\n\tfunction useGlobalUpdate<K extends GlobalNames<TApp>>(\n\t\tglobalName: K,\n\t\tmutationOptions?: Omit<UseMutationOptions, \"mutationFn\">,\n\t): any {\n\t\tconst client = useAdminStore(selectClient);\n\t\tconst contentLocale = useAdminStore(selectContentLocale);\n\t\tconst queryClient = useQueryClient();\n\t\tconst keyPrefix = [\"questpie\", \"globals\"] as const;\n\t\tconst queryOpts = createQuestpieQueryOptions(\n\t\t\tclient as any,\n\t\t\t{\n\t\t\t\tkeyPrefix,\n\t\t\t\tlocale: contentLocale,\n\t\t\t} as any,\n\t\t);\n\n\t\tconst globalQueryKey = queryOpts.key([\n\t\t\t\"globals\",\n\t\t\tglobalName as string,\n\t\t\t\"get\",\n\t\t\tcontentLocale,\n\t\t]);\n\n\t\treturn useMutation({\n\t\t\t...(queryOpts as any).globals[globalName as string].update(),\n\t\t\tonSuccess: (data: any, variables: any, context: any) => {\n\t\t\t\t(mutationOptions?.onSuccess as any)?.(data, variables, context);\n\t\t\t},\n\t\t\tonSettled: (data: any, error: any, variables: any, context: any) => {\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: globalQueryKey,\n\t\t\t\t});\n\t\t\t\t(mutationOptions?.onSettled as any)?.(data, error, variables, context);\n\t\t\t},\n\t\t\t...mutationOptions,\n\t\t} as any);\n\t}\n\n\treturn {\n\t\tuseCollectionList,\n\t\tuseCollectionCount,\n\t\tuseCollectionItem,\n\t\tuseCollectionCreate,\n\t\tuseCollectionUpdate,\n\t\tuseCollectionDelete,\n\t\tuseGlobal,\n\t\tuseGlobalUpdate,\n\t};\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { getDefaultActionsConfig } from "../builder/types/action-registry.mjs";
|
|
4
|
+
import { useTranslation } from "../i18n/hooks.mjs";
|
|
5
|
+
import { selectBasePath, selectClient, selectContentLocale, selectNavigate, useAdminStore } from "../runtime/provider.mjs";
|
|
6
|
+
import { createQuestpieQueryOptions } from "@questpie/tanstack-query";
|
|
7
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { toast } from "sonner";
|
|
10
|
+
|
|
11
|
+
//#region src/client/hooks/use-action.ts
|
|
12
|
+
/**
|
|
13
|
+
* useAction Hook
|
|
14
|
+
*
|
|
15
|
+
* Provides action helpers and state management for collection actions.
|
|
16
|
+
* Handles action execution, navigation, and API calls.
|
|
17
|
+
*/
|
|
18
|
+
/** Query key prefix for CMS queries (must match use-collection.ts) */
|
|
19
|
+
const QUERY_KEY_PREFIX = ["questpie", "collections"];
|
|
20
|
+
/**
|
|
21
|
+
* Hook to create action helpers for a collection
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { helpers } = useActionHelpers({ collection: "posts" });
|
|
26
|
+
*
|
|
27
|
+
* return (
|
|
28
|
+
* <HeaderActions
|
|
29
|
+
* actions={headerActions}
|
|
30
|
+
* collection="posts"
|
|
31
|
+
* helpers={helpers}
|
|
32
|
+
* />
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function useActionHelpers({ collection, onRefresh }) {
|
|
37
|
+
const basePath = useAdminStore(selectBasePath);
|
|
38
|
+
const navigate = useAdminStore(selectNavigate);
|
|
39
|
+
const client = useAdminStore(selectClient);
|
|
40
|
+
const contentLocale = useAdminStore(selectContentLocale);
|
|
41
|
+
const queryClient = useQueryClient();
|
|
42
|
+
const { t } = useTranslation();
|
|
43
|
+
const queryOpts = React$1.useMemo(() => createQuestpieQueryOptions(client, {
|
|
44
|
+
keyPrefix: QUERY_KEY_PREFIX,
|
|
45
|
+
locale: contentLocale
|
|
46
|
+
}), [client, contentLocale]);
|
|
47
|
+
return { helpers: React$1.useMemo(() => ({
|
|
48
|
+
navigate,
|
|
49
|
+
toast: {
|
|
50
|
+
success: toast.success,
|
|
51
|
+
error: toast.error,
|
|
52
|
+
info: toast.info,
|
|
53
|
+
warning: toast.warning
|
|
54
|
+
},
|
|
55
|
+
t,
|
|
56
|
+
invalidateCollection: async (targetCollection) => {
|
|
57
|
+
const col = targetCollection || collection;
|
|
58
|
+
await queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
59
|
+
"collections",
|
|
60
|
+
col,
|
|
61
|
+
"find",
|
|
62
|
+
contentLocale
|
|
63
|
+
]) });
|
|
64
|
+
await queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
65
|
+
"collections",
|
|
66
|
+
col,
|
|
67
|
+
"count",
|
|
68
|
+
contentLocale
|
|
69
|
+
]) });
|
|
70
|
+
onRefresh?.();
|
|
71
|
+
},
|
|
72
|
+
invalidateItem: async (itemId, targetCollection) => {
|
|
73
|
+
const col = targetCollection || collection;
|
|
74
|
+
await queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
75
|
+
"collections",
|
|
76
|
+
col,
|
|
77
|
+
"findOne",
|
|
78
|
+
contentLocale,
|
|
79
|
+
{ id: itemId }
|
|
80
|
+
]) });
|
|
81
|
+
await queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
82
|
+
"collections",
|
|
83
|
+
col,
|
|
84
|
+
"find",
|
|
85
|
+
contentLocale
|
|
86
|
+
]) });
|
|
87
|
+
},
|
|
88
|
+
invalidateAll: async () => {
|
|
89
|
+
await queryClient.invalidateQueries({ queryKey: [...QUERY_KEY_PREFIX] });
|
|
90
|
+
onRefresh?.();
|
|
91
|
+
},
|
|
92
|
+
refresh: () => {
|
|
93
|
+
queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
94
|
+
"collections",
|
|
95
|
+
collection,
|
|
96
|
+
"find",
|
|
97
|
+
contentLocale
|
|
98
|
+
]) });
|
|
99
|
+
queryClient.invalidateQueries({ queryKey: queryOpts.key([
|
|
100
|
+
"collections",
|
|
101
|
+
collection,
|
|
102
|
+
"count",
|
|
103
|
+
contentLocale
|
|
104
|
+
]) });
|
|
105
|
+
onRefresh?.();
|
|
106
|
+
},
|
|
107
|
+
closeDialog: () => {},
|
|
108
|
+
basePath
|
|
109
|
+
}), [
|
|
110
|
+
navigate,
|
|
111
|
+
queryClient,
|
|
112
|
+
queryOpts,
|
|
113
|
+
collection,
|
|
114
|
+
contentLocale,
|
|
115
|
+
onRefresh,
|
|
116
|
+
basePath,
|
|
117
|
+
t
|
|
118
|
+
]) };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Hook to manage collection actions with dialog state
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* const {
|
|
126
|
+
* helpers,
|
|
127
|
+
* actions,
|
|
128
|
+
* dialogAction,
|
|
129
|
+
* dialogItem,
|
|
130
|
+
* openDialog,
|
|
131
|
+
* closeDialog,
|
|
132
|
+
* } = useActions({
|
|
133
|
+
* collection: "posts",
|
|
134
|
+
* actionsConfig: config.actions,
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* return (
|
|
138
|
+
* <>
|
|
139
|
+
* <HeaderActions
|
|
140
|
+
* actions={actions.header}
|
|
141
|
+
* collection="posts"
|
|
142
|
+
* helpers={helpers}
|
|
143
|
+
* onOpenDialog={openDialog}
|
|
144
|
+
* />
|
|
145
|
+
*
|
|
146
|
+
* {dialogAction && (
|
|
147
|
+
* <ActionDialog
|
|
148
|
+
* open={!!dialogAction}
|
|
149
|
+
* onOpenChange={(open) => !open && closeDialog()}
|
|
150
|
+
* action={dialogAction}
|
|
151
|
+
* collection="posts"
|
|
152
|
+
* item={dialogItem}
|
|
153
|
+
* helpers={helpers}
|
|
154
|
+
* />
|
|
155
|
+
* )}
|
|
156
|
+
* </>
|
|
157
|
+
* );
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
function useActions({ collection, actionsConfig, onRefresh }) {
|
|
161
|
+
const [dialogAction, setDialogAction] = React$1.useState(null);
|
|
162
|
+
const [dialogItem, setDialogItem] = React$1.useState(null);
|
|
163
|
+
const defaultActions = React$1.useMemo(() => getDefaultActionsConfig(), []);
|
|
164
|
+
const actions = React$1.useMemo(() => ({
|
|
165
|
+
header: actionsConfig?.header ?? defaultActions.header ?? {
|
|
166
|
+
primary: [],
|
|
167
|
+
secondary: []
|
|
168
|
+
},
|
|
169
|
+
bulk: actionsConfig?.bulk ?? defaultActions.bulk ?? []
|
|
170
|
+
}), [actionsConfig, defaultActions]);
|
|
171
|
+
const closeDialog = React$1.useCallback(() => {
|
|
172
|
+
setDialogAction(null);
|
|
173
|
+
setDialogItem(null);
|
|
174
|
+
}, []);
|
|
175
|
+
const { helpers: baseHelpers } = useActionHelpers({
|
|
176
|
+
collection,
|
|
177
|
+
onRefresh: () => {
|
|
178
|
+
onRefresh?.();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
helpers: React$1.useMemo(() => ({
|
|
183
|
+
...baseHelpers,
|
|
184
|
+
closeDialog
|
|
185
|
+
}), [baseHelpers, closeDialog]),
|
|
186
|
+
actions,
|
|
187
|
+
dialogAction,
|
|
188
|
+
setDialogAction,
|
|
189
|
+
dialogItem,
|
|
190
|
+
setDialogItem,
|
|
191
|
+
openDialog: React$1.useCallback((action, item) => {
|
|
192
|
+
setDialogAction(action);
|
|
193
|
+
setDialogItem(item ?? null);
|
|
194
|
+
}, []),
|
|
195
|
+
closeDialog
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
//#endregion
|
|
200
|
+
export { useActions };
|
|
201
|
+
//# sourceMappingURL=use-action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-action.mjs","names":["React","actions: Required<ActionsConfig<TItem>>"],"sources":["../../../src/client/hooks/use-action.ts"],"sourcesContent":["/**\n * useAction Hook\n *\n * Provides action helpers and state management for collection actions.\n * Handles action execution, navigation, and API calls.\n */\n\n\"use client\";\n\nimport { createQuestpieQueryOptions } from \"@questpie/tanstack-query\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport * as React from \"react\";\nimport { toast } from \"sonner\";\nimport { getDefaultActionsConfig } from \"../builder/types/action-registry\";\nimport type {\n ActionContext,\n ActionDefinition,\n ActionHelpers,\n ActionQueryClient,\n ActionsConfig,\n HeaderActionsConfig,\n} from \"../builder/types/action-types\";\nimport { useTranslation } from \"../i18n/hooks\";\nimport {\n selectAuthClient,\n selectBasePath,\n selectClient,\n selectContentLocale,\n selectNavigate,\n useAdminStore,\n} from \"../runtime/provider\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Query key prefix for CMS queries (must match use-collection.ts) */\nconst QUERY_KEY_PREFIX = [\"questpie\", \"collections\"] as const;\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UseActionHelpersOptions {\n /** Collection name */\n collection: string;\n /** Custom refresh callback */\n onRefresh?: () => void;\n}\n\nexport interface UseActionHelpersReturn {\n /** Action helpers to pass to action components */\n helpers: ActionHelpers;\n}\n\nexport interface UseActionsOptions<TItem = any> {\n /** Collection name */\n collection: string;\n /** Actions configuration from collection config */\n actionsConfig?: ActionsConfig<TItem>;\n /** Custom refresh callback */\n onRefresh?: () => void;\n}\n\nexport interface UseActionsReturn<TItem = any> {\n /** Action helpers */\n helpers: ActionHelpers;\n /** Resolved actions config (with defaults) */\n actions: Required<ActionsConfig<TItem>>;\n /** Currently active dialog action */\n dialogAction: ActionDefinition<TItem> | null;\n /** Set active dialog action */\n setDialogAction: (action: ActionDefinition<TItem> | null) => void;\n /** Item for dialog action (for row actions) */\n dialogItem: TItem | null;\n /** Set item for dialog action */\n setDialogItem: (item: TItem | null) => void;\n /** Open dialog for an action */\n openDialog: (action: ActionDefinition<TItem>, item?: TItem) => void;\n /** Close dialog */\n closeDialog: () => void;\n}\n\n// ============================================================================\n// useActionHelpers Hook\n// ============================================================================\n\n/**\n * Hook to create action helpers for a collection\n *\n * @example\n * ```tsx\n * const { helpers } = useActionHelpers({ collection: \"posts\" });\n *\n * return (\n * <HeaderActions\n * actions={headerActions}\n * collection=\"posts\"\n * helpers={helpers}\n * />\n * );\n * ```\n */\nexport function useActionHelpers({\n collection,\n onRefresh,\n}: UseActionHelpersOptions): UseActionHelpersReturn {\n const basePath = useAdminStore(selectBasePath);\n const navigate = useAdminStore(selectNavigate);\n const client = useAdminStore(selectClient);\n const contentLocale = useAdminStore(selectContentLocale);\n const queryClient = useQueryClient();\n const { t } = useTranslation();\n\n // Create query options proxy for key building (same as use-collection hooks)\n const queryOpts = React.useMemo(\n () =>\n createQuestpieQueryOptions(client as any, {\n keyPrefix: QUERY_KEY_PREFIX,\n locale: contentLocale,\n }),\n [client, contentLocale],\n );\n\n const helpers: ActionHelpers = React.useMemo(\n () => ({\n navigate,\n toast: {\n success: toast.success,\n error: toast.error,\n info: toast.info,\n warning: toast.warning,\n },\n t,\n invalidateCollection: async (targetCollection?: string) => {\n const col = targetCollection || collection;\n // Invalidate list and count queries for the collection\n await queryClient.invalidateQueries({\n queryKey: queryOpts.key([\"collections\", col, \"find\", contentLocale]),\n });\n await queryClient.invalidateQueries({\n queryKey: queryOpts.key([\"collections\", col, \"count\", contentLocale]),\n });\n // Call custom refresh handler\n onRefresh?.();\n },\n invalidateItem: async (itemId: string, targetCollection?: string) => {\n const col = targetCollection || collection;\n // Invalidate findOne query for specific item\n await queryClient.invalidateQueries({\n queryKey: queryOpts.key([\n \"collections\",\n col,\n \"findOne\",\n contentLocale,\n { id: itemId },\n ]),\n });\n // Also invalidate list queries since item data changed\n await queryClient.invalidateQueries({\n queryKey: queryOpts.key([\"collections\", col, \"find\", contentLocale]),\n });\n },\n invalidateAll: async () => {\n // Invalidate all CMS queries\n await queryClient.invalidateQueries({\n queryKey: [...QUERY_KEY_PREFIX],\n });\n // Call custom refresh handler\n onRefresh?.();\n },\n refresh: () => {\n // Invalidate collection queries (better than page reload)\n queryClient.invalidateQueries({\n queryKey: queryOpts.key([\n \"collections\",\n collection,\n \"find\",\n contentLocale,\n ]),\n });\n queryClient.invalidateQueries({\n queryKey: queryOpts.key([\n \"collections\",\n collection,\n \"count\",\n contentLocale,\n ]),\n });\n // Call custom refresh handler\n onRefresh?.();\n },\n closeDialog: () => {\n // This will be overridden by the component managing dialog state\n },\n basePath,\n }),\n [\n navigate,\n queryClient,\n queryOpts,\n collection,\n contentLocale,\n onRefresh,\n basePath,\n t,\n ],\n );\n\n return { helpers };\n}\n\n// ============================================================================\n// useActions Hook\n// ============================================================================\n\n/**\n * Hook to manage collection actions with dialog state\n *\n * @example\n * ```tsx\n * const {\n * helpers,\n * actions,\n * dialogAction,\n * dialogItem,\n * openDialog,\n * closeDialog,\n * } = useActions({\n * collection: \"posts\",\n * actionsConfig: config.actions,\n * });\n *\n * return (\n * <>\n * <HeaderActions\n * actions={actions.header}\n * collection=\"posts\"\n * helpers={helpers}\n * onOpenDialog={openDialog}\n * />\n *\n * {dialogAction && (\n * <ActionDialog\n * open={!!dialogAction}\n * onOpenChange={(open) => !open && closeDialog()}\n * action={dialogAction}\n * collection=\"posts\"\n * item={dialogItem}\n * helpers={helpers}\n * />\n * )}\n * </>\n * );\n * ```\n */\nexport function useActions<TItem = any>({\n collection,\n actionsConfig,\n onRefresh,\n}: UseActionsOptions<TItem>): UseActionsReturn<TItem> {\n const [dialogAction, setDialogAction] =\n React.useState<ActionDefinition<TItem> | null>(null);\n const [dialogItem, setDialogItem] = React.useState<TItem | null>(null);\n\n // Get default actions if not provided\n const defaultActions = React.useMemo(\n () => getDefaultActionsConfig<TItem>(),\n [],\n );\n\n // Merge provided config with defaults\n const actions: Required<ActionsConfig<TItem>> = React.useMemo(\n () => ({\n header: actionsConfig?.header ??\n defaultActions.header ?? { primary: [], secondary: [] },\n bulk: actionsConfig?.bulk ?? defaultActions.bulk ?? [],\n }),\n [actionsConfig, defaultActions],\n );\n\n // Close dialog handler\n const closeDialog = React.useCallback(() => {\n setDialogAction(null);\n setDialogItem(null);\n }, []);\n\n // Get base helpers\n const { helpers: baseHelpers } = useActionHelpers({\n collection,\n onRefresh: () => {\n onRefresh?.();\n },\n });\n\n // Enhanced helpers with dialog control\n const helpers: ActionHelpers = React.useMemo(\n () => ({\n ...baseHelpers,\n closeDialog,\n }),\n [baseHelpers, closeDialog],\n );\n\n // Open dialog for an action\n const openDialog = React.useCallback(\n (action: ActionDefinition<TItem>, item?: TItem) => {\n setDialogAction(action);\n setDialogItem(item ?? null);\n },\n [],\n );\n\n return {\n helpers,\n actions,\n dialogAction,\n setDialogAction,\n dialogItem,\n setDialogItem,\n openDialog,\n closeDialog,\n };\n}\n\n// ============================================================================\n// useActionExecution Hook\n// ============================================================================\n\nexport interface UseActionExecutionOptions<TItem = any> {\n /** Collection name */\n collection: string;\n /** Action helpers */\n helpers: ActionHelpers;\n}\n\n/**\n * Hook for executing individual actions\n *\n * Provides a function to execute an action with proper error handling\n * and loading state management.\n */\nexport function useActionExecution<TItem = any>({\n collection,\n helpers,\n}: UseActionExecutionOptions<TItem>) {\n const client = useAdminStore(selectClient);\n const authClient = useAdminStore(selectAuthClient);\n const queryClient = useQueryClient();\n const [isExecuting, setIsExecuting] = React.useState(false);\n\n // Wrapped query client for action context\n const actionQueryClient: ActionQueryClient = React.useMemo(\n () => ({\n invalidateQueries: (filters) => queryClient.invalidateQueries(filters),\n refetchQueries: (filters) => queryClient.refetchQueries(filters),\n resetQueries: (filters) => queryClient.resetQueries(filters),\n }),\n [queryClient],\n );\n\n const executeAction = React.useCallback(\n async (\n action: ActionDefinition<TItem>,\n item?: TItem,\n items?: TItem[],\n ): Promise<void> => {\n const ctx: ActionContext<TItem> = {\n item,\n items,\n collection,\n helpers,\n queryClient: actionQueryClient,\n authClient,\n };\n\n setIsExecuting(true);\n try {\n const { handler } = action;\n\n switch (handler.type) {\n case \"navigate\": {\n const path =\n typeof handler.path === \"function\"\n ? handler.path(item!)\n : handler.path;\n helpers.navigate(\n `${helpers.basePath}/collections/${collection}/${path}`,\n );\n break;\n }\n\n case \"api\": {\n // Replace {id} placeholder in endpoint\n const endpoint = handler.endpoint.replace(\n \"{id}\",\n String((item as any)?.id || \"\"),\n );\n\n // Execute API call\n const method = (handler.method || \"POST\").toLowerCase();\n\n // Get collection-specific client\n const collectionClient = (client as any).collections?.[collection];\n\n if (collectionClient) {\n if (method === \"delete\" && collectionClient.delete) {\n await collectionClient.delete({ id: (item as any)?.id });\n helpers.toast.success(\"Item deleted successfully\");\n } else {\n // For other methods, show info (actual implementation would call the API)\n helpers.toast.info(`${handler.method || \"POST\"} ${endpoint}`);\n }\n } else {\n helpers.toast.info(\n `API call: ${handler.method || \"POST\"} ${endpoint}`,\n );\n }\n\n helpers.refresh();\n break;\n }\n\n case \"custom\": {\n await handler.fn(ctx);\n break;\n }\n\n case \"dialog\":\n case \"form\": {\n // These are handled by the ActionDialog component\n break;\n }\n\n case \"server\": {\n // Execute server-side action via API\n const serverHandler = handler as {\n type: \"server\";\n actionId: string;\n collection: string;\n };\n try {\n const collectionClient = (client as any).collections?.[\n serverHandler.collection\n ];\n if (collectionClient?.executeAction) {\n const result = await collectionClient.executeAction(\n serverHandler.actionId,\n {\n itemId: (item as any)?.id,\n itemIds: items?.map((i: any) => i?.id).filter(Boolean),\n },\n );\n if (result?.toast) {\n if (result.type === \"error\") {\n helpers.toast.error(result.toast.message);\n } else {\n helpers.toast.success(result.toast.message);\n }\n }\n if (result?.effects?.invalidate) {\n if (result.effects.invalidate === true) {\n await helpers.invalidateAll();\n } else {\n for (const col of result.effects.invalidate) {\n await helpers.invalidateCollection(col);\n }\n }\n }\n if (result?.effects?.closeModal) {\n helpers.closeDialog();\n }\n } else {\n helpers.toast.info(`Server action: ${serverHandler.actionId}`);\n }\n } catch (err) {\n helpers.toast.error(\n err instanceof Error ? err.message : \"Server action failed\",\n );\n }\n break;\n }\n }\n } catch (error) {\n helpers.toast.error(\n error instanceof Error ? error.message : \"Action failed\",\n );\n } finally {\n setIsExecuting(false);\n }\n },\n [collection, helpers, client, authClient, actionQueryClient],\n );\n\n return {\n executeAction,\n isExecuting,\n };\n}\n"],"mappings":"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"}
|