From 9490da878222fde38ebf6377f5ff8d1e72336121 Mon Sep 17 00:00:00 2001 From: trickypr <23250792+trickypr@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:08:16 +1100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Customizable=20UI=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/webpack.config.cjs | 1 + package.json | 1 + pnpm-lock.yaml | 9 + src/content/browser/Browser.svelte | 76 +---- src/content/browser/components/Browser.svelte | 1 + .../components/customizableUI/Block.svelte | 25 ++ .../customizableUI/BrowserView.svelte | 29 ++ .../customizableUI/CustomizableUI.svelte | 37 +++ .../customizableUI/IconButton.svelte | 32 ++ .../customizableUI/OmniboxContainer.svelte | 24 ++ .../components/customizableUI/Spacer.svelte | 17 + .../components/customizableUI/Tabs.svelte | 32 ++ .../customizableUI/UIItemBase.svelte | 34 ++ .../components/customizableUI/index.ts | 3 + .../components/keybindings/Keybinding.svelte | 2 +- .../BrowserContextMenu.svelte | 0 .../HamburgerMenu}/HamburgerMenu.svelte | 21 +- .../HamburgerMenu}/HamburgerMenuItem.svelte | 0 src/content/browser/components/menus/index.ts | 18 ++ .../{toolbar => }/omnibox/Bookmarks.svelte | 14 +- .../{toolbar => }/omnibox/Omnibox.svelte | 5 +- .../browser/components/toolbar/Toolbar.svelte | 54 ---- src/content/browser/lib/globalApi.ts | 6 +- src/content/settings/Settings.svelte | 16 +- .../pref/CustomizableUI/Component.svelte | 155 +++++++++ .../CustomizableUI/Components/Block.svelte | 28 ++ .../CustomizableUI/Components/Browser.svelte | 11 + .../Components/IconButton.svelte | 14 + .../CustomizableUI/Components/Omnibox.svelte | 15 + .../CustomizableUI/Components/Spacer.svelte | 32 ++ .../CustomizableUI/Components/Tabs.svelte | 25 ++ .../Components/TempDropTarget.svelte | 13 + .../pref/CustomizableUI/Components/index.ts | 13 + .../pref/CustomizableUI/Configure.svelte | 98 ++++++ .../CustomizableUI/CustomizableUIPref.svelte | 103 ++++++ .../components/pref/CustomizableUI/index.ts | 7 + src/content/settings/components/pref/index.ts | 6 +- src/content/settings/settings.ts | 2 + .../components}/ToolbarButton.svelte | 0 src/content/shared/components/index.ts | 5 +- src/content/shared/contextMenus/MenuItem.ts | 11 +- src/content/shared/customizableUI/helpers.ts | 295 ++++++++++++++++++ src/content/shared/customizableUI/index.ts | 8 + src/content/shared/customizableUI/items.ts | 95 ++++++ src/content/shared/customizableUI/style.ts | 108 +++++++ src/content/shared/customizableUI/types.ts | 96 ++++++ src/content/shared/svelteUtils.ts | 14 + .../{browser/lib => shared}/xul/observable.ts | 0 src/link.d.ts | 4 + src/prefs.js | 4 + tsconfig.json | 3 +- 51 files changed, 1461 insertions(+), 161 deletions(-) create mode 100644 src/content/browser/components/customizableUI/Block.svelte create mode 100644 src/content/browser/components/customizableUI/BrowserView.svelte create mode 100644 src/content/browser/components/customizableUI/CustomizableUI.svelte create mode 100644 src/content/browser/components/customizableUI/IconButton.svelte create mode 100644 src/content/browser/components/customizableUI/OmniboxContainer.svelte create mode 100644 src/content/browser/components/customizableUI/Spacer.svelte create mode 100644 src/content/browser/components/customizableUI/Tabs.svelte create mode 100644 src/content/browser/components/customizableUI/UIItemBase.svelte create mode 100644 src/content/browser/components/customizableUI/index.ts rename src/content/browser/components/{contextMenus => menus}/BrowserContextMenu.svelte (100%) rename src/content/browser/components/{toolbar => menus/HamburgerMenu}/HamburgerMenu.svelte (73%) rename src/content/browser/components/{toolbar => menus/HamburgerMenu}/HamburgerMenuItem.svelte (100%) create mode 100644 src/content/browser/components/menus/index.ts rename src/content/browser/components/{toolbar => }/omnibox/Bookmarks.svelte (91%) rename src/content/browser/components/{toolbar => }/omnibox/Omnibox.svelte (97%) delete mode 100644 src/content/browser/components/toolbar/Toolbar.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Component.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/Block.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/Browser.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/IconButton.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/Omnibox.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/Spacer.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/Tabs.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/TempDropTarget.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/Components/index.ts create mode 100644 src/content/settings/components/pref/CustomizableUI/Configure.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/CustomizableUIPref.svelte create mode 100644 src/content/settings/components/pref/CustomizableUI/index.ts rename src/content/{browser/components/toolbar => shared/components}/ToolbarButton.svelte (100%) create mode 100644 src/content/shared/customizableUI/helpers.ts create mode 100644 src/content/shared/customizableUI/index.ts create mode 100644 src/content/shared/customizableUI/items.ts create mode 100644 src/content/shared/customizableUI/style.ts create mode 100644 src/content/shared/customizableUI/types.ts rename src/content/{browser/lib => shared}/xul/observable.ts (100%) diff --git a/.config/webpack.config.cjs b/.config/webpack.config.cjs index fed87e2..8b15211 100644 --- a/.config/webpack.config.cjs +++ b/.config/webpack.config.cjs @@ -64,6 +64,7 @@ const sharedSettings = (contentFiles, dev) => { extensions: ['.ts', '.mjs', '.js', '.svelte'], alias: { '@shared': resolve('src/content/shared'), + '@browser': resolve('src/content/browser'), }, }, diff --git a/package.json b/package.json index aa959f2..9aad0f2 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@catppuccin/palette": "^0.2.0", "fnts": "^2.0.1", "mitt": "^3.0.1", + "nanoid": "^5.0.3", "remixicon": "^3.5.0", "snarkdown": "^2.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8e10a3..6cffd7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,6 +19,9 @@ dependencies: mitt: specifier: ^3.0.1 version: 3.0.1 + nanoid: + specifier: ^5.0.3 + version: 5.0.3 remixicon: specifier: ^3.5.0 version: 3.5.0 @@ -2833,6 +2836,12 @@ packages: hasBin: true dev: true + /nanoid@5.0.3: + resolution: {integrity: sha512-I7X2b22cxA4LIHXPSqbBCEQSL+1wv8TuoefejsX4HFWyC6jc5JG7CEaxOltiKjc1M+YCS2YkrZZcj4+dytw9GA==} + engines: {node: ^18 || >=20} + hasBin: true + dev: false + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true diff --git a/src/content/browser/Browser.svelte b/src/content/browser/Browser.svelte index f882046..55bd3bf 100644 --- a/src/content/browser/Browser.svelte +++ b/src/content/browser/Browser.svelte @@ -3,81 +3,29 @@ - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -
+ Warning: Editing this layout will likely unload all of your tabs! + Proceed with caution +
+ +