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.
- package/README.md +143 -9
- package/bin/waybetter.mjs +46 -0
- package/build/runtime.mjs +105 -0
- package/cli/buildenv.mjs +130 -0
- package/cli/dev.mjs +97 -0
- package/cli/i18n.mjs +382 -0
- package/cli/manifests.mjs +383 -0
- package/cli/privacy.mjs +768 -0
- package/cli/release.mjs +444 -0
- package/cli/remote.mjs +260 -0
- package/cli/store.mjs +326 -0
- package/cli/strings.mjs +121 -0
- package/dist/runtime/column.d.ts +93 -0
- package/dist/runtime/column.js +451 -0
- package/dist/runtime/column.js.map +1 -0
- package/dist/runtime/commandReport.d.ts +19 -0
- package/dist/runtime/commandReport.js +47 -0
- package/dist/runtime/commandReport.js.map +1 -0
- package/dist/runtime/commands.d.ts +72 -0
- package/dist/runtime/commands.js +214 -0
- package/dist/runtime/commands.js.map +1 -0
- package/dist/runtime/devErrors.d.ts +16 -0
- package/dist/runtime/devErrors.js +30 -0
- package/dist/runtime/devErrors.js.map +1 -0
- package/dist/runtime/domHub.d.ts +21 -0
- package/dist/runtime/domHub.js +139 -4
- package/dist/runtime/domHub.js.map +1 -1
- package/dist/runtime/featureModules.d.ts +157 -0
- package/dist/runtime/featureModules.js +484 -0
- package/dist/runtime/featureModules.js.map +1 -0
- package/dist/runtime/featureTable.d.ts +144 -0
- package/dist/runtime/featureTable.js +223 -0
- package/dist/runtime/featureTable.js.map +1 -0
- package/dist/runtime/fonts.d.ts +22 -0
- package/dist/runtime/fonts.js +72 -0
- package/dist/runtime/fonts.js.map +1 -0
- package/dist/runtime/i18n.d.ts +138 -0
- package/dist/runtime/i18n.js +614 -0
- package/dist/runtime/i18n.js.map +1 -0
- package/dist/runtime/i18nCheck.d.ts +30 -0
- package/dist/runtime/i18nCheck.js +224 -0
- package/dist/runtime/i18nCheck.js.map +1 -0
- package/dist/runtime/pageLang.d.ts +8 -0
- package/dist/runtime/pageLang.js +64 -0
- package/dist/runtime/pageLang.js.map +1 -0
- package/dist/runtime/pageStrings.d.ts +35 -0
- package/dist/runtime/pageStrings.js +76 -0
- package/dist/runtime/pageStrings.js.map +1 -0
- package/dist/runtime/panelButton.d.ts +33 -0
- package/dist/runtime/panelButton.js +83 -0
- package/dist/runtime/panelButton.js.map +1 -0
- package/dist/runtime/permissions.d.ts +47 -0
- package/dist/runtime/permissions.js +141 -0
- package/dist/runtime/permissions.js.map +1 -0
- package/dist/runtime/pluginApi.d.ts +51 -2
- package/dist/runtime/pluginApi.js +137 -22
- package/dist/runtime/pluginApi.js.map +1 -1
- package/dist/runtime/pluginI18n.d.ts +29 -0
- package/dist/runtime/pluginI18n.js +119 -0
- package/dist/runtime/pluginI18n.js.map +1 -0
- package/dist/runtime/settingsForm.d.ts +66 -0
- package/dist/runtime/settingsForm.js +114 -0
- package/dist/runtime/settingsForm.js.map +1 -0
- package/dist/runtime/site.d.ts +5 -0
- package/dist/runtime/site.js +1 -1
- package/dist/runtime/site.js.map +1 -1
- package/dist/runtime/siteRuntime.d.ts +144 -0
- package/dist/runtime/siteRuntime.js +175 -0
- package/dist/runtime/siteRuntime.js.map +1 -0
- package/dist/runtime/stringPackHook.d.ts +84 -0
- package/dist/runtime/stringPackHook.js +220 -0
- package/dist/runtime/stringPackHook.js.map +1 -0
- package/dist/runtime/stringPackTranslate.d.ts +59 -0
- package/dist/runtime/stringPackTranslate.js +264 -0
- package/dist/runtime/stringPackTranslate.js.map +1 -0
- package/dist/runtime/stringPacks.d.ts +200 -0
- package/dist/runtime/stringPacks.js +474 -0
- package/dist/runtime/stringPacks.js.map +1 -0
- package/dist/runtime/styles.d.ts +15 -0
- package/dist/runtime/styles.js +81 -0
- package/dist/runtime/styles.js.map +1 -0
- package/dist/runtime/textNet.d.ts +15 -0
- package/dist/runtime/textNet.js +131 -0
- package/dist/runtime/textNet.js.map +1 -0
- package/dist/runtime/themeApi.d.ts +121 -0
- package/dist/runtime/themeApi.js +220 -0
- package/dist/runtime/themeApi.js.map +1 -0
- package/dist/runtime/themeChoice.d.ts +52 -0
- package/dist/runtime/themeChoice.js +69 -0
- package/dist/runtime/themeChoice.js.map +1 -0
- package/dist/runtime/themeComponents.d.ts +435 -0
- package/dist/runtime/themeComponents.js +463 -0
- package/dist/runtime/themeComponents.js.map +1 -0
- package/dist/runtime/themeDecor.d.ts +73 -0
- package/dist/runtime/themeDecor.js +131 -0
- package/dist/runtime/themeDecor.js.map +1 -0
- package/dist/runtime/themeDoctor.d.ts +11 -0
- package/dist/runtime/themeDoctor.js +51 -0
- package/dist/runtime/themeDoctor.js.map +1 -0
- package/dist/runtime/themeIcons.d.ts +130 -0
- package/dist/runtime/themeIcons.js +263 -0
- package/dist/runtime/themeIcons.js.map +1 -0
- package/dist/runtime/themeRuntime.d.ts +100 -0
- package/dist/runtime/themeRuntime.js +497 -0
- package/dist/runtime/themeRuntime.js.map +1 -0
- package/dist/runtime/themeSchema.d.ts +10 -0
- package/dist/runtime/themeSchema.js +150 -0
- package/dist/runtime/themeSchema.js.map +1 -0
- package/dist/runtime/themeSpec.d.ts +259 -0
- package/dist/runtime/themeSpec.js +439 -0
- package/dist/runtime/themeSpec.js.map +1 -0
- package/dist/runtime/themeTokens.d.ts +12 -0
- package/dist/runtime/themeTokens.js +14 -6
- package/dist/runtime/themeTokens.js.map +1 -1
- package/dist/runtime/themeVariants.d.ts +30 -0
- package/dist/runtime/themeVariants.js +53 -0
- package/dist/runtime/themeVariants.js.map +1 -0
- package/dist/runtime/ui.d.ts +192 -0
- package/dist/runtime/ui.js +926 -0
- package/dist/runtime/ui.js.map +1 -0
- package/dist/shell/InstallDialog.d.ts +40 -0
- package/dist/shell/InstallDialog.js +170 -0
- package/dist/shell/InstallDialog.js.map +1 -0
- package/dist/shell/StoreView.d.ts +66 -0
- package/dist/shell/StoreView.js +103 -0
- package/dist/shell/StoreView.js.map +1 -0
- package/dist/shell/addressModel.js.map +1 -1
- package/dist/shell/chrome.js.map +1 -1
- package/dist/shell/deckModel.d.ts +117 -0
- package/dist/shell/deckModel.js +267 -0
- package/dist/shell/deckModel.js.map +1 -0
- package/dist/shell/frame/AccountSwitcher.d.ts +42 -0
- package/dist/shell/frame/AccountSwitcher.js +243 -0
- package/dist/shell/frame/AccountSwitcher.js.map +1 -0
- package/dist/shell/frame/AddColumnDialog.d.ts +8 -0
- package/dist/shell/frame/AddColumnDialog.js +81 -0
- package/dist/shell/frame/AddColumnDialog.js.map +1 -0
- package/dist/shell/frame/AppMenu.d.ts +21 -0
- package/dist/shell/frame/AppMenu.js +642 -0
- package/dist/shell/frame/AppMenu.js.map +1 -0
- package/dist/shell/frame/CommandPalette.d.ts +7 -0
- package/dist/shell/frame/CommandPalette.js +118 -0
- package/dist/shell/frame/CommandPalette.js.map +1 -0
- package/dist/shell/frame/DeckView.d.ts +13 -0
- package/dist/shell/frame/DeckView.js +287 -0
- package/dist/shell/frame/DeckView.js.map +1 -0
- package/dist/shell/frame/FindBar.d.ts +10 -0
- package/dist/shell/frame/FindBar.js +108 -0
- package/dist/shell/frame/FindBar.js.map +1 -0
- package/dist/shell/frame/MediaPanel.d.ts +8 -0
- package/dist/shell/frame/MediaPanel.js +76 -0
- package/dist/shell/frame/MediaPanel.js.map +1 -0
- package/dist/shell/frame/NewTabPage.d.ts +9 -0
- package/dist/shell/frame/NewTabPage.js +71 -0
- package/dist/shell/frame/NewTabPage.js.map +1 -0
- package/dist/shell/frame/PaneTheme.d.ts +16 -0
- package/dist/shell/frame/PaneTheme.js +67 -0
- package/dist/shell/frame/PaneTheme.js.map +1 -0
- package/dist/shell/frame/ReportDialog.d.ts +3 -0
- package/dist/shell/frame/ReportDialog.js +95 -0
- package/dist/shell/frame/ReportDialog.js.map +1 -0
- package/dist/shell/frame/Shell.d.ts +8 -0
- package/dist/shell/frame/Shell.js +1131 -0
- package/dist/shell/frame/Shell.js.map +1 -0
- package/dist/shell/frame/Titlebar.d.ts +16 -0
- package/dist/shell/frame/Titlebar.js +77 -0
- package/dist/shell/frame/Titlebar.js.map +1 -0
- package/dist/shell/frame/TitlebarExtras.d.ts +4 -0
- package/dist/shell/frame/TitlebarExtras.js +202 -0
- package/dist/shell/frame/TitlebarExtras.js.map +1 -0
- package/dist/shell/frame/WebPanel.d.ts +4 -0
- package/dist/shell/frame/WebPanel.js +182 -0
- package/dist/shell/frame/WebPanel.js.map +1 -0
- package/dist/shell/frame/accountModel.d.ts +49 -0
- package/dist/shell/frame/accountModel.js +67 -0
- package/dist/shell/frame/accountModel.js.map +1 -0
- package/dist/shell/frame/accountSwitcher.css +91 -0
- package/dist/shell/frame/appI18n.d.ts +44 -0
- package/dist/shell/frame/appI18n.js +64 -0
- package/dist/shell/frame/appI18n.js.map +1 -0
- package/dist/shell/frame/appMenu.css +121 -0
- package/dist/shell/frame/backupModel.d.ts +38 -0
- package/dist/shell/frame/backupModel.js +192 -0
- package/dist/shell/frame/backupModel.js.map +1 -0
- package/dist/shell/frame/boot.d.ts +8 -0
- package/dist/shell/frame/boot.js +35 -0
- package/dist/shell/frame/boot.js.map +1 -0
- package/dist/shell/frame/brand.d.ts +1 -0
- package/dist/shell/frame/brand.js +4 -0
- package/dist/shell/frame/brand.js.map +1 -0
- package/dist/shell/frame/bridge.d.ts +35 -0
- package/dist/shell/frame/bridge.js +70 -0
- package/dist/shell/frame/bridge.js.map +1 -0
- package/dist/shell/frame/chromeTheme.d.ts +29 -0
- package/dist/shell/frame/chromeTheme.js +81 -0
- package/dist/shell/frame/chromeTheme.js.map +1 -0
- package/dist/shell/frame/deck.css +209 -0
- package/dist/shell/frame/deckStore.d.ts +89 -0
- package/dist/shell/frame/deckStore.js +239 -0
- package/dist/shell/frame/deckStore.js.map +1 -0
- package/dist/shell/frame/devHost.d.ts +35 -0
- package/dist/shell/frame/devHost.js +80 -0
- package/dist/shell/frame/devHost.js.map +1 -0
- package/dist/shell/frame/devModel.d.ts +7 -0
- package/dist/shell/frame/devModel.js +17 -0
- package/dist/shell/frame/devModel.js.map +1 -0
- package/dist/shell/frame/diag.d.ts +7 -0
- package/dist/shell/frame/diag.js +39 -0
- package/dist/shell/frame/diag.js.map +1 -0
- package/dist/shell/frame/findBar.css +14 -0
- package/dist/shell/frame/frameMessages.d.ts +248 -0
- package/dist/shell/frame/frameMessages.js +252 -0
- package/dist/shell/frame/frameMessages.js.map +1 -0
- package/dist/shell/frame/hooks.d.ts +39 -0
- package/dist/shell/frame/hooks.js +97 -0
- package/dist/shell/frame/hooks.js.map +1 -0
- package/dist/shell/frame/i18n.d.ts +27 -0
- package/dist/shell/frame/i18n.js +66 -0
- package/dist/shell/frame/i18n.js.map +1 -0
- package/dist/shell/frame/iconPack.d.ts +11 -0
- package/dist/shell/frame/iconPack.js +45 -0
- package/dist/shell/frame/iconPack.js.map +1 -0
- package/dist/shell/frame/icons.d.ts +71 -0
- package/dist/shell/frame/icons.js +75 -0
- package/dist/shell/frame/icons.js.map +1 -0
- package/dist/shell/frame/index.d.ts +34 -0
- package/dist/shell/frame/index.js +43 -0
- package/dist/shell/frame/index.js.map +1 -0
- package/dist/shell/frame/language.d.ts +58 -0
- package/dist/shell/frame/language.js +165 -0
- package/dist/shell/frame/language.js.map +1 -0
- package/dist/shell/frame/mediaModel.d.ts +34 -0
- package/dist/shell/frame/mediaModel.js +53 -0
- package/dist/shell/frame/mediaModel.js.map +1 -0
- package/dist/shell/frame/menuMessages.en.json +54 -0
- package/dist/shell/frame/menuModel.d.ts +277 -0
- package/dist/shell/frame/menuModel.js +293 -0
- package/dist/shell/frame/menuModel.js.map +1 -0
- package/dist/shell/frame/paletteModel.d.ts +139 -0
- package/dist/shell/frame/paletteModel.js +112 -0
- package/dist/shell/frame/paletteModel.js.map +1 -0
- package/dist/shell/frame/paneTheme.css +9 -0
- package/dist/shell/frame/pluginCommandStore.d.ts +23 -0
- package/dist/shell/frame/pluginCommandStore.js +70 -0
- package/dist/shell/frame/pluginCommandStore.js.map +1 -0
- package/dist/shell/frame/reportModel.d.ts +52 -0
- package/dist/shell/frame/reportModel.js +105 -0
- package/dist/shell/frame/reportModel.js.map +1 -0
- package/dist/shell/frame/safeStore.d.ts +7 -0
- package/dist/shell/frame/safeStore.js +40 -0
- package/dist/shell/frame/safeStore.js.map +1 -0
- package/dist/shell/frame/searchInput.d.ts +2 -0
- package/dist/shell/frame/searchInput.js +11 -0
- package/dist/shell/frame/searchInput.js.map +1 -0
- package/dist/shell/frame/shell.css +629 -0
- package/dist/shell/frame/site.d.ts +206 -0
- package/dist/shell/frame/site.js +22 -0
- package/dist/shell/frame/site.js.map +1 -0
- package/dist/shell/frame/state.d.ts +99 -0
- package/dist/shell/frame/state.js +284 -0
- package/dist/shell/frame/state.js.map +1 -0
- package/dist/shell/frame/syncGate.d.ts +10 -0
- package/dist/shell/frame/syncGate.js +36 -0
- package/dist/shell/frame/syncGate.js.map +1 -0
- package/dist/shell/frame/syncHost.d.ts +35 -0
- package/dist/shell/frame/syncHost.js +85 -0
- package/dist/shell/frame/syncHost.js.map +1 -0
- package/dist/shell/frame/tabStill.d.ts +2 -0
- package/dist/shell/frame/tabStill.js +62 -0
- package/dist/shell/frame/tabStill.js.map +1 -0
- package/dist/shell/frame/themeScopes.d.ts +29 -0
- package/dist/shell/frame/themeScopes.js +61 -0
- package/dist/shell/frame/themeScopes.js.map +1 -0
- package/dist/shell/frame/themeStore.d.ts +99 -0
- package/dist/shell/frame/themeStore.js +252 -0
- package/dist/shell/frame/themeStore.js.map +1 -0
- package/dist/shell/frame/windowBinding.d.ts +2 -0
- package/dist/shell/frame/windowBinding.js +7 -0
- package/dist/shell/frame/windowBinding.js.map +1 -0
- package/dist/shell/frame/workspaceModel.d.ts +82 -0
- package/dist/shell/frame/workspaceModel.js +250 -0
- package/dist/shell/frame/workspaceModel.js.map +1 -0
- package/dist/shell/frame/workspaces.css +84 -0
- package/dist/shell/frame/workspaces.d.ts +22 -0
- package/dist/shell/frame/workspaces.js +125 -0
- package/dist/shell/frame/workspaces.js.map +1 -0
- package/dist/shell/frame/zoomStore.d.ts +10 -0
- package/dist/shell/frame/zoomStore.js +65 -0
- package/dist/shell/frame/zoomStore.js.map +1 -0
- package/dist/shell/installController.d.ts +122 -0
- package/dist/shell/installController.js +146 -0
- package/dist/shell/installController.js.map +1 -0
- package/dist/shell/installerMessages.d.ts +30 -0
- package/dist/shell/installerMessages.js +36 -0
- package/dist/shell/installerMessages.js.map +1 -0
- package/dist/shell/linkDrop.js.map +1 -1
- package/dist/shell/messages.d.ts +16 -0
- package/dist/shell/messages.js +27 -0
- package/dist/shell/messages.js.map +1 -0
- package/dist/shell/palette.js.map +1 -1
- package/dist/shell/paneModel.d.ts +22 -0
- package/dist/shell/paneModel.js +24 -1
- package/dist/shell/paneModel.js.map +1 -1
- package/dist/shell/panel/Appearance.d.ts +8 -0
- package/dist/shell/panel/Appearance.js +256 -0
- package/dist/shell/panel/Appearance.js.map +1 -0
- package/dist/shell/panel/BackupPanel.d.ts +5 -0
- package/dist/shell/panel/BackupPanel.js +198 -0
- package/dist/shell/panel/BackupPanel.js.map +1 -0
- package/dist/shell/panel/DeveloperPanel.d.ts +4 -0
- package/dist/shell/panel/DeveloperPanel.js +51 -0
- package/dist/shell/panel/DeveloperPanel.js.map +1 -0
- package/dist/shell/panel/FeatureToggles.d.ts +13 -0
- package/dist/shell/panel/FeatureToggles.js +42 -0
- package/dist/shell/panel/FeatureToggles.js.map +1 -0
- package/dist/shell/panel/Home.d.ts +3 -0
- package/dist/shell/panel/Home.js +23 -0
- package/dist/shell/panel/Home.js.map +1 -0
- package/dist/shell/panel/IconPackInstall.d.ts +15 -0
- package/dist/shell/panel/IconPackInstall.js +41 -0
- package/dist/shell/panel/IconPackInstall.js.map +1 -0
- package/dist/shell/panel/LanguageSettings.d.ts +1 -0
- package/dist/shell/panel/LanguageSettings.js +54 -0
- package/dist/shell/panel/LanguageSettings.js.map +1 -0
- package/dist/shell/panel/MakePanel.d.ts +3 -0
- package/dist/shell/panel/MakePanel.js +237 -0
- package/dist/shell/panel/MakePanel.js.map +1 -0
- package/dist/shell/panel/MarkdownDoc.d.ts +6 -0
- package/dist/shell/panel/MarkdownDoc.js +35 -0
- package/dist/shell/panel/MarkdownDoc.js.map +1 -0
- package/dist/shell/panel/Modes.d.ts +40 -0
- package/dist/shell/panel/Modes.js +270 -0
- package/dist/shell/panel/Modes.js.map +1 -0
- package/dist/shell/panel/NavIcon.d.ts +4 -0
- package/dist/shell/panel/NavIcon.js +6 -0
- package/dist/shell/panel/NavIcon.js.map +1 -0
- package/dist/shell/panel/Panel.d.ts +7 -0
- package/dist/shell/panel/Panel.js +139 -0
- package/dist/shell/panel/Panel.js.map +1 -0
- package/dist/shell/panel/PluginFeatures.d.ts +24 -0
- package/dist/shell/panel/PluginFeatures.js +165 -0
- package/dist/shell/panel/PluginFeatures.js.map +1 -0
- package/dist/shell/panel/Plugins.d.ts +33 -0
- package/dist/shell/panel/Plugins.js +112 -0
- package/dist/shell/panel/Plugins.js.map +1 -0
- package/dist/shell/panel/PowerSettings.d.ts +4 -0
- package/dist/shell/panel/PowerSettings.js +52 -0
- package/dist/shell/panel/PowerSettings.js.map +1 -0
- package/dist/shell/panel/Settings.d.ts +23 -0
- package/dist/shell/panel/Settings.js +116 -0
- package/dist/shell/panel/Settings.js.map +1 -0
- package/dist/shell/panel/ShareSetup.d.ts +8 -0
- package/dist/shell/panel/ShareSetup.js +130 -0
- package/dist/shell/panel/ShareSetup.js.map +1 -0
- package/dist/shell/panel/StoreSection.d.ts +6 -0
- package/dist/shell/panel/StoreSection.js +48 -0
- package/dist/shell/panel/StoreSection.js.map +1 -0
- package/dist/shell/panel/StringPacks.d.ts +11 -0
- package/dist/shell/panel/StringPacks.js +106 -0
- package/dist/shell/panel/StringPacks.js.map +1 -0
- package/dist/shell/panel/ThemeBuilder.d.ts +5 -0
- package/dist/shell/panel/ThemeBuilder.js +205 -0
- package/dist/shell/panel/ThemeBuilder.js.map +1 -0
- package/dist/shell/panel/backup.css +34 -0
- package/dist/shell/panel/builder.css +232 -0
- package/dist/shell/panel/builderModel.d.ts +55 -0
- package/dist/shell/panel/builderModel.js +95 -0
- package/dist/shell/panel/builderModel.js.map +1 -0
- package/dist/shell/panel/compare.d.ts +10 -0
- package/dist/shell/panel/compare.js +51 -0
- package/dist/shell/panel/compare.js.map +1 -0
- package/dist/shell/panel/controls.d.ts +135 -0
- package/dist/shell/panel/controls.js +213 -0
- package/dist/shell/panel/controls.js.map +1 -0
- package/dist/shell/panel/featureModel.d.ts +69 -0
- package/dist/shell/panel/featureModel.js +79 -0
- package/dist/shell/panel/featureModel.js.map +1 -0
- package/dist/shell/panel/fonts/FontBrowser.d.ts +10 -0
- package/dist/shell/panel/fonts/FontBrowser.js +189 -0
- package/dist/shell/panel/fonts/FontBrowser.js.map +1 -0
- package/dist/shell/panel/fonts/FontRoles.d.ts +20 -0
- package/dist/shell/panel/fonts/FontRoles.js +77 -0
- package/dist/shell/panel/fonts/FontRoles.js.map +1 -0
- package/dist/shell/panel/fonts/catalog.d.ts +37 -0
- package/dist/shell/panel/fonts/catalog.js +68 -0
- package/dist/shell/panel/fonts/catalog.js.map +1 -0
- package/dist/shell/panel/fonts/googleFontsCatalog.json +1 -0
- package/dist/shell/panel/index.d.ts +20 -0
- package/dist/shell/panel/index.js +34 -0
- package/dist/shell/panel/index.js.map +1 -0
- package/dist/shell/panel/languageModel.d.ts +5 -0
- package/dist/shell/panel/languageModel.js +7 -0
- package/dist/shell/panel/languageModel.js.map +1 -0
- package/dist/shell/panel/make.css +72 -0
- package/dist/shell/panel/makeModel.d.ts +32 -0
- package/dist/shell/panel/makeModel.js +84 -0
- package/dist/shell/panel/makeModel.js.map +1 -0
- package/dist/shell/panel/markdown.d.ts +46 -0
- package/dist/shell/panel/markdown.js +100 -0
- package/dist/shell/panel/markdown.js.map +1 -0
- package/dist/shell/panel/nav.d.ts +12 -0
- package/dist/shell/panel/nav.js +50 -0
- package/dist/shell/panel/nav.js.map +1 -0
- package/dist/shell/panel/panel.css +401 -0
- package/dist/shell/panel/panelMessages.d.ts +763 -0
- package/dist/shell/panel/panelMessages.js +767 -0
- package/dist/shell/panel/panelMessages.js.map +1 -0
- package/dist/shell/panel/plugins.css +59 -0
- package/dist/shell/panel/setupModel.d.ts +87 -0
- package/dist/shell/panel/setupModel.js +152 -0
- package/dist/shell/panel/setupModel.js.map +1 -0
- package/dist/shell/panel/site.d.ts +259 -0
- package/dist/shell/panel/site.js +25 -0
- package/dist/shell/panel/site.js.map +1 -0
- package/dist/shell/panel/strings.css +7 -0
- package/dist/shell/panel/themes.d.ts +10 -0
- package/dist/shell/panel/themes.js +8 -0
- package/dist/shell/panel/themes.js.map +1 -0
- package/dist/shell/profileModel.d.ts +3 -2
- package/dist/shell/profileModel.js +7 -5
- package/dist/shell/profileModel.js.map +1 -1
- package/dist/shell/store.css +230 -0
- package/dist/shell/storeMessages.d.ts +169 -0
- package/dist/shell/storeMessages.js +172 -0
- package/dist/shell/storeMessages.js.map +1 -0
- package/dist/shell/storeModel.d.ts +181 -0
- package/dist/shell/storeModel.js +133 -0
- package/dist/shell/storeModel.js.map +1 -0
- package/dist/shell/stringPacksModel.d.ts +44 -0
- package/dist/shell/stringPacksModel.js +94 -0
- package/dist/shell/stringPacksModel.js.map +1 -0
- package/dist/shell/updateModel.d.ts +2 -1
- package/dist/shell/updateModel.js +5 -4
- package/dist/shell/updateModel.js.map +1 -1
- package/dist/shell/windowControls.d.ts +4 -0
- package/dist/shell/windowControls.js +5 -0
- package/dist/shell/windowControls.js.map +1 -1
- package/i18n-config.schema.json +29 -0
- package/i18n-meta.schema.json +26 -0
- package/i18n.schema.json +42 -0
- package/icons.schema.json +646 -0
- package/languages.schema.json +23 -0
- package/locales/ar-x-fm.json +11 -0
- package/locales/ar.json +1281 -0
- package/locales/bg.json +1280 -0
- package/locales/bn.json +1280 -0
- package/locales/ca.json +1280 -0
- package/locales/cs.json +1280 -0
- package/locales/da.json +1280 -0
- package/locales/de.json +1280 -0
- package/locales/el.json +1280 -0
- package/locales/en-GB.json +27 -0
- package/locales/en.json +1280 -0
- package/locales/en.meta.json +51 -0
- package/locales/es.json +1280 -0
- package/locales/eu.json +1280 -0
- package/locales/fa.json +1281 -0
- package/locales/fi.json +1280 -0
- package/locales/fil.json +1280 -0
- package/locales/fr.json +1280 -0
- package/locales/ga.json +1280 -0
- package/locales/gl.json +1280 -0
- package/locales/gu.json +1280 -0
- package/locales/ha.json +1280 -0
- package/locales/he.json +1281 -0
- package/locales/hi.json +1280 -0
- package/locales/hr.json +1280 -0
- package/locales/hu.json +1279 -0
- package/locales/id.json +1280 -0
- package/locales/ig.json +1280 -0
- package/locales/it.json +1280 -0
- package/locales/ja.json +1280 -0
- package/locales/kn.json +1280 -0
- package/locales/ko.json +1280 -0
- package/locales/mr.json +1280 -0
- package/locales/ms.json +1280 -0
- package/locales/nb.json +1280 -0
- package/locales/nl.json +1280 -0
- package/locales/pl.json +1280 -0
- package/locales/pt.json +1280 -0
- package/locales/ro.json +1280 -0
- package/locales/ru.json +1280 -0
- package/locales/sk.json +1280 -0
- package/locales/sr.json +1280 -0
- package/locales/sv.json +1280 -0
- package/locales/ta.json +1280 -0
- package/locales/th.json +1280 -0
- package/locales/tr.json +1280 -0
- package/locales/uk.json +1280 -0
- package/locales/ur.json +1281 -0
- package/locales/vi.json +1280 -0
- package/locales/yo.json +1280 -0
- package/locales/zh-Hans.json +1280 -0
- package/locales/zh-Hant.json +1280 -0
- package/package.json +148 -6
- package/store-catalog.schema.json +65 -0
- package/theme.schema.json +4659 -0
- package/windows/installer.nsi +926 -0
- package/windows/languages/Basque.nsh +28 -0
- package/windows/languages/Catalan.nsh +28 -0
- package/windows/languages/Croatian.nsh +28 -0
- package/windows/languages/Czech.nsh +28 -0
- package/windows/languages/Danish.nsh +28 -0
- package/windows/languages/Finnish.nsh +28 -0
- package/windows/languages/Galician.nsh +28 -0
- package/windows/languages/Greek.nsh +28 -0
- package/windows/languages/Hungarian.nsh +28 -0
- package/windows/languages/Indonesian.nsh +28 -0
- package/windows/languages/Irish.nsh +28 -0
- package/windows/languages/Malay.nsh +28 -0
- package/windows/languages/Polish.nsh +28 -0
- package/windows/languages/Romanian.nsh +28 -0
- package/windows/languages/Serbian.nsh +28 -0
- package/windows/languages/Slovak.nsh +28 -0
- package/windows/languages/Thai.nsh +28 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { AddressModel } from '../addressModel.ts';
|
|
3
|
+
import type { ColumnSource, DeckColumn } from '../deckModel.ts';
|
|
4
|
+
import type { AccountRules } from '../profileModel.ts';
|
|
5
|
+
import type { IconName } from './icons.tsx';
|
|
6
|
+
import type { ShellMenu } from './menuModel.ts';
|
|
7
|
+
import type { PaletteItem } from './paletteModel.ts';
|
|
8
|
+
import type { ThemeStore } from './themeStore.ts';
|
|
9
|
+
/** An inline completion for a text field (the address bar, a column's value). */
|
|
10
|
+
export type Suggestion = {
|
|
11
|
+
label: string;
|
|
12
|
+
insert: string;
|
|
13
|
+
hint: string;
|
|
14
|
+
};
|
|
15
|
+
/** Completions for what is being typed and how accepting one rewrites the text. */
|
|
16
|
+
export type Completer = {
|
|
17
|
+
/** Up to `max` completions for the token at `caret`. */
|
|
18
|
+
suggest(text: string, caret: number, max: number): Suggestion[];
|
|
19
|
+
apply(text: string, caret: number, insert: string): {
|
|
20
|
+
text: string;
|
|
21
|
+
caret: number;
|
|
22
|
+
};
|
|
23
|
+
/** Accessible name of the chips ("X search operators"). */
|
|
24
|
+
label(): string;
|
|
25
|
+
};
|
|
26
|
+
/** One kind of deck column (Home, Notifications, a search, a profile, ...). */
|
|
27
|
+
export type ColumnKind = {
|
|
28
|
+
kind: string;
|
|
29
|
+
label: string;
|
|
30
|
+
icon: IconName;
|
|
31
|
+
hint: string;
|
|
32
|
+
/** What the value field asks for (none = no value). */
|
|
33
|
+
value?: {
|
|
34
|
+
label: string;
|
|
35
|
+
placeholder: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** A deck column flag the page applies (a site tweak), with its label for settings. */
|
|
39
|
+
export type ColumnFlag = {
|
|
40
|
+
key: string;
|
|
41
|
+
label: string;
|
|
42
|
+
hint: string;
|
|
43
|
+
};
|
|
44
|
+
/** A ready-made set of columns ("Monitor", "Two accounts"). */
|
|
45
|
+
export type DeckPreset = {
|
|
46
|
+
id: string;
|
|
47
|
+
label(): string;
|
|
48
|
+
/** The new deck's name and the preset's row in settings (default: `label`). */
|
|
49
|
+
name?(): string;
|
|
50
|
+
/** What the preset's columns are, for settings. */
|
|
51
|
+
hint?(): string;
|
|
52
|
+
/** Disabled (with this hint) when only one account exists. */
|
|
53
|
+
needsTwoAccounts?: () => string;
|
|
54
|
+
columns(profiles: readonly string[]): Array<Pick<DeckColumn, 'profile' | 'source'>>;
|
|
55
|
+
};
|
|
56
|
+
export type DeckSite = {
|
|
57
|
+
kinds: readonly ColumnKind[];
|
|
58
|
+
/** The page a column loads, or null when its value is not valid for its kind. */
|
|
59
|
+
urlFor(source: ColumnSource): string | null;
|
|
60
|
+
/** Header title and subtitle for a column. */
|
|
61
|
+
title(source: ColumnSource, custom?: string): {
|
|
62
|
+
title: string;
|
|
63
|
+
detail?: string;
|
|
64
|
+
};
|
|
65
|
+
/** The typed value → the stored value, or null when it is not valid for that kind. */
|
|
66
|
+
parseValue(kind: string, input: string): string | null;
|
|
67
|
+
/** Why a typed value is not valid for `kind` (shown under the field). */
|
|
68
|
+
invalid(kind: string): string;
|
|
69
|
+
/** Completions in a kind's value field (e.g. search operators for a search column). */
|
|
70
|
+
completer?(kind: string): Completer | null;
|
|
71
|
+
/** Flags a column may override (listed in settings), and flags the page accepts that are not listed. */
|
|
72
|
+
flags: readonly ColumnFlag[];
|
|
73
|
+
extraFlags?: readonly string[];
|
|
74
|
+
/** Flags every column starts with. */
|
|
75
|
+
defaultFlags: Record<string, boolean>;
|
|
76
|
+
/** Flags a column's kind always sets (e.g. X's Following column selects X's own Following tab). */
|
|
77
|
+
kindFlags?(source: ColumnSource): Record<string, boolean>;
|
|
78
|
+
presets?: readonly DeckPreset[];
|
|
79
|
+
/** A page docked at the right of a deck to write in (X: its composer). */
|
|
80
|
+
compose?: {
|
|
81
|
+
url: string;
|
|
82
|
+
width: number;
|
|
83
|
+
/** The docked page's chrome and placeholder (it registers its placeholder with the frame). */
|
|
84
|
+
Dock: ComponentType<{
|
|
85
|
+
deckId: string;
|
|
86
|
+
left: number;
|
|
87
|
+
}>;
|
|
88
|
+
/** The dock's webview reported a page (e.g. load a fresh composer once one was sent). */
|
|
89
|
+
navigated?(tabId: string, url: string | undefined, loading: boolean | undefined): void;
|
|
90
|
+
};
|
|
91
|
+
/** A page title without the site's suffix (" / X"). */
|
|
92
|
+
pageTitle?(title: string): string;
|
|
93
|
+
};
|
|
94
|
+
export type PaletteSite = {
|
|
95
|
+
/** The field's placeholder. */
|
|
96
|
+
placeholder(): string;
|
|
97
|
+
/** The literal search for the query (listed first; kept as the last resort when ranking). */
|
|
98
|
+
search?(text: string): PaletteItem | null;
|
|
99
|
+
/** Completions ranked above everything else while typing (they rewrite the query). */
|
|
100
|
+
completions?(text: string): PaletteItem[];
|
|
101
|
+
/** Sections of the app's panel ("Themes", "Plugins", ...). */
|
|
102
|
+
sections: ReadonlyArray<{
|
|
103
|
+
id: string;
|
|
104
|
+
label(): string;
|
|
105
|
+
keywords: string;
|
|
106
|
+
icon: IconName;
|
|
107
|
+
}>;
|
|
108
|
+
/** The site's own pages and actions (after the tabs, decks and the app's items). */
|
|
109
|
+
items?(): PaletteItem[];
|
|
110
|
+
/** Heading for a site group (`PaletteItem.group`); the frame names its own groups. */
|
|
111
|
+
groupLabel?(group: string): string | undefined;
|
|
112
|
+
};
|
|
113
|
+
export type ShellSite = {
|
|
114
|
+
/** The site's name in messages ("X"). */
|
|
115
|
+
name: string;
|
|
116
|
+
/** The app's name ("wayBetter for X"): the update chip, the brand button, the palette's group. */
|
|
117
|
+
product: string;
|
|
118
|
+
/** Match native `AppConfig::defer_window_show`: reveal after the first layout reaches native. */
|
|
119
|
+
deferWindowShow?: boolean;
|
|
120
|
+
/** The app's logo (an image URL): titlebar, the panel tab, the new-tab page, the site chip. */
|
|
121
|
+
logo: string;
|
|
122
|
+
/** The site's home feed: the first tab, and what an account opens beside. */
|
|
123
|
+
homeUrl: string;
|
|
124
|
+
/** The site's own sign-in and sign-out pages (accounts are signed in and out on the site). */
|
|
125
|
+
loginUrl: string;
|
|
126
|
+
logoutUrl: string;
|
|
127
|
+
/** A page of the site itself (https, the site's hosts). */
|
|
128
|
+
isSiteUrl(url: string): boolean;
|
|
129
|
+
/** Account handle and avatar rules (as the native `AccountRules`). */
|
|
130
|
+
accounts: AccountRules;
|
|
131
|
+
/** Text typed in the address bar or the new-tab page that is not an address: the site's search. */
|
|
132
|
+
searchUrl(text: string): string;
|
|
133
|
+
/** Address bar chips for a URL (null: show the raw address). */
|
|
134
|
+
address(url: string): AddressModel | null;
|
|
135
|
+
/** Completions while the address is edited. */
|
|
136
|
+
addressCompleter?: Completer;
|
|
137
|
+
/** The app's own tab: its settings panel, opened at a section (`openPanelSection`). */
|
|
138
|
+
panel: {
|
|
139
|
+
/** Tab id (kept in saved layouts and workspaces). */
|
|
140
|
+
id: string;
|
|
141
|
+
title: string;
|
|
142
|
+
component: ComponentType<{
|
|
143
|
+
section?: {
|
|
144
|
+
name: string;
|
|
145
|
+
nonce: number;
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
};
|
|
149
|
+
newTab: {
|
|
150
|
+
/** The search field's placeholder. */
|
|
151
|
+
search(): string;
|
|
152
|
+
/** Quick links (their `url` gets the `homeUrl` setting). */
|
|
153
|
+
links: ReadonlyArray<{
|
|
154
|
+
id: string;
|
|
155
|
+
label(): string;
|
|
156
|
+
icon: IconName;
|
|
157
|
+
url(homeUrl: string): string;
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
palette: PaletteSite;
|
|
161
|
+
/** Decks of site columns (Power User Mode); omit for none. */
|
|
162
|
+
deck?: DeckSite;
|
|
163
|
+
/** Gallery and clipboard panel: which tabs have a composer to attach to; omit for none. */
|
|
164
|
+
media?: {
|
|
165
|
+
canAttach(url: string): boolean;
|
|
166
|
+
};
|
|
167
|
+
/** The app's theme store (createThemeStore): chrome and pane themes; omit to keep the frame's own style. */
|
|
168
|
+
themes?: ThemeStore<any, any>;
|
|
169
|
+
/**
|
|
170
|
+
* Native features the app serves (waybetter-host modules it wires up): workspaces (`workspaces_*`),
|
|
171
|
+
* encrypted folder sync (`sync_*`), developer mode (`dev_*`), plugin palette commands
|
|
172
|
+
* (`tab_run_command`), page zoom, find in page and safe mode (`tab_zoom`, `tab_find`, `safe_mode_*`: the host's own); and what its panel has that the
|
|
173
|
+
* app menu links to: the Store (`PanelSite.store`) and the updater (`PanelSite.updates`). Each is
|
|
174
|
+
* on unless set to false; off, the frame shows nothing of it.
|
|
175
|
+
*/
|
|
176
|
+
features?: {
|
|
177
|
+
workspaces?: boolean;
|
|
178
|
+
sync?: boolean;
|
|
179
|
+
developer?: boolean;
|
|
180
|
+
pluginCommands?: boolean;
|
|
181
|
+
zoom?: boolean;
|
|
182
|
+
find?: boolean;
|
|
183
|
+
safeMode?: boolean;
|
|
184
|
+
store?: boolean;
|
|
185
|
+
updates?: boolean;
|
|
186
|
+
/** The panel has the Languages section for string packs (`createStringPacksSection`, id `languages`): only when true. */
|
|
187
|
+
strings?: boolean;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* The app menu (the titlebar's "Settings and more", Alt+F / F10): its rows in order (built-in
|
|
191
|
+
* ones by name, the app's own as objects) and what the Language and Mode submenus need. Omit for
|
|
192
|
+
* the default menu: every built-in row this app can serve (menuModel.ts `DEFAULT_MENU`).
|
|
193
|
+
*/
|
|
194
|
+
menu?: ShellMenu;
|
|
195
|
+
/** Components rendered on top of the shell (they listen to their own events). */
|
|
196
|
+
overlays?: ReadonlyArray<ComponentType>;
|
|
197
|
+
/** Called once the dock exists (read site settings, listen to site events). Returns a cleanup. */
|
|
198
|
+
start?(): (() => void) | undefined;
|
|
199
|
+
};
|
|
200
|
+
/** Sets the site (createShell). */
|
|
201
|
+
export declare function configureSite(value: ShellSite): void;
|
|
202
|
+
export declare function site(): ShellSite;
|
|
203
|
+
/** Whether the app serves a native feature (`site.features`, on by default). */
|
|
204
|
+
export declare const hasFeature: (name: keyof NonNullable<ShellSite["features"]>) => boolean;
|
|
205
|
+
/** The site's runtime text changed (X: the Twitter/X wording): address bars and new-tab pages re-render. */
|
|
206
|
+
export declare function siteChanged(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// What a wayBetter app tells the shell frame about its site: names, pages, the address bar chips,
|
|
2
|
+
// the new-tab page, the palette's site items, deck column kinds, the app's own panel and the
|
|
3
|
+
// overlays it adds. `createShell(site)` sets it; every frame module reads it through `site()`.
|
|
4
|
+
// Everything here is data or small functions; the frame owns the behavior (tabs, splits, the
|
|
5
|
+
// titlebar, overlays, layout sync, workspaces, sync, developer mode).
|
|
6
|
+
let current = null;
|
|
7
|
+
/** Sets the site (createShell). */
|
|
8
|
+
export function configureSite(value) {
|
|
9
|
+
current = value;
|
|
10
|
+
}
|
|
11
|
+
export function site() {
|
|
12
|
+
if (!current)
|
|
13
|
+
throw new Error('wayBetter shell: createShell(site) first');
|
|
14
|
+
return current;
|
|
15
|
+
}
|
|
16
|
+
/** Whether the app serves a native feature (`site.features`, on by default). */
|
|
17
|
+
export const hasFeature = (name) => site().features?.[name] !== false;
|
|
18
|
+
/** The site's runtime text changed (X: the Twitter/X wording): address bars and new-tab pages re-render. */
|
|
19
|
+
export function siteChanged() {
|
|
20
|
+
window.dispatchEvent(new CustomEvent('bt-site'));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.js","sourceRoot":"","sources":["../../../../../../shell/src/frame/site.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,6FAA6F;AAC7F,+FAA+F;AAC/F,6FAA6F;AAC7F,sEAAsE;AAoKtE,IAAI,OAAO,GAAqB,IAAI,CAAC;AAErC,mCAAmC;AACnC,MAAM,UAAU,aAAa,CAAC,KAAgB;IAC5C,OAAO,GAAG,KAAK,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC1E,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAA8C,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;AAEhH,4GAA4G;AAC5G,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// What a wayBetter app tells the shell frame about its site: names, pages, the address bar chips,\n// the new-tab page, the palette's site items, deck column kinds, the app's own panel and the\n// overlays it adds. `createShell(site)` sets it; every frame module reads it through `site()`.\n// Everything here is data or small functions; the frame owns the behavior (tabs, splits, the\n// titlebar, overlays, layout sync, workspaces, sync, developer mode).\n\nimport type { ComponentType } from 'react';\nimport type { AddressModel } from '../addressModel.ts';\nimport type { ColumnSource, DeckColumn } from '../deckModel.ts';\nimport type { AccountRules } from '../profileModel.ts';\nimport type { IconName } from './icons.tsx';\nimport type { ShellMenu } from './menuModel.ts';\nimport type { PaletteItem } from './paletteModel.ts';\nimport type { ThemeStore } from './themeStore.ts';\n\n/** An inline completion for a text field (the address bar, a column's value). */\nexport type Suggestion = { label: string; insert: string; hint: string };\n\n/** Completions for what is being typed and how accepting one rewrites the text. */\nexport type Completer = {\n /** Up to `max` completions for the token at `caret`. */\n suggest(text: string, caret: number, max: number): Suggestion[];\n apply(text: string, caret: number, insert: string): { text: string; caret: number };\n /** Accessible name of the chips (\"X search operators\"). */\n label(): string;\n};\n\n/** One kind of deck column (Home, Notifications, a search, a profile, ...). */\nexport type ColumnKind = {\n kind: string;\n label: string;\n icon: IconName;\n hint: string;\n /** What the value field asks for (none = no value). */\n value?: { label: string; placeholder: string };\n};\n\n/** A deck column flag the page applies (a site tweak), with its label for settings. */\nexport type ColumnFlag = { key: string; label: string; hint: string };\n\n/** A ready-made set of columns (\"Monitor\", \"Two accounts\"). */\nexport type DeckPreset = {\n id: string;\n label(): string;\n /** The new deck's name and the preset's row in settings (default: `label`). */\n name?(): string;\n /** What the preset's columns are, for settings. */\n hint?(): string;\n /** Disabled (with this hint) when only one account exists. */\n needsTwoAccounts?: () => string;\n columns(profiles: readonly string[]): Array<Pick<DeckColumn, 'profile' | 'source'>>;\n};\n\nexport type DeckSite = {\n kinds: readonly ColumnKind[];\n /** The page a column loads, or null when its value is not valid for its kind. */\n urlFor(source: ColumnSource): string | null;\n /** Header title and subtitle for a column. */\n title(source: ColumnSource, custom?: string): { title: string; detail?: string };\n /** The typed value → the stored value, or null when it is not valid for that kind. */\n parseValue(kind: string, input: string): string | null;\n /** Why a typed value is not valid for `kind` (shown under the field). */\n invalid(kind: string): string;\n /** Completions in a kind's value field (e.g. search operators for a search column). */\n completer?(kind: string): Completer | null;\n /** Flags a column may override (listed in settings), and flags the page accepts that are not listed. */\n flags: readonly ColumnFlag[];\n extraFlags?: readonly string[];\n /** Flags every column starts with. */\n defaultFlags: Record<string, boolean>;\n /** Flags a column's kind always sets (e.g. X's Following column selects X's own Following tab). */\n kindFlags?(source: ColumnSource): Record<string, boolean>;\n presets?: readonly DeckPreset[];\n /** A page docked at the right of a deck to write in (X: its composer). */\n compose?: {\n url: string;\n width: number;\n /** The docked page's chrome and placeholder (it registers its placeholder with the frame). */\n Dock: ComponentType<{ deckId: string; left: number }>;\n /** The dock's webview reported a page (e.g. load a fresh composer once one was sent). */\n navigated?(tabId: string, url: string | undefined, loading: boolean | undefined): void;\n };\n /** A page title without the site's suffix (\" / X\"). */\n pageTitle?(title: string): string;\n};\n\nexport type PaletteSite = {\n /** The field's placeholder. */\n placeholder(): string;\n /** The literal search for the query (listed first; kept as the last resort when ranking). */\n search?(text: string): PaletteItem | null;\n /** Completions ranked above everything else while typing (they rewrite the query). */\n completions?(text: string): PaletteItem[];\n /** Sections of the app's panel (\"Themes\", \"Plugins\", ...). */\n sections: ReadonlyArray<{ id: string; label(): string; keywords: string; icon: IconName }>;\n /** The site's own pages and actions (after the tabs, decks and the app's items). */\n items?(): PaletteItem[];\n /** Heading for a site group (`PaletteItem.group`); the frame names its own groups. */\n groupLabel?(group: string): string | undefined;\n};\n\nexport type ShellSite = {\n /** The site's name in messages (\"X\"). */\n name: string;\n /** The app's name (\"wayBetter for X\"): the update chip, the brand button, the palette's group. */\n product: string;\n /** Match native `AppConfig::defer_window_show`: reveal after the first layout reaches native. */\n deferWindowShow?: boolean;\n /** The app's logo (an image URL): titlebar, the panel tab, the new-tab page, the site chip. */\n logo: string;\n /** The site's home feed: the first tab, and what an account opens beside. */\n homeUrl: string;\n /** The site's own sign-in and sign-out pages (accounts are signed in and out on the site). */\n loginUrl: string;\n logoutUrl: string;\n /** A page of the site itself (https, the site's hosts). */\n isSiteUrl(url: string): boolean;\n /** Account handle and avatar rules (as the native `AccountRules`). */\n accounts: AccountRules;\n /** Text typed in the address bar or the new-tab page that is not an address: the site's search. */\n searchUrl(text: string): string;\n /** Address bar chips for a URL (null: show the raw address). */\n address(url: string): AddressModel | null;\n /** Completions while the address is edited. */\n addressCompleter?: Completer;\n /** The app's own tab: its settings panel, opened at a section (`openPanelSection`). */\n panel: {\n /** Tab id (kept in saved layouts and workspaces). */\n id: string;\n title: string;\n component: ComponentType<{ section?: { name: string; nonce: number } }>;\n };\n newTab: {\n /** The search field's placeholder. */\n search(): string;\n /** Quick links (their `url` gets the `homeUrl` setting). */\n links: ReadonlyArray<{ id: string; label(): string; icon: IconName; url(homeUrl: string): string }>;\n };\n palette: PaletteSite;\n /** Decks of site columns (Power User Mode); omit for none. */\n deck?: DeckSite;\n /** Gallery and clipboard panel: which tabs have a composer to attach to; omit for none. */\n media?: { canAttach(url: string): boolean };\n /** The app's theme store (createThemeStore): chrome and pane themes; omit to keep the frame's own style. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n themes?: ThemeStore<any, any>;\n /**\n * Native features the app serves (waybetter-host modules it wires up): workspaces (`workspaces_*`),\n * encrypted folder sync (`sync_*`), developer mode (`dev_*`), plugin palette commands\n * (`tab_run_command`), page zoom, find in page and safe mode (`tab_zoom`, `tab_find`, `safe_mode_*`: the host's own); and what its panel has that the\n * app menu links to: the Store (`PanelSite.store`) and the updater (`PanelSite.updates`). Each is\n * on unless set to false; off, the frame shows nothing of it.\n */\n features?: { workspaces?: boolean; sync?: boolean; developer?: boolean; pluginCommands?: boolean; zoom?: boolean; find?: boolean; safeMode?: boolean; store?: boolean; updates?: boolean;\n /** The panel has the Languages section for string packs (`createStringPacksSection`, id `languages`): only when true. */\n strings?: boolean };\n /**\n * The app menu (the titlebar's \"Settings and more\", Alt+F / F10): its rows in order (built-in\n * ones by name, the app's own as objects) and what the Language and Mode submenus need. Omit for\n * the default menu: every built-in row this app can serve (menuModel.ts `DEFAULT_MENU`).\n */\n menu?: ShellMenu;\n /** Components rendered on top of the shell (they listen to their own events). */\n overlays?: ReadonlyArray<ComponentType>;\n /** Called once the dock exists (read site settings, listen to site events). Returns a cleanup. */\n start?(): (() => void) | undefined;\n};\n\nlet current: ShellSite | null = null;\n\n/** Sets the site (createShell). */\nexport function configureSite(value: ShellSite) {\n current = value;\n}\n\nexport function site(): ShellSite {\n if (!current) throw new Error('wayBetter shell: createShell(site) first');\n return current;\n}\n\n/** Whether the app serves a native feature (`site.features`, on by default). */\nexport const hasFeature = (name: keyof NonNullable<ShellSite['features']>) => site().features?.[name] !== false;\n\n/** The site's runtime text changed (X: the Twitter/X wording): address bars and new-tab pages re-render. */\nexport function siteChanged() {\n window.dispatchEvent(new CustomEvent('bt-site'));\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { DockviewApi, IDockviewPanel } from 'dockview';
|
|
2
|
+
import { type ProfileSettings } from '../profileModel.ts';
|
|
3
|
+
import type { PaneInfo } from './accountModel.ts';
|
|
4
|
+
import type { PaletteAction } from './paletteModel.ts';
|
|
5
|
+
/** `profile`: the account profile (WebView data directory) the tab runs in; missing = default. */
|
|
6
|
+
/** `besideOf`: the group whose "beside" link opened this tab; its group is that group's side pane. */
|
|
7
|
+
export type WebParams = {
|
|
8
|
+
kind: 'web';
|
|
9
|
+
url: string;
|
|
10
|
+
profile?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
favicon?: string;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
pinned?: boolean;
|
|
15
|
+
besideOf?: string;
|
|
16
|
+
};
|
|
17
|
+
/** The app's own tab (its settings panel, `site.panel`). */
|
|
18
|
+
export type PanelParams = {
|
|
19
|
+
kind: 'panel';
|
|
20
|
+
section?: string;
|
|
21
|
+
nonce?: number;
|
|
22
|
+
pinned?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** The new-tab page: drawn by the shell itself (no webview); `profile` is the account it opens links in. */
|
|
25
|
+
export type StartParams = {
|
|
26
|
+
kind: 'start';
|
|
27
|
+
profile?: string;
|
|
28
|
+
pinned?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** A deck of site columns (DeckView.tsx); its columns are tab webviews of their own. */
|
|
31
|
+
export type DeckParams = {
|
|
32
|
+
kind: 'deck';
|
|
33
|
+
deckId: string;
|
|
34
|
+
pinned?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type TabParams = WebParams | PanelParams | StartParams | DeckParams;
|
|
37
|
+
/** Shared, non-React shell state: pane placeholders and the native webview reconciliation. */
|
|
38
|
+
export declare const shell: {
|
|
39
|
+
api: DockviewApi | null;
|
|
40
|
+
placeholders: Map<string, HTMLElement>;
|
|
41
|
+
/**
|
|
42
|
+
* Open shell overlays (menus, dialogs, palette, drag zones). While > 0 the shell webview is raised
|
|
43
|
+
* above the tab webviews (panes stay visible under it), or, where it cannot be, they are hidden.
|
|
44
|
+
*/
|
|
45
|
+
overlay: number;
|
|
46
|
+
/** Recently closed web tabs, newest last (Ctrl+Shift+T, new-tab page). */
|
|
47
|
+
closed: Array<{
|
|
48
|
+
url: string;
|
|
49
|
+
profile?: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
}>;
|
|
52
|
+
profiles: ProfileSettings;
|
|
53
|
+
restoring: boolean;
|
|
54
|
+
/** Toolbar actions implemented by Shell.tsx (split view, the app's panel). */
|
|
55
|
+
split: (_id: string, _direction: "right" | "below") => void;
|
|
56
|
+
openPanel: (_from?: string) => void;
|
|
57
|
+
/** Opens the new-tab page in the given profile. */
|
|
58
|
+
newTab: (_profile: string) => void;
|
|
59
|
+
/** The `homeUrl` setting (new-tab page "Home" link, first tab); `site.homeUrl` until read. */
|
|
60
|
+
homeUrl: string;
|
|
61
|
+
/** Opens `url` from the new-tab page: replaces that page (`startId`) or, without one, adds a tab. */
|
|
62
|
+
openFromStart: (_url: string, _profile: string, _startId?: string) => void;
|
|
63
|
+
/** Account switcher click: focus a visible pane of that account or open its feed beside (Shell.tsx). */
|
|
64
|
+
openAccount: (_profile: string, _options?: {
|
|
65
|
+
force?: boolean;
|
|
66
|
+
url?: string;
|
|
67
|
+
}) => void;
|
|
68
|
+
/** Opens `url` as a web tab in `profile` (a deck column's "Open as tab"). */
|
|
69
|
+
openUrl: (_url: string, _profile: string) => void;
|
|
70
|
+
/** Opens the app's panel at a section (e.g. the deck's settings button). */
|
|
71
|
+
openPanelSection: (_section: string) => void;
|
|
72
|
+
/** Runs a shell shortcut by name as if its keys were pressed (`new-tab`, `split-right`, `command-palette`, ...). */
|
|
73
|
+
shortcut: (_name: string) => void;
|
|
74
|
+
/** Runs a palette action (navigation only: open a deck, add a column, restore a workspace, ...). */
|
|
75
|
+
run: (_action: PaletteAction) => void;
|
|
76
|
+
};
|
|
77
|
+
/** The app's panel tab id (`site.panel.id`, kept in saved layouts). */
|
|
78
|
+
export declare const panelId: () => string;
|
|
79
|
+
/** Replaces the profile list (after a native save) and tells mounted switchers and tabs. */
|
|
80
|
+
export declare function setProfiles(value: unknown): void;
|
|
81
|
+
export declare const newTabId: () => string;
|
|
82
|
+
export declare const isWeb: (panel: IDockviewPanel) => boolean;
|
|
83
|
+
/** Every tab as the account switcher sees it. */
|
|
84
|
+
export declare function paneInfos(): PaneInfo[];
|
|
85
|
+
/** Merge params without ever passing `undefined` (dockview deletes keys set to undefined). */
|
|
86
|
+
export declare function patchParams(panel: IDockviewPanel, patch: Partial<WebParams>): void;
|
|
87
|
+
export declare function scheduleSync(): void;
|
|
88
|
+
/** Sends the layout again even though nothing moved: native code asked to build every tab webview anew (`tabs-rebuild`). */
|
|
89
|
+
export declare function resync(): void;
|
|
90
|
+
/** Sends the tab rectangles now (e.g. so native code knows closed tabs are gone before a profile removal). */
|
|
91
|
+
export declare function flushSync(): Promise<void>;
|
|
92
|
+
export declare function setOverlay(delta: number): void;
|
|
93
|
+
/** The startup probe (createShell): whether this platform can raise the shell above its tabs. */
|
|
94
|
+
export declare function probeLayer(): void;
|
|
95
|
+
/** Wait until the startup cover has either raised the shell or hidden the native tabs. */
|
|
96
|
+
export declare function flushLayer(): Promise<void>;
|
|
97
|
+
export declare function saveLayoutSoon(): void;
|
|
98
|
+
export declare function loadLayout(): unknown;
|
|
99
|
+
export declare const tabAction: (id: string, action: "back" | "forward" | "reload" | "stop" | "focus") => Promise<unknown>;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
// Shared, non-React shell state: the dock, pane placeholders and the native webview reconciliation
|
|
2
|
+
// (`tabs_sync`, one layout in flight at a time), shell overlays (the shell webview is raised above
|
|
3
|
+
// the tab webviews while a menu, dialog or drag is open), profiles and session layout persistence.
|
|
4
|
+
import { cssRgb, paneVisibility, raiseSupported, withNavRedundant } from "../paneModel.js";
|
|
5
|
+
import { defaultProfiles, normalizeProfiles, tabProfile } from "../profileModel.js";
|
|
6
|
+
import { currentWindow, invoke } from "./bridge.js";
|
|
7
|
+
import { columnSourceUrl, composeTabId, deckById, decks } from "./deckStore.js";
|
|
8
|
+
import { diag } from "./diag.js";
|
|
9
|
+
import { site } from "./site.js";
|
|
10
|
+
import { latestOnly } from "./syncGate.js";
|
|
11
|
+
const LAYOUT_KEY = 'bt.shell.layout.v1';
|
|
12
|
+
/** Shared, non-React shell state: pane placeholders and the native webview reconciliation. */
|
|
13
|
+
export const shell = {
|
|
14
|
+
api: null,
|
|
15
|
+
placeholders: new Map(),
|
|
16
|
+
/**
|
|
17
|
+
* Open shell overlays (menus, dialogs, palette, drag zones). While > 0 the shell webview is raised
|
|
18
|
+
* above the tab webviews (panes stay visible under it), or, where it cannot be, they are hidden.
|
|
19
|
+
*/
|
|
20
|
+
overlay: 0,
|
|
21
|
+
/** Recently closed web tabs, newest last (Ctrl+Shift+T, new-tab page). */
|
|
22
|
+
closed: [],
|
|
23
|
+
profiles: defaultProfiles(),
|
|
24
|
+
restoring: false,
|
|
25
|
+
/** Toolbar actions implemented by Shell.tsx (split view, the app's panel). */
|
|
26
|
+
split: (_id, _direction) => { },
|
|
27
|
+
openPanel: (_from) => { },
|
|
28
|
+
/** Opens the new-tab page in the given profile. */
|
|
29
|
+
newTab: (_profile) => { },
|
|
30
|
+
/** The `homeUrl` setting (new-tab page "Home" link, first tab); `site.homeUrl` until read. */
|
|
31
|
+
homeUrl: '',
|
|
32
|
+
/** Opens `url` from the new-tab page: replaces that page (`startId`) or, without one, adds a tab. */
|
|
33
|
+
openFromStart: (_url, _profile, _startId) => { },
|
|
34
|
+
/** Account switcher click: focus a visible pane of that account or open its feed beside (Shell.tsx). */
|
|
35
|
+
openAccount: (_profile, _options) => { },
|
|
36
|
+
/** Opens `url` as a web tab in `profile` (a deck column's "Open as tab"). */
|
|
37
|
+
openUrl: (_url, _profile) => { },
|
|
38
|
+
/** Opens the app's panel at a section (e.g. the deck's settings button). */
|
|
39
|
+
openPanelSection: (_section) => { },
|
|
40
|
+
/** Runs a shell shortcut by name as if its keys were pressed (`new-tab`, `split-right`, `command-palette`, ...). */
|
|
41
|
+
shortcut: (_name) => { },
|
|
42
|
+
/** Runs a palette action (navigation only: open a deck, add a column, restore a workspace, ...). */
|
|
43
|
+
run: (_action) => { },
|
|
44
|
+
};
|
|
45
|
+
/** The app's panel tab id (`site.panel.id`, kept in saved layouts). */
|
|
46
|
+
export const panelId = () => site().panel.id;
|
|
47
|
+
/** Replaces the profile list (after a native save) and tells mounted switchers and tabs. */
|
|
48
|
+
export function setProfiles(value) {
|
|
49
|
+
shell.profiles = normalizeProfiles(value, site().accounts);
|
|
50
|
+
window.dispatchEvent(new CustomEvent('bt-profiles'));
|
|
51
|
+
scheduleSync();
|
|
52
|
+
}
|
|
53
|
+
export const newTabId = () => `t${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
54
|
+
export const isWeb = (panel) => panel.params?.kind === 'web';
|
|
55
|
+
/** Every tab as the account switcher sees it. */
|
|
56
|
+
export function paneInfos() {
|
|
57
|
+
return (shell.api?.panels ?? []).map(panel => {
|
|
58
|
+
const params = panel.params;
|
|
59
|
+
return {
|
|
60
|
+
id: panel.id,
|
|
61
|
+
kind: !params || params.kind === 'deck' ? 'panel' : params.kind,
|
|
62
|
+
profile: params && params.kind !== 'panel' && params.kind !== 'deck' ? params.profile : undefined,
|
|
63
|
+
url: params?.kind === 'web' ? params.url : undefined,
|
|
64
|
+
visible: panel.api.isVisible,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** Merge params without ever passing `undefined` (dockview deletes keys set to undefined). */
|
|
69
|
+
export function patchParams(panel, patch) {
|
|
70
|
+
const clean = Object.fromEntries(Object.entries(patch).filter(([, value]) => value !== undefined));
|
|
71
|
+
if (Object.keys(clean).length)
|
|
72
|
+
panel.api.updateParameters(clean);
|
|
73
|
+
}
|
|
74
|
+
let frame = 0;
|
|
75
|
+
let lastPayload = '';
|
|
76
|
+
/** Last `navRedundant` per tab; a hidden tab keeps its value so it shows up without a flicker. */
|
|
77
|
+
const navRedundant = new Map();
|
|
78
|
+
export function scheduleSync() {
|
|
79
|
+
if (frame)
|
|
80
|
+
return;
|
|
81
|
+
frame = requestAnimationFrame(() => { frame = 0; void syncTabs(); });
|
|
82
|
+
}
|
|
83
|
+
/** Sends the layout again even though nothing moved: native code asked to build every tab webview anew (`tabs-rebuild`). */
|
|
84
|
+
export function resync() {
|
|
85
|
+
lastPayload = '';
|
|
86
|
+
scheduleSync();
|
|
87
|
+
}
|
|
88
|
+
/** Sends the tab rectangles now (e.g. so native code knows closed tabs are gone before a profile removal). */
|
|
89
|
+
export function flushSync() {
|
|
90
|
+
if (frame) {
|
|
91
|
+
cancelAnimationFrame(frame);
|
|
92
|
+
frame = 0;
|
|
93
|
+
}
|
|
94
|
+
return syncTabs();
|
|
95
|
+
}
|
|
96
|
+
function syncTabs() {
|
|
97
|
+
const api = shell.api;
|
|
98
|
+
if (!api)
|
|
99
|
+
return Promise.resolve();
|
|
100
|
+
const boxes = api.panels.filter(isWeb).map(panel => {
|
|
101
|
+
const params = panel.params;
|
|
102
|
+
const el = shell.placeholders.get(panel.id);
|
|
103
|
+
const rect = el?.isConnected ? el.getBoundingClientRect() : null;
|
|
104
|
+
const shown = !!rect && rect.width > 1 && rect.height > 1 && panel.api.isVisible;
|
|
105
|
+
const { visible, parked } = paneVisibility({ shown, overlay: shell.overlay, raiseSupported: layer.supported });
|
|
106
|
+
return {
|
|
107
|
+
id: panel.id,
|
|
108
|
+
url: params.url,
|
|
109
|
+
profile: tabProfile(shell.profiles, params.profile).id,
|
|
110
|
+
x: Math.round(rect?.left ?? 0),
|
|
111
|
+
y: Math.round(rect?.top ?? 0),
|
|
112
|
+
width: Math.round(rect?.width ?? 1),
|
|
113
|
+
height: Math.round(rect?.height ?? 1),
|
|
114
|
+
visible,
|
|
115
|
+
// Not shown for a reason other than a shell overlay: only these drop to low memory.
|
|
116
|
+
parked,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
// Only visible panes are judged (a shell overlay hides them all and so changes nothing).
|
|
120
|
+
const items = withNavRedundant([...boxes, ...columnBoxes()], site().isSiteUrl, navRedundant);
|
|
121
|
+
const payload = JSON.stringify(items);
|
|
122
|
+
if (payload === lastPayload)
|
|
123
|
+
return Promise.resolve();
|
|
124
|
+
lastPayload = payload;
|
|
125
|
+
saveLayoutSoon();
|
|
126
|
+
// `viewport`: the window size this layout is for; native code re-bases it if the window was
|
|
127
|
+
// resized while it was in flight (it also follows resizes itself, before the shell re-lays out).
|
|
128
|
+
return sendLayout({ items, viewport: [window.innerWidth, window.innerHeight] });
|
|
129
|
+
}
|
|
130
|
+
/** One tabs_sync in flight at a time; during a drag only the newest layout waits (syncGate.ts). */
|
|
131
|
+
const sendLayout = latestOnly(args => invoke('tabs_sync', args).then(() => { }, error => console.error('[shell] tabs_sync', error)));
|
|
132
|
+
/**
|
|
133
|
+
* Deck columns (and each deck's compose dock) of every open deck tab. A column on another page of
|
|
134
|
+
* its deck has no placeholder: hidden, and parked (low memory) when the setting says so; a deck
|
|
135
|
+
* tab in the background parks all of its columns.
|
|
136
|
+
*/
|
|
137
|
+
function columnBoxes() {
|
|
138
|
+
const api = shell.api;
|
|
139
|
+
const composeUrl = site().deck?.compose?.url;
|
|
140
|
+
if (!api)
|
|
141
|
+
return [];
|
|
142
|
+
const boxes = [];
|
|
143
|
+
for (const panel of api.panels) {
|
|
144
|
+
const params = panel.params;
|
|
145
|
+
if (params?.kind !== 'deck')
|
|
146
|
+
continue;
|
|
147
|
+
const deck = deckById(params.deckId);
|
|
148
|
+
if (!deck)
|
|
149
|
+
continue;
|
|
150
|
+
const deckShown = panel.api.isVisible;
|
|
151
|
+
const entries = deck.columns.map(column => ({ id: column.tabId, profile: column.profile, url: columnSourceUrl(column.source) }));
|
|
152
|
+
const compose = decks.compose.get(deck.id);
|
|
153
|
+
if (compose && composeUrl)
|
|
154
|
+
entries.push({ id: composeTabId(deck.id), profile: compose.profile, url: composeUrl });
|
|
155
|
+
for (const entry of entries) {
|
|
156
|
+
if (!entry.url || !decks.ready.has(entry.id))
|
|
157
|
+
continue;
|
|
158
|
+
const el = shell.placeholders.get(entry.id);
|
|
159
|
+
const rect = el?.isConnected ? el.getBoundingClientRect() : null;
|
|
160
|
+
const shown = !!rect && rect.width > 1 && rect.height > 1 && deckShown;
|
|
161
|
+
boxes.push({
|
|
162
|
+
id: entry.id,
|
|
163
|
+
url: entry.url,
|
|
164
|
+
profile: tabProfile(shell.profiles, entry.profile).id,
|
|
165
|
+
x: Math.round(rect?.left ?? 0),
|
|
166
|
+
y: Math.round(rect?.top ?? 0),
|
|
167
|
+
width: Math.round(rect?.width ?? 1),
|
|
168
|
+
height: Math.round(rect?.height ?? 1),
|
|
169
|
+
visible: paneVisibility({ shown, overlay: shell.overlay, raiseSupported: layer.supported }).visible,
|
|
170
|
+
parked: !shown && (decks.settings.parkOffPage || !deckShown),
|
|
171
|
+
role: 'column',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return boxes;
|
|
176
|
+
}
|
|
177
|
+
export function setOverlay(delta) {
|
|
178
|
+
const before = shell.overlay;
|
|
179
|
+
shell.overlay = Math.max(0, before + delta);
|
|
180
|
+
diag(`overlay ${before} -> ${shell.overlay}`);
|
|
181
|
+
if ((before === 0) !== (shell.overlay === 0)) {
|
|
182
|
+
window.dispatchEvent(new Event('bt-overlay-changed'));
|
|
183
|
+
syncLayer();
|
|
184
|
+
}
|
|
185
|
+
scheduleSync();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The shell webview's place relative to the tab webviews. `supported`: `shell_raise` works here
|
|
189
|
+
* (Windows, Linux, macOS; probed once at startup, which also lowers a shell left raised by a reload). While raised,
|
|
190
|
+
* `html.bt-raised` makes the page see-through where panes are (shell.css).
|
|
191
|
+
*/
|
|
192
|
+
const layer = { supported: false, raised: false, queue: Promise.resolve(), probed: false };
|
|
193
|
+
let layerProbe = Promise.resolve();
|
|
194
|
+
const frames = () => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
|
|
195
|
+
/** The startup probe (createShell): whether this platform can raise the shell above its tabs. */
|
|
196
|
+
export function probeLayer() {
|
|
197
|
+
if (layer.probed)
|
|
198
|
+
return;
|
|
199
|
+
layer.probed = true;
|
|
200
|
+
// `localStorage['bt.dev.noRaise'] = '1'` (then reload): overlays hide the tabs as where raising
|
|
201
|
+
// is not supported, for before/after comparisons.
|
|
202
|
+
const off = (() => { try {
|
|
203
|
+
return localStorage.getItem('bt.dev.noRaise') === '1';
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return false;
|
|
207
|
+
} })();
|
|
208
|
+
layerProbe = invoke('shell_raise', { on: false }).then(ok => { layer.supported = raiseSupported(ok, off); syncLayer(); scheduleSync(); }, () => { });
|
|
209
|
+
}
|
|
210
|
+
/** Wait until the startup cover has either raised the shell or hidden the native tabs. */
|
|
211
|
+
export async function flushLayer() {
|
|
212
|
+
await layerProbe;
|
|
213
|
+
await layer.queue;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* While the shell is see-through, the few px of gutter between panes show the window's own
|
|
217
|
+
* background: paint it the theme's ground (read before `bt-raised` clears the page's).
|
|
218
|
+
*/
|
|
219
|
+
let windowGround = '';
|
|
220
|
+
function paintWindowGround() {
|
|
221
|
+
const ground = cssRgb(getComputedStyle(document.documentElement).backgroundColor);
|
|
222
|
+
if (!ground || ground.join() === windowGround)
|
|
223
|
+
return;
|
|
224
|
+
windowGround = ground.join();
|
|
225
|
+
currentWindow().setBackgroundColor([...ground, 255]).catch(() => { windowGround = ''; });
|
|
226
|
+
}
|
|
227
|
+
function syncLayer() {
|
|
228
|
+
if (!layer.supported)
|
|
229
|
+
return;
|
|
230
|
+
layer.queue = layer.queue.then(async () => {
|
|
231
|
+
const want = shell.overlay > 0;
|
|
232
|
+
if (want === layer.raised)
|
|
233
|
+
return;
|
|
234
|
+
const root = document.documentElement;
|
|
235
|
+
if (want) {
|
|
236
|
+
// See-through first (still under the tabs, so nothing changes on screen), then on top.
|
|
237
|
+
paintWindowGround();
|
|
238
|
+
root.classList.add('bt-raised');
|
|
239
|
+
await frames();
|
|
240
|
+
layer.raised = true;
|
|
241
|
+
diag('raise: on');
|
|
242
|
+
await invoke('shell_raise', { on: true });
|
|
243
|
+
diag(`raised (hasFocus=${document.hasFocus()})`);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Under the tabs first, then opaque again: the panes never blink.
|
|
247
|
+
const refocus = document.hasFocus() && (!document.activeElement || document.activeElement === document.body);
|
|
248
|
+
layer.raised = false;
|
|
249
|
+
diag('raise: off');
|
|
250
|
+
await invoke('shell_raise', { on: false });
|
|
251
|
+
diag(`lowered (hasFocus=${document.hasFocus()})`);
|
|
252
|
+
await frames();
|
|
253
|
+
if (shell.overlay === 0)
|
|
254
|
+
root.classList.remove('bt-raised');
|
|
255
|
+
// Closed from the keyboard or a click in the shell (not by the window losing focus) with
|
|
256
|
+
// nothing in the shell focused: typing goes back to the active pane.
|
|
257
|
+
const active = shell.api?.activePanel;
|
|
258
|
+
if (refocus && shell.overlay === 0 && active && isWeb(active))
|
|
259
|
+
void tabAction(active.id, 'focus');
|
|
260
|
+
}
|
|
261
|
+
}).catch(error => console.error('[shell] shell_raise', error));
|
|
262
|
+
}
|
|
263
|
+
let saveTimer;
|
|
264
|
+
export function saveLayoutSoon() {
|
|
265
|
+
clearTimeout(saveTimer);
|
|
266
|
+
saveTimer = setTimeout(() => {
|
|
267
|
+
if (!shell.api || shell.restoring)
|
|
268
|
+
return;
|
|
269
|
+
try {
|
|
270
|
+
localStorage.setItem(LAYOUT_KEY, JSON.stringify(shell.api.toJSON()));
|
|
271
|
+
}
|
|
272
|
+
catch { /* Session restore is best effort. */ }
|
|
273
|
+
}, 400);
|
|
274
|
+
}
|
|
275
|
+
export function loadLayout() {
|
|
276
|
+
try {
|
|
277
|
+
return JSON.parse(localStorage.getItem(LAYOUT_KEY) || 'null');
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
export const tabAction = (id, action) => invoke('tab_action', { id, action }).catch(() => { });
|
|
284
|
+
//# sourceMappingURL=state.js.map
|