@revealui/core 0.0.0-canary-20260409021642
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +171 -0
- package/dist/api/compression.d.ts +83 -0
- package/dist/api/compression.d.ts.map +1 -0
- package/dist/api/compression.js +233 -0
- package/dist/api/payload-optimization.d.ts +138 -0
- package/dist/api/payload-optimization.d.ts.map +1 -0
- package/dist/api/payload-optimization.js +320 -0
- package/dist/api/rate-limit.d.ts +114 -0
- package/dist/api/rate-limit.d.ts.map +1 -0
- package/dist/api/rate-limit.js +376 -0
- package/dist/api/response-cache.d.ts +125 -0
- package/dist/api/response-cache.d.ts.map +1 -0
- package/dist/api/response-cache.js +335 -0
- package/dist/api/rest.d.ts +54 -0
- package/dist/api/rest.d.ts.map +1 -0
- package/dist/api/rest.js +465 -0
- package/dist/auth/access.d.ts +25 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/access.js +20 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/cache/query-cache.d.ts +100 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +266 -0
- package/dist/caching/index.d.ts +6 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +5 -0
- package/dist/client/admin/RichText.d.ts +12 -0
- package/dist/client/admin/RichText.d.ts.map +1 -0
- package/dist/client/admin/RichText.js +5 -0
- package/dist/client/admin/components/AdminDashboard.d.ts +7 -0
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -0
- package/dist/client/admin/components/AdminDashboard.js +308 -0
- package/dist/client/admin/components/CollectionList.d.ts +16 -0
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -0
- package/dist/client/admin/components/CollectionList.js +67 -0
- package/dist/client/admin/components/DocumentForm.d.ts +11 -0
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -0
- package/dist/client/admin/components/DocumentForm.js +223 -0
- package/dist/client/admin/components/GlobalForm.d.ts +11 -0
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -0
- package/dist/client/admin/components/GlobalForm.js +74 -0
- package/dist/client/admin/context/ServerFunctionContext.d.ts +8 -0
- package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -0
- package/dist/client/admin/context/ServerFunctionContext.js +15 -0
- package/dist/client/admin/i18n/en.d.ts +25 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -0
- package/dist/client/admin/i18n/en.js +25 -0
- package/dist/client/admin/index.d.ts +11 -0
- package/dist/client/admin/index.d.ts.map +1 -0
- package/dist/client/admin/index.js +11 -0
- package/dist/client/admin/layout.d.ts +10 -0
- package/dist/client/admin/layout.d.ts.map +1 -0
- package/dist/client/admin/layout.js +7 -0
- package/dist/client/admin/page.d.ts +38 -0
- package/dist/client/admin/page.d.ts.map +1 -0
- package/dist/client/admin/page.js +15 -0
- package/dist/client/admin/utils/apiClient.d.ts +110 -0
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -0
- package/dist/client/admin/utils/apiClient.js +216 -0
- package/dist/client/admin/utils/index.d.ts +5 -0
- package/dist/client/admin/utils/index.d.ts.map +1 -0
- package/dist/client/admin/utils/index.js +4 -0
- package/dist/client/admin/utils/serializeConfig.d.ts +7 -0
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -0
- package/dist/client/admin/utils/serializeConfig.js +35 -0
- package/dist/client/hooks.d.ts +18 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +29 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +13 -0
- package/dist/client/richtext/RichTextEditor.d.ts +48 -0
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -0
- package/dist/client/richtext/RichTextEditor.js +360 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts +9 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageNodeComponent.js +98 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts +13 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageUploadButton.js +118 -0
- package/dist/client/richtext/index.d.ts +92 -0
- package/dist/client/richtext/index.d.ts.map +1 -0
- package/dist/client/richtext/index.js +74 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts +20 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.js +29 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts +51 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/ImageNode.js +95 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts +13 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.js +8 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts +4 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.js +50 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts +7 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +246 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts +3 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ImagePlugin.js +73 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts +2 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/PastePlugin.js +36 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts +8 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.js +204 -0
- package/dist/client/ui/index.d.ts +111 -0
- package/dist/client/ui/index.d.ts.map +1 -0
- package/dist/client/ui/index.js +130 -0
- package/dist/collections/CollectionOperations.d.ts +27 -0
- package/dist/collections/CollectionOperations.d.ts.map +1 -0
- package/dist/collections/CollectionOperations.js +48 -0
- package/dist/collections/hooks.d.ts +11 -0
- package/dist/collections/hooks.d.ts.map +1 -0
- package/dist/collections/hooks.js +35 -0
- package/dist/collections/index.d.ts +2 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +1 -0
- package/dist/collections/operations/create.d.ts +9 -0
- package/dist/collections/operations/create.d.ts.map +1 -0
- package/dist/collections/operations/create.js +130 -0
- package/dist/collections/operations/createMany.d.ts +12 -0
- package/dist/collections/operations/createMany.d.ts.map +1 -0
- package/dist/collections/operations/createMany.js +43 -0
- package/dist/collections/operations/delete.d.ts +10 -0
- package/dist/collections/operations/delete.d.ts.map +1 -0
- package/dist/collections/operations/delete.js +45 -0
- package/dist/collections/operations/deleteMany.d.ts +11 -0
- package/dist/collections/operations/deleteMany.d.ts.map +1 -0
- package/dist/collections/operations/deleteMany.js +50 -0
- package/dist/collections/operations/fieldHooks.d.ts +21 -0
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -0
- package/dist/collections/operations/fieldHooks.js +51 -0
- package/dist/collections/operations/find.d.ts +8 -0
- package/dist/collections/operations/find.d.ts.map +1 -0
- package/dist/collections/operations/find.js +231 -0
- package/dist/collections/operations/findById.d.ts +14 -0
- package/dist/collections/operations/findById.d.ts.map +1 -0
- package/dist/collections/operations/findById.js +111 -0
- package/dist/collections/operations/sqlAdapter.d.ts +23 -0
- package/dist/collections/operations/sqlAdapter.d.ts.map +1 -0
- package/dist/collections/operations/sqlAdapter.js +108 -0
- package/dist/collections/operations/update.d.ts +8 -0
- package/dist/collections/operations/update.d.ts.map +1 -0
- package/dist/collections/operations/update.js +226 -0
- package/dist/collections/operations/updateMany.d.ts +11 -0
- package/dist/collections/operations/updateMany.d.ts.map +1 -0
- package/dist/collections/operations/updateMany.js +52 -0
- package/dist/collections/registry.d.ts +12 -0
- package/dist/collections/registry.d.ts.map +1 -0
- package/dist/collections/registry.js +38 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +61 -0
- package/dist/config/runtime.d.ts +22 -0
- package/dist/config/runtime.d.ts.map +1 -0
- package/dist/config/runtime.js +32 -0
- package/dist/config/utils.d.ts +2 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +21 -0
- package/dist/database/index.d.ts +4 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +2 -0
- package/dist/database/safe-parse.d.ts +26 -0
- package/dist/database/safe-parse.d.ts.map +1 -0
- package/dist/database/safe-parse.js +42 -0
- package/dist/database/ssl-config.d.ts +9 -0
- package/dist/database/ssl-config.d.ts.map +1 -0
- package/dist/database/ssl-config.js +7 -0
- package/dist/database/type-adapter.d.ts +113 -0
- package/dist/database/type-adapter.d.ts.map +1 -0
- package/dist/database/type-adapter.js +97 -0
- package/dist/database/universal-postgres.d.ts +45 -0
- package/dist/database/universal-postgres.d.ts.map +1 -0
- package/dist/database/universal-postgres.js +531 -0
- package/dist/dataloader.d.ts +26 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +176 -0
- package/dist/error-handling/error-boundary.d.ts +94 -0
- package/dist/error-handling/error-boundary.d.ts.map +1 -0
- package/dist/error-handling/error-boundary.js +285 -0
- package/dist/error-handling/error-reporter.d.ts +214 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +491 -0
- package/dist/error-handling/fallback-components.d.ts +131 -0
- package/dist/error-handling/fallback-components.d.ts.map +1 -0
- package/dist/error-handling/fallback-components.js +371 -0
- package/dist/error-handling/index.d.ts +14 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +12 -0
- package/dist/factories/builders.d.ts +50 -0
- package/dist/factories/builders.d.ts.map +1 -0
- package/dist/factories/builders.js +77 -0
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +1 -0
- package/dist/features.d.ts +88 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +105 -0
- package/dist/fieldTraversal.d.ts +26 -0
- package/dist/fieldTraversal.d.ts.map +1 -0
- package/dist/fieldTraversal.js +132 -0
- package/dist/fields/config/types.d.ts +48 -0
- package/dist/fields/config/types.d.ts.map +1 -0
- package/dist/fields/config/types.js +20 -0
- package/dist/fields/getDefaultValue.d.ts +16 -0
- package/dist/fields/getDefaultValue.d.ts.map +1 -0
- package/dist/fields/getDefaultValue.js +20 -0
- package/dist/fields/getFieldPaths.d.ts +25 -0
- package/dist/fields/getFieldPaths.d.ts.map +1 -0
- package/dist/fields/getFieldPaths.js +23 -0
- package/dist/fields/hooks/afterRead/index.d.ts +36 -0
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/index.js +70 -0
- package/dist/fields/hooks/afterRead/promise.d.ts +46 -0
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/promise.js +178 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +44 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/traverseFields.js +37 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +9 -0
- package/dist/generated/types/cms.d.ts +1766 -0
- package/dist/generated/types/cms.d.ts.map +1 -0
- package/dist/generated/types/cms.js +11 -0
- package/dist/generated/types/index.d.ts +16 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +21 -0
- package/dist/generated/types/neon.d.ts +11 -0
- package/dist/generated/types/neon.d.ts.map +1 -0
- package/dist/generated/types/neon.js +13 -0
- package/dist/globals/GlobalOperations.d.ts +24 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -0
- package/dist/globals/GlobalOperations.js +165 -0
- package/dist/globals/index.d.ts +2 -0
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/index.js +1 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +136 -0
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +293 -0
- package/dist/instance/index.d.ts +3 -0
- package/dist/instance/index.d.ts.map +1 -0
- package/dist/instance/index.js +2 -0
- package/dist/instance/logger.d.ts +31 -0
- package/dist/instance/logger.d.ts.map +1 -0
- package/dist/instance/logger.js +42 -0
- package/dist/instance/methods/create.d.ts +10 -0
- package/dist/instance/methods/create.d.ts.map +1 -0
- package/dist/instance/methods/create.js +38 -0
- package/dist/instance/methods/delete.d.ts +10 -0
- package/dist/instance/methods/delete.d.ts.map +1 -0
- package/dist/instance/methods/delete.js +24 -0
- package/dist/instance/methods/find.d.ts +10 -0
- package/dist/instance/methods/find.d.ts.map +1 -0
- package/dist/instance/methods/find.js +20 -0
- package/dist/instance/methods/findById.d.ts +13 -0
- package/dist/instance/methods/findById.d.ts.map +1 -0
- package/dist/instance/methods/findById.js +20 -0
- package/dist/instance/methods/hooks.d.ts +14 -0
- package/dist/instance/methods/hooks.d.ts.map +1 -0
- package/dist/instance/methods/hooks.js +34 -0
- package/dist/instance/methods/update.d.ts +10 -0
- package/dist/instance/methods/update.d.ts.map +1 -0
- package/dist/instance/methods/update.js +42 -0
- package/dist/jobs/index.d.ts +16 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +14 -0
- package/dist/jobs/queue.d.ts +57 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/queue.js +134 -0
- package/dist/license-encryption.d.ts +21 -0
- package/dist/license-encryption.d.ts.map +1 -0
- package/dist/license-encryption.js +74 -0
- package/dist/license.d.ts +99 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +262 -0
- package/dist/monitoring/alerts.d.ts +118 -0
- package/dist/monitoring/alerts.d.ts.map +1 -0
- package/dist/monitoring/alerts.js +324 -0
- package/dist/monitoring/cleanup-manager.d.ts +71 -0
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -0
- package/dist/monitoring/cleanup-manager.js +226 -0
- package/dist/monitoring/health-monitor.d.ts +22 -0
- package/dist/monitoring/health-monitor.d.ts.map +1 -0
- package/dist/monitoring/health-monitor.js +142 -0
- package/dist/monitoring/index.d.ts +14 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +17 -0
- package/dist/monitoring/process-registry.d.ts +97 -0
- package/dist/monitoring/process-registry.d.ts.map +1 -0
- package/dist/monitoring/process-registry.js +222 -0
- package/dist/monitoring/query-monitor.d.ts +153 -0
- package/dist/monitoring/query-monitor.d.ts.map +1 -0
- package/dist/monitoring/query-monitor.js +209 -0
- package/dist/monitoring/types.d.ts +231 -0
- package/dist/monitoring/types.d.ts.map +1 -0
- package/dist/monitoring/types.js +42 -0
- package/dist/monitoring/zombie-detector.d.ts +81 -0
- package/dist/monitoring/zombie-detector.d.ts.map +1 -0
- package/dist/monitoring/zombie-detector.js +236 -0
- package/dist/nextjs/index.d.ts +4 -0
- package/dist/nextjs/index.d.ts.map +1 -0
- package/dist/nextjs/index.js +3 -0
- package/dist/nextjs/utilities.d.ts +5 -0
- package/dist/nextjs/utilities.d.ts.map +1 -0
- package/dist/nextjs/utilities.js +16 -0
- package/dist/nextjs/withRevealUI.d.ts +20 -0
- package/dist/nextjs/withRevealUI.d.ts.map +1 -0
- package/dist/nextjs/withRevealUI.js +181 -0
- package/dist/observability/alerts.d.ts +138 -0
- package/dist/observability/alerts.d.ts.map +1 -0
- package/dist/observability/alerts.js +389 -0
- package/dist/observability/health-check.d.ts +91 -0
- package/dist/observability/health-check.d.ts.map +1 -0
- package/dist/observability/health-check.js +345 -0
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/logger.d.ts +47 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +140 -0
- package/dist/observability/metrics.d.ts +205 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +429 -0
- package/dist/observability/tracing.d.ts +149 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +380 -0
- package/dist/plugins/form-builder.d.ts +115 -0
- package/dist/plugins/form-builder.d.ts.map +1 -0
- package/dist/plugins/form-builder.js +239 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/nested-docs.d.ts +12 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -0
- package/dist/plugins/nested-docs.js +111 -0
- package/dist/plugins/redirects.d.ts +17 -0
- package/dist/plugins/redirects.d.ts.map +1 -0
- package/dist/plugins/redirects.js +62 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +1 -0
- package/dist/queries/queryBuilder.d.ts +47 -0
- package/dist/queries/queryBuilder.d.ts.map +1 -0
- package/dist/queries/queryBuilder.js +276 -0
- package/dist/relationships/analyzer.d.ts +39 -0
- package/dist/relationships/analyzer.d.ts.map +1 -0
- package/dist/relationships/analyzer.js +135 -0
- package/dist/relationships/index.d.ts +3 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +2 -0
- package/dist/relationships/populate-core.d.ts +57 -0
- package/dist/relationships/populate-core.d.ts.map +1 -0
- package/dist/relationships/populate-core.js +116 -0
- package/dist/relationships/populate-helpers.d.ts +58 -0
- package/dist/relationships/populate-helpers.d.ts.map +1 -0
- package/dist/relationships/populate-helpers.js +82 -0
- package/dist/relationships/population.d.ts +34 -0
- package/dist/relationships/population.d.ts.map +1 -0
- package/dist/relationships/population.js +193 -0
- package/dist/revealui.d.ts +46 -0
- package/dist/revealui.d.ts.map +1 -0
- package/dist/revealui.js +92 -0
- package/dist/richtext/exports/client/rcc.d.ts +37 -0
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -0
- package/dist/richtext/exports/client/rcc.js +182 -0
- package/dist/richtext/exports/server/rsc.d.ts +134 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -0
- package/dist/richtext/exports/server/rsc.js +344 -0
- package/dist/richtext/index.d.ts +161 -0
- package/dist/richtext/index.d.ts.map +1 -0
- package/dist/richtext/index.js +243 -0
- package/dist/richtext/lexical.d.ts +23 -0
- package/dist/richtext/lexical.d.ts.map +1 -0
- package/dist/richtext/lexical.js +35 -0
- package/dist/security/index.d.ts +6 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +5 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/server/renderPage.d.ts +69 -0
- package/dist/server/renderPage.d.ts.map +1 -0
- package/dist/server/renderPage.js +109 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/vercel-blob.d.ts +17 -0
- package/dist/storage/vercel-blob.d.ts.map +1 -0
- package/dist/storage/vercel-blob.js +86 -0
- package/dist/translations/index.d.ts +17 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +1 -0
- package/dist/types/access.d.ts +67 -0
- package/dist/types/access.d.ts.map +1 -0
- package/dist/types/access.js +8 -0
- package/dist/types/api.d.ts +57 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +8 -0
- package/dist/types/cms.d.ts +8 -0
- package/dist/types/cms.d.ts.map +1 -0
- package/dist/types/cms.js +6 -0
- package/dist/types/config.d.ts +152 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +9 -0
- package/dist/types/core.d.ts +11 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +9 -0
- package/dist/types/extensions.d.ts +116 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/extensions.js +8 -0
- package/dist/types/frontend.d.ts +53 -0
- package/dist/types/frontend.d.ts.map +1 -0
- package/dist/types/frontend.js +7 -0
- package/dist/types/generated.d.ts +12 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/generated.js +10 -0
- package/dist/types/hooks.d.ts +53 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/hooks.js +8 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +61 -0
- package/dist/types/interfaces/app.d.ts +50 -0
- package/dist/types/interfaces/app.d.ts.map +1 -0
- package/dist/types/interfaces/app.js +5 -0
- package/dist/types/jobs.d.ts +112 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/jobs.js +7 -0
- package/dist/types/legacy.d.ts +147 -0
- package/dist/types/legacy.d.ts.map +1 -0
- package/dist/types/legacy.js +8 -0
- package/dist/types/plugins.d.ts +17 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/plugins.js +8 -0
- package/dist/types/query.d.ts +99 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +24 -0
- package/dist/types/request.d.ts +40 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/types/request.js +8 -0
- package/dist/types/richtext.d.ts +23 -0
- package/dist/types/richtext.d.ts.map +1 -0
- package/dist/types/richtext.js +8 -0
- package/dist/types/runtime.d.ts +275 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +9 -0
- package/dist/types/schema.d.ts +9 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +7 -0
- package/dist/types/user.d.ts +48 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +8 -0
- package/dist/utils/access-conversion.d.ts +17 -0
- package/dist/utils/access-conversion.d.ts.map +1 -0
- package/dist/utils/access-conversion.js +96 -0
- package/dist/utils/api-wrapper.d.ts +63 -0
- package/dist/utils/api-wrapper.d.ts.map +1 -0
- package/dist/utils/api-wrapper.js +151 -0
- package/dist/utils/block-conversion.d.ts +21 -0
- package/dist/utils/block-conversion.d.ts.map +1 -0
- package/dist/utils/block-conversion.js +109 -0
- package/dist/utils/cache.d.ts +86 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +154 -0
- package/dist/utils/deep-clone.d.ts +25 -0
- package/dist/utils/deep-clone.d.ts.map +1 -0
- package/dist/utils/deep-clone.js +114 -0
- package/dist/utils/error-responses.d.ts +57 -0
- package/dist/utils/error-responses.d.ts.map +1 -0
- package/dist/utils/error-responses.js +95 -0
- package/dist/utils/errors.d.ts +133 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +500 -0
- package/dist/utils/field-conversion.d.ts +40 -0
- package/dist/utils/field-conversion.d.ts.map +1 -0
- package/dist/utils/field-conversion.js +275 -0
- package/dist/utils/flattenResult.d.ts +7 -0
- package/dist/utils/flattenResult.d.ts.map +1 -0
- package/dist/utils/flattenResult.js +22 -0
- package/dist/utils/getBlockSelect.d.ts +12 -0
- package/dist/utils/getBlockSelect.d.ts.map +1 -0
- package/dist/utils/getBlockSelect.js +12 -0
- package/dist/utils/getSelectMode.d.ts +8 -0
- package/dist/utils/getSelectMode.d.ts.map +1 -0
- package/dist/utils/getSelectMode.js +21 -0
- package/dist/utils/isValidID.d.ts +5 -0
- package/dist/utils/isValidID.d.ts.map +1 -0
- package/dist/utils/isValidID.js +13 -0
- package/dist/utils/json-parsing.d.ts +48 -0
- package/dist/utils/json-parsing.d.ts.map +1 -0
- package/dist/utils/json-parsing.js +130 -0
- package/dist/utils/logger-client.d.ts +32 -0
- package/dist/utils/logger-client.d.ts.map +1 -0
- package/dist/utils/logger-client.js +55 -0
- package/dist/utils/logger-server.d.ts +32 -0
- package/dist/utils/logger-server.d.ts.map +1 -0
- package/dist/utils/logger-server.js +68 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/request-context.d.ts +143 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +168 -0
- package/dist/utils/stripUnselectedFields.d.ts +10 -0
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -0
- package/dist/utils/stripUnselectedFields.js +20 -0
- package/dist/utils/type-guards.d.ts +33 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +63 -0
- package/dist/utils/user.d.ts +14 -0
- package/dist/utils/user.d.ts.map +1 -0
- package/dist/utils/user.js +15 -0
- package/package.json +302 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
function getFieldLabel(field) {
|
|
4
|
+
const { label } = field;
|
|
5
|
+
if (typeof label === 'function') {
|
|
6
|
+
return label({ t: (key) => key });
|
|
7
|
+
}
|
|
8
|
+
if (typeof label === 'string') {
|
|
9
|
+
return label;
|
|
10
|
+
}
|
|
11
|
+
return typeof field.name === 'string' ? field.name : 'Field';
|
|
12
|
+
}
|
|
13
|
+
function formatTextValue(value) {
|
|
14
|
+
if (value === null || value === undefined)
|
|
15
|
+
return '';
|
|
16
|
+
if (typeof value === 'string')
|
|
17
|
+
return value;
|
|
18
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
19
|
+
return String(value);
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === 'symbol')
|
|
22
|
+
return value.description ?? value.toString();
|
|
23
|
+
if (typeof value === 'function')
|
|
24
|
+
return value.name || 'function';
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
}
|
|
27
|
+
function formatDateValue(value) {
|
|
28
|
+
if (value instanceof Date)
|
|
29
|
+
return value.toLocaleDateString();
|
|
30
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
31
|
+
const parsed = new Date(value);
|
|
32
|
+
return Number.isNaN(parsed.getTime()) ? '' : parsed.toLocaleDateString();
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
export function CollectionList({ collection, documents, totalDocs, page, totalPages, onCreate, onEdit, onDelete, onPageChange, deleting, }) {
|
|
37
|
+
// Filter to only include fields with names (exclude layout fields) that are visible
|
|
38
|
+
const displayFields = collection.fields
|
|
39
|
+
.filter((field) => {
|
|
40
|
+
return field.name && field.admin?.position !== 'sidebar' && !field.admin?.hidden;
|
|
41
|
+
})
|
|
42
|
+
.slice(0, 5); // Show first 5 visible fields
|
|
43
|
+
return (_jsxs("div", { className: "bg-white shadow overflow-hidden sm:rounded-md", children: [_jsxs("div", { className: "px-4 py-5 sm:px-6 flex justify-between items-center", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-lg leading-6 font-medium text-gray-900 capitalize", children: collection.slug }), _jsxs("p", { className: "mt-1 max-w-2xl text-sm text-gray-500", children: [totalDocs, " ", totalDocs === 1 ? 'document' : 'documents'] })] }), _jsxs("button", { type: "button", onClick: onCreate, className: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", children: [_jsxs("svg", { className: "-ml-1 mr-2 h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", role: "img", focusable: "false", children: [_jsx("title", { children: "Create New" }), _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" })] }), "Create New"] })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [_jsx("thead", { className: "bg-gray-50", children: _jsxs("tr", { children: [displayFields.map((field) => (_jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: getFieldLabel(field) }, field.name))), _jsx("th", { scope: "col", className: "relative px-6 py-3", children: _jsx("span", { className: "sr-only", children: "Actions" }) })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: documents.length === 0 ? (_jsx("tr", { children: _jsxs("td", { colSpan: displayFields.length + 1, className: "px-6 py-4 text-center text-sm text-gray-500", children: ["No documents found.", ' ', _jsx("button", { type: "button", onClick: onCreate, className: "text-indigo-600 hover:text-indigo-500", children: "Create the first one" }), "."] }) })) : (documents.map((doc) => (_jsxs("tr", { className: "hover:bg-gray-50", children: [displayFields.map((field) => (_jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-900", children: renderFieldValue(field.name ? doc[field.name] : undefined, field) }, field.name))), _jsxs("td", { className: "px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-2", children: [_jsx("button", { type: "button", onClick: () => onEdit(doc), className: "text-indigo-600 hover:text-indigo-900 disabled:opacity-50 disabled:cursor-not-allowed", disabled: deleting !== null, children: "Edit" }), _jsx("button", { type: "button", onClick: () => onDelete(doc), className: "text-red-600 hover:text-red-900 disabled:opacity-50 disabled:cursor-not-allowed", disabled: deleting !== null, children: deleting === doc.id ? 'Deleting...' : 'Delete' })] })] }, doc.id)))) })] }) }), totalPages > 1 && (_jsxs("div", { className: "bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6", children: [_jsxs("div", { className: "flex-1 flex justify-between sm:hidden", children: [_jsx("button", { type: "button", onClick: () => onPageChange(page - 1), disabled: page <= 1, className: "relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed", children: "Previous" }), _jsx("button", { type: "button", onClick: () => onPageChange(page + 1), disabled: page >= totalPages, className: "ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed", children: "Next" })] }), _jsxs("div", { className: "hidden sm:flex-1 sm:flex sm:items-center sm:justify-between", children: [_jsx("div", { children: _jsxs("p", { className: "text-sm text-gray-700", children: ["Showing page ", _jsx("span", { className: "font-medium", children: page }), " of", ' ', _jsx("span", { className: "font-medium", children: totalPages })] }) }), _jsx("div", { children: _jsxs("nav", { className: "relative z-0 inline-flex rounded-md shadow-sm -space-x-px", children: [_jsx("button", { type: "button", onClick: () => onPageChange(page - 1), disabled: page <= 1, className: "relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed", children: "Previous" }), _jsx("button", { type: "button", onClick: () => onPageChange(page + 1), disabled: page >= totalPages, className: "relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed", children: "Next" })] }) })] })] }))] }));
|
|
44
|
+
}
|
|
45
|
+
function renderFieldValue(value, field) {
|
|
46
|
+
if (value === null || value === undefined) {
|
|
47
|
+
return _jsx("span", { className: "text-gray-400", children: "-" });
|
|
48
|
+
}
|
|
49
|
+
switch (field.type) {
|
|
50
|
+
case 'text':
|
|
51
|
+
case 'textarea':
|
|
52
|
+
return formatTextValue(value);
|
|
53
|
+
case 'number':
|
|
54
|
+
return Number(value);
|
|
55
|
+
case 'checkbox':
|
|
56
|
+
return value ? '✓' : '✗';
|
|
57
|
+
case 'date':
|
|
58
|
+
return formatDateValue(value);
|
|
59
|
+
case 'select':
|
|
60
|
+
return formatTextValue(value);
|
|
61
|
+
default:
|
|
62
|
+
if (typeof value === 'object') {
|
|
63
|
+
return JSON.stringify(value);
|
|
64
|
+
}
|
|
65
|
+
return formatTextValue(value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RevealCollectionConfig, RevealDocument } from '../../../types/index.js';
|
|
2
|
+
interface DocumentFormProps {
|
|
3
|
+
collection: RevealCollectionConfig;
|
|
4
|
+
document?: RevealDocument;
|
|
5
|
+
onSave: (data: Record<string, unknown>) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function DocumentForm({ collection, document, onSave, onCancel, isLoading, }: DocumentFormProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DocumentForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentForm.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/components/DocumentForm.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAiEjC,UAAU,iBAAiB;IACzB,UAAU,EAAE,sBAAsB,CAAC;IACnC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAiB,GAClB,EAAE,iBAAiB,2CA0DnB"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { lazy, Suspense, useCallback, useState } from 'react';
|
|
4
|
+
// Lazy-loaded so Lexical (~1.2MB) is only bundled for edit pages with richText
|
|
5
|
+
// fields — list/dashboard pages skip the entire Lexical chunk.
|
|
6
|
+
const RichTextEditor = lazy(() => import('../../richtext/RichTextEditor.js').then((m) => ({ default: m.RichTextEditor })));
|
|
7
|
+
function getFieldLabel(field) {
|
|
8
|
+
const { label } = field;
|
|
9
|
+
if (typeof label === 'function') {
|
|
10
|
+
return label({ t: (key) => key });
|
|
11
|
+
}
|
|
12
|
+
if (typeof label === 'string') {
|
|
13
|
+
return label;
|
|
14
|
+
}
|
|
15
|
+
return typeof field.name === 'string' ? field.name : 'Field';
|
|
16
|
+
}
|
|
17
|
+
function formatTextValue(value) {
|
|
18
|
+
if (value === null || value === undefined)
|
|
19
|
+
return '';
|
|
20
|
+
if (typeof value === 'string')
|
|
21
|
+
return value;
|
|
22
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
if (typeof value === 'symbol')
|
|
26
|
+
return value.description ?? value.toString();
|
|
27
|
+
if (typeof value === 'function')
|
|
28
|
+
return value.name || 'function';
|
|
29
|
+
return JSON.stringify(value);
|
|
30
|
+
}
|
|
31
|
+
function formatDateInputValue(value) {
|
|
32
|
+
if (value instanceof Date) {
|
|
33
|
+
return value.toISOString().slice(0, 16);
|
|
34
|
+
}
|
|
35
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
36
|
+
const parsed = new Date(value);
|
|
37
|
+
return Number.isNaN(parsed.getTime()) ? '' : parsed.toISOString().slice(0, 16);
|
|
38
|
+
}
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
// Flatten tabs/rows and skip sidebar/hidden/disabled fields
|
|
42
|
+
function getVisibleFields(fields) {
|
|
43
|
+
const result = [];
|
|
44
|
+
for (const field of fields) {
|
|
45
|
+
if (field.admin?.position === 'sidebar' || field.admin?.hidden || field.admin?.disabled) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const anyField = field;
|
|
49
|
+
if (field.type === 'tabs' && Array.isArray(anyField.tabs)) {
|
|
50
|
+
for (const tab of anyField.tabs) {
|
|
51
|
+
result.push(...getVisibleFields(tab.fields ?? []));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (field.type === 'row' && Array.isArray(anyField.fields)) {
|
|
55
|
+
result.push(...getVisibleFields(anyField.fields));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
result.push(field);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
export function DocumentForm({ collection, document, onSave, onCancel, isLoading = false, }) {
|
|
64
|
+
const [formData, setFormData] = useState(document || {});
|
|
65
|
+
const visibleFields = getVisibleFields(collection.fields);
|
|
66
|
+
const handleSubmit = (e) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
onSave(formData);
|
|
69
|
+
};
|
|
70
|
+
const handleFieldChange = (fieldName, value) => {
|
|
71
|
+
setFormData((prev) => ({ ...prev, [fieldName]: value }));
|
|
72
|
+
};
|
|
73
|
+
return (_jsx("div", { className: "bg-white shadow overflow-hidden sm:rounded-lg", children: _jsxs("div", { className: "px-4 py-5 sm:p-6", children: [_jsxs("h3", { className: "text-lg leading-6 font-medium text-gray-900 mb-4", children: [document ? 'Edit' : 'Create', " ", collection.slug.slice(0, -1)] }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [visibleFields.map((field) => (_jsxs("div", { children: [_jsxs("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: [getFieldLabel(field), field.required && _jsx("span", { className: "text-red-500 ml-1", children: "*" })] }), _jsx("div", { className: "mt-1", children: _jsx(FieldInput, { field: field, value: field.name ? formData[field.name] : undefined, onChange: (value) => field.name && handleFieldChange(field.name, value) }) })] }, field.name || 'layout'))), _jsxs("div", { className: "flex justify-end space-x-3 pt-6", children: [_jsx("button", { type: "button", onClick: onCancel, className: "bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", children: "Cancel" }), _jsx("button", { type: "submit", disabled: isLoading, className: "inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed", children: isLoading ? 'Saving...' : 'Save' })] })] })] }) }));
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Array field: repeatable list of sub-fields
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
function ArrayFieldRenderer({ field, value, onChange, }) {
|
|
79
|
+
const rows = Array.isArray(value) ? value : [];
|
|
80
|
+
const subFields = field.fields ?? [];
|
|
81
|
+
const addRow = () => onChange([...rows, {}]);
|
|
82
|
+
const removeRow = (idx) => onChange(rows.filter((_, i) => i !== idx));
|
|
83
|
+
const updateRow = (idx, key, val) => {
|
|
84
|
+
const updated = rows.map((row, i) => (i === idx ? { ...row, [key]: val } : row));
|
|
85
|
+
onChange(updated);
|
|
86
|
+
};
|
|
87
|
+
return (_jsxs("div", { className: "space-y-3", children: [rows.map((row, idx) => (_jsxs("div", { className: "border border-gray-200 rounded-md p-3 space-y-2 relative", children: [_jsx("button", { type: "button", onClick: () => removeRow(idx), className: "absolute top-2 right-2 text-red-400 hover:text-red-600 text-sm", children: "Remove" }), subFields.map((sf) => (_jsxs("div", { children: [_jsx("label", { htmlFor: `${field.name}-${idx}-${sf.name}`, className: "block text-xs font-medium text-gray-600", children: getFieldLabel(sf) }), _jsx(FieldInput, { field: sf, value: row[sf.name ?? ''], onChange: (v) => updateRow(idx, sf.name ?? '', v) })] }, sf.name)))] }, `${field.name}-row-${idx.toString()}`))), _jsx("button", { type: "button", onClick: addRow, className: "text-sm text-indigo-600 hover:text-indigo-800 font-medium", children: "+ Add item" })] }));
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Group field: named group of sub-fields (single object, not repeatable)
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
function GroupFieldRenderer({ field, value, onChange, }) {
|
|
93
|
+
const data = (typeof value === 'object' && value !== null ? value : {});
|
|
94
|
+
const subFields = field.fields ?? [];
|
|
95
|
+
const handleChange = (key, val) => {
|
|
96
|
+
onChange({ ...data, [key]: val });
|
|
97
|
+
};
|
|
98
|
+
return (_jsx("div", { className: "border border-gray-200 rounded-md p-3 space-y-3", children: subFields.map((sf) => (_jsxs("div", { children: [_jsxs("label", { htmlFor: `${field.name}-${sf.name}`, className: "block text-xs font-medium text-gray-600", children: [getFieldLabel(sf), sf.required && _jsx("span", { className: "text-red-500 ml-1", children: "*" })] }), _jsx(FieldInput, { field: sf, value: data[sf.name ?? ''], onChange: (v) => handleChange(sf.name ?? '', v) })] }, sf.name))) }));
|
|
99
|
+
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Blocks field: polymorphic list of typed blocks
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
function BlocksFieldRenderer({ field, value, onChange, }) {
|
|
104
|
+
const blocks = Array.isArray(value) ? value : [];
|
|
105
|
+
const blockTypes = field.blocks ??
|
|
106
|
+
[];
|
|
107
|
+
const addBlock = (slug) => {
|
|
108
|
+
onChange([...blocks, { blockType: slug }]);
|
|
109
|
+
};
|
|
110
|
+
const removeBlock = (idx) => onChange(blocks.filter((_, i) => i !== idx));
|
|
111
|
+
const updateBlock = (idx, key, val) => {
|
|
112
|
+
const updated = blocks.map((b, i) => (i === idx ? { ...b, [key]: val } : b));
|
|
113
|
+
onChange(updated);
|
|
114
|
+
};
|
|
115
|
+
return (_jsxs("div", { className: "space-y-3", children: [blocks.map((block, idx) => {
|
|
116
|
+
const blockDef = blockTypes.find((bt) => bt.slug === block.blockType);
|
|
117
|
+
return (_jsxs("div", { className: "border border-gray-200 rounded-md p-3 space-y-2 relative", children: [_jsxs("div", { className: "flex items-center justify-between mb-1", children: [_jsx("span", { className: "text-xs font-semibold text-gray-500 uppercase", children: String(block.blockType) }), _jsx("button", { type: "button", onClick: () => removeBlock(idx), className: "text-red-400 hover:text-red-600 text-sm", children: "Remove" })] }), (blockDef?.fields ?? []).map((sf) => (_jsxs("div", { children: [_jsx("label", { htmlFor: `${field.name}-${idx}-${sf.name}`, className: "block text-xs font-medium text-gray-600", children: getFieldLabel(sf) }), _jsx(FieldInput, { field: sf, value: block[sf.name ?? ''], onChange: (v) => updateBlock(idx, sf.name ?? '', v) })] }, sf.name)))] }, `${field.name}-block-${idx.toString()}`));
|
|
118
|
+
}), blockTypes.length > 0 && (_jsx("div", { className: "flex gap-2 flex-wrap", children: blockTypes.map((bt) => (_jsxs("button", { type: "button", onClick: () => addBlock(bt.slug), className: "text-sm text-indigo-600 hover:text-indigo-800 font-medium", children: ["+ ", bt.slug] }, bt.slug))) }))] }));
|
|
119
|
+
}
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Collapsible field: expandable section of sub-fields
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
function CollapsibleFieldRenderer({ field, value, onChange, }) {
|
|
124
|
+
const [open, setOpen] = useState(true);
|
|
125
|
+
const data = (typeof value === 'object' && value !== null ? value : {});
|
|
126
|
+
const subFields = field.fields ?? [];
|
|
127
|
+
const handleChange = (key, val) => {
|
|
128
|
+
onChange({ ...data, [key]: val });
|
|
129
|
+
};
|
|
130
|
+
return (_jsxs("div", { className: "border border-gray-200 rounded-md", children: [_jsxs("button", { type: "button", onClick: () => setOpen(!open), className: "w-full text-left px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 flex items-center justify-between", children: [getFieldLabel(field), _jsx("span", { className: "text-gray-400", children: open ? '\u25B2' : '\u25BC' })] }), open && (_jsx("div", { className: "px-3 pb-3 space-y-3", children: subFields.map((sf) => (_jsxs("div", { children: [_jsx("label", { htmlFor: `${field.name}-${sf.name}`, className: "block text-xs font-medium text-gray-600", children: getFieldLabel(sf) }), _jsx(FieldInput, { field: sf, value: data[sf.name ?? ''], onChange: (v) => handleChange(sf.name ?? '', v) })] }, sf.name))) }))] }));
|
|
131
|
+
}
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
// JSON field: raw JSON editor with syntax-highlighted textarea
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
function JsonFieldRenderer({ field, value, onChange, }) {
|
|
136
|
+
const [error, setError] = useState(null);
|
|
137
|
+
const formatted = typeof value === 'string' ? value : value != null ? JSON.stringify(value, null, 2) : '';
|
|
138
|
+
const handleChange = useCallback((e) => {
|
|
139
|
+
const raw = e.target.value;
|
|
140
|
+
try {
|
|
141
|
+
const parsed = JSON.parse(raw);
|
|
142
|
+
setError(null);
|
|
143
|
+
onChange(parsed);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
setError('Invalid JSON');
|
|
147
|
+
onChange(raw);
|
|
148
|
+
}
|
|
149
|
+
}, [onChange]);
|
|
150
|
+
return (_jsxs("div", { children: [_jsx("textarea", { id: field.name, value: formatted, onChange: handleChange, rows: 8, className: "mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm font-mono text-xs", spellCheck: false }), error && _jsx("p", { className: "mt-1 text-xs text-red-500", children: error })] }));
|
|
151
|
+
}
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// Point field: latitude/longitude pair
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
function PointFieldRenderer({ field, value, onChange, }) {
|
|
156
|
+
const point = (typeof value === 'object' && value !== null ? value : { lat: 0, lng: 0 });
|
|
157
|
+
const baseClasses = 'mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm';
|
|
158
|
+
return (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: `${field.name}-lat`, className: "block text-xs font-medium text-gray-600", children: "Latitude" }), _jsx("input", { type: "number", id: `${field.name}-lat`, value: point.lat, onChange: (e) => onChange({ ...point, lat: Number(e.target.value) }), className: baseClasses, step: "any", min: -90, max: 90 })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: `${field.name}-lng`, className: "block text-xs font-medium text-gray-600", children: "Longitude" }), _jsx("input", { type: "number", id: `${field.name}-lng`, value: point.lng, onChange: (e) => onChange({ ...point, lng: Number(e.target.value) }), className: baseClasses, step: "any", min: -180, max: 180 })] })] }));
|
|
159
|
+
}
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// Main FieldInput — renders the appropriate control for each field type
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
function FieldInput({ field, value, onChange }) {
|
|
164
|
+
const baseClasses = 'mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm';
|
|
165
|
+
switch (field.type) {
|
|
166
|
+
case 'text':
|
|
167
|
+
return (_jsx("input", { type: "text", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required }));
|
|
168
|
+
case 'email':
|
|
169
|
+
return (_jsx("input", { type: "email", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required, placeholder: field.admin?.placeholder }));
|
|
170
|
+
case 'password':
|
|
171
|
+
return (_jsx("input", { type: "password", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required, autoComplete: "new-password" }));
|
|
172
|
+
case 'code':
|
|
173
|
+
return (_jsx("textarea", { id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), rows: 8, className: `${baseClasses} font-mono text-xs`, required: field.required, spellCheck: false }));
|
|
174
|
+
case 'textarea':
|
|
175
|
+
return (_jsx("textarea", { id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), rows: 4, className: baseClasses, required: field.required }));
|
|
176
|
+
case 'number':
|
|
177
|
+
return (_jsx("input", { type: "number", id: field.name, value: typeof value === 'number' ? value : value ? Number(value) : '', onChange: (e) => onChange(Number(e.target.value) || undefined), className: baseClasses, required: field.required, min: field.min, max: field.max }));
|
|
178
|
+
case 'checkbox':
|
|
179
|
+
return (_jsx("input", { type: "checkbox", id: field.name, checked: Boolean(value), onChange: (e) => onChange(e.target.checked), className: "h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" }));
|
|
180
|
+
case 'select':
|
|
181
|
+
return (_jsxs("select", { id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required, children: [_jsx("option", { value: "", children: "Select an option" }), field.options?.map((option) => {
|
|
182
|
+
const optValue = typeof option === 'string' ? option : option.value;
|
|
183
|
+
const optLabel = typeof option === 'string' ? option : option.label;
|
|
184
|
+
return (_jsx("option", { value: optValue, children: optLabel }, optValue));
|
|
185
|
+
})] }));
|
|
186
|
+
case 'radio':
|
|
187
|
+
return (_jsx("div", { className: "space-y-2 mt-1", children: field.options?.map((option) => {
|
|
188
|
+
const optValue = typeof option === 'string' ? option : option.value;
|
|
189
|
+
const optLabel = typeof option === 'string' ? option : option.label;
|
|
190
|
+
return (_jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-700 cursor-pointer", children: [_jsx("input", { type: "radio", name: field.name, value: optValue, checked: formatTextValue(value) === optValue, onChange: () => onChange(optValue), className: "h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300" }), optLabel] }, optValue));
|
|
191
|
+
}) }));
|
|
192
|
+
case 'relationship':
|
|
193
|
+
return (_jsxs("div", { children: [_jsx("input", { type: "text", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required, placeholder: `Enter ${field.relationTo ?? 'related'} ID` }), _jsxs("p", { className: "mt-1 text-xs text-gray-400", children: ["Related to: ", field.relationTo ?? 'unknown'] })] }));
|
|
194
|
+
case 'upload':
|
|
195
|
+
return (_jsxs("div", { children: [_jsx("input", { type: "file", id: field.name, onChange: (e) => {
|
|
196
|
+
const file = e.target.files?.[0];
|
|
197
|
+
if (file)
|
|
198
|
+
onChange(file);
|
|
199
|
+
}, className: "block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-medium file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100" }), typeof value === 'string' && value !== '' && (_jsxs("p", { className: "mt-1 text-xs text-gray-500", children: ["Current: ", value] }))] }));
|
|
200
|
+
case 'date':
|
|
201
|
+
return (_jsx("input", { type: "datetime-local", id: field.name, value: formatDateInputValue(value), onChange: (e) => onChange(e.target.value ? new Date(e.target.value) : null), className: baseClasses, required: field.required }));
|
|
202
|
+
case 'richText': {
|
|
203
|
+
const editorConfig = field.editor;
|
|
204
|
+
return (_jsx(Suspense, { fallback: _jsx("div", { className: "border border-gray-300 rounded-md h-40 flex items-center justify-center text-sm text-gray-400", children: "Loading editor\u2026" }), children: _jsx(RichTextEditor, { namespace: String(field.name), editorConfig: editorConfig, initialValue: value, onSerializedChange: (json) => onChange(json), className: "border border-gray-300 rounded-md" }) }));
|
|
205
|
+
}
|
|
206
|
+
case 'array':
|
|
207
|
+
return _jsx(ArrayFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
208
|
+
case 'group':
|
|
209
|
+
return _jsx(GroupFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
210
|
+
case 'blocks':
|
|
211
|
+
return _jsx(BlocksFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
212
|
+
case 'collapsible':
|
|
213
|
+
return _jsx(CollapsibleFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
214
|
+
case 'json':
|
|
215
|
+
return _jsx(JsonFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
216
|
+
case 'point':
|
|
217
|
+
return _jsx(PointFieldRenderer, { field: field, value: value, onChange: onChange });
|
|
218
|
+
case 'ui':
|
|
219
|
+
return (_jsxs("div", { className: "border border-dashed border-gray-300 rounded-md p-3 text-sm text-gray-400 text-center", children: ["Custom UI field: ", field.name] }));
|
|
220
|
+
default:
|
|
221
|
+
return (_jsx("input", { type: "text", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required }));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RevealDocument, RevealGlobalConfig } from '../../../types/index.js';
|
|
2
|
+
interface GlobalFormProps {
|
|
3
|
+
global: RevealGlobalConfig;
|
|
4
|
+
document?: RevealDocument;
|
|
5
|
+
onSave: (data: Record<string, unknown>) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function GlobalForm({ global, document, onSave, onCancel, isLoading, }: GlobalFormProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=GlobalForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlobalForm.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/components/GlobalForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAiB,MAAM,yBAAyB,CAAC;AAsCjG,UAAU,eAAe;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAiB,GAClB,EAAE,eAAe,2CA4DjB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
function getFieldLabel(field) {
|
|
5
|
+
const { label } = field;
|
|
6
|
+
if (typeof label === 'function') {
|
|
7
|
+
return label({ t: (key) => key });
|
|
8
|
+
}
|
|
9
|
+
if (typeof label === 'string') {
|
|
10
|
+
return label;
|
|
11
|
+
}
|
|
12
|
+
return typeof field.name === 'string' ? field.name : 'Field';
|
|
13
|
+
}
|
|
14
|
+
function formatTextValue(value) {
|
|
15
|
+
if (value === null || value === undefined)
|
|
16
|
+
return '';
|
|
17
|
+
if (typeof value === 'string')
|
|
18
|
+
return value;
|
|
19
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
if (typeof value === 'symbol')
|
|
23
|
+
return value.description ?? value.toString();
|
|
24
|
+
if (typeof value === 'function')
|
|
25
|
+
return value.name || 'function';
|
|
26
|
+
return JSON.stringify(value);
|
|
27
|
+
}
|
|
28
|
+
function formatDateInputValue(value) {
|
|
29
|
+
if (value instanceof Date) {
|
|
30
|
+
return value.toISOString().slice(0, 16);
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
33
|
+
const parsed = new Date(value);
|
|
34
|
+
return Number.isNaN(parsed.getTime()) ? '' : parsed.toISOString().slice(0, 16);
|
|
35
|
+
}
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
export function GlobalForm({ global, document, onSave, onCancel, isLoading = false, }) {
|
|
39
|
+
const [formData, setFormData] = useState(document || {});
|
|
40
|
+
const visibleFields = global.fields.filter((field) => {
|
|
41
|
+
return field.admin?.position !== 'sidebar' && !field.admin?.hidden;
|
|
42
|
+
});
|
|
43
|
+
const handleSubmit = (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
onSave(formData);
|
|
46
|
+
};
|
|
47
|
+
const handleFieldChange = (fieldName, value) => {
|
|
48
|
+
setFormData((prev) => ({ ...prev, [fieldName]: value }));
|
|
49
|
+
};
|
|
50
|
+
return (_jsx("div", { className: "bg-white shadow overflow-hidden sm:rounded-lg", children: _jsxs("div", { className: "px-4 py-5 sm:p-6", children: [_jsxs("h3", { className: "text-lg leading-6 font-medium text-gray-900 mb-4", children: ["Edit ", global.label || global.slug] }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [visibleFields.map((field) => (_jsxs("div", { children: [_jsxs("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: [getFieldLabel(field), field.required && _jsx("span", { className: "text-red-500 ml-1", children: "*" })] }), _jsx("div", { className: "mt-1", children: _jsx(FieldInput, { field: field, value: field.name ? formData[field.name] : undefined, onChange: (value) => field.name && handleFieldChange(field.name, value) }) })] }, field.name || 'layout'))), _jsxs("div", { className: "flex justify-end space-x-3 pt-6", children: [_jsx("button", { type: "button", onClick: onCancel, className: "bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", children: "Cancel" }), _jsx("button", { type: "submit", disabled: isLoading, className: "inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed", children: isLoading ? 'Saving...' : 'Save' })] })] })] }) }));
|
|
51
|
+
}
|
|
52
|
+
function FieldInput({ field, value, onChange }) {
|
|
53
|
+
const baseClasses = 'mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm';
|
|
54
|
+
switch (field.type) {
|
|
55
|
+
case 'text':
|
|
56
|
+
return (_jsx("input", { type: "text", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required }));
|
|
57
|
+
case 'textarea':
|
|
58
|
+
return (_jsx("textarea", { id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), rows: 4, className: baseClasses, required: field.required }));
|
|
59
|
+
case 'number':
|
|
60
|
+
return (_jsx("input", { type: "number", id: field.name, value: typeof value === 'number' ? value : value ? Number(value) : '', onChange: (e) => onChange(Number(e.target.value) || undefined), className: baseClasses, required: field.required, min: field.min, max: field.max }));
|
|
61
|
+
case 'checkbox':
|
|
62
|
+
return (_jsx("input", { type: "checkbox", id: field.name, checked: Boolean(value), onChange: (e) => onChange(e.target.checked), className: "h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" }));
|
|
63
|
+
case 'select':
|
|
64
|
+
return (_jsxs("select", { id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required, children: [_jsx("option", { value: "", children: "Select an option" }), field.options?.map((option) => {
|
|
65
|
+
const value = typeof option === 'string' ? option : option.value;
|
|
66
|
+
const label = typeof option === 'string' ? option : option.label;
|
|
67
|
+
return (_jsx("option", { value: value, children: label }, value));
|
|
68
|
+
})] }));
|
|
69
|
+
case 'date':
|
|
70
|
+
return (_jsx("input", { type: "datetime-local", id: field.name, value: formatDateInputValue(value), onChange: (e) => onChange(e.target.value ? new Date(e.target.value) : null), className: baseClasses, required: field.required }));
|
|
71
|
+
default:
|
|
72
|
+
return (_jsx("input", { type: "text", id: field.name, value: formatTextValue(value), onChange: (e) => onChange(e.target.value), className: baseClasses, required: field.required }));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ServerFunction = (name: string, args: unknown) => Promise<unknown>;
|
|
2
|
+
export declare function ServerFunctionProvider({ children, serverFunction, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
serverFunction?: ServerFunction;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useServerFunction(): ServerFunction;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ServerFunctionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerFunctionContext.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/context/ServerFunctionContext.tsx"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAIxE,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,2CAEA;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CASlD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
const ServerFunctionContext = createContext(null);
|
|
5
|
+
export function ServerFunctionProvider({ children, serverFunction, }) {
|
|
6
|
+
return _jsx(ServerFunctionContext, { value: serverFunction ?? null, children: children });
|
|
7
|
+
}
|
|
8
|
+
export function useServerFunction() {
|
|
9
|
+
const fn = useContext(ServerFunctionContext);
|
|
10
|
+
if (!fn) {
|
|
11
|
+
throw new Error('useServerFunction must be used within a ServerFunctionProvider. ' +
|
|
12
|
+
'Pass serverFunction prop to RootLayout.');
|
|
13
|
+
}
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const en: {
|
|
2
|
+
general: {
|
|
3
|
+
loading: string;
|
|
4
|
+
save: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
delete: string;
|
|
7
|
+
edit: string;
|
|
8
|
+
create: string;
|
|
9
|
+
back: string;
|
|
10
|
+
};
|
|
11
|
+
fields: {
|
|
12
|
+
enterURL: string;
|
|
13
|
+
};
|
|
14
|
+
authentication: {
|
|
15
|
+
logIn: string;
|
|
16
|
+
logOut: string;
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
};
|
|
20
|
+
validation: {
|
|
21
|
+
required: string;
|
|
22
|
+
email: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/i18n/en.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAuBd,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Basic English translations for RevealUI admin
|
|
2
|
+
export const en = {
|
|
3
|
+
general: {
|
|
4
|
+
loading: 'Loading...',
|
|
5
|
+
save: 'Save',
|
|
6
|
+
cancel: 'Cancel',
|
|
7
|
+
delete: 'Delete',
|
|
8
|
+
edit: 'Edit',
|
|
9
|
+
create: 'Create',
|
|
10
|
+
back: 'Back',
|
|
11
|
+
},
|
|
12
|
+
fields: {
|
|
13
|
+
enterURL: 'Enter URL',
|
|
14
|
+
},
|
|
15
|
+
authentication: {
|
|
16
|
+
logIn: 'Log In',
|
|
17
|
+
logOut: 'Log Out',
|
|
18
|
+
email: 'Email',
|
|
19
|
+
password: 'Password',
|
|
20
|
+
},
|
|
21
|
+
validation: {
|
|
22
|
+
required: 'This field is required',
|
|
23
|
+
email: 'Please enter a valid email address',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AdminDashboard } from './components/AdminDashboard.js';
|
|
2
|
+
export { CollectionList } from './components/CollectionList.js';
|
|
3
|
+
export { DocumentForm } from './components/DocumentForm.js';
|
|
4
|
+
export { GlobalForm } from './components/GlobalForm.js';
|
|
5
|
+
export { ServerFunctionProvider, useServerFunction, } from './context/ServerFunctionContext.js';
|
|
6
|
+
export { en } from './i18n/en.js';
|
|
7
|
+
export { RootLayout } from './layout.js';
|
|
8
|
+
export { generatePageMetadata, NotFoundPage, RootPage } from './page.js';
|
|
9
|
+
export * from './utils/index.js';
|
|
10
|
+
export { serializeConfig } from './utils/serializeConfig.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/admin/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Re-export admin utilities
|
|
2
|
+
export { AdminDashboard } from './components/AdminDashboard.js';
|
|
3
|
+
export { CollectionList } from './components/CollectionList.js';
|
|
4
|
+
export { DocumentForm } from './components/DocumentForm.js';
|
|
5
|
+
export { GlobalForm } from './components/GlobalForm.js';
|
|
6
|
+
export { ServerFunctionProvider, useServerFunction, } from './context/ServerFunctionContext.js';
|
|
7
|
+
export { en } from './i18n/en.js';
|
|
8
|
+
export { RootLayout } from './layout.js';
|
|
9
|
+
export { generatePageMetadata, NotFoundPage, RootPage } from './page.js';
|
|
10
|
+
export * from './utils/index.js';
|
|
11
|
+
export { serializeConfig } from './utils/serializeConfig.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { Config } from '../../types/index.js';
|
|
3
|
+
export interface RootLayoutProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
config: Config;
|
|
6
|
+
importMap?: Record<string, unknown>;
|
|
7
|
+
serverFunction?: (name: string, args: unknown) => Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function RootLayout({ children, serverFunction }: RootLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/client/admin/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpE;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,eAAe,2CAiBvE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// RevealUI Admin Layout - Local implementation
|
|
3
|
+
import Head from 'next/head';
|
|
4
|
+
import { ServerFunctionProvider } from './context/ServerFunctionContext.js';
|
|
5
|
+
export function RootLayout({ children, serverFunction }) {
|
|
6
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs(Head, { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "RevealUI Admin" })] }), _jsx("body", { className: "antialiased", children: _jsx(ServerFunctionProvider, { serverFunction: serverFunction, children: _jsx("main", { id: "revealui-admin", className: "min-h-screen", children: children }) }) })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface Metadata {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface RootPageProps {
|
|
7
|
+
config: {
|
|
8
|
+
collections?: unknown[];
|
|
9
|
+
globals?: unknown[];
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
params: Promise<{
|
|
13
|
+
segments?: string[];
|
|
14
|
+
}>;
|
|
15
|
+
searchParams: Promise<{
|
|
16
|
+
[key: string]: string | string[];
|
|
17
|
+
}>;
|
|
18
|
+
importMap?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface NotFoundPageProps {
|
|
21
|
+
config: {
|
|
22
|
+
collections?: unknown[];
|
|
23
|
+
globals?: unknown[];
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
params: Promise<{
|
|
27
|
+
segments?: string[];
|
|
28
|
+
}>;
|
|
29
|
+
searchParams: Promise<{
|
|
30
|
+
[key: string]: string | string[];
|
|
31
|
+
}>;
|
|
32
|
+
importMap?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
export declare function RootPage({ config }: RootPageProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function NotFoundPage(): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function generatePageMetadata(): Metadata;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/client/admin/page.tsx"],"names":[],"mappings":"AACA,UAAU,QAAQ;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QACN,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,MAAM,EAAE,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzC,YAAY,EAAE,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QACN,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,MAAM,EAAE,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzC,YAAY,EAAE,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,aAAa,2CAoKjD;AAED,wBAAgB,YAAY,4CAO3B;AAED,wBAAgB,oBAAoB,IAAI,QAAQ,CAK/C"}
|