@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,176 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useEffect, useRef } from 'react';
3
+ import { useDocumentEditor } from '../hooks/useDocumentEditor.js';
4
+ import { mergeFieldEditors } from '../fieldEditors/registry.js';
5
+ import { useContainerSize } from '../../primitives/hooks/useContainerSize.js';
6
+ const Ctx = createContext(null);
7
+ function useEditorContext() {
8
+ const ctx = useContext(Ctx);
9
+ if (!ctx) {
10
+ throw new Error('DocumentEditor.* components must render inside <DocumentEditor.Root>');
11
+ }
12
+ return ctx;
13
+ }
14
+ /**
15
+ * Wires the `useDocumentEditor` hook + field-editor registry into a
16
+ * React context so `<DocumentEditor.Fields>` and `<DocumentEditor.AddField>`
17
+ * can render the tree without prop drilling.
18
+ *
19
+ * Pattern: hook + compound component. Consumers wanting full control
20
+ * over the layout call `useDocumentEditor` directly and render their
21
+ * own tree; consumers wanting the default rendering use this.
22
+ */
23
+ export function DocumentEditorRoot({ initial, fieldEditors, onChange, children, className, }) {
24
+ const editor = useDocumentEditor({ initial });
25
+ const registry = mergeFieldEditors(fieldEditors);
26
+ // Hold the latest onChange in a ref so the effect's deps don't
27
+ // include the callback — avoids re-firing onChange on every parent
28
+ // re-render that produces a new function identity.
29
+ const onChangeRef = useRef(onChange);
30
+ onChangeRef.current = onChange;
31
+ useEffect(() => {
32
+ onChangeRef.current?.(editor);
33
+ }, [editor]);
34
+ const { ref: rootRef, size } = useContainerSize();
35
+ return (_jsx(Ctx.Provider, { value: { editor, fieldEditors: registry }, children: _jsx("div", { ref: rootRef, className: className, "data-pyric-ui": "document-editor", "data-pyric-is-valid": editor.isValid ? '' : undefined, "data-pyric-is-dirty": editor.isDirty ? '' : undefined, "data-size": size, children: children }) }));
36
+ }
37
+ /** Read access to the underlying editor state from inside a Root. */
38
+ export function useDocumentEditorContext() {
39
+ return useEditorContext().editor;
40
+ }
41
+ /**
42
+ * Renders the top-level fields of the document. For finer control,
43
+ * a consumer can call `useDocumentEditorContext()` and render the
44
+ * tree themselves.
45
+ */
46
+ export function DocumentEditorFields() {
47
+ const { editor } = useEditorContext();
48
+ // Stable INSERTION order, never re-sorted by the (currently being
49
+ // typed) key — `childIds` already preserves the order fields were
50
+ // added in, which is exactly what must stay stable while a row's
51
+ // name is edited. Sorting here was the cause of rows visibly
52
+ // reordering mid-keystroke.
53
+ const rootChildren = editor.tree.childIds[editor.tree.rootId] ?? [];
54
+ return (_jsxs("div", { "data-pyric-editor-fields": true, children: [rootChildren.map((id) => (_jsx(Field, { nodeId: id, path: fieldPath(editor, id) }, id))), _jsx(AddMapEntry, { parentId: editor.tree.rootId })] }));
55
+ }
56
+ function fieldPath(editor, nodeId) {
57
+ const segments = [];
58
+ let current = editor.tree.nodes[nodeId];
59
+ while (current && current.parentId != null) {
60
+ const parent = editor.tree.nodes[current.parentId];
61
+ if (!parent)
62
+ break;
63
+ if (parent.type === 'array') {
64
+ const idx = (editor.tree.childIds[parent.id] ?? []).indexOf(current.id);
65
+ segments.unshift(`[${idx}]`);
66
+ }
67
+ else {
68
+ segments.unshift(current.key ?? '');
69
+ }
70
+ current = parent;
71
+ }
72
+ // Join — array index segments don't take a leading dot.
73
+ return segments.reduce((acc, seg) => {
74
+ if (seg.startsWith('['))
75
+ return `${acc}${seg}`;
76
+ return acc ? `${acc}.${seg}` : seg;
77
+ }, '');
78
+ }
79
+ function Field({ nodeId, path }) {
80
+ const { editor, fieldEditors } = useEditorContext();
81
+ const node = editor.tree.nodes[nodeId];
82
+ if (!node)
83
+ return null;
84
+ if (node.type === 'map') {
85
+ return _jsx(MapField, { node: node, path: path });
86
+ }
87
+ if (node.type === 'array') {
88
+ return _jsx(ArrayField, { node: node, path: path });
89
+ }
90
+ const contract = fieldEditors[node.type];
91
+ const EditComponent = contract?.Edit;
92
+ if (!EditComponent)
93
+ return null;
94
+ // Errors are computed on every keystroke (so Save can gate on
95
+ // `isValid`), but only DISPLAYED once the field has been touched
96
+ // (blurred) or a submit attempt swept the tree — otherwise a
97
+ // freshly-added empty row would show "required" before the user
98
+ // has typed anything.
99
+ const showError = node.touched ? node.error : undefined;
100
+ return (_jsxs("div", { "data-pyric-field-entry": true, "data-field-name": node.key ?? undefined, "data-pyric-error": showError ? '' : undefined, onBlur: () => editor.touch(node.id), children: [_jsx(FieldChrome, { node: node, path: path }), _jsx(EditComponent, { value: node.value, path: path, error: showError, onChange: (v) => editor.setValue(node.id, v) })] }));
101
+ }
102
+ /**
103
+ * Per-field chrome: the field's key input (for map children), the
104
+ * type selector, and the remove button. Inline at every non-root
105
+ * node so consumers can hide individual pieces via `data-*` CSS.
106
+ */
107
+ function FieldChrome({ node, path }) {
108
+ const { editor } = useEditorContext();
109
+ const parent = node.parentId != null ? editor.tree.nodes[node.parentId] : null;
110
+ const inMap = parent?.type === 'map';
111
+ const isRoot = node.id === editor.tree.rootId;
112
+ if (isRoot)
113
+ return null;
114
+ return (_jsxs("div", { "data-pyric-field-chrome": true, "data-pyric-field-path": path, children: [inMap ? (_jsx("input", { type: "text", value: node.key ?? '', onChange: (e) => editor.setKey(node.id, e.target.value), "aria-label": "Field name", "data-pyric-field-key-input": true, "aria-invalid": node.touched && node.error ? 'true' : undefined })) : null, _jsx(TypeSelect, { node: node }), _jsx("button", { type: "button", onClick: () => editor.remove(node.id), "data-pyric-remove": true, "aria-label": "Remove field", children: "\u00D7" })] }));
115
+ }
116
+ const ALL_TYPES = [
117
+ 'string',
118
+ 'number',
119
+ 'boolean',
120
+ 'null',
121
+ 'timestamp',
122
+ 'geopoint',
123
+ 'reference',
124
+ 'bytes',
125
+ 'vector',
126
+ 'map',
127
+ 'array',
128
+ ];
129
+ function TypeSelect({ node }) {
130
+ const { editor } = useEditorContext();
131
+ const parent = node.parentId != null ? editor.tree.nodes[node.parentId] : null;
132
+ // Firestore disallows nested arrays — filter that option out
133
+ // when the parent is an array.
134
+ const options = ALL_TYPES.filter((t) => !(parent?.type === 'array' && t === 'array'));
135
+ return (_jsx("select", { value: node.type, onChange: (e) => editor.setType(node.id, e.target.value), "aria-label": "Field type", "data-pyric-field-type-select": true, children: options.map((t) => (_jsx("option", { value: t, children: t }, t))) }));
136
+ }
137
+ function MapField({ node, path }) {
138
+ const { editor } = useEditorContext();
139
+ // Stable insertion order — same rationale as `DocumentEditorFields`.
140
+ const children = editor.tree.childIds[node.id] ?? [];
141
+ return (_jsxs("div", { "data-pyric-field-entry": true, "data-pyric-field-type": "map", "data-field-name": node.key ?? undefined, children: [node.id !== editor.tree.rootId ? _jsx(FieldChrome, { node: node, path: path }) : null, _jsx("div", { "data-pyric-map-children": true, children: children.map((childId) => {
142
+ const child = editor.tree.nodes[childId];
143
+ if (!child)
144
+ return null;
145
+ const childPath = path ? `${path}.${child.key ?? ''}` : child.key ?? '';
146
+ return _jsx(Field, { nodeId: childId, path: childPath }, childId);
147
+ }) }), _jsx(AddMapEntry, { parentId: node.id })] }));
148
+ }
149
+ function ArrayField({ node, path }) {
150
+ const { editor } = useEditorContext();
151
+ const children = editor.tree.childIds[node.id] ?? [];
152
+ return (_jsxs("div", { "data-pyric-field-entry": true, "data-pyric-field-type": "array", "data-field-name": node.key ?? undefined, children: [_jsx(FieldChrome, { node: node, path: path }), _jsx("ol", { "data-pyric-array-children": true, children: children.map((childId, idx) => {
153
+ const childPath = path ? `${path}[${idx}]` : `[${idx}]`;
154
+ return (_jsx("li", { "data-field-index": String(idx), children: _jsx(Field, { nodeId: childId, path: childPath }) }, childId));
155
+ }) }), _jsx(AddArrayEntry, { parentId: node.id })] }));
156
+ }
157
+ function AddMapEntry({ parentId }) {
158
+ const { editor } = useEditorContext();
159
+ return (_jsx("button", { type: "button", "data-pyric-add-map-entry": true, onClick: () => editor.addMapEntry(parentId, '', 'string'), children: "+ Add field" }));
160
+ }
161
+ function AddArrayEntry({ parentId }) {
162
+ const { editor } = useEditorContext();
163
+ return (_jsx("button", { type: "button", "data-pyric-add-array-entry": true, onClick: () => editor.addArrayEntry(parentId, 'string'), children: "+ Add item" }));
164
+ }
165
+ /**
166
+ * Compound root export. Consumers pattern-match via dot access:
167
+ *
168
+ * <DocumentEditor.Root initial={data} onChange={…}>
169
+ * <DocumentEditor.Fields />
170
+ * </DocumentEditor.Root>
171
+ */
172
+ export const DocumentEditor = {
173
+ Root: DocumentEditorRoot,
174
+ Fields: DocumentEditorFields,
175
+ };
176
+ //# sourceMappingURL=DocumentEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentEditor.js","sourceRoot":"","sources":["../../../src/firestore/components/DocumentEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAgC,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAO9E,MAAM,GAAG,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEtD,SAAS,gBAAgB;IACvB,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAiBD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,SAAS,GACe;IACxB,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9C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0 +1,60 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DocumentReference, QueryDocumentSnapshot } from 'pyric/firestore';
3
+ export interface DocumentListProps {
4
+ documents: QueryDocumentSnapshot[];
5
+ isLoading?: boolean;
6
+ error?: Error;
7
+ hasMore?: boolean;
8
+ onSelect?: (ref: DocumentReference) => void;
9
+ /** Fired when the user requests another page. Wire to the hook's
10
+ * `loadMore`. The component will not render a Load More button
11
+ * when this is undefined. */
12
+ onLoadMore?: () => void;
13
+ /**
14
+ * Optional renderer for the row label. Default renders the doc id.
15
+ * Override to show a field value alongside, an icon, etc.
16
+ */
17
+ renderLabel?: (doc: QueryDocumentSnapshot) => ReactNode;
18
+ /**
19
+ * Optional per-row action(s), rendered as a SIBLING of the row's
20
+ * select button inside the entry (not nested in it — so the action
21
+ * carries its own click handling without an invalid button-in-button).
22
+ * Used for row-level affordances like delete.
23
+ */
24
+ renderRowAction?: (doc: QueryDocumentSnapshot) => ReactNode;
25
+ emptyState?: ReactNode;
26
+ className?: string;
27
+ /**
28
+ * Above this row count, the list switches to virtualization via
29
+ * `<VirtualList>`. Default 100. Set to `Infinity` to disable
30
+ * (e.g. when measuring layout shifts is more important than
31
+ * scroll perf).
32
+ */
33
+ virtualizeThreshold?: number;
34
+ /**
35
+ * Estimated row height when virtualizing. Default 36 — matches
36
+ * a single-line text button at 13px font + ~10px padding. Pass
37
+ * a function for variable sizing (TanStack measures the actual
38
+ * height via ResizeObserver after the first paint anyway).
39
+ */
40
+ rowHeight?: number | ((index: number) => number);
41
+ /**
42
+ * Pixel height the virtualized scroll container fills. Only
43
+ * applies when `documents.length > virtualizeThreshold`. Default
44
+ * `'60vh'` — consumers usually constrain via their layout.
45
+ */
46
+ virtualizedHeight?: number | string;
47
+ }
48
+ /**
49
+ * Headless document list. Below `virtualizeThreshold`, renders a
50
+ * plain `<ul>`; above it, switches to TanStack-Virtual via
51
+ * `<VirtualList>` so 10k-doc collections don't bloat the DOM.
52
+ *
53
+ * The hook owns pagination state; this component just renders. The
54
+ * Load More button only renders when `hasMore` is true AND
55
+ * `onLoadMore` is provided. Consumers wanting infinite scroll
56
+ * trigger `onLoadMore` from a sentinel `IntersectionObserver` in
57
+ * their own code — the component doesn't bake that policy in.
58
+ */
59
+ export declare function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, virtualizeThreshold, rowHeight, virtualizedHeight, }: DocumentListProps): import("react").JSX.Element;
60
+ //# sourceMappingURL=DocumentList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentList.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAahF,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C;;kCAE8B;IAC9B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,SAAS,CAAC;IACxD;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAC5D,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACjD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,EACT,mBAAyB,EACzB,SAAc,EACd,iBAA0B,GAC3B,EAAE,iBAAiB,+BAmGnB"}
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { VirtualList } from '../../primitives/VirtualList.js';
3
+ /**
4
+ * Both backends carry `.ref` on snapshots at runtime, but the
5
+ * `pyric/firestore` modular interface omits it. Pull it through
6
+ * a structural cast — safe because the property is guaranteed by
7
+ * the underlying SDKs.
8
+ */
9
+ function snapshotRef(snap) {
10
+ return snap.ref;
11
+ }
12
+ /**
13
+ * Headless document list. Below `virtualizeThreshold`, renders a
14
+ * plain `<ul>`; above it, switches to TanStack-Virtual via
15
+ * `<VirtualList>` so 10k-doc collections don't bloat the DOM.
16
+ *
17
+ * The hook owns pagination state; this component just renders. The
18
+ * Load More button only renders when `hasMore` is true AND
19
+ * `onLoadMore` is provided. Consumers wanting infinite scroll
20
+ * trigger `onLoadMore` from a sentinel `IntersectionObserver` in
21
+ * their own code — the component doesn't bake that policy in.
22
+ */
23
+ export function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, virtualizeThreshold = 100, rowHeight = 36, virtualizedHeight = '60vh', }) {
24
+ if (error) {
25
+ return (_jsx("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-error": "", role: "alert", children: error.message }));
26
+ }
27
+ if (isLoading && documents.length === 0) {
28
+ return (_jsx("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-loading": "" }));
29
+ }
30
+ if (documents.length === 0) {
31
+ return (_jsx("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-empty": "", children: emptyState }));
32
+ }
33
+ const virtualized = documents.length > virtualizeThreshold;
34
+ return (_jsxs("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-virtualized": virtualized ? '' : undefined, children: [virtualized ? (_jsx(VirtualList, { items: documents, estimateSize: rowHeight, height: virtualizedHeight, getItemKey: (doc) => snapshotRef(doc).path, renderItem: (doc) => (_jsxs("div", { "data-pyric-document-entry": true, "data-pyric-document-id": doc.id, children: [_jsx("button", { type: "button", onClick: () => onSelect?.(snapshotRef(doc)), "data-pyric-document-select": true, children: renderLabel ? renderLabel(doc) : doc.id }), renderRowAction ? (_jsx("span", { "data-pyric-document-action": true, children: renderRowAction(doc) })) : null] })) })) : (_jsx("ul", { "data-pyric-document-list-items": true, children: documents.map((doc) => {
35
+ const ref = snapshotRef(doc);
36
+ return (_jsxs("li", { "data-pyric-document-entry": true, "data-pyric-document-id": doc.id, children: [_jsx("button", { type: "button", onClick: () => onSelect?.(ref), "data-pyric-document-select": true, children: renderLabel ? renderLabel(doc) : doc.id }), renderRowAction ? (_jsx("span", { "data-pyric-document-action": true, children: renderRowAction(doc) })) : null] }, ref.path));
37
+ }) })), hasMore && onLoadMore ? (_jsx("button", { type: "button", onClick: onLoadMore, "data-pyric-load-more": true, disabled: isLoading, children: "Load more" })) : null] }));
38
+ }
39
+ //# sourceMappingURL=DocumentList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentList.js","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAA2B;IAC9C,OAAQ,IAA8C,CAAC,GAAG,CAAC;AAC7D,CAAC;AAgDD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EAC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,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GACjC,EACR,eAAe,CAAC,CAAC,CAAC,CACjB,6DAAkC,eAAe,CAAC,GAAG,CAAC,GAAQ,CAC/D,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,GACD,CACH,CAAC,CAAC,CAAC,CACF,+DACG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACrB,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;oBAC7B,OAAO,CACL,2EAG0B,GAAG,CAAC,EAAE,aAE9B,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,gDAG7B,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GACjC,EACR,eAAe,CAAC,CAAC,CAAC,CACjB,6DAAkC,eAAe,CAAC,GAAG,CAAC,GAAQ,CAC/D,CAAC,CAAC,CAAC,IAAI,KAbH,GAAG,CAAC,IAAI,CAcV,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,CACN,EACA,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CACvB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,UAAU,gCAEnB,QAAQ,EAAE,SAAS,0BAGZ,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { CollectionReference, DocumentReference, DocumentSnapshot, Firestore } from 'pyric/firestore';
3
+ import type { FieldEditorRegistry } from '../fieldEditors/types.js';
4
+ import { type ListSubcollections } from '../hooks/useDocumentSubcollections.js';
5
+ export interface DocumentPreviewProps {
6
+ /** Snapshot from `useFirestoreDoc` or `getDoc`. When `null` /
7
+ * `undefined`, renders {@link emptyState}. */
8
+ snapshot: DocumentSnapshot | null | undefined;
9
+ /** Override or extend the built-in field editors. Merged on top
10
+ * of {@link defaultFieldEditors} — only the keys you provide
11
+ * override. */
12
+ fieldEditors?: FieldEditorRegistry;
13
+ /** Content rendered when the snapshot is missing or
14
+ * `!exists()`. Defaults to `null` (renders nothing). */
15
+ emptyState?: ReactNode;
16
+ /** Forwarded to the root `<div>`. */
17
+ className?: string;
18
+ /**
19
+ * Fired when a reference field is clicked. When supplied, the
20
+ * reference Display renders as an interactive `<button>` (with
21
+ * `data-pyric-clickable`); when omitted, it stays inert as a
22
+ * `<span>`. Consumers wire navigation here — the library does
23
+ * not depend on a router.
24
+ */
25
+ onReferenceClick?: (ref: DocumentReference) => void;
26
+ /**
27
+ * The document's own reference. Required to surface its
28
+ * subcollections — `DocumentSnapshot` (as typed by `pyric/firestore`)
29
+ * doesn't expose `.ref`, so the consumer threads the ref it already
30
+ * holds from fetching the doc. Without it (or without
31
+ * {@link listSubcollections}) the Subcollections section is omitted.
32
+ */
33
+ documentRef?: DocumentReference | null;
34
+ /**
35
+ * Firestore handle passed to {@link listSubcollections}. Required
36
+ * alongside `documentRef` + `listSubcollections` to surface the
37
+ * Subcollections section (the same explicit-handle shape
38
+ * `ReferencePicker` uses).
39
+ */
40
+ firestore?: Firestore;
41
+ /**
42
+ * Injected lister for the document's subcollections. The modular Web
43
+ * SDK has no client-side `listCollections`; sandbox-backed apps wire
44
+ * `pyric/sandbox`'s in-process listing, production apps pass a known
45
+ * list or a server proxy. Same shape `ReferencePicker` /
46
+ * `useCollectionList` use. Omit to hide the Subcollections section.
47
+ */
48
+ listSubcollections?: ListSubcollections;
49
+ /**
50
+ * Fired when a subcollection's drill affordance is activated. Receives
51
+ * the subcollection's `CollectionReference` (its `.path` is the
52
+ * navigate target). Consumers wire navigation here.
53
+ */
54
+ onSubcollectionClick?: (collection: CollectionReference) => void;
55
+ }
56
+ /**
57
+ * Read-only renderer for a Firestore document. Iterates top-level
58
+ * fields in lexicographic order; each field dispatches through the
59
+ * field-editor registry on its inferred type.
60
+ *
61
+ * Headless — no shipped CSS. Consumers style via `className` on the
62
+ * root and `[data-pyric-field-type]` / `[data-pyric-field-path]`
63
+ * attribute selectors on the per-field nodes.
64
+ *
65
+ * Editing arrives in M3 (`<DocumentEditor>`). M2 only displays.
66
+ */
67
+ export declare function DocumentPreview({ snapshot, fieldEditors, emptyState, className, onReferenceClick, documentRef, firestore, listSubcollections, onSubcollectionClick, }: DocumentPreviewProps): import("react").JSX.Element;
68
+ //# sourceMappingURL=DocumentPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPreview.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/DocumentPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACV,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,uCAAuC,CAAC;AAa/C,MAAM,WAAW,oBAAoB;IACnC;mDAC+C;IAC/C,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C;;oBAEgB;IAChB,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC;6DACyD;IACzD,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAClE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,YAAY,EACZ,UAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,oBAAoB,+BAqCtB"}
@@ -0,0 +1,76 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import { FieldRenderer } from './FieldRenderer.js';
4
+ import { inferType } from '../types.js';
5
+ import { mergeFieldEditors } from '../fieldEditors/registry.js';
6
+ import { DisplayContextProvider } from './context.js';
7
+ import { useContainerSize } from '../../primitives/hooks/useContainerSize.js';
8
+ import { useDocumentSubcollections, } from '../hooks/useDocumentSubcollections.js';
9
+ /**
10
+ * `DocumentSnapshot.exists` is a method on the firebase/firestore
11
+ * `QueryDocumentSnapshot` (`.exists()`) and a getter/property on the
12
+ * Admin chainable adapter. `pyric/firestore` unions the two; this
13
+ * helper handles either.
14
+ */
15
+ function snapshotExists(snapshot) {
16
+ const e = snapshot.exists;
17
+ return typeof e === 'function' ? e.call(snapshot) : e;
18
+ }
19
+ /**
20
+ * Read-only renderer for a Firestore document. Iterates top-level
21
+ * fields in lexicographic order; each field dispatches through the
22
+ * field-editor registry on its inferred type.
23
+ *
24
+ * Headless — no shipped CSS. Consumers style via `className` on the
25
+ * root and `[data-pyric-field-type]` / `[data-pyric-field-path]`
26
+ * attribute selectors on the per-field nodes.
27
+ *
28
+ * Editing arrives in M3 (`<DocumentEditor>`). M2 only displays.
29
+ */
30
+ export function DocumentPreview({ snapshot, fieldEditors, emptyState = null, className, onReferenceClick, documentRef, firestore, listSubcollections, onSubcollectionClick, }) {
31
+ const displayCtx = useMemo(() => ({ onReferenceClick }), [onReferenceClick]);
32
+ const { ref: rootRef, size } = useContainerSize();
33
+ if (!snapshot || !snapshotExists(snapshot)) {
34
+ return _jsx(_Fragment, { children: emptyState });
35
+ }
36
+ const data = snapshot.data() ?? {};
37
+ const entries = Object.entries(data).sort(([a], [b]) => a.localeCompare(b));
38
+ const registry = mergeFieldEditors(fieldEditors);
39
+ return (_jsx(DisplayContextProvider, { value: displayCtx, children: _jsxs("div", { ref: rootRef, className: className, "data-pyric-ui": "document-preview", "data-doc-id": snapshot.id, "data-size": size, children: [entries.map(([key, value]) => (_jsx(FieldEntry, { fieldKey: key, value: value, registry: registry }, key))), firestore && documentRef && listSubcollections ? (_jsx(SubcollectionsSection, { firestore: firestore, documentRef: documentRef, listSubcollections: listSubcollections, onSubcollectionClick: onSubcollectionClick })) : null] }) }));
40
+ }
41
+ /**
42
+ * One top-level document field. A scalar renders `key value` in the field grid;
43
+ * a map/array renders a disclosure (chevron + key) that collapses its value, so
44
+ * top-level containers toggle just like the nested tree does. A chevron gutter
45
+ * sits on scalars too (empty) so every key aligns.
46
+ */
47
+ function FieldEntry({ fieldKey, value, registry, }) {
48
+ const type = inferType(value);
49
+ const nested = type === 'map' || type === 'array';
50
+ const [expanded, setExpanded] = useState(true);
51
+ if (!nested) {
52
+ return (_jsxs("div", { "data-pyric-field-entry": true, "data-field-name": fieldKey, children: [_jsxs("span", { "data-pyric-field-keycell": true, children: [_jsx("span", { "data-pyric-tree-chevron": true, "data-pyric-tree-chevron-empty": true, "aria-hidden": "true" }), _jsx("span", { "data-pyric-field-key": true, children: fieldKey })] }), _jsx(FieldRenderer, { value: value, path: fieldKey, fieldEditors: registry })] }));
53
+ }
54
+ return (_jsxs("div", { "data-pyric-field-entry": true, "data-field-name": fieldKey, "data-pyric-field-nested": true, children: [_jsxs("button", { type: "button", "data-pyric-field-keycell": true, "data-pyric-field-toggle": true, "aria-expanded": expanded, onClick: () => setExpanded((e) => !e), children: [_jsx("span", { "data-pyric-tree-chevron": true, "aria-hidden": "true", children: "\u203A" }), _jsx("span", { "data-pyric-field-key": true, children: fieldKey })] }), expanded ? _jsx(FieldRenderer, { value: value, path: fieldKey, fieldEditors: registry }) : null] }));
55
+ }
56
+ /**
57
+ * The "Subcollections" section under a document's fields. Lists the
58
+ * document's OWN subcollections (name + a drill affordance), mirroring
59
+ * the `c-data` mock. Reuses the injected-lister pattern; emits the
60
+ * subcollection ref through {@link onSubcollectionClick} for navigation.
61
+ *
62
+ * Renders nothing once loaded if the document has no subcollections —
63
+ * an empty section is noise. While loading it carries
64
+ * `data-pyric-loading` so consumers can show a placeholder.
65
+ */
66
+ function SubcollectionsSection({ firestore, documentRef, listSubcollections, onSubcollectionClick, }) {
67
+ const { subcollections, isLoading } = useDocumentSubcollections({
68
+ firestore,
69
+ documentRef,
70
+ listSubcollections,
71
+ });
72
+ if (!isLoading && subcollections.length === 0)
73
+ return null;
74
+ return (_jsxs("section", { "data-pyric-ui": "subcollections", "data-pyric-loading": isLoading ? '' : undefined, children: [_jsx("div", { "data-pyric-subcollections-group": true, children: "Subcollections" }), _jsx("ul", { "data-pyric-subcollections-list": true, children: subcollections.map((coll) => (_jsx("li", { "data-pyric-subcollection": true, "data-pyric-collection-id": coll.id, "data-pyric-collection-path": coll.path, children: onSubcollectionClick ? (_jsxs("button", { type: "button", "data-pyric-subcollection-row": true, "data-pyric-clickable": true, onClick: () => onSubcollectionClick(coll), "aria-label": `Open subcollection ${coll.id}`, children: [_jsx("span", { "data-pyric-subcollection-key": true, children: coll.id }), _jsx("span", { "data-pyric-subcollection-type": true, children: "subcollection" }), _jsx("span", { "data-pyric-subcollection-drill": true, "aria-hidden": "true", children: "\u203A" })] })) : (_jsxs("div", { "data-pyric-subcollection-row": true, children: [_jsx("span", { "data-pyric-subcollection-key": true, children: coll.id }), _jsx("span", { "data-pyric-subcollection-type": true, children: "subcollection" }), _jsx("span", { "data-pyric-subcollection-drill": true, "aria-hidden": "true", children: "\u203A" })] })) }, coll.path))) })] }));
75
+ }
76
+ //# sourceMappingURL=DocumentPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPreview.js","sourceRoot":"","sources":["../../../src/firestore/components/DocumentPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAO1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAA4B,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EACL,yBAAyB,GAE1B,MAAM,uCAAuC,CAAC;AAE/C;;;;;GAKG;AACH,SAAS,cAAc,CAAC,QAA0B;IAChD,MAAM,CAAC,GAAI,QAAkD,CAAC,MAAM,CAAC;IACrE,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAsDD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,YAAY,EACZ,UAAU,GAAG,IAAI,EACjB,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,oBAAoB,GACC;IACrB,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAC5B,CAAC,gBAAgB,CAAC,CACnB,CAAC;IACF,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAkB,CAAC;IAElE,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,OAAO,4BAAG,UAAU,GAAI,CAAC;IAC3B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AAoB,CAAC,CAAC,CAAC,CACtB,kBACE,IAAI,EAAC,QAAQ,sEAGb,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,gBAC7B,sBAAsB,IAAI,CAAC,EAAE,EAAE,aAE3C,+DAAoC,IAAI,CAAC,EAAE,GAAQ,EACnD,kFAAwD,EACxD,sEAAiD,MAAM,uBAEhD,IACA,CACV,CAAC,CAAC,CAAC,CACF,gEACE,+DAAoC,IAAI,CAAC,EAAE,GAAQ,EACnD,kFAAwD,EACxD,sEAAiD,MAAM,uBAEhD,IACH,CACP,IA3BI,IAAI,CAAC,IAAI,CA4BX,CACN,CAAC,GACC,IACG,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { FieldEditorRegistry } from '../fieldEditors/types.js';
2
+ export interface FieldRendererProps {
3
+ value: unknown;
4
+ path?: string;
5
+ /** Registry to dispatch through. Pass the merged registry — this
6
+ * component does not fall back to defaults on its own (to avoid
7
+ * a circular import with the editors). `<DocumentPreview>` is
8
+ * the entry point that merges user overrides into defaults. */
9
+ fieldEditors: FieldEditorRegistry;
10
+ }
11
+ /**
12
+ * Dispatches a single value to its registered display component.
13
+ * Recursive editors (Map, Array) re-enter through this component
14
+ * for their children, threading the same registry.
15
+ */
16
+ export declare function FieldRenderer({ value, path, fieldEditors }: FieldRendererProps): import("react").JSX.Element | null;
17
+ //# sourceMappingURL=FieldRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldRenderer.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/FieldRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;oEAGgE;IAChE,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,kBAAkB,sCAM9E"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { inferType } from '../types.js';
3
+ /**
4
+ * Dispatches a single value to its registered display component.
5
+ * Recursive editors (Map, Array) re-enter through this component
6
+ * for their children, threading the same registry.
7
+ */
8
+ export function FieldRenderer({ value, path, fieldEditors }) {
9
+ const type = inferType(value);
10
+ const contract = fieldEditors[type];
11
+ if (!contract)
12
+ return null;
13
+ const { Display } = contract;
14
+ return _jsx(Display, { value: value, path: path, fieldEditors: fieldEditors });
15
+ }
16
+ //# sourceMappingURL=FieldRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldRenderer.js","sourceRoot":"","sources":["../../../src/firestore/components/FieldRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAsB;IAC7E,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC7B,OAAO,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,GAAI,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type UseQueryBuilderOptions, type UseQueryBuilderResult } from '../hooks/useQueryBuilder.js';
2
+ export interface QueryBuilderProps {
3
+ /** Drives the hook used internally. Both the state and the
4
+ * composed Query are exposed via `onChange`. */
5
+ initial?: UseQueryBuilderOptions['initial'];
6
+ /** Fired on every state change with the latest builder API. The
7
+ * parent typically calls `builder.buildQuery(collection)` and
8
+ * feeds the result into `useDocumentList` / `useFirestoreCollection`. */
9
+ onChange?: (builder: UseQueryBuilderResult) => void;
10
+ className?: string;
11
+ }
12
+ /**
13
+ * Default visible composition over `useQueryBuilder`. Renders the
14
+ * condition list + orderBy + limit form. Headless — every node
15
+ * carries `data-pyric-*` for styling.
16
+ *
17
+ * Values are JSON-parsed on input. `42`, `"text"`, `true`, `null`,
18
+ * and `[1, 2, 3]` (for `in`/`not-in`/`array-contains-any`) all
19
+ * work; raw strings that aren't JSON-parsable fall through as-is.
20
+ * For non-JSON Firestore values (Timestamp, GeoPoint, Reference,
21
+ * Bytes), consumers either use the hook directly with their own
22
+ * value editors or swap the rendered component out.
23
+ */
24
+ export declare function QueryBuilder({ initial, onChange, className }: QueryBuilderProps): import("react").JSX.Element;
25
+ //# sourceMappingURL=QueryBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/QueryBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC;qDACiD;IACjD,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC5C;;8EAE0E;IAC1E,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BA6H/E"}
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useQueryBuilder, QUERY_OPS, MULTI_VALUE_OPS, } from '../hooks/useQueryBuilder.js';
3
+ /**
4
+ * Default visible composition over `useQueryBuilder`. Renders the
5
+ * condition list + orderBy + limit form. Headless — every node
6
+ * carries `data-pyric-*` for styling.
7
+ *
8
+ * Values are JSON-parsed on input. `42`, `"text"`, `true`, `null`,
9
+ * and `[1, 2, 3]` (for `in`/`not-in`/`array-contains-any`) all
10
+ * work; raw strings that aren't JSON-parsable fall through as-is.
11
+ * For non-JSON Firestore values (Timestamp, GeoPoint, Reference,
12
+ * Bytes), consumers either use the hook directly with their own
13
+ * value editors or swap the rendered component out.
14
+ */
15
+ export function QueryBuilder({ initial, onChange, className }) {
16
+ const builder = useQueryBuilder({ initial });
17
+ // Pipe state changes back to the consumer. We don't memoize on
18
+ // the builder object itself since the hook already memoizes
19
+ // internally; calling onChange every render is cheap and matches
20
+ // the `<DocumentEditor>` pattern.
21
+ if (onChange)
22
+ onChange(builder);
23
+ return (_jsxs("div", { className: className, "data-pyric-ui": "query-builder", children: [_jsx("ul", { "data-pyric-query-conditions": true, children: builder.conditions.map((cond) => (_jsxs("li", { "data-pyric-query-condition": true, children: [_jsx("input", { type: "text", value: cond.field, placeholder: "field", onChange: (e) => builder.updateCondition(cond.id, { field: e.target.value }), "data-pyric-query-field": true, "aria-label": "Field" }), _jsx("select", { value: cond.op, onChange: (e) => builder.updateCondition(cond.id, { op: e.target.value }), "data-pyric-query-op": true, "aria-label": "Operator", children: QUERY_OPS.map((op) => (_jsx("option", { value: op, children: op }, op))) }), _jsx("input", { type: "text", value: stringifyValue(cond.value), placeholder: MULTI_VALUE_OPS.has(cond.op) ? '[1, 2]' : 'value', onChange: (e) => builder.updateCondition(cond.id, { value: parseValue(e.target.value) }), "data-pyric-query-value": true, "aria-label": "Value" }), _jsx("button", { type: "button", onClick: () => builder.removeCondition(cond.id), "data-pyric-query-remove": true, "aria-label": "Remove condition", children: "\u00D7" })] }, cond.id))) }), _jsx("button", { type: "button", onClick: () => builder.addCondition(), "data-pyric-query-add-condition": true, children: "+ Add condition" }), _jsxs("div", { "data-pyric-query-modifiers": true, children: [_jsxs("label", { "data-pyric-query-orderby": true, children: [_jsx("span", { children: "orderBy" }), _jsx("input", { type: "text", value: builder.orderBy?.field ?? '', placeholder: "field", onChange: (e) => {
24
+ const field = e.target.value;
25
+ if (!field) {
26
+ builder.setOrderBy(undefined);
27
+ }
28
+ else {
29
+ builder.setOrderBy({
30
+ field,
31
+ direction: builder.orderBy?.direction ?? 'asc',
32
+ });
33
+ }
34
+ }, "data-pyric-query-orderby-field": true }), _jsxs("select", { value: builder.orderBy?.direction ?? 'asc', onChange: (e) => {
35
+ if (!builder.orderBy?.field)
36
+ return;
37
+ builder.setOrderBy({
38
+ field: builder.orderBy.field,
39
+ direction: e.target.value,
40
+ });
41
+ }, disabled: !builder.orderBy?.field, "data-pyric-query-orderby-direction": true, children: [_jsx("option", { value: "asc", children: "asc" }), _jsx("option", { value: "desc", children: "desc" })] })] }), _jsxs("label", { "data-pyric-query-limit": true, children: [_jsx("span", { children: "limit" }), _jsx("input", { type: "number", min: 0, value: builder.limit ?? '', placeholder: "\u221E", onChange: (e) => {
42
+ const v = e.target.value;
43
+ if (!v) {
44
+ builder.setLimit(undefined);
45
+ }
46
+ else {
47
+ const n = parseInt(v, 10);
48
+ builder.setLimit(Number.isFinite(n) ? n : undefined);
49
+ }
50
+ }, "data-pyric-query-limit-input": true })] })] })] }));
51
+ }
52
+ function parseValue(raw) {
53
+ if (raw === '')
54
+ return '';
55
+ try {
56
+ return JSON.parse(raw);
57
+ }
58
+ catch {
59
+ // Not JSON — return the raw string. Firestore `where` will
60
+ // refuse mistyped values at query time; the builder doesn't
61
+ // gate on type because some workflows (e.g. searching by a
62
+ // numeric-string id) are deliberate.
63
+ return raw;
64
+ }
65
+ }
66
+ function stringifyValue(v) {
67
+ if (typeof v === 'string')
68
+ return v;
69
+ if (v === undefined)
70
+ return '';
71
+ try {
72
+ return JSON.stringify(v);
73
+ }
74
+ catch {
75
+ return String(v);
76
+ }
77
+ }
78
+ //# sourceMappingURL=QueryBuilder.js.map