soseki 0.0.5 → 0.0.7
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/dist/src/components/browser-router.d.ts +19 -0
- package/dist/src/components/browser-router.d.ts.map +1 -0
- package/dist/src/components/browser-router.jsx +15 -0
- package/dist/src/components/outlet.d.ts +8 -0
- package/dist/src/components/outlet.d.ts.map +1 -0
- package/dist/src/components/outlet.jsx +15 -0
- package/dist/src/components/router.d.ts +21 -0
- package/dist/src/components/router.d.ts.map +1 -0
- package/dist/src/components/router.jsx +138 -0
- package/dist/src/contexts/route-context.d.ts +19 -0
- package/dist/src/contexts/route-context.d.ts.map +1 -0
- package/dist/src/contexts/route-context.js +6 -0
- package/dist/src/contexts/router-context.d.ts +55 -0
- package/dist/src/contexts/router-context.d.ts.map +1 -0
- package/dist/src/contexts/router-context.js +8 -0
- package/dist/src/core/_compare-route-paths.d.ts +11 -0
- package/dist/src/core/_compare-route-paths.d.ts.map +1 -0
- package/dist/src/core/_compare-route-paths.js +92 -0
- package/dist/src/core/_match-route-path.d.ts +22 -0
- package/dist/src/core/_match-route-path.d.ts.map +1 -0
- package/dist/src/core/_match-route-path.js +26 -0
- package/dist/src/core/_process-routes.d.ts +14 -0
- package/dist/src/core/_process-routes.d.ts.map +1 -0
- package/dist/src/core/_process-routes.js +45 -0
- package/dist/src/core/_singleton.d.ts +12 -0
- package/dist/src/core/_singleton.d.ts.map +1 -0
- package/dist/src/core/_singleton.js +18 -0
- package/dist/src/core/_unreachable.d.ts +16 -0
- package/dist/src/core/_unreachable.d.ts.map +1 -0
- package/dist/src/core/_unreachable.js +8 -0
- package/dist/src/core/_valibot.d.ts +25 -0
- package/dist/src/core/_valibot.d.ts.map +1 -0
- package/dist/src/core/_valibot.js +30 -0
- package/dist/src/core/errors.d.ts +182 -0
- package/dist/src/core/errors.d.ts.map +1 -0
- package/dist/src/core/errors.js +166 -0
- package/dist/src/core/expect-history-entry.d.ts +59 -0
- package/dist/src/core/expect-history-entry.d.ts.map +1 -0
- package/dist/src/core/expect-history-entry.js +42 -0
- package/dist/src/core/form-data-to-html-form-element.d.ts +11 -0
- package/dist/src/core/form-data-to-html-form-element.d.ts.map +1 -0
- package/dist/src/core/form-data-to-html-form-element.js +31 -0
- package/dist/src/core/history-entry-id-schema.d.ts +17 -0
- package/dist/src/core/history-entry-id-schema.d.ts.map +1 -0
- package/dist/src/core/history-entry-id-schema.js +9 -0
- package/dist/src/core/history-entry-url-schema.d.ts +18 -0
- package/dist/src/core/history-entry-url-schema.d.ts.map +1 -0
- package/dist/src/core/history-entry-url-schema.js +20 -0
- package/dist/src/core/init-loaders.d.ts +28 -0
- package/dist/src/core/init-loaders.d.ts.map +1 -0
- package/dist/src/core/init-loaders.js +30 -0
- package/dist/src/core/match-routes.d.ts +28 -0
- package/dist/src/core/match-routes.d.ts.map +1 -0
- package/dist/src/core/match-routes.js +31 -0
- package/dist/src/core/readonly-form-data.types.d.ts +74 -0
- package/dist/src/core/readonly-form-data.types.d.ts.map +1 -0
- package/dist/src/core/readonly-url.types.d.ts +164 -0
- package/dist/src/core/readonly-url.types.d.ts.map +1 -0
- package/dist/src/core/redirect-response.d.ts +37 -0
- package/dist/src/core/redirect-response.d.ts.map +1 -0
- package/dist/src/core/redirect-response.js +19 -0
- package/dist/src/core/route-path.d.ts +57 -0
- package/dist/src/core/route-path.d.ts.map +1 -0
- package/dist/src/core/route-path.js +93 -0
- package/dist/src/core/route-request.d.ts +149 -0
- package/dist/src/core/route-request.d.ts.map +1 -0
- package/dist/src/core/route-request.js +41 -0
- package/dist/src/core/route.types.d.ts +296 -0
- package/dist/src/core/route.types.d.ts.map +1 -0
- package/dist/src/core/start-action.d.ts +53 -0
- package/dist/src/core/start-action.d.ts.map +1 -0
- package/dist/src/core/start-action.js +95 -0
- package/dist/src/core/start-loaders.d.ts +63 -0
- package/dist/src/core/start-loaders.d.ts.map +1 -0
- package/dist/src/core/start-loaders.js +138 -0
- package/dist/{core.d.ts → src/core.d.ts} +7 -11
- package/dist/src/core.d.ts.map +1 -0
- package/dist/{core.js → src/core.js} +2 -4
- package/dist/src/engines/engine.types.d.ts +216 -0
- package/dist/src/engines/engine.types.d.ts.map +1 -0
- package/dist/src/engines/navigation-api-engine.d.ts +50 -0
- package/dist/src/engines/navigation-api-engine.d.ts.map +1 -0
- package/dist/src/engines/navigation-api-engine.js +411 -0
- package/dist/src/engines.d.ts +4 -0
- package/dist/src/engines.d.ts.map +1 -0
- package/dist/src/engines.js +1 -0
- package/dist/src/hooks/_use-singleton.d.ts +11 -0
- package/dist/src/hooks/_use-singleton.d.ts.map +1 -0
- package/dist/src/hooks/_use-singleton.js +26 -0
- package/dist/src/hooks/use-action-data.d.ts +17 -0
- package/dist/src/hooks/use-action-data.d.ts.map +1 -0
- package/dist/src/hooks/use-action-data.js +16 -0
- package/dist/src/hooks/use-form-action.d.ts +7 -0
- package/dist/src/hooks/use-form-action.d.ts.map +1 -0
- package/dist/src/hooks/use-form-action.js +9 -0
- package/dist/src/hooks/use-loader-data.d.ts +9 -0
- package/dist/src/hooks/use-loader-data.d.ts.map +1 -0
- package/dist/src/hooks/use-loader-data.js +20 -0
- package/dist/src/hooks/use-navigate.d.ts +53 -0
- package/dist/src/hooks/use-navigate.d.ts.map +1 -0
- package/dist/src/hooks/use-navigate.js +43 -0
- package/dist/{hooks → src/hooks}/use-params.d.ts +2 -2
- package/dist/src/hooks/use-params.d.ts.map +1 -0
- package/dist/{hooks → src/hooks}/use-params.js +1 -1
- package/dist/src/hooks/use-route-context.d.ts +10 -0
- package/dist/src/hooks/use-route-context.d.ts.map +1 -0
- package/dist/src/hooks/use-route-context.js +17 -0
- package/dist/src/hooks/use-router-context.d.ts +12 -0
- package/dist/src/hooks/use-router-context.d.ts.map +1 -0
- package/dist/src/hooks/use-router-context.js +20 -0
- package/dist/src/hooks/use-submit.d.ts +59 -0
- package/dist/src/hooks/use-submit.d.ts.map +1 -0
- package/dist/src/hooks/use-submit.js +38 -0
- package/dist/src/soseki.d.ts +31 -0
- package/dist/src/soseki.d.ts.map +1 -0
- package/dist/src/soseki.js +12 -0
- package/dist/src/utils/redirect.d.ts +11 -0
- package/dist/src/utils/redirect.d.ts.map +1 -0
- package/dist/src/utils/redirect.js +12 -0
- package/package.json +47 -40
- package/src/components/browser-router.tsx +8 -11
- package/src/components/outlet.tsx +3 -2
- package/src/components/router.tsx +139 -145
- package/src/contexts/route-context.ts +6 -5
- package/src/contexts/router-context.ts +36 -19
- package/src/core/_compare-route-paths.ts +48 -34
- package/src/core/_match-route-path.ts +21 -15
- package/src/core/_process-routes.ts +44 -46
- package/src/core/_singleton.ts +13 -38
- package/src/core/_unreachable.ts +12 -7
- package/src/core/_valibot.ts +19 -116
- package/src/core/errors.ts +150 -495
- package/src/core/expect-history-entry.ts +40 -41
- package/src/core/form-data-to-html-form-element.ts +37 -0
- package/src/core/history-entry-id-schema.ts +6 -11
- package/src/core/history-entry-url-schema.ts +25 -18
- package/src/core/init-loaders.ts +35 -57
- package/src/core/match-routes.ts +33 -65
- package/src/core/readonly-form-data.types.ts +48 -28
- package/src/core/readonly-url.types.ts +57 -28
- package/src/core/redirect-response.ts +26 -15
- package/src/core/route-path.ts +114 -0
- package/src/core/route-request.ts +144 -32
- package/src/core/route.types.ts +250 -226
- package/src/core/start-action.ts +164 -0
- package/src/core/start-loaders.ts +190 -212
- package/src/core.ts +8 -15
- package/src/engines/engine.types.ts +204 -166
- package/src/engines/navigation-api-engine.ts +332 -233
- package/src/engines.ts +4 -0
- package/src/hooks/_use-singleton.ts +30 -0
- package/src/hooks/use-action-data.ts +21 -26
- package/src/hooks/use-form-action.ts +4 -5
- package/src/hooks/use-loader-data.ts +16 -18
- package/src/hooks/use-navigate.ts +69 -28
- package/src/hooks/use-params.ts +4 -4
- package/src/hooks/use-route-context.ts +20 -0
- package/src/hooks/use-router-context.ts +25 -0
- package/src/hooks/use-submit.ts +48 -53
- package/src/soseki.ts +27 -34
- package/src/utils/redirect.ts +5 -5
- package/dist/components/action-id.d.ts +0 -19
- package/dist/components/action-id.d.ts.map +0 -1
- package/dist/components/action-id.jsx +0 -14
- package/dist/components/browser-router.d.ts +0 -17
- package/dist/components/browser-router.d.ts.map +0 -1
- package/dist/components/browser-router.jsx +0 -13
- package/dist/components/hidden-input.d.ts +0 -20
- package/dist/components/hidden-input.d.ts.map +0 -1
- package/dist/components/hidden-input.jsx +0 -8
- package/dist/components/outlet.d.ts +0 -8
- package/dist/components/outlet.d.ts.map +0 -1
- package/dist/components/outlet.jsx +0 -15
- package/dist/components/router.d.ts +0 -23
- package/dist/components/router.d.ts.map +0 -1
- package/dist/components/router.jsx +0 -128
- package/dist/contexts/route-context.d.ts +0 -19
- package/dist/contexts/route-context.d.ts.map +0 -1
- package/dist/contexts/route-context.js +0 -6
- package/dist/contexts/router-context.d.ts +0 -46
- package/dist/contexts/router-context.d.ts.map +0 -1
- package/dist/contexts/router-context.js +0 -8
- package/dist/core/_action-id-registry.d.ts +0 -10
- package/dist/core/_action-id-registry.d.ts.map +0 -1
- package/dist/core/_action-id-registry.js +0 -8
- package/dist/core/_capture-stack-trace.d.ts +0 -8
- package/dist/core/_capture-stack-trace.d.ts.map +0 -1
- package/dist/core/_capture-stack-trace.js +0 -12
- package/dist/core/_compare-route-paths.d.ts +0 -11
- package/dist/core/_compare-route-paths.d.ts.map +0 -1
- package/dist/core/_compare-route-paths.js +0 -80
- package/dist/core/_create-html-form-element-form-form-data.d.ts +0 -9
- package/dist/core/_create-html-form-element-form-form-data.d.ts.map +0 -1
- package/dist/core/_create-html-form-element-form-form-data.js +0 -27
- package/dist/core/_encode-pathname.d.ts +0 -10
- package/dist/core/_encode-pathname.d.ts.map +0 -1
- package/dist/core/_encode-pathname.js +0 -16
- package/dist/core/_is-error.d.ts +0 -3
- package/dist/core/_is-error.d.ts.map +0 -1
- package/dist/core/_is-error.js +0 -13
- package/dist/core/_is-promise-like.d.ts +0 -8
- package/dist/core/_is-promise-like.d.ts.map +0 -1
- package/dist/core/_is-promise-like.js +0 -12
- package/dist/core/_match-route-path.d.ts +0 -19
- package/dist/core/_match-route-path.d.ts.map +0 -1
- package/dist/core/_match-route-path.js +0 -22
- package/dist/core/_process-routes.d.ts +0 -9
- package/dist/core/_process-routes.d.ts.map +0 -1
- package/dist/core/_process-routes.js +0 -47
- package/dist/core/_singleton.d.ts +0 -18
- package/dist/core/_singleton.d.ts.map +0 -1
- package/dist/core/_singleton.js +0 -37
- package/dist/core/_unreachable.d.ts +0 -12
- package/dist/core/_unreachable.d.ts.map +0 -1
- package/dist/core/_unreachable.js +0 -8
- package/dist/core/_use-singleton.d.ts +0 -11
- package/dist/core/_use-singleton.d.ts.map +0 -1
- package/dist/core/_use-singleton.js +0 -21
- package/dist/core/_valibot.d.ts +0 -52
- package/dist/core/_valibot.d.ts.map +0 -1
- package/dist/core/_valibot.js +0 -107
- package/dist/core/_weak-id-registry.d.ts +0 -76
- package/dist/core/_weak-id-registry.d.ts.map +0 -1
- package/dist/core/_weak-id-registry.js +0 -67
- package/dist/core/constants.d.ts +0 -5
- package/dist/core/constants.d.ts.map +0 -1
- package/dist/core/constants.js +0 -4
- package/dist/core/data-map.types.d.ts +0 -23
- package/dist/core/data-map.types.d.ts.map +0 -1
- package/dist/core/data-map.types.js +0 -1
- package/dist/core/data-store.types.d.ts +0 -22
- package/dist/core/data-store.types.d.ts.map +0 -1
- package/dist/core/data-store.types.js +0 -1
- package/dist/core/deferred-promise.d.ts +0 -203
- package/dist/core/deferred-promise.d.ts.map +0 -1
- package/dist/core/deferred-promise.js +0 -200
- package/dist/core/errors.d.ts +0 -303
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -400
- package/dist/core/expect-history-entry.d.ts +0 -52
- package/dist/core/expect-history-entry.d.ts.map +0 -1
- package/dist/core/expect-history-entry.js +0 -38
- package/dist/core/history-entry-id-schema.d.ts +0 -17
- package/dist/core/history-entry-id-schema.d.ts.map +0 -1
- package/dist/core/history-entry-id-schema.js +0 -9
- package/dist/core/history-entry-url-schema.d.ts +0 -20
- package/dist/core/history-entry-url-schema.d.ts.map +0 -1
- package/dist/core/history-entry-url-schema.js +0 -16
- package/dist/core/init-loaders.d.ts +0 -37
- package/dist/core/init-loaders.d.ts.map +0 -1
- package/dist/core/init-loaders.js +0 -38
- package/dist/core/match-routes.d.ts +0 -31
- package/dist/core/match-routes.d.ts.map +0 -1
- package/dist/core/match-routes.js +0 -54
- package/dist/core/readonly-form-data.types.d.ts +0 -32
- package/dist/core/readonly-form-data.types.d.ts.map +0 -1
- package/dist/core/readonly-url.types.d.ts +0 -135
- package/dist/core/readonly-url.types.d.ts.map +0 -1
- package/dist/core/redirect-response.d.ts +0 -29
- package/dist/core/redirect-response.d.ts.map +0 -1
- package/dist/core/redirect-response.js +0 -17
- package/dist/core/route-request.d.ts +0 -52
- package/dist/core/route-request.d.ts.map +0 -1
- package/dist/core/route-request.js +0 -26
- package/dist/core/route.types.d.ts +0 -309
- package/dist/core/route.types.d.ts.map +0 -1
- package/dist/core/start-actions.d.ts +0 -60
- package/dist/core/start-actions.d.ts.map +0 -1
- package/dist/core/start-actions.js +0 -186
- package/dist/core/start-loaders.d.ts +0 -69
- package/dist/core/start-loaders.d.ts.map +0 -1
- package/dist/core/start-loaders.js +0 -154
- package/dist/core.d.ts.map +0 -1
- package/dist/engines/engine.types.d.ts +0 -190
- package/dist/engines/engine.types.d.ts.map +0 -1
- package/dist/engines/navigation-api-engine.d.ts +0 -48
- package/dist/engines/navigation-api-engine.d.ts.map +0 -1
- package/dist/engines/navigation-api-engine.js +0 -332
- package/dist/hooks/_use-route-context.d.ts +0 -10
- package/dist/hooks/_use-route-context.d.ts.map +0 -1
- package/dist/hooks/_use-route-context.js +0 -17
- package/dist/hooks/_use-router-context.d.ts +0 -10
- package/dist/hooks/_use-router-context.d.ts.map +0 -1
- package/dist/hooks/_use-router-context.js +0 -18
- package/dist/hooks/use-action-data.d.ts +0 -23
- package/dist/hooks/use-action-data.d.ts.map +0 -1
- package/dist/hooks/use-action-data.js +0 -16
- package/dist/hooks/use-form-action.d.ts +0 -7
- package/dist/hooks/use-form-action.d.ts.map +0 -1
- package/dist/hooks/use-form-action.js +0 -10
- package/dist/hooks/use-loader-data.d.ts +0 -11
- package/dist/hooks/use-loader-data.d.ts.map +0 -1
- package/dist/hooks/use-loader-data.js +0 -19
- package/dist/hooks/use-navigate.d.ts +0 -39
- package/dist/hooks/use-navigate.d.ts.map +0 -1
- package/dist/hooks/use-navigate.js +0 -26
- package/dist/hooks/use-params.d.ts.map +0 -1
- package/dist/hooks/use-pathname.d.ts +0 -7
- package/dist/hooks/use-pathname.d.ts.map +0 -1
- package/dist/hooks/use-pathname.js +0 -9
- package/dist/hooks/use-submit.d.ts +0 -66
- package/dist/hooks/use-submit.d.ts.map +0 -1
- package/dist/hooks/use-submit.js +0 -35
- package/dist/soseki.d.ts +0 -42
- package/dist/soseki.d.ts.map +0 -1
- package/dist/soseki.js +0 -19
- package/dist/utils/get-action-id.d.ts +0 -8
- package/dist/utils/get-action-id.d.ts.map +0 -1
- package/dist/utils/get-action-id.js +0 -11
- package/dist/utils/href.d.ts +0 -11
- package/dist/utils/href.d.ts.map +0 -1
- package/dist/utils/href.js +0 -12
- package/dist/utils/redirect.d.ts +0 -11
- package/dist/utils/redirect.d.ts.map +0 -1
- package/dist/utils/redirect.js +0 -12
- package/dist/utils/route-index.d.ts +0 -41
- package/dist/utils/route-index.d.ts.map +0 -1
- package/dist/utils/route-index.js +0 -12
- package/dist/utils/route-route.d.ts +0 -62
- package/dist/utils/route-route.d.ts.map +0 -1
- package/dist/utils/route-route.js +0 -25
- package/dist/utils/set-action-id.d.ts +0 -9
- package/dist/utils/set-action-id.d.ts.map +0 -1
- package/dist/utils/set-action-id.js +0 -12
- package/src/components/action-id.tsx +0 -35
- package/src/components/hidden-input.tsx +0 -39
- package/src/core/_action-id-registry.ts +0 -11
- package/src/core/_capture-stack-trace.ts +0 -12
- package/src/core/_create-html-form-element-form-form-data.ts +0 -32
- package/src/core/_encode-pathname.ts +0 -17
- package/src/core/_is-error.ts +0 -16
- package/src/core/_is-promise-like.ts +0 -14
- package/src/core/_use-singleton.ts +0 -24
- package/src/core/_weak-id-registry.ts +0 -125
- package/src/core/constants.ts +0 -4
- package/src/core/data-map.types.ts +0 -28
- package/src/core/data-store.types.ts +0 -25
- package/src/core/deferred-promise.ts +0 -408
- package/src/core/start-actions.ts +0 -274
- package/src/hooks/_use-route-context.ts +0 -19
- package/src/hooks/_use-router-context.ts +0 -25
- package/src/hooks/use-pathname.ts +0 -10
- package/src/utils/get-action-id.ts +0 -12
- package/src/utils/href.ts +0 -17
- package/src/utils/route-index.ts +0 -70
- package/src/utils/route-route.ts +0 -111
- package/src/utils/set-action-id.ts +0 -14
- /package/dist/{core → src/core}/readonly-form-data.types.js +0 -0
- /package/dist/{core → src/core}/readonly-url.types.js +0 -0
- /package/dist/{core → src/core}/route.types.js +0 -0
- /package/dist/{engines → src/engines}/engine.types.js +0 -0
package/src/core/route.types.ts
CHANGED
|
@@ -1,351 +1,375 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import type { ReadonlyURL } from "./readonly-url.types.js";
|
|
4
|
-
import type
|
|
4
|
+
import type { RouteGetRequest, RoutePostRequest } from "./route-request.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 個別のパスパラメーターを解析し、適切なプロパティーの型オブジェクトへと変換する内部ユーティリティー型です。
|
|
8
|
+
*
|
|
9
|
+
* パラメーターの末尾の形状を条件付き型により詳細に選別します。
|
|
8
10
|
*
|
|
9
|
-
* @template
|
|
11
|
+
* @template Param 解析対象となる単一のパラメーター文字列です。
|
|
10
12
|
*/
|
|
11
|
-
//
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
// oxfmt-ignore
|
|
14
|
+
type ParamRecord<Param extends string> =
|
|
15
|
+
// パラメーター末尾に「?」がある場合、オプショナルなプロパティー型に変換します
|
|
16
|
+
Param extends `${infer Name}?`
|
|
17
|
+
? { [K in Name]?: string }
|
|
18
|
+
|
|
19
|
+
// パラメーターに拡張子が含まれている場合、拡張子を除いた名前を必須のプロパティー型に変換します。
|
|
20
|
+
: Param extends `${infer Name}.${string}`
|
|
21
|
+
? { [K in Name]: string }
|
|
22
|
+
|
|
23
|
+
// 上記のいずれのパターンにも該当しない場合は、パラメーター名をそのまま必須のプロパティー型に変換します。
|
|
24
|
+
: { [K in Param]: string };
|
|
16
25
|
|
|
17
26
|
/**
|
|
18
|
-
*
|
|
27
|
+
* パス文字列のセグメントから動的なパラメーターやワイルドカードを再帰的に抽出し、型安全なオブジェクト構造を構築するユーティリティー型です。
|
|
19
28
|
*
|
|
20
|
-
*
|
|
29
|
+
* 開発者が指定した文字列リテラル型の形状に基づいて、ルーティングに必要なパラメーターの型を静的に決定します。
|
|
30
|
+
*
|
|
31
|
+
* このユーティリティー型は、ライブラリー `regexparam` の改良版です。
|
|
32
|
+
*
|
|
33
|
+
* @template T 解析対象となる URL パス全体の文字列リテラル型です。
|
|
34
|
+
* @see https://github.com/lukeed/regexparam
|
|
35
|
+
* @see https://github.com/lukeed/regexparam/issues/31
|
|
36
|
+
* @see https://github.com/lukeed/regexparam/pull/33
|
|
21
37
|
*/
|
|
22
|
-
|
|
38
|
+
// oxfmt-ignore
|
|
39
|
+
type RouteParams<T extends string> =
|
|
40
|
+
// 与えられた型が具体的なリテラルでなく文字列型である場合は、汎用的なレコード型へとフォールバックします。
|
|
41
|
+
string extends T
|
|
42
|
+
? { [K in string]?: string }
|
|
43
|
+
|
|
44
|
+
// パスの中間にワイルドカードが存在する場合、前後のパラメーターに加えて、必須のワイルドカードプロパティーを結合します。
|
|
45
|
+
: T extends `${infer Prev}/*/${infer Rest}`
|
|
46
|
+
? & RouteParams<Prev>
|
|
47
|
+
& { wild: string }
|
|
48
|
+
& RouteParams<`/${Rest}`>
|
|
49
|
+
|
|
50
|
+
// パスの先頭がコロンで開始されている場合、先頭にスラッシュ(/)を補正して再帰的に再評価します。
|
|
51
|
+
: T extends `:${infer Rest}`
|
|
52
|
+
? RouteParams<`/:${Rest}`>
|
|
53
|
+
|
|
54
|
+
// パスの中間にコロンで始まるパラメーターが含まれている場合、そのセグメントの型情報を抽出し、スラッシュ以降の残りのパスの解析結果と交差型で結合します。
|
|
55
|
+
: T extends `${string}:${infer Param}/${infer Rest}`
|
|
56
|
+
? & ParamRecord<Param>
|
|
57
|
+
& RouteParams<`/${Rest}`>
|
|
58
|
+
|
|
59
|
+
// パスの末尾がコロンで始まるパラメーターで終了している場合、そのセグメントの型情報を判定して抽出を完了します。
|
|
60
|
+
: T extends `${string}/:${infer Param}`
|
|
61
|
+
? ParamRecord<Param>
|
|
62
|
+
|
|
63
|
+
// パスの末尾がオプショナルワイルドカードで終了している場合、キー名を「"*"」としたオプショナルなプロパティー型を返します。
|
|
64
|
+
: T extends `${string}/*?`
|
|
65
|
+
? { "*"?: string }
|
|
66
|
+
|
|
67
|
+
// パスの末尾が通常のワイルドカードで終了している場合、キー名を「"*"」とした必須のプロパティー型を返します。
|
|
68
|
+
: T extends `${string}/*`
|
|
69
|
+
? { "*": string }
|
|
70
|
+
|
|
71
|
+
// 抽出可能なパラメーターやワイルドカードが一切検出されなかった場合は、空のオブジェクト型を返します。
|
|
72
|
+
: {};
|
|
23
73
|
|
|
24
74
|
/**
|
|
25
|
-
*
|
|
75
|
+
* 文字列リテラルとして定義されたパスの形状から、含まれるパスパラメーターを解析し、静的に型付けされたオブジェクトとして抽出する型定義です。
|
|
26
76
|
*
|
|
27
|
-
* @template
|
|
77
|
+
* @template TRoutePath パラメーター抽出の対象となるパス文字列リテラル型です。
|
|
28
78
|
*/
|
|
29
|
-
export type
|
|
30
|
-
/**
|
|
31
|
-
* URL から抽出されたパスパラメーターのオブジェクトです。
|
|
32
|
-
*/
|
|
33
|
-
params: PathParams<TPath>;
|
|
79
|
+
export type RoutePathParams<TRoutePath extends string = string> = Readonly<RouteParams<TRoutePath>>;
|
|
34
80
|
|
|
81
|
+
/**
|
|
82
|
+
* データ更新などのアクション処理を実行する際に、該当する関数へ渡される引数の型定義です。
|
|
83
|
+
*
|
|
84
|
+
* 解析済みのパスパラメーターと、HTTP の POST メソッドを抽象化したリクエストオブジェクトを含みます。
|
|
85
|
+
*
|
|
86
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
87
|
+
*/
|
|
88
|
+
export type ActionFunctionArgs<TRoutePath extends string = string> = {
|
|
35
89
|
/**
|
|
36
|
-
*
|
|
90
|
+
* 現在の URL パスから抽出されたパラメーターオブジェクトです。
|
|
37
91
|
*/
|
|
38
|
-
|
|
92
|
+
params: RoutePathParams<TRoutePath>;
|
|
39
93
|
|
|
40
94
|
/**
|
|
41
|
-
*
|
|
95
|
+
* フォームデータなどを内包する、HTTP の POST メソッドに特化したルーティングリクエストオブジェクトです。
|
|
42
96
|
*/
|
|
43
|
-
|
|
97
|
+
request: RoutePostRequest;
|
|
44
98
|
};
|
|
45
99
|
|
|
46
100
|
/**
|
|
47
|
-
*
|
|
101
|
+
* データの登録、更新、削除といった副作用を伴うアクション処理を定義するための関数インターフェースです。
|
|
48
102
|
*
|
|
49
|
-
* @template
|
|
103
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
104
|
+
* @template TData アクション関数が返す戻り値の型定義です。既定値は `unknown` です。
|
|
50
105
|
*/
|
|
51
|
-
export interface
|
|
52
|
-
|
|
53
|
-
* アクションの実行可否を判定します。
|
|
54
|
-
*
|
|
55
|
-
* @param args 判定に必要なパラメーターとリクエスト情報です。
|
|
56
|
-
* @returns アクションを実行する場合は `true`、そうでない場合は `false` を返します。
|
|
57
|
-
*/
|
|
58
|
-
(args: ShouldActionArgs<TPath>): boolean;
|
|
106
|
+
export interface ActionFunction<TRoutePath extends string = string, TData = unknown> {
|
|
107
|
+
(args: ActionFunctionArgs<TRoutePath>): TData;
|
|
59
108
|
}
|
|
60
109
|
|
|
61
110
|
/**
|
|
62
|
-
*
|
|
111
|
+
* ページ遷移やデータ更新が発生した際、現在の画面データを再読み込みすべきかどうかを判定する関数へ渡される引数の型定義です。
|
|
112
|
+
*
|
|
113
|
+
* アクションを実行した契機となる HTTP メソッドの種類(GET / POST)に応じて、含まれるコンテキスト情報が分岐します。
|
|
63
114
|
*
|
|
64
|
-
* @template
|
|
115
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
65
116
|
*/
|
|
66
|
-
export type
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
117
|
+
export type ShouldReloadFunctionArgs<TRoutePath extends string = string> =
|
|
118
|
+
| {
|
|
119
|
+
/**
|
|
120
|
+
* 再読み込みを引き起こした HTTP メソッドの種別です。
|
|
121
|
+
*/
|
|
122
|
+
triggerMethod: "GET";
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 現在の画面に対応する読み取り専用 URL オブジェクトです。
|
|
126
|
+
*/
|
|
127
|
+
currentUrl: ReadonlyURL;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 現在の URL から抽出されたパスパラメーターです。
|
|
131
|
+
*/
|
|
132
|
+
currentParams: RoutePathParams<TRoutePath>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* POST リクエストが発生する直前の読み取り専用 URL オブジェクトです。
|
|
136
|
+
*/
|
|
137
|
+
prevUrl: ReadonlyURL;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* POST リクエストが発生する直前の URL から抽出されたパスパラメーターです。
|
|
141
|
+
*/
|
|
142
|
+
prevParams: RoutePathParams;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* システムが内部ロジックに基づいて判断した、再読み込み実行の既定の判定フラグです。
|
|
146
|
+
*/
|
|
147
|
+
defaultShouldReload: boolean;
|
|
148
|
+
}
|
|
149
|
+
| {
|
|
150
|
+
/**
|
|
151
|
+
* 再読み込みを引き起こした HTTP メソッドの種別です。
|
|
152
|
+
*/
|
|
153
|
+
triggerMethod: "POST";
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 現在の画面に対応する読み取り専用 URL オブジェクトです。
|
|
157
|
+
*/
|
|
158
|
+
currentUrl: ReadonlyURL;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 現在の URL から抽出されたパスパラメーターです。
|
|
162
|
+
*/
|
|
163
|
+
currentParams: RoutePathParams<TRoutePath>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* POST リクエストが発生する直前の読み取り専用 URL オブジェクトです。
|
|
167
|
+
*/
|
|
168
|
+
prevUrl: ReadonlyURL;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* POST リクエストが発生する直前の URL から抽出されたパスパラメーターです。
|
|
172
|
+
*/
|
|
173
|
+
prevParams: RoutePathParams;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* POST リクエストと共に送信された標準のフォームデータオブジェクトです。
|
|
177
|
+
*/
|
|
178
|
+
formData: FormData;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 直前に実行されたアクション関数から返されたデータです。
|
|
182
|
+
*/
|
|
183
|
+
actionData: unknown;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* システムが内部ロジックに基づいて判断した、再読み込み実行の既定の判定フラグです。
|
|
187
|
+
*/
|
|
188
|
+
defaultShouldReload: boolean;
|
|
189
|
+
};
|
|
77
190
|
|
|
78
191
|
/**
|
|
79
|
-
*
|
|
192
|
+
* ルートデータの再読み込みが不必要な場合に、余分な通信や再取得処理を抑制するための判定関数インターフェースです。
|
|
80
193
|
*
|
|
81
|
-
* @template
|
|
82
|
-
* @
|
|
194
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
195
|
+
* @returns データを再読み込みする場合は `true`、スキップする場合は `false` を返します。
|
|
83
196
|
*/
|
|
84
|
-
export interface
|
|
85
|
-
|
|
86
|
-
* 指定された引数に基づいてアクションを実行します。
|
|
87
|
-
*
|
|
88
|
-
* @param args アクションの実行に必要なパラメーターとリクエスト情報です。
|
|
89
|
-
* @returns 処理結果として任意のデータを返します。
|
|
90
|
-
*/
|
|
91
|
-
(args: ActionArgs<TPath>): TData;
|
|
197
|
+
export interface ShouldReloadFunction<TRoutePath extends string = string> {
|
|
198
|
+
(args: ShouldReloadFunctionArgs<TRoutePath>): boolean;
|
|
92
199
|
}
|
|
93
200
|
|
|
94
201
|
/**
|
|
95
|
-
*
|
|
202
|
+
* 画面の描画に必要なデータを取得(ロード)する際に、該当する関数へ渡される引数の型定義です。
|
|
96
203
|
*
|
|
97
|
-
*
|
|
204
|
+
* 解析済みのパスパラメーターと、HTTP の GET メソッドを抽象化したリクエストオブジェクトを含みます。
|
|
98
205
|
*
|
|
99
|
-
* @template
|
|
206
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
100
207
|
*/
|
|
101
|
-
export type
|
|
208
|
+
export type LoaderFunctionArgs<TRoutePath extends string = string> = {
|
|
102
209
|
/**
|
|
103
|
-
*
|
|
210
|
+
* 現在の URL パスから抽出されたパラメーターオブジェクトです。
|
|
104
211
|
*/
|
|
105
|
-
|
|
212
|
+
params: RoutePathParams<TRoutePath>;
|
|
106
213
|
|
|
107
214
|
/**
|
|
108
|
-
*
|
|
215
|
+
* HTTP の GET メソッドに特化したルーティングリクエストオブジェクトです。
|
|
109
216
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* 現在のパスパラメーターです。
|
|
114
|
-
*/
|
|
115
|
-
currentParams: PathParams<TPath>;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* 遷移前の URL オブジェクトです。
|
|
119
|
-
*/
|
|
120
|
-
prevUrl: ReadonlyURL;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* 遷移前のパスパラメーターです。
|
|
124
|
-
*/
|
|
125
|
-
prevParams: PathParams;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* 送信されたフォームデータです。GET 時は常にありません。
|
|
129
|
-
*/
|
|
130
|
-
formData?: undefined;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* 直前に行われたアクションの結果です。GET 時は常にありません。
|
|
134
|
-
*/
|
|
135
|
-
actionResult?: undefined;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* デフォルトのルールに基づいた判定結果です。
|
|
139
|
-
*/
|
|
140
|
-
defaultShouldReload: boolean;
|
|
141
|
-
} | {
|
|
142
|
-
/**
|
|
143
|
-
* 最読み込みをトリガーしたリクエストメソッドです。
|
|
144
|
-
*/
|
|
145
|
-
triggerMethod: "POST";
|
|
217
|
+
request: RouteGetRequest;
|
|
218
|
+
};
|
|
146
219
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
220
|
+
/**
|
|
221
|
+
* 画面の初期描画時や遷移時にデータをオンデマンドで取得するための関数インターフェースです。
|
|
222
|
+
*
|
|
223
|
+
* @template TRoutePath 対象となるルートのパス文字列リテラル型です。
|
|
224
|
+
* @template TData ローダー関数が返す戻り値の型定義です。既定値は `unknown` です。
|
|
225
|
+
*/
|
|
226
|
+
export interface LoaderFunction<TRoutePath extends string = string, TData = unknown> {
|
|
227
|
+
(args: LoaderFunctionArgs<TRoutePath>): TData;
|
|
228
|
+
}
|
|
151
229
|
|
|
230
|
+
/**
|
|
231
|
+
* アプリケーションのルーティング設定を定義するためのオブジェクトの型定義です。
|
|
232
|
+
*
|
|
233
|
+
* 開発者が宣言的にルーティングのツリーやリストを記述する際に使用します。
|
|
234
|
+
*
|
|
235
|
+
* @template TPath ルートに関連付けるパス文字列リテラル型です。
|
|
236
|
+
*/
|
|
237
|
+
export type RouteDefinitionObject<TPath extends string = string> = {
|
|
152
238
|
/**
|
|
153
|
-
*
|
|
239
|
+
* マッチングの対象となる URL パスのパターン文字列です。
|
|
154
240
|
*/
|
|
155
|
-
|
|
241
|
+
readonly path: TPath;
|
|
156
242
|
|
|
157
243
|
/**
|
|
158
|
-
*
|
|
244
|
+
* 親ルートのパスにおいて、インデックスルートとして機能させるかどうかのフラグです。
|
|
159
245
|
*/
|
|
160
|
-
|
|
246
|
+
readonly index?: boolean | undefined;
|
|
161
247
|
|
|
162
248
|
/**
|
|
163
|
-
*
|
|
249
|
+
* このルートで実行されるデータ更新用のアクション関数です。
|
|
164
250
|
*/
|
|
165
|
-
|
|
251
|
+
readonly action?: ActionFunction<TPath> | undefined;
|
|
166
252
|
|
|
167
253
|
/**
|
|
168
|
-
*
|
|
254
|
+
* このルートのデータ再読み込み動作を制御する判定関数です。
|
|
169
255
|
*/
|
|
170
|
-
|
|
256
|
+
readonly shouldReload?: ShouldReloadFunction<TPath> | undefined;
|
|
171
257
|
|
|
172
258
|
/**
|
|
173
|
-
*
|
|
259
|
+
* このルートの画面描画に必要なデータを取得する関数です。
|
|
174
260
|
*/
|
|
175
|
-
|
|
261
|
+
readonly loader?: LoaderFunction<TPath> | undefined;
|
|
176
262
|
|
|
177
263
|
/**
|
|
178
|
-
*
|
|
264
|
+
* このルートに対応して描画される React のコンポーネントです。
|
|
179
265
|
*/
|
|
180
|
-
|
|
266
|
+
readonly component?: React.ComponentType<{}> | undefined;
|
|
181
267
|
};
|
|
182
|
-
|
|
183
268
|
/**
|
|
184
|
-
*
|
|
269
|
+
* ルーティング設定をインポート経由で定義するための構造体型定義です。
|
|
185
270
|
*
|
|
186
|
-
* @template TPath
|
|
271
|
+
* @template TPath ルートに関連付けるパス文字列リテラル型です。
|
|
187
272
|
*/
|
|
188
|
-
export
|
|
273
|
+
export type RouteDefinitionModule<TPath extends string = string> = {
|
|
189
274
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @param args 遷移先後やアクションの結果を含む判定用データです。
|
|
193
|
-
* @returns 再読み込みを行う場合は `true`、そうでない場合は `false` を返します。
|
|
275
|
+
* マッチングの対象となる URL パスのパターン文字列です。
|
|
194
276
|
*/
|
|
195
|
-
|
|
196
|
-
}
|
|
277
|
+
readonly path: TPath;
|
|
197
278
|
|
|
198
|
-
/**
|
|
199
|
-
* ローダー関数(`loader`)に渡される引数の型定義です。
|
|
200
|
-
*
|
|
201
|
-
* @template TPath パス文字列の型です。
|
|
202
|
-
*/
|
|
203
|
-
export type LoaderArgs<TPath extends string = string> = {
|
|
204
279
|
/**
|
|
205
|
-
*
|
|
280
|
+
* 親ルートのパスにおいて、インデックスルートとして機能させるかどうかのフラグです。
|
|
206
281
|
*/
|
|
207
|
-
|
|
282
|
+
readonly index?: boolean | undefined;
|
|
208
283
|
|
|
209
284
|
/**
|
|
210
|
-
*
|
|
285
|
+
* このルートで実行されるデータ更新用のアクション関数です。
|
|
211
286
|
*/
|
|
212
|
-
|
|
213
|
-
};
|
|
287
|
+
readonly action?: ActionFunction<TPath> | undefined;
|
|
214
288
|
|
|
215
|
-
/**
|
|
216
|
-
* データを取得するためのローダー関数のインターフェースです。
|
|
217
|
-
*
|
|
218
|
-
* @template TPath パス文字列の型です。
|
|
219
|
-
* @template TData ローダーが取得するデータの型です。
|
|
220
|
-
*/
|
|
221
|
-
export interface ILoader<TPath extends string = string, TData = unknown> {
|
|
222
289
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* @param args データ取得に必要なパラメーターとリクエスト情報です。
|
|
226
|
-
* @returns 取得したデータを返します。
|
|
290
|
+
* このルートのデータ再読み込み動作を制御する判定関数です。
|
|
227
291
|
*/
|
|
228
|
-
|
|
229
|
-
}
|
|
292
|
+
readonly shouldReload?: ShouldReloadFunction<TPath> | undefined;
|
|
230
293
|
|
|
231
|
-
/**
|
|
232
|
-
* ルートに紐づくデータ処理用の関数群をまとめたオブジェクトの型定義です。
|
|
233
|
-
*
|
|
234
|
-
* @template TPath パス文字列の型です。
|
|
235
|
-
*/
|
|
236
|
-
export type DataFunctionObject<TPath extends string = string> = {
|
|
237
294
|
/**
|
|
238
|
-
*
|
|
295
|
+
* このルートの画面描画に必要なデータを取得する関数です。
|
|
239
296
|
*/
|
|
240
|
-
readonly
|
|
297
|
+
readonly loader?: LoaderFunction<TPath> | undefined;
|
|
241
298
|
|
|
242
299
|
/**
|
|
243
|
-
*
|
|
300
|
+
* このルートに対応して描画される React のコンポーネントです。
|
|
301
|
+
*
|
|
302
|
+
* `default` プロパティーよりこちらが優先されます。
|
|
244
303
|
*/
|
|
245
|
-
readonly
|
|
304
|
+
readonly component?: React.ComponentType<{}> | undefined;
|
|
246
305
|
|
|
247
306
|
/**
|
|
248
|
-
*
|
|
307
|
+
* ES モジュールのデフォルトエクスポートとして定義された、描画対象となる React のコンポーネントです。
|
|
308
|
+
*
|
|
309
|
+
* `component` プロパティーがない場合はこちらにフォールバックされます。
|
|
249
310
|
*/
|
|
250
|
-
readonly
|
|
311
|
+
readonly default?: React.ComponentType<{}> | undefined;
|
|
251
312
|
|
|
252
313
|
/**
|
|
253
|
-
*
|
|
314
|
+
* オブジェクトの文字列表現をカスタマイズするための組み込みタグプロパティーです。
|
|
315
|
+
*
|
|
316
|
+
* モジュールオブジェクトとしての識別に使用します。
|
|
254
317
|
*/
|
|
255
|
-
|
|
318
|
+
get [Symbol.toStringTag](): string;
|
|
256
319
|
};
|
|
257
320
|
|
|
258
321
|
/**
|
|
259
|
-
*
|
|
322
|
+
* アプリケーションのルーティング設定を定義するためのオブジェクトの型定義です。
|
|
260
323
|
*
|
|
261
|
-
* @template TPath
|
|
324
|
+
* @template TPath ルートに関連付けるパス文字列リテラル型です。
|
|
262
325
|
*/
|
|
263
|
-
export type RouteDefinition<TPath extends string = string> =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
*/
|
|
267
|
-
readonly path: TPath;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* このルートで使用するデータ操作関数の配列です。
|
|
271
|
-
*/
|
|
272
|
-
readonly dataFunctions?: readonly DataFunctionObject<TPath>[] | undefined;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* このルートで描画される React コンポーネントです。
|
|
276
|
-
*/
|
|
277
|
-
readonly component?: React.ComponentType<{}> | undefined;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* 子ルートの定義リストです。
|
|
281
|
-
*/
|
|
282
|
-
readonly children?: readonly RouteDefinition[] | undefined;
|
|
283
|
-
};
|
|
326
|
+
export type RouteDefinition<TPath extends string = string> =
|
|
327
|
+
| RouteDefinitionObject<TPath>
|
|
328
|
+
| RouteDefinitionModule<TPath>;
|
|
284
329
|
|
|
285
330
|
/**
|
|
286
|
-
*
|
|
331
|
+
* `RouteDefinition` を基にシステム内部で解析・コンパイルされ、ルーティングエンジンが直接処理を行うための実体化されたルートオブジェクトの型定義です。
|
|
332
|
+
*
|
|
333
|
+
* 省略可能だったプロパティーが正規化され、正規表現によるマッチング機構が追加されています。
|
|
287
334
|
*/
|
|
288
335
|
export type Route = {
|
|
289
336
|
/**
|
|
290
|
-
*
|
|
337
|
+
* マッチングの対象となる URL パスのパターン文字列です。
|
|
291
338
|
*/
|
|
292
339
|
readonly path: string;
|
|
293
340
|
|
|
294
341
|
/**
|
|
295
|
-
*
|
|
342
|
+
* インデックスルートであるかどうかの確定的なフラグです。
|
|
296
343
|
*/
|
|
297
344
|
readonly index: boolean;
|
|
298
345
|
|
|
299
346
|
/**
|
|
300
|
-
*
|
|
347
|
+
* 実際の URL パスがこのルートに合致するかを検証するために動的に生成された正規表現オブジェクトです。
|
|
301
348
|
*/
|
|
302
349
|
readonly pathPattern: RegExp;
|
|
303
350
|
|
|
304
351
|
/**
|
|
305
|
-
*
|
|
352
|
+
* パスパターン内に含まれるパラメーターのキー名を、順番通りに格納した読み取り専用の配列です。
|
|
306
353
|
*/
|
|
307
354
|
readonly paramKeys: readonly string[];
|
|
308
355
|
|
|
309
356
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* デフォルトの判定関数などが補完された状態で保持されます。
|
|
357
|
+
* データ更新用のアクション関数です。未定義の場合は `undefined` となります。
|
|
313
358
|
*/
|
|
314
|
-
readonly
|
|
315
|
-
/**
|
|
316
|
-
* アクションの実行可否を判定します。
|
|
317
|
-
*
|
|
318
|
-
* @param args 判定に必要なパラメーターとリクエスト情報です。
|
|
319
|
-
* @returns アクションを実行する場合は `true`、そうでない場合は `false` を返すはずです。
|
|
320
|
-
*/
|
|
321
|
-
readonly shouldAction: (args: ShouldActionArgs) => unknown;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* データの更新などを行うオプションのアクション関数です。
|
|
325
|
-
*/
|
|
326
|
-
readonly action: IAction | undefined;
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* 再読み込みの要否を判定します。
|
|
330
|
-
*
|
|
331
|
-
* @param args 遷移先後やアクションの結果を含む判定用データです。
|
|
332
|
-
* @returns 再読み込みを行う場合は `true`、そうでない場合は `false` を返すはずです。
|
|
333
|
-
*/
|
|
334
|
-
readonly shouldReload: (args: ShouldReloadArgs) => unknown;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* データを取得するオプションのローダー関数です。
|
|
338
|
-
*/
|
|
339
|
-
readonly loader: ILoader | undefined;
|
|
340
|
-
}[];
|
|
359
|
+
readonly action: ActionFunction | undefined;
|
|
341
360
|
|
|
342
361
|
/**
|
|
343
|
-
*
|
|
362
|
+
* データの再読み込み動作を制御する確定的な判定関数です。定義がない場合はシステム既定の挙動を行う関数が割り当てられます。
|
|
344
363
|
*/
|
|
345
|
-
readonly
|
|
364
|
+
readonly shouldReload: ShouldReloadFunction;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 画面描画に必要なデータを取得する関数です。未定義の場合は `undefined` となります。
|
|
368
|
+
*/
|
|
369
|
+
readonly loader: LoaderFunction | undefined;
|
|
346
370
|
|
|
347
371
|
/**
|
|
348
|
-
*
|
|
372
|
+
* 表示対象となる React のコンポーネントです。未定義の場合は `undefined` となります。
|
|
349
373
|
*/
|
|
350
|
-
readonly
|
|
374
|
+
readonly component: React.ComponentType<{}> | undefined;
|
|
351
375
|
};
|