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.
Files changed (352) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/components/browser-router.d.ts +19 -0
  3. package/dist/src/components/browser-router.d.ts.map +1 -0
  4. package/dist/src/components/browser-router.jsx +15 -0
  5. package/dist/src/components/outlet.d.ts +8 -0
  6. package/dist/src/components/outlet.d.ts.map +1 -0
  7. package/dist/src/components/outlet.jsx +15 -0
  8. package/dist/src/components/router.d.ts +21 -0
  9. package/dist/src/components/router.d.ts.map +1 -0
  10. package/dist/src/components/router.jsx +138 -0
  11. package/dist/src/contexts/route-context.d.ts +19 -0
  12. package/dist/src/contexts/route-context.d.ts.map +1 -0
  13. package/dist/src/contexts/route-context.js +6 -0
  14. package/dist/src/contexts/router-context.d.ts +55 -0
  15. package/dist/src/contexts/router-context.d.ts.map +1 -0
  16. package/dist/src/contexts/router-context.js +8 -0
  17. package/dist/src/core/_compare-route-paths.d.ts +11 -0
  18. package/dist/src/core/_compare-route-paths.d.ts.map +1 -0
  19. package/dist/src/core/_compare-route-paths.js +92 -0
  20. package/dist/src/core/_match-route-path.d.ts +22 -0
  21. package/dist/src/core/_match-route-path.d.ts.map +1 -0
  22. package/dist/src/core/_match-route-path.js +26 -0
  23. package/dist/src/core/_process-routes.d.ts +14 -0
  24. package/dist/src/core/_process-routes.d.ts.map +1 -0
  25. package/dist/src/core/_process-routes.js +45 -0
  26. package/dist/src/core/_singleton.d.ts +12 -0
  27. package/dist/src/core/_singleton.d.ts.map +1 -0
  28. package/dist/src/core/_singleton.js +18 -0
  29. package/dist/src/core/_unreachable.d.ts +16 -0
  30. package/dist/src/core/_unreachable.d.ts.map +1 -0
  31. package/dist/src/core/_unreachable.js +8 -0
  32. package/dist/src/core/_valibot.d.ts +25 -0
  33. package/dist/src/core/_valibot.d.ts.map +1 -0
  34. package/dist/src/core/_valibot.js +30 -0
  35. package/dist/src/core/errors.d.ts +182 -0
  36. package/dist/src/core/errors.d.ts.map +1 -0
  37. package/dist/src/core/errors.js +166 -0
  38. package/dist/src/core/expect-history-entry.d.ts +59 -0
  39. package/dist/src/core/expect-history-entry.d.ts.map +1 -0
  40. package/dist/src/core/expect-history-entry.js +42 -0
  41. package/dist/src/core/form-data-to-html-form-element.d.ts +11 -0
  42. package/dist/src/core/form-data-to-html-form-element.d.ts.map +1 -0
  43. package/dist/src/core/form-data-to-html-form-element.js +31 -0
  44. package/dist/src/core/history-entry-id-schema.d.ts +17 -0
  45. package/dist/src/core/history-entry-id-schema.d.ts.map +1 -0
  46. package/dist/src/core/history-entry-id-schema.js +9 -0
  47. package/dist/src/core/history-entry-url-schema.d.ts +18 -0
  48. package/dist/src/core/history-entry-url-schema.d.ts.map +1 -0
  49. package/dist/src/core/history-entry-url-schema.js +20 -0
  50. package/dist/src/core/init-loaders.d.ts +28 -0
  51. package/dist/src/core/init-loaders.d.ts.map +1 -0
  52. package/dist/src/core/init-loaders.js +30 -0
  53. package/dist/src/core/match-routes.d.ts +28 -0
  54. package/dist/src/core/match-routes.d.ts.map +1 -0
  55. package/dist/src/core/match-routes.js +31 -0
  56. package/dist/src/core/readonly-form-data.types.d.ts +74 -0
  57. package/dist/src/core/readonly-form-data.types.d.ts.map +1 -0
  58. package/dist/src/core/readonly-url.types.d.ts +164 -0
  59. package/dist/src/core/readonly-url.types.d.ts.map +1 -0
  60. package/dist/src/core/redirect-response.d.ts +37 -0
  61. package/dist/src/core/redirect-response.d.ts.map +1 -0
  62. package/dist/src/core/redirect-response.js +19 -0
  63. package/dist/src/core/route-path.d.ts +57 -0
  64. package/dist/src/core/route-path.d.ts.map +1 -0
  65. package/dist/src/core/route-path.js +93 -0
  66. package/dist/src/core/route-request.d.ts +149 -0
  67. package/dist/src/core/route-request.d.ts.map +1 -0
  68. package/dist/src/core/route-request.js +41 -0
  69. package/dist/src/core/route.types.d.ts +296 -0
  70. package/dist/src/core/route.types.d.ts.map +1 -0
  71. package/dist/src/core/start-action.d.ts +53 -0
  72. package/dist/src/core/start-action.d.ts.map +1 -0
  73. package/dist/src/core/start-action.js +95 -0
  74. package/dist/src/core/start-loaders.d.ts +63 -0
  75. package/dist/src/core/start-loaders.d.ts.map +1 -0
  76. package/dist/src/core/start-loaders.js +138 -0
  77. package/dist/{core.d.ts → src/core.d.ts} +7 -11
  78. package/dist/src/core.d.ts.map +1 -0
  79. package/dist/{core.js → src/core.js} +2 -4
  80. package/dist/src/engines/engine.types.d.ts +216 -0
  81. package/dist/src/engines/engine.types.d.ts.map +1 -0
  82. package/dist/src/engines/navigation-api-engine.d.ts +50 -0
  83. package/dist/src/engines/navigation-api-engine.d.ts.map +1 -0
  84. package/dist/src/engines/navigation-api-engine.js +411 -0
  85. package/dist/src/engines.d.ts +4 -0
  86. package/dist/src/engines.d.ts.map +1 -0
  87. package/dist/src/engines.js +1 -0
  88. package/dist/src/hooks/_use-singleton.d.ts +11 -0
  89. package/dist/src/hooks/_use-singleton.d.ts.map +1 -0
  90. package/dist/src/hooks/_use-singleton.js +26 -0
  91. package/dist/src/hooks/use-action-data.d.ts +17 -0
  92. package/dist/src/hooks/use-action-data.d.ts.map +1 -0
  93. package/dist/src/hooks/use-action-data.js +16 -0
  94. package/dist/src/hooks/use-form-action.d.ts +7 -0
  95. package/dist/src/hooks/use-form-action.d.ts.map +1 -0
  96. package/dist/src/hooks/use-form-action.js +9 -0
  97. package/dist/src/hooks/use-loader-data.d.ts +9 -0
  98. package/dist/src/hooks/use-loader-data.d.ts.map +1 -0
  99. package/dist/src/hooks/use-loader-data.js +20 -0
  100. package/dist/src/hooks/use-navigate.d.ts +53 -0
  101. package/dist/src/hooks/use-navigate.d.ts.map +1 -0
  102. package/dist/src/hooks/use-navigate.js +43 -0
  103. package/dist/{hooks → src/hooks}/use-params.d.ts +2 -2
  104. package/dist/src/hooks/use-params.d.ts.map +1 -0
  105. package/dist/{hooks → src/hooks}/use-params.js +1 -1
  106. package/dist/src/hooks/use-route-context.d.ts +10 -0
  107. package/dist/src/hooks/use-route-context.d.ts.map +1 -0
  108. package/dist/src/hooks/use-route-context.js +17 -0
  109. package/dist/src/hooks/use-router-context.d.ts +12 -0
  110. package/dist/src/hooks/use-router-context.d.ts.map +1 -0
  111. package/dist/src/hooks/use-router-context.js +20 -0
  112. package/dist/src/hooks/use-submit.d.ts +59 -0
  113. package/dist/src/hooks/use-submit.d.ts.map +1 -0
  114. package/dist/src/hooks/use-submit.js +38 -0
  115. package/dist/src/soseki.d.ts +31 -0
  116. package/dist/src/soseki.d.ts.map +1 -0
  117. package/dist/src/soseki.js +12 -0
  118. package/dist/src/utils/redirect.d.ts +11 -0
  119. package/dist/src/utils/redirect.d.ts.map +1 -0
  120. package/dist/src/utils/redirect.js +12 -0
  121. package/package.json +48 -30
  122. package/src/components/browser-router.tsx +8 -11
  123. package/src/components/outlet.tsx +3 -2
  124. package/src/components/router.tsx +139 -145
  125. package/src/contexts/route-context.ts +6 -5
  126. package/src/contexts/router-context.ts +36 -19
  127. package/src/core/_compare-route-paths.ts +48 -34
  128. package/src/core/_match-route-path.ts +21 -15
  129. package/src/core/_process-routes.ts +44 -46
  130. package/src/core/_singleton.ts +13 -38
  131. package/src/core/_unreachable.ts +12 -7
  132. package/src/core/_valibot.ts +19 -116
  133. package/src/core/errors.ts +150 -495
  134. package/src/core/expect-history-entry.ts +40 -41
  135. package/src/core/form-data-to-html-form-element.ts +37 -0
  136. package/src/core/history-entry-id-schema.ts +6 -11
  137. package/src/core/history-entry-url-schema.ts +25 -18
  138. package/src/core/init-loaders.ts +35 -57
  139. package/src/core/match-routes.ts +33 -65
  140. package/src/core/readonly-form-data.types.ts +48 -28
  141. package/src/core/readonly-url.types.ts +57 -28
  142. package/src/core/redirect-response.ts +26 -15
  143. package/src/core/route-path.ts +114 -0
  144. package/src/core/route-request.ts +144 -32
  145. package/src/core/route.types.ts +250 -226
  146. package/src/core/start-action.ts +164 -0
  147. package/src/core/start-loaders.ts +190 -212
  148. package/src/core.ts +8 -15
  149. package/src/engines/engine.types.ts +204 -166
  150. package/src/engines/navigation-api-engine.ts +332 -233
  151. package/src/engines.ts +4 -0
  152. package/src/hooks/_use-singleton.ts +30 -0
  153. package/src/hooks/use-action-data.ts +21 -26
  154. package/src/hooks/use-form-action.ts +4 -5
  155. package/src/hooks/use-loader-data.ts +16 -18
  156. package/src/hooks/use-navigate.ts +69 -28
  157. package/src/hooks/use-params.ts +4 -4
  158. package/src/hooks/use-route-context.ts +20 -0
  159. package/src/hooks/use-router-context.ts +25 -0
  160. package/src/hooks/use-submit.ts +48 -53
  161. package/src/soseki.ts +27 -34
  162. package/src/utils/redirect.ts +5 -5
  163. package/dist/components/action-id.d.ts +0 -19
  164. package/dist/components/action-id.d.ts.map +0 -1
  165. package/dist/components/action-id.jsx +0 -14
  166. package/dist/components/browser-router.d.ts +0 -17
  167. package/dist/components/browser-router.d.ts.map +0 -1
  168. package/dist/components/browser-router.jsx +0 -13
  169. package/dist/components/hidden-input.d.ts +0 -20
  170. package/dist/components/hidden-input.d.ts.map +0 -1
  171. package/dist/components/hidden-input.jsx +0 -8
  172. package/dist/components/outlet.d.ts +0 -8
  173. package/dist/components/outlet.d.ts.map +0 -1
  174. package/dist/components/outlet.jsx +0 -15
  175. package/dist/components/router.d.ts +0 -23
  176. package/dist/components/router.d.ts.map +0 -1
  177. package/dist/components/router.jsx +0 -128
  178. package/dist/contexts/route-context.d.ts +0 -19
  179. package/dist/contexts/route-context.d.ts.map +0 -1
  180. package/dist/contexts/route-context.js +0 -6
  181. package/dist/contexts/router-context.d.ts +0 -46
  182. package/dist/contexts/router-context.d.ts.map +0 -1
  183. package/dist/contexts/router-context.js +0 -8
  184. package/dist/core/_action-id-registry.d.ts +0 -10
  185. package/dist/core/_action-id-registry.d.ts.map +0 -1
  186. package/dist/core/_action-id-registry.js +0 -8
  187. package/dist/core/_capture-stack-trace.d.ts +0 -8
  188. package/dist/core/_capture-stack-trace.d.ts.map +0 -1
  189. package/dist/core/_capture-stack-trace.js +0 -12
  190. package/dist/core/_compare-route-paths.d.ts +0 -11
  191. package/dist/core/_compare-route-paths.d.ts.map +0 -1
  192. package/dist/core/_compare-route-paths.js +0 -80
  193. package/dist/core/_create-html-form-element-form-form-data.d.ts +0 -9
  194. package/dist/core/_create-html-form-element-form-form-data.d.ts.map +0 -1
  195. package/dist/core/_create-html-form-element-form-form-data.js +0 -27
  196. package/dist/core/_encode-pathname.d.ts +0 -10
  197. package/dist/core/_encode-pathname.d.ts.map +0 -1
  198. package/dist/core/_encode-pathname.js +0 -16
  199. package/dist/core/_is-error.d.ts +0 -3
  200. package/dist/core/_is-error.d.ts.map +0 -1
  201. package/dist/core/_is-error.js +0 -13
  202. package/dist/core/_is-promise-like.d.ts +0 -8
  203. package/dist/core/_is-promise-like.d.ts.map +0 -1
  204. package/dist/core/_is-promise-like.js +0 -12
  205. package/dist/core/_match-route-path.d.ts +0 -19
  206. package/dist/core/_match-route-path.d.ts.map +0 -1
  207. package/dist/core/_match-route-path.js +0 -22
  208. package/dist/core/_process-routes.d.ts +0 -9
  209. package/dist/core/_process-routes.d.ts.map +0 -1
  210. package/dist/core/_process-routes.js +0 -47
  211. package/dist/core/_singleton.d.ts +0 -18
  212. package/dist/core/_singleton.d.ts.map +0 -1
  213. package/dist/core/_singleton.js +0 -37
  214. package/dist/core/_unreachable.d.ts +0 -12
  215. package/dist/core/_unreachable.d.ts.map +0 -1
  216. package/dist/core/_unreachable.js +0 -8
  217. package/dist/core/_use-singleton.d.ts +0 -11
  218. package/dist/core/_use-singleton.d.ts.map +0 -1
  219. package/dist/core/_use-singleton.js +0 -21
  220. package/dist/core/_valibot.d.ts +0 -52
  221. package/dist/core/_valibot.d.ts.map +0 -1
  222. package/dist/core/_valibot.js +0 -107
  223. package/dist/core/_weak-id-registry.d.ts +0 -76
  224. package/dist/core/_weak-id-registry.d.ts.map +0 -1
  225. package/dist/core/_weak-id-registry.js +0 -67
  226. package/dist/core/constants.d.ts +0 -5
  227. package/dist/core/constants.d.ts.map +0 -1
  228. package/dist/core/constants.js +0 -4
  229. package/dist/core/data-map.types.d.ts +0 -23
  230. package/dist/core/data-map.types.d.ts.map +0 -1
  231. package/dist/core/data-map.types.js +0 -1
  232. package/dist/core/data-store.types.d.ts +0 -22
  233. package/dist/core/data-store.types.d.ts.map +0 -1
  234. package/dist/core/data-store.types.js +0 -1
  235. package/dist/core/deferred-promise.d.ts +0 -203
  236. package/dist/core/deferred-promise.d.ts.map +0 -1
  237. package/dist/core/deferred-promise.js +0 -200
  238. package/dist/core/errors.d.ts +0 -303
  239. package/dist/core/errors.d.ts.map +0 -1
  240. package/dist/core/errors.js +0 -400
  241. package/dist/core/expect-history-entry.d.ts +0 -52
  242. package/dist/core/expect-history-entry.d.ts.map +0 -1
  243. package/dist/core/expect-history-entry.js +0 -38
  244. package/dist/core/history-entry-id-schema.d.ts +0 -17
  245. package/dist/core/history-entry-id-schema.d.ts.map +0 -1
  246. package/dist/core/history-entry-id-schema.js +0 -9
  247. package/dist/core/history-entry-url-schema.d.ts +0 -20
  248. package/dist/core/history-entry-url-schema.d.ts.map +0 -1
  249. package/dist/core/history-entry-url-schema.js +0 -16
  250. package/dist/core/init-loaders.d.ts +0 -37
  251. package/dist/core/init-loaders.d.ts.map +0 -1
  252. package/dist/core/init-loaders.js +0 -38
  253. package/dist/core/match-routes.d.ts +0 -31
  254. package/dist/core/match-routes.d.ts.map +0 -1
  255. package/dist/core/match-routes.js +0 -54
  256. package/dist/core/readonly-form-data.types.d.ts +0 -32
  257. package/dist/core/readonly-form-data.types.d.ts.map +0 -1
  258. package/dist/core/readonly-url.types.d.ts +0 -135
  259. package/dist/core/readonly-url.types.d.ts.map +0 -1
  260. package/dist/core/redirect-response.d.ts +0 -29
  261. package/dist/core/redirect-response.d.ts.map +0 -1
  262. package/dist/core/redirect-response.js +0 -17
  263. package/dist/core/route-request.d.ts +0 -52
  264. package/dist/core/route-request.d.ts.map +0 -1
  265. package/dist/core/route-request.js +0 -26
  266. package/dist/core/route.types.d.ts +0 -309
  267. package/dist/core/route.types.d.ts.map +0 -1
  268. package/dist/core/start-actions.d.ts +0 -60
  269. package/dist/core/start-actions.d.ts.map +0 -1
  270. package/dist/core/start-actions.js +0 -186
  271. package/dist/core/start-loaders.d.ts +0 -69
  272. package/dist/core/start-loaders.d.ts.map +0 -1
  273. package/dist/core/start-loaders.js +0 -154
  274. package/dist/core.d.ts.map +0 -1
  275. package/dist/engines/engine.types.d.ts +0 -190
  276. package/dist/engines/engine.types.d.ts.map +0 -1
  277. package/dist/engines/navigation-api-engine.d.ts +0 -48
  278. package/dist/engines/navigation-api-engine.d.ts.map +0 -1
  279. package/dist/engines/navigation-api-engine.js +0 -332
  280. package/dist/hooks/_use-route-context.d.ts +0 -10
  281. package/dist/hooks/_use-route-context.d.ts.map +0 -1
  282. package/dist/hooks/_use-route-context.js +0 -17
  283. package/dist/hooks/_use-router-context.d.ts +0 -10
  284. package/dist/hooks/_use-router-context.d.ts.map +0 -1
  285. package/dist/hooks/_use-router-context.js +0 -18
  286. package/dist/hooks/use-action-data.d.ts +0 -23
  287. package/dist/hooks/use-action-data.d.ts.map +0 -1
  288. package/dist/hooks/use-action-data.js +0 -16
  289. package/dist/hooks/use-form-action.d.ts +0 -7
  290. package/dist/hooks/use-form-action.d.ts.map +0 -1
  291. package/dist/hooks/use-form-action.js +0 -10
  292. package/dist/hooks/use-loader-data.d.ts +0 -11
  293. package/dist/hooks/use-loader-data.d.ts.map +0 -1
  294. package/dist/hooks/use-loader-data.js +0 -19
  295. package/dist/hooks/use-navigate.d.ts +0 -39
  296. package/dist/hooks/use-navigate.d.ts.map +0 -1
  297. package/dist/hooks/use-navigate.js +0 -26
  298. package/dist/hooks/use-params.d.ts.map +0 -1
  299. package/dist/hooks/use-pathname.d.ts +0 -7
  300. package/dist/hooks/use-pathname.d.ts.map +0 -1
  301. package/dist/hooks/use-pathname.js +0 -9
  302. package/dist/hooks/use-submit.d.ts +0 -66
  303. package/dist/hooks/use-submit.d.ts.map +0 -1
  304. package/dist/hooks/use-submit.js +0 -35
  305. package/dist/soseki.d.ts +0 -42
  306. package/dist/soseki.d.ts.map +0 -1
  307. package/dist/soseki.js +0 -19
  308. package/dist/utils/get-action-id.d.ts +0 -8
  309. package/dist/utils/get-action-id.d.ts.map +0 -1
  310. package/dist/utils/get-action-id.js +0 -11
  311. package/dist/utils/href.d.ts +0 -11
  312. package/dist/utils/href.d.ts.map +0 -1
  313. package/dist/utils/href.js +0 -12
  314. package/dist/utils/redirect.d.ts +0 -11
  315. package/dist/utils/redirect.d.ts.map +0 -1
  316. package/dist/utils/redirect.js +0 -12
  317. package/dist/utils/route-index.d.ts +0 -41
  318. package/dist/utils/route-index.d.ts.map +0 -1
  319. package/dist/utils/route-index.js +0 -12
  320. package/dist/utils/route-route.d.ts +0 -62
  321. package/dist/utils/route-route.d.ts.map +0 -1
  322. package/dist/utils/route-route.js +0 -25
  323. package/dist/utils/set-action-id.d.ts +0 -9
  324. package/dist/utils/set-action-id.d.ts.map +0 -1
  325. package/dist/utils/set-action-id.js +0 -12
  326. package/src/components/action-id.tsx +0 -35
  327. package/src/components/hidden-input.tsx +0 -39
  328. package/src/core/_action-id-registry.ts +0 -11
  329. package/src/core/_capture-stack-trace.ts +0 -12
  330. package/src/core/_create-html-form-element-form-form-data.ts +0 -32
  331. package/src/core/_encode-pathname.ts +0 -17
  332. package/src/core/_is-error.ts +0 -16
  333. package/src/core/_is-promise-like.ts +0 -14
  334. package/src/core/_use-singleton.ts +0 -24
  335. package/src/core/_weak-id-registry.ts +0 -125
  336. package/src/core/constants.ts +0 -4
  337. package/src/core/data-map.types.ts +0 -28
  338. package/src/core/data-store.types.ts +0 -25
  339. package/src/core/deferred-promise.ts +0 -408
  340. package/src/core/start-actions.ts +0 -274
  341. package/src/hooks/_use-route-context.ts +0 -19
  342. package/src/hooks/_use-router-context.ts +0 -25
  343. package/src/hooks/use-pathname.ts +0 -10
  344. package/src/utils/get-action-id.ts +0 -12
  345. package/src/utils/href.ts +0 -17
  346. package/src/utils/route-index.ts +0 -70
  347. package/src/utils/route-route.ts +0 -111
  348. package/src/utils/set-action-id.ts +0 -14
  349. /package/dist/{core → src/core}/readonly-form-data.types.js +0 -0
  350. /package/dist/{core → src/core}/readonly-url.types.js +0 -0
  351. /package/dist/{core → src/core}/route.types.js +0 -0
  352. /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
