@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.
- package/LICENSE +21 -0
- package/README.md +2085 -2
- package/dist/api-keys/api-keys.d.ts +93 -0
- package/dist/api-keys/api-keys.d.ts.map +1 -0
- package/dist/api-keys/index.d.ts +9 -0
- package/dist/api-keys/index.d.ts.map +1 -0
- package/dist/api-keys/index.js +66 -0
- package/dist/api-keys/index.js.map +10 -0
- package/dist/assets.d.ts +14 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/chunks/index-0786n4qe.js +25 -0
- package/dist/chunks/index-0786n4qe.js.map +10 -0
- package/dist/chunks/index-1nw5yeek.js +169 -0
- package/dist/chunks/index-1nw5yeek.js.map +11 -0
- package/dist/chunks/index-59vhfj6n.js +10 -0
- package/dist/chunks/index-59vhfj6n.js.map +10 -0
- package/dist/chunks/index-5gqcpyyg.js +34 -0
- package/dist/chunks/index-5gqcpyyg.js.map +10 -0
- package/dist/chunks/index-6jf7zpxz.js +119 -0
- package/dist/chunks/index-6jf7zpxz.js.map +11 -0
- package/dist/chunks/index-8as4j8m3.js +340 -0
- package/dist/chunks/index-8as4j8m3.js.map +16 -0
- package/dist/chunks/index-9xv2a8et.js +108 -0
- package/dist/chunks/index-9xv2a8et.js.map +11 -0
- package/dist/chunks/index-ajtvyq35.js +16 -0
- package/dist/chunks/index-ajtvyq35.js.map +10 -0
- package/dist/chunks/index-c55hxgr5.js +124 -0
- package/dist/chunks/index-c55hxgr5.js.map +14 -0
- package/dist/chunks/index-d42p3mdp.js +19 -0
- package/dist/chunks/index-d42p3mdp.js.map +10 -0
- package/dist/chunks/index-gac44rs5.js +42 -0
- package/dist/chunks/index-gac44rs5.js.map +11 -0
- package/dist/chunks/index-j4ktpcke.js +62 -0
- package/dist/chunks/index-j4ktpcke.js.map +10 -0
- package/dist/chunks/index-mscfme4r.js +12 -0
- package/dist/chunks/index-mscfme4r.js.map +10 -0
- package/dist/chunks/index-pghmb2dm.js +30 -0
- package/dist/chunks/index-pghmb2dm.js.map +10 -0
- package/dist/chunks/index-rfr02vg4.js +40 -0
- package/dist/chunks/index-rfr02vg4.js.map +10 -0
- package/dist/chunks/index-sfhshxqz.js +31 -0
- package/dist/chunks/index-sfhshxqz.js.map +10 -0
- package/dist/chunks/index-skwypsjz.js +357 -0
- package/dist/chunks/index-skwypsjz.js.map +12 -0
- package/dist/chunks/index-sxh06ged.js +118 -0
- package/dist/chunks/index-sxh06ged.js.map +11 -0
- package/dist/chunks/index-t2ph23wk.js +96 -0
- package/dist/chunks/index-t2ph23wk.js.map +13 -0
- package/dist/chunks/index-thyabr5n.js +19 -0
- package/dist/chunks/index-thyabr5n.js.map +10 -0
- package/dist/chunks/index-tx36swjx.js +134 -0
- package/dist/chunks/index-tx36swjx.js.map +11 -0
- package/dist/chunks/index-v2z5k640.js +54 -0
- package/dist/chunks/index-v2z5k640.js.map +11 -0
- package/dist/chunks/index-vr82typq.js +23 -0
- package/dist/chunks/index-vr82typq.js.map +11 -0
- package/dist/chunks/index-whj6h5eg.js +9 -0
- package/dist/chunks/index-whj6h5eg.js.map +10 -0
- package/dist/chunks/index-wyypkfdv.js +130 -0
- package/dist/chunks/index-wyypkfdv.js.map +13 -0
- package/dist/chunks/index-xd5aqy3g.js +90 -0
- package/dist/chunks/index-xd5aqy3g.js.map +10 -0
- package/dist/chunks/index-zdbqzcjp.js +97 -0
- package/dist/chunks/index-zdbqzcjp.js.map +12 -0
- package/dist/chunks/index-zyg8amjc.js +23 -0
- package/dist/chunks/index-zyg8amjc.js.map +10 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +215 -0
- package/dist/cli/index.js.map +13 -0
- package/dist/cli/main.d.ts +13 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/reveal.d.ts +18 -0
- package/dist/cli/reveal.d.ts.map +1 -0
- package/dist/cli/template.d.ts +8 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/context.d.ts +104 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/document/index.d.ts +11 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +19 -0
- package/dist/document/index.js.map +9 -0
- package/dist/document/inline-script.d.ts +27 -0
- package/dist/document/inline-script.d.ts.map +1 -0
- package/dist/document/language-store.d.ts +8 -0
- package/dist/document/language-store.d.ts.map +1 -0
- package/dist/document/nonce.d.ts +34 -0
- package/dist/document/nonce.d.ts.map +1 -0
- package/dist/document/page-language.d.ts +39 -0
- package/dist/document/page-language.d.ts.map +1 -0
- package/dist/document/text-direction.d.ts +10 -0
- package/dist/document/text-direction.d.ts.map +1 -0
- package/dist/entry/abort.d.ts +21 -0
- package/dist/entry/abort.d.ts.map +1 -0
- package/dist/entry/create-entry.d.ts +41 -0
- package/dist/entry/create-entry.d.ts.map +1 -0
- package/dist/entry/index.d.ts +8 -0
- package/dist/entry/index.d.ts.map +1 -0
- package/dist/entry/index.js +154 -0
- package/dist/entry/index.js.map +13 -0
- package/dist/entry/root-data.d.ts +27 -0
- package/dist/entry/root-data.d.ts.map +1 -0
- package/dist/entry/whole-page.d.ts +10 -0
- package/dist/entry/whole-page.d.ts.map +1 -0
- package/dist/errors/api-error.d.ts +117 -0
- package/dist/errors/api-error.d.ts.map +1 -0
- package/dist/errors/api-errors.d.ts +122 -0
- package/dist/errors/api-errors.d.ts.map +1 -0
- package/dist/errors/call-failure.d.ts +45 -0
- package/dist/errors/call-failure.d.ts.map +1 -0
- package/dist/errors/catalogue-check.d.ts +24 -0
- package/dist/errors/catalogue-check.d.ts.map +1 -0
- package/dist/errors/catalogue-read.d.ts +33 -0
- package/dist/errors/catalogue-read.d.ts.map +1 -0
- package/dist/errors/catalogue.d.ts +59 -0
- package/dist/errors/catalogue.d.ts.map +1 -0
- package/dist/errors/code-resolver.d.ts +44 -0
- package/dist/errors/code-resolver.d.ts.map +1 -0
- package/dist/errors/cross-site.d.ts +8 -0
- package/dist/errors/cross-site.d.ts.map +1 -0
- package/dist/errors/describe-refusal.d.ts +6 -0
- package/dist/errors/describe-refusal.d.ts.map +1 -0
- package/dist/errors/describe.d.ts +3 -0
- package/dist/errors/describe.d.ts.map +1 -0
- package/dist/errors/fetcher-result.d.ts +33 -0
- package/dist/errors/fetcher-result.d.ts.map +1 -0
- package/dist/errors/field-placement.d.ts +12 -0
- package/dist/errors/field-placement.d.ts.map +1 -0
- package/dist/errors/form-errors.d.ts +8 -0
- package/dist/errors/form-errors.d.ts.map +1 -0
- package/dist/errors/form-refusal.d.ts +25 -0
- package/dist/errors/form-refusal.d.ts.map +1 -0
- package/dist/errors/index.d.ts +21 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +588 -0
- package/dist/errors/index.js.map +26 -0
- package/dist/errors/json-actions.d.ts +38 -0
- package/dist/errors/json-actions.d.ts.map +1 -0
- package/dist/errors/log.d.ts +8 -0
- package/dist/errors/log.d.ts.map +1 -0
- package/dist/errors/message-values.d.ts +11 -0
- package/dist/errors/message-values.d.ts.map +1 -0
- package/dist/errors/messages.d.ts +63 -0
- package/dist/errors/messages.d.ts.map +1 -0
- package/dist/errors/page-path.d.ts +9 -0
- package/dist/errors/page-path.d.ts.map +1 -0
- package/dist/errors/problem-error.d.ts +50 -0
- package/dist/errors/problem-error.d.ts.map +1 -0
- package/dist/errors/provider.d.ts +20 -0
- package/dist/errors/provider.d.ts.map +1 -0
- package/dist/errors/request-id.d.ts +5 -0
- package/dist/errors/request-id.d.ts.map +1 -0
- package/dist/errors/route-error.d.ts +33 -0
- package/dist/errors/route-error.d.ts.map +1 -0
- package/dist/errors/route-refusal.d.ts +20 -0
- package/dist/errors/route-refusal.d.ts.map +1 -0
- package/dist/errors/same-site.d.ts +49 -0
- package/dist/errors/same-site.d.ts.map +1 -0
- package/dist/errors/section-action.d.ts +46 -0
- package/dist/errors/section-action.d.ts.map +1 -0
- package/dist/errors/standard-schema.d.ts +34 -0
- package/dist/errors/standard-schema.d.ts.map +1 -0
- package/dist/errors/submit-form.d.ts +16 -0
- package/dist/errors/submit-form.d.ts.map +1 -0
- package/dist/errors/upstream-headers.d.ts +18 -0
- package/dist/errors/upstream-headers.d.ts.map +1 -0
- package/dist/errors/use-json-fetcher.d.ts +18 -0
- package/dist/errors/use-json-fetcher.d.ts.map +1 -0
- package/dist/fetcher/auth-refusal.d.ts +29 -0
- package/dist/fetcher/auth-refusal.d.ts.map +1 -0
- package/dist/fetcher/index.d.ts +20 -0
- package/dist/fetcher/index.d.ts.map +1 -0
- package/dist/fetcher/index.js +392 -0
- package/dist/fetcher/index.js.map +21 -0
- package/dist/fetcher/section-form.d.ts +24 -0
- package/dist/fetcher/section-form.d.ts.map +1 -0
- package/dist/fetcher/section-reload.d.ts +17 -0
- package/dist/fetcher/section-reload.d.ts.map +1 -0
- package/dist/fetcher/section-save.d.ts +29 -0
- package/dist/fetcher/section-save.d.ts.map +1 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts +57 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-answer.d.ts +16 -0
- package/dist/fetcher/use-fetcher-answer.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-done.d.ts +15 -0
- package/dist/fetcher/use-fetcher-done.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-promise.d.ts +48 -0
- package/dist/fetcher/use-fetcher-promise.d.ts.map +1 -0
- package/dist/fetcher/use-form-refusal.d.ts +20 -0
- package/dist/fetcher/use-form-refusal.d.ts.map +1 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts +20 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts.map +1 -0
- package/dist/fetcher/use-row-save.d.ts +32 -0
- package/dist/fetcher/use-row-save.d.ts.map +1 -0
- package/dist/fetcher/use-section-save.d.ts +46 -0
- package/dist/fetcher/use-section-save.d.ts.map +1 -0
- package/dist/fetcher/use-visible-interval.d.ts +24 -0
- package/dist/fetcher/use-visible-interval.d.ts.map +1 -0
- package/dist/fetcher/use-visible-revalidation.d.ts +10 -0
- package/dist/fetcher/use-visible-revalidation.d.ts.map +1 -0
- package/dist/health.d.ts +21 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/help/check/check.d.ts +35 -0
- package/dist/help/check/check.d.ts.map +1 -0
- package/dist/help/check/index.d.ts +8 -0
- package/dist/help/check/index.d.ts.map +1 -0
- package/dist/help/check/index.js +17 -0
- package/dist/help/check/index.js.map +9 -0
- package/dist/help/check/routes.d.ts +22 -0
- package/dist/help/check/routes.d.ts.map +1 -0
- package/dist/help/guide.d.ts +33 -0
- package/dist/help/guide.d.ts.map +1 -0
- package/dist/help/index.d.ts +16 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +192 -0
- package/dist/help/index.js.map +14 -0
- package/dist/help/load.d.ts +39 -0
- package/dist/help/load.d.ts.map +1 -0
- package/dist/help/panel.d.ts +69 -0
- package/dist/help/panel.d.ts.map +1 -0
- package/dist/help/parse-flow.d.ts +27 -0
- package/dist/help/parse-flow.d.ts.map +1 -0
- package/dist/help/react.d.ts +12 -0
- package/dist/help/react.d.ts.map +1 -0
- package/dist/help/resolve.d.ts +24 -0
- package/dist/help/resolve.d.ts.map +1 -0
- package/dist/help/types.d.ts +50 -0
- package/dist/help/types.d.ts.map +1 -0
- package/dist/help/yaml.d.ts +18 -0
- package/dist/help/yaml.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +14 -0
- package/dist/link/index.d.ts +7 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +16 -0
- package/dist/link/index.js.map +10 -0
- package/dist/link/router-link.d.ts +27 -0
- package/dist/link/router-link.d.ts.map +1 -0
- package/dist/lists/connection-page.d.ts +50 -0
- package/dist/lists/connection-page.d.ts.map +1 -0
- package/dist/lists/index.d.ts +13 -0
- package/dist/lists/index.d.ts.map +1 -0
- package/dist/lists/index.js +205 -0
- package/dist/lists/index.js.map +15 -0
- package/dist/lists/newest-first.d.ts +5 -0
- package/dist/lists/newest-first.d.ts.map +1 -0
- package/dist/lists/nodes-of.d.ts +21 -0
- package/dist/lists/nodes-of.d.ts.map +1 -0
- package/dist/lists/or-failed.d.ts +19 -0
- package/dist/lists/or-failed.d.ts.map +1 -0
- package/dist/lists/use-paged-rows.d.ts +40 -0
- package/dist/lists/use-paged-rows.d.ts.map +1 -0
- package/dist/lists/use-same-route-loading.d.ts +8 -0
- package/dist/lists/use-same-route-loading.d.ts.map +1 -0
- package/dist/lists/use-search-change.d.ts +20 -0
- package/dist/lists/use-search-change.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +105 -0
- package/dist/mcp/index.js.map +11 -0
- package/dist/mcp/mcp-relay.d.ts +58 -0
- package/dist/mcp/mcp-relay.d.ts.map +1 -0
- package/dist/mcp/relay.d.ts +38 -0
- package/dist/mcp/relay.d.ts.map +1 -0
- package/dist/media/client/error.d.ts +29 -0
- package/dist/media/client/error.d.ts.map +1 -0
- package/dist/media/client/index.d.ts +8 -0
- package/dist/media/client/index.d.ts.map +1 -0
- package/dist/media/client/index.js +133 -0
- package/dist/media/client/index.js.map +11 -0
- package/dist/media/client/upload.d.ts +32 -0
- package/dist/media/client/upload.d.ts.map +1 -0
- package/dist/media/forward.d.ts +14 -0
- package/dist/media/forward.d.ts.map +1 -0
- package/dist/media/headers.d.ts +11 -0
- package/dist/media/headers.d.ts.map +1 -0
- package/dist/media/index.d.ts +9 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +396 -0
- package/dist/media/index.js.map +16 -0
- package/dist/media/options.d.ts +114 -0
- package/dist/media/options.d.ts.map +1 -0
- package/dist/media/path.d.ts +12 -0
- package/dist/media/path.d.ts.map +1 -0
- package/dist/media/read.d.ts +11 -0
- package/dist/media/read.d.ts.map +1 -0
- package/dist/media/refusal.d.ts +11 -0
- package/dist/media/refusal.d.ts.map +1 -0
- package/dist/media/respond.d.ts +8 -0
- package/dist/media/respond.d.ts.map +1 -0
- package/dist/media/write.d.ts +13 -0
- package/dist/media/write.d.ts.map +1 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +48 -0
- package/dist/navigation/index.js.map +11 -0
- package/dist/navigation/use-focus-on-navigate.d.ts +16 -0
- package/dist/navigation/use-focus-on-navigate.d.ts.map +1 -0
- package/dist/navigation/use-route-transition.d.ts +19 -0
- package/dist/navigation/use-route-transition.d.ts.map +1 -0
- package/dist/nonce.d.ts +16 -0
- package/dist/nonce.d.ts.map +1 -0
- package/dist/oauth/answer.d.ts +33 -0
- package/dist/oauth/answer.d.ts.map +1 -0
- package/dist/oauth/binding.d.ts +43 -0
- package/dist/oauth/binding.d.ts.map +1 -0
- package/dist/oauth/consent.d.ts +134 -0
- package/dist/oauth/consent.d.ts.map +1 -0
- package/dist/oauth/grants.d.ts +88 -0
- package/dist/oauth/grants.d.ts.map +1 -0
- package/dist/oauth/index.d.ts +16 -0
- package/dist/oauth/index.d.ts.map +1 -0
- package/dist/oauth/index.js +207 -0
- package/dist/oauth/index.js.map +12 -0
- package/dist/oauth/model.d.ts +13 -0
- package/dist/oauth/model.d.ts.map +1 -0
- package/dist/oauth/react/index.d.ts +7 -0
- package/dist/oauth/react/index.d.ts.map +1 -0
- package/dist/oauth/react/index.js +99 -0
- package/dist/oauth/react/index.js.map +10 -0
- package/dist/oauth/react/use-consent.d.ts +52 -0
- package/dist/oauth/react/use-consent.d.ts.map +1 -0
- package/dist/oidc/dpop.d.ts +80 -0
- package/dist/oidc/dpop.d.ts.map +1 -0
- package/dist/oidc/errors.d.ts +16 -0
- package/dist/oidc/errors.d.ts.map +1 -0
- package/dist/oidc/flow.d.ts +59 -0
- package/dist/oidc/flow.d.ts.map +1 -0
- package/dist/oidc/index.d.ts +11 -0
- package/dist/oidc/index.d.ts.map +1 -0
- package/dist/oidc/index.js +742 -0
- package/dist/oidc/index.js.map +15 -0
- package/dist/oidc/oidc.d.ts +132 -0
- package/dist/oidc/oidc.d.ts.map +1 -0
- package/dist/oidc/revoke.d.ts +28 -0
- package/dist/oidc/revoke.d.ts.map +1 -0
- package/dist/oidc/seal.d.ts +20 -0
- package/dist/oidc/seal.d.ts.map +1 -0
- package/dist/pwa/build/build-worker.d.ts +41 -0
- package/dist/pwa/build/build-worker.d.ts.map +1 -0
- package/dist/pwa/build/index.d.ts +9 -0
- package/dist/pwa/build/index.d.ts.map +1 -0
- package/dist/pwa/build/index.js +9 -0
- package/dist/pwa/build/index.js.map +9 -0
- package/dist/pwa/build/precache.d.ts +17 -0
- package/dist/pwa/build/precache.d.ts.map +1 -0
- package/dist/pwa/index.d.ts +16 -0
- package/dist/pwa/index.d.ts.map +1 -0
- package/dist/pwa/index.js +110 -0
- package/dist/pwa/index.js.map +12 -0
- package/dist/pwa/model/caching.d.ts +46 -0
- package/dist/pwa/model/caching.d.ts.map +1 -0
- package/dist/pwa/model/clear-app-caches.d.ts +9 -0
- package/dist/pwa/model/clear-app-caches.d.ts.map +1 -0
- package/dist/pwa/model/font-precache.d.ts +15 -0
- package/dist/pwa/model/font-precache.d.ts.map +1 -0
- package/dist/pwa/model/manifest.d.ts +80 -0
- package/dist/pwa/model/manifest.d.ts.map +1 -0
- package/dist/pwa/model/precache-list.d.ts +40 -0
- package/dist/pwa/model/precache-list.d.ts.map +1 -0
- package/dist/pwa/model/registration.d.ts +39 -0
- package/dist/pwa/model/registration.d.ts.map +1 -0
- package/dist/pwa/model/start-service-worker.d.ts +24 -0
- package/dist/pwa/model/start-service-worker.d.ts.map +1 -0
- package/dist/pwa/model/storable.d.ts +8 -0
- package/dist/pwa/model/storable.d.ts.map +1 -0
- package/dist/pwa/model/theme-color.d.ts +20 -0
- package/dist/pwa/model/theme-color.d.ts.map +1 -0
- package/dist/pwa/model/update-notice.d.ts +38 -0
- package/dist/pwa/model/update-notice.d.ts.map +1 -0
- package/dist/pwa/model/worker-contract.d.ts +61 -0
- package/dist/pwa/model/worker-contract.d.ts.map +1 -0
- package/dist/pwa/react/index.d.ts +9 -0
- package/dist/pwa/react/index.d.ts.map +1 -0
- package/dist/pwa/react/index.js +75 -0
- package/dist/pwa/react/index.js.map +13 -0
- package/dist/pwa/react/use-online.d.ts +6 -0
- package/dist/pwa/react/use-online.d.ts.map +1 -0
- package/dist/pwa/react/use-service-worker.d.ts +33 -0
- package/dist/pwa/react/use-service-worker.d.ts.map +1 -0
- package/dist/pwa/react/use-update-notice.d.ts +14 -0
- package/dist/pwa/react/use-update-notice.d.ts.map +1 -0
- package/dist/pwa/server/index.d.ts +7 -0
- package/dist/pwa/server/index.d.ts.map +1 -0
- package/dist/pwa/server/index.js +18 -0
- package/dist/pwa/server/index.js.map +10 -0
- package/dist/pwa/server/no-cache.d.ts +22 -0
- package/dist/pwa/server/no-cache.d.ts.map +1 -0
- package/dist/pwa/worker/index.d.ts +9 -0
- package/dist/pwa/worker/index.d.ts.map +1 -0
- package/dist/pwa/worker/index.js +144 -0
- package/dist/pwa/worker/index.js.map +12 -0
- package/dist/pwa/worker/injected.d.ts +15 -0
- package/dist/pwa/worker/injected.d.ts.map +1 -0
- package/dist/pwa/worker/plan.d.ts +65 -0
- package/dist/pwa/worker/plan.d.ts.map +1 -0
- package/dist/pwa/worker/scope.d.ts +18 -0
- package/dist/pwa/worker/scope.d.ts.map +1 -0
- package/dist/pwa/worker/start-worker.d.ts +17 -0
- package/dist/pwa/worker/start-worker.d.ts.map +1 -0
- package/dist/react-router.d.ts +68 -0
- package/dist/react-router.d.ts.map +1 -0
- package/dist/server.d.ts +127 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/session/codes.d.ts +9 -0
- package/dist/session/codes.d.ts.map +1 -0
- package/dist/session/cookies.d.ts +128 -0
- package/dist/session/cookies.d.ts.map +1 -0
- package/dist/session/flow-types.d.ts +235 -0
- package/dist/session/flow-types.d.ts.map +1 -0
- package/dist/session/guard.d.ts +10 -0
- package/dist/session/guard.d.ts.map +1 -0
- package/dist/session/index.d.ts +22 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +1090 -0
- package/dist/session/index.js.map +27 -0
- package/dist/session/land.d.ts +28 -0
- package/dist/session/land.d.ts.map +1 -0
- package/dist/session/link-json.d.ts +22 -0
- package/dist/session/link-json.d.ts.map +1 -0
- package/dist/session/link-land.d.ts +20 -0
- package/dist/session/link-land.d.ts.map +1 -0
- package/dist/session/link-token.d.ts +24 -0
- package/dist/session/link-token.d.ts.map +1 -0
- package/dist/session/link-types.d.ts +142 -0
- package/dist/session/link-types.d.ts.map +1 -0
- package/dist/session/links.d.ts +14 -0
- package/dist/session/links.d.ts.map +1 -0
- package/dist/session/model/index.d.ts +8 -0
- package/dist/session/model/index.d.ts.map +1 -0
- package/dist/session/model/index.js +35 -0
- package/dist/session/model/index.js.map +9 -0
- package/dist/session/model/link-post.d.ts +35 -0
- package/dist/session/model/link-post.d.ts.map +1 -0
- package/dist/session/model/paths.d.ts +24 -0
- package/dist/session/model/paths.d.ts.map +1 -0
- package/dist/session/model/safe-next.d.ts +15 -0
- package/dist/session/model/safe-next.d.ts.map +1 -0
- package/dist/session/model/second-factor.d.ts +16 -0
- package/dist/session/model/second-factor.d.ts.map +1 -0
- package/dist/session/model/site-path.d.ts +10 -0
- package/dist/session/model/site-path.d.ts.map +1 -0
- package/dist/session/model/step-up-answers.d.ts +45 -0
- package/dist/session/model/step-up-answers.d.ts.map +1 -0
- package/dist/session/model/step-up-props.d.ts +22 -0
- package/dist/session/model/step-up-props.d.ts.map +1 -0
- package/dist/session/model/step-up.d.ts +48 -0
- package/dist/session/model/step-up.d.ts.map +1 -0
- package/dist/session/react/index.d.ts +13 -0
- package/dist/session/react/index.d.ts.map +1 -0
- package/dist/session/react/index.js +196 -0
- package/dist/session/react/index.js.map +14 -0
- package/dist/session/react/step-up/answers.d.ts +9 -0
- package/dist/session/react/step-up/answers.d.ts.map +1 -0
- package/dist/session/react/step-up/dialog-props.d.ts +27 -0
- package/dist/session/react/step-up/dialog-props.d.ts.map +1 -0
- package/dist/session/react/step-up/index.d.ts +7 -0
- package/dist/session/react/step-up/index.d.ts.map +1 -0
- package/dist/session/react/step-up/pending-runs.d.ts +21 -0
- package/dist/session/react/step-up/pending-runs.d.ts.map +1 -0
- package/dist/session/react/step-up/phase.d.ts +8 -0
- package/dist/session/react/step-up/phase.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts +59 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts +70 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up.d.ts +51 -0
- package/dist/session/react/step-up/use-step-up.d.ts.map +1 -0
- package/dist/session/react/use-code-field.d.ts +37 -0
- package/dist/session/react/use-code-field.d.ts.map +1 -0
- package/dist/session/react/use-link-fragment.d.ts +22 -0
- package/dist/session/react/use-link-fragment.d.ts.map +1 -0
- package/dist/session/react/use-link-param.d.ts +26 -0
- package/dist/session/react/use-link-param.d.ts.map +1 -0
- package/dist/session/react/use-link-post.d.ts +39 -0
- package/dist/session/react/use-link-post.d.ts.map +1 -0
- package/dist/session/react/use-sign-out.d.ts +46 -0
- package/dist/session/react/use-sign-out.d.ts.map +1 -0
- package/dist/session/second-factor.d.ts +22 -0
- package/dist/session/second-factor.d.ts.map +1 -0
- package/dist/session/serialize.d.ts +42 -0
- package/dist/session/serialize.d.ts.map +1 -0
- package/dist/session/sign-in.d.ts +19 -0
- package/dist/session/sign-in.d.ts.map +1 -0
- package/dist/session/signed.d.ts +44 -0
- package/dist/session/signed.d.ts.map +1 -0
- package/dist/session/social-flow.d.ts +22 -0
- package/dist/session/social-flow.d.ts.map +1 -0
- package/dist/session/social-land.d.ts +31 -0
- package/dist/session/social-land.d.ts.map +1 -0
- package/dist/session/social-types.d.ts +136 -0
- package/dist/session/social-types.d.ts.map +1 -0
- package/dist/session/social.d.ts +32 -0
- package/dist/session/social.d.ts.map +1 -0
- package/dist/session/step-up-codes.d.ts +9 -0
- package/dist/session/step-up-codes.d.ts.map +1 -0
- package/dist/session/step-up-signed-out.d.ts +21 -0
- package/dist/session/step-up-signed-out.d.ts.map +1 -0
- package/dist/session/step-up-types.d.ts +127 -0
- package/dist/session/step-up-types.d.ts.map +1 -0
- package/dist/session/step-up.d.ts +17 -0
- package/dist/session/step-up.d.ts.map +1 -0
- package/dist/session/step.d.ts +22 -0
- package/dist/session/step.d.ts.map +1 -0
- package/dist/session/throttle.d.ts +73 -0
- package/dist/session/throttle.d.ts.map +1 -0
- package/dist/session/timed-wait.d.ts +4 -0
- package/dist/session/timed-wait.d.ts.map +1 -0
- package/dist/session/viewer.d.ts +34 -0
- package/dist/session/viewer.d.ts.map +1 -0
- package/dist/subscription/documents.d.ts +3 -0
- package/dist/subscription/documents.d.ts.map +1 -0
- package/dist/subscription/index.d.ts +7 -0
- package/dist/subscription/index.d.ts.map +1 -0
- package/dist/subscription/index.js +359 -0
- package/dist/subscription/index.js.map +14 -0
- package/dist/subscription/proxy.d.ts +54 -0
- package/dist/subscription/proxy.d.ts.map +1 -0
- package/dist/subscription/react/backoff.d.ts +8 -0
- package/dist/subscription/react/backoff.d.ts.map +1 -0
- package/dist/subscription/react/classify.d.ts +15 -0
- package/dist/subscription/react/classify.d.ts.map +1 -0
- package/dist/subscription/react/controller.d.ts +40 -0
- package/dist/subscription/react/controller.d.ts.map +1 -0
- package/dist/subscription/react/fake-timers.d.ts +8 -0
- package/dist/subscription/react/fake-timers.d.ts.map +1 -0
- package/dist/subscription/react/index.d.ts +15 -0
- package/dist/subscription/react/index.d.ts.map +1 -0
- package/dist/subscription/react/index.js +227 -0
- package/dist/subscription/react/index.js.map +17 -0
- package/dist/subscription/react/reconnect.d.ts +9 -0
- package/dist/subscription/react/reconnect.d.ts.map +1 -0
- package/dist/subscription/react/scheduler.d.ts +13 -0
- package/dist/subscription/react/scheduler.d.ts.map +1 -0
- package/dist/subscription/react/timers.d.ts +7 -0
- package/dist/subscription/react/timers.d.ts.map +1 -0
- package/dist/subscription/react/use-live-subscription.d.ts +36 -0
- package/dist/subscription/react/use-live-subscription.d.ts.map +1 -0
- package/dist/subscription/react/versions.d.ts +6 -0
- package/dist/subscription/react/versions.d.ts.map +1 -0
- package/dist/subscription/read.d.ts +17 -0
- package/dist/subscription/read.d.ts.map +1 -0
- package/dist/subscription/refusal.d.ts +11 -0
- package/dist/subscription/refusal.d.ts.map +1 -0
- package/dist/subscription/relay.d.ts +16 -0
- package/dist/subscription/relay.d.ts.map +1 -0
- package/dist/vite/bun.d.ts +21 -0
- package/dist/vite/bun.d.ts.map +1 -0
- package/dist/vite/bundle.d.ts +33 -0
- package/dist/vite/bundle.d.ts.map +1 -0
- package/dist/vite/compress.d.ts +18 -0
- package/dist/vite/compress.d.ts.map +1 -0
- package/dist/vite/config.d.ts +33 -0
- package/dist/vite/config.d.ts.map +1 -0
- package/dist/vite/dev.d.ts +28 -0
- package/dist/vite/dev.d.ts.map +1 -0
- package/dist/vite/entry.d.ts +20 -0
- package/dist/vite/entry.d.ts.map +1 -0
- package/dist/vite/hosts.d.ts +16 -0
- package/dist/vite/hosts.d.ts.map +1 -0
- package/dist/vite/index.d.ts +68 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +635 -0
- package/dist/vite/index.js.map +22 -0
- package/dist/vite/inline.d.ts +18 -0
- package/dist/vite/inline.d.ts.map +1 -0
- package/dist/vite/node.d.ts +16 -0
- package/dist/vite/node.d.ts.map +1 -0
- package/dist/vite/preview.d.ts +8 -0
- package/dist/vite/preview.d.ts.map +1 -0
- package/dist/vite/runtime.d.ts +8 -0
- package/dist/vite/runtime.d.ts.map +1 -0
- package/dist/vite/socket.d.ts +75 -0
- package/dist/vite/socket.d.ts.map +1 -0
- package/dist/vite/worker.d.ts +16 -0
- package/dist/vite/worker.d.ts.map +1 -0
- package/dist/with-alxia.d.ts +36 -0
- package/dist/with-alxia.d.ts.map +1 -0
- package/docs/README.md +42 -0
- package/docs/guide/api-keys.md +216 -0
- package/docs/guide/beside-the-pages.md +201 -0
- package/docs/guide/csp-nonce.md +166 -0
- package/docs/guide/customising-the-server.md +324 -0
- package/docs/guide/deploying.md +102 -0
- package/docs/guide/document.md +334 -0
- package/docs/guide/errors.md +1147 -0
- package/docs/guide/fetcher.md +355 -0
- package/docs/guide/getting-started.md +112 -0
- package/docs/guide/help.md +325 -0
- package/docs/guide/how-it-works.md +274 -0
- package/docs/guide/link.md +32 -0
- package/docs/guide/lists.md +225 -0
- package/docs/guide/mcp.md +173 -0
- package/docs/guide/media.md +273 -0
- package/docs/guide/navigation.md +52 -0
- package/docs/guide/oauth.md +342 -0
- package/docs/guide/oidc.md +262 -0
- package/docs/guide/openapi.md +51 -0
- package/docs/guide/pwa.md +670 -0
- package/docs/guide/session.md +2105 -0
- package/docs/guide/subscriptions.md +211 -0
- package/docs/guide/testing.md +42 -0
- package/docs/guide/typing-the-loaders.md +311 -0
- package/docs/guide.md +82 -0
- package/docs/roadmap.md +474 -0
- package/docs/troubleshooting.md +3837 -0
- package/package.json +301 -5
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# A fetcher's fresh answer
|
|
2
|
+
|
|
3
|
+
A page that posts JSON through a keyed fetcher (`useJsonFetcher('save')`) often
|
|
4
|
+
reacts to each answer once: a toast, a form error. A keyed fetcher outlives its
|
|
5
|
+
component, so its data from an earlier visit is still there when the component
|
|
6
|
+
mounts again, and a plain `useEffect` on `fetcher.data` reacts to it as if it
|
|
7
|
+
were new. `@softistx/alxia-react-router/fetcher` holds the hook that tells them apart
|
|
8
|
+
(`useFetcherAnswer`, which reads the fetcher structurally) and the one that
|
|
9
|
+
loads a resource route for what the user types (`useDebouncedFetcher`, below),
|
|
10
|
+
and the ones that read data again while the page is visible
|
|
11
|
+
(`useVisibleInterval`, `useVisibleRevalidation`, `useRevalidateOnFocus`, below). `react` is its only
|
|
12
|
+
import, plus `react-router` for the hooks that use a fetcher or the
|
|
13
|
+
revalidator, and all render on the server.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useJsonFetcher } from '@softistx/alxia-react-router/errors';
|
|
17
|
+
import { useFetcherAnswer } from '@softistx/alxia-react-router/fetcher';
|
|
18
|
+
|
|
19
|
+
export function SaveForm() {
|
|
20
|
+
const { fetcher, post } = useJsonFetcher<typeof action>('save');
|
|
21
|
+
const answer = useFetcherAnswer(fetcher, (result) => toast(result.message));
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<button onClick={() => post({ name: 'Ana' })}>Save</button>
|
|
25
|
+
{answer ? <p>{answer.message}</p> : null}
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## `useFetcherAnswer(fetcher, onAnswer?)`
|
|
32
|
+
|
|
33
|
+
- `onAnswer` is called once for each answer that arrives while
|
|
34
|
+
`fetcher.state` is `'idle'` and is another object than the last one seen.
|
|
35
|
+
- The data the fetcher holds when the component mounts counts as seen, so
|
|
36
|
+
remounting does not replay it.
|
|
37
|
+
- The handler is kept in a ref: a new function each render never fires it
|
|
38
|
+
again, and it always runs the latest one.
|
|
39
|
+
- It returns the latest answer handed over (`undefined` until one arrives),
|
|
40
|
+
typed as the action's data, for a screen that reads it as well.
|
|
41
|
+
- The comparison is by identity: two answers equal in value but returned as
|
|
42
|
+
two objects are two answers, and so is a reloading `fetcher.load`, which
|
|
43
|
+
hands a new object each time. An answer that comes back as the object seen
|
|
44
|
+
before (A, B, then A again) is a new answer once B was seen.
|
|
45
|
+
|
|
46
|
+
## A write is done: `useFetcherDone(fetcher, isDone, onDone)`
|
|
47
|
+
|
|
48
|
+
A fetcher keeps its last data, so a dialog or section that opens again would
|
|
49
|
+
react a second time to a success it already handled. `useFetcherDone` calls
|
|
50
|
+
`onDone()` once for each new answer that `isDone(data)` accepts, when
|
|
51
|
+
`fetcher.state` is `'idle'`.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { useJsonFetcher } from '@softistx/alxia-react-router/errors';
|
|
55
|
+
import { useFetcherDone } from '@softistx/alxia-react-router/fetcher';
|
|
56
|
+
|
|
57
|
+
const { fetcher } = useJsonFetcher<typeof action>('rename');
|
|
58
|
+
useFetcherDone(fetcher, (result) => result.ok, () => setOpen(false));
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- The data the fetcher holds at mount counts as handled: reopening the dialog
|
|
62
|
+
does not close it again.
|
|
63
|
+
- Each answer is handled once. An answer `isDone` refuses (a validation error)
|
|
64
|
+
is not replayed later; the next accepted answer fires.
|
|
65
|
+
- `isDone` and `onDone` are kept in refs, so a new function each render never
|
|
66
|
+
fires it, and the latest ones run.
|
|
67
|
+
- Comparison is by identity, as in `useFetcherAnswer`; use that hook when the
|
|
68
|
+
answer itself is needed.
|
|
69
|
+
|
|
70
|
+
## One submission's answer as a Promise: `useFetcherPromise(fetcher, options?)`
|
|
71
|
+
|
|
72
|
+
A confirm dialog whose `onConfirm` returns a Promise stays open, and shows the
|
|
73
|
+
error, while the Promise rejects. `useFetcherPromise` ties a submission to the
|
|
74
|
+
fetcher's next new answer, on top of `useFetcherAnswer`, so the app keeps no
|
|
75
|
+
ref of resolve and reject.
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { useJsonFetcher } from '@softistx/alxia-react-router/errors';
|
|
79
|
+
import { useFetcherPromise } from '@softistx/alxia-react-router/fetcher';
|
|
80
|
+
|
|
81
|
+
const { fetcher, post } = useJsonFetcher<typeof action>('delete');
|
|
82
|
+
const run = useFetcherPromise(fetcher, {
|
|
83
|
+
refusal: (result) => (result.ok ? undefined : result.error),
|
|
84
|
+
});
|
|
85
|
+
// a confirm dialog that stays open, and shows the error, while this rejects
|
|
86
|
+
const onConfirm = () => run(() => post({ intent: 'delete', id }));
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- `run(submit)` calls `submit` and returns a Promise. It resolves with the
|
|
90
|
+
next new answer, or rejects when `options.refusal(answer)` returns a
|
|
91
|
+
message (an `Error` with that message) or an `Error` (thrown as it is).
|
|
92
|
+
Without `refusal` every answer resolves. `run` is the same function on every
|
|
93
|
+
render.
|
|
94
|
+
- An answer the fetcher already held when `run` was called never settles the
|
|
95
|
+
Promise, nor does the data present at mount; only an answer that arrives
|
|
96
|
+
after the call, once the fetcher is idle, does.
|
|
97
|
+
- **A second `run` while one is pending replaces it**: the older Promise
|
|
98
|
+
rejects with a `FetcherPromiseAborted` (`reason: 'superseded'`) and the newer
|
|
99
|
+
one gets the answer. The fetcher itself still sends both submissions (React
|
|
100
|
+
Router answers the last), so disable the button while the dialog works if
|
|
101
|
+
the first must not be sent.
|
|
102
|
+
- **An unmount rejects the pending Promise** with a `FetcherPromiseAborted`
|
|
103
|
+
(`reason: 'unmounted'`), so nothing waits forever; the caller (the dialog)
|
|
104
|
+
is usually gone and ignores it. Check `error instanceof FetcherPromiseAborted`
|
|
105
|
+
to tell it from a refusal.
|
|
106
|
+
- **A submission that ends without a new answer rejects the Promise** with a
|
|
107
|
+
`FetcherPromiseNoAnswer`: the fetcher was busy and is idle again, but the
|
|
108
|
+
action answered `null`, `undefined` or the very data it already held, so
|
|
109
|
+
nothing would ever settle the call. Check
|
|
110
|
+
`error instanceof FetcherPromiseNoAnswer` to tell it from a refusal; an
|
|
111
|
+
action meant to answer nothing should be awaited on `fetcher.state`
|
|
112
|
+
instead.
|
|
113
|
+
- Catch every Promise `run` returns: an abort or a missing answer rejects it,
|
|
114
|
+
and one nobody handles is an unhandled rejection. Where the caller does not
|
|
115
|
+
await it:
|
|
116
|
+
`run(...).catch((e) => { if (!(e instanceof FetcherPromiseAborted || e instanceof FetcherPromiseNoAnswer)) throw e; })`.
|
|
117
|
+
The example assumes `fetcherResult`'s shape, `{ ok: false, error: string }`.
|
|
118
|
+
- A `refusal` that throws rejects the Promise with what it threw.
|
|
119
|
+
- A `submit` that throws, or returns a Promise that rejects, rejects the
|
|
120
|
+
Promise with that error.
|
|
121
|
+
|
|
122
|
+
## An action's answer as an auth form's refusal: `authRefusal(answer, fields)`
|
|
123
|
+
|
|
124
|
+
An auth form (sign in, sign up, a new password) takes an `onSubmit` that
|
|
125
|
+
returns a refusal, `{ form, retryAfter, <field> }`, or nothing when the form is
|
|
126
|
+
accepted. A route action answers `{ sent, formError, retryAfter, fieldErrors }`.
|
|
127
|
+
`authRefusal` is the mapping between the two, so no app writes its own copy.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { authRefusal } from '@softistx/alxia-react-router/fetcher';
|
|
131
|
+
|
|
132
|
+
const onSubmit = async (values: { email: string; password: string }) => {
|
|
133
|
+
const answer = await run(() =>
|
|
134
|
+
submit(values, { method: 'post', encType: 'application/json' }),
|
|
135
|
+
);
|
|
136
|
+
return authRefusal(answer, ['email', 'password']);
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- It returns `undefined` when `answer.sent` is true, so the form is accepted.
|
|
141
|
+
- Otherwise it returns `form` (from `formError`), `retryAfter`, and for each
|
|
142
|
+
name in `fields` the matching `fieldErrors` entry. The result is typed with
|
|
143
|
+
those names (`refusal.email`).
|
|
144
|
+
- A field error whose name is not in `fields` is left out: list every field
|
|
145
|
+
the form shows.
|
|
146
|
+
- An answer with no `sent` and no message is still a refusal (all keys
|
|
147
|
+
`undefined`); it is not read as a success.
|
|
148
|
+
- For the `FormErrors` of a section form use `useFormRefusal`; `authRefusal` is for the auth forms' `{ form, retryAfter, <field> }`.
|
|
149
|
+
- It is a plain function with no React import, usable on the server too.
|
|
150
|
+
|
|
151
|
+
## Typeahead: `useDebouncedFetcher(value, to, options?)`
|
|
152
|
+
|
|
153
|
+
A search box, a suggestion list or a preview loads a resource route for what
|
|
154
|
+
the user types. The pattern is always the same: wait for a pause after the last
|
|
155
|
+
keystroke, ask from a minimum length, never act on an answer for older words,
|
|
156
|
+
keep the previous answer on screen while the next one loads, offer a retry.
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
import { useDebouncedFetcher } from '@softistx/alxia-react-router/fetcher';
|
|
160
|
+
|
|
161
|
+
type SuggestAnswer = { items: string[] } | { failed: true };
|
|
162
|
+
|
|
163
|
+
export function Suggestions({ typed }: { typed: string }) {
|
|
164
|
+
const { data, stale, state, retry } = useDebouncedFetcher<SuggestAnswer>(
|
|
165
|
+
typed,
|
|
166
|
+
(q) => `/suggest?${new URLSearchParams({ q })}`,
|
|
167
|
+
{ minLength: 2, delayMs: 250, keep: (answer) => !('failed' in answer) },
|
|
168
|
+
);
|
|
169
|
+
if (state === 'idle') return null;
|
|
170
|
+
return (
|
|
171
|
+
<div aria-busy={state !== 'done'} style={{ opacity: stale ? 0.5 : 1 }}>
|
|
172
|
+
{data && 'items' in data ? <List items={data.items} /> : <Spinner />}
|
|
173
|
+
{data && 'failed' in data ? <button onClick={retry}>Try again</button> : null}
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
- `value` is the text typed; it is trimmed, and nothing is asked below
|
|
180
|
+
`minLength` (default 1). `to` is the route's URL, or a function of the
|
|
181
|
+
trimmed value that builds it (a plain string is loaded as it is, the value
|
|
182
|
+
only triggering it).
|
|
183
|
+
- After `delayMs` (default 250) without a change, one `fetcher.load` is made;
|
|
184
|
+
a newer load cancels the previous one.
|
|
185
|
+
- `data` is the route's answer for the value as it stands. While a newer value
|
|
186
|
+
waits or loads it is the previous answer and `stale` is `true`; an answer
|
|
187
|
+
for an older value is never returned as current. It is `undefined` before
|
|
188
|
+
the first answer and again once the hook is `idle`.
|
|
189
|
+
- `state` is `'idle'` (disabled or too short), `'waiting'` (the pause is
|
|
190
|
+
running), `'loading'` or `'done'`.
|
|
191
|
+
- `retry()` asks again for the value as it stands, without the pause; it is
|
|
192
|
+
the same function on every render. The route answers `{ failed: true }` on a
|
|
193
|
+
failure (for example with `orFailed` from `/lists`) rather than throwing,
|
|
194
|
+
which is what gives the retry button something to show (see
|
|
195
|
+
[troubleshooting](../troubleshooting.md)).
|
|
196
|
+
- `keep(answer)` (default: keep all) decides which answers may stay as the
|
|
197
|
+
stale `data` while the next value waits or loads; refuse the failed ones so
|
|
198
|
+
a failure is shown once, as the current answer, never dimmed as a previous
|
|
199
|
+
one. After a refused answer, the stale data is the last *kept* answer, not
|
|
200
|
+
the refused one.
|
|
201
|
+
- A refusal the route answers as data (`{ failed: true }`) is `data` like any
|
|
202
|
+
answer. A route that throws goes to the route's error boundary, as with any
|
|
203
|
+
fetcher.
|
|
204
|
+
- `enabled: false` asks nothing and forgets the previous answer (a closed
|
|
205
|
+
dialog); `key` shares the fetcher with another component.
|
|
206
|
+
|
|
207
|
+
## Fresh data while the page is visible: `useVisibleInterval(callback, ms, options?)`
|
|
208
|
+
|
|
209
|
+
A screen with no real-time channel reads its data again on a timer. The timer
|
|
210
|
+
should run only while the user can see the page, and a page that was hidden
|
|
211
|
+
for a while should not show old data when it comes back.
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { useFetcher } from 'react-router';
|
|
215
|
+
import {
|
|
216
|
+
useVisibleInterval,
|
|
217
|
+
useVisibleRevalidation,
|
|
218
|
+
} from '@softistx/alxia-react-router/fetcher';
|
|
219
|
+
|
|
220
|
+
export function Board({ menuOpen }: { menuOpen: boolean }) {
|
|
221
|
+
// the route's loaders, every minute, never while a menu is open
|
|
222
|
+
useVisibleRevalidation(60_000, { enabled: !menuOpen });
|
|
223
|
+
|
|
224
|
+
// any callback, here a fetcher's load, every five minutes
|
|
225
|
+
const counts = useFetcher<Counts>();
|
|
226
|
+
useVisibleInterval(() => void counts.load('/counts'), 300_000);
|
|
227
|
+
return <Tiles counts={counts.data} />;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- The callback runs every `ms` while `document.visibilityState` is
|
|
232
|
+
`'visible'`. A tick that fires while the page is hidden is skipped.
|
|
233
|
+
- When a hidden page becomes visible and at least `ms` has passed since the
|
|
234
|
+
last run, the callback runs at once (`runOnVisible`, default `true`; pass
|
|
235
|
+
`false` to wait for the next tick). A page that comes back sooner waits for
|
|
236
|
+
the tick.
|
|
237
|
+
- `enabled: false` stops the timer and removes the listener; `true` again
|
|
238
|
+
starts a fresh interval.
|
|
239
|
+
- The callback is read from a ref: a new function each render does not
|
|
240
|
+
restart the timer, and the latest one runs. It decides whether to skip a
|
|
241
|
+
read already in flight (`fetcher.state`); `useVisibleRevalidation` does so
|
|
242
|
+
for `useRevalidator`.
|
|
243
|
+
- The timer and the listener are cleared on unmount. On the server nothing
|
|
244
|
+
starts, since effects do not run there.
|
|
245
|
+
- Changing `ms` restarts the interval. `ms` must be positive.
|
|
246
|
+
|
|
247
|
+
## Fresh data on return: `useRevalidateOnFocus(options?)`
|
|
248
|
+
|
|
249
|
+
A page whose figures should be fresh when the user comes back to the tab, with
|
|
250
|
+
no polling, revalidates its route's loaders on the return.
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import { useRevalidateOnFocus } from '@softistx/alxia-react-router/fetcher';
|
|
254
|
+
|
|
255
|
+
export function Dashboard({ saving }: { saving: boolean }) {
|
|
256
|
+
// once when the user returns after 30 s or more, never while saving
|
|
257
|
+
useRevalidateOnFocus({ minHiddenMs: 30_000, enabled: !saving });
|
|
258
|
+
return <Figures />;
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
- The page counts as left when `document.visibilityState` becomes `'hidden'`
|
|
263
|
+
or the window loses focus (`blur`). It counts as back on `visibilitychange`
|
|
264
|
+
to visible or on `focus`.
|
|
265
|
+
- A return after at least `minHiddenMs` (default `30_000`) calls
|
|
266
|
+
`useRevalidator().revalidate()` once; a quicker return does nothing. The
|
|
267
|
+
visibility and focus events of one return revalidate once, not twice.
|
|
268
|
+
- A revalidation already in flight is not doubled.
|
|
269
|
+
- `enabled: false` removes the listeners; `true` again starts listening
|
|
270
|
+
afresh. They are also removed on unmount. No timer runs; use
|
|
271
|
+
`useVisibleRevalidation` to poll while the page is visible.
|
|
272
|
+
- On the server nothing starts, since effects do not run there.
|
|
273
|
+
|
|
274
|
+
## Saving a section or a row in place: `useSectionSave`, `useRowSave`
|
|
275
|
+
|
|
276
|
+
A record page that opens read-only and is edited section by section (a card
|
|
277
|
+
with its own Edit, a row of a list) posts one section's values to the route's
|
|
278
|
+
own action and handles the same answers every time: a field's refusal under
|
|
279
|
+
the field, a stale version kept open with a reload, a save that went through
|
|
280
|
+
resetting the form from the record the page now reads. The pair is
|
|
281
|
+
`sectionAction` on the server (`@softistx/alxia-react-router/errors`, see the
|
|
282
|
+
[errors guide](errors.md#saving-a-section-sectionaction)) and `useSectionSave`
|
|
283
|
+
on the client.
|
|
284
|
+
|
|
285
|
+
The hooks are headless: they return data, and the app draws it. `notice` is
|
|
286
|
+
`{ kind: 'stale', reload }` or `{ kind: 'error', message }` for the app's own
|
|
287
|
+
alert (or `@softistx/material`'s `StaleNotice`), so the package carries no
|
|
288
|
+
words and no component. The form is any object with `handleSubmit`, `reset`,
|
|
289
|
+
`setError` and `setFocus` (React Hook Form's `useForm()` result fits; the object must be stable across renders, as it is).
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { useSectionSave } from '@softistx/alxia-react-router/fetcher';
|
|
293
|
+
import { useForm } from 'react-hook-form';
|
|
294
|
+
|
|
295
|
+
export function IdentityCard({ record, onClose }: Props) {
|
|
296
|
+
const form = useForm({ defaultValues: record });
|
|
297
|
+
const { onSubmit, busy, notice, onCancel } = useSectionSave({
|
|
298
|
+
form,
|
|
299
|
+
intent: 'update-identity', // posted as `intent`; tells this section's answer from another's
|
|
300
|
+
toInput: (values) =>
|
|
301
|
+
sameAs(values, record) ? null : { ...values, version: record.version },
|
|
302
|
+
record, // the form values as the page reads them now
|
|
303
|
+
onSaved: onClose, // after the form was reset
|
|
304
|
+
});
|
|
305
|
+
return (
|
|
306
|
+
<form onSubmit={onSubmit}>
|
|
307
|
+
{notice?.kind === 'stale' ? (
|
|
308
|
+
<p role="alert">
|
|
309
|
+
Someone changed this record. <button type="button" onClick={notice.reload}>Reload</button>
|
|
310
|
+
</p>
|
|
311
|
+
) : null}
|
|
312
|
+
{notice?.kind === 'error' ? <p role="alert">{notice.message}</p> : null}
|
|
313
|
+
<input {...form.register('name')} />
|
|
314
|
+
<button type="submit" disabled={busy}>Save</button>
|
|
315
|
+
<button type="button" onClick={() => { onCancel(); onClose(); }}>Cancel</button>
|
|
316
|
+
</form>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- The values are posted as JSON `{ intent, ...toInput(values) }` through
|
|
322
|
+
`useJsonFetcher`; the route's action reads them with `readJson` and answers
|
|
323
|
+
`sectionAction`.
|
|
324
|
+
- `toInput` returns `null` when nothing changed: nothing is posted, the form
|
|
325
|
+
goes back to `record` and `onSaved` runs.
|
|
326
|
+
- A fetcher answer with another `intent` is ignored, so two sections of one
|
|
327
|
+
page never read each other's refusals.
|
|
328
|
+
- A refusal's `fieldErrors` are set on the form (`type: 'server'`) and the
|
|
329
|
+
first refused field, in page order, is focused (`focusOf(name)` maps a name
|
|
330
|
+
that is no field itself to the one to focus). The form's own message is set
|
|
331
|
+
on `root.server`.
|
|
332
|
+
- A stale answer is `notice.kind === 'stale'`, the edit kept open. `reload()`
|
|
333
|
+
revalidates the page, then refills the form from the record read again and
|
|
334
|
+
calls `onRefilled`.
|
|
335
|
+
- A save that went through resets the form with `record` once the loaders ran
|
|
336
|
+
again, then calls `onSaved`.
|
|
337
|
+
- `onCancel()` puts the form back on `record` and drops the shown refusal.
|
|
338
|
+
|
|
339
|
+
`useRowSave` is the same for one row of a list, with the row's version kept
|
|
340
|
+
from the moment it opened: a page read again meanwhile never turns a stale
|
|
341
|
+
save into a fresh one.
|
|
342
|
+
|
|
343
|
+
```tsx
|
|
344
|
+
import { useRowSave } from '@softistx/alxia-react-router/fetcher';
|
|
345
|
+
|
|
346
|
+
const { onSubmit, busy, notice, onCancel } = useRowSave({
|
|
347
|
+
form,
|
|
348
|
+
editing, // whether the row is open
|
|
349
|
+
intent: 'update',
|
|
350
|
+
record: row, // the row's form values as the page reads them
|
|
351
|
+
version: row.version, // and its version
|
|
352
|
+
toRequest: (values, openedOn) => ({ id: row.id, input: values, version: openedOn }),
|
|
353
|
+
onSaved: closeRow,
|
|
354
|
+
});
|
|
355
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
`@softistx/alxia-react-router` serves a React Router **framework-mode** app with
|
|
4
|
+
server rendering from an alxia app, under Bun. This page covers starting one:
|
|
5
|
+
a new app with `bunx @softistx/alxia-create`, the official template with alxia added
|
|
6
|
+
to it, or an app you already have.
|
|
7
|
+
|
|
8
|
+
## A new app: `bunx @softistx/alxia-create`
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
bunx @softistx/alxia-create my-app --template react-router
|
|
12
|
+
cd my-app
|
|
13
|
+
bun dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
[`@softistx/alxia-create`](https://www.npmjs.com/package/@softistx/alxia-create) copies React
|
|
17
|
+
Router's official template with alxia's layer already applied: the steps
|
|
18
|
+
of the next section, done.
|
|
19
|
+
|
|
20
|
+
- `@softistx/alxia` and `@softistx/alxia-react-router` installed, and every dependency
|
|
21
|
+
moved to the newest release alxia accepts (see
|
|
22
|
+
[`@softistx/alxia-create`'s Versions](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#versions));
|
|
23
|
+
- `alxia()` in `vite.config.ts`, the `bunfig.toml`, and `start` running
|
|
24
|
+
`NODE_ENV=production bun build/server/index.js`;
|
|
25
|
+
- Biome, with `lint`, `format`, `check`, `check:ci` and `verify` scripts;
|
|
26
|
+
- a `Dockerfile` that builds on `oven/bun:1` and runs `build/` alone on
|
|
27
|
+
`oven/bun:1-alpine`, as [Deploying](deploying.md#deploying) describes.
|
|
28
|
+
|
|
29
|
+
`bun run verify` checks, typechecks and builds it.
|
|
30
|
+
[`@softistx/alxia-create`'s guide](https://github.com/softistx/alxia/blob/develop/packages/create/docs/guide.md#running-it)
|
|
31
|
+
lists the command's options. The template keeps `@react-router/serve` in its
|
|
32
|
+
dependencies, unused: remove it if you like.
|
|
33
|
+
|
|
34
|
+
## An existing React Router app
|
|
35
|
+
|
|
36
|
+
Start from React Router's official template, or your own app:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
bunx create-react-router@latest my-app
|
|
40
|
+
cd my-app
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then make three changes.
|
|
44
|
+
|
|
45
|
+
**1. Install** alxia and this package:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bun add @softistx/alxia @softistx/alxia-react-router
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**2. Add `alxia()`** to the plugins in `vite.config.ts`:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// vite.config.ts
|
|
55
|
+
import { alxia } from '@softistx/alxia-react-router/vite';
|
|
56
|
+
import { reactRouter } from '@react-router/dev/vite';
|
|
57
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
58
|
+
import { defineConfig } from 'vite';
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
plugins: [tailwindcss(), reactRouter(), alxia()],
|
|
62
|
+
resolve: {
|
|
63
|
+
tsconfigPaths: true,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The order does not matter. The plugin always runs before React Router's:
|
|
69
|
+
React Router's build reads its server input from it, and its dev
|
|
70
|
+
middleware must come after alxia's.
|
|
71
|
+
|
|
72
|
+
**3. Start with Bun**, in `package.json`:
|
|
73
|
+
|
|
74
|
+
```jsonc
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "react-router build",
|
|
77
|
+
"dev": "react-router dev",
|
|
78
|
+
"start": "NODE_ENV=production bun build/server/index.js",
|
|
79
|
+
"typecheck": "react-router typegen && tsc"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Only `start` changes. The `react-router` and `vite` CLIs start with
|
|
84
|
+
`#!/usr/bin/env node`, so where a node is installed `bun run` would run
|
|
85
|
+
them on Node, and alxia's server needs Bun. A `bunfig.toml` beside
|
|
86
|
+
`package.json` makes `bun run` start them on Bun, for every script:
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
# bunfig.toml, beside package.json
|
|
90
|
+
[run]
|
|
91
|
+
bun = true
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then `bun run dev`, `bun run build` and `bun run typecheck` work as they
|
|
95
|
+
are, with or without a node installed. Without that file, run them as
|
|
96
|
+
`bun --bun react-router dev`. The plugin refuses a dev or preview server
|
|
97
|
+
running on Node at startup, rather than failing on the first request:
|
|
98
|
+
see [the troubleshooting entry](../troubleshooting.md#alxia-react-router--is-running-on-node-and-alxias-server-runs-on-bun-). The
|
|
99
|
+
template's `@react-router/serve` is no longer used, and you can remove it.
|
|
100
|
+
|
|
101
|
+
What the template keeps:
|
|
102
|
+
|
|
103
|
+
- `@react-router/node`, which React Router's default `entry.server`
|
|
104
|
+
renders with: it streams under Bun.
|
|
105
|
+
- Vite 7 or 8 (the template ships 8).
|
|
106
|
+
- With `bunx create-react-router`, its `typescript` 5.9. This package's
|
|
107
|
+
peer asks for 6 or 7, so `bun add` warns, but the template's code
|
|
108
|
+
typechecks with 5.9. `bun add -d typescript@^6` silences the warning;
|
|
109
|
+
`bunx @softistx/alxia-create` writes 6 or 7 already.
|
|
110
|
+
|
|
111
|
+
React Router 8 is required: its loaders receive a `RouterContextProvider`,
|
|
112
|
+
and alxia's context is set on it.
|