@pyric/ui 0.1.0-alpha.7 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +216 -0
- package/dist/auth/components/AuthUserList.d.ts +15 -4
- package/dist/auth/components/AuthUserList.d.ts.map +1 -1
- package/dist/auth/components/AuthUserList.js +3 -3
- package/dist/auth/components/AuthUserList.js.map +1 -1
- package/dist/firestore/components/DocumentList.d.ts +5 -2
- package/dist/firestore/components/DocumentList.d.ts.map +1 -1
- package/dist/firestore/components/DocumentList.js +17 -3
- package/dist/firestore/components/DocumentList.js.map +1 -1
- package/dist/firestore/firestoreApi.d.ts +2 -2
- package/dist/firestore/firestoreApi.d.ts.map +1 -1
- package/dist/firestore/firestoreApi.js +2 -1
- package/dist/firestore/firestoreApi.js.map +1 -1
- package/dist/firestore/hooks/useDocumentEditor.d.ts +7 -4
- package/dist/firestore/hooks/useDocumentEditor.d.ts.map +1 -1
- package/dist/firestore/hooks/useDocumentEditor.js +7 -4
- package/dist/firestore/hooks/useDocumentEditor.js.map +1 -1
- package/dist/firestore/hooks/useDocumentList.d.ts +18 -13
- package/dist/firestore/hooks/useDocumentList.d.ts.map +1 -1
- package/dist/firestore/hooks/useDocumentList.js +77 -27
- package/dist/firestore/hooks/useDocumentList.js.map +1 -1
- package/dist/firestore/hooks/useFirestoreCollection.d.ts +1 -1
- package/dist/firestore/hooks/useFirestoreCollection.d.ts.map +1 -1
- package/dist/firestore/hooks/useFirestoreCollection.js +3 -2
- package/dist/firestore/hooks/useFirestoreCollection.js.map +1 -1
- package/dist/firestore/hooks/useFirestoreDoc.d.ts +1 -1
- package/dist/firestore/hooks/useFirestoreDoc.d.ts.map +1 -1
- package/dist/firestore/hooks/useFirestoreDoc.js +3 -2
- package/dist/firestore/hooks/useFirestoreDoc.js.map +1 -1
- package/dist/firestore/index.d.ts +1 -0
- package/dist/firestore/index.d.ts.map +1 -1
- package/dist/firestore/index.js +1 -0
- package/dist/firestore/index.js.map +1 -1
- package/dist/firestore/reducers/documentEditor.d.ts.map +1 -1
- package/dist/firestore/reducers/documentEditor.js +2 -0
- package/dist/firestore/reducers/documentEditor.js.map +1 -1
- package/dist/firestore/reducers/types.d.ts +3 -0
- package/dist/firestore/reducers/types.d.ts.map +1 -1
- package/dist/firestore/valueEquality.d.ts +4 -0
- package/dist/firestore/valueEquality.d.ts.map +1 -0
- package/dist/firestore/valueEquality.js +44 -0
- package/dist/firestore/valueEquality.js.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts +18 -0
- package/dist/primitives/hooks/useUpdateHighlights.d.ts.map +1 -0
- package/dist/primitives/hooks/useUpdateHighlights.js +84 -0
- package/dist/primitives/hooks/useUpdateHighlights.js.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/rtdb/components/RtdbTree.js +2 -1
- package/dist/rtdb/components/RtdbTree.js.map +1 -1
- package/dist/rtdb/hooks/useRtdbTree.d.ts +2 -0
- package/dist/rtdb/hooks/useRtdbTree.d.ts.map +1 -1
- package/dist/rtdb/hooks/useRtdbTree.js +20 -2
- package/dist/rtdb/hooks/useRtdbTree.js.map +1 -1
- package/dist/rtdb/values.d.ts +6 -0
- package/dist/rtdb/values.d.ts.map +1 -1
- package/dist/rtdb/values.js +43 -0
- package/dist/rtdb/values.js.map +1 -1
- package/dist/rules/hooks/useDenialTrace.d.ts +1 -1
- package/dist/rules/hooks/useDenialTrace.d.ts.map +1 -1
- package/dist/rules/hooks/useDenialTrace.js +1 -1
- package/dist/rules/hooks/useDenialTrace.js.map +1 -1
- package/dist/rules/types.d.ts +1 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts +0 -2
- package/dist/storage/components/DeleteSelectionWithConfirm.d.ts.map +1 -1
- package/dist/storage/components/DeleteSelectionWithConfirm.js.map +1 -1
- package/dist/storage/components/ObjectBrowser.d.ts +6 -3
- package/dist/storage/components/ObjectBrowser.d.ts.map +1 -1
- package/dist/storage/components/ObjectBrowser.js +6 -5
- package/dist/storage/components/ObjectBrowser.js.map +1 -1
- package/dist/storage/components/ObjectInspector.d.ts +1 -1
- package/dist/storage/components/ObjectInspector.d.ts.map +1 -1
- package/dist/storage/folderPlaceholder.d.ts +9 -3
- package/dist/storage/folderPlaceholder.d.ts.map +1 -1
- package/dist/storage/folderPlaceholder.js +12 -5
- package/dist/storage/folderPlaceholder.js.map +1 -1
- package/dist/storage/hooks/useObjectUpload.d.ts +5 -9
- package/dist/storage/hooks/useObjectUpload.d.ts.map +1 -1
- package/dist/storage/hooks/useObjectUpload.js.map +1 -1
- package/dist/storage/hooks/useStorageDelete.d.ts +2 -1
- package/dist/storage/hooks/useStorageDelete.d.ts.map +1 -1
- package/dist/storage/hooks/useStorageDelete.js +19 -13
- package/dist/storage/hooks/useStorageDelete.js.map +1 -1
- package/dist/storage/hooks/useStorageList.d.ts +5 -7
- package/dist/storage/hooks/useStorageList.d.ts.map +1 -1
- package/dist/storage/hooks/useStorageList.js +5 -8
- package/dist/storage/hooks/useStorageList.js.map +1 -1
- package/dist/storage/hooks/useStorageObject.d.ts +4 -5
- package/dist/storage/hooks/useStorageObject.d.ts.map +1 -1
- package/dist/storage/hooks/useStorageObject.js.map +1 -1
- package/dist/storage/hooks/useStorageRulesGate.d.ts +5 -17
- package/dist/storage/hooks/useStorageRulesGate.d.ts.map +1 -1
- package/dist/storage/hooks/useStorageRulesGate.js +35 -43
- package/dist/storage/hooks/useStorageRulesGate.js.map +1 -1
- package/dist/storage/pendingPrefixes.d.ts +7 -3
- package/dist/storage/pendingPrefixes.d.ts.map +1 -1
- package/dist/storage/pendingPrefixes.js +9 -3
- package/dist/storage/pendingPrefixes.js.map +1 -1
- package/dist/storage/storageApi.d.ts +1 -1
- package/dist/storage/storageApi.d.ts.map +1 -1
- package/dist/storage/storageApi.js +9 -2
- package/dist/storage/storageApi.js.map +1 -1
- package/dist/traffic/components/TrafficLineChart.d.ts +4 -1
- package/dist/traffic/components/TrafficLineChart.d.ts.map +1 -1
- package/dist/traffic/components/TrafficLineChart.js +3 -3
- package/dist/traffic/components/TrafficLineChart.js.map +1 -1
- package/dist/traffic/components/TrafficRow.js +1 -1
- package/dist/traffic/components/TrafficRow.js.map +1 -1
- package/dist/traffic/components/TrafficTimeline.d.ts +12 -5
- package/dist/traffic/components/TrafficTimeline.d.ts.map +1 -1
- package/dist/traffic/components/TrafficTimeline.js +20 -6
- package/dist/traffic/components/TrafficTimeline.js.map +1 -1
- package/dist/traffic/hooks/useTrafficMetrics.js +1 -1
- package/package.json +17 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
Copyright 2026 David East
|
|
205
|
+
|
|
206
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
+
you may not use this file except in compliance with the License.
|
|
208
|
+
You may obtain a copy of the License at
|
|
209
|
+
|
|
210
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
+
|
|
212
|
+
Unless required by applicable law or agreed to in writing, software
|
|
213
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
+
See the License for the specific language governing permissions and
|
|
216
|
+
limitations under the License.
|
|
@@ -18,12 +18,23 @@ export interface AuthUserListProps {
|
|
|
18
18
|
* per linked provider with its text label (`anonymous` for anonymous
|
|
19
19
|
* users) — hook icons off the attribute. */
|
|
20
20
|
renderProviders?: (user: AuthUserRecord) => ReactNode;
|
|
21
|
+
/** Per-row selection control. Rendered in the leading cell so bulk
|
|
22
|
+
* selection stays visually separate from trailing row actions. */
|
|
23
|
+
renderSelection?: (user: AuthUserRecord) => ReactNode;
|
|
24
|
+
/** Optional content for the leading selection column header (for example,
|
|
25
|
+
* a select-all checkbox). Only rendered with `renderSelection`. */
|
|
26
|
+
renderSelectionHeader?: ReactNode;
|
|
21
27
|
/** Per-row action slot (edit / disable / delete menu). Rendered in a
|
|
22
28
|
* trailing cell; column header is added when this is provided. */
|
|
23
29
|
renderActions?: (user: AuthUserRecord) => ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
30
|
+
/** Optional content for the trailing actions column header (for example,
|
|
31
|
+
* a select-all checkbox). Only rendered with `renderActions`. */
|
|
32
|
+
renderActionsHeader?: ReactNode;
|
|
33
|
+
/** Timestamp formatter for Created. Default: locale date, em dash for null. */
|
|
34
|
+
formatCreatedAt?: (iso: string | null) => ReactNode;
|
|
35
|
+
/** Timestamp formatter for Signed In. Kept separate because a missing login
|
|
36
|
+
* means "never", while a missing/invalid creation time is malformed data. */
|
|
37
|
+
formatLastLoginAt?: (iso: string | null) => ReactNode;
|
|
27
38
|
/** Zero state when the project has no users at all. */
|
|
28
39
|
emptyState?: ReactNode;
|
|
29
40
|
/** Zero state when the filter matches nothing. */
|
|
@@ -47,5 +58,5 @@ export interface AuthUserListProps {
|
|
|
47
58
|
* just renders. Disabled accounts carry `data-pyric-user-disabled` for
|
|
48
59
|
* dimmed styling.
|
|
49
60
|
*/
|
|
50
|
-
export declare function AuthUserList({ users, isLoading, error, filter, onSelect, renderIdentifier, renderProviders, renderActions,
|
|
61
|
+
export declare function AuthUserList({ users, isLoading, error, filter, onSelect, renderIdentifier, renderProviders, renderSelection, renderSelectionHeader, renderActions, renderActionsHeader, formatCreatedAt, formatLastLoginAt, emptyState, noResultsState, className, virtualizeThreshold, rowHeight, virtualizedHeight, }: AuthUserListProps): import("react").JSX.Element;
|
|
51
62
|
//# sourceMappingURL=AuthUserList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthUserList.d.ts","sourceRoot":"","sources":["../../../src/auth/components/AuthUserList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;wDACoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;4CACwC;IACxC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;qCACiC;IACjC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC;IACvD;;iDAE6C;IAC7C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC;IACtD;uEACmE;IACnE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC;IACpD;
|
|
1
|
+
{"version":3,"file":"AuthUserList.d.ts","sourceRoot":"","sources":["../../../src/auth/components/AuthUserList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CA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AgB,EAChB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,eAAmC,EACnC,iBAAqC,EACrC,UAAU,EACV,cAAc,EACd,SAAS,EACT,mBAAyB,EACzB,SAAc,EACd,iBAA0B,GAC3B,EAAE,iBAAiB,+BAiHnB"}
|
|
@@ -26,7 +26,7 @@ function defaultFormatDate(iso) {
|
|
|
26
26
|
* just renders. Disabled accounts carry `data-pyric-user-disabled` for
|
|
27
27
|
* dimmed styling.
|
|
28
28
|
*/
|
|
29
|
-
export function AuthUserList({ users, isLoading, error, filter, onSelect, renderIdentifier, renderProviders, renderActions,
|
|
29
|
+
export function AuthUserList({ users, isLoading, error, filter, onSelect, renderIdentifier, renderProviders, renderSelection, renderSelectionHeader, renderActions, renderActionsHeader, formatCreatedAt = defaultFormatDate, formatLastLoginAt = defaultFormatDate, emptyState, noResultsState, className, virtualizeThreshold = 100, rowHeight = 44, virtualizedHeight = '60vh', }) {
|
|
30
30
|
if (error) {
|
|
31
31
|
return (_jsx("div", { className: className, "data-pyric-ui": "auth-user-list", "data-pyric-error": "", role: "alert", children: error.message }));
|
|
32
32
|
}
|
|
@@ -40,7 +40,7 @@ export function AuthUserList({ users, isLoading, error, filter, onSelect, render
|
|
|
40
40
|
: (emptyState ?? 'No users for this project yet') }));
|
|
41
41
|
}
|
|
42
42
|
const virtualized = users.length > virtualizeThreshold;
|
|
43
|
-
const row = (user) => (_jsxs("div", { role: "row", "data-pyric-user-entry": true, "data-pyric-user-uid": user.uid, "data-pyric-user-disabled": user.disabled ? '' : undefined, children: [_jsx("span", { role: "cell", "data-pyric-user-cell": "identifier", children: onSelect ? (_jsx("button", { type: "button", "data-pyric-user-select": true, onClick: () => onSelect(user), children: renderIdentifier ? renderIdentifier(user) : defaultIdentifier(user) })) : ((renderIdentifier ?? defaultIdentifier)(user)) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "providers", children: (renderProviders ?? defaultProviders)(user) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "created", children:
|
|
44
|
-
return (_jsxs("div", { className: className, role: "table", "aria-label": "Authentication users", "data-pyric-ui": "auth-user-list", "data-pyric-virtualized": virtualized ? '' : undefined, children: [_jsxs("div", { role: "row", "data-pyric-user-header": true, children: [_jsx("span", { role: "columnheader", "data-pyric-user-cell": "identifier", children: "Identifier" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "providers", children: "Provider" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "created", children: "Created" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "signed-in", children: "Signed In" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "uid", children: "User UID" }), renderActions ? (_jsx("span", { role: "columnheader", "data-pyric-user-cell": "actions", "aria-label": "Actions" })) : null] }), virtualized ? (_jsx(VirtualList, { items: users, estimateSize: rowHeight, height: virtualizedHeight, getItemKey: (user) => user.uid, renderItem: row })) : (_jsx("div", { role: "rowgroup", "data-pyric-user-rows": true, children: users.map(row) }))] }));
|
|
43
|
+
const row = (user) => (_jsxs("div", { role: "row", "data-pyric-user-entry": true, "data-pyric-user-uid": user.uid, "data-pyric-user-disabled": user.disabled ? '' : undefined, children: [renderSelection ? (_jsx("span", { role: "cell", "data-pyric-user-cell": "selection", children: renderSelection(user) })) : null, _jsx("span", { role: "cell", "data-pyric-user-cell": "identifier", children: onSelect ? (_jsx("button", { type: "button", "data-pyric-user-select": true, onClick: () => onSelect(user), children: renderIdentifier ? renderIdentifier(user) : defaultIdentifier(user) })) : ((renderIdentifier ?? defaultIdentifier)(user)) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "providers", children: (renderProviders ?? defaultProviders)(user) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "created", children: formatCreatedAt(user.createdAt) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "signed-in", children: formatLastLoginAt(user.lastLoginAt) }), _jsx("span", { role: "cell", "data-pyric-user-cell": "uid", children: user.uid }), renderActions ? (_jsx("span", { role: "cell", "data-pyric-user-cell": "actions", children: renderActions(user) })) : null] }, user.uid));
|
|
44
|
+
return (_jsxs("div", { className: className, role: "table", "aria-label": "Authentication users", "data-pyric-ui": "auth-user-list", "data-pyric-virtualized": virtualized ? '' : undefined, "data-pyric-selection": renderSelection ? '' : undefined, "data-pyric-actions": renderActions ? '' : undefined, children: [_jsxs("div", { role: "row", "data-pyric-user-header": true, children: [renderSelection ? (_jsx("span", { role: "columnheader", "data-pyric-user-cell": "selection", "aria-label": "Selection", children: renderSelectionHeader })) : null, _jsx("span", { role: "columnheader", "data-pyric-user-cell": "identifier", children: "Identifier" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "providers", children: "Provider" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "created", children: "Created" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "signed-in", children: "Signed In" }), _jsx("span", { role: "columnheader", "data-pyric-user-cell": "uid", children: "User UID" }), renderActions ? (_jsx("span", { role: "columnheader", "data-pyric-user-cell": "actions", "aria-label": "Actions", children: renderActionsHeader })) : null] }), virtualized ? (_jsx(VirtualList, { items: users, estimateSize: rowHeight, height: virtualizedHeight, getItemKey: (user) => user.uid, renderItem: row })) : (_jsx("div", { role: "rowgroup", "data-pyric-user-rows": true, children: users.map(row) }))] }));
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=AuthUserList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthUserList.js","sourceRoot":"","sources":["../../../src/auth/components/AuthUserList.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthUserList.js","sourceRoot":"","sources":["../../../src/auth/components/AuthUserList.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,aAAa,E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AAI,EAAC,cAAc,0BAAsB,WAAW,gBAAY,WAAW,YAC9E,qBAAqB,GACjB,CACR,CAAC,CAAC,CAAC,IAAI,EACR,eAAM,IAAI,EAAC,cAAc,0BAAsB,YAAY,2BAAkB,EAC7E,eAAM,IAAI,EAAC,cAAc,0BAAsB,WAAW,yBAAgB,EAC1E,eAAM,IAAI,EAAC,cAAc,0BAAsB,SAAS,wBAAe,EACvE,eAAM,IAAI,EAAC,cAAc,0BAAsB,WAAW,0BAAiB,EAC3E,eAAM,IAAI,EAAC,cAAc,0BAAsB,KAAK,yBAAgB,EACnE,aAAa,CAAC,CAAC,CAAC,CACf,eAAM,IAAI,EAAC,cAAc,0BAAsB,SAAS,gBAAY,SAAS,YAC1E,mBAAmB,GACf,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,SAAS,EACvB,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAC9B,UAAU,EAAE,GAAG,GACf,CACH,CAAC,CAAC,CAAC,CACF,cAAK,IAAI,EAAC,UAAU,0CACjB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GACX,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import type { DocumentReference, QueryDocumentSnapshot } from 'pyric/firestore';
|
|
3
3
|
export interface DocumentListProps {
|
|
4
4
|
documents: QueryDocumentSnapshot[];
|
|
@@ -24,6 +24,9 @@ export interface DocumentListProps {
|
|
|
24
24
|
renderRowAction?: (doc: QueryDocumentSnapshot) => ReactNode;
|
|
25
25
|
emptyState?: ReactNode;
|
|
26
26
|
className?: string;
|
|
27
|
+
/** Stable collection/query identity used to reset update highlighting when
|
|
28
|
+
* the rendered list changes scope. */
|
|
29
|
+
updateScope?: string;
|
|
27
30
|
/**
|
|
28
31
|
* Above this row count, the list switches to virtualization via
|
|
29
32
|
* `<VirtualList>`. Default 100. Set to `Infinity` to disable
|
|
@@ -56,5 +59,5 @@ export interface DocumentListProps {
|
|
|
56
59
|
* trigger `onLoadMore` from a sentinel `IntersectionObserver` in
|
|
57
60
|
* their own code — the component doesn't bake that policy in.
|
|
58
61
|
*/
|
|
59
|
-
export declare function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, virtualizeThreshold, rowHeight, virtualizedHeight, }: DocumentListProps): import("react").JSX.Element;
|
|
62
|
+
export declare function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, updateScope, virtualizeThreshold, rowHeight, virtualizedHeight, }: DocumentListProps): import("react").JSX.Element;
|
|
60
63
|
//# sourceMappingURL=DocumentList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentList.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DocumentList.d.ts","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAehF,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;0CACsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;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,WAA6B,EAC7B,mBAAyB,EACzB,SAAc,EACd,iBAA0B,GAC3B,EAAE,iBAAiB,+BA6HnB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { VirtualList } from '../../primitives/VirtualList.js';
|
|
4
|
+
import { useUpdateHighlights } from '../../primitives/hooks/useUpdateHighlights.js';
|
|
5
|
+
import { firestoreValuesEqual } from '../valueEquality.js';
|
|
3
6
|
/**
|
|
4
7
|
* Both backends carry `.ref` on snapshots at runtime, but the
|
|
5
8
|
* `pyric/firestore` modular interface omits it. Pull it through
|
|
@@ -20,7 +23,14 @@ function snapshotRef(snap) {
|
|
|
20
23
|
* trigger `onLoadMore` from a sentinel `IntersectionObserver` in
|
|
21
24
|
* their own code — the component doesn't bake that policy in.
|
|
22
25
|
*/
|
|
23
|
-
export function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, virtualizeThreshold = 100, rowHeight = 36, virtualizedHeight = '60vh', }) {
|
|
26
|
+
export function DocumentList({ documents, isLoading, error, hasMore, onSelect, onLoadMore, renderLabel, renderRowAction, emptyState, className, updateScope = 'document-list', virtualizeThreshold = 100, rowHeight = 36, virtualizedHeight = '60vh', }) {
|
|
27
|
+
const updateEntries = useMemo(() => new Map(documents.map((snapshot) => [snapshotRef(snapshot).path, snapshot.data()])), [documents]);
|
|
28
|
+
const updates = useUpdateHighlights({
|
|
29
|
+
scope: updateScope,
|
|
30
|
+
entries: updateEntries,
|
|
31
|
+
equals: firestoreValuesEqual,
|
|
32
|
+
ready: !isLoading,
|
|
33
|
+
});
|
|
24
34
|
if (error) {
|
|
25
35
|
return (_jsx("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-error": "", role: "alert", children: error.message }));
|
|
26
36
|
}
|
|
@@ -31,9 +41,13 @@ export function DocumentList({ documents, isLoading, error, hasMore, onSelect, o
|
|
|
31
41
|
return (_jsx("div", { className: className, "data-pyric-ui": "document-list", "data-pyric-empty": "", children: emptyState }));
|
|
32
42
|
}
|
|
33
43
|
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) =>
|
|
44
|
+
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) => {
|
|
45
|
+
const update = updates.get(snapshotRef(doc).path);
|
|
46
|
+
return (_jsxs("div", { "data-pyric-document-entry": true, "data-pyric-document-id": doc.id, "data-pyric-update": update?.kind, "data-pyric-update-cycle": update?.cycle, children: [_jsx("button", { type: "button", onClick: () => onSelect?.(snapshotRef(doc)), "data-pyric-document-select": true, "data-pyric-update": update?.kind, "data-pyric-update-cycle": update?.cycle, children: renderLabel ? renderLabel(doc) : doc.id }), renderRowAction ? (_jsx("span", { "data-pyric-document-action": true, children: renderRowAction(doc) })) : null] }));
|
|
47
|
+
} })) : (_jsx("ul", { "data-pyric-document-list-items": true, children: documents.map((doc) => {
|
|
35
48
|
const ref = snapshotRef(doc);
|
|
36
|
-
|
|
49
|
+
const update = updates.get(ref.path);
|
|
50
|
+
return (_jsxs("li", { "data-pyric-document-entry": true, "data-pyric-document-id": doc.id, "data-pyric-update": update?.kind, "data-pyric-update-cycle": update?.cycle, children: [_jsx("button", { type: "button", onClick: () => onSelect?.(ref), "data-pyric-document-select": true, "data-pyric-update": update?.kind, "data-pyric-update-cycle": update?.cycle, children: renderLabel ? renderLabel(doc) : doc.id }), renderRowAction ? (_jsx("span", { "data-pyric-document-action": true, children: renderRowAction(doc) })) : null] }, ref.path));
|
|
37
51
|
}) })), hasMore && onLoadMore ? (_jsx("button", { type: "button", onClick: onLoadMore, "data-pyric-load-more": true, disabled: isLoading, children: "Load more" })) : null] }));
|
|
38
52
|
}
|
|
39
53
|
//# sourceMappingURL=DocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentList.js","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DocumentList.js","sourceRoot":"","sources":["../../../src/firestore/components/DocumentList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAA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GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;oBAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACrC,OAAO,CACL,2EAG0B,GAAG,CAAC,EAAE,uBACX,MAAM,EAAE,IAAI,6BACN,MAAM,EAAE,KAAK,aAEtC,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,2DAEX,MAAM,EAAE,IAAI,6BACN,MAAM,EAAE,KAAK,YAErC,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,KAjBH,GAAG,CAAC,IAAI,CAkBV,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"}
|
|
@@ -4,7 +4,7 @@ import { type ReactNode } from 'react';
|
|
|
4
4
|
*
|
|
5
5
|
* WHY: the hooks default to the in-process `pyric/firestore` API, but Pyric
|
|
6
6
|
* Studio's served mode drives the SAME ops over a SharedWorker via a PARALLEL
|
|
7
|
-
* modular client (
|
|
7
|
+
* modular client (`@pyric/cli/serve/worker`: its own `collection`/`getDocs`/...
|
|
8
8
|
* over a `MessagePort`, and a `ClientDb` that is not a `pyric/firestore`
|
|
9
9
|
* `Firestore`). Statically importing the in-process fns hardwires the hooks to
|
|
10
10
|
* the in-page sandbox; reading them from this context lets a consumer inject the
|
|
@@ -20,7 +20,7 @@ import { type ReactNode } from 'react';
|
|
|
20
20
|
* dev-seed review build, tests, any app embedding `@pyric/ui`) is unchanged: no
|
|
21
21
|
* provider needed unless you are swapping the backend.
|
|
22
22
|
*/
|
|
23
|
-
export type FirestoreApi = Pick<typeof import('pyric/firestore'), 'addDoc' | 'collection' | 'deleteDoc' | 'doc' | 'getDoc' | 'getDocs' | 'limit' | 'query' | 'setDoc' | 'startAfter'>;
|
|
23
|
+
export type FirestoreApi = Pick<typeof import('pyric/firestore'), 'addDoc' | 'collection' | 'deleteDoc' | 'doc' | 'getDoc' | 'getDocs' | 'limit' | 'onSnapshot' | 'query' | 'setDoc' | 'startAfter'>;
|
|
24
24
|
/** Read the active Firestore API bundle (defaults to in-process `pyric/firestore`). */
|
|
25
25
|
export declare function useFirestoreApi(): FirestoreApi;
|
|
26
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestoreApi.d.ts","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"firestoreApi.d.ts","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAejF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,cAAc,iBAAiB,CAAC,EAC9B,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,KAAK,GACL,QAAQ,GACR,SAAS,GACT,OAAO,GACP,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,YAAY,CACf,CAAC;AAkBF,uFAAuF;AACvF,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,yFAEA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, createElement, useContext } from 'react';
|
|
2
|
-
import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, limit, query, setDoc, startAfter, } from 'pyric/firestore';
|
|
2
|
+
import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, limit, onSnapshot, query, setDoc, startAfter, } from 'pyric/firestore';
|
|
3
3
|
const inProcessFirestoreApi = {
|
|
4
4
|
addDoc,
|
|
5
5
|
collection,
|
|
@@ -8,6 +8,7 @@ const inProcessFirestoreApi = {
|
|
|
8
8
|
getDoc,
|
|
9
9
|
getDocs,
|
|
10
10
|
limit,
|
|
11
|
+
onSnapshot,
|
|
11
12
|
query,
|
|
12
13
|
setDoc,
|
|
13
14
|
startAfter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestoreApi.js","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AACjF,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,GAAG,EACH,MAAM,EACN,OAAO,EACP,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,GACX,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"firestoreApi.js","sourceRoot":"","sources":["../../src/firestore/firestoreApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AACjF,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,GAAG,EACH,MAAM,EACN,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,GACX,MAAM,iBAAiB,CAAC;AAsCzB,MAAM,qBAAqB,GAAiB;IAC1C,MAAM;IACN,UAAU;IACV,SAAS;IACT,GAAG;IACH,MAAM;IACN,OAAO;IACP,KAAK;IACL,UAAU;IACV,KAAK;IACL,MAAM;IACN,UAAU;CACX,CAAC;AAEF,MAAM,mBAAmB,GAAG,aAAa,CAAe,qBAAqB,CAAC,CAAC;AAE/E,uFAAuF;AACvF,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GAIT;IACC,OAAO,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -32,6 +32,9 @@ export interface UseDocumentEditorResult extends DocumentEditorState {
|
|
|
32
32
|
remove: (nodeId: string) => void;
|
|
33
33
|
/** Restore the tree to its initial state. Clears `isDirty`. */
|
|
34
34
|
reset: () => void;
|
|
35
|
+
/** Replace the editor with a newly delivered snapshot and adopt it as the
|
|
36
|
+
* clean baseline. Intended for live document viewers. */
|
|
37
|
+
replaceData: (data: Record<string, unknown>) => void;
|
|
35
38
|
/** Mark one node touched (dispatch on blur). Gates error display —
|
|
36
39
|
* a freshly-added row stays quiet until the user leaves it. */
|
|
37
40
|
touch: (nodeId: string) => void;
|
|
@@ -49,10 +52,10 @@ export interface UseDocumentEditorResult extends DocumentEditorState {
|
|
|
49
52
|
* their own tree using the returned state.
|
|
50
53
|
*
|
|
51
54
|
* The hook builds its tree from `initial` on first mount. Changing
|
|
52
|
-
* `initial` later does NOT rebuild the tree
|
|
53
|
-
*
|
|
54
|
-
* This matches the firebase-tools-ui pattern of treating the
|
|
55
|
-
*
|
|
55
|
+
* `initial` later does NOT rebuild the tree; live viewers explicitly call
|
|
56
|
+
* `replaceData()` when a newer snapshot should become the clean baseline.
|
|
57
|
+
* This matches the firebase-tools-ui pattern of treating the editor as a
|
|
58
|
+
* stateful workspace while still allowing snapshot-driven reconciliation.
|
|
56
59
|
*/
|
|
57
60
|
export declare function useDocumentEditor(options?: UseDocumentEditorOptions): UseDocumentEditorResult;
|
|
58
61
|
//# sourceMappingURL=useDocumentEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentEditor.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACvC;wBACoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB;;;qEAGiE;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB;+BAC2B;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,iEAAiE;IACjE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IACtD,6BAA6B;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,+BAA+B;IAC/B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3E;8DAC0D;IAC1D,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAChE;mBACe;IACf,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;oEACgE;IAChE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;yCACqC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;sCACkC;IAClC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"useDocumentEditor.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACvC;wBACoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB;;;qEAGiE;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB;+BAC2B;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,iEAAiE;IACjE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IACtD,6BAA6B;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,+BAA+B;IAC/B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAC3E;8DAC0D;IAC1D,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAChE;mBACe;IACf,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;6DACyD;IACzD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrD;oEACgE;IAChE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;yCACqC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;sCACkC;IAClC,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,CA0FzB"}
|
|
@@ -8,10 +8,10 @@ import { treeToData } from '../reducers/tree.js';
|
|
|
8
8
|
* their own tree using the returned state.
|
|
9
9
|
*
|
|
10
10
|
* The hook builds its tree from `initial` on first mount. Changing
|
|
11
|
-
* `initial` later does NOT rebuild the tree
|
|
12
|
-
*
|
|
13
|
-
* This matches the firebase-tools-ui pattern of treating the
|
|
14
|
-
*
|
|
11
|
+
* `initial` later does NOT rebuild the tree; live viewers explicitly call
|
|
12
|
+
* `replaceData()` when a newer snapshot should become the clean baseline.
|
|
13
|
+
* This matches the firebase-tools-ui pattern of treating the editor as a
|
|
14
|
+
* stateful workspace while still allowing snapshot-driven reconciliation.
|
|
15
15
|
*/
|
|
16
16
|
export function useDocumentEditor(options = {}) {
|
|
17
17
|
const initial = options.initial ?? {};
|
|
@@ -29,6 +29,7 @@ export function useDocumentEditor(options = {}) {
|
|
|
29
29
|
const addArrayEntry = useCallback((parentId, childType) => dispatch({ type: 'addArrayEntry', parentId, childType }), []);
|
|
30
30
|
const remove = useCallback((nodeId) => dispatch({ type: 'remove', nodeId }), []);
|
|
31
31
|
const reset = useCallback(() => dispatch({ type: 'reset' }), []);
|
|
32
|
+
const replaceData = useCallback((data) => dispatch({ type: 'replaceData', data }), []);
|
|
32
33
|
const touch = useCallback((nodeId) => dispatch({ type: 'touch', nodeId }), []);
|
|
33
34
|
const touchAll = useCallback(() => dispatch({ type: 'touchAll' }), []);
|
|
34
35
|
const toData = useCallback(() => treeToData(state.tree), [state.tree]);
|
|
@@ -46,6 +47,7 @@ export function useDocumentEditor(options = {}) {
|
|
|
46
47
|
addArrayEntry,
|
|
47
48
|
remove,
|
|
48
49
|
reset,
|
|
50
|
+
replaceData,
|
|
49
51
|
touch,
|
|
50
52
|
touchAll,
|
|
51
53
|
toData,
|
|
@@ -60,6 +62,7 @@ export function useDocumentEditor(options = {}) {
|
|
|
60
62
|
addArrayEntry,
|
|
61
63
|
remove,
|
|
62
64
|
reset,
|
|
65
|
+
replaceData,
|
|
63
66
|
touch,
|
|
64
67
|
touchAll,
|
|
65
68
|
toData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentEditor.js","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useDocumentEditor.js","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentEditor.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I,KAAK,KAAK,CAAC,OAAO,CAAC;IAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC;IAEvC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,KAAK;QACR,OAAO;QACP,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,MAAM;QACN,WAAW;QACX,aAAa;QACb,MAAM;QACN,KAAK;QACL,WAAW;QACX,KAAK;QACL,QAAQ;QACR,MAAM;KACP,CAAC,EACF;QACE,KAAK;QACL,OAAO;QACP,OAAO;QACP,QAAQ;QACR,OAAO;QACP,MAAM;QACN,WAAW;QACX,aAAa;QACb,MAAM;QACN,KAAK;QACL,WAAW;QACX,KAAK;QACL,QAAQ;QACR,MAAM;KACP,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,15 +5,25 @@ export interface UseDocumentListOptions {
|
|
|
5
5
|
query?: Query;
|
|
6
6
|
/** Page size for cursor-based pagination. Default 50. */
|
|
7
7
|
pageSize?: number;
|
|
8
|
+
/**
|
|
9
|
+
* `paged` preserves the historical get-based cursor behavior. `live` keeps
|
|
10
|
+
* the currently requested window under an `onSnapshot` subscription and
|
|
11
|
+
* grows that window when `loadMore` is requested. Default `paged`.
|
|
12
|
+
*/
|
|
13
|
+
mode?: 'paged' | 'live';
|
|
8
14
|
}
|
|
9
15
|
export interface UseDocumentListResult {
|
|
10
16
|
documents: QueryDocumentSnapshot[];
|
|
11
17
|
isLoading: boolean;
|
|
12
18
|
error: Error | undefined;
|
|
19
|
+
/** Identifies the active live subscription. Consumers that diff result
|
|
20
|
+
* snapshots can include this in their scope so a re-subscription (including
|
|
21
|
+
* load-more) establishes a silent baseline instead of looking like writes. */
|
|
22
|
+
subscriptionGeneration: number;
|
|
13
23
|
/** True if there might be another page. The hook tracks this via
|
|
14
24
|
* the last fetch's length === pageSize. */
|
|
15
25
|
hasMore: boolean;
|
|
16
|
-
/** Fetch the next page and
|
|
26
|
+
/** Fetch the next page; live mode grows and re-establishes its window. */
|
|
17
27
|
loadMore: () => void;
|
|
18
28
|
/** Create a document. If `id` is null, Firestore generates one
|
|
19
29
|
* via `addDoc`. With `onExisting: 'fail'` (CREATE semantics, the
|
|
@@ -26,20 +36,15 @@ export interface UseDocumentListResult {
|
|
|
26
36
|
onExisting?: 'overwrite' | 'fail';
|
|
27
37
|
}) => Promise<DocumentReference>;
|
|
28
38
|
deleteDocument: (ref: DocumentReference) => Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
39
|
+
/** Re-establish the active read/subscription. Useful after the consumer
|
|
40
|
+
* mutates data outside this hook. */
|
|
31
41
|
refresh: () => void;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Note: this is read-via-get, not realtime. The list updates on
|
|
39
|
-
* `loadMore` / `createDocument` / `deleteDocument` / `refresh`.
|
|
40
|
-
* Realtime subscriptions for a collection live in
|
|
41
|
-
* `useFirestoreCollection`; combining the two (paginated + realtime)
|
|
42
|
-
* is non-trivial and deferred — see design rationale section M6.
|
|
44
|
+
* Paginated document list with two acquisition strategies. The default
|
|
45
|
+
* `paged` mode uses `startAfter` and accumulates one-shot reads. `live` keeps
|
|
46
|
+
* the requested prefix under one `onSnapshot` listener; loading more grows
|
|
47
|
+
* that prefix and establishes a new subscription baseline.
|
|
43
48
|
*/
|
|
44
|
-
export declare function useDocumentList({ collection, query, pageSize, }: UseDocumentListOptions): UseDocumentListResult;
|
|
49
|
+
export declare function useDocumentList({ collection, query, pageSize, mode, }: UseDocumentListOptions): UseDocumentListResult;
|
|
45
50
|
//# sourceMappingURL=useDocumentList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentList.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,EACL,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,mBAAmB,CAAC;IAChC,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useDocumentList.d.ts","sourceRoot":"","sources":["../../../src/firestore/hooks/useDocumentList.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,EACL,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,mBAAmB,CAAC;IAChC,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB;;kFAE8E;IAC9E,sBAAsB,EAAE,MAAM,CAAC;IAC/B;gDAC4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;;qDAMiD;IACjD,cAAc,EAAE,CACd,EAAE,EAAE,MAAM,GAAG,IAAI,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;KAAE,KACzC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,cAAc,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D;0CACsC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,KAAK,EACL,QAAa,EACb,IAAc,GACf,EAAE,sBAAsB,GAAG,qBAAqB,CAgLhD"}
|