adnbn 0.10.0 → 0.12.0

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 (716) hide show
  1. package/README.md +3 -0
  2. package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
  3. package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
  4. package/dist/cli/builders/locale/index.js +1 -1
  5. package/dist/cli/builders/locale/index.js.map +1 -1
  6. package/dist/cli/builders/manifest/ManifestBase.js +17 -7
  7. package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
  8. package/dist/cli/builders/manifest/ManifestV2.js +1 -1
  9. package/dist/cli/builders/manifest/ManifestV3.js +12 -5
  10. package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
  11. package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
  12. package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
  13. package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
  14. package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
  15. package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
  16. package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
  17. package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
  18. package/dist/cli/builders/manifest/utils/index.js +19 -0
  19. package/dist/cli/builders/manifest/utils/index.js.map +1 -0
  20. package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
  21. package/dist/cli/builders/manifest/utils/permissions.js +34 -0
  22. package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
  23. package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
  24. package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
  25. package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
  26. package/dist/cli/bundler/index.d.ts +1 -0
  27. package/dist/cli/bundler/index.js +1 -0
  28. package/dist/cli/bundler/index.js.map +1 -1
  29. package/dist/cli/bundler/layers.d.ts +5 -0
  30. package/dist/cli/bundler/layers.js +12 -0
  31. package/dist/cli/bundler/layers.js.map +1 -0
  32. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
  33. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +524 -0
  34. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
  35. package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +2 -0
  36. package/dist/cli/bundler/plugins/build-assets-map/index.js +5 -0
  37. package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
  38. package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +9 -0
  39. package/dist/cli/bundler/plugins/build-assets-map/usage.js +31 -0
  40. package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
  41. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
  42. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
  43. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
  44. package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
  45. package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
  46. package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
  47. package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
  48. package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
  49. package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
  50. package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
  51. package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
  52. package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
  53. package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
  54. package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
  55. package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
  56. package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
  57. package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
  58. package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
  59. package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
  60. package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
  61. package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
  62. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
  63. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
  64. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
  65. package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
  66. package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
  67. package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
  68. package/dist/cli/bundler/plugins/index.d.ts +11 -5
  69. package/dist/cli/bundler/plugins/index.js +28 -10
  70. package/dist/cli/bundler/plugins/index.js.map +1 -1
  71. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
  72. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
  73. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
  74. package/dist/cli/bundler/plugins/isolated-styles/chunks.d.ts +3 -0
  75. package/dist/cli/bundler/plugins/isolated-styles/chunks.js +32 -0
  76. package/dist/cli/bundler/plugins/isolated-styles/chunks.js.map +1 -0
  77. package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
  78. package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
  79. package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
  80. package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
  81. package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
  82. package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
  83. package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
  84. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
  85. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +54 -0
  86. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
  87. package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
  88. package/dist/cli/bundler/plugins/manifest/index.js +6 -0
  89. package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
  90. package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
  91. package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
  92. package/dist/cli/bundler/plugins/replace/index.js +5 -0
  93. package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
  94. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
  95. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
  96. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
  97. package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
  98. package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
  99. package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
  100. package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
  101. package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
  102. package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
  103. package/dist/cli/bundler/plugins/types.d.ts +8 -0
  104. package/dist/cli/bundler/plugins/types.js +1 -0
  105. package/dist/cli/bundler/plugins/types.js.map +1 -0
  106. package/dist/cli/bundler/plugins/utils/compilation-assets.d.ts +4 -0
  107. package/dist/cli/bundler/plugins/utils/compilation-assets.js +12 -0
  108. package/dist/cli/bundler/plugins/utils/compilation-assets.js.map +1 -0
  109. package/dist/cli/bundler/plugins/utils/index.d.ts +5 -0
  110. package/dist/cli/bundler/plugins/utils/index.js +14 -0
  111. package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
  112. package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
  113. package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
  114. package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
  115. package/dist/cli/bundler/plugins/utils/runtime-module.d.ts +3 -0
  116. package/dist/cli/bundler/plugins/utils/runtime-module.js +11 -0
  117. package/dist/cli/bundler/plugins/utils/runtime-module.js.map +1 -0
  118. package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
  119. package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
  120. package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
  121. package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
  122. package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
  123. package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
  124. package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
  125. package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
  126. package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
  127. package/dist/cli/bundler/plugins/watch/index.js +5 -0
  128. package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
  129. package/dist/cli/bundler/utils/app-filename.d.ts +2 -0
  130. package/dist/cli/bundler/utils/app-filename.js +19 -0
  131. package/dist/cli/bundler/utils/app-filename.js.map +1 -0
  132. package/dist/cli/bundler/utils/assets.d.ts +3 -0
  133. package/dist/cli/bundler/utils/assets.js +162 -0
  134. package/dist/cli/bundler/utils/assets.js.map +1 -0
  135. package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
  136. package/dist/cli/bundler/utils/chunk-filename.js +93 -0
  137. package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
  138. package/dist/cli/bundler/utils/index.d.ts +2 -1
  139. package/dist/cli/bundler/utils/index.js +2 -1
  140. package/dist/cli/bundler/utils/index.js.map +1 -1
  141. package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
  142. package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
  143. package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
  144. package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
  145. package/dist/cli/entrypoint/file/OptionFile.js +35 -31
  146. package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
  147. package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
  148. package/dist/cli/entrypoint/file/SourceFile.js +260 -156
  149. package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
  150. package/dist/cli/entrypoint/file/index.d.ts +2 -0
  151. package/dist/cli/entrypoint/file/index.js +2 -0
  152. package/dist/cli/entrypoint/file/index.js.map +1 -1
  153. package/dist/cli/entrypoint/file/injectors/core.js +22 -1
  154. package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
  155. package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
  156. package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
  157. package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
  158. package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
  159. package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
  160. package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
  161. package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
  162. package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
  163. package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
  164. package/dist/cli/entrypoint/file/parsers/index.js +2 -0
  165. package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
  166. package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
  167. package/dist/cli/entrypoint/file/parsers/types.js +13 -0
  168. package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
  169. package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
  170. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
  171. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
  172. package/dist/cli/entrypoint/file/types.d.ts +26 -1
  173. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
  174. package/dist/cli/entrypoint/finder/ContentFinder.d.ts +1 -1
  175. package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
  176. package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
  177. package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
  178. package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
  179. package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
  180. package/dist/cli/entrypoint/parser/ContentParser.d.ts +7 -3
  181. package/dist/cli/entrypoint/parser/ContentParser.js +42 -6
  182. package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
  183. package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
  184. package/dist/cli/entrypoint/parser/RelayParser.js +5 -1
  185. package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
  186. package/dist/cli/entrypoint/parser/utils/content/default-render.d.ts +3 -0
  187. package/dist/cli/entrypoint/parser/utils/content/default-render.js +21 -0
  188. package/dist/cli/entrypoint/parser/utils/content/default-render.js.map +1 -0
  189. package/dist/cli/plugins/asset.js +9 -4
  190. package/dist/cli/plugins/asset.js.map +1 -1
  191. package/dist/cli/plugins/background/index.js +1 -1
  192. package/dist/cli/plugins/background/index.js.map +1 -1
  193. package/dist/cli/plugins/content/Content.d.ts +2 -2
  194. package/dist/cli/plugins/content/Content.js +3 -2
  195. package/dist/cli/plugins/content/Content.js.map +1 -1
  196. package/dist/cli/plugins/content/ContentDriver.d.ts +1 -1
  197. package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
  198. package/dist/cli/plugins/content/ContentManager.js +79 -28
  199. package/dist/cli/plugins/content/ContentManager.js.map +1 -1
  200. package/dist/cli/plugins/content/ContentName.d.ts +2 -2
  201. package/dist/cli/plugins/content/ContentName.js +8 -7
  202. package/dist/cli/plugins/content/ContentName.js.map +1 -1
  203. package/dist/cli/plugins/content/Relay.d.ts +2 -2
  204. package/dist/cli/plugins/content/Relay.js +3 -2
  205. package/dist/cli/plugins/content/Relay.js.map +1 -1
  206. package/dist/cli/plugins/content/RelayDriver.d.ts +1 -1
  207. package/dist/cli/plugins/content/RelayDriver.js +1 -1
  208. package/dist/cli/plugins/content/bundler.d.ts +7 -0
  209. package/dist/cli/plugins/content/bundler.js +47 -0
  210. package/dist/cli/plugins/content/bundler.js.map +1 -0
  211. package/dist/cli/plugins/content/index.js +121 -62
  212. package/dist/cli/plugins/content/index.js.map +1 -1
  213. package/dist/cli/plugins/content/relay-module.d.ts +3 -0
  214. package/dist/cli/plugins/content/relay-module.js +11 -0
  215. package/dist/cli/plugins/content/relay-module.js.map +1 -0
  216. package/dist/cli/plugins/content/types.d.ts +2 -2
  217. package/dist/cli/plugins/content/utils.d.ts +3 -1
  218. package/dist/cli/plugins/content/utils.js +8 -1
  219. package/dist/cli/plugins/content/utils.js.map +1 -1
  220. package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
  221. package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
  222. package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
  223. package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
  224. package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
  225. package/dist/cli/plugins/icon/icon-module.js +11 -0
  226. package/dist/cli/plugins/icon/icon-module.js.map +1 -0
  227. package/dist/cli/plugins/icon/index.js +5 -3
  228. package/dist/cli/plugins/icon/index.js.map +1 -1
  229. package/dist/cli/plugins/index.d.ts +1 -1
  230. package/dist/cli/plugins/index.js +1 -1
  231. package/dist/cli/plugins/locale/Locale.d.ts +9 -2
  232. package/dist/cli/plugins/locale/Locale.js +37 -5
  233. package/dist/cli/plugins/locale/Locale.js.map +1 -1
  234. package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
  235. package/dist/cli/plugins/locale/index.js +57 -22
  236. package/dist/cli/plugins/locale/index.js.map +1 -1
  237. package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
  238. package/dist/cli/plugins/locale/locale-module.js +16 -0
  239. package/dist/cli/plugins/locale/locale-module.js.map +1 -0
  240. package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
  241. package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
  242. package/dist/cli/plugins/offscreen/index.js +5 -4
  243. package/dist/cli/plugins/offscreen/index.js.map +1 -1
  244. package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
  245. package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
  246. package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
  247. package/dist/cli/plugins/output/index.d.ts +2 -0
  248. package/dist/cli/plugins/output/index.js +60 -0
  249. package/dist/cli/plugins/output/index.js.map +1 -0
  250. package/dist/cli/plugins/output/runtime.d.ts +26 -0
  251. package/dist/cli/plugins/output/runtime.js +19 -0
  252. package/dist/cli/plugins/output/runtime.js.map +1 -0
  253. package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
  254. package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
  255. package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
  256. package/dist/cli/plugins/page/index.js +14 -10
  257. package/dist/cli/plugins/page/index.js.map +1 -1
  258. package/dist/cli/plugins/page/page-module.d.ts +2 -0
  259. package/dist/cli/plugins/page/page-module.js +11 -0
  260. package/dist/cli/plugins/page/page-module.js.map +1 -0
  261. package/dist/cli/plugins/popup/Popup.d.ts +1 -1
  262. package/dist/cli/plugins/popup/Popup.js +2 -2
  263. package/dist/cli/plugins/popup/Popup.js.map +1 -1
  264. package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
  265. package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
  266. package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
  267. package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
  268. package/dist/cli/plugins/popup/index.js +6 -5
  269. package/dist/cli/plugins/popup/index.js.map +1 -1
  270. package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
  271. package/dist/cli/plugins/popup/popup-module.js +11 -0
  272. package/dist/cli/plugins/popup/popup-module.js.map +1 -0
  273. package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
  274. package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
  275. package/dist/cli/plugins/sandbox/index.js +5 -4
  276. package/dist/cli/plugins/sandbox/index.js.map +1 -1
  277. package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
  278. package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
  279. package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
  280. package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
  281. package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
  282. package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
  283. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
  284. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
  285. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
  286. package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
  287. package/dist/cli/plugins/sidebar/index.js +6 -5
  288. package/dist/cli/plugins/sidebar/index.js.map +1 -1
  289. package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
  290. package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
  291. package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
  292. package/dist/cli/plugins/style/index.d.ts +2 -1
  293. package/dist/cli/plugins/style/index.js +52 -25
  294. package/dist/cli/plugins/style/index.js.map +1 -1
  295. package/dist/cli/plugins/style/types.d.ts +5 -0
  296. package/dist/cli/plugins/style/types.js +1 -0
  297. package/dist/cli/plugins/style/types.js.map +1 -0
  298. package/dist/cli/raw.d.ts +4 -0
  299. package/dist/cli/resolvers/bundler.js +9 -7
  300. package/dist/cli/resolvers/bundler.js.map +1 -1
  301. package/dist/cli/resolvers/config.js +2 -1
  302. package/dist/cli/resolvers/config.js.map +1 -1
  303. package/dist/cli/virtual/index.d.ts +2 -2
  304. package/dist/cli/virtual/index.js +11 -8
  305. package/dist/cli/virtual/virtual.d.ts +14 -11
  306. package/dist/content/index.d.ts +3 -0
  307. package/dist/content/index.js +8 -0
  308. package/dist/content/index.js.map +1 -0
  309. package/dist/entry/content/adapters/react/Builder.d.ts +5 -6
  310. package/dist/entry/content/adapters/react/Builder.js +8 -21
  311. package/dist/entry/content/adapters/react/Builder.js.map +1 -1
  312. package/dist/entry/content/adapters/react/Node.d.ts +6 -12
  313. package/dist/entry/content/adapters/react/Node.js +9 -25
  314. package/dist/entry/content/adapters/react/Node.js.map +1 -1
  315. package/dist/entry/content/adapters/react/index.d.ts +2 -1
  316. package/dist/entry/content/adapters/react/index.js +3 -1
  317. package/dist/entry/content/adapters/react/index.js.map +1 -1
  318. package/dist/entry/content/adapters/react/resolvers/definition.d.ts +2 -0
  319. package/dist/entry/content/adapters/react/resolvers/definition.js +12 -0
  320. package/dist/entry/content/adapters/react/resolvers/definition.js.map +1 -0
  321. package/dist/entry/content/adapters/react/resolvers/render.d.ts +2 -2
  322. package/dist/entry/content/adapters/react/resolvers/render.js +4 -6
  323. package/dist/entry/content/adapters/react/resolvers/render.js.map +1 -1
  324. package/dist/entry/content/adapters/vanilla/Builder.d.ts +5 -5
  325. package/dist/entry/content/adapters/vanilla/Builder.js +9 -15
  326. package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
  327. package/dist/entry/content/adapters/vanilla/Node.d.ts +5 -10
  328. package/dist/entry/content/adapters/vanilla/Node.js +11 -34
  329. package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
  330. package/dist/entry/content/adapters/vanilla/index.d.ts +2 -1
  331. package/dist/entry/content/adapters/vanilla/index.js +3 -1
  332. package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
  333. package/dist/entry/content/adapters/vanilla/resolvers/definition.d.ts +2 -0
  334. package/dist/entry/content/adapters/vanilla/resolvers/definition.js +9 -0
  335. package/dist/entry/content/adapters/vanilla/resolvers/definition.js.map +1 -0
  336. package/dist/entry/content/adapters/vanilla/resolvers/render.d.ts +3 -0
  337. package/dist/entry/content/adapters/vanilla/resolvers/render.js +15 -0
  338. package/dist/entry/content/adapters/vanilla/resolvers/render.js.map +1 -0
  339. package/dist/entry/content/index.d.ts +5 -1
  340. package/dist/entry/content/index.js +8 -1
  341. package/dist/entry/content/index.js.map +1 -1
  342. package/dist/entry/content/lifecycle/Builder.d.ts +26 -0
  343. package/dist/entry/content/lifecycle/Builder.js +212 -0
  344. package/dist/entry/content/lifecycle/Builder.js.map +1 -0
  345. package/dist/entry/content/lifecycle/IsolationSetup.d.ts +16 -0
  346. package/dist/entry/content/lifecycle/IsolationSetup.js +37 -0
  347. package/dist/entry/content/lifecycle/IsolationSetup.js.map +1 -0
  348. package/dist/entry/content/lifecycle/MountBuilder.d.ts +8 -0
  349. package/dist/entry/content/lifecycle/MountBuilder.js +57 -0
  350. package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -0
  351. package/dist/entry/content/{core → lifecycle/context}/Context.d.ts +5 -2
  352. package/dist/entry/content/lifecycle/context/Context.js +73 -0
  353. package/dist/entry/content/lifecycle/context/Context.js.map +1 -0
  354. package/dist/entry/content/{core → lifecycle/context}/EventEmitter.d.ts +2 -2
  355. package/dist/entry/content/{core → lifecycle/context}/EventEmitter.js +3 -3
  356. package/dist/entry/content/lifecycle/context/EventEmitter.js.map +1 -0
  357. package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +5 -0
  358. package/dist/entry/content/{core → lifecycle/context}/ManagedContext.js +2 -2
  359. package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -0
  360. package/dist/entry/content/lifecycle/context/index.d.ts +3 -0
  361. package/dist/entry/content/lifecycle/context/index.js +9 -0
  362. package/dist/entry/content/lifecycle/context/index.js.map +1 -0
  363. package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.d.ts +2 -2
  364. package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.js +3 -3
  365. package/dist/entry/content/lifecycle/markers/AbstractMarker.js.map +1 -0
  366. package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.d.ts +2 -2
  367. package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.js +2 -2
  368. package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -0
  369. package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.d.ts +2 -2
  370. package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.js +2 -2
  371. package/dist/entry/content/lifecycle/markers/WeakMarker.js.map +1 -0
  372. package/dist/entry/content/lifecycle/markers/index.d.ts +3 -0
  373. package/dist/entry/content/lifecycle/markers/index.js +9 -0
  374. package/dist/entry/content/lifecycle/markers/index.js.map +1 -0
  375. package/dist/entry/content/{core → lifecycle/nodes}/EventNode.d.ts +5 -2
  376. package/dist/entry/content/{core → lifecycle/nodes}/EventNode.js +14 -2
  377. package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -0
  378. package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +29 -0
  379. package/dist/entry/content/lifecycle/nodes/FrameNode.js +187 -0
  380. package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -0
  381. package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.d.ts +4 -2
  382. package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.js +8 -2
  383. package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -0
  384. package/dist/entry/content/{core → lifecycle/nodes}/MountNode.d.ts +4 -2
  385. package/dist/entry/content/{core → lifecycle/nodes}/MountNode.js +8 -2
  386. package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -0
  387. package/dist/entry/content/{core → lifecycle/nodes}/Node.d.ts +3 -2
  388. package/dist/entry/content/{core → lifecycle/nodes}/Node.js +5 -2
  389. package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -0
  390. package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +19 -0
  391. package/dist/entry/content/lifecycle/nodes/RenderNode.js +75 -0
  392. package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -0
  393. package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +21 -0
  394. package/dist/entry/content/lifecycle/nodes/ShadowNode.js +121 -0
  395. package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -0
  396. package/dist/entry/content/lifecycle/nodes/index.d.ts +7 -0
  397. package/dist/entry/content/lifecycle/nodes/index.js +17 -0
  398. package/dist/entry/content/lifecycle/nodes/index.js.map +1 -0
  399. package/dist/entry/content/lifecycle/nodes/isolated-styles.d.ts +2 -0
  400. package/dist/entry/content/lifecycle/nodes/isolated-styles.js +14 -0
  401. package/dist/entry/content/lifecycle/nodes/isolated-styles.js.map +1 -0
  402. package/dist/entry/content/resolvers/anchor.d.ts +2 -0
  403. package/dist/entry/content/{core/resolvers → resolvers}/anchor.js +2 -2
  404. package/dist/entry/content/resolvers/anchor.js.map +1 -0
  405. package/dist/entry/content/resolvers/container.d.ts +2 -0
  406. package/dist/entry/content/{core/resolvers → resolvers}/container.js +2 -2
  407. package/dist/entry/content/resolvers/container.js.map +1 -0
  408. package/dist/entry/content/resolvers/definition.d.ts +5 -0
  409. package/dist/entry/content/resolvers/definition.js +24 -0
  410. package/dist/entry/content/resolvers/definition.js.map +1 -0
  411. package/dist/entry/content/{core/resolvers → resolvers}/index.d.ts +1 -1
  412. package/dist/entry/content/{core/resolvers → resolvers}/index.js +1 -1
  413. package/dist/entry/content/resolvers/index.js.map +1 -0
  414. package/dist/entry/content/resolvers/mount.d.ts +2 -0
  415. package/dist/entry/content/{core/resolvers → resolvers}/mount.js +3 -3
  416. package/dist/entry/content/resolvers/mount.js.map +1 -0
  417. package/dist/entry/content/resolvers/target.d.ts +3 -0
  418. package/dist/entry/content/resolvers/target.js +34 -0
  419. package/dist/entry/content/resolvers/target.js.map +1 -0
  420. package/dist/entry/content/resolvers/watch.d.ts +6 -0
  421. package/dist/entry/content/{core/resolvers → resolvers}/watch.js +15 -11
  422. package/dist/entry/content/resolvers/watch.js.map +1 -0
  423. package/dist/entry/relay/Builder.d.ts +8 -8
  424. package/dist/entry/relay/Builder.js +32 -19
  425. package/dist/entry/relay/Builder.js.map +1 -1
  426. package/dist/entry/relay/TransportBuilder.d.ts +3 -2
  427. package/dist/entry/relay/TransportBuilder.js +3 -3
  428. package/dist/entry/relay/TransportBuilder.js.map +1 -1
  429. package/dist/entry/relay/index.d.ts +5 -2
  430. package/dist/entry/relay/index.js +8 -2
  431. package/dist/entry/relay/index.js.map +1 -1
  432. package/dist/entry/relay/resolvers/definition.d.ts +4 -0
  433. package/dist/entry/relay/resolvers/definition.js +16 -0
  434. package/dist/entry/relay/resolvers/definition.js.map +1 -0
  435. package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
  436. package/dist/locale/adapters/react/ReactLocale.js +41 -0
  437. package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
  438. package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
  439. package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
  440. package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
  441. package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
  442. package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
  443. package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
  444. package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
  445. package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
  446. package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
  447. package/dist/locale/adapters/react/index.d.ts +4 -2
  448. package/dist/locale/adapters/react/index.js +6 -4
  449. package/dist/locale/adapters/react/index.js.map +1 -1
  450. package/dist/locale/adapters/react/types.d.ts +22 -0
  451. package/dist/locale/adapters/react/types.js +1 -0
  452. package/dist/locale/adapters/react/types.js.map +1 -0
  453. package/dist/locale/helpers.d.ts +4 -5
  454. package/dist/locale/helpers.js +1 -1
  455. package/dist/locale/helpers.js.map +1 -1
  456. package/dist/locale/index.d.ts +2 -1
  457. package/dist/locale/index.js +1 -0
  458. package/dist/locale/index.js.map +1 -1
  459. package/dist/locale/providers/AbstractLocale.d.ts +4 -4
  460. package/dist/locale/providers/AbstractLocale.js +13 -94
  461. package/dist/locale/providers/AbstractLocale.js.map +1 -1
  462. package/dist/locale/providers/CustomLocale.d.ts +3 -3
  463. package/dist/locale/providers/CustomLocale.js +6 -5
  464. package/dist/locale/providers/CustomLocale.js.map +1 -1
  465. package/dist/locale/providers/DynamicLocale.d.ts +18 -11
  466. package/dist/locale/providers/DynamicLocale.js +60 -47
  467. package/dist/locale/providers/DynamicLocale.js.map +1 -1
  468. package/dist/locale/providers/NativeLocale.d.ts +4 -7
  469. package/dist/locale/providers/NativeLocale.js +5 -14
  470. package/dist/locale/providers/NativeLocale.js.map +1 -1
  471. package/dist/locale/providers/ObservableLocale.d.ts +35 -0
  472. package/dist/locale/providers/ObservableLocale.js +179 -0
  473. package/dist/locale/providers/ObservableLocale.js.map +1 -0
  474. package/dist/locale/providers/index.d.ts +2 -1
  475. package/dist/locale/providers/index.js +3 -1
  476. package/dist/locale/providers/index.js.map +1 -1
  477. package/dist/locale/storage/LocaleStorage.d.ts +11 -0
  478. package/dist/locale/storage/LocaleStorage.js +40 -0
  479. package/dist/locale/storage/LocaleStorage.js.map +1 -0
  480. package/dist/locale/storage/index.d.ts +1 -0
  481. package/dist/locale/storage/index.js +5 -0
  482. package/dist/locale/storage/index.js.map +1 -0
  483. package/dist/main/content.d.ts +4 -6
  484. package/dist/main/content.js +3 -16
  485. package/dist/main/content.js.map +1 -1
  486. package/dist/main/entrypoint.d.ts +4 -0
  487. package/dist/main/entrypoint.js +20 -0
  488. package/dist/main/entrypoint.js.map +1 -0
  489. package/dist/main/icon.d.ts +2 -3
  490. package/dist/main/icon.js +2 -1
  491. package/dist/main/icon.js.map +1 -1
  492. package/dist/main/index.d.ts +1 -0
  493. package/dist/main/index.js +1 -0
  494. package/dist/main/index.js.map +1 -1
  495. package/dist/main/offscreen.d.ts +2 -5
  496. package/dist/main/offscreen.js +5 -2
  497. package/dist/main/offscreen.js.map +1 -1
  498. package/dist/main/page.d.ts +2 -4
  499. package/dist/main/page.js +2 -1
  500. package/dist/main/page.js.map +1 -1
  501. package/dist/main/popup.d.ts +2 -5
  502. package/dist/main/popup.js +3 -3
  503. package/dist/main/popup.js.map +1 -1
  504. package/dist/main/relay.d.ts +3 -3
  505. package/dist/main/relay.js +2 -1
  506. package/dist/main/relay.js.map +1 -1
  507. package/dist/main/sandbox.d.ts +1 -4
  508. package/dist/main/sandbox.js +2 -1
  509. package/dist/main/sandbox.js.map +1 -1
  510. package/dist/main/service.d.ts +1 -2
  511. package/dist/main/service.js.map +1 -1
  512. package/dist/main/sidebar.d.ts +2 -5
  513. package/dist/main/sidebar.js +3 -3
  514. package/dist/main/sidebar.js.map +1 -1
  515. package/dist/message/index.d.ts +2 -4
  516. package/dist/message/index.js.map +1 -1
  517. package/dist/offscreen/index.d.ts +2 -6
  518. package/dist/offscreen/index.js.map +1 -1
  519. package/dist/relay/RelayPermission.js +1 -1
  520. package/dist/relay/index.d.ts +2 -5
  521. package/dist/relay/index.js.map +1 -1
  522. package/dist/sandbox/index.d.ts +1 -5
  523. package/dist/sandbox/index.js.map +1 -1
  524. package/dist/service/index.d.ts +2 -6
  525. package/dist/service/index.js.map +1 -1
  526. package/dist/shared/content/index.d.ts +1 -0
  527. package/dist/shared/content/index.js +6 -0
  528. package/dist/shared/content/index.js.map +1 -0
  529. package/dist/shared/content/isolation.d.ts +4 -0
  530. package/dist/shared/content/isolation.js +63 -0
  531. package/dist/shared/content/isolation.js.map +1 -0
  532. package/dist/shared/locale/index.d.ts +5 -0
  533. package/dist/shared/locale/index.js +21 -0
  534. package/dist/shared/locale/index.js.map +1 -0
  535. package/dist/shared/locale/keys.d.ts +5 -0
  536. package/dist/shared/locale/keys.js +33 -0
  537. package/dist/shared/locale/keys.js.map +1 -0
  538. package/dist/shared/locale/language.d.ts +4 -0
  539. package/dist/shared/locale/language.js +23 -0
  540. package/dist/shared/locale/language.js.map +1 -0
  541. package/dist/shared/locale/messages.d.ts +3 -0
  542. package/dist/shared/locale/messages.js +9 -0
  543. package/dist/shared/locale/messages.js.map +1 -0
  544. package/dist/shared/locale/plural.d.ts +2 -0
  545. package/dist/shared/locale/plural.js +81 -0
  546. package/dist/shared/locale/plural.js.map +1 -0
  547. package/dist/shared/locale/substitutions.d.ts +10 -0
  548. package/dist/shared/locale/substitutions.js +32 -0
  549. package/dist/shared/locale/substitutions.js.map +1 -0
  550. package/dist/types/background.d.ts +1 -1
  551. package/dist/types/background.js.map +1 -1
  552. package/dist/types/command.d.ts +1 -1
  553. package/dist/types/command.js.map +1 -1
  554. package/dist/types/content/adapters/index.d.ts +2 -0
  555. package/dist/types/content/adapters/index.js +1 -0
  556. package/dist/types/content/adapters/index.js.map +1 -0
  557. package/dist/types/content/adapters/react.d.ts +4 -0
  558. package/dist/types/content/adapters/react.js +1 -0
  559. package/dist/types/content/adapters/react.js.map +1 -0
  560. package/dist/types/content/adapters/vanilla.d.ts +1 -0
  561. package/dist/types/content/adapters/vanilla.js +1 -0
  562. package/dist/types/content/adapters/vanilla.js.map +1 -0
  563. package/dist/types/content/boundary.d.ts +17 -0
  564. package/dist/types/content/boundary.js +1 -0
  565. package/dist/types/content/boundary.js.map +1 -0
  566. package/dist/types/{content.d.ts → content/common.d.ts} +119 -59
  567. package/dist/types/{content.js → content/common.js} +23 -2
  568. package/dist/types/content/common.js.map +1 -0
  569. package/dist/types/content/definition.d.ts +61 -0
  570. package/dist/types/content/definition.js +1 -0
  571. package/dist/types/content/definition.js.map +1 -0
  572. package/dist/types/content/index.d.ts +7 -0
  573. package/dist/types/content/index.js +2 -0
  574. package/dist/types/content/index.js.map +1 -0
  575. package/dist/types/content/prepare.d.ts +9 -0
  576. package/dist/types/content/prepare.js +1 -0
  577. package/dist/types/content/prepare.js.map +1 -0
  578. package/dist/types/content/render.d.ts +6 -0
  579. package/dist/types/content/render.js +1 -0
  580. package/dist/types/content/render.js.map +1 -0
  581. package/dist/types/content/target.d.ts +13 -0
  582. package/dist/types/content/target.js +1 -0
  583. package/dist/types/content/target.js.map +1 -0
  584. package/dist/types/entrypoint.d.ts +20 -0
  585. package/dist/types/entrypoint.js +4 -0
  586. package/dist/types/entrypoint.js.map +1 -1
  587. package/dist/types/icon.d.ts +8 -0
  588. package/dist/types/icon.js.map +1 -1
  589. package/dist/types/language.d.ts +57 -0
  590. package/dist/types/language.js +62 -0
  591. package/dist/types/language.js.map +1 -0
  592. package/dist/types/locale.d.ts +34 -63
  593. package/dist/types/locale.js +62 -119
  594. package/dist/types/locale.js.map +1 -1
  595. package/dist/types/manifest.d.ts +11 -8
  596. package/dist/types/manifest.js.map +1 -1
  597. package/dist/types/message.d.ts +7 -0
  598. package/dist/types/message.js.map +1 -1
  599. package/dist/types/offscreen.d.ts +14 -1
  600. package/dist/types/offscreen.js.map +1 -1
  601. package/dist/types/page.d.ts +8 -0
  602. package/dist/types/popup.d.ts +9 -0
  603. package/dist/types/relay.d.ts +15 -7
  604. package/dist/types/relay.js.map +1 -1
  605. package/dist/types/sandbox.d.ts +12 -0
  606. package/dist/types/sandbox.js.map +1 -1
  607. package/dist/types/service.d.ts +10 -1
  608. package/dist/types/service.js.map +1 -1
  609. package/dist/types/sidebar.d.ts +9 -0
  610. package/dist/types/sidebar.js.map +1 -1
  611. package/dist/types/transport.d.ts +4 -0
  612. package/dist/virtual/icon.d.ts +2 -0
  613. package/dist/virtual/icon.js +5 -0
  614. package/dist/virtual/icon.js.map +1 -0
  615. package/dist/virtual/locale.d.ts +7 -0
  616. package/dist/virtual/locale.js +13 -0
  617. package/dist/virtual/locale.js.map +1 -0
  618. package/dist/virtual/modules.d.ts +41 -0
  619. package/dist/virtual/offscreen.d.ts +3 -0
  620. package/dist/virtual/offscreen.js +5 -0
  621. package/dist/virtual/offscreen.js.map +1 -0
  622. package/dist/virtual/page.d.ts +2 -0
  623. package/dist/virtual/page.js +5 -0
  624. package/dist/virtual/page.js.map +1 -0
  625. package/dist/virtual/popup.d.ts +3 -0
  626. package/dist/virtual/popup.js +5 -0
  627. package/dist/virtual/popup.js.map +1 -0
  628. package/dist/virtual/relay.d.ts +3 -0
  629. package/dist/virtual/relay.js +5 -0
  630. package/dist/virtual/relay.js.map +1 -0
  631. package/dist/virtual/runtime.d.ts +8 -0
  632. package/dist/virtual/runtime.js +9 -0
  633. package/dist/virtual/runtime.js.map +1 -0
  634. package/dist/virtual/sandbox.d.ts +3 -0
  635. package/dist/virtual/sandbox.js +5 -0
  636. package/dist/virtual/sandbox.js.map +1 -0
  637. package/dist/virtual/sidebar.d.ts +3 -0
  638. package/dist/virtual/sidebar.js +5 -0
  639. package/dist/virtual/sidebar.js.map +1 -0
  640. package/package.json +53 -23
  641. package/scripts/clean-dist.js +7 -0
  642. package/scripts/copy-dts.js +11 -1
  643. package/scripts/merge-coverage.mjs +12 -0
  644. package/scripts/pre-commit.mjs +22 -0
  645. package/scripts/test-inventory.mjs +38 -0
  646. package/scripts/test-run.mjs +25 -0
  647. package/types/client.d.ts +15 -0
  648. package/dist/cli/builders/manifest/utils.d.ts +0 -32
  649. package/dist/cli/builders/manifest/utils.js +0 -209
  650. package/dist/cli/builders/manifest/utils.js.map +0 -1
  651. package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
  652. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
  653. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
  654. package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
  655. package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
  656. package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
  657. package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
  658. package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
  659. package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
  660. package/dist/cli/bundler/utils/output.d.ts +0 -2
  661. package/dist/cli/bundler/utils/output.js +0 -15
  662. package/dist/cli/bundler/utils/output.js.map +0 -1
  663. package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/account.options.d.ts +0 -1
  664. package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/advanced.options/index.d.ts +0 -1
  665. package/dist/cli/plugins/output.d.ts +0 -2
  666. package/dist/cli/plugins/output.js +0 -32
  667. package/dist/cli/plugins/output.js.map +0 -1
  668. package/dist/entry/content/adapters/react/resolvers/index.d.ts +0 -1
  669. package/dist/entry/content/adapters/react/resolvers/index.js +0 -2
  670. package/dist/entry/content/adapters/react/resolvers/index.js.map +0 -1
  671. package/dist/entry/content/core/AbstractMarker.js.map +0 -1
  672. package/dist/entry/content/core/AttributeMarker.js.map +0 -1
  673. package/dist/entry/content/core/Builder.d.ts +0 -27
  674. package/dist/entry/content/core/Builder.js +0 -124
  675. package/dist/entry/content/core/Builder.js.map +0 -1
  676. package/dist/entry/content/core/Context.js +0 -43
  677. package/dist/entry/content/core/Context.js.map +0 -1
  678. package/dist/entry/content/core/EventEmitter.js.map +0 -1
  679. package/dist/entry/content/core/EventNode.js.map +0 -1
  680. package/dist/entry/content/core/ManagedContext.d.ts +0 -5
  681. package/dist/entry/content/core/ManagedContext.js.map +0 -1
  682. package/dist/entry/content/core/MarkerNode.js.map +0 -1
  683. package/dist/entry/content/core/MountBuilder.d.ts +0 -10
  684. package/dist/entry/content/core/MountBuilder.js +0 -40
  685. package/dist/entry/content/core/MountBuilder.js.map +0 -1
  686. package/dist/entry/content/core/MountNode.js.map +0 -1
  687. package/dist/entry/content/core/Node.js.map +0 -1
  688. package/dist/entry/content/core/WeakMarker.js.map +0 -1
  689. package/dist/entry/content/core/resolvers/anchor.d.ts +0 -2
  690. package/dist/entry/content/core/resolvers/anchor.js.map +0 -1
  691. package/dist/entry/content/core/resolvers/container.d.ts +0 -2
  692. package/dist/entry/content/core/resolvers/container.js.map +0 -1
  693. package/dist/entry/content/core/resolvers/definition.d.ts +0 -3
  694. package/dist/entry/content/core/resolvers/definition.js +0 -12
  695. package/dist/entry/content/core/resolvers/definition.js.map +0 -1
  696. package/dist/entry/content/core/resolvers/index.js.map +0 -1
  697. package/dist/entry/content/core/resolvers/mount.d.ts +0 -2
  698. package/dist/entry/content/core/resolvers/mount.js.map +0 -1
  699. package/dist/entry/content/core/resolvers/render.d.ts +0 -3
  700. package/dist/entry/content/core/resolvers/render.js +0 -18
  701. package/dist/entry/content/core/resolvers/render.js.map +0 -1
  702. package/dist/entry/content/core/resolvers/watch.d.ts +0 -4
  703. package/dist/entry/content/core/resolvers/watch.js.map +0 -1
  704. package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
  705. package/dist/locale/adapters/react/LocaleProvider.js +0 -58
  706. package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
  707. package/dist/locale/adapters/react/context.d.ts +0 -14
  708. package/dist/locale/adapters/react/context.js +0 -25
  709. package/dist/locale/adapters/react/context.js.map +0 -1
  710. package/dist/locale/utils.d.ts +0 -11
  711. package/dist/locale/utils.js +0 -67
  712. package/dist/locale/utils.js.map +0 -1
  713. package/dist/types/content.js.map +0 -1
  714. /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
  715. /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
  716. /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/entry/relay/TransportBuilder.ts"],"sourcesContent":["import AbstractBuilder from \"@entry/transport/AbstractBuilder\";\n\nimport {RegisterRelay} from \"@relay/providers\";\n\nimport {RelayOptions, RelayUnresolvedDefinition, RelayMethod} from \"@typing/relay\";\nimport {TransportName, TransportType} from \"@typing/transport\";\n\nexport default class<T extends TransportType = TransportType> extends AbstractBuilder<RelayOptions, T> {\n protected readonly method: RelayMethod;\n\n constructor(definition: RelayUnresolvedDefinition<T>) {\n const {main, method, ...options} = definition;\n\n super(options);\n\n this.method = method || RelayMethod.Messaging;\n }\n\n protected transport(): RegisterRelay<TransportName, T, [RelayOptions]> {\n const {name, init} = this.definition;\n\n return new RegisterRelay(name, this.method, init);\n }\n}\n"],"mappings":"AAAA,OAAO,qBAAqB;AAE5B,SAAQ,qBAAoB;AAE5B,SAAiD,mBAAkB;AAGnE,MAAO,iCAA+D,gBAAiC;AAAA,EAChF;AAAA,EAEnB,YAAY,YAA0C;AAClD,UAAM,EAAC,MAAM,QAAQ,GAAG,QAAO,IAAI;AAEnC,UAAM,OAAO;AAEb,SAAK,SAAS,UAAU,YAAY;AAAA,EACxC;AAAA,EAEU,YAA6D;AACnE,UAAM,EAAC,MAAM,KAAI,IAAI,KAAK;AAE1B,WAAO,IAAI,cAAc,MAAM,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/entry/relay/TransportBuilder.ts"],"sourcesContent":["import AbstractBuilder from \"@entry/transport/AbstractBuilder\";\n\nimport {RegisterRelay} from \"@relay/providers\";\n\nimport {RelayOptions, RelayUnresolvedDefinition, RelayMethod} from \"@typing/relay\";\nimport {TransportName, TransportType} from \"@typing/transport\";\nimport type {ContentScriptIsolation} from \"@typing/content\";\n\nexport default class TransportBuilder<\n T extends TransportType = TransportType,\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n> extends AbstractBuilder<RelayOptions, T> {\n protected readonly method: RelayMethod;\n\n constructor(definition: RelayUnresolvedDefinition<T, Data, Isolation>) {\n const {main, method, prepare, boundary, target, ...options} = definition;\n\n super(options);\n\n this.method = method || RelayMethod.Messaging;\n }\n\n protected transport(): RegisterRelay<TransportName, T, [RelayOptions]> {\n const {name, init} = this.definition;\n\n return new RegisterRelay(name, this.method, init);\n }\n}\n"],"mappings":"AAAA,OAAO,qBAAqB;AAE5B,SAAQ,qBAAoB;AAE5B,SAAiD,mBAAkB;AAInE,MAAO,yBAIG,gBAAiC;AAAA,EACpB;AAAA,EAEnB,YAAY,YAA2D;AACnE,UAAM,EAAC,MAAM,QAAQ,SAAS,UAAU,QAAQ,GAAG,QAAO,IAAI;AAE9D,UAAM,OAAO;AAEb,SAAK,SAAS,UAAU,YAAY;AAAA,EACxC;AAAA,EAEU,YAA6D;AACnE,UAAM,EAAC,MAAM,KAAI,IAAI,KAAK;AAE1B,WAAO,IAAI,cAAc,MAAM,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;","names":[]}
