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
|
@@ -4,84 +4,83 @@ import HistoryEntryIdSchema, { type HistoryEntryId } from "./history-entry-id-sc
|
|
|
4
4
|
import HistoryEntryUrlSchema, { type HistoryEntryUrl } from "./history-entry-url-schema.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 履歴エントリーオブジェクト全体の構造を検証するためのスキーマを作成する関数です。
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @returns 履歴エントリーのスキーマです。
|
|
9
|
+
* スキーマの構築処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
|
|
12
10
|
*/
|
|
13
|
-
const HistoryEntrySchema = () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const HistoryEntrySchema = () =>
|
|
12
|
+
singleton("HistoryEntrySchema", () =>
|
|
13
|
+
v.object({
|
|
14
|
+
/**
|
|
15
|
+
* 履歴エントリーの識別子です。
|
|
16
|
+
*/
|
|
17
|
+
id: HistoryEntryIdSchema(),
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 履歴エントリーの絶対 URL です。
|
|
21
|
+
*/
|
|
22
|
+
url: v.nullable(HistoryEntryUrlSchema()),
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 履歴エントリーリスト内の履歴エントリーのインデックスです。
|
|
26
|
+
*/
|
|
27
|
+
index: v.pipe(v.number(), v.safeInteger(), v.minValue(-1)),
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
|
-
*
|
|
32
|
+
* `HistoryEntrySchema` による検証と構造変換を行う前の、生の入力オブジェクトに対応する型定義です。
|
|
27
33
|
*/
|
|
28
|
-
export type HistoryEntryLike =
|
|
34
|
+
export type HistoryEntryLike = v.InferInput<ReturnType<typeof HistoryEntrySchema>>;
|
|
29
35
|
|
|
30
36
|
/**
|
|
31
|
-
*
|
|
37
|
+
* `expectHistoryEntry` 関数による検証を通過した、ランタイムで確定的に使用可能な履歴エントリーの型定義です。
|
|
32
38
|
*/
|
|
33
39
|
export type HistoryEntry = {
|
|
34
40
|
/**
|
|
35
|
-
*
|
|
41
|
+
* 履歴エントリーの識別子です。
|
|
36
42
|
*/
|
|
37
43
|
readonly id: HistoryEntryId;
|
|
38
44
|
|
|
39
45
|
/**
|
|
40
|
-
*
|
|
46
|
+
* 履歴エントリーの絶対 URL です。
|
|
41
47
|
*/
|
|
42
48
|
readonly url: HistoryEntryUrl;
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
|
-
*
|
|
51
|
+
* 履歴エントリーリスト内の履歴エントリーのインデックスです。
|
|
46
52
|
*/
|
|
47
53
|
readonly index: number;
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
/**
|
|
51
|
-
*
|
|
57
|
+
* 履歴エントリーオブジェクトを検証し、仕様を満たしている場合に確定的な `HistoryEntry` 型へと変換します。
|
|
52
58
|
*
|
|
53
|
-
* @param entry
|
|
54
|
-
* @returns
|
|
59
|
+
* @param entry スキーマの基本構造を満たしていると予想される生の入力値です。
|
|
60
|
+
* @returns すべてのプロパティーが完全に確定した `HistoryEntry` を返します。
|
|
55
61
|
*/
|
|
56
62
|
function expectHistoryEntry(entry: HistoryEntryLike): HistoryEntry;
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
|
-
*
|
|
65
|
+
* 履歴エントリーオブジェクトを検証し、仕様を満たしている場合に確定的な `HistoryEntry` 型へと変換します。
|
|
60
66
|
*
|
|
61
|
-
* @param entry
|
|
62
|
-
* @returns
|
|
67
|
+
* @param entry スキーマの入力形式を満たすオブジェクト、または空値です。
|
|
68
|
+
* @returns 入力値が空であった場合、あるいは検証の過程で必要なデータが欠落していた場合は `null` を返します。
|
|
63
69
|
*/
|
|
64
70
|
function expectHistoryEntry(entry: HistoryEntryLike | null | undefined): HistoryEntry | null;
|
|
65
71
|
|
|
66
|
-
/**
|
|
67
|
-
* 入力値が履歴エントリーの形式を満たしているか検証します。
|
|
68
|
-
*
|
|
69
|
-
* @param entry 検証対象のデータです。
|
|
70
|
-
* @returns 検証結果に基づく履歴エントリー、または null です。
|
|
71
|
-
*/
|
|
72
72
|
function expectHistoryEntry(entry: HistoryEntryLike | null | undefined): HistoryEntry | null {
|
|
73
73
|
if (entry == null) {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!url) {
|
|
77
|
+
const { id, url, index } = v.expect(HistoryEntrySchema(), entry);
|
|
78
|
+
if (
|
|
79
|
+
// 特定の条件下で null に設定される場合があるので、そのときは null を返します。
|
|
80
|
+
!url ||
|
|
81
|
+
// 現在のドキュメントが完全にアクティブでない場合は -1 になってしまうので、そのときは null を返します。
|
|
82
|
+
index < 0
|
|
83
|
+
) {
|
|
85
84
|
return null;
|
|
86
85
|
}
|
|
87
86
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReadonlyFormData } from "./readonly-form-data.types.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 読み取り専用のフォームデータを基に、プログラムによって仮想的な `HTMLFormElement` を動的に構築する関数です。
|
|
5
|
+
*
|
|
6
|
+
* 生成されたフォーム要素は画面上のレイアウトを崩さないよう非表示(`display: none`)に設定され、内包する各データは適切な `<input>` 要素にラップされてフォーム内に追加されます。
|
|
7
|
+
*
|
|
8
|
+
* @param formData 変換元となる読み取り専用のフォームデータです。
|
|
9
|
+
* @returns 子要素としてデータが詰め込まれた、DOM に未配置の非表示 `HTMLFormElement` を返します。
|
|
10
|
+
*/
|
|
11
|
+
export default function formDataToHTMLFormElement(formData: ReadonlyFormData): HTMLFormElement {
|
|
12
|
+
const form = document.createElement("form");
|
|
13
|
+
|
|
14
|
+
// 画面のレンダリングや視覚的なレイアウトに影響を及ぼさないよう、非表示スタイルを強制します。
|
|
15
|
+
form.style.display = "none";
|
|
16
|
+
|
|
17
|
+
formData.forEach((value, name) => {
|
|
18
|
+
const input = document.createElement("input");
|
|
19
|
+
if (value instanceof File) {
|
|
20
|
+
// DataTransfer オブジェクトを仲介役として利用し、FileList を安全に再構成します。
|
|
21
|
+
const df = new DataTransfer();
|
|
22
|
+
df.items.add(value);
|
|
23
|
+
|
|
24
|
+
input.type = "file";
|
|
25
|
+
input.name = name;
|
|
26
|
+
input.files = df.files;
|
|
27
|
+
} else {
|
|
28
|
+
input.type = "hidden";
|
|
29
|
+
input.name = name;
|
|
30
|
+
input.value = value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
form.appendChild(input);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return form;
|
|
37
|
+
}
|
|
@@ -2,25 +2,20 @@ import singleton from "./_singleton.js";
|
|
|
2
2
|
import * as v from "./_valibot.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 履歴エントリーの識別子を検証およびブランド化するためのスキーマを作成する関数です。
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* スキーマの生成処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
|
|
8
8
|
*/
|
|
9
|
-
const HistoryEntryIdSchema = () =>
|
|
10
|
-
v.pipe(
|
|
11
|
-
v.string(),
|
|
12
|
-
v.uuid(),
|
|
13
|
-
v.brand("HistoryEntryId"),
|
|
14
|
-
)
|
|
15
|
-
)));
|
|
9
|
+
const HistoryEntryIdSchema = () =>
|
|
10
|
+
singleton("HistoryEntryIdSchema", () => v.pipe(v.string(), v.uuid(), v.brand("HistoryEntryId")));
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
|
-
*
|
|
13
|
+
* `HistoryEntryIdSchema` による検証を通過する前の、入力値に対応する型定義です。
|
|
19
14
|
*/
|
|
20
15
|
export type HistoryEntryIdLike = v.InferInput<ReturnType<typeof HistoryEntryIdSchema>>;
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
|
-
*
|
|
18
|
+
* `HistoryEntryIdSchema` による検証および解析が正常に完了した、安全な出力値の型定義です。
|
|
24
19
|
*/
|
|
25
20
|
export type HistoryEntryId = v.InferOutput<ReturnType<typeof HistoryEntryIdSchema>>;
|
|
26
21
|
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
import singleton from "./_singleton.js";
|
|
2
2
|
import * as v from "./_valibot.js";
|
|
3
3
|
import type { ReadonlyURL } from "./readonly-url.types.js";
|
|
4
|
+
import RoutePath from "./route-path.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* 履歴エントリーで使用される URL 文字列を検証、正規化、およびブランド化するためのスキーマを作成する関数です。
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @returns 履歴エントリー URL のスキーマです。
|
|
9
|
+
* スキーマの構築処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
|
|
11
10
|
*/
|
|
12
|
-
const HistoryEntryUrlSchema = () =>
|
|
13
|
-
|
|
14
|
-
v.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const HistoryEntryUrlSchema = () =>
|
|
12
|
+
singleton("HistoryEntryUrlSchema", () =>
|
|
13
|
+
v.pipe(
|
|
14
|
+
v.string(),
|
|
15
|
+
v.url(),
|
|
16
|
+
// 検証を通過した URL 文字列を、読み取り専用の ReadonlyURL オブジェクトへと構造変換および正規化します。
|
|
17
|
+
v.transform(function toNormalizedReadonlyURL(s): ReadonlyURL {
|
|
18
|
+
const u = new URL(s);
|
|
19
|
+
|
|
20
|
+
// 正規化します。
|
|
21
|
+
const { hash, search, pathname } = new RoutePath(u);
|
|
22
|
+
u.hash = hash;
|
|
23
|
+
u.search = search;
|
|
24
|
+
u.pathname = pathname;
|
|
25
|
+
|
|
26
|
+
return u;
|
|
27
|
+
}),
|
|
28
|
+
v.brand("HistoryEntryUrl"),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
24
31
|
|
|
25
32
|
/**
|
|
26
|
-
*
|
|
33
|
+
* `HistoryEntryUrlSchema` による検証と変換を行う前の、入力値に対応する型定義です。
|
|
27
34
|
*/
|
|
28
35
|
export type HistoryEntryUrlLike = v.InferInput<ReturnType<typeof HistoryEntryUrlSchema>>;
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
|
-
*
|
|
38
|
+
* `HistoryEntryUrlSchema` による検証、並び替え、および変換が正常に完了した、安全な出力値の型定義です。
|
|
32
39
|
*/
|
|
33
40
|
export type HistoryEntryUrl = v.InferOutput<ReturnType<typeof HistoryEntryUrlSchema>>;
|
|
34
41
|
|
package/src/core/init-loaders.ts
CHANGED
|
@@ -1,79 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import type { HistoryEntry } from "./expect-history-entry.js";
|
|
1
|
+
import { NinjaPromise } from "ninja-promise";
|
|
2
|
+
|
|
3
|
+
import type { HistoryEntryUrl } from "./history-entry-url-schema.js";
|
|
5
4
|
import type { MatchedRoute } from "./match-routes.js";
|
|
6
5
|
import RouteRequest from "./route-request.js";
|
|
7
|
-
import type {
|
|
6
|
+
import type { LoaderFunction } from "./route.types.js";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* 各ローダー関数を初期化する際に必要となるリクエスト情報の型定義です。
|
|
11
10
|
*/
|
|
12
|
-
export type
|
|
13
|
-
/**
|
|
14
|
-
* マッチしたルート情報のリストです。パラメーターとデータ関数を含みます。
|
|
15
|
-
*/
|
|
16
|
-
readonly routes: readonly Pick<MatchedRoute, "params" | "dataFuncs">[];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 履歴エントリーの情報です。 ID と URL を含みます。
|
|
20
|
-
*/
|
|
21
|
-
readonly entry: Pick<HistoryEntry, "id" | "url">;
|
|
22
|
-
|
|
11
|
+
export type LoaderInitRequest = {
|
|
23
12
|
/**
|
|
24
|
-
*
|
|
13
|
+
* 読み込み対象となる現在の履歴エントリーの正規化済み URL オブジェクトです。
|
|
25
14
|
*/
|
|
26
|
-
readonly
|
|
15
|
+
readonly url: HistoryEntryUrl;
|
|
27
16
|
|
|
28
17
|
/**
|
|
29
|
-
*
|
|
18
|
+
* 進行中の非同期データ取得処理を外部から中断するための中断シグナルです。
|
|
30
19
|
*/
|
|
31
20
|
readonly signal: AbortSignal;
|
|
32
21
|
};
|
|
33
22
|
|
|
34
23
|
/**
|
|
35
|
-
*
|
|
24
|
+
* マッチしたすべてのルートに紐づくデータ取得用のローダー関数を一斉に起動し、その実行コンテキストと遅延非同期状態を管理するためのマップを作成して返す関数です。
|
|
36
25
|
*
|
|
37
|
-
*
|
|
26
|
+
* 階層的な並行データフェッチをサポートするために、各ローダーの実行結果を個別のプロミスとしてラップします。
|
|
38
27
|
*
|
|
39
|
-
* @param params
|
|
40
|
-
* @
|
|
28
|
+
* @param routes 現在の URL にマッチしたルート情報の配列です。各ルートから `loader` 関数と解析済みの `params` のみを抽出して利用します。
|
|
29
|
+
* @param request 各ローダー関数を初期化する際に必要となるリクエスト情報です。
|
|
30
|
+
* @returns 各ローダー関数をキーとし、その実行結果または進行状態を表す `NinjaPromise` を値としたマップです。
|
|
41
31
|
*/
|
|
42
|
-
export default function initLoaders(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (!loader) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
32
|
+
export default function initLoaders(
|
|
33
|
+
routes: readonly Pick<MatchedRoute, "loader" | "params">[],
|
|
34
|
+
request: LoaderInitRequest,
|
|
35
|
+
): Map<LoaderFunction, NinjaPromise<unknown>> {
|
|
36
|
+
const dataMap = new Map<LoaderFunction, NinjaPromise<unknown>>();
|
|
37
|
+
|
|
38
|
+
// マッチしたすべてのローダーで共有可能なリクエストオブジェクトを 1 つだけ作成します。
|
|
39
|
+
// すべてのプロパティーが読み取り専用なので、ローダー間で共有できます。
|
|
40
|
+
const req = RouteRequest.new("GET", request.url, request.signal);
|
|
41
|
+
|
|
42
|
+
for (const { loader, params } of routes) {
|
|
43
|
+
if (typeof loader !== "function") {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
request,
|
|
65
|
-
});
|
|
47
|
+
const data = NinjaPromise.try(function executeLoader() {
|
|
48
|
+
return loader({
|
|
49
|
+
params,
|
|
50
|
+
request: req,
|
|
66
51
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
52
|
+
});
|
|
53
|
+
dataMap.set(loader, data);
|
|
70
54
|
}
|
|
71
55
|
|
|
72
|
-
|
|
73
|
-
dataStore.set(entry.id, dataMap);
|
|
74
|
-
|
|
75
|
-
return async function waitForLoadersComplete() {
|
|
76
|
-
// すべてのローダーの Promise が確定するまで待機します。
|
|
77
|
-
await Promise.allSettled(dataMap.values());
|
|
78
|
-
};
|
|
56
|
+
return dataMap;
|
|
79
57
|
}
|
package/src/core/match-routes.ts
CHANGED
|
@@ -1,90 +1,58 @@
|
|
|
1
1
|
import { inject } from "regexparam";
|
|
2
|
+
|
|
2
3
|
import matchRoutePath from "./_match-route-path.js";
|
|
3
|
-
import type {
|
|
4
|
+
import type { ReadonlyURL } from "./readonly-url.types.js";
|
|
5
|
+
import type { Route, RoutePathParams } from "./route.types.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* URL とのマッチングが確認されたルート情報を表す型定義です。
|
|
9
|
+
*
|
|
10
|
+
* 基本となる `Route` オブジェクトの構造を引き継ぎつつ、抽出された動的パラメーターと、それらを埋め戻して構築された具体的な URL パス文字列が追加されています。
|
|
7
11
|
*/
|
|
8
|
-
export type MatchedRoute =
|
|
12
|
+
export type MatchedRoute = Route & {
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
14
|
+
* 現在の URL パスから抽出された、このルート固有の動的パスパラメーターです。
|
|
11
15
|
*/
|
|
12
|
-
readonly params:
|
|
16
|
+
readonly params: RoutePathParams;
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const route = matchRoutes(routes, "/user/123/setting");
|
|
20
|
-
* route.path; // "/user/:id"
|
|
21
|
-
* route.params; // { id: "123" }
|
|
22
|
-
* route.urlPath; // "/user/123"
|
|
23
|
-
* ```
|
|
19
|
+
* ルートの定義パターン(例: `/users/:id`)に抽出したパラメーター(例: `{ id: "42" }`)を流し込み、具現化されたリクエストパス(例: `/users/42`)です。
|
|
24
20
|
*/
|
|
25
21
|
readonly urlPath: string;
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* 事前に詳細度順でソートされたルート定義の配列から、指定された URL に適合するすべてのルートを探索・抽出し、マッチした順に正規化して返す関数です。
|
|
30
26
|
*
|
|
31
|
-
*
|
|
32
|
-
* @param pathname マッチング対象のパス名です。
|
|
33
|
-
* @returns マッチした場合は親から子への階層構造を保持した配列を返し、マッチしない場合は `null` を返します。
|
|
34
|
-
*/
|
|
35
|
-
function matchRoute(
|
|
36
|
-
route: Route,
|
|
37
|
-
pathname: string,
|
|
38
|
-
): readonly [MatchedRoute, ...MatchedRoute[]] | null {
|
|
39
|
-
const result = matchRoutePath(route, pathname);
|
|
40
|
-
if (!result) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const matched: MatchedRoute = {
|
|
45
|
-
path: route.path,
|
|
46
|
-
index: route.index,
|
|
47
|
-
params: result.params,
|
|
48
|
-
urlPath: inject(route.path, result.params),
|
|
49
|
-
dataFuncs: route.dataFuncs,
|
|
50
|
-
component: route.component,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// インデックスルート(末端)の場合は、現在のルートを配列に含めて返します。
|
|
54
|
-
if (route.index) {
|
|
55
|
-
return [matched];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// 子ルートの中にマッチするものがあるか探索します。
|
|
59
|
-
for (const childRoute of route.children) {
|
|
60
|
-
const childMathced = matchRoute(childRoute, pathname);
|
|
61
|
-
if (childMathced) {
|
|
62
|
-
return [
|
|
63
|
-
...childMathced,
|
|
64
|
-
matched,
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return [matched];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* ルート定義のリスト全体から、指定されたパス名にマッチするルートを探索します。
|
|
27
|
+
* ネストされた階層的なルーティング構造において、親ルートから子ルートまで、現在の URL に部分一致または完全一致するルートの連鎖を構成する目的で使用します。
|
|
74
28
|
*
|
|
75
|
-
* @param routes
|
|
76
|
-
* @param
|
|
77
|
-
* @returns
|
|
29
|
+
* @param routes あらかじめ正規化およびソートが完了しているルートオブジェクトの読み取り専用配列です。
|
|
30
|
+
* @param url マッチングの判定元となる、読み取り専用の URL オブジェクトです。
|
|
31
|
+
* @returns マッチしたルートが 1 つ以上存在する場合は、最低 1 つの要素を持つことが保証された `MatchedRoute` の読み取り専用タプル配列を返します。1 つもマッチしなかった場合は `null` を返します。
|
|
78
32
|
*/
|
|
79
33
|
export default function matchRoutes(
|
|
80
34
|
routes: readonly Route[],
|
|
81
|
-
|
|
35
|
+
url: ReadonlyURL,
|
|
82
36
|
): readonly [MatchedRoute, ...MatchedRoute[]] | null {
|
|
37
|
+
const matched: MatchedRoute[] = [];
|
|
38
|
+
|
|
39
|
+
// 登録されているすべてのルートを前方から順番に走査します。
|
|
40
|
+
// routes 配列は詳細度が高い順に並んでいることが前提となります。
|
|
83
41
|
for (const route of routes) {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
|
|
42
|
+
const result = matchRoutePath(route, url);
|
|
43
|
+
if (!result) {
|
|
44
|
+
continue;
|
|
87
45
|
}
|
|
46
|
+
|
|
47
|
+
matched.push({
|
|
48
|
+
...route,
|
|
49
|
+
params: result.params,
|
|
50
|
+
urlPath: inject(route.path, result.params),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (matched.length > 0) {
|
|
55
|
+
return matched as [any];
|
|
88
56
|
}
|
|
89
57
|
|
|
90
58
|
return null;
|
|
@@ -1,63 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* フォームデータを読み取り専用で操作するためのインターフェースです。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* データの追加、削除、更新といった変更処理を禁止し、データの参照や走査のみを許可する目的で使用します。
|
|
5
5
|
*
|
|
6
6
|
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData)
|
|
7
7
|
*/
|
|
8
8
|
export interface ReadonlyFormData {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* 指定された名前に一致する最初のフォームデータの値を取得します。
|
|
11
|
+
*
|
|
12
|
+
* @param name 検索するフォームコントロールのキー名です。
|
|
13
|
+
* @returns 一致したデータを返します。データは文字列または `File` オブジェクトのいずれかです。指定された名前のキーが存在しない場合は `null` を返します。
|
|
11
14
|
*
|
|
12
15
|
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/get)
|
|
13
16
|
*/
|
|
14
17
|
get(name: string): FormDataEntryValue | null;
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
20
|
+
* 指定された名前に一致するすべてのフォームデータの値を配列として取得します。
|
|
21
|
+
*
|
|
22
|
+
* @param name 検索するフォームコントロールのキー名です。
|
|
23
|
+
* @returns 一致したすべてのデータを含む配列です。キーが存在しない場合は空の配列を返します。
|
|
18
24
|
*
|
|
19
25
|
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
|
|
20
26
|
*/
|
|
21
27
|
getAll(name: string): FormDataEntryValue[];
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
|
-
*
|
|
30
|
+
* 指定された名前を持つフォームデータが存在するかどうかを判定します。
|
|
31
|
+
*
|
|
32
|
+
* @param name 検証するフォームコントロールのキー名です。
|
|
33
|
+
* @returns 指定されたキーが存在する場合は `true` を、存在しない場合は `false` を返します。
|
|
25
34
|
*
|
|
26
35
|
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/has)
|
|
27
36
|
*/
|
|
28
37
|
has(name: string): boolean;
|
|
29
38
|
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
40
|
+
* コールバック関数を使用して、格納されているすべてのフォームデータに対して反復処理を実行します。
|
|
41
|
+
*
|
|
42
|
+
* @param callbackfn 各データに対して実行するコールバック関数です。
|
|
43
|
+
* @param thisArg コールバック関数を実行する際に `this` として使用する値です。
|
|
32
44
|
*/
|
|
33
45
|
forEach(
|
|
34
46
|
callbackfn: (value: FormDataEntryValue, key: string, parent: ReadonlyFormData) => void,
|
|
35
47
|
thisArg?: any,
|
|
36
48
|
): void;
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
/**
|
|
51
|
+
* 格納されているすべてのキーと値のペアを順に処理するための反復子(イテレーター)を返します。
|
|
52
|
+
*
|
|
53
|
+
* @returns キーと値のペアを要素とする `IterableIterator` オブジェクトです。
|
|
54
|
+
*
|
|
55
|
+
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/entries)
|
|
56
|
+
*/
|
|
57
|
+
entries(): IterableIterator<[string, FormDataEntryValue]>;
|
|
44
58
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
/**
|
|
60
|
+
* 格納されているすべてのキー名を順に処理するための反復子を返します。
|
|
61
|
+
*
|
|
62
|
+
* @returns 各データのキー名を要素とする `IterableIterator` オブジェクトです。
|
|
63
|
+
*
|
|
64
|
+
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/keys)
|
|
65
|
+
*/
|
|
66
|
+
keys(): IterableIterator<string>;
|
|
51
67
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
/**
|
|
69
|
+
* 格納されているすべての値のみを順に処理するための反復子を返します。
|
|
70
|
+
*
|
|
71
|
+
* @returns 各データの値(文字列または `File` オブジェクト)を要素とする `IterableIterator` オブジェクトです。
|
|
72
|
+
*
|
|
73
|
+
* [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/values)
|
|
74
|
+
*/
|
|
75
|
+
values(): IterableIterator<FormDataEntryValue>;
|
|
58
76
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
77
|
+
/**
|
|
78
|
+
* オブジェクトの既定の反復子を定義します。 `for...of` 構文などで直接オブジェクトを走査することを可能にします。
|
|
79
|
+
*
|
|
80
|
+
* @returns `entries` メソッドと同様に、キーと値のペアを要素とする `IterableIterator` オブジェクトです。
|
|
81
|
+
*/
|
|
82
|
+
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
|
|
63
83
|
}
|