@softistx/alxia-react-router 0.0.0-stage → 0.83.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (609) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2085 -2
  3. package/dist/api-keys/api-keys.d.ts +93 -0
  4. package/dist/api-keys/api-keys.d.ts.map +1 -0
  5. package/dist/api-keys/index.d.ts +9 -0
  6. package/dist/api-keys/index.d.ts.map +1 -0
  7. package/dist/api-keys/index.js +66 -0
  8. package/dist/api-keys/index.js.map +10 -0
  9. package/dist/assets.d.ts +14 -0
  10. package/dist/assets.d.ts.map +1 -0
  11. package/dist/chunks/index-0786n4qe.js +25 -0
  12. package/dist/chunks/index-0786n4qe.js.map +10 -0
  13. package/dist/chunks/index-1nw5yeek.js +169 -0
  14. package/dist/chunks/index-1nw5yeek.js.map +11 -0
  15. package/dist/chunks/index-59vhfj6n.js +10 -0
  16. package/dist/chunks/index-59vhfj6n.js.map +10 -0
  17. package/dist/chunks/index-5gqcpyyg.js +34 -0
  18. package/dist/chunks/index-5gqcpyyg.js.map +10 -0
  19. package/dist/chunks/index-6jf7zpxz.js +119 -0
  20. package/dist/chunks/index-6jf7zpxz.js.map +11 -0
  21. package/dist/chunks/index-8as4j8m3.js +340 -0
  22. package/dist/chunks/index-8as4j8m3.js.map +16 -0
  23. package/dist/chunks/index-9xv2a8et.js +108 -0
  24. package/dist/chunks/index-9xv2a8et.js.map +11 -0
  25. package/dist/chunks/index-ajtvyq35.js +16 -0
  26. package/dist/chunks/index-ajtvyq35.js.map +10 -0
  27. package/dist/chunks/index-c55hxgr5.js +124 -0
  28. package/dist/chunks/index-c55hxgr5.js.map +14 -0
  29. package/dist/chunks/index-d42p3mdp.js +19 -0
  30. package/dist/chunks/index-d42p3mdp.js.map +10 -0
  31. package/dist/chunks/index-gac44rs5.js +42 -0
  32. package/dist/chunks/index-gac44rs5.js.map +11 -0
  33. package/dist/chunks/index-j4ktpcke.js +62 -0
  34. package/dist/chunks/index-j4ktpcke.js.map +10 -0
  35. package/dist/chunks/index-mscfme4r.js +12 -0
  36. package/dist/chunks/index-mscfme4r.js.map +10 -0
  37. package/dist/chunks/index-pghmb2dm.js +30 -0
  38. package/dist/chunks/index-pghmb2dm.js.map +10 -0
  39. package/dist/chunks/index-rfr02vg4.js +40 -0
  40. package/dist/chunks/index-rfr02vg4.js.map +10 -0
  41. package/dist/chunks/index-sfhshxqz.js +31 -0
  42. package/dist/chunks/index-sfhshxqz.js.map +10 -0
  43. package/dist/chunks/index-skwypsjz.js +357 -0
  44. package/dist/chunks/index-skwypsjz.js.map +12 -0
  45. package/dist/chunks/index-sxh06ged.js +118 -0
  46. package/dist/chunks/index-sxh06ged.js.map +11 -0
  47. package/dist/chunks/index-t2ph23wk.js +96 -0
  48. package/dist/chunks/index-t2ph23wk.js.map +13 -0
  49. package/dist/chunks/index-thyabr5n.js +19 -0
  50. package/dist/chunks/index-thyabr5n.js.map +10 -0
  51. package/dist/chunks/index-tx36swjx.js +134 -0
  52. package/dist/chunks/index-tx36swjx.js.map +11 -0
  53. package/dist/chunks/index-v2z5k640.js +54 -0
  54. package/dist/chunks/index-v2z5k640.js.map +11 -0
  55. package/dist/chunks/index-vr82typq.js +23 -0
  56. package/dist/chunks/index-vr82typq.js.map +11 -0
  57. package/dist/chunks/index-whj6h5eg.js +9 -0
  58. package/dist/chunks/index-whj6h5eg.js.map +10 -0
  59. package/dist/chunks/index-wyypkfdv.js +130 -0
  60. package/dist/chunks/index-wyypkfdv.js.map +13 -0
  61. package/dist/chunks/index-xd5aqy3g.js +90 -0
  62. package/dist/chunks/index-xd5aqy3g.js.map +10 -0
  63. package/dist/chunks/index-zdbqzcjp.js +97 -0
  64. package/dist/chunks/index-zdbqzcjp.js.map +12 -0
  65. package/dist/chunks/index-zyg8amjc.js +23 -0
  66. package/dist/chunks/index-zyg8amjc.js.map +10 -0
  67. package/dist/cli/index.d.ts +3 -0
  68. package/dist/cli/index.d.ts.map +1 -0
  69. package/dist/cli/index.js +215 -0
  70. package/dist/cli/index.js.map +13 -0
  71. package/dist/cli/main.d.ts +13 -0
  72. package/dist/cli/main.d.ts.map +1 -0
  73. package/dist/cli/reveal.d.ts +18 -0
  74. package/dist/cli/reveal.d.ts.map +1 -0
  75. package/dist/cli/template.d.ts +8 -0
  76. package/dist/cli/template.d.ts.map +1 -0
  77. package/dist/context.d.ts +104 -0
  78. package/dist/context.d.ts.map +1 -0
  79. package/dist/document/index.d.ts +11 -0
  80. package/dist/document/index.d.ts.map +1 -0
  81. package/dist/document/index.js +19 -0
  82. package/dist/document/index.js.map +9 -0
  83. package/dist/document/inline-script.d.ts +27 -0
  84. package/dist/document/inline-script.d.ts.map +1 -0
  85. package/dist/document/language-store.d.ts +8 -0
  86. package/dist/document/language-store.d.ts.map +1 -0
  87. package/dist/document/nonce.d.ts +34 -0
  88. package/dist/document/nonce.d.ts.map +1 -0
  89. package/dist/document/page-language.d.ts +39 -0
  90. package/dist/document/page-language.d.ts.map +1 -0
  91. package/dist/document/text-direction.d.ts +10 -0
  92. package/dist/document/text-direction.d.ts.map +1 -0
  93. package/dist/entry/abort.d.ts +21 -0
  94. package/dist/entry/abort.d.ts.map +1 -0
  95. package/dist/entry/create-entry.d.ts +41 -0
  96. package/dist/entry/create-entry.d.ts.map +1 -0
  97. package/dist/entry/index.d.ts +8 -0
  98. package/dist/entry/index.d.ts.map +1 -0
  99. package/dist/entry/index.js +154 -0
  100. package/dist/entry/index.js.map +13 -0
  101. package/dist/entry/root-data.d.ts +27 -0
  102. package/dist/entry/root-data.d.ts.map +1 -0
  103. package/dist/entry/whole-page.d.ts +10 -0
  104. package/dist/entry/whole-page.d.ts.map +1 -0
  105. package/dist/errors/api-error.d.ts +117 -0
  106. package/dist/errors/api-error.d.ts.map +1 -0
  107. package/dist/errors/api-errors.d.ts +122 -0
  108. package/dist/errors/api-errors.d.ts.map +1 -0
  109. package/dist/errors/call-failure.d.ts +45 -0
  110. package/dist/errors/call-failure.d.ts.map +1 -0
  111. package/dist/errors/catalogue-check.d.ts +24 -0
  112. package/dist/errors/catalogue-check.d.ts.map +1 -0
  113. package/dist/errors/catalogue-read.d.ts +33 -0
  114. package/dist/errors/catalogue-read.d.ts.map +1 -0
  115. package/dist/errors/catalogue.d.ts +59 -0
  116. package/dist/errors/catalogue.d.ts.map +1 -0
  117. package/dist/errors/code-resolver.d.ts +44 -0
  118. package/dist/errors/code-resolver.d.ts.map +1 -0
  119. package/dist/errors/cross-site.d.ts +8 -0
  120. package/dist/errors/cross-site.d.ts.map +1 -0
  121. package/dist/errors/describe-refusal.d.ts +6 -0
  122. package/dist/errors/describe-refusal.d.ts.map +1 -0
  123. package/dist/errors/describe.d.ts +3 -0
  124. package/dist/errors/describe.d.ts.map +1 -0
  125. package/dist/errors/fetcher-result.d.ts +33 -0
  126. package/dist/errors/fetcher-result.d.ts.map +1 -0
  127. package/dist/errors/field-placement.d.ts +12 -0
  128. package/dist/errors/field-placement.d.ts.map +1 -0
  129. package/dist/errors/form-errors.d.ts +8 -0
  130. package/dist/errors/form-errors.d.ts.map +1 -0
  131. package/dist/errors/form-refusal.d.ts +25 -0
  132. package/dist/errors/form-refusal.d.ts.map +1 -0
  133. package/dist/errors/index.d.ts +21 -0
  134. package/dist/errors/index.d.ts.map +1 -0
  135. package/dist/errors/index.js +588 -0
  136. package/dist/errors/index.js.map +26 -0
  137. package/dist/errors/json-actions.d.ts +38 -0
  138. package/dist/errors/json-actions.d.ts.map +1 -0
  139. package/dist/errors/log.d.ts +8 -0
  140. package/dist/errors/log.d.ts.map +1 -0
  141. package/dist/errors/message-values.d.ts +11 -0
  142. package/dist/errors/message-values.d.ts.map +1 -0
  143. package/dist/errors/messages.d.ts +63 -0
  144. package/dist/errors/messages.d.ts.map +1 -0
  145. package/dist/errors/page-path.d.ts +9 -0
  146. package/dist/errors/page-path.d.ts.map +1 -0
  147. package/dist/errors/problem-error.d.ts +50 -0
  148. package/dist/errors/problem-error.d.ts.map +1 -0
  149. package/dist/errors/provider.d.ts +20 -0
  150. package/dist/errors/provider.d.ts.map +1 -0
  151. package/dist/errors/request-id.d.ts +5 -0
  152. package/dist/errors/request-id.d.ts.map +1 -0
  153. package/dist/errors/route-error.d.ts +33 -0
  154. package/dist/errors/route-error.d.ts.map +1 -0
  155. package/dist/errors/route-refusal.d.ts +20 -0
  156. package/dist/errors/route-refusal.d.ts.map +1 -0
  157. package/dist/errors/same-site.d.ts +49 -0
  158. package/dist/errors/same-site.d.ts.map +1 -0
  159. package/dist/errors/section-action.d.ts +46 -0
  160. package/dist/errors/section-action.d.ts.map +1 -0
  161. package/dist/errors/standard-schema.d.ts +34 -0
  162. package/dist/errors/standard-schema.d.ts.map +1 -0
  163. package/dist/errors/submit-form.d.ts +16 -0
  164. package/dist/errors/submit-form.d.ts.map +1 -0
  165. package/dist/errors/upstream-headers.d.ts +18 -0
  166. package/dist/errors/upstream-headers.d.ts.map +1 -0
  167. package/dist/errors/use-json-fetcher.d.ts +18 -0
  168. package/dist/errors/use-json-fetcher.d.ts.map +1 -0
  169. package/dist/fetcher/auth-refusal.d.ts +29 -0
  170. package/dist/fetcher/auth-refusal.d.ts.map +1 -0
  171. package/dist/fetcher/index.d.ts +20 -0
  172. package/dist/fetcher/index.d.ts.map +1 -0
  173. package/dist/fetcher/index.js +392 -0
  174. package/dist/fetcher/index.js.map +21 -0
  175. package/dist/fetcher/section-form.d.ts +24 -0
  176. package/dist/fetcher/section-form.d.ts.map +1 -0
  177. package/dist/fetcher/section-reload.d.ts +17 -0
  178. package/dist/fetcher/section-reload.d.ts.map +1 -0
  179. package/dist/fetcher/section-save.d.ts +29 -0
  180. package/dist/fetcher/section-save.d.ts.map +1 -0
  181. package/dist/fetcher/use-debounced-fetcher.d.ts +57 -0
  182. package/dist/fetcher/use-debounced-fetcher.d.ts.map +1 -0
  183. package/dist/fetcher/use-fetcher-answer.d.ts +16 -0
  184. package/dist/fetcher/use-fetcher-answer.d.ts.map +1 -0
  185. package/dist/fetcher/use-fetcher-done.d.ts +15 -0
  186. package/dist/fetcher/use-fetcher-done.d.ts.map +1 -0
  187. package/dist/fetcher/use-fetcher-promise.d.ts +48 -0
  188. package/dist/fetcher/use-fetcher-promise.d.ts.map +1 -0
  189. package/dist/fetcher/use-form-refusal.d.ts +20 -0
  190. package/dist/fetcher/use-form-refusal.d.ts.map +1 -0
  191. package/dist/fetcher/use-revalidate-on-focus.d.ts +20 -0
  192. package/dist/fetcher/use-revalidate-on-focus.d.ts.map +1 -0
  193. package/dist/fetcher/use-row-save.d.ts +32 -0
  194. package/dist/fetcher/use-row-save.d.ts.map +1 -0
  195. package/dist/fetcher/use-section-save.d.ts +46 -0
  196. package/dist/fetcher/use-section-save.d.ts.map +1 -0
  197. package/dist/fetcher/use-visible-interval.d.ts +24 -0
  198. package/dist/fetcher/use-visible-interval.d.ts.map +1 -0
  199. package/dist/fetcher/use-visible-revalidation.d.ts +10 -0
  200. package/dist/fetcher/use-visible-revalidation.d.ts.map +1 -0
  201. package/dist/health.d.ts +21 -0
  202. package/dist/health.d.ts.map +1 -0
  203. package/dist/help/check/check.d.ts +35 -0
  204. package/dist/help/check/check.d.ts.map +1 -0
  205. package/dist/help/check/index.d.ts +8 -0
  206. package/dist/help/check/index.d.ts.map +1 -0
  207. package/dist/help/check/index.js +17 -0
  208. package/dist/help/check/index.js.map +9 -0
  209. package/dist/help/check/routes.d.ts +22 -0
  210. package/dist/help/check/routes.d.ts.map +1 -0
  211. package/dist/help/guide.d.ts +33 -0
  212. package/dist/help/guide.d.ts.map +1 -0
  213. package/dist/help/index.d.ts +16 -0
  214. package/dist/help/index.d.ts.map +1 -0
  215. package/dist/help/index.js +192 -0
  216. package/dist/help/index.js.map +14 -0
  217. package/dist/help/load.d.ts +39 -0
  218. package/dist/help/load.d.ts.map +1 -0
  219. package/dist/help/panel.d.ts +69 -0
  220. package/dist/help/panel.d.ts.map +1 -0
  221. package/dist/help/parse-flow.d.ts +27 -0
  222. package/dist/help/parse-flow.d.ts.map +1 -0
  223. package/dist/help/react.d.ts +12 -0
  224. package/dist/help/react.d.ts.map +1 -0
  225. package/dist/help/resolve.d.ts +24 -0
  226. package/dist/help/resolve.d.ts.map +1 -0
  227. package/dist/help/types.d.ts +50 -0
  228. package/dist/help/types.d.ts.map +1 -0
  229. package/dist/help/yaml.d.ts +18 -0
  230. package/dist/help/yaml.d.ts.map +1 -0
  231. package/dist/index.d.ts +7 -0
  232. package/dist/index.d.ts.map +1 -0
  233. package/dist/index.js +197 -0
  234. package/dist/index.js.map +14 -0
  235. package/dist/link/index.d.ts +7 -0
  236. package/dist/link/index.d.ts.map +1 -0
  237. package/dist/link/index.js +16 -0
  238. package/dist/link/index.js.map +10 -0
  239. package/dist/link/router-link.d.ts +27 -0
  240. package/dist/link/router-link.d.ts.map +1 -0
  241. package/dist/lists/connection-page.d.ts +50 -0
  242. package/dist/lists/connection-page.d.ts.map +1 -0
  243. package/dist/lists/index.d.ts +13 -0
  244. package/dist/lists/index.d.ts.map +1 -0
  245. package/dist/lists/index.js +205 -0
  246. package/dist/lists/index.js.map +15 -0
  247. package/dist/lists/newest-first.d.ts +5 -0
  248. package/dist/lists/newest-first.d.ts.map +1 -0
  249. package/dist/lists/nodes-of.d.ts +21 -0
  250. package/dist/lists/nodes-of.d.ts.map +1 -0
  251. package/dist/lists/or-failed.d.ts +19 -0
  252. package/dist/lists/or-failed.d.ts.map +1 -0
  253. package/dist/lists/use-paged-rows.d.ts +40 -0
  254. package/dist/lists/use-paged-rows.d.ts.map +1 -0
  255. package/dist/lists/use-same-route-loading.d.ts +8 -0
  256. package/dist/lists/use-same-route-loading.d.ts.map +1 -0
  257. package/dist/lists/use-search-change.d.ts +20 -0
  258. package/dist/lists/use-search-change.d.ts.map +1 -0
  259. package/dist/mcp/index.d.ts +8 -0
  260. package/dist/mcp/index.d.ts.map +1 -0
  261. package/dist/mcp/index.js +105 -0
  262. package/dist/mcp/index.js.map +11 -0
  263. package/dist/mcp/mcp-relay.d.ts +58 -0
  264. package/dist/mcp/mcp-relay.d.ts.map +1 -0
  265. package/dist/mcp/relay.d.ts +38 -0
  266. package/dist/mcp/relay.d.ts.map +1 -0
  267. package/dist/media/client/error.d.ts +29 -0
  268. package/dist/media/client/error.d.ts.map +1 -0
  269. package/dist/media/client/index.d.ts +8 -0
  270. package/dist/media/client/index.d.ts.map +1 -0
  271. package/dist/media/client/index.js +133 -0
  272. package/dist/media/client/index.js.map +11 -0
  273. package/dist/media/client/upload.d.ts +32 -0
  274. package/dist/media/client/upload.d.ts.map +1 -0
  275. package/dist/media/forward.d.ts +14 -0
  276. package/dist/media/forward.d.ts.map +1 -0
  277. package/dist/media/headers.d.ts +11 -0
  278. package/dist/media/headers.d.ts.map +1 -0
  279. package/dist/media/index.d.ts +9 -0
  280. package/dist/media/index.d.ts.map +1 -0
  281. package/dist/media/index.js +396 -0
  282. package/dist/media/index.js.map +16 -0
  283. package/dist/media/options.d.ts +114 -0
  284. package/dist/media/options.d.ts.map +1 -0
  285. package/dist/media/path.d.ts +12 -0
  286. package/dist/media/path.d.ts.map +1 -0
  287. package/dist/media/read.d.ts +11 -0
  288. package/dist/media/read.d.ts.map +1 -0
  289. package/dist/media/refusal.d.ts +11 -0
  290. package/dist/media/refusal.d.ts.map +1 -0
  291. package/dist/media/respond.d.ts +8 -0
  292. package/dist/media/respond.d.ts.map +1 -0
  293. package/dist/media/write.d.ts +13 -0
  294. package/dist/media/write.d.ts.map +1 -0
  295. package/dist/navigation/index.d.ts +9 -0
  296. package/dist/navigation/index.d.ts.map +1 -0
  297. package/dist/navigation/index.js +48 -0
  298. package/dist/navigation/index.js.map +11 -0
  299. package/dist/navigation/use-focus-on-navigate.d.ts +16 -0
  300. package/dist/navigation/use-focus-on-navigate.d.ts.map +1 -0
  301. package/dist/navigation/use-route-transition.d.ts +19 -0
  302. package/dist/navigation/use-route-transition.d.ts.map +1 -0
  303. package/dist/nonce.d.ts +16 -0
  304. package/dist/nonce.d.ts.map +1 -0
  305. package/dist/oauth/answer.d.ts +33 -0
  306. package/dist/oauth/answer.d.ts.map +1 -0
  307. package/dist/oauth/binding.d.ts +43 -0
  308. package/dist/oauth/binding.d.ts.map +1 -0
  309. package/dist/oauth/consent.d.ts +134 -0
  310. package/dist/oauth/consent.d.ts.map +1 -0
  311. package/dist/oauth/grants.d.ts +88 -0
  312. package/dist/oauth/grants.d.ts.map +1 -0
  313. package/dist/oauth/index.d.ts +16 -0
  314. package/dist/oauth/index.d.ts.map +1 -0
  315. package/dist/oauth/index.js +207 -0
  316. package/dist/oauth/index.js.map +12 -0
  317. package/dist/oauth/model.d.ts +13 -0
  318. package/dist/oauth/model.d.ts.map +1 -0
  319. package/dist/oauth/react/index.d.ts +7 -0
  320. package/dist/oauth/react/index.d.ts.map +1 -0
  321. package/dist/oauth/react/index.js +99 -0
  322. package/dist/oauth/react/index.js.map +10 -0
  323. package/dist/oauth/react/use-consent.d.ts +52 -0
  324. package/dist/oauth/react/use-consent.d.ts.map +1 -0
  325. package/dist/oidc/dpop.d.ts +80 -0
  326. package/dist/oidc/dpop.d.ts.map +1 -0
  327. package/dist/oidc/errors.d.ts +16 -0
  328. package/dist/oidc/errors.d.ts.map +1 -0
  329. package/dist/oidc/flow.d.ts +59 -0
  330. package/dist/oidc/flow.d.ts.map +1 -0
  331. package/dist/oidc/index.d.ts +11 -0
  332. package/dist/oidc/index.d.ts.map +1 -0
  333. package/dist/oidc/index.js +742 -0
  334. package/dist/oidc/index.js.map +15 -0
  335. package/dist/oidc/oidc.d.ts +132 -0
  336. package/dist/oidc/oidc.d.ts.map +1 -0
  337. package/dist/oidc/revoke.d.ts +28 -0
  338. package/dist/oidc/revoke.d.ts.map +1 -0
  339. package/dist/oidc/seal.d.ts +20 -0
  340. package/dist/oidc/seal.d.ts.map +1 -0
  341. package/dist/pwa/build/build-worker.d.ts +41 -0
  342. package/dist/pwa/build/build-worker.d.ts.map +1 -0
  343. package/dist/pwa/build/index.d.ts +9 -0
  344. package/dist/pwa/build/index.d.ts.map +1 -0
  345. package/dist/pwa/build/index.js +9 -0
  346. package/dist/pwa/build/index.js.map +9 -0
  347. package/dist/pwa/build/precache.d.ts +17 -0
  348. package/dist/pwa/build/precache.d.ts.map +1 -0
  349. package/dist/pwa/index.d.ts +16 -0
  350. package/dist/pwa/index.d.ts.map +1 -0
  351. package/dist/pwa/index.js +110 -0
  352. package/dist/pwa/index.js.map +12 -0
  353. package/dist/pwa/model/caching.d.ts +46 -0
  354. package/dist/pwa/model/caching.d.ts.map +1 -0
  355. package/dist/pwa/model/clear-app-caches.d.ts +9 -0
  356. package/dist/pwa/model/clear-app-caches.d.ts.map +1 -0
  357. package/dist/pwa/model/font-precache.d.ts +15 -0
  358. package/dist/pwa/model/font-precache.d.ts.map +1 -0
  359. package/dist/pwa/model/manifest.d.ts +80 -0
  360. package/dist/pwa/model/manifest.d.ts.map +1 -0
  361. package/dist/pwa/model/precache-list.d.ts +40 -0
  362. package/dist/pwa/model/precache-list.d.ts.map +1 -0
  363. package/dist/pwa/model/registration.d.ts +39 -0
  364. package/dist/pwa/model/registration.d.ts.map +1 -0
  365. package/dist/pwa/model/start-service-worker.d.ts +24 -0
  366. package/dist/pwa/model/start-service-worker.d.ts.map +1 -0
  367. package/dist/pwa/model/storable.d.ts +8 -0
  368. package/dist/pwa/model/storable.d.ts.map +1 -0
  369. package/dist/pwa/model/theme-color.d.ts +20 -0
  370. package/dist/pwa/model/theme-color.d.ts.map +1 -0
  371. package/dist/pwa/model/update-notice.d.ts +38 -0
  372. package/dist/pwa/model/update-notice.d.ts.map +1 -0
  373. package/dist/pwa/model/worker-contract.d.ts +61 -0
  374. package/dist/pwa/model/worker-contract.d.ts.map +1 -0
  375. package/dist/pwa/react/index.d.ts +9 -0
  376. package/dist/pwa/react/index.d.ts.map +1 -0
  377. package/dist/pwa/react/index.js +75 -0
  378. package/dist/pwa/react/index.js.map +13 -0
  379. package/dist/pwa/react/use-online.d.ts +6 -0
  380. package/dist/pwa/react/use-online.d.ts.map +1 -0
  381. package/dist/pwa/react/use-service-worker.d.ts +33 -0
  382. package/dist/pwa/react/use-service-worker.d.ts.map +1 -0
  383. package/dist/pwa/react/use-update-notice.d.ts +14 -0
  384. package/dist/pwa/react/use-update-notice.d.ts.map +1 -0
  385. package/dist/pwa/server/index.d.ts +7 -0
  386. package/dist/pwa/server/index.d.ts.map +1 -0
  387. package/dist/pwa/server/index.js +18 -0
  388. package/dist/pwa/server/index.js.map +10 -0
  389. package/dist/pwa/server/no-cache.d.ts +22 -0
  390. package/dist/pwa/server/no-cache.d.ts.map +1 -0
  391. package/dist/pwa/worker/index.d.ts +9 -0
  392. package/dist/pwa/worker/index.d.ts.map +1 -0
  393. package/dist/pwa/worker/index.js +144 -0
  394. package/dist/pwa/worker/index.js.map +12 -0
  395. package/dist/pwa/worker/injected.d.ts +15 -0
  396. package/dist/pwa/worker/injected.d.ts.map +1 -0
  397. package/dist/pwa/worker/plan.d.ts +65 -0
  398. package/dist/pwa/worker/plan.d.ts.map +1 -0
  399. package/dist/pwa/worker/scope.d.ts +18 -0
  400. package/dist/pwa/worker/scope.d.ts.map +1 -0
  401. package/dist/pwa/worker/start-worker.d.ts +17 -0
  402. package/dist/pwa/worker/start-worker.d.ts.map +1 -0
  403. package/dist/react-router.d.ts +68 -0
  404. package/dist/react-router.d.ts.map +1 -0
  405. package/dist/server.d.ts +127 -0
  406. package/dist/server.d.ts.map +1 -0
  407. package/dist/session/codes.d.ts +9 -0
  408. package/dist/session/codes.d.ts.map +1 -0
  409. package/dist/session/cookies.d.ts +128 -0
  410. package/dist/session/cookies.d.ts.map +1 -0
  411. package/dist/session/flow-types.d.ts +235 -0
  412. package/dist/session/flow-types.d.ts.map +1 -0
  413. package/dist/session/guard.d.ts +10 -0
  414. package/dist/session/guard.d.ts.map +1 -0
  415. package/dist/session/index.d.ts +22 -0
  416. package/dist/session/index.d.ts.map +1 -0
  417. package/dist/session/index.js +1090 -0
  418. package/dist/session/index.js.map +27 -0
  419. package/dist/session/land.d.ts +28 -0
  420. package/dist/session/land.d.ts.map +1 -0
  421. package/dist/session/link-json.d.ts +22 -0
  422. package/dist/session/link-json.d.ts.map +1 -0
  423. package/dist/session/link-land.d.ts +20 -0
  424. package/dist/session/link-land.d.ts.map +1 -0
  425. package/dist/session/link-token.d.ts +24 -0
  426. package/dist/session/link-token.d.ts.map +1 -0
  427. package/dist/session/link-types.d.ts +142 -0
  428. package/dist/session/link-types.d.ts.map +1 -0
  429. package/dist/session/links.d.ts +14 -0
  430. package/dist/session/links.d.ts.map +1 -0
  431. package/dist/session/model/index.d.ts +8 -0
  432. package/dist/session/model/index.d.ts.map +1 -0
  433. package/dist/session/model/index.js +35 -0
  434. package/dist/session/model/index.js.map +9 -0
  435. package/dist/session/model/link-post.d.ts +35 -0
  436. package/dist/session/model/link-post.d.ts.map +1 -0
  437. package/dist/session/model/paths.d.ts +24 -0
  438. package/dist/session/model/paths.d.ts.map +1 -0
  439. package/dist/session/model/safe-next.d.ts +15 -0
  440. package/dist/session/model/safe-next.d.ts.map +1 -0
  441. package/dist/session/model/second-factor.d.ts +16 -0
  442. package/dist/session/model/second-factor.d.ts.map +1 -0
  443. package/dist/session/model/site-path.d.ts +10 -0
  444. package/dist/session/model/site-path.d.ts.map +1 -0
  445. package/dist/session/model/step-up-answers.d.ts +45 -0
  446. package/dist/session/model/step-up-answers.d.ts.map +1 -0
  447. package/dist/session/model/step-up-props.d.ts +22 -0
  448. package/dist/session/model/step-up-props.d.ts.map +1 -0
  449. package/dist/session/model/step-up.d.ts +48 -0
  450. package/dist/session/model/step-up.d.ts.map +1 -0
  451. package/dist/session/react/index.d.ts +13 -0
  452. package/dist/session/react/index.d.ts.map +1 -0
  453. package/dist/session/react/index.js +196 -0
  454. package/dist/session/react/index.js.map +14 -0
  455. package/dist/session/react/step-up/answers.d.ts +9 -0
  456. package/dist/session/react/step-up/answers.d.ts.map +1 -0
  457. package/dist/session/react/step-up/dialog-props.d.ts +27 -0
  458. package/dist/session/react/step-up/dialog-props.d.ts.map +1 -0
  459. package/dist/session/react/step-up/index.d.ts +7 -0
  460. package/dist/session/react/step-up/index.d.ts.map +1 -0
  461. package/dist/session/react/step-up/pending-runs.d.ts +21 -0
  462. package/dist/session/react/step-up/pending-runs.d.ts.map +1 -0
  463. package/dist/session/react/step-up/phase.d.ts +8 -0
  464. package/dist/session/react/step-up/phase.d.ts.map +1 -0
  465. package/dist/session/react/step-up/use-step-up-replay.d.ts +59 -0
  466. package/dist/session/react/step-up/use-step-up-replay.d.ts.map +1 -0
  467. package/dist/session/react/step-up/use-step-up-runner.d.ts +70 -0
  468. package/dist/session/react/step-up/use-step-up-runner.d.ts.map +1 -0
  469. package/dist/session/react/step-up/use-step-up.d.ts +51 -0
  470. package/dist/session/react/step-up/use-step-up.d.ts.map +1 -0
  471. package/dist/session/react/use-code-field.d.ts +37 -0
  472. package/dist/session/react/use-code-field.d.ts.map +1 -0
  473. package/dist/session/react/use-link-fragment.d.ts +22 -0
  474. package/dist/session/react/use-link-fragment.d.ts.map +1 -0
  475. package/dist/session/react/use-link-param.d.ts +26 -0
  476. package/dist/session/react/use-link-param.d.ts.map +1 -0
  477. package/dist/session/react/use-link-post.d.ts +39 -0
  478. package/dist/session/react/use-link-post.d.ts.map +1 -0
  479. package/dist/session/react/use-sign-out.d.ts +46 -0
  480. package/dist/session/react/use-sign-out.d.ts.map +1 -0
  481. package/dist/session/second-factor.d.ts +22 -0
  482. package/dist/session/second-factor.d.ts.map +1 -0
  483. package/dist/session/serialize.d.ts +42 -0
  484. package/dist/session/serialize.d.ts.map +1 -0
  485. package/dist/session/sign-in.d.ts +19 -0
  486. package/dist/session/sign-in.d.ts.map +1 -0
  487. package/dist/session/signed.d.ts +44 -0
  488. package/dist/session/signed.d.ts.map +1 -0
  489. package/dist/session/social-flow.d.ts +22 -0
  490. package/dist/session/social-flow.d.ts.map +1 -0
  491. package/dist/session/social-land.d.ts +31 -0
  492. package/dist/session/social-land.d.ts.map +1 -0
  493. package/dist/session/social-types.d.ts +136 -0
  494. package/dist/session/social-types.d.ts.map +1 -0
  495. package/dist/session/social.d.ts +32 -0
  496. package/dist/session/social.d.ts.map +1 -0
  497. package/dist/session/step-up-codes.d.ts +9 -0
  498. package/dist/session/step-up-codes.d.ts.map +1 -0
  499. package/dist/session/step-up-signed-out.d.ts +21 -0
  500. package/dist/session/step-up-signed-out.d.ts.map +1 -0
  501. package/dist/session/step-up-types.d.ts +127 -0
  502. package/dist/session/step-up-types.d.ts.map +1 -0
  503. package/dist/session/step-up.d.ts +17 -0
  504. package/dist/session/step-up.d.ts.map +1 -0
  505. package/dist/session/step.d.ts +22 -0
  506. package/dist/session/step.d.ts.map +1 -0
  507. package/dist/session/throttle.d.ts +73 -0
  508. package/dist/session/throttle.d.ts.map +1 -0
  509. package/dist/session/timed-wait.d.ts +4 -0
  510. package/dist/session/timed-wait.d.ts.map +1 -0
  511. package/dist/session/viewer.d.ts +34 -0
  512. package/dist/session/viewer.d.ts.map +1 -0
  513. package/dist/subscription/documents.d.ts +3 -0
  514. package/dist/subscription/documents.d.ts.map +1 -0
  515. package/dist/subscription/index.d.ts +7 -0
  516. package/dist/subscription/index.d.ts.map +1 -0
  517. package/dist/subscription/index.js +359 -0
  518. package/dist/subscription/index.js.map +14 -0
  519. package/dist/subscription/proxy.d.ts +54 -0
  520. package/dist/subscription/proxy.d.ts.map +1 -0
  521. package/dist/subscription/react/backoff.d.ts +8 -0
  522. package/dist/subscription/react/backoff.d.ts.map +1 -0
  523. package/dist/subscription/react/classify.d.ts +15 -0
  524. package/dist/subscription/react/classify.d.ts.map +1 -0
  525. package/dist/subscription/react/controller.d.ts +40 -0
  526. package/dist/subscription/react/controller.d.ts.map +1 -0
  527. package/dist/subscription/react/fake-timers.d.ts +8 -0
  528. package/dist/subscription/react/fake-timers.d.ts.map +1 -0
  529. package/dist/subscription/react/index.d.ts +15 -0
  530. package/dist/subscription/react/index.d.ts.map +1 -0
  531. package/dist/subscription/react/index.js +227 -0
  532. package/dist/subscription/react/index.js.map +17 -0
  533. package/dist/subscription/react/reconnect.d.ts +9 -0
  534. package/dist/subscription/react/reconnect.d.ts.map +1 -0
  535. package/dist/subscription/react/scheduler.d.ts +13 -0
  536. package/dist/subscription/react/scheduler.d.ts.map +1 -0
  537. package/dist/subscription/react/timers.d.ts +7 -0
  538. package/dist/subscription/react/timers.d.ts.map +1 -0
  539. package/dist/subscription/react/use-live-subscription.d.ts +36 -0
  540. package/dist/subscription/react/use-live-subscription.d.ts.map +1 -0
  541. package/dist/subscription/react/versions.d.ts +6 -0
  542. package/dist/subscription/react/versions.d.ts.map +1 -0
  543. package/dist/subscription/read.d.ts +17 -0
  544. package/dist/subscription/read.d.ts.map +1 -0
  545. package/dist/subscription/refusal.d.ts +11 -0
  546. package/dist/subscription/refusal.d.ts.map +1 -0
  547. package/dist/subscription/relay.d.ts +16 -0
  548. package/dist/subscription/relay.d.ts.map +1 -0
  549. package/dist/vite/bun.d.ts +21 -0
  550. package/dist/vite/bun.d.ts.map +1 -0
  551. package/dist/vite/bundle.d.ts +33 -0
  552. package/dist/vite/bundle.d.ts.map +1 -0
  553. package/dist/vite/compress.d.ts +18 -0
  554. package/dist/vite/compress.d.ts.map +1 -0
  555. package/dist/vite/config.d.ts +33 -0
  556. package/dist/vite/config.d.ts.map +1 -0
  557. package/dist/vite/dev.d.ts +28 -0
  558. package/dist/vite/dev.d.ts.map +1 -0
  559. package/dist/vite/entry.d.ts +20 -0
  560. package/dist/vite/entry.d.ts.map +1 -0
  561. package/dist/vite/hosts.d.ts +16 -0
  562. package/dist/vite/hosts.d.ts.map +1 -0
  563. package/dist/vite/index.d.ts +68 -0
  564. package/dist/vite/index.d.ts.map +1 -0
  565. package/dist/vite/index.js +635 -0
  566. package/dist/vite/index.js.map +22 -0
  567. package/dist/vite/inline.d.ts +18 -0
  568. package/dist/vite/inline.d.ts.map +1 -0
  569. package/dist/vite/node.d.ts +16 -0
  570. package/dist/vite/node.d.ts.map +1 -0
  571. package/dist/vite/preview.d.ts +8 -0
  572. package/dist/vite/preview.d.ts.map +1 -0
  573. package/dist/vite/runtime.d.ts +8 -0
  574. package/dist/vite/runtime.d.ts.map +1 -0
  575. package/dist/vite/socket.d.ts +75 -0
  576. package/dist/vite/socket.d.ts.map +1 -0
  577. package/dist/vite/worker.d.ts +16 -0
  578. package/dist/vite/worker.d.ts.map +1 -0
  579. package/dist/with-alxia.d.ts +36 -0
  580. package/dist/with-alxia.d.ts.map +1 -0
  581. package/docs/README.md +42 -0
  582. package/docs/guide/api-keys.md +216 -0
  583. package/docs/guide/beside-the-pages.md +201 -0
  584. package/docs/guide/csp-nonce.md +166 -0
  585. package/docs/guide/customising-the-server.md +324 -0
  586. package/docs/guide/deploying.md +102 -0
  587. package/docs/guide/document.md +334 -0
  588. package/docs/guide/errors.md +1147 -0
  589. package/docs/guide/fetcher.md +355 -0
  590. package/docs/guide/getting-started.md +112 -0
  591. package/docs/guide/help.md +325 -0
  592. package/docs/guide/how-it-works.md +274 -0
  593. package/docs/guide/link.md +32 -0
  594. package/docs/guide/lists.md +225 -0
  595. package/docs/guide/mcp.md +173 -0
  596. package/docs/guide/media.md +273 -0
  597. package/docs/guide/navigation.md +52 -0
  598. package/docs/guide/oauth.md +342 -0
  599. package/docs/guide/oidc.md +262 -0
  600. package/docs/guide/openapi.md +51 -0
  601. package/docs/guide/pwa.md +670 -0
  602. package/docs/guide/session.md +2105 -0
  603. package/docs/guide/subscriptions.md +211 -0
  604. package/docs/guide/testing.md +42 -0
  605. package/docs/guide/typing-the-loaders.md +311 -0
  606. package/docs/guide.md +82 -0
  607. package/docs/roadmap.md +474 -0
  608. package/docs/troubleshooting.md +3837 -0
  609. package/package.json +301 -5
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `@softistx/alxia-react-router/document`: what a root route renders for the page's
3
+ * CSP nonce, on the server and in the browser. `react` is its only import
4
+ * (an optional peer of the package), and nothing runs at the top level but
5
+ * `createContext`.
6
+ */
7
+ export { CspNonceMeta, InlineScript, type InlineScriptProps, } from './inline-script';
8
+ export { DocumentNonce, type DocumentNonceProps, useNonce, } from './nonce';
9
+ export { createPageLanguage, type PageLanguage, type PageLanguageOptions, } from './page-language';
10
+ export { textDirection } from './text-direction';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,KAAK,iBAAiB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,aAAa,EACb,KAAK,kBAAkB,EACvB,QAAQ,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import {
2
+ DocumentNonce2,
3
+ useNonce2,
4
+ InlineScript2,
5
+ CspNonceMeta2,
6
+ createPageLanguage2,
7
+ textDirection2
8
+ } from "../chunks/index-c55hxgr5.js";
9
+ export {
10
+ CspNonceMeta2 as CspNonceMeta,
11
+ DocumentNonce2 as DocumentNonce,
12
+ InlineScript2 as InlineScript,
13
+ createPageLanguage2 as createPageLanguage,
14
+ textDirection2 as textDirection,
15
+ useNonce2 as useNonce
16
+ };
17
+
18
+ //# debugId=3F5BF8C287845B0F64756E2164756E21
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "3F5BF8C287845B0F64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,27 @@
1
+ import { type ReactElement } from 'react';
2
+ export interface InlineScriptProps {
3
+ /**
4
+ * The script's text, rendered as it is: never escaped, so a `</script`
5
+ * or a `<!--` in it is refused (see `InlineScript`).
6
+ */
7
+ code: string;
8
+ /** The script's nonce; `useNonce()`'s by default. */
9
+ nonce?: string | undefined;
10
+ }
11
+ /**
12
+ * An inline `<script>` carrying the page's CSP nonce, on the server and in
13
+ * the browser, so hydration finds the attribute it rendered. The code is a
14
+ * constant of the app (a theme's boot script): never put user input in it.
15
+ * With no nonce anywhere, it renders no `nonce` attribute, and the policy
16
+ * must then allow inline scripts some other way.
17
+ *
18
+ * Throws a `TypeError` when the code holds `</script` or `<!--`, which end or
19
+ * confuse the element whatever the nonce: escape them in a string (`<\/script`).
20
+ */
21
+ export declare function InlineScript({ code, nonce }: InlineScriptProps): ReactElement;
22
+ /**
23
+ * `<meta property="csp-nonce" nonce="…">`: the page's nonce for the scripts
24
+ * and styles a library adds at runtime (a UI kit reads it from the DOM).
25
+ */
26
+ export declare function CspNonceMeta(): ReactElement;
27
+ //# sourceMappingURL=inline-script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-script.d.ts","sourceRoot":"","sources":["../../src/document/inline-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAKzD,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAW7E;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,YAAY,CAK3C"}
@@ -0,0 +1,8 @@
1
+ /** The picked language and who listens to it: internal to `createPageLanguage`. */
2
+ export interface LanguageStore<L extends string> {
3
+ subscribe(listener: () => void): () => void;
4
+ getSnapshot(): L | undefined;
5
+ choose(language: L): void;
6
+ }
7
+ export declare function createLanguageStore<L extends string>(): LanguageStore<L>;
8
+ //# sourceMappingURL=language-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-store.d.ts","sourceRoot":"","sources":["../../src/document/language-store.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM;IAC9C,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,WAAW,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,CAgBxE"}
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface DocumentNonceProps {
3
+ /** This response's CSP nonce: `nonceOf(loadContext)` in the entry. */
4
+ nonce: string | undefined;
5
+ children?: ReactNode | undefined;
6
+ }
7
+ /**
8
+ * Gives the server render this response's CSP nonce, for `useNonce()` and
9
+ * the components built on it. The entry wraps the router in it, so every
10
+ * boundary reads the nonce, an error page after an action included (it
11
+ * runs no loader). Never put the nonce in loader data: the browser hides
12
+ * it from the page, and loader data would print it in the hydration script
13
+ * and every `.data` answer.
14
+ */
15
+ export declare function DocumentNonce({ nonce, children, }: DocumentNonceProps): ReactNode;
16
+ /**
17
+ * The page's CSP nonce, for what the root renders: an inline script, and
18
+ * React Router's `<Links>`, `<Scripts>` and `<ScrollRestoration>`. On the
19
+ * server, the one `DocumentNonce` provides. In the browser, the one the
20
+ * document carries: React Router's client knows no nonce, and React would
21
+ * find `nonce` on the server's elements and none in its own (a hydration
22
+ * mismatch). It is read from the DOM property of the first script or
23
+ * `csp-nonce` meta in the `<head>` (the browser hides the attribute, not
24
+ * the property), else of the first `script[nonce]` anywhere, once for the
25
+ * document. That first read is cached per module copy, so a test with a
26
+ * DOM keeps it across tests: reset modules, or render the server path with
27
+ * `DocumentNonce`.
28
+ *
29
+ * "In the browser" means a global `document`. A server that installs a DOM
30
+ * shim on `globalThis` takes the browser path and finds no nonce: it must not
31
+ * render this hook that way.
32
+ */
33
+ export declare function useNonce(): string | undefined;
34
+ //# sourceMappingURL=nonce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../../src/document/nonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,SAAS,EAEd,MAAM,OAAO,CAAC;AAiBf,MAAM,WAAW,kBAAkB;IAClC,sEAAsE;IACtE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC7B,KAAK,EACL,QAAQ,GACR,EAAE,kBAAkB,GAAG,SAAS,CAEhC;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,SAAS,CAS7C"}
@@ -0,0 +1,39 @@
1
+ export interface PageLanguageOptions<L extends string> {
2
+ /** The languages the app serves. */
3
+ readonly languages: readonly L[];
4
+ /** The language of a page whose root data gives none; one of `languages`. */
5
+ readonly fallback: NoInfer<L>;
6
+ /**
7
+ * Whether this is a browser. Default: `typeof document !== 'undefined'`,
8
+ * a global `document`: a server with a DOM shim on `globalThis` must pass
9
+ * `() => false`, or the instance remembers a language across requests.
10
+ */
11
+ readonly browser?: (() => boolean) | undefined;
12
+ }
13
+ export interface PageLanguage<L extends string> {
14
+ /**
15
+ * The page's language from the root loader's `language`. In the browser,
16
+ * the one picked with `chooseLanguage` wins, and the last one seen stands
17
+ * in when the root's data is gone (a failed navigation takes the root's
18
+ * with it): the error page keeps the page's language, not the fallback's.
19
+ * On the server it remembers nothing, since one module serves every request.
20
+ */
21
+ pageLanguage(language: string | undefined): L;
22
+ /** The page's language in a route's `meta`, from `matches[0].loaderData.language`. */
23
+ metaLanguage(matches: ReadonlyArray<unknown>): L;
24
+ /**
25
+ * Records the language picked in a language menu: from then on the page's
26
+ * language in the browser, until the next document. Re-renders every
27
+ * `useChosenLanguage()`.
28
+ */
29
+ chooseLanguage(language: L): void;
30
+ /** The language picked in this document, if any; re-renders on a new pick. */
31
+ useChosenLanguage(): L | undefined;
32
+ }
33
+ /**
34
+ * The page's language for a root route: `<html lang>`, a route's `meta`, and
35
+ * the language menu. An instance, not module state: keep one per app, in a
36
+ * module both the root and the routes import.
37
+ */
38
+ export declare function createPageLanguage<const L extends string>(options: PageLanguageOptions<L>): PageLanguage<L>;
39
+ //# sourceMappingURL=page-language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-language.d.ts","sourceRoot":"","sources":["../../src/document/page-language.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACpD,oCAAoC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM;IAC7C;;;;;;OAMG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,CAAC;IAC9C,sFAAsF;IACtF,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjD;;;;OAIG;IACH,cAAc,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,8EAA8E;IAC9E,iBAAiB,IAAI,CAAC,GAAG,SAAS,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACxD,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC7B,YAAY,CAAC,CAAC,CAAC,CAmCjB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The `dir` of a language tag: `'rtl'` for a right-to-left base language,
3
+ * `'ltr'` for the rest. The base tag is read whatever its case, so `ar-EG`
4
+ * and `AR` are `'rtl'` and `en-US` is `'ltr'`.
5
+ *
6
+ * Known gap: a script subtag is not read, so `az-Arab` (Azerbaijani in the
7
+ * Arabic script) is `'ltr'`, as `az` is.
8
+ */
9
+ export declare function textDirection(language: string): 'ltr' | 'rtl';
10
+ //# sourceMappingURL=text-direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-direction.d.ts","sourceRoot":"","sources":["../../src/document/text-direction.ts"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAG7D"}
@@ -0,0 +1,21 @@
1
+ /** The render's abort timer: one per response, cleared when the response is over. */
2
+ export interface Deadline {
3
+ readonly signal: AbortSignal;
4
+ /** Stops the timer. Calling it again does nothing. */
5
+ readonly clear: () => void;
6
+ }
7
+ /** A signal aborted after `ms`, with the means to stop the timer. */
8
+ export declare function deadline(ms: number): Deadline;
9
+ /**
10
+ * The same bytes in a new stream that calls `done` when the body ends,
11
+ * fails or is cancelled (the client went away), so no timer outlives the
12
+ * response. React's `allReady` is not carried over: await it first.
13
+ */
14
+ export declare function untilDone(body: ReadableStream<Uint8Array>, done: () => void): ReadableStream<Uint8Array>;
15
+ /**
16
+ * Gives up on a render that will not be served: stops its timer and cancels
17
+ * the body, which aborts React's work. A cancel that itself fails is ignored,
18
+ * so the error that got us here is the one the caller rethrows.
19
+ */
20
+ export declare function abandon(limit: Pick<Deadline, 'clear'>, body: Pick<ReadableStream, 'cancel'> | undefined): Promise<void>;
21
+ //# sourceMappingURL=abort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../src/entry/abort.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAI7C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,IAAI,EAAE,MAAM,IAAI,GACd,cAAc,CAAC,UAAU,CAAC,CAsB5B;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAC5B,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC9B,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,GAAG,SAAS,GAC9C,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -0,0 +1,41 @@
1
+ import { type EntryContext, type RouterContextProvider } from 'react-router';
2
+ export interface EntryOptions {
3
+ /**
4
+ * Milliseconds React Router waits for a pending promise; the render itself
5
+ * is aborted 1 000 ms later. Export it as `streamTimeout`. Default 5 000.
6
+ */
7
+ readonly streamTimeout?: number | undefined;
8
+ /** This response's CSP nonce. Default `nonceOf(loadContext)`. */
9
+ readonly nonce?: ((loadContext: RouterContextProvider, request: Request) => string | undefined) | undefined;
10
+ /** Whether a user agent is a bot, which gets the whole page. Default `isbot`, which is then needed. */
11
+ readonly isBot?: ((userAgent: string) => boolean) | undefined;
12
+ /**
13
+ * The data to give the root route when its loader did not run, because a
14
+ * middleware threw and React Router went straight to the root's error
15
+ * boundary. Return what the root's loader returns, or `undefined` for
16
+ * none. Default: `{ language }` from alxia's context, when a middleware
17
+ * such as `@softistx/alxia-language` set one, so that an error page is written in
18
+ * the request's language. Never replaces the data of a root loader that ran.
19
+ */
20
+ readonly rootData?: ((loadContext: RouterContextProvider, request: Request) => Record<string, unknown> | undefined) | undefined;
21
+ /** An error after the shell is out. Default `console.error`. */
22
+ readonly onError?: ((error: unknown) => void) | undefined;
23
+ }
24
+ /** React Router's `handleRequest` export of `entry.server`. */
25
+ export type HandleRequest = (request: Request, responseStatusCode: number, responseHeaders: Headers, routerContext: EntryContext, loadContext: RouterContextProvider) => Promise<Response>;
26
+ /** What `createEntry` returns: the two exports of `entry.server`. */
27
+ export interface Entry {
28
+ readonly handleRequest: HandleRequest;
29
+ readonly streamTimeout: number;
30
+ }
31
+ export declare const streamTimeout: number;
32
+ /**
33
+ * `entry.server`'s `handleRequest` and `streamTimeout`, on the web stream
34
+ * renderer. Streams the shell, waits for the whole page for a bot and in
35
+ * SPA mode, answers HEAD with no body, stops rendering when the client goes
36
+ * away, and gives the router the response's CSP nonce.
37
+ */
38
+ export declare function createEntry(options?: EntryOptions): Entry;
39
+ /** The default entry: `export { handleRequest as default, streamTimeout } from '@softistx/alxia-react-router/entry'`. */
40
+ export declare const handleRequest: HandleRequest;
41
+ //# sourceMappingURL=create-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-entry.d.ts","sourceRoot":"","sources":["../../src/entry/create-entry.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAE1B,MAAM,cAAc,CAAC;AAOtB,MAAM,WAAW,YAAY;IAC5B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EACZ,CAAC,CACD,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,OAAO,KACX,MAAM,GAAG,SAAS,CAAC,GACxB,SAAS,CAAC;IACb,uGAAuG;IACvG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9D;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EACf,CAAC,CACD,WAAW,EAAE,qBAAqB,EAClC,OAAO,EAAE,OAAO,KACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,GACzC,SAAS,CAAC;IACb,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC1D;AAED,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,CAC3B,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,OAAO,EACxB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,qBAAqB,KAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,qEAAqE;AACrE,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,aAAa,EAAE,MAAc,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,KAAK,CAsE7D;AAID,yHAAyH;AACzH,eAAO,MAAM,aAAa,EAAE,aAAsC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `@softistx/alxia-react-router/entry`: `entry.server.tsx` for a React Router app on
3
+ * Bun. Server only. It imports `react`, `react-dom/server`, `react-router`
4
+ * and, only when no `isBot` option is given, `isbot`: all optional peers but
5
+ * `react-router`.
6
+ */
7
+ export { createEntry, type Entry, type EntryOptions, type HandleRequest, handleRequest, streamTimeout, } from './create-entry';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entry/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,WAAW,EACX,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,154 @@
1
+ import {
2
+ DocumentNonce2
3
+ } from "../chunks/index-c55hxgr5.js";
4
+ import {
5
+ alxiaContext2,
6
+ nonceOf2
7
+ } from "../chunks/index-gac44rs5.js";
8
+
9
+ // src/entry/create-entry.ts
10
+ import { createElement } from "react";
11
+ import {
12
+ renderToReadableStream
13
+ } from "react-dom/server";
14
+ import {
15
+ ServerRouter
16
+ } from "react-router";
17
+
18
+ // src/entry/abort.ts
19
+ function deadline(ms) {
20
+ const controller = new AbortController;
21
+ const timer = setTimeout(() => controller.abort(), ms);
22
+ return { signal: controller.signal, clear: () => clearTimeout(timer) };
23
+ }
24
+ function untilDone(body, done) {
25
+ const reader = body.getReader();
26
+ return new ReadableStream({
27
+ async pull(controller) {
28
+ try {
29
+ const chunk = await reader.read();
30
+ if (chunk.done) {
31
+ done();
32
+ controller.close();
33
+ } else {
34
+ controller.enqueue(chunk.value);
35
+ }
36
+ } catch (error) {
37
+ done();
38
+ controller.error(error);
39
+ }
40
+ },
41
+ async cancel(reason) {
42
+ done();
43
+ await reader.cancel(reason);
44
+ }
45
+ });
46
+ }
47
+ async function abandon(limit, body) {
48
+ limit.clear();
49
+ await body?.cancel().catch(() => {});
50
+ }
51
+
52
+ // src/entry/root-data.ts
53
+ function hasRootData(routerContext) {
54
+ return ROOT in (routerContext.staticHandlerContext.loaderData ?? {});
55
+ }
56
+ var ROOT = "root";
57
+ function languageData(context) {
58
+ const value = context.get(alxiaContext2);
59
+ if (typeof value !== "object" || value === null || !("language" in value)) {
60
+ return;
61
+ }
62
+ return typeof value.language === "string" ? { language: value.language } : undefined;
63
+ }
64
+ function fillRootData(routerContext, data) {
65
+ if (!data)
66
+ return;
67
+ const holder = routerContext.staticHandlerContext;
68
+ const loaderData = holder.loaderData ?? {};
69
+ holder.loaderData = loaderData;
70
+ if (!(ROOT in loaderData))
71
+ loaderData[ROOT] = data;
72
+ }
73
+
74
+ // src/entry/whole-page.ts
75
+ var loaded;
76
+ function defaultIsBot() {
77
+ loaded ??= import("isbot").then((module) => module.isbot, (error) => {
78
+ loaded = undefined;
79
+ throw error;
80
+ });
81
+ return loaded;
82
+ }
83
+ async function wantsWholePage(request, isSpaMode, isBot) {
84
+ if (isSpaMode)
85
+ return true;
86
+ const agent = request.headers.get("user-agent");
87
+ if (agent === null)
88
+ return false;
89
+ return (isBot ?? await defaultIsBot())(agent);
90
+ }
91
+
92
+ // src/entry/create-entry.ts
93
+ var streamTimeout = 5000;
94
+ function createEntry(options = {}) {
95
+ const timeout = options.streamTimeout ?? streamTimeout;
96
+ const nonceFor = options.nonce ?? nonceOf2;
97
+ const report = options.onError ?? console.error;
98
+ const handleRequest = async (request, responseStatusCode, responseHeaders, routerContext, loadContext) => {
99
+ responseHeaders.set("Content-Type", "text/html");
100
+ if (request.method === "HEAD") {
101
+ return new Response(null, {
102
+ status: responseStatusCode,
103
+ headers: responseHeaders
104
+ });
105
+ }
106
+ if (!hasRootData(routerContext)) {
107
+ fillRootData(routerContext, (options.rootData ?? languageData)(loadContext, request));
108
+ }
109
+ const nonce = nonceFor(loadContext, request);
110
+ const limit = deadline(timeout + 1000);
111
+ let status = responseStatusCode;
112
+ let shellOut = false;
113
+ let body;
114
+ try {
115
+ body = await renderToReadableStream(createElement(DocumentNonce2, { nonce }, createElement(ServerRouter, {
116
+ context: routerContext,
117
+ url: request.url,
118
+ ...nonce === undefined ? {} : { nonce }
119
+ })), {
120
+ nonce,
121
+ signal: AbortSignal.any([limit.signal, request.signal]),
122
+ onError(error) {
123
+ if (request.signal.aborted)
124
+ return;
125
+ status = 500;
126
+ if (shellOut)
127
+ report(error);
128
+ }
129
+ });
130
+ shellOut = true;
131
+ if (await wantsWholePage(request, routerContext.isSpaMode, options.isBot)) {
132
+ await body.allReady;
133
+ }
134
+ return new Response(untilDone(body, limit.clear), {
135
+ status,
136
+ headers: responseHeaders
137
+ });
138
+ } catch (error) {
139
+ await abandon(limit, body);
140
+ throw error;
141
+ }
142
+ };
143
+ return { handleRequest, streamTimeout: timeout };
144
+ }
145
+ var defaults = createEntry();
146
+ var handleRequest = defaults.handleRequest;
147
+ export {
148
+ createEntry,
149
+ handleRequest,
150
+ streamTimeout
151
+ };
152
+
153
+ //# debugId=FF51119AD7D6DEC964756E2164756E21
154
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/entry/create-entry.ts", "../src/entry/abort.ts", "../src/entry/root-data.ts", "../src/entry/whole-page.ts"],
4
+ "sourcesContent": [
5
+ "import { createElement } from 'react';\nimport {\n\ttype ReactDOMServerReadableStream,\n\trenderToReadableStream,\n} from 'react-dom/server';\nimport {\n\ttype EntryContext,\n\ttype RouterContextProvider,\n\tServerRouter,\n} from 'react-router';\nimport { DocumentNonce } from '../document';\nimport { nonceOf } from '../nonce';\nimport { abandon, deadline, untilDone } from './abort';\nimport { fillRootData, hasRootData, languageData } from './root-data';\nimport { wantsWholePage } from './whole-page';\n\nexport interface EntryOptions {\n\t/**\n\t * Milliseconds React Router waits for a pending promise; the render itself\n\t * is aborted 1 000 ms later. Export it as `streamTimeout`. Default 5 000.\n\t */\n\treadonly streamTimeout?: number | undefined;\n\t/** This response's CSP nonce. Default `nonceOf(loadContext)`. */\n\treadonly nonce?:\n\t\t| ((\n\t\t\t\tloadContext: RouterContextProvider,\n\t\t\t\trequest: Request,\n\t\t ) => string | undefined)\n\t\t| undefined;\n\t/** Whether a user agent is a bot, which gets the whole page. Default `isbot`, which is then needed. */\n\treadonly isBot?: ((userAgent: string) => boolean) | undefined;\n\t/**\n\t * The data to give the root route when its loader did not run, because a\n\t * middleware threw and React Router went straight to the root's error\n\t * boundary. Return what the root's loader returns, or `undefined` for\n\t * none. Default: `{ language }` from alxia's context, when a middleware\n\t * such as `@softistx/alxia-language` set one, so that an error page is written in\n\t * the request's language. Never replaces the data of a root loader that ran.\n\t */\n\treadonly rootData?:\n\t\t| ((\n\t\t\t\tloadContext: RouterContextProvider,\n\t\t\t\trequest: Request,\n\t\t ) => Record<string, unknown> | undefined)\n\t\t| undefined;\n\t/** An error after the shell is out. Default `console.error`. */\n\treadonly onError?: ((error: unknown) => void) | undefined;\n}\n\n/** React Router's `handleRequest` export of `entry.server`. */\nexport type HandleRequest = (\n\trequest: Request,\n\tresponseStatusCode: number,\n\tresponseHeaders: Headers,\n\trouterContext: EntryContext,\n\tloadContext: RouterContextProvider,\n) => Promise<Response>;\n\n/** What `createEntry` returns: the two exports of `entry.server`. */\nexport interface Entry {\n\treadonly handleRequest: HandleRequest;\n\treadonly streamTimeout: number;\n}\n\nexport const streamTimeout: number = 5_000;\n\n/**\n * `entry.server`'s `handleRequest` and `streamTimeout`, on the web stream\n * renderer. Streams the shell, waits for the whole page for a bot and in\n * SPA mode, answers HEAD with no body, stops rendering when the client goes\n * away, and gives the router the response's CSP nonce.\n */\nexport function createEntry(options: EntryOptions = {}): Entry {\n\tconst timeout = options.streamTimeout ?? streamTimeout;\n\tconst nonceFor = options.nonce ?? nonceOf;\n\tconst report = options.onError ?? console.error;\n\n\tconst handleRequest: HandleRequest = async (\n\t\trequest,\n\t\tresponseStatusCode,\n\t\tresponseHeaders,\n\t\trouterContext,\n\t\tloadContext,\n\t) => {\n\t\tresponseHeaders.set('Content-Type', 'text/html');\n\t\tif (request.method === 'HEAD') {\n\t\t\treturn new Response(null, {\n\t\t\t\tstatus: responseStatusCode,\n\t\t\t\theaders: responseHeaders,\n\t\t\t});\n\t\t}\n\t\tif (!hasRootData(routerContext)) {\n\t\t\tfillRootData(\n\t\t\t\trouterContext,\n\t\t\t\t(options.rootData ?? languageData)(loadContext, request),\n\t\t\t);\n\t\t}\n\t\tconst nonce = nonceFor(loadContext, request);\n\t\tconst limit = deadline(timeout + 1_000);\n\t\tlet status = responseStatusCode;\n\t\tlet shellOut = false;\n\t\tlet body: ReactDOMServerReadableStream | undefined;\n\t\ttry {\n\t\t\tbody = await renderToReadableStream(\n\t\t\t\tcreateElement(\n\t\t\t\t\tDocumentNonce,\n\t\t\t\t\t{ nonce },\n\t\t\t\t\tcreateElement(ServerRouter, {\n\t\t\t\t\t\tcontext: routerContext,\n\t\t\t\t\t\turl: request.url,\n\t\t\t\t\t\t// Under exactOptionalPropertyTypes, ServerRouter's nonce takes no undefined.\n\t\t\t\t\t\t...(nonce === undefined ? {} : { nonce }),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tnonce,\n\t\t\t\t\tsignal: AbortSignal.any([limit.signal, request.signal]),\n\t\t\t\t\tonError(error: unknown) {\n\t\t\t\t\t\t// A client that left is not an error of ours.\n\t\t\t\t\t\tif (request.signal.aborted) return;\n\t\t\t\t\t\tstatus = 500;\n\t\t\t\t\t\tif (shellOut) report(error);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t\tshellOut = true;\n\t\t\tif (\n\t\t\t\tawait wantsWholePage(request, routerContext.isSpaMode, options.isBot)\n\t\t\t) {\n\t\t\t\tawait body.allReady;\n\t\t\t}\n\t\t\treturn new Response(untilDone(body, limit.clear), {\n\t\t\t\tstatus,\n\t\t\t\theaders: responseHeaders,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\t// A throwing isBot or a rejected allReady: stop the render.\n\t\t\tawait abandon(limit, body);\n\t\t\tthrow error;\n\t\t}\n\t};\n\treturn { handleRequest, streamTimeout: timeout };\n}\n\nconst defaults = createEntry();\n\n/** The default entry: `export { handleRequest as default, streamTimeout } from '@softistx/alxia-react-router/entry'`. */\nexport const handleRequest: HandleRequest = defaults.handleRequest;\n",
6
+ "/** The render's abort timer: one per response, cleared when the response is over. */\nexport interface Deadline {\n\treadonly signal: AbortSignal;\n\t/** Stops the timer. Calling it again does nothing. */\n\treadonly clear: () => void;\n}\n\n/** A signal aborted after `ms`, with the means to stop the timer. */\nexport function deadline(ms: number): Deadline {\n\tconst controller = new AbortController();\n\tconst timer = setTimeout(() => controller.abort(), ms);\n\treturn { signal: controller.signal, clear: () => clearTimeout(timer) };\n}\n\n/**\n * The same bytes in a new stream that calls `done` when the body ends,\n * fails or is cancelled (the client went away), so no timer outlives the\n * response. React's `allReady` is not carried over: await it first.\n */\nexport function untilDone(\n\tbody: ReadableStream<Uint8Array>,\n\tdone: () => void,\n): ReadableStream<Uint8Array> {\n\tconst reader = body.getReader();\n\treturn new ReadableStream<Uint8Array>({\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst chunk = await reader.read();\n\t\t\t\tif (chunk.done) {\n\t\t\t\t\tdone();\n\t\t\t\t\tcontroller.close();\n\t\t\t\t} else {\n\t\t\t\t\tcontroller.enqueue(chunk.value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tdone();\n\t\t\t\tcontroller.error(error);\n\t\t\t}\n\t\t},\n\t\tasync cancel(reason) {\n\t\t\tdone();\n\t\t\tawait reader.cancel(reason);\n\t\t},\n\t});\n}\n\n/**\n * Gives up on a render that will not be served: stops its timer and cancels\n * the body, which aborts React's work. A cancel that itself fails is ignored,\n * so the error that got us here is the one the caller rethrows.\n */\nexport async function abandon(\n\tlimit: Pick<Deadline, 'clear'>,\n\tbody: Pick<ReadableStream, 'cancel'> | undefined,\n): Promise<void> {\n\tlimit.clear();\n\tawait body?.cancel().catch(() => {});\n}\n",
7
+ "import type { EntryContext } from 'react-router';\nimport { alxiaContext, type ProviderLike } from '../context';\n\n/** What the entry reads of a router context: `staticHandlerContext.loaderData`, as in React Router 8.x (checked on 8.5). */\ntype Holder = Pick<EntryContext['staticHandlerContext'], 'loaderData'>;\n\n/** Whether the root route has data (a loader that ran and returned `null` counts). */\nexport function hasRootData(routerContext: { staticHandlerContext: Holder }) {\n\treturn ROOT in (routerContext.staticHandlerContext.loaderData ?? {});\n}\n\n/** The root route's id in React Router's framework mode. */\nconst ROOT = 'root';\n\n/**\n * The root's loader data when the root's loader did not run: the request's\n * `language`, if a middleware (`@softistx/alxia-language`) put one on alxia's context.\n * `undefined` when none did, or when the request did not come through alxia.\n */\nexport function languageData(\n\tcontext: ProviderLike,\n): Record<string, unknown> | undefined {\n\tconst value = context.get(alxiaContext);\n\tif (typeof value !== 'object' || value === null || !('language' in value)) {\n\t\treturn undefined;\n\t}\n\treturn typeof value.language === 'string'\n\t\t? { language: value.language }\n\t\t: undefined;\n}\n\n/**\n * A middleware that throws (an access gate) makes React Router skip every\n * loader and render the root's error boundary, so the root's loader data is\n * missing. Puts `data` there, in what the server renders from\n * (`staticHandlerContext`), unless the root's loader ran. What the client\n * hydrates from was encoded before the entry ran and stays without it: the\n * root reads the language from `<html lang>` there (`createPageLanguage`).\n */\nexport function fillRootData(\n\trouterContext: { staticHandlerContext: Holder },\n\tdata: Record<string, unknown> | undefined,\n): void {\n\tif (!data) return;\n\tconst holder = routerContext.staticHandlerContext;\n\tconst loaderData = holder.loaderData ?? {};\n\tholder.loaderData = loaderData;\n\tif (!(ROOT in loaderData)) loaderData[ROOT] = data;\n}\n",
8
+ "type IsBot = (userAgent: string) => boolean;\n\nlet loaded: Promise<IsBot> | undefined;\n\n/**\n * `isbot`, imported on the first bot check that needs it and kept: an\n * optional peer, so an app that gives `isBot` never loads it. A failed import\n * is not kept, so a later request tries again.\n */\nfunction defaultIsBot(): Promise<IsBot> {\n\tloaded ??= import('isbot').then(\n\t\t(module) => module.isbot,\n\t\t(error: unknown) => {\n\t\t\tloaded = undefined;\n\t\t\tthrow error;\n\t\t},\n\t);\n\treturn loaded;\n}\n\n/**\n * Whether the response waits for the whole page instead of streaming the\n * shell: a bot (`isBot`, `isbot` by default, imported only then) gets\n * complete HTML to index, and SPA mode renders the one shell the build\n * prerenders.\n */\nexport async function wantsWholePage(\n\trequest: Request,\n\tisSpaMode: boolean,\n\tisBot?: IsBot,\n): Promise<boolean> {\n\tif (isSpaMode) return true;\n\tconst agent = request.headers.get('user-agent');\n\tif (agent === null) return false;\n\treturn (isBot ?? (await defaultIsBot()))(agent);\n}\n"
9
+ ],
10
+ "mappings": ";;;;;;;;;AAAA;AACA;AAAA;AAAA;AAIA;AAAA;AAAA;;;ACGO,SAAS,QAAQ,CAAC,IAAsB;AAAA,EAC9C,MAAM,aAAa,IAAI;AAAA,EACvB,MAAM,QAAQ,WAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AAAA,EACrD,OAAO,EAAE,QAAQ,WAAW,QAAQ,OAAO,MAAM,aAAa,KAAK,EAAE;AAAA;AAQ/D,SAAS,SAAS,CACxB,MACA,MAC6B;AAAA,EAC7B,MAAM,SAAS,KAAK,UAAU;AAAA,EAC9B,OAAO,IAAI,eAA2B;AAAA,UAC/B,IAAI,CAAC,YAAY;AAAA,MACtB,IAAI;AAAA,QACH,MAAM,QAAQ,MAAM,OAAO,KAAK;AAAA,QAChC,IAAI,MAAM,MAAM;AAAA,UACf,KAAK;AAAA,UACL,WAAW,MAAM;AAAA,QAClB,EAAE,KAAK;AAAA,UACN,WAAW,QAAQ,MAAM,KAAK;AAAA;AAAA,QAE9B,OAAO,OAAO;AAAA,QACf,KAAK;AAAA,QACL,WAAW,MAAM,KAAK;AAAA;AAAA;AAAA,UAGlB,MAAM,CAAC,QAAQ;AAAA,MACpB,KAAK;AAAA,MACL,MAAM,OAAO,OAAO,MAAM;AAAA;AAAA,EAE5B,CAAC;AAAA;AAQK,eAAe,OAAO,CAC5B,OACA,MACgB;AAAA,EAChB,MAAM,MAAM;AAAA,EACZ,MAAM,MAAM,OAAO,EAAE,MAAM,MAAM,EAAE;AAAA;;;ACjD7B,SAAS,WAAW,CAAC,eAAiD;AAAA,EAC5E,OAAO,SAAS,cAAc,qBAAqB,cAAc,CAAC;AAAA;AAInE,IAAM,OAAO;AAON,SAAS,YAAY,CAC3B,SACsC;AAAA,EACtC,MAAM,QAAQ,QAAQ,IAAI,aAAY;AAAA,EACtC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,cAAc,QAAQ;AAAA,IAC1E;AAAA,EACD;AAAA,EACA,OAAO,OAAO,MAAM,aAAa,WAC9B,EAAE,UAAU,MAAM,SAAS,IAC3B;AAAA;AAWG,SAAS,YAAY,CAC3B,eACA,MACO;AAAA,EACP,IAAI,CAAC;AAAA,IAAM;AAAA,EACX,MAAM,SAAS,cAAc;AAAA,EAC7B,MAAM,aAAa,OAAO,cAAc,CAAC;AAAA,EACzC,OAAO,aAAa;AAAA,EACpB,IAAI,EAAE,QAAQ;AAAA,IAAa,WAAW,QAAQ;AAAA;;;AC7C/C,IAAI;AAOJ,SAAS,YAAY,GAAmB;AAAA,EACvC,WAAW,gBAAgB,KAC1B,CAAC,WAAkB,cACnB,CAAC,UAAmB;AAAA,IACnB,SAAS;AAAA,IACT,MAAM;AAAA,GAER;AAAA,EACA,OAAO;AAAA;AASD,eAAe,cAAc,CACnC,SACA,WACA,OACmB;AAAA,EACnB,IAAI;AAAA,IAAW,OAAO;AAAA,EACtB,MAAM,QAAQ,QAAQ,QAAQ,IAAI,YAAY;AAAA,EAC9C,IAAI,UAAU;AAAA,IAAM,OAAO;AAAA,EAC3B,QAAQ,SAAU,MAAM,aAAa,GAAI,KAAK;AAAA;;;AH8BxC,IAAM,gBAAwB;AAQ9B,SAAS,WAAW,CAAC,UAAwB,CAAC,GAAU;AAAA,EAC9D,MAAM,UAAU,QAAQ,iBAAiB;AAAA,EACzC,MAAM,WAAW,QAAQ,SAAS;AAAA,EAClC,MAAM,SAAS,QAAQ,WAAW,QAAQ;AAAA,EAE1C,MAAM,gBAA+B,OACpC,SACA,oBACA,iBACA,eACA,gBACI;AAAA,IACJ,gBAAgB,IAAI,gBAAgB,WAAW;AAAA,IAC/C,IAAI,QAAQ,WAAW,QAAQ;AAAA,MAC9B,OAAO,IAAI,SAAS,MAAM;AAAA,QACzB,QAAQ;AAAA,QACR,SAAS;AAAA,MACV,CAAC;AAAA,IACF;AAAA,IACA,IAAI,CAAC,YAAY,aAAa,GAAG;AAAA,MAChC,aACC,gBACC,QAAQ,YAAY,cAAc,aAAa,OAAO,CACxD;AAAA,IACD;AAAA,IACA,MAAM,QAAQ,SAAS,aAAa,OAAO;AAAA,IAC3C,MAAM,QAAQ,SAAS,UAAU,IAAK;AAAA,IACtC,IAAI,SAAS;AAAA,IACb,IAAI,WAAW;AAAA,IACf,IAAI;AAAA,IACJ,IAAI;AAAA,MACH,OAAO,MAAM,uBACZ,cACC,gBACA,EAAE,MAAM,GACR,cAAc,cAAc;AAAA,QAC3B,SAAS;AAAA,QACT,KAAK,QAAQ;AAAA,WAET,UAAU,YAAY,CAAC,IAAI,EAAE,MAAM;AAAA,MACxC,CAAC,CACF,GACA;AAAA,QACC;AAAA,QACA,QAAQ,YAAY,IAAI,CAAC,MAAM,QAAQ,QAAQ,MAAM,CAAC;AAAA,QACtD,OAAO,CAAC,OAAgB;AAAA,UAEvB,IAAI,QAAQ,OAAO;AAAA,YAAS;AAAA,UAC5B,SAAS;AAAA,UACT,IAAI;AAAA,YAAU,OAAO,KAAK;AAAA;AAAA,MAE5B,CACD;AAAA,MACA,WAAW;AAAA,MACX,IACC,MAAM,eAAe,SAAS,cAAc,WAAW,QAAQ,KAAK,GACnE;AAAA,QACD,MAAM,KAAK;AAAA,MACZ;AAAA,MACA,OAAO,IAAI,SAAS,UAAU,MAAM,MAAM,KAAK,GAAG;AAAA,QACjD;AAAA,QACA,SAAS;AAAA,MACV,CAAC;AAAA,MACA,OAAO,OAAO;AAAA,MAEf,MAAM,QAAQ,OAAO,IAAI;AAAA,MACzB,MAAM;AAAA;AAAA;AAAA,EAGR,OAAO,EAAE,eAAe,eAAe,QAAQ;AAAA;AAGhD,IAAM,WAAW,YAAY;AAGtB,IAAM,gBAA+B,SAAS;",
11
+ "debugId": "FF51119AD7D6DEC964756E2164756E21",
12
+ "names": []
13
+ }
@@ -0,0 +1,27 @@
1
+ import type { EntryContext } from 'react-router';
2
+ import { type ProviderLike } from '../context';
3
+ /** What the entry reads of a router context: `staticHandlerContext.loaderData`, as in React Router 8.x (checked on 8.5). */
4
+ type Holder = Pick<EntryContext['staticHandlerContext'], 'loaderData'>;
5
+ /** Whether the root route has data (a loader that ran and returned `null` counts). */
6
+ export declare function hasRootData(routerContext: {
7
+ staticHandlerContext: Holder;
8
+ }): boolean;
9
+ /**
10
+ * The root's loader data when the root's loader did not run: the request's
11
+ * `language`, if a middleware (`@softistx/alxia-language`) put one on alxia's context.
12
+ * `undefined` when none did, or when the request did not come through alxia.
13
+ */
14
+ export declare function languageData(context: ProviderLike): Record<string, unknown> | undefined;
15
+ /**
16
+ * A middleware that throws (an access gate) makes React Router skip every
17
+ * loader and render the root's error boundary, so the root's loader data is
18
+ * missing. Puts `data` there, in what the server renders from
19
+ * (`staticHandlerContext`), unless the root's loader ran. What the client
20
+ * hydrates from was encoded before the entry ran and stays without it: the
21
+ * root reads the language from `<html lang>` there (`createPageLanguage`).
22
+ */
23
+ export declare function fillRootData(routerContext: {
24
+ staticHandlerContext: Holder;
25
+ }, data: Record<string, unknown> | undefined): void;
26
+ export {};
27
+ //# sourceMappingURL=root-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-data.d.ts","sourceRoot":"","sources":["../../src/entry/root-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D,4HAA4H;AAC5H,KAAK,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,EAAE,YAAY,CAAC,CAAC;AAEvE,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,aAAa,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,WAE1E;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,YAAY,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAQrC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,aAAa,EAAE;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,EAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACvC,IAAI,CAMN"}
@@ -0,0 +1,10 @@
1
+ type IsBot = (userAgent: string) => boolean;
2
+ /**
3
+ * Whether the response waits for the whole page instead of streaming the
4
+ * shell: a bot (`isBot`, `isbot` by default, imported only then) gets
5
+ * complete HTML to index, and SPA mode renders the one shell the build
6
+ * prerenders.
7
+ */
8
+ export declare function wantsWholePage(request: Request, isSpaMode: boolean, isBot?: IsBot): Promise<boolean>;
9
+ export {};
10
+ //# sourceMappingURL=whole-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whole-page.d.ts","sourceRoot":"","sources":["../../src/entry/whole-page.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;AAoB5C;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,KAAK,GACX,OAAO,CAAC,OAAO,CAAC,CAKlB"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The shape of an API's refusal, as `@nxgt/graphql-client`'s `ApiError`
3
+ * carries it, declared structurally: `/errors` never imports the client, so
4
+ * an app needs it only if it calls the API through it. `api-error.spec.ts`
5
+ * holds the two in step.
6
+ */
7
+ /** One refused input field: `extensions.fields` of a validation refusal. */
8
+ export interface ApiFieldErrorLike {
9
+ readonly path: string;
10
+ readonly code: string;
11
+ readonly message: string;
12
+ /** The values the field's message interpolates. */
13
+ readonly params?: Readonly<Record<string, unknown>>;
14
+ }
15
+ /** The values a message interpolates; a throttle's wait is `minutes` or `retryAfter`. */
16
+ export interface ApiErrorParamsLike {
17
+ readonly minutes?: unknown;
18
+ readonly retryAfter?: unknown;
19
+ readonly attemptsLeft?: unknown;
20
+ readonly [key: string]: unknown;
21
+ }
22
+ /**
23
+ * One GraphQL error's `extensions`. `code` is the API's own
24
+ * `<module>.errors.<slug>`; the rest is what its messages name.
25
+ */
26
+ export interface ApiErrorExtensionsLike {
27
+ readonly code?: string;
28
+ /** The values the message interpolates, when the API sends them. */
29
+ readonly params?: ApiErrorParamsLike;
30
+ /** A validation refusal: every field at fault, by input path. */
31
+ readonly fields?: readonly ApiFieldErrorLike[];
32
+ /** Any other refusal about one input field, by its path. */
33
+ readonly field?: string;
34
+ /** A throttle's wait, in minutes (`waitMinutes` coerces a string). */
35
+ readonly minutes?: unknown;
36
+ /** A throttle's wait, in seconds. */
37
+ readonly retryAfter?: unknown;
38
+ /** The tries a refused code leaves, as `@softistx/janus` counts them. */
39
+ readonly attemptsLeft?: unknown;
40
+ readonly [key: string]: unknown;
41
+ }
42
+ /** One error of a response's `errors`. */
43
+ export interface ApiErrorEntryLike {
44
+ readonly message: string;
45
+ readonly extensions?: ApiErrorExtensionsLike;
46
+ }
47
+ /** A refusal read from a GraphQL API: what `ApiError` has, and the request id. */
48
+ export interface ApiErrorLike extends Error {
49
+ readonly errors: readonly ApiErrorEntryLike[];
50
+ /** The first error's `extensions.code`. */
51
+ readonly code: string | undefined;
52
+ /** The HTTP status to answer with. */
53
+ readonly status: number;
54
+ /** The id the API logged the request under, when the caller kept it. */
55
+ readonly requestId?: string;
56
+ }
57
+ /** Whether `error` is an `Error` of this `name`: the client's errors are told by it, never `instanceof`. */
58
+ export declare const isNamed: (error: unknown, name: string) => error is Error;
59
+ /**
60
+ * Whether `error` is an `ApiError` of `@nxgt/graphql-client`, by the test
61
+ * that client's `isApiError` makes (an `Error` named `ApiError` with an
62
+ * `errors` array), plus a numeric `status`, which `ApiErrorLike` promises.
63
+ * It holds across two copies of the client.
64
+ */
65
+ export declare function isApiErrorLike(error: unknown): error is ApiErrorLike;
66
+ /**
67
+ * Whether `error` is an API's refusal of an update whose version is out of
68
+ * date: an `ApiError` with status 409 whose `code` ends with
69
+ * `.errors.stale-version`. False for any other value.
70
+ */
71
+ export declare function isStaleVersion(error: unknown): error is ApiErrorLike;
72
+ /**
73
+ * The minutes a wait lasts, as the API words it: `minutes` (at least one, in
74
+ * `extensions.params` or beside it), else the `retryAfter` seconds rounded
75
+ * up, else one.
76
+ */
77
+ export declare function waitMinutes(extensions: ApiErrorExtensionsLike | undefined): number;
78
+ /**
79
+ * The seconds a throttle asks to wait: `retryAfter` of the first error's
80
+ * `extensions.params`, else (when that is unusable) of its `extensions`.
81
+ * Only a finite number from 0, or a decimal string, counts; it is rounded up
82
+ * and held at a day (86 400), and `-0` is 0. `undefined` when the API sent
83
+ * none usable. Exported from `/errors`; `/session` words it as a typed
84
+ * `retryAfter`.
85
+ */
86
+ export declare function retryAfterOf(error: ApiErrorLike): number | undefined;
87
+ /** The API's `extensions.reason` of the first error (also in its `params`): `'throttled'` is a timed wait. */
88
+ export declare function reasonOf(error: ApiErrorLike): unknown;
89
+ /** Whether the refusal carries `reason: 'throttled'`: a rate limit that asks to wait, whatever its code. */
90
+ export declare const isThrottledReason: (error: ApiErrorLike) => boolean;
91
+ /**
92
+ * The tries a refused code leaves, as `@softistx/janus` counts them:
93
+ * `extensions.attemptsLeft` of the first error, else the same key in its
94
+ * `params`. A whole number from 0 up; `undefined` when the API sent none or
95
+ * something that is not a count. A throttled refusal (`isThrottledReason`)
96
+ * spends no try: whatever count it carries (`0` included), it answers
97
+ * `undefined`.
98
+ */
99
+ export declare function attemptsLeftOf(error: ApiErrorLike): number | undefined;
100
+ /**
101
+ * The values a message names: `extensions.params` over the extensions
102
+ * themselves, where older errors and the extras of a few sit.
103
+ */
104
+ export declare function valuesOf(extensions: ApiErrorExtensionsLike | undefined): Record<string, unknown> | undefined;
105
+ /** `@nxgt/graphql-client`'s `ApiStatusError`, as far as the failure reads it. */
106
+ export interface StatusErrorLike extends Error {
107
+ status: number;
108
+ statusText?: string | undefined;
109
+ body?: unknown;
110
+ }
111
+ /** `@nxgt/graphql-client`'s `ApiUnavailableError`, as far as the failure reads it. */
112
+ export interface UnavailableErrorLike extends Error {
113
+ reason: string;
114
+ }
115
+ export declare const isStatusError: (error: unknown) => error is StatusErrorLike;
116
+ export declare const isUnavailableError: (error: unknown) => error is UnavailableErrorLike;
117
+ //# sourceMappingURL=api-error.d.ts.map