@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/help/check/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,SAAS,EACT,KAAK,WAAW,EAChB,eAAe,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,SAAS,EACd,aAAa,EACb,aAAa,EACb,KAAK,UAAU,EACf,OAAO,GACP,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
routeId2,
|
|
3
|
+
flattenRoutes2,
|
|
4
|
+
matchesIgnore2,
|
|
5
|
+
readRouteConfig2,
|
|
6
|
+
checkHelp2
|
|
7
|
+
} from "../../chunks/index-tx36swjx.js";
|
|
8
|
+
export {
|
|
9
|
+
checkHelp2 as checkHelp,
|
|
10
|
+
flattenRoutes2 as flattenRoutes,
|
|
11
|
+
matchesIgnore2 as matchesIgnore,
|
|
12
|
+
readRouteConfig2 as readRouteConfig,
|
|
13
|
+
routeId2 as routeId
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//# debugId=47630BBD51E6A9F564756E2164756E21
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The part of React Router's `RouteConfigEntry` the check reads. */
|
|
2
|
+
export interface RouteEntry {
|
|
3
|
+
readonly id?: string;
|
|
4
|
+
readonly path?: string;
|
|
5
|
+
readonly file: string;
|
|
6
|
+
readonly index?: boolean;
|
|
7
|
+
readonly children?: readonly RouteEntry[];
|
|
8
|
+
}
|
|
9
|
+
export interface FlatRoute {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** A screen: a route with no children. Layouts are not screens. */
|
|
12
|
+
readonly screen: boolean;
|
|
13
|
+
/** The ids of the routes above it, root first (`root` included). */
|
|
14
|
+
readonly ancestors: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/** React Router's route id: the entry's `id`, else its file without extension. */
|
|
17
|
+
export declare function routeId(entry: RouteEntry): string;
|
|
18
|
+
/** Every route of a config, depth first; `root` is added as React Router does. */
|
|
19
|
+
export declare function flattenRoutes(entries: readonly RouteEntry[]): FlatRoute[];
|
|
20
|
+
/** `*` in an ignore pattern matches any run of characters. */
|
|
21
|
+
export declare function matchesIgnore(id: string, patterns: readonly string[]): boolean;
|
|
22
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/help/check/routes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAGjD;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,EAAE,CAYzE;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAC5B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAMT"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The role a guide opens on: the first of `order` (highest first) the viewer
|
|
3
|
+
* may read, else the first role they may read, else `fallback` (the last of
|
|
4
|
+
* `order`: with no role at all, that is what opens).
|
|
5
|
+
*/
|
|
6
|
+
export declare function highestGuideRole(roles: readonly string[], order: readonly string[], fallback?: string): string;
|
|
7
|
+
/** What `useGuideRole` answers. */
|
|
8
|
+
export interface GuideRoleState {
|
|
9
|
+
/** The role being read: always one of `roles`. */
|
|
10
|
+
readonly role: string;
|
|
11
|
+
/** The roles the viewer may read, in display order. */
|
|
12
|
+
readonly roles: readonly string[];
|
|
13
|
+
/** True when there is more than one role, so a picker is worth showing. */
|
|
14
|
+
readonly canPick: boolean;
|
|
15
|
+
readonly setRole: (role: string) => void;
|
|
16
|
+
/** `guideUrl(role)`: key the PDF reader on it so a role change reloads it. */
|
|
17
|
+
readonly file: string;
|
|
18
|
+
}
|
|
19
|
+
export interface UseGuideRoleOptions {
|
|
20
|
+
/** The roles the viewer may read, in display order. */
|
|
21
|
+
readonly roles: readonly string[];
|
|
22
|
+
/** The role to open on (see `highestGuideRole`). */
|
|
23
|
+
readonly initialRole: string;
|
|
24
|
+
/** The URL of a role's guide PDF. */
|
|
25
|
+
readonly guideUrl: (role: string) => string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The state of a role guide reader: the picked role (kept among the roles the
|
|
29
|
+
* viewer may read, falling back to the first when the list changes) and the
|
|
30
|
+
* guide URL. The sheet, the picker and the PDF reader are the app's own.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useGuideRole(options: UseGuideRoleOptions): GuideRoleState;
|
|
33
|
+
//# sourceMappingURL=guide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/help/guide.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,SAAgC,GACtC,MAAM,CAER;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IACnC,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,CAWzE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@softistx/alxia-react-router/help`: per-role flow docs (`docs/flows/*.md`) loaded
|
|
3
|
+
* and validated at build time, `useHelpFlows`, which answers the flows
|
|
4
|
+
* of the current screen in the shape of `@softistx/material`'s `HelpSheet`, the
|
|
5
|
+
* lazy `HelpPanel` and the role guide's `useGuideRole`.
|
|
6
|
+
* `react` and `react-router` are its only imports; the coverage check is
|
|
7
|
+
* `@softistx/alxia-react-router/help/check` (Node and Bun only).
|
|
8
|
+
*/
|
|
9
|
+
export { type GuideRoleState, highestGuideRole, type UseGuideRoleOptions, useGuideRole, } from './guide';
|
|
10
|
+
export { type HelpFlows, type LoadHelpFlowsOptions, loadHelpFlows, } from './load';
|
|
11
|
+
export { type HelpBundle, HelpPanel, type HelpPanelButtonState, type HelpPanelProps, type HelpPanelSheetExtra, type HelpPanelSheetProps, type HelpPanelSheetPropsProp, } from './panel';
|
|
12
|
+
export { FlowFormatError, type ParsedFlow, parseFlow } from './parse-flow';
|
|
13
|
+
export { useHelpFlows } from './react';
|
|
14
|
+
export { type HelpAnswer, resolveHelp } from './resolve';
|
|
15
|
+
export { CAPTURE_THEMES, CAPTURE_WIDTHS, type CaptureTheme, type CaptureWidth, captureFile, type HelpCapture, type HelpFlow, type HelpStep, } from './types';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/help/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACN,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,aAAa,GACb,MAAM,QAAQ,CAAC;AAChB,OAAO,EACN,KAAK,UAAU,EACf,SAAS,EACT,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACN,cAAc,EACd,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,QAAQ,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FlowFormatError2,
|
|
3
|
+
langOfFile,
|
|
4
|
+
parseFlow2,
|
|
5
|
+
CAPTURE_WIDTHS2,
|
|
6
|
+
CAPTURE_THEMES2,
|
|
7
|
+
captureFile2
|
|
8
|
+
} from "../chunks/index-skwypsjz.js";
|
|
9
|
+
|
|
10
|
+
// src/help/guide.ts
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
function highestGuideRole(roles, order, fallback = order[order.length - 1] ?? "") {
|
|
13
|
+
return order.find((role) => roles.includes(role)) ?? roles[0] ?? fallback;
|
|
14
|
+
}
|
|
15
|
+
function useGuideRole(options) {
|
|
16
|
+
const { roles, initialRole, guideUrl } = options;
|
|
17
|
+
const [picked, setPicked] = useState(initialRole);
|
|
18
|
+
const role = roles.includes(picked) ? picked : roles[0] ?? initialRole;
|
|
19
|
+
return {
|
|
20
|
+
role,
|
|
21
|
+
roles,
|
|
22
|
+
canPick: roles.length > 1,
|
|
23
|
+
setRole: setPicked,
|
|
24
|
+
file: guideUrl(role)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// src/help/load.ts
|
|
28
|
+
var baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
29
|
+
function loadHelpFlows(options) {
|
|
30
|
+
const urls = new Map;
|
|
31
|
+
for (const [path, url] of Object.entries(options.captures)) {
|
|
32
|
+
urls.set(baseName(path), url);
|
|
33
|
+
}
|
|
34
|
+
const wanted = [options.lang, options.fallbackLang].filter((lang) => lang !== undefined);
|
|
35
|
+
const byId = new Map;
|
|
36
|
+
const ids = new Map;
|
|
37
|
+
for (const [path, source] of Object.entries(options.docs).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
38
|
+
const lang = langOfFile(path);
|
|
39
|
+
if (lang === undefined || !wanted.includes(lang))
|
|
40
|
+
continue;
|
|
41
|
+
const parsed = parseFlow2(source, path);
|
|
42
|
+
const previous = ids.get(`${lang}:${parsed.id}`);
|
|
43
|
+
if (previous !== undefined) {
|
|
44
|
+
throw new FlowFormatError2(path, `flow id "${parsed.id}" is already used by ${previous}`);
|
|
45
|
+
}
|
|
46
|
+
ids.set(`${lang}:${parsed.id}`, path);
|
|
47
|
+
const captures = new Map;
|
|
48
|
+
for (const raw of parsed.captures) {
|
|
49
|
+
const variant = (width, theme) => {
|
|
50
|
+
const file = captureFile2(raw.name, width, theme);
|
|
51
|
+
const url = urls.get(file);
|
|
52
|
+
if (url === undefined) {
|
|
53
|
+
throw new FlowFormatError2(path, `capture file ${file} is missing from docs/flows/captures/`);
|
|
54
|
+
}
|
|
55
|
+
return url;
|
|
56
|
+
};
|
|
57
|
+
const [wide, narrow] = CAPTURE_WIDTHS2;
|
|
58
|
+
captures.set(raw.step, {
|
|
59
|
+
name: raw.name,
|
|
60
|
+
alt: raw.alt,
|
|
61
|
+
light: { 1440: variant(wide, "light"), 360: variant(narrow, "light") },
|
|
62
|
+
dark: { 1440: variant(wide, "dark"), 360: variant(narrow, "dark") }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const flow = {
|
|
66
|
+
id: parsed.id,
|
|
67
|
+
title: parsed.title,
|
|
68
|
+
roles: parsed.roles,
|
|
69
|
+
routes: parsed.routes,
|
|
70
|
+
overview: parsed.overview,
|
|
71
|
+
lang,
|
|
72
|
+
body: parsed.body,
|
|
73
|
+
file: path,
|
|
74
|
+
steps: parsed.steps.map((step) => {
|
|
75
|
+
const capture = captures.get(step.index);
|
|
76
|
+
return capture ? { ...step, capture } : step;
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
const held = byId.get(flow.id);
|
|
80
|
+
if (held === undefined || held.lang !== options.lang && lang === options.lang) {
|
|
81
|
+
byId.set(flow.id, flow);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const flows = [...byId.values()];
|
|
85
|
+
const roles = [...new Set(flows.flatMap((flow) => flow.roles))];
|
|
86
|
+
return { lang: options.lang, flows, roles };
|
|
87
|
+
}
|
|
88
|
+
// src/help/panel.ts
|
|
89
|
+
import {
|
|
90
|
+
createElement,
|
|
91
|
+
Fragment,
|
|
92
|
+
useCallback,
|
|
93
|
+
useEffect,
|
|
94
|
+
useRef,
|
|
95
|
+
useState as useState2
|
|
96
|
+
} from "react";
|
|
97
|
+
function HelpPanel(props) {
|
|
98
|
+
const { load, loadSheet, language, roles, renderButton, onLoadError } = props;
|
|
99
|
+
const fallbackLanguage = props.fallbackLanguage ?? "en";
|
|
100
|
+
const [loaded, setLoaded] = useState2(null);
|
|
101
|
+
const [open, setOpen] = useState2(false);
|
|
102
|
+
const loading = useRef(false);
|
|
103
|
+
const mounted = useRef(true);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
mounted.current = true;
|
|
106
|
+
return () => {
|
|
107
|
+
mounted.current = false;
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
const onOpen = useCallback(() => {
|
|
111
|
+
setOpen(true);
|
|
112
|
+
if (loaded || loading.current)
|
|
113
|
+
return;
|
|
114
|
+
loading.current = true;
|
|
115
|
+
Promise.resolve().then(() => Promise.all([load(), loadSheet()])).then(([bundle, sheet]) => {
|
|
116
|
+
if (sheet.default == null) {
|
|
117
|
+
throw new Error("HelpPanel: `loadSheet` must resolve a module with a default export");
|
|
118
|
+
}
|
|
119
|
+
return { bundle, Sheet: sheet.default };
|
|
120
|
+
}).then((next) => {
|
|
121
|
+
loading.current = false;
|
|
122
|
+
if (mounted.current)
|
|
123
|
+
setLoaded(next);
|
|
124
|
+
}, (error) => {
|
|
125
|
+
loading.current = false;
|
|
126
|
+
if (!mounted.current)
|
|
127
|
+
return;
|
|
128
|
+
setOpen(false);
|
|
129
|
+
try {
|
|
130
|
+
onLoadError(error);
|
|
131
|
+
} catch {}
|
|
132
|
+
});
|
|
133
|
+
}, [loaded, load, loadSheet, onLoadError]);
|
|
134
|
+
if (roles.length === 0)
|
|
135
|
+
return null;
|
|
136
|
+
const help = loaded ? loaded.bundle[language] ?? loaded.bundle[fallbackLanguage] : undefined;
|
|
137
|
+
return createElement(Fragment, null, renderButton({ onOpen, open, loading: open && !help }), loaded && help ? createElement(loaded.Sheet, {
|
|
138
|
+
...props.sheetProps,
|
|
139
|
+
help,
|
|
140
|
+
roles,
|
|
141
|
+
open,
|
|
142
|
+
onOpenChange: setOpen
|
|
143
|
+
}) : null);
|
|
144
|
+
}
|
|
145
|
+
// src/help/react.ts
|
|
146
|
+
import { useMemo } from "react";
|
|
147
|
+
import { useMatches } from "react-router";
|
|
148
|
+
|
|
149
|
+
// src/help/resolve.ts
|
|
150
|
+
function resolveHelp(help, routeIds, userRoles) {
|
|
151
|
+
const covering = help.flows.filter((flow) => !flow.overview && flow.routes.some((id) => routeIds.includes(id)));
|
|
152
|
+
const fallback = covering.length === 0;
|
|
153
|
+
const flows = fallback ? help.flows.filter((flow) => flow.overview) : covering;
|
|
154
|
+
const have = new Set(flows.flatMap((flow) => flow.roles));
|
|
155
|
+
const roles = userRoles.filter((role) => have.has(role));
|
|
156
|
+
const allRoles = help.roles.filter((role) => have.has(role));
|
|
157
|
+
return {
|
|
158
|
+
flows,
|
|
159
|
+
fallback,
|
|
160
|
+
roles,
|
|
161
|
+
role: roles[0],
|
|
162
|
+
allRoles,
|
|
163
|
+
otherRoles: allRoles.filter((role) => !userRoles.includes(role))
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/help/react.ts
|
|
168
|
+
function useHelpFlows(help, options) {
|
|
169
|
+
const ids = useMatches().map((match) => match.id).join(`
|
|
170
|
+
`);
|
|
171
|
+
const roles = options.roles.join(`
|
|
172
|
+
`);
|
|
173
|
+
return useMemo(() => resolveHelp(help, ids.split(`
|
|
174
|
+
`), roles === "" ? [] : roles.split(`
|
|
175
|
+
`)), [help, ids, roles]);
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
CAPTURE_THEMES2 as CAPTURE_THEMES,
|
|
179
|
+
CAPTURE_WIDTHS2 as CAPTURE_WIDTHS,
|
|
180
|
+
FlowFormatError2 as FlowFormatError,
|
|
181
|
+
HelpPanel,
|
|
182
|
+
captureFile2 as captureFile,
|
|
183
|
+
highestGuideRole,
|
|
184
|
+
loadHelpFlows,
|
|
185
|
+
parseFlow2 as parseFlow,
|
|
186
|
+
resolveHelp,
|
|
187
|
+
useGuideRole,
|
|
188
|
+
useHelpFlows
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
//# debugId=70B24BB99825A1CF64756E2164756E21
|
|
192
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/help/guide.ts", "../src/help/load.ts", "../src/help/panel.ts", "../src/help/react.ts", "../src/help/resolve.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { useState } from 'react';\n\n/**\n * The role a guide opens on: the first of `order` (highest first) the viewer\n * may read, else the first role they may read, else `fallback` (the last of\n * `order`: with no role at all, that is what opens).\n */\nexport function highestGuideRole(\n\troles: readonly string[],\n\torder: readonly string[],\n\tfallback = order[order.length - 1] ?? '',\n): string {\n\treturn order.find((role) => roles.includes(role)) ?? roles[0] ?? fallback;\n}\n\n/** What `useGuideRole` answers. */\nexport interface GuideRoleState {\n\t/** The role being read: always one of `roles`. */\n\treadonly role: string;\n\t/** The roles the viewer may read, in display order. */\n\treadonly roles: readonly string[];\n\t/** True when there is more than one role, so a picker is worth showing. */\n\treadonly canPick: boolean;\n\treadonly setRole: (role: string) => void;\n\t/** `guideUrl(role)`: key the PDF reader on it so a role change reloads it. */\n\treadonly file: string;\n}\n\nexport interface UseGuideRoleOptions {\n\t/** The roles the viewer may read, in display order. */\n\treadonly roles: readonly string[];\n\t/** The role to open on (see `highestGuideRole`). */\n\treadonly initialRole: string;\n\t/** The URL of a role's guide PDF. */\n\treadonly guideUrl: (role: string) => string;\n}\n\n/**\n * The state of a role guide reader: the picked role (kept among the roles the\n * viewer may read, falling back to the first when the list changes) and the\n * guide URL. The sheet, the picker and the PDF reader are the app's own.\n */\nexport function useGuideRole(options: UseGuideRoleOptions): GuideRoleState {\n\tconst { roles, initialRole, guideUrl } = options;\n\tconst [picked, setPicked] = useState(initialRole);\n\tconst role = roles.includes(picked) ? picked : (roles[0] ?? initialRole);\n\treturn {\n\t\trole,\n\t\troles,\n\t\tcanPick: roles.length > 1,\n\t\tsetRole: setPicked,\n\t\tfile: guideUrl(role),\n\t};\n}\n",
|
|
6
|
+
"import { FlowFormatError, langOfFile, parseFlow } from './parse-flow';\nimport {\n\tCAPTURE_WIDTHS,\n\tcaptureFile,\n\ttype HelpCapture,\n\ttype HelpFlow,\n} from './types';\n\n/**\n * What `import.meta.glob` gives for the flows and their captures, in the\n * app's own module (the glob must be written there, Vite reads it\n * statically):\n *\n * ```ts\n * loadHelpFlows({\n * docs: import.meta.glob('/docs/flows/*.md', { query: '?raw', import: 'default', eager: true }),\n * captures: import.meta.glob('/docs/flows/captures/*.webp', { query: '?url', import: 'default', eager: true }),\n * lang: 'fr',\n * })\n * ```\n */\nexport interface LoadHelpFlowsOptions {\n\t/** The flow files' sources, by path. */\n\treadonly docs: Readonly<Record<string, string>>;\n\t/** The captures' URLs, by path. */\n\treadonly captures: Readonly<Record<string, string>>;\n\t/** The user's language: its flows are loaded. */\n\treadonly lang: string;\n\t/** Fills the flow ids `lang` has no file for (ids must match across languages). Default: none. */\n\treadonly fallbackLang?: string;\n}\n\n/** The flows of one language, ready for `useHelpFlows`. */\nexport interface HelpFlows {\n\treadonly lang: string;\n\treadonly flows: readonly HelpFlow[];\n\t/** Every role that has a flow, in the order of the files. */\n\treadonly roles: readonly string[];\n}\n\nconst baseName = (path: string) => path.slice(path.lastIndexOf('/') + 1);\n\n/**\n * Parses and validates the flows of a language and resolves each step's\n * capture to its four URLs. Throws a `FlowFormatError` (file, line, what is\n * wrong) on the first bad file, a missing capture variant included, so a\n * broken doc fails the build or the first render rather than the help panel.\n */\nexport function loadHelpFlows(options: LoadHelpFlowsOptions): HelpFlows {\n\tconst urls = new Map<string, string>();\n\tfor (const [path, url] of Object.entries(options.captures)) {\n\t\turls.set(baseName(path), url);\n\t}\n\tconst wanted = [options.lang, options.fallbackLang].filter(\n\t\t(lang): lang is string => lang !== undefined,\n\t);\n\tconst byId = new Map<string, HelpFlow>();\n\tconst ids = new Map<string, string>();\n\n\tfor (const [path, source] of Object.entries(options.docs).sort(([a], [b]) =>\n\t\ta < b ? -1 : a > b ? 1 : 0,\n\t)) {\n\t\tconst lang = langOfFile(path);\n\t\tif (lang === undefined || !wanted.includes(lang)) continue;\n\t\tconst parsed = parseFlow(source, path);\n\t\tconst previous = ids.get(`${lang}:${parsed.id}`);\n\t\tif (previous !== undefined) {\n\t\t\tthrow new FlowFormatError(\n\t\t\t\tpath,\n\t\t\t\t`flow id \"${parsed.id}\" is already used by ${previous}`,\n\t\t\t);\n\t\t}\n\t\tids.set(`${lang}:${parsed.id}`, path);\n\t\tconst captures = new Map<number, HelpCapture>();\n\t\tfor (const raw of parsed.captures) {\n\t\t\tconst variant = (width: 360 | 1440, theme: 'light' | 'dark') => {\n\t\t\t\tconst file = captureFile(raw.name, width, theme);\n\t\t\t\tconst url = urls.get(file);\n\t\t\t\tif (url === undefined) {\n\t\t\t\t\tthrow new FlowFormatError(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\t`capture file ${file} is missing from docs/flows/captures/`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn url;\n\t\t\t};\n\t\t\tconst [wide, narrow] = CAPTURE_WIDTHS;\n\t\t\tcaptures.set(raw.step, {\n\t\t\t\tname: raw.name,\n\t\t\t\talt: raw.alt,\n\t\t\t\tlight: { 1440: variant(wide, 'light'), 360: variant(narrow, 'light') },\n\t\t\t\tdark: { 1440: variant(wide, 'dark'), 360: variant(narrow, 'dark') },\n\t\t\t});\n\t\t}\n\t\tconst flow: HelpFlow = {\n\t\t\tid: parsed.id,\n\t\t\ttitle: parsed.title,\n\t\t\troles: parsed.roles,\n\t\t\troutes: parsed.routes,\n\t\t\toverview: parsed.overview,\n\t\t\tlang,\n\t\t\tbody: parsed.body,\n\t\t\tfile: path,\n\t\t\tsteps: parsed.steps.map((step) => {\n\t\t\t\tconst capture = captures.get(step.index);\n\t\t\t\treturn capture ? { ...step, capture } : step;\n\t\t\t}),\n\t\t};\n\t\t// The wanted language wins; the fallback only fills the ids it lacks.\n\t\tconst held = byId.get(flow.id);\n\t\tif (\n\t\t\theld === undefined ||\n\t\t\t(held.lang !== options.lang && lang === options.lang)\n\t\t) {\n\t\t\tbyId.set(flow.id, flow);\n\t\t}\n\t}\n\n\tconst flows = [...byId.values()];\n\tconst roles = [...new Set(flows.flatMap((flow) => flow.roles))];\n\treturn { lang: options.lang, flows, roles };\n}\n",
|
|
7
|
+
"import {\n\ttype ComponentType,\n\tcreateElement,\n\tFragment,\n\ttype ReactNode,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type { HelpFlows } from './load';\n\n/** The flows of each language the app speaks, as `load` answers them. */\nexport type HelpBundle = Partial<Record<string, HelpFlows>>;\n\n/** What `HelpPanel` hands the sheet it renders. */\nexport interface HelpPanelSheetProps {\n\t/** The flows in the viewer's language (`fallbackLanguage` when it has none). */\n\treadonly help: HelpFlows;\n\t/** The roles the viewer holds. */\n\treadonly roles: readonly string[];\n\treadonly open: boolean;\n\treadonly onOpenChange: (open: boolean) => void;\n}\n\n/** What `HelpPanel` hands `renderButton`. */\nexport interface HelpPanelButtonState {\n\t/** Call it when the button is pressed (or the help shortcut used). */\n\treadonly onOpen: () => void;\n\treadonly open: boolean;\n\t/** Opened, and the flows or the sheet are not there yet. */\n\treadonly loading: boolean;\n}\n\n/** The props a sheet takes beyond `HelpPanelSheetProps`. */\nexport type HelpPanelSheetExtra<Sheet extends HelpPanelSheetProps> = Omit<\n\tSheet,\n\tkeyof HelpPanelSheetProps\n>;\n\n/**\n * The `sheetProps` prop: absent when the sheet takes no extra props, optional\n * when all its extras are optional, required otherwise.\n */\nexport type HelpPanelSheetPropsProp<Sheet extends HelpPanelSheetProps> = [\n\tkeyof HelpPanelSheetExtra<Sheet>,\n] extends [never]\n\t? { readonly sheetProps?: undefined }\n\t: Record<never, never> extends HelpPanelSheetExtra<Sheet>\n\t\t? { readonly sheetProps?: HelpPanelSheetExtra<Sheet> }\n\t\t: { readonly sheetProps: HelpPanelSheetExtra<Sheet> };\n\nexport type HelpPanelProps<\n\tSheet extends HelpPanelSheetProps = HelpPanelSheetProps,\n> = {\n\t/** A dynamic import of the flows per language, called on the first open. */\n\treadonly load: () => Promise<HelpBundle>;\n\t/** A dynamic import of the sheet (default export), loaded with the flows. */\n\treadonly loadSheet: () => Promise<{\n\t\treadonly default: ComponentType<Sheet>;\n\t}>;\n\t/** The viewer's language. */\n\treadonly language: string;\n\t/** The language used when `language` has no flows. Defaults to `'en'`. */\n\treadonly fallbackLanguage?: string;\n\t/** The roles the viewer holds. With none, nothing is rendered. */\n\treadonly roles: readonly string[];\n\t/** The help button; it calls `onOpen`. */\n\treadonly renderButton: (state: HelpPanelButtonState) => ReactNode;\n\t/** Called once per failed load (show a toast); the next open retries. */\n\treadonly onLoadError: (error: unknown) => void;\n} & HelpPanelSheetPropsProp<Sheet>;\n\n/**\n * The help button with its sheet, loaded lazily. The first open loads the\n * flows and the sheet's chunk together; a failure of either calls\n * `onLoadError` once, closes the panel and lets the next open retry; two opens\n * in a row never load twice. Headless: the button and the sheet are the app's\n * own components (`@softistx/material`'s `HelpButton` and `HelpSheet`, say). A bundle with\n * neither `language` nor `fallbackLanguage` leaves the panel on `loading`.\n *\n * `sheetProps` hands the sheet data of the app (the current record, say),\n * typed by the sheet's own props: the sheet receives it next to `help`,\n * `roles`, `open` and `onOpenChange`, which it cannot override, and it follows\n * the value of every render.\n */\nexport function HelpPanel<\n\tSheet extends HelpPanelSheetProps = HelpPanelSheetProps,\n>(props: HelpPanelProps<Sheet>): ReactNode {\n\tconst { load, loadSheet, language, roles, renderButton, onLoadError } = props;\n\tconst fallbackLanguage = props.fallbackLanguage ?? 'en';\n\tconst [loaded, setLoaded] = useState<{\n\t\treadonly bundle: HelpBundle;\n\t\treadonly Sheet: ComponentType<Sheet>;\n\t} | null>(null);\n\tconst [open, setOpen] = useState(false);\n\tconst loading = useRef(false);\n\tconst mounted = useRef(true);\n\tuseEffect(() => {\n\t\tmounted.current = true;\n\t\treturn () => {\n\t\t\tmounted.current = false;\n\t\t};\n\t}, []);\n\tconst onOpen = useCallback(() => {\n\t\tsetOpen(true);\n\t\tif (loaded || loading.current) return;\n\t\tloading.current = true;\n\t\t// Started in a microtask, so a `load` that throws at once is a failure\n\t\t// too, not an error that leaves `loading` set for good.\n\t\tPromise.resolve()\n\t\t\t.then(() => Promise.all([load(), loadSheet()]))\n\t\t\t.then(([bundle, sheet]) => {\n\t\t\t\tif (sheet.default == null) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'HelpPanel: `loadSheet` must resolve a module with a default export',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn { bundle, Sheet: sheet.default };\n\t\t\t})\n\t\t\t.then(\n\t\t\t\t(next) => {\n\t\t\t\t\tloading.current = false;\n\t\t\t\t\tif (mounted.current) setLoaded(next);\n\t\t\t\t},\n\t\t\t\t(error: unknown) => {\n\t\t\t\t\tloading.current = false;\n\t\t\t\t\tif (!mounted.current) return;\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tonLoadError(error);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// A failing reporter must not leave the panel stuck.\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t}, [loaded, load, loadSheet, onLoadError]);\n\tif (roles.length === 0) return null;\n\tconst help = loaded\n\t\t? (loaded.bundle[language] ?? loaded.bundle[fallbackLanguage])\n\t\t: undefined;\n\treturn createElement(\n\t\tFragment,\n\t\tnull,\n\t\trenderButton({ onOpen, open, loading: open && !help }),\n\t\tloaded && help\n\t\t\t? createElement(loaded.Sheet, {\n\t\t\t\t\t...props.sheetProps,\n\t\t\t\t\thelp,\n\t\t\t\t\troles,\n\t\t\t\t\topen,\n\t\t\t\t\tonOpenChange: setOpen,\n\t\t\t\t} as unknown as Sheet) // TS cannot see that the spread of `Extra` completes `Sheet`\n\t\t\t: null,\n\t);\n}\n",
|
|
8
|
+
"import { useMemo } from 'react';\nimport { useMatches } from 'react-router';\nimport type { HelpFlows } from './load';\nimport { type HelpAnswer, resolveHelp } from './resolve';\n\n/**\n * The help for the screen the user is on: the flows citing a current route\n * match (by route id), the user's roles that have one with the first\n * preselected, the other roles, and the roles' overviews when no flow covers\n * the screen. Pass `help` from `loadHelpFlows` (built once, at module level).\n */\nexport function useHelpFlows(\n\thelp: HelpFlows,\n\toptions: { readonly roles: readonly string[] },\n): HelpAnswer {\n\tconst ids = useMatches()\n\t\t.map((match) => match.id)\n\t\t.join('\\n');\n\tconst roles = options.roles.join('\\n');\n\treturn useMemo(\n\t\t() =>\n\t\t\tresolveHelp(help, ids.split('\\n'), roles === '' ? [] : roles.split('\\n')),\n\t\t[help, ids, roles],\n\t);\n}\n",
|
|
9
|
+
"import type { HelpFlows } from './load';\nimport type { HelpFlow } from './types';\n\n/** What the help panel shows: the shape of `HelpSheet`'s props. */\nexport interface HelpAnswer {\n\t/** Flows for the current screen, or the role overviews when none covers it. */\n\treadonly flows: readonly HelpFlow[];\n\t/** True when `flows` are the overviews: no flow covers this screen. */\n\treadonly fallback: boolean;\n\t/** The user's roles that have a flow in `flows`, the tabs. */\n\treadonly roles: readonly string[];\n\t/** The tab opened first: the user's first role with a flow here. */\n\treadonly role: string | undefined;\n\t/** Every role that has a flow in `flows`, for \"see as…\". */\n\treadonly allRoles: readonly string[];\n\t/** `allRoles` the user does not have. */\n\treadonly otherRoles: readonly string[];\n}\n\n/**\n * Pure core of `useHelpFlows`. `routeIds` are the ids of the current\n * matches, root first; a flow covers the screen when it cites any of them.\n * The user's roles keep their order, so the first one with a flow wins.\n */\nexport function resolveHelp(\n\thelp: HelpFlows,\n\trouteIds: readonly string[],\n\tuserRoles: readonly string[],\n): HelpAnswer {\n\tconst covering = help.flows.filter(\n\t\t(flow) => !flow.overview && flow.routes.some((id) => routeIds.includes(id)),\n\t);\n\tconst fallback = covering.length === 0;\n\tconst flows = fallback\n\t\t? help.flows.filter((flow) => flow.overview)\n\t\t: covering;\n\tconst have = new Set(flows.flatMap((flow) => flow.roles));\n\tconst roles = userRoles.filter((role) => have.has(role));\n\tconst allRoles = help.roles.filter((role) => have.has(role));\n\treturn {\n\t\tflows,\n\t\tfallback,\n\t\troles,\n\t\trole: roles[0],\n\t\tallRoles,\n\t\totherRoles: allRoles.filter((role) => !userRoles.includes(role)),\n\t};\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AC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,EAC3D,OAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,MAAM;AAAA,IACZ;AAAA,IACA,YAAY,SAAS,OAAO,CAAC,SAAS,CAAC,UAAU,SAAS,IAAI,CAAC;AAAA,EAChE;AAAA;;;ADnCM,SAAS,YAAY,CAC3B,MACA,SACa;AAAA,EACb,MAAM,MAAM,WAAW,EACrB,IAAI,CAAC,UAAU,MAAM,EAAE,EACvB,KAAK;AAAA,CAAI;AAAA,EACX,MAAM,QAAQ,QAAQ,MAAM,KAAK;AAAA,CAAI;AAAA,EACrC,OAAO,QACN,MACC,YAAY,MAAM,IAAI,MAAM;AAAA,CAAI,GAAG,UAAU,KAAK,CAAC,IAAI,MAAM,MAAM;AAAA,CAAI,CAAC,GACzE,CAAC,MAAM,KAAK,KAAK,CAClB;AAAA;",
|
|
12
|
+
"debugId": "70B24BB99825A1CF64756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type HelpFlow } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* What `import.meta.glob` gives for the flows and their captures, in the
|
|
4
|
+
* app's own module (the glob must be written there, Vite reads it
|
|
5
|
+
* statically):
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* loadHelpFlows({
|
|
9
|
+
* docs: import.meta.glob('/docs/flows/*.md', { query: '?raw', import: 'default', eager: true }),
|
|
10
|
+
* captures: import.meta.glob('/docs/flows/captures/*.webp', { query: '?url', import: 'default', eager: true }),
|
|
11
|
+
* lang: 'fr',
|
|
12
|
+
* })
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export interface LoadHelpFlowsOptions {
|
|
16
|
+
/** The flow files' sources, by path. */
|
|
17
|
+
readonly docs: Readonly<Record<string, string>>;
|
|
18
|
+
/** The captures' URLs, by path. */
|
|
19
|
+
readonly captures: Readonly<Record<string, string>>;
|
|
20
|
+
/** The user's language: its flows are loaded. */
|
|
21
|
+
readonly lang: string;
|
|
22
|
+
/** Fills the flow ids `lang` has no file for (ids must match across languages). Default: none. */
|
|
23
|
+
readonly fallbackLang?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The flows of one language, ready for `useHelpFlows`. */
|
|
26
|
+
export interface HelpFlows {
|
|
27
|
+
readonly lang: string;
|
|
28
|
+
readonly flows: readonly HelpFlow[];
|
|
29
|
+
/** Every role that has a flow, in the order of the files. */
|
|
30
|
+
readonly roles: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parses and validates the flows of a language and resolves each step's
|
|
34
|
+
* capture to its four URLs. Throws a `FlowFormatError` (file, line, what is
|
|
35
|
+
* wrong) on the first bad file, a missing capture variant included, so a
|
|
36
|
+
* broken doc fails the build or the first render rather than the help panel.
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadHelpFlows(options: LoadHelpFlowsOptions): HelpFlows;
|
|
39
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/help/load.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,QAAQ,EACb,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACpC,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,2DAA2D;AAC3D,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,CAyEtE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import type { HelpFlows } from './load';
|
|
3
|
+
/** The flows of each language the app speaks, as `load` answers them. */
|
|
4
|
+
export type HelpBundle = Partial<Record<string, HelpFlows>>;
|
|
5
|
+
/** What `HelpPanel` hands the sheet it renders. */
|
|
6
|
+
export interface HelpPanelSheetProps {
|
|
7
|
+
/** The flows in the viewer's language (`fallbackLanguage` when it has none). */
|
|
8
|
+
readonly help: HelpFlows;
|
|
9
|
+
/** The roles the viewer holds. */
|
|
10
|
+
readonly roles: readonly string[];
|
|
11
|
+
readonly open: boolean;
|
|
12
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/** What `HelpPanel` hands `renderButton`. */
|
|
15
|
+
export interface HelpPanelButtonState {
|
|
16
|
+
/** Call it when the button is pressed (or the help shortcut used). */
|
|
17
|
+
readonly onOpen: () => void;
|
|
18
|
+
readonly open: boolean;
|
|
19
|
+
/** Opened, and the flows or the sheet are not there yet. */
|
|
20
|
+
readonly loading: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** The props a sheet takes beyond `HelpPanelSheetProps`. */
|
|
23
|
+
export type HelpPanelSheetExtra<Sheet extends HelpPanelSheetProps> = Omit<Sheet, keyof HelpPanelSheetProps>;
|
|
24
|
+
/**
|
|
25
|
+
* The `sheetProps` prop: absent when the sheet takes no extra props, optional
|
|
26
|
+
* when all its extras are optional, required otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export type HelpPanelSheetPropsProp<Sheet extends HelpPanelSheetProps> = [
|
|
29
|
+
keyof HelpPanelSheetExtra<Sheet>
|
|
30
|
+
] extends [never] ? {
|
|
31
|
+
readonly sheetProps?: undefined;
|
|
32
|
+
} : Record<never, never> extends HelpPanelSheetExtra<Sheet> ? {
|
|
33
|
+
readonly sheetProps?: HelpPanelSheetExtra<Sheet>;
|
|
34
|
+
} : {
|
|
35
|
+
readonly sheetProps: HelpPanelSheetExtra<Sheet>;
|
|
36
|
+
};
|
|
37
|
+
export type HelpPanelProps<Sheet extends HelpPanelSheetProps = HelpPanelSheetProps> = {
|
|
38
|
+
/** A dynamic import of the flows per language, called on the first open. */
|
|
39
|
+
readonly load: () => Promise<HelpBundle>;
|
|
40
|
+
/** A dynamic import of the sheet (default export), loaded with the flows. */
|
|
41
|
+
readonly loadSheet: () => Promise<{
|
|
42
|
+
readonly default: ComponentType<Sheet>;
|
|
43
|
+
}>;
|
|
44
|
+
/** The viewer's language. */
|
|
45
|
+
readonly language: string;
|
|
46
|
+
/** The language used when `language` has no flows. Defaults to `'en'`. */
|
|
47
|
+
readonly fallbackLanguage?: string;
|
|
48
|
+
/** The roles the viewer holds. With none, nothing is rendered. */
|
|
49
|
+
readonly roles: readonly string[];
|
|
50
|
+
/** The help button; it calls `onOpen`. */
|
|
51
|
+
readonly renderButton: (state: HelpPanelButtonState) => ReactNode;
|
|
52
|
+
/** Called once per failed load (show a toast); the next open retries. */
|
|
53
|
+
readonly onLoadError: (error: unknown) => void;
|
|
54
|
+
} & HelpPanelSheetPropsProp<Sheet>;
|
|
55
|
+
/**
|
|
56
|
+
* The help button with its sheet, loaded lazily. The first open loads the
|
|
57
|
+
* flows and the sheet's chunk together; a failure of either calls
|
|
58
|
+
* `onLoadError` once, closes the panel and lets the next open retry; two opens
|
|
59
|
+
* in a row never load twice. Headless: the button and the sheet are the app's
|
|
60
|
+
* own components (`@softistx/material`'s `HelpButton` and `HelpSheet`, say). A bundle with
|
|
61
|
+
* neither `language` nor `fallbackLanguage` leaves the panel on `loading`.
|
|
62
|
+
*
|
|
63
|
+
* `sheetProps` hands the sheet data of the app (the current record, say),
|
|
64
|
+
* typed by the sheet's own props: the sheet receives it next to `help`,
|
|
65
|
+
* `roles`, `open` and `onOpenChange`, which it cannot override, and it follows
|
|
66
|
+
* the value of every render.
|
|
67
|
+
*/
|
|
68
|
+
export declare function HelpPanel<Sheet extends HelpPanelSheetProps = HelpPanelSheetProps>(props: HelpPanelProps<Sheet>): ReactNode;
|
|
69
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/help/panel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,EAGlB,KAAK,SAAS,EAKd,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5D,mDAAmD;AACnD,MAAM,WAAW,mBAAmB;IACnC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACpC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,CAAC,K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;AAEnC;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACxB,KAAK,SAAS,mBAAmB,GAAG,mBAAmB,EACtD,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,SAAS,CAmEzC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HelpFlow } from './types';
|
|
2
|
+
/** A flow file the format refuses; the message names the file and line. */
|
|
3
|
+
export declare class FlowFormatError extends Error {
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly line?: number | undefined;
|
|
6
|
+
constructor(file: string, message: string, line?: number | undefined);
|
|
7
|
+
}
|
|
8
|
+
/** A capture reference of the front-matter: the step it belongs to. */
|
|
9
|
+
export interface RawCapture {
|
|
10
|
+
readonly step: number;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly alt: string;
|
|
13
|
+
}
|
|
14
|
+
/** What a flow file says before its captures are resolved to URLs. */
|
|
15
|
+
export interface ParsedFlow extends Omit<HelpFlow, 'steps'> {
|
|
16
|
+
readonly steps: readonly {
|
|
17
|
+
readonly index: number;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly body: string;
|
|
20
|
+
}[];
|
|
21
|
+
readonly captures: readonly RawCapture[];
|
|
22
|
+
}
|
|
23
|
+
/** `<role>.<lang>.md` → its language, or undefined when the name has none. */
|
|
24
|
+
export declare function langOfFile(file: string): string | undefined;
|
|
25
|
+
/** Parses one flow file; throws a `FlowFormatError` naming file and line. */
|
|
26
|
+
export declare function parseFlow(source: string, file: string): ParsedFlow;
|
|
27
|
+
//# sourceMappingURL=parse-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-flow.d.ts","sourceRoot":"","sources":["../../src/help/parse-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,2EAA2E;AAC3E,qBAAa,eAAgB,SAAQ,KAAK;IAExC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;gBAFb,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB;AAED,uEAAuE;AACvE,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AAED,sEAAsE;AACtE,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,SAAS;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACtB,EAAE,CAAC;IACJ,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;CACzC;AAgCD,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3D;AAgID,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAqBlE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HelpFlows } from './load';
|
|
2
|
+
import { type HelpAnswer } from './resolve';
|
|
3
|
+
/**
|
|
4
|
+
* The help for the screen the user is on: the flows citing a current route
|
|
5
|
+
* match (by route id), the user's roles that have one with the first
|
|
6
|
+
* preselected, the other roles, and the roles' overviews when no flow covers
|
|
7
|
+
* the screen. Pass `help` from `loadHelpFlows` (built once, at module level).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useHelpFlows(help: HelpFlows, options: {
|
|
10
|
+
readonly roles: readonly string[];
|
|
11
|
+
}): HelpAnswer;
|
|
12
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/help/react.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,WAAW,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC5C,UAAU,CAUZ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HelpFlows } from './load';
|
|
2
|
+
import type { HelpFlow } from './types';
|
|
3
|
+
/** What the help panel shows: the shape of `HelpSheet`'s props. */
|
|
4
|
+
export interface HelpAnswer {
|
|
5
|
+
/** Flows for the current screen, or the role overviews when none covers it. */
|
|
6
|
+
readonly flows: readonly HelpFlow[];
|
|
7
|
+
/** True when `flows` are the overviews: no flow covers this screen. */
|
|
8
|
+
readonly fallback: boolean;
|
|
9
|
+
/** The user's roles that have a flow in `flows`, the tabs. */
|
|
10
|
+
readonly roles: readonly string[];
|
|
11
|
+
/** The tab opened first: the user's first role with a flow here. */
|
|
12
|
+
readonly role: string | undefined;
|
|
13
|
+
/** Every role that has a flow in `flows`, for "see as…". */
|
|
14
|
+
readonly allRoles: readonly string[];
|
|
15
|
+
/** `allRoles` the user does not have. */
|
|
16
|
+
readonly otherRoles: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Pure core of `useHelpFlows`. `routeIds` are the ids of the current
|
|
20
|
+
* matches, root first; a flow covers the screen when it cites any of them.
|
|
21
|
+
* The user's roles keep their order, so the first one with a flow wins.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveHelp(help: HelpFlows, routeIds: readonly string[], userRoles: readonly string[]): HelpAnswer;
|
|
24
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/help/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,mEAAmE;AACnE,MAAM,WAAW,UAAU;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC1B,UAAU,CAmBZ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** The widths a capture is taken at. */
|
|
2
|
+
export type CaptureWidth = 360 | 1440;
|
|
3
|
+
/** The themes a capture is taken in. */
|
|
4
|
+
export type CaptureTheme = 'light' | 'dark';
|
|
5
|
+
export declare const CAPTURE_WIDTHS: readonly [1440, 360];
|
|
6
|
+
export declare const CAPTURE_THEMES: readonly ["light", "dark"];
|
|
7
|
+
/** The file name of one capture variant: `<name>.<width>.<theme>.webp`. */
|
|
8
|
+
export declare function captureFile(name: string, width: CaptureWidth, theme: CaptureTheme): string;
|
|
9
|
+
/**
|
|
10
|
+
* One step's screenshot: the URL of each variant and its alt text. The
|
|
11
|
+
* shape `HelpSheet` of `@softistx/material` takes.
|
|
12
|
+
*/
|
|
13
|
+
export interface HelpCapture {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly alt: string;
|
|
16
|
+
readonly light: {
|
|
17
|
+
readonly 360: string;
|
|
18
|
+
readonly 1440: string;
|
|
19
|
+
};
|
|
20
|
+
readonly dark: {
|
|
21
|
+
readonly 360: string;
|
|
22
|
+
readonly 1440: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** One numbered step: a `##` section of the flow's Markdown. */
|
|
26
|
+
export interface HelpStep {
|
|
27
|
+
/** 1-based, in reading order. */
|
|
28
|
+
readonly index: number;
|
|
29
|
+
readonly title: string;
|
|
30
|
+
/** The section's Markdown, without its heading. */
|
|
31
|
+
readonly body: string;
|
|
32
|
+
readonly capture?: HelpCapture;
|
|
33
|
+
}
|
|
34
|
+
/** One flow: a file `docs/flows/<role>.<lang>.md`. */
|
|
35
|
+
export interface HelpFlow {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly roles: readonly string[];
|
|
39
|
+
/** React Router route ids this flow covers. */
|
|
40
|
+
readonly routes: readonly string[];
|
|
41
|
+
/** The role's overview: shown when no flow covers the screen. */
|
|
42
|
+
readonly overview: boolean;
|
|
43
|
+
readonly lang: string;
|
|
44
|
+
/** The Markdown before the first step. */
|
|
45
|
+
readonly body: string;
|
|
46
|
+
readonly steps: readonly HelpStep[];
|
|
47
|
+
/** The source file, for messages. */
|
|
48
|
+
readonly file: string;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/help/types.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC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AC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The small YAML a flow's front-matter uses: `key: value` lines, inline
|
|
3
|
+
* lists (`[a, b]`), block lists (`- a`) and block lists of maps
|
|
4
|
+
* (`- key: value`, then the map's other keys indented). Scalars are strings,
|
|
5
|
+
* `true`/`false` or numbers; `"…"` and `'…'` quote one. No anchors, no
|
|
6
|
+
* multi-line scalars: a flow's front-matter has no need of them.
|
|
7
|
+
*/
|
|
8
|
+
export type YamlValue = string | number | boolean | readonly YamlValue[] | {
|
|
9
|
+
readonly [key: string]: YamlValue;
|
|
10
|
+
};
|
|
11
|
+
/** A syntax error, with its 1-based line in the front-matter. */
|
|
12
|
+
export declare class YamlError extends Error {
|
|
13
|
+
readonly line: number;
|
|
14
|
+
constructor(line: number, message: string);
|
|
15
|
+
}
|
|
16
|
+
/** Parses a front-matter block to a map; `firstLine` offsets error lines. */
|
|
17
|
+
export declare function parseYaml(source: string, firstLine?: number): Record<string, YamlValue>;
|
|
18
|
+
//# sourceMappingURL=yaml.d.ts.map
|