@viglet/shio-react-sdk 2026.3.2 → 2026.3.3
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 +4 -4
- package/dist/components/shio-blocks.d.ts +40 -0
- package/dist/hooks/use-shio-post.d.ts +14 -4
- package/dist/index.d.ts +3 -1
- package/dist/shio-react-sdk.js +76 -39
- package/dist/shio-react-sdk.umd.cjs +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +7 -7
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
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@viglet/shio-react-sdk)
|
|
4
4
|
[](https://github.com/openviglet/shio/blob/HEAD/LICENSE)
|
|
5
|
-
[](https://openviglet.github.io/shio/)
|
|
6
6
|
|
|
7
|
-
The **React SDK** for **[Viglet Shio](https://
|
|
8
|
-
source **
|
|
7
|
+
The **React SDK** for **[Viglet Shio](https://openviglet.github.io/shio/)**, the open
|
|
8
|
+
source, **agent-ready CMS**. Hooks and render components for
|
|
9
9
|
consuming Shio content through the **Content Delivery API (CDA)**, built on
|
|
10
10
|
[`@viglet/shio-client`](https://www.npmjs.com/package/@viglet/shio-client).
|
|
11
11
|
|
|
@@ -121,7 +121,7 @@ npm run typecheck
|
|
|
121
121
|
|
|
122
122
|
## License
|
|
123
123
|
|
|
124
|
-
Apache-2.0 — [Viglet Shio](https://
|
|
124
|
+
Apache-2.0 — [Viglet Shio](https://openviglet.github.io/shio/) ·
|
|
125
125
|
[github.com/openviglet/shio](https://github.com/openviglet/shio) ·
|
|
126
126
|
[docs.viglet.org/shio](https://docs.viglet.org/shio/) ·
|
|
127
127
|
part of the [Viglet](https://www.viglet.org) open source family.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ShioBlock } from "@viglet/shio-client";
|
|
3
|
+
/** A component rendering one block of its kind. */
|
|
4
|
+
export type ShioBlockComponent<T extends ShioBlock = ShioBlock> = (props: {
|
|
5
|
+
block: T;
|
|
6
|
+
}) => ReactNode;
|
|
7
|
+
/** Block type to component. Every key is optional: a kind with no entry falls back. */
|
|
8
|
+
export type ShioBlockComponents = {
|
|
9
|
+
[K in ShioBlock["type"]]?: ShioBlockComponent<Extract<ShioBlock, {
|
|
10
|
+
type: K;
|
|
11
|
+
}>>;
|
|
12
|
+
};
|
|
13
|
+
export interface ShioBlocksProps {
|
|
14
|
+
/** The field's blocks — `shioBlocks(post, "BODY")` from the core client. */
|
|
15
|
+
blocks: ShioBlock[] | null | undefined;
|
|
16
|
+
/** A component per block type. Anything not named here uses the fallback. */
|
|
17
|
+
components?: ShioBlockComponents;
|
|
18
|
+
/**
|
|
19
|
+
* The rendered HTML the CDA delivers beside the blocks (`post.rendered?.BODY`), used for a
|
|
20
|
+
* block type this build has no component for.
|
|
21
|
+
*/
|
|
22
|
+
fallbackHtml?: Record<string, string> | string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SH1016 — a blocks body rendered with your own components.
|
|
26
|
+
*
|
|
27
|
+
* <p>The CDA delivers a body twice: as an array of typed blocks and as HTML. This maps the first
|
|
28
|
+
* onto components you own, which is the whole reason the body stopped being a string.</p>
|
|
29
|
+
*
|
|
30
|
+
* <h2>The fallback is per block, not per document</h2>
|
|
31
|
+
*
|
|
32
|
+
* <p>A page with one block type you have no component for should render the seven it knows. Falling
|
|
33
|
+
* back for the whole document would make adding a block type to the model blank a page that was
|
|
34
|
+
* working — which is the failure a fallback exists to prevent, arriving by the fallback.</p>
|
|
35
|
+
*
|
|
36
|
+
* <p>An unhandled block renders a readable default rather than nothing: a heading is a heading, a
|
|
37
|
+
* list is a list. Rendering nothing is how content goes missing silently, and "I did not write a
|
|
38
|
+
* component for `embed`" should not mean "the embed is gone".</p>
|
|
39
|
+
*/
|
|
40
|
+
export declare function ShioBlocks({ blocks, components, fallbackHtml }: ShioBlocksProps): import("react").JSX.Element | null;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import type { ShioPost } from "@viglet/shio-client";
|
|
2
|
-
/**
|
|
3
|
-
|
|
1
|
+
import type { ShioContentState, ShioPost } from "@viglet/shio-client";
|
|
2
|
+
/**
|
|
3
|
+
* Get a published post by id (attributes expanded). `null` when not found.
|
|
4
|
+
*
|
|
5
|
+
* SH1081 — `state` asks for another version (`"draft"`, `"rev:<n>"`), which needs a preview token.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useShioPost(postId: string | undefined, state?: ShioContentState): import("./use-async").ShioAsyncState<ShioPost | null>;
|
|
4
8
|
/**
|
|
5
9
|
* Resolve a published post by site + friendly URL — the client-side analog of
|
|
6
10
|
* the catch-all route. `null` when unresolved.
|
|
11
|
+
*
|
|
12
|
+
* SH1081 — `options.locale` pins a translation and `options.state` asks for another version, as
|
|
13
|
+
* the client's `getPostByUrl` takes them.
|
|
7
14
|
*/
|
|
8
|
-
export declare function useShioPostByUrl(siteId: string | undefined, url: string | undefined
|
|
15
|
+
export declare function useShioPostByUrl(siteId: string | undefined, url: string | undefined, options?: {
|
|
16
|
+
locale?: string;
|
|
17
|
+
state?: ShioContentState;
|
|
18
|
+
}): import("./use-async").ShioAsyncState<ShioPost | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export { useShioBreadcrumb } from "./hooks/use-shio-breadcrumb";
|
|
|
9
9
|
export { useShioPost, useShioPostByUrl } from "./hooks/use-shio-post";
|
|
10
10
|
export { useShioQuery } from "./hooks/use-shio-query";
|
|
11
11
|
export { ShioRichText } from "./components/shio-rich-text";
|
|
12
|
+
export { ShioBlocks } from "./components/shio-blocks";
|
|
13
|
+
export type { ShioBlocksProps, ShioBlockComponent, ShioBlockComponents } from "./components/shio-blocks";
|
|
12
14
|
export type { ShioRichTextProps } from "./components/shio-rich-text";
|
|
13
15
|
export { ShioImage } from "./components/shio-image";
|
|
14
16
|
export type { ShioImageProps } from "./components/shio-image";
|
|
@@ -16,4 +18,4 @@ export { ShioRelator } from "./components/shio-relator";
|
|
|
16
18
|
export type { ShioRelatorProps } from "./components/shio-relator";
|
|
17
19
|
export { ShioField } from "./components/shio-field";
|
|
18
20
|
export type { ShioFieldProps, ShioFieldKind } from "./components/shio-field";
|
|
19
|
-
export type { ShioClientConfig, ShioRequestOptions, ShioSite, ShioFolder, ShioPostSummary, ShioPost, ShioListing, ShioPath, ShioQueryParams, ShioPageParams, } from "@viglet/shio-client";
|
|
21
|
+
export type { ShioClientConfig, ShioRequestOptions, ShioSite, ShioSiteLocales, ShioFolder, ShioPostSummary, ShioPost, ShioListing, ShioPath, ShioQueryParams, ShioPageParams, } from "@viglet/shio-client";
|
package/dist/shio-react-sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as e, createContext as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
2
2
|
import { ShioClient as o, ShioClient as s, ShioHttpError as c, createShioClient as l } from "@viglet/shio-client";
|
|
3
3
|
import { Fragment as u, jsx as d } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/provider.tsx
|
|
5
5
|
var f = t(null);
|
|
6
6
|
function p(e) {
|
|
7
7
|
let { children: t } = e, n = "client" in e ? e.client : void 0, r = n ? void 0 : e, a = i(() => n ?? new s(r), [
|
|
@@ -21,8 +21,7 @@ function m() {
|
|
|
21
21
|
if (!e) throw Error("useShioClient must be used within a <ShioProvider>");
|
|
22
22
|
return e;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
//#region src/hooks/use-async.ts
|
|
24
|
+
// src/hooks/use-async.ts
|
|
26
25
|
function h(e, t, n = !0) {
|
|
27
26
|
let [i, o] = a({
|
|
28
27
|
data: void 0,
|
|
@@ -58,8 +57,7 @@ function h(e, t, n = !0) {
|
|
|
58
57
|
}), () => t.abort();
|
|
59
58
|
}, t), i;
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
//#region src/hooks/use-shio-sites.ts
|
|
60
|
+
// src/hooks/use-shio-sites.ts
|
|
63
61
|
function g() {
|
|
64
62
|
let e = m();
|
|
65
63
|
return h((t) => e.getSites({ signal: t }), [e]);
|
|
@@ -68,39 +66,52 @@ function _(e) {
|
|
|
68
66
|
let t = m();
|
|
69
67
|
return h((n) => t.getSite(e, { signal: n }), [t, e], !!e);
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/hooks/use-shio-children.ts
|
|
69
|
+
// src/hooks/use-shio-children.ts
|
|
73
70
|
function v(e, t) {
|
|
74
71
|
let n = m();
|
|
75
72
|
return h((r) => n.listChildren(e, t, { signal: r }), [
|
|
76
73
|
n,
|
|
77
74
|
e,
|
|
78
75
|
t?.page,
|
|
79
|
-
t?.size
|
|
76
|
+
t?.size,
|
|
77
|
+
t?.locale,
|
|
78
|
+
t?.state
|
|
80
79
|
], !!e);
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
//#region src/hooks/use-shio-breadcrumb.ts
|
|
81
|
+
// src/hooks/use-shio-breadcrumb.ts
|
|
84
82
|
function y(e) {
|
|
85
83
|
let t = m();
|
|
86
84
|
return h((n) => t.getPath(e, { signal: n }), [t, e], !!e);
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function b(e) {
|
|
91
|
-
let t = m();
|
|
92
|
-
return h((n) => t.getPost(e, { signal: n }), [t, e], !!e);
|
|
93
|
-
}
|
|
94
|
-
function x(e, t) {
|
|
86
|
+
// src/hooks/use-shio-post.ts
|
|
87
|
+
function b(e, t) {
|
|
95
88
|
let n = m();
|
|
96
|
-
return h((r) => n.
|
|
89
|
+
return h((r) => n.getPost(e, {
|
|
90
|
+
signal: r,
|
|
91
|
+
state: t
|
|
92
|
+
}), [
|
|
97
93
|
n,
|
|
98
94
|
e,
|
|
99
95
|
t
|
|
96
|
+
], !!e);
|
|
97
|
+
}
|
|
98
|
+
function x(e, t, n) {
|
|
99
|
+
let r = m(), i = n?.locale, a = n?.state;
|
|
100
|
+
return h((n) => i ? r.getPostByUrl(e, t, i, {
|
|
101
|
+
signal: n,
|
|
102
|
+
state: a
|
|
103
|
+
}) : r.getPostByUrl(e, t, {
|
|
104
|
+
signal: n,
|
|
105
|
+
state: a
|
|
106
|
+
}), [
|
|
107
|
+
r,
|
|
108
|
+
e,
|
|
109
|
+
t,
|
|
110
|
+
i,
|
|
111
|
+
a
|
|
100
112
|
], !!e && !!t);
|
|
101
113
|
}
|
|
102
|
-
|
|
103
|
-
//#region src/hooks/use-shio-query.ts
|
|
114
|
+
// src/hooks/use-shio-query.ts
|
|
104
115
|
function S(e, t = !0) {
|
|
105
116
|
let n = m();
|
|
106
117
|
return h((t) => n.query(e, { signal: t }), [
|
|
@@ -109,20 +120,49 @@ function S(e, t = !0) {
|
|
|
109
120
|
e?.folderId,
|
|
110
121
|
e?.postType,
|
|
111
122
|
e?.page,
|
|
112
|
-
e?.size
|
|
123
|
+
e?.size,
|
|
124
|
+
e?.locale,
|
|
125
|
+
e?.state
|
|
113
126
|
], t);
|
|
114
127
|
}
|
|
115
|
-
|
|
116
|
-
//#region src/components/shio-rich-text.tsx
|
|
128
|
+
// src/components/shio-rich-text.tsx
|
|
117
129
|
function C({ html: e, ...t }) {
|
|
118
130
|
return e ? /* @__PURE__ */ d("div", {
|
|
119
131
|
...t,
|
|
120
132
|
dangerouslySetInnerHTML: { __html: e }
|
|
121
133
|
}) : null;
|
|
122
134
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
// src/components/shio-blocks.tsx
|
|
136
|
+
function w({ blocks: e, components: t, fallbackHtml: n }) {
|
|
137
|
+
return e?.length ? /* @__PURE__ */ d(u, { children: e.map((e) => {
|
|
138
|
+
let r = t?.[e.type];
|
|
139
|
+
return /* @__PURE__ */ d("div", { children: r ? /* @__PURE__ */ d(r, { block: e }) : T(e, n) }, e.key);
|
|
140
|
+
}) }) : null;
|
|
141
|
+
}
|
|
142
|
+
function T(e, t) {
|
|
143
|
+
switch (e.type) {
|
|
144
|
+
case "heading": {
|
|
145
|
+
let t = `h${Math.min(6, Math.max(1, e.level ?? 2))}`;
|
|
146
|
+
return /* @__PURE__ */ d(t, { children: e.text });
|
|
147
|
+
}
|
|
148
|
+
case "paragraph": return /* @__PURE__ */ d("p", { children: e.text });
|
|
149
|
+
case "quote": return /* @__PURE__ */ d("blockquote", { children: e.text });
|
|
150
|
+
case "code": return /* @__PURE__ */ d("pre", { children: /* @__PURE__ */ d("code", { children: e.text }) });
|
|
151
|
+
case "list": return e.ordered ? /* @__PURE__ */ d("ol", { children: (e.items ?? []).map(E) }) : /* @__PURE__ */ d("ul", { children: (e.items ?? []).map(E) });
|
|
152
|
+
case "image": return /* @__PURE__ */ d("img", {
|
|
153
|
+
src: e.src,
|
|
154
|
+
alt: e.alt ?? ""
|
|
155
|
+
});
|
|
156
|
+
case "embed":
|
|
157
|
+
case "reference": return null;
|
|
158
|
+
default: return typeof t == "string" && t ? /* @__PURE__ */ d("div", { dangerouslySetInnerHTML: { __html: t } }) : null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function E(e, t) {
|
|
162
|
+
return /* @__PURE__ */ d("li", { children: e }, `${t}-${e}`);
|
|
163
|
+
}
|
|
164
|
+
// src/components/shio-image.tsx
|
|
165
|
+
function D({ src: e, baseUrl: t, alt: n = "", ...r }) {
|
|
126
166
|
if (!e) return null;
|
|
127
167
|
let i = /^(https?:)?\/\//.test(e) || e.startsWith("data:") || !t ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`;
|
|
128
168
|
return /* @__PURE__ */ d("img", {
|
|
@@ -131,25 +171,23 @@ function w({ src: e, baseUrl: t, alt: n = "", ...r }) {
|
|
|
131
171
|
...r
|
|
132
172
|
});
|
|
133
173
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
function T({ items: t, children: n, keyFor: r }) {
|
|
174
|
+
// src/components/shio-relator.tsx
|
|
175
|
+
function O({ items: t, children: n, keyFor: r }) {
|
|
137
176
|
return /* @__PURE__ */ d(u, { children: (Array.isArray(t) ? t : []).map((t, i) => /* @__PURE__ */ d(e, { children: n(t, i) }, r ? r(t, i) : i)) });
|
|
138
177
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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";
|
|
178
|
+
// src/components/shio-field.tsx
|
|
179
|
+
var k = /<[a-z][\s\S]*>/i, A = /\.(png|jpe?g|gif|webp|svg|avif)$/i;
|
|
180
|
+
function j(e) {
|
|
181
|
+
return typeof e == "string" ? k.test(e) ? "html" : A.test(e.trim()) ? "image" : "text" : Array.isArray(e) ? "list" : typeof e == "object" && e ? "json" : "text";
|
|
144
182
|
}
|
|
145
|
-
function
|
|
183
|
+
function M({ value: e, as: t, baseUrl: n, className: r }) {
|
|
146
184
|
if (e == null || e === "") return null;
|
|
147
|
-
switch (t ??
|
|
185
|
+
switch (t ?? j(e)) {
|
|
148
186
|
case "html": return /* @__PURE__ */ d(C, {
|
|
149
187
|
className: r,
|
|
150
188
|
html: String(e)
|
|
151
189
|
});
|
|
152
|
-
case "image": return /* @__PURE__ */ d(
|
|
190
|
+
case "image": return /* @__PURE__ */ d(D, {
|
|
153
191
|
className: r,
|
|
154
192
|
src: String(e),
|
|
155
193
|
baseUrl: n
|
|
@@ -168,5 +206,4 @@ function k({ value: e, as: t, baseUrl: n, className: r }) {
|
|
|
168
206
|
});
|
|
169
207
|
}
|
|
170
208
|
}
|
|
171
|
-
|
|
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 };
|
|
209
|
+
export { w as ShioBlocks, o as ShioClient, M as ShioField, c as ShioHttpError, D as ShioImage, p as ShioProvider, O 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(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
|
|
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,t?.locale,t?.state],!!e)}function d(e){let t=o();return s(n=>t.getPath(e,{signal:n}),[t,e],!!e)}function f(e,t){let n=o();return s(r=>n.getPost(e,{signal:r,state:t}),[n,e,t],!!e)}function p(e,t,n){let r=o(),i=n?.locale,a=n?.state;return s(n=>i?r.getPostByUrl(e,t,i,{signal:n,state:a}):r.getPostByUrl(e,t,{signal:n,state:a}),[r,e,t,i,a],!!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,e?.locale,e?.state],t)}function h({html:e,...t}){return e?(0,r.jsx)(`div`,{...t,dangerouslySetInnerHTML:{__html:e}}):null}function g({blocks:e,components:t,fallbackHtml:n}){return e?.length?(0,r.jsx)(r.Fragment,{children:e.map(e=>{let i=t?.[e.type];return(0,r.jsx)(`div`,{children:i?(0,r.jsx)(i,{block:e}):_(e,n)},e.key)})}):null}function _(e,t){switch(e.type){case`heading`:{let t=`h${Math.min(6,Math.max(1,e.level??2))}`;return(0,r.jsx)(t,{children:e.text})}case`paragraph`:return(0,r.jsx)(`p`,{children:e.text});case`quote`:return(0,r.jsx)(`blockquote`,{children:e.text});case`code`:return(0,r.jsx)(`pre`,{children:(0,r.jsx)(`code`,{children:e.text})});case`list`:return e.ordered?(0,r.jsx)(`ol`,{children:(e.items??[]).map(v)}):(0,r.jsx)(`ul`,{children:(e.items??[]).map(v)});case`image`:return(0,r.jsx)(`img`,{src:e.src,alt:e.alt??``});case`embed`:case`reference`:return null;default:return typeof t==`string`&&t?(0,r.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t}}):null}}function v(e,t){return(0,r.jsx)(`li`,{children:e},`${t}-${e}`)}function y({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 b({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 x=/<[a-z][\s\S]*>/i,S=/\.(png|jpe?g|gif|webp|svg|avif)$/i;function C(e){return typeof e==`string`?x.test(e)?`html`:S.test(e.trim())?`image`:`text`:Array.isArray(e)?`list`:typeof e==`object`&&e?`json`:`text`}function w({value:e,as:t,baseUrl:n,className:i}){if(e==null||e===``)return null;switch(t??C(e)){case`html`:return(0,r.jsx)(h,{className:i,html:String(e)});case`image`:return(0,r.jsx)(y,{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)})}}e.ShioBlocks=g,Object.defineProperty(e,"ShioClient",{enumerable:!0,get:function(){return n.ShioClient}}),e.ShioField=w,Object.defineProperty(e,"ShioHttpError",{enumerable:!0,get:function(){return n.ShioHttpError}}),e.ShioImage=y,e.ShioProvider=a,e.ShioRelator=b,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/dist/types.d.ts
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* re-exported here for convenience, so React consumers can import them from a
|
|
4
4
|
* single package.
|
|
5
5
|
*/
|
|
6
|
-
export type { ShioClientConfig, ShioRequestOptions, ShioSite, ShioFolder, ShioPostSummary, ShioPost, ShioListing, ShioPath, ShioQueryParams, ShioPageParams, } from "@viglet/shio-client";
|
|
6
|
+
export type { ShioClientConfig, ShioRequestOptions, ShioSite, ShioSiteLocales, ShioFolder, ShioPostSummary, ShioPost, ShioListing, ShioPath, ShioQueryParams, ShioPageParams, } from "@viglet/shio-client";
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viglet/shio-react-sdk",
|
|
3
|
-
"version": "2026.3.
|
|
4
|
-
"description": "React SDK for consuming Shio
|
|
5
|
-
"homepage": "https://
|
|
3
|
+
"version": "2026.3.3",
|
|
4
|
+
"description": "React SDK for consuming Viglet Shio content via the Content Delivery API (CDA). Hooks + render components built on @viglet/shio-client.",
|
|
5
|
+
"homepage": "https://openviglet.github.io/shio/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/openviglet/shio.git",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@viglet/shio-client": "2026.3.
|
|
29
|
+
"@viglet/shio-client": "2026.3.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/react": "^19.
|
|
36
|
-
"react": "^19.
|
|
35
|
+
"@types/react": "^19.3.0",
|
|
36
|
+
"react": "^19.3.1",
|
|
37
37
|
"typescript": "^5.8.3",
|
|
38
|
-
"vite": "^8.
|
|
38
|
+
"vite": "^8.3.5"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"shio",
|