soseki 0.0.4 → 0.0.6
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 +48 -30
- 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
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import actionIdRegistry from "./_action-id-registry.js";
|
|
2
|
-
import unreachable from "./_unreachable.js";
|
|
3
|
-
import { ACTION_ID_FORM_DATA_NAME } from "./constants.js";
|
|
4
|
-
import type { IDataMap } from "./data-map.types.js";
|
|
5
|
-
import type { IDataStore } from "./data-store.types.js";
|
|
6
|
-
import DeferredPromise from "./deferred-promise.js";
|
|
7
|
-
import { ActionConditionError, ActionExecutionError, MultipleRedirectError } from "./errors.js";
|
|
8
|
-
import type { HistoryEntry } from "./expect-history-entry.js";
|
|
9
|
-
import type { MatchedRoute } from "./match-routes.js";
|
|
10
|
-
import type { ReadonlyFormData } from "./readonly-form-data.types.js";
|
|
11
|
-
import RedirectResponse from "./redirect-response.js";
|
|
12
|
-
import RouteRequest from "./route-request.js";
|
|
13
|
-
import type { IAction } from "./route.types.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* アクションの開始に使用するパラメーターの型定義です。
|
|
17
|
-
*/
|
|
18
|
-
export type StartActionsParams = {
|
|
19
|
-
/**
|
|
20
|
-
* マッチしたルート情報のリストです。パラメーターとデータ関数を含みます。
|
|
21
|
-
*/
|
|
22
|
-
readonly routes: readonly Pick<MatchedRoute, "params" | "urlPath" | "dataFuncs">[];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 履歴エントリーの情報です。 ID と URL を含みます。
|
|
26
|
-
*/
|
|
27
|
-
readonly entry: Pick<HistoryEntry, "id" | "url">;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* フォームから送信された読み取り専用のデータです。
|
|
31
|
-
*/
|
|
32
|
-
readonly formData: ReadonlyFormData;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* アクションの結果を保持するためのデータストアです。
|
|
36
|
-
*/
|
|
37
|
-
readonly dataStore: IDataStore<IAction>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 非同期処理を中断するためのシグナルです。
|
|
41
|
-
*/
|
|
42
|
-
readonly signal: AbortSignal;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* アクションの実行結果を表す型定義です。
|
|
47
|
-
*/
|
|
48
|
-
export type ActionsResult = {
|
|
49
|
-
/**
|
|
50
|
-
* リダイレクトが必要な場合のパス名です。リダイレクトが発生しない場合は undefined となります。
|
|
51
|
-
*/
|
|
52
|
-
redirect: string | undefined;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 各アクションと実行結果を紐付けたマップです。
|
|
56
|
-
*/
|
|
57
|
-
resultMap: ReadonlyMap<IAction, unknown>;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* ルートに定義されたアクションの実行を開始します。
|
|
62
|
-
*
|
|
63
|
-
* 条件に合致するアクションが存在する場合、それらを待機するための非同期関数を返します。
|
|
64
|
-
*
|
|
65
|
-
* @param params アクションの開始に必要なパラメーターオブジェクトです。
|
|
66
|
-
* @returns アクションの完了を待機するための関数です。実行すべきアクションがない場合は undefined を返します。
|
|
67
|
-
*/
|
|
68
|
-
export default function startActions(params: StartActionsParams): undefined | {
|
|
69
|
-
/**
|
|
70
|
-
* アクションの完了を待機し、結果を集約して返す非同期関数です。
|
|
71
|
-
*
|
|
72
|
-
* @returns アクションの結果(リダイレクト先や実行結果のマップ)を返します。
|
|
73
|
-
*/
|
|
74
|
-
(): Promise<ActionsResult>;
|
|
75
|
-
} {
|
|
76
|
-
const {
|
|
77
|
-
entry,
|
|
78
|
-
routes,
|
|
79
|
-
signal,
|
|
80
|
-
formData,
|
|
81
|
-
dataStore,
|
|
82
|
-
} = params;
|
|
83
|
-
const request = new RouteRequest("POST", entry.url, signal, formData);
|
|
84
|
-
const redirects: string[] = [];
|
|
85
|
-
const dataIncMap: IDataMap<IAction> = new Map();
|
|
86
|
-
let encountered = false;
|
|
87
|
-
// ルートを走査し、実行すべきアクションを特定します。
|
|
88
|
-
for (const route of routes) {
|
|
89
|
-
for (const { action, shouldAction } of route.dataFuncs) {
|
|
90
|
-
if (!action) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// アクションを持つルートが見つかったため、フラグを立てます。
|
|
95
|
-
encountered = true;
|
|
96
|
-
|
|
97
|
-
// アクションを実行すべきかどうかを判定します。
|
|
98
|
-
const should = DeferredPromise.try(function executeShouldAction() {
|
|
99
|
-
return shouldAction({
|
|
100
|
-
params: route.params,
|
|
101
|
-
request,
|
|
102
|
-
defaultShouldAction: formData.has(ACTION_ID_FORM_DATA_NAME)
|
|
103
|
-
? formData.get(ACTION_ID_FORM_DATA_NAME) === actionIdRegistry.get(action)
|
|
104
|
-
: true,
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
let data: DeferredPromise<unknown>;
|
|
109
|
-
switch (should.status) {
|
|
110
|
-
case "pending": {
|
|
111
|
-
// shouldAction は同期的に真偽値を返す必要があるので、pending 状態(つまり非同期)であってはいけません。
|
|
112
|
-
const error = new ActionConditionError(request.url.href, shouldAction, should);
|
|
113
|
-
// エラーハンドリングは、このアクションデータを参照するコンポーネントに任せます。
|
|
114
|
-
data = DeferredPromise.reject(error);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
case "rejected":
|
|
119
|
-
// エラーハンドリングは、このアクションデータを参照するコンポーネントに任せます。
|
|
120
|
-
data = should;
|
|
121
|
-
break;
|
|
122
|
-
|
|
123
|
-
case "fulfilled": {
|
|
124
|
-
const { value } = should;
|
|
125
|
-
switch (value) {
|
|
126
|
-
case true: {
|
|
127
|
-
// 条件を満たす場合のみ、アクションの実行をスケジュールします。
|
|
128
|
-
const clientData = DeferredPromise.try(function executeAction() {
|
|
129
|
-
return action({
|
|
130
|
-
params: route.params,
|
|
131
|
-
request,
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
switch (clientData.status) {
|
|
135
|
-
case "pending": {
|
|
136
|
-
// 特定の返り値を別の値に入れ替えるために中継 DeferredPromise をアクションデータとします。
|
|
137
|
-
const proxy = DeferredPromise.withResolvers();
|
|
138
|
-
data = proxy.promise;
|
|
139
|
-
(async () => {
|
|
140
|
-
try {
|
|
141
|
-
const value = await clientData;
|
|
142
|
-
switch (true) {
|
|
143
|
-
case value instanceof RedirectResponse:
|
|
144
|
-
// リダイレクトを指示する返り値を記録し、コンポーネントが参照するデータを undefined に置き換えます。
|
|
145
|
-
redirects.push(value.pathname);
|
|
146
|
-
proxy.resolve(undefined);
|
|
147
|
-
break;
|
|
148
|
-
|
|
149
|
-
default:
|
|
150
|
-
proxy.resolve(value);
|
|
151
|
-
}
|
|
152
|
-
} catch (ex) {
|
|
153
|
-
proxy.reject(ex);
|
|
154
|
-
}
|
|
155
|
-
})();
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
case "rejected":
|
|
160
|
-
// エラーハンドリングは、このアクションデータを参照するコンポーネントに任せます。
|
|
161
|
-
data = clientData;
|
|
162
|
-
break;
|
|
163
|
-
|
|
164
|
-
case "fulfilled": {
|
|
165
|
-
const { value } = clientData;
|
|
166
|
-
switch (true) {
|
|
167
|
-
case value instanceof RedirectResponse:
|
|
168
|
-
// リダイレクトを指示する返り値を記録し、コンポーネントが参照するデータを undefined に置き換えます。
|
|
169
|
-
redirects.push(value.pathname);
|
|
170
|
-
data = DeferredPromise.resolve(undefined);
|
|
171
|
-
break;
|
|
172
|
-
|
|
173
|
-
default:
|
|
174
|
-
data = clientData;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
default:
|
|
181
|
-
unreachable(clientData);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
case false:
|
|
188
|
-
// 条件を満たさない場合はアクションの実行をスキップします。
|
|
189
|
-
continue;
|
|
190
|
-
|
|
191
|
-
default: {
|
|
192
|
-
// shouldAction が真偽値を返さなかった場合、エラーとします。
|
|
193
|
-
const error = new ActionConditionError(request.url.href, shouldAction, value);
|
|
194
|
-
// エラーハンドリングは、このアクションデータを参照するコンポーネントに任せます。
|
|
195
|
-
data = DeferredPromise.reject(error);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
default:
|
|
203
|
-
unreachable(should);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
dataIncMap.set(action, data);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// アクションを持つルートが見つかった時点で走査を終了します。
|
|
210
|
-
if (encountered) {
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (!encountered) {
|
|
216
|
-
// 実行されたアクションが無い場合は、これ以上することは何もありません。
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (dataIncMap.size <= 0) {
|
|
221
|
-
return async () => ({
|
|
222
|
-
redirect: undefined,
|
|
223
|
-
resultMap: new Map(),
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// 特定されたアクションのマップをデータストアに格納します。
|
|
228
|
-
const dataMap = dataStore.get(entry.id);
|
|
229
|
-
if (dataMap) {
|
|
230
|
-
for (const [action, data] of dataIncMap) {
|
|
231
|
-
dataMap.set(action, data);
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
dataStore.set(entry.id, dataIncMap);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return async function waitForActionsComplete() {
|
|
238
|
-
const resultMap: IDataMap<IAction, unknown> = new Map();
|
|
239
|
-
const promises: Promise<void>[] = [];
|
|
240
|
-
const rejected: { action: IAction; reason: unknown }[] = [];
|
|
241
|
-
for (const [action, data] of dataIncMap) {
|
|
242
|
-
const promise = (async () => {
|
|
243
|
-
try {
|
|
244
|
-
const value = await data;
|
|
245
|
-
resultMap.set(action, value);
|
|
246
|
-
} catch (ex) {
|
|
247
|
-
rejected.push({
|
|
248
|
-
action,
|
|
249
|
-
reason: ex,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
})();
|
|
253
|
-
promises.push(promise);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// すべてのアクションの完了を待ちます。
|
|
257
|
-
await Promise.all(promises);
|
|
258
|
-
|
|
259
|
-
// エラーが発生したアクションがある場合は例外を投げます。
|
|
260
|
-
if (rejected.length > 0) {
|
|
261
|
-
throw new ActionExecutionError(request.url.href, rejected);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// 複数のアクションからリダイレクトが返された場合は不正な状態としてエラーを投げます。
|
|
265
|
-
if (redirects.length > 1) {
|
|
266
|
-
throw new MultipleRedirectError(request.url.href, redirects);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return {
|
|
270
|
-
redirect: redirects[0],
|
|
271
|
-
resultMap,
|
|
272
|
-
};
|
|
273
|
-
};
|
|
274
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import RouteContext, { type RouteContextValue } from "../contexts/route-context.js";
|
|
3
|
-
import { RouteContextMissingError } from "../core/errors.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ルートに関するコンテキスト情報を取得するためのカスタムフックです。
|
|
7
|
-
*
|
|
8
|
-
* `RouteContext` から現在のコンテキスト値を抽出し、コンテキストが提供されていない場合にはエラーを投げます。
|
|
9
|
-
*
|
|
10
|
-
* @returns 現在のルートコンテキストの値を返します。
|
|
11
|
-
*/
|
|
12
|
-
export default function useRouteContext(): RouteContextValue {
|
|
13
|
-
const routeContext = React.use(RouteContext);
|
|
14
|
-
if (!routeContext) {
|
|
15
|
-
throw new RouteContextMissingError();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return routeContext;
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import RouterContext, { type RouterRef } from "../contexts/router-context.js";
|
|
3
|
-
import { RouterContextMissingError } from "../core/errors.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ルーターのコンテキストから特定の状態を抽出して取得するためのカスタムフックです。
|
|
7
|
-
*
|
|
8
|
-
* @template TSlice 抽出される状態の型です。
|
|
9
|
-
* @param selector ルーターの参照から必要なデータを抽出するためのセレクター関数です。
|
|
10
|
-
* @returns セレクターによって抽出された状態を返します。
|
|
11
|
-
*/
|
|
12
|
-
export default function useRouterContext<TSlice>(
|
|
13
|
-
selector: (router: RouterRef["current"]) => TSlice,
|
|
14
|
-
): TSlice {
|
|
15
|
-
const routerContext = React.use(RouterContext);
|
|
16
|
-
if (!routerContext) {
|
|
17
|
-
throw new RouterContextMissingError();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
routerRef,
|
|
22
|
-
subscribe,
|
|
23
|
-
} = routerContext;
|
|
24
|
-
return React.useSyncExternalStore(subscribe, () => selector(routerRef.current));
|
|
25
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import useRouterContext from "./_use-router-context.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 現在のルートにおける URL のパスネームを取得するためのカスタムフックです。
|
|
5
|
-
*
|
|
6
|
-
* @returns 現在のルートにおけるパスネームを表す文字列を返します。
|
|
7
|
-
*/
|
|
8
|
-
export default function usePathname(): string {
|
|
9
|
-
return useRouterContext(router => router.currentEntry.url.pathname);
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ACTION_ID_FORM_DATA_NAME } from "../core/constants.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* フォームデータからアクション ID を取得します。
|
|
5
|
-
*
|
|
6
|
-
* @param formData 取得対象のフォームデータです。
|
|
7
|
-
* @returns 取得したアクション ID を返します。文字列でない場合や存在しない場合は null を返します。
|
|
8
|
-
*/
|
|
9
|
-
export default function getActionId(formData: FormData): string | null {
|
|
10
|
-
const id = formData.get(ACTION_ID_FORM_DATA_NAME);
|
|
11
|
-
return typeof id === "string" ? id : null;
|
|
12
|
-
}
|
package/src/utils/href.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { inject, type RouteParams } from "regexparam";
|
|
2
|
-
import type { PathParams } from "../core/route.types.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 指定されたパスのテンプレートにパラメーターを注入し、完全な URL パスを生成します。
|
|
6
|
-
*
|
|
7
|
-
* @template TPath パスのテンプレート文字列の型です。
|
|
8
|
-
* @param path パスのテンプレート文字列です(例: `/users/:id`)。
|
|
9
|
-
* @param params パスに注入するパラメーターのオブジェクトです。
|
|
10
|
-
* @returns パラメーターが注入された後の文字列を返します。
|
|
11
|
-
*/
|
|
12
|
-
export default function href<const TPath extends string>(
|
|
13
|
-
path: TPath,
|
|
14
|
-
params: PathParams<TPath>,
|
|
15
|
-
): string {
|
|
16
|
-
return inject(path, params as RouteParams<TPath>);
|
|
17
|
-
}
|
package/src/utils/route-index.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { DataFunctionObject, RouteDefinition } from "../core/route.types.js";
|
|
2
|
-
import route, { type RouteEntryModule, type RouteModule } from "./route-route.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* インデックスルートの定義を構成するモジュールの型定義です。
|
|
6
|
-
*
|
|
7
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
8
|
-
*/
|
|
9
|
-
export type IndexRouteModule<TPath extends string = string> = RouteModule<TPath>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* インデックスルートの起点となるエントリーモジュールの型定義です。
|
|
13
|
-
*
|
|
14
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
15
|
-
*/
|
|
16
|
-
export type IndexRouteEntryModule<TPath extends string = string> = RouteEntryModule<TPath>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 複数のモジュール配列からインデックスルート定義を生成するオーバーロードです。
|
|
20
|
-
*
|
|
21
|
-
* @template TPath ルートのパスの型です。
|
|
22
|
-
* @param mods エントリーモジュールと追加のデータ操作関数の配列です。
|
|
23
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
24
|
-
*/
|
|
25
|
-
function index<const TPath extends string = string>(
|
|
26
|
-
mods: readonly [entry: IndexRouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]],
|
|
27
|
-
): RouteDefinition<TPath>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 単一のルートモジュールからインデックスルート定義を生成するオーバーロードです。
|
|
31
|
-
*
|
|
32
|
-
* @template TPath ルートのパスの型です。
|
|
33
|
-
* @param mod ルートモジュールオブジェクトです。
|
|
34
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
35
|
-
*/
|
|
36
|
-
function index<const TPath extends string = string>(
|
|
37
|
-
mod: IndexRouteModule<TPath>,
|
|
38
|
-
): RouteDefinition<TPath>;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* インデックスルートモジュールまたはモジュール配列を受け取り、インデックスルート定義を生成します。
|
|
42
|
-
*
|
|
43
|
-
* @template TPath ルートのパスの型です。
|
|
44
|
-
* @param modOrMods ルートモジュールまたはエントリーモジュールを含む配列です。
|
|
45
|
-
* @param children 子ルートの配列です(インデックスルートでは通常使用されません)。
|
|
46
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
47
|
-
*/
|
|
48
|
-
function index<const TPath extends string = string>(
|
|
49
|
-
modOrMods:
|
|
50
|
-
| IndexRouteModule<TPath>
|
|
51
|
-
| readonly [entry: IndexRouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]],
|
|
52
|
-
children: readonly RouteDefinition[],
|
|
53
|
-
): RouteDefinition<TPath>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* インデックスルート定義を構築する関数の実体です。
|
|
57
|
-
* `route` 関数を利用して定義を生成し、`children` を明示的に `undefined` に設定します。
|
|
58
|
-
*/
|
|
59
|
-
function index(
|
|
60
|
-
arg0:
|
|
61
|
-
| IndexRouteModule
|
|
62
|
-
| readonly [entry: IndexRouteEntryModule, ...ui: DataFunctionObject[]],
|
|
63
|
-
): RouteDefinition {
|
|
64
|
-
// route 関数でベースとなる定義を生成した後、子ルートを持たないように上書きします。
|
|
65
|
-
return Object.assign(route(arg0, []), {
|
|
66
|
-
children: undefined,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default index;
|
package/src/utils/route-route.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type { DataFunctionObject, RouteDefinition } from "../core/route.types.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ルートの定義を構成するモジュールの型定義です。
|
|
5
|
-
*
|
|
6
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
7
|
-
*/
|
|
8
|
-
export type RouteModule<TPath extends string = string> = DataFunctionObject<TPath> & {
|
|
9
|
-
/**
|
|
10
|
-
* ルートのパス(パスパターン)です。
|
|
11
|
-
*/
|
|
12
|
-
readonly path: TPath;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* このルートで描画される React コンポーネントです。
|
|
16
|
-
*/
|
|
17
|
-
readonly default?: React.ComponentType<{}> | undefined;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* ルートの起点となるエントリーモジュールの型定義です。
|
|
22
|
-
*
|
|
23
|
-
* データ操作関数の定義を直接含みます。
|
|
24
|
-
*
|
|
25
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
26
|
-
*/
|
|
27
|
-
export type RouteEntryModule<TPath extends string = string> = DataFunctionObject<TPath> & {
|
|
28
|
-
/**
|
|
29
|
-
* ルートのパス(パスパターン)です。
|
|
30
|
-
*/
|
|
31
|
-
readonly path: TPath;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* このルートで描画される React コンポーネントです。
|
|
35
|
-
*/
|
|
36
|
-
readonly default?: React.ComponentType<{}> | undefined;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 複数のモジュール配列からルート定義を生成するオーバーロードです。
|
|
41
|
-
*
|
|
42
|
-
* @template TPath ルートのパスの型です。
|
|
43
|
-
* @param mods エントリーモジュールと追加のデータ操作関数の配列です。
|
|
44
|
-
* @param children 子ルートの配列です。
|
|
45
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
46
|
-
*/
|
|
47
|
-
function route<const TPath extends string = string>(
|
|
48
|
-
mods: readonly [entry: RouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]],
|
|
49
|
-
children: readonly RouteDefinition[],
|
|
50
|
-
): RouteDefinition<TPath>;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 単一のルートモジュールからルート定義を生成するオーバーロードです。
|
|
54
|
-
*
|
|
55
|
-
* @template TPath ルートのパスの型です。
|
|
56
|
-
* @param mod ルートモジュールオブジェクトです。
|
|
57
|
-
* @param children 子ルートの配列です。
|
|
58
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
59
|
-
*/
|
|
60
|
-
function route<const TPath extends string = string>(
|
|
61
|
-
mod: RouteModule<TPath>,
|
|
62
|
-
children: readonly RouteDefinition[],
|
|
63
|
-
): RouteDefinition<TPath>;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* ルートモジュールまたはモジュール配列を受け取り、ルート定義を生成します。
|
|
67
|
-
*
|
|
68
|
-
* @template TPath ルートのパスの型です。
|
|
69
|
-
* @param modOrMods ルートモジュールまたはエントリーモジュールを含む配列です。
|
|
70
|
-
* @param children 子ルートの配列です。
|
|
71
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
72
|
-
*/
|
|
73
|
-
function route<const TPath extends string = string>(
|
|
74
|
-
modOrMods:
|
|
75
|
-
| RouteModule<TPath>
|
|
76
|
-
| readonly [entry: RouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]],
|
|
77
|
-
children: readonly RouteDefinition[],
|
|
78
|
-
): RouteDefinition<TPath>;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* ルート定義を構築する関数の実体です。
|
|
82
|
-
*/
|
|
83
|
-
function route(
|
|
84
|
-
modOrMods:
|
|
85
|
-
| RouteModule
|
|
86
|
-
| readonly [entry: RouteEntryModule, ...ui: DataFunctionObject[]],
|
|
87
|
-
children: readonly RouteDefinition[],
|
|
88
|
-
): RouteDefinition {
|
|
89
|
-
// 配列形式で渡された場合の処理です。
|
|
90
|
-
if (Array.isArray(modOrMods)) {
|
|
91
|
-
const mods = modOrMods;
|
|
92
|
-
const [entry, ...ui] = mods;
|
|
93
|
-
return {
|
|
94
|
-
path: entry.path,
|
|
95
|
-
children,
|
|
96
|
-
component: entry.default,
|
|
97
|
-
dataFunctions: [entry, ...ui],
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// オブジェクト形式で渡された場合の処理です。
|
|
102
|
-
const mod = modOrMods;
|
|
103
|
-
return {
|
|
104
|
-
path: mod.path,
|
|
105
|
-
children,
|
|
106
|
-
component: mod.default,
|
|
107
|
-
dataFunctions: [mod],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default route;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import actionIdRegistry from "../core/_action-id-registry.js";
|
|
2
|
-
import { ACTION_ID_FORM_DATA_NAME } from "../core/constants.js";
|
|
3
|
-
import type { IAction } from "../core/route.types.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* フォームデータに対してアクション ID を発行し、設定します。
|
|
7
|
-
*
|
|
8
|
-
* @param formData アクション ID を設定する対象のフォームデータです。
|
|
9
|
-
* @param action アクション関数です。
|
|
10
|
-
*/
|
|
11
|
-
export default function setActionId(formData: FormData, action: IAction): void {
|
|
12
|
-
const id = actionIdRegistry.set(action);
|
|
13
|
-
formData.set(ACTION_ID_FORM_DATA_NAME, id);
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|