@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,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/fetcher/auth-refusal.ts", "../src/fetcher/section-save.ts", "../src/fetcher/use-debounced-fetcher.ts", "../src/fetcher/use-fetcher-done.ts", "../src/fetcher/use-form-refusal.ts", "../src/fetcher/use-revalidate-on-focus.ts", "../src/fetcher/use-row-save.ts", "../src/fetcher/use-section-save.ts", "../src/fetcher/section-form.ts", "../src/fetcher/section-reload.ts", "../src/fetcher/use-visible-interval.ts", "../src/fetcher/use-visible-revalidation.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * What an auth route action answers when the page stays: a message, a wait,\n * a field's word. `sent` marks the answer that is not a refusal.\n */\nexport type AuthAnswer = {\n\tsent?: boolean | undefined;\n\tformError?: string | undefined;\n\tretryAfter?: number | undefined;\n\tfieldErrors?: Readonly<Record<string, string | undefined>>;\n};\n\n/**\n * The refusal an auth form or notice takes back from its `onSubmit`:\n * `form` (the message above the form), `retryAfter` (seconds to wait) and\n * the field's word under its own name.\n */\nexport type AuthRefusal<F extends string = string> = {\n\tform?: string | undefined;\n\tretryAfter?: number | undefined;\n} & { [K in F]?: string | undefined };\n\n/**\n * Maps a route action's answer to the refusal shape of an auth form.\n * `fields` lists the names to carry over from `fieldErrors`; any other field\n * error is left out. Returns `undefined` for an answer that is not a refusal\n * (`sent` is true), so `return authRefusal(answer, [...])` accepts the form.\n */\nexport function authRefusal<const F extends string>(\n\tanswer: AuthAnswer,\n\tfields: readonly F[],\n): AuthRefusal<F> | undefined {\n\tif (answer.sent) return undefined;\n\tconst refusal: Record<string, string | number | undefined> = {\n\t\tform: answer.formError,\n\t\tretryAfter: answer.retryAfter,\n\t};\n\tfor (const field of fields) refusal[field] = answer.fieldErrors?.[field];\n\treturn refusal as AuthRefusal<F>;\n}\n",
|
|
6
|
+
"import type { FormErrors } from '../errors/form-errors';\nimport type { SectionResult } from '../errors/section-action';\n\n/** The refusal of a section save. */\nexport type SectionRefusal = Extract<SectionResult, { ok: false }>;\n\n/** The answer when it is a refusal, else `undefined`. */\nexport const refusalOf = (\n\tresult: SectionResult | undefined,\n): SectionRefusal | undefined => (result && !result.ok ? result : undefined);\n\n/**\n * The messages to put under the section's fields. The rest of a refusal, and\n * a stale version, are the section's notice.\n */\nexport function fieldErrorsOf(\n\tresult: SectionResult | undefined,\n): FormErrors | undefined {\n\tconst refusal = refusalOf(result);\n\tif (!refusal || refusal.stale) return undefined;\n\treturn { fieldErrors: refusal.fieldErrors };\n}\n\n/**\n * What a section shows above its fields, as data for the app's own\n * component: a version conflict (`stale`: the record changed since it was\n * read, `reload` reads it again and refills the form), or the refusal's\n * message when it has one beyond the field messages.\n */\nexport type SectionNotice =\n\t| { kind: 'stale'; reload: () => void }\n\t| { kind: 'error'; message: string };\n\n/** The notice of a refusal, or `undefined` when the field messages say it all. */\nexport function noticeOf(\n\trefusal: SectionRefusal | undefined,\n\treload: () => void,\n): SectionNotice | undefined {\n\tif (!refusal) return undefined;\n\tif (refusal.stale) return { kind: 'stale', reload };\n\treturn refusal.error ? { kind: 'error', message: refusal.error } : undefined;\n}\n",
|
|
7
|
+
"import {\n\tstartTransition,\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { useFetcher } from 'react-router';\n\n/** What `useFetcher<Data>` hands back as `data` (`Data` may be `typeof loader`). */\ntype FetcherData<Data> = ReturnType<typeof useFetcher<Data>>['data'];\n\n/** What `useDebouncedFetcher` is doing for the value typed. */\nexport type DebouncedFetcherState =\n\t/** Nothing to ask: disabled, or the value is shorter than `minLength`. */\n\t| 'idle'\n\t/** The value changed and the pause after the last change is running. */\n\t| 'waiting'\n\t/** The resource route is loading. */\n\t| 'loading'\n\t/** The route answered for the value as it stands. */\n\t| 'done';\n\nexport interface DebouncedFetcherOptions<Data = unknown> {\n\t/** Pause after the last change before the route is asked. Default 250. */\n\treadonly delayMs?: number;\n\t/** The trimmed value must have this many characters. Default 1. */\n\treadonly minLength?: number;\n\t/** `false` asks nothing and forgets the previous answer. Default `true`. */\n\treadonly enabled?: boolean;\n\t/** The fetcher's key, to share it with another component. */\n\treadonly key?: string;\n\t/**\n\t * Which answers may be kept as the stale `data` while the next value waits\n\t * or loads. Default: all. An answer it refuses (a failure) is still `data`\n\t * while it is the current one, but is never shown as the previous one: after a refused answer, the stale\n\t * data is the last *kept* answer, not the refused one.\n\t */\n\treadonly keep?: (data: NonNullable<FetcherData<Data>>) => boolean;\n}\n\nexport interface DebouncedFetcher<Data> {\n\t/**\n\t * The route's answer for the value as it stands, else (`stale`) the last\n\t * answer for an earlier value, kept until the new one lands. `undefined`\n\t * before any answer, and again once the hook goes `idle`.\n\t */\n\treadonly data: FetcherData<Data>;\n\t/** `data` answers an earlier value (or none is current yet). */\n\treadonly stale: boolean;\n\treadonly state: DebouncedFetcherState;\n\t/** Asks the route again for the value as it stands, without waiting. */\n\treadonly retry: () => void;\n}\n\n/**\n * A resource route loaded through a fetcher for a value that changes as the\n * user types. After `delayMs` without a change, and from `minLength`\n * characters, it calls `fetcher.load` once (a newer load cancels the\n * previous one). An answer only counts for the value it was asked for: while\n * a newer value waits or loads, `data` is the previous answer with `stale`\n * set, and an answer for an older value is never returned as current.\n * `to` is the route's URL, or a function of the trimmed value that builds it\n * (a string without a function is loaded as it is, the value being only the\n * trigger). A refusal the route answers as data is `data` like any answer.\n */\nexport function useDebouncedFetcher<Data>(\n\tvalue: string,\n\tto: string | ((value: string) => string),\n\toptions: DebouncedFetcherOptions<Data> = {},\n): DebouncedFetcher<Data> {\n\tconst { delayMs = 250, minLength = 1, enabled = true, key, keep } = options;\n\tconst keepRef = useRef(keep);\n\tkeepRef.current = keep;\n\tconst fetcher = useFetcher<Data>(key === undefined ? undefined : { key });\n\tconst load = useRef(fetcher.load);\n\tload.current = fetcher.load;\n\tconst text = value.trim();\n\tconst url =\n\t\tenabled && text.length >= minLength\n\t\t\t? typeof to === 'function'\n\t\t\t\t? to(text)\n\t\t\t\t: to\n\t\t\t: null;\n\t// The URL the fetcher was last told to load.\n\tconst [loaded, setLoaded] = useState<string | null>(null);\n\tconst previous = useRef<FetcherData<Data>>(undefined);\n\t// React Router applies the fetcher's `loading` state in a transition, so\n\t// right after `load()` a render can still show `idle` and the previous\n\t// answer. A load has landed only once the fetcher was seen busy for that very load (the load number is kept, so a busy render of a superseded load does not count), or\n\t// its `load()` promise settled and a transition queued after it committed\n\t// (a fast load whose busy state was never rendered, or a route answering\n\t// the very same object twice). `seq` numbers the loads, so a superseded\n\t// one never counts.\n\tconst seq = useRef(0);\n\tconst [settled, setSettled] = useState(0);\n\tconst busySeq = useRef(0);\n\tuseLayoutEffect(() => {\n\t\tif (fetcher.state !== 'idle') busySeq.current = seq.current;\n\t}, [fetcher.state]);\n\tconst ask = (target: string) => {\n\t\tconst mine = ++seq.current;\n\t\tsetLoaded(target);\n\t\tvoid Promise.resolve(load.current(target)).then(() => {\n\t\t\tif (mine === seq.current) startTransition(() => setSettled(mine));\n\t\t});\n\t};\n\tconst askRef = useRef(ask);\n\taskRef.current = ask;\n\n\tuseEffect(() => {\n\t\tif (url === null) {\n\t\t\tprevious.current = undefined;\n\t\t\tsetLoaded(null);\n\t\t\treturn;\n\t\t}\n\t\tconst timer = setTimeout(() => {\n\t\t\taskRef.current(url);\n\t\t}, delayMs);\n\t\treturn () => clearTimeout(timer);\n\t}, [url, text, delayMs]);\n\n\tconst landed =\n\t\tfetcher.state === 'idle' &&\n\t\t(busySeq.current === seq.current || settled === seq.current);\n\tconst current =\n\t\turl !== null && loaded === url && landed && fetcher.data !== undefined;\n\tconst answer = current ? fetcher.data : undefined;\n\tuseEffect(() => {\n\t\tif (answer === undefined || answer === null) return;\n\t\tif (keepRef.current?.(answer) ?? true) previous.current = answer;\n\t}, [answer]);\n\n\tconst data = current ? answer : url === null ? undefined : previous.current;\n\tlet state: DebouncedFetcherState;\n\tif (url === null) state = 'idle';\n\telse if (loaded !== url) state = 'waiting';\n\telse state = landed ? 'done' : 'loading';\n\n\tconst urlRef = useRef(url);\n\turlRef.current = url;\n\tconst retry = useCallback(() => {\n\t\tconst now = urlRef.current;\n\t\tif (now === null) return;\n\t\taskRef.current(now);\n\t}, []);\n\treturn { data, stale: state !== 'done' && data !== undefined, state, retry };\n}\n",
|
|
8
|
+
"import { useEffect, useRef } from 'react';\nimport type { AnswerSource } from './use-fetcher-answer';\n\n/**\n * Runs `onDone` once for each new answer of a fetcher that `isDone` accepts:\n * a save that succeeded, to close the dialog or section that sent it. A\n * fetcher keeps its last data, so an effect on `fetcher.data` alone fires\n * again when the dialog opens again; here the data present at mount counts as\n * handled, and each answer is handled once, whether `isDone` accepts it or not\n * (a refusal is not replayed when a later render flips the predicate).\n *\n * The answer is looked at while `fetcher.state` is `'idle'` only. `isDone` and\n * `onDone` are read from refs, so a new function each render never re-fires\n * the hook, and the latest ones run.\n */\nexport function useFetcherDone<Data>(\n\tfetcher: AnswerSource<Data>,\n\tisDone: (data: Data) => boolean,\n\tonDone: () => void,\n): void {\n\tconst handled = useRef<unknown>(fetcher.data);\n\tconst predicate = useRef(isDone);\n\tconst callback = useRef(onDone);\n\tpredicate.current = isDone;\n\tcallback.current = onDone;\n\tconst { state, data } = fetcher;\n\tuseEffect(() => {\n\t\tif (state !== 'idle' || data === handled.current) {\n\t\t\treturn;\n\t\t}\n\t\thandled.current = data;\n\t\tif (data !== undefined && data !== null && predicate.current(data)) {\n\t\t\tcallback.current();\n\t\t}\n\t}, [state, data]);\n}\n",
|
|
9
|
+
"import { useMemo } from 'react';\nimport type { FormErrors } from '../errors/form-errors';\n\n/**\n * What a form's fetcher answers: a done step (`ok: true`), or a refusal\n * (`formRefusal`, or `fetcherResult` with its `error`) that may carry the\n * form's field errors.\n */\nexport type FormRefusalResult =\n\t| { ok: true }\n\t| { ok?: false; fieldErrors?: Record<string, string>; error?: string };\n\n/**\n * The refusal of a form's last answer as its `FormErrors`: `undefined` for\n * no answer, a done step, or a refusal with no `fieldErrors` (a toast's\n * message, not the form's). Stable for one answer.\n */\nexport function useFormRefusal(\n\tresult: FormRefusalResult | undefined,\n): FormErrors | undefined {\n\treturn useMemo(\n\t\t() =>\n\t\t\tresult && !result.ok && result.fieldErrors\n\t\t\t\t? {\n\t\t\t\t\t\tfieldErrors: result.fieldErrors,\n\t\t\t\t\t\tformError: result.error || undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t[result],\n\t);\n}\n",
|
|
10
|
+
"import { useEffect, useRef } from 'react';\nimport { useRevalidator } from 'react-router';\n\nexport interface RevalidateOnFocusOptions {\n\t/**\n\t * How long the page must have been hidden (or the window out of focus)\n\t * before coming back revalidates, in ms. Default `30_000`.\n\t */\n\treadonly minHiddenMs?: number;\n\t/** `false` removes the listeners and revalidates nothing. Default `true`. */\n\treadonly enabled?: boolean;\n}\n\n/**\n * Runs the current route's loaders again when the user comes back to the page:\n * the tab becomes visible (`visibilitychange`) or the window gains focus after\n * having been hidden, or out of focus, for at least `minHiddenMs` (30 s by\n * default). A quicker return does nothing, and a revalidation already in\n * flight is not doubled. No timer runs (`useVisibleRevalidation` is the\n * polling one). `enabled: false` removes the listeners. They are removed on\n * unmount too, and on the server nothing starts (effects do not run).\n */\nexport function useRevalidateOnFocus(\n\toptions: RevalidateOnFocusOptions = {},\n): void {\n\tconst { minHiddenMs = 30_000, enabled = true } = options;\n\tconst revalidator = useRevalidator();\n\tconst latest = useRef(revalidator);\n\tlatest.current = revalidator;\n\n\tuseEffect(() => {\n\t\tif (!enabled) return;\n\t\tlet leftAt: number | undefined;\n\t\tconst left = () => {\n\t\t\tleftAt ??= Date.now();\n\t\t};\n\t\tconst back = () => {\n\t\t\tconst since = leftAt;\n\t\t\tleftAt = undefined;\n\t\t\tif (since === undefined || Date.now() - since < minHiddenMs) return;\n\t\t\tif (latest.current.state === 'idle') void latest.current.revalidate();\n\t\t};\n\t\tconst onVisibility = () => {\n\t\t\tif (document.visibilityState === 'hidden') left();\n\t\t\telse back();\n\t\t};\n\t\tdocument.addEventListener('visibilitychange', onVisibility);\n\t\twindow.addEventListener('blur', left);\n\t\twindow.addEventListener('focus', back);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('visibilitychange', onVisibility);\n\t\t\twindow.removeEventListener('blur', left);\n\t\t\twindow.removeEventListener('focus', back);\n\t\t};\n\t}, [minHiddenMs, enabled]);\n}\n",
|
|
11
|
+
"import { useEffect, useRef } from 'react';\nimport type { SectionForm } from './section-form';\nimport { type SectionSave, useSectionSave } from './use-section-save';\n\n/** What `useRowSave` takes. */\nexport interface RowSaveOptions<Values, Parsed> {\n\t/** The row's form. */\n\tform: SectionForm<Values, Parsed>;\n\t/** Whether the row is open (its key is the group's open one). */\n\tediting: boolean;\n\t/** The step the route's action takes (`update`): posted as `intent`, and what tells this row's answer from another's. */\n\tintent: string;\n\t/** The row's form values as the page now reads them. */\n\trecord: Values;\n\t/** The row's version as the page now reads it. */\n\tversion: number;\n\t/** The step's body (`{ id, input }`) from the parsed values and the version the row was opened on; `null` when nothing changed. */\n\ttoRequest: (\n\t\tvalues: Parsed,\n\t\tversion: number,\n\t) => Record<string, unknown> | null;\n\t/** Ends the edit once the save went through. */\n\tonSaved: () => void;\n\t/** The field to focus for a refused name that is no field itself (a stable function). */\n\tfocusOf?: (name: string) => string;\n}\n\n/**\n * One row of an editable list saved through its route's action, as a section\n * is (`useSectionSave`): a field's refusal under the field, a stale version\n * as the row's `notice` with a reload, the form reset with the record the\n * page reads once saved. The row takes the record as the page reads it when\n * it opens (values and version), and a save posts the version it was opened\n * on, so a page read again meanwhile never turns a stale save into a fresh\n * one.\n */\nexport function useRowSave<Values, Parsed>({\n\tform,\n\tediting,\n\tintent,\n\trecord,\n\tversion,\n\ttoRequest,\n\tonSaved,\n\tfocusOf,\n}: RowSaveOptions<Values, Parsed>): SectionSave {\n\tconst openedOn = useRef<number>(undefined);\n\tconst latest = useRef({ record, version });\n\tlatest.current = { record, version };\n\t// Opening takes the record as it is now: the form was built on an older one.\n\tuseEffect(() => {\n\t\tif (!editing) return;\n\t\topenedOn.current = latest.current.version;\n\t\tform.reset(latest.current.record);\n\t}, [editing, form]);\n\treturn useSectionSave({\n\t\tform,\n\t\tintent,\n\t\ttoInput: (values) => toRequest(values, openedOn.current ?? version),\n\t\trecord,\n\t\tonSaved,\n\t\t...(focusOf ? { focusOf } : {}),\n\t\t// A reload read the record again: the row goes on from its version.\n\t\tonRefilled: () => {\n\t\t\topenedOn.current = latest.current.version;\n\t\t},\n\t});\n}\n",
|
|
12
|
+
"import {\n\ttype BaseSyntheticEvent,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type { SectionResult } from '../errors/section-action';\nimport { useJsonFetcher } from '../errors/use-json-fetcher';\nimport { type SectionForm, useSectionErrors } from './section-form';\nimport { useSectionReload } from './section-reload';\nimport {\n\tfieldErrorsOf,\n\tnoticeOf,\n\trefusalOf,\n\ttype SectionNotice,\n} from './section-save';\n\n/** What `useSectionSave` takes. */\nexport interface SectionSaveOptions<Values, Parsed> {\n\t/** The section's form (React Hook Form's `useForm()` result fits). */\n\tform: SectionForm<Values, Parsed>;\n\t/** The section's name: posted as `intent`, and what tells its answer from another section's. */\n\tintent: string;\n\t/** The API input of the section from the parsed values; `null` when nothing changed: nothing is posted and the edit ends. */\n\ttoInput: (values: Parsed) => Record<string, unknown> | null;\n\t/** The record's form values as the page now reads them: the form is reset to them once a save went through. */\n\trecord: Values;\n\t/** Ends the edit, after the form was reset. */\n\tonSaved: () => void;\n\t/** Called once a reload refilled the form from the record read again. */\n\tonRefilled?: () => void;\n\t/** The field to focus for a refused name that is no field itself (a stable function). */\n\tfocusOf?: (name: string) => string;\n}\n\n/** What `useSectionSave` returns, for the section's component. */\nexport interface SectionSave {\n\t/** The form's submit handler. */\n\tonSubmit: (event?: BaseSyntheticEvent) => Promise<unknown> | void;\n\t/** A save is in flight. */\n\tbusy: boolean;\n\t/** What to show above the fields (the app words and draws it), or `undefined`. */\n\tnotice: SectionNotice | undefined;\n\t/** Puts the form back on the record (the section closes the form after). */\n\tonCancel: () => void;\n}\n\n/**\n * One section of a read-only record saved through its route's action\n * (`sectionAction`): the parsed values are posted as JSON with the section's\n * `intent`, and\n * - a field's refusal is put under the field, the first refused one focused;\n * - a stale version is the `notice`, the edit kept open, with a `reload`\n * that revalidates the page and refills the form from the record read\n * again;\n * - a save that went through resets the form with the record the page now\n * reads and calls `onSaved`.\n *\n * It is headless: `notice` is data, drawn by the app's own component.\n */\nexport function useSectionSave<Values, Parsed>({\n\tform,\n\tintent,\n\ttoInput,\n\trecord,\n\tonSaved,\n\tfocusOf,\n\tonRefilled,\n}: SectionSaveOptions<Values, Parsed>): SectionSave {\n\tconst { fetcher, post, busy } =\n\t\tuseJsonFetcher<() => Promise<SectionResult>>();\n\tconst answer = fetcher.data?.intent === intent ? fetcher.data : undefined;\n\t// The answer a reload or a cancel put aside: it is shown no more.\n\tconst [setAside, setSetAside] = useState<SectionResult>();\n\tconst shown = answer === setAside ? undefined : answer;\n\n\tconst latest = useRef({ record, onSaved, onRefilled });\n\tlatest.current = { record, onSaved, onRefilled };\n\n\tconst errors = useMemo(() => fieldErrorsOf(shown), [shown]);\n\tuseSectionErrors(form, errors, focusOf);\n\n\t// The fetcher is idle once the loaders ran again: `record` is the saved one.\n\tuseEffect(() => {\n\t\tif (fetcher.state !== 'idle' || !answer?.ok) return;\n\t\tform.reset(latest.current.record);\n\t\tlatest.current.onSaved();\n\t}, [fetcher.state, answer, form]);\n\n\tconst reload = useSectionReload(form, record, latest);\n\tconst notice = noticeOf(refusalOf(shown), () => {\n\t\tsetSetAside(answer);\n\t\treload();\n\t});\n\n\treturn {\n\t\tonSubmit: form.handleSubmit((values) => {\n\t\t\tconst input = toInput(values);\n\t\t\tif (!input) {\n\t\t\t\tform.reset(latest.current.record);\n\t\t\t\tlatest.current.onSaved();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvoid post({ intent, ...input });\n\t\t}),\n\t\tbusy,\n\t\tnotice,\n\t\tonCancel: () => {\n\t\t\tsetSetAside(answer);\n\t\t\tform.reset(latest.current.record);\n\t\t},\n\t};\n}\n",
|
|
13
|
+
"import { type BaseSyntheticEvent, useEffect } from 'react';\nimport type { FormErrors } from '../errors/form-errors';\n\n/**\n * What the section hooks use of a form: React Hook Form's `useForm()` result\n * fits as it is, and so does any form with these four methods. The object\n * must be stable across renders (the hooks list it as an effect dependency).\n */\nexport interface SectionForm<Values, Parsed> {\n\thandleSubmit(\n\t\tonValid: (values: Parsed) => unknown,\n\t): (event?: BaseSyntheticEvent) => Promise<unknown> | void;\n\treset(values?: Values): void;\n\tsetError(name: never, error: { type: string; message: string }): void;\n\tsetFocus(name: never): void;\n}\n\nconst same = (name: string) => name;\n\n/** The refused field that comes first in the page, by its input's `name`. */\nfunction firstInPage(names: string[]): string | undefined {\n\tif (typeof document === 'undefined') return names[0];\n\tconst found: { name: string; node: Element }[] = [];\n\tfor (const name of names) {\n\t\tconst node = document.getElementsByName(name)[0];\n\t\tif (node) found.push({ name, node });\n\t}\n\tfound.sort((a, b) =>\n\t\ta.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING\n\t\t\t? -1\n\t\t\t: 1,\n\t);\n\treturn found[0]?.name ?? names[0];\n}\n\n/**\n * Puts a refusal on the form: a message under each refused field\n * (`type: 'server'`) and the first of them focused.\n * `focusOf` (a stable function) names the field to focus for a\n * refused name that is no registered field itself.\n */\nexport function useSectionErrors<Values, Parsed>(\n\tform: SectionForm<Values, Parsed>,\n\terrors: FormErrors | undefined,\n\tfocusOf: (name: string) => string = same,\n): void {\n\tuseEffect(() => {\n\t\tif (!errors) return;\n\t\tconst fields = Object.entries(errors.fieldErrors ?? {});\n\t\tfor (const [name, message] of fields) {\n\t\t\tform.setError(name as never, { type: 'server', message });\n\t\t}\n\t\tconst first = firstInPage(fields.map(([name]) => name));\n\t\tif (first) form.setFocus(focusOf(first) as never);\n\t}, [errors, form, focusOf]);\n}\n",
|
|
14
|
+
"import { type RefObject, useEffect, useRef, useState } from 'react';\nimport { useRevalidator } from 'react-router';\nimport type { SectionForm } from './section-form';\n\n/**\n * The reload of a stale section: `reload()` revalidates the page, then\n * refills the form from the record read again and calls `onRefilled`.\n *\n * It ends once the page read the record again: the router's state reaches\n * React in a transition, so the render that follows the click can still say\n * \"idle\" with the old record. It is over when the revalidation was seen\n * running and is idle again, when the record itself changed, or a moment\n * after the revalidation's promise resolved (a record that did not change).\n */\nexport function useSectionReload<Values, Parsed>(\n\tform: SectionForm<Values, Parsed>,\n\trecord: Values,\n\tlatest: RefObject<{ record: Values; onRefilled: (() => void) | undefined }>,\n): () => void {\n\tconst revalidator = useRevalidator();\n\tconst [reloading, setReloading] = useState(false);\n\tconst [settled, setSettled] = useState(false);\n\tconst recordKey = JSON.stringify(record);\n\tconst asked = useRef({ key: '', loading: false });\n\tconst settleTimer = useRef<ReturnType<typeof setTimeout>>(undefined);\n\tuseEffect(() => () => clearTimeout(settleTimer.current), []);\n\tuseEffect(() => {\n\t\tif (!reloading) return;\n\t\tif (revalidator.state === 'loading') {\n\t\t\tasked.current.loading = true;\n\t\t\treturn;\n\t\t}\n\t\tif (!settled && !asked.current.loading && recordKey === asked.current.key) {\n\t\t\treturn;\n\t\t}\n\t\tform.reset(latest.current.record);\n\t\tlatest.current.onRefilled?.();\n\t\tsetReloading(false);\n\t\tsetSettled(false);\n\t}, [reloading, settled, revalidator.state, recordKey, form, latest]);\n\treturn () => {\n\t\tasked.current = { key: recordKey, loading: false };\n\t\tsetReloading(true);\n\t\tvoid Promise.resolve(revalidator.revalidate()).then(() => {\n\t\t\tsettleTimer.current = setTimeout(() => setSettled(true), 100);\n\t\t});\n\t};\n}\n",
|
|
15
|
+
"import { useEffect, useRef } from 'react';\n\nexport interface VisibleIntervalOptions {\n\t/** `false` stops the timer. Default `true`. */\n\treadonly enabled?: boolean;\n\t/**\n\t * Run the callback as soon as a hidden page becomes visible again, when at\n\t * least the interval has passed since its last run. Default `true`.\n\t */\n\treadonly runOnVisible?: boolean;\n}\n\n/**\n * Runs `callback` every `ms` **only while the page is visible**\n * (`document.visibilityState`), for a screen that has no real-time channel\n * (a revalidation, a fetcher's `load`). A tick that fires while the page is\n * hidden is skipped; when the page becomes visible again after at least `ms`\n * since the last run, the callback runs at once (`runOnVisible`); a page that\n * comes back sooner waits for the next tick. The timer and the listener are\n * cleared on unmount and while `enabled` is false. `ms` must be positive.\n *\n * The callback is read from a ref: a new function each render never restarts\n * the timer, and the latest one runs. Skipping a read already in flight is the\n * callback's to decide. On the server nothing starts (effects do not run).\n */\nexport function useVisibleInterval(\n\tcallback: () => void,\n\tms: number,\n\toptions: VisibleIntervalOptions = {},\n): void {\n\tconst { enabled = true, runOnVisible = true } = options;\n\tconst latest = useRef(callback);\n\tlatest.current = callback;\n\n\tuseEffect(() => {\n\t\tif (!enabled || ms <= 0) return;\n\t\tlet last = Date.now();\n\t\tconst run = () => {\n\t\t\tif (document.visibilityState !== 'visible') return;\n\t\t\tlast = Date.now();\n\t\t\tlatest.current();\n\t\t};\n\t\tconst timer = setInterval(run, ms);\n\t\tconst back = () => {\n\t\t\tif (runOnVisible && Date.now() - last >= ms) run();\n\t\t};\n\t\tdocument.addEventListener('visibilitychange', back);\n\t\treturn () => {\n\t\t\tclearInterval(timer);\n\t\t\tdocument.removeEventListener('visibilitychange', back);\n\t\t};\n\t}, [ms, enabled, runOnVisible]);\n}\n",
|
|
16
|
+
"import { useRevalidator } from 'react-router';\nimport {\n\tuseVisibleInterval,\n\ttype VisibleIntervalOptions,\n} from './use-visible-interval';\n\n/**\n * Runs the current route's loaders again every `ms`, **only while the page is\n * visible**, and at once when a hidden page comes back after more than `ms`\n * (`useVisibleInterval` over React Router's `useRevalidator`). A revalidation\n * already in flight is not doubled. `enabled: false` stops it (a menu is open,\n * a change is in flight).\n */\nexport function useVisibleRevalidation(\n\tms: number,\n\toptions?: Pick<VisibleIntervalOptions, 'enabled'>,\n): void {\n\tconst revalidator = useRevalidator();\n\tuseVisibleInterval(\n\t\t() => {\n\t\t\tif (revalidator.state === 'idle') void revalidator.revalidate();\n\t\t},\n\t\tms,\n\t\toptions,\n\t);\n}\n"
|
|
17
|
+
],
|
|
18
|
+
"mappings": ";;;;;;;;;;;;;AA2BO,SAAS,WAAmC,CAClD,QACA,QAC6B;AAAA,EAC7B,IAAI,OAAO;AAAA,IAAM;AAAA,EACjB,MAAM,UAAuD;AAAA,IAC5D,MAAM,OAAO;AAAA,IACb,YAAY,OAAO;AAAA,EACpB;AAAA,EACA,WAAW,SAAS;AAAA,IAAQ,QAAQ,SAAS,OAAO,cAAc;AAAA,EAClE,OAAO;AAAA;;AC9BD,IAAM,YAAY,CACxB,WACiC,UAAU,CAAC,OAA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;AAAA;;AIlEF,sBAAS,sBAAW;AAyBb,SAAS,kBAAkB,CACjC,UACA,IACA,UAAkC,CAAC,GAC5B;AAAA,EACP,QAAQ,UAAU,MAAM,eAAe,SAAS;AAAA,EAChD,MAAM,SAAS,QAAO,QAAQ;AAAA,EAC9B,OAAO,UAAU;AAAA,EAEjB,WAAU,MAAM;AAAA,IACf,IAAI,CAAC,WAAW,MAAM;AAAA,MAAG;AAAA,IACzB,IAAI,OAAO,KAAK,IAAI;AAAA,IACpB,MAAM,MAAM,MAAM;AAAA,MACjB,IAAI,SAAS,oBAAoB;AAAA,QAAW;AAAA,MAC5C,OAAO,KAAK,IAAI;AAAA,MAChB,OAAO,QAAQ;AAAA;AAAA,IAEhB,MAAM,QAAQ,YAAY,KAAK,EAAE;AAAA,IACjC,MAAM,OAAO,MAAM;AAAA,MAClB,IAAI,gBAAgB,KAAK,IAAI,IAAI,QAAQ;AAAA,QAAI,IAAI;AAAA;AAAA,IAElD,SAAS,iBAAiB,oBAAoB,IAAI;AAAA,IAClD,OAAO,MAAM;AAAA,MACZ,cAAc,KAAK;AAAA,MACnB,SAAS,oBAAoB,oBAAoB,IAAI;AAAA;AAAA,KAEpD,CAAC,IAAI,SAAS,YAAY,CAAC;AAAA;;ACnD/B,2BAAS;AAaF,SAAS,sBAAsB,CACrC,IACA,SACO;AAAA,EACP,MAAM,cAAc,gBAAe;AAAA,EACnC,mBACC,MAAM;AAAA,IACL,IAAI,YAAY,UAAU;AAAA,MAAa,YAAY,WAAW;AAAA,KAE/D,IACA,OACD;AAAA;",
|
|
19
|
+
"debugId": "F162F812AF5BDE9A64756E2164756E21",
|
|
20
|
+
"names": []
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type BaseSyntheticEvent } from 'react';
|
|
2
|
+
import type { FormErrors } from '../errors/form-errors';
|
|
3
|
+
/**
|
|
4
|
+
* What the section hooks use of a form: React Hook Form's `useForm()` result
|
|
5
|
+
* fits as it is, and so does any form with these four methods. The object
|
|
6
|
+
* must be stable across renders (the hooks list it as an effect dependency).
|
|
7
|
+
*/
|
|
8
|
+
export interface SectionForm<Values, Parsed> {
|
|
9
|
+
handleSubmit(onValid: (values: Parsed) => unknown): (event?: BaseSyntheticEvent) => Promise<unknown> | void;
|
|
10
|
+
reset(values?: Values): void;
|
|
11
|
+
setError(name: never, error: {
|
|
12
|
+
type: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}): void;
|
|
15
|
+
setFocus(name: never): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Puts a refusal on the form: a message under each refused field
|
|
19
|
+
* (`type: 'server'`) and the first of them focused.
|
|
20
|
+
* `focusOf` (a stable function) names the field to focus for a
|
|
21
|
+
* refused name that is no registered field itself.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSectionErrors<Values, Parsed>(form: SectionForm<Values, Parsed>, errors: FormErrors | undefined, focusOf?: (name: string) => string): void;
|
|
24
|
+
//# sourceMappingURL=section-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-form.d.ts","sourceRoot":"","sources":["../../src/fetcher/section-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAa,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,MAAM,EAAE,MAAM;IAC1C,YAAY,CACX,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAClC,CAAC,KAAK,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;CAC5B;AAoBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAC9C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAa,GACtC,IAAI,CAUN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { SectionForm } from './section-form';
|
|
3
|
+
/**
|
|
4
|
+
* The reload of a stale section: `reload()` revalidates the page, then
|
|
5
|
+
* refills the form from the record read again and calls `onRefilled`.
|
|
6
|
+
*
|
|
7
|
+
* It ends once the page read the record again: the router's state reaches
|
|
8
|
+
* React in a transition, so the render that follows the click can still say
|
|
9
|
+
* "idle" with the old record. It is over when the revalidation was seen
|
|
10
|
+
* running and is idle again, when the record itself changed, or a moment
|
|
11
|
+
* after the revalidation's promise resolved (a record that did not change).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useSectionReload<Values, Parsed>(form: SectionForm<Values, Parsed>, record: Values, latest: RefObject<{
|
|
14
|
+
record: Values;
|
|
15
|
+
onRefilled: (() => void) | undefined;
|
|
16
|
+
}>): () => void;
|
|
17
|
+
//# sourceMappingURL=section-reload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-reload.d.ts","sourceRoot":"","sources":["../../src/fetcher/section-reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAC9C,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;CAAE,CAAC,GACzE,MAAM,IAAI,CA6BZ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FormErrors } from '../errors/form-errors';
|
|
2
|
+
import type { SectionResult } from '../errors/section-action';
|
|
3
|
+
/** The refusal of a section save. */
|
|
4
|
+
export type SectionRefusal = Extract<SectionResult, {
|
|
5
|
+
ok: false;
|
|
6
|
+
}>;
|
|
7
|
+
/** The answer when it is a refusal, else `undefined`. */
|
|
8
|
+
export declare const refusalOf: (result: SectionResult | undefined) => SectionRefusal | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The messages to put under the section's fields. The rest of a refusal, and
|
|
11
|
+
* a stale version, are the section's notice.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fieldErrorsOf(result: SectionResult | undefined): FormErrors | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* What a section shows above its fields, as data for the app's own
|
|
16
|
+
* component: a version conflict (`stale`: the record changed since it was
|
|
17
|
+
* read, `reload` reads it again and refills the form), or the refusal's
|
|
18
|
+
* message when it has one beyond the field messages.
|
|
19
|
+
*/
|
|
20
|
+
export type SectionNotice = {
|
|
21
|
+
kind: 'stale';
|
|
22
|
+
reload: () => void;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'error';
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
/** The notice of a refusal, or `undefined` when the field messages say it all. */
|
|
28
|
+
export declare function noticeOf(refusal: SectionRefusal | undefined, reload: () => void): SectionNotice | undefined;
|
|
29
|
+
//# sourceMappingURL=section-save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-save.d.ts","sourceRoot":"","sources":["../../src/fetcher/section-save.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAEnE,yDAAyD;AACzD,eAAO,MAAM,SAAS,GACrB,QAAQ,aAAa,GAAG,SAAS,KAC/B,cAAc,GAAG,SAAwD,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,aAAa,GAAG,SAAS,GAC/B,UAAU,GAAG,SAAS,CAIxB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,kFAAkF;AAClF,wBAAgB,QAAQ,CACvB,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,MAAM,EAAE,MAAM,IAAI,GAChB,aAAa,GAAG,SAAS,CAI3B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useFetcher } from 'react-router';
|
|
2
|
+
/** What `useFetcher<Data>` hands back as `data` (`Data` may be `typeof loader`). */
|
|
3
|
+
type FetcherData<Data> = ReturnType<typeof useFetcher<Data>>['data'];
|
|
4
|
+
/** What `useDebouncedFetcher` is doing for the value typed. */
|
|
5
|
+
export type DebouncedFetcherState =
|
|
6
|
+
/** Nothing to ask: disabled, or the value is shorter than `minLength`. */
|
|
7
|
+
'idle'
|
|
8
|
+
/** The value changed and the pause after the last change is running. */
|
|
9
|
+
| 'waiting'
|
|
10
|
+
/** The resource route is loading. */
|
|
11
|
+
| 'loading'
|
|
12
|
+
/** The route answered for the value as it stands. */
|
|
13
|
+
| 'done';
|
|
14
|
+
export interface DebouncedFetcherOptions<Data = unknown> {
|
|
15
|
+
/** Pause after the last change before the route is asked. Default 250. */
|
|
16
|
+
readonly delayMs?: number;
|
|
17
|
+
/** The trimmed value must have this many characters. Default 1. */
|
|
18
|
+
readonly minLength?: number;
|
|
19
|
+
/** `false` asks nothing and forgets the previous answer. Default `true`. */
|
|
20
|
+
readonly enabled?: boolean;
|
|
21
|
+
/** The fetcher's key, to share it with another component. */
|
|
22
|
+
readonly key?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Which answers may be kept as the stale `data` while the next value waits
|
|
25
|
+
* or loads. Default: all. An answer it refuses (a failure) is still `data`
|
|
26
|
+
* while it is the current one, but is never shown as the previous one: after a refused answer, the stale
|
|
27
|
+
* data is the last *kept* answer, not the refused one.
|
|
28
|
+
*/
|
|
29
|
+
readonly keep?: (data: NonNullable<FetcherData<Data>>) => boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface DebouncedFetcher<Data> {
|
|
32
|
+
/**
|
|
33
|
+
* The route's answer for the value as it stands, else (`stale`) the last
|
|
34
|
+
* answer for an earlier value, kept until the new one lands. `undefined`
|
|
35
|
+
* before any answer, and again once the hook goes `idle`.
|
|
36
|
+
*/
|
|
37
|
+
readonly data: FetcherData<Data>;
|
|
38
|
+
/** `data` answers an earlier value (or none is current yet). */
|
|
39
|
+
readonly stale: boolean;
|
|
40
|
+
readonly state: DebouncedFetcherState;
|
|
41
|
+
/** Asks the route again for the value as it stands, without waiting. */
|
|
42
|
+
readonly retry: () => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A resource route loaded through a fetcher for a value that changes as the
|
|
46
|
+
* user types. After `delayMs` without a change, and from `minLength`
|
|
47
|
+
* characters, it calls `fetcher.load` once (a newer load cancels the
|
|
48
|
+
* previous one). An answer only counts for the value it was asked for: while
|
|
49
|
+
* a newer value waits or loads, `data` is the previous answer with `stale`
|
|
50
|
+
* set, and an answer for an older value is never returned as current.
|
|
51
|
+
* `to` is the route's URL, or a function of the trimmed value that builds it
|
|
52
|
+
* (a string without a function is loaded as it is, the value being only the
|
|
53
|
+
* trigger). A refusal the route answers as data is `data` like any answer.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useDebouncedFetcher<Data>(value: string, to: string | ((value: string) => string), options?: DebouncedFetcherOptions<Data>): DebouncedFetcher<Data>;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=use-debounced-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-debounced-fetcher.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-debounced-fetcher.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,oFAAoF;AACpF,KAAK,WAAW,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB;AAChC,0EAA0E;AACxE,MAAM;AACR,wEAAwE;GACtE,SAAS;AACX,qCAAqC;GACnC,SAAS;AACX,qDAAqD;GACnD,MAAM,CAAC;AAEV,MAAM,WAAW,uBAAuB,CAAC,IAAI,GAAG,OAAO;IACtD,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,OAAO,CAAC;CAClE;AAED,MAAM,WAAW,gBAAgB,CAAC,IAAI;IACrC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EACvC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,EACxC,OAAO,GAAE,uBAAuB,CAAC,IAAI,CAAM,GACzC,gBAAgB,CAAC,IAAI,CAAC,CA6ExB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** What the hook reads of a React Router fetcher. */
|
|
2
|
+
export interface AnswerSource<Data> {
|
|
3
|
+
readonly state: string;
|
|
4
|
+
readonly data: Data | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The answers a fetcher gives, one at a time. A keyed fetcher outlives its
|
|
8
|
+
* component, so the data it holds when the component mounts is an earlier
|
|
9
|
+
* visit's, not this one's. `onAnswer` is called once for each answer that
|
|
10
|
+
* arrives while the fetcher is idle and is another object than the last one
|
|
11
|
+
* seen (the data present at mount counts as seen). The handler is read from
|
|
12
|
+
* a ref, so a new function each render never re-fires it. Returns the latest
|
|
13
|
+
* answer handed over, `undefined` until one arrives.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFetcherAnswer<Data>(fetcher: AnswerSource<Data>, onAnswer?: (answer: Data) => void): Data | undefined;
|
|
16
|
+
//# sourceMappingURL=use-fetcher-answer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fetcher-answer.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-fetcher-answer.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,MAAM,WAAW,YAAY,CAAC,IAAI;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EACpC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAC3B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,IAAI,GAC/B,IAAI,GAAG,SAAS,CAelB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnswerSource } from './use-fetcher-answer';
|
|
2
|
+
/**
|
|
3
|
+
* Runs `onDone` once for each new answer of a fetcher that `isDone` accepts:
|
|
4
|
+
* a save that succeeded, to close the dialog or section that sent it. A
|
|
5
|
+
* fetcher keeps its last data, so an effect on `fetcher.data` alone fires
|
|
6
|
+
* again when the dialog opens again; here the data present at mount counts as
|
|
7
|
+
* handled, and each answer is handled once, whether `isDone` accepts it or not
|
|
8
|
+
* (a refusal is not replayed when a later render flips the predicate).
|
|
9
|
+
*
|
|
10
|
+
* The answer is looked at while `fetcher.state` is `'idle'` only. `isDone` and
|
|
11
|
+
* `onDone` are read from refs, so a new function each render never re-fires
|
|
12
|
+
* the hook, and the latest ones run.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFetcherDone<Data>(fetcher: AnswerSource<Data>, isDone: (data: Data) => boolean, onDone: () => void): void;
|
|
15
|
+
//# sourceMappingURL=use-fetcher-done.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fetcher-done.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-fetcher-done.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAClC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAC3B,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EAC/B,MAAM,EAAE,MAAM,IAAI,GAChB,IAAI,CAgBN"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AnswerSource } from './use-fetcher-answer';
|
|
2
|
+
/** What `useFetcherPromise` accepts. */
|
|
3
|
+
export interface FetcherPromiseOptions<Data> {
|
|
4
|
+
/**
|
|
5
|
+
* Decides whether an answer is a refusal: the message (or the `Error`) the
|
|
6
|
+
* promise rejects with, `undefined` to resolve with the answer. Read from a
|
|
7
|
+
* ref, so a new function each render is fine. Without it every answer
|
|
8
|
+
* resolves.
|
|
9
|
+
*/
|
|
10
|
+
refusal?: (answer: Data) => string | Error | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The rejection of a call replaced by a newer one, or cut off by an unmount. */
|
|
13
|
+
export declare class FetcherPromiseAborted extends Error {
|
|
14
|
+
readonly name = "FetcherPromiseAborted";
|
|
15
|
+
readonly reason: 'superseded' | 'unmounted';
|
|
16
|
+
constructor(reason: 'superseded' | 'unmounted');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The rejection of a call whose submission ended, the fetcher idle again,
|
|
20
|
+
* without a new answer: the action answered `null`, `undefined` or the very
|
|
21
|
+
* data the fetcher already held.
|
|
22
|
+
*/
|
|
23
|
+
export declare class FetcherPromiseNoAnswer extends Error {
|
|
24
|
+
readonly name = "FetcherPromiseNoAnswer";
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Ties one submission to its answer. `run(submit)` calls `submit` (usually
|
|
29
|
+
* `() => fetcher.submit(...)`) and returns a Promise settled by the fetcher's
|
|
30
|
+
* next new answer (see `useFetcherAnswer`): it resolves with the answer, or
|
|
31
|
+
* rejects with an `Error` when `options.refusal` returns a message for it. An
|
|
32
|
+
* answer the fetcher already held when `run` was called never settles it.
|
|
33
|
+
*
|
|
34
|
+
* A second `run` while one is pending rejects the older promise with a
|
|
35
|
+
* `FetcherPromiseAborted` (`'superseded'`) and waits for the answer to the
|
|
36
|
+
* newer one. A submission that ends, the fetcher idle again, without a new
|
|
37
|
+
* answer (the action answered `null`, `undefined` or the same data) rejects
|
|
38
|
+
* it with a `FetcherPromiseNoAnswer`. An unmount rejects the pending promise with a
|
|
39
|
+
* `FetcherPromiseAborted` (`'unmounted'`). A `submit` that throws (or whose
|
|
40
|
+
* promise rejects) rejects the promise with that error, and so does a
|
|
41
|
+
* `refusal` that throws. `run` is stable.
|
|
42
|
+
*
|
|
43
|
+
* Catch every promise `run` returns: an abort rejects it, and one nobody
|
|
44
|
+
* handles is an unhandled rejection. Ignore the aborts with
|
|
45
|
+
* `.catch((e) => { if (!(e instanceof FetcherPromiseAborted)) throw e; })`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useFetcherPromise<Data>(fetcher: AnswerSource<Data>, options?: FetcherPromiseOptions<Data>): (submit: () => void | Promise<unknown>) => Promise<Data>;
|
|
48
|
+
//# sourceMappingURL=use-fetcher-promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fetcher-promise.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-fetcher-promise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,sBAAsB,CAAC;AAE3E,wCAAwC;AACxC,MAAM,WAAW,qBAAqB,CAAC,IAAI;IAC1C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;CACvD;AAED,iFAAiF;AACjF,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,SAAkB,IAAI,2BAA2B;IACjD,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAAC;gBAChC,MAAM,EAAE,YAAY,GAAG,WAAW;CAQ9C;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,SAAkB,IAAI,4BAA4B;;CAMlD;AAOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EACrC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAC3B,OAAO,GAAE,qBAAqB,CAAC,IAAI,CAAM,GACvC,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAsE1D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FormErrors } from '../errors/form-errors';
|
|
2
|
+
/**
|
|
3
|
+
* What a form's fetcher answers: a done step (`ok: true`), or a refusal
|
|
4
|
+
* (`formRefusal`, or `fetcherResult` with its `error`) that may carry the
|
|
5
|
+
* form's field errors.
|
|
6
|
+
*/
|
|
7
|
+
export type FormRefusalResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
} | {
|
|
10
|
+
ok?: false;
|
|
11
|
+
fieldErrors?: Record<string, string>;
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The refusal of a form's last answer as its `FormErrors`: `undefined` for
|
|
16
|
+
* no answer, a done step, or a refusal with no `fieldErrors` (a toast's
|
|
17
|
+
* message, not the form's). Stable for one answer.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useFormRefusal(result: FormRefusalResult | undefined): FormErrors | undefined;
|
|
20
|
+
//# sourceMappingURL=use-form-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-form-refusal.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-form-refusal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACnC,UAAU,GAAG,SAAS,CAWxB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RevalidateOnFocusOptions {
|
|
2
|
+
/**
|
|
3
|
+
* How long the page must have been hidden (or the window out of focus)
|
|
4
|
+
* before coming back revalidates, in ms. Default `30_000`.
|
|
5
|
+
*/
|
|
6
|
+
readonly minHiddenMs?: number;
|
|
7
|
+
/** `false` removes the listeners and revalidates nothing. Default `true`. */
|
|
8
|
+
readonly enabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runs the current route's loaders again when the user comes back to the page:
|
|
12
|
+
* the tab becomes visible (`visibilitychange`) or the window gains focus after
|
|
13
|
+
* having been hidden, or out of focus, for at least `minHiddenMs` (30 s by
|
|
14
|
+
* default). A quicker return does nothing, and a revalidation already in
|
|
15
|
+
* flight is not doubled. No timer runs (`useVisibleRevalidation` is the
|
|
16
|
+
* polling one). `enabled: false` removes the listeners. They are removed on
|
|
17
|
+
* unmount too, and on the server nothing starts (effects do not run).
|
|
18
|
+
*/
|
|
19
|
+
export declare function useRevalidateOnFocus(options?: RevalidateOnFocusOptions): void;
|
|
20
|
+
//# sourceMappingURL=use-revalidate-on-focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-revalidate-on-focus.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-revalidate-on-focus.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,GAAE,wBAA6B,GACpC,IAAI,CA+BN"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SectionForm } from './section-form';
|
|
2
|
+
import { type SectionSave } from './use-section-save';
|
|
3
|
+
/** What `useRowSave` takes. */
|
|
4
|
+
export interface RowSaveOptions<Values, Parsed> {
|
|
5
|
+
/** The row's form. */
|
|
6
|
+
form: SectionForm<Values, Parsed>;
|
|
7
|
+
/** Whether the row is open (its key is the group's open one). */
|
|
8
|
+
editing: boolean;
|
|
9
|
+
/** The step the route's action takes (`update`): posted as `intent`, and what tells this row's answer from another's. */
|
|
10
|
+
intent: string;
|
|
11
|
+
/** The row's form values as the page now reads them. */
|
|
12
|
+
record: Values;
|
|
13
|
+
/** The row's version as the page now reads it. */
|
|
14
|
+
version: number;
|
|
15
|
+
/** The step's body (`{ id, input }`) from the parsed values and the version the row was opened on; `null` when nothing changed. */
|
|
16
|
+
toRequest: (values: Parsed, version: number) => Record<string, unknown> | null;
|
|
17
|
+
/** Ends the edit once the save went through. */
|
|
18
|
+
onSaved: () => void;
|
|
19
|
+
/** The field to focus for a refused name that is no field itself (a stable function). */
|
|
20
|
+
focusOf?: (name: string) => string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One row of an editable list saved through its route's action, as a section
|
|
24
|
+
* is (`useSectionSave`): a field's refusal under the field, a stale version
|
|
25
|
+
* as the row's `notice` with a reload, the form reset with the record the
|
|
26
|
+
* page reads once saved. The row takes the record as the page reads it when
|
|
27
|
+
* it opens (values and version), and a save posts the version it was opened
|
|
28
|
+
* on, so a page read again meanwhile never turns a stale save into a fresh
|
|
29
|
+
* one.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useRowSave<Values, Parsed>({ form, editing, intent, record, version, toRequest, onSaved, focusOf, }: RowSaveOptions<Values, Parsed>): SectionSave;
|
|
32
|
+
//# sourceMappingURL=use-row-save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-row-save.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-row-save.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AAEtE,+BAA+B;AAC/B,MAAM,WAAW,cAAc,CAAC,MAAM,EAAE,MAAM;IAC7C,sBAAsB;IACtB,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,yHAAyH;IACzH,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,mIAAmI;IACnI,SAAS,EAAE,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,KACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACpC,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yFAAyF;IACzF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAC1C,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,GACP,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,CAsB9C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type BaseSyntheticEvent } from 'react';
|
|
2
|
+
import { type SectionForm } from './section-form';
|
|
3
|
+
import { type SectionNotice } from './section-save';
|
|
4
|
+
/** What `useSectionSave` takes. */
|
|
5
|
+
export interface SectionSaveOptions<Values, Parsed> {
|
|
6
|
+
/** The section's form (React Hook Form's `useForm()` result fits). */
|
|
7
|
+
form: SectionForm<Values, Parsed>;
|
|
8
|
+
/** The section's name: posted as `intent`, and what tells its answer from another section's. */
|
|
9
|
+
intent: string;
|
|
10
|
+
/** The API input of the section from the parsed values; `null` when nothing changed: nothing is posted and the edit ends. */
|
|
11
|
+
toInput: (values: Parsed) => Record<string, unknown> | null;
|
|
12
|
+
/** The record's form values as the page now reads them: the form is reset to them once a save went through. */
|
|
13
|
+
record: Values;
|
|
14
|
+
/** Ends the edit, after the form was reset. */
|
|
15
|
+
onSaved: () => void;
|
|
16
|
+
/** Called once a reload refilled the form from the record read again. */
|
|
17
|
+
onRefilled?: () => void;
|
|
18
|
+
/** The field to focus for a refused name that is no field itself (a stable function). */
|
|
19
|
+
focusOf?: (name: string) => string;
|
|
20
|
+
}
|
|
21
|
+
/** What `useSectionSave` returns, for the section's component. */
|
|
22
|
+
export interface SectionSave {
|
|
23
|
+
/** The form's submit handler. */
|
|
24
|
+
onSubmit: (event?: BaseSyntheticEvent) => Promise<unknown> | void;
|
|
25
|
+
/** A save is in flight. */
|
|
26
|
+
busy: boolean;
|
|
27
|
+
/** What to show above the fields (the app words and draws it), or `undefined`. */
|
|
28
|
+
notice: SectionNotice | undefined;
|
|
29
|
+
/** Puts the form back on the record (the section closes the form after). */
|
|
30
|
+
onCancel: () => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One section of a read-only record saved through its route's action
|
|
34
|
+
* (`sectionAction`): the parsed values are posted as JSON with the section's
|
|
35
|
+
* `intent`, and
|
|
36
|
+
* - a field's refusal is put under the field, the first refused one focused;
|
|
37
|
+
* - a stale version is the `notice`, the edit kept open, with a `reload`
|
|
38
|
+
* that revalidates the page and refills the form from the record read
|
|
39
|
+
* again;
|
|
40
|
+
* - a save that went through resets the form with the record the page now
|
|
41
|
+
* reads and calls `onSaved`.
|
|
42
|
+
*
|
|
43
|
+
* It is headless: `notice` is data, drawn by the app's own component.
|
|
44
|
+
*/
|
|
45
|
+
export declare function useSectionSave<Values, Parsed>({ form, intent, toInput, record, onSaved, focusOf, onRefilled, }: SectionSaveOptions<Values, Parsed>): SectionSave;
|
|
46
|
+
//# sourceMappingURL=use-section-save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-section-save.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-section-save.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,kBAAkB,EAKvB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAIN,KAAK,aAAa,EAClB,MAAM,gBAAgB,CAAC;AAExB,mCAAmC;AACnC,MAAM,WAAW,kBAAkB,CAAC,MAAM,EAAE,MAAM;IACjD,sEAAsE;IACtE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAC;IACf,6HAA6H;IAC7H,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,+GAA+G;IAC/G,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,yFAAyF;IACzF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC3B,iCAAiC;IACjC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAClE,2BAA2B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,MAAM,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAC9C,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,GACV,EAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,CA4ClD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface VisibleIntervalOptions {
|
|
2
|
+
/** `false` stops the timer. Default `true`. */
|
|
3
|
+
readonly enabled?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Run the callback as soon as a hidden page becomes visible again, when at
|
|
6
|
+
* least the interval has passed since its last run. Default `true`.
|
|
7
|
+
*/
|
|
8
|
+
readonly runOnVisible?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runs `callback` every `ms` **only while the page is visible**
|
|
12
|
+
* (`document.visibilityState`), for a screen that has no real-time channel
|
|
13
|
+
* (a revalidation, a fetcher's `load`). A tick that fires while the page is
|
|
14
|
+
* hidden is skipped; when the page becomes visible again after at least `ms`
|
|
15
|
+
* since the last run, the callback runs at once (`runOnVisible`); a page that
|
|
16
|
+
* comes back sooner waits for the next tick. The timer and the listener are
|
|
17
|
+
* cleared on unmount and while `enabled` is false. `ms` must be positive.
|
|
18
|
+
*
|
|
19
|
+
* The callback is read from a ref: a new function each render never restarts
|
|
20
|
+
* the timer, and the latest one runs. Skipping a read already in flight is the
|
|
21
|
+
* callback's to decide. On the server nothing starts (effects do not run).
|
|
22
|
+
*/
|
|
23
|
+
export declare function useVisibleInterval(callback: () => void, ms: number, options?: VisibleIntervalOptions): void;
|
|
24
|
+
//# sourceMappingURL=use-visible-interval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visible-interval.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-visible-interval.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,IAAI,EACpB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,sBAA2B,GAClC,IAAI,CAuBN"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VisibleIntervalOptions } from './use-visible-interval';
|
|
2
|
+
/**
|
|
3
|
+
* Runs the current route's loaders again every `ms`, **only while the page is
|
|
4
|
+
* visible**, and at once when a hidden page comes back after more than `ms`
|
|
5
|
+
* (`useVisibleInterval` over React Router's `useRevalidator`). A revalidation
|
|
6
|
+
* already in flight is not doubled. `enabled: false` stops it (a menu is open,
|
|
7
|
+
* a change is in flight).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useVisibleRevalidation(ms: number, options?: Pick<VisibleIntervalOptions, 'enabled'>): void;
|
|
10
|
+
//# sourceMappingURL=use-visible-revalidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visible-revalidation.d.ts","sourceRoot":"","sources":["../../src/fetcher/use-visible-revalidation.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAC/C,IAAI,CASN"}
|
package/dist/health.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createServer({ health })`: the liveness probe, declared first. It is
|
|
3
|
+
* `@softistx/alxia`'s `health()` mounted alone, in text.
|
|
4
|
+
*/
|
|
5
|
+
import { type AnyAlxia, type MaybePromise } from '@softistx/alxia';
|
|
6
|
+
/** `createServer({ health })` in its long form. */
|
|
7
|
+
export interface ServerHealth {
|
|
8
|
+
/** Where the probe answers, `GET`: `/health` by default. */
|
|
9
|
+
readonly path?: `/${string}`;
|
|
10
|
+
/**
|
|
11
|
+
* Called on each probe: the probe answers 503 `unavailable` when it
|
|
12
|
+
* returns `false`, throws, rejects or outlasts `timeout`; `undefined` or
|
|
13
|
+
* no return value counts as healthy. The error is not logged.
|
|
14
|
+
*/
|
|
15
|
+
readonly check?: () => MaybePromise<boolean | undefined | void>;
|
|
16
|
+
/** How long `check` may take, in milliseconds: 1 000 by default. */
|
|
17
|
+
readonly timeout?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Declares the probe on `app`, before anything else. */
|
|
20
|
+
export declare function declareHealth(app: AnyAlxia, option: `/${string}` | ServerHealth): void;
|
|
21
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../src/health.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,QAAQ,EAAU,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3E,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IAChE,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAC5B,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,IAAI,MAAM,EAAE,GAAG,YAAY,GACjC,IAAI,CAYN"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RouteEntry } from './routes';
|
|
2
|
+
export interface CheckHelpOptions {
|
|
3
|
+
/** The app's root. Default: the current directory. */
|
|
4
|
+
readonly root?: string;
|
|
5
|
+
/** The route config file. Default: `app/routes.ts`. */
|
|
6
|
+
readonly routes?: string;
|
|
7
|
+
/** The flows folder. Default: `docs/flows`. */
|
|
8
|
+
readonly flows?: string;
|
|
9
|
+
/** Route ids (with `*`) that need no flow: resource routes, redirects. */
|
|
10
|
+
readonly ignore?: readonly string[];
|
|
11
|
+
/** The routes, instead of reading `routes`: a spec's or a custom loader's. */
|
|
12
|
+
readonly config?: readonly RouteEntry[];
|
|
13
|
+
}
|
|
14
|
+
export interface HelpProblem {
|
|
15
|
+
readonly kind: 'uncovered-route' | 'unknown-route' | 'missing-capture' | 'bad-flow' | 'unused-ignore';
|
|
16
|
+
readonly message: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckHelpResult {
|
|
19
|
+
readonly ok: boolean;
|
|
20
|
+
readonly problems: readonly HelpProblem[];
|
|
21
|
+
readonly flows: number;
|
|
22
|
+
readonly screens: number;
|
|
23
|
+
}
|
|
24
|
+
/** The route config of an app: its default export, awaited. */
|
|
25
|
+
export declare function readRouteConfig(file: string): Promise<readonly RouteEntry[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Checks the flows against the routes and the captures:
|
|
28
|
+
* - every screen route (no children, not ignored) is cited by a flow, or sits
|
|
29
|
+
* under a layout a flow cites (as `resolveHelp` does at runtime);
|
|
30
|
+
* - every route a flow cites exists;
|
|
31
|
+
* - every capture a flow cites has its four WebP variants;
|
|
32
|
+
* - every flow file parses (the format errors are reported, not thrown).
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkHelp(options?: CheckHelpOptions): Promise<CheckHelpResult>;
|
|
35
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/help/check/check.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAChC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EACV,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,UAAU,GACV,eAAe,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,wBAAsB,eAAe,CACpC,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAWhC;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC9B,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,eAAe,CAAC,CA6F1B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@softistx/alxia-react-router/help/check`: the coverage check of the flow docs
|
|
3
|
+
* against the route config and the captures, for the green bar. It reads
|
|
4
|
+
* files, so it runs in Bun or Node, never in the page.
|
|
5
|
+
*/
|
|
6
|
+
export { type CheckHelpOptions, type CheckHelpResult, checkHelp, type HelpProblem, readRouteConfig, } from './check';
|
|
7
|
+
export { type FlatRoute, flattenRoutes, matchesIgnore, type RouteEntry, routeId, } from './routes';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|