From 4e6dc7472482ba211fe1a799c5cc2b5c98c49013 Mon Sep 17 00:00:00 2001 From: trickypr <23250792+trickypr@users.noreply.github.com> Date: Mon, 25 Dec 2023 15:48:38 +1100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Use=20`xul:arrowscrollbox`?= =?UTF-8?q?=20in=20the=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/customizableUI/Tabs.svelte | 59 +++++++++++++++++-- .../browser/components/tabs/Tab.svelte | 15 ++++- .../pref/CustomizableUI/Component.svelte | 5 ++ src/content/shared/customizableUI/style.ts | 9 --- src/prefs.js | 6 +- 5 files changed, 74 insertions(+), 20 deletions(-) diff --git a/src/content/browser/components/customizableUI/Tabs.svelte b/src/content/browser/components/customizableUI/Tabs.svelte index b066bcd..e759cde 100644 --- a/src/content/browser/components/customizableUI/Tabs.svelte +++ b/src/content/browser/components/customizableUI/Tabs.svelte @@ -11,20 +11,69 @@ import Tab from '@browser/components/tabs/Tab.svelte' import UiItemBase from './UIItemBase.svelte' - import { selectedTabId, tabs } from '@browser/lib/window/tabs' + import { openTab, selectedTabId, tabs } from '@browser/lib/window/tabs' + import ToolbarButton from '@shared/components/ToolbarButton.svelte' + import { onMount } from 'svelte' export let component: ComponentId & TabsComponent export let root: Component + + let overflow = false + let arrowBox: HTMLElement + + onMount(() => { + arrowBox.addEventListener('overflow', () => (overflow = true)) + arrowBox.addEventListener('underflow', () => (overflow = false)) + }) e.preventDefault()}> - {#each $tabs as tab (tab.getId())} - - {/each} + + {#each $tabs as tab (tab.getId())} + + {/each} + + {#if !overflow} + openTab()}> + + + {/if} + + + {#if overflow} + openTab()}> + + + {/if} diff --git a/src/content/browser/components/tabs/Tab.svelte b/src/content/browser/components/tabs/Tab.svelte index 1e6b2c4..d8f7bf8 100644 --- a/src/content/browser/components/tabs/Tab.svelte +++ b/src/content/browser/components/tabs/Tab.svelte @@ -50,6 +50,9 @@ favicon {/if} {$title || $uri.asciiSpec} + + +