@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.
Files changed (594) hide show
  1. package/README.md +79 -0
  2. package/dist/agents/ContextWindowUsage.d.ts +67 -0
  3. package/dist/agents/ContextWindowUsage.d.ts.map +1 -0
  4. package/dist/agents/ContextWindowUsage.js +115 -0
  5. package/dist/agents/ContextWindowUsage.js.map +1 -0
  6. package/dist/agents/EmptyState.d.ts +18 -0
  7. package/dist/agents/EmptyState.d.ts.map +1 -0
  8. package/dist/agents/EmptyState.js +11 -0
  9. package/dist/agents/EmptyState.js.map +1 -0
  10. package/dist/agents/Fold.d.ts +37 -0
  11. package/dist/agents/Fold.d.ts.map +1 -0
  12. package/dist/agents/Fold.js +18 -0
  13. package/dist/agents/Fold.js.map +1 -0
  14. package/dist/agents/Modal.d.ts +25 -0
  15. package/dist/agents/Modal.d.ts.map +1 -0
  16. package/dist/agents/Modal.js +28 -0
  17. package/dist/agents/Modal.js.map +1 -0
  18. package/dist/agents/PulsingDot.d.ts +21 -0
  19. package/dist/agents/PulsingDot.d.ts.map +1 -0
  20. package/dist/agents/PulsingDot.js +18 -0
  21. package/dist/agents/PulsingDot.js.map +1 -0
  22. package/dist/agents/index.d.ts +15 -0
  23. package/dist/agents/index.d.ts.map +1 -0
  24. package/dist/agents/index.js +15 -0
  25. package/dist/agents/index.js.map +1 -0
  26. package/dist/auth/authApi.d.ts +32 -0
  27. package/dist/auth/authApi.d.ts.map +1 -0
  28. package/dist/auth/authApi.js +27 -0
  29. package/dist/auth/authApi.js.map +1 -0
  30. package/dist/auth/claims.d.ts +27 -0
  31. package/dist/auth/claims.d.ts.map +1 -0
  32. package/dist/auth/claims.js +58 -0
  33. package/dist/auth/claims.js.map +1 -0
  34. package/dist/auth/components/AuthProviderToggles.d.ts +31 -0
  35. package/dist/auth/components/AuthProviderToggles.d.ts.map +1 -0
  36. package/dist/auth/components/AuthProviderToggles.js +48 -0
  37. package/dist/auth/components/AuthProviderToggles.js.map +1 -0
  38. package/dist/auth/components/AuthSignInHelper.d.ts +57 -0
  39. package/dist/auth/components/AuthSignInHelper.d.ts.map +1 -0
  40. package/dist/auth/components/AuthSignInHelper.js +69 -0
  41. package/dist/auth/components/AuthSignInHelper.js.map +1 -0
  42. package/dist/auth/components/AuthUserForm.d.ts +84 -0
  43. package/dist/auth/components/AuthUserForm.d.ts.map +1 -0
  44. package/dist/auth/components/AuthUserForm.js +89 -0
  45. package/dist/auth/components/AuthUserForm.js.map +1 -0
  46. package/dist/auth/components/AuthUserList.d.ts +51 -0
  47. package/dist/auth/components/AuthUserList.d.ts.map +1 -0
  48. package/dist/auth/components/AuthUserList.js +46 -0
  49. package/dist/auth/components/AuthUserList.js.map +1 -0
  50. package/dist/auth/components/ClaimsField.d.ts +22 -0
  51. package/dist/auth/components/ClaimsField.d.ts.map +1 -0
  52. package/dist/auth/components/ClaimsField.js +11 -0
  53. package/dist/auth/components/ClaimsField.js.map +1 -0
  54. package/dist/auth/components/confirmActions.d.ts +40 -0
  55. package/dist/auth/components/confirmActions.d.ts.map +1 -0
  56. package/dist/auth/components/confirmActions.js +49 -0
  57. package/dist/auth/components/confirmActions.js.map +1 -0
  58. package/dist/auth/controller.d.ts +73 -0
  59. package/dist/auth/controller.d.ts.map +1 -0
  60. package/dist/auth/controller.js +139 -0
  61. package/dist/auth/controller.js.map +1 -0
  62. package/dist/auth/hooks/index.d.ts +7 -0
  63. package/dist/auth/hooks/index.d.ts.map +1 -0
  64. package/dist/auth/hooks/index.js +7 -0
  65. package/dist/auth/hooks/index.js.map +1 -0
  66. package/dist/auth/hooks/useAuthFlowHelper.d.ts +30 -0
  67. package/dist/auth/hooks/useAuthFlowHelper.d.ts.map +1 -0
  68. package/dist/auth/hooks/useAuthFlowHelper.js +30 -0
  69. package/dist/auth/hooks/useAuthFlowHelper.js.map +1 -0
  70. package/dist/auth/hooks/useAuthProviderConfig.d.ts +37 -0
  71. package/dist/auth/hooks/useAuthProviderConfig.d.ts.map +1 -0
  72. package/dist/auth/hooks/useAuthProviderConfig.js +98 -0
  73. package/dist/auth/hooks/useAuthProviderConfig.js.map +1 -0
  74. package/dist/auth/hooks/useAuthUserEditor.d.ts +30 -0
  75. package/dist/auth/hooks/useAuthUserEditor.d.ts.map +1 -0
  76. package/dist/auth/hooks/useAuthUserEditor.js +27 -0
  77. package/dist/auth/hooks/useAuthUserEditor.js.map +1 -0
  78. package/dist/auth/hooks/useAuthUsers.d.ts +38 -0
  79. package/dist/auth/hooks/useAuthUsers.d.ts.map +1 -0
  80. package/dist/auth/hooks/useAuthUsers.js +111 -0
  81. package/dist/auth/hooks/useAuthUsers.js.map +1 -0
  82. package/dist/auth/index.d.ts +11 -0
  83. package/dist/auth/index.d.ts.map +1 -0
  84. package/dist/auth/index.js +13 -0
  85. package/dist/auth/index.js.map +1 -0
  86. package/dist/auth/providers.d.ts +11 -0
  87. package/dist/auth/providers.d.ts.map +1 -0
  88. package/dist/auth/providers.js +28 -0
  89. package/dist/auth/providers.js.map +1 -0
  90. package/dist/auth/reducers/userEditor.d.ts +55 -0
  91. package/dist/auth/reducers/userEditor.d.ts.map +1 -0
  92. package/dist/auth/reducers/userEditor.js +136 -0
  93. package/dist/auth/reducers/userEditor.js.map +1 -0
  94. package/dist/events/components/ActivityActionItems.d.ts +45 -0
  95. package/dist/events/components/ActivityActionItems.d.ts.map +1 -0
  96. package/dist/events/components/ActivityActionItems.js +68 -0
  97. package/dist/events/components/ActivityActionItems.js.map +1 -0
  98. package/dist/events/components/ActivityGrid.d.ts +65 -0
  99. package/dist/events/components/ActivityGrid.d.ts.map +1 -0
  100. package/dist/events/components/ActivityGrid.js +61 -0
  101. package/dist/events/components/ActivityGrid.js.map +1 -0
  102. package/dist/events/components/ActivityGridRow.d.ts +31 -0
  103. package/dist/events/components/ActivityGridRow.d.ts.map +1 -0
  104. package/dist/events/components/ActivityGridRow.js +23 -0
  105. package/dist/events/components/ActivityGridRow.js.map +1 -0
  106. package/dist/events/components/ProposedChangeDiff.d.ts +46 -0
  107. package/dist/events/components/ProposedChangeDiff.d.ts.map +1 -0
  108. package/dist/events/components/ProposedChangeDiff.js +60 -0
  109. package/dist/events/components/ProposedChangeDiff.js.map +1 -0
  110. package/dist/events/components/format.d.ts +11 -0
  111. package/dist/events/components/format.d.ts.map +1 -0
  112. package/dist/events/components/format.js +26 -0
  113. package/dist/events/components/format.js.map +1 -0
  114. package/dist/events/components/index.d.ts +6 -0
  115. package/dist/events/components/index.d.ts.map +1 -0
  116. package/dist/events/components/index.js +6 -0
  117. package/dist/events/components/index.js.map +1 -0
  118. package/dist/events/digest.d.ts +167 -0
  119. package/dist/events/digest.d.ts.map +1 -0
  120. package/dist/events/digest.js +426 -0
  121. package/dist/events/digest.js.map +1 -0
  122. package/dist/events/hooks/index.d.ts +3 -0
  123. package/dist/events/hooks/index.d.ts.map +1 -0
  124. package/dist/events/hooks/index.js +3 -0
  125. package/dist/events/hooks/index.js.map +1 -0
  126. package/dist/events/hooks/useActivityDigest.d.ts +27 -0
  127. package/dist/events/hooks/useActivityDigest.d.ts.map +1 -0
  128. package/dist/events/hooks/useActivityDigest.js +18 -0
  129. package/dist/events/hooks/useActivityDigest.js.map +1 -0
  130. package/dist/events/hooks/useActivityStream.d.ts +44 -0
  131. package/dist/events/hooks/useActivityStream.d.ts.map +1 -0
  132. package/dist/events/hooks/useActivityStream.js +38 -0
  133. package/dist/events/hooks/useActivityStream.js.map +1 -0
  134. package/dist/events/index.d.ts +15 -0
  135. package/dist/events/index.d.ts.map +1 -0
  136. package/dist/events/index.js +14 -0
  137. package/dist/events/index.js.map +1 -0
  138. package/dist/events/types.d.ts +160 -0
  139. package/dist/events/types.d.ts.map +1 -0
  140. package/dist/events/types.js +21 -0
  141. package/dist/events/types.js.map +1 -0
  142. package/dist/firestore/components/CollectionList.d.ts +22 -0
  143. package/dist/firestore/components/CollectionList.d.ts.map +1 -0
  144. package/dist/firestore/components/CollectionList.js +21 -0
  145. package/dist/firestore/components/CollectionList.js.map +1 -0
  146. package/dist/firestore/components/DeleteWithConfirm.d.ts +38 -0
  147. package/dist/firestore/components/DeleteWithConfirm.d.ts.map +1 -0
  148. package/dist/firestore/components/DeleteWithConfirm.js +33 -0
  149. package/dist/firestore/components/DeleteWithConfirm.js.map +1 -0
  150. package/dist/firestore/components/DocumentEditor.d.ts +47 -0
  151. package/dist/firestore/components/DocumentEditor.d.ts.map +1 -0
  152. package/dist/firestore/components/DocumentEditor.js +176 -0
  153. package/dist/firestore/components/DocumentEditor.js.map +1 -0
  154. package/dist/firestore/components/DocumentList.d.ts +60 -0
  155. package/dist/firestore/components/DocumentList.d.ts.map +1 -0
  156. package/dist/firestore/components/DocumentList.js +39 -0
  157. package/dist/firestore/components/DocumentList.js.map +1 -0
  158. package/dist/firestore/components/DocumentPreview.d.ts +68 -0
  159. package/dist/firestore/components/DocumentPreview.d.ts.map +1 -0
  160. package/dist/firestore/components/DocumentPreview.js +76 -0
  161. package/dist/firestore/components/DocumentPreview.js.map +1 -0
  162. package/dist/firestore/components/FieldRenderer.d.ts +17 -0
  163. package/dist/firestore/components/FieldRenderer.d.ts.map +1 -0
  164. package/dist/firestore/components/FieldRenderer.js +16 -0
  165. package/dist/firestore/components/FieldRenderer.js.map +1 -0
  166. package/dist/firestore/components/QueryBuilder.d.ts +25 -0
  167. package/dist/firestore/components/QueryBuilder.d.ts.map +1 -0
  168. package/dist/firestore/components/QueryBuilder.js +78 -0
  169. package/dist/firestore/components/QueryBuilder.js.map +1 -0
  170. package/dist/firestore/components/ReferencePicker.d.ts +33 -0
  171. package/dist/firestore/components/ReferencePicker.d.ts.map +1 -0
  172. package/dist/firestore/components/ReferencePicker.js +42 -0
  173. package/dist/firestore/components/ReferencePicker.js.map +1 -0
  174. package/dist/firestore/components/TreeEntry.d.ts +15 -0
  175. package/dist/firestore/components/TreeEntry.d.ts.map +1 -0
  176. package/dist/firestore/components/TreeEntry.js +23 -0
  177. package/dist/firestore/components/TreeEntry.js.map +1 -0
  178. package/dist/firestore/components/context.d.ts +18 -0
  179. package/dist/firestore/components/context.d.ts.map +1 -0
  180. package/dist/firestore/components/context.js +7 -0
  181. package/dist/firestore/components/context.js.map +1 -0
  182. package/dist/firestore/fieldEditors/array.d.ts +3 -0
  183. package/dist/firestore/fieldEditors/array.d.ts.map +1 -0
  184. package/dist/firestore/fieldEditors/array.js +16 -0
  185. package/dist/firestore/fieldEditors/array.js.map +1 -0
  186. package/dist/firestore/fieldEditors/boolean.d.ts +3 -0
  187. package/dist/firestore/fieldEditors/boolean.d.ts.map +1 -0
  188. package/dist/firestore/fieldEditors/boolean.js +13 -0
  189. package/dist/firestore/fieldEditors/boolean.js.map +1 -0
  190. package/dist/firestore/fieldEditors/bytes.d.ts +4 -0
  191. package/dist/firestore/fieldEditors/bytes.d.ts.map +1 -0
  192. package/dist/firestore/fieldEditors/bytes.js +31 -0
  193. package/dist/firestore/fieldEditors/bytes.js.map +1 -0
  194. package/dist/firestore/fieldEditors/geopoint.d.ts +4 -0
  195. package/dist/firestore/fieldEditors/geopoint.d.ts.map +1 -0
  196. package/dist/firestore/fieldEditors/geopoint.js +32 -0
  197. package/dist/firestore/fieldEditors/geopoint.js.map +1 -0
  198. package/dist/firestore/fieldEditors/map.d.ts +3 -0
  199. package/dist/firestore/fieldEditors/map.d.ts.map +1 -0
  200. package/dist/firestore/fieldEditors/map.js +19 -0
  201. package/dist/firestore/fieldEditors/map.js.map +1 -0
  202. package/dist/firestore/fieldEditors/null.d.ts +3 -0
  203. package/dist/firestore/fieldEditors/null.d.ts.map +1 -0
  204. package/dist/firestore/fieldEditors/null.js +17 -0
  205. package/dist/firestore/fieldEditors/null.js.map +1 -0
  206. package/dist/firestore/fieldEditors/number.d.ts +3 -0
  207. package/dist/firestore/fieldEditors/number.d.ts.map +1 -0
  208. package/dist/firestore/fieldEditors/number.js +24 -0
  209. package/dist/firestore/fieldEditors/number.js.map +1 -0
  210. package/dist/firestore/fieldEditors/reference.d.ts +4 -0
  211. package/dist/firestore/fieldEditors/reference.d.ts.map +1 -0
  212. package/dist/firestore/fieldEditors/reference.js +49 -0
  213. package/dist/firestore/fieldEditors/reference.js.map +1 -0
  214. package/dist/firestore/fieldEditors/registry.d.ts +16 -0
  215. package/dist/firestore/fieldEditors/registry.d.ts.map +1 -0
  216. package/dist/firestore/fieldEditors/registry.js +42 -0
  217. package/dist/firestore/fieldEditors/registry.js.map +1 -0
  218. package/dist/firestore/fieldEditors/string.d.ts +3 -0
  219. package/dist/firestore/fieldEditors/string.d.ts.map +1 -0
  220. package/dist/firestore/fieldEditors/string.js +13 -0
  221. package/dist/firestore/fieldEditors/string.js.map +1 -0
  222. package/dist/firestore/fieldEditors/timestamp.d.ts +4 -0
  223. package/dist/firestore/fieldEditors/timestamp.d.ts.map +1 -0
  224. package/dist/firestore/fieldEditors/timestamp.js +52 -0
  225. package/dist/firestore/fieldEditors/timestamp.js.map +1 -0
  226. package/dist/firestore/fieldEditors/types.d.ts +64 -0
  227. package/dist/firestore/fieldEditors/types.d.ts.map +1 -0
  228. package/dist/firestore/fieldEditors/types.js +2 -0
  229. package/dist/firestore/fieldEditors/types.js.map +1 -0
  230. package/dist/firestore/fieldEditors/vector.d.ts +29 -0
  231. package/dist/firestore/fieldEditors/vector.d.ts.map +1 -0
  232. package/dist/firestore/fieldEditors/vector.js +93 -0
  233. package/dist/firestore/fieldEditors/vector.js.map +1 -0
  234. package/dist/firestore/firestoreApi.d.ts +35 -0
  235. package/dist/firestore/firestoreApi.d.ts.map +1 -0
  236. package/dist/firestore/firestoreApi.js +28 -0
  237. package/dist/firestore/firestoreApi.js.map +1 -0
  238. package/dist/firestore/hooks/coerceError.d.ts +17 -0
  239. package/dist/firestore/hooks/coerceError.d.ts.map +1 -0
  240. package/dist/firestore/hooks/coerceError.js +41 -0
  241. package/dist/firestore/hooks/coerceError.js.map +1 -0
  242. package/dist/firestore/hooks/index.d.ts +10 -0
  243. package/dist/firestore/hooks/index.d.ts.map +1 -0
  244. package/dist/firestore/hooks/index.js +10 -0
  245. package/dist/firestore/hooks/index.js.map +1 -0
  246. package/dist/firestore/hooks/useCollectionList.d.ts +37 -0
  247. package/dist/firestore/hooks/useCollectionList.d.ts.map +1 -0
  248. package/dist/firestore/hooks/useCollectionList.js +51 -0
  249. package/dist/firestore/hooks/useCollectionList.js.map +1 -0
  250. package/dist/firestore/hooks/useDocumentEditor.d.ts +58 -0
  251. package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -0
  252. package/dist/firestore/hooks/useDocumentEditor.js +68 -0
  253. package/dist/firestore/hooks/useDocumentEditor.js.map +1 -0
  254. package/dist/firestore/hooks/useDocumentList.d.ts +45 -0
  255. package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -0
  256. package/dist/firestore/hooks/useDocumentList.js +112 -0
  257. package/dist/firestore/hooks/useDocumentList.js.map +1 -0
  258. package/dist/firestore/hooks/useDocumentSubcollections.d.ts +29 -0
  259. package/dist/firestore/hooks/useDocumentSubcollections.d.ts.map +1 -0
  260. package/dist/firestore/hooks/useDocumentSubcollections.js +48 -0
  261. package/dist/firestore/hooks/useDocumentSubcollections.js.map +1 -0
  262. package/dist/firestore/hooks/useFirestoreCollection.d.ts +14 -0
  263. package/dist/firestore/hooks/useFirestoreCollection.d.ts.map +1 -0
  264. package/dist/firestore/hooks/useFirestoreCollection.js +35 -0
  265. package/dist/firestore/hooks/useFirestoreCollection.js.map +1 -0
  266. package/dist/firestore/hooks/useFirestoreDoc.d.ts +17 -0
  267. package/dist/firestore/hooks/useFirestoreDoc.d.ts.map +1 -0
  268. package/dist/firestore/hooks/useFirestoreDoc.js +34 -0
  269. package/dist/firestore/hooks/useFirestoreDoc.js.map +1 -0
  270. package/dist/firestore/hooks/useQueryBuilder.d.ts +51 -0
  271. package/dist/firestore/hooks/useQueryBuilder.d.ts.map +1 -0
  272. package/dist/firestore/hooks/useQueryBuilder.js +110 -0
  273. package/dist/firestore/hooks/useQueryBuilder.js.map +1 -0
  274. package/dist/firestore/hooks/useRecursiveDelete.d.ts +40 -0
  275. package/dist/firestore/hooks/useRecursiveDelete.d.ts.map +1 -0
  276. package/dist/firestore/hooks/useRecursiveDelete.js +44 -0
  277. package/dist/firestore/hooks/useRecursiveDelete.js.map +1 -0
  278. package/dist/firestore/hooks/useReferencePicker.d.ts +70 -0
  279. package/dist/firestore/hooks/useReferencePicker.d.ts.map +1 -0
  280. package/dist/firestore/hooks/useReferencePicker.js +140 -0
  281. package/dist/firestore/hooks/useReferencePicker.js.map +1 -0
  282. package/dist/firestore/import/parseImport.d.ts +55 -0
  283. package/dist/firestore/import/parseImport.d.ts.map +1 -0
  284. package/dist/firestore/import/parseImport.js +101 -0
  285. package/dist/firestore/import/parseImport.js.map +1 -0
  286. package/dist/firestore/index.d.ts +20 -0
  287. package/dist/firestore/index.d.ts.map +1 -0
  288. package/dist/firestore/index.js +28 -0
  289. package/dist/firestore/index.js.map +1 -0
  290. package/dist/firestore/reducers/defaults.d.ts +10 -0
  291. package/dist/firestore/reducers/defaults.d.ts.map +1 -0
  292. package/dist/firestore/reducers/defaults.js +37 -0
  293. package/dist/firestore/reducers/defaults.js.map +1 -0
  294. package/dist/firestore/reducers/documentEditor.d.ts +23 -0
  295. package/dist/firestore/reducers/documentEditor.d.ts.map +1 -0
  296. package/dist/firestore/reducers/documentEditor.js +199 -0
  297. package/dist/firestore/reducers/documentEditor.js.map +1 -0
  298. package/dist/firestore/reducers/tree.d.ts +28 -0
  299. package/dist/firestore/reducers/tree.d.ts.map +1 -0
  300. package/dist/firestore/reducers/tree.js +129 -0
  301. package/dist/firestore/reducers/tree.js.map +1 -0
  302. package/dist/firestore/reducers/types.d.ts +112 -0
  303. package/dist/firestore/reducers/types.d.ts.map +1 -0
  304. package/dist/firestore/reducers/types.js +2 -0
  305. package/dist/firestore/reducers/types.js.map +1 -0
  306. package/dist/firestore/reducers/validation.d.ts +25 -0
  307. package/dist/firestore/reducers/validation.d.ts.map +1 -0
  308. package/dist/firestore/reducers/validation.js +121 -0
  309. package/dist/firestore/reducers/validation.js.map +1 -0
  310. package/dist/firestore/types.d.ts +77 -0
  311. package/dist/firestore/types.d.ts.map +1 -0
  312. package/dist/firestore/types.js +196 -0
  313. package/dist/firestore/types.js.map +1 -0
  314. package/dist/firestore/validation/ids.d.ts +23 -0
  315. package/dist/firestore/validation/ids.d.ts.map +1 -0
  316. package/dist/firestore/validation/ids.js +46 -0
  317. package/dist/firestore/validation/ids.js.map +1 -0
  318. package/dist/index.d.ts +2 -0
  319. package/dist/index.d.ts.map +1 -0
  320. package/dist/index.js +2 -0
  321. package/dist/index.js.map +1 -0
  322. package/dist/primitives/Badge.d.ts +28 -0
  323. package/dist/primitives/Badge.d.ts.map +1 -0
  324. package/dist/primitives/Badge.js +11 -0
  325. package/dist/primitives/Badge.js.map +1 -0
  326. package/dist/primitives/ConfirmDialog.d.ts +42 -0
  327. package/dist/primitives/ConfirmDialog.d.ts.map +1 -0
  328. package/dist/primitives/ConfirmDialog.js +61 -0
  329. package/dist/primitives/ConfirmDialog.js.map +1 -0
  330. package/dist/primitives/CopyButton.d.ts +28 -0
  331. package/dist/primitives/CopyButton.d.ts.map +1 -0
  332. package/dist/primitives/CopyButton.js +27 -0
  333. package/dist/primitives/CopyButton.js.map +1 -0
  334. package/dist/primitives/JsonView.d.ts +29 -0
  335. package/dist/primitives/JsonView.d.ts.map +1 -0
  336. package/dist/primitives/JsonView.js +56 -0
  337. package/dist/primitives/JsonView.js.map +1 -0
  338. package/dist/primitives/SegmentedControl.d.ts +37 -0
  339. package/dist/primitives/SegmentedControl.d.ts.map +1 -0
  340. package/dist/primitives/SegmentedControl.js +18 -0
  341. package/dist/primitives/SegmentedControl.js.map +1 -0
  342. package/dist/primitives/Toast.d.ts +48 -0
  343. package/dist/primitives/Toast.d.ts.map +1 -0
  344. package/dist/primitives/Toast.js +60 -0
  345. package/dist/primitives/Toast.js.map +1 -0
  346. package/dist/primitives/VirtualList.d.ts +37 -0
  347. package/dist/primitives/VirtualList.d.ts.map +1 -0
  348. package/dist/primitives/VirtualList.js +47 -0
  349. package/dist/primitives/VirtualList.js.map +1 -0
  350. package/dist/primitives/hooks/useContainerSize.d.ts +29 -0
  351. package/dist/primitives/hooks/useContainerSize.d.ts.map +1 -0
  352. package/dist/primitives/hooks/useContainerSize.js +45 -0
  353. package/dist/primitives/hooks/useContainerSize.js.map +1 -0
  354. package/dist/primitives/index.d.ts +10 -0
  355. package/dist/primitives/index.d.ts.map +1 -0
  356. package/dist/primitives/index.js +10 -0
  357. package/dist/primitives/index.js.map +1 -0
  358. package/dist/primitives/useConfirm.d.ts +34 -0
  359. package/dist/primitives/useConfirm.d.ts.map +1 -0
  360. package/dist/primitives/useConfirm.js +63 -0
  361. package/dist/primitives/useConfirm.js.map +1 -0
  362. package/dist/rtdb/components/RtdbPathBar.d.ts +31 -0
  363. package/dist/rtdb/components/RtdbPathBar.d.ts.map +1 -0
  364. package/dist/rtdb/components/RtdbPathBar.js +47 -0
  365. package/dist/rtdb/components/RtdbPathBar.js.map +1 -0
  366. package/dist/rtdb/components/RtdbTree.d.ts +38 -0
  367. package/dist/rtdb/components/RtdbTree.d.ts.map +1 -0
  368. package/dist/rtdb/components/RtdbTree.js +103 -0
  369. package/dist/rtdb/components/RtdbTree.js.map +1 -0
  370. package/dist/rtdb/editor.d.ts +25 -0
  371. package/dist/rtdb/editor.d.ts.map +1 -0
  372. package/dist/rtdb/editor.js +79 -0
  373. package/dist/rtdb/editor.js.map +1 -0
  374. package/dist/rtdb/hooks/useRtdbTree.d.ts +31 -0
  375. package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -0
  376. package/dist/rtdb/hooks/useRtdbTree.js +49 -0
  377. package/dist/rtdb/hooks/useRtdbTree.js.map +1 -0
  378. package/dist/rtdb/index.d.ts +17 -0
  379. package/dist/rtdb/index.d.ts.map +1 -0
  380. package/dist/rtdb/index.js +21 -0
  381. package/dist/rtdb/index.js.map +1 -0
  382. package/dist/rtdb/pathInput.d.ts +28 -0
  383. package/dist/rtdb/pathInput.d.ts.map +1 -0
  384. package/dist/rtdb/pathInput.js +40 -0
  385. package/dist/rtdb/pathInput.js.map +1 -0
  386. package/dist/rtdb/reducers/tree.d.ts +86 -0
  387. package/dist/rtdb/reducers/tree.d.ts.map +1 -0
  388. package/dist/rtdb/reducers/tree.js +131 -0
  389. package/dist/rtdb/reducers/tree.js.map +1 -0
  390. package/dist/rtdb/rtdbApi.d.ts +20 -0
  391. package/dist/rtdb/rtdbApi.d.ts.map +1 -0
  392. package/dist/rtdb/rtdbApi.js +2 -0
  393. package/dist/rtdb/rtdbApi.js.map +1 -0
  394. package/dist/rtdb/values.d.ts +44 -0
  395. package/dist/rtdb/values.d.ts.map +1 -0
  396. package/dist/rtdb/values.js +143 -0
  397. package/dist/rtdb/values.js.map +1 -0
  398. package/dist/rules/components/DenialInspector.d.ts +18 -0
  399. package/dist/rules/components/DenialInspector.d.ts.map +1 -0
  400. package/dist/rules/components/DenialInspector.js +58 -0
  401. package/dist/rules/components/DenialInspector.js.map +1 -0
  402. package/dist/rules/components/format.d.ts +56 -0
  403. package/dist/rules/components/format.d.ts.map +1 -0
  404. package/dist/rules/components/format.js +137 -0
  405. package/dist/rules/components/format.js.map +1 -0
  406. package/dist/rules/components/index.d.ts +4 -0
  407. package/dist/rules/components/index.d.ts.map +1 -0
  408. package/dist/rules/components/index.js +4 -0
  409. package/dist/rules/components/index.js.map +1 -0
  410. package/dist/rules/components/scope.d.ts +10 -0
  411. package/dist/rules/components/scope.d.ts.map +1 -0
  412. package/dist/rules/components/scope.js +72 -0
  413. package/dist/rules/components/scope.js.map +1 -0
  414. package/dist/rules/hooks/index.d.ts +2 -0
  415. package/dist/rules/hooks/index.d.ts.map +1 -0
  416. package/dist/rules/hooks/index.js +2 -0
  417. package/dist/rules/hooks/index.js.map +1 -0
  418. package/dist/rules/hooks/useDenialTrace.d.ts +51 -0
  419. package/dist/rules/hooks/useDenialTrace.d.ts.map +1 -0
  420. package/dist/rules/hooks/useDenialTrace.js +58 -0
  421. package/dist/rules/hooks/useDenialTrace.js.map +1 -0
  422. package/dist/rules/index.d.ts +14 -0
  423. package/dist/rules/index.d.ts.map +1 -0
  424. package/dist/rules/index.js +13 -0
  425. package/dist/rules/index.js.map +1 -0
  426. package/dist/rules/types.d.ts +75 -0
  427. package/dist/rules/types.d.ts.map +1 -0
  428. package/dist/rules/types.js +2 -0
  429. package/dist/rules/types.js.map +1 -0
  430. package/dist/storage/collisionRename.d.ts +73 -0
  431. package/dist/storage/collisionRename.d.ts.map +1 -0
  432. package/dist/storage/collisionRename.js +113 -0
  433. package/dist/storage/collisionRename.js.map +1 -0
  434. package/dist/storage/components/DeleteSelectionWithConfirm.d.ts +68 -0
  435. package/dist/storage/components/DeleteSelectionWithConfirm.d.ts.map +1 -0
  436. package/dist/storage/components/DeleteSelectionWithConfirm.js +82 -0
  437. package/dist/storage/components/DeleteSelectionWithConfirm.js.map +1 -0
  438. package/dist/storage/components/ObjectBrowser.d.ts +75 -0
  439. package/dist/storage/components/ObjectBrowser.d.ts.map +1 -0
  440. package/dist/storage/components/ObjectBrowser.js +59 -0
  441. package/dist/storage/components/ObjectBrowser.js.map +1 -0
  442. package/dist/storage/components/ObjectInspector.d.ts +43 -0
  443. package/dist/storage/components/ObjectInspector.d.ts.map +1 -0
  444. package/dist/storage/components/ObjectInspector.js +92 -0
  445. package/dist/storage/components/ObjectInspector.js.map +1 -0
  446. package/dist/storage/components/PathBreadcrumb.d.ts +30 -0
  447. package/dist/storage/components/PathBreadcrumb.d.ts.map +1 -0
  448. package/dist/storage/components/PathBreadcrumb.js +26 -0
  449. package/dist/storage/components/PathBreadcrumb.js.map +1 -0
  450. package/dist/storage/components/UploadDropzone.d.ts +50 -0
  451. package/dist/storage/components/UploadDropzone.d.ts.map +1 -0
  452. package/dist/storage/components/UploadDropzone.js +109 -0
  453. package/dist/storage/components/UploadDropzone.js.map +1 -0
  454. package/dist/storage/folderPlaceholder.d.ts +14 -0
  455. package/dist/storage/folderPlaceholder.d.ts.map +1 -0
  456. package/dist/storage/folderPlaceholder.js +27 -0
  457. package/dist/storage/folderPlaceholder.js.map +1 -0
  458. package/dist/storage/hooks/index.d.ts +9 -0
  459. package/dist/storage/hooks/index.d.ts.map +1 -0
  460. package/dist/storage/hooks/index.js +9 -0
  461. package/dist/storage/hooks/index.js.map +1 -0
  462. package/dist/storage/hooks/useMetadataEditor.d.ts +114 -0
  463. package/dist/storage/hooks/useMetadataEditor.d.ts.map +1 -0
  464. package/dist/storage/hooks/useMetadataEditor.js +193 -0
  465. package/dist/storage/hooks/useMetadataEditor.js.map +1 -0
  466. package/dist/storage/hooks/useObjectUpload.d.ts +109 -0
  467. package/dist/storage/hooks/useObjectUpload.d.ts.map +1 -0
  468. package/dist/storage/hooks/useObjectUpload.js +134 -0
  469. package/dist/storage/hooks/useObjectUpload.js.map +1 -0
  470. package/dist/storage/hooks/usePathState.d.ts +43 -0
  471. package/dist/storage/hooks/usePathState.d.ts.map +1 -0
  472. package/dist/storage/hooks/usePathState.js +42 -0
  473. package/dist/storage/hooks/usePathState.js.map +1 -0
  474. package/dist/storage/hooks/useStorageDelete.d.ts +73 -0
  475. package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -0
  476. package/dist/storage/hooks/useStorageDelete.js +114 -0
  477. package/dist/storage/hooks/useStorageDelete.js.map +1 -0
  478. package/dist/storage/hooks/useStorageList.d.ts +74 -0
  479. package/dist/storage/hooks/useStorageList.d.ts.map +1 -0
  480. package/dist/storage/hooks/useStorageList.js +167 -0
  481. package/dist/storage/hooks/useStorageList.js.map +1 -0
  482. package/dist/storage/hooks/useStorageObject.d.ts +34 -0
  483. package/dist/storage/hooks/useStorageObject.d.ts.map +1 -0
  484. package/dist/storage/hooks/useStorageObject.js +114 -0
  485. package/dist/storage/hooks/useStorageObject.js.map +1 -0
  486. package/dist/storage/hooks/useStorageRulesGate.d.ts +128 -0
  487. package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -0
  488. package/dist/storage/hooks/useStorageRulesGate.js +158 -0
  489. package/dist/storage/hooks/useStorageRulesGate.js.map +1 -0
  490. package/dist/storage/hooks/useStorageSelection.d.ts +32 -0
  491. package/dist/storage/hooks/useStorageSelection.d.ts.map +1 -0
  492. package/dist/storage/hooks/useStorageSelection.js +55 -0
  493. package/dist/storage/hooks/useStorageSelection.js.map +1 -0
  494. package/dist/storage/index.d.ts +11 -0
  495. package/dist/storage/index.d.ts.map +1 -0
  496. package/dist/storage/index.js +17 -0
  497. package/dist/storage/index.js.map +1 -0
  498. package/dist/storage/pendingPrefixes.d.ts +73 -0
  499. package/dist/storage/pendingPrefixes.d.ts.map +1 -0
  500. package/dist/storage/pendingPrefixes.js +98 -0
  501. package/dist/storage/pendingPrefixes.js.map +1 -0
  502. package/dist/storage/previews.d.ts +51 -0
  503. package/dist/storage/previews.d.ts.map +1 -0
  504. package/dist/storage/previews.js +73 -0
  505. package/dist/storage/previews.js.map +1 -0
  506. package/dist/storage/storageApi.d.ts +30 -0
  507. package/dist/storage/storageApi.d.ts.map +1 -0
  508. package/dist/storage/storageApi.js +13 -0
  509. package/dist/storage/storageApi.js.map +1 -0
  510. package/dist/traffic/components/RuleHeatmap.d.ts +34 -0
  511. package/dist/traffic/components/RuleHeatmap.d.ts.map +1 -0
  512. package/dist/traffic/components/RuleHeatmap.js +40 -0
  513. package/dist/traffic/components/RuleHeatmap.js.map +1 -0
  514. package/dist/traffic/components/TrafficDetail.d.ts +33 -0
  515. package/dist/traffic/components/TrafficDetail.d.ts.map +1 -0
  516. package/dist/traffic/components/TrafficDetail.js +28 -0
  517. package/dist/traffic/components/TrafficDetail.js.map +1 -0
  518. package/dist/traffic/components/TrafficGroupRow.d.ts +28 -0
  519. package/dist/traffic/components/TrafficGroupRow.d.ts.map +1 -0
  520. package/dist/traffic/components/TrafficGroupRow.js +18 -0
  521. package/dist/traffic/components/TrafficGroupRow.js.map +1 -0
  522. package/dist/traffic/components/TrafficLineChart.d.ts +34 -0
  523. package/dist/traffic/components/TrafficLineChart.d.ts.map +1 -0
  524. package/dist/traffic/components/TrafficLineChart.js +49 -0
  525. package/dist/traffic/components/TrafficLineChart.js.map +1 -0
  526. package/dist/traffic/components/TrafficLog.d.ts +52 -0
  527. package/dist/traffic/components/TrafficLog.d.ts.map +1 -0
  528. package/dist/traffic/components/TrafficLog.js +34 -0
  529. package/dist/traffic/components/TrafficLog.js.map +1 -0
  530. package/dist/traffic/components/TrafficMetricCards.d.ts +26 -0
  531. package/dist/traffic/components/TrafficMetricCards.d.ts.map +1 -0
  532. package/dist/traffic/components/TrafficMetricCards.js +24 -0
  533. package/dist/traffic/components/TrafficMetricCards.js.map +1 -0
  534. package/dist/traffic/components/TrafficRow.d.ts +40 -0
  535. package/dist/traffic/components/TrafficRow.d.ts.map +1 -0
  536. package/dist/traffic/components/TrafficRow.js +27 -0
  537. package/dist/traffic/components/TrafficRow.js.map +1 -0
  538. package/dist/traffic/components/TrafficStats.d.ts +18 -0
  539. package/dist/traffic/components/TrafficStats.d.ts.map +1 -0
  540. package/dist/traffic/components/TrafficStats.js +19 -0
  541. package/dist/traffic/components/TrafficStats.js.map +1 -0
  542. package/dist/traffic/components/TrafficTimeline.d.ts +81 -0
  543. package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -0
  544. package/dist/traffic/components/TrafficTimeline.js +72 -0
  545. package/dist/traffic/components/TrafficTimeline.js.map +1 -0
  546. package/dist/traffic/components/format.d.ts +13 -0
  547. package/dist/traffic/components/format.d.ts.map +1 -0
  548. package/dist/traffic/components/format.js +24 -0
  549. package/dist/traffic/components/format.js.map +1 -0
  550. package/dist/traffic/components/index.d.ts +11 -0
  551. package/dist/traffic/components/index.d.ts.map +1 -0
  552. package/dist/traffic/components/index.js +11 -0
  553. package/dist/traffic/components/index.js.map +1 -0
  554. package/dist/traffic/hooks/index.d.ts +8 -0
  555. package/dist/traffic/hooks/index.d.ts.map +1 -0
  556. package/dist/traffic/hooks/index.js +8 -0
  557. package/dist/traffic/hooks/index.js.map +1 -0
  558. package/dist/traffic/hooks/useRuleHeatmap.d.ts +33 -0
  559. package/dist/traffic/hooks/useRuleHeatmap.d.ts.map +1 -0
  560. package/dist/traffic/hooks/useRuleHeatmap.js +54 -0
  561. package/dist/traffic/hooks/useRuleHeatmap.js.map +1 -0
  562. package/dist/traffic/hooks/useTrafficBuckets.d.ts +71 -0
  563. package/dist/traffic/hooks/useTrafficBuckets.d.ts.map +1 -0
  564. package/dist/traffic/hooks/useTrafficBuckets.js +74 -0
  565. package/dist/traffic/hooks/useTrafficBuckets.js.map +1 -0
  566. package/dist/traffic/hooks/useTrafficFilter.d.ts +40 -0
  567. package/dist/traffic/hooks/useTrafficFilter.d.ts.map +1 -0
  568. package/dist/traffic/hooks/useTrafficFilter.js +33 -0
  569. package/dist/traffic/hooks/useTrafficFilter.js.map +1 -0
  570. package/dist/traffic/hooks/useTrafficGroups.d.ts +47 -0
  571. package/dist/traffic/hooks/useTrafficGroups.d.ts.map +1 -0
  572. package/dist/traffic/hooks/useTrafficGroups.js +73 -0
  573. package/dist/traffic/hooks/useTrafficGroups.js.map +1 -0
  574. package/dist/traffic/hooks/useTrafficMetrics.d.ts +66 -0
  575. package/dist/traffic/hooks/useTrafficMetrics.d.ts.map +1 -0
  576. package/dist/traffic/hooks/useTrafficMetrics.js +156 -0
  577. package/dist/traffic/hooks/useTrafficMetrics.js.map +1 -0
  578. package/dist/traffic/hooks/useTrafficMonitor.d.ts +56 -0
  579. package/dist/traffic/hooks/useTrafficMonitor.d.ts.map +1 -0
  580. package/dist/traffic/hooks/useTrafficMonitor.js +58 -0
  581. package/dist/traffic/hooks/useTrafficMonitor.js.map +1 -0
  582. package/dist/traffic/hooks/useTrafficStats.d.ts +32 -0
  583. package/dist/traffic/hooks/useTrafficStats.d.ts.map +1 -0
  584. package/dist/traffic/hooks/useTrafficStats.js +45 -0
  585. package/dist/traffic/hooks/useTrafficStats.js.map +1 -0
  586. package/dist/traffic/index.d.ts +4 -0
  587. package/dist/traffic/index.d.ts.map +1 -0
  588. package/dist/traffic/index.js +3 -0
  589. package/dist/traffic/index.js.map +1 -0
  590. package/dist/traffic/types.d.ts +72 -0
  591. package/dist/traffic/types.d.ts.map +1 -0
  592. package/dist/traffic/types.js +10 -0
  593. package/dist/traffic/types.js.map +1 -0
  594. 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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B,eAAe,GAIhB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { FieldType } from '../types.js';
