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,66 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyFormData } from "../core/readonly-form-data.types.js";
|
|
2
|
-
import type { ReadonlyURLSearchParams } from "../core/readonly-url.types.js";
|
|
3
|
-
import type { IAction } from "../core/route.types.js";
|
|
4
|
-
/**
|
|
5
|
-
* GET メソッドによる送信時のオプションです。
|
|
6
|
-
*/
|
|
7
|
-
export type SubmitGetOptions = {
|
|
8
|
-
/**
|
|
9
|
-
* 送信先のパスです。
|
|
10
|
-
*/
|
|
11
|
-
readonly action?: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* 現在の履歴エントリーを置き換えるかどうかを指定します。
|
|
14
|
-
*/
|
|
15
|
-
readonly replace?: boolean | undefined;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* POST メソッドによる送信時のオプションです。
|
|
19
|
-
*/
|
|
20
|
-
export type SubmitPostOptions = {
|
|
21
|
-
/**
|
|
22
|
-
* 送信先のパスです。
|
|
23
|
-
*/
|
|
24
|
-
readonly action?: string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* 実行するアクションの定義です。
|
|
27
|
-
*/
|
|
28
|
-
readonly actionId?: IAction | undefined;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* 送信処理に使用するオプションの連合型です。
|
|
32
|
-
*/
|
|
33
|
-
export type SubmitOptions = SubmitGetOptions | SubmitPostOptions;
|
|
34
|
-
/**
|
|
35
|
-
* データを送信するための関数インターフェースです。
|
|
36
|
-
*/
|
|
37
|
-
export interface ISubmit {
|
|
38
|
-
/**
|
|
39
|
-
* フォーム データを送信します。
|
|
40
|
-
*
|
|
41
|
-
* @param target 送信対象のフォームデータです。
|
|
42
|
-
* @param options 送信時のオプションです。
|
|
43
|
-
*/
|
|
44
|
-
(target: ReadonlyFormData, options?: SubmitPostOptions | undefined): void;
|
|
45
|
-
/**
|
|
46
|
-
* URL クエリーパラメーターを送信します。
|
|
47
|
-
*
|
|
48
|
-
* @param target 送信対象の URL クエリーパラメーターです。
|
|
49
|
-
* @param options 送信時のオプションです。
|
|
50
|
-
*/
|
|
51
|
-
(target: ReadonlyURLSearchParams, options?: SubmitGetOptions | undefined): void;
|
|
52
|
-
/**
|
|
53
|
-
* フォーム データまたは URL クエリーパラメーターを送信します。
|
|
54
|
-
*
|
|
55
|
-
* @param target 送信対象のデータです。
|
|
56
|
-
* @param options 送信時のオプションです。
|
|
57
|
-
*/
|
|
58
|
-
(target: ReadonlyURLSearchParams | ReadonlyFormData, options?: SubmitOptions | undefined): void;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 命令的にデータを送信するための submit 関数を提供するフックです。
|
|
62
|
-
*
|
|
63
|
-
* @returns データを送信するための ISubmit 関数を返します。
|
|
64
|
-
*/
|
|
65
|
-
export default function useSubmit(): ISubmit;
|
|
66
|
-
//# sourceMappingURL=use-submit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-submit.d.ts","sourceRoot":"","sources":["../../src/hooks/use-submit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAItD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CAAC;IAE1E;;;;;OAKG;IACH,CAAC,MAAM,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAC;IAEhF;;;;;OAKG;IACH,CAAC,MAAM,EAAE,uBAAuB,GAAG,gBAAgB,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;CACjG;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,OAAO,CAkC3C"}
|
package/dist/hooks/use-submit.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import useRouterContext from "./_use-router-context.js";
|
|
3
|
-
import useFormAction from "./use-form-action.js";
|
|
4
|
-
/**
|
|
5
|
-
* 命令的にデータを送信するための submit 関数を提供するフックです。
|
|
6
|
-
*
|
|
7
|
-
* @returns データを送信するための ISubmit 関数を返します。
|
|
8
|
-
*/
|
|
9
|
-
export default function useSubmit() {
|
|
10
|
-
const formAction = useFormAction();
|
|
11
|
-
const call = useRouterContext(router => router.submit);
|
|
12
|
-
return React.useCallback(function submit(target, options = {}) {
|
|
13
|
-
if (target instanceof FormData) {
|
|
14
|
-
const { action = formAction, actionId, } = options;
|
|
15
|
-
return call({
|
|
16
|
-
target,
|
|
17
|
-
action,
|
|
18
|
-
actionId,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const { action = formAction, replace, } = options;
|
|
23
|
-
return call({
|
|
24
|
-
target: target,
|
|
25
|
-
action,
|
|
26
|
-
history: replace
|
|
27
|
-
? "replace"
|
|
28
|
-
: "push",
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}, [
|
|
32
|
-
call,
|
|
33
|
-
formAction,
|
|
34
|
-
]);
|
|
35
|
-
}
|
package/dist/soseki.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export type * from "./components/action-id.jsx";
|
|
2
|
-
export { default as ActionId } from "./components/action-id.jsx";
|
|
3
|
-
export type * from "./components/browser-router.jsx";
|
|
4
|
-
export { default as BrowserRouter } from "./components/browser-router.jsx";
|
|
5
|
-
export type * from "./components/hidden-input.jsx";
|
|
6
|
-
export { default as HiddenInput } from "./components/hidden-input.jsx";
|
|
7
|
-
export type * from "./components/outlet.jsx";
|
|
8
|
-
export { default as Outlet } from "./components/outlet.jsx";
|
|
9
|
-
export type * from "./core/deferred-promise.js";
|
|
10
|
-
export { default as DeferredPromise } from "./core/deferred-promise.js";
|
|
11
|
-
export type { ErrorMeta, ErrorOptions, ISosekiErrorConstructor, Issue } from "./core/errors.js";
|
|
12
|
-
export { ActionConditionError, ActionExecutionError, ErrorBase, LoaderConditionError, MultipleRedirectError, NavigationApiNotSupportedError, RouteContextMissingError, RouterContextMissingError, setErrorMessage, UnexpectedValidationError, UnreachableError, ValidationErrorBase, } from "./core/errors.js";
|
|
13
|
-
export type * from "./core/readonly-form-data.types.js";
|
|
14
|
-
export type * from "./core/readonly-url.types.js";
|
|
15
|
-
export type * from "./core/route-request.js";
|
|
16
|
-
export { default as RouteRequest } from "./core/route-request.js";
|
|
17
|
-
export type * from "./core/route.types.js";
|
|
18
|
-
export type * from "./hooks/use-action-data.js";
|
|
19
|
-
export { default as useActionData } from "./hooks/use-action-data.js";
|
|
20
|
-
export type * from "./hooks/use-loader-data.js";
|
|
21
|
-
export { default as useLoaderData } from "./hooks/use-loader-data.js";
|
|
22
|
-
export type * from "./hooks/use-navigate.js";
|
|
23
|
-
export { default as useNavigate } from "./hooks/use-navigate.js";
|
|
24
|
-
export type * from "./hooks/use-params.js";
|
|
25
|
-
export { default as useParams } from "./hooks/use-params.js";
|
|
26
|
-
export type * from "./hooks/use-pathname.js";
|
|
27
|
-
export { default as usePathname } from "./hooks/use-pathname.js";
|
|
28
|
-
export type * from "./hooks/use-submit.js";
|
|
29
|
-
export { default as useSubmit } from "./hooks/use-submit.js";
|
|
30
|
-
export type * from "./utils/get-action-id.js";
|
|
31
|
-
export { default as getActionId } from "./utils/get-action-id.js";
|
|
32
|
-
export type * from "./utils/href.js";
|
|
33
|
-
export { default as href } from "./utils/href.js";
|
|
34
|
-
export type * from "./utils/redirect.js";
|
|
35
|
-
export { default as redirect } from "./utils/redirect.js";
|
|
36
|
-
export type * from "./utils/route-index.js";
|
|
37
|
-
export { default as index } from "./utils/route-index.js";
|
|
38
|
-
export type * from "./utils/route-route.js";
|
|
39
|
-
export { default as route } from "./utils/route-route.js";
|
|
40
|
-
export type * from "./utils/set-action-id.js";
|
|
41
|
-
export { default as setActionId } from "./utils/set-action-id.js";
|
|
42
|
-
//# sourceMappingURL=soseki.d.ts.map
|
package/dist/soseki.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"soseki.d.ts","sourceRoot":"","sources":["../src/soseki.ts"],"names":[],"mappings":"AAAA,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEjE,mBAAmB,iCAAiC,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE3E,mBAAmB,+BAA+B,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEvE,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE5D,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAExE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,mBAAmB,oCAAoC,CAAC;AAExD,mBAAmB,8BAA8B,CAAC;AAElD,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAElE,mBAAmB,uBAAuB,CAAC;AAE3C,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEtE,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEtE,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEjE,mBAAmB,uBAAuB,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE7D,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEjE,mBAAmB,uBAAuB,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE7D,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAElE,mBAAmB,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAElD,mBAAmB,qBAAqB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE1D,mBAAmB,wBAAwB,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE1D,mBAAmB,wBAAwB,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE1D,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/soseki.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { default as ActionId } from "./components/action-id.jsx";
|
|
2
|
-
export { default as BrowserRouter } from "./components/browser-router.jsx";
|
|
3
|
-
export { default as HiddenInput } from "./components/hidden-input.jsx";
|
|
4
|
-
export { default as Outlet } from "./components/outlet.jsx";
|
|
5
|
-
export { default as DeferredPromise } from "./core/deferred-promise.js";
|
|
6
|
-
export { ActionConditionError, ActionExecutionError, ErrorBase, LoaderConditionError, MultipleRedirectError, NavigationApiNotSupportedError, RouteContextMissingError, RouterContextMissingError, setErrorMessage, UnexpectedValidationError, UnreachableError, ValidationErrorBase, } from "./core/errors.js";
|
|
7
|
-
export { default as RouteRequest } from "./core/route-request.js";
|
|
8
|
-
export { default as useActionData } from "./hooks/use-action-data.js";
|
|
9
|
-
export { default as useLoaderData } from "./hooks/use-loader-data.js";
|
|
10
|
-
export { default as useNavigate } from "./hooks/use-navigate.js";
|
|
11
|
-
export { default as useParams } from "./hooks/use-params.js";
|
|
12
|
-
export { default as usePathname } from "./hooks/use-pathname.js";
|
|
13
|
-
export { default as useSubmit } from "./hooks/use-submit.js";
|
|
14
|
-
export { default as getActionId } from "./utils/get-action-id.js";
|
|
15
|
-
export { default as href } from "./utils/href.js";
|
|
16
|
-
export { default as redirect } from "./utils/redirect.js";
|
|
17
|
-
export { default as index } from "./utils/route-index.js";
|
|
18
|
-
export { default as route } from "./utils/route-route.js";
|
|
19
|
-
export { default as setActionId } from "./utils/set-action-id.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-action-id.d.ts","sourceRoot":"","sources":["../../src/utils/get-action-id.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAGrE"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ACTION_ID_FORM_DATA_NAME } from "../core/constants.js";
|
|
2
|
-
/**
|
|
3
|
-
* フォームデータからアクション ID を取得します。
|
|
4
|
-
*
|
|
5
|
-
* @param formData 取得対象のフォームデータです。
|
|
6
|
-
* @returns 取得したアクション ID を返します。文字列でない場合や存在しない場合は null を返します。
|
|
7
|
-
*/
|
|
8
|
-
export default function getActionId(formData) {
|
|
9
|
-
const id = formData.get(ACTION_ID_FORM_DATA_NAME);
|
|
10
|
-
return typeof id === "string" ? id : null;
|
|
11
|
-
}
|
package/dist/utils/href.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PathParams } from "../core/route.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* 指定されたパスのテンプレートにパラメーターを注入し、完全な URL パスを生成します。
|
|
4
|
-
*
|
|
5
|
-
* @template TPath パスのテンプレート文字列の型です。
|
|
6
|
-
* @param path パスのテンプレート文字列です(例: `/users/:id`)。
|
|
7
|
-
* @param params パスに注入するパラメーターのオブジェクトです。
|
|
8
|
-
* @returns パラメーターが注入された後の文字列を返します。
|
|
9
|
-
*/
|
|
10
|
-
export default function href<const TPath extends string>(path: TPath, params: PathParams<TPath>): string;
|
|
11
|
-
//# sourceMappingURL=href.d.ts.map
|
package/dist/utils/href.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../../src/utils/href.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,EACrD,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,GACxB,MAAM,CAER"}
|
package/dist/utils/href.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { inject } from "regexparam";
|
|
2
|
-
/**
|
|
3
|
-
* 指定されたパスのテンプレートにパラメーターを注入し、完全な URL パスを生成します。
|
|
4
|
-
*
|
|
5
|
-
* @template TPath パスのテンプレート文字列の型です。
|
|
6
|
-
* @param path パスのテンプレート文字列です(例: `/users/:id`)。
|
|
7
|
-
* @param params パスに注入するパラメーターのオブジェクトです。
|
|
8
|
-
* @returns パラメーターが注入された後の文字列を返します。
|
|
9
|
-
*/
|
|
10
|
-
export default function href(path, params) {
|
|
11
|
-
return inject(path, params);
|
|
12
|
-
}
|
package/dist/utils/redirect.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import RedirectResponse from "../core/redirect-response.js";
|
|
2
|
-
/**
|
|
3
|
-
* 指定されたパスネームへのリダイレクトを表すレスポンスオブジェクトを生成します。
|
|
4
|
-
*
|
|
5
|
-
* アクションの中で、別のページへ遷移させるために使用されます。
|
|
6
|
-
*
|
|
7
|
-
* @param pathname リダイレクト先のパスネームです。
|
|
8
|
-
* @returns 生成された `RedirectResponse` オブジェクトを返します。
|
|
9
|
-
*/
|
|
10
|
-
export default function redirect(pathname: string): RedirectResponse;
|
|
11
|
-
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/utils/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAEnE"}
|
package/dist/utils/redirect.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import RedirectResponse from "../core/redirect-response.js";
|
|
2
|
-
/**
|
|
3
|
-
* 指定されたパスネームへのリダイレクトを表すレスポンスオブジェクトを生成します。
|
|
4
|
-
*
|
|
5
|
-
* アクションの中で、別のページへ遷移させるために使用されます。
|
|
6
|
-
*
|
|
7
|
-
* @param pathname リダイレクト先のパスネームです。
|
|
8
|
-
* @returns 生成された `RedirectResponse` オブジェクトを返します。
|
|
9
|
-
*/
|
|
10
|
-
export default function redirect(pathname) {
|
|
11
|
-
return new RedirectResponse(pathname);
|
|
12
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { DataFunctionObject, RouteDefinition } from "../core/route.types.js";
|
|
2
|
-
import { type RouteEntryModule, type RouteModule } from "./route-route.js";
|
|
3
|
-
/**
|
|
4
|
-
* インデックスルートの定義を構成するモジュールの型定義です。
|
|
5
|
-
*
|
|
6
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
7
|
-
*/
|
|
8
|
-
export type IndexRouteModule<TPath extends string = string> = RouteModule<TPath>;
|
|
9
|
-
/**
|
|
10
|
-
* インデックスルートの起点となるエントリーモジュールの型定義です。
|
|
11
|
-
*
|
|
12
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
13
|
-
*/
|
|
14
|
-
export type IndexRouteEntryModule<TPath extends string = string> = RouteEntryModule<TPath>;
|
|
15
|
-
/**
|
|
16
|
-
* 複数のモジュール配列からインデックスルート定義を生成するオーバーロードです。
|
|
17
|
-
*
|
|
18
|
-
* @template TPath ルートのパスの型です。
|
|
19
|
-
* @param mods エントリーモジュールと追加のデータ操作関数の配列です。
|
|
20
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
21
|
-
*/
|
|
22
|
-
declare function index<const TPath extends string = string>(mods: readonly [entry: IndexRouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]]): RouteDefinition<TPath>;
|
|
23
|
-
/**
|
|
24
|
-
* 単一のルートモジュールからインデックスルート定義を生成するオーバーロードです。
|
|
25
|
-
*
|
|
26
|
-
* @template TPath ルートのパスの型です。
|
|
27
|
-
* @param mod ルートモジュールオブジェクトです。
|
|
28
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
29
|
-
*/
|
|
30
|
-
declare function index<const TPath extends string = string>(mod: IndexRouteModule<TPath>): RouteDefinition<TPath>;
|
|
31
|
-
/**
|
|
32
|
-
* インデックスルートモジュールまたはモジュール配列を受け取り、インデックスルート定義を生成します。
|
|
33
|
-
*
|
|
34
|
-
* @template TPath ルートのパスの型です。
|
|
35
|
-
* @param modOrMods ルートモジュールまたはエントリーモジュールを含む配列です。
|
|
36
|
-
* @param children 子ルートの配列です(インデックスルートでは通常使用されません)。
|
|
37
|
-
* @returns 構成されたインデックスルート定義オブジェクトを返します。
|
|
38
|
-
*/
|
|
39
|
-
declare function index<const TPath extends string = string>(modOrMods: IndexRouteModule<TPath> | readonly [entry: IndexRouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]], children: readonly RouteDefinition[]): RouteDefinition<TPath>;
|
|
40
|
-
export default index;
|
|
41
|
-
//# sourceMappingURL=route-index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-index.d.ts","sourceRoot":"","sources":["../../src/utils/route-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAE3F;;;;;;GAMG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GACvF,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1B;;;;;;GAMG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAC3B,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1B;;;;;;;GAOG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,SAAS,EACL,gBAAgB,CAAC,KAAK,CAAC,GACvB,SAAS,CAAC,KAAK,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,EACtF,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,eAAe,CAAC,KAAK,CAAC,CAAC;AAiB1B,eAAe,KAAK,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import route from "./route-route.js";
|
|
2
|
-
/**
|
|
3
|
-
* インデックスルート定義を構築する関数の実体です。
|
|
4
|
-
* `route` 関数を利用して定義を生成し、`children` を明示的に `undefined` に設定します。
|
|
5
|
-
*/
|
|
6
|
-
function index(arg0) {
|
|
7
|
-
// route 関数でベースとなる定義を生成した後、子ルートを持たないように上書きします。
|
|
8
|
-
return Object.assign(route(arg0, []), {
|
|
9
|
-
children: undefined,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
export default index;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { DataFunctionObject, RouteDefinition } from "../core/route.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* ルートの定義を構成するモジュールの型定義です。
|
|
4
|
-
*
|
|
5
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
6
|
-
*/
|
|
7
|
-
export type RouteModule<TPath extends string = string> = DataFunctionObject<TPath> & {
|
|
8
|
-
/**
|
|
9
|
-
* ルートのパス(パスパターン)です。
|
|
10
|
-
*/
|
|
11
|
-
readonly path: TPath;
|
|
12
|
-
/**
|
|
13
|
-
* このルートで描画される React コンポーネントです。
|
|
14
|
-
*/
|
|
15
|
-
readonly default?: React.ComponentType<{}> | undefined;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* ルートの起点となるエントリーモジュールの型定義です。
|
|
19
|
-
*
|
|
20
|
-
* データ操作関数の定義を直接含みます。
|
|
21
|
-
*
|
|
22
|
-
* @template TPath ルートのパス(パスパターン)の型です。
|
|
23
|
-
*/
|
|
24
|
-
export type RouteEntryModule<TPath extends string = string> = DataFunctionObject<TPath> & {
|
|
25
|
-
/**
|
|
26
|
-
* ルートのパス(パスパターン)です。
|
|
27
|
-
*/
|
|
28
|
-
readonly path: TPath;
|
|
29
|
-
/**
|
|
30
|
-
* このルートで描画される React コンポーネントです。
|
|
31
|
-
*/
|
|
32
|
-
readonly default?: React.ComponentType<{}> | undefined;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* 複数のモジュール配列からルート定義を生成するオーバーロードです。
|
|
36
|
-
*
|
|
37
|
-
* @template TPath ルートのパスの型です。
|
|
38
|
-
* @param mods エントリーモジュールと追加のデータ操作関数の配列です。
|
|
39
|
-
* @param children 子ルートの配列です。
|
|
40
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
41
|
-
*/
|
|
42
|
-
declare function route<const TPath extends string = string>(mods: readonly [entry: RouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]], children: readonly RouteDefinition[]): RouteDefinition<TPath>;
|
|
43
|
-
/**
|
|
44
|
-
* 単一のルートモジュールからルート定義を生成するオーバーロードです。
|
|
45
|
-
*
|
|
46
|
-
* @template TPath ルートのパスの型です。
|
|
47
|
-
* @param mod ルートモジュールオブジェクトです。
|
|
48
|
-
* @param children 子ルートの配列です。
|
|
49
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
50
|
-
*/
|
|
51
|
-
declare function route<const TPath extends string = string>(mod: RouteModule<TPath>, children: readonly RouteDefinition[]): RouteDefinition<TPath>;
|
|
52
|
-
/**
|
|
53
|
-
* ルートモジュールまたはモジュール配列を受け取り、ルート定義を生成します。
|
|
54
|
-
*
|
|
55
|
-
* @template TPath ルートのパスの型です。
|
|
56
|
-
* @param modOrMods ルートモジュールまたはエントリーモジュールを含む配列です。
|
|
57
|
-
* @param children 子ルートの配列です。
|
|
58
|
-
* @returns 構成されたルート定義オブジェクトを返します。
|
|
59
|
-
*/
|
|
60
|
-
declare function route<const TPath extends string = string>(modOrMods: RouteModule<TPath> | readonly [entry: RouteEntryModule<TPath>, ...ui: DataFunctionObject<TPath>[]], children: readonly RouteDefinition[]): RouteDefinition<TPath>;
|
|
61
|
-
export default route;
|
|
62
|
-
//# sourceMappingURL=route-route.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-route.d.ts","sourceRoot":"","sources":["../../src/utils/route-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElF;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG;IACnF;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG;IACxF;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF;;;;;;;GAOG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,EACnF,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1B;;;;;;;GAOG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,EACvB,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1B;;;;;;;GAOG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAChD,SAAS,EACL,WAAW,CAAC,KAAK,CAAC,GAClB,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,EACjF,QAAQ,EAAE,SAAS,eAAe,EAAE,GACnC,eAAe,CAAC,KAAK,CAAC,CAAC;AAiC1B,eAAe,KAAK,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ルート定義を構築する関数の実体です。
|
|
3
|
-
*/
|
|
4
|
-
function route(modOrMods, children) {
|
|
5
|
-
// 配列形式で渡された場合の処理です。
|
|
6
|
-
if (Array.isArray(modOrMods)) {
|
|
7
|
-
const mods = modOrMods;
|
|
8
|
-
const [entry, ...ui] = mods;
|
|
9
|
-
return {
|
|
10
|
-
path: entry.path,
|
|
11
|
-
children,
|
|
12
|
-
component: entry.default,
|
|
13
|
-
dataFunctions: [entry, ...ui],
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
// オブジェクト形式で渡された場合の処理です。
|
|
17
|
-
const mod = modOrMods;
|
|
18
|
-
return {
|
|
19
|
-
path: mod.path,
|
|
20
|
-
children,
|
|
21
|
-
component: mod.default,
|
|
22
|
-
dataFunctions: [mod],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export default route;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IAction } from "../core/route.types.js";
|
|
2
|
-
/**
|
|
3
|
-
* フォームデータに対してアクション ID を発行し、設定します。
|
|
4
|
-
*
|
|
5
|
-
* @param formData アクション ID を設定する対象のフォームデータです。
|
|
6
|
-
* @param action アクション関数です。
|
|
7
|
-
*/
|
|
8
|
-
export default function setActionId(formData: FormData, action: IAction): void;
|
|
9
|
-
//# sourceMappingURL=set-action-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-action-id.d.ts","sourceRoot":"","sources":["../../src/utils/set-action-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAG7E"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import actionIdRegistry from "../core/_action-id-registry.js";
|
|
2
|
-
import { ACTION_ID_FORM_DATA_NAME } from "../core/constants.js";
|
|
3
|
-
/**
|
|
4
|
-
* フォームデータに対してアクション ID を発行し、設定します。
|
|
5
|
-
*
|
|
6
|
-
* @param formData アクション ID を設定する対象のフォームデータです。
|
|
7
|
-
* @param action アクション関数です。
|
|
8
|
-
*/
|
|
9
|
-
export default function setActionId(formData, action) {
|
|
10
|
-
const id = actionIdRegistry.set(action);
|
|
11
|
-
formData.set(ACTION_ID_FORM_DATA_NAME, id);
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import actionIdRegistry from "../core/_action-id-registry.js";
|
|
3
|
-
import { ACTION_ID_FORM_DATA_NAME } from "../core/constants.js";
|
|
4
|
-
import type { IAction } from "../core/route.types.js";
|
|
5
|
-
import HiddenInput from "./hidden-input.jsx";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ActionId コンポーネントのプロパティーを定義する型です。
|
|
9
|
-
*/
|
|
10
|
-
export type ActionIdProps = {
|
|
11
|
-
/**
|
|
12
|
-
* 実行対象となるアクション関数です。
|
|
13
|
-
*/
|
|
14
|
-
action: IAction;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* アクションに対応する識別子を隠しフィールドとしてレンダリングするコンポーネントです。
|
|
19
|
-
*
|
|
20
|
-
* アクション関数をレジストリーに登録し、発行された ID をフォームデータとして送信可能な状態にします。
|
|
21
|
-
*/
|
|
22
|
-
export default /*#__PURE__*/ React.memo(
|
|
23
|
-
function ActionId(props: ActionIdProps): React.ReactElement {
|
|
24
|
-
const { action } = props;
|
|
25
|
-
const id = actionIdRegistry.set(action);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<HiddenInput
|
|
29
|
-
name={ACTION_ID_FORM_DATA_NAME}
|
|
30
|
-
value={id}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
},
|
|
34
|
-
(a, b) => a.action === b.action,
|
|
35
|
-
);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 隠し入力フィールド(hidden input)のプロパティーを定義する型です。
|
|
5
|
-
*/
|
|
6
|
-
export type HiddenInputProps = {
|
|
7
|
-
/**
|
|
8
|
-
* フォーム送信時に使用される要素の名前です。
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* フォーム送信時に送信される値です。
|
|
14
|
-
*/
|
|
15
|
-
value: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* フォーム内で非表示の状態を保持するための隠し入力コンポーネントです。
|
|
20
|
-
*/
|
|
21
|
-
export default /*#__PURE__*/ React.memo(
|
|
22
|
-
function HiddenInput(props: HiddenInputProps) {
|
|
23
|
-
const {
|
|
24
|
-
name,
|
|
25
|
-
value,
|
|
26
|
-
} = props;
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<input
|
|
30
|
-
type="hidden"
|
|
31
|
-
name={name}
|
|
32
|
-
style={{ display: "none" }}
|
|
33
|
-
value={value}
|
|
34
|
-
hidden
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
(a, b) => a.name === b.name && a.value === b.value,
|
|
39
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import WeakIdRegistry from "./_weak-id-registry.js";
|
|
2
|
-
import type { IAction } from "./route.types.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `IAction` 型のオブジェクトとその識別子を管理するための、弱い参照を用いたレジストリーです。
|
|
6
|
-
*
|
|
7
|
-
* ガベージコレクションを妨げずにアクションの識別子を保持するために使用されます。
|
|
8
|
-
*/
|
|
9
|
-
const actionIdRegistry = new WeakIdRegistry<IAction>();
|
|
10
|
-
|
|
11
|
-
export default actionIdRegistry;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* オブジェクトにスタックトレースをキャプチャーします。
|
|
3
|
-
*
|
|
4
|
-
* @param targetObject スタックトレースのプロパティーを追加する対象のオブジェクトです。
|
|
5
|
-
* @param constructorOpt スタックトレースの開始地点としてマークする関数です。
|
|
6
|
-
*/
|
|
7
|
-
export default function captureStackTrace(targetObject: object, constructorOpt: Function): void {
|
|
8
|
-
// 実行環境(V8 エンジンなど)が Error.captureStackTrace をサポートしているか確認します。
|
|
9
|
-
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
10
|
-
Error.captureStackTrace(targetObject, constructorOpt);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyFormData } from "./readonly-form-data.types.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ReadonlyFormData の内容から、一時的な HTMLFormElement を生成します。
|
|
5
|
-
*
|
|
6
|
-
* @param formData フォーム要素に変換する元のフォームデータです。
|
|
7
|
-
* @returns 生成された HTMLFormElement を返します。
|
|
8
|
-
*/
|
|
9
|
-
export default function createHtmlFormElementFormFormData(
|
|
10
|
-
formData: ReadonlyFormData,
|
|
11
|
-
): HTMLFormElement {
|
|
12
|
-
const form = document.createElement("form");
|
|
13
|
-
form.style.display = "none";
|
|
14
|
-
formData.forEach((value, name) => {
|
|
15
|
-
const input = document.createElement("input");
|
|
16
|
-
if (value instanceof File) {
|
|
17
|
-
input.type = "file";
|
|
18
|
-
input.name = name;
|
|
19
|
-
const dataTransfer = new DataTransfer();
|
|
20
|
-
dataTransfer.items.add(value);
|
|
21
|
-
input.files = dataTransfer.files;
|
|
22
|
-
} else {
|
|
23
|
-
input.type = "hidden";
|
|
24
|
-
input.name = name;
|
|
25
|
-
input.value = value;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
form.appendChild(input);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return form;
|
|
32
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 連続するスラッシュ(/)にマッチする正規表現です。
|
|
3
|
-
*/
|
|
4
|
-
const MULTI_SLASH = /\/\/+/gu;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 与えられたパス名を URL エンコードし、正規化された形式で返します。
|
|
8
|
-
*
|
|
9
|
-
* エンコードの必要がある部分のみをエンコードします。
|
|
10
|
-
*
|
|
11
|
-
* @param pathname エンコード対象となるパス名の文字列です。
|
|
12
|
-
* @returns 正規化およびエンコードされたパス名の文字列です。
|
|
13
|
-
*/
|
|
14
|
-
export default function encodePathname(pathname: string): string {
|
|
15
|
-
const u = new URL("x://y" + ("/" + pathname).replace(MULTI_SLASH, "/"));
|
|
16
|
-
return u.pathname;
|
|
17
|
-
}
|
package/src/core/_is-error.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* エラーオブジェクトのようなオブジェクトかどうか判定します。
|
|
3
|
-
*
|
|
4
|
-
* @param e 判定する値です。
|
|
5
|
-
* @returns 判定結果です。
|
|
6
|
-
*/
|
|
7
|
-
function isError(e: unknown): e is Error {
|
|
8
|
-
return e instanceof Error || (
|
|
9
|
-
e !== null
|
|
10
|
-
&& typeof e === "object"
|
|
11
|
-
&& ("name" in e && typeof e.name === "string")
|
|
12
|
-
&& ("message" in e && typeof e.message === "string")
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default globalThis.Error.isError || isError;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 与えられた値が `PromiseLike` であるかどうかを判定します。
|
|
3
|
-
*
|
|
4
|
-
* @param value 判定対象の値です。
|
|
5
|
-
* @returns 値が `then` メソッドを持つオブジェクトである場合は `true`、それ以外は `false` を返します。
|
|
6
|
-
*/
|
|
7
|
-
export default function isPromiseLike<T = unknown>(value: unknown): value is PromiseLike<T> {
|
|
8
|
-
return (
|
|
9
|
-
value !== null
|
|
10
|
-
&& typeof value === "object"
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
&& typeof value["then"] === "function"
|
|
13
|
-
);
|
|
14
|
-
}
|