intor 2.5.0 → 2.5.1

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 (294) hide show
  1. package/dist/core/src/client/shared/helpers/get-client-locale.js +5 -20
  2. package/dist/core/src/client/shared/utils/locale/detect-browser-locale.js +2 -8
  3. package/dist/core/src/client/shared/utils/locale/get-locale-from-cookie.js +5 -12
  4. package/dist/core/src/config/constants/cookie.js +9 -9
  5. package/dist/core/src/config/constants/routing.js +13 -14
  6. package/dist/core/src/config/define-intor-config.js +28 -44
  7. package/dist/core/src/config/resolvers/resolve-cookie-options.js +4 -4
  8. package/dist/core/src/config/resolvers/resolve-fallback-locales.js +33 -50
  9. package/dist/core/src/config/resolvers/resolve-routing-options.js +32 -61
  10. package/dist/core/src/config/validators/validate-default-locale.js +8 -13
  11. package/dist/core/src/config/validators/validate-id.js +8 -13
  12. package/dist/core/src/config/validators/validate-supported-locales.js +8 -13
  13. package/dist/core/src/core/constants/locale-placeholder.js +0 -1
  14. package/dist/core/src/core/error/intor-error.js +14 -29
  15. package/dist/core/src/core/locale/canonicalize-locale.js +7 -18
  16. package/dist/core/src/core/locale/match-locale.js +24 -50
  17. package/dist/core/src/core/locale/parse-locale.js +12 -22
  18. package/dist/core/src/core/logger/get-logger.js +26 -31
  19. package/dist/core/src/core/logger/global-logger-pool.js +4 -4
  20. package/dist/core/src/core/messages/internal-metadata.js +1 -1
  21. package/dist/core/src/core/messages/load-remote-messages/collect-remote-resources.js +13 -22
  22. package/dist/core/src/core/messages/load-remote-messages/fetch-remote-resource.js +30 -39
  23. package/dist/core/src/core/messages/load-remote-messages/load-remote-messages.js +72 -89
  24. package/dist/core/src/core/messages/load-remote-messages/resolve-remote-resources.js +7 -17
  25. package/dist/core/src/core/messages/merge-messages.js +17 -28
  26. package/dist/core/src/core/messages/utils/is-valid-messages.js +22 -37
  27. package/dist/core/src/core/messages/utils/nest-object-from-path.js +5 -17
  28. package/dist/core/src/core/render/create-html-renderer.js +29 -37
  29. package/dist/core/src/core/render/utils/escape-html.js +1 -6
  30. package/dist/core/src/core/render/utils/render-attributes.js +6 -11
  31. package/dist/core/src/core/translator/create-t-rich.js +6 -15
  32. package/dist/core/src/core/translator/create-translator.js +16 -24
  33. package/dist/core/src/core/utils/deep-merge.js +24 -42
  34. package/dist/core/src/core/utils/normalizers/normalize-cache-key.js +14 -40
  35. package/dist/core/src/core/utils/normalizers/normalize-pathname.js +19 -37
  36. package/dist/core/src/core/utils/normalizers/normalize-query.js +6 -20
  37. package/dist/core/src/core/utils/parse-cookie-header.js +11 -18
  38. package/dist/core/src/core/utils/resolve-loader-options.js +6 -32
  39. package/dist/core/src/edge/helpers/get-translator.js +14 -20
  40. package/dist/core/src/edge/translator/init-translator.js +23 -31
  41. package/dist/core/src/routing/inbound/helpers/resolve-inbound-from-request.js +21 -28
  42. package/dist/core/src/routing/inbound/resolve-inbound.js +22 -37
  43. package/dist/core/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  44. package/dist/core/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  45. package/dist/core/src/routing/inbound/resolve-pathname/strategies/all.js +10 -23
  46. package/dist/core/src/routing/inbound/resolve-pathname/strategies/except-default.js +11 -24
  47. package/dist/core/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  48. package/dist/core/src/routing/locale/get-locale-from-accept-language.js +21 -36
  49. package/dist/core/src/routing/locale/get-locale-from-host.js +5 -28
  50. package/dist/core/src/routing/locale/get-locale-from-pathname.js +11 -37
  51. package/dist/core/src/routing/locale/get-locale-from-query.js +2 -17
  52. package/dist/core/src/routing/pathname/canonicalize-pathname.js +25 -67
  53. package/dist/core/src/routing/pathname/localize-pathname.js +12 -30
  54. package/dist/core/src/routing/pathname/materialize-pathname.js +9 -44
  55. package/dist/core/src/routing/pathname/standardize-pathname.js +6 -30
  56. package/dist/core/src/server/helpers/get-translator.js +26 -23
  57. package/dist/core/src/server/intor/intor.js +20 -25
  58. package/dist/core/src/server/messages/load-local-messages/cache/messages-pool.js +4 -7
  59. package/dist/core/src/server/messages/load-local-messages/load-local-messages.js +76 -92
  60. package/dist/core/src/server/messages/load-local-messages/read-locale-messages/collect-file-entries/collect-file-entries.js +59 -80
  61. package/dist/core/src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/parse-file-entries.js +53 -87
  62. package/dist/core/src/server/messages/load-local-messages/read-locale-messages/parse-file-entries/utils/json-reader.js +3 -6
  63. package/dist/core/src/server/messages/load-local-messages/read-locale-messages/read-locale-messages.js +23 -35
  64. package/dist/core/src/server/messages/load-messages.js +56 -69
  65. package/dist/core/src/server/translator/init-translator.js +28 -30
  66. package/dist/express/src/adapters/express/create-intor-handler.js +35 -46
  67. package/dist/express/src/adapters/express/get-translator.js +2 -9
  68. package/dist/express/src/core/constants/locale-placeholder.js +0 -1
  69. package/dist/express/src/core/locale/canonicalize-locale.js +7 -18
  70. package/dist/express/src/core/locale/match-locale.js +24 -50
  71. package/dist/express/src/core/locale/parse-locale.js +12 -22
  72. package/dist/express/src/core/utils/normalizers/normalize-pathname.js +19 -37
  73. package/dist/express/src/core/utils/normalizers/normalize-query.js +6 -20
  74. package/dist/express/src/core/utils/parse-cookie-header.js +11 -18
  75. package/dist/express/src/routing/inbound/resolve-inbound.js +22 -37
  76. package/dist/express/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  77. package/dist/express/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  78. package/dist/express/src/routing/inbound/resolve-pathname/strategies/all.js +10 -23
  79. package/dist/express/src/routing/inbound/resolve-pathname/strategies/except-default.js +11 -24
  80. package/dist/express/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  81. package/dist/express/src/routing/locale/get-locale-from-accept-language.js +21 -36
  82. package/dist/express/src/routing/locale/get-locale-from-host.js +5 -28
  83. package/dist/express/src/routing/locale/get-locale-from-pathname.js +11 -37
  84. package/dist/express/src/routing/locale/get-locale-from-query.js +2 -17
  85. package/dist/express/src/routing/pathname/canonicalize-pathname.js +25 -67
  86. package/dist/express/src/routing/pathname/localize-pathname.js +12 -30
  87. package/dist/express/src/routing/pathname/materialize-pathname.js +9 -44
  88. package/dist/express/src/routing/pathname/standardize-pathname.js +6 -30
  89. package/dist/fastify/src/adapters/fastify/create-intor-handler.js +35 -47
  90. package/dist/fastify/src/adapters/fastify/get-translator.js +2 -9
  91. package/dist/fastify/src/adapters/fastify/intor-fastify-plugin.js +29 -38
  92. package/dist/fastify/src/core/constants/locale-placeholder.js +0 -1
  93. package/dist/fastify/src/core/locale/canonicalize-locale.js +7 -18
  94. package/dist/fastify/src/core/locale/match-locale.js +24 -50
  95. package/dist/fastify/src/core/locale/parse-locale.js +12 -22
  96. package/dist/fastify/src/core/utils/normalizers/normalize-pathname.js +19 -37
  97. package/dist/fastify/src/core/utils/normalizers/normalize-query.js +6 -20
  98. package/dist/fastify/src/core/utils/parse-cookie-header.js +11 -18
  99. package/dist/fastify/src/routing/inbound/resolve-inbound.js +22 -37
  100. package/dist/fastify/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  101. package/dist/fastify/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  102. package/dist/fastify/src/routing/inbound/resolve-pathname/strategies/all.js +10 -23
  103. package/dist/fastify/src/routing/inbound/resolve-pathname/strategies/except-default.js +11 -24
  104. package/dist/fastify/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  105. package/dist/fastify/src/routing/locale/get-locale-from-accept-language.js +21 -36
  106. package/dist/fastify/src/routing/locale/get-locale-from-host.js +5 -28
  107. package/dist/fastify/src/routing/locale/get-locale-from-pathname.js +11 -37
  108. package/dist/fastify/src/routing/locale/get-locale-from-query.js +2 -17
  109. package/dist/fastify/src/routing/pathname/canonicalize-pathname.js +25 -67
  110. package/dist/fastify/src/routing/pathname/localize-pathname.js +12 -30
  111. package/dist/fastify/src/routing/pathname/materialize-pathname.js +9 -44
  112. package/dist/fastify/src/routing/pathname/standardize-pathname.js +6 -30
  113. package/dist/hono/src/adapters/hono/create-intor-handler.js +33 -44
  114. package/dist/hono/src/adapters/hono/get-translator.js +2 -9
  115. package/dist/hono/src/core/constants/locale-placeholder.js +0 -1
  116. package/dist/hono/src/core/locale/canonicalize-locale.js +7 -18
  117. package/dist/hono/src/core/locale/match-locale.js +24 -50
  118. package/dist/hono/src/core/locale/parse-locale.js +12 -22
  119. package/dist/hono/src/core/utils/normalizers/normalize-pathname.js +19 -37
  120. package/dist/hono/src/core/utils/normalizers/normalize-query.js +6 -20
  121. package/dist/hono/src/core/utils/parse-cookie-header.js +11 -18
  122. package/dist/hono/src/routing/inbound/resolve-inbound.js +22 -37
  123. package/dist/hono/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  124. package/dist/hono/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  125. package/dist/hono/src/routing/inbound/resolve-pathname/strategies/all.js +10 -23
  126. package/dist/hono/src/routing/inbound/resolve-pathname/strategies/except-default.js +11 -24
  127. package/dist/hono/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  128. package/dist/hono/src/routing/locale/get-locale-from-accept-language.js +21 -36
  129. package/dist/hono/src/routing/locale/get-locale-from-host.js +5 -28
  130. package/dist/hono/src/routing/locale/get-locale-from-pathname.js +11 -37
  131. package/dist/hono/src/routing/locale/get-locale-from-query.js +2 -17
  132. package/dist/hono/src/routing/pathname/canonicalize-pathname.js +25 -67
  133. package/dist/hono/src/routing/pathname/localize-pathname.js +12 -30
  134. package/dist/hono/src/routing/pathname/materialize-pathname.js +9 -44
  135. package/dist/hono/src/routing/pathname/standardize-pathname.js +6 -30
  136. package/dist/next/src/adapters/next/create-intor-handler.js +29 -47
  137. package/dist/next/src/adapters/next/link.js +33 -28
  138. package/dist/next/src/adapters/next/redirect.js +12 -15
  139. package/dist/next/src/adapters/next/server/get-locale.js +12 -23
  140. package/dist/next/src/adapters/next/server/get-translator.js +2 -9
  141. package/dist/next/src/adapters/next/server/intor.js +5 -13
  142. package/dist/next/src/adapters/next/use-router.js +47 -66
  143. package/dist/next/src/client/shared/navigation/execute-navigation.js +20 -38
  144. package/dist/next/src/client/shared/utils/build-cookie-string.js +18 -27
  145. package/dist/next/src/client/shared/utils/locale/set-locale-cookie.js +2 -9
  146. package/dist/next/src/core/constants/headers.js +4 -4
  147. package/dist/next/src/core/constants/locale-placeholder.js +0 -1
  148. package/dist/next/src/core/locale/canonicalize-locale.js +7 -18
  149. package/dist/next/src/core/locale/match-locale.js +24 -50
  150. package/dist/next/src/core/locale/parse-locale.js +12 -22
  151. package/dist/next/src/core/utils/normalizers/normalize-pathname.js +19 -37
  152. package/dist/next/src/core/utils/normalizers/normalize-query.js +6 -20
  153. package/dist/next/src/core/utils/resolve-loader-options.js +6 -29
  154. package/dist/next/src/policies/shoud-full-reload.js +2 -5
  155. package/dist/next/src/policies/should-sync-locale.js +1 -4
  156. package/dist/next/src/routing/inbound/resolve-inbound.js +24 -39
  157. package/dist/next/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  158. package/dist/next/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  159. package/dist/next/src/routing/inbound/resolve-pathname/strategies/all.js +13 -29
  160. package/dist/next/src/routing/inbound/resolve-pathname/strategies/except-default.js +14 -30
  161. package/dist/next/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  162. package/dist/next/src/routing/locale/get-locale-from-accept-language.js +21 -36
  163. package/dist/next/src/routing/locale/get-locale-from-host.js +5 -28
  164. package/dist/next/src/routing/locale/get-locale-from-pathname.js +11 -37
  165. package/dist/next/src/routing/locale/get-locale-from-query.js +2 -17
  166. package/dist/next/src/routing/outbound/decide-strategy.js +9 -9
  167. package/dist/next/src/routing/outbound/determine-target.js +28 -44
  168. package/dist/next/src/routing/outbound/resolve-outbound.js +12 -16
  169. package/dist/next/src/routing/outbound/utils/derive-host-destination.js +5 -9
  170. package/dist/next/src/routing/outbound/utils/derive-query-destination.js +4 -7
  171. package/dist/next/src/routing/outbound/utils/is-external-destination.js +1 -7
  172. package/dist/next/src/routing/pathname/canonicalize-pathname.js +25 -67
  173. package/dist/next/src/routing/pathname/localize-pathname.js +12 -30
  174. package/dist/next/src/routing/pathname/materialize-pathname.js +9 -44
  175. package/dist/next/src/routing/pathname/standardize-pathname.js +6 -30
  176. package/dist/react/src/client/react/helpers/use-intor.js +25 -44
  177. package/dist/react/src/client/react/provider/effects/use-locale-effects.js +20 -25
  178. package/dist/react/src/client/react/provider/effects/use-messages-effects.js +17 -16
  179. package/dist/react/src/client/react/provider/intor-provider.js +63 -66
  180. package/dist/react/src/client/react/provider/use-intor-context.js +4 -4
  181. package/dist/react/src/client/react/render/create-react-renderer.js +18 -24
  182. package/dist/react/src/client/react/translator/create-t-rich.js +9 -22
  183. package/dist/react/src/client/react/translator/use-translator.js +11 -16
  184. package/dist/react/src/client/shared/messages/create-refetch-messages.js +41 -51
  185. package/dist/react/src/client/shared/provider/effective-state.js +2 -6
  186. package/dist/react/src/client/shared/utils/build-cookie-string.js +18 -27
  187. package/dist/react/src/client/shared/utils/locale/get-locale-from-cookie.js +5 -12
  188. package/dist/react/src/client/shared/utils/locale/set-document-locale.js +2 -8
  189. package/dist/react/src/client/shared/utils/locale/set-locale-cookie.js +2 -9
  190. package/dist/react/src/core/logger/get-logger.js +26 -31
  191. package/dist/react/src/core/logger/global-logger-pool.js +4 -4
  192. package/dist/react/src/core/messages/load-remote-messages/collect-remote-resources.js +13 -22
  193. package/dist/react/src/core/messages/load-remote-messages/fetch-remote-resource.js +30 -39
  194. package/dist/react/src/core/messages/load-remote-messages/load-remote-messages.js +72 -89
  195. package/dist/react/src/core/messages/load-remote-messages/resolve-remote-resources.js +7 -17
  196. package/dist/react/src/core/messages/merge-messages.js +17 -28
  197. package/dist/react/src/core/messages/utils/is-valid-messages.js +22 -37
  198. package/dist/react/src/core/messages/utils/nest-object-from-path.js +5 -17
  199. package/dist/react/src/core/utils/deep-merge.js +24 -42
  200. package/dist/react/src/core/utils/resolve-loader-options.js +6 -29
  201. package/dist/react/src/policies/should-persist-on-first-visit.js +1 -4
  202. package/dist/svelte/export/svelte/index.js +0 -6
  203. package/dist/svelte/src/client/shared/messages/create-refetch-messages.js +41 -51
  204. package/dist/svelte/src/client/shared/provider/effective-state.js +2 -6
  205. package/dist/svelte/src/client/shared/utils/build-cookie-string.js +18 -27
  206. package/dist/svelte/src/client/shared/utils/locale/get-locale-from-cookie.js +5 -12
  207. package/dist/svelte/src/client/shared/utils/locale/set-document-locale.js +2 -8
  208. package/dist/svelte/src/client/shared/utils/locale/set-locale-cookie.js +2 -9
  209. package/dist/svelte/src/client/svelte/provider/create-intor-store.js +59 -63
  210. package/dist/svelte/src/client/svelte/provider/effects/attach-locale-effects.js +20 -25
  211. package/dist/svelte/src/client/svelte/provider/effects/attach-messages-effects.js +21 -18
  212. package/dist/svelte/src/client/svelte/provider/get-intor-context.js +4 -4
  213. package/dist/svelte/src/client/svelte/translator/use-translator.js +11 -16
  214. package/dist/svelte/src/core/logger/get-logger.js +26 -31
  215. package/dist/svelte/src/core/logger/global-logger-pool.js +4 -4
  216. package/dist/svelte/src/core/messages/load-remote-messages/collect-remote-resources.js +13 -22
  217. package/dist/svelte/src/core/messages/load-remote-messages/fetch-remote-resource.js +30 -39
  218. package/dist/svelte/src/core/messages/load-remote-messages/load-remote-messages.js +72 -89
  219. package/dist/svelte/src/core/messages/load-remote-messages/resolve-remote-resources.js +7 -17
  220. package/dist/svelte/src/core/messages/merge-messages.js +17 -28
  221. package/dist/svelte/src/core/messages/utils/is-valid-messages.js +22 -37
  222. package/dist/svelte/src/core/messages/utils/nest-object-from-path.js +5 -17
  223. package/dist/svelte/src/core/render/create-html-renderer.js +29 -37
  224. package/dist/svelte/src/core/render/utils/escape-html.js +1 -6
  225. package/dist/svelte/src/core/render/utils/render-attributes.js +6 -11
  226. package/dist/svelte/src/core/translator/create-t-rich.js +6 -15
  227. package/dist/svelte/src/core/utils/deep-merge.js +24 -42
  228. package/dist/svelte/src/core/utils/resolve-loader-options.js +6 -29
  229. package/dist/svelte/src/policies/should-persist-on-first-visit.js +1 -4
  230. package/dist/svelte-kit/src/adapters/svelte-kit/create-intor-handler.js +37 -57
  231. package/dist/svelte-kit/src/adapters/svelte-kit/use-navigation.js +29 -27
  232. package/dist/svelte-kit/src/adapters/svelte-kit/utils/is-svelte-kit-ssg.js +4 -11
  233. package/dist/svelte-kit/src/client/shared/navigation/execute-navigation.js +19 -37
  234. package/dist/svelte-kit/src/client/shared/utils/build-cookie-string.js +18 -27
  235. package/dist/svelte-kit/src/client/shared/utils/locale/set-locale-cookie.js +2 -9
  236. package/dist/svelte-kit/src/core/constants/locale-placeholder.js +0 -1
  237. package/dist/svelte-kit/src/core/locale/canonicalize-locale.js +7 -18
  238. package/dist/svelte-kit/src/core/locale/match-locale.js +24 -50
  239. package/dist/svelte-kit/src/core/locale/parse-locale.js +12 -22
  240. package/dist/svelte-kit/src/core/utils/normalizers/normalize-pathname.js +19 -37
  241. package/dist/svelte-kit/src/core/utils/normalizers/normalize-query.js +6 -20
  242. package/dist/svelte-kit/src/core/utils/resolve-loader-options.js +6 -29
  243. package/dist/svelte-kit/src/policies/shoud-full-reload.js +2 -5
  244. package/dist/svelte-kit/src/policies/should-sync-locale.js +1 -4
  245. package/dist/svelte-kit/src/routing/inbound/resolve-inbound.js +22 -37
  246. package/dist/svelte-kit/src/routing/inbound/resolve-locale/resolve-locale.js +22 -39
  247. package/dist/svelte-kit/src/routing/inbound/resolve-pathname/resolve-pathname.js +24 -30
  248. package/dist/svelte-kit/src/routing/inbound/resolve-pathname/strategies/all.js +10 -23
  249. package/dist/svelte-kit/src/routing/inbound/resolve-pathname/strategies/except-default.js +11 -24
  250. package/dist/svelte-kit/src/routing/inbound/resolve-pathname/strategies/none.js +1 -4
  251. package/dist/svelte-kit/src/routing/locale/get-locale-from-accept-language.js +21 -36
  252. package/dist/svelte-kit/src/routing/locale/get-locale-from-host.js +5 -28
  253. package/dist/svelte-kit/src/routing/locale/get-locale-from-pathname.js +11 -37
  254. package/dist/svelte-kit/src/routing/locale/get-locale-from-query.js +2 -17
  255. package/dist/svelte-kit/src/routing/outbound/decide-strategy.js +9 -9
  256. package/dist/svelte-kit/src/routing/outbound/determine-target.js +28 -44
  257. package/dist/svelte-kit/src/routing/outbound/resolve-outbound.js +12 -16
  258. package/dist/svelte-kit/src/routing/outbound/utils/derive-host-destination.js +5 -9
  259. package/dist/svelte-kit/src/routing/outbound/utils/derive-query-destination.js +4 -7
  260. package/dist/svelte-kit/src/routing/outbound/utils/is-external-destination.js +1 -7
  261. package/dist/svelte-kit/src/routing/pathname/canonicalize-pathname.js +25 -67
  262. package/dist/svelte-kit/src/routing/pathname/localize-pathname.js +12 -30
  263. package/dist/svelte-kit/src/routing/pathname/materialize-pathname.js +9 -44
  264. package/dist/svelte-kit/src/routing/pathname/standardize-pathname.js +6 -30
  265. package/dist/types/src/routing/outbound/decide-strategy.d.ts +1 -1
  266. package/dist/types/src/routing/outbound/decide-strategy.d.ts.map +1 -1
  267. package/dist/vue/src/client/shared/messages/create-refetch-messages.js +41 -51
  268. package/dist/vue/src/client/shared/provider/effective-state.js +2 -6
  269. package/dist/vue/src/client/shared/utils/build-cookie-string.js +18 -27
  270. package/dist/vue/src/client/shared/utils/locale/get-locale-from-cookie.js +5 -12
  271. package/dist/vue/src/client/shared/utils/locale/set-document-locale.js +2 -8
  272. package/dist/vue/src/client/shared/utils/locale/set-locale-cookie.js +2 -9
  273. package/dist/vue/src/client/vue/helpers/use-intor.js +20 -42
  274. package/dist/vue/src/client/vue/provider/effects/use-locale-effects.js +23 -24
  275. package/dist/vue/src/client/vue/provider/effects/use-messages-effects.js +15 -24
  276. package/dist/vue/src/client/vue/provider/inject-intor-context.js +4 -4
  277. package/dist/vue/src/client/vue/provider/intor-provider.js +61 -66
  278. package/dist/vue/src/client/vue/render/create-vue-renderer.js +18 -24
  279. package/dist/vue/src/client/vue/translator/create-t-rich.js +5 -17
  280. package/dist/vue/src/client/vue/translator/trans.js +24 -31
  281. package/dist/vue/src/client/vue/translator/use-translator.js +12 -17
  282. package/dist/vue/src/core/logger/get-logger.js +26 -31
  283. package/dist/vue/src/core/logger/global-logger-pool.js +4 -4
  284. package/dist/vue/src/core/messages/load-remote-messages/collect-remote-resources.js +13 -22
  285. package/dist/vue/src/core/messages/load-remote-messages/fetch-remote-resource.js +30 -39
  286. package/dist/vue/src/core/messages/load-remote-messages/load-remote-messages.js +72 -89
  287. package/dist/vue/src/core/messages/load-remote-messages/resolve-remote-resources.js +7 -17
  288. package/dist/vue/src/core/messages/merge-messages.js +17 -28
  289. package/dist/vue/src/core/messages/utils/is-valid-messages.js +22 -37
  290. package/dist/vue/src/core/messages/utils/nest-object-from-path.js +5 -17
  291. package/dist/vue/src/core/utils/deep-merge.js +24 -42
  292. package/dist/vue/src/core/utils/resolve-loader-options.js +6 -29
  293. package/dist/vue/src/policies/should-persist-on-first-visit.js +1 -4
  294. package/package.json +2 -2
