Skip to content

Commit

Permalink
💄 Add group and separator components
Browse files Browse the repository at this point in the history
  • Loading branch information
kierandrewett committed Jan 13, 2024
1 parent 67c5f27 commit 16d309d
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/content/browser-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ let noCallbackElements = [

"chrome://dot/content/widgets/browser-customizable-area-overflow-menu.js",

"chrome://dot/content/widgets/browser-group.js",
"chrome://dot/content/widgets/browser-separator.js",

"chrome://dot/content/widgets/browser-button.js",
"chrome://dot/content/widgets/browser-command-button.js",
"chrome://dot/content/widgets/browser-command-mixin.js",
"chrome://dot/content/widgets/browser-toolbar-button.js",
"chrome://dot/content/widgets/browser-tab-button.js",
"chrome://dot/content/widgets/browser-urlbar-button.js",
Expand Down
18 changes: 18 additions & 0 deletions components/widgets/content/browser-group.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* 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-group {
display: flex;
gap: inherit;
}

browser-group[orientation=vertical],
:host([orientation=vertical]) browser-group:not([orientation]) {
flex-direction: column;
}

browser-group[orientation=horizontal],
:host([orientation=horizontal]) browser-group:not([orientation]) {
flex-direction: row;
}
17 changes: 17 additions & 0 deletions components/widgets/content/browser-group.js
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/. */

class BrowserGroup extends BrowserContextualMixin(MozHTMLElement) {
/**
* The allowed customizable attributes for the group
*/
static get customizableAttributes() {
return {
orientation: "orientation",
mode: "mode"
};
}
}

customElements.define("browser-group", BrowserGroup);
28 changes: 28 additions & 0 deletions components/widgets/content/browser-separator.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* 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-separator {
display: flex;
background-color: var(--chrome-content-separator-color, color-mix(in srgb, currentColor 5%, transparent 100%));

--size: 100%;
}

:host([orientation=vertical]) browser-separator,
browser-separator[orientation=vertical] {
width: var(--size);
height: 1px;
}

:host([orientation=horizontal]) browser-separator,
browser-separator[orientation=horizontal] {
width: 1px;
height: var(--size);
}

:host(.browser-panel-container) browser-separator {
--size: calc(100% - 4px * 2);
margin: 0 4px;
background: linear-gradient(to top, var(--arrowpanel-border-color), var(--arrowpanel-border-color)), color-mix(in srgb, currentColor 15%, transparent 100%);
}
16 changes: 16 additions & 0 deletions components/widgets/content/browser-separator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* 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/. */

class BrowserSeparator extends BrowserContextualMixin(MozHTMLElement) {
/**
* The allowed customizable attributes for the group
*/
static get customizableAttributes() {
return {
orientation: "orientation"
};
}
}

customElements.define("browser-separator", BrowserSeparator);
6 changes: 6 additions & 0 deletions components/widgets/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ dot.jar:

content/widgets/browser-debug-hologram.js (content/browser-debug-hologram.js)
content/widgets/browser-debug-hologram.css (content/browser-debug-hologram.css)

content/widgets/browser-group.js (content/browser-group.js)
content/widgets/browser-group.css (content/browser-group.css)

content/widgets/browser-separator.js (content/browser-separator.js)
content/widgets/browser-separator.css (content/browser-separator.css)
2 changes: 2 additions & 0 deletions themes/shared/browser-shared.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
@import url("chrome://dot/content/widgets/browser-identity-panel.css");
@import url("chrome://dot/content/widgets/browser-context-menu.css");
@import url("chrome://dot/content/widgets/browser-debug-hologram.css");
@import url("chrome://dot/content/widgets/browser-group.css");
@import url("chrome://dot/content/widgets/browser-separator.css");

/* XUL */
@import url("chrome://dot/skin/input.css");
Expand Down

0 comments on commit 16d309d

Please sign in to comment.