- * 識別子、URL、および 0 以上の整数であるインデックスを持つオブジェクト構造を定義します。
10
- *
11
- * @returns 履歴エントリーのスキーマです。
9
+ * スキーマの構築処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
12
10
  */
13
- const HistoryEntrySchema = () => (singleton("HistoryEntrySchema", () => (
14
- v.object({
15
- id: HistoryEntryIdSchema(),
16
- url: v.nullable(HistoryEntryUrlSchema()),
17
- index: v.pipe(
18
- v.number(),
19
- v.safeInteger(),
20
- v.minValue(0),
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 = Readonly<v.InferInput<ReturnType<typeof HistoryEntrySchema>>>;
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
- * 履歴エントリーを一意に識別する ID です。
41
+ * 履歴エントリーの識別子です。
36
42
  */
37
43
  readonly id: HistoryEntryId;
38
44
 
39
45
  /**
40
- * 正規化済みの URL オブジェクトです。
46
+ * 履歴エントリーの絶対 URL です。
41
47
  */
42
48
  readonly url: HistoryEntryUrl;
43
49
 
44
50
  /**
45
- * 0 以上の整数で表される履歴のインデックスです。
51
+ * 履歴エントリーリスト内の履歴エントリーのインデックスです。
46
52
  */
47
53
  readonly index: number;
48
54
  };
49
55
 
50
56
  /**
51
- * 入力値が履歴エントリーの形式を満たしているか検証します。
57
+ * 履歴エントリーオブジェクトを検証し、仕様を満たしている場合に確定的な `HistoryEntry` 型へと変換します。
52
58
  *
53
- * @param entry 検証対象のオブジェクトです。
54
- * @returns バリデーション済み、かつ URL が存在する履歴エントリーです。
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 検証対象のオブジェクト、または null 系値です。
62
- * @returns 検証に成功した場合は履歴エントリーを、入力が null もしくは URL が欠損している場合は null を返します。
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
- id,
79
- url,
80
- index,
81
- } = v.expect(HistoryEntrySchema(), entry);
82
-
83
- // URL が nullable として定義されていますが、この関数では URL が存在することを必須とします。
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
- * 履歴エントリー ID のバリデーションスキーマを作成、または取得します。
5
+ * 履歴エントリーの識別子を検証およびブランド化するためのスキーマを作成する関数です。
6
6
  *
7
- * @returns 履歴エントリー ID のスキーマです。
7
+ * スキーマの生成処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
8
8
  */
9
- const HistoryEntryIdSchema = () => (singleton("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
- * 履歴エントリー ID として受け入れ可能な入力型の定義です(バリデーション前の文字列など)。
13
+ * `HistoryEntryIdSchema` による検証を通過する前の、入力値に対応する型定義です。
19
14
  */
20
15
  export type HistoryEntryIdLike = v.InferInput<ReturnType<typeof HistoryEntryIdSchema>>;
21
16
 
22
17
  /**
23
- * バリデーション済みでブランド化された、履歴エントリー ID の出力型の定義です。
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
- * 履歴エントリー URL のバリデーションおよび変換スキーマを作成、または取得します。
7
+ * 履歴エントリーで使用される URL 文字列を検証、正規化、およびブランド化するためのスキーマを作成する関数です。
7
8
  *
8
- * 文字列が有効な URL であるかを確認し、クエリーパラメーターをソートして正規化した `ReadonlyURL` オブジェクトを返します。
9
- *
10
- * @returns 履歴エントリー URL のスキーマです。
9
+ * スキーマの構築処理は一度だけ実行され、以降はシングルトンインスタンスとしてキャッシュから再利用されます。
11
10
  */
12
- const HistoryEntryUrlSchema = () => (singleton("HistoryEntryUrlSchema", () => (
13
- v.pipe(
14
- v.string(),
15
- v.url(),
16
- v.transform(function createNormalizedUrl(s): ReadonlyURL {
17
- const u = new URL(s);
18
- // 同一の URL として比較しやすくするため、クエリーパラメーターを昇順にソートします。
19
- u.searchParams.sort();
20
- return u;
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
- * 履歴エントリー URL として受け入れ可能な入力型の定義です(バリデーション前の文字列など)。
33
+ * `HistoryEntryUrlSchema` による検証と変換を行う前の、入力値に対応する型定義です。
27
34
  */
28
35
  export type HistoryEntryUrlLike = v.InferInput<ReturnType<typeof HistoryEntryUrlSchema>>;
29
36
 
30
37
  /**
31
- * バリデーションおよび正規化が行われた後の、履歴エントリー URL の出力型の定義です。
38
+ * `HistoryEntryUrlSchema` による検証、並び替え、および変換が正常に完了した、安全な出力値の型定義です。
32
39
  */
33
40
  export type HistoryEntryUrl = v.InferOutput<ReturnType<typeof HistoryEntryUrlSchema>>;
34
41
 
@@ -1,79 +1,57 @@
1
- import type { IDataMap } from "./data-map.types.js";
2
- import type { IDataStore } from "./data-store.types.js";
3
- import DeferredPromise from "./deferred-promise.js";
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 { ILoader } from "./route.types.js";
6
+ import type { LoaderFunction } from "./route.types.js";
8
7
 
9
8
  /**
10
- * ローダーの初期化に使用するパラメーターの型定義です。
9
+ * 各ローダー関数を初期化する際に必要となるリクエスト情報の型定義です。
11
10
  */
12
- export type InitLoadersParams = {
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 dataStore: IDataStore<ILoader>;
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
- * @returns すべてのローダーの処理が開始(Settled)されるまで待機する Promise です。
28
+ * @param routes 現在の URL にマッチしたルート情報の配列です。各ルートから `loader` 関数と解析済みの `params` のみを抽出して利用します。
29
+ * @param request 各ローダー関数を初期化する際に必要となるリクエスト情報です。
30
+ * @returns 各ローダー関数をキーとし、その実行結果または進行状態を表す `NinjaPromise` を値としたマップです。
41
31
  */
42
- export default function initLoaders(params: InitLoadersParams): {
43
- (): Promise<void>;
44
- } {
45
- const {
46
- entry,
47
- routes,
48
- signal,
49
- dataStore,
50
- } = params;
51
- const dataMap: IDataMap<ILoader> = new Map();
52
- const request = new RouteRequest("GET", entry.url, signal);
53
- // 各ルートおよびそのデータ関数に含まれるローダーを走査します。
54
- for (const route of routes) {
55
- for (const { loader } of route.dataFuncs) {
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
- const data = DeferredPromise.try(function executeLoader() {
62
- return loader({
63
- params: route.params,
64
- request,
65
- });
47
+ const data = NinjaPromise.try(function executeLoader() {
48
+ return loader({
49
+ params,
50
+ request: req,
66
51
  });
67
- // ローダーの結果を待機、エラーハンドリングする処理は、この結果を参照するコンポーネントに任せます。
68
- dataMap.set(loader, data);
69
- }
52
+ });
53
+ dataMap.set(loader, data);
70
54
  }
71
55
 
72
- // 生成されたデータマップを履歴エントリーの ID に紐付けて保存します。
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
  }
@@ -1,90 +1,58 @@
1
1
  import { inject } from "regexparam";
2
+
2
3
  import matchRoutePath from "./_match-route-path.js";
3
- import type { PathParams, Route } from "./route.types.js";
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 = Pick<Route, "path" | "index" | "dataFuncs" | "component"> & {
12
+ export type MatchedRoute = Route & {
9
13
  /**
10
- * パス名から抽出された動的なパラメーターのオブジェクトです。
14
+ * 現在の URL パスから抽出された、このルート固有の動的パスパラメーターです。
11
15
  */
12
- readonly params: PathParams;
16
+ readonly params: RoutePathParams;
13
17
 
14
18
  /**
15
- * ルートのパスパターンに基づく URL のパスです。
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
- * @param route マッチングを確認する対象のルートオブジェクトです。
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 pathname マッチング対象のパス名です。
77
- * @returns 最初にマッチしたルートとその階層構造を返し、どのルートにもマッチしない場合は `null` を返します。
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
- pathname: string,
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 matched = matchRoute(route, pathname);
85
- if (matched) {
86
- return matched;
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
- * **`ReadonlyFormData`** インターフェースは、フォームフィールドとその値のセットをキーと値のペアで構築する方法を提供します。
2
+ * フォームデータを読み取り専用で操作するためのインターフェースです。
3
3
  *
4
- * 構築したデータは、`fetch()`、`XMLHttpRequest.send()`、または `navigator.sendBeacon()` メソッドを使用して送信できます。
4
+ * データの追加、削除、更新といった変更処理を禁止し、データの参照や走査のみを許可する目的で使用します。
5
5
  *
6
6
  * [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData)
7
7
  */
8
8
  export interface ReadonlyFormData {
9
9
  /**
10
- * ReadonlyFormData インターフェースの **`get()`** メソッドは、`FormData` オブジェクト内にある指定したキーに関連付けられた最初の値を返します。
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
- * ReadonlyFormData インターフェースの **`getAll()`** メソッドは、`FormData` オブジェクト内にある指定したキーに関連付けられたすべての値を返します。
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
- * ReadonlyFormData インターフェースの **`has()`** メソッドは、`FormData` オブジェクトに特定のキーが含まれているかどうかを返します。
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
- * FormData オブジェクトに含まれるすべてのキーと値のペアに対して、指定されたコールバック関数を一度ずつ実行します。
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
- // * ReadonlyFormData インターフェースの **`entries()`** メソッドは、このオブジェクトに含まれるすべてのキーと値のペアを順に走査するためのイテレーターを返します。
40
- // *
41
- // * [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/entries)
42
- // */
43
- // entries(): IterableIterator<[string, FormDataEntryValue]>;
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
- // * ReadonlyFormData インターフェースの **`keys()`** メソッドは、このオブジェクトに含まれるすべてのキー(name)を順に走査するためのイテレーターを返します。
47
- // *
48
- // * [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/keys)
49
- // */
50
- // keys(): IterableIterator<string>;
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
- // * ReadonlyFormData インターフェースの **`values()`** メソッドは、このオブジェクトに含まれるすべての値を順に走査するためのイテレーターを返します。
54
- // *
55
- // * [MDN リファレンス](https://developer.mozilla.org/docs/Web/API/FormData/values)
56
- // */
57
- // values(): IterableIterator<FormDataEntryValue>;
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
- // * FormData オブジェクトのデフォルトのイテレーターです。これにより `for...of` ループで直接 `entries()` と同様の挙動(キーと値のペアの取得)が可能になります。
61
- // */
62
- // [Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
77
+ /**
78
+ * オブジェクトの既定の反復子を定義します。 `for...of` 構文などで直接オブジェクトを走査することを可能にします。
79
+ *
80
+ * @returns `entries` メソッドと同様に、キーと値のペアを要素とする `IterableIterator` オブジェクトです。
81
+ */
82
+ [Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
63
83
  }