diff --git a/src/browser/base/content/ZenViewSplitter.mjs b/src/browser/base/content/ZenViewSplitter.mjs new file mode 100644 index 000000000..27a1925f5 --- /dev/null +++ b/src/browser/base/content/ZenViewSplitter.mjs @@ -0,0 +1,75 @@ + +var gZenViewSplitter = { + /** + * [ + * [ + * tab1, + * tab2, + * tab3, + * ] + * ] + */ + _data: [], + + init() { + return; // TODO: Fix this please + window.addEventListener("TabClose", this); + window.addEventListener("TabChange", this); + }, + + handleEvent(event) { + switch (event.type) { + case "TabClose": + this.onTabClose(event); + break; + case "TabChange": + this.onTabChange(event); + break; + } + }, + + onTabClose(event) { + const tab = event.target; + let index = -2; + while (index !== -1) { + index = this._data.findIndex((group) => group.includes(tabId)); + if (index !== -1) { + this._data[index].splice(this._data[index].indexOf(tabId), 1); + if (this._data[index].length < 2) { + this._data.splice(index, 1); + } + } + } + this._showSplitView(tab); + }, + + onTabChange(event) { + const tab = event.target; + this._showSplitView(tab); + }, + + splitTabs(tabs) { + if (tabs.length < 2) { + return; + } + this._data.push(tabs); + this._showSplitView(tabs[0]); + }, + + _showSplitView(tab) { + const splitData = this._data.find((group) => group.includes(tab)); + console.log(splitData) + if (!splitData) { + return; + } + for (const tab of splitData) { + tab._zenSplitted = true; + let container = tab.linkedBrowser.closest(".browserSidebarContainer"); + console.assert(container, "No container found for tab"); + container.classList.add("deck-selected"); + container.setAttribute("zen-split", "true"); + } + }, +}; + +gZenViewSplitter.init(); diff --git a/src/browser/base/content/zen-scripts.inc.xhtml b/src/browser/base/content/zen-scripts.inc.xhtml index 295e97aa3..ddebe12e5 100644 --- a/src/browser/base/content/zen-scripts.inc.xhtml +++ b/src/browser/base/content/zen-scripts.inc.xhtml @@ -1,5 +1,6 @@ \ No newline at end of file diff --git a/src/browser/base/content/zen-scripts.jar.inc.mn b/src/browser/base/content/zen-scripts.jar.inc.mn index ebb9f3648..e9d8dfa7e 100644 --- a/src/browser/base/content/zen-scripts.jar.inc.mn +++ b/src/browser/base/content/zen-scripts.jar.inc.mn @@ -1,3 +1,5 @@ content/browser/zen-browser-places.js (content/zen-browser-places.js) content/browser/zenThemeModifier.js (content/zenThemeModifier.js) - content/browser/ZenSidebarManager.mjs (content/ZenSidebarManager.mjs) \ No newline at end of file + content/browser/ZenSidebarManager.mjs (content/ZenSidebarManager.mjs) + content/browser/ZenViewSplitter.mjs (content/ZenViewSplitter.mjs) + \ No newline at end of file diff --git a/src/browser/themes/shared/zen-browser-shared.css b/src/browser/themes/shared/zen-browser-shared.css index c2c6a51ef..50775bbc4 100644 --- a/src/browser/themes/shared/zen-browser-shared.css +++ b/src/browser/themes/shared/zen-browser-shared.css @@ -436,10 +436,15 @@ panelmultiview { background: var(--toolbar-bgcolor); } -#tabbrowser-tabbox[inlinedwithsidebar="true"] #tabbrowser-tabpanels { +#tabbrowser-tabpanels { + background: transparent !important; +} + +#tabbrowser-tabbox[inlinedwithsidebar="true"] #tabbrowser-tabpanels .browserSidebarContainer { margin: 0 10px 10px 0; border-radius: var(--zen-browser-border-radius); border: 1px solid light-dark(#ddd, #4a4a4a); + width: 100%; } #tabbrowser-tabbox[inlinedwithsidebar="true"] #tabbrowser-tabpanels .browserStack > browser { diff --git a/src/toolkit/modules/LightweightThemeConsumer-sys-mjs.patch b/src/toolkit/modules/LightweightThemeConsumer-sys-mjs.patch index dd09cf0d9..83ce14970 100644 --- a/src/toolkit/modules/LightweightThemeConsumer-sys-mjs.patch +++ b/src/toolkit/modules/LightweightThemeConsumer-sys-mjs.patch @@ -1,8 +1,17 @@ diff --git a/toolkit/modules/LightweightThemeConsumer.sys.mjs b/toolkit/modules/LightweightThemeConsumer.sys.mjs -index cf388eb3d393403c077f2a01c3e670cefad7db59..747095a95fc87837093ec7c85437f289450b4486 100644 +index 0d3993370b4ecbdfaf87cfd3145617343c29dc39..8587f7286476ca0dcce1bb02ef02ce0dae9c4df7 100644 --- a/toolkit/modules/LightweightThemeConsumer.sys.mjs +++ b/toolkit/modules/LightweightThemeConsumer.sys.mjs -@@ -315,6 +315,7 @@ LightweightThemeConsumer.prototype = { +@@ -32,7 +32,7 @@ const toolkitVariableMap = [ + lwtProperty: "accentcolor", + processColor(rgbaChannels, element) { + if (!rgbaChannels || rgbaChannels.a == 0) { +- return "white"; ++ return "var(--zen-colors-primary)"; + } + // Remove the alpha channel + const { r, g, b } = rgbaChannels; +@@ -334,6 +334,7 @@ LightweightThemeConsumer.prototype = { theme.additionalBackgrounds ); _setProperties(root, active, theme, hasTheme); @@ -10,7 +19,7 @@ index cf388eb3d393403c077f2a01c3e670cefad7db59..747095a95fc87837093ec7c85437f289 if (hasTheme) { if (updateGlobalThemeData) { -@@ -406,6 +407,14 @@ LightweightThemeConsumer.prototype = { +@@ -425,6 +426,14 @@ LightweightThemeConsumer.prototype = { this._lastExperimentData.stylesheet = stylesheet; } },