@softistx/alxia-react-router 0.0.0-stage → 0.83.0
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,325 @@
|
|
|
1
|
+
# Per-role flow docs and a help panel
|
|
2
|
+
|
|
3
|
+
An app documents, for each role, its flows screen by screen: what you see, what
|
|
4
|
+
you do, with a screenshot per step. The docs are Markdown files in the app's
|
|
5
|
+
repository, reviewed in pull requests and bundled at build time.
|
|
6
|
+
`@softistx/alxia-react-router/help` loads and validates them and answers the flows of the
|
|
7
|
+
screen the user is on, in the shape of the `HelpSheet` of `@softistx/material`.
|
|
8
|
+
`@softistx/alxia-react-router/help/check` is the check for the green bar.
|
|
9
|
+
|
|
10
|
+
`react` and `react-router` are the only imports of `/help`; `/help/check` reads
|
|
11
|
+
files and runs in Bun (or Node with TypeScript support for `routes.ts`), never in the page. Files in `docs/flows` that are not named `<name>.<lang>.md` are ignored by the loader and the check.
|
|
12
|
+
|
|
13
|
+
## The files
|
|
14
|
+
|
|
15
|
+
One flow per file, in `docs/flows/`, named `<name>.<lang>.md` (`editor.fr.md`,
|
|
16
|
+
`owner-members.en.md`). The language is the one in the name.
|
|
17
|
+
|
|
18
|
+
````md
|
|
19
|
+
---
|
|
20
|
+
id: editor-create-content
|
|
21
|
+
title: Create a post
|
|
22
|
+
roles: [editor, owner]
|
|
23
|
+
routes:
|
|
24
|
+
- routes/posts.new
|
|
25
|
+
- routes/posts.edit
|
|
26
|
+
captures:
|
|
27
|
+
- step: 1
|
|
28
|
+
name: new-post-form
|
|
29
|
+
alt: The new post form, empty
|
|
30
|
+
- step: 3
|
|
31
|
+
name: post-saved
|
|
32
|
+
alt: The post page after saving
|
|
33
|
+
---
|
|
34
|
+
You write a post and send it to review.
|
|
35
|
+
|
|
36
|
+
## Open the form
|
|
37
|
+
|
|
38
|
+
Click **New post** in the header.
|
|
39
|
+
|
|
40
|
+
## Write the post
|
|
41
|
+
|
|
42
|
+
Fill in the title and the body.
|
|
43
|
+
|
|
44
|
+
## Save
|
|
45
|
+
|
|
46
|
+
Press **Save**: the post is a draft until you submit it.
|
|
47
|
+
````
|
|
48
|
+
|
|
49
|
+
### Front-matter
|
|
50
|
+
|
|
51
|
+
| key | | |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| `id` | required | lowercase words joined by `-`, `_` or `.`; unique per language |
|
|
54
|
+
| `title` | required | the flow's name in the panel |
|
|
55
|
+
| `roles` | required | the roles the flow is for, a list of strings (your own role names) |
|
|
56
|
+
| `routes` | required unless `overview: true` | the React Router **route ids** the flow covers: the file of the route without its extension (`routes/posts.new`), or its `id` in `routes.ts` |
|
|
57
|
+
| `overview` | optional | `true` for a role's overview: the flow shown when no flow covers the screen. It cites no route |
|
|
58
|
+
| `captures` | optional | a list of `{ step, name, alt }`: the 1-based step, the capture's base name, and its alt text (required) |
|
|
59
|
+
|
|
60
|
+
An unknown key is an error, so a typo does not go unnoticed. The front-matter is
|
|
61
|
+
a small YAML: `key: value`, inline lists (`[a, b]`), block lists and block lists
|
|
62
|
+
of maps as above, `"quoted"` or `'quoted'` strings and `# comments`.
|
|
63
|
+
|
|
64
|
+
### Steps
|
|
65
|
+
|
|
66
|
+
The text before the first `##` is the flow's intro (`body`). Each `##` section
|
|
67
|
+
is a numbered step: its heading is the step's title and its Markdown the step's
|
|
68
|
+
body. A `##` inside a fenced code block is not a heading. A step has at most
|
|
69
|
+
one capture, and the Markdown is returned as written: the UI renders it.
|
|
70
|
+
|
|
71
|
+
### Captures
|
|
72
|
+
|
|
73
|
+
A capture is four WebP files in `docs/flows/captures/`, committed:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
<name>.1440.light.webp <name>.1440.dark.webp
|
|
77
|
+
<name>.360.light.webp <name>.360.dark.webp
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The panel picks the variant for the user's theme and width. The files are taken
|
|
81
|
+
by the flow's e2e spec, never generated at build time. A missing variant is an
|
|
82
|
+
error for the build and for the check.
|
|
83
|
+
|
|
84
|
+
## Loading, at build time
|
|
85
|
+
|
|
86
|
+
The two globs are written in the app, because Vite reads them statically. They
|
|
87
|
+
make the flows and the captures part of the bundle; `loadHelpFlows` parses and
|
|
88
|
+
validates them, once, at module level:
|
|
89
|
+
|
|
90
|
+
```ts no-check
|
|
91
|
+
// app/help.ts
|
|
92
|
+
import { loadHelpFlows } from '@softistx/alxia-react-router/help';
|
|
93
|
+
|
|
94
|
+
export const help = loadHelpFlows({
|
|
95
|
+
docs: import.meta.glob('/docs/flows/*.md', {
|
|
96
|
+
query: '?raw',
|
|
97
|
+
import: 'default',
|
|
98
|
+
eager: true,
|
|
99
|
+
}),
|
|
100
|
+
captures: import.meta.glob('/docs/flows/captures/*.webp', {
|
|
101
|
+
query: '?url',
|
|
102
|
+
import: 'default',
|
|
103
|
+
eager: true,
|
|
104
|
+
}),
|
|
105
|
+
lang: 'fr',
|
|
106
|
+
fallbackLang: 'en',
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`lang` is the user's language; `fallbackLang` (default: none) fills the flow ids
|
|
111
|
+
a language has no file for, so keep a flow's `id` the same in every language.
|
|
112
|
+
Quote a title or alt text that contains ` #` (it starts a comment otherwise).
|
|
113
|
+
When a screen's flows are for roles the user does not have, `roles` is empty
|
|
114
|
+
and `otherRoles` lets the panel offer "see as…". `loadHelpFlows` throws a `FlowFormatError` on the first bad file,
|
|
115
|
+
and its message names the file and the line:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
docs/flows/editor.fr.md:4: front-matter "roles" must be a list of non-empty strings, e.g. roles: [a, b]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`captures` maps each variant to its URL; Vite's `?url` gives a hashed asset, and
|
|
122
|
+
the images are fetched only when the panel shows a step.
|
|
123
|
+
|
|
124
|
+
## In the page: `useHelpFlows`
|
|
125
|
+
|
|
126
|
+
```tsx no-check
|
|
127
|
+
// app/components/help-panel.tsx
|
|
128
|
+
import { useHelpFlows } from '@softistx/alxia-react-router/help';
|
|
129
|
+
import { help } from '../help';
|
|
130
|
+
|
|
131
|
+
export function HelpPanel({ roles }: { roles: readonly string[] }) {
|
|
132
|
+
const { flows, role, roles: tabs, allRoles, fallback } = useHelpFlows(help, { roles });
|
|
133
|
+
return <pre>{JSON.stringify({ role, tabs, allRoles, fallback, flows: flows.length })}</pre>;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The hook reads `useMatches()`: a flow covers the screen when it cites the id of
|
|
138
|
+
any current match, so a flow can cite a layout. It returns:
|
|
139
|
+
|
|
140
|
+
| field | |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| `flows` | the flows covering the screen (`HelpFlow[]`: `id`, `title`, `roles`, `body`, `steps`, each step with `index`, `title`, `body` and `capture`). When no flow covers it, the roles' overviews |
|
|
143
|
+
| `fallback` | `true` when `flows` are the overviews |
|
|
144
|
+
| `roles` | the user's roles that have a flow in `flows`, in the order you passed them: the tabs |
|
|
145
|
+
| `role` | the tab to open first: the first of `roles`, `undefined` when none |
|
|
146
|
+
| `allRoles`, `otherRoles` | every role with a flow in `flows`, and those the user does not have: "see as…" |
|
|
147
|
+
|
|
148
|
+
A `capture` is `{ name, alt, light: { 360, 1440 }, dark: { 360, 1440 } }`, the
|
|
149
|
+
URLs of the four variants. `resolveHelp(help, routeIds, roles)` is the same
|
|
150
|
+
without React, for a loader or a test.
|
|
151
|
+
|
|
152
|
+
## The lazy panel: `HelpPanel`
|
|
153
|
+
|
|
154
|
+
`HelpPanel` is the help button with its sheet, loaded on the first open: the
|
|
155
|
+
flows (`load`, a dynamic import of `app/help.ts`) and the sheet's chunk
|
|
156
|
+
(`loadSheet`) come together, so the docs stay out of the shell's bundle. It is
|
|
157
|
+
headless (no UI library is a peer): the button and the sheet are yours, for
|
|
158
|
+
example `HelpButton` and `HelpSheet` of `@softistx/material`.
|
|
159
|
+
|
|
160
|
+
```tsx no-check
|
|
161
|
+
// app/components/help-panel.tsx
|
|
162
|
+
import { HelpPanel } from '@softistx/alxia-react-router/help';
|
|
163
|
+
import { toast } from './toast'; // your toast helper
|
|
164
|
+
|
|
165
|
+
// `language` and `roles` come from your session or loader data.
|
|
166
|
+
export function AppHelp({ language, roles }: { language: string; roles: string[] }) {
|
|
167
|
+
return (
|
|
168
|
+
<HelpPanel
|
|
169
|
+
// app/help.ts exports `bundle`: { fr: loadHelpFlows({ …, lang: 'fr' }), en: … }
|
|
170
|
+
load={() => import('../help').then((m) => m.bundle)}
|
|
171
|
+
loadSheet={() => import('./help-sheet')}
|
|
172
|
+
language={language}
|
|
173
|
+
roles={roles}
|
|
174
|
+
renderButton={({ onOpen, open, loading }) => (
|
|
175
|
+
<button type="button" aria-expanded={open} aria-busy={loading} onClick={onOpen}>
|
|
176
|
+
Help
|
|
177
|
+
</button>
|
|
178
|
+
)}
|
|
179
|
+
onLoadError={() => toast.error('The help could not be loaded')}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`./help-sheet` default-exports a component taking `HelpPanelSheetProps`:
|
|
186
|
+
|
|
187
|
+
```tsx no-check
|
|
188
|
+
// app/components/help-sheet.tsx
|
|
189
|
+
import type { HelpPanelSheetProps } from '@softistx/alxia-react-router/help';
|
|
190
|
+
import { HelpSheet } from '@softistx/material/components';
|
|
191
|
+
|
|
192
|
+
export default function Sheet({ help, roles, open, onOpenChange }: HelpPanelSheetProps) {
|
|
193
|
+
return <HelpSheet open={open} onOpenChange={onOpenChange} flows={help.flows} roles={roles} />;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Passing data to the sheet: `sheetProps`
|
|
198
|
+
|
|
199
|
+
The sheet often needs something only the screen knows (the current record, say,
|
|
200
|
+
to preselect a flow). `sheetProps` hands it over, typed by the sheet's own
|
|
201
|
+
props: `HelpPanel` is generic over the props of the sheet `loadSheet` resolves.
|
|
202
|
+
`sheetProps` is required when the sheet declares required props beyond
|
|
203
|
+
`HelpPanelSheetProps`, optional when all of them are optional, and not allowed
|
|
204
|
+
for a sheet without extras.
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
// app/components/help-sheet.tsx
|
|
208
|
+
import type { HelpPanelSheetProps } from '@softistx/alxia-react-router/help';
|
|
209
|
+
|
|
210
|
+
export default function Sheet({
|
|
211
|
+
help,
|
|
212
|
+
open,
|
|
213
|
+
onOpenChange,
|
|
214
|
+
itemId,
|
|
215
|
+
}: HelpPanelSheetProps & { itemId: string }) {
|
|
216
|
+
if (!open) return null;
|
|
217
|
+
return (
|
|
218
|
+
<aside aria-label="Help">
|
|
219
|
+
<p>Help for item {itemId}</p>
|
|
220
|
+
<p>{help.flows.length} flows</p>
|
|
221
|
+
<button type="button" onClick={() => onOpenChange(false)}>
|
|
222
|
+
Close
|
|
223
|
+
</button>
|
|
224
|
+
</aside>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```tsx no-check
|
|
230
|
+
// app/components/help-panel.tsx
|
|
231
|
+
<HelpPanel
|
|
232
|
+
load={() => import('../help').then((m) => m.bundle)}
|
|
233
|
+
loadSheet={() => import('./help-sheet')}
|
|
234
|
+
sheetProps={{ itemId }}
|
|
235
|
+
/* language, roles, renderButton, onLoadError as above */
|
|
236
|
+
/>;
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`sheetProps` follows every render (an open sheet sees the new value), and it
|
|
240
|
+
is spread first: it can never override `help`, `roles`, `open` or
|
|
241
|
+
`onOpenChange`. A type error on `sheetProps` means it does not match what the
|
|
242
|
+
sheet declares. No React context of your own is needed.
|
|
243
|
+
|
|
244
|
+
`help` is the flows of `language`, or of `fallbackLanguage` (default `en`). A
|
|
245
|
+
failure of either import (or a `loadSheet` module without a default export)
|
|
246
|
+
calls `onLoadError` once, closes the panel, and the next open retries; opening
|
|
247
|
+
twice while loading loads once. A throwing `load` counts too, and so does a
|
|
248
|
+
throwing `onLoadError`: the panel is never stuck. Nothing is reported after an
|
|
249
|
+
unmount. With no `roles` nothing is rendered. A bundle with neither `language`
|
|
250
|
+
nor `fallbackLanguage` leaves the button on `loading` (see
|
|
251
|
+
[troubleshooting](../troubleshooting.md)).
|
|
252
|
+
|
|
253
|
+
## The role guide: `useGuideRole`
|
|
254
|
+
|
|
255
|
+
`useGuideRole` holds the state of a role guide reader: the picked role (always
|
|
256
|
+
one of `roles`; a role that leaves the list falls back to the first) and the
|
|
257
|
+
PDF URL for it. The sheet, the role picker and the PDF reader are yours (it
|
|
258
|
+
takes no PDF library). `highestGuideRole(roles, order)` gives the role to open
|
|
259
|
+
on: the first of `order` (highest first) the viewer may read, else their first
|
|
260
|
+
role, and with `roles` empty the last of `order` (or a third `fallback`
|
|
261
|
+
argument).
|
|
262
|
+
|
|
263
|
+
```tsx no-check
|
|
264
|
+
import { highestGuideRole, useGuideRole } from '@softistx/alxia-react-router/help';
|
|
265
|
+
|
|
266
|
+
// `guideRoles` and `language` come from your session or loader data.
|
|
267
|
+
export function GuideReader({ guideRoles, language }: { guideRoles: string[]; language: string }) {
|
|
268
|
+
const { role, roles, canPick, setRole, file } = useGuideRole({
|
|
269
|
+
roles: guideRoles,
|
|
270
|
+
initialRole: highestGuideRole(guideRoles, ['admin', 'author', 'learner']),
|
|
271
|
+
guideUrl: (r) =>
|
|
272
|
+
`/help/guide.pdf?role=${encodeURIComponent(r)}&lang=${encodeURIComponent(language)}`,
|
|
273
|
+
});
|
|
274
|
+
return (
|
|
275
|
+
<>
|
|
276
|
+
{canPick ? (
|
|
277
|
+
<select value={role} onChange={(e) => setRole(e.target.value)}>
|
|
278
|
+
{roles.map((id) => <option key={id}>{id}</option>)}
|
|
279
|
+
</select>
|
|
280
|
+
) : null}
|
|
281
|
+
<MyPdfReader key={file} file={file} />
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## The coverage check
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
bunx alxia-react-router help check --ignore 'routes/api.*,routes/logout'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
It reads `app/routes.ts` (the default export, awaited) and `docs/flows`, and
|
|
294
|
+
fails, with one line per problem, when:
|
|
295
|
+
|
|
296
|
+
- a **screen route** (a route with no children) is covered by no flow: neither it
|
|
297
|
+
nor any layout above it is cited by one, as `useHelpFlows` shows a flow on every
|
|
298
|
+
screen under a layout it cites. Cite a layout to cover its whole subtree
|
|
299
|
+
(`routes: [routes/patients]`) instead of listing each leaf. Layouts are not
|
|
300
|
+
screens themselves. `--ignore` lists the ids (`*` matches any run of characters) that
|
|
301
|
+
need no flow: resource routes, redirects;
|
|
302
|
+
- a flow cites a **route that is not in the route config**;
|
|
303
|
+
- a flow cites a **capture** whose four WebP variants are not all there;
|
|
304
|
+
- a flow file does not parse, or an `--ignore` entry matches no route.
|
|
305
|
+
|
|
306
|
+
`--routes <file>` and `--flows <dir>` change the two paths. The same check is a
|
|
307
|
+
function, for a spec or a script:
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
import { checkHelp } from '@softistx/alxia-react-router/help/check';
|
|
311
|
+
|
|
312
|
+
const { ok, problems, flows, screens } = await checkHelp({ ignore: ['routes/api.*'] });
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Options: `root` (default the current directory), `routes`, `flows`, `ignore` and
|
|
316
|
+
`config` (the route entries, instead of reading `routes`). It resolves to
|
|
317
|
+
`{ ok, problems, flows, screens }`: each problem is `{ kind, message }`, `kind`
|
|
318
|
+
being `uncovered-route`, `unknown-route`, `missing-capture`, `bad-flow` or
|
|
319
|
+
`unused-ignore`.
|
|
320
|
+
|
|
321
|
+
`routes.ts` is run as the CLI's own module (Bun), so it must not need Vite's
|
|
322
|
+
plugin context: `route()`, `index()`, `layout()` and `prefix()` are fine,
|
|
323
|
+
`flatRoutes()` is not. Pass `config` to `checkHelp` the routes you built another way.
|
|
324
|
+
|
|
325
|
+
Add it to the app's `verify` script, beside lint, typecheck and the tests.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# How it works
|
|
2
|
+
|
|
3
|
+
This page covers what the plugin does in dev, in a build and under
|
|
4
|
+
`vite preview`, and what it sets so the build runs on Bun with no
|
|
5
|
+
`node_modules`.
|
|
6
|
+
|
|
7
|
+
With no `app/server.ts`, the plugin serves the app with
|
|
8
|
+
`createServer()`, from this package, with no options: a fresh alxia app,
|
|
9
|
+
the client's files, and the pages as a catch-all behind it.
|
|
10
|
+
|
|
11
|
+
## In dev
|
|
12
|
+
|
|
13
|
+
`react-router dev` starts Vite's server. Vite answers its own requests
|
|
14
|
+
first: modules, `/@fs/…`, `public/`, the HMR socket. The plugin hands
|
|
15
|
+
every other request to the server: pages, single-fetch data, and alxia's
|
|
16
|
+
routes. The server is loaded through Vite's SSR runner, so:
|
|
17
|
+
|
|
18
|
+
- **HMR** works as in any React Router app: a component edit reaches the
|
|
19
|
+
browser over Vite's socket.
|
|
20
|
+
- **An edit to `app/server.ts`, or to a module it imports, is live on the
|
|
21
|
+
next request**, with no restart: the runner reloads what changed.
|
|
22
|
+
- **Creating or deleting `app/server.ts`** takes effect on the next
|
|
23
|
+
request.
|
|
24
|
+
- **The app's own context keys work**: the server and the routes are one
|
|
25
|
+
module graph. See [The app's own context keys](typing-the-loaders.md#the-apps-own-context-keys).
|
|
26
|
+
- **Errors** go to Vite's error page, with the stack mapped to the source.
|
|
27
|
+
- **alxia's `ws` routes connect**: an upgrade Vite's HMR does not claim
|
|
28
|
+
goes to the app, as from the build. See [WebSockets](beside-the-pages.md#websockets).
|
|
29
|
+
|
|
30
|
+
HTTP requests reach the app through `app.fetch`, not through `listen`,
|
|
31
|
+
given the loopback server the sockets are relayed to as `ctx.server`
|
|
32
|
+
([The server](typing-the-loaders.md#the-server-server)). So `page()` is not served in dev; see
|
|
33
|
+
[the troubleshooting entry](../troubleshooting.md#a-page-is-not-served-under-react-router-dev).
|
|
34
|
+
|
|
35
|
+
## In a build
|
|
36
|
+
|
|
37
|
+
`react-router build` builds the client as usual. It builds the server
|
|
38
|
+
from `app/server.ts`, or from the default server, with React Router's
|
|
39
|
+
server build inside it, into one file:
|
|
40
|
+
|
|
41
|
+
- **`build/server/index.js`'s default export is the alxia app.** Beside it
|
|
42
|
+
are React Router's own exports, so the file is a server build too, and
|
|
43
|
+
React Router's `prerender` reads it. The server file's other exports
|
|
44
|
+
stay out of it.
|
|
45
|
+
- **Run, it listens**: `bun build/server/index.js` listens on `PORT`
|
|
46
|
+
(3000 by default) and `HOST` (`0.0.0.0`). It prints
|
|
47
|
+
`alxia listening on <url>`, and in dev — under `react-router dev`; a
|
|
48
|
+
production build never is, whatever `NODE_ENV` says — the route table
|
|
49
|
+
([`@softistx/alxia`'s Development](https://github.com/softistx/alxia/blob/develop/packages/core/docs/guide/development.md#the-route-table)). On `SIGINT` or `SIGTERM` it shuts the app
|
|
50
|
+
down as `@softistx/alxia`'s `listen` does: readiness turns 503, new
|
|
51
|
+
connections are refused, the requests in flight finish within
|
|
52
|
+
`shutdownTimeout` (10 s; `listen: { shutdownTimeout }` sets it), the
|
|
53
|
+
`onStop` hooks run, and the process exits
|
|
54
|
+
([core's guide](https://github.com/softistx/alxia/blob/develop/packages/core/docs/guide/health-and-shutdown.md)).
|
|
55
|
+
- **Imported, it starts nothing**: prerendering, a test or another server
|
|
56
|
+
can import it safely, since it listens only when it is the process's
|
|
57
|
+
entry point (`import.meta.main`).
|
|
58
|
+
- **The mode follows the command**: `development` under `react-router dev`,
|
|
59
|
+
`production` in a build, whatever `NODE_ENV` says. The app's dev switch
|
|
60
|
+
follows it: `alxia({ dev: mode === 'development' })`, so a 500 of the
|
|
61
|
+
build never shows its stack.
|
|
62
|
+
- **The client folder is resolved against the built file**: `../client`,
|
|
63
|
+
from React Router's `buildDirectory`, so it is found wherever the
|
|
64
|
+
process starts.
|
|
65
|
+
- **It is self-contained**: every package the server imports, React,
|
|
66
|
+
React Router and alxia included, is bundled into it
|
|
67
|
+
([Self-contained](#self-contained)), so `build/` runs with no
|
|
68
|
+
`node_modules`.
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
bun run build
|
|
72
|
+
PORT=8080 bun run start
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After React Router's builder has written the client, the plugin builds the
|
|
76
|
+
service worker when the app has an `app/service-worker.ts` (`worker: false`
|
|
77
|
+
turns it off): `build/client/service-worker.js`, with the precache list read
|
|
78
|
+
from the client build ([the PWA guide](pwa.md#zero-config-alxia-builds-it)).
|
|
79
|
+
|
|
80
|
+
Then it writes the compressed copies of the client build, `.br` and `.gz`
|
|
81
|
+
beside each compressible file, which the server serves to a browser that
|
|
82
|
+
accepts them ([the client's files](beside-the-pages.md#compressed)).
|
|
83
|
+
`precompress: false` turns it off, `precompress: { minSize }` moves the 1 kB
|
|
84
|
+
threshold.
|
|
85
|
+
|
|
86
|
+
React Router's `serverBundles` split the server build in several, and
|
|
87
|
+
alxia serves one: the plugin refuses them. With `ssr: false`, a
|
|
88
|
+
single-page app, the plugin does nothing but build the service worker (when
|
|
89
|
+
`app/service-worker.ts` exists).
|
|
90
|
+
|
|
91
|
+
## Under `vite preview`
|
|
92
|
+
|
|
93
|
+
After a build, Vite's preview server serves the built server:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
bun run build
|
|
97
|
+
bunx --bun vite preview
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`--bun` runs Vite under Bun even where Node is installed, since Vite's bin
|
|
101
|
+
asks for Node: the built server runs inside Vite's process, and it needs
|
|
102
|
+
Bun's APIs. With the [`bunfig.toml`](getting-started.md#an-existing-react-router-app) (`[run]`,
|
|
103
|
+
`bun = true`), or with no Node installed, a `"preview": "vite preview"`
|
|
104
|
+
script run with `bun run preview` works too, as the template's other
|
|
105
|
+
scripts do.
|
|
106
|
+
|
|
107
|
+
The plugin loads `build/server/index.js` on the first request and hands
|
|
108
|
+
every request to its default export, the alxia app, before Vite's own
|
|
109
|
+
files. So the preview answers as `bun run start` does: the pages and their
|
|
110
|
+
data, `/api`, `build/client` with the cache headers of
|
|
111
|
+
[the client's files](beside-the-pages.md#the-clients-files), and every middleware of `beforeAll`
|
|
112
|
+
and `configure`. Requests, their bodies and every `Set-Cookie` pass
|
|
113
|
+
through whole, and pages stream.
|
|
114
|
+
|
|
115
|
+
What differs from `bun run start`:
|
|
116
|
+
|
|
117
|
+
- **Vite listens**, on `preview.port` (4173), `preview.host` and
|
|
118
|
+
`preview.https`. `listen`, `onListen`, `PORT` and `HOST` are not read.
|
|
119
|
+
- **Requests arrive through `app.fetch`**, as under `react-router dev`:
|
|
120
|
+
`page()` and an HTTP request's `ctx.server` are absent. alxia's `ws`
|
|
121
|
+
routes connect, relayed to a `Bun.serve` of the built app as in dev
|
|
122
|
+
([WebSockets](beside-the-pages.md#websockets)); an upgrade `preview.proxy` relays stays
|
|
123
|
+
Vite's.
|
|
124
|
+
- **Vite's preview options that come after the plugin never run**:
|
|
125
|
+
`preview.proxy` for HTTP requests, `preview.headers` and Vite's file
|
|
126
|
+
serving.
|
|
127
|
+
`preview.cors` and `preview.allowedHosts` still apply. alxia adds `DEV_ALLOWED_HOSTS` and `alxia({ allowedHosts })` to these; see the README's Dev tunnels section.
|
|
128
|
+
- **The build is loaded once**: after `bun run build` again, restart the
|
|
129
|
+
preview.
|
|
130
|
+
|
|
131
|
+
React Router prerenders the `prerender` paths of `react-router.config.ts`
|
|
132
|
+
through the same preview server, during `react-router build`. A
|
|
133
|
+
prerendered page is therefore rendered by the built server too: its loader
|
|
134
|
+
reads `alxiaOf(context)` and `getLoadContext`'s keys, and `beforeAll`'s
|
|
135
|
+
and `configure`'s middlewares run around it.
|
|
136
|
+
|
|
137
|
+
## Built for Bun
|
|
138
|
+
|
|
139
|
+
`build/server/index.js` runs on Bun, and the plugin builds it for Bun,
|
|
140
|
+
with nothing to configure. It adds to Vite's `ssr` environment, under
|
|
141
|
+
`react-router dev` and `react-router build` alike but for the last row,
|
|
142
|
+
the build's alone:
|
|
143
|
+
|
|
144
|
+
| option | what the plugin adds | why |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| `resolve.conditions` | `bun` | a package bundled into the server whose `exports` has a `bun` condition is bundled as its Bun variant |
|
|
147
|
+
| `resolve.externalConditions` | `bun` | a dependency left external, as every one is in dev and one the app names in `ssr.external` is in the build, is loaded as its Bun variant, as Bun loads it |
|
|
148
|
+
| `resolve.builtins` | `bun`, and `bun:*` (`bun:sqlite`, `bun:ffi`, …) | Bun's own modules stay imports of the build, whichever runtime runs Vite. Vite knows `bun:*`, and bare `bun` only when it runs on Bun |
|
|
149
|
+
| `build.target` | `esnext` | the newest syntax is left as written: Bun runs it, and Vite's default targets browsers |
|
|
150
|
+
| `resolve.noExternal` | `true`, under `react-router build` only | every package is bundled into `build/server/index.js`, so `build/` runs with no `node_modules` ([Self-contained](#self-contained)) |
|
|
151
|
+
|
|
152
|
+
A package written for Bun, then, gives the build the variant Bun would
|
|
153
|
+
load, and Bun's own modules are used as they are:
|
|
154
|
+
|
|
155
|
+
```jsonc
|
|
156
|
+
// node_modules/some-package/package.json
|
|
157
|
+
{ "exports": { "bun": "./bun.js", "default": "./node.js" } }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
// app/server.ts
|
|
162
|
+
import { createServer } from '@softistx/alxia-react-router';
|
|
163
|
+
import { Database } from 'bun:sqlite';
|
|
164
|
+
|
|
165
|
+
const db = new Database(':memory:');
|
|
166
|
+
|
|
167
|
+
export default createServer({
|
|
168
|
+
configure: (app) =>
|
|
169
|
+
app.get('/api/count', ({ reply }) =>
|
|
170
|
+
reply.ok(db.query('select sqlite_version() as version').get()),
|
|
171
|
+
),
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
// build/server/index.js, in part
|
|
177
|
+
import { Database } from "bun:sqlite";
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Which variant wins is still the package's own order: `exports` is read
|
|
181
|
+
top to bottom, and the first condition the build has wins. A package that
|
|
182
|
+
lists `node` before `bun` gives its Node variant, as Bun itself would load
|
|
183
|
+
it.
|
|
184
|
+
|
|
185
|
+
What the plugin leaves alone:
|
|
186
|
+
|
|
187
|
+
- **`ssr.target` stays `node`.** Bun runs Node's modules, and `node`
|
|
188
|
+
keeps `node:*` external and resolves packages as a server does;
|
|
189
|
+
`webworker` would bundle every dependency with the browser's conditions.
|
|
190
|
+
An app that sets `ssr.target: 'webworker'` itself gets none of the
|
|
191
|
+
above: that environment keeps Vite's own defaults.
|
|
192
|
+
- **No polyfill is added.** Vite adds none to a server build, and the
|
|
193
|
+
plugin adds none.
|
|
194
|
+
- **The client build** is a browser's, as before: none of this reaches
|
|
195
|
+
it. A Bun module imported by code that reaches the client is replaced
|
|
196
|
+
by an empty module there: Vite 7 fails the build, Vite 8 fails in the
|
|
197
|
+
browser ([troubleshooting](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/troubleshooting.md#module--has-been-externalized-for-browser-compatibility-imported-by-)).
|
|
198
|
+
|
|
199
|
+
What the app sets wins. The plugin adds to the `ssr` environment once
|
|
200
|
+
every plugin's `config` has run, and Vite merges what it adds by
|
|
201
|
+
concatenating arrays, so conditions and builtins of the app's own are
|
|
202
|
+
kept, and `bun` is added only when they lack it. A `build.target`, at the
|
|
203
|
+
top level or on the environment, is kept as it is:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
// vite.config.ts
|
|
207
|
+
export default defineConfig({
|
|
208
|
+
// Kept: the build resolves `worker`, then `bun`, and targets es2022.
|
|
209
|
+
environments: {
|
|
210
|
+
ssr: {
|
|
211
|
+
resolve: { conditions: ['worker'] },
|
|
212
|
+
build: { target: 'es2022' },
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
plugins: [reactRouter(), alxia()],
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`ssr.resolve.conditions` at the top level is the same option, and is kept
|
|
220
|
+
the same way.
|
|
221
|
+
|
|
222
|
+
### Self-contained
|
|
223
|
+
|
|
224
|
+
Under `react-router build`, the plugin sets `resolve.noExternal: true` on
|
|
225
|
+
the `ssr` environment: Vite bundles every package the server imports into
|
|
226
|
+
`build/server/index.js`, where it would otherwise leave each one under
|
|
227
|
+
`node_modules` as an `import`. What the file still imports is Node's and
|
|
228
|
+
Bun's own modules:
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
// build/server/index.js, its imports
|
|
232
|
+
import { createRequire } from "node:module";
|
|
233
|
+
import { PassThrough } from "node:stream";
|
|
234
|
+
// … and no "react", "react-router" or "@softistx/alxia"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
So `build/` is all a server needs, beside Bun: a Docker image's last
|
|
238
|
+
stage copies it alone ([Docker](deploying.md#docker)). React and `react-dom/server`,
|
|
239
|
+
React Router, alxia and its plugins bundle as they are, CommonJS included;
|
|
240
|
+
the `bun` condition above picks each package's Bun variant. One copy of
|
|
241
|
+
each package is in the file, so `alxiaContext` and the app's own keys are
|
|
242
|
+
one object for the server and the routes. React Router's prerendering and
|
|
243
|
+
`vite preview` load the same file.
|
|
244
|
+
|
|
245
|
+
`react-router dev` is left as it was: Vite's SSR runner loads the
|
|
246
|
+
packages from `node_modules`.
|
|
247
|
+
|
|
248
|
+
What the app sets wins. Vite reads `external` before `noExternal`:
|
|
249
|
+
|
|
250
|
+
- **`ssr.external: ['sharp']`**, or the same on
|
|
251
|
+
`environments.ssr.resolve.external`, keeps those packages external,
|
|
252
|
+
imported from `node_modules` at runtime. Use it for a package that
|
|
253
|
+
cannot be bundled: a native addon (a `.node` file), or one that reads
|
|
254
|
+
files of its own folder at runtime. The image must then hold that
|
|
255
|
+
package ([Docker](deploying.md#docker)).
|
|
256
|
+
- **`ssr.external: true`** keeps every package external, Vite's own
|
|
257
|
+
behaviour: the plugin adds no `noExternal` then, and the server needs
|
|
258
|
+
the production `node_modules` beside `build/`.
|
|
259
|
+
- **`ssr.noExternal`**, a list, changes nothing: everything is bundled
|
|
260
|
+
already.
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
// vite.config.ts
|
|
264
|
+
export default defineConfig({
|
|
265
|
+
// Bundled but for sharp, a native addon.
|
|
266
|
+
ssr: { external: ['sharp'] },
|
|
267
|
+
plugins: [reactRouter(), alxia()],
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
A package the build could not bundle and was not told to leave external
|
|
272
|
+
fails at runtime, from `build/` alone, with Bun's
|
|
273
|
+
`Cannot find package '…'`: see
|
|
274
|
+
[the troubleshooting entry](../troubleshooting.md#error-cannot-find-package--from-appbuildserverindexjs).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Links through React Router
|
|
2
|
+
|
|
3
|
+
A UI library that renders its links through a component of its own (a
|
|
4
|
+
`LinkComponentProvider`) hands that component an `href` and spreads every other
|
|
5
|
+
prop onto the anchor. React Router's `Link` takes `to`, so an app adapts it.
|
|
6
|
+
`@softistx/alxia-react-router/link` exports that adapter. `react` and `react-router` are
|
|
7
|
+
its only imports, and it renders on the server.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// app/root.tsx
|
|
11
|
+
import { RouterLink } from '@softistx/alxia-react-router/link';
|
|
12
|
+
|
|
13
|
+
export default function App() {
|
|
14
|
+
return (
|
|
15
|
+
<LinkComponentProvider component={RouterLink}>
|
|
16
|
+
<Outlet />
|
|
17
|
+
</LinkComponentProvider>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What it does
|
|
23
|
+
|
|
24
|
+
- `href` (or `to`, React Router's own name, never both) is the destination: a
|
|
25
|
+
string or a `To` object.
|
|
26
|
+
- An external target (`https://…`, `mailto:`, `//host`) renders a plain anchor with that `href`; React Router's `Link` already handles it.
|
|
27
|
+
- `className`, `children`, `ref`, `aria-*`, `target` and every other anchor prop
|
|
28
|
+
reach the `<a>`.
|
|
29
|
+
- `Link`'s own props (`replace`, `prefetch`, `reloadDocument`, `state`, ...) still
|
|
30
|
+
apply, so a link can opt out of client-side navigation.
|
|
31
|
+
|
|
32
|
+
`RouterLinkProps` is the type of its props, for a wrapper of your own.
|