@softistx/alxia-react-router 0.0.0-stage → 0.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2085 -2
- package/dist/api-keys/api-keys.d.ts +93 -0
- package/dist/api-keys/api-keys.d.ts.map +1 -0
- package/dist/api-keys/index.d.ts +9 -0
- package/dist/api-keys/index.d.ts.map +1 -0
- package/dist/api-keys/index.js +66 -0
- package/dist/api-keys/index.js.map +10 -0
- package/dist/assets.d.ts +14 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/chunks/index-0786n4qe.js +25 -0
- package/dist/chunks/index-0786n4qe.js.map +10 -0
- package/dist/chunks/index-1nw5yeek.js +169 -0
- package/dist/chunks/index-1nw5yeek.js.map +11 -0
- package/dist/chunks/index-59vhfj6n.js +10 -0
- package/dist/chunks/index-59vhfj6n.js.map +10 -0
- package/dist/chunks/index-5gqcpyyg.js +34 -0
- package/dist/chunks/index-5gqcpyyg.js.map +10 -0
- package/dist/chunks/index-6jf7zpxz.js +119 -0
- package/dist/chunks/index-6jf7zpxz.js.map +11 -0
- package/dist/chunks/index-8as4j8m3.js +340 -0
- package/dist/chunks/index-8as4j8m3.js.map +16 -0
- package/dist/chunks/index-9xv2a8et.js +108 -0
- package/dist/chunks/index-9xv2a8et.js.map +11 -0
- package/dist/chunks/index-ajtvyq35.js +16 -0
- package/dist/chunks/index-ajtvyq35.js.map +10 -0
- package/dist/chunks/index-c55hxgr5.js +124 -0
- package/dist/chunks/index-c55hxgr5.js.map +14 -0
- package/dist/chunks/index-d42p3mdp.js +19 -0
- package/dist/chunks/index-d42p3mdp.js.map +10 -0
- package/dist/chunks/index-gac44rs5.js +42 -0
- package/dist/chunks/index-gac44rs5.js.map +11 -0
- package/dist/chunks/index-j4ktpcke.js +62 -0
- package/dist/chunks/index-j4ktpcke.js.map +10 -0
- package/dist/chunks/index-mscfme4r.js +12 -0
- package/dist/chunks/index-mscfme4r.js.map +10 -0
- package/dist/chunks/index-pghmb2dm.js +30 -0
- package/dist/chunks/index-pghmb2dm.js.map +10 -0
- package/dist/chunks/index-rfr02vg4.js +40 -0
- package/dist/chunks/index-rfr02vg4.js.map +10 -0
- package/dist/chunks/index-sfhshxqz.js +31 -0
- package/dist/chunks/index-sfhshxqz.js.map +10 -0
- package/dist/chunks/index-skwypsjz.js +357 -0
- package/dist/chunks/index-skwypsjz.js.map +12 -0
- package/dist/chunks/index-sxh06ged.js +118 -0
- package/dist/chunks/index-sxh06ged.js.map +11 -0
- package/dist/chunks/index-t2ph23wk.js +96 -0
- package/dist/chunks/index-t2ph23wk.js.map +13 -0
- package/dist/chunks/index-thyabr5n.js +19 -0
- package/dist/chunks/index-thyabr5n.js.map +10 -0
- package/dist/chunks/index-tx36swjx.js +134 -0
- package/dist/chunks/index-tx36swjx.js.map +11 -0
- package/dist/chunks/index-v2z5k640.js +54 -0
- package/dist/chunks/index-v2z5k640.js.map +11 -0
- package/dist/chunks/index-vr82typq.js +23 -0
- package/dist/chunks/index-vr82typq.js.map +11 -0
- package/dist/chunks/index-whj6h5eg.js +9 -0
- package/dist/chunks/index-whj6h5eg.js.map +10 -0
- package/dist/chunks/index-wyypkfdv.js +130 -0
- package/dist/chunks/index-wyypkfdv.js.map +13 -0
- package/dist/chunks/index-xd5aqy3g.js +90 -0
- package/dist/chunks/index-xd5aqy3g.js.map +10 -0
- package/dist/chunks/index-zdbqzcjp.js +97 -0
- package/dist/chunks/index-zdbqzcjp.js.map +12 -0
- package/dist/chunks/index-zyg8amjc.js +23 -0
- package/dist/chunks/index-zyg8amjc.js.map +10 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +215 -0
- package/dist/cli/index.js.map +13 -0
- package/dist/cli/main.d.ts +13 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/reveal.d.ts +18 -0
- package/dist/cli/reveal.d.ts.map +1 -0
- package/dist/cli/template.d.ts +8 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/context.d.ts +104 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/document/index.d.ts +11 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +19 -0
- package/dist/document/index.js.map +9 -0
- package/dist/document/inline-script.d.ts +27 -0
- package/dist/document/inline-script.d.ts.map +1 -0
- package/dist/document/language-store.d.ts +8 -0
- package/dist/document/language-store.d.ts.map +1 -0
- package/dist/document/nonce.d.ts +34 -0
- package/dist/document/nonce.d.ts.map +1 -0
- package/dist/document/page-language.d.ts +39 -0
- package/dist/document/page-language.d.ts.map +1 -0
- package/dist/document/text-direction.d.ts +10 -0
- package/dist/document/text-direction.d.ts.map +1 -0
- package/dist/entry/abort.d.ts +21 -0
- package/dist/entry/abort.d.ts.map +1 -0
- package/dist/entry/create-entry.d.ts +41 -0
- package/dist/entry/create-entry.d.ts.map +1 -0
- package/dist/entry/index.d.ts +8 -0
- package/dist/entry/index.d.ts.map +1 -0
- package/dist/entry/index.js +154 -0
- package/dist/entry/index.js.map +13 -0
- package/dist/entry/root-data.d.ts +27 -0
- package/dist/entry/root-data.d.ts.map +1 -0
- package/dist/entry/whole-page.d.ts +10 -0
- package/dist/entry/whole-page.d.ts.map +1 -0
- package/dist/errors/api-error.d.ts +117 -0
- package/dist/errors/api-error.d.ts.map +1 -0
- package/dist/errors/api-errors.d.ts +122 -0
- package/dist/errors/api-errors.d.ts.map +1 -0
- package/dist/errors/call-failure.d.ts +45 -0
- package/dist/errors/call-failure.d.ts.map +1 -0
- package/dist/errors/catalogue-check.d.ts +24 -0
- package/dist/errors/catalogue-check.d.ts.map +1 -0
- package/dist/errors/catalogue-read.d.ts +33 -0
- package/dist/errors/catalogue-read.d.ts.map +1 -0
- package/dist/errors/catalogue.d.ts +59 -0
- package/dist/errors/catalogue.d.ts.map +1 -0
- package/dist/errors/code-resolver.d.ts +44 -0
- package/dist/errors/code-resolver.d.ts.map +1 -0
- package/dist/errors/cross-site.d.ts +8 -0
- package/dist/errors/cross-site.d.ts.map +1 -0
- package/dist/errors/describe-refusal.d.ts +6 -0
- package/dist/errors/describe-refusal.d.ts.map +1 -0
- package/dist/errors/describe.d.ts +3 -0
- package/dist/errors/describe.d.ts.map +1 -0
- package/dist/errors/fetcher-result.d.ts +33 -0
- package/dist/errors/fetcher-result.d.ts.map +1 -0
- package/dist/errors/field-placement.d.ts +12 -0
- package/dist/errors/field-placement.d.ts.map +1 -0
- package/dist/errors/form-errors.d.ts +8 -0
- package/dist/errors/form-errors.d.ts.map +1 -0
- package/dist/errors/form-refusal.d.ts +25 -0
- package/dist/errors/form-refusal.d.ts.map +1 -0
- package/dist/errors/index.d.ts +21 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +588 -0
- package/dist/errors/index.js.map +26 -0
- package/dist/errors/json-actions.d.ts +38 -0
- package/dist/errors/json-actions.d.ts.map +1 -0
- package/dist/errors/log.d.ts +8 -0
- package/dist/errors/log.d.ts.map +1 -0
- package/dist/errors/message-values.d.ts +11 -0
- package/dist/errors/message-values.d.ts.map +1 -0
- package/dist/errors/messages.d.ts +63 -0
- package/dist/errors/messages.d.ts.map +1 -0
- package/dist/errors/page-path.d.ts +9 -0
- package/dist/errors/page-path.d.ts.map +1 -0
- package/dist/errors/problem-error.d.ts +50 -0
- package/dist/errors/problem-error.d.ts.map +1 -0
- package/dist/errors/provider.d.ts +20 -0
- package/dist/errors/provider.d.ts.map +1 -0
- package/dist/errors/request-id.d.ts +5 -0
- package/dist/errors/request-id.d.ts.map +1 -0
- package/dist/errors/route-error.d.ts +33 -0
- package/dist/errors/route-error.d.ts.map +1 -0
- package/dist/errors/route-refusal.d.ts +20 -0
- package/dist/errors/route-refusal.d.ts.map +1 -0
- package/dist/errors/same-site.d.ts +49 -0
- package/dist/errors/same-site.d.ts.map +1 -0
- package/dist/errors/section-action.d.ts +46 -0
- package/dist/errors/section-action.d.ts.map +1 -0
- package/dist/errors/standard-schema.d.ts +34 -0
- package/dist/errors/standard-schema.d.ts.map +1 -0
- package/dist/errors/submit-form.d.ts +16 -0
- package/dist/errors/submit-form.d.ts.map +1 -0
- package/dist/errors/upstream-headers.d.ts +18 -0
- package/dist/errors/upstream-headers.d.ts.map +1 -0
- package/dist/errors/use-json-fetcher.d.ts +18 -0
- package/dist/errors/use-json-fetcher.d.ts.map +1 -0
- package/dist/fetcher/auth-refusal.d.ts +29 -0
- package/dist/fetcher/auth-refusal.d.ts.map +1 -0
- package/dist/fetcher/index.d.ts +20 -0
- package/dist/fetcher/index.d.ts.map +1 -0
- package/dist/fetcher/index.js +392 -0
- package/dist/fetcher/index.js.map +21 -0
- package/dist/fetcher/section-form.d.ts +24 -0
- package/dist/fetcher/section-form.d.ts.map +1 -0
- package/dist/fetcher/section-reload.d.ts +17 -0
- package/dist/fetcher/section-reload.d.ts.map +1 -0
- package/dist/fetcher/section-save.d.ts +29 -0
- package/dist/fetcher/section-save.d.ts.map +1 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts +57 -0
- package/dist/fetcher/use-debounced-fetcher.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-answer.d.ts +16 -0
- package/dist/fetcher/use-fetcher-answer.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-done.d.ts +15 -0
- package/dist/fetcher/use-fetcher-done.d.ts.map +1 -0
- package/dist/fetcher/use-fetcher-promise.d.ts +48 -0
- package/dist/fetcher/use-fetcher-promise.d.ts.map +1 -0
- package/dist/fetcher/use-form-refusal.d.ts +20 -0
- package/dist/fetcher/use-form-refusal.d.ts.map +1 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts +20 -0
- package/dist/fetcher/use-revalidate-on-focus.d.ts.map +1 -0
- package/dist/fetcher/use-row-save.d.ts +32 -0
- package/dist/fetcher/use-row-save.d.ts.map +1 -0
- package/dist/fetcher/use-section-save.d.ts +46 -0
- package/dist/fetcher/use-section-save.d.ts.map +1 -0
- package/dist/fetcher/use-visible-interval.d.ts +24 -0
- package/dist/fetcher/use-visible-interval.d.ts.map +1 -0
- package/dist/fetcher/use-visible-revalidation.d.ts +10 -0
- package/dist/fetcher/use-visible-revalidation.d.ts.map +1 -0
- package/dist/health.d.ts +21 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/help/check/check.d.ts +35 -0
- package/dist/help/check/check.d.ts.map +1 -0
- package/dist/help/check/index.d.ts +8 -0
- package/dist/help/check/index.d.ts.map +1 -0
- package/dist/help/check/index.js +17 -0
- package/dist/help/check/index.js.map +9 -0
- package/dist/help/check/routes.d.ts +22 -0
- package/dist/help/check/routes.d.ts.map +1 -0
- package/dist/help/guide.d.ts +33 -0
- package/dist/help/guide.d.ts.map +1 -0
- package/dist/help/index.d.ts +16 -0
- package/dist/help/index.d.ts.map +1 -0
- package/dist/help/index.js +192 -0
- package/dist/help/index.js.map +14 -0
- package/dist/help/load.d.ts +39 -0
- package/dist/help/load.d.ts.map +1 -0
- package/dist/help/panel.d.ts +69 -0
- package/dist/help/panel.d.ts.map +1 -0
- package/dist/help/parse-flow.d.ts +27 -0
- package/dist/help/parse-flow.d.ts.map +1 -0
- package/dist/help/react.d.ts +12 -0
- package/dist/help/react.d.ts.map +1 -0
- package/dist/help/resolve.d.ts +24 -0
- package/dist/help/resolve.d.ts.map +1 -0
- package/dist/help/types.d.ts +50 -0
- package/dist/help/types.d.ts.map +1 -0
- package/dist/help/yaml.d.ts +18 -0
- package/dist/help/yaml.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +14 -0
- package/dist/link/index.d.ts +7 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +16 -0
- package/dist/link/index.js.map +10 -0
- package/dist/link/router-link.d.ts +27 -0
- package/dist/link/router-link.d.ts.map +1 -0
- package/dist/lists/connection-page.d.ts +50 -0
- package/dist/lists/connection-page.d.ts.map +1 -0
- package/dist/lists/index.d.ts +13 -0
- package/dist/lists/index.d.ts.map +1 -0
- package/dist/lists/index.js +205 -0
- package/dist/lists/index.js.map +15 -0
- package/dist/lists/newest-first.d.ts +5 -0
- package/dist/lists/newest-first.d.ts.map +1 -0
- package/dist/lists/nodes-of.d.ts +21 -0
- package/dist/lists/nodes-of.d.ts.map +1 -0
- package/dist/lists/or-failed.d.ts +19 -0
- package/dist/lists/or-failed.d.ts.map +1 -0
- package/dist/lists/use-paged-rows.d.ts +40 -0
- package/dist/lists/use-paged-rows.d.ts.map +1 -0
- package/dist/lists/use-same-route-loading.d.ts +8 -0
- package/dist/lists/use-same-route-loading.d.ts.map +1 -0
- package/dist/lists/use-search-change.d.ts +20 -0
- package/dist/lists/use-search-change.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +105 -0
- package/dist/mcp/index.js.map +11 -0
- package/dist/mcp/mcp-relay.d.ts +58 -0
- package/dist/mcp/mcp-relay.d.ts.map +1 -0
- package/dist/mcp/relay.d.ts +38 -0
- package/dist/mcp/relay.d.ts.map +1 -0
- package/dist/media/client/error.d.ts +29 -0
- package/dist/media/client/error.d.ts.map +1 -0
- package/dist/media/client/index.d.ts +8 -0
- package/dist/media/client/index.d.ts.map +1 -0
- package/dist/media/client/index.js +133 -0
- package/dist/media/client/index.js.map +11 -0
- package/dist/media/client/upload.d.ts +32 -0
- package/dist/media/client/upload.d.ts.map +1 -0
- package/dist/media/forward.d.ts +14 -0
- package/dist/media/forward.d.ts.map +1 -0
- package/dist/media/headers.d.ts +11 -0
- package/dist/media/headers.d.ts.map +1 -0
- package/dist/media/index.d.ts +9 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +396 -0
- package/dist/media/index.js.map +16 -0
- package/dist/media/options.d.ts +114 -0
- package/dist/media/options.d.ts.map +1 -0
- package/dist/media/path.d.ts +12 -0
- package/dist/media/path.d.ts.map +1 -0
- package/dist/media/read.d.ts +11 -0
- package/dist/media/read.d.ts.map +1 -0
- package/dist/media/refusal.d.ts +11 -0
- package/dist/media/refusal.d.ts.map +1 -0
- package/dist/media/respond.d.ts +8 -0
- package/dist/media/respond.d.ts.map +1 -0
- package/dist/media/write.d.ts +13 -0
- package/dist/media/write.d.ts.map +1 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +48 -0
- package/dist/navigation/index.js.map +11 -0
- package/dist/navigation/use-focus-on-navigate.d.ts +16 -0
- package/dist/navigation/use-focus-on-navigate.d.ts.map +1 -0
- package/dist/navigation/use-route-transition.d.ts +19 -0
- package/dist/navigation/use-route-transition.d.ts.map +1 -0
- package/dist/nonce.d.ts +16 -0
- package/dist/nonce.d.ts.map +1 -0
- package/dist/oauth/answer.d.ts +33 -0
- package/dist/oauth/answer.d.ts.map +1 -0
- package/dist/oauth/binding.d.ts +43 -0
- package/dist/oauth/binding.d.ts.map +1 -0
- package/dist/oauth/consent.d.ts +134 -0
- package/dist/oauth/consent.d.ts.map +1 -0
- package/dist/oauth/grants.d.ts +88 -0
- package/dist/oauth/grants.d.ts.map +1 -0
- package/dist/oauth/index.d.ts +16 -0
- package/dist/oauth/index.d.ts.map +1 -0
- package/dist/oauth/index.js +207 -0
- package/dist/oauth/index.js.map +12 -0
- package/dist/oauth/model.d.ts +13 -0
- package/dist/oauth/model.d.ts.map +1 -0
- package/dist/oauth/react/index.d.ts +7 -0
- package/dist/oauth/react/index.d.ts.map +1 -0
- package/dist/oauth/react/index.js +99 -0
- package/dist/oauth/react/index.js.map +10 -0
- package/dist/oauth/react/use-consent.d.ts +52 -0
- package/dist/oauth/react/use-consent.d.ts.map +1 -0
- package/dist/oidc/dpop.d.ts +80 -0
- package/dist/oidc/dpop.d.ts.map +1 -0
- package/dist/oidc/errors.d.ts +16 -0
- package/dist/oidc/errors.d.ts.map +1 -0
- package/dist/oidc/flow.d.ts +59 -0
- package/dist/oidc/flow.d.ts.map +1 -0
- package/dist/oidc/index.d.ts +11 -0
- package/dist/oidc/index.d.ts.map +1 -0
- package/dist/oidc/index.js +742 -0
- package/dist/oidc/index.js.map +15 -0
- package/dist/oidc/oidc.d.ts +132 -0
- package/dist/oidc/oidc.d.ts.map +1 -0
- package/dist/oidc/revoke.d.ts +28 -0
- package/dist/oidc/revoke.d.ts.map +1 -0
- package/dist/oidc/seal.d.ts +20 -0
- package/dist/oidc/seal.d.ts.map +1 -0
- package/dist/pwa/build/build-worker.d.ts +41 -0
- package/dist/pwa/build/build-worker.d.ts.map +1 -0
- package/dist/pwa/build/index.d.ts +9 -0
- package/dist/pwa/build/index.d.ts.map +1 -0
- package/dist/pwa/build/index.js +9 -0
- package/dist/pwa/build/index.js.map +9 -0
- package/dist/pwa/build/precache.d.ts +17 -0
- package/dist/pwa/build/precache.d.ts.map +1 -0
- package/dist/pwa/index.d.ts +16 -0
- package/dist/pwa/index.d.ts.map +1 -0
- package/dist/pwa/index.js +110 -0
- package/dist/pwa/index.js.map +12 -0
- package/dist/pwa/model/caching.d.ts +46 -0
- package/dist/pwa/model/caching.d.ts.map +1 -0
- package/dist/pwa/model/clear-app-caches.d.ts +9 -0
- package/dist/pwa/model/clear-app-caches.d.ts.map +1 -0
- package/dist/pwa/model/font-precache.d.ts +15 -0
- package/dist/pwa/model/font-precache.d.ts.map +1 -0
- package/dist/pwa/model/manifest.d.ts +80 -0
- package/dist/pwa/model/manifest.d.ts.map +1 -0
- package/dist/pwa/model/precache-list.d.ts +40 -0
- package/dist/pwa/model/precache-list.d.ts.map +1 -0
- package/dist/pwa/model/registration.d.ts +39 -0
- package/dist/pwa/model/registration.d.ts.map +1 -0
- package/dist/pwa/model/start-service-worker.d.ts +24 -0
- package/dist/pwa/model/start-service-worker.d.ts.map +1 -0
- package/dist/pwa/model/storable.d.ts +8 -0
- package/dist/pwa/model/storable.d.ts.map +1 -0
- package/dist/pwa/model/theme-color.d.ts +20 -0
- package/dist/pwa/model/theme-color.d.ts.map +1 -0
- package/dist/pwa/model/update-notice.d.ts +38 -0
- package/dist/pwa/model/update-notice.d.ts.map +1 -0
- package/dist/pwa/model/worker-contract.d.ts +61 -0
- package/dist/pwa/model/worker-contract.d.ts.map +1 -0
- package/dist/pwa/react/index.d.ts +9 -0
- package/dist/pwa/react/index.d.ts.map +1 -0
- package/dist/pwa/react/index.js +75 -0
- package/dist/pwa/react/index.js.map +13 -0
- package/dist/pwa/react/use-online.d.ts +6 -0
- package/dist/pwa/react/use-online.d.ts.map +1 -0
- package/dist/pwa/react/use-service-worker.d.ts +33 -0
- package/dist/pwa/react/use-service-worker.d.ts.map +1 -0
- package/dist/pwa/react/use-update-notice.d.ts +14 -0
- package/dist/pwa/react/use-update-notice.d.ts.map +1 -0
- package/dist/pwa/server/index.d.ts +7 -0
- package/dist/pwa/server/index.d.ts.map +1 -0
- package/dist/pwa/server/index.js +18 -0
- package/dist/pwa/server/index.js.map +10 -0
- package/dist/pwa/server/no-cache.d.ts +22 -0
- package/dist/pwa/server/no-cache.d.ts.map +1 -0
- package/dist/pwa/worker/index.d.ts +9 -0
- package/dist/pwa/worker/index.d.ts.map +1 -0
- package/dist/pwa/worker/index.js +144 -0
- package/dist/pwa/worker/index.js.map +12 -0
- package/dist/pwa/worker/injected.d.ts +15 -0
- package/dist/pwa/worker/injected.d.ts.map +1 -0
- package/dist/pwa/worker/plan.d.ts +65 -0
- package/dist/pwa/worker/plan.d.ts.map +1 -0
- package/dist/pwa/worker/scope.d.ts +18 -0
- package/dist/pwa/worker/scope.d.ts.map +1 -0
- package/dist/pwa/worker/start-worker.d.ts +17 -0
- package/dist/pwa/worker/start-worker.d.ts.map +1 -0
- package/dist/react-router.d.ts +68 -0
- package/dist/react-router.d.ts.map +1 -0
- package/dist/server.d.ts +127 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/session/codes.d.ts +9 -0
- package/dist/session/codes.d.ts.map +1 -0
- package/dist/session/cookies.d.ts +128 -0
- package/dist/session/cookies.d.ts.map +1 -0
- package/dist/session/flow-types.d.ts +235 -0
- package/dist/session/flow-types.d.ts.map +1 -0
- package/dist/session/guard.d.ts +10 -0
- package/dist/session/guard.d.ts.map +1 -0
- package/dist/session/index.d.ts +22 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +1090 -0
- package/dist/session/index.js.map +27 -0
- package/dist/session/land.d.ts +28 -0
- package/dist/session/land.d.ts.map +1 -0
- package/dist/session/link-json.d.ts +22 -0
- package/dist/session/link-json.d.ts.map +1 -0
- package/dist/session/link-land.d.ts +20 -0
- package/dist/session/link-land.d.ts.map +1 -0
- package/dist/session/link-token.d.ts +24 -0
- package/dist/session/link-token.d.ts.map +1 -0
- package/dist/session/link-types.d.ts +142 -0
- package/dist/session/link-types.d.ts.map +1 -0
- package/dist/session/links.d.ts +14 -0
- package/dist/session/links.d.ts.map +1 -0
- package/dist/session/model/index.d.ts +8 -0
- package/dist/session/model/index.d.ts.map +1 -0
- package/dist/session/model/index.js +35 -0
- package/dist/session/model/index.js.map +9 -0
- package/dist/session/model/link-post.d.ts +35 -0
- package/dist/session/model/link-post.d.ts.map +1 -0
- package/dist/session/model/paths.d.ts +24 -0
- package/dist/session/model/paths.d.ts.map +1 -0
- package/dist/session/model/safe-next.d.ts +15 -0
- package/dist/session/model/safe-next.d.ts.map +1 -0
- package/dist/session/model/second-factor.d.ts +16 -0
- package/dist/session/model/second-factor.d.ts.map +1 -0
- package/dist/session/model/site-path.d.ts +10 -0
- package/dist/session/model/site-path.d.ts.map +1 -0
- package/dist/session/model/step-up-answers.d.ts +45 -0
- package/dist/session/model/step-up-answers.d.ts.map +1 -0
- package/dist/session/model/step-up-props.d.ts +22 -0
- package/dist/session/model/step-up-props.d.ts.map +1 -0
- package/dist/session/model/step-up.d.ts +48 -0
- package/dist/session/model/step-up.d.ts.map +1 -0
- package/dist/session/react/index.d.ts +13 -0
- package/dist/session/react/index.d.ts.map +1 -0
- package/dist/session/react/index.js +196 -0
- package/dist/session/react/index.js.map +14 -0
- package/dist/session/react/step-up/answers.d.ts +9 -0
- package/dist/session/react/step-up/answers.d.ts.map +1 -0
- package/dist/session/react/step-up/dialog-props.d.ts +27 -0
- package/dist/session/react/step-up/dialog-props.d.ts.map +1 -0
- package/dist/session/react/step-up/index.d.ts +7 -0
- package/dist/session/react/step-up/index.d.ts.map +1 -0
- package/dist/session/react/step-up/pending-runs.d.ts +21 -0
- package/dist/session/react/step-up/pending-runs.d.ts.map +1 -0
- package/dist/session/react/step-up/phase.d.ts +8 -0
- package/dist/session/react/step-up/phase.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts +59 -0
- package/dist/session/react/step-up/use-step-up-replay.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts +70 -0
- package/dist/session/react/step-up/use-step-up-runner.d.ts.map +1 -0
- package/dist/session/react/step-up/use-step-up.d.ts +51 -0
- package/dist/session/react/step-up/use-step-up.d.ts.map +1 -0
- package/dist/session/react/use-code-field.d.ts +37 -0
- package/dist/session/react/use-code-field.d.ts.map +1 -0
- package/dist/session/react/use-link-fragment.d.ts +22 -0
- package/dist/session/react/use-link-fragment.d.ts.map +1 -0
- package/dist/session/react/use-link-param.d.ts +26 -0
- package/dist/session/react/use-link-param.d.ts.map +1 -0
- package/dist/session/react/use-link-post.d.ts +39 -0
- package/dist/session/react/use-link-post.d.ts.map +1 -0
- package/dist/session/react/use-sign-out.d.ts +46 -0
- package/dist/session/react/use-sign-out.d.ts.map +1 -0
- package/dist/session/second-factor.d.ts +22 -0
- package/dist/session/second-factor.d.ts.map +1 -0
- package/dist/session/serialize.d.ts +42 -0
- package/dist/session/serialize.d.ts.map +1 -0
- package/dist/session/sign-in.d.ts +19 -0
- package/dist/session/sign-in.d.ts.map +1 -0
- package/dist/session/signed.d.ts +44 -0
- package/dist/session/signed.d.ts.map +1 -0
- package/dist/session/social-flow.d.ts +22 -0
- package/dist/session/social-flow.d.ts.map +1 -0
- package/dist/session/social-land.d.ts +31 -0
- package/dist/session/social-land.d.ts.map +1 -0
- package/dist/session/social-types.d.ts +136 -0
- package/dist/session/social-types.d.ts.map +1 -0
- package/dist/session/social.d.ts +32 -0
- package/dist/session/social.d.ts.map +1 -0
- package/dist/session/step-up-codes.d.ts +9 -0
- package/dist/session/step-up-codes.d.ts.map +1 -0
- package/dist/session/step-up-signed-out.d.ts +21 -0
- package/dist/session/step-up-signed-out.d.ts.map +1 -0
- package/dist/session/step-up-types.d.ts +127 -0
- package/dist/session/step-up-types.d.ts.map +1 -0
- package/dist/session/step-up.d.ts +17 -0
- package/dist/session/step-up.d.ts.map +1 -0
- package/dist/session/step.d.ts +22 -0
- package/dist/session/step.d.ts.map +1 -0
- package/dist/session/throttle.d.ts +73 -0
- package/dist/session/throttle.d.ts.map +1 -0
- package/dist/session/timed-wait.d.ts +4 -0
- package/dist/session/timed-wait.d.ts.map +1 -0
- package/dist/session/viewer.d.ts +34 -0
- package/dist/session/viewer.d.ts.map +1 -0
- package/dist/subscription/documents.d.ts +3 -0
- package/dist/subscription/documents.d.ts.map +1 -0
- package/dist/subscription/index.d.ts +7 -0
- package/dist/subscription/index.d.ts.map +1 -0
- package/dist/subscription/index.js +359 -0
- package/dist/subscription/index.js.map +14 -0
- package/dist/subscription/proxy.d.ts +54 -0
- package/dist/subscription/proxy.d.ts.map +1 -0
- package/dist/subscription/react/backoff.d.ts +8 -0
- package/dist/subscription/react/backoff.d.ts.map +1 -0
- package/dist/subscription/react/classify.d.ts +15 -0
- package/dist/subscription/react/classify.d.ts.map +1 -0
- package/dist/subscription/react/controller.d.ts +40 -0
- package/dist/subscription/react/controller.d.ts.map +1 -0
- package/dist/subscription/react/fake-timers.d.ts +8 -0
- package/dist/subscription/react/fake-timers.d.ts.map +1 -0
- package/dist/subscription/react/index.d.ts +15 -0
- package/dist/subscription/react/index.d.ts.map +1 -0
- package/dist/subscription/react/index.js +227 -0
- package/dist/subscription/react/index.js.map +17 -0
- package/dist/subscription/react/reconnect.d.ts +9 -0
- package/dist/subscription/react/reconnect.d.ts.map +1 -0
- package/dist/subscription/react/scheduler.d.ts +13 -0
- package/dist/subscription/react/scheduler.d.ts.map +1 -0
- package/dist/subscription/react/timers.d.ts +7 -0
- package/dist/subscription/react/timers.d.ts.map +1 -0
- package/dist/subscription/react/use-live-subscription.d.ts +36 -0
- package/dist/subscription/react/use-live-subscription.d.ts.map +1 -0
- package/dist/subscription/react/versions.d.ts +6 -0
- package/dist/subscription/react/versions.d.ts.map +1 -0
- package/dist/subscription/read.d.ts +17 -0
- package/dist/subscription/read.d.ts.map +1 -0
- package/dist/subscription/refusal.d.ts +11 -0
- package/dist/subscription/refusal.d.ts.map +1 -0
- package/dist/subscription/relay.d.ts +16 -0
- package/dist/subscription/relay.d.ts.map +1 -0
- package/dist/vite/bun.d.ts +21 -0
- package/dist/vite/bun.d.ts.map +1 -0
- package/dist/vite/bundle.d.ts +33 -0
- package/dist/vite/bundle.d.ts.map +1 -0
- package/dist/vite/compress.d.ts +18 -0
- package/dist/vite/compress.d.ts.map +1 -0
- package/dist/vite/config.d.ts +33 -0
- package/dist/vite/config.d.ts.map +1 -0
- package/dist/vite/dev.d.ts +28 -0
- package/dist/vite/dev.d.ts.map +1 -0
- package/dist/vite/entry.d.ts +20 -0
- package/dist/vite/entry.d.ts.map +1 -0
- package/dist/vite/hosts.d.ts +16 -0
- package/dist/vite/hosts.d.ts.map +1 -0
- package/dist/vite/index.d.ts +68 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +635 -0
- package/dist/vite/index.js.map +22 -0
- package/dist/vite/inline.d.ts +18 -0
- package/dist/vite/inline.d.ts.map +1 -0
- package/dist/vite/node.d.ts +16 -0
- package/dist/vite/node.d.ts.map +1 -0
- package/dist/vite/preview.d.ts +8 -0
- package/dist/vite/preview.d.ts.map +1 -0
- package/dist/vite/runtime.d.ts +8 -0
- package/dist/vite/runtime.d.ts.map +1 -0
- package/dist/vite/socket.d.ts +75 -0
- package/dist/vite/socket.d.ts.map +1 -0
- package/dist/vite/worker.d.ts +16 -0
- package/dist/vite/worker.d.ts.map +1 -0
- package/dist/with-alxia.d.ts +36 -0
- package/dist/with-alxia.d.ts.map +1 -0
- package/docs/README.md +42 -0
- package/docs/guide/api-keys.md +216 -0
- package/docs/guide/beside-the-pages.md +201 -0
- package/docs/guide/csp-nonce.md +166 -0
- package/docs/guide/customising-the-server.md +324 -0
- package/docs/guide/deploying.md +102 -0
- package/docs/guide/document.md +334 -0
- package/docs/guide/errors.md +1147 -0
- package/docs/guide/fetcher.md +355 -0
- package/docs/guide/getting-started.md +112 -0
- package/docs/guide/help.md +325 -0
- package/docs/guide/how-it-works.md +274 -0
- package/docs/guide/link.md +32 -0
- package/docs/guide/lists.md +225 -0
- package/docs/guide/mcp.md +173 -0
- package/docs/guide/media.md +273 -0
- package/docs/guide/navigation.md +52 -0
- package/docs/guide/oauth.md +342 -0
- package/docs/guide/oidc.md +262 -0
- package/docs/guide/openapi.md +51 -0
- package/docs/guide/pwa.md +670 -0
- package/docs/guide/session.md +2105 -0
- package/docs/guide/subscriptions.md +211 -0
- package/docs/guide/testing.md +42 -0
- package/docs/guide/typing-the-loaders.md +311 -0
- package/docs/guide.md +82 -0
- package/docs/roadmap.md +474 -0
- package/docs/troubleshooting.md +3837 -0
- package/package.json +301 -5
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of [Standard Schema](https://standardschema.dev) v1 that `readInput`
|
|
3
|
+
* calls, declared here so `/errors` names no other package, not even as a
|
|
4
|
+
* type. It is structurally the specification's interface: a Zod 4, Valibot
|
|
5
|
+
* or ArkType schema, or `@softistx/alxia`'s `StandardSchemaV1`, is accepted as is.
|
|
6
|
+
*/
|
|
7
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
8
|
+
readonly '~standard': {
|
|
9
|
+
readonly version: 1;
|
|
10
|
+
readonly vendor: string;
|
|
11
|
+
readonly validate: (value: unknown) => StandardResult<Output> | Promise<StandardResult<Output>>;
|
|
12
|
+
readonly types?: {
|
|
13
|
+
readonly input: Input;
|
|
14
|
+
readonly output: Output;
|
|
15
|
+
} | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** What a schema's validation answers: the value, or the issues. */
|
|
19
|
+
export type StandardResult<Output> = {
|
|
20
|
+
readonly value: Output;
|
|
21
|
+
readonly issues?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
readonly issues: readonly StandardIssue[];
|
|
24
|
+
};
|
|
25
|
+
/** One thing a schema refused. */
|
|
26
|
+
export interface StandardIssue {
|
|
27
|
+
readonly message: string;
|
|
28
|
+
readonly path?: readonly (PropertyKey | {
|
|
29
|
+
readonly key: PropertyKey;
|
|
30
|
+
})[] | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** What a schema gives back once the value passed. */
|
|
33
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
34
|
+
//# sourceMappingURL=standard-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-schema.d.ts","sourceRoot":"","sources":["../../src/errors/standard-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;IAChE,QAAQ,CAAC,WAAW,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,CAClB,KAAK,EAAE,OAAO,KACV,cAAc,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9D,QAAQ,CAAC,KAAK,CAAC,EACZ;YAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;YAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAClD,SAAS,CAAC;KACb,CAAC;CACF;AAED,oEAAoE;AACpE,MAAM,MAAM,cAAc,CAAC,MAAM,IAC9B;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAEjD,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EACX,SAAS,CAAC,WAAW,GAAG;QAAE,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAA;KAAE,CAAC,EAAE,GACxD,SAAS,CAAC;CACb;AAED,sDAAsD;AACtD,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACrE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC5B,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { data } from 'react-router';
|
|
2
|
+
import type { ApiErrors } from './api-errors';
|
|
3
|
+
import type { FormErrors } from './form-errors';
|
|
4
|
+
import { type RouteErrorOptions } from './route-error';
|
|
5
|
+
/**
|
|
6
|
+
* Runs a form's mutation. An `ApiError` becomes the form's errors: each
|
|
7
|
+
* refused field (`extensions.fields`, or the one `extensions.field` names)
|
|
8
|
+
* under the form field `fieldOf` names (else on the form), and any other
|
|
9
|
+
* code as the form's message. A 404 about none of the form's fields (the
|
|
10
|
+
* record itself is gone), a 401 and other failures go to the error page.
|
|
11
|
+
*/
|
|
12
|
+
export declare function submitForm<L extends string, T>(errors: Pick<ApiErrors<L>, 'apiErrorMessage' | 'fieldErrors'>, language: L, run: () => Promise<T>, fieldOf: (path: string) => string | undefined, route?: RouteErrorOptions): Promise<{
|
|
13
|
+
ok: true;
|
|
14
|
+
value: T;
|
|
15
|
+
} | ReturnType<typeof data<FormErrors>>>;
|
|
16
|
+
//# sourceMappingURL=submit-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-form.d.ts","sourceRoot":"","sources":["../../src/errors/submit-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,eAAe,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EACnD,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC,EAC7D,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC7C,KAAK,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAuBvE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the BFF relays (`/subscription`, `/media`) share to build the headers
|
|
3
|
+
* they send to the API: the app's extra headers, fixed or per request, with
|
|
4
|
+
* a `null` or `undefined` value left out, and the session token guard. It
|
|
5
|
+
* reads values only and imports nothing, like `cross-site.ts`, so each relay
|
|
6
|
+
* stays import-free.
|
|
7
|
+
*/
|
|
8
|
+
/** Extra headers as an app writes them: a record or a `Headers`. */
|
|
9
|
+
export type HeaderValues = Record<string, string | null | undefined> | Headers;
|
|
10
|
+
/** The token when a header can hold it, else `undefined`. */
|
|
11
|
+
export declare function usableToken(token: string | null | undefined): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The app's `headers` option as a `Headers`: a function is called with the
|
|
14
|
+
* request and the route's arguments. It throws when a name or a value is not
|
|
15
|
+
* valid or when the function throws; the caller answers that.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extraHeaders<Args>(headers: HeaderValues | ((request: Request, args: Args) => HeaderValues | Promise<HeaderValues>) | undefined, request: Request, args: Args): Promise<Headers>;
|
|
18
|
+
//# sourceMappingURL=upstream-headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upstream-headers.d.ts","sourceRoot":"","sources":["../../src/errors/upstream-headers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC;AAK/E,6DAA6D;AAC7D,wBAAgB,WAAW,CAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAEpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EACtC,OAAO,EACJ,YAAY,GACZ,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,GACxE,SAAS,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACR,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type FetcherWithComponents, useFetcher } from 'react-router';
|
|
2
|
+
/** What a fetcher can post as JSON. */
|
|
3
|
+
export type JsonBody = Parameters<FetcherWithComponents<unknown>['submit']>[0];
|
|
4
|
+
/**
|
|
5
|
+
* A fetcher posting JSON to its page's action (which reads it with
|
|
6
|
+
* `readJson`, and answers `fetcherResult` or the like): `post` sends a
|
|
7
|
+
* body, `busy` while it is in flight. `key` shares the fetcher between the
|
|
8
|
+
* form that posts and the component that reads the answer; `action` posts to
|
|
9
|
+
* another route's action instead (a resource route's, such as a
|
|
10
|
+
* `notifications/poll`). `post` takes the target of one call as its second
|
|
11
|
+
* argument (a list's rows each post to their own record's action).
|
|
12
|
+
*/
|
|
13
|
+
export declare function useJsonFetcher<Action, Body extends JsonBody = JsonBody>(key?: string, action?: string): {
|
|
14
|
+
fetcher: ReturnType<typeof useFetcher<Action>>;
|
|
15
|
+
post(body: Body, to?: string): Promise<void>;
|
|
16
|
+
busy: boolean;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=use-json-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-json-fetcher.d.ts","sourceRoot":"","sources":["../../src/errors/use-json-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtE,uCAAuC;AACvC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,SAAS,QAAQ,GAAG,QAAQ,EACtE,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACb;IACF,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,EAAE,OAAO,CAAC;CACd,CASA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an auth route action answers when the page stays: a message, a wait,
|
|
3
|
+
* a field's word. `sent` marks the answer that is not a refusal.
|
|
4
|
+
*/
|
|
5
|
+
export type AuthAnswer = {
|
|
6
|
+
sent?: boolean | undefined;
|
|
7
|
+
formError?: string | undefined;
|
|
8
|
+
retryAfter?: number | undefined;
|
|
9
|
+
fieldErrors?: Readonly<Record<string, string | undefined>>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The refusal an auth form or notice takes back from its `onSubmit`:
|
|
13
|
+
* `form` (the message above the form), `retryAfter` (seconds to wait) and
|
|
14
|
+
* the field's word under its own name.
|
|
15
|
+
*/
|
|
16
|
+
export type AuthRefusal<F extends string = string> = {
|
|
17
|
+
form?: string | undefined;
|
|
18
|
+
retryAfter?: number | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
[K in F]?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Maps a route action's answer to the refusal shape of an auth form.
|
|
24
|
+
* `fields` lists the names to carry over from `fieldErrors`; any other field
|
|
25
|
+
* error is left out. Returns `undefined` for an answer that is not a refusal
|
|
26
|
+
* (`sent` is true), so `return authRefusal(answer, [...])` accepts the form.
|
|
27
|
+
*/
|
|
28
|
+
export declare function authRefusal<const F extends string>(answer: AuthAnswer, fields: readonly F[]): AuthRefusal<F> | undefined;
|
|
29
|
+
//# sourceMappingURL=auth-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-refusal.d.ts","sourceRoot":"","sources":["../../src/fetcher/auth-refusal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACpD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,GAAG;KAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS;CAAE,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACjD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,CAAC,EAAE,GAClB,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAQ5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@softistx/alxia-react-router/fetcher`: the hooks around a React Router fetcher's
|
|
3
|
+
* answers, and the ones that keep a screen fresh while its page is visible.
|
|
4
|
+
* `react` and `react-router` are its imports, and every hook renders on the
|
|
5
|
+
* server (a load starts in the browser only).
|
|
6
|
+
*/
|
|
7
|
+
export { type AuthAnswer, type AuthRefusal, authRefusal, } from './auth-refusal';
|
|
8
|
+
export type { SectionForm } from './section-form';
|
|
9
|
+
export { refusalOf, type SectionNotice, type SectionRefusal, } from './section-save';
|
|
10
|
+
export { type DebouncedFetcher, type DebouncedFetcherOptions, type DebouncedFetcherState, useDebouncedFetcher, } from './use-debounced-fetcher';
|
|
11
|
+
export { type AnswerSource, useFetcherAnswer } from './use-fetcher-answer';
|
|
12
|
+
export { useFetcherDone } from './use-fetcher-done';
|
|
13
|
+
export { FetcherPromiseAborted, FetcherPromiseNoAnswer, type FetcherPromiseOptions, useFetcherPromise, } from './use-fetcher-promise';
|
|
14
|
+
export { type FormRefusalResult, useFormRefusal } from './use-form-refusal';
|
|
15
|
+
export { type RevalidateOnFocusOptions, useRevalidateOnFocus, } from './use-revalidate-on-focus';
|
|
16
|
+
export { type RowSaveOptions, useRowSave } from './use-row-save';
|
|
17
|
+
export { type SectionSave, type SectionSaveOptions, useSectionSave, } from './use-section-save';
|
|
18
|
+
export { useVisibleInterval, type VisibleIntervalOptions, } from './use-visible-interval';
|
|
19
|
+
export { useVisibleRevalidation } from './use-visible-revalidation';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetcher/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,cAAc,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACN,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,iBAAiB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACN,KAAK,wBAAwB,EAC7B,oBAAoB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,cAAc,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,kBAAkB,EAClB,KAAK,sBAAsB,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFetcherAnswer2
|
|
3
|
+
} from "../chunks/index-zyg8amjc.js";
|
|
4
|
+
import {
|
|
5
|
+
FetcherPromiseAborted2,
|
|
6
|
+
FetcherPromiseNoAnswer2,
|
|
7
|
+
useFetcherPromise2
|
|
8
|
+
} from "../chunks/index-xd5aqy3g.js";
|
|
9
|
+
import {
|
|
10
|
+
useJsonFetcher2
|
|
11
|
+
} from "../chunks/index-ajtvyq35.js";
|
|
12
|
+
|
|
13
|
+
// src/fetcher/auth-refusal.ts
|
|
14
|
+
function authRefusal(answer, fields) {
|
|
15
|
+
if (answer.sent)
|
|
16
|
+
return;
|
|
17
|
+
const refusal = {
|
|
18
|
+
form: answer.formError,
|
|
19
|
+
retryAfter: answer.retryAfter
|
|
20
|
+
};
|
|
21
|
+
for (const field of fields)
|
|
22
|
+
refusal[field] = answer.fieldErrors?.[field];
|
|
23
|
+
return refusal;
|
|
24
|
+
}
|
|
25
|
+
// src/fetcher/section-save.ts
|
|
26
|
+
var refusalOf = (result) => result && !result.ok ? result : undefined;
|
|
27
|
+
function fieldErrorsOf(result) {
|
|
28
|
+
const refusal = refusalOf(result);
|
|
29
|
+
if (!refusal || refusal.stale)
|
|
30
|
+
return;
|
|
31
|
+
return { fieldErrors: refusal.fieldErrors };
|
|
32
|
+
}
|
|
33
|
+
function noticeOf(refusal, reload) {
|
|
34
|
+
if (!refusal)
|
|
35
|
+
return;
|
|
36
|
+
if (refusal.stale)
|
|
37
|
+
return { kind: "stale", reload };
|
|
38
|
+
return refusal.error ? { kind: "error", message: refusal.error } : undefined;
|
|
39
|
+
}
|
|
40
|
+
// src/fetcher/use-debounced-fetcher.ts
|
|
41
|
+
import {
|
|
42
|
+
startTransition,
|
|
43
|
+
useCallback,
|
|
44
|
+
useEffect,
|
|
45
|
+
useLayoutEffect,
|
|
46
|
+
useRef,
|
|
47
|
+
useState
|
|
48
|
+
} from "react";
|
|
49
|
+
import { useFetcher } from "react-router";
|
|
50
|
+
function useDebouncedFetcher(value, to, options = {}) {
|
|
51
|
+
const { delayMs = 250, minLength = 1, enabled = true, key, keep } = options;
|
|
52
|
+
const keepRef = useRef(keep);
|
|
53
|
+
keepRef.current = keep;
|
|
54
|
+
const fetcher = useFetcher(key === undefined ? undefined : { key });
|
|
55
|
+
const load = useRef(fetcher.load);
|
|
56
|
+
load.current = fetcher.load;
|
|
57
|
+
const text = value.trim();
|
|
58
|
+
const url = enabled && text.length >= minLength ? typeof to === "function" ? to(text) : to : null;
|
|
59
|
+
const [loaded, setLoaded] = useState(null);
|
|
60
|
+
const previous = useRef(undefined);
|
|
61
|
+
const seq = useRef(0);
|
|
62
|
+
const [settled, setSettled] = useState(0);
|
|
63
|
+
const busySeq = useRef(0);
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
if (fetcher.state !== "idle")
|
|
66
|
+
busySeq.current = seq.current;
|
|
67
|
+
}, [fetcher.state]);
|
|
68
|
+
const ask = (target) => {
|
|
69
|
+
const mine = ++seq.current;
|
|
70
|
+
setLoaded(target);
|
|
71
|
+
Promise.resolve(load.current(target)).then(() => {
|
|
72
|
+
if (mine === seq.current)
|
|
73
|
+
startTransition(() => setSettled(mine));
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const askRef = useRef(ask);
|
|
77
|
+
askRef.current = ask;
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (url === null) {
|
|
80
|
+
previous.current = undefined;
|
|
81
|
+
setLoaded(null);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const timer = setTimeout(() => {
|
|
85
|
+
askRef.current(url);
|
|
86
|
+
}, delayMs);
|
|
87
|
+
return () => clearTimeout(timer);
|
|
88
|
+
}, [url, text, delayMs]);
|
|
89
|
+
const landed = fetcher.state === "idle" && (busySeq.current === seq.current || settled === seq.current);
|
|
90
|
+
const current = url !== null && loaded === url && landed && fetcher.data !== undefined;
|
|
91
|
+
const answer = current ? fetcher.data : undefined;
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (answer === undefined || answer === null)
|
|
94
|
+
return;
|
|
95
|
+
if (keepRef.current?.(answer) ?? true)
|
|
96
|
+
previous.current = answer;
|
|
97
|
+
}, [answer]);
|
|
98
|
+
const data = current ? answer : url === null ? undefined : previous.current;
|
|
99
|
+
let state;
|
|
100
|
+
if (url === null)
|
|
101
|
+
state = "idle";
|
|
102
|
+
else if (loaded !== url)
|
|
103
|
+
state = "waiting";
|
|
104
|
+
else
|
|
105
|
+
state = landed ? "done" : "loading";
|
|
106
|
+
const urlRef = useRef(url);
|
|
107
|
+
urlRef.current = url;
|
|
108
|
+
const retry = useCallback(() => {
|
|
109
|
+
const now = urlRef.current;
|
|
110
|
+
if (now === null)
|
|
111
|
+
return;
|
|
112
|
+
askRef.current(now);
|
|
113
|
+
}, []);
|
|
114
|
+
return { data, stale: state !== "done" && data !== undefined, state, retry };
|
|
115
|
+
}
|
|
116
|
+
// src/fetcher/use-fetcher-done.ts
|
|
117
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
118
|
+
function useFetcherDone(fetcher, isDone, onDone) {
|
|
119
|
+
const handled = useRef2(fetcher.data);
|
|
120
|
+
const predicate = useRef2(isDone);
|
|
121
|
+
const callback = useRef2(onDone);
|
|
122
|
+
predicate.current = isDone;
|
|
123
|
+
callback.current = onDone;
|
|
124
|
+
const { state, data } = fetcher;
|
|
125
|
+
useEffect2(() => {
|
|
126
|
+
if (state !== "idle" || data === handled.current) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
handled.current = data;
|
|
130
|
+
if (data !== undefined && data !== null && predicate.current(data)) {
|
|
131
|
+
callback.current();
|
|
132
|
+
}
|
|
133
|
+
}, [state, data]);
|
|
134
|
+
}
|
|
135
|
+
// src/fetcher/use-form-refusal.ts
|
|
136
|
+
import { useMemo } from "react";
|
|
137
|
+
function useFormRefusal(result) {
|
|
138
|
+
return useMemo(() => result && !result.ok && result.fieldErrors ? {
|
|
139
|
+
fieldErrors: result.fieldErrors,
|
|
140
|
+
formError: result.error || undefined
|
|
141
|
+
} : undefined, [result]);
|
|
142
|
+
}
|
|
143
|
+
// src/fetcher/use-revalidate-on-focus.ts
|
|
144
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
145
|
+
import { useRevalidator } from "react-router";
|
|
146
|
+
function useRevalidateOnFocus(options = {}) {
|
|
147
|
+
const { minHiddenMs = 30000, enabled = true } = options;
|
|
148
|
+
const revalidator = useRevalidator();
|
|
149
|
+
const latest = useRef3(revalidator);
|
|
150
|
+
latest.current = revalidator;
|
|
151
|
+
useEffect3(() => {
|
|
152
|
+
if (!enabled)
|
|
153
|
+
return;
|
|
154
|
+
let leftAt;
|
|
155
|
+
const left = () => {
|
|
156
|
+
leftAt ??= Date.now();
|
|
157
|
+
};
|
|
158
|
+
const back = () => {
|
|
159
|
+
const since = leftAt;
|
|
160
|
+
leftAt = undefined;
|
|
161
|
+
if (since === undefined || Date.now() - since < minHiddenMs)
|
|
162
|
+
return;
|
|
163
|
+
if (latest.current.state === "idle")
|
|
164
|
+
latest.current.revalidate();
|
|
165
|
+
};
|
|
166
|
+
const onVisibility = () => {
|
|
167
|
+
if (document.visibilityState === "hidden")
|
|
168
|
+
left();
|
|
169
|
+
else
|
|
170
|
+
back();
|
|
171
|
+
};
|
|
172
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
173
|
+
window.addEventListener("blur", left);
|
|
174
|
+
window.addEventListener("focus", back);
|
|
175
|
+
return () => {
|
|
176
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
177
|
+
window.removeEventListener("blur", left);
|
|
178
|
+
window.removeEventListener("focus", back);
|
|
179
|
+
};
|
|
180
|
+
}, [minHiddenMs, enabled]);
|
|
181
|
+
}
|
|
182
|
+
// src/fetcher/use-row-save.ts
|
|
183
|
+
import { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
184
|
+
|
|
185
|
+
// src/fetcher/use-section-save.ts
|
|
186
|
+
import {
|
|
187
|
+
useEffect as useEffect6,
|
|
188
|
+
useMemo as useMemo2,
|
|
189
|
+
useRef as useRef5,
|
|
190
|
+
useState as useState3
|
|
191
|
+
} from "react";
|
|
192
|
+
|
|
193
|
+
// src/fetcher/section-form.ts
|
|
194
|
+
import { useEffect as useEffect4 } from "react";
|
|
195
|
+
var same = (name) => name;
|
|
196
|
+
function firstInPage(names) {
|
|
197
|
+
if (typeof document === "undefined")
|
|
198
|
+
return names[0];
|
|
199
|
+
const found = [];
|
|
200
|
+
for (const name of names) {
|
|
201
|
+
const node = document.getElementsByName(name)[0];
|
|
202
|
+
if (node)
|
|
203
|
+
found.push({ name, node });
|
|
204
|
+
}
|
|
205
|
+
found.sort((a, b) => a.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
206
|
+
return found[0]?.name ?? names[0];
|
|
207
|
+
}
|
|
208
|
+
function useSectionErrors(form, errors, focusOf = same) {
|
|
209
|
+
useEffect4(() => {
|
|
210
|
+
if (!errors)
|
|
211
|
+
return;
|
|
212
|
+
const fields = Object.entries(errors.fieldErrors ?? {});
|
|
213
|
+
for (const [name, message] of fields) {
|
|
214
|
+
form.setError(name, { type: "server", message });
|
|
215
|
+
}
|
|
216
|
+
const first = firstInPage(fields.map(([name]) => name));
|
|
217
|
+
if (first)
|
|
218
|
+
form.setFocus(focusOf(first));
|
|
219
|
+
}, [errors, form, focusOf]);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/fetcher/section-reload.ts
|
|
223
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState2 } from "react";
|
|
224
|
+
import { useRevalidator as useRevalidator2 } from "react-router";
|
|
225
|
+
function useSectionReload(form, record, latest) {
|
|
226
|
+
const revalidator = useRevalidator2();
|
|
227
|
+
const [reloading, setReloading] = useState2(false);
|
|
228
|
+
const [settled, setSettled] = useState2(false);
|
|
229
|
+
const recordKey = JSON.stringify(record);
|
|
230
|
+
const asked = useRef4({ key: "", loading: false });
|
|
231
|
+
const settleTimer = useRef4(undefined);
|
|
232
|
+
useEffect5(() => () => clearTimeout(settleTimer.current), []);
|
|
233
|
+
useEffect5(() => {
|
|
234
|
+
if (!reloading)
|
|
235
|
+
return;
|
|
236
|
+
if (revalidator.state === "loading") {
|
|
237
|
+
asked.current.loading = true;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (!settled && !asked.current.loading && recordKey === asked.current.key) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
form.reset(latest.current.record);
|
|
244
|
+
latest.current.onRefilled?.();
|
|
245
|
+
setReloading(false);
|
|
246
|
+
setSettled(false);
|
|
247
|
+
}, [reloading, settled, revalidator.state, recordKey, form, latest]);
|
|
248
|
+
return () => {
|
|
249
|
+
asked.current = { key: recordKey, loading: false };
|
|
250
|
+
setReloading(true);
|
|
251
|
+
Promise.resolve(revalidator.revalidate()).then(() => {
|
|
252
|
+
settleTimer.current = setTimeout(() => setSettled(true), 100);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/fetcher/use-section-save.ts
|
|
258
|
+
function useSectionSave({
|
|
259
|
+
form,
|
|
260
|
+
intent,
|
|
261
|
+
toInput,
|
|
262
|
+
record,
|
|
263
|
+
onSaved,
|
|
264
|
+
focusOf,
|
|
265
|
+
onRefilled
|
|
266
|
+
}) {
|
|
267
|
+
const { fetcher, post, busy } = useJsonFetcher2();
|
|
268
|
+
const answer = fetcher.data?.intent === intent ? fetcher.data : undefined;
|
|
269
|
+
const [setAside, setSetAside] = useState3();
|
|
270
|
+
const shown = answer === setAside ? undefined : answer;
|
|
271
|
+
const latest = useRef5({ record, onSaved, onRefilled });
|
|
272
|
+
latest.current = { record, onSaved, onRefilled };
|
|
273
|
+
const errors = useMemo2(() => fieldErrorsOf(shown), [shown]);
|
|
274
|
+
useSectionErrors(form, errors, focusOf);
|
|
275
|
+
useEffect6(() => {
|
|
276
|
+
if (fetcher.state !== "idle" || !answer?.ok)
|
|
277
|
+
return;
|
|
278
|
+
form.reset(latest.current.record);
|
|
279
|
+
latest.current.onSaved();
|
|
280
|
+
}, [fetcher.state, answer, form]);
|
|
281
|
+
const reload = useSectionReload(form, record, latest);
|
|
282
|
+
const notice = noticeOf(refusalOf(shown), () => {
|
|
283
|
+
setSetAside(answer);
|
|
284
|
+
reload();
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
onSubmit: form.handleSubmit((values) => {
|
|
288
|
+
const input = toInput(values);
|
|
289
|
+
if (!input) {
|
|
290
|
+
form.reset(latest.current.record);
|
|
291
|
+
latest.current.onSaved();
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
post({ intent, ...input });
|
|
295
|
+
}),
|
|
296
|
+
busy,
|
|
297
|
+
notice,
|
|
298
|
+
onCancel: () => {
|
|
299
|
+
setSetAside(answer);
|
|
300
|
+
form.reset(latest.current.record);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/fetcher/use-row-save.ts
|
|
306
|
+
function useRowSave({
|
|
307
|
+
form,
|
|
308
|
+
editing,
|
|
309
|
+
intent,
|
|
310
|
+
record,
|
|
311
|
+
version,
|
|
312
|
+
toRequest,
|
|
313
|
+
onSaved,
|
|
314
|
+
focusOf
|
|
315
|
+
}) {
|
|
316
|
+
const openedOn = useRef6(undefined);
|
|
317
|
+
const latest = useRef6({ record, version });
|
|
318
|
+
latest.current = { record, version };
|
|
319
|
+
useEffect7(() => {
|
|
320
|
+
if (!editing)
|
|
321
|
+
return;
|
|
322
|
+
openedOn.current = latest.current.version;
|
|
323
|
+
form.reset(latest.current.record);
|
|
324
|
+
}, [editing, form]);
|
|
325
|
+
return useSectionSave({
|
|
326
|
+
form,
|
|
327
|
+
intent,
|
|
328
|
+
toInput: (values) => toRequest(values, openedOn.current ?? version),
|
|
329
|
+
record,
|
|
330
|
+
onSaved,
|
|
331
|
+
...focusOf ? { focusOf } : {},
|
|
332
|
+
onRefilled: () => {
|
|
333
|
+
openedOn.current = latest.current.version;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
// src/fetcher/use-visible-interval.ts
|
|
338
|
+
import { useEffect as useEffect8, useRef as useRef7 } from "react";
|
|
339
|
+
function useVisibleInterval(callback, ms, options = {}) {
|
|
340
|
+
const { enabled = true, runOnVisible = true } = options;
|
|
341
|
+
const latest = useRef7(callback);
|
|
342
|
+
latest.current = callback;
|
|
343
|
+
useEffect8(() => {
|
|
344
|
+
if (!enabled || ms <= 0)
|
|
345
|
+
return;
|
|
346
|
+
let last = Date.now();
|
|
347
|
+
const run = () => {
|
|
348
|
+
if (document.visibilityState !== "visible")
|
|
349
|
+
return;
|
|
350
|
+
last = Date.now();
|
|
351
|
+
latest.current();
|
|
352
|
+
};
|
|
353
|
+
const timer = setInterval(run, ms);
|
|
354
|
+
const back = () => {
|
|
355
|
+
if (runOnVisible && Date.now() - last >= ms)
|
|
356
|
+
run();
|
|
357
|
+
};
|
|
358
|
+
document.addEventListener("visibilitychange", back);
|
|
359
|
+
return () => {
|
|
360
|
+
clearInterval(timer);
|
|
361
|
+
document.removeEventListener("visibilitychange", back);
|
|
362
|
+
};
|
|
363
|
+
}, [ms, enabled, runOnVisible]);
|
|
364
|
+
}
|
|
365
|
+
// src/fetcher/use-visible-revalidation.ts
|
|
366
|
+
import { useRevalidator as useRevalidator3 } from "react-router";
|
|
367
|
+
function useVisibleRevalidation(ms, options) {
|
|
368
|
+
const revalidator = useRevalidator3();
|
|
369
|
+
useVisibleInterval(() => {
|
|
370
|
+
if (revalidator.state === "idle")
|
|
371
|
+
revalidator.revalidate();
|
|
372
|
+
}, ms, options);
|
|
373
|
+
}
|
|
374
|
+
export {
|
|
375
|
+
FetcherPromiseAborted2 as FetcherPromiseAborted,
|
|
376
|
+
FetcherPromiseNoAnswer2 as FetcherPromiseNoAnswer,
|
|
377
|
+
authRefusal,
|
|
378
|
+
refusalOf,
|
|
379
|
+
useDebouncedFetcher,
|
|
380
|
+
useFetcherAnswer2 as useFetcherAnswer,
|
|
381
|
+
useFetcherDone,
|
|
382
|
+
useFetcherPromise2 as useFetcherPromise,
|
|
383
|
+
useFormRefusal,
|
|
384
|
+
useRevalidateOnFocus,
|
|
385
|
+
useRowSave,
|
|
386
|
+
useSectionSave,
|
|
387
|
+
useVisibleInterval,
|
|
388
|
+
useVisibleRevalidation
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
//# debugId=F162F812AF5BDE9A64756E2164756E21
|
|
392
|
+
//# sourceMappingURL=index.js.map
|