@pyric/ui 0.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +51 -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 +60 -0
- package/dist/firestore/components/DocumentList.d.ts.map +1 -0
- package/dist/firestore/components/DocumentList.js +39 -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 +28 -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 +58 -0
- package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentEditor.js +68 -0
- package/dist/firestore/hooks/useDocumentEditor.js.map +1 -0
- package/dist/firestore/hooks/useDocumentList.d.ts +45 -0
- package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -0
- package/dist/firestore/hooks/useDocumentList.js +112 -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 +35 -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 +34 -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 +20 -0
- package/dist/firestore/index.d.ts.map +1 -0
- package/dist/firestore/index.js +28 -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 +199 -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 +112 -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/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/index.d.ts +10 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +10 -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 +103 -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 +31 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -0
- package/dist/rtdb/hooks/useRtdbTree.js +49 -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 +44 -0
- package/dist/rtdb/values.d.ts.map +1 -0
- package/dist/rtdb/values.js +143 -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 +68 -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 +75 -0
- package/dist/storage/components/ObjectBrowser.d.ts.map +1 -0
- package/dist/storage/components/ObjectBrowser.js +59 -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 +14 -0
- package/dist/storage/folderPlaceholder.d.ts.map +1 -0
- package/dist/storage/folderPlaceholder.js +27 -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 +109 -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 +73 -0
- package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageDelete.js +114 -0
- package/dist/storage/hooks/useStorageDelete.js.map +1 -0
- package/dist/storage/hooks/useStorageList.d.ts +74 -0
- package/dist/storage/hooks/useStorageList.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageList.js +167 -0
- package/dist/storage/hooks/useStorageList.js.map +1 -0
- package/dist/storage/hooks/useStorageObject.d.ts +34 -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 +128 -0
- package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -0
- package/dist/storage/hooks/useStorageRulesGate.js +158 -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 +73 -0
- package/dist/storage/pendingPrefixes.d.ts.map +1 -0
- package/dist/storage/pendingPrefixes.js +98 -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 +13 -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 +18 -0
- package/dist/traffic/components/TrafficGroupRow.js.map +1 -0
- package/dist/traffic/components/TrafficLineChart.d.ts +34 -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 +81 -0
- package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -0
- package/dist/traffic/components/TrafficTimeline.js +72 -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 +116 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function StringDisplay({ value, path }) {
|
|
3
|
+
return (_jsx("span", { "data-pyric-field-type": "string", "data-pyric-field-path": path, children: value }));
|
|
4
|
+
}
|
|
5
|
+
function StringEdit({ value, onChange, error, path }) {
|
|
6
|
+
return (_jsxs("label", { "data-pyric-field-type": "string", "data-pyric-field-path": path, "data-pyric-error": error ? '' : undefined, children: [_jsx("input", { type: "text", value: value, onChange: (e) => onChange(e.target.value), "aria-invalid": error ? 'true' : undefined }), error ? _jsx("span", { "data-pyric-error-message": true, children: error }) : null] }));
|
|
7
|
+
}
|
|
8
|
+
export const stringEditor = {
|
|
9
|
+
type: 'string',
|
|
10
|
+
Display: StringDisplay,
|
|
11
|
+
Edit: StringEdit,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/string.tsx"],"names":[],"mappings":";AAEA,SAAS,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAA6B;IAC/D,OAAO,CACL,wCAA4B,QAAQ,2BAAwB,IAAI,YAC7D,KAAK,GACD,CACR,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAA0B;IAC1E,OAAO,CACL,0CACwB,QAAQ,2BACP,IAAI,sBACT,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aAExC,gBACE,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,kBAC3B,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GACxC,EACD,KAAK,CAAC,CAAC,CAAC,2DAAgC,KAAK,GAAQ,CAAC,CAAC,CAAC,IAAI,IACvD,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAgC;IACvD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.d.ts","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/timestamp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAqC,MAAM,YAAY,CAAC;AAqEzF,eAAO,MAAM,eAAe,EAAE,mBAAmB,CAAC,SAAS,CAI1D,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Timestamp } from 'pyric/firestore';
|
|
3
|
+
/**
|
|
4
|
+
* Coerce a Timestamp value to a Date. Real instances use `.toDate()`; a value
|
|
5
|
+
* that crossed a worker / postMessage boundary arrives as a plain
|
|
6
|
+
* `{ seconds, nanoseconds }` (or `{ _seconds, _nanoseconds }`) and is rebuilt
|
|
7
|
+
* here, so the display + editor work in both in-process and served modes.
|
|
8
|
+
*/
|
|
9
|
+
function coerceDate(value) {
|
|
10
|
+
if (value instanceof Timestamp)
|
|
11
|
+
return value.toDate();
|
|
12
|
+
const o = value;
|
|
13
|
+
const seconds = o ? (o.seconds ?? o._seconds) : undefined;
|
|
14
|
+
const nanoseconds = o ? (o.nanoseconds ?? o._nanoseconds ?? 0) : 0;
|
|
15
|
+
if (typeof seconds === 'number')
|
|
16
|
+
return new Date(seconds * 1000 + Math.floor(nanoseconds / 1e6));
|
|
17
|
+
return new Date(NaN);
|
|
18
|
+
}
|
|
19
|
+
function TimestampDisplay({ value, path }) {
|
|
20
|
+
const date = coerceDate(value);
|
|
21
|
+
const iso = Number.isNaN(date.getTime()) ? '' : date.toISOString();
|
|
22
|
+
return (_jsx("time", { dateTime: iso, "data-pyric-field-type": "timestamp", "data-pyric-field-path": path, children: iso }));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Native `<input type="datetime-local">` for editing. The element
|
|
26
|
+
* speaks local time (no zone offset); we convert to/from a UTC
|
|
27
|
+
* `Timestamp` at the boundary so the underlying value stays
|
|
28
|
+
* timezone-correct.
|
|
29
|
+
*/
|
|
30
|
+
function TimestampEdit({ value, onChange, error, path }) {
|
|
31
|
+
// Convert the value to the `YYYY-MM-DDTHH:MM` shape <input
|
|
32
|
+
// datetime-local> wants. Seconds and millis aren't part of the
|
|
33
|
+
// native input precision; round-trips through this editor lose
|
|
34
|
+
// sub-minute resolution intentionally — consumers needing higher
|
|
35
|
+
// fidelity should swap the editor out via the registry.
|
|
36
|
+
const dt = coerceDate(value);
|
|
37
|
+
const local = new Date(dt.getTime() - dt.getTimezoneOffset() * 60_000);
|
|
38
|
+
const inputValue = Number.isNaN(local.getTime()) ? '' : local.toISOString().slice(0, 16);
|
|
39
|
+
return (_jsxs("label", { "data-pyric-field-type": "timestamp", "data-pyric-field-path": path, "data-pyric-error": error ? '' : undefined, children: [_jsx("input", { type: "datetime-local", value: inputValue, onChange: (e) => {
|
|
40
|
+
const next = e.target.value;
|
|
41
|
+
if (!next)
|
|
42
|
+
return;
|
|
43
|
+
const localDate = new Date(next);
|
|
44
|
+
onChange(Timestamp.fromDate(localDate));
|
|
45
|
+
}, "aria-invalid": error ? 'true' : undefined }), error ? _jsx("span", { "data-pyric-error-message": true, children: error }) : null] }));
|
|
46
|
+
}
|
|
47
|
+
export const timestampEditor = {
|
|
48
|
+
type: 'timestamp',
|
|
49
|
+
Display: TimestampDisplay,
|
|
50
|
+
Edit: TimestampEdit,
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=timestamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { FieldType } from '../types.js';
|
|
3
|
+
export interface FieldDisplayProps<V = unknown> {
|
|
4
|
+
/** Value to display. The component's `V` generic narrows this. */
|
|
5
|
+
value: V;
|
|
6
|
+
/** Dotted/bracketed path from the document root, e.g. `users.alice`
|
|
7
|
+
* or `tags[0]`. Forwarded so consumer styles can target nested
|
|
8
|
+
* positions via `[data-field-path="users.alice"]`. */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** Recursive editors (Map, Array) need the registry to dispatch
|
|
11
|
+
* on their children. Leaf editors (String, Number, …) can ignore
|
|
12
|
+
* this prop. Required-but-optional because the consumer of the
|
|
13
|
+
* component (`<FieldRenderer>`, `<DocumentPreview>`) always
|
|
14
|
+
* threads it through. */
|
|
15
|
+
fieldEditors?: FieldEditorRegistry;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Props passed to a per-type `Edit` component. The leaf editors
|
|
19
|
+
* (string, number, …) consume this directly. Map/array editing is
|
|
20
|
+
* handled by the `<DocumentEditor>` compound component itself, not
|
|
21
|
+
* by individual editors — Firestore's container shapes are special
|
|
22
|
+
* enough that pushing them through the registry costs more than
|
|
23
|
+
* it's worth.
|
|
24
|
+
*/
|
|
25
|
+
export interface FieldEditProps<V = unknown> {
|
|
26
|
+
/** Current value. */
|
|
27
|
+
value: V;
|
|
28
|
+
/** Commit a new value. The hook wires this to the reducer's
|
|
29
|
+
* `setValue` action. */
|
|
30
|
+
onChange: (next: V) => void;
|
|
31
|
+
/** Validation error attached by the reducer. Editors render it
|
|
32
|
+
* inline alongside the input. */
|
|
33
|
+
error?: string;
|
|
34
|
+
/** Dotted/bracketed path from the document root. */
|
|
35
|
+
path?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Contract for one Firestore value type. `Display` (read-mode) is
|
|
39
|
+
* required; `Edit` + `validate` + `defaultValue` are required for
|
|
40
|
+
* leaf types that participate in M3's editor. Map/array contracts
|
|
41
|
+
* supply only `Display` — their edit affordances come from the
|
|
42
|
+
* `<DocumentEditor>` compound component.
|
|
43
|
+
*/
|
|
44
|
+
export interface FieldEditorContract<V = unknown> {
|
|
45
|
+
type: FieldType;
|
|
46
|
+
Display: ComponentType<FieldDisplayProps<V>>;
|
|
47
|
+
Edit?: ComponentType<FieldEditProps<V>>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Map of field-type to editor contract. `Partial<…>` so consumers
|
|
51
|
+
* can override one type without re-supplying the rest — the merge
|
|
52
|
+
* happens at the `<DocumentPreview>` boundary.
|
|
53
|
+
*
|
|
54
|
+
* The stored value type is `FieldEditorContract<any>` rather than
|
|
55
|
+
* `FieldEditorContract<unknown>` because each per-type contract
|
|
56
|
+
* narrows its generic (e.g., `FieldEditorContract<Timestamp>` for
|
|
57
|
+
* timestamp) and TypeScript's `ComponentType` is invariant in
|
|
58
|
+
* props. `any` at the registry layer means the type-safety lives
|
|
59
|
+
* at the per-contract definition site, not in the dispatch map.
|
|
60
|
+
* `FieldRenderer` narrows back from `unknown` -> the right contract
|
|
61
|
+
* via `inferType` at dispatch time.
|
|
62
|
+
*/
|
|
63
|
+
export type FieldEditorRegistry = Partial<Record<FieldType, FieldEditorContract<any>>>;
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,kEAAkE;IAClE,KAAK,EAAE,CAAC,CAAC;IACT;;2DAEuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;8BAI0B;IAC1B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,qBAAqB;IACrB,KAAK,EAAE,CAAC,CAAC;IACT;6BACyB;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B;sCACkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type VectorView } from '../types.js';
|
|
2
|
+
import type { FieldEditorContract } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Result of parsing the raw-replace textarea. `ok` carries the new
|
|
5
|
+
* wire-sentinel value to commit; otherwise `error` is a human message.
|
|
6
|
+
* Exported (and pure) so the parse/validation contract is unit-testable
|
|
7
|
+
* without the JSDOM text-input event path, which is broken under this
|
|
8
|
+
* repo's bun:test + JSDOM setup (see DocumentEditor.test.tsx note).
|
|
9
|
+
*/
|
|
10
|
+
export type ParsedVectorInput = {
|
|
11
|
+
ok: true;
|
|
12
|
+
value: {
|
|
13
|
+
__type__: '__vector__';
|
|
14
|
+
value: number[];
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
ok: false;
|
|
18
|
+
error: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Parse the textarea contents into a wire-sentinel vector, or an error.
|
|
22
|
+
* Accepts only a JSON array of numbers — the whole-value replace
|
|
23
|
+
* contract. Anything else (bad JSON, non-array, non-numeric element)
|
|
24
|
+
* is rejected and the previous value is kept by the caller.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseVectorInput(text: string): ParsedVectorInput;
|
|
27
|
+
export declare const vectorEditor: FieldEditorContract<unknown>;
|
|
28
|
+
export type { VectorView };
|
|
29
|
+
//# sourceMappingURL=vector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/vector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAqC,MAAM,YAAY,CAAC;AA+CzF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,GAChE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAWhE;AA0DD,eAAO,MAAM,YAAY,EAAE,mBAAmB,CAAC,OAAO,CAIrD,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { asVectorView } from '../types.js';
|
|
4
|
+
/** How many leading components to show in the truncated preview. The
|
|
5
|
+
* mock (`c-data.html`) renders four then an ellipsis. */
|
|
6
|
+
const PREVIEW_COUNT = 4;
|
|
7
|
+
/**
|
|
8
|
+
* Render a `[a, b, c, … ]` preview of the first {@link PREVIEW_COUNT}
|
|
9
|
+
* components. A vector that's already short enough is shown in full
|
|
10
|
+
* without the trailing ellipsis.
|
|
11
|
+
*/
|
|
12
|
+
function previewText(values) {
|
|
13
|
+
if (values.length <= PREVIEW_COUNT) {
|
|
14
|
+
return `[${values.join(', ')}]`;
|
|
15
|
+
}
|
|
16
|
+
const head = values.slice(0, PREVIEW_COUNT).join(', ');
|
|
17
|
+
return `[${head}, …]`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Read view for a vector (embedding). Mirrors the mock: a
|
|
21
|
+
* `vector · <dims>` type chip plus a truncated value preview. The full
|
|
22
|
+
* 768-float array is never rendered inline — it's noise and a perf
|
|
23
|
+
* hazard. `data-dimension` carries the dimension for styling/queries.
|
|
24
|
+
*/
|
|
25
|
+
function VectorDisplay({ value, path }) {
|
|
26
|
+
const view = asVectorView(value);
|
|
27
|
+
if (!view) {
|
|
28
|
+
// Should be unreachable: the renderer only dispatches here when
|
|
29
|
+
// `inferType` already classified the value as `vector`. Render a
|
|
30
|
+
// defensive empty marker rather than throwing.
|
|
31
|
+
return (_jsx("span", { "data-pyric-field-type": "vector", "data-pyric-field-path": path }));
|
|
32
|
+
}
|
|
33
|
+
return (_jsxs("span", { "data-pyric-field-type": "vector", "data-pyric-field-path": path, "data-dimension": String(view.dimension), children: [_jsx("span", { "data-pyric-vector-dims": true, children: `vector · ${view.dimension}` }), _jsx("span", { "data-pyric-vector-preview": true, children: previewText(view.values) })] }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse the textarea contents into a wire-sentinel vector, or an error.
|
|
37
|
+
* Accepts only a JSON array of numbers — the whole-value replace
|
|
38
|
+
* contract. Anything else (bad JSON, non-array, non-numeric element)
|
|
39
|
+
* is rejected and the previous value is kept by the caller.
|
|
40
|
+
*/
|
|
41
|
+
export function parseVectorInput(text) {
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = JSON.parse(text);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return { ok: false, error: 'Invalid JSON' };
|
|
48
|
+
}
|
|
49
|
+
if (!Array.isArray(parsed) || !parsed.every((n) => typeof n === 'number')) {
|
|
50
|
+
return { ok: false, error: 'Expected a JSON array of numbers' };
|
|
51
|
+
}
|
|
52
|
+
return { ok: true, value: { __type__: '__vector__', value: parsed } };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Edit affordance for a vector. Deliberately NOT a per-element grid —
|
|
56
|
+
* a 768-dim embedding isn't hand-tuned float by float. The contract is
|
|
57
|
+
* "replace the whole value": paste a JSON number array and commit. The
|
|
58
|
+
* dimension + a note are shown so the editor is honest about what it is.
|
|
59
|
+
*
|
|
60
|
+
* On commit, we emit the value back in the same wire-sentinel shape the
|
|
61
|
+
* read side already understands (`{__type__:'__vector__', value}`), so a
|
|
62
|
+
* round-trip through `inferType` re-classifies it as `vector`. Invalid
|
|
63
|
+
* JSON / non-numeric input leaves the previous value in place (same
|
|
64
|
+
* forgiving stance as the bytes + geopoint editors).
|
|
65
|
+
*/
|
|
66
|
+
function VectorEdit({ value, onChange, error, path }) {
|
|
67
|
+
const view = asVectorView(value);
|
|
68
|
+
const initial = view ? JSON.stringify(view.values) : '[]';
|
|
69
|
+
const [draft, setDraft] = useState(initial);
|
|
70
|
+
const [parseError, setParseError] = useState(undefined);
|
|
71
|
+
const commit = (text) => {
|
|
72
|
+
setDraft(text);
|
|
73
|
+
const result = parseVectorInput(text);
|
|
74
|
+
if (!result.ok) {
|
|
75
|
+
setParseError(result.error);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setParseError(undefined);
|
|
79
|
+
// Re-emit in the wire-sentinel shape so the read side + inferType
|
|
80
|
+
// recognize it as a vector again without depending on a backend
|
|
81
|
+
// VectorValue class being importable here.
|
|
82
|
+
onChange(result.value);
|
|
83
|
+
};
|
|
84
|
+
const dims = view ? view.dimension : 0;
|
|
85
|
+
const shown = parseError ?? error;
|
|
86
|
+
return (_jsxs("label", { "data-pyric-field-type": "vector", "data-pyric-field-path": path, "data-dimension": String(dims), "data-pyric-error": shown ? '' : undefined, children: [_jsx("span", { "data-pyric-vector-dims": true, children: `vector · ${dims}` }), _jsx("span", { "data-pyric-vector-note": true, children: "Replace whole. Paste a JSON number array." }), _jsx("textarea", { "data-pyric-vector-raw": true, value: draft, onChange: (e) => commit(e.target.value), "aria-invalid": shown ? 'true' : undefined, "aria-label": "Vector value (JSON number array)" }), shown ? _jsx("span", { "data-pyric-error-message": true, children: shown }) : null] }));
|
|
87
|
+
}
|
|
88
|
+
export const vectorEditor = {
|
|
89
|
+
type: 'vector',
|
|
90
|
+
Display: VectorDisplay,
|
|
91
|
+
Edit: VectorEdit,
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=vector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.js","sourceRoot":"","sources":["../../../src/firestore/fieldEditors/vector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAG5D;0DAC0D;AAC1D,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAS,WAAW,CAAC,MAAgB;IACnC,IAAI,MAAM,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC;QACnC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAClC,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,IAAI,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,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,kBACzB,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,gBAC7B,kCAAkC,GAC7C,EACD,KAAK,CAAC,CAAC,CAAC,2DAAgC,KAAK,GAAQ,CAAC,CAAC,CAAC,IAAI,IACvD,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiC;IACxD,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,UAAU;CACjB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The modular Firestore functions the data hooks call, as an INJECTABLE bundle.
|
|
4
|
+
*
|
|
5
|
+
* WHY: the hooks default to the in-process `pyric/firestore` API, but Pyric
|
|
6
|
+
* Studio's served mode drives the SAME ops over a SharedWorker via a PARALLEL
|
|
7
|
+
* modular client (`pyric-tools/serve/worker`: its own `collection`/`getDocs`/...
|
|
8
|
+
* over a `MessagePort`, and a `ClientDb` that is not a `pyric/firestore`
|
|
9
|
+
* `Firestore`). Statically importing the in-process fns hardwires the hooks to
|
|
10
|
+
* the in-page sandbox; reading them from this context lets a consumer inject the
|
|
11
|
+
* worker client's fns so the hooks operate on the live worker backend without
|
|
12
|
+
* the hooks (or the components) knowing which backend they hit.
|
|
13
|
+
*
|
|
14
|
+
* The bundle is typed to the in-process signatures. A worker bundle is adapted
|
|
15
|
+
* (cast) to this shape at the Studio boundary: the worker handles + snapshots
|
|
16
|
+
* are runtime-compatible at the surface the hooks use (`.id` / `.data()` /
|
|
17
|
+
* `.docs` / `.ref`), which is the contract function-injection relies on.
|
|
18
|
+
*
|
|
19
|
+
* Default = the real `pyric/firestore` fns, so every existing consumer (the
|
|
20
|
+
* dev-seed review build, tests, any app embedding `@pyric/ui`) is unchanged: no
|
|
21
|
+
* provider needed unless you are swapping the backend.
|
|
22
|
+
*/
|
|
23
|
+
export type FirestoreApi = Pick<typeof import('pyric/firestore'), 'addDoc' | 'collection' | 'deleteDoc' | 'doc' | 'getDoc' | 'getDocs' | 'limit' | 'query' | 'setDoc' | 'startAfter'>;
|
|
24
|
+
/** Read the active Firestore API bundle (defaults to in-process `pyric/firestore`). */
|
|
25
|
+
export declare function useFirestoreApi(): FirestoreApi;
|
|
26
|
+
/**
|
|
27
|
+
* Provide a Firestore API bundle to the subtree. Pyric Studio wraps its data
|
|
28
|
+
* surface with this, supplying the in-process bundle for dev-seed review and the
|
|
29
|
+
* SharedWorker client bundle under `pyric dev --ui`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function FirestoreApiProvider({ value, children, }: {
|
|
32
|
+
value: FirestoreApi;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): import("react").FunctionComponentElement<import("react").ProviderProps<FirestoreApi>>;
|
|
35
|
+
//# sourceMappingURL=firestoreApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestoreApi.d.ts","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAcjF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,cAAc,iBAAiB,CAAC,EAC9B,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,KAAK,GACL,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,YAAY,CACf,CAAC;AAiBF,uFAAuF;AACvF,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,yFAEA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createContext, createElement, useContext } from 'react';
|
|
2
|
+
import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, limit, query, setDoc, startAfter, } from 'pyric/firestore';
|
|
3
|
+
const inProcessFirestoreApi = {
|
|
4
|
+
addDoc,
|
|
5
|
+
collection,
|
|
6
|
+
deleteDoc,
|
|
7
|
+
doc,
|
|
8
|
+
getDoc,
|
|
9
|
+
getDocs,
|
|
10
|
+
limit,
|
|
11
|
+
query,
|
|
12
|
+
setDoc,
|
|
13
|
+
startAfter,
|
|
14
|
+
};
|
|
15
|
+
const FirestoreApiContext = createContext(inProcessFirestoreApi);
|
|
16
|
+
/** Read the active Firestore API bundle (defaults to in-process `pyric/firestore`). */
|
|
17
|
+
export function useFirestoreApi() {
|
|
18
|
+
return useContext(FirestoreApiContext);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Provide a Firestore API bundle to the subtree. Pyric Studio wraps its data
|
|
22
|
+
* surface with this, supplying the in-process bundle for dev-seed review and the
|
|
23
|
+
* SharedWorker client bundle under `pyric dev --ui`.
|
|
24
|
+
*/
|
|
25
|
+
export function FirestoreApiProvider({ value, children, }) {
|
|
26
|
+
return createElement(FirestoreApiContext.Provider, { value }, children);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=firestoreApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestoreApi.js","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AACjF,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,GAAG,EACH,MAAM,EACN,OAAO,EACP,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,GACX,MAAM,iBAAiB,CAAC;AAqCzB,MAAM,qBAAqB,GAAiB;IAC1C,MAAM;IACN,UAAU;IACV,SAAS;IACT,GAAG;IACH,MAAM;IACN,OAAO;IACP,KAAK;IACL,KAAK;IACL,MAAM;IACN,UAAU;CACX,CAAC;AAEF,MAAM,mBAAmB,GAAG,aAAa,CAAe,qBAAqB,CAAC,CAAC;AAE/E,uFAAuF;AACvF,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GAIT;IACC,OAAO,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coerce an arbitrary thrown value into an `Error` with a useful
|
|
3
|
+
* `.message`. The naive `new Error(String(err))` produces the literal
|
|
4
|
+
* string `"[object Object]"` when `err` is a non-Error object shape
|
|
5
|
+
* — which is exactly what Firestore's `onSnapshot` error callback
|
|
6
|
+
* receives for `FirestoreError`-like values (`{ code, message, …}`).
|
|
7
|
+
*
|
|
8
|
+
* Strategy:
|
|
9
|
+
* - `Error` → returned unchanged.
|
|
10
|
+
* - `string` → `new Error(value)`.
|
|
11
|
+
* - `{ message }` → `new Error(message)` (preserves Firestore's
|
|
12
|
+
* stringified message), with `code` appended when present.
|
|
13
|
+
* - anything else → `new Error(JSON.stringify(value))` (no more
|
|
14
|
+
* "[object Object]").
|
|
15
|
+
*/
|
|
16
|
+
export declare function coerceError(value: unknown): Error;
|
|
17
|
+
//# sourceMappingURL=coerceError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerceError.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/coerceError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAkBjD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coerce an arbitrary thrown value into an `Error` with a useful
|
|
3
|
+
* `.message`. The naive `new Error(String(err))` produces the literal
|
|
4
|
+
* string `"[object Object]"` when `err` is a non-Error object shape
|
|
5
|
+
* — which is exactly what Firestore's `onSnapshot` error callback
|
|
6
|
+
* receives for `FirestoreError`-like values (`{ code, message, …}`).
|
|
7
|
+
*
|
|
8
|
+
* Strategy:
|
|
9
|
+
* - `Error` → returned unchanged.
|
|
10
|
+
* - `string` → `new Error(value)`.
|
|
11
|
+
* - `{ message }` → `new Error(message)` (preserves Firestore's
|
|
12
|
+
* stringified message), with `code` appended when present.
|
|
13
|
+
* - anything else → `new Error(JSON.stringify(value))` (no more
|
|
14
|
+
* "[object Object]").
|
|
15
|
+
*/
|
|
16
|
+
export function coerceError(value) {
|
|
17
|
+
if (value instanceof Error)
|
|
18
|
+
return value;
|
|
19
|
+
if (typeof value === 'string')
|
|
20
|
+
return new Error(value);
|
|
21
|
+
if (value && typeof value === 'object') {
|
|
22
|
+
const obj = value;
|
|
23
|
+
const msg = typeof obj.message === 'string' ? obj.message : null;
|
|
24
|
+
const code = typeof obj.code === 'string' ? obj.code : null;
|
|
25
|
+
if (msg && code)
|
|
26
|
+
return new Error(`[${code}] ${msg}`);
|
|
27
|
+
if (msg)
|
|
28
|
+
return new Error(msg);
|
|
29
|
+
if (code)
|
|
30
|
+
return new Error(code);
|
|
31
|
+
try {
|
|
32
|
+
return new Error(JSON.stringify(value));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Cyclic objects — bail to a type tag rather than crash.
|
|
36
|
+
return new Error(Object.prototype.toString.call(value));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return new Error(String(value));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=coerceError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerceError.js","sourceRoot":"","sources":["../../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SubscriptionState } from './useFirestoreDoc.js';
|
|
2
|
+
export { useFirestoreCollection } from './useFirestoreCollection.js';
|
|
3
|
+
export { useDocumentEditor, type UseDocumentEditorOptions, type UseDocumentEditorResult, } from './useDocumentEditor.js';
|
|
4
|
+
export { useCollectionList, type UseCollectionListOptions, type UseCollectionListResult, } from './useCollectionList.js';
|
|
5
|
+
export { useDocumentList, type UseDocumentListOptions, type UseDocumentListResult, } from './useDocumentList.js';
|
|
6
|
+
export { useDocumentSubcollections, type ListSubcollections, type UseDocumentSubcollectionsOptions, type UseDocumentSubcollectionsResult, } from './useDocumentSubcollections.js';
|
|
7
|
+
export { useRecursiveDelete, type RecursiveDeleteImpl, type RecursiveDeleteProgress, type UseRecursiveDeleteResult, } from './useRecursiveDelete.js';
|
|
8
|
+
export { useReferencePicker, type BrowseLocation, type UseReferencePickerOptions, type UseReferencePickerResult, } from './useReferencePicker.js';
|
|
9
|
+
export { useQueryBuilder, QUERY_OPS, MULTI_VALUE_OPS, type QueryOp, type QueryCondition, type QueryBuilderState, type QueryBuilderActions, type UseQueryBuilderOptions, type UseQueryBuilderResult, } from './useQueryBuilder.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,GACrC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,SAAS,EACT,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useFirestoreDoc } from './useFirestoreDoc.js';
|
|
2
|
+
export { useFirestoreCollection } from './useFirestoreCollection.js';
|
|
3
|
+
export { useDocumentEditor, } from './useDocumentEditor.js';
|
|
4
|
+
export { useCollectionList, } from './useCollectionList.js';
|
|
5
|
+
export { useDocumentList, } from './useDocumentList.js';
|
|
6
|
+
export { useDocumentSubcollections, } from './useDocumentSubcollections.js';
|
|
7
|
+
export { useRecursiveDelete, } from './useRecursiveDelete.js';
|
|
8
|
+
export { useReferencePicker, } from './useReferencePicker.js';
|
|
9
|
+
export { useQueryBuilder, QUERY_OPS, MULTI_VALUE_OPS, } from './useQueryBuilder.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/firestore/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA0B,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,iBAAiB,GAGlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,GAGlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,yBAAyB,GAI1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,GAInB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,GAInB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,SAAS,EACT,eAAe,GAOhB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type CollectionReference, type DocumentReference, type Firestore } from 'pyric/firestore';
|
|
2
|
+
export interface UseCollectionListOptions {
|
|
3
|
+
firestore: Firestore;
|
|
4
|
+
/** Parent document, or `null`/`undefined` for root collections. */
|
|
5
|
+
parent?: DocumentReference | null;
|
|
6
|
+
/**
|
|
7
|
+
* Injected collection-listing function. The library doesn't ship
|
|
8
|
+
* a default — the modular Web SDK doesn't expose `listCollections`
|
|
9
|
+
* on the client. Sandbox-backed apps usually wire
|
|
10
|
+
* `pyric/sandbox`'s in-process listing; production apps either
|
|
11
|
+
* pass a known list (e.g. from a schema) or call a server proxy.
|
|
12
|
+
*/
|
|
13
|
+
listCollections: (firestore: Firestore, parent: DocumentReference | null | undefined) => Promise<CollectionReference[]>;
|
|
14
|
+
}
|
|
15
|
+
export interface UseCollectionListResult {
|
|
16
|
+
collections: CollectionReference[];
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
error: Error | undefined;
|
|
19
|
+
/** Re-run the listing function. */
|
|
20
|
+
refresh: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new collection by writing its first document. Firestore
|
|
23
|
+
* collections don't exist independently of their documents —
|
|
24
|
+
* `setDoc` on the first child path materializes the collection.
|
|
25
|
+
*/
|
|
26
|
+
createCollection: (collectionId: string, firstDoc: {
|
|
27
|
+
id: string;
|
|
28
|
+
data: Record<string, unknown>;
|
|
29
|
+
}) => Promise<DocumentReference>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Operational read + create for collections under a parent (or root).
|
|
33
|
+
* Listing is injected because the modular Web SDK doesn't expose a
|
|
34
|
+
* native `listCollections` on the client — see options docs.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useCollectionList({ firestore, parent, listCollections, }: UseCollectionListOptions): UseCollectionListResult;
|
|
37
|
+
//# sourceMappingURL=useCollectionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCollectionList.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useCollectionList.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,SAAS,CAAC;IACrB,mEAAmE;IACnE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,eAAe,EAAE,CACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,KACzC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,EAAE,CAChB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KACpD,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,eAAe,GAChB,EAAE,wBAAwB,GAAG,uBAAuB,CAgDpD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { collection as collFn, doc as docFn, setDoc, } from 'pyric/firestore';
|
|
3
|
+
/**
|
|
4
|
+
* Operational read + create for collections under a parent (or root).
|
|
5
|
+
* Listing is injected because the modular Web SDK doesn't expose a
|
|
6
|
+
* native `listCollections` on the client — see options docs.
|
|
7
|
+
*/
|
|
8
|
+
export function useCollectionList({ firestore, parent, listCollections, }) {
|
|
9
|
+
const [collections, setCollections] = useState([]);
|
|
10
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
11
|
+
const [error, setError] = useState(undefined);
|
|
12
|
+
const [tick, setTick] = useState(0);
|
|
13
|
+
// Stable-ref the injected lister so re-renders with a fresh
|
|
14
|
+
// closure identity don't loop the effect — see useReferencePicker
|
|
15
|
+
// for the same pattern + rationale.
|
|
16
|
+
const listCollectionsRef = useRef(listCollections);
|
|
17
|
+
listCollectionsRef.current = listCollections;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
setIsLoading(true);
|
|
21
|
+
setError(undefined);
|
|
22
|
+
listCollectionsRef.current(firestore, parent)
|
|
23
|
+
.then((list) => {
|
|
24
|
+
if (cancelled)
|
|
25
|
+
return;
|
|
26
|
+
setCollections(list);
|
|
27
|
+
setIsLoading(false);
|
|
28
|
+
})
|
|
29
|
+
.catch((e) => {
|
|
30
|
+
if (cancelled)
|
|
31
|
+
return;
|
|
32
|
+
setError(e instanceof Error ? e : new Error(String(e)));
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
cancelled = true;
|
|
37
|
+
};
|
|
38
|
+
}, [firestore, parent, tick]);
|
|
39
|
+
const refresh = useCallback(() => setTick((n) => n + 1), []);
|
|
40
|
+
const createCollection = useCallback(async (collectionId, firstDoc) => {
|
|
41
|
+
const parentColl = parent
|
|
42
|
+
? collFn(parent, collectionId)
|
|
43
|
+
: collFn(firestore, collectionId);
|
|
44
|
+
const ref = docFn(parentColl, firstDoc.id);
|
|
45
|
+
await setDoc(ref, firstDoc.data);
|
|
46
|
+
setTick((n) => n + 1);
|
|
47
|
+
return ref;
|
|
48
|
+
}, [firestore, parent]);
|
|
49
|
+
return { collections, isLoading, error, refresh, createCollection };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=useCollectionList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCollectionList.js","sourceRoot":"","sources":["../../../src/firestore/hooks/useCollectionList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,GAAG,IAAI,KAAK,EACZ,MAAM,GAIP,MAAM,iBAAiB,CAAC;AAoCzB;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,MAAM,EACN,eAAe,GACU;IACzB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAoB,SAAS,CAAC,CAAC;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpC,4DAA4D;IAC5D,kEAAkE;IAClE,oCAAoC;IACpC,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;IACnD,kBAAkB,C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