diff --git a/src/browser/app/profile/zen-browser.js b/src/browser/app/profile/zen-browser.js index 3f0405a4b..5cc645ef4 100644 --- a/src/browser/app/profile/zen-browser.js +++ b/src/browser/app/profile/zen-browser.js @@ -92,7 +92,8 @@ pref("alerts.showFavicons", true); // CUSTOM ZEN PREFS -// TODO: pref('zen.verticalTabs.enabled', false); +pref('zen.welcomeScreen.enabled', true); +pref('zen.welcomeScreen.seen', false); // From: https://github.com/yokoffing/Betterfox diff --git a/src/browser/base/content/browser-css.patch b/src/browser/base/content/browser-css.patch index 5988991e8..52e3dbc89 100644 --- a/src/browser/base/content/browser-css.patch +++ b/src/browser/base/content/browser-css.patch @@ -1,5 +1,5 @@ diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css -index 8a2a20280954eb9db144a723f477e7afc603fda3..bbcc1eaa85b8dc608a8d85c3709bcc7c5fc441e2 100644 +index 8a2a20280954eb9db144a723f477e7afc603fda3..35a3b6e9d8b7bab6bf6e6e3f6000b5c007163aa5 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -2,6 +2,8 @@ @@ -28,7 +28,7 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..bbcc1eaa85b8dc608a8d85c3709bcc7c list-style-image: var(--webextension-menuitem-image, inherit); -moz-context-properties: fill; fill: currentColor; -@@ -1526,3 +1528,19 @@ toolbar[keyNav=true]:not([collapsed=true], [customizing=true]) toolbartabstop { +@@ -1526,3 +1528,42 @@ toolbar[keyNav=true]:not([collapsed=true], [customizing=true]) toolbartabstop { /** * End Dialogs */ @@ -44,7 +44,30 @@ index 8a2a20280954eb9db144a723f477e7afc603fda3..bbcc1eaa85b8dc608a8d85c3709bcc7c + +.dialogBox:not(.spotlightBox) { + border: 1px solid var(--zen-dialog-border-color); -+ border-radius: 5px; ++} + ++#window-modal-dialog:not([zen-dialog-welcome-element="true"]) .dialogBox:not(.spotlightBox) { + transform: translateY(-9px); +} ++ ++#window-modal-dialog[zen-dialog-welcome-element="true"] .dialogBox:not(.spotlightBox) { ++ margin: 0 !important; ++} ++ ++#window-modal-dialog[zen-dialog-welcome-element="true"], ++#window-modal-dialog[zen-dialog-welcome-element="true"] .dialogOverlay, ++#window-modal-dialog[zen-dialog-welcome-element="true"] .dialogFrame, ++#window-modal-dialog[zen-dialog-welcome-element="true"] .dialogBox { ++ width: 100% !important; ++ height: 100% !important; ++ max-height: none !important; ++ max-width: none !important; ++} ++ ++#window-modal-dialog[zen-dialog-welcome-element="true"] { ++ --zen-welcome-dialog-space: 8px; ++ margin: 0 auto !important; ++ max-width: calc(100% - calc(var(--zen-welcome-dialog-space) * 2)) !important; ++ max-height: calc(100% - calc(var(--zen-welcome-dialog-space) * 2)) !important; ++ margin-top: var(--zen-welcome-dialog-space) !important; ++} diff --git a/src/browser/base/content/browser-js.patch b/src/browser/base/content/browser-js.patch index ec3e0dcf9..0715f4222 100644 --- a/src/browser/base/content/browser-js.patch +++ b/src/browser/base/content/browser-js.patch @@ -1,11 +1,13 @@ diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js -index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..040c455e3e06305b03f835d47fc7fb22f9448402 100644 +index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..01ebb483e6d9632588578b8b05195250ca26968a 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js -@@ -13,6 +13,13 @@ ChromeUtils.importESModule("resource://gre/modules/NotificationDB.sys.mjs"); +@@ -13,6 +13,15 @@ ChromeUtils.importESModule("resource://gre/modules/NotificationDB.sys.mjs"); // lazy module getters ++const ZEN_WELCOME_PATH = "zen-welcome"; ++const ZEN_WELCOME_ELEMENT_ATTR = "zen-dialog-welcome-element"; +XPCOMUtils.defineLazyServiceGetter( + this, + "ProfileService", @@ -16,7 +18,7 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..040c455e3e06305b03f835d47fc7fb22 ChromeUtils.defineESModuleGetters(this, { AMTelemetry: "resource://gre/modules/AddonManager.sys.mjs", AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs", -@@ -1735,6 +1742,11 @@ var gBrowserInit = { +@@ -1735,6 +1744,11 @@ var gBrowserInit = { } // Misc. inits. @@ -28,7 +30,7 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..040c455e3e06305b03f835d47fc7fb22 gUIDensity.init(); TabletModeUpdater.init(); CombinedStopReload.ensureInitialized(); -@@ -6660,7 +6672,7 @@ function setToolbarVisibility( +@@ -6660,7 +6674,7 @@ function setToolbarVisibility( ); } @@ -37,7 +39,21 @@ index 4f145c494973374e87f3a3ed5eb6b33a43c518c8..040c455e3e06305b03f835d47fc7fb22 switch (isVisible) { case true: case "always": -@@ -10157,3 +10169,15 @@ var FirefoxViewHandler = { +@@ -9780,6 +9794,13 @@ var gDialogBox = { + parentElement.style.removeProperty("width"); + parentElement.style.removeProperty("height"); + document.documentElement.setAttribute("window-modal-open", true); ++ ++ if (uri.includes(ZEN_WELCOME_PATH)) { ++ parentElement.setAttribute(ZEN_WELCOME_ELEMENT_ATTR, true); ++ } else if (parentElement.hasAttribute(ZEN_WELCOME_ELEMENT_ATTR)) { ++ parentElement.removeAttribute(ZEN_WELCOME_ELEMENT_ATTR); ++ } ++ + // Call this first so the contents show up and get layout, which is + // required for SubDialog to work. + parentElement.showModal(); +@@ -10157,3 +10178,15 @@ var FirefoxViewHandler = { this.button?.toggleAttribute("attention", shouldShow); }, }; diff --git a/src/browser/base/content/zen-browser-places.js b/src/browser/base/content/zen-browser-places.js index ed68fa8d1..c960c303a 100644 --- a/src/browser/base/content/zen-browser-places.js +++ b/src/browser/base/content/zen-browser-places.js @@ -60,7 +60,7 @@ var ZenProfileDialogUI = { createProfileWizard() { // This should be rewritten in HTML eventually. - window.browsingContext.topChromeWindow.openDialog( + window.browsingContext.topChromeWindow.gDialogBox.open( "chrome://mozapps/content/profile/createProfileWizard.xhtml", "", "centerscreen,chrome,modal,titlebar", diff --git a/src/browser/components/BrowserGlue-sys-mjs.patch b/src/browser/components/BrowserGlue-sys-mjs.patch new file mode 100644 index 000000000..d6efea46a --- /dev/null +++ b/src/browser/components/BrowserGlue-sys-mjs.patch @@ -0,0 +1,29 @@ +diff --git a/browser/components/BrowserGlue.sys.mjs b/browser/components/BrowserGlue.sys.mjs +index 4ad6c5212b22e7dc0ee9495214b6531676490e95..d90dcfed5da60e19eb1fa7fb88cfb07f9cce5663 100644 +--- a/browser/components/BrowserGlue.sys.mjs ++++ b/browser/components/BrowserGlue.sys.mjs +@@ -4475,6 +4475,7 @@ BrowserGlue.prototype = { + }, + + async _maybeShowDefaultBrowserPrompt() { ++ this._ZenMaybeShowWelcomeScreen(); + // Highest priority is about:welcome window modal experiment + // Second highest priority is the upgrade dialog, which can include a "primary + // browser" request and is limited in various ways, e.g., major upgrades. +@@ -4933,6 +4934,16 @@ BrowserGlue.prototype = { + "nsIObserver", + "nsISupportsWeakReference", + ]), ++ ++ _ZenMaybeShowWelcomeScreen() { ++ const welcomeEnabled = Services.prefs.getBoolPref("zen.welcomeScreen.enabled", true) ++ const welcomeSeen = Services.prefs.getBoolPref("zen.welcomeScreen.seen", false) ++ if (welcomeEnabled && !welcomeSeen) { ++ lazy.BrowserWindowTracker.getTopWindow().gDialogBox.open( ++ "chrome://browser/content/zen-welcome/welcome.html" ++ ); ++ } ++ }, + }; + + var ContentBlockingCategoriesPrefs = { diff --git a/src/browser/components/moz-build.patch b/src/browser/components/moz-build.patch new file mode 100644 index 000000000..e1b7473b3 --- /dev/null +++ b/src/browser/components/moz-build.patch @@ -0,0 +1,14 @@ +diff --git a/browser/components/moz.build b/browser/components/moz.build +index 6fd86955650e4589677007eb8aeee39c1839fedd..600ff91802e7357be3c55dac626ce2ca79544cd2 100644 +--- a/browser/components/moz.build ++++ b/browser/components/moz.build +@@ -69,6 +69,9 @@ DIRS += [ + "urlbar", + ] + ++# Zen Components: ++DIRS += ["zen-welcome"] ++ + DIRS += ["build"] + + diff --git a/src/browser/components/zen-welcome/IMPORTANT.md b/src/browser/components/zen-welcome/IMPORTANT.md new file mode 100644 index 000000000..3457f2941 --- /dev/null +++ b/src/browser/components/zen-welcome/IMPORTANT.md @@ -0,0 +1,8 @@ + +# Important notes! + +Inside browser.js, we hardcoded-ly detect the path name for `zen-welcome` so we can add special attributes to the welcom page. If this path name changes, the welcome page will not work properly. + +Make sure to update the path name in browser.js if you change the path name of `zen-welcome`. + +The constant that contains this path name is `ZEN_WELCOME_PATH`. diff --git a/src/browser/components/zen-welcome/jar.mn b/src/browser/components/zen-welcome/jar.mn new file mode 100644 index 000000000..dc29b34df --- /dev/null +++ b/src/browser/components/zen-welcome/jar.mn @@ -0,0 +1,13 @@ +# 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/. + +browser.jar: +% content browser %content/browser/ contentaccessible=yes + content/browser/zen-welcome/welcome.html (welcome.html) + content/browser/zen-welcome/welcome.css (welcome.css) + content/browser/zen-welcome/welcome.js (welcome.js) + content/browser/zen-welcome/migrate.light.svg (migrate.light.svg) + content/browser/zen-welcome/migrate.dark.svg (migrate.dark.svg) + content/browser/zen-welcome/sidebar.vis.svg (sidebar.vis.svg) + content/browser/zen-welcome/vertical.vis.svg (vertical.vis.svg) diff --git a/src/browser/components/zen-welcome/migrate.dark.svg b/src/browser/components/zen-welcome/migrate.dark.svg new file mode 100644 index 000000000..1401b989d --- /dev/null +++ b/src/browser/components/zen-welcome/migrate.dark.svg @@ -0,0 +1,11 @@ + + diff --git a/src/browser/components/zen-welcome/migrate.light.svg b/src/browser/components/zen-welcome/migrate.light.svg new file mode 100644 index 000000000..d1c1b867e --- /dev/null +++ b/src/browser/components/zen-welcome/migrate.light.svg @@ -0,0 +1,11 @@ + + diff --git a/src/browser/components/zen-welcome/moz.build b/src/browser/components/zen-welcome/moz.build new file mode 100644 index 000000000..4f61c47b9 --- /dev/null +++ b/src/browser/components/zen-welcome/moz.build @@ -0,0 +1,4 @@ +# 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/. +JAR_MANIFESTS += ["jar.mn"] diff --git a/src/browser/components/zen-welcome/sidebar.vis.svg b/src/browser/components/zen-welcome/sidebar.vis.svg new file mode 100644 index 000000000..37eb9dc2c --- /dev/null +++ b/src/browser/components/zen-welcome/sidebar.vis.svg @@ -0,0 +1,61 @@ + + diff --git a/src/browser/components/zen-welcome/vertical.vis.svg b/src/browser/components/zen-welcome/vertical.vis.svg new file mode 100644 index 000000000..323d3347a --- /dev/null +++ b/src/browser/components/zen-welcome/vertical.vis.svg @@ -0,0 +1,42 @@ + + diff --git a/src/browser/components/zen-welcome/welcome.css b/src/browser/components/zen-welcome/welcome.css new file mode 100644 index 000000000..dd1ddec99 --- /dev/null +++ b/src/browser/components/zen-welcome/welcome.css @@ -0,0 +1,173 @@ +/* +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/. +*/ + +html { + width: 100%; + height: 100%; +} + +body { + display: flex; + position: relative; + flex-flow: row nowrap; + width: 100%; + height: 100%; + overflow: hidden; + background: var(--zen-characteristic-gradient); + transition: .1s; +} + +body.normal-background { + background: var(--zen-main-browser-background) !important; +} + +.page { + display: none; + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + align-content: center; + width: 100%; + + margin: 32px; +} + +#enableFeatures .card { + width: auto; +} + +.card h3 { + margin: auto; + text-align: center; +} + +.cardGroup { + display: flex; + flex-wrap: wrap; + align-items: stretch; + gap: 8px; + margin-bottom: 8px; + justify-content: center; +} + +.cardGroup .card { + width: 140px; + display: flex; + flex-direction: column; + align-items: center; + align-content: space-between; + border: 2px solid var(--arrowpanel-border-color) !important; + transition: all .1s ease-in-out !important; + margin: 0 10px; + border-radius: 7px; + outline: none !important; + cursor: auto; + user-select: none; +} + +.cardGroup .card.selected { + border: 2px solid var(--in-content-primary-button-background-hover) !important; + transform: scale(1.1); +} + +h1 { + font-size: 32px; + font-weight: 700; + margin: 16px 0 5px 0; +} + +p { + font-size: 16px; + opacity: 0.8; + margin: 0; + margin-bottom: 30px; +} + +button { + transform: scale(1.3); +} + +.icon { + -moz-context-properties: fill; + fill: currentColor; + display: inline-block; + height: 82px; + width: 82px; +} + +.asset { + width: 500px; + padding-bottom: 32px; +} + +@media (prefers-color-scheme: light) { + .dark-only { + display: none; + } +} + +@media (prefers-color-scheme: dark) { + .light-only { + display: none; + } +} + +input[type='checkbox'] { + display: inline-block; + vertical-align: middle; +} + +#importNext { + margin-left: 30px; + color: var(--in-content-primary-button-background); +} + +#themeNext, +#searchNext, +#thanksNext { + margin-top: 20px; +} + +#search h1, +#theme h1 { + margin-bottom: 30px; +} + +.page[hidden="true"] { + display: none; +} + +.page:not([hidden="true"]) { + display: flex; +} + +.page:not([hidden="true"]) > * { + opacity: 0; + animation: fadeInRight 0.3s ease-in-out forwards; +} + +@keyframes fadeInRight { + from { + opacity: 0; + transform: translate3d(40px, 0, 0); + filter: blur(15px); + } + + to { + opacity: 1; + filter: blur(0); + transform: translate3d(0, 0, 0); + } +} + +/* There should be no more than 5 elements in a page */ +.page:not([hidden="true"]) > *:nth-child(2) { animation-delay: 0.1s; } +.page:not([hidden="true"]) > *:nth-child(3) { animation-delay: 0.2s; } +.page:not([hidden="true"]) > *:nth-child(4) { animation-delay: 0.3s; } +.page:not([hidden="true"]) > *:nth-child(5) { animation-delay: 0.4s; } + diff --git a/src/browser/components/zen-welcome/welcome.html b/src/browser/components/zen-welcome/welcome.html new file mode 100644 index 000000000..ebce03786 --- /dev/null +++ b/src/browser/components/zen-welcome/welcome.html @@ -0,0 +1,109 @@ + + + + +
+ + + + + + + + + + + + +