-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,461 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
} | ||
.browser-container[hidden] { | ||
|
25 changes: 25 additions & 0 deletions
25
src/content/browser/components/customizableUI/Block.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
BlockComponent, | ||
Component, | ||
ComponentId, | ||
} from '@shared/customizableUI' | ||
import type { Tab } from '../tabs/tab' | ||
import UiItemBase from './UIItemBase.svelte' | ||
import CustomizableUi from './CustomizableUI.svelte' | ||
export let component: ComponentId & BlockComponent | ||
export let root: Component | ||
export let tab: Tab | ||
</script> | ||
|
||
<UiItemBase {component} {root}> | ||
{#each component.content as child} | ||
<CustomizableUi component={child} {tab} {root} /> | ||
{/each} | ||
</UiItemBase> |
29 changes: 29 additions & 0 deletions
29
src/content/browser/components/customizableUI/BrowserView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
BrowserComponent, | ||
Component, | ||
ComponentId, | ||
} from '@shared/customizableUI' | ||
import UiItemBase from './UIItemBase.svelte' | ||
import { selectedTab, tabs } from '../../lib/globalApi' | ||
import Browser from '../Browser.svelte' | ||
export let component: ComponentId & BrowserComponent | ||
export let root: Component | ||
// We don't care about the order that browers are rendered in the dom, but we | ||
// want to allow tab reordering. This should stop unnessisary updates | ||
$: sortedBrowers = [...$tabs].sort( | ||
(tabA, tabB) => tabA.getId() - tabB.getId(), | ||
) | ||
</script> | ||
|
||
<UiItemBase {component} {root}> | ||
{#each sortedBrowers as tab (tab.getId())} | ||
<Browser {tab} selectedTab={$selectedTab} /> | ||
{/each} | ||
</UiItemBase> |
37 changes: 37 additions & 0 deletions
37
src/content/browser/components/customizableUI/CustomizableUI.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
Component, | ||
ComponentId, | ||
ExportComponent, | ||
} from '@shared/customizableUI' | ||
import type { Tab } from '../tabs/tab' | ||
import Block from './Block.svelte' | ||
import IconButton from './IconButton.svelte' | ||
import Spacer from './Spacer.svelte' | ||
import BrowserView from './BrowserView.svelte' | ||
import OmniboxContainer from './OmniboxContainer.svelte' | ||
import Tabs from './Tabs.svelte' | ||
export let component: ComponentId & ExportComponent | ||
export let root: Component | ||
export let tab: Tab | ||
</script> | ||
|
||
{#if component.type === 'block'} | ||
<Block {component} {root} {tab} /> | ||
{:else if component.type === 'icon'} | ||
<IconButton {component} {root} {tab} /> | ||
{:else if component.type === 'spacer'} | ||
<Spacer {component} {root} /> | ||
{:else if component.type === 'browser'} | ||
<BrowserView {component} {root} /> | ||
{:else if component.type === 'omnibox'} | ||
<OmniboxContainer {component} {root} {tab} /> | ||
{:else if component.type === 'tabs'} | ||
<Tabs {component} {root} /> | ||
{/if} |
32 changes: 32 additions & 0 deletions
32
src/content/browser/components/customizableUI/IconButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
ComponentId, | ||
IconComponent, | ||
Component, | ||
} from '@shared/customizableUI' | ||
import type { Tab } from '../tabs/tab' | ||
import { ToolbarButton } from '@shared/components' | ||
import UIItemBase from './UIItemBase.svelte' | ||
export let component: ComponentId & IconComponent | ||
export let root: Component | ||
export let tab: Tab | ||
let button: HTMLButtonElement | undefined | ||
$: enabled = component.enabled(tab) | ||
</script> | ||
|
||
<UIItemBase {component} {root}> | ||
<ToolbarButton | ||
bind:button | ||
disabled={!$enabled} | ||
on:click={() => component.action(tab, button)} | ||
> | ||
<i class={`ri-${component.icon}`} /> | ||
</ToolbarButton> | ||
</UIItemBase> |
24 changes: 24 additions & 0 deletions
24
src/content/browser/components/customizableUI/OmniboxContainer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
Component, | ||
ComponentId, | ||
OmniboxComponent, | ||
} from '@shared/customizableUI' | ||
import type { Tab } from '../tabs/tab' | ||
import UiItemBase from './UIItemBase.svelte' | ||
import Omnibox from '../omnibox/Omnibox.svelte' | ||
export let component: ComponentId & OmniboxComponent | ||
export let root: Component | ||
export let tab: Tab | ||
</script> | ||
|
||
<UiItemBase {component} {root}> | ||
<Omnibox {tab} /> | ||
</UiItemBase> |
17 changes: 17 additions & 0 deletions
17
src/content/browser/components/customizableUI/Spacer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
Component, | ||
ComponentId, | ||
SpacerComponent, | ||
} from '@shared/customizableUI' | ||
import UiItemBase from './UIItemBase.svelte' | ||
export let component: ComponentId & SpacerComponent | ||
export let root: Component | ||
</script> | ||
|
||
<UiItemBase {component} {root} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import type { | ||
Component, | ||
ComponentId, | ||
TabsComponent, | ||
} from '@shared/customizableUI' | ||
import { tabs, selectedTab } from '@browser/lib/globalApi' | ||
import Tab from '@browser/components/tabs/Tab.svelte' | ||
import UiItemBase from './UIItemBase.svelte' | ||
export let component: ComponentId & TabsComponent | ||
export let root: Component | ||
</script> | ||
|
||
<UiItemBase {component} {root} class="tabs" on:drop={(e) => e.preventDefault()}> | ||
{#each $tabs as tab} | ||
<Tab {tab} bind:selectedTab={$selectedTab} /> | ||
{/each} | ||
</UiItemBase> | ||
|
||
<style> | ||
:global(.component.tabs) { | ||
display: flex; | ||
gap: 0.25; | ||
overflow: scroll; | ||
} | ||
</style> |
34 changes: 34 additions & 0 deletions
34
src/content/browser/components/customizableUI/UIItemBase.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<script lang="ts"> | ||
import { | ||
getParentOrientation, | ||
type Component, | ||
getComponentStyle, | ||
} from '@shared/customizableUI' | ||
let clazz = '' | ||
export { clazz as class } | ||
export let component: Component | ||
export let root: Component | ||
$: parentOrientation = getParentOrientation(root, component) | ||
$: style = getComponentStyle(component, parentOrientation, false) | ||
</script> | ||
|
||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<div class={`component ${clazz}`} {style} on:drop> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.component { | ||
border-style: solid; | ||
border-width: 1px; | ||
border-color: transparent; | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.