waybetter 0.1.0 → 0.6.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 (515) hide show
  1. package/README.md +143 -9
  2. package/bin/waybetter.mjs +46 -0
  3. package/build/runtime.mjs +105 -0
  4. package/cli/buildenv.mjs +130 -0
  5. package/cli/dev.mjs +97 -0
  6. package/cli/i18n.mjs +382 -0
  7. package/cli/manifests.mjs +383 -0
  8. package/cli/privacy.mjs +768 -0
  9. package/cli/release.mjs +444 -0
  10. package/cli/remote.mjs +260 -0
  11. package/cli/store.mjs +326 -0
  12. package/cli/strings.mjs +121 -0
  13. package/dist/runtime/column.d.ts +93 -0
  14. package/dist/runtime/column.js +451 -0
  15. package/dist/runtime/column.js.map +1 -0
  16. package/dist/runtime/commandReport.d.ts +19 -0
  17. package/dist/runtime/commandReport.js +47 -0
  18. package/dist/runtime/commandReport.js.map +1 -0
  19. package/dist/runtime/commands.d.ts +72 -0
  20. package/dist/runtime/commands.js +214 -0
  21. package/dist/runtime/commands.js.map +1 -0
  22. package/dist/runtime/devErrors.d.ts +16 -0
  23. package/dist/runtime/devErrors.js +30 -0
  24. package/dist/runtime/devErrors.js.map +1 -0
  25. package/dist/runtime/domHub.d.ts +21 -0
  26. package/dist/runtime/domHub.js +139 -4
  27. package/dist/runtime/domHub.js.map +1 -1
  28. package/dist/runtime/featureModules.d.ts +157 -0
  29. package/dist/runtime/featureModules.js +484 -0
  30. package/dist/runtime/featureModules.js.map +1 -0
  31. package/dist/runtime/featureTable.d.ts +144 -0
  32. package/dist/runtime/featureTable.js +223 -0
  33. package/dist/runtime/featureTable.js.map +1 -0
  34. package/dist/runtime/fonts.d.ts +22 -0
  35. package/dist/runtime/fonts.js +72 -0
  36. package/dist/runtime/fonts.js.map +1 -0
  37. package/dist/runtime/i18n.d.ts +138 -0
  38. package/dist/runtime/i18n.js +614 -0
  39. package/dist/runtime/i18n.js.map +1 -0
  40. package/dist/runtime/i18nCheck.d.ts +30 -0
  41. package/dist/runtime/i18nCheck.js +224 -0
  42. package/dist/runtime/i18nCheck.js.map +1 -0
  43. package/dist/runtime/pageLang.d.ts +8 -0
  44. package/dist/runtime/pageLang.js +64 -0
  45. package/dist/runtime/pageLang.js.map +1 -0
  46. package/dist/runtime/pageStrings.d.ts +35 -0
  47. package/dist/runtime/pageStrings.js +76 -0
  48. package/dist/runtime/pageStrings.js.map +1 -0
  49. package/dist/runtime/panelButton.d.ts +33 -0
  50. package/dist/runtime/panelButton.js +83 -0
  51. package/dist/runtime/panelButton.js.map +1 -0
  52. package/dist/runtime/permissions.d.ts +47 -0
  53. package/dist/runtime/permissions.js +141 -0
  54. package/dist/runtime/permissions.js.map +1 -0
  55. package/dist/runtime/pluginApi.d.ts +51 -2
  56. package/dist/runtime/pluginApi.js +137 -22
  57. package/dist/runtime/pluginApi.js.map +1 -1
  58. package/dist/runtime/pluginI18n.d.ts +29 -0
  59. package/dist/runtime/pluginI18n.js +119 -0
  60. package/dist/runtime/pluginI18n.js.map +1 -0
  61. package/dist/runtime/settingsForm.d.ts +66 -0
  62. package/dist/runtime/settingsForm.js +114 -0
  63. package/dist/runtime/settingsForm.js.map +1 -0
  64. package/dist/runtime/site.d.ts +5 -0
  65. package/dist/runtime/site.js +1 -1
  66. package/dist/runtime/site.js.map +1 -1
  67. package/dist/runtime/siteRuntime.d.ts +144 -0
  68. package/dist/runtime/siteRuntime.js +175 -0
  69. package/dist/runtime/siteRuntime.js.map +1 -0
  70. package/dist/runtime/stringPackHook.d.ts +84 -0
  71. package/dist/runtime/stringPackHook.js +220 -0
  72. package/dist/runtime/stringPackHook.js.map +1 -0
  73. package/dist/runtime/stringPackTranslate.d.ts +59 -0
  74. package/dist/runtime/stringPackTranslate.js +264 -0
  75. package/dist/runtime/stringPackTranslate.js.map +1 -0
  76. package/dist/runtime/stringPacks.d.ts +200 -0
  77. package/dist/runtime/stringPacks.js +474 -0
  78. package/dist/runtime/stringPacks.js.map +1 -0
  79. package/dist/runtime/styles.d.ts +15 -0
  80. package/dist/runtime/styles.js +81 -0
  81. package/dist/runtime/styles.js.map +1 -0
  82. package/dist/runtime/textNet.d.ts +15 -0
  83. package/dist/runtime/textNet.js +131 -0
  84. package/dist/runtime/textNet.js.map +1 -0
  85. package/dist/runtime/themeApi.d.ts +121 -0
  86. package/dist/runtime/themeApi.js +220 -0
  87. package/dist/runtime/themeApi.js.map +1 -0
  88. package/dist/runtime/themeChoice.d.ts +52 -0
  89. package/dist/runtime/themeChoice.js +69 -0
  90. package/dist/runtime/themeChoice.js.map +1 -0
  91. package/dist/runtime/themeComponents.d.ts +435 -0
  92. package/dist/runtime/themeComponents.js +463 -0
  93. package/dist/runtime/themeComponents.js.map +1 -0
  94. package/dist/runtime/themeDecor.d.ts +73 -0
  95. package/dist/runtime/themeDecor.js +131 -0
  96. package/dist/runtime/themeDecor.js.map +1 -0
  97. package/dist/runtime/themeDoctor.d.ts +11 -0
  98. package/dist/runtime/themeDoctor.js +51 -0
  99. package/dist/runtime/themeDoctor.js.map +1 -0
  100. package/dist/runtime/themeIcons.d.ts +130 -0
  101. package/dist/runtime/themeIcons.js +263 -0
  102. package/dist/runtime/themeIcons.js.map +1 -0
  103. package/dist/runtime/themeRuntime.d.ts +100 -0
  104. package/dist/runtime/themeRuntime.js +497 -0
  105. package/dist/runtime/themeRuntime.js.map +1 -0
  106. package/dist/runtime/themeSchema.d.ts +10 -0
  107. package/dist/runtime/themeSchema.js +150 -0
  108. package/dist/runtime/themeSchema.js.map +1 -0
  109. package/dist/runtime/themeSpec.d.ts +259 -0
  110. package/dist/runtime/themeSpec.js +439 -0
  111. package/dist/runtime/themeSpec.js.map +1 -0
  112. package/dist/runtime/themeTokens.d.ts +12 -0
  113. package/dist/runtime/themeTokens.js +14 -6
  114. package/dist/runtime/themeTokens.js.map +1 -1
  115. package/dist/runtime/themeVariants.d.ts +30 -0
  116. package/dist/runtime/themeVariants.js +53 -0
  117. package/dist/runtime/themeVariants.js.map +1 -0
  118. package/dist/runtime/ui.d.ts +192 -0
  119. package/dist/runtime/ui.js +926 -0
  120. package/dist/runtime/ui.js.map +1 -0
  121. package/dist/shell/InstallDialog.d.ts +40 -0
  122. package/dist/shell/InstallDialog.js +170 -0
  123. package/dist/shell/InstallDialog.js.map +1 -0
  124. package/dist/shell/StoreView.d.ts +66 -0
  125. package/dist/shell/StoreView.js +103 -0
  126. package/dist/shell/StoreView.js.map +1 -0
  127. package/dist/shell/addressModel.js.map +1 -1
  128. package/dist/shell/chrome.js.map +1 -1
  129. package/dist/shell/deckModel.d.ts +117 -0
  130. package/dist/shell/deckModel.js +267 -0
  131. package/dist/shell/deckModel.js.map +1 -0
  132. package/dist/shell/frame/AccountSwitcher.d.ts +42 -0
  133. package/dist/shell/frame/AccountSwitcher.js +243 -0
  134. package/dist/shell/frame/AccountSwitcher.js.map +1 -0
  135. package/dist/shell/frame/AddColumnDialog.d.ts +8 -0
  136. package/dist/shell/frame/AddColumnDialog.js +81 -0
  137. package/dist/shell/frame/AddColumnDialog.js.map +1 -0
  138. package/dist/shell/frame/AppMenu.d.ts +21 -0
  139. package/dist/shell/frame/AppMenu.js +642 -0
  140. package/dist/shell/frame/AppMenu.js.map +1 -0
  141. package/dist/shell/frame/CommandPalette.d.ts +7 -0
  142. package/dist/shell/frame/CommandPalette.js +118 -0
  143. package/dist/shell/frame/CommandPalette.js.map +1 -0
  144. package/dist/shell/frame/DeckView.d.ts +13 -0
  145. package/dist/shell/frame/DeckView.js +287 -0
  146. package/dist/shell/frame/DeckView.js.map +1 -0
  147. package/dist/shell/frame/FindBar.d.ts +10 -0
  148. package/dist/shell/frame/FindBar.js +108 -0
  149. package/dist/shell/frame/FindBar.js.map +1 -0
  150. package/dist/shell/frame/MediaPanel.d.ts +8 -0
  151. package/dist/shell/frame/MediaPanel.js +76 -0
  152. package/dist/shell/frame/MediaPanel.js.map +1 -0
  153. package/dist/shell/frame/NewTabPage.d.ts +9 -0
  154. package/dist/shell/frame/NewTabPage.js +71 -0
  155. package/dist/shell/frame/NewTabPage.js.map +1 -0
  156. package/dist/shell/frame/PaneTheme.d.ts +16 -0
  157. package/dist/shell/frame/PaneTheme.js +67 -0
  158. package/dist/shell/frame/PaneTheme.js.map +1 -0
  159. package/dist/shell/frame/ReportDialog.d.ts +3 -0
  160. package/dist/shell/frame/ReportDialog.js +95 -0
  161. package/dist/shell/frame/ReportDialog.js.map +1 -0
  162. package/dist/shell/frame/Shell.d.ts +8 -0
  163. package/dist/shell/frame/Shell.js +1131 -0
  164. package/dist/shell/frame/Shell.js.map +1 -0
  165. package/dist/shell/frame/Titlebar.d.ts +16 -0
  166. package/dist/shell/frame/Titlebar.js +77 -0
  167. package/dist/shell/frame/Titlebar.js.map +1 -0
  168. package/dist/shell/frame/TitlebarExtras.d.ts +4 -0
  169. package/dist/shell/frame/TitlebarExtras.js +202 -0
  170. package/dist/shell/frame/TitlebarExtras.js.map +1 -0
  171. package/dist/shell/frame/WebPanel.d.ts +4 -0
  172. package/dist/shell/frame/WebPanel.js +182 -0
  173. package/dist/shell/frame/WebPanel.js.map +1 -0
  174. package/dist/shell/frame/accountModel.d.ts +49 -0
  175. package/dist/shell/frame/accountModel.js +67 -0
  176. package/dist/shell/frame/accountModel.js.map +1 -0
  177. package/dist/shell/frame/accountSwitcher.css +91 -0
  178. package/dist/shell/frame/appI18n.d.ts +44 -0
  179. package/dist/shell/frame/appI18n.js +64 -0
  180. package/dist/shell/frame/appI18n.js.map +1 -0
  181. package/dist/shell/frame/appMenu.css +121 -0
  182. package/dist/shell/frame/backupModel.d.ts +38 -0
  183. package/dist/shell/frame/backupModel.js +192 -0
  184. package/dist/shell/frame/backupModel.js.map +1 -0
  185. package/dist/shell/frame/boot.d.ts +8 -0
  186. package/dist/shell/frame/boot.js +35 -0
  187. package/dist/shell/frame/boot.js.map +1 -0
  188. package/dist/shell/frame/brand.d.ts +1 -0
  189. package/dist/shell/frame/brand.js +4 -0
  190. package/dist/shell/frame/brand.js.map +1 -0
  191. package/dist/shell/frame/bridge.d.ts +35 -0
  192. package/dist/shell/frame/bridge.js +70 -0
  193. package/dist/shell/frame/bridge.js.map +1 -0
  194. package/dist/shell/frame/chromeTheme.d.ts +29 -0
  195. package/dist/shell/frame/chromeTheme.js +81 -0
  196. package/dist/shell/frame/chromeTheme.js.map +1 -0
  197. package/dist/shell/frame/deck.css +209 -0
  198. package/dist/shell/frame/deckStore.d.ts +89 -0
  199. package/dist/shell/frame/deckStore.js +239 -0
  200. package/dist/shell/frame/deckStore.js.map +1 -0
  201. package/dist/shell/frame/devHost.d.ts +35 -0
  202. package/dist/shell/frame/devHost.js +80 -0
  203. package/dist/shell/frame/devHost.js.map +1 -0
  204. package/dist/shell/frame/devModel.d.ts +7 -0
  205. package/dist/shell/frame/devModel.js +17 -0
  206. package/dist/shell/frame/devModel.js.map +1 -0
  207. package/dist/shell/frame/diag.d.ts +7 -0
  208. package/dist/shell/frame/diag.js +39 -0
  209. package/dist/shell/frame/diag.js.map +1 -0
  210. package/dist/shell/frame/findBar.css +14 -0
  211. package/dist/shell/frame/frameMessages.d.ts +248 -0
  212. package/dist/shell/frame/frameMessages.js +252 -0
  213. package/dist/shell/frame/frameMessages.js.map +1 -0
  214. package/dist/shell/frame/hooks.d.ts +39 -0
  215. package/dist/shell/frame/hooks.js +97 -0
  216. package/dist/shell/frame/hooks.js.map +1 -0
  217. package/dist/shell/frame/i18n.d.ts +27 -0
  218. package/dist/shell/frame/i18n.js +66 -0
  219. package/dist/shell/frame/i18n.js.map +1 -0
  220. package/dist/shell/frame/iconPack.d.ts +11 -0
  221. package/dist/shell/frame/iconPack.js +45 -0
  222. package/dist/shell/frame/iconPack.js.map +1 -0
  223. package/dist/shell/frame/icons.d.ts +71 -0
  224. package/dist/shell/frame/icons.js +75 -0
  225. package/dist/shell/frame/icons.js.map +1 -0
  226. package/dist/shell/frame/index.d.ts +34 -0
  227. package/dist/shell/frame/index.js +43 -0
  228. package/dist/shell/frame/index.js.map +1 -0
  229. package/dist/shell/frame/language.d.ts +58 -0
  230. package/dist/shell/frame/language.js +165 -0
  231. package/dist/shell/frame/language.js.map +1 -0
  232. package/dist/shell/frame/mediaModel.d.ts +34 -0
  233. package/dist/shell/frame/mediaModel.js +53 -0
  234. package/dist/shell/frame/mediaModel.js.map +1 -0
  235. package/dist/shell/frame/menuMessages.en.json +54 -0
  236. package/dist/shell/frame/menuModel.d.ts +277 -0
  237. package/dist/shell/frame/menuModel.js +293 -0
  238. package/dist/shell/frame/menuModel.js.map +1 -0
  239. package/dist/shell/frame/paletteModel.d.ts +139 -0
  240. package/dist/shell/frame/paletteModel.js +112 -0
  241. package/dist/shell/frame/paletteModel.js.map +1 -0
  242. package/dist/shell/frame/paneTheme.css +9 -0
  243. package/dist/shell/frame/pluginCommandStore.d.ts +23 -0
  244. package/dist/shell/frame/pluginCommandStore.js +70 -0
  245. package/dist/shell/frame/pluginCommandStore.js.map +1 -0
  246. package/dist/shell/frame/reportModel.d.ts +52 -0
  247. package/dist/shell/frame/reportModel.js +105 -0
  248. package/dist/shell/frame/reportModel.js.map +1 -0
  249. package/dist/shell/frame/safeStore.d.ts +7 -0
  250. package/dist/shell/frame/safeStore.js +40 -0
  251. package/dist/shell/frame/safeStore.js.map +1 -0
  252. package/dist/shell/frame/searchInput.d.ts +2 -0
  253. package/dist/shell/frame/searchInput.js +11 -0
  254. package/dist/shell/frame/searchInput.js.map +1 -0
  255. package/dist/shell/frame/shell.css +629 -0
  256. package/dist/shell/frame/site.d.ts +206 -0
  257. package/dist/shell/frame/site.js +22 -0
  258. package/dist/shell/frame/site.js.map +1 -0
  259. package/dist/shell/frame/state.d.ts +99 -0
  260. package/dist/shell/frame/state.js +284 -0
  261. package/dist/shell/frame/state.js.map +1 -0
  262. package/dist/shell/frame/syncGate.d.ts +10 -0
  263. package/dist/shell/frame/syncGate.js +36 -0
  264. package/dist/shell/frame/syncGate.js.map +1 -0
  265. package/dist/shell/frame/syncHost.d.ts +35 -0
  266. package/dist/shell/frame/syncHost.js +85 -0
  267. package/dist/shell/frame/syncHost.js.map +1 -0
  268. package/dist/shell/frame/tabStill.d.ts +2 -0
  269. package/dist/shell/frame/tabStill.js +62 -0
  270. package/dist/shell/frame/tabStill.js.map +1 -0
  271. package/dist/shell/frame/themeScopes.d.ts +29 -0
  272. package/dist/shell/frame/themeScopes.js +61 -0
  273. package/dist/shell/frame/themeScopes.js.map +1 -0
  274. package/dist/shell/frame/themeStore.d.ts +99 -0
  275. package/dist/shell/frame/themeStore.js +252 -0
  276. package/dist/shell/frame/themeStore.js.map +1 -0
  277. package/dist/shell/frame/windowBinding.d.ts +2 -0
  278. package/dist/shell/frame/windowBinding.js +7 -0
  279. package/dist/shell/frame/windowBinding.js.map +1 -0
  280. package/dist/shell/frame/workspaceModel.d.ts +82 -0
  281. package/dist/shell/frame/workspaceModel.js +250 -0
  282. package/dist/shell/frame/workspaceModel.js.map +1 -0
  283. package/dist/shell/frame/workspaces.css +84 -0
  284. package/dist/shell/frame/workspaces.d.ts +22 -0
  285. package/dist/shell/frame/workspaces.js +125 -0
  286. package/dist/shell/frame/workspaces.js.map +1 -0
  287. package/dist/shell/frame/zoomStore.d.ts +10 -0
  288. package/dist/shell/frame/zoomStore.js +65 -0
  289. package/dist/shell/frame/zoomStore.js.map +1 -0
  290. package/dist/shell/installController.d.ts +122 -0
  291. package/dist/shell/installController.js +146 -0
  292. package/dist/shell/installController.js.map +1 -0
  293. package/dist/shell/installerMessages.d.ts +30 -0
  294. package/dist/shell/installerMessages.js +36 -0
  295. package/dist/shell/installerMessages.js.map +1 -0
  296. package/dist/shell/linkDrop.js.map +1 -1
  297. package/dist/shell/messages.d.ts +16 -0
  298. package/dist/shell/messages.js +27 -0
  299. package/dist/shell/messages.js.map +1 -0
  300. package/dist/shell/palette.js.map +1 -1
  301. package/dist/shell/paneModel.d.ts +22 -0
  302. package/dist/shell/paneModel.js +24 -1
  303. package/dist/shell/paneModel.js.map +1 -1
  304. package/dist/shell/panel/Appearance.d.ts +8 -0
  305. package/dist/shell/panel/Appearance.js +256 -0
  306. package/dist/shell/panel/Appearance.js.map +1 -0
  307. package/dist/shell/panel/BackupPanel.d.ts +5 -0
  308. package/dist/shell/panel/BackupPanel.js +198 -0
  309. package/dist/shell/panel/BackupPanel.js.map +1 -0
  310. package/dist/shell/panel/DeveloperPanel.d.ts +4 -0
  311. package/dist/shell/panel/DeveloperPanel.js +51 -0
  312. package/dist/shell/panel/DeveloperPanel.js.map +1 -0
  313. package/dist/shell/panel/FeatureToggles.d.ts +13 -0
  314. package/dist/shell/panel/FeatureToggles.js +42 -0
  315. package/dist/shell/panel/FeatureToggles.js.map +1 -0
  316. package/dist/shell/panel/Home.d.ts +3 -0
  317. package/dist/shell/panel/Home.js +23 -0
  318. package/dist/shell/panel/Home.js.map +1 -0
  319. package/dist/shell/panel/IconPackInstall.d.ts +15 -0
  320. package/dist/shell/panel/IconPackInstall.js +41 -0
  321. package/dist/shell/panel/IconPackInstall.js.map +1 -0
  322. package/dist/shell/panel/LanguageSettings.d.ts +1 -0
  323. package/dist/shell/panel/LanguageSettings.js +54 -0
  324. package/dist/shell/panel/LanguageSettings.js.map +1 -0
  325. package/dist/shell/panel/MakePanel.d.ts +3 -0
  326. package/dist/shell/panel/MakePanel.js +237 -0
  327. package/dist/shell/panel/MakePanel.js.map +1 -0
  328. package/dist/shell/panel/MarkdownDoc.d.ts +6 -0
  329. package/dist/shell/panel/MarkdownDoc.js +35 -0
  330. package/dist/shell/panel/MarkdownDoc.js.map +1 -0
  331. package/dist/shell/panel/Modes.d.ts +40 -0
  332. package/dist/shell/panel/Modes.js +270 -0
  333. package/dist/shell/panel/Modes.js.map +1 -0
  334. package/dist/shell/panel/NavIcon.d.ts +4 -0
  335. package/dist/shell/panel/NavIcon.js +6 -0
  336. package/dist/shell/panel/NavIcon.js.map +1 -0
  337. package/dist/shell/panel/Panel.d.ts +7 -0
  338. package/dist/shell/panel/Panel.js +139 -0
  339. package/dist/shell/panel/Panel.js.map +1 -0
  340. package/dist/shell/panel/PluginFeatures.d.ts +24 -0
  341. package/dist/shell/panel/PluginFeatures.js +165 -0
  342. package/dist/shell/panel/PluginFeatures.js.map +1 -0
  343. package/dist/shell/panel/Plugins.d.ts +33 -0
  344. package/dist/shell/panel/Plugins.js +112 -0
  345. package/dist/shell/panel/Plugins.js.map +1 -0
  346. package/dist/shell/panel/PowerSettings.d.ts +4 -0
  347. package/dist/shell/panel/PowerSettings.js +52 -0
  348. package/dist/shell/panel/PowerSettings.js.map +1 -0
  349. package/dist/shell/panel/Settings.d.ts +23 -0
  350. package/dist/shell/panel/Settings.js +116 -0
  351. package/dist/shell/panel/Settings.js.map +1 -0
  352. package/dist/shell/panel/ShareSetup.d.ts +8 -0
  353. package/dist/shell/panel/ShareSetup.js +130 -0
  354. package/dist/shell/panel/ShareSetup.js.map +1 -0
  355. package/dist/shell/panel/StoreSection.d.ts +6 -0
  356. package/dist/shell/panel/StoreSection.js +48 -0
  357. package/dist/shell/panel/StoreSection.js.map +1 -0
  358. package/dist/shell/panel/StringPacks.d.ts +11 -0
  359. package/dist/shell/panel/StringPacks.js +106 -0
  360. package/dist/shell/panel/StringPacks.js.map +1 -0
  361. package/dist/shell/panel/ThemeBuilder.d.ts +5 -0
  362. package/dist/shell/panel/ThemeBuilder.js +205 -0
  363. package/dist/shell/panel/ThemeBuilder.js.map +1 -0
  364. package/dist/shell/panel/backup.css +34 -0
  365. package/dist/shell/panel/builder.css +232 -0
  366. package/dist/shell/panel/builderModel.d.ts +55 -0
  367. package/dist/shell/panel/builderModel.js +95 -0
  368. package/dist/shell/panel/builderModel.js.map +1 -0
  369. package/dist/shell/panel/compare.d.ts +10 -0
  370. package/dist/shell/panel/compare.js +51 -0
  371. package/dist/shell/panel/compare.js.map +1 -0
  372. package/dist/shell/panel/controls.d.ts +135 -0
  373. package/dist/shell/panel/controls.js +213 -0
  374. package/dist/shell/panel/controls.js.map +1 -0
  375. package/dist/shell/panel/featureModel.d.ts +69 -0
  376. package/dist/shell/panel/featureModel.js +79 -0
  377. package/dist/shell/panel/featureModel.js.map +1 -0
  378. package/dist/shell/panel/fonts/FontBrowser.d.ts +10 -0
  379. package/dist/shell/panel/fonts/FontBrowser.js +189 -0
  380. package/dist/shell/panel/fonts/FontBrowser.js.map +1 -0
  381. package/dist/shell/panel/fonts/FontRoles.d.ts +20 -0
  382. package/dist/shell/panel/fonts/FontRoles.js +77 -0
  383. package/dist/shell/panel/fonts/FontRoles.js.map +1 -0
  384. package/dist/shell/panel/fonts/catalog.d.ts +37 -0
  385. package/dist/shell/panel/fonts/catalog.js +68 -0
  386. package/dist/shell/panel/fonts/catalog.js.map +1 -0
  387. package/dist/shell/panel/fonts/googleFontsCatalog.json +1 -0
  388. package/dist/shell/panel/index.d.ts +20 -0
  389. package/dist/shell/panel/index.js +34 -0
  390. package/dist/shell/panel/index.js.map +1 -0
  391. package/dist/shell/panel/languageModel.d.ts +5 -0
  392. package/dist/shell/panel/languageModel.js +7 -0
  393. package/dist/shell/panel/languageModel.js.map +1 -0
  394. package/dist/shell/panel/make.css +72 -0
  395. package/dist/shell/panel/makeModel.d.ts +32 -0
  396. package/dist/shell/panel/makeModel.js +84 -0
  397. package/dist/shell/panel/makeModel.js.map +1 -0
  398. package/dist/shell/panel/markdown.d.ts +46 -0
  399. package/dist/shell/panel/markdown.js +100 -0
  400. package/dist/shell/panel/markdown.js.map +1 -0
  401. package/dist/shell/panel/nav.d.ts +12 -0
  402. package/dist/shell/panel/nav.js +50 -0
  403. package/dist/shell/panel/nav.js.map +1 -0
  404. package/dist/shell/panel/panel.css +401 -0
  405. package/dist/shell/panel/panelMessages.d.ts +763 -0
  406. package/dist/shell/panel/panelMessages.js +767 -0
  407. package/dist/shell/panel/panelMessages.js.map +1 -0
  408. package/dist/shell/panel/plugins.css +59 -0
  409. package/dist/shell/panel/setupModel.d.ts +87 -0
  410. package/dist/shell/panel/setupModel.js +152 -0
  411. package/dist/shell/panel/setupModel.js.map +1 -0
  412. package/dist/shell/panel/site.d.ts +259 -0
  413. package/dist/shell/panel/site.js +25 -0
  414. package/dist/shell/panel/site.js.map +1 -0
  415. package/dist/shell/panel/strings.css +7 -0
  416. package/dist/shell/panel/themes.d.ts +10 -0
  417. package/dist/shell/panel/themes.js +8 -0
  418. package/dist/shell/panel/themes.js.map +1 -0
  419. package/dist/shell/profileModel.d.ts +3 -2
  420. package/dist/shell/profileModel.js +7 -5
  421. package/dist/shell/profileModel.js.map +1 -1
  422. package/dist/shell/store.css +230 -0
  423. package/dist/shell/storeMessages.d.ts +169 -0
  424. package/dist/shell/storeMessages.js +172 -0
  425. package/dist/shell/storeMessages.js.map +1 -0
  426. package/dist/shell/storeModel.d.ts +181 -0
  427. package/dist/shell/storeModel.js +133 -0
  428. package/dist/shell/storeModel.js.map +1 -0
  429. package/dist/shell/stringPacksModel.d.ts +44 -0
  430. package/dist/shell/stringPacksModel.js +94 -0
  431. package/dist/shell/stringPacksModel.js.map +1 -0
  432. package/dist/shell/updateModel.d.ts +2 -1
  433. package/dist/shell/updateModel.js +5 -4
  434. package/dist/shell/updateModel.js.map +1 -1
  435. package/dist/shell/windowControls.d.ts +4 -0
  436. package/dist/shell/windowControls.js +5 -0
  437. package/dist/shell/windowControls.js.map +1 -1
  438. package/i18n-config.schema.json +29 -0
  439. package/i18n-meta.schema.json +26 -0
  440. package/i18n.schema.json +42 -0
  441. package/icons.schema.json +646 -0
  442. package/languages.schema.json +23 -0
  443. package/locales/ar-x-fm.json +11 -0
  444. package/locales/ar.json +1281 -0
  445. package/locales/bg.json +1280 -0
  446. package/locales/bn.json +1280 -0
  447. package/locales/ca.json +1280 -0
  448. package/locales/cs.json +1280 -0
  449. package/locales/da.json +1280 -0
  450. package/locales/de.json +1280 -0
  451. package/locales/el.json +1280 -0
  452. package/locales/en-GB.json +27 -0
  453. package/locales/en.json +1280 -0
  454. package/locales/en.meta.json +51 -0
  455. package/locales/es.json +1280 -0
  456. package/locales/eu.json +1280 -0
  457. package/locales/fa.json +1281 -0
  458. package/locales/fi.json +1280 -0
  459. package/locales/fil.json +1280 -0
  460. package/locales/fr.json +1280 -0
  461. package/locales/ga.json +1280 -0
  462. package/locales/gl.json +1280 -0
  463. package/locales/gu.json +1280 -0
  464. package/locales/ha.json +1280 -0
  465. package/locales/he.json +1281 -0
  466. package/locales/hi.json +1280 -0
  467. package/locales/hr.json +1280 -0
  468. package/locales/hu.json +1279 -0
  469. package/locales/id.json +1280 -0
  470. package/locales/ig.json +1280 -0
  471. package/locales/it.json +1280 -0
  472. package/locales/ja.json +1280 -0
  473. package/locales/kn.json +1280 -0
  474. package/locales/ko.json +1280 -0
  475. package/locales/mr.json +1280 -0
  476. package/locales/ms.json +1280 -0
  477. package/locales/nb.json +1280 -0
  478. package/locales/nl.json +1280 -0
  479. package/locales/pl.json +1280 -0
  480. package/locales/pt.json +1280 -0
  481. package/locales/ro.json +1280 -0
  482. package/locales/ru.json +1280 -0
  483. package/locales/sk.json +1280 -0
  484. package/locales/sr.json +1280 -0
  485. package/locales/sv.json +1280 -0
  486. package/locales/ta.json +1280 -0
  487. package/locales/th.json +1280 -0
  488. package/locales/tr.json +1280 -0
  489. package/locales/uk.json +1280 -0
  490. package/locales/ur.json +1281 -0
  491. package/locales/vi.json +1280 -0
  492. package/locales/yo.json +1280 -0
  493. package/locales/zh-Hans.json +1280 -0
  494. package/locales/zh-Hant.json +1280 -0
  495. package/package.json +148 -6
  496. package/store-catalog.schema.json +65 -0
  497. package/theme.schema.json +4659 -0
  498. package/windows/installer.nsi +926 -0
  499. package/windows/languages/Basque.nsh +28 -0
  500. package/windows/languages/Catalan.nsh +28 -0
  501. package/windows/languages/Croatian.nsh +28 -0
  502. package/windows/languages/Czech.nsh +28 -0
  503. package/windows/languages/Danish.nsh +28 -0
  504. package/windows/languages/Finnish.nsh +28 -0
  505. package/windows/languages/Galician.nsh +28 -0
  506. package/windows/languages/Greek.nsh +28 -0
  507. package/windows/languages/Hungarian.nsh +28 -0
  508. package/windows/languages/Indonesian.nsh +28 -0
  509. package/windows/languages/Irish.nsh +28 -0
  510. package/windows/languages/Malay.nsh +28 -0
  511. package/windows/languages/Polish.nsh +28 -0
  512. package/windows/languages/Romanian.nsh +28 -0
  513. package/windows/languages/Serbian.nsh +28 -0
  514. package/windows/languages/Slovak.nsh +28 -0
  515. package/windows/languages/Thai.nsh +28 -0
