feat: Final touches for release, b=(no-bug), c=common, compact-mode

This commit is contained in:
mr. m
2025-05-07 14:29:04 +02:00
parent 019779e425
commit 7ca3396c8b
6 changed files with 67 additions and 24 deletions

2
l10n

Submodule l10n updated: 70534bcec7...102a19cdee

View File

@@ -28,7 +28,11 @@ pref('zen.injections.match-urls', 'http://localhost/*', locked);
#endif
pref('zen.rice.share.notice.accepted', false);
#ifdef XP_MACOSX
pref('zen.theme.border-radius', 10); // In pixels
#else
pref('zen.theme.border-radius', 8); // In pixels
#endif
pref('zen.theme.color-prefs.use-workspace-colors', true);

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
index 5633e5032f5d50c70512187d27e045b579978927..724fe7ec3bb6058c006f25b1d9ee0ce10f7b2e36 100644
index 5633e5032f5d50c70512187d27e045b579978927..6b9e56cb62a4812925ff812763ea9b0e6a478202 100644
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -2081,7 +2081,6 @@ var SessionStoreInternal = {
@@ -41,6 +41,15 @@ index 5633e5032f5d50c70512187d27e045b579978927..724fe7ec3bb6058c006f25b1d9ee0ce1
if (inBackground === false) {
aWindow.gBrowser.selectedTab = newTab;
@@ -5225,7 +5225,7 @@ var SessionStoreInternal = {
}
let workspaceID = aWindow.getWorkspaceID();
- if (workspaceID) {
+ if (workspaceID && !(this.isLastRestorableWindow() && AppConstants.platform == "macosx")) {
winData.workspaceID = workspaceID;
}
},
@@ -5416,14 +5416,15 @@ var SessionStoreInternal = {
}

View File

@@ -382,6 +382,12 @@ var gZenUIManager = {
// Section: Notification messages
_createToastElement(messageId, options) {
// Check if this message ID already exists
for (const child of this._toastContainer.children) {
if (child._messageId === messageId) {
return [child, true];
}
}
const element = document.createXULElement('vbox');
const label = document.createXULElement('label');
document.l10n.setAttributes(label, messageId, options);
@@ -393,23 +399,34 @@ var gZenUIManager = {
element.appendChild(description);
}
element.classList.add('zen-toast');
return element;
element._messageId = messageId;
return [element, false];
},
async showToast(messageId, options = {}) {
const toast = this._createToastElement(messageId, options);
const [toast, reused] = this._createToastElement(messageId, options);
this._toastContainer.removeAttribute('hidden');
this._toastContainer.appendChild(toast);
await this.motion.animate(toast, { opacity: [0, 1], scale: [0.8, 1] }, { type: 'spring', bounce: 0.5, duration: 0.7 });
await new Promise((resolve) => setTimeout(resolve, 3000));
await this.motion.animate(toast, { opacity: [1, 0], scale: [1, 0.9] }, { duration: 0.2, bounce: 0 });
const toastHeight = toast.getBoundingClientRect().height;
// 5 for the separation between toasts
await this.motion.animate(toast, { marginBottom: [0, `-${toastHeight + 5}px`] }, { duration: 0.2 });
toast.remove();
if (!this._toastContainer.hasChildNodes()) {
this._toastContainer.setAttribute('hidden', 'true');
if (reused) {
await this.motion.animate(toast, { scale: 0.2 }, { duration: 0.1, bounce: 0 });
toast._useCount++;
} else {
toast._useCount = 1;
}
if (!toast.style.hasOwnProperty('transform')) {
toast.style.transform = 'scale(0)';
}
await this.motion.animate(toast, { scale: 1 }, { type: 'spring', bounce: 0.2, duration: 0.5 });
await new Promise((resolve) => setTimeout(resolve, 3000));
if (toast._useCount <= 1) {
await this.motion.animate(toast, { opacity: [1, 0], scale: [1, 0.5] }, { duration: 0.2, bounce: 0 });
toast.remove();
if (!this._toastContainer.hasChildNodes()) {
this._toastContainer.setAttribute('hidden', 'true');
}
return;
}
toast._useCount--;
},
get panelUIPosition() {

View File

@@ -338,7 +338,6 @@ menuitem {
position: fixed;
top: calc(var(--zen-element-separation) * 2);
z-index: 1000;
gap: 1rem;
display: flex;
align-items: end;
@@ -351,7 +350,7 @@ menuitem {
}
& .zen-toast {
padding: 0.5rem 0.6rem;
padding: 10px;
border-radius: 12px;
background: linear-gradient(
170deg,
@@ -362,14 +361,16 @@ menuitem {
box-shadow: 0 0 14px 3px rgba(0, 0, 0, 0.05);
border: 1px solid rgba(0, 0, 0, 0.1);
display: flex;
font-weight: 500;
gap: 5px;
font-weight: 600;
flex-direction: column;
gap: 2px;
width: fit-content;
width: max-content;
font-size: medium;
position: absolute;
transform-origin: top center;
& .description {
opacity: 0.6;
font-size: small;
}
}
}

View File

@@ -48,6 +48,7 @@ var gZenCompactModeManager = {
// Clear hover states when window state changes (minimize, maximize, etc.)
window.addEventListener('sizemodechange', () => this._clearAllHoverStates());
window.addEventListener('TabOpen', this._onTabOpen.bind(this));
if (AppConstants.platform == 'macosx') {
window.addEventListener('mouseover', (event) => {
@@ -194,11 +195,7 @@ var gZenCompactModeManager = {
const isCompactMode = this.preference;
const canHideSidebar =
Services.prefs.getBoolPref('zen.view.compact.hide-tabbar') || gZenVerticalTabsManager._hasSetSingleToolbar;
let canAnimate =
lazyCompactMode.COMPACT_MODE_CAN_ANIMATE_SIDEBAR &&
!this.sidebar.hasAttribute('zen-user-show') &&
!this.sidebar.hasAttribute('zen-has-empty-tab') &&
!this.sidebar.hasAttribute('zen-has-hover');
let canAnimate = lazyCompactMode.COMPACT_MODE_CAN_ANIMATE_SIDEBAR && !this.isSidebarPotentiallyOpen();
if (typeof this._wasInCompactMode !== 'undefined') {
canAnimate = false;
delete this._wasInCompactMode;
@@ -552,6 +549,21 @@ var gZenCompactModeManager = {
}
}
},
isSidebarPotentiallyOpen() {
return (
this.sidebar.hasAttribute('zen-user-show') ||
this.sidebar.hasAttribute('zen-has-hover') ||
this.sidebar.hasAttribute('zen-has-empty-tab')
);
},
_onTabOpen(event) {
const tab = event.target;
if (!tab.selected && this.preference && !this.isSidebarPotentiallyOpen()) {
gZenUIManager.showToast('zen-background-tab-opened');
}
},
};
document.addEventListener(