@viglet/shio-react-sdk 2026.2.1 → 2026.3.2
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 +201 -201
- package/README.md +127 -0
- package/dist/hooks/use-shio-query.d.ts +9 -2
- package/dist/shio-react-sdk.js +157 -139
- package/dist/shio-react-sdk.umd.cjs +1 -1
- package/package.json +32 -9
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @viglet/shio-react-sdk
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@viglet/shio-react-sdk)
|
|
4
|
+
[](https://github.com/openviglet/shio/blob/HEAD/LICENSE)
|
|
5
|
+
[](https://shio.viglet.org/)
|
|
6
|
+
|
|
7
|
+
The **React SDK** for **[Viglet Shio](https://shio.viglet.org/)**, the open
|
|
8
|
+
source **headless CMS built for coding agents**. Hooks and render components for
|
|
9
|
+
consuming Shio content through the **Content Delivery API (CDA)**, built on
|
|
10
|
+
[`@viglet/shio-client`](https://www.npmjs.com/package/@viglet/shio-client).
|
|
11
|
+
|
|
12
|
+
- **React 18 / 19** — `react` is a peer dependency.
|
|
13
|
+
- Targets the stable, read-only CDA contract (`/api/v2/cda/**`).
|
|
14
|
+
- Everything the core client exports is **re-exported** here, so this is the only
|
|
15
|
+
package a React app needs.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @viglet/shio-react-sdk react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
Wrap your tree once:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { ShioProvider } from "@viglet/shio-react-sdk";
|
|
29
|
+
|
|
30
|
+
export function App({ children }: { children: React.ReactNode }) {
|
|
31
|
+
return (
|
|
32
|
+
<ShioProvider
|
|
33
|
+
baseUrl="https://cms.example.com"
|
|
34
|
+
apiToken={import.meta.env.VITE_SHIO_CDA_TOKEN}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</ShioProvider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then read content anywhere below it:
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { useShioPostByUrl, ShioRichText } from "@viglet/shio-react-sdk";
|
|
46
|
+
|
|
47
|
+
function Article({ siteId, url }: { siteId: string; url: string }) {
|
|
48
|
+
const { data: post, loading, error } = useShioPostByUrl(siteId, url);
|
|
49
|
+
|
|
50
|
+
if (loading) return <p>Loading…</p>;
|
|
51
|
+
if (error) return <p>{error.message}</p>;
|
|
52
|
+
if (!post) return <p>Not found</p>;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<article>
|
|
56
|
+
<h1>{String(post.attrs.title ?? "")}</h1>
|
|
57
|
+
<ShioRichText html={String(post.attrs.content ?? "")} />
|
|
58
|
+
</article>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`<ShioProvider>` also accepts an already-built client:
|
|
64
|
+
`<ShioProvider client={myClient}>`.
|
|
65
|
+
|
|
66
|
+
## Hooks
|
|
67
|
+
|
|
68
|
+
Every hook returns a `ShioAsyncState<T>` — `{ data, loading, error }`.
|
|
69
|
+
|
|
70
|
+
| Hook | Returns |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `useShioSites()` | Every site the token can see |
|
|
73
|
+
| `useShioSite(siteId)` | One site |
|
|
74
|
+
| `useShioChildren(folderId, params?)` | A folder's children, paged |
|
|
75
|
+
| `useShioBreadcrumb(objectId)` | The path from the site root to an object |
|
|
76
|
+
| `useShioPost(postId)` | One post by id |
|
|
77
|
+
| `useShioPostByUrl(siteId, url)` | One post by its friendly URL — built for `[...slug]` routing |
|
|
78
|
+
| `useShioQuery(params?, enabled?)` | A query across a site / folder / post-type, paged |
|
|
79
|
+
| `useShioClient()` | The `ShioClient` from context, for anything the hooks don't cover |
|
|
80
|
+
|
|
81
|
+
## Components
|
|
82
|
+
|
|
83
|
+
| Component | For |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `<ShioRichText html={…} />` | Renders an HTML-editor field safely into a `div` (accepts any `div` props) |
|
|
86
|
+
| `<ShioImage src={…} baseUrl={…} alt={…} />` | Resolves a stored file reference to a URL and renders an `img` |
|
|
87
|
+
| `<ShioRelator items={…}>` | Maps over a Relator (nested repeatable) field |
|
|
88
|
+
| `<ShioField value={…} as={…} />` | Renders one attribute by kind — `text`, `html`, `image`, `list`, `json` |
|
|
89
|
+
|
|
90
|
+
## Next.js
|
|
91
|
+
|
|
92
|
+
For **server components**, use
|
|
93
|
+
[`@viglet/shio-client`](https://www.npmjs.com/package/@viglet/shio-client)
|
|
94
|
+
directly — it is zero-dependency and needs no provider. Reach for this package
|
|
95
|
+
in **client components**, where the hooks give you loading and error state.
|
|
96
|
+
|
|
97
|
+
The fastest way to a working project is the generator, which wires both up for
|
|
98
|
+
you:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm create @viglet/shio-app@latest my-site
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Related packages
|
|
105
|
+
|
|
106
|
+
| Package | For |
|
|
107
|
+
|---|---|
|
|
108
|
+
| [`@viglet/shio-client`](https://www.npmjs.com/package/@viglet/shio-client) | The framework-agnostic core this is built on |
|
|
109
|
+
| [`@viglet/shio`](https://www.npmjs.com/package/@viglet/shio) | The Shio CLI — content as files, `shio types`, and the MCP bridge for [Claude Code](https://claude.com/claude-code) |
|
|
110
|
+
| [`@viglet/shio-sections`](https://www.npmjs.com/package/@viglet/shio-sections) | The page-section vocabulary and its React components |
|
|
111
|
+
| [`@viglet/shio-model`](https://www.npmjs.com/package/@viglet/shio-model) | Author the content model as typed code |
|
|
112
|
+
| [`@viglet/shio-editor-cors`](https://www.npmjs.com/package/@viglet/shio-editor-cors) | Inline visual editing with the Universal Editor |
|
|
113
|
+
| [`@viglet/create-shio-app`](https://www.npmjs.com/package/@viglet/create-shio-app) | Next.js starter generator |
|
|
114
|
+
|
|
115
|
+
## Develop
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm run build # vite lib build + .d.ts
|
|
119
|
+
npm run typecheck
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Apache-2.0 — [Viglet Shio](https://shio.viglet.org/) ·
|
|
125
|
+
[github.com/openviglet/shio](https://github.com/openviglet/shio) ·
|
|
126
|
+
[docs.viglet.org/shio](https://docs.viglet.org/shio/) ·
|
|
127
|
+
part of the [Viglet](https://www.viglet.org) open source family.
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { ShioListing, ShioQueryParams } from "@viglet/shio-client";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Query published posts by site / folder / post type (always returns a listing).
|
|
4
|
+
*
|
|
5
|
+
* Pass `enabled: false` to defer the request until its inputs are ready — e.g.
|
|
6
|
+
* while a `siteId` is still being resolved from {@link useShioSites}. While
|
|
7
|
+
* disabled the hook stays idle (`loading: false`, `data: undefined`) and never
|
|
8
|
+
* fires a request with half-resolved params.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useShioQuery(params?: ShioQueryParams, enabled?: boolean): import("./use-async").ShioAsyncState<ShioListing>;
|
package/dist/shio-react-sdk.js
CHANGED
|
@@ -1,154 +1,172 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Fragment as e, createContext as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
2
|
+
import { ShioClient as o, ShioClient as s, ShioHttpError as c, createShioClient as l } from "@viglet/shio-client";
|
|
3
|
+
import { Fragment as u, jsx as d } from "react/jsx-runtime";
|
|
4
|
+
//#region src/provider.tsx
|
|
5
|
+
var f = t(null);
|
|
6
|
+
function p(e) {
|
|
7
|
+
let { children: t } = e, n = "client" in e ? e.client : void 0, r = n ? void 0 : e, a = i(() => n ?? new s(r), [
|
|
8
|
+
n,
|
|
9
|
+
r?.baseUrl,
|
|
10
|
+
r?.apiToken,
|
|
11
|
+
r?.fetch,
|
|
12
|
+
r?.credentials
|
|
13
|
+
]);
|
|
14
|
+
return /* @__PURE__ */ d(f.Provider, {
|
|
15
|
+
value: a,
|
|
16
|
+
children: t
|
|
17
|
+
});
|
|
13
18
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return t;
|
|
19
|
+
function m() {
|
|
20
|
+
let e = n(f);
|
|
21
|
+
if (!e) throw Error("useShioClient must be used within a <ShioProvider>");
|
|
22
|
+
return e;
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/hooks/use-async.ts
|
|
26
|
+
function h(e, t, n = !0) {
|
|
27
|
+
let [i, o] = a({
|
|
28
|
+
data: void 0,
|
|
29
|
+
loading: n,
|
|
30
|
+
error: null
|
|
31
|
+
});
|
|
32
|
+
return r(() => {
|
|
33
|
+
if (!n) {
|
|
34
|
+
o({
|
|
35
|
+
data: void 0,
|
|
36
|
+
loading: !1,
|
|
37
|
+
error: null
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let t = new AbortController();
|
|
42
|
+
return o((e) => ({
|
|
43
|
+
...e,
|
|
44
|
+
loading: !0,
|
|
45
|
+
error: null
|
|
46
|
+
})), e(t.signal).then((e) => {
|
|
47
|
+
t.signal.aborted || o({
|
|
48
|
+
data: e,
|
|
49
|
+
loading: !1,
|
|
50
|
+
error: null
|
|
51
|
+
});
|
|
52
|
+
}).catch((e) => {
|
|
53
|
+
t.signal.aborted || o({
|
|
54
|
+
data: void 0,
|
|
55
|
+
loading: !1,
|
|
56
|
+
error: e instanceof Error ? e : Error(String(e))
|
|
57
|
+
});
|
|
58
|
+
}), () => t.abort();
|
|
59
|
+
}, t), i;
|
|
42
60
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/hooks/use-shio-sites.ts
|
|
63
|
+
function g() {
|
|
64
|
+
let e = m();
|
|
65
|
+
return h((t) => e.getSites({ signal: t }), [e]);
|
|
46
66
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(i) => n.getSite(t, { signal: i }),
|
|
51
|
-
[n, t],
|
|
52
|
-
!!t
|
|
53
|
-
);
|
|
67
|
+
function _(e) {
|
|
68
|
+
let t = m();
|
|
69
|
+
return h((n) => t.getSite(e, { signal: n }), [t, e], !!e);
|
|
54
70
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/hooks/use-shio-children.ts
|
|
73
|
+
function v(e, t) {
|
|
74
|
+
let n = m();
|
|
75
|
+
return h((r) => n.listChildren(e, t, { signal: r }), [
|
|
76
|
+
n,
|
|
77
|
+
e,
|
|
78
|
+
t?.page,
|
|
79
|
+
t?.size
|
|
80
|
+
], !!e);
|
|
62
81
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
!!t
|
|
69
|
-
);
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/hooks/use-shio-breadcrumb.ts
|
|
84
|
+
function y(e) {
|
|
85
|
+
let t = m();
|
|
86
|
+
return h((n) => t.getPath(e, { signal: n }), [t, e], !!e);
|
|
70
87
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
!!t
|
|
77
|
-
);
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/hooks/use-shio-post.ts
|
|
90
|
+
function b(e) {
|
|
91
|
+
let t = m();
|
|
92
|
+
return h((n) => t.getPost(e, { signal: n }), [t, e], !!e);
|
|
78
93
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
function x(e, t) {
|
|
95
|
+
let n = m();
|
|
96
|
+
return h((r) => n.getPostByUrl(e, t, { signal: r }), [
|
|
97
|
+
n,
|
|
98
|
+
e,
|
|
99
|
+
t
|
|
100
|
+
], !!e && !!t);
|
|
86
101
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/hooks/use-shio-query.ts
|
|
104
|
+
function S(e, t = !0) {
|
|
105
|
+
let n = m();
|
|
106
|
+
return h((t) => n.query(e, { signal: t }), [
|
|
107
|
+
n,
|
|
108
|
+
e?.siteId,
|
|
109
|
+
e?.folderId,
|
|
110
|
+
e?.postType,
|
|
111
|
+
e?.page,
|
|
112
|
+
e?.size
|
|
113
|
+
], t);
|
|
100
114
|
}
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/components/shio-rich-text.tsx
|
|
117
|
+
function C({ html: e, ...t }) {
|
|
118
|
+
return e ? /* @__PURE__ */ d("div", {
|
|
119
|
+
...t,
|
|
120
|
+
dangerouslySetInnerHTML: { __html: e }
|
|
121
|
+
}) : null;
|
|
103
122
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/components/shio-image.tsx
|
|
125
|
+
function w({ src: e, baseUrl: t, alt: n = "", ...r }) {
|
|
126
|
+
if (!e) return null;
|
|
127
|
+
let i = /^(https?:)?\/\//.test(e) || e.startsWith("data:") || !t ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`;
|
|
128
|
+
return /* @__PURE__ */ d("img", {
|
|
129
|
+
src: i,
|
|
130
|
+
alt: n,
|
|
131
|
+
...r
|
|
132
|
+
});
|
|
108
133
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}) {
|
|
114
|
-
const e = Array.isArray(t) ? t : [];
|
|
115
|
-
return /* @__PURE__ */ u(s, { children: e.map((o, r) => /* @__PURE__ */ u(A, { children: n(o, r) }, i ? i(o, r) : r)) });
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/components/shio-relator.tsx
|
|
136
|
+
function T({ items: t, children: n, keyFor: r }) {
|
|
137
|
+
return /* @__PURE__ */ d(u, { children: (Array.isArray(t) ? t : []).map((t, i) => /* @__PURE__ */ d(e, { children: n(t, i) }, r ? r(t, i) : i)) });
|
|
116
138
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/components/shio-field.tsx
|
|
141
|
+
var E = /<[a-z][\s\S]*>/i, D = /\.(png|jpe?g|gif|webp|svg|avif)$/i;
|
|
142
|
+
function O(e) {
|
|
143
|
+
return typeof e == "string" ? E.test(e) ? "html" : D.test(e.trim()) ? "image" : "text" : Array.isArray(e) ? "list" : typeof e == "object" && e ? "json" : "text";
|
|
120
144
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
145
|
+
function k({ value: e, as: t, baseUrl: n, className: r }) {
|
|
146
|
+
if (e == null || e === "") return null;
|
|
147
|
+
switch (t ?? O(e)) {
|
|
148
|
+
case "html": return /* @__PURE__ */ d(C, {
|
|
149
|
+
className: r,
|
|
150
|
+
html: String(e)
|
|
151
|
+
});
|
|
152
|
+
case "image": return /* @__PURE__ */ d(w, {
|
|
153
|
+
className: r,
|
|
154
|
+
src: String(e),
|
|
155
|
+
baseUrl: n
|
|
156
|
+
});
|
|
157
|
+
case "list": return /* @__PURE__ */ d("ul", {
|
|
158
|
+
className: r,
|
|
159
|
+
children: e.map((e, t) => /* @__PURE__ */ d("li", { children: typeof e == "object" ? JSON.stringify(e) : String(e) }, t))
|
|
160
|
+
});
|
|
161
|
+
case "json": return /* @__PURE__ */ d("pre", {
|
|
162
|
+
className: r,
|
|
163
|
+
children: JSON.stringify(e, null, 2)
|
|
164
|
+
});
|
|
165
|
+
default: return /* @__PURE__ */ d("span", {
|
|
166
|
+
className: r,
|
|
167
|
+
children: String(e)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
136
170
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
L as ShioField,
|
|
140
|
-
G as ShioHttpError,
|
|
141
|
-
x as ShioImage,
|
|
142
|
-
R as ShioProvider,
|
|
143
|
-
J as ShioRelator,
|
|
144
|
-
w as ShioRichText,
|
|
145
|
-
Q as createShioClient,
|
|
146
|
-
F as useShioBreadcrumb,
|
|
147
|
-
B as useShioChildren,
|
|
148
|
-
c as useShioClient,
|
|
149
|
-
H as useShioPost,
|
|
150
|
-
k as useShioPostByUrl,
|
|
151
|
-
v as useShioQuery,
|
|
152
|
-
z as useShioSite,
|
|
153
|
-
_ as useShioSites
|
|
154
|
-
};
|
|
171
|
+
//#endregion
|
|
172
|
+
export { o as ShioClient, k as ShioField, c as ShioHttpError, w as ShioImage, p as ShioProvider, T as ShioRelator, C as ShioRichText, l as createShioClient, y as useShioBreadcrumb, v as useShioChildren, m as useShioClient, b as useShioPost, x as useShioPostByUrl, S as useShioQuery, _ as useShioSite, g as useShioSites };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@viglet/shio-client"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@viglet/shio-client`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ShioReactSdk={},e.React,e.ShioClient,e.jsxRuntime))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=(0,t.createContext)(null);function a(e){let{children:a}=e,o=`client`in e?e.client:void 0,s=o?void 0:e,c=(0,t.useMemo)(()=>o??new n.ShioClient(s),[o,s?.baseUrl,s?.apiToken,s?.fetch,s?.credentials]);return(0,r.jsx)(i.Provider,{value:c,children:a})}function o(){let e=(0,t.useContext)(i);if(!e)throw Error(`useShioClient must be used within a <ShioProvider>`);return e}function s(e,n,r=!0){let[i,a]=(0,t.useState)({data:void 0,loading:r,error:null});return(0,t.useEffect)(()=>{if(!r){a({data:void 0,loading:!1,error:null});return}let t=new AbortController;return a(e=>({...e,loading:!0,error:null})),e(t.signal).then(e=>{t.signal.aborted||a({data:e,loading:!1,error:null})}).catch(e=>{t.signal.aborted||a({data:void 0,loading:!1,error:e instanceof Error?e:Error(String(e))})}),()=>t.abort()},n),i}function c(){let e=o();return s(t=>e.getSites({signal:t}),[e])}function l(e){let t=o();return s(n=>t.getSite(e,{signal:n}),[t,e],!!e)}function u(e,t){let n=o();return s(r=>n.listChildren(e,t,{signal:r}),[n,e,t?.page,t?.size],!!e)}function d(e){let t=o();return s(n=>t.getPath(e,{signal:n}),[t,e],!!e)}function f(e){let t=o();return s(n=>t.getPost(e,{signal:n}),[t,e],!!e)}function p(e,t){let n=o();return s(r=>n.getPostByUrl(e,t,{signal:r}),[n,e,t],!!e&&!!t)}function m(e,t=!0){let n=o();return s(t=>n.query(e,{signal:t}),[n,e?.siteId,e?.folderId,e?.postType,e?.page,e?.size],t)}function h({html:e,...t}){return e?(0,r.jsx)(`div`,{...t,dangerouslySetInnerHTML:{__html:e}}):null}function g({src:e,baseUrl:t,alt:n=``,...i}){if(!e)return null;let a=/^(https?:)?\/\//.test(e)||e.startsWith(`data:`)||!t?e:`${t.replace(/\/+$/,``)}/${e.replace(/^\/+/,``)}`;return(0,r.jsx)(`img`,{src:a,alt:n,...i})}function _({items:e,children:n,keyFor:i}){return(0,r.jsx)(r.Fragment,{children:(Array.isArray(e)?e:[]).map((e,a)=>(0,r.jsx)(t.Fragment,{children:n(e,a)},i?i(e,a):a))})}var v=/<[a-z][\s\S]*>/i,y=/\.(png|jpe?g|gif|webp|svg|avif)$/i;function b(e){return typeof e==`string`?v.test(e)?`html`:y.test(e.trim())?`image`:`text`:Array.isArray(e)?`list`:typeof e==`object`&&e?`json`:`text`}function x({value:e,as:t,baseUrl:n,className:i}){if(e==null||e===``)return null;switch(t??b(e)){case`html`:return(0,r.jsx)(h,{className:i,html:String(e)});case`image`:return(0,r.jsx)(g,{className:i,src:String(e),baseUrl:n});case`list`:return(0,r.jsx)(`ul`,{className:i,children:e.map((e,t)=>(0,r.jsx)(`li`,{children:typeof e==`object`?JSON.stringify(e):String(e)},t))});case`json`:return(0,r.jsx)(`pre`,{className:i,children:JSON.stringify(e,null,2)});default:return(0,r.jsx)(`span`,{className:i,children:String(e)})}}Object.defineProperty(e,"ShioClient",{enumerable:!0,get:function(){return n.ShioClient}}),e.ShioField=x,Object.defineProperty(e,"ShioHttpError",{enumerable:!0,get:function(){return n.ShioHttpError}}),e.ShioImage=g,e.ShioProvider=a,e.ShioRelator=_,e.ShioRichText=h,Object.defineProperty(e,"createShioClient",{enumerable:!0,get:function(){return n.createShioClient}}),e.useShioBreadcrumb=d,e.useShioChildren=u,e.useShioClient=o,e.useShioPost=f,e.useShioPostByUrl=p,e.useShioQuery=m,e.useShioSite=l,e.useShioSites=c});
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viglet/shio-react-sdk",
|
|
3
|
-
"version": "2026.2
|
|
3
|
+
"version": "2026.3.2",
|
|
4
4
|
"description": "React SDK for consuming Shio CMS content via the Content Delivery API (CDA). Hooks + render components built on @viglet/shio-client.",
|
|
5
|
+
"homepage": "https://shio.viglet.org/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/openviglet/shio.git",
|
|
9
|
+
"directory": "shio-react-sdk"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/openviglet/shio/issues"
|
|
13
|
+
},
|
|
5
14
|
"type": "module",
|
|
6
15
|
"main": "dist/shio-react-sdk.umd.cjs",
|
|
7
16
|
"module": "dist/shio-react-sdk.js",
|
|
@@ -17,27 +26,41 @@
|
|
|
17
26
|
"dist"
|
|
18
27
|
],
|
|
19
28
|
"dependencies": {
|
|
20
|
-
"@viglet/shio-client": "2026.2
|
|
29
|
+
"@viglet/shio-client": "2026.3.2"
|
|
21
30
|
},
|
|
22
31
|
"peerDependencies": {
|
|
23
32
|
"react": ">=18.0.0"
|
|
24
33
|
},
|
|
25
34
|
"devDependencies": {
|
|
26
|
-
"@types/react": "^19.
|
|
27
|
-
"react": "^19.
|
|
35
|
+
"@types/react": "^19.2.18",
|
|
36
|
+
"react": "^19.2.8",
|
|
28
37
|
"typescript": "^5.8.3",
|
|
29
|
-
"vite": "^
|
|
38
|
+
"vite": "^8.2.0"
|
|
30
39
|
},
|
|
31
40
|
"keywords": [
|
|
32
41
|
"shio",
|
|
42
|
+
"viglet",
|
|
33
43
|
"cms",
|
|
34
|
-
"headless",
|
|
44
|
+
"headless-cms",
|
|
45
|
+
"content-management-system",
|
|
46
|
+
"agent",
|
|
47
|
+
"ai",
|
|
48
|
+
"mcp",
|
|
49
|
+
"model-context-protocol",
|
|
50
|
+
"claude-code",
|
|
35
51
|
"react",
|
|
36
52
|
"sdk",
|
|
37
|
-
"cda"
|
|
53
|
+
"cda",
|
|
54
|
+
"hooks",
|
|
55
|
+
"nextjs",
|
|
56
|
+
"typescript",
|
|
57
|
+
"headless"
|
|
38
58
|
],
|
|
39
|
-
"author":
|
|
40
|
-
|
|
59
|
+
"author": {
|
|
60
|
+
"name": "Viglet Team",
|
|
61
|
+
"url": "https://www.viglet.org"
|
|
62
|
+
},
|
|
63
|
+
"license": "Apache-2.0",
|
|
41
64
|
"scripts": {
|
|
42
65
|
"dev": "vite build --watch",
|
|
43
66
|
"build": "vite build && tsc --emitDeclarationOnly",
|