2
+ /**
3
+ * Default value used when a new field of this type is added (or
4
+ * when an existing field's type is switched). The reducer applies
5
+ * these so a fresh node always starts in a valid state for its type
6
+ * — except that map/array start empty (children come from add
7
+ * actions).
8
+ */
9
+ export declare function defaultValueFor(type: FieldType): unknown;
10
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CA2BxD"}
@@ -0,0 +1,37 @@
1
+ import { Timestamp, GeoPoint, Bytes } from 'pyric/firestore';
2
+ /**
3
+ * Default value used when a new field of this type is added (or
4
+ * when an existing field's type is switched). The reducer applies
5
+ * these so a fresh node always starts in a valid state for its type
6
+ * — except that map/array start empty (children come from add
7
+ * actions).
8
+ */
9
+ export function defaultValueFor(type) {
10
+ switch (type) {
11
+ case 'string':
12
+ return '';
13
+ case 'number':
14
+ return 0;
15
+ case 'boolean':
16
+ return false;
17
+ case 'null':
18
+ return null;
19
+ case 'timestamp':
20
+ return Timestamp.now();
21
+ case 'geopoint':
22
+ return new GeoPoint(0, 0);
23
+ case 'reference':
24
+ // No default — a fresh reference is invalid until the user
25
+ // sets a path. The validator will surface that.
26
+ return { path: '', id: '', firestore: {} };
27
+ case 'bytes':
28
+ return Bytes.fromUint8Array(new Uint8Array());
29
+ case 'vector':
30
+ // The wire-sentinel both inferType and the vector editor speak.
31
+ return { __type__: '__vector__', value: [] };
32
+ case 'map':
33
+ case 'array':
34
+ return undefined; // children carry the value
35
+ }
36
+ }
37
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/firestore/reducers/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC;QACX,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,WAAW;YACd,OAAO,SAAS,CAAC,GAAG,EAAE,CAAC;QACzB,KAAK,UAAU;YACb,OAAO,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,KAAK,WAAW;YACd,2DAA2D;YAC3D,gDAAgD;YAChD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAC7C,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;QAChD,KAAK,QAAQ;YACX,gEAAgE;YAChE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC/C,KAAK,KAAK,CAAC;QACX,KAAK,OAAO;YACV,OAAO,SAAS,CAAC,CAAC,2BAA2B;IACjD,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { DocumentEditorAction, DocumentEditorState } from './types.js';
2
+ /**
3
+ * Rehydrate serialized Firestore values back into class instances. Over a
4
+ * worker / postMessage boundary, a Timestamp/GeoPoint loses its class and
5
+ * arrives as a plain `{ seconds, nanoseconds }` / `{ latitude, longitude }`;
6
+ * the editor's validators check `instanceof`, so without this the editor opens
7
+ * with false "Expected a Timestamp/GeoPoint" errors. Vectors stay as their wire
8
+ * sentinel (there is no Vector constructor; the editor speaks the sentinel).
9
+ * The prototype guard stops the recursion from walking INTO instances and
10
+ * shredding them into plain maps.
11
+ */
12
+ export declare function rehydrateFirestoreValues(value: unknown): unknown;
13
+ /** Initial state factory. Builds tree + initial snapshot + error count. */
14
+ export declare function initState(initial: Record<string, unknown>): DocumentEditorState;
15
+ /**
16
+ * Pure reducer. Every action returns a fresh state — no in-place
17
+ * mutation of `state.tree`. Validation re-runs after the structural
18
+ * change so `errorCount` is always current. Container nodes (map /
19
+ * array) ignore actions that don't apply to them rather than
20
+ * throwing; the components only render valid affordances per type.
21
+ */
22
+ export declare function reducer(state: DocumentEditorState, action: DocumentEditorAction): DocumentEditorState;
23
+ //# sourceMappingURL=documentEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentEditor.d.ts","sourceRoot":"","sources":["../../../src/firestore/reducers/documentEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAGpB,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmBhE;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,mBAAmB,CAI/E;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,oBAAoB,GAC3B,mBAAmB,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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,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,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,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;IAC1B,CAAC;IACD,MAAM,QAAQ,GAA6B,EAAE,CAAC;IAC9C,KAAK,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,MAAc;IACjE,MAAM,GAAG,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,IAAI,CAAC;IACnB,uDAAuD;IACvD,IAAI,EAAE,SAAS,CAAC;IAChB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE;AACnB;oEACoE;GAClE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACnC;mEACmE;GACjE;IAAE,IAAI,EAAE,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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -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