@@ -3,37 +3,13 @@ import 'logry';
3
3
  import 'p-limit';
4
4
  import 'intor-translator';
5
5
 
6
- /**
7
- * Standardizes a canonical pathname into an internal routing template.
8
- *
9
- * Standardized representation:
10
- * - Prepends the deployment prefix (`basePath`) if defined
11
- * - Injects the `{locale}` placeholder as the first path segment
12
- * - Preserves the canonical pathname structure
13
- *
14
- * Input must be a canonical pathname.
15
- *
16
- * Output is an internal routing template and
17
- * is not a locale-resolved URL.
18
- *
19
- * @example
20
- * ```ts
21
- * // config.routing.basePath: "/app",
22
- * standardizePathname("/about", config);
23
- * // => "/app/{locale}/about"
24
- * ```
25
- */
26
6
  const standardizePathname = (canonicalPathname, config) => {
27
- const { routing } = config;
28
- const basePath = routing.basePath && routing.basePath !== "/" ? routing.basePath : "";
29
- if (canonicalPathname === "/") {
30
- return basePath
31
- ? `${basePath}/${LOCALE_PLACEHOLDER}`
32
- : `/${LOCALE_PLACEHOLDER}`;
33
- }
34
- return basePath
35
- ? `${basePath}/${LOCALE_PLACEHOLDER}${canonicalPathname}`
36
- : `/${LOCALE_PLACEHOLDER}${canonicalPathname}`;
7
+ const { routing } = config;
8
+ const basePath = routing.basePath && routing.basePath !== "/" ? routing.basePath : "";
9
+ if (canonicalPathname === "/") {
10
+ return basePath ? `${basePath}/${LOCALE_PLACEHOLDER}` : `/${LOCALE_PLACEHOLDER}`;
11
+ }
12
+ return basePath ? `${basePath}/${LOCALE_PLACEHOLDER}${canonicalPathname}` : `/${LOCALE_PLACEHOLDER}${canonicalPathname}`;
37
13
  };
