diff --git a/src/browser/base/content/zen-assets.jar.inc.mn b/src/browser/base/content/zen-assets.jar.inc.mn index 2a44065d4..168ae6105 100644 --- a/src/browser/base/content/zen-assets.jar.inc.mn +++ b/src/browser/base/content/zen-assets.jar.inc.mn @@ -19,3 +19,4 @@ #include ../../../zen/vendor/jar.inc.mn #include ../../../zen/fonts/jar.inc.mn #include ../../../zen/live-folders/jar.inc.mn +#include ../../../zen/library/jar.inc.mn diff --git a/src/browser/base/content/zen-commands.inc.xhtml b/src/browser/base/content/zen-commands.inc.xhtml index 670e8725d..3369574d4 100644 --- a/src/browser/base/content/zen-commands.inc.xhtml +++ b/src/browser/base/content/zen-commands.inc.xhtml @@ -65,4 +65,6 @@ + + diff --git a/src/browser/base/content/zen-sidebar-icons.inc.xhtml b/src/browser/base/content/zen-sidebar-icons.inc.xhtml index 3a5791d0b..9bd84b826 100644 --- a/src/browser/base/content/zen-sidebar-icons.inc.xhtml +++ b/src/browser/base/content/zen-sidebar-icons.inc.xhtml @@ -13,6 +13,7 @@ skipintoolbarset="true" context="toolbar-context-menu" mode="icons"> + diff --git a/src/browser/themes/shared/zen-icons/icons.css b/src/browser/themes/shared/zen-icons/icons.css index 11927b00c..951f803e7 100644 --- a/src/browser/themes/shared/zen-icons/icons.css +++ b/src/browser/themes/shared/zen-icons/icons.css @@ -289,7 +289,8 @@ display: none; } -#library-button { +#library-button, +#zen-library-button { list-style-image: url("library.svg") !important; } diff --git a/src/zen/common/sys/ZenCustomizableUI.sys.mjs b/src/zen/common/sys/ZenCustomizableUI.sys.mjs index 4adc45706..b04c0b9f0 100644 --- a/src/zen/common/sys/ZenCustomizableUI.sys.mjs +++ b/src/zen/common/sys/ZenCustomizableUI.sys.mjs @@ -8,7 +8,7 @@ export const ZenCustomizableUI = new (class { constructor() {} TYPE_TOOLBAR = "toolbar"; - defaultSidebarIcons = ["downloads-button", "zen-workspaces-button", "zen-create-new-button"]; + defaultSidebarIcons = ["zen-library-button", "zen-workspaces-button", "zen-create-new-button"]; startup(CustomizableUIInternal) { CustomizableUIInternal.registerArea( diff --git a/src/zen/common/zen-sets.js b/src/zen/common/zen-sets.js index bc87d6625..78b51f8a7 100644 --- a/src/zen/common/zen-sets.js +++ b/src/zen/common/zen-sets.js @@ -137,6 +137,14 @@ document.addEventListener( ZenLiveFoldersManager.handleEvent(event); break; } + case "cmd_zenToggleLibrary": { + const { ZenLibrary } = ChromeUtils.importESModule( + "moz-src:///zen/library/ZenLibrary.mjs", + { global: "current" } + ); + ZenLibrary.toggle(); + break; + } default: gZenGlanceManager.handleMainCommandSet(event); if (event.target.id.startsWith("cmd_zenWorkspaceSwitch")) { diff --git a/src/zen/library/ZenLibrary.mjs b/src/zen/library/ZenLibrary.mjs new file mode 100644 index 000000000..4385a22aa --- /dev/null +++ b/src/zen/library/ZenLibrary.mjs @@ -0,0 +1,86 @@ +// 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/. + +import { html } from "chrome://global/content/vendor/lit.all.mjs"; +import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; + +let gZenLibraryInstance = null; + +/** + * The ZenLibrary class is responsible for managing the UI for the library feature. + * This feature allows users to view and manage their browsing history, downloads, + * spaces, and other related data in a unified interface. + */ +export class ZenLibrary extends MozLitElement { + #initialized = false; + + static properties = { + activeTab: { type: String }, + }; + + static queries = { + content: "#zen-library-content", + tabs: { all: "#zen-library-sidebar-tabs > .library-tab" }, + }; + + constructor() { + super(); + this.activeTab = "history"; + } + + connectedCallback() { + super.connectedCallback(); + if (this.#initialized) { + return; + } + window.addEventListener("keydown", this); + this.#initialized = true; + } + + disconnectedCallback() { + super.disconnectedCallback(); + window.removeEventListener("keydown", this); + this.#initialized = false; + } + + render() { + return html` + + + + + + + + test + + `; + } + + handleEvent() { + // Handle events related to the library UI here + } + + static getInstance() { + if (!gZenLibraryInstance) { + gZenLibraryInstance = new ZenLibrary(); + gNavToolbox.before(gZenLibraryInstance); + } + return gZenLibraryInstance; + } + + static clearInstance() { + if (gZenLibraryInstance) { + gZenLibraryInstance.remove(); + gZenLibraryInstance = null; + } + } + + static toggle() { + let instance = this.getInstance(); + instance.toggleAttribute("open"); + } +} + +customElements.define("zen-library", ZenLibrary); diff --git a/src/zen/library/jar.inc.mn b/src/zen/library/jar.inc.mn new file mode 100644 index 000000000..762275b77 --- /dev/null +++ b/src/zen/library/jar.inc.mn @@ -0,0 +1,5 @@ +# 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/. + + content/browser/zen-components/zen-library.css (../../zen/library/zen-library.css) diff --git a/src/zen/library/moz.build b/src/zen/library/moz.build new file mode 100644 index 000000000..41e3e1aae --- /dev/null +++ b/src/zen/library/moz.build @@ -0,0 +1,7 @@ +# 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/. + +MOZ_SRC_FILES += [ + "ZenLibrary.mjs", +] diff --git a/src/zen/library/zen-library.css b/src/zen/library/zen-library.css new file mode 100644 index 000000000..88d24da3e --- /dev/null +++ b/src/zen/library/zen-library.css @@ -0,0 +1,8 @@ +/* + * 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/. + */ + +:host { +} diff --git a/src/zen/live-folders/ZenLiveFolder.sys.mjs b/src/zen/live-folders/ZenLiveFolder.sys.mjs index 36d17d42f..eff30563d 100644 --- a/src/zen/live-folders/ZenLiveFolder.sys.mjs +++ b/src/zen/live-folders/ZenLiveFolder.sys.mjs @@ -1,6 +1,7 @@ // 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/. + const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { NetUtil: "resource://gre/modules/NetUtil.sys.mjs", diff --git a/src/zen/moz.build b/src/zen/moz.build index 6e54f9573..f93486796 100644 --- a/src/zen/moz.build +++ b/src/zen/moz.build @@ -17,4 +17,5 @@ DIRS += [ "toolkit", "sessionstore", "share", + "library", ]