@@ -0,0 +1,97 @@
1
+ // React hooks over the frame's shared state (profiles, decks, the language, site text, developer
2
+ // mode, sync, themes, the update status). Each re-renders its component when that state changes.
3
+ import { useEffect, useReducer, useState, useSyncExternalStore } from 'react';
4
+ import { parseUpdateStatus } from "../updateModel.js";
5
+ import { isTauri } from "../windowControls.js";
6
+ import { invoke, listen } from "./bridge.js";
7
+ import { dev } from "./devHost.js";
8
+ import { subscribeText, t, textLocale } from "./i18n.js";
9
+ import { shell } from "./state.js";
10
+ import { syncState } from "./syncHost.js";
11
+ /** Re-renders the calling component when the language changes; returns `t`. */
12
+ export function useT() {
13
+ useSyncExternalStore(subscribeText, textLocale, textLocale);
14
+ return t;
15
+ }
16
+ /** Re-renders on every window event in `events`. */
17
+ function useEvents(...events) {
18
+ const [, tick] = useReducer((n) => n + 1, 0);
19
+ useEffect(() => {
20
+ for (const event of events)
21
+ window.addEventListener(event, tick);
22
+ return () => { for (const event of events)
23
+ window.removeEventListener(event, tick); };
24
+ }, []);
25
+ }
26
+ /** Current profile list; re-renders on every `setProfiles`. */
27
+ export function useProfiles() {
28
+ const [profiles, set] = useState(shell.profiles);
29
+ useEffect(() => {
30
+ const update = () => set(shell.profiles);
31
+ window.addEventListener('bt-profiles', update);
32
+ update();
33
+ return () => window.removeEventListener('bt-profiles', update);
34
+ }, []);
35
+ return profiles;
36
+ }
37
+ /** Re-renders when the focused pane (or the layout) changes. */
38
+ export function usePaneTick() {
39
+ const [tick, setTick] = useState(0);
40
+ useEffect(() => {
41
+ const bump = () => setTick(value => value + 1);
42
+ window.addEventListener('bt-active-pane', bump);
43
+ return () => window.removeEventListener('bt-active-pane', bump);
44
+ }, []);
45
+ return tick;
46
+ }
47
+ /** Re-renders when the site's runtime text changes (`siteChanged()`). */
48
+ export const useSiteText = () => useEvents('bt-site');
49
+ /** Re-renders on deck and profile changes. */
50
+ export const useDecks = () => useEvents('bt-decks', 'bt-profiles');
51
+ export function useDev() {
52
+ useEvents('bt-dev');
53
+ return dev;
54
+ }
55
+ export function useSync() {
56
+ useEvents('bt-sync');
57
+ return syncState;
58
+ }
59
+ /** The theme state of `store`; loads it once. */
60
+ export function useThemeState(store) {
61
+ const [value, setValue] = useState(store.current());
62
+ useEffect(() => {
63
+ const update = () => setValue(store.current());
64
+ const off = store.subscribe(update);
65
+ void store.loadThemes();
66
+ update();
67
+ return off;
68
+ }, [store]);
69
+ return value;
70
+ }
71
+ /**
72
+ * Native update status for the titlebar chip. Native code checks, downloads and verifies; the
73
+ * shell only reads the status, confirms it started (`app_ready`) and asks to apply a ready update.
74
+ */
75
+ export function useUpdateStatus() {
76
+ const [status, setStatus] = useState({ state: 'idle' });
77
+ useEffect(() => {
78
+ if (!isTauri)
79
+ return;
80
+ let unlisten;
81
+ let disposed = false;
82
+ listen('update-status', event => setStatus(parseUpdateStatus(event.payload)))
83
+ .then(fn => { if (disposed)
84
+ fn();
85
+ else
86
+ unlisten = fn; })
87
+ .catch(() => { });
88
+ // Handshake: the shell rendered, so a just-installed update is confirmed working.
89
+ invoke('app_ready').then(value => setStatus(parseUpdateStatus(value))).catch(() => { });
90
+ return () => { disposed = true; unlisten?.(); };
91
+ }, []);
92
+ const apply = () => {
93
+ invoke('apply_update').catch(() => invoke('update_status').then(value => setStatus(parseUpdateStatus(value))).catch(() => { }));
94
+ };
95
+ return [status, apply];
96
+ }
97
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/hooks.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,iGAAiG;AAEjG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,oBA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F,OAAO,GAAG,EAAE,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC;IACjI,CAAC,CAAC;IACF,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["// React hooks over the frame's shared state (profiles, decks, the language, site text, developer\n// mode, sync, themes, the update status). Each re-renders its component when that state changes.\n\nimport { useEffect, useReducer, useState, useSyncExternalStore } from 'react';\nimport { parseUpdateStatus, type UpdateStatus } from '../updateModel.ts';\nimport { isTauri } from '../windowControls.ts';\nimport { invoke, listen } from './bridge.ts';\nimport { dev } from './devHost.ts';\nimport { subscribeText, t, textLocale } from './i18n.ts';\nimport { shell } from './state.ts';\nimport { syncState } from './syncHost.ts';\nimport type { ThemeDoc, ThemeStore } from './themeStore.ts';\nimport type { ProfileSettings } from '../profileModel.ts';\n\n/** Re-renders the calling component when the language changes; returns `t`. */\nexport function useT(): typeof t {\n useSyncExternalStore(subscribeText, textLocale, textLocale);\n return t;\n}\n\n/** Re-renders on every window event in `events`. */\nfunction useEvents(...events: string[]) {\n const [, tick] = useReducer((n: number) => n + 1, 0);\n useEffect(() => {\n for (const event of events) window.addEventListener(event, tick);\n return () => { for (const event of events) window.removeEventListener(event, tick); };\n }, []);\n}\n\n/** Current profile list; re-renders on every `setProfiles`. */\nexport function useProfiles(): ProfileSettings {\n const [profiles, set] = useState(shell.profiles);\n useEffect(() => {\n const update = () => set(shell.profiles);\n window.addEventListener('bt-profiles', update);\n update();\n return () => window.removeEventListener('bt-profiles', update);\n }, []);\n return profiles;\n}\n\n/** Re-renders when the focused pane (or the layout) changes. */\nexport function usePaneTick(): number {\n const [tick, setTick] = useState(0);\n useEffect(() => {\n const bump = () => setTick(value => value + 1);\n window.addEventListener('bt-active-pane', bump);\n return () => window.removeEventListener('bt-active-pane', bump);\n }, []);\n return tick;\n}\n\n/** Re-renders when the site's runtime text changes (`siteChanged()`). */\nexport const useSiteText = () => useEvents('bt-site');\n\n/** Re-renders on deck and profile changes. */\nexport const useDecks = () => useEvents('bt-decks', 'bt-profiles');\n\nexport function useDev() {\n useEvents('bt-dev');\n return dev;\n}\n\nexport function useSync() {\n useEvents('bt-sync');\n return syncState;\n}\n\n/** The theme state of `store`; loads it once. */\nexport function useThemeState<Choice, Spec extends ThemeDoc>(store: ThemeStore<Choice, Spec>) {\n const [value, setValue] = useState(store.current());\n useEffect(() => {\n const update = () => setValue(store.current());\n const off = store.subscribe(update);\n void store.loadThemes();\n update();\n return off;\n }, [store]);\n return value;\n}\n\n/**\n * Native update status for the titlebar chip. Native code checks, downloads and verifies; the\n * shell only reads the status, confirms it started (`app_ready`) and asks to apply a ready update.\n */\nexport function useUpdateStatus(): [UpdateStatus, () => void] {\n const [status, setStatus] = useState<UpdateStatus>({ state: 'idle' });\n useEffect(() => {\n if (!isTauri) return;\n let unlisten: (() => void) | undefined;\n let disposed = false;\n listen('update-status', event => setStatus(parseUpdateStatus(event.payload)))\n .then(fn => { if (disposed) fn(); else unlisten = fn; })\n .catch(() => {});\n // Handshake: the shell rendered, so a just-installed update is confirmed working.\n invoke('app_ready').then(value => setStatus(parseUpdateStatus(value))).catch(() => {});\n return () => { disposed = true; unlisten?.(); };\n }, []);\n const apply = () => {\n invoke('apply_update').catch(() => invoke('update_status').then(value => setStatus(parseUpdateStatus(value))).catch(() => {}));\n };\n return [status, apply];\n}\n"]}
@@ -0,0 +1,27 @@
1
+ export type Params = Record<string, string | number | boolean | Date | null | undefined>;
2
+ /** The part of a waybetter/i18n instance the frame uses. */
3
+ export type ShellI18n = {
4
+ readonly locale: string;
5
+ tx(key: string, params?: Params, fallback?: string): string;
6
+ onChange(listener: (locale: string) => void): () => void;
7
+ number(value: number, options?: Intl.NumberFormatOptions): string;
8
+ relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;
9
+ date(value: string | number | Date, options?: Intl.DateTimeFormatOptions): string;
10
+ };
11
+ /** Binds the frame to the app's i18n instance (once, before the shell renders). */
12
+ export declare function setShellI18n(i18n: ShellI18n): void;
13
+ /** Sets the parameters every frame message gets (createShell: `{ site }`). */
14
+ export declare function setTextDefaults(values: Params): void;
15
+ /** The message for a framework key in the active language (the key itself when unbound or missing). */
16
+ export declare function t(key: string, params?: Params): string;
17
+ /** Like `t` for keys assembled at runtime: `fallback` when the key is unknown. */
18
+ export declare function tx(key: string, params?: Params, fallback?: string): string;
19
+ /** Language changes (for `useT`). */
20
+ export declare function subscribeText(listener: () => void): () => void;
21
+ export declare const textLocale: () => string;
22
+ /** A number in the active language ("5 min", "5 dk" with a unit style). */
23
+ export declare function formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
24
+ /** A date (and time) in the active language: `formatDate(iso, { dateStyle: 'medium' })`. */
25
+ export declare function formatDate(value: string | number | Date, options?: Intl.DateTimeFormatOptions): string;
26
+ /** "3 minutes ago" style text for a timestamp in the active language. */
27
+ export declare function relativeTime(then: number, now?: number): string;
@@ -0,0 +1,66 @@
1
+ // The shell frame's words. They live in the framework catalogs (`waybetter/locales/<bcp47>.json`,
2
+ // `wb.*`); the app hands the frame its i18n instance (`setShellI18n`, a `createI18n` from
3
+ // waybetter/i18n that has the framework catalogs merged in), so the frame speaks the app's language
4
+ // and re-renders when it changes (`useT`, hooks.ts). Without one (a unit test), a key reads as itself.
5
+ // Pure (no React, no Tauri), so the models that use it are unit-tested under node.
6
+ //
7
+ // Placeholders: `{site}` is the site's name ("X").
8
+ let current = null;
9
+ /** Parameters every frame message gets (`{site}`: the site's name, set by createShell). */
10
+ let defaults = {};
11
+ const listeners = new Set();
12
+ let unbind = null;
13
+ /** Binds the frame to the app's i18n instance (once, before the shell renders). */
14
+ export function setShellI18n(i18n) {
15
+ unbind?.();
16
+ current = i18n;
17
+ unbind = i18n.onChange(() => { for (const listener of [...listeners])
18
+ listener(); });
19
+ for (const listener of [...listeners])
20
+ listener();
21
+ }
22
+ /** Sets the parameters every frame message gets (createShell: `{ site }`). */
23
+ export function setTextDefaults(values) {
24
+ defaults = { ...values };
25
+ }
26
+ /** The message for a framework key in the active language (the key itself when unbound or missing). */
27
+ export function t(key, params) {
28
+ return current ? current.tx(key, { ...defaults, ...params }) : key;
29
+ }
30
+ /** Like `t` for keys assembled at runtime: `fallback` when the key is unknown. */
31
+ export function tx(key, params, fallback) {
32
+ return current ? current.tx(key, { ...defaults, ...params }, fallback) : fallback ?? key;
33
+ }
34
+ /** Language changes (for `useT`). */
35
+ export function subscribeText(listener) {
36
+ listeners.add(listener);
37
+ return () => { listeners.delete(listener); };
38
+ }
39
+ export const textLocale = () => current?.locale ?? '';
40
+ /** A number in the active language ("5 min", "5 dk" with a unit style). */
41
+ export function formatNumber(value, options) {
42
+ return current ? current.number(value, options) : String(value);
43
+ }
44
+ /** A date (and time) in the active language: `formatDate(iso, { dateStyle: 'medium' })`. */
45
+ export function formatDate(value, options = { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }) {
46
+ return current ? current.date(value, options) : new Date(value).toISOString();
47
+ }
48
+ /** "3 minutes ago" style text for a timestamp in the active language. */
49
+ export function relativeTime(then, now = Date.now()) {
50
+ if (!current)
51
+ return new Date(then).toISOString();
52
+ const seconds = Math.round((then - now) / 1000);
53
+ const abs = Math.abs(seconds);
54
+ if (abs < 45)
55
+ return current.relative(0, 'second');
56
+ if (abs < 3600)
57
+ return current.relative(Math.round(seconds / 60), 'minute');
58
+ if (abs < 86400)
59
+ return current.relative(Math.round(seconds / 3600), 'hour');
60
+ if (abs < 86400 * 30)
61
+ return current.relative(Math.round(seconds / 86400), 'day');
62
+ if (abs < 86400 * 365)
63
+ return current.relative(Math.round(seconds / (86400 * 30)), 'month');
64
+ return current.relative(Math.round(seconds / (86400 * 365)), 'year');
65
+ }
66
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/i18n.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,0FAA0F;AAC1F,oGAAoG;AACpG,uGAAuG;AACvG,mFAAmF;AACnF,EAAE;AACF,mDAAmD;AAcnD,IAAI,OAAO,GAAqB,IAAI,CAAC;AACrC,2FAA2F;AAC3F,IAAI,QAAQ,GAAW,EAAE,CAAC;AAC1B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;AACxC,IAAI,MAAM,GAAwB,IAAI,CAAC;AAEvC,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,MAAM,EAAE,EAAE,CAAC;IACX,OAAO,GAAG,IAAI,CAAC;IACf,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;QAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;QAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,QAAQ,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,CAAC,CAAC,GAAW,EAAE,MAAe;IAC5C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC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AI,CAAC,OAAO;QAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACnD,IAAI,GAAG,GAAG,IAAI;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5E,IAAI,GAAG,GAAG,KAAK;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,GAAG,GAAG,KAAK,GAAG,EAAE;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IAClF,IAAI,GAAG,GAAG,KAAK,GAAG,GAAG;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5F,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// The shell frame's words. They live in the framework catalogs (`waybetter/locales/<bcp47>.json`,\n// `wb.*`); the app hands the frame its i18n instance (`setShellI18n`, a `createI18n` from\n// waybetter/i18n that has the framework catalogs merged in), so the frame speaks the app's language\n// and re-renders when it changes (`useT`, hooks.ts). Without one (a unit test), a key reads as itself.\n// Pure (no React, no Tauri), so the models that use it are unit-tested under node.\n//\n// Placeholders: `{site}` is the site's name (\"X\").\n\nexport type Params = Record<string, string | number | boolean | Date | null | undefined>;\n\n/** The part of a waybetter/i18n instance the frame uses. */\nexport type ShellI18n = {\n readonly locale: string;\n tx(key: string, params?: Params, fallback?: string): string;\n onChange(listener: (locale: string) => void): () => void;\n number(value: number, options?: Intl.NumberFormatOptions): string;\n relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;\n date(value: string | number | Date, options?: Intl.DateTimeFormatOptions): string;\n};\n\nlet current: ShellI18n | null = null;\n/** Parameters every frame message gets (`{site}`: the site's name, set by createShell). */\nlet defaults: Params = {};\nconst listeners = new Set<() => void>();\nlet unbind: (() => void) | null = null;\n\n/** Binds the frame to the app's i18n instance (once, before the shell renders). */\nexport function setShellI18n(i18n: ShellI18n) {\n unbind?.();\n current = i18n;\n unbind = i18n.onChange(() => { for (const listener of [...listeners]) listener(); });\n for (const listener of [...listeners]) listener();\n}\n\n/** Sets the parameters every frame message gets (createShell: `{ site }`). */\nexport function setTextDefaults(values: Params) {\n defaults = { ...values };\n}\n\n/** The message for a framework key in the active language (the key itself when unbound or missing). */\nexport function t(key: string, params?: Params): string {\n return current ? current.tx(key, { ...defaults, ...params }) : key;\n}\n\n/** Like `t` for keys assembled at runtime: `fallback` when the key is unknown. */\nexport function tx(key: string, params?: Params, fallback?: string): string {\n return current ? current.tx(key, { ...defaults, ...params }, fallback) : fallback ?? key;\n}\n\n/** Language changes (for `useT`). */\nexport function subscribeText(listener: () => void): () => void {\n listeners.add(listener);\n return () => { listeners.delete(listener); };\n}\nexport const textLocale = () => current?.locale ?? '';\n\n/** A number in the active language (\"5 min\", \"5 dk\" with a unit style). */\nexport function formatNumber(value: number, options?: Intl.NumberFormatOptions): string {\n return current ? current.number(value, options) : String(value);\n}\n\n/** A date (and time) in the active language: `formatDate(iso, { dateStyle: 'medium' })`. */\nexport function formatDate(value: string | number | Date, options: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }): string {\n return current ? current.date(value, options) : new Date(value).toISOString();\n}\n\n/** \"3 minutes ago\" style text for a timestamp in the active language. */\nexport function relativeTime(then: number, now = Date.now()): string {\n if (!current) return new Date(then).toISOString();\n const seconds = Math.round((then - now) / 1000);\n const abs = Math.abs(seconds);\n if (abs < 45) return current.relative(0, 'second');\n if (abs < 3600) return current.relative(Math.round(seconds / 60), 'minute');\n if (abs < 86400) return current.relative(Math.round(seconds / 3600), 'hour');\n if (abs < 86400 * 30) return current.relative(Math.round(seconds / 86400), 'day');\n if (abs < 86400 * 365) return current.relative(Math.round(seconds / (86400 * 30)), 'month');\n return current.relative(Math.round(seconds / (86400 * 365)), 'year');\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { IconGlyph, IconName, IconPack } from '../../runtime/themeIcons.ts';
2
+ /** Sets the chrome's pack (the theme store calls it with the global theme's). */
3
+ export declare function setChromeIconPack(pack: IconPack | null): void;
4
+ export declare const useChromeIconPack: () => IconPack | null;
5
+ /** Which pack glyph stands for each of the frame's own glyph names. */
6
+ export declare const CHROME_ICON_NAMES: Readonly<Record<string, IconName>>;
7
+ /** One pack glyph as SVG children (no `<svg>` wrapper). */
8
+ export declare function GlyphPaths({ glyph, pack }: {
9
+ glyph: IconGlyph;
10
+ pack: IconPack;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // The icon pack of the shell's own chrome: the global theme's pack (or the owner's pick), drawn in
3
+ // place of the frame's line glyphs wherever the pack has a glyph for that meaning. The glyphs are
4
+ // the pack's validated path data (framework themeIcons.ts), rendered as SVG elements by React, never
5
+ // as markup.
6
+ import { useSyncExternalStore } from 'react';
7
+ let current = null;
8
+ const listeners = new Set();
9
+ /** Sets the chrome's pack (the theme store calls it with the global theme's). */
10
+ export function setChromeIconPack(pack) {
11
+ if (pack === current)
12
+ return;
13
+ current = pack;
14
+ for (const listener of [...listeners])
15
+ listener();
16
+ }
17
+ const subscribe = (listener) => { listeners.add(listener); return () => { listeners.delete(listener); }; };
18
+ export const useChromeIconPack = () => useSyncExternalStore(subscribe, () => current, () => null);
19
+ /** Which pack glyph stands for each of the frame's own glyph names. */
20
+ export const CHROME_ICON_NAMES = {
21
+ home: 'home', search: 'search', explore: 'explore', bell: 'notifications', mail: 'messages', bookmark: 'bookmarks', user: 'profile',
22
+ list: 'lists', close: 'close', back: 'back', image: 'media', draft: 'compose', edit: 'compose', settings: 'settings',
23
+ };
24
+ let gradients = 0;
25
+ /** One pack glyph as SVG children (no `<svg>` wrapper). */
26
+ export function GlyphPaths({ glyph, pack }) {
27
+ const style = pack.style;
28
+ if ('d' in glyph) {
29
+ return glyph.stroke
30
+ ? _jsx("path", { d: glyph.d, style: { fill: 'none', stroke: 'currentColor', strokeWidth: style.stroke, strokeLinecap: style.cap, strokeLinejoin: style.join } })
31
+ : _jsx("path", { d: glyph.d, fillRule: glyph.rule, style: { fill: 'currentColor', stroke: 'none' } });
32
+ }
33
+ if ('layers' in glyph) {
34
+ const base = `wbg${++gradients}`;
35
+ return _jsx(_Fragment, { children: glyph.layers.map((layer, index) => {
36
+ const id = `${base}-${index}`;
37
+ const fill = typeof layer.fill === 'string'
38
+ ? (layer.fill.startsWith('#') ? layer.fill : 'currentColor')
39
+ : `url(#${id})`;
40
+ return _jsxs("g", { children: [typeof layer.fill === 'object' && _jsx("defs", { children: _jsxs("linearGradient", { id: id, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", stopColor: layer.fill.from }), _jsx("stop", { offset: "1", stopColor: layer.fill.to })] }) }), _jsx("path", { d: layer.d, fillRule: layer.rule, opacity: layer.opacity, style: { fill, stroke: 'none' } })] }, index);
41
+ }) });
42
+ }
43
+ return _jsx("image", { href: glyph.png, width: "24", height: "24", style: glyph.pixel ? { imageRendering: 'pixelated' } : undefined });
44
+ }
45
+ //# sourceMappingURL=iconPack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconPack.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/iconPack.tsx"],"names":[],"mappings":";AAAA,mGAAmG;AACnG,kGAAkG;AAClG,qGAAqG;AACrG,aAAa;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG7C,IAAI,OAAO,GAAoB,IAAI,CAAC;AACpC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;AAExC,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO;IAC7B,OAAO,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;QAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AACD,MAAM,SAAS,GAAG,CAAC,QAAoB,EAAE,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAElG,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAuC;IACnE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS;IACnI,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,E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CAAC,cAAc,CAAC;oBAC5D,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC;gBAClB,OAAO,wBACJ,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,yBAAM,0BAAgB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,aAAC,eAAM,MAAM,EAAC,GAAG,EAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,EAAA,eAAM,MAAM,EAAC,GAAG,EAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAiB,GAAO,EAC/M,eAAM,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAFrF,KAAK,CAGhB,CAAC;YACP,CAAC,CAAC,GAAI,CAAC;IACT,CAAC;IACD,OAAO,gBAAO,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC;AAC5H,CAAC","sourcesContent":["// The icon pack of the shell's own chrome: the global theme's pack (or the owner's pick), drawn in\n// place of the frame's line glyphs wherever the pack has a glyph for that meaning. The glyphs are\n// the pack's validated path data (framework themeIcons.ts), rendered as SVG elements by React, never\n// as markup.\n\nimport { useSyncExternalStore } from 'react';\nimport type { IconGlyph, IconName, IconPack } from '../../../runtime/src/themeIcons.ts';\n\nlet current: IconPack | null = null;\nconst listeners = new Set<() => void>();\n\n/** Sets the chrome's pack (the theme store calls it with the global theme's). */\nexport function setChromeIconPack(pack: IconPack | null) {\n if (pack === current) return;\n current = pack;\n for (const listener of [...listeners]) listener();\n}\nconst subscribe = (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener); }; };\nexport const useChromeIconPack = () => useSyncExternalStore(subscribe, () => current, () => null);\n\n/** Which pack glyph stands for each of the frame's own glyph names. */\nexport const CHROME_ICON_NAMES: Readonly<Record<string, IconName>> = {\n home: 'home', search: 'search', explore: 'explore', bell: 'notifications', mail: 'messages', bookmark: 'bookmarks', user: 'profile',\n list: 'lists', close: 'close', back: 'back', image: 'media', draft: 'compose', edit: 'compose', settings: 'settings',\n};\n\nlet gradients = 0;\n/** One pack glyph as SVG children (no `<svg>` wrapper). */\nexport function GlyphPaths({ glyph, pack }: { glyph: IconGlyph; pack: IconPack }) {\n const style = pack.style;\n if ('d' in glyph) {\n return glyph.stroke\n ? <path d={glyph.d} style={{ fill: 'none', stroke: 'currentColor', strokeWidth: style.stroke, strokeLinecap: style.cap, strokeLinejoin: style.join }}/>\n : <path d={glyph.d} fillRule={glyph.rule} style={{ fill: 'currentColor', stroke: 'none' }}/>;\n }\n if ('layers' in glyph) {\n const base = `wbg${++gradients}`;\n return <>{glyph.layers.map((layer, index) => {\n const id = `${base}-${index}`;\n const fill = typeof layer.fill === 'string'\n ? (layer.fill.startsWith('#') ? layer.fill : 'currentColor')\n : `url(#${id})`;\n return <g key={index}>\n {typeof layer.fill === 'object' && <defs><linearGradient id={id} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stopColor={layer.fill.from}/><stop offset=\"1\" stopColor={layer.fill.to}/></linearGradient></defs>}\n <path d={layer.d} fillRule={layer.rule} opacity={layer.opacity} style={{ fill, stroke: 'none' }}/>\n </g>;\n })}</>;\n }\n return <image href={glyph.png} width=\"24\" height=\"24\" style={glyph.pixel ? { imageRendering: 'pixelated' } : undefined}/>;\n}\n"]}
@@ -0,0 +1,71 @@
1
+ export declare const ICONS: {
2
+ readonly back: "M15 5l-7 7 7 7";
3
+ readonly forward: "M9 5l7 7-7 7";
4
+ readonly reload: "M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5";
5
+ readonly stop: "M6 6l12 12M18 6L6 18";
6
+ readonly close: "M7 7l10 10M17 7L7 17";
7
+ readonly plus: "M12 5v14M5 12h14";
8
+ readonly external: "M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5";
9
+ readonly split: "M4 5h16v14H4zM12 5v14";
10
+ readonly splitDown: "M4 5h16v14H4zM4 12h16";
11
+ readonly chevron: "M7 10l5 5 5-5";
12
+ readonly check: "M5 12.5l4.5 4.5L19 7.5";
13
+ readonly pin: "M9 4h6l-1 6 3 3H7l3-3zM12 13v7";
14
+ readonly unpin: "M9 4h6l-1 6 3 3H7l3-3zM12 13v7M4 4l16 16";
15
+ readonly copy: "M9 9h10v11H9zM5 15V4h10";
16
+ readonly duplicate: "M8 8h11v11H8zM5 16V5h11";
17
+ readonly closeOthers: "M4 6h16M4 12h10M4 18h7M15 15l5 5M20 15l-5 5";
18
+ readonly search: "M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4";
19
+ readonly home: "M4 11l8-7 8 7M6 9.5V20h4.5v-5.5h3V20H18V9.5";
20
+ readonly bell: "M6 16V11a6 6 0 1 1 12 0v5l1.5 2h-15zM10 20.5h4";
21
+ readonly bookmark: "M7 4h10v16l-5-4-5 4z";
22
+ readonly mail: "M4 6h16v12H4zM4 7l8 6 8-6";
23
+ readonly list: "M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01";
24
+ readonly explore: "M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM15.5 8.5l-2 5-5 2 2-5z";
25
+ readonly globe: "M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18";
26
+ readonly settings: "M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zM19.4 13.5l1.6 1.2-2 3.4-1.9-.7a7 7 0 0 1-2 1.2L14.8 21h-4l-.3-2.4a7 7 0 0 1-2-1.2l-1.9.7-2-3.4 1.6-1.2a7 7 0 0 1 0-2.4L4.6 9.9l2-3.4 1.9.7a7 7 0 0 1 2-1.2L10.8 3.6h4l.3 2.4a7 7 0 0 1 2 1.2l1.9-.7 2 3.4-1.6 1.2a7 7 0 0 1 0 2.4z";
27
+ readonly palette: "M12 21a9 9 0 1 1 9-9c0 2-1.5 3-3.5 3H16a2 2 0 0 0-1.5 3.3A1.6 1.6 0 0 1 12 21zM7.5 11h.01M10 7.5h.01M14.5 7.5h.01";
28
+ readonly image: "M4 5h16v14H4zM4 16l5-5 4 4 2-2 5 5M15 9.5h.01";
29
+ readonly draft: "M5 20h4L20 9l-4-4L5 16zM14 7l4 4";
30
+ readonly user: "M12 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM4.5 20a7.5 7.5 0 0 1 15 0";
31
+ readonly sparkle: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z";
32
+ readonly bolt: "M13 3L5 14h6l-1 7 8-11h-6z";
33
+ readonly filter: "M4 5h16l-6 7v6l-4 2v-8z";
34
+ readonly history: "M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5M12 8v4l3 2";
35
+ readonly trash: "M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13";
36
+ readonly edit: "M4 20h4L19 9l-4-4L4 16zM14 6l4 4";
37
+ readonly grid: "M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z";
38
+ readonly chevronRight: "M10 7l5 5-5 5";
39
+ readonly minus: "M5 12h14";
40
+ readonly columns: "M4 5h16v14H4zM9.5 5v14M14.5 5v14";
41
+ readonly layers: "M12 4l8 4-8 4-8-4zM4 12l8 4 8-4M4 16l8 4 8-4";
42
+ readonly zoom: "M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4M8.5 11h5M11 8.5v5";
43
+ readonly plug: "M9 3v5M15 3v5M6.5 8h11v3.5a5.5 5.5 0 0 1-11 0zM12 17v4";
44
+ readonly bag: "M5 8h14l-1 12H6zM9 8V7a3 3 0 0 1 6 0v1";
45
+ readonly layout: "M4 5h16v14H4zM10 5v14M10 12h10";
46
+ readonly keyboard: "M3 7h18v10H3zM7 10.5h.01M11 10.5h.01M15 10.5h.01M7.5 13.5h9";
47
+ readonly command: "M5 8l4 4-4 4M12 16h7";
48
+ readonly code: "M9 8l-4 4 4 4M15 8l4 4-4 4";
49
+ readonly folder: "M4 7h6l2 2h8v10H4z";
50
+ readonly info: "M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 11v5M12 8h.01";
51
+ readonly shield: "M12 3l7 3v5.5c0 4.2-2.9 7.9-7 9.5-4.1-1.6-7-5.3-7-9.5V6z";
52
+ readonly flag: "M6 21V4M6 5h11l-2 4 2 4H6";
53
+ };
54
+ export type IconName = keyof typeof ICONS;
55
+ /** One of the frame's glyphs, or the chrome icon pack's glyph for the same meaning (iconPack.tsx). */
56
+ export declare const Icon: ({ name, className }: {
57
+ name: IconName;
58
+ className?: string;
59
+ }) => import("react").JSX.Element;
60
+ /** Readable initial on a profile color: dark ink on light colors, white on dark ones. */
61
+ export declare function inkOn(hex: string): string;
62
+ export declare const initial: (name: string) => string;
63
+ /** Round account avatar: the profile's initial on its color. */
64
+ /** An account's X profile picture when known (`src`), else its initial on the profile color. */
65
+ export declare const Avatar: ({ name, color, size, className, src }: {
66
+ name: string;
67
+ color: string;
68
+ size?: number;
69
+ className?: string;
70
+ src?: string;
71
+ }) => import("react").JSX.Element;
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Shared 24px stroke glyphs for the shell chrome (1.75 stroke, round joins; sized by CSS).
3
+ import { CHROME_ICON_NAMES, GlyphPaths, useChromeIconPack } from "./iconPack.js";
4
+ export const ICONS = {
5
+ back: 'M15 5l-7 7 7 7',
6
+ forward: 'M9 5l7 7-7 7',
7
+ reload: 'M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5',
8
+ stop: 'M6 6l12 12M18 6L6 18',
9
+ close: 'M7 7l10 10M17 7L7 17',
10
+ plus: 'M12 5v14M5 12h14',
11
+ external: 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5',
12
+ split: 'M4 5h16v14H4zM12 5v14',
13
+ splitDown: 'M4 5h16v14H4zM4 12h16',
14
+ chevron: 'M7 10l5 5 5-5',
15
+ check: 'M5 12.5l4.5 4.5L19 7.5',
16
+ pin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7',
17
+ unpin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7M4 4l16 16',
18
+ copy: 'M9 9h10v11H9zM5 15V4h10',
19
+ duplicate: 'M8 8h11v11H8zM5 16V5h11',
20
+ closeOthers: 'M4 6h16M4 12h10M4 18h7M15 15l5 5M20 15l-5 5',
21
+ search: 'M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4',
22
+ home: 'M4 11l8-7 8 7M6 9.5V20h4.5v-5.5h3V20H18V9.5',
23
+ bell: 'M6 16V11a6 6 0 1 1 12 0v5l1.5 2h-15zM10 20.5h4',
24
+ bookmark: 'M7 4h10v16l-5-4-5 4z',
25
+ mail: 'M4 6h16v12H4zM4 7l8 6 8-6',
26
+ list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
27
+ explore: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM15.5 8.5l-2 5-5 2 2-5z',
28
+ globe: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18',
29
+ settings: 'M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zM19.4 13.5l1.6 1.2-2 3.4-1.9-.7a7 7 0 0 1-2 1.2L14.8 21h-4l-.3-2.4a7 7 0 0 1-2-1.2l-1.9.7-2-3.4 1.6-1.2a7 7 0 0 1 0-2.4L4.6 9.9l2-3.4 1.9.7a7 7 0 0 1 2-1.2L10.8 3.6h4l.3 2.4a7 7 0 0 1 2 1.2l1.9-.7 2 3.4-1.6 1.2a7 7 0 0 1 0 2.4z',
30
+ palette: 'M12 21a9 9 0 1 1 9-9c0 2-1.5 3-3.5 3H16a2 2 0 0 0-1.5 3.3A1.6 1.6 0 0 1 12 21zM7.5 11h.01M10 7.5h.01M14.5 7.5h.01',
31
+ image: 'M4 5h16v14H4zM4 16l5-5 4 4 2-2 5 5M15 9.5h.01',
32
+ draft: 'M5 20h4L20 9l-4-4L5 16zM14 7l4 4',
33
+ user: 'M12 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM4.5 20a7.5 7.5 0 0 1 15 0',
34
+ sparkle: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z',
35
+ bolt: 'M13 3L5 14h6l-1 7 8-11h-6z',
36
+ filter: 'M4 5h16l-6 7v6l-4 2v-8z',
37
+ history: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5M12 8v4l3 2',
38
+ trash: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
39
+ edit: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4',
40
+ grid: 'M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z',
41
+ // The app menu's rows (AppMenu.tsx).
42
+ chevronRight: 'M10 7l5 5-5 5',
43
+ minus: 'M5 12h14',
44
+ columns: 'M4 5h16v14H4zM9.5 5v14M14.5 5v14',
45
+ layers: 'M12 4l8 4-8 4-8-4zM4 12l8 4 8-4M4 16l8 4 8-4',
46
+ zoom: 'M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4M8.5 11h5M11 8.5v5',
47
+ plug: 'M9 3v5M15 3v5M6.5 8h11v3.5a5.5 5.5 0 0 1-11 0zM12 17v4',
48
+ bag: 'M5 8h14l-1 12H6zM9 8V7a3 3 0 0 1 6 0v1',
49
+ layout: 'M4 5h16v14H4zM10 5v14M10 12h10',
50
+ keyboard: 'M3 7h18v10H3zM7 10.5h.01M11 10.5h.01M15 10.5h.01M7.5 13.5h9',
51
+ command: 'M5 8l4 4-4 4M12 16h7',
52
+ code: 'M9 8l-4 4 4 4M15 8l4 4-4 4',
53
+ folder: 'M4 7h6l2 2h8v10H4z',
54
+ info: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 11v5M12 8h.01',
55
+ shield: 'M12 3l7 3v5.5c0 4.2-2.9 7.9-7 9.5-4.1-1.6-7-5.3-7-9.5V6z',
56
+ flag: 'M6 21V4M6 5h11l-2 4 2 4H6',
57
+ };
58
+ /** One of the frame's glyphs, or the chrome icon pack's glyph for the same meaning (iconPack.tsx). */
59
+ export const Icon = ({ name, className }) => {
60
+ const pack = useChromeIconPack();
61
+ const mapped = CHROME_ICON_NAMES[name];
62
+ const glyph = pack && mapped ? pack.glyphs[mapped] : undefined;
63
+ return _jsx("svg", { className: className ? `bt-glyph ${className}` : 'bt-glyph', viewBox: "0 0 24 24", "aria-hidden": "true", children: glyph && pack ? _jsx(GlyphPaths, { glyph: glyph, pack: pack }) : _jsx("path", { d: ICONS[name] }) });
64
+ };
65
+ /** Readable initial on a profile color: dark ink on light colors, white on dark ones. */
66
+ export function inkOn(hex) {
67
+ const value = Number.parseInt(hex.slice(1), 16);
68
+ const [r, g, b] = [(value >> 16) & 255, (value >> 8) & 255, value & 255];
69
+ return (0.299 * r + 0.587 * g + 0.114 * b) > 150 ? '#0b0d12' : '#ffffff';
70
+ }
71
+ export const initial = (name) => ([...name.trim()][0] ?? '?').toUpperCase();
72
+ /** Round account avatar: the profile's initial on its color. */
73
+ /** An account's X profile picture when known (`src`), else its initial on the profile color. */
74
+ export const Avatar = ({ name, color, size = 20, className = '', src }) => _jsx("span", { className: `bt-avatar ${src ? 'bt-avatar--image' : ''} ${className}`, "aria-hidden": "true", style: { width: size, height: size, flexBasis: size, background: color, color: inkOn(color), fontSize: Math.round(size * 0.46) }, children: src ? _jsx("img", { src: src, alt: "", width: size, height: size, draggable: false, referrerPolicy: "no-referrer" }) : initial(name) });
75
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/icons.tsx"],"names":[],"mappings":";AAAA,2FAA2F;AAE3F,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAgB,CAAC;AAElF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,sCAAsC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,6EAA6E;IACvF,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,uBAAuB;IAClC,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,wBAAwB;IAC/B,GAAG,EAAE,gCAAgC;IACrC,KAAK,EAAE,0CAA0C;IACjD,IAAI,EAAE,yBAAyB;IAC/B,SAAS,EAAE,yBAAyB;IACpC,WAAW,EAAE,6CAA6C;IAC1D,MAAM,EAAE,kDAAkD;IAC1D,IAAI,EAAE,6CAA6C;IACnD,IAAI,EAAE,gDAAgD;IACtD,QAAQ,EAAE,sBAAsB;IAChC,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,yDAAyD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AAM,EAC5F,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,YAC/H,GAAG,CAAC,CAAC,CAAC,cAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAC,aAAa,GAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAQ,CAAC","sourcesContent":["// Shared 24px stroke glyphs for the shell chrome (1.75 stroke, round joins; sized by CSS).\n\nimport { CHROME_ICON_NAMES, GlyphPaths, useChromeIconPack } from './iconPack.tsx';\n\nexport const ICONS = {\n back: 'M15 5l-7 7 7 7',\n forward: 'M9 5l7 7-7 7',\n reload: 'M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5',\n stop: 'M6 6l12 12M18 6L6 18',\n close: 'M7 7l10 10M17 7L7 17',\n plus: 'M12 5v14M5 12h14',\n external: 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5',\n split: 'M4 5h16v14H4zM12 5v14',\n splitDown: 'M4 5h16v14H4zM4 12h16',\n chevron: 'M7 10l5 5 5-5',\n check: 'M5 12.5l4.5 4.5L19 7.5',\n pin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7',\n unpin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7M4 4l16 16',\n copy: 'M9 9h10v11H9zM5 15V4h10',\n duplicate: 'M8 8h11v11H8zM5 16V5h11',\n closeOthers: 'M4 6h16M4 12h10M4 18h7M15 15l5 5M20 15l-5 5',\n search: 'M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4',\n home: 'M4 11l8-7 8 7M6 9.5V20h4.5v-5.5h3V20H18V9.5',\n bell: 'M6 16V11a6 6 0 1 1 12 0v5l1.5 2h-15zM10 20.5h4',\n bookmark: 'M7 4h10v16l-5-4-5 4z',\n mail: 'M4 6h16v12H4zM4 7l8 6 8-6',\n list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',\n explore: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM15.5 8.5l-2 5-5 2 2-5z',\n globe: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18',\n settings: 'M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zM19.4 13.5l1.6 1.2-2 3.4-1.9-.7a7 7 0 0 1-2 1.2L14.8 21h-4l-.3-2.4a7 7 0 0 1-2-1.2l-1.9.7-2-3.4 1.6-1.2a7 7 0 0 1 0-2.4L4.6 9.9l2-3.4 1.9.7a7 7 0 0 1 2-1.2L10.8 3.6h4l.3 2.4a7 7 0 0 1 2 1.2l1.9-.7 2 3.4-1.6 1.2a7 7 0 0 1 0 2.4z',\n palette: 'M12 21a9 9 0 1 1 9-9c0 2-1.5 3-3.5 3H16a2 2 0 0 0-1.5 3.3A1.6 1.6 0 0 1 12 21zM7.5 11h.01M10 7.5h.01M14.5 7.5h.01',\n image: 'M4 5h16v14H4zM4 16l5-5 4 4 2-2 5 5M15 9.5h.01',\n draft: 'M5 20h4L20 9l-4-4L5 16zM14 7l4 4',\n user: 'M12 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM4.5 20a7.5 7.5 0 0 1 15 0',\n sparkle: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z',\n bolt: 'M13 3L5 14h6l-1 7 8-11h-6z',\n filter: 'M4 5h16l-6 7v6l-4 2v-8z',\n history: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5M12 8v4l3 2',\n trash: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',\n edit: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4',\n grid: 'M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z',\n // The app menu's rows (AppMenu.tsx).\n chevronRight: 'M10 7l5 5-5 5',\n minus: 'M5 12h14',\n columns: 'M4 5h16v14H4zM9.5 5v14M14.5 5v14',\n layers: 'M12 4l8 4-8 4-8-4zM4 12l8 4 8-4M4 16l8 4 8-4',\n zoom: 'M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4M8.5 11h5M11 8.5v5',\n plug: 'M9 3v5M15 3v5M6.5 8h11v3.5a5.5 5.5 0 0 1-11 0zM12 17v4',\n bag: 'M5 8h14l-1 12H6zM9 8V7a3 3 0 0 1 6 0v1',\n layout: 'M4 5h16v14H4zM10 5v14M10 12h10',\n keyboard: 'M3 7h18v10H3zM7 10.5h.01M11 10.5h.01M15 10.5h.01M7.5 13.5h9',\n command: 'M5 8l4 4-4 4M12 16h7',\n code: 'M9 8l-4 4 4 4M15 8l4 4-4 4',\n folder: 'M4 7h6l2 2h8v10H4z',\n info: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 11v5M12 8h.01',\n shield: 'M12 3l7 3v5.5c0 4.2-2.9 7.9-7 9.5-4.1-1.6-7-5.3-7-9.5V6z',\n flag: 'M6 21V4M6 5h11l-2 4 2 4H6',\n} as const;\n\nexport type IconName = keyof typeof ICONS;\n\n/** One of the frame's glyphs, or the chrome icon pack's glyph for the same meaning (iconPack.tsx). */\nexport const Icon = ({ name, className }: { name: IconName; className?: string }) => {\n const pack = useChromeIconPack();\n const mapped = CHROME_ICON_NAMES[name];\n const glyph = pack && mapped ? pack.glyphs[mapped] : undefined;\n return <svg className={className ? `bt-glyph ${className}` : 'bt-glyph'} viewBox=\"0 0 24 24\" aria-hidden=\"true\">{glyph && pack ? <GlyphPaths glyph={glyph} pack={pack}/> : <path d={ICONS[name]}/>}</svg>;\n};\n\n/** Readable initial on a profile color: dark ink on light colors, white on dark ones. */\nexport function inkOn(hex: string): string {\n const value = Number.parseInt(hex.slice(1), 16);\n const [r, g, b] = [(value >> 16) & 255, (value >> 8) & 255, value & 255];\n return (0.299 * r + 0.587 * g + 0.114 * b) > 150 ? '#0b0d12' : '#ffffff';\n}\n\nexport const initial = (name: string) => ([...name.trim()][0] ?? '?').toUpperCase();\n\n/** Round account avatar: the profile's initial on its color. */\n/** An account's X profile picture when known (`src`), else its initial on the profile color. */\nexport const Avatar = ({ name, color, size = 20, className = '', src }: { name: string; color: string; size?: number; className?: string; src?: string }) =>\n <span className={`bt-avatar ${src ? 'bt-avatar--image' : ''} ${className}`} aria-hidden=\"true\"\n style={{ width: size, height: size, flexBasis: size, background: color, color: inkOn(color), fontSize: Math.round(size * 0.46) }}>\n {src ? <img src={src} alt=\"\" width={size} height={size} draggable={false} referrerPolicy=\"no-referrer\"/> : initial(name)}</span>;\n"]}
@@ -0,0 +1,34 @@
1
+ import type { ComponentType } from 'react';
2
+ import { type NativeApi } from './bridge.ts';
3
+ import { type ShellI18n } from './i18n.ts';
4
+ import { type ShellSite } from './site.ts';
5
+ export type ShellOptions = {
6
+ /** The app's Tauri API: `invoke` and `listen` from @tauri-apps/api, and `getCurrentWindow`. */
7
+ native: NativeApi;
8
+ /** The app's i18n instance (waybetter/i18n `createI18n`, the framework catalogs merged in). */
9
+ i18n: ShellI18n;
10
+ /** A development build (keeps the devtools shortcut). */
11
+ dev?: boolean;
12
+ };
13
+ /**
14
+ * Sets the site and the app's native API and language for every frame module, and returns the
15
+ * shell's root component. Call once, before anything of the frame renders (the app's own panel
16
+ * may render the frame's pieces, e.g. in a preview, without the shell).
17
+ */
18
+ export declare function createShell(site: ShellSite, options: ShellOptions): ComponentType;
19
+ export type { ShellSite, DeckSite, PaletteSite, ColumnKind, ColumnFlag, DeckPreset, Completer, Suggestion } from './site.ts';
20
+ export { site, siteChanged } from './site.ts';
21
+ export type { NativeApi, Invoke, Listen, ShellWindow, MockHandler } from './bridge.ts';
22
+ export { invoke, listen, isNative, installPreviewMocks } from './bridge.ts';
23
+ export type { ShellI18n } from './i18n.ts';
24
+ export { setShellI18n } from './i18n.ts';
25
+ export { bootScript, BOOT_CACHE_KEY } from './boot.ts';
26
+ export { createThemeStore, type ThemeAdapter, type ThemeStore, type ThemeDoc, type InstalledFont, type Weights } from './themeStore.ts';
27
+ export { chromeVars, CHROME_VAR_NAMES, SHELL_UI_FONT, SHELL_MONO_FONT, type ChromeTheme } from './chromeTheme.ts';
28
+ export { shell, setOverlay, scheduleSync, flushSync, isWeb, tabAction, setProfiles, type TabParams, type WebParams } from './state.ts';
29
+ export type { PaletteItem, PaletteAction, PaletteContext } from './paletteModel.ts';
30
+ export { Icon, Avatar, ICONS, type IconName } from './icons.tsx';
31
+ export { DEFAULT_MENU, MENU_BUILTINS, MENU_MESSAGES, menuWith, menuWithout, type BuiltinMenuItem, type MenuEntry, type MenuGroups, type MenuItemSpec, type MenuLanguages, type MenuModes, type ReportDetails, type ShellMenu, } from './menuModel.ts';
32
+ export { openAppMenu, type AppMenuRequest } from './AppMenu.tsx';
33
+ export { createLanguage, resolveLocale, type Language, type LanguageOptions, type LanguagePreference } from './language.ts';
34
+ export { createAppI18n, type AppI18n, type AppI18nOptions, type AppLanguage } from './appI18n.ts';
@@ -0,0 +1,43 @@
1
+ // The wayBetter shell frame: `createShell(site, options)` gives an app the whole shell (tabs in the
2
+ // titlebar row, splits, the smart address bar, the new-tab page, the command palette, the account
3
+ // switcher, decks of site columns, workspaces, developer mode and sync chips, the media panel,
4
+ // pane themes, overlays and the native layout sync). The app describes its site (`ShellSite`) and
5
+ // passes its Tauri API and i18n instance; styles come with the components (`--wb-*` tokens).
6
+ //
7
+ // const Shell = createShell(site, { native: { invoke, listen, currentWindow: getCurrentWindow }, i18n });
8
+ // createRoot(root).render(<Shell/>);
9
+ import { setNative } from "./bridge.js";
10
+ import { decks, defaultDeckSettings } from "./deckStore.js";
11
+ import { setShellI18n, setTextDefaults } from "./i18n.js";
12
+ import Shell, { setDevBuild } from "./Shell.js";
13
+ import { configureSite } from "./site.js";
14
+ import { probeLayer, shell } from "./state.js";
15
+ /**
16
+ * Sets the site and the app's native API and language for every frame module, and returns the
17
+ * shell's root component. Call once, before anything of the frame renders (the app's own panel
18
+ * may render the frame's pieces, e.g. in a preview, without the shell).
19
+ */
20
+ export function createShell(site, options) {
21
+ setNative(options.native);
22
+ setShellI18n(options.i18n);
23
+ setTextDefaults({ site: site.name });
24
+ configureSite(site);
25
+ setDevBuild(!!options.dev);
26
+ shell.homeUrl = site.homeUrl;
27
+ decks.settings = defaultDeckSettings();
28
+ probeLayer();
29
+ return Shell;
30
+ }
31
+ export { site, siteChanged } from "./site.js";
32
+ export { invoke, listen, isNative, installPreviewMocks } from "./bridge.js";
33
+ export { setShellI18n } from "./i18n.js";
34
+ export { bootScript, BOOT_CACHE_KEY } from "./boot.js";
35
+ export { createThemeStore } from "./themeStore.js";
36
+ export { chromeVars, CHROME_VAR_NAMES, SHELL_UI_FONT, SHELL_MONO_FONT } from "./chromeTheme.js";
37
+ export { shell, setOverlay, scheduleSync, flushSync, isWeb, tabAction, setProfiles } from "./state.js";
38
+ export { Icon, Avatar, ICONS } from "./icons.js";
39
+ export { DEFAULT_MENU, MENU_BUILTINS, MENU_MESSAGES, menuWith, menuWithout, } from "./menuModel.js";
40
+ export { openAppMenu } from "./AppMenu.js";
41
+ export { createLanguage, resolveLocale } from "./language.js";
42
+ export { createAppI18n } from "./appI18n.js";
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/index.ts"],"names":[],"mappings":"AAAA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AE,gBAAgB,EAAuF,MAAM,iBAAiB,CAAC;AACxI,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAoB,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAkC,MAAM,YAAY,CAAC;AAEvI,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAiB,MAAM,YAAa,CAAC;AACjE,OAAO,EACL,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,GAElE,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAe,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAgE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,aAAa,EAAuD,MAAM,cAAc,CAAC","sourcesContent":["// The wayBetter shell frame: `createShell(site, options)` gives an app the whole shell (tabs in the\n// titlebar row, splits, the smart address bar, the new-tab page, the command palette, the account\n// switcher, decks of site columns, workspaces, developer mode and sync chips, the media panel,\n// pane themes, overlays and the native layout sync). The app describes its site (`ShellSite`) and\n// passes its Tauri API and i18n instance; styles come with the components (`--wb-*` tokens).\n//\n// const Shell = createShell(site, { native: { invoke, listen, currentWindow: getCurrentWindow }, i18n });\n// createRoot(root).render(<Shell/>);\n\nimport type { ComponentType } from 'react';\nimport { setNative, type NativeApi } from './bridge.ts';\nimport { decks, defaultDeckSettings } from './deckStore.ts';\nimport { setShellI18n, setTextDefaults, type ShellI18n } from './i18n.ts';\nimport Shell, { setDevBuild } from './Shell.tsx';\nimport { configureSite, type ShellSite } from './site.ts';\nimport { probeLayer, shell } from './state.ts';\n\nexport type ShellOptions = {\n /** The app's Tauri API: `invoke` and `listen` from @tauri-apps/api, and `getCurrentWindow`. */\n native: NativeApi;\n /** The app's i18n instance (waybetter/i18n `createI18n`, the framework catalogs merged in). */\n i18n: ShellI18n;\n /** A development build (keeps the devtools shortcut). */\n dev?: boolean;\n};\n\n/**\n * Sets the site and the app's native API and language for every frame module, and returns the\n * shell's root component. Call once, before anything of the frame renders (the app's own panel\n * may render the frame's pieces, e.g. in a preview, without the shell).\n */\nexport function createShell(site: ShellSite, options: ShellOptions): ComponentType {\n setNative(options.native);\n setShellI18n(options.i18n);\n setTextDefaults({ site: site.name });\n configureSite(site);\n setDevBuild(!!options.dev);\n shell.homeUrl = site.homeUrl;\n decks.settings = defaultDeckSettings();\n probeLayer();\n return Shell;\n}\n\nexport type { ShellSite, DeckSite, PaletteSite, ColumnKind, ColumnFlag, DeckPreset, Completer, Suggestion } from './site.ts';\nexport { site, siteChanged } from './site.ts';\nexport type { NativeApi, Invoke, Listen, ShellWindow, MockHandler } from './bridge.ts';\nexport { invoke, listen, isNative, installPreviewMocks } from './bridge.ts';\nexport type { ShellI18n } from './i18n.ts';\nexport { setShellI18n } from './i18n.ts';\nexport { bootScript, BOOT_CACHE_KEY } from './boot.ts';\nexport { createThemeStore, type ThemeAdapter, type ThemeStore, type ThemeDoc, type InstalledFont, type Weights } from './themeStore.ts';\nexport { chromeVars, CHROME_VAR_NAMES, SHELL_UI_FONT, SHELL_MONO_FONT, type ChromeTheme } from './chromeTheme.ts';\nexport { shell, setOverlay, scheduleSync, flushSync, isWeb, tabAction, setProfiles, type TabParams, type WebParams } from './state.ts';\nexport type { PaletteItem, PaletteAction, PaletteContext } from './paletteModel.ts';\nexport { Icon, Avatar, ICONS, type IconName } from './icons.tsx';\nexport {\n DEFAULT_MENU, MENU_BUILTINS, MENU_MESSAGES, menuWith, menuWithout,\n type BuiltinMenuItem, type MenuEntry, type MenuGroups, type MenuItemSpec, type MenuLanguages, type MenuModes, type ReportDetails, type ShellMenu,\n} from './menuModel.ts';\nexport { openAppMenu, type AppMenuRequest } from './AppMenu.tsx';\nexport { createLanguage, resolveLocale, type Language, type LanguageOptions, type LanguagePreference } from './language.ts';\nexport { createAppI18n, type AppI18n, type AppI18nOptions, type AppLanguage } from './appI18n.ts';\n"]}
@@ -0,0 +1,58 @@
1
+ import type { Invoke, Listen } from './bridge.ts';
2
+ /** `site`: follow the site's own language. `system`: follow the OS. Otherwise a catalog tag. */
3
+ export type LanguagePreference = 'site' | 'system' | string;
4
+ /** The part of a waybetter/i18n instance the language state drives. */
5
+ export type LanguageI18n = {
6
+ readonly locale: string;
7
+ readonly available: readonly string[];
8
+ setLocale(locale: string): Promise<string>;
9
+ resolved(prefixes?: readonly string[]): Record<string, string>;
10
+ };
11
+ export type LanguageOptions = {
12
+ i18n: LanguageI18n;
13
+ /** Key prefixes native code and site tabs need; the shell hands exactly these over (`i18n_set`). */
14
+ nativePrefixes: readonly string[];
15
+ /** The app's Tauri `invoke` and `listen` (the language is set up before the shell frame is). */
16
+ native: {
17
+ invoke: Invoke;
18
+ listen: Listen;
19
+ };
20
+ /** Where the choice is kept for the app's other local windows (default `wb.language`). */
21
+ storageKey?: string;
22
+ /**
23
+ * The supported tier: automatic choices ("Follow the site", "Follow system") resolve only to
24
+ * these (English is always one). Any other catalog is a community language: it applies only
25
+ * when picked explicitly. Default: every catalog is supported.
26
+ */
27
+ supported?: readonly string[];
28
+ };
29
+ /** Where the shell keeps its choice for the app's other local windows (localStorage). */
30
+ export declare const DEFAULT_STORAGE_KEY = "wb.language";
31
+ /**
32
+ * The catalog to use for a preference, the site's reported language and the OS preferences.
33
+ * Automatic choices ("site", "system") only resolve to `supported` languages (default: all of
34
+ * `available`), through the normal fallback chain (pt-BR -> pt, zh-TW -> zh-Hant); a language
35
+ * picked explicitly applies whatever its tier.
36
+ */
37
+ export declare function resolveLocale(preference: LanguagePreference, siteLang: string | null, system: readonly string[], available: readonly string[], supported?: readonly string[]): string;
38
+ /**
39
+ * The community language an automatic choice would have used had it been supported (the site's or
40
+ * the system's), or null: the panel offers it as a one-click switch.
41
+ */
42
+ export declare function communitySuggestion(preference: LanguagePreference, siteLang: string | null, system: readonly string[], available: readonly string[], supported?: readonly string[]): string | null;
43
+ export type Language = ReturnType<typeof createLanguage>;
44
+ export declare function createLanguage(options: LanguageOptions): {
45
+ initShell: (isNative: boolean) => Promise<void>;
46
+ initFollower: (forced?: string | null) => Promise<void>;
47
+ state: () => {
48
+ preference: string;
49
+ siteLang: string | null;
50
+ system: string[];
51
+ locale: string;
52
+ community: string | null;
53
+ };
54
+ set: (preference: LanguagePreference) => Promise<void>;
55
+ subscribe: (listener: () => void) => () => void;
56
+ forcePreview: (tag: string) => Promise<void>;
57
+ storageKey: string;
58
+ };