38
14
 
39
15
  export { standardizePathname };
@@ -4,5 +4,5 @@ export type OutboundStrategy = "external" | "client" | "reload";
4
4
  /**
5
5
  * Decide how a resolved navigation target should be executed.
6
6
  */
7
- export declare function decideStrategy(config: IntorResolvedConfig, target: OutboundTarget): OutboundStrategy;
7
+ export declare function decideStrategy(config: IntorResolvedConfig, target: OutboundTarget, currentLocale: string): OutboundStrategy;
8
8
  //# sourceMappingURL=decide-strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decide-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/routing/outbound/decide-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,cAAc,GACrB,gBAAgB,CAOlB"}
1
+ {"version":3,"file":"decide-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/routing/outbound/decide-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB,gBAAgB,CAalB"}
@@ -4,57 +4,47 @@ import { loadRemoteMessages } from '../../../core/messages/load-remote-messages/
4
4
  import { mergeMessages } from '../../../core/messages/merge-messages.js';
5
5
  import 'intor-translator';
6
6
 
7
- /**
8
- * Creates a framework-agnostic message refetcher.
9
- *
10
- * - At most one remote request is active at any time
11
- * - Previous in-flight requests are aborted on subsequent calls
12
- * - State updates are applied only for the latest, non-aborted request
13
- */
14
- const createRefetchMessages = ({ config, onLoadingStart, onLoadingEnd, onMessages, }) => {
15
- // Tracks the currently active remote request for this refetcher instance
16
- let controller = null;
17
- return async function refetchMessages(newLocale) {
18
- // No-op when remote loading is not enabled
19
- const loader = resolveLoaderOptions(config);
20
- if (!loader || loader.mode !== "remote")
21
- return;
22
- const { namespaces, concurrency, url, headers } = loader;
23
- // Abort previous request
24
- controller?.abort();
25
- const currentController = new AbortController();
26
- controller = currentController;
27
- onLoadingStart?.();
28
- try {
29
- const loadedMessages = await loadRemoteMessages({
30
- locale: newLocale,
31
- fallbackLocales: config.fallbackLocales[newLocale] || [],
32
- ...(namespaces !== undefined ? { namespaces } : {}),
33
- ...(concurrency !== undefined ? { concurrency } : {}),
34
- fetch: globalThis.fetch,
35
- url,
36
- ...(headers !== undefined ? { headers } : {}),
37
- signal: currentController.signal,
38
- loggerOptions: config.logger,
39
- });
40
- // Apply state updates only when this request is still the active one
41
- // and has not been aborted.
42
- if (controller === currentController &&
43
- !currentController.signal.aborted) {
44
- onMessages?.(mergeMessages(config.messages, loadedMessages, {
45
- config,
46
- locale: newLocale,
47
- }));
48
- }
49
- }
50
- finally {
51
- // Clear loading state only if this request is still the active one
52
- if (controller === currentController &&
53
- !currentController.signal.aborted) {
54
- onLoadingEnd?.();
55
- }
56
- }
57
- };
7
+ const createRefetchMessages = ({
8
+ config,
9
+ onLoadingStart,
10
+ onLoadingEnd,
11
+ onMessages
12
+ }) => {
13
+ let controller = null;
14
+ return async function refetchMessages(newLocale) {
15
+ const loader = resolveLoaderOptions(config);
16
+ if (!loader || loader.mode !== "remote") return;
17
+ const { namespaces, concurrency, url, headers } = loader;
18
+ controller?.abort();
19
+ const currentController = new AbortController();
20
+ controller = currentController;
21
+ onLoadingStart?.();
22
+ try {
23
+ const loadedMessages = await loadRemoteMessages({
24
+ locale: newLocale,
25
+ fallbackLocales: config.fallbackLocales[newLocale] || [],
26
+ ...namespaces !== void 0 ? { namespaces } : {},
27
+ ...concurrency !== void 0 ? { concurrency } : {},
28
+ fetch: globalThis.fetch,
29
+ url,
30
+ ...headers !== void 0 ? { headers } : {},
31
+ signal: currentController.signal,
32
+ loggerOptions: config.logger
33
+ });
34
+ if (controller === currentController && !currentController.signal.aborted) {
35
+ onMessages?.(
36
+ mergeMessages(config.messages, loadedMessages, {
37
+ config,
38
+ locale: newLocale
39
+ })
40
+ );
41
+ }
42
+ } finally {
43
+ if (controller === currentController && !currentController.signal.aborted) {
44
+ onLoadingEnd?.();
45
+ }
46
+ }
47
+ };
58
48
  };
59
49
 
60
50
  export { createRefetchMessages };
@@ -1,12 +1,8 @@
1
- // runtime > external > config
2
- // Always resolves to a non-null message object.
3
1
  function resolveEffectiveMessages(runtime, external, configMessages) {
4
- return runtime ?? external ?? configMessages ?? {};
2
+ return runtime ?? external ?? configMessages ?? {};
5
3
  }
6
- // external > internal
7
- // Loading is active if either source is truthy
8
4
  function resolveEffectiveIsLoading(external, internal) {
9
- return !!external || internal;
5
+ return !!external || internal;
10
6
  }
11
7
 
12
8
  export { resolveEffectiveIsLoading, resolveEffectiveMessages };
@@ -1,31 +1,22 @@
1
- /**
2
- * Build a serialized cookie string.
3
- */
4
1
  const buildCookieString = (cookieOptions, value) => {
5
- const { name, maxAge, path, domain, sameSite, secure } = cookieOptions;
6
- // Cookie name and encoded value
7
- const parts = [`${name}=${encodeURIComponent(value)}`];
8
- // Add expiration and max-age if provided
9
- if (maxAge !== undefined) {
10
- const expires = new Date(Date.now() + maxAge * 1000).toUTCString();
11
- parts.push(`expires=${expires}`, `max-age=${maxAge}`);
12
- }
13
- // Set path (default to "/")
14
- parts.push(`path=${path ?? "/"}`);
15
- // Add domain if specified
16
- if (domain) {
17
- parts.push(`domain=${domain}`);
18
- }
19
- // Add SameSite policy (e.g., Lax, Strict)
20
- if (sameSite) {
21
- const normalized = sameSite.charAt(0).toUpperCase() + sameSite.slice(1).toLowerCase();
22
- parts.push(`SameSite=${normalized}`);
23
- }
24
- // Add Secure flag if not explicitly disabled
25
- if (secure !== false) {
26
- parts.push(`Secure`);
27
- }
28
- return parts.join("; ");
2
+ const { name, maxAge, path, domain, sameSite, secure } = cookieOptions;
3
+ const parts = [`${name}=${encodeURIComponent(value)}`];
4
+ if (maxAge !== void 0) {
5
+ const expires = new Date(Date.now() + maxAge * 1e3).toUTCString();
6
+ parts.push(`expires=${expires}`, `max-age=${maxAge}`);
7
+ }
8
+ parts.push(`path=${path ?? "/"}`);
9
+ if (domain) {
10
+ parts.push(`domain=${domain}`);
11
+ }
12
+ if (sameSite) {
13
+ const normalized = sameSite.charAt(0).toUpperCase() + sameSite.slice(1).toLowerCase();
14
+ parts.push(`SameSite=${normalized}`);
15
+ }
16
+ if (secure !== false) {
17
+ parts.push(`Secure`);
18
+ }
19
+ return parts.join("; ");
29
20
  };
30
21
 
31
22
  export { buildCookieString };
@@ -1,16 +1,9 @@
1
- /**
2
- * Gets the locale value from the browser cookie.
3
- *
4
- * This function relies on `document.cookie`.
5
- */
6
1
  function getLocaleFromCookie(cookieName) {
7
- if (typeof document === "undefined")
8
- return undefined;
9
- const cookies = document.cookie.split(";").map((c) => c.trim());
10
- const entry = cookies.find((c) => c.startsWith(`${cookieName}=`));
11
- if (!entry)
12
- return undefined;
13
- return decodeURIComponent(entry.slice(cookieName.length + 1));
2
+ if (typeof document === "undefined") return void 0;
3
+ const cookies = document.cookie.split(";").map((c) => c.trim());
4
+ const entry = cookies.find((c) => c.startsWith(`${cookieName}=`));
5
+ if (!entry) return void 0;
6
+ return decodeURIComponent(entry.slice(cookieName.length + 1));
14
7
  }
15
8
 
16
9
  export { getLocaleFromCookie };
@@ -1,12 +1,6 @@
1
- /**
2
- * Set the document language attribute.
3
- *
4
- * This function relies on `document.documentElement.lang`.
5
- */
6
1
  function setDocumentLocale(locale) {
7
- if (typeof document === "undefined")
8
- return;
9
- document.documentElement.lang = locale;
2
+ if (typeof document === "undefined") return;
3
+ document.documentElement.lang = locale;
10
4
  }
11
5
 
12
6
  export { setDocumentLocale };
@@ -1,15 +1,8 @@
1
1
  import { buildCookieString } from '../build-cookie-string.js';
2
2
 
3
- /**
4
- * Persist locale to a cookie.
5
- *
6
- * This function relies on `document.cookie`.
7
- */
8
3
  const setLocaleCookie = (cookieOptions, locale) => {
9
- if (typeof document === "undefined")
10
- return;
11
- // Build and apply the cookie string
12
- document.cookie = buildCookieString(cookieOptions, locale);
4
+ if (typeof document === "undefined") return;
5
+ document.cookie = buildCookieString(cookieOptions, locale);
13
6
  };
14
7
 
15
8
  export { setLocaleCookie };
@@ -1,49 +1,27 @@
1
1
  import { ref, onMounted } from 'vue';
2
2
  import { getClientLocale } from 'intor';
3
3
 
4
- /**
5
- * Client-side Intor runtime helper.
6
- *
7
- * Manages locale state and dynamic message loading
8
- * in pure client-side (SPA) environments.
9
- *
10
- * @public
11
- */
12
4
  function useIntor(config, loader) {
13
- // ---------------------------------------------------------------------------
14
- // Initial locale
15
- // ---------------------------------------------------------------------------
16
- const locale = getClientLocale(config);
17
- // ---------------------------------------------------------------------------
18
- // State
19
- // ---------------------------------------------------------------------------
20
- const messages = ref(config.messages || {});
21
- const isLoading = ref(true);
22
- let activeLocale = locale;
23
- // ---------------------------------------------------------------------------
24
- // Locale change handler
25
- // ---------------------------------------------------------------------------
26
- const onLocaleChange = async (newLocale) => {
27
- activeLocale = newLocale;
28
- isLoading.value = true;
29
- const loaded = await loader(config, newLocale);
30
- // Ignore outdated results when locale changes again.
31
- if (activeLocale !== newLocale)
32
- return;
33
- messages.value = loaded;
34
- isLoading.value = false;
35
- };
36
- // ---------------------------------------------------------------------------
37
- // Initial load
38
- // ---------------------------------------------------------------------------
39
- onMounted(() => onLocaleChange(locale));
40
- return {
41
- config,
42
- locale,
43
- messages,
44
- isLoading,
45
- onLocaleChange,
46
- };
5
+ const locale = getClientLocale(config);
6
+ const messages = ref(config.messages || {});
7
+ const isLoading = ref(true);
8
+ let activeLocale = locale;
9
+ const onLocaleChange = async (newLocale) => {
10
+ activeLocale = newLocale;
11
+ isLoading.value = true;
12
+ const loaded = await loader(config, newLocale);
13
+ if (activeLocale !== newLocale) return;
14
+ messages.value = loaded;
15
+ isLoading.value = false;
16
+ };
17
+ onMounted(() => onLocaleChange(locale));
18
+ return {
19
+ config,
20
+ locale,
21
+ messages,
22
+ isLoading,
23
+ onLocaleChange
24
+ };
47
25
  }
48
26
 
49
27
  export { useIntor };
@@ -8,31 +8,30 @@ import { setLocaleCookie } from '../../../shared/utils/locale/set-locale-cookie.
8
8
  import { setDocumentLocale } from '../../../shared/utils/locale/set-document-locale.js';
9
9
 
10
10
  function useLocaleEffects(config, locale) {
11
- const { cookie, routing } = config;
12
- let isFirstSync = true;
13
- watch(locale, (currentLocale) => {
14
- // Always sync document language
15
- setDocumentLocale(currentLocale);
16
- // -------------------------------------------------------------
17
- // First sync (initial mount / hydration)
18
- // -------------------------------------------------------------
19
- if (isFirstSync) {
20
- isFirstSync = false;
21
- const localeCookie = getLocaleFromCookie(cookie.name);
22
- const isFirstVisit = !localeCookie;
23
- if (shouldPersistOnFirstVisit(isFirstVisit, routing.inbound.firstVisit.persist) &&
24
- cookie.persist) {
25
- setLocaleCookie(cookie, currentLocale);
26
- }
27
- return;
11
+ const { cookie, routing } = config;
12
+ let isFirstSync = true;
13
+ watch(
14
+ locale,
15
+ (currentLocale) => {
16
+ setDocumentLocale(currentLocale);
17
+ if (isFirstSync) {
18
+ isFirstSync = false;
19
+ const localeCookie = getLocaleFromCookie(cookie.name);
20
+ const isFirstVisit = !localeCookie;
21
+ if (shouldPersistOnFirstVisit(
22
+ isFirstVisit,
23
+ routing.inbound.firstVisit.persist
24
+ ) && cookie.persist) {
25
+ setLocaleCookie(cookie, currentLocale);
28
26
  }
29
- // -------------------------------------------------------------
30
- // Subsequent locale changes (user-driven)
31
- // -------------------------------------------------------------
32
- if (cookie.persist) {
33
- setLocaleCookie(cookie, currentLocale);
34
- }
35
- }, { immediate: true });
27
+ return;
28
+ }
29
+ if (cookie.persist) {
30
+ setLocaleCookie(cookie, currentLocale);
31
+ }
32
+ },
33
+ { immediate: true }
34
+ );
36
35
  }
37
36
 
38
37
  export { useLocaleEffects };
@@ -1,31 +1,22 @@
1
1
  import { watch } from 'vue';
2
2
  import { createRefetchMessages } from '../../../shared/messages/create-refetch-messages.js';
3
3
 
4
- /**
5
- * Attach message refetch side effects based on locale changes.
6
- *
7
- * - Skips initial run
8
- * - Aborts previous in-flight requests automatically
9
- * - Acts as a side-effect boundary (no state returned)
10
- */
11
4
  function useMessagesEffects(config, locale, runtimeMessages, internalIsLoading) {
12
- // Prepares message refetch function.
13
- const refetchMessages = createRefetchMessages({
14
- config,
15
- onLoadingStart: () => {
16
- internalIsLoading.value = true;
17
- },
18
- onLoadingEnd: () => {
19
- internalIsLoading.value = false;
20
- },
21
- onMessages: (messages) => {
22
- runtimeMessages.value = messages;
23
- },
24
- });
25
- // Refetch messages when locale changes (except initial render).
26
- watch(locale, (newLocale) => {
27
- void refetchMessages(newLocale);
28
- });
5
+ const refetchMessages = createRefetchMessages({
6
+ config,
7
+ onLoadingStart: () => {
8
+ internalIsLoading.value = true;
9
+ },
10
+ onLoadingEnd: () => {
11
+ internalIsLoading.value = false;
12
+ },
13
+ onMessages: (messages) => {
14
+ runtimeMessages.value = messages;
15
+ }
16
+ });
17
+ watch(locale, (newLocale) => {
18
+ void refetchMessages(newLocale);
19
+ });
29
20
  }
30
21
 
31
22
  export { useMessagesEffects };
@@ -2,10 +2,10 @@ import { inject } from 'vue';
2
2
  import { IntorContextKey } from './intor-provider.js';
3
3
 
4
4
  function injectIntorContext() {
5
- const context = inject(IntorContextKey);
6
- if (!context)
7
- throw new Error("injectIntorContext must be used within IntorProvider");
8
- return context;
5
+ const context = inject(IntorContextKey);
6
+ if (!context)
7
+ throw new Error("injectIntorContext must be used within IntorProvider");
8
+ return context;
9
9
  }
10
10
 
11
11
  export { injectIntorContext };
@@ -4,73 +4,68 @@ import { resolveEffectiveIsLoading, resolveEffectiveMessages } from '../../share
4
4
  import { useLocaleEffects } from './effects/use-locale-effects.js';
5
5
  import { useMessagesEffects } from './effects/use-messages-effects.js';
6
6
 
7
- const IntorContextKey = Symbol("IntorContext");
8
- /**
9
- * Vue provider for Intor.
10
- *
11
- * @public
12
- */
7
+ const IntorContextKey = /* @__PURE__ */ Symbol("IntorContext");
13
8
  const IntorProvider = defineComponent({
14
- name: "IntorProvider",
15
- props: { value: { type: Object, required: true } },
16
- setup(props, { slots }) {
17
- // ---------------------------------------------------------------------------
18
- // Internal state
19
- // ---------------------------------------------------------------------------
20
- const locale = ref(props.value.locale);
21
- const runtimeMessages = ref(null);
22
- const internalIsLoading = ref(false);
23
- // ---------------------------------------------------------------------------
24
- // Locale transition
25
- // ---------------------------------------------------------------------------
26
- /** Request a locale change. */
27
- const setLocale = (newLocale) => {
28
- if (newLocale === locale.value)
29
- return;
30
- locale.value = newLocale;
31
- void props.value.onLocaleChange?.(newLocale); // Notify external listener (fire-and-forget)
32
- };
33
- // ---------------------------------------------------------------------------
34
- // Effective state
35
- // ---------------------------------------------------------------------------
36
- const effectiveIsLoading = computed(() => resolveEffectiveIsLoading(!!props.value.isLoading?.value, internalIsLoading.value));
37
- const effectiveMessages = computed(() => resolveEffectiveMessages(runtimeMessages.value, props.value.messages?.value, props.value.config.messages));
38
- // ---------------------------------------------------------------------------
39
- // Translator
40
- // ---------------------------------------------------------------------------
41
- const { loadingMessage, missingMessage } = props.value.config.translator ?? {};
42
- const { handlers, hooks } = props.value;
43
- const translator = computed(() => {
44
- return new Translator({
45
- messages: effectiveMessages.value,
46
- locale: locale.value,
47
- isLoading: effectiveIsLoading.value,
48
- fallbackLocales: props.value.config.fallbackLocales,
49
- ...(loadingMessage !== undefined ? { loadingMessage } : {}),
50
- ...(missingMessage !== undefined ? { missingMessage } : {}),
51
- ...(handlers !== undefined ? { handlers } : {}),
52
- ...(hooks !== undefined ? { hooks } : {}),
53
- });
54
- });
55
- // -------------------------------------------------------------------------
56
- // Side effects
57
- // -------------------------------------------------------------------------
58
- useLocaleEffects(props.value.config, locale);
59
- useMessagesEffects(props.value.config, locale, runtimeMessages, internalIsLoading);
60
- // Sync internal locale with external prop
61
- watch(() => props.value.locale, (newLocale) => {
62
- if (newLocale !== locale.value)
63
- locale.value = newLocale;
64
- });
65
- const contextValue = computed(() => ({
66
- config: props.value.config,
67
- locale,
68
- setLocale,
69
- translator,
70
- }));
71
- provide(IntorContextKey, contextValue);
72
- return () => slots["default"]?.();
73
- },
9
+ name: "IntorProvider",
10
+ props: { value: { type: Object, required: true } },
11
+ setup(props, { slots }) {
12
+ const locale = ref(props.value.locale);
13
+ const runtimeMessages = ref(null);
14
+ const internalIsLoading = ref(false);
15
+ const setLocale = (newLocale) => {
16
+ if (newLocale === locale.value) return;
17
+ locale.value = newLocale;
18
+ void props.value.onLocaleChange?.(newLocale);
19
+ };
20
+ const effectiveIsLoading = computed(
21
+ () => resolveEffectiveIsLoading(
22
+ !!props.value.isLoading?.value,
23
+ internalIsLoading.value
24
+ )
25
+ );
26
+ const effectiveMessages = computed(
27
+ () => resolveEffectiveMessages(
28
+ runtimeMessages.value,
29
+ props.value.messages?.value,
30
+ props.value.config.messages
31
+ )
32
+ );
33
+ const { loadingMessage, missingMessage } = props.value.config.translator ?? {};
34
+ const { handlers, hooks } = props.value;
35
+ const translator = computed(() => {
36
+ return new Translator({
37
+ messages: effectiveMessages.value,
38
+ locale: locale.value,
39
+ isLoading: effectiveIsLoading.value,
40
+ fallbackLocales: props.value.config.fallbackLocales,
41
+ ...loadingMessage !== void 0 ? { loadingMessage } : {},
42
+ ...missingMessage !== void 0 ? { missingMessage } : {},
43
+ ...handlers !== void 0 ? { handlers } : {},
44
+ ...hooks !== void 0 ? { hooks } : {}
45
+ });
46
+ });
47
+ useLocaleEffects(props.value.config, locale);
48
+ useMessagesEffects(
49
+ props.value.config,
50
+ locale,
51
+ runtimeMessages,
52
+ internalIsLoading
53
+ );
54
+ watch(
55
+ () => props.value.locale,
56
+ (newLocale) => {
57
+ if (newLocale !== locale.value) locale.value = newLocale;
58
+ }
59
+ );
60
+ const contextValue = computed(() => ({
61
+ config: props.value.config,
62
+ locale,
63
+ setLocale,
64
+ translator
65
+ }));
66
+ provide(IntorContextKey, contextValue);
67
+ return () => slots["default"]?.();
68
+ }
74
69
  });
75
70
 
76
71
  export { IntorContextKey, IntorProvider };