@pyric/ui 0.1.0-alpha.10
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 +216 -0
- package/README.md +79 -0
- package/dist/agents/ContextWindowUsage.d.ts +67 -0
- package/dist/agents/ContextWindowUsage.d.ts.map +1 -0
- package/dist/agents/ContextWindowUsage.js +115 -0
- package/dist/agents/ContextWindowUsage.js.map +1 -0
- package/dist/agents/EmptyState.d.ts +18 -0
- package/dist/agents/EmptyState.d.ts.map +1 -0
- package/dist/agents/EmptyState.js +11 -0
- package/dist/agents/EmptyState.js.map +1 -0
- package/dist/agents/Fold.d.ts +37 -0
- package/dist/agents/Fold.d.ts.map +1 -0
- package/dist/agents/Fold.js +18 -0
- package/dist/agents/Fold.js.map +1 -0
- package/dist/agents/Modal.d.ts +25 -0
- package/dist/agents/Modal.d.ts.map +1 -0
- package/dist/agents/Modal.js +28 -0
- package/dist/agents/Modal.js.map +1 -0
- package/dist/agents/PulsingDot.d.ts +21 -0
- package/dist/agents/PulsingDot.d.ts.map +1 -0
- package/dist/agents/PulsingDot.js +18 -0
- package/dist/agents/PulsingDot.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +15 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/auth/authApi.d.ts +32 -0
- package/dist/auth/authApi.d.ts.map +1 -0
- package/dist/auth/authApi.js +27 -0
- package/dist/auth/authApi.js.map +1 -0
- package/dist/auth/claims.d.ts +27 -0
- package/dist/auth/claims.d.ts.map +1 -0
- package/dist/auth/claims.js +58 -0
- package/dist/auth/claims.js.map +1 -0
- package/dist/auth/components/AuthProviderToggles.d.ts +31 -0
- package/dist/auth/components/AuthProviderToggles.d.ts.map +1 -0
- package/dist/auth/components/AuthProviderToggles.js +48 -0
- package/dist/auth/components/AuthProviderToggles.js.map +1 -0
- package/dist/auth/components/AuthSignInHelper.d.ts +57 -0
- package/dist/auth/components/AuthSignInHelper.d.ts.map +1 -0
- package/dist/auth/components/AuthSignInHelper.js +69 -0
- package/dist/auth/components/AuthSignInHelper.js.map +1 -0
- package/dist/auth/components/AuthUserForm.d.ts +84 -0
- package/dist/auth/components/AuthUserForm.d.ts.map +1 -0
- package/dist/auth/components/AuthUserForm.js +89 -0
- package/dist/auth/components/AuthUserForm.js.map +1 -0
- package/dist/auth/components/AuthUserList.d.ts +62 -0
- package/dist/auth/components/AuthUserList.d.ts.map +1 -0
- package/dist/auth/components/AuthUserList.js +46 -0
- package/dist/auth/components/AuthUserList.js.map +1 -0
- package/dist/auth/components/ClaimsField.d.ts +22 -0
- package/dist/auth/components/ClaimsField.d.ts.map +1 -0
- package/dist/auth/components/ClaimsField.js +11 -0
- package/dist/auth/components/ClaimsField.js.map +1 -0
- package/dist/auth/components/confirmActions.d.ts +40 -0
- package/dist/auth/components/confirmActions.d.ts.map +1 -0
- package/dist/auth/components/confirmActions.js +49 -0
- package/dist/auth/components/confirmActions.js.map +1 -0
- package/dist/auth/controller.d.ts +73 -0
- package/dist/auth/controller.d.ts.map +1 -0
- package/dist/auth/controller.js +139 -0
- package/dist/auth/controller.js.map +1 -0
- package/dist/auth/hooks/index.d.ts +7 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +7 -0
- package/dist/auth/hooks/index.js.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthFlowHelper.js +30 -0
- package/dist/auth/hooks/useAuthFlowHelper.js.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts +37 -0
- package/dist/auth/hooks/useAuthProviderConfig.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthProviderConfig.js +98 -0
- package/dist/auth/hooks/useAuthProviderConfig.js.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts +30 -0
- package/dist/auth/hooks/useAuthUserEditor.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUserEditor.js +27 -0
- package/dist/auth/hooks/useAuthUserEditor.js.map +1 -0
- package/dist/auth/hooks/useAuthUsers.d.ts +38 -0
- package/dist/auth/hooks/useAuthUsers.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthUsers.js +111 -0
- package/dist/auth/hooks/useAuthUsers.js.map +1 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/providers.d.ts +11 -0
- package/dist/auth/providers.d.ts.map +1 -0
- package/dist/auth/providers.js +28 -0
- package/dist/auth/providers.js.map +1 -0
- package/dist/auth/reducers/userEditor.d.ts +55 -0
- package/dist/auth/reducers/userEditor.d.ts.map +1 -0
- package/dist/auth/reducers/userEditor.js +136 -0
- package/dist/auth/reducers/userEditor.js.map +1 -0
- package/dist/events/components/ActivityActionItems.d.ts +45 -0
- package/dist/events/components/ActivityActionItems.d.ts.map +1 -0
- package/dist/events/components/ActivityActionItems.js +68 -0
- package/dist/events/components/ActivityActionItems.js.map +1 -0
- package/dist/events/components/ActivityGrid.d.ts +65 -0
- package/dist/events/components/ActivityGrid.d.ts.map +1 -0
- package/dist/events/components/ActivityGrid.js +61 -0
- package/dist/events/components/ActivityGrid.js.map +1 -0
- package/dist/events/components/ActivityGridRow.d.ts +31 -0
- package/dist/events/components/ActivityGridRow.d.ts.map +1 -0
- package/dist/events/components/ActivityGridRow.js +23 -0
- package/dist/events/components/ActivityGridRow.js.map +1 -0
- package/dist/events/components/ProposedChangeDiff.d.ts +46 -0
- package/dist/events/components/ProposedChangeDiff.d.ts.map +1 -0
- package/dist/events/components/ProposedChangeDiff.js +60 -0
- package/dist/events/components/ProposedChangeDiff.js.map +1 -0
- package/dist/events/components/format.d.ts +11 -0
- package/dist/events/components/format.d.ts.map +1 -0
- package/dist/events/components/format.js +26 -0
- package/dist/events/components/format.js.map +1 -0
- package/dist/events/components/index.d.ts +6 -0
- package/dist/events/components/index.d.ts.map +1 -0
- package/dist/events/components/index.js +6 -0
- package/dist/events/components/index.js.map +1 -0
- package/dist/events/digest.d.ts +167 -0
- package/dist/events/digest.d.ts.map +1 -0
- package/dist/events/digest.js +426 -0
- package/dist/events/digest.js.map +1 -0
- package/dist/events/hooks/index.d.ts +3 -0
- package/dist/events/hooks/index.d.ts.map +1 -0
- package/dist/events/hooks/index.js +3 -0
- package/dist/events/hooks/index.js.map +1 -0
- package/dist/events/hooks/useActivityDigest.d.ts +27 -0
- package/dist/events/hooks/useActivityDigest.d.ts.map +1 -0
- package/dist/events/hooks/useActivityDigest.js +18 -0
- package/dist/events/hooks/useActivityDigest.js.map +1 -0
- package/dist/events/hooks/useActivityStream.d.ts +44 -0
- package/dist/events/hooks/useActivityStream.d.ts.map +1 -0
- package/dist/events/hooks/useActivityStream.js +38 -0
- package/dist/events/hooks/useActivityStream.js.map +1 -0
- package/dist/events/index.d.ts +15 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +14 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +160 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +21 -0
- package/dist/events/types.js.map +1 -0
- package/dist/firestore/components/CollectionList.d.ts +22 -0
- package/dist/firestore/components/CollectionList.d.ts.map +1 -0
- package/dist/firestore/components/CollectionList.js +21 -0
- package/dist/firestore/components/CollectionList.js.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts +38 -0
- package/dist/firestore/components/DeleteWithConfirm.d.ts.map +1 -0
- package/dist/firestore/components/DeleteWithConfirm.js +33 -0
- package/dist/firestore/components/DeleteWithConfirm.js.map +1 -0
- package/dist/firestore/components/DocumentEditor.d.ts +47 -0
- package/dist/firestore/components/DocumentEditor.d.ts.map +1 -0
- package/dist/firestore/components/DocumentEditor.js +176 -0
- package/dist/firestore/components/DocumentEditor.js.map +1 -0
- package/dist/firestore/components/DocumentList.d.ts +63 -0
- package/dist/firestore/components/DocumentList.d.ts.map +1 -0
- package/dist/firestore/components/DocumentList.js +53 -0
- package/dist/firestore/components/DocumentList.js.map +1 -0
- package/dist/firestore/components/DocumentPreview.d.ts +68 -0
- package/dist/firestore/components/DocumentPreview.d.ts.map +1 -0
- package/dist/firestore/components/DocumentPreview.js +76 -0
- package/dist/firestore/components/DocumentPreview.js.map +1 -0
- package/dist/firestore/components/FieldRenderer.d.ts +17 -0
- package/dist/firestore/components/FieldRenderer.d.ts.map +1 -0
- package/dist/firestore/components/FieldRenderer.js +16 -0
- package/dist/firestore/components/FieldRenderer.js.map +1 -0
- package/dist/firestore/components/QueryBuilder.d.ts +25 -0
- package/dist/firestore/components/QueryBuilder.d.ts.map +1 -0
- package/dist/firestore/components/QueryBuilder.js +78 -0
- package/dist/firestore/components/QueryBuilder.js.map +1 -0
- package/dist/firestore/components/ReferencePicker.d.ts +33 -0
- package/dist/firestore/components/ReferencePicker.d.ts.map +1 -0
- package/dist/firestore/components/ReferencePicker.js +42 -0
- package/dist/firestore/components/ReferencePicker.js.map +1 -0
- package/dist/firestore/components/TreeEntry.d.ts +15 -0
- package/dist/firestore/components/TreeEntry.d.ts.map +1 -0
- package/dist/firestore/components/TreeEntry.js +23 -0
- package/dist/firestore/components/TreeEntry.js.map +1 -0
- package/dist/firestore/components/context.d.ts +18 -0
- package/dist/firestore/components/context.d.ts.map +1 -0
- package/dist/firestore/components/context.js +7 -0
- package/dist/firestore/components/context.js.map +1 -0
- package/dist/firestore/fieldEditors/array.d.ts +3 -0
- package/dist/firestore/fieldEditors/array.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/array.js +16 -0
- package/dist/firestore/fieldEditors/array.js.map +1 -0
- package/dist/firestore/fieldEditors/boolean.d.ts +3 -0
- package/dist/firestore/fieldEditors/boolean.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/boolean.js +13 -0
- package/dist/firestore/fieldEditors/boolean.js.map +1 -0
- package/dist/firestore/fieldEditors/bytes.d.ts +4 -0
- package/dist/firestore/fieldEditors/bytes.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/bytes.js +31 -0
- package/dist/firestore/fieldEditors/bytes.js.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts +4 -0
- package/dist/firestore/fieldEditors/geopoint.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/geopoint.js +32 -0
- package/dist/firestore/fieldEditors/geopoint.js.map +1 -0
- package/dist/firestore/fieldEditors/map.d.ts +3 -0
- package/dist/firestore/fieldEditors/map.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/map.js +19 -0
- package/dist/firestore/fieldEditors/map.js.map +1 -0
- package/dist/firestore/fieldEditors/null.d.ts +3 -0
- package/dist/firestore/fieldEditors/null.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/null.js +17 -0
- package/dist/firestore/fieldEditors/null.js.map +1 -0
- package/dist/firestore/fieldEditors/number.d.ts +3 -0
- package/dist/firestore/fieldEditors/number.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/number.js +24 -0
- package/dist/firestore/fieldEditors/number.js.map +1 -0
- package/dist/firestore/fieldEditors/reference.d.ts +4 -0
- package/dist/firestore/fieldEditors/reference.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/reference.js +49 -0
- package/dist/firestore/fieldEditors/reference.js.map +1 -0
- package/dist/firestore/fieldEditors/registry.d.ts +16 -0
- package/dist/firestore/fieldEditors/registry.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/registry.js +42 -0
- package/dist/firestore/fieldEditors/registry.js.map +1 -0
- package/dist/firestore/fieldEditors/string.d.ts +3 -0
- package/dist/firestore/fieldEditors/string.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/string.js +13 -0
- package/dist/firestore/fieldEditors/string.js.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts +4 -0
- package/dist/firestore/fieldEditors/timestamp.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/timestamp.js +52 -0
- package/dist/firestore/fieldEditors/timestamp.js.map +1 -0
- package/dist/firestore/fieldEditors/types.d.ts +64 -0
- package/dist/firestore/fieldEditors/types.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/types.js +2 -0
- package/dist/firestore/fieldEditors/types.js.map +1 -0
- package/dist/firestore/fieldEditors/vector.d.ts +29 -0
- package/dist/firestore/fieldEditors/vector.d.ts.map +1 -0
- package/dist/firestore/fieldEditors/vector.js +93 -0
- package/dist/firestore/fieldEditors/vector.js.map +1 -0
- package/dist/firestore/firestoreApi.d.ts +35 -0
- package/dist/firestore/firestoreApi.d.ts.map +1 -0
- package/dist/firestore/firestoreApi.js +29 -0
- package/dist/firestore/firestoreApi.js.map +1 -0
- package/dist/firestore/hooks/coerceError.d.ts +17 -0
- package/dist/firestore/hooks/coerceError.d.ts.map +1 -0
- package/dist/firestore/hooks/coerceError.js +41 -0
- package/dist/firestore/hooks/coerceError.js.map +1 -0
- package/dist/firestore/hooks/index.d.ts +10 -0
- package/dist/firestore/hooks/index.d.ts.map +1 -0
- package/dist/firestore/hooks/index.js +10 -0
- package/dist/firestore/hooks/index.js.map +1 -0
- package/dist/firestore/hooks/useCollectionList.d.ts +37 -0
- package/dist/firestore/hooks/useCollectionList.d.ts.map +1 -0
- package/dist/firestore/hooks/useCollectionList.js +51 -0
- package/dist/firestore/hooks/useCollectionList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts +61 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.js +71 -0
- package/dist/firestore/hooks/useDocumentEditor.js.map +1 -0
- package/dist/firestore/hooks/useDocumentList.d.ts +50 -0
- package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentList.js +162 -0
- package/dist/firestore/hooks/useDocumentList.js.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts +29 -0
- package/dist/firestore/hooks/useDocumentSubcollections.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js +48 -0
- package/dist/firestore/hooks/useDocumentSubcollections.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts +14 -0
- package/dist/firestore/hooks/useFirestoreCollection.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreCollection.js +36 -0
- package/dist/firestore/hooks/useFirestoreCollection.js.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts +17 -0
- package/dist/firestore/hooks/useFirestoreDoc.d.ts.map +1 -0
- package/dist/firestore/hooks/useFirestoreDoc.js +35 -0
- package/dist/firestore/hooks/useFirestoreDoc.js.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts +51 -0
- package/dist/firestore/hooks/useQueryBuilder.d.ts.map +1 -0
- package/dist/firestore/hooks/useQueryBuilder.js +110 -0
- package/dist/firestore/hooks/useQueryBuilder.js.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts +40 -0
- package/dist/firestore/hooks/useRecursiveDelete.d.ts.map +1 -0
- package/dist/firestore/hooks/useRecursiveDelete.js +44 -0
- package/dist/firestore/hooks/useRecursiveDelete.js.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts +70 -0
- package/dist/firestore/hooks/useReferencePicker.d.ts.map +1 -0
- package/dist/firestore/hooks/useReferencePicker.js +140 -0
- package/dist/firestore/hooks/useReferencePicker.js.map +1 -0
- package/dist/firestore/import/parseImport.d.ts +55 -0
- package/dist/firestore/import/parseImport.d.ts.map +1 -0
- package/dist/firestore/import/parseImport.js +101 -0
- package/dist/firestore/import/parseImport.js.map +1 -0
- package/dist/firestore/index.d.ts +21 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +29 -0
- package/dist/firestore/index.js.map +1 -0
- package/dist/firestore/reducers/defaults.d.ts +10 -0
- package/dist/firestore/reducers/defaults.d.ts.map +1 -0
- package/dist/firestore/reducers/defaults.js +37 -0
- package/dist/firestore/reducers/defaults.js.map +1 -0
- package/dist/firestore/reducers/documentEditor.d.ts +23 -0
- package/dist/firestore/reducers/documentEditor.d.ts.map +1 -0
- package/dist/firestore/reducers/documentEditor.js +201 -0
- package/dist/firestore/reducers/documentEditor.js.map +1 -0
- package/dist/firestore/reducers/tree.d.ts +28 -0
- package/dist/firestore/reducers/tree.d.ts.map +1 -0
- package/dist/firestore/reducers/tree.js +129 -0
- package/dist/firestore/reducers/tree.js.map +1 -0
- package/dist/firestore/reducers/types.d.ts +115 -0
- package/dist/firestore/reducers/types.d.ts.map +1 -0
- package/dist/firestore/reducers/types.js +2 -0
- package/dist/firestore/reducers/types.js.map +1 -0
- package/dist/firestore/reducers/validation.d.ts +25 -0
- package/dist/firestore/reducers/validation.d.ts.map +1 -0
- package/dist/firestore/reducers/validation.js +121 -0
- package/dist/firestore/reducers/validation.js.map +1 -0
- package/dist/firestore/types.d.ts +77 -0
- package/dist/firestore/types.d.ts.map +1 -0
- package/dist/firestore/types.js +196 -0
- package/dist/firestore/types.js.map +1 -0
- package/dist/firestore/validation/ids.d.ts +23 -0
- package/dist/firestore/validation/ids.d.ts.map +1 -0
- package/dist/firestore/validation/ids.js +46 -0
- package/dist/firestore/validation/ids.js.map +1 -0
- package/dist/firestore/valueEquality.d.ts +4 -0
- package/dist/firestore/valueEquality.d.ts.map +1 -0
- package/dist/firestore/valueEquality.js +44 -0
- package/dist/firestore/valueEquality.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/Badge.d.ts +28 -0
- package/dist/primitives/Badge.d.ts.map +1 -0
- package/dist/primitives/Badge.js +11 -0
- package/dist/primitives/Badge.js.map +1 -0
- package/dist/primitives/ConfirmDialog.d.ts +42 -0
- package/dist/primitives/ConfirmDialog.d.ts.map +1 -0
- package/dist/primitives/ConfirmDialog.js +61 -0
- package/dist/primitives/ConfirmDialog.js.map +1 -0
- package/dist/primitives/CopyButton.d.ts +28 -0
- package/dist/primitives/CopyButton.d.ts.map +1 -0
- package/dist/primitives/CopyButton.js +27 -0
- package/dist/primitives/CopyButton.js.map +1 -0
- package/dist/primitives/JsonView.d.ts +29 -0
- package/dist/primitives/JsonView.d.ts.map +1 -0
- package/dist/primitives/JsonView.js +56 -0
- package/dist/primitives/JsonView.js.map +1 -0
- package/dist/primitives/SegmentedControl.d.ts +37 -0
- package/dist/primitives/SegmentedControl.d.ts.map +1 -0
- package/dist/primitives/SegmentedControl.js +18 -0
- package/dist/primitives/SegmentedControl.js.map +1 -0
- package/dist/primitives/Toast.d.ts +48 -0
- package/dist/primitives/Toast.d.ts.map +1 -0
- package/dist/primitives/Toast.js +60 -0
- package/dist/primitives/Toast.js.map +1 -0
- package/dist/primitives/VirtualList.d.ts +37 -0
- package/dist/primitives/VirtualList.d.ts.map +1 -0
- package/dist/primitives/VirtualList.js +47 -0
- package/dist/primitives/VirtualList.js.map +1 -0
- package/dist/primitives/hooks/useContainerSize.d.ts +29 -0
- package/dist/primitives/hooks/useContainerSize.d.ts.map +1 -0
- package/dist/primitives/hooks/useContainerSize.js +45 -0
- package/dist/primitives/hooks/useContainerSize.js.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts +18 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.js +84 -0
- package/dist/primitives/hooks/useUpdateHighlights.js.map +1 -0
- package/dist/primitives/index.d.ts +11 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +11 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/useConfirm.d.ts +34 -0
- package/dist/primitives/useConfirm.d.ts.map +1 -0
- package/dist/primitives/useConfirm.js +63 -0
- package/dist/primitives/useConfirm.js.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts +31 -0
- package/dist/rtdb/components/RtdbPathBar.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbPathBar.js +47 -0
- package/dist/rtdb/components/RtdbPathBar.js.map +1 -0
- package/dist/rtdb/components/RtdbTree.d.ts +38 -0
- package/dist/rtdb/components/RtdbTree.d.ts.map +1 -0
- package/dist/rtdb/components/RtdbTree.js +104 -0
- package/dist/rtdb/components/RtdbTree.js.map +1 -0
- package/dist/rtdb/editor.d.ts +25 -0
- package/dist/rtdb/editor.d.ts.map +1 -0
- package/dist/rtdb/editor.js +79 -0
- package/dist/rtdb/editor.js.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts +33 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.js +67 -0
- package/dist/rtdb/hooks/useRtdbTree.js.map +1 -0
- package/dist/rtdb/index.d.ts +17 -0
- package/dist/rtdb/index.d.ts.map +1 -0
- package/dist/rtdb/index.js +21 -0
- package/dist/rtdb/index.js.map +1 -0
- package/dist/rtdb/pathInput.d.ts +28 -0
- package/dist/rtdb/pathInput.d.ts.map +1 -0
- package/dist/rtdb/pathInput.js +40 -0
- package/dist/rtdb/pathInput.js.map +1 -0
- package/dist/rtdb/reducers/tree.d.ts +86 -0
- package/dist/rtdb/reducers/tree.d.ts.map +1 -0
- package/dist/rtdb/reducers/tree.js +131 -0
- package/dist/rtdb/reducers/tree.js.map +1 -0
- package/dist/rtdb/rtdbApi.d.ts +20 -0
- package/dist/rtdb/rtdbApi.d.ts.map +1 -0
- package/dist/rtdb/rtdbApi.js +2 -0
- package/dist/rtdb/rtdbApi.js.map +1 -0
- package/dist/rtdb/values.d.ts +50 -0
- package/dist/rtdb/values.d.ts.map +1 -0
- package/dist/rtdb/values.js +186 -0
- package/dist/rtdb/values.js.map +1 -0
- package/dist/rules/components/DenialInspector.d.ts +18 -0
- package/dist/rules/components/DenialInspector.d.ts.map +1 -0
- package/dist/rules/components/DenialInspector.js +58 -0
- package/dist/rules/components/DenialInspector.js.map +1 -0
- package/dist/rules/components/format.d.ts +56 -0
- package/dist/rules/components/format.d.ts.map +1 -0
- package/dist/rules/components/format.js +137 -0
- package/dist/rules/components/format.js.map +1 -0
- package/dist/rules/components/index.d.ts +4 -0
- package/dist/rules/components/index.d.ts.map +1 -0
- package/dist/rules/components/index.js +4 -0
- package/dist/rules/components/index.js.map +1 -0
- package/dist/rules/components/scope.d.ts +10 -0
- package/dist/rules/components/scope.d.ts.map +1 -0
- package/dist/rules/components/scope.js +72 -0
- package/dist/rules/components/scope.js.map +1 -0
- package/dist/rules/hooks/index.d.ts +2 -0
- package/dist/rules/hooks/index.d.ts.map +1 -0
- package/dist/rules/hooks/index.js +2 -0
- package/dist/rules/hooks/index.js.map +1 -0
- package/dist/rules/hooks/useDenialTrace.d.ts +51 -0
- package/dist/rules/hooks/useDenialTrace.d.ts.map +1 -0
- package/dist/rules/hooks/useDenialTrace.js +58 -0
- package/dist/rules/hooks/useDenialTrace.js.map +1 -0
- package/dist/rules/index.d.ts +14 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +13 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/types.d.ts +75 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/storage/collisionRename.d.ts +73 -0
- package/dist/storage/collisionRename.d.ts.map +1 -0
- package/dist/storage/collisionRename.js +113 -0
- package/dist/storage/collisionRename.js.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts +66 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts.map +1 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js +82 -0
- package/dist/storage/components/DeleteSelectionWithConfirm.js.map +1 -0
- package/dist/storage/components/ObjectBrowser.d.ts +78 -0
- package/dist/storage/components/ObjectBrowser.d.ts.map +1 -0
- package/dist/storage/components/ObjectBrowser.js +60 -0
- package/dist/storage/components/ObjectBrowser.js.map +1 -0
- package/dist/storage/components/ObjectInspector.d.ts +43 -0
- package/dist/storage/components/ObjectInspector.d.ts.map +1 -0
- package/dist/storage/components/ObjectInspector.js +92 -0
- package/dist/storage/components/ObjectInspector.js.map +1 -0
- package/dist/storage/components/PathBreadcrumb.d.ts +30 -0
- package/dist/storage/components/PathBreadcrumb.d.ts.map +1 -0
- package/dist/storage/components/PathBreadcrumb.js +26 -0
- package/dist/storage/components/PathBreadcrumb.js.map +1 -0
- package/dist/storage/components/UploadDropzone.d.ts +50 -0
- package/dist/storage/components/UploadDropzone.d.ts.map +1 -0
- package/dist/storage/components/UploadDropzone.js +109 -0
- package/dist/storage/components/UploadDropzone.js.map +1 -0
- package/dist/storage/folderPlaceholder.d.ts +20 -0
- package/dist/storage/folderPlaceholder.d.ts.map +1 -0
- package/dist/storage/folderPlaceholder.js +34 -0
- package/dist/storage/folderPlaceholder.js.map +1 -0
- package/dist/storage/hooks/index.d.ts +9 -0
- package/dist/storage/hooks/index.d.ts.map +1 -0
- package/dist/storage/hooks/index.js +9 -0
- package/dist/storage/hooks/index.js.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts +114 -0
- package/dist/storage/hooks/useMetadataEditor.d.ts.map +1 -0
- package/dist/storage/hooks/useMetadataEditor.js +193 -0
- package/dist/storage/hooks/useMetadataEditor.js.map +1 -0
- package/dist/storage/hooks/useObjectUpload.d.ts +105 -0
- package/dist/storage/hooks/useObjectUpload.d.ts.map +1 -0
- package/dist/storage/hooks/useObjectUpload.js +134 -0
- package/dist/storage/hooks/useObjectUpload.js.map +1 -0
- package/dist/storage/hooks/usePathState.d.ts +43 -0
- package/dist/storage/hooks/usePathState.d.ts.map +1 -0
- package/dist/storage/hooks/usePathState.js +42 -0
- package/dist/storage/hooks/usePathState.js.map +1 -0
- package/dist/storage/hooks/useStorageDelete.d.ts +74 -0
- package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageDelete.js +120 -0
- package/dist/storage/hooks/useStorageDelete.js.map +1 -0
- package/dist/storage/hooks/useStorageList.d.ts +72 -0
- package/dist/storage/hooks/useStorageList.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageList.js +164 -0
- package/dist/storage/hooks/useStorageList.js.map +1 -0
- package/dist/storage/hooks/useStorageObject.d.ts +33 -0
- package/dist/storage/hooks/useStorageObject.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageObject.js +114 -0
- package/dist/storage/hooks/useStorageObject.js.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts +116 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.js +150 -0
- package/dist/storage/hooks/useStorageRulesGate.js.map +1 -0
- package/dist/storage/hooks/useStorageSelection.d.ts +32 -0
- package/dist/storage/hooks/useStorageSelection.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageSelection.js +55 -0
- package/dist/storage/hooks/useStorageSelection.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/pendingPrefixes.d.ts +77 -0
- package/dist/storage/pendingPrefixes.d.ts.map +1 -0
- package/dist/storage/pendingPrefixes.js +104 -0
- package/dist/storage/pendingPrefixes.js.map +1 -0
- package/dist/storage/previews.d.ts +51 -0
- package/dist/storage/previews.d.ts.map +1 -0
- package/dist/storage/previews.js +73 -0
- package/dist/storage/previews.js.map +1 -0
- package/dist/storage/storageApi.d.ts +30 -0
- package/dist/storage/storageApi.d.ts.map +1 -0
- package/dist/storage/storageApi.js +20 -0
- package/dist/storage/storageApi.js.map +1 -0
- package/dist/traffic/components/RuleHeatmap.d.ts +34 -0
- package/dist/traffic/components/RuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/components/RuleHeatmap.js +40 -0
- package/dist/traffic/components/RuleHeatmap.js.map +1 -0
- package/dist/traffic/components/TrafficDetail.d.ts +33 -0
- package/dist/traffic/components/TrafficDetail.d.ts.map +1 -0
- package/dist/traffic/components/TrafficDetail.js +28 -0
- package/dist/traffic/components/TrafficDetail.js.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts +28 -0
- package/dist/traffic/components/TrafficGroupRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficGroupRow.js +25 -0
- package/dist/traffic/components/TrafficGroupRow.js.map +1 -0
- package/dist/traffic/components/TrafficLineChart.d.ts +37 -0
- package/dist/traffic/components/TrafficLineChart.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLineChart.js +49 -0
- package/dist/traffic/components/TrafficLineChart.js.map +1 -0
- package/dist/traffic/components/TrafficLog.d.ts +52 -0
- package/dist/traffic/components/TrafficLog.d.ts.map +1 -0
- package/dist/traffic/components/TrafficLog.js +34 -0
- package/dist/traffic/components/TrafficLog.js.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts +26 -0
- package/dist/traffic/components/TrafficMetricCards.d.ts.map +1 -0
- package/dist/traffic/components/TrafficMetricCards.js +24 -0
- package/dist/traffic/components/TrafficMetricCards.js.map +1 -0
- package/dist/traffic/components/TrafficRow.d.ts +40 -0
- package/dist/traffic/components/TrafficRow.d.ts.map +1 -0
- package/dist/traffic/components/TrafficRow.js +27 -0
- package/dist/traffic/components/TrafficRow.js.map +1 -0
- package/dist/traffic/components/TrafficStats.d.ts +18 -0
- package/dist/traffic/components/TrafficStats.d.ts.map +1 -0
- package/dist/traffic/components/TrafficStats.js +19 -0
- package/dist/traffic/components/TrafficStats.js.map +1 -0
- package/dist/traffic/components/TrafficTimeline.d.ts +88 -0
- package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -0
- package/dist/traffic/components/TrafficTimeline.js +86 -0
- package/dist/traffic/components/TrafficTimeline.js.map +1 -0
- package/dist/traffic/components/format.d.ts +13 -0
- package/dist/traffic/components/format.d.ts.map +1 -0
- package/dist/traffic/components/format.js +24 -0
- package/dist/traffic/components/format.js.map +1 -0
- package/dist/traffic/components/index.d.ts +11 -0
- package/dist/traffic/components/index.d.ts.map +1 -0
- package/dist/traffic/components/index.js +11 -0
- package/dist/traffic/components/index.js.map +1 -0
- package/dist/traffic/hooks/index.d.ts +8 -0
- package/dist/traffic/hooks/index.d.ts.map +1 -0
- package/dist/traffic/hooks/index.js +8 -0
- package/dist/traffic/hooks/index.js.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts +33 -0
- package/dist/traffic/hooks/useRuleHeatmap.d.ts.map +1 -0
- package/dist/traffic/hooks/useRuleHeatmap.js +54 -0
- package/dist/traffic/hooks/useRuleHeatmap.js.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts +71 -0
- package/dist/traffic/hooks/useTrafficBuckets.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficBuckets.js +74 -0
- package/dist/traffic/hooks/useTrafficBuckets.js.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts +40 -0
- package/dist/traffic/hooks/useTrafficFilter.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficFilter.js +33 -0
- package/dist/traffic/hooks/useTrafficFilter.js.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts +47 -0
- package/dist/traffic/hooks/useTrafficGroups.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficGroups.js +73 -0
- package/dist/traffic/hooks/useTrafficGroups.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts +66 -0
- package/dist/traffic/hooks/useTrafficMetrics.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMetrics.js +156 -0
- package/dist/traffic/hooks/useTrafficMetrics.js.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts +56 -0
- package/dist/traffic/hooks/useTrafficMonitor.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficMonitor.js +58 -0
- package/dist/traffic/hooks/useTrafficMonitor.js.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts +32 -0
- package/dist/traffic/hooks/useTrafficStats.d.ts.map +1 -0
- package/dist/traffic/hooks/useTrafficStats.js +45 -0
- package/dist/traffic/hooks/useTrafficStats.js.map +1 -0
- package/dist/traffic/index.d.ts +4 -0
- package/dist/traffic/index.d.ts.map +1 -0
- package/dist/traffic/index.js +3 -0
- package/dist/traffic/index.js.map +1 -0
- package/dist/traffic/types.d.ts +72 -0
- package/dist/traffic/types.d.ts.map +1 -0
- package/dist/traffic/types.js +10 -0
- package/dist/traffic/types.js.map +1 -0
- package/package.json +127 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecursiveDelete.js","sourceRoot":"","sources":["../../../src/firestore/hooks/useRecursiveDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAkCtD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAyB;IAEzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAoB,SAAS,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEhC,MAAM,GAAG,GAAG,WAAW,CACrB,KAAK,EAAE,MAA+C,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC;QACtC,WAAW,CAAC,CAAC,CAAC,CAAC;QACf,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,IAAI,CAAC;YACH,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3C,IAAI,KAAK,KAAK,aAAa,CAAC,OAAO;oBAAE,OAAO;gBAC5C,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC9B,IAAI,GAAG,CAAC,IAAI;oBAAE,MAAM;YACtB,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,KAAK,KAAK,aAAa,CAAC,OAAO;gBAAE,OAAO;YAC5C,QAAQ,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK,KAAK,aAAa,CAAC,OAAO;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,EACD,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type CollectionReference, type DocumentReference, type Firestore, type QueryDocumentSnapshot } from 'pyric/firestore';
|
|
2
|
+
export type BrowseLocation = {
|
|
3
|
+
kind: 'root';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'document';
|
|
6
|
+
ref: DocumentReference;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'collection';
|
|
9
|
+
ref: CollectionReference;
|
|
10
|
+
};
|
|
11
|
+
export interface UseReferencePickerOptions {
|
|
12
|
+
firestore: Firestore;
|
|
13
|
+
/**
|
|
14
|
+
* Lister for subcollections under a parent (or root when
|
|
15
|
+
* `parent == null`). The library does not ship a default — see
|
|
16
|
+
* `useCollectionList` for the same rationale (the modular Web SDK
|
|
17
|
+
* can't enumerate collections client-side).
|
|
18
|
+
*/
|
|
19
|
+
listCollections: (firestore: Firestore, parent: DocumentReference | null) => Promise<CollectionReference[]>;
|
|
20
|
+
/** Default page size for the document list when browsing inside
|
|
21
|
+
* a collection. Default 20. */
|
|
22
|
+
pageSize?: number;
|
|
23
|
+
/** Initial value to pre-populate the text input + parse. */
|
|
24
|
+
initialPath?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UseReferencePickerResult {
|
|
27
|
+
/** Current text input value. */
|
|
28
|
+
pathInput: string;
|
|
29
|
+
/** Validated `DocumentReference` parsed from `pathInput`, or
|
|
30
|
+
* `null` when the path is empty / invalid. */
|
|
31
|
+
reference: DocumentReference | null;
|
|
32
|
+
/** Parse error, or `null` when valid. */
|
|
33
|
+
error: string | null;
|
|
34
|
+
/** Current browse position in the tree. */
|
|
35
|
+
browseLocation: BrowseLocation;
|
|
36
|
+
/** Whether `drillBack` has anywhere to go. */
|
|
37
|
+
canDrillBack: boolean;
|
|
38
|
+
/** Collections available at the current browse level. Populated
|
|
39
|
+
* when `browseLocation` is `root` or `document`. */
|
|
40
|
+
collections: CollectionReference[];
|
|
41
|
+
/** First page of documents in the current collection — populated
|
|
42
|
+
* when `browseLocation.kind === 'collection'`. */
|
|
43
|
+
documents: QueryDocumentSnapshot[];
|
|
44
|
+
/** True while a fetch is in flight. */
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
/** Set the text-input value. Parses on every change. */
|
|
47
|
+
setPathInput: (path: string) => void;
|
|
48
|
+
/** Commit a chosen reference. Updates `pathInput` (and therefore
|
|
49
|
+
* the parsed `reference`). */
|
|
50
|
+
pick: (ref: DocumentReference) => void;
|
|
51
|
+
/** Drill into a collection — fetches its first page of documents. */
|
|
52
|
+
drillIntoCollection: (ref: CollectionReference) => void;
|
|
53
|
+
/** Drill into a document — fetches its subcollections. */
|
|
54
|
+
drillIntoDocument: (ref: DocumentReference) => void;
|
|
55
|
+
/** Step back one level. No-op when at root. */
|
|
56
|
+
drillBack: () => void;
|
|
57
|
+
/** Clear the path input + reset browse to root. */
|
|
58
|
+
clear: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Picker state machine. Browses a Firestore tree level-by-level
|
|
62
|
+
* (root → collection → document → collection → ...), maintains a
|
|
63
|
+
* separately-validated text-input path, and commits a chosen
|
|
64
|
+
* reference via `pick`.
|
|
65
|
+
*
|
|
66
|
+
* Headless — consumers compose the resulting state into their own
|
|
67
|
+
* UI, or use the bundled `<ReferencePicker>` component.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useReferencePicker({ firestore, listCollections, pageSize, initialPath, }: UseReferencePickerOptions): UseReferencePickerResult;
|
|
70
|
+
//# sourceMappingURL=useReferencePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReferencePicker.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useReferencePicker.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,iBAAiB,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,eAAe,EAAE,CACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,iBAAiB,GAAG,IAAI,KAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACpC;oCACgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB;mDAC+C;IAC/C,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2CAA2C;IAC3C,cAAc,EAAE,cAAc,CAAC;IAC/B,8CAA8C;IAC9C,YAAY,EAAE,OAAO,CAAC;IACtB;yDACqD;IACrD,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC;uDACmD;IACnD,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IAEnB,wDAAwD;IACxD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;mCAC+B;IAC/B,IAAI,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACvC,qEAAqE;IACrE,mBAAmB,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACxD,0DAA0D;IAC1D,iBAAiB,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD,+CAA+C;IAC/C,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,mDAAmD;IACnD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AA8BD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,eAAe,EACf,QAAa,EACb,WAAgB,GACjB,EAAE,yBAAyB,GAAG,wBAAwB,CAiHtD"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { doc as docFn, getDocs, limit as limitFn, query as queryFn, } from 'pyric/firestore';
|
|
3
|
+
function parseReferencePath(firestore, path) {
|
|
4
|
+
const trimmed = path.trim();
|
|
5
|
+
if (!trimmed)
|
|
6
|
+
return { ref: null, error: null };
|
|
7
|
+
const segments = trimmed.split('/').filter(Boolean);
|
|
8
|
+
if (segments.length === 0)
|
|
9
|
+
return { ref: null, error: 'Empty path' };
|
|
10
|
+
if (segments.length % 2 !== 0)
|
|
11
|
+
return { ref: null, error: 'Must point to a document (even segment count)' };
|
|
12
|
+
try {
|
|
13
|
+
const ref = docFn(firestore, trimmed);
|
|
14
|
+
return { ref, error: null };
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
return {
|
|
18
|
+
ref: null,
|
|
19
|
+
error: e instanceof Error ? e.message : 'Invalid path',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const ROOT = { kind: 'root' };
|
|
24
|
+
/**
|
|
25
|
+
* Picker state machine. Browses a Firestore tree level-by-level
|
|
26
|
+
* (root → collection → document → collection → ...), maintains a
|
|
27
|
+
* separately-validated text-input path, and commits a chosen
|
|
28
|
+
* reference via `pick`.
|
|
29
|
+
*
|
|
30
|
+
* Headless — consumers compose the resulting state into their own
|
|
31
|
+
* UI, or use the bundled `<ReferencePicker>` component.
|
|
32
|
+
*/
|
|
33
|
+
export function useReferencePicker({ firestore, listCollections, pageSize = 20, initialPath = '', }) {
|
|
34
|
+
const [pathInput, setPathInputState] = useState(initialPath);
|
|
35
|
+
const [browse, setBrowse] = useState({
|
|
36
|
+
current: ROOT,
|
|
37
|
+
history: [],
|
|
38
|
+
});
|
|
39
|
+
const [collections, setCollections] = useState([]);
|
|
40
|
+
const [documents, setDocuments] = useState([]);
|
|
41
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
42
|
+
const parsed = useMemo(() => parseReferencePath(firestore, pathInput), [firestore, pathInput]);
|
|
43
|
+
// Keep the injected `listCollections` in a ref so the fetch
|
|
44
|
+
// effect's deps don't include it. Consumers commonly pass an
|
|
45
|
+
// inline arrow function whose identity churns on every render;
|
|
46
|
+
// depending on it would loop the effect forever.
|
|
47
|
+
const listCollectionsRef = useRef(listCollections);
|
|
48
|
+
listCollectionsRef.current = listCollections;
|
|
49
|
+
// Re-fetch contents whenever the browse location changes.
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
let cancelled = false;
|
|
52
|
+
setIsLoading(true);
|
|
53
|
+
const loc = browse.current;
|
|
54
|
+
if (loc.kind === 'root' || loc.kind === 'document') {
|
|
55
|
+
const parent = loc.kind === 'document' ? loc.ref : null;
|
|
56
|
+
setDocuments([]);
|
|
57
|
+
listCollectionsRef.current(firestore, parent)
|
|
58
|
+
.then((cs) => {
|
|
59
|
+
if (cancelled)
|
|
60
|
+
return;
|
|
61
|
+
setCollections(cs);
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
})
|
|
64
|
+
.catch(() => {
|
|
65
|
+
if (cancelled)
|
|
66
|
+
return;
|
|
67
|
+
setCollections([]);
|
|
68
|
+
setIsLoading(false);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setCollections([]);
|
|
73
|
+
const pagedQuery = queryFn(loc.ref, limitFn(pageSize));
|
|
74
|
+
getDocs(pagedQuery)
|
|
75
|
+
.then((snap) => {
|
|
76
|
+
if (cancelled)
|
|
77
|
+
return;
|
|
78
|
+
setDocuments([...snap.docs]);
|
|
79
|
+
setIsLoading(false);
|
|
80
|
+
})
|
|
81
|
+
.catch(() => {
|
|
82
|
+
if (cancelled)
|
|
83
|
+
return;
|
|
84
|
+
setDocuments([]);
|
|
85
|
+
setIsLoading(false);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return () => {
|
|
89
|
+
cancelled = true;
|
|
90
|
+
};
|
|
91
|
+
}, [browse.current, firestore, pageSize]);
|
|
92
|
+
const setPathInput = useCallback((path) => {
|
|
93
|
+
setPathInputState(path);
|
|
94
|
+
}, []);
|
|
95
|
+
const pick = useCallback((ref) => {
|
|
96
|
+
setPathInputState(ref.path);
|
|
97
|
+
}, []);
|
|
98
|
+
const drillIntoCollection = useCallback((ref) => {
|
|
99
|
+
setBrowse((prev) => ({
|
|
100
|
+
current: { kind: 'collection', ref },
|
|
101
|
+
history: [...prev.history, prev.current],
|
|
102
|
+
}));
|
|
103
|
+
}, []);
|
|
104
|
+
const drillIntoDocument = useCallback((ref) => {
|
|
105
|
+
setBrowse((prev) => ({
|
|
106
|
+
current: { kind: 'document', ref },
|
|
107
|
+
history: [...prev.history, prev.current],
|
|
108
|
+
}));
|
|
109
|
+
}, []);
|
|
110
|
+
const drillBack = useCallback(() => {
|
|
111
|
+
setBrowse((prev) => {
|
|
112
|
+
if (prev.history.length === 0)
|
|
113
|
+
return prev;
|
|
114
|
+
const next = prev.history.slice(0, -1);
|
|
115
|
+
const popped = prev.history[prev.history.length - 1];
|
|
116
|
+
return { current: popped, history: next };
|
|
117
|
+
});
|
|
118
|
+
}, []);
|
|
119
|
+
const clear = useCallback(() => {
|
|
120
|
+
setPathInputState('');
|
|
121
|
+
setBrowse({ current: ROOT, history: [] });
|
|
122
|
+
}, []);
|
|
123
|
+
return {
|
|
124
|
+
pathInput,
|
|
125
|
+
reference: parsed.ref,
|
|
126
|
+
error: parsed.error,
|
|
127
|
+
browseLocation: browse.current,
|
|
128
|
+
canDrillBack: browse.history.length > 0,
|
|
129
|
+
collections,
|
|
130
|
+
documents,
|
|
131
|
+
isLoading,
|
|
132
|
+
setPathInput,
|
|
133
|
+
pick,
|
|
134
|
+
drillIntoCollection,
|
|
135
|
+
drillIntoDocument,
|
|
136
|
+
drillBack,
|
|
137
|
+
clear,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=useReferencePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReferencePicker.js","sourceRoot":"","sources":["../../../src/firestore/hooks/useReferencePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,GAAG,IAAI,KAAK,EACZ,OAAO,EACP,KAAK,IAAI,OAAO,EAChB,KAAK,IAAI,OAAO,GAKjB,MAAM,iBAAiB,CAAC;AAmEzB,SAAS,kBAAkB,CACzB,SAAoB,EACpB,IAAY;IAEZ,MAAM,OA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QACL,SAAS;QACT,SAAS,EAAE,MAAM,CAAC,GAAG;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,cAAc,EAAE,MAAM,CAAC,OAAO;QAC9B,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QACvC,WAAW;QACX,SAAS;QACT,SAAS;QACT,YAAY;QACZ,IAAI;QACJ,mBAAmB;QACnB,iBAAiB;QACjB,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON import parsing + collision detection for the Firestore "import JSON
|
|
3
|
+
* into a collection" flow.
|
|
4
|
+
*
|
|
5
|
+
* Pure, no React, no I/O: `parseImport` takes the raw pasted/loaded text and
|
|
6
|
+
* returns the documents it would create plus any per-item errors; the caller
|
|
7
|
+
* (the Studio pane) owns showing the "will create N documents" preview,
|
|
8
|
+
* disclosing a collision policy ONLY when {@link detectCollisions} finds an
|
|
9
|
+
* overlap, and actually writing through the existing Firestore write handle.
|
|
10
|
+
*
|
|
11
|
+
* Two accepted shapes:
|
|
12
|
+
* 1. A map: `{ "docId": { ...fields }, "docId2": { ...fields } }`
|
|
13
|
+
* — each key becomes the document id (validated), each value its data.
|
|
14
|
+
* 2. An array: `[ { ...fields }, { ...fields } ]`
|
|
15
|
+
* — each element becomes a document with `id: null` (auto-id at write
|
|
16
|
+
* time), since a bare array carries no natural id.
|
|
17
|
+
*/
|
|
18
|
+
/** One document to create. `id === null` means "let Firestore auto-id it"
|
|
19
|
+
* (only produced by the array shape when no `generateId` option is given —
|
|
20
|
+
* a map key is always a chosen id). */
|
|
21
|
+
export interface ParsedImportDoc {
|
|
22
|
+
id: string | null;
|
|
23
|
+
data: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface ParseImportOptions {
|
|
26
|
+
/** When provided, array-shape entries get their auto-id GENERATED AT PARSE
|
|
27
|
+
* TIME (instead of `id: null` / addDoc-at-write-time). Fixing ids at parse
|
|
28
|
+
* makes a retry after a partial failure idempotent: the same parse's ids
|
|
29
|
+
* are reused, so re-running the import cannot duplicate already-written
|
|
30
|
+
* docs. Use {@link firestoreAutoId} for prod-parity ids. */
|
|
31
|
+
generateId?: () => string;
|
|
32
|
+
}
|
|
33
|
+
/** A Firestore-style 20-char auto id (same alphabet/length the SDK uses). */
|
|
34
|
+
export declare function firestoreAutoId(): string;
|
|
35
|
+
export interface ParseImportResult {
|
|
36
|
+
docs: ParsedImportDoc[];
|
|
37
|
+
/** Human-readable problems found while parsing. A non-empty `errors` does
|
|
38
|
+
* NOT necessarily mean `docs` is empty — the parser is per-item tolerant
|
|
39
|
+
* so one bad entry doesn't block the rest; the caller decides whether to
|
|
40
|
+
* block on any error or proceed with the valid subset. */
|
|
41
|
+
errors: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse raw JSON text into the documents it would create. Never throws —
|
|
45
|
+
* a JSON syntax error or a wrong top-level shape becomes an entry in
|
|
46
|
+
* `errors` with an empty `docs` array.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseImport(input: string, options?: ParseImportOptions): ParseImportResult;
|
|
49
|
+
/**
|
|
50
|
+
* Ids in `docs` (map-shape entries only — `id !== null`) that already exist
|
|
51
|
+
* in `existingIds`. The UI shows the skip-or-overwrite policy choice ONLY
|
|
52
|
+
* when this returns a non-empty list.
|
|
53
|
+
*/
|
|
54
|
+
export declare function detectCollisions(existingIds: readonly string[], docs: readonly ParsedImportDoc[]): string[];
|
|
55
|
+
//# sourceMappingURL=parseImport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseImport.d.ts","sourceRoot":"","sources":["../../../src/firestore/import/parseImport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;wCAEwC;AACxC,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;iEAI6D;IAC7D,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B;AAID,6EAA6E;AAC7E,wBAAgB,eAAe,IAAI,MAAM,CAMxC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB;;;+DAG2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAMD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,CA+C1F;AAQD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,IAAI,EAAE,SAAS,eAAe,EAAE,GAC/B,MAAM,EAAE,CAOV"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON import parsing + collision detection for the Firestore "import JSON
|
|
3
|
+
* into a collection" flow.
|
|
4
|
+
*
|
|
5
|
+
* Pure, no React, no I/O: `parseImport` takes the raw pasted/loaded text and
|
|
6
|
+
* returns the documents it would create plus any per-item errors; the caller
|
|
7
|
+
* (the Studio pane) owns showing the "will create N documents" preview,
|
|
8
|
+
* disclosing a collision policy ONLY when {@link detectCollisions} finds an
|
|
9
|
+
* overlap, and actually writing through the existing Firestore write handle.
|
|
10
|
+
*
|
|
11
|
+
* Two accepted shapes:
|
|
12
|
+
* 1. A map: `{ "docId": { ...fields }, "docId2": { ...fields } }`
|
|
13
|
+
* — each key becomes the document id (validated), each value its data.
|
|
14
|
+
* 2. An array: `[ { ...fields }, { ...fields } ]`
|
|
15
|
+
* — each element becomes a document with `id: null` (auto-id at write
|
|
16
|
+
* time), since a bare array carries no natural id.
|
|
17
|
+
*/
|
|
18
|
+
import { validateDocumentId } from '../validation/ids.js';
|
|
19
|
+
const AUTO_ID_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
20
|
+
/** A Firestore-style 20-char auto id (same alphabet/length the SDK uses). */
|
|
21
|
+
export function firestoreAutoId() {
|
|
22
|
+
let id = '';
|
|
23
|
+
for (let i = 0; i < 20; i++) {
|
|
24
|
+
id += AUTO_ID_ALPHABET.charAt(Math.floor(Math.random() * AUTO_ID_ALPHABET.length));
|
|
25
|
+
}
|
|
26
|
+
return id;
|
|
27
|
+
}
|
|
28
|
+
function isPlainObject(value) {
|
|
29
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse raw JSON text into the documents it would create. Never throws —
|
|
33
|
+
* a JSON syntax error or a wrong top-level shape becomes an entry in
|
|
34
|
+
* `errors` with an empty `docs` array.
|
|
35
|
+
*/
|
|
36
|
+
export function parseImport(input, options) {
|
|
37
|
+
const trimmed = input.trim();
|
|
38
|
+
if (trimmed === '') {
|
|
39
|
+
return { docs: [], errors: ['Input is empty'] };
|
|
40
|
+
}
|
|
41
|
+
let parsed;
|
|
42
|
+
try {
|
|
43
|
+
parsed = JSON.parse(trimmed);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
return { docs: [], errors: [`Invalid JSON: ${e instanceof Error ? e.message : String(e)}`] };
|
|
47
|
+
}
|
|
48
|
+
const docs = [];
|
|
49
|
+
const errors = [];
|
|
50
|
+
if (Array.isArray(parsed)) {
|
|
51
|
+
parsed.forEach((item, i) => {
|
|
52
|
+
if (!isPlainObject(item)) {
|
|
53
|
+
errors.push(`Item ${i}: expected an object, got ${describeType(item)}`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
docs.push({ id: options?.generateId ? options.generateId() : null, data: item });
|
|
57
|
+
});
|
|
58
|
+
return { docs, errors };
|
|
59
|
+
}
|
|
60
|
+
if (isPlainObject(parsed)) {
|
|
61
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
62
|
+
const idError = validateDocumentId(key);
|
|
63
|
+
if (idError) {
|
|
64
|
+
errors.push(`"${key}": invalid document id — ${idError}`);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (!isPlainObject(value)) {
|
|
68
|
+
errors.push(`"${key}": expected an object of fields, got ${describeType(value)}`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
docs.push({ id: key, data: value });
|
|
72
|
+
}
|
|
73
|
+
return { docs, errors };
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
docs: [],
|
|
77
|
+
errors: ['Input must be a JSON object mapping docId -> fields, or an array of objects'],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function describeType(value) {
|
|
81
|
+
if (value === null)
|
|
82
|
+
return 'null';
|
|
83
|
+
if (Array.isArray(value))
|
|
84
|
+
return 'an array';
|
|
85
|
+
return typeof value;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ids in `docs` (map-shape entries only — `id !== null`) that already exist
|
|
89
|
+
* in `existingIds`. The UI shows the skip-or-overwrite policy choice ONLY
|
|
90
|
+
* when this returns a non-empty list.
|
|
91
|
+
*/
|
|
92
|
+
export function detectCollisions(existingIds, docs) {
|
|
93
|
+
const existing = new Set(existingIds);
|
|
94
|
+
const collisions = [];
|
|
95
|
+
for (const doc of docs) {
|
|
96
|
+
if (doc.id !== null && existing.has(doc.id))
|
|
97
|
+
collisions.push(doc.id);
|
|
98
|
+
}
|
|
99
|
+
return collisions;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=parseImport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseImport.js","sourceRoot":"","sources":["../../../src/firestore/import/parseImport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAmB1D,MAAM,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QACL,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC,6EAA6E,CAAC;KACxF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC;IAC5C,OAAO,OAAO,KAAK,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAA8B,EAC9B,IAAgC;IAEhC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,CAAC,EAAE,KAAK,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './hooks/index.js';
|
|
2
|
+
export { FirestoreApiProvider, useFirestoreApi, type FirestoreApi, } from './firestoreApi.js';
|
|
3
|
+
export { inferType, asVectorView, vectorPreview, truncateVectorsForDisplay, type FieldType, type VectorView, } from './types.js';
|
|
4
|
+
export { firestoreValuesEqual } from './valueEquality.js';
|
|
5
|
+
export { defaultFieldEditors, mergeFieldEditors, } from './fieldEditors/registry.js';
|
|
6
|
+
export type { FieldEditorContract, FieldEditorRegistry, FieldDisplayProps, FieldEditProps, } from './fieldEditors/types.js';
|
|
7
|
+
export { FieldRenderer, type FieldRendererProps } from './components/FieldRenderer.js';
|
|
8
|
+
export { DocumentPreview, type DocumentPreviewProps, } from './components/DocumentPreview.js';
|
|
9
|
+
export type { FieldNode, EditorTree, DocumentEditorAction, DocumentEditorState, } from './reducers/types.js';
|
|
10
|
+
export { validateLeaf, validateTree } from './reducers/validation.js';
|
|
11
|
+
export { treeFromData, treeToData } from './reducers/tree.js';
|
|
12
|
+
export { initState, reducer } from './reducers/documentEditor.js';
|
|
13
|
+
export { DocumentEditor, DocumentEditorRoot, DocumentEditorFields, useDocumentEditorContext, type DocumentEditorRootProps, } from './components/DocumentEditor.js';
|
|
14
|
+
export { CollectionList, type CollectionListProps } from './components/CollectionList.js';
|
|
15
|
+
export { DocumentList, type DocumentListProps } from './components/DocumentList.js';
|
|
16
|
+
export { DeleteWithConfirm, type DeleteWithConfirmProps, } from './components/DeleteWithConfirm.js';
|
|
17
|
+
export { ReferencePicker, type ReferencePickerProps, } from './components/ReferencePicker.js';
|
|
18
|
+
export { QueryBuilder, type QueryBuilderProps, } from './components/QueryBuilder.js';
|
|
19
|
+
export { validateCollectionId, validateDocumentId } from './validation/ids.js';
|
|
20
|
+
export { parseImport, detectCollisions, firestoreAutoId, type ParsedImportDoc, type ParseImportResult, type ParseImportOptions, } from './import/parseImport.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/firestore/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAIjC,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './hooks/index.js';
|
|
2
|
+
// Injectable Firestore API bundle (Pyric Studio data-backend swap): defaults to
|
|
3
|
+
// in-process `pyric/firestore`; a consumer can provide the SharedWorker client.
|
|
4
|
+
export { FirestoreApiProvider, useFirestoreApi, } from './firestoreApi.js';
|
|
5
|
+
// M2: read-only display surface
|
|
6
|
+
export { inferType, asVectorView, vectorPreview, truncateVectorsForDisplay, } from './types.js';
|
|
7
|
+
export { firestoreValuesEqual } from './valueEquality.js';
|
|
8
|
+
export { defaultFieldEditors, mergeFieldEditors, } from './fieldEditors/registry.js';
|
|
9
|
+
export { FieldRenderer } from './components/FieldRenderer.js';
|
|
10
|
+
export { DocumentPreview, } from './components/DocumentPreview.js';
|
|
11
|
+
export { validateLeaf, validateTree } from './reducers/validation.js';
|
|
12
|
+
export { treeFromData, treeToData } from './reducers/tree.js';
|
|
13
|
+
export { initState, reducer } from './reducers/documentEditor.js';
|
|
14
|
+
export { DocumentEditor, DocumentEditorRoot, DocumentEditorFields, useDocumentEditorContext, } from './components/DocumentEditor.js';
|
|
15
|
+
// M4: operational read/write + admin ops
|
|
16
|
+
export { CollectionList } from './components/CollectionList.js';
|
|
17
|
+
export { DocumentList } from './components/DocumentList.js';
|
|
18
|
+
export { DeleteWithConfirm, } from './components/DeleteWithConfirm.js';
|
|
19
|
+
// M5: improvements over firebase-tools-ui
|
|
20
|
+
export { ReferencePicker, } from './components/ReferencePicker.js';
|
|
21
|
+
// M6: query builder + virtualization
|
|
22
|
+
export { QueryBuilder, } from './components/QueryBuilder.js';
|
|
23
|
+
// M7: create-collection / create-document / JSON-import — pure, tested logic.
|
|
24
|
+
// Presentational wiring lives in the consumer (Pyric Studio's FirestorePane)
|
|
25
|
+
// over these + the existing DocumentEditor/hooks, per the disclosure-over-
|
|
26
|
+
// modals design principles.
|
|
27
|
+
export { validateCollectionId, validateDocumentId } from './validation/ids.js';
|
|
28
|
+
export { parseImport, detectCollisions, firestoreAutoId, } from './import/parseImport.js';
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["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B,eAAe,GAIhB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldType } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default value used when a new field of this type is added (or
|
|
4
|
+
* when an existing field's type is switched). The reducer applies
|
|
5
|
+
* these so a fresh node always starts in a valid state for its type
|
|
6
|
+
* — except that map/array start empty (children come from add
|
|
7
|
+
* actions).
|
|
8
|
+
*/
|
|
9
|
+
export declare function defaultValueFor(type: FieldType): unknown;
|
|
10
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CA2BxD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Timestamp, GeoPoint, Bytes } from 'pyric/firestore';
|
|
2
|
+
/**
|
|
3
|
+
* Default value used when a new field of this type is added (or
|
|
4
|
+
* when an existing field's type is switched). The reducer applies
|
|
5
|
+
* these so a fresh node always starts in a valid state for its type
|
|
6
|
+
* — except that map/array start empty (children come from add
|
|
7
|
+
* actions).
|
|
8
|
+
*/
|
|
9
|
+
export function defaultValueFor(type) {
|
|
10
|
+
switch (type) {
|
|
11
|
+
case 'string':
|
|
12
|
+
return '';
|
|
13
|
+
case 'number':
|
|
14
|
+
return 0;
|
|
15
|
+
case 'boolean':
|
|
16
|
+
return false;
|
|
17
|
+
case 'null':
|
|
18
|
+
return null;
|
|
19
|
+
case 'timestamp':
|
|
20
|
+
return Timestamp.now();
|
|
21
|
+
case 'geopoint':
|
|
22
|
+
return new GeoPoint(0, 0);
|
|
23
|
+
case 'reference':
|
|
24
|
+
// No default — a fresh reference is invalid until the user
|
|
25
|
+
// sets a path. The validator will surface that.
|
|
26
|
+
return { path: '', id: '', firestore: {} };
|
|
27
|
+
case 'bytes':
|
|
28
|
+
return Bytes.fromUint8Array(new Uint8Array());
|
|
29
|
+
case 'vector':
|
|
30
|
+
// The wire-sentinel both inferType and the vector editor speak.
|
|
31
|
+
return { __type__: '__vector__', value: [] };
|
|
32
|
+
case 'map':
|
|
33
|
+
case 'array':
|
|
34
|
+
return undefined; // children carry the value
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/firestore/reducers/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC;QACX,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,WAAW;YACd,OAAO,SAAS,CAAC,GAAG,EAAE,CAAC;QACzB,KAAK,UAAU;YACb,OAAO,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,KAAK,WAAW;YACd,2DAA2D;YAC3D,gDAAgD;YAChD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAC7C,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;QAChD,KAAK,QAAQ;YACX,gEAAgE;YAChE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC/C,KAAK,KAAK,CAAC;QACX,KAAK,OAAO;YACV,OAAO,SAAS,CAAC,CAAC,2BAA2B;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DocumentEditorAction, DocumentEditorState } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rehydrate serialized Firestore values back into class instances. Over a
|
|
4
|
+
* worker / postMessage boundary, a Timestamp/GeoPoint loses its class and
|
|
5
|
+
* arrives as a plain `{ seconds, nanoseconds }` / `{ latitude, longitude }`;
|
|
6
|
+
* the editor's validators check `instanceof`, so without this the editor opens
|
|
7
|
+
* with false "Expected a Timestamp/GeoPoint" errors. Vectors stay as their wire
|
|
8
|
+
* sentinel (there is no Vector constructor; the editor speaks the sentinel).
|
|
9
|
+
* The prototype guard stops the recursion from walking INTO instances and
|
|
10
|
+
* shredding them into plain maps.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rehydrateFirestoreValues(value: unknown): unknown;
|
|
13
|
+
/** Initial state factory. Builds tree + initial snapshot + error count. */
|
|
14
|
+
export declare function initState(initial: Record<string, unknown>): DocumentEditorState;
|
|
15
|
+
/**
|
|
16
|
+
* Pure reducer. Every action returns a fresh state — no in-place
|
|
17
|
+
* mutation of `state.tree`. Validation re-runs after the structural
|
|
18
|
+
* change so `errorCount` is always current. Container nodes (map /
|
|
19
|
+
* array) ignore actions that don't apply to them rather than
|
|
20
|
+
* throwing; the components only render valid affordances per type.
|
|
21
|
+
*/
|
|
22
|
+
export declare function reducer(state: DocumentEditorState, action: DocumentEditorAction): DocumentEditorState;
|
|
23
|
+
//# sourceMappingURL=documentEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentEditor.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/documentEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAGpB,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmBhE;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,mBAAmB,CAI/E;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,oBAAoB,GAC3B,mBAAmB,CAkDrB"}
|