@@ -1,5 +1,8 @@
1
1
  import Builder from "./Builder.js";
2
+ import type { RelayUnresolvedDefinition } from "../../types/relay.js";
3
+ import type { TransportType } from "../../types/transport.js";
4
+ import type { ContentScriptIsolation } from "../../types/content/index.js";
2
5
  export { Builder };
6
+ export { resolveDefinition } from "./resolvers/definition.js";
3
7
  export type { RelayUnresolvedDefinition } from "../../types/relay.js";
4
- declare const _default: (definition: Partial<import("../../types/relay.js").RelayDefinition<import("../../transport/index.js").TransportType>>) => void;
5
- export default _default;
8
+ export default function relay<T extends TransportType, Data = unknown, Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`>(definition: RelayUnresolvedDefinition<T, Data, Isolation>, contentBuilder: ConstructorParameters<typeof Builder<T, Data, NoInfer<Isolation>>>[1]): void;
@@ -1,7 +1,13 @@
1
1
  import Builder from "./Builder.js";
2
- var relay_default = Builder.resolver();
2
+ import { resolveDefinition } from "./resolvers/definition.js";
3
+ function relay(definition, contentBuilder) {
4
+ new Builder(definition, contentBuilder).build().catch((error) => {
5
+ console.error("Failed to build relay: ", error);
6
+ });
7
+ }
3
8
  export {
4
9
  Builder,
5
- relay_default as default
10
+ relay as default,
11
+ resolveDefinition
6
12
  };
7
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/entry/relay/index.ts"],"sourcesContent":["import Builder from \"./Builder\";\n\nexport {Builder};\nexport type {RelayUnresolvedDefinition} from \"@typing/relay\";\n\nexport default Builder.resolver();\n"],"mappings":"AAAA,OAAO,aAAa;AAKpB,IAAO,gBAAQ,QAAQ,SAAS;","names":[]}
1
+ {"version":3,"sources":["../../../src/entry/relay/index.ts"],"sourcesContent":["import Builder from \"./Builder\";\n\nimport type {RelayUnresolvedDefinition} from \"@typing/relay\";\nimport type {TransportType} from \"@typing/transport\";\nimport type {ContentScriptIsolation} from \"@typing/content\";\n\nexport {Builder};\nexport {resolveDefinition} from \"./resolvers/definition\";\nexport type {RelayUnresolvedDefinition} from \"@typing/relay\";\n\nexport default function relay<\n T extends TransportType,\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n>(\n definition: RelayUnresolvedDefinition<T, Data, Isolation>,\n contentBuilder: ConstructorParameters<typeof Builder<T, Data, NoInfer<Isolation>>>[1]\n): void {\n new Builder(definition, contentBuilder).build().catch(error => {\n console.error(\"Failed to build relay: \", error);\n });\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAOpB,SAAQ,yBAAwB;AAGjB,SAAR,MAKH,YACA,gBACI;AACJ,MAAI,QAAQ,YAAY,cAAc,EAAE,MAAM,EAAE,MAAM,WAAS;AAC3D,YAAQ,MAAM,2BAA2B,KAAK;AAAA,EAClD,CAAC;AACL;","names":[]}
@@ -0,0 +1,4 @@
1
+ import type { RelayUnresolvedDefinition } from "../../../types/relay.js";
2
+ import type { TransportType } from "../../../types/transport.js";
3
+ /** Resolve Relay exports without executing init; the build supplies the authoritative name. */
4
+ export declare const resolveDefinition: <T extends TransportType = TransportType>(module: object, name: string) => RelayUnresolvedDefinition<T>;
@@ -0,0 +1,16 @@
1
+ import { isValidTransportDefinition, isValidTransportInitFunction } from "./../../../entry/transport/resolvers/definition.js";
2
+ const resolveDefinition = (module, name) => {
3
+ const { default: defaultDefinition, ...otherDefinition } = module;
4
+ let definition = otherDefinition;
5
+ if (isValidTransportDefinition(defaultDefinition)) {
6
+ definition = { ...definition, ...defaultDefinition };
7
+ } else if (isValidTransportInitFunction(defaultDefinition)) {
8
+ definition = { ...definition, init: defaultDefinition };
9
+ }
10
+ const { init, main, name: _name, ...options } = definition;
11
+ return { name, init, main, ...options };
12
+ };
13
+ export {
14
+ resolveDefinition
15
+ };
16
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/entry/relay/resolvers/definition.ts"],"sourcesContent":["import {isValidTransportDefinition, isValidTransportInitFunction} from \"@entry/transport/resolvers/definition\";\n\nimport type {RelayOptions, RelayUnresolvedDefinition} from \"@typing/relay\";\nimport type {TransportType} from \"@typing/transport\";\n\n/** Resolve Relay exports without executing init; the build supplies the authoritative name. */\nexport const resolveDefinition = <T extends TransportType = TransportType>(\n module: object,\n name: string\n): RelayUnresolvedDefinition<T> => {\n const {default: defaultDefinition, ...otherDefinition} = module as Record<string, unknown>;\n\n let definition = otherDefinition as RelayUnresolvedDefinition<T>;\n\n if (isValidTransportDefinition<RelayOptions, T>(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidTransportInitFunction<RelayOptions, T>(defaultDefinition)) {\n definition = {...definition, init: defaultDefinition};\n }\n\n const {init, main, name: _name, ...options} = definition;\n\n return {name, init, main, ...options};\n};\n"],"mappings":"AAAA,SAAQ,4BAA4B,oCAAmC;AAMhE,MAAM,oBAAoB,CAC7B,QACA,SAC+B;AAC/B,QAAM,EAAC,SAAS,mBAAmB,GAAG,gBAAe,IAAI;AAEzD,MAAI,aAAa;AAEjB,MAAI,2BAA4C,iBAAiB,GAAG;AAChE,iBAAa,EAAC,GAAG,YAAY,GAAG,kBAAiB;AAAA,EACrD,WAAW,6BAA8C,iBAAiB,GAAG;AACzE,iBAAa,EAAC,GAAG,YAAY,MAAM,kBAAiB;AAAA,EACxD;AAEA,QAAM,EAAC,MAAM,MAAM,MAAM,OAAO,GAAG,QAAO,IAAI;AAE9C,SAAO,EAAC,MAAM,MAAM,MAAM,GAAG,QAAO;AACxC;","names":[]}
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Language, LocaleDir, LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs, LocaleSnapshot } from "../../../types/locale.js";
3
+ import type { LocaleReactContract, LocaleReactSubstitutionArgs } from "./types.js";
4
+ /** Adapts an existing message provider to React without owning storage or language changes. */
5
+ export default class ReactLocale<S extends object = LocaleRegistry> implements LocaleReactContract<S> {
6
+ private readonly locale;
7
+ readonly lang: Language;
8
+ readonly langs: ReadonlySet<Language>;
9
+ readonly langNames: ReadonlyMap<Language, string>;
10
+ readonly dir: LocaleDir;
11
+ readonly isRtl: boolean;
12
+ constructor(locale: LocaleSnapshot<S>);
13
+ t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
14
+ t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
15
+ choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
16
+ choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
17
+ private render;
18
+ }
@@ -0,0 +1,41 @@
1
+ import { createElement, Fragment } from "react";
2
+ import { selectPluralForm, applySubstitutions, getLocaleDir, isLocaleRtl } from "./../../../shared/locale/index.js";
3
+ class ReactLocale {
4
+ constructor(locale) {
5
+ this.locale = locale;
6
+ this.lang = locale.lang();
7
+ this.langs = locale.langs();
8
+ this.langNames = locale.langNames();
9
+ this.dir = getLocaleDir(this.lang);
10
+ this.isRtl = isLocaleRtl(this.lang);
11
+ this.t = this.t.bind(this);
12
+ this.choice = this.choice.bind(this);
13
+ }
14
+ locale;
15
+ lang;
16
+ langs;
17
+ langNames;
18
+ dir;
19
+ isRtl;
20
+ t(key, substitutions) {
21
+ return this.render(key, substitutions);
22
+ }
23
+ choice(key, count, substitutions) {
24
+ return this.render(key, substitutions, count);
25
+ }
26
+ render(key, substitutions, count) {
27
+ const message = this.locale.get(key);
28
+ const template = count === void 0 ? message : selectPluralForm(message, this.lang, count);
29
+ const parts = applySubstitutions(template, substitutions, (name) => {
30
+ console.warn(`Locale substitution "${name}" not found for key "${key}" in "${this.lang}" language.`);
31
+ });
32
+ if (parts.every((part) => typeof part === "string" || typeof part === "number")) {
33
+ return parts.join("");
34
+ }
35
+ return parts.map((part, index) => createElement(Fragment, { key: index }, part));
36
+ }
37
+ }
38
+ export {
39
+ ReactLocale as default
40
+ };
41
+ //# sourceMappingURL=ReactLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/locale/adapters/react/ReactLocale.ts"],"sourcesContent":["import {createElement, Fragment, type ReactNode} from \"react\";\n\nimport {selectPluralForm, applySubstitutions, getLocaleDir, isLocaleRtl} from \"@shared/locale\";\n\nimport type {\n Language,\n LocaleDir,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleRegistry,\n LocaleSubstitutionArgs,\n LocaleSnapshot,\n} from \"@typing/locale\";\n\nimport type {LocaleReactContract, LocaleReactSubstitutionArgs} from \"./types\";\n\n/** Adapts an existing message provider to React without owning storage or language changes. */\nexport default class ReactLocale<S extends object = LocaleRegistry> implements LocaleReactContract<S> {\n public readonly lang: Language;\n public readonly langs: ReadonlySet<Language>;\n public readonly langNames: ReadonlyMap<Language, string>;\n public readonly dir: LocaleDir;\n public readonly isRtl: boolean;\n\n constructor(private readonly locale: LocaleSnapshot<S>) {\n this.lang = locale.lang();\n this.langs = locale.langs();\n this.langNames = locale.langNames();\n this.dir = getLocaleDir(this.lang);\n this.isRtl = isLocaleRtl(this.lang);\n\n this.t = this.t.bind(this);\n this.choice = this.choice.bind(this);\n }\n\n public t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;\n public t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;\n public t(key: LocaleNonPluralKeys<S>, substitutions?: Record<string, ReactNode>): ReactNode {\n return this.render(key, substitutions);\n }\n\n public choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;\n public choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n ...args: LocaleReactSubstitutionArgs<S, K>\n ): ReactNode;\n public choice(key: LocalePluralKeys<S>, count: number, substitutions?: Record<string, ReactNode>): ReactNode {\n return this.render(key, substitutions, count);\n }\n\n private render(key: keyof S & string, substitutions?: Record<string, ReactNode>, count?: number): ReactNode {\n const message = this.locale.get(key);\n\n const template = count === undefined ? message : selectPluralForm(message, this.lang, count);\n\n const parts = applySubstitutions(template, substitutions, name => {\n console.warn(`Locale substitution \"${name}\" not found for key \"${key}\" in \"${this.lang}\" language.`);\n });\n\n if (parts.every(part => typeof part === \"string\" || typeof part === \"number\")) {\n return parts.join(\"\");\n }\n\n return parts.map((part, index) => createElement(Fragment, {key: index}, part));\n }\n}\n"],"mappings":"AAAA,SAAQ,eAAe,gBAA+B;AAEtD,SAAQ,kBAAkB,oBAAoB,cAAc,mBAAkB;AAe9E,MAAO,YAA+F;AAAA,EAOlG,YAA6B,QAA2B;AAA3B;AACzB,SAAK,OAAO,OAAO,KAAK;AACxB,SAAK,QAAQ,OAAO,MAAM;AAC1B,SAAK,YAAY,OAAO,UAAU;AAClC,SAAK,MAAM,aAAa,KAAK,IAAI;AACjC,SAAK,QAAQ,YAAY,KAAK,IAAI;AAElC,SAAK,IAAI,KAAK,EAAE,KAAK,IAAI;AACzB,SAAK,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,EACvC;AAAA,EAT6B;AAAA,EANb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAeT,EAAE,KAA6B,eAAsD;AACxF,WAAO,KAAK,OAAO,KAAK,aAAa;AAAA,EACzC;AAAA,EAQO,OAAO,KAA0B,OAAe,eAAsD;AACzG,WAAO,KAAK,OAAO,KAAK,eAAe,KAAK;AAAA,EAChD;AAAA,EAEQ,OAAO,KAAuB,eAA2C,OAA2B;AACxG,UAAM,UAAU,KAAK,OAAO,IAAI,GAAG;AAEnC,UAAM,WAAW,UAAU,SAAY,UAAU,iBAAiB,SAAS,KAAK,MAAM,KAAK;AAE3F,UAAM,QAAQ,mBAAmB,UAAU,eAAe,UAAQ;AAC9D,cAAQ,KAAK,wBAAwB,IAAI,wBAAwB,GAAG,SAAS,KAAK,IAAI,aAAa;AAAA,IACvG,CAAC;AAED,QAAI,MAAM,MAAM,UAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,GAAG;AAC3E,aAAO,MAAM,KAAK,EAAE;AAAA,IACxB;AAEA,WAAO,MAAM,IAAI,CAAC,MAAM,UAAU,cAAc,UAAU,EAAC,KAAK,MAAK,GAAG,IAAI,CAAC;AAAA,EACjF;AACJ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import type { LocaleReactContract } from "../types.js";
2
+ /**
3
+ * Applies language attributes from either locale hook to an element after render.
4
+ * An omitted target or undefined selects html; null disables application.
5
+ * Cleanup restores each previous attribute only while its applied value is unchanged.
6
+ */
7
+ export declare const useLocaleAttributes: (locale: Pick<LocaleReactContract, "lang" | "dir">, target?: string | Element | null) => void;
@@ -0,0 +1,30 @@
1
+ import { useEffect } from "react";
2
+ const useLocaleAttributes = (locale, target = "html") => {
3
+ const { lang, dir } = locale;
4
+ useEffect(() => {
5
+ const element = typeof target === "string" ? document.querySelector(target) : target;
6
+ if (!element) return;
7
+ const attributes = Object.entries({ lang, dir }).map(([name, value]) => ({
8
+ name,
9
+ value,
10
+ previous: element.getAttribute(name)
11
+ }));
12
+ for (const { name, value } of attributes) {
13
+ element.setAttribute(name, value);
14
+ }
15
+ return () => {
16
+ for (const { name, value, previous } of attributes) {
17
+ if (element.getAttribute(name) !== value) continue;
18
+ if (previous === null) {
19
+ element.removeAttribute(name);
20
+ } else {
21
+ element.setAttribute(name, previous);
22
+ }
23
+ }
24
+ };
25
+ }, [target, lang, dir]);
26
+ };
27
+ export {
28
+ useLocaleAttributes
29
+ };
30
+ //# sourceMappingURL=use-locale-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-locale-attributes.ts"],"sourcesContent":["import {useEffect} from \"react\";\nimport type {LocaleReactContract} from \"../types\";\n\n/**\n * Applies language attributes from either locale hook to an element after render.\n * An omitted target or undefined selects html; null disables application.\n * Cleanup restores each previous attribute only while its applied value is unchanged.\n */\nexport const useLocaleAttributes = (\n locale: Pick<LocaleReactContract, \"lang\" | \"dir\">,\n target: string | Element | null = \"html\"\n): void => {\n const {lang, dir} = locale;\n\n useEffect(() => {\n const element = typeof target === \"string\" ? document.querySelector(target) : target;\n\n if (!element) return;\n\n const attributes = Object.entries({lang, dir}).map(([name, value]) => ({\n name,\n value,\n previous: element.getAttribute(name),\n }));\n\n for (const {name, value} of attributes) {\n element.setAttribute(name, value);\n }\n\n return () => {\n for (const {name, value, previous} of attributes) {\n if (element.getAttribute(name) !== value) continue;\n\n if (previous === null) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, previous);\n }\n }\n };\n }, [target, lang, dir]);\n};\n"],"mappings":"AAAA,SAAQ,iBAAgB;AAQjB,MAAM,sBAAsB,CAC/B,QACA,SAAkC,WAC3B;AACP,QAAM,EAAC,MAAM,IAAG,IAAI;AAEpB,YAAU,MAAM;AACZ,UAAM,UAAU,OAAO,WAAW,WAAW,SAAS,cAAc,MAAM,IAAI;AAE9E,QAAI,CAAC,QAAS;AAEd,UAAM,aAAa,OAAO,QAAQ,EAAC,MAAM,IAAG,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO;AAAA,MACnE;AAAA,MACA;AAAA,MACA,UAAU,QAAQ,aAAa,IAAI;AAAA,IACvC,EAAE;AAEF,eAAW,EAAC,MAAM,MAAK,KAAK,YAAY;AACpC,cAAQ,aAAa,MAAM,KAAK;AAAA,IACpC;AAEA,WAAO,MAAM;AACT,iBAAW,EAAC,MAAM,OAAO,SAAQ,KAAK,YAAY;AAC9C,YAAI,QAAQ,aAAa,IAAI,MAAM,MAAO;AAE1C,YAAI,aAAa,MAAM;AACnB,kBAAQ,gBAAgB,IAAI;AAAA,QAChC,OAAO;AACH,kBAAQ,aAAa,MAAM,QAAQ;AAAA,QACvC;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,GAAG,CAAC,QAAQ,MAAM,GAAG,CAAC;AAC1B;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { LocaleReactDynamicContract } from "../types.js";
2
+ import type { LocaleStorageDriver } from "../../../../types/locale.js";
3
+ export declare const useLocale: (storage?: LocaleStorageDriver | false) => LocaleReactDynamicContract;
@@ -0,0 +1,17 @@
1
+ import { useMemo, useSyncExternalStore } from "react";
2
+ import ReactLocale from "../ReactLocale.js";
3
+ import { ObservableLocale } from "./../../../../locale/providers/index.js";
4
+ const useLocale = (storage) => {
5
+ const locale = useMemo(() => ObservableLocale.getInstance(storage), [storage]);
6
+ const snapshot = useSyncExternalStore(locale.subscribe, locale.snapshot);
7
+ return useMemo(
8
+ () => Object.assign(new ReactLocale(snapshot), {
9
+ change: locale.change
10
+ }),
11
+ [locale, snapshot]
12
+ );
13
+ };
14
+ export {
15
+ useLocale
16
+ };
17
+ //# sourceMappingURL=use-locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-locale.ts"],"sourcesContent":["import {useMemo, useSyncExternalStore} from \"react\";\n\nimport ReactLocale from \"../ReactLocale\";\n\nimport {ObservableLocale} from \"@locale/providers\";\n\nimport type {LocaleReactDynamicContract} from \"../types\";\nimport type {LocaleRegistry, LocaleStorageDriver} from \"@typing/locale\";\n\nexport const useLocale = (storage?: LocaleStorageDriver | false): LocaleReactDynamicContract => {\n const locale = useMemo(() => ObservableLocale.getInstance(storage), [storage]);\n const snapshot = useSyncExternalStore(locale.subscribe, locale.snapshot);\n\n return useMemo(\n () =>\n Object.assign(new ReactLocale<LocaleRegistry>(snapshot), {\n change: locale.change,\n }),\n [locale, snapshot]\n );\n};\n"],"mappings":"AAAA,SAAQ,SAAS,4BAA2B;AAE5C,OAAO,iBAAiB;AAExB,SAAQ,wBAAuB;AAKxB,MAAM,YAAY,CAAC,YAAsE;AAC5F,QAAM,SAAS,QAAQ,MAAM,iBAAiB,YAAY,OAAO,GAAG,CAAC,OAAO,CAAC;AAC7E,QAAM,WAAW,qBAAqB,OAAO,WAAW,OAAO,QAAQ;AAEvE,SAAO;AAAA,IACH,MACI,OAAO,OAAO,IAAI,YAA4B,QAAQ,GAAG;AAAA,MACrD,QAAQ,OAAO;AAAA,IACnB,CAAC;AAAA,IACL,CAAC,QAAQ,QAAQ;AAAA,EACrB;AACJ;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { LocaleReactContract } from "../types.js";
2
+ /** Uses browser-selected translations with React substitutions. */
3
+ export declare const useNativeLocale: () => LocaleReactContract;
@@ -0,0 +1,10 @@
1
+ import { useMemo } from "react";
2
+ import NativeLocale from "./../../../../locale/providers/NativeLocale.js";
3
+ import ReactLocale from "../ReactLocale.js";
4
+ const useNativeLocale = () => {
5
+ return useMemo(() => new ReactLocale(NativeLocale.getInstance()), []);
6
+ };
7
+ export {
8
+ useNativeLocale
9
+ };
10
+ //# sourceMappingURL=use-native-locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/locale/adapters/react/hooks/use-native-locale.ts"],"sourcesContent":["import {useMemo} from \"react\";\nimport NativeLocale from \"@locale/providers/NativeLocale\";\nimport ReactLocale from \"../ReactLocale\";\nimport type {LocaleRegistry} from \"@typing/locale\";\nimport type {LocaleReactContract} from \"../types\";\n\n/** Uses browser-selected translations with React substitutions. */\nexport const useNativeLocale = (): LocaleReactContract => {\n return useMemo(() => new ReactLocale<LocaleRegistry>(NativeLocale.getInstance()), []);\n};\n"],"mappings":"AAAA,SAAQ,eAAc;AACtB,OAAO,kBAAkB;AACzB,OAAO,iBAAiB;AAKjB,MAAM,kBAAkB,MAA2B;AACtD,SAAO,QAAQ,MAAM,IAAI,YAA4B,aAAa,YAAY,CAAC,GAAG,CAAC,CAAC;AACxF;","names":[]}
@@ -1,2 +1,4 @@
1
- export { default as LocaleProvider, type LocaleProviderProps } from "./LocaleProvider.js";
2
- export { useLocale, type LocaleContract } from "./context.js";
1
+ export { useNativeLocale } from "./hooks/use-native-locale.js";
2
+ export { useLocale } from "./hooks/use-locale.js";
3
+ export { useLocaleAttributes } from "./hooks/use-locale-attributes.js";
4
+ export type { LocaleReactContract, LocaleReactDynamicContract } from "./types.js";
@@ -1,7 +1,9 @@
1
- import { default as default2 } from "./LocaleProvider.js";
2
- import { useLocale } from "./context.js";
1
+ import { useNativeLocale } from "./hooks/use-native-locale.js";
2
+ import { useLocale } from "./hooks/use-locale.js";
3
+ import { useLocaleAttributes } from "./hooks/use-locale-attributes.js";
3
4
  export {
4
- default2 as LocaleProvider,
5
- useLocale
5
+ useLocale,
6
+ useLocaleAttributes,
7
+ useNativeLocale
6
8
  };
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/locale/adapters/react/index.ts"],"sourcesContent":["export {default as LocaleProvider, type LocaleProviderProps} from \"./LocaleProvider\";\nexport {useLocale, type LocaleContract} from \"./context\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA0D;AAClE,SAAQ,iBAAqC;","names":["default"]}
1
+ {"version":3,"sources":["../../../../src/locale/adapters/react/index.ts"],"sourcesContent":["export {useNativeLocale} from \"./hooks/use-native-locale\";\nexport {useLocale} from \"./hooks/use-locale\";\nexport {useLocaleAttributes} from \"./hooks/use-locale-attributes\";\nexport type {LocaleReactContract, LocaleReactDynamicContract} from \"./types\";\n"],"mappings":"AAAA,SAAQ,uBAAsB;AAC9B,SAAQ,iBAAgB;AACxB,SAAQ,2BAA0B;","names":[]}
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from "react";
2
+ import type { Language, LocaleDir, LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs, LocaleSubstitutionKeys } from "../../../types/locale.js";
3
+ export type LocaleReactSubstitutionArgs<S, K extends keyof S> = string extends keyof S ? [substitutions?: Record<string, ReactNode>] : [LocaleSubstitutionKeys<S, K>] extends [never] ? [] : [substitutions: Record<LocaleSubstitutionKeys<S, K>, ReactNode>];
4
+ /** Translation capabilities shared by React adapters, without language mutation or storage. */
5
+ export interface LocaleReactContract<S extends object = LocaleRegistry> {
6
+ /** Currently selected language code. */
7
+ readonly lang: Language;
8
+ /** Available language codes. */
9
+ readonly langs: ReadonlySet<Language>;
10
+ /** Native names keyed by the available language codes. */
11
+ readonly langNames: ReadonlyMap<Language, string>;
12
+ readonly dir: LocaleDir;
13
+ readonly isRtl: boolean;
14
+ t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
15
+ t<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
16
+ choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
17
+ choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleReactSubstitutionArgs<S, K>): ReactNode;
18
+ }
19
+ /** React translations with an observable language selection. */
20
+ export interface LocaleReactDynamicContract<S extends object = LocaleRegistry> extends LocaleReactContract<S> {
21
+ change(lang: Language): Promise<Language>;
22
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,5 +1,4 @@
1
- import { LocaleNativeStructure } from "./providers/index.js";
2
- import { LocaleNonPluralKeys, LocalePluralKeys, LocaleSubstitutionArgs } from "../types/locale.js";
1
+ import type { LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs } from "../types/locale.js";
3
2
  /**
4
3
  * Translates a non-plural locale key.
5
4
  *
@@ -17,7 +16,7 @@ import { LocaleNonPluralKeys, LocalePluralKeys, LocaleSubstitutionArgs } from ".
17
16
  * @param args
18
17
  * @returns The translated string.
19
18
  */
20
- export declare const t: <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(key: K, ...args: LocaleSubstitutionArgs<LocaleNativeStructure, K>) => string;
19
+ export declare const t: <K extends LocaleNonPluralKeys<LocaleRegistry>>(key: K, ...args: LocaleSubstitutionArgs<LocaleRegistry, K>) => string;
21
20
  /**
22
21
  * Translates a plural locale key using the provided count.
23
22
  *
@@ -35,7 +34,7 @@ export declare const t: <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(k
35
34
  * @param args
36
35
  * @returns The translated string.
37
36
  */
38
- export declare const choice: <K extends LocalePluralKeys<LocaleNativeStructure>>(key: K, count: number, ...args: LocaleSubstitutionArgs<LocaleNativeStructure, K>) => string;
37
+ export declare const choice: <K extends LocalePluralKeys<LocaleRegistry>>(key: K, count: number, ...args: LocaleSubstitutionArgs<LocaleRegistry, K>) => string;
39
38
  /**
40
39
  * Converts a locale key to a browser message reference.
41
40
  *
@@ -52,7 +51,7 @@ export declare const choice: <K extends LocalePluralKeys<LocaleNativeStructure>>
52
51
  * @param value - The locale key to convert.
53
52
  * @returns The browser message reference.
54
53
  */
55
- export declare const key: (value: keyof LocaleNativeStructure & string) => string;
54
+ export declare const key: (value: keyof LocaleRegistry & string) => string;
56
55
  /**
57
56
  * Resolves a string that may contain a locale marker.
58
57
  *
@@ -1,5 +1,5 @@
1
1
  import { NativeLocale } from "./../locale/providers/index.js";
2
- import { convertLocaleMessageKey, extractLocaleKey } from "./../locale/utils.js";
2
+ import { convertLocaleMessageKey, extractLocaleKey } from "./../shared/locale/index.js";
3
3
  const t = (key2, ...args) => {
4
4
  return NativeLocale.getInstance().trans(key2, ...args);
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/locale/helpers.ts"],"sourcesContent":["import {LocaleNativeStructure, NativeLocale} from \"@locale/providers\";\nimport {convertLocaleMessageKey, extractLocaleKey} from \"@locale/utils\";\nimport {LocaleNonPluralKeys, LocalePluralKeys, LocaleSubstitutionArgs} from \"@typing/locale\";\n\n/**\n * Translates a non-plural locale key.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * t(\"app.name\");\n * t(\"app.greeting\", {name: \"Alice\"});\n * ```\n *\n * @param key - The locale key to translate.\n * @param args\n * @returns The translated string.\n */\nexport const t = <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(\n key: K,\n ...args: LocaleSubstitutionArgs<LocaleNativeStructure, K>\n): string => {\n return NativeLocale.getInstance().trans(key, ...args);\n};\n\n/**\n * Translates a plural locale key using the provided count.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * choice(\"cart.items\", count, {count});\n * ```\n *\n * @param key - The locale key to translate.\n * @param count - The count used to select the plural form.\n * @param args\n * @returns The translated string.\n */\nexport const choice = <K extends LocalePluralKeys<LocaleNativeStructure>>(\n key: K,\n count: number,\n ...args: LocaleSubstitutionArgs<LocaleNativeStructure, K>\n): string => {\n return NativeLocale.getInstance().choice(key, count, ...args);\n};\n\n/**\n * Converts a locale key to a browser message reference.\n *\n * This is useful for browser-managed extension fields that expect\n * `__MSG_name__` references instead of already translated text.\n *\n * A warning is logged when the key does not exist in the generated locale keys.\n *\n * @example\n * ```ts\n * key(\"app.name\"); // \"__MSG_app_name__\"\n * ```\n *\n * @param value - The locale key to convert.\n * @returns The browser message reference.\n */\nexport const key = (value: keyof LocaleNativeStructure & string): string => {\n const locale = NativeLocale.getInstance();\n\n if (!locale.keys().has(value)) {\n console.warn(`Locale key \"${value}\" not found in \"${locale.lang()}\" language.`);\n }\n\n return convertLocaleMessageKey(value);\n};\n\n/**\n * Resolves a string that may contain a locale marker.\n *\n * When the input contains a locale marker, the marker is extracted and translated.\n * Plain strings are returned unchanged.\n *\n * @example\n * ```ts\n * resolve(\"@app.name\");\n * resolve(\"Plain title\");\n * ```\n *\n * @param input - A plain string or a marked locale key string.\n * @returns The translated text when a marker is found, otherwise the original input.\n */\nexport const resolve = (input: string): string => {\n const localeKey = extractLocaleKey(input);\n\n if (localeKey) {\n // Markers are runtime strings without substitutions; keep t() strict for typed callers.\n return (t as (key: string) => string)(localeKey);\n }\n\n return input;\n};\n"],"mappings":"AAAA,SAA+B,oBAAmB;AAClD,SAAQ,yBAAyB,wBAAuB;AAoBjD,MAAM,IAAI,CACbA,SACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,MAAMA,MAAK,GAAG,IAAI;AACxD;AAmBO,MAAM,SAAS,CAClBA,MACA,UACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,OAAOA,MAAK,OAAO,GAAG,IAAI;AAChE;AAkBO,MAAM,MAAM,CAAC,UAAwD;AACxE,QAAM,SAAS,aAAa,YAAY;AAExC,MAAI,CAAC,OAAO,KAAK,EAAE,IAAI,KAAK,GAAG;AAC3B,YAAQ,KAAK,eAAe,KAAK,mBAAmB,OAAO,KAAK,CAAC,aAAa;AAAA,EAClF;AAEA,SAAO,wBAAwB,KAAK;AACxC;AAiBO,MAAM,UAAU,CAAC,UAA0B;AAC9C,QAAM,YAAY,iBAAiB,KAAK;AAExC,MAAI,WAAW;AAEX,WAAQ,EAA8B,SAAS;AAAA,EACnD;AAEA,SAAO;AACX;","names":["key"]}
1
+ {"version":3,"sources":["../../src/locale/helpers.ts"],"sourcesContent":["import {NativeLocale} from \"@locale/providers\";\nimport {convertLocaleMessageKey, extractLocaleKey} from \"@shared/locale\";\nimport type {LocaleNonPluralKeys, LocalePluralKeys, LocaleRegistry, LocaleSubstitutionArgs} from \"@typing/locale\";\n\n/**\n * Translates a non-plural locale key.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * t(\"app.name\");\n * t(\"app.greeting\", {name: \"Alice\"});\n * ```\n *\n * @param key - The locale key to translate.\n * @param args\n * @returns The translated string.\n */\nexport const t = <K extends LocaleNonPluralKeys<LocaleRegistry>>(\n key: K,\n ...args: LocaleSubstitutionArgs<LocaleRegistry, K>\n): string => {\n return NativeLocale.getInstance().trans(key, ...args);\n};\n\n/**\n * Translates a plural locale key using the provided count.\n *\n * Substitutions are type-checked from the generated locale structure:\n * keys without placeholders do not accept substitutions, while keys with\n * placeholders require all declared substitution values.\n *\n * @example\n * ```ts\n * choice(\"cart.items\", count, {count});\n * ```\n *\n * @param key - The locale key to translate.\n * @param count - The count used to select the plural form.\n * @param args\n * @returns The translated string.\n */\nexport const choice = <K extends LocalePluralKeys<LocaleRegistry>>(\n key: K,\n count: number,\n ...args: LocaleSubstitutionArgs<LocaleRegistry, K>\n): string => {\n return NativeLocale.getInstance().choice(key, count, ...args);\n};\n\n/**\n * Converts a locale key to a browser message reference.\n *\n * This is useful for browser-managed extension fields that expect\n * `__MSG_name__` references instead of already translated text.\n *\n * A warning is logged when the key does not exist in the generated locale keys.\n *\n * @example\n * ```ts\n * key(\"app.name\"); // \"__MSG_app_name__\"\n * ```\n *\n * @param value - The locale key to convert.\n * @returns The browser message reference.\n */\nexport const key = (value: keyof LocaleRegistry & string): string => {\n const locale = NativeLocale.getInstance();\n\n if (!locale.keys().has(value)) {\n console.warn(`Locale key \"${value}\" not found in \"${locale.lang()}\" language.`);\n }\n\n return convertLocaleMessageKey(value);\n};\n\n/**\n * Resolves a string that may contain a locale marker.\n *\n * When the input contains a locale marker, the marker is extracted and translated.\n * Plain strings are returned unchanged.\n *\n * @example\n * ```ts\n * resolve(\"@app.name\");\n * resolve(\"Plain title\");\n * ```\n *\n * @param input - A plain string or a marked locale key string.\n * @returns The translated text when a marker is found, otherwise the original input.\n */\nexport const resolve = (input: string): string => {\n const localeKey = extractLocaleKey(input);\n\n if (localeKey) {\n // Markers are runtime strings without substitutions; keep t() strict for typed callers.\n return (t as (key: string) => string)(localeKey);\n }\n\n return input;\n};\n"],"mappings":"AAAA,SAAQ,oBAAmB;AAC3B,SAAQ,yBAAyB,wBAAuB;AAoBjD,MAAM,IAAI,CACbA,SACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,MAAMA,MAAK,GAAG,IAAI;AACxD;AAmBO,MAAM,SAAS,CAClBA,MACA,UACG,SACM;AACT,SAAO,aAAa,YAAY,EAAE,OAAOA,MAAK,OAAO,GAAG,IAAI;AAChE;AAkBO,MAAM,MAAM,CAAC,UAAiD;AACjE,QAAM,SAAS,aAAa,YAAY;AAExC,MAAI,CAAC,OAAO,KAAK,EAAE,IAAI,KAAK,GAAG;AAC3B,YAAQ,KAAK,eAAe,KAAK,mBAAmB,OAAO,KAAK,CAAC,aAAa;AAAA,EAClF;AAEA,SAAO,wBAAwB,KAAK;AACxC;AAiBO,MAAM,UAAU,CAAC,UAA0B;AAC9C,QAAM,YAAY,iBAAiB,KAAK;AAExC,MAAI,WAAW;AAEX,WAAQ,EAA8B,SAAS;AAAA,EACnD;AAEA,SAAO;AACX;","names":["key"]}
@@ -1,3 +1,4 @@
1
1
  export * from "./providers/index.js";
2
2
  export * from "./helpers.js";
3
- export { Language, LanguageCodes, LocaleDir, type LocaleStructure, type LocaleProvider, type LocaleDynamicProvider, type LocaleKeys, type LocaleSubstitutionArgs, type LocaleSubstitutionKeys, type LocaleSubstitutionValue, type LocaleNonPluralKeys, type LocalePluralKeys, } from "../types/locale.js";
3
+ export * from "./storage/index.js";
4
+ export { Language, LanguageCodes, LocaleDir, type LocaleStructure, type LocaleRegistry, type LocaleProvider, type LocaleDynamicProvider, type LocaleSnapshot, type LocaleStorageDriver, type LocaleKeys, type LocaleSubstitutionArgs, type LocaleSubstitutionKeys, type LocaleSubstitutionValue, type LocaleNonPluralKeys, type LocalePluralKeys, } from "../types/locale.js";
@@ -1,5 +1,6 @@
1
1
  export * from "./providers/index.js";
2
2
  export * from "./helpers.js";
3
+ export * from "./storage/index.js";
3
4
  import {
4
5
  Language,
5
6
  LanguageCodes,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/locale/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./helpers\";\n\nexport {\n Language,\n LanguageCodes,\n LocaleDir,\n type LocaleStructure,\n type LocaleProvider,\n type LocaleDynamicProvider,\n type LocaleKeys,\n type LocaleSubstitutionArgs,\n type LocaleSubstitutionKeys,\n type LocaleSubstitutionValue,\n type LocaleNonPluralKeys,\n type LocalePluralKeys,\n} from \"@typing/locale\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OAUG;","names":[]}
1
+ {"version":3,"sources":["../../src/locale/index.ts"],"sourcesContent":["export * from \"./providers\";\nexport * from \"./helpers\";\nexport * from \"./storage\";\n\nexport {\n Language,\n LanguageCodes,\n LocaleDir,\n type LocaleStructure,\n type LocaleRegistry,\n type LocaleProvider,\n type LocaleDynamicProvider,\n type LocaleSnapshot,\n type LocaleStorageDriver,\n type LocaleKeys,\n type LocaleSubstitutionArgs,\n type LocaleSubstitutionKeys,\n type LocaleSubstitutionValue,\n type LocaleNonPluralKeys,\n type LocalePluralKeys,\n} from \"@typing/locale\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OAaG;","names":[]}
@@ -1,13 +1,13 @@
1
1
  import { Language, LocaleNonPluralKeys, LocalePluralKeys, LocaleProvider, LocaleStructure, LocaleSubstitutionArgs, LocaleSubstitutionValue } from "../../types/locale.js";
2
- export default abstract class<S extends object = LocaleStructure> implements LocaleProvider<S> {
2
+ export default abstract class AbstractLocale<S extends object = LocaleStructure> implements LocaleProvider<S> {
3
3
  abstract lang(): Language;
4
4
  abstract keys(): Set<keyof S>;
5
- abstract languages(): Set<Language>;
5
+ abstract langs(): ReadonlySet<Language>;
6
6
  /** Returns native names for this provider's languages, preserving their order. */
7
- languageNames(): Map<Language, string>;
7
+ langNames(): ReadonlyMap<Language, string>;
8
8
  protected abstract value(key: keyof S & string): string | undefined;
9
9
  trans<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string;
10
10
  choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string;
11
11
  get<K extends keyof S & string>(key: K, substitutions?: Record<string, LocaleSubstitutionValue>): string;
12
- private getPluralIndex;
12
+ private substitute;
13
13
  }
@@ -1,12 +1,11 @@
1
+ import { selectPluralForm, applySubstitutions } from "./../../shared/locale/index.js";
1
2
  import {
2
- Language,
3
- LanguageNames,
4
- LocaleValuesSeparator
3
+ LanguageNames
5
4
  } from "./../../types/locale.js";
6
- class AbstractLocale_default {
5
+ class AbstractLocale {
7
6
  /** Returns native names for this provider's languages, preserving their order. */
8
- languageNames() {
9
- return new Map([...this.languages()].map((language) => [language, LanguageNames[language]]));
7
+ langNames() {
8
+ return new Map([...this.langs()].map((language) => [language, LanguageNames[language]]));
10
9
  }
11
10
  trans(key, ...args) {
12
11
  const [substitutions] = args;
@@ -14,9 +13,8 @@ class AbstractLocale_default {
14
13
  }
15
14
  choice(key, count, ...args) {
16
15
  const [substitutions] = args;
17
- const parts = this.get(key, substitutions).split(LocaleValuesSeparator);
18
- const idx = this.getPluralIndex(count);
19
- return parts[idx] ?? parts[0] ?? key;
16
+ const message = selectPluralForm(this.get(key), this.lang(), count);
17
+ return this.substitute(message, key, substitutions);
20
18
  }
21
19
  get(key, substitutions) {
22
20
  const template = this.value(key);
@@ -24,94 +22,15 @@ class AbstractLocale_default {
24
22
  console.warn(`Locale key "${key}" not found in "${this.lang()}" language.`);
25
23
  return key;
26
24
  }
27
- if (substitutions) {
28
- return template.replace(/{{(.*?)}}/g, (_, placeholder) => {
29
- const substitution = placeholder.trim();
30
- if (substitution in substitutions) {
31
- return substitutions[substitution].toString();
32
- }
33
- console.warn(
34
- `Locale substitution "${substitution}" not found for key "${key}" in "${this.lang()}" language.`
35
- );
36
- return substitution;
37
- });
38
- }
39
- return template;
25
+ return this.substitute(template, key, substitutions);
40
26
  }
41
- getPluralIndex(count) {
42
- switch (this.lang()) {
43
- case Language.Indonesian:
44
- case Language.Japanese:
45
- case Language.Kannada:
46
- case Language.Korean:
47
- case Language.Malay:
48
- case Language.Thai:
49
- case Language.Turkish:
50
- case Language.Vietnamese:
51
- return 0;
52
- case Language.Bengali:
53
- case Language.Bulgarian:
54
- case Language.Catalan:
55
- case Language.Danish:
56
- case Language.German:
57
- case Language.Greek:
58
- case Language.English:
59
- case Language.EnglishAustralia:
60
- case Language.EnglishGreatBritain:
61
- case Language.EnglishUSA:
62
- case Language.Spanish:
63
- case Language.SpanishLatinAmericaAndCaribbean:
64
- case Language.Estonian:
65
- case Language.Persian:
66
- case Language.Finnish:
67
- case Language.Gujarati:
68
- case Language.Hebrew:
69
- case Language.Hungarian:
70
- case Language.Italian:
71
- case Language.Malayalam:
72
- case Language.Marathi:
73
- case Language.Dutch:
74
- case Language.Norwegian:
75
- case Language.Swedish:
76
- case Language.Swahili:
77
- case Language.Tamil:
78
- case Language.Telugu:
79
- case Language.ChineseChina:
80
- case Language.ChineseTaiwan:
81
- case Language.PortugueseBrazil:
82
- case Language.PortuguesePortugal:
83
- return count == 1 ? 0 : 1;
84
- case Language.Amharic:
85
- case Language.Filipino:
86
- case Language.French:
87
- case Language.Hindi:
88
- return count == 0 || count == 1 ? 0 : 1;
89
- case Language.Croatian:
90
- case Language.Russian:
91
- case Language.Serbian:
92
- case Language.Ukrainian:
93
- return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
94
- case Language.Czech:
95
- case Language.Slovak:
96
- return count == 1 ? 0 : count >= 2 && count <= 4 ? 1 : 2;
97
- case Language.Lithuanian:
98
- return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
99
- case Language.Slovenian:
100
- return count % 100 == 1 ? 0 : count % 100 == 2 ? 1 : count % 100 == 3 || count % 100 == 4 ? 2 : 3;
101
- case Language.Latvian:
102
- return count == 0 ? 0 : count % 10 == 1 && count % 100 != 11 ? 1 : 2;
103
- case Language.Polish:
104
- return count == 1 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 12 || count % 100 > 14) ? 1 : 2;
105
- case Language.Romanian:
106
- return count == 1 ? 0 : count == 0 || count % 100 > 0 && count % 100 < 20 ? 1 : 2;
107
- case Language.Arabic:
108
- return count == 0 ? 0 : count == 1 ? 1 : count == 2 ? 2 : count % 100 >= 3 && count % 100 <= 10 ? 3 : count % 100 >= 11 && count % 100 <= 99 ? 4 : 5;
109
- default:
110
- return 0;
111
- }
27
+ substitute(message, key, substitutions) {
28
+ return applySubstitutions(message, substitutions, (name) => {
29
+ console.warn(`Locale substitution "${name}" not found for key "${key}" in "${this.lang()}" language.`);
30
+ }).join("");
112
31
  }
113
32
  }
114
33
  export {
115
- AbstractLocale_default as default
34
+ AbstractLocale as default
116
35
  };
117
36
  //# sourceMappingURL=AbstractLocale.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/locale/providers/AbstractLocale.ts"],"sourcesContent":["import {\n Language,\n LanguageNames,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionArgs,\n LocaleSubstitutionValue,\n LocaleValuesSeparator,\n} from \"@typing/locale\";\n\nexport default abstract class<S extends object = LocaleStructure> implements LocaleProvider<S> {\n public abstract lang(): Language;\n\n public abstract keys(): Set<keyof S>;\n\n public abstract languages(): Set<Language>;\n\n /** Returns native names for this provider's languages, preserving their order. */\n public languageNames(): Map<Language, string> {\n return new Map([...this.languages()].map(language => [language, LanguageNames[language]]));\n }\n\n protected abstract value(key: keyof S & string): string | undefined;\n\n public trans<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n\n return this.get(key, substitutions);\n }\n\n public choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n const parts = this.get(key, substitutions).split(LocaleValuesSeparator);\n\n const idx = this.getPluralIndex(count);\n\n return parts[idx] ?? parts[0] ?? (key as string);\n }\n\n public get<K extends keyof S & string>(key: K, substitutions?: Record<string, LocaleSubstitutionValue>): string {\n const template = this.value(key);\n\n if (template === undefined) {\n console.warn(`Locale key \"${key}\" not found in \"${this.lang()}\" language.`);\n\n return key as string;\n }\n\n if (substitutions) {\n return template.replace(/{{(.*?)}}/g, (_, placeholder: string) => {\n const substitution = placeholder.trim();\n\n if (substitution in substitutions) {\n return substitutions[substitution]!.toString();\n }\n\n console.warn(\n `Locale substitution \"${substitution}\" not found for key \"${key}\" in \"${this.lang()}\" language.`\n );\n\n return substitution;\n });\n }\n\n return template;\n }\n\n private getPluralIndex(count: number): number {\n switch (this.lang()) {\n case Language.Indonesian:\n case Language.Japanese:\n case Language.Kannada:\n case Language.Korean:\n case Language.Malay:\n case Language.Thai:\n case Language.Turkish:\n case Language.Vietnamese:\n return 0;\n\n case Language.Bengali:\n case Language.Bulgarian:\n case Language.Catalan:\n case Language.Danish:\n case Language.German:\n case Language.Greek:\n case Language.English:\n case Language.EnglishAustralia:\n case Language.EnglishGreatBritain:\n case Language.EnglishUSA:\n case Language.Spanish:\n case Language.SpanishLatinAmericaAndCaribbean:\n case Language.Estonian:\n case Language.Persian:\n case Language.Finnish:\n case Language.Gujarati:\n case Language.Hebrew:\n case Language.Hungarian:\n case Language.Italian:\n case Language.Malayalam:\n case Language.Marathi:\n case Language.Dutch:\n case Language.Norwegian:\n case Language.Swedish:\n case Language.Swahili:\n case Language.Tamil:\n case Language.Telugu:\n case Language.ChineseChina:\n case Language.ChineseTaiwan:\n case Language.PortugueseBrazil:\n case Language.PortuguesePortugal:\n return count == 1 ? 0 : 1;\n\n case Language.Amharic:\n case Language.Filipino:\n case Language.French:\n case Language.Hindi:\n return count == 0 || count == 1 ? 0 : 1;\n\n case Language.Croatian:\n case Language.Russian:\n case Language.Serbian:\n case Language.Ukrainian:\n return count % 10 == 1 && count % 100 != 11\n ? 0\n : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20)\n ? 1\n : 2;\n\n case Language.Czech:\n case Language.Slovak:\n return count == 1 ? 0 : count >= 2 && count <= 4 ? 1 : 2;\n\n case Language.Lithuanian:\n return count % 10 == 1 && count % 100 != 11\n ? 0\n : count % 10 >= 2 && (count % 100 < 10 || count % 100 >= 20)\n ? 1\n : 2;\n\n case Language.Slovenian:\n return count % 100 == 1 ? 0 : count % 100 == 2 ? 1 : count % 100 == 3 || count % 100 == 4 ? 2 : 3;\n\n case Language.Latvian:\n return count == 0 ? 0 : count % 10 == 1 && count % 100 != 11 ? 1 : 2;\n\n case Language.Polish:\n return count == 1\n ? 0\n : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 12 || count % 100 > 14)\n ? 1\n : 2;\n\n case Language.Romanian:\n return count == 1 ? 0 : count == 0 || (count % 100 > 0 && count % 100 < 20) ? 1 : 2;\n\n case Language.Arabic:\n return count == 0\n ? 0\n : count == 1\n ? 1\n : count == 2\n ? 2\n : count % 100 >= 3 && count % 100 <= 10\n ? 3\n : count % 100 >= 11 && count % 100 <= 99\n ? 4\n : 5;\n\n default:\n return 0;\n }\n }\n}\n"],"mappings":"AAAA;AAAA,EACI;AAAA,EACA;AAAA,EAOA;AAAA,OACG;AAEP,MAAO,uBAAwF;AAAA;AAAA,EAQpF,gBAAuC;AAC1C,WAAO,IAAI,IAAI,CAAC,GAAG,KAAK,UAAU,CAAC,EAAE,IAAI,cAAY,CAAC,UAAU,cAAc,QAAQ,CAAC,CAAC,CAAC;AAAA,EAC7F;AAAA,EAIO,MAAwC,QAAW,MAA4C;AAClG,UAAM,CAAC,aAAa,IAAI;AAExB,WAAO,KAAK,IAAI,KAAK,aAAa;AAAA,EACtC;AAAA,EAEO,OAAsC,KAAQ,UAAkB,MAA4C;AAC/G,UAAM,CAAC,aAAa,IAAI;AACxB,UAAM,QAAQ,KAAK,IAAI,KAAK,aAAa,EAAE,MAAM,qBAAqB;AAEtE,UAAM,MAAM,KAAK,eAAe,KAAK;AAErC,WAAO,MAAM,GAAG,KAAK,MAAM,CAAC,KAAM;AAAA,EACtC;AAAA,EAEO,IAAgC,KAAQ,eAAiE;AAC5G,UAAM,WAAW,KAAK,MAAM,GAAG;AAE/B,QAAI,aAAa,QAAW;AACxB,cAAQ,KAAK,eAAe,GAAG,mBAAmB,KAAK,KAAK,CAAC,aAAa;AAE1E,aAAO;AAAA,IACX;AAEA,QAAI,eAAe;AACf,aAAO,SAAS,QAAQ,cAAc,CAAC,GAAG,gBAAwB;AAC9D,cAAM,eAAe,YAAY,KAAK;AAEtC,YAAI,gBAAgB,eAAe;AAC/B,iBAAO,cAAc,YAAY,EAAG,SAAS;AAAA,QACjD;AAEA,gBAAQ;AAAA,UACJ,wBAAwB,YAAY,wBAAwB,GAAG,SAAS,KAAK,KAAK,CAAC;AAAA,QACvF;AAEA,eAAO;AAAA,MACX,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACX;AAAA,EAEQ,eAAe,OAAuB;AAC1C,YAAQ,KAAK,KAAK,GAAG;AAAA,MACjB,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AACV,eAAO;AAAA,MAEX,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AACV,eAAO,SAAS,IAAI,IAAI;AAAA,MAE5B,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AACV,eAAO,SAAS,KAAK,SAAS,IAAI,IAAI;AAAA,MAE1C,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AACV,eAAO,QAAQ,MAAM,KAAK,QAAQ,OAAO,KACnC,IACA,QAAQ,MAAM,KAAK,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,OAAO,MACxE,IACA;AAAA,MAEZ,KAAK,SAAS;AAAA,MACd,KAAK,SAAS;AACV,eAAO,SAAS,IAAI,IAAI,SAAS,KAAK,SAAS,IAAI,IAAI;AAAA,MAE3D,KAAK,SAAS;AACV,eAAO,QAAQ,MAAM,KAAK,QAAQ,OAAO,KACnC,IACA,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,OAAO,MACrD,IACA;AAAA,MAEZ,KAAK,SAAS;AACV,eAAO,QAAQ,OAAO,IAAI,IAAI,QAAQ,OAAO,IAAI,IAAI,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,IAAI;AAAA,MAEpG,KAAK,SAAS;AACV,eAAO,SAAS,IAAI,IAAI,QAAQ,MAAM,KAAK,QAAQ,OAAO,KAAK,IAAI;AAAA,MAEvE,KAAK,SAAS;AACV,eAAO,SAAS,IACV,IACA,QAAQ,MAAM,KAAK,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,MAAM,MACvE,IACA;AAAA,MAEZ,KAAK,SAAS;AACV,eAAO,SAAS,IAAI,IAAI,SAAS,KAAM,QAAQ,MAAM,KAAK,QAAQ,MAAM,KAAM,IAAI;AAAA,MAEtF,KAAK,SAAS;AACV,eAAO,SAAS,IACV,IACA,SAAS,IACP,IACA,SAAS,IACP,IACA,QAAQ,OAAO,KAAK,QAAQ,OAAO,KACjC,IACA,QAAQ,OAAO,MAAM,QAAQ,OAAO,KAClC,IACA;AAAA,MAElB;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/locale/providers/AbstractLocale.ts"],"sourcesContent":["import {selectPluralForm, applySubstitutions} from \"@shared/locale\";\n\nimport {\n Language,\n LanguageNames,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionArgs,\n LocaleSubstitutionValue,\n} from \"@typing/locale\";\n\nexport default abstract class AbstractLocale<S extends object = LocaleStructure> implements LocaleProvider<S> {\n public abstract lang(): Language;\n\n public abstract keys(): Set<keyof S>;\n\n public abstract langs(): ReadonlySet<Language>;\n\n /** Returns native names for this provider's languages, preserving their order. */\n public langNames(): ReadonlyMap<Language, string> {\n return new Map([...this.langs()].map(language => [language, LanguageNames[language]]));\n }\n\n protected abstract value(key: keyof S & string): string | undefined;\n\n public trans<K extends LocaleNonPluralKeys<S>>(key: K, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n\n return this.get(key, substitutions);\n }\n\n public choice<K extends LocalePluralKeys<S>>(key: K, count: number, ...args: LocaleSubstitutionArgs<S, K>): string {\n const [substitutions] = args;\n const message = selectPluralForm(this.get(key), this.lang(), count);\n\n return this.substitute(message, key, substitutions);\n }\n\n public get<K extends keyof S & string>(key: K, substitutions?: Record<string, LocaleSubstitutionValue>): string {\n const template = this.value(key);\n\n if (template === undefined) {\n console.warn(`Locale key \"${key}\" not found in \"${this.lang()}\" language.`);\n\n return key as string;\n }\n\n return this.substitute(template, key, substitutions);\n }\n\n private substitute(message: string, key: string, substitutions?: Record<string, LocaleSubstitutionValue>): string {\n return applySubstitutions(message, substitutions, name => {\n console.warn(`Locale substitution \"${name}\" not found for key \"${key}\" in \"${this.lang()}\" language.`);\n }).join(\"\");\n }\n}\n"],"mappings":"AAAA,SAAQ,kBAAkB,0BAAyB;AAEnD;AAAA,EAEI;AAAA,OAOG;AAEP,MAAO,eAAuG;AAAA;AAAA,EAQnG,YAA2C;AAC9C,WAAO,IAAI,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,EAAE,IAAI,cAAY,CAAC,UAAU,cAAc,QAAQ,CAAC,CAAC,CAAC;AAAA,EACzF;AAAA,EAIO,MAAwC,QAAW,MAA4C;AAClG,UAAM,CAAC,aAAa,IAAI;AAExB,WAAO,KAAK,IAAI,KAAK,aAAa;AAAA,EACtC;AAAA,EAEO,OAAsC,KAAQ,UAAkB,MAA4C;AAC/G,UAAM,CAAC,aAAa,IAAI;AACxB,UAAM,UAAU,iBAAiB,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK,GAAG,KAAK;AAElE,WAAO,KAAK,WAAW,SAAS,KAAK,aAAa;AAAA,EACtD;AAAA,EAEO,IAAgC,KAAQ,eAAiE;AAC5G,UAAM,WAAW,KAAK,MAAM,GAAG;AAE/B,QAAI,aAAa,QAAW;AACxB,cAAQ,KAAK,eAAe,GAAG,mBAAmB,KAAK,KAAK,CAAC,aAAa;AAE1E,aAAO;AAAA,IACX;AAEA,WAAO,KAAK,WAAW,UAAU,KAAK,aAAa;AAAA,EACvD;AAAA,EAEQ,WAAW,SAAiB,KAAa,eAAiE;AAC9G,WAAO,mBAAmB,SAAS,eAAe,UAAQ;AACtD,cAAQ,KAAK,wBAAwB,IAAI,wBAAwB,GAAG,SAAS,KAAK,KAAK,CAAC,aAAa;AAAA,IACzG,CAAC,EAAE,KAAK,EAAE;AAAA,EACd;AACJ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import AbstractLocale from "./AbstractLocale.js";
2
2
  import { Language, LocaleStructure } from "../../types/locale.js";
3
- export type CustomLocaleData = Record<string, string>;
4
- export default class<T extends object = LocaleStructure> extends AbstractLocale<T> {
3
+ export type CustomLocaleData = Readonly<Record<string, string>>;
4
+ export default class CustomLocale<T extends object = LocaleStructure> extends AbstractLocale<T> {
5
5
  protected language: Language;
6
6
  protected data: CustomLocaleData;
7
7
  constructor(language?: Language, data?: CustomLocaleData);
@@ -9,6 +9,6 @@ export default class<T extends object = LocaleStructure> extends AbstractLocale<
9
9
  setData(data: CustomLocaleData): this;
10
10
  lang(): Language;
11
11
  keys(): Set<keyof T>;
12
- languages(): Set<Language>;
12
+ langs(): ReadonlySet<Language>;
13
13
  protected value(key: string): string | undefined;
14
14
  }