@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,28 @@
|
|
|
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 { defaultFieldEditors, mergeFieldEditors, } from './fieldEditors/registry.js';
|
|
8
|
+
export { FieldRenderer } from './components/FieldRenderer.js';
|
|
9
|
+
export { DocumentPreview, } from './components/DocumentPreview.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, } from './components/DocumentEditor.js';
|
|
14
|
+
// M4: operational read/write + admin ops
|
|
15
|
+
export { CollectionList } from './components/CollectionList.js';
|
|
16
|
+
export { DocumentList } from './components/DocumentList.js';
|
|
17
|
+
export { DeleteWithConfirm, } from './components/DeleteWithConfirm.js';
|
|
18
|
+
// M5: improvements over firebase-tools-ui
|
|
19
|
+
export { ReferencePicker, } from './components/ReferencePicker.js';
|
|
20
|
+
// M6: query builder + virtualization
|
|
21
|
+
export { QueryBuilder, } from './components/QueryBuilder.js';
|
|
22
|
+
// M7: create-collection / create-document / JSON-import — pure, tested logic.
|
|
23
|
+
// Presentational wiring lives in the consumer (Pyric Studio's FirestorePane)
|
|
24
|
+
// over these + the existing DocumentEditor/hooks, per the disclosure-over-
|
|
25
|
+
// modals design principles.
|
|
26
|
+
export { validateCollectionId, validateDocumentId } from './validation/ids.js';
|
|
27
|
+
export { parseImport, detectCollisions, firestoreAutoId, } from './import/parseImport.js';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|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BAAgB,EAChB,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,CA+CrB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Timestamp, GeoPoint } from 'pyric/firestore';
|
|
2
|
+
import { cloneTree, collectDescendants, treeFromData } from './tree.js';
|
|
3
|
+
import { validateTree } from './validation.js';
|
|
4
|
+
import { defaultValueFor } from './defaults.js';
|
|
5
|
+
import { isTimestampShape, isGeoPointShape, asVectorView } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Rehydrate serialized Firestore values back into class instances. Over a
|
|
8
|
+
* worker / postMessage boundary, a Timestamp/GeoPoint loses its class and
|
|
9
|
+
* arrives as a plain `{ seconds, nanoseconds }` / `{ latitude, longitude }`;
|
|
10
|
+
* the editor's validators check `instanceof`, so without this the editor opens
|
|
11
|
+
* with false "Expected a Timestamp/GeoPoint" errors. Vectors stay as their wire
|
|
12
|
+
* sentinel (there is no Vector constructor; the editor speaks the sentinel).
|
|
13
|
+
* The prototype guard stops the recursion from walking INTO instances and
|
|
14
|
+
* shredding them into plain maps.
|
|
15
|
+
*/
|
|
16
|
+
export function rehydrateFirestoreValues(value) {
|
|
17
|
+
if (value === null || typeof value !== 'object')
|
|
18
|
+
return value;
|
|
19
|
+
if (asVectorView(value) !== null)
|
|
20
|
+
return value; // wire-sentinel vector: leave as-is
|
|
21
|
+
if (isTimestampShape(value)) {
|
|
22
|
+
const o = value;
|
|
23
|
+
return new Timestamp(o.seconds ?? o._seconds ?? 0, o.nanoseconds ?? o._nanoseconds ?? 0);
|
|
24
|
+
}
|
|
25
|
+
if (isGeoPointShape(value)) {
|
|
26
|
+
const o = value;
|
|
27
|
+
return new GeoPoint(o.latitude, o.longitude);
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(value))
|
|
30
|
+
return value.map(rehydrateFirestoreValues);
|
|
31
|
+
const proto = Object.getPrototypeOf(value);
|
|
32
|
+
if (proto === Object.prototype || proto === null) {
|
|
33
|
+
const out = {};
|
|
34
|
+
for (const [k, v] of Object.entries(value))
|
|
35
|
+
out[k] = rehydrateFirestoreValues(v);
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
return value; // a class instance (Timestamp, GeoPoint, DocumentReference, …): leave intact
|
|
39
|
+
}
|
|
40
|
+
/** Initial state factory. Builds tree + initial snapshot + error count. */
|
|
41
|
+
export function initState(initial) {
|
|
42
|
+
const fresh = treeFromData(rehydrateFirestoreValues(initial));
|
|
43
|
+
const { tree, errorCount } = validateTree(fresh);
|
|
44
|
+
return { tree, initial: tree, errorCount };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pure reducer. Every action returns a fresh state — no in-place
|
|
48
|
+
* mutation of `state.tree`. Validation re-runs after the structural
|
|
49
|
+
* change so `errorCount` is always current. Container nodes (map /
|
|
50
|
+
* array) ignore actions that don't apply to them rather than
|
|
51
|
+
* throwing; the components only render valid affordances per type.
|
|
52
|
+
*/
|
|
53
|
+
export function reducer(state, action) {
|
|
54
|
+
switch (action.type) {
|
|
55
|
+
case 'setValue':
|
|
56
|
+
return applyAndValidate(state, (t) => setValue(t, action.nodeId, action.value));
|
|
57
|
+
case 'setType':
|
|
58
|
+
return applyAndValidate(state, (t) => setType(t, action.nodeId, action.newType));
|
|
59
|
+
case 'setKey':
|
|
60
|
+
return applyAndValidate(state, (t) => setKey(t, action.nodeId, action.key));
|
|
61
|
+
case 'addMapEntry':
|
|
62
|
+
return applyAndValidate(state, (t) => addMapEntry(t, action.parentId, action.key, action.childType));
|
|
63
|
+
case 'addArrayEntry':
|
|
64
|
+
return applyAndValidate(state, (t) => addArrayEntry(t, action.parentId, action.childType));
|
|
65
|
+
case 'remove':
|
|
66
|
+
return applyAndValidate(state, (t) => removeNode(t, action.nodeId));
|
|
67
|
+
case 'reset':
|
|
68
|
+
return {
|
|
69
|
+
tree: state.initial,
|
|
70
|
+
initial: state.initial,
|
|
71
|
+
errorCount: countErrors(state.initial),
|
|
72
|
+
};
|
|
73
|
+
case 'touch': {
|
|
74
|
+
const node = state.tree.nodes[action.nodeId];
|
|
75
|
+
if (!node || node.touched)
|
|
76
|
+
return state; // no-op: already touched
|
|
77
|
+
const tree = cloneTree(state.tree);
|
|
78
|
+
tree.nodes[action.nodeId] = { ...tree.nodes[action.nodeId], touched: true };
|
|
79
|
+
return { ...state, tree };
|
|
80
|
+
}
|
|
81
|
+
case 'touchAll': {
|
|
82
|
+
const tree = cloneTree(state.tree);
|
|
83
|
+
for (const id of Object.keys(tree.nodes)) {
|
|
84
|
+
tree.nodes[id] = { ...tree.nodes[id], touched: true };
|
|
85
|
+
}
|
|
86
|
+
return { ...state, tree };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function applyAndValidate(state, mutate) {
|
|
91
|
+
const next = mutate(cloneTree(state.tree));
|
|
92
|
+
const { tree, errorCount } = validateTree(next);
|
|
93
|
+
return { ...state, tree, errorCount };
|
|
94
|
+
}
|
|
95
|
+
function countErrors(tree) {
|
|
96
|
+
let n = 0;
|
|
97
|
+
for (const node of Object.values(tree.nodes)) {
|
|
98
|
+
if (node.error)
|
|
99
|
+
n++;
|
|
100
|
+
}
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Structural transformations. Each takes a cloned tree (mutable here),
|
|
105
|
+
// mutates it, and returns it. validateTree runs in applyAndValidate.
|
|
106
|
+
function setValue(tree, nodeId, value) {
|
|
107
|
+
const node = tree.nodes[nodeId];
|
|
108
|
+
if (!node)
|
|
109
|
+
return tree;
|
|
110
|
+
if (node.type === 'map' || node.type === 'array')
|
|
111
|
+
return tree;
|
|
112
|
+
tree.nodes[nodeId] = { ...node, value };
|
|
113
|
+
return tree;
|
|
114
|
+
}
|
|
115
|
+
function setType(tree, nodeId, newType) {
|
|
116
|
+
const node = tree.nodes[nodeId];
|
|
117
|
+
if (!node)
|
|
118
|
+
return tree;
|
|
119
|
+
// Don't allow switching the root away from `map` — the
|
|
120
|
+
// serializer assumes the root is a map.
|
|
121
|
+
if (node.id === tree.rootId && newType !== 'map')
|
|
122
|
+
return tree;
|
|
123
|
+
if (node.type === newType)
|
|
124
|
+
return tree;
|
|
125
|
+
// If switching away from a container, drop its children.
|
|
126
|
+
if (node.type === 'map' || node.type === 'array') {
|
|
127
|
+
const toRemove = (tree.childIds[nodeId] ?? []).slice();
|
|
128
|
+
for (const childId of toRemove) {
|
|
129
|
+
for (const descId of collectDescendants(tree, childId)) {
|
|
130
|
+
delete tree.nodes[descId];
|
|
131
|
+
delete tree.childIds[descId];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
tree.childIds[nodeId] = [];
|
|
135
|
+
}
|
|
136
|
+
const value = newType === 'map' || newType === 'array' ? undefined : defaultValueFor(newType);
|
|
137
|
+
tree.nodes[nodeId] = { ...node, type: newType, value };
|
|
138
|
+
return tree;
|
|
139
|
+
}
|
|
140
|
+
function setKey(tree, nodeId, key) {
|
|
141
|
+
const node = tree.nodes[nodeId];
|
|
142
|
+
if (!node)
|
|
143
|
+
return tree;
|
|
144
|
+
// Only map children carry a key. Array children's positions come
|
|
145
|
+
// from the parent's child list order.
|
|
146
|
+
if (node.parentId == null)
|
|
147
|
+
return tree; // root has no key
|
|
148
|
+
const parent = tree.nodes[node.parentId];
|
|
149
|
+
if (!parent || parent.type !== 'map')
|
|
150
|
+
return tree;
|
|
151
|
+
tree.nodes[nodeId] = { ...node, key };
|
|
152
|
+
return tree;
|
|
153
|
+
}
|
|
154
|
+
function addMapEntry(tree, parentId, key, childType) {
|
|
155
|
+
const parent = tree.nodes[parentId];
|
|
156
|
+
if (!parent || parent.type !== 'map')
|
|
157
|
+
return tree;
|
|
158
|
+
const id = crypto.randomUUID();
|
|
159
|
+
const value = childType === 'map' || childType === 'array'
|
|
160
|
+
? undefined
|
|
161
|
+
: defaultValueFor(childType);
|
|
162
|
+
tree.nodes[id] = { id, parentId, key, type: childType, value };
|
|
163
|
+
tree.childIds[id] = [];
|
|
164
|
+
tree.childIds[parentId] = [...(tree.childIds[parentId] ?? []), id];
|
|
165
|
+
return tree;
|
|
166
|
+
}
|
|
167
|
+
function addArrayEntry(tree, parentId, childType) {
|
|
168
|
+
const parent = tree.nodes[parentId];
|
|
169
|
+
if (!parent || parent.type !== 'array')
|
|
170
|
+
return tree;
|
|
171
|
+
// Firestore disallows nested arrays — guard at the reducer level.
|
|
172
|
+
if (childType === 'array')
|
|
173
|
+
return tree;
|
|
174
|
+
const id = crypto.randomUUID();
|
|
175
|
+
const value = childType === 'map' ? undefined : defaultValueFor(childType);
|
|
176
|
+
tree.nodes[id] = { id, parentId, key: null, type: childType, value };
|
|
177
|
+
tree.childIds[id] = [];
|
|
178
|
+
tree.childIds[parentId] = [...(tree.childIds[parentId] ?? []), id];
|
|
179
|
+
return tree;
|
|
180
|
+
}
|
|
181
|
+
function removeNode(tree, nodeId) {
|
|
182
|
+
const node = tree.nodes[nodeId];
|
|
183
|
+
if (!node)
|
|
184
|
+
return tree;
|
|
185
|
+
// Removing the root is forbidden — it would invalidate the
|
|
186
|
+
// serializer.
|
|
187
|
+
if (node.id === tree.rootId)
|
|
188
|
+
return tree;
|
|
189
|
+
const ids = collectDescendants(tree, nodeId);
|
|
190
|
+
for (const id of ids) {
|
|
191
|
+
delete tree.nodes[id];
|
|
192
|
+
delete tree.childIds[id];
|
|
193
|
+
}
|
|
194
|
+
if (node.parentId != null) {
|
|
195
|
+
tree.childIds[node.parentId] = (tree.childIds[node.parentId] ?? []).filter((id) => id !== nodeId);
|
|
196
|
+
}
|
|
197
|
+
return tree;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=documentEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentEditor.js","sourceRoot":"","sources":["../../../src/firestore/reducers/documentEditor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAC,oCAAoC;IACpF,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,KAA+B,CAAC;QAC1C,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,KAA+B,CAAC;QAC1C,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,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,CAAC;AACd,CAAC;AAED,SAAS,UAAU,CAAC,IAAgB,EAAE,MAAc;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,2DAA2D;IAC3D,cAAc;IACd,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzC,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CACxE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,MAAM,CACtB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EditorTree } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a normalized editor tree from a Firestore-shaped object.
|
|
4
|
+
* The root node is a virtual `map` that holds the document's
|
|
5
|
+
* top-level fields. Order of children mirrors `Object.entries` (the
|
|
6
|
+
* renderer is responsible for any sort it wants).
|
|
7
|
+
*/
|
|
8
|
+
export declare function treeFromData(data: Record<string, unknown>): EditorTree;
|
|
9
|
+
/**
|
|
10
|
+
* Serialize a tree back to a Firestore-shaped object. Leaf values
|
|
11
|
+
* pass through unchanged (so a `Timestamp` round-trips as the same
|
|
12
|
+
* `Timestamp` instance). Maps recurse with their sorted keys; arrays
|
|
13
|
+
* recurse in `childIds` order.
|
|
14
|
+
*/
|
|
15
|
+
export declare function treeToData(tree: EditorTree): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Deep-clone a tree. Cheap because nodes are flat — no
|
|
18
|
+
* Firestore values traverse this path (`Timestamp`, `Bytes` etc.
|
|
19
|
+
* are stored as references, not copies, and that's fine because
|
|
20
|
+
* the reducer never mutates the value, only replaces the node).
|
|
21
|
+
*/
|
|
22
|
+
export declare function cloneTree(tree: EditorTree): EditorTree;
|
|
23
|
+
/**
|
|
24
|
+
* Collect a node and all its descendants. Used by `remove` to wipe
|
|
25
|
+
* an entire subtree from the lookup tables in one pass.
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectDescendants(tree: EditorTree, nodeId: string): string[];
|
|
28
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/tree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,YAAY,CAAC;AAOxD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAatE;AAqCD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOpE;AA6BD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAUtD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAW7E"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { inferType } from '../types.js';
|
|
2
|
+
/** Web-standard uuid generator. Browser-only target. */
|
|
3
|
+
function uuid() {
|
|
4
|
+
return crypto.randomUUID();
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Build a normalized editor tree from a Firestore-shaped object.
|
|
8
|
+
* The root node is a virtual `map` that holds the document's
|
|
9
|
+
* top-level fields. Order of children mirrors `Object.entries` (the
|
|
10
|
+
* renderer is responsible for any sort it wants).
|
|
11
|
+
*/
|
|
12
|
+
export function treeFromData(data) {
|
|
13
|
+
const rootId = uuid();
|
|
14
|
+
const tree = {
|
|
15
|
+
rootId,
|
|
16
|
+
nodes: {
|
|
17
|
+
[rootId]: { id: rootId, parentId: null, key: null, type: 'map', value: undefined },
|
|
18
|
+
},
|
|
19
|
+
childIds: { [rootId]: [] },
|
|
20
|
+
};
|
|
21
|
+
for (const [key, value] of Object.entries(data)) {
|
|
22
|
+
addSubtree(tree, rootId, key, value);
|
|
23
|
+
}
|
|
24
|
+
return tree;
|
|
25
|
+
}
|
|
26
|
+
function addSubtree(tree, parentId, key, value) {
|
|
27
|
+
const type = inferType(value);
|
|
28
|
+
const id = uuid();
|
|
29
|
+
const node = {
|
|
30
|
+
id,
|
|
31
|
+
parentId,
|
|
32
|
+
key,
|
|
33
|
+
type,
|
|
34
|
+
value: isContainer(type) ? undefined : value,
|
|
35
|
+
};
|
|
36
|
+
tree.nodes[id] = node;
|
|
37
|
+
tree.childIds[id] = [];
|
|
38
|
+
tree.childIds[parentId].push(id);
|
|
39
|
+
if (type === 'map' && value && typeof value === 'object') {
|
|
40
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
41
|
+
addSubtree(tree, id, childKey, childValue);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (type === 'array' && Array.isArray(value)) {
|
|
45
|
+
for (const childValue of value) {
|
|
46
|
+
addSubtree(tree, id, null, childValue);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return id;
|
|
50
|
+
}
|
|
51
|
+
function isContainer(type) {
|
|
52
|
+
return type === 'map' || type === 'array';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Serialize a tree back to a Firestore-shaped object. Leaf values
|
|
56
|
+
* pass through unchanged (so a `Timestamp` round-trips as the same
|
|
57
|
+
* `Timestamp` instance). Maps recurse with their sorted keys; arrays
|
|
58
|
+
* recurse in `childIds` order.
|
|
59
|
+
*/
|
|
60
|
+
export function treeToData(tree) {
|
|
61
|
+
const root = tree.nodes[tree.rootId];
|
|
62
|
+
if (!root || root.type !== 'map') {
|
|
63
|
+
throw new Error('treeToData: tree root must be a map node');
|
|
64
|
+
}
|
|
65
|
+
const result = serializeNode(tree, tree.rootId);
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
function serializeNode(tree, nodeId) {
|
|
69
|
+
const node = tree.nodes[nodeId];
|
|
70
|
+
if (!node)
|
|
71
|
+
throw new Error(`serializeNode: missing node ${nodeId}`);
|
|
72
|
+
switch (node.type) {
|
|
73
|
+
case 'map': {
|
|
74
|
+
const out = {};
|
|
75
|
+
for (const childId of tree.childIds[nodeId] ?? []) {
|
|
76
|
+
const child = tree.nodes[childId];
|
|
77
|
+
if (!child)
|
|
78
|
+
continue;
|
|
79
|
+
if (child.key == null)
|
|
80
|
+
continue; // map child must have a key
|
|
81
|
+
out[child.key] = serializeNode(tree, childId);
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
case 'array': {
|
|
86
|
+
const out = [];
|
|
87
|
+
for (const childId of tree.childIds[nodeId] ?? []) {
|
|
88
|
+
out.push(serializeNode(tree, childId));
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
return node.value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Deep-clone a tree. Cheap because nodes are flat — no
|
|
98
|
+
* Firestore values traverse this path (`Timestamp`, `Bytes` etc.
|
|
99
|
+
* are stored as references, not copies, and that's fine because
|
|
100
|
+
* the reducer never mutates the value, only replaces the node).
|
|
101
|
+
*/
|
|
102
|
+
export function cloneTree(tree) {
|
|
103
|
+
const nodes = {};
|
|
104
|
+
for (const [id, node] of Object.entries(tree.nodes)) {
|
|
105
|
+
nodes[id] = { ...node };
|
|
106
|
+
}
|
|
107
|
+
const childIds = {};
|
|
108
|
+
for (const [id, ids] of Object.entries(tree.childIds)) {
|
|
109
|
+
childIds[id] = [...ids];
|
|
110
|
+
}
|
|
111
|
+
return { rootId: tree.rootId, nodes, childIds };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Collect a node and all its descendants. Used by `remove` to wipe
|
|
115
|
+
* an entire subtree from the lookup tables in one pass.
|
|
116
|
+
*/
|
|
117
|
+
export function collectDescendants(tree, nodeId) {
|
|
118
|
+
const out = [nodeId];
|
|
119
|
+
const queue = [nodeId];
|
|
120
|
+
while (queue.length) {
|
|
121
|
+
const current = queue.shift();
|
|
122
|
+
for (const childId of tree.childIds[current] ?? []) {
|
|
123
|
+
out.push(childId);
|
|
124
|
+
queue.push(childId);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/firestore/reducers/tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAGxD,wDAAwD;AACxD,SAAS,IAAI;IACX,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAA6B;IACxD,MAAM,MAAM,GAAG,IAAI,EAAE,CAAC;IACtB,MAAM,IAAI,GAAe;QACvB,MAAM;QACN,KAAK,EAAE;YACL,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE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AAG,GAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;QAC/B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACnD,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { FieldType } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One node in the normalized editor tree. Every Firestore field —
|
|
4
|
+
* leaf or container — is a node with a uuid, a parent pointer, a
|
|
5
|
+
* type, and a value. Containers (map, array) carry no value of
|
|
6
|
+
* their own; their children represent the value.
|
|
7
|
+
*/
|
|
8
|
+
export interface FieldNode {
|
|
9
|
+
/** Stable uuid. Used as React `key` and as the action target. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Parent uuid; `null` for the root. */
|
|
12
|
+
parentId: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Map children carry their key here. Array children carry `null`
|
|
15
|
+
* (position comes from the parent's `childIds` order). The root
|
|
16
|
+
* also carries `null` (it has no parent).
|
|
17
|
+
*/
|
|
18
|
+
key: string | null;
|
|
19
|
+
/** Discriminated type. Drives which editor renders. */
|
|
20
|
+
type: FieldType;
|
|
21
|
+
/**
|
|
22
|
+
* Leaf value. `undefined` for `map` / `array` — those carry their
|
|
23
|
+
* value as children. `null` field type has `value === null`.
|
|
24
|
+
*/
|
|
25
|
+
value: unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Validation error message attached to the node by the reducer
|
|
28
|
+
* after every action. `undefined` when valid. Computed on EVERY
|
|
29
|
+
* action regardless of {@link touched} — `errorCount` / `isValid`
|
|
30
|
+
* must reflect the true state so Save stays disabled. `touched`
|
|
31
|
+
* governs only whether a consumer chooses to DISPLAY the error.
|
|
32
|
+
*/
|
|
33
|
+
error?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Set once the field has been blurred (or a submit attempt swept
|
|
36
|
+
* the whole tree via `touchAll`). Consumers gate error display on
|
|
37
|
+
* `touched && error` so a freshly-added empty row doesn't show
|
|
38
|
+
* "Field name is required" before the user has interacted with it.
|
|
39
|
+
*/
|
|
40
|
+
touched?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Normalized tree of nodes. `nodes` is the lookup; `childIds` is the
|
|
44
|
+
* ordered child list per parent. The root node is itself a `map`
|
|
45
|
+
* node (its children are the document's top-level fields).
|
|
46
|
+
*/
|
|
47
|
+
export interface EditorTree {
|
|
48
|
+
rootId: string;
|
|
49
|
+
nodes: Record<string, FieldNode>;
|
|
50
|
+
childIds: Record<string, string[]>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Discriminated union of every action the reducer accepts. Each
|
|
54
|
+
* action carries a `type` discriminator plus the data the reducer
|
|
55
|
+
* needs to apply it.
|
|
56
|
+
*/
|
|
57
|
+
export type DocumentEditorAction = {
|
|
58
|
+
type: 'setValue';
|
|
59
|
+
nodeId: string;
|
|
60
|
+
value: unknown;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'setType';
|
|
63
|
+
nodeId: string;
|
|
64
|
+
newType: FieldType;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'setKey';
|
|
67
|
+
nodeId: string;
|
|
68
|
+
key: string;
|
|
69
|
+
} | {
|
|
70
|
+
type: 'addMapEntry';
|
|
71
|
+
parentId: string;
|
|
72
|
+
key: string;
|
|
73
|
+
childType: FieldType;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'addArrayEntry';
|
|
76
|
+
parentId: string;
|
|
77
|
+
childType: FieldType;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'remove';
|
|
80
|
+
nodeId: string;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'reset';
|
|
83
|
+
}
|
|
84
|
+
/** Mark one node touched (dispatched on blur). Doesn't change any
|
|
85
|
+
* value — only gates error display for consumers that check it. */
|
|
86
|
+
| {
|
|
87
|
+
type: 'touch';
|
|
88
|
+
nodeId: string;
|
|
89
|
+
}
|
|
90
|
+
/** Mark every node touched (dispatched on a submit attempt), so
|
|
91
|
+
* errors that were hidden pre-interaction all surface at once. */
|
|
92
|
+
| {
|
|
93
|
+
type: 'touchAll';
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Reducer state. `tree` is the live document under edit; `initial`
|
|
97
|
+
* is the snapshot the editor was constructed from (used to
|
|
98
|
+
* implement `reset` and `isDirty`).
|
|
99
|
+
*/
|
|
100
|
+
export interface DocumentEditorState {
|
|
101
|
+
tree: EditorTree;
|
|
102
|
+
/** Frozen copy of the tree at construction. `reset` restores from
|
|
103
|
+
* here; `isDirty` is computed by comparing serializations. */
|
|
104
|
+
initial: EditorTree;
|
|
105
|
+
/**
|
|
106
|
+
* Count of nodes with an active `error`. Derived after every
|
|
107
|
+
* action; the reducer keeps it in state to avoid a tree walk on
|
|
108
|
+
* every render.
|
|
109
|
+
*/
|
|
110
|
+
errorCount: number;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,GAAG,EAAE,MAAM,GAAG,I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,UAAU,CAAA;CAAE,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,UAAU,CAAC;IACjB;mEAC+D;IAC/D,OAAO,EAAE,UAAU,CAAC;IACpB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/firestore/reducers/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FieldType } from '../types.js';
|
|
2
|
+
import type { EditorTree } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-type leaf validator. Returns an error message when the value
|
|
5
|
+
* doesn't satisfy the type's constraints, `undefined` when valid.
|
|
6
|
+
*
|
|
7
|
+
* `map` and `array` aren't validated here — their integrity comes
|
|
8
|
+
* from their children + (for maps) sibling-key uniqueness, which
|
|
9
|
+
* is enforced in {@link validateTree}.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateLeaf(type: FieldType, value: unknown): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Walk the tree, attach an `error` to each node, and return the
|
|
14
|
+
* mutated tree along with the total error count. The function does
|
|
15
|
+
* not mutate the input; it returns a fresh tree.
|
|
16
|
+
*
|
|
17
|
+
* Per-leaf errors come from {@link validateLeaf}. Map nodes
|
|
18
|
+
* additionally surface duplicate-key + empty-key errors on the
|
|
19
|
+
* offending children (not on the parent).
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateTree(tree: EditorTree): {
|
|
22
|
+
tree: EditorTree;
|
|
23
|
+
errorCount: number;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=validation.d.ts.map
|