Merge branch 'master' into imporve-icons

This commit is contained in:
alstjr7375 2023-10-28 00:05:01 +09:00
commit 718a0b9b68
20 changed files with 19458 additions and 44 deletions

View file

@ -1,7 +1,10 @@
@use "true" as *;
@use "../src/utils/accent_color" as *;
@use "../src/utils/mode";
@include test-module("Accent Color Option [mix]") {
@include mode.ESR;
@include test("simple") {
@include assert {
@include output {

View file

@ -27,6 +27,36 @@
}
}
}
@include test("support pref") {
@include mode.SUPPORT_PREF;
@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}
@include test("media pref") {
@include mode.MEDIA_PREF;
@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}
}
@include test-module("STANDARD Mode [mix]") {
@ -54,4 +84,34 @@
}
}
}
@include test("support pref") {
@include mode.SUPPORT_PREF;
@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}
@include test("media pref") {
@include mode.MEDIA_PREF;
@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
@include example;
}
}
}
}

View file

@ -137,6 +137,7 @@
@include test-module("Native Menu Option - Standard [mix]") {
@include mode.STANDARD;
@include mode.SUPPORT_PREF;
@include test("simple") {
@include assert {
@ -252,3 +253,122 @@
}
}
}
@include test-module("Native Menu Option - MediaPref [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;
@include test("simple") {
@include assert {
@include output {
@include native_menu.NativeToolkitMenu {
@include example;
}
@include native_menu.NativeMenuPopup {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"widget.macos.native-context-menus"'), (-moz-bool-pref: '"widget.gtk.native-context-menus"') {
@include example;
}
menupopup:is(#historyMenuPopup, #bookmarksMenuPopup),
menupopup:not([placespopup="true"]) {
@include example;
}
}
}
}
@include test("native menu - with windows media") {
@include assert {
@include output {
@include native_menu.NativeMenu(true) {
@include example;
}
@include native_menu.NonNativeMenu(true) {
@include example;
}
@include native_menu.WinNativeMenu(true) {
@include example;
}
@include native_menu.WinNonNativeMenu(true) {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.theme.non_native_menu"')) {
@media (-moz-gtk-csd-available) {
@include example;
}
}
// Only Windows
@media (-moz-platform: windows) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.theme.non_native_menu"') {
@media (-moz-gtk-csd-available) {
@include example;
}
}
// IGNORE
// Only Windows
@media (-moz-platform: windows) {
@include example;
}
}
}
}
@include test("native menu - without windows media") {
@include assert {
@include output {
@include native_menu.NativeMenu {
@include example;
}
@include native_menu.NonNativeMenu {
@include example;
}
@include native_menu.WinNativeMenu {
@include example;
}
@include native_menu.WinNonNativeMenu {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.theme.non_native_menu"')) {
@media (-moz-gtk-csd-available) {
@include example;
}
}
// AS Windows
@media (-moz-platform: windows) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.theme.non_native_menu"') {
@media (-moz-gtk-csd-available) {
@include example;
}
}
// IGNORE
// AS Windows
@media (-moz-platform: windows) {
@include example;
}
}
}
}
}

View file

@ -1,8 +1,11 @@
@use "true" as *;
@use "example" as *;
@use "../src/utils/one_liner";
@use "../src/utils/mode";
@include test-module("One Liner - ESR [mix]") {
@include mode.ESR;
@include test-module("One Liner [mix]") {
@include test("content") {
@include assert {
@include output {
@ -46,7 +49,54 @@
}
}
@include test-module("One Liner for Responsive [mix]") {
@include test-module("One Liner - MediaPref [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;
@include test("content") {
@include assert {
@include output {
@include one_liner.OneLinerContent {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') {
@media screen and (min-width: 1100px) {
@include example;
}
}
}
}
}
@include test("explicitly") {
@include assert {
@include output {
@include one_liner.OneLiner {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner"') {
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (min-width: 1100px) {
@include example;
}
}
}
}
}
}
@include test-module("One Liner for Responsive - ESR [mix]") {
@include mode.ESR;
@include test("Tabs on bottom") {
@include assert {
@include output {
@ -116,3 +166,65 @@
}
}
}
@include test-module("One Liner for Responsive - MEDIA_PREF [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;
@include test("Tabs on bottom") {
@include assert {
@include output {
@include one_liner.OneLinerOnBottom {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (max-width: 1100px) {
@include example;
}
}
}
}
@include test("Tab bar") {
@include assert {
@include output {
@include one_liner.OneLinerTabbar {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (min-width: 1100px) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (-moz-bool-pref: '"userChrome.autohide.tabbar"') {
@include example;
}
}
}
}
@include test("Nav Bar") {
@include assert {
@include output {
@include one_liner.OneLinerNavbar {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.autohide.navbar"') and (not (-moz-bool-pref: '"userChrome.tabbar.one_liner"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.autohide.navbar"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (max-width: 1100px) {
@include example;
}
}
}
}
}

View file

@ -1,8 +1,11 @@
@use "true" as *;
@use "example" as *;
@use "../src/utils/option";
@use "../src/utils/mode";
@include test-module("If exist pref - ESR [mix]") {
@include mode.ESR;
@include test-module("If exist pref [mix]") {
@include test("simple") {
@include assert {
@include output {
@ -76,7 +79,163 @@
}
}
@include test-module("If not exist pref [mx]") {
@include test-module("If exist pref - Standard [mix]") {
@include mode.STANDARD;
@include mode.SUPPORT_PREF;
@include test("simple") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon") {
@include example;
}
}
@include expect {
@supports -moz-bool-pref("userChrome.tab.photon") {
@include example;
}
}
}
}
@include test("multiple") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon", "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@supports -moz-bool-pref("userChrome.tab.photon") or -moz-bool-pref("userChrome.padding.photon") {
@include example;
}
}
}
}
@include test("simple `and`") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@supports (-moz-bool-pref("userChrome.tab.photon") and -moz-bool-pref("userChrome.padding.photon")) {
@include example;
}
}
}
}
@include test("multiple `and`") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow") {
@include example;
}
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow", "userChrome.icon.panel_full") {
@include example;
}
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow" "userChrome.icon.panel_full") {
@include example;
}
}
@include expect {
@supports (-moz-bool-pref("userChrome.tab.photon") and -moz-bool-pref("userChrome.padding.photon")) or -moz-bool-pref("userChrome.tab.box_shadow") {
@include example;
}
@supports (-moz-bool-pref("userChrome.tab.photon") and -moz-bool-pref("userChrome.padding.photon")) or -moz-bool-pref("userChrome.tab.box_shadow") or -moz-bool-pref("userChrome.icon.panel_full") {
@include example;
}
@supports (-moz-bool-pref("userChrome.tab.photon") and -moz-bool-pref("userChrome.padding.photon")) or (-moz-bool-pref("userChrome.tab.box_shadow") and -moz-bool-pref("userChrome.icon.panel_full")) {
@include example;
}
}
}
}
}
@include test-module("If exist pref - MediaPref [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;
@include test("simple") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon") {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tab.photon"') {
@include example;
}
}
}
}
@include test("multiple") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon", "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tab.photon"'), (-moz-bool-pref: '"userChrome.padding.photon"') {
@include example;
}
}
}
}
@include test("simple `and`") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tab.photon"') and (-moz-bool-pref: '"userChrome.padding.photon"') {
@include example;
}
}
}
}
@include test("multiple `and`") {
@include assert {
@include output {
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow") {
@include example;
}
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow", "userChrome.icon.panel_full") {
@include example;
}
@include option.Option("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow" "userChrome.icon.panel_full") {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tab.photon"') and (-moz-bool-pref: '"userChrome.padding.photon"'), (-moz-bool-pref: '"userChrome.tab.box_shadow"') {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tab.photon"') and (-moz-bool-pref: '"userChrome.padding.photon"'), (-moz-bool-pref: '"userChrome.tab.box_shadow"'), (-moz-bool-pref: '"userChrome.icon.panel_full"') {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tab.photon"') and (-moz-bool-pref: '"userChrome.padding.photon"'), (-moz-bool-pref: '"userChrome.tab.box_shadow"') and (-moz-bool-pref: '"userChrome.icon.panel_full"') {
@include example;
}
}
}
}
}
@include test-module("If not exist pref - ESR [mx]") {
@include mode.ESR;
@include test("simple") {
@include assert {
@include output {
@ -150,3 +309,127 @@
}
}
}
@include test-module("If not exist pref - Standard [mx]") {
@include mode.STANDARD;
@include mode.SUPPORT_PREF;
@include test("simple") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon") {
@include example;
}
}
@include expect {
@supports not -moz-bool-pref("userChrome.tab.photon") {
@include example;
}
}
}
}
@include test("multiple") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon", "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@supports (not -moz-bool-pref("userChrome.tab.photon")) or (not -moz-bool-pref("userChrome.padding.photon")) {
@include example;
}
}
}
}
@include test("multiple `and`") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow") {
@include example;
}
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow", "userChrome.icon.panel_full") {
@include example;
}
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow" "userChrome.icon.panel_full") {
@include example;
}
}
@include expect {
@supports ((not -moz-bool-pref("userChrome.tab.photon")) and (not -moz-bool-pref("userChrome.padding.photon"))) or (not -moz-bool-pref("userChrome.tab.box_shadow")) {
@include example;
}
@supports ((not -moz-bool-pref("userChrome.tab.photon")) and (not -moz-bool-pref("userChrome.padding.photon"))) or (not -moz-bool-pref("userChrome.tab.box_shadow")) or (not -moz-bool-pref("userChrome.icon.panel_full")) {
@include example;
}
@supports ((not -moz-bool-pref("userChrome.tab.photon")) and (not -moz-bool-pref("userChrome.padding.photon"))) or ((not -moz-bool-pref("userChrome.tab.box_shadow")) and (not -moz-bool-pref("userChrome.icon.panel_full"))) {
@include example;
}
}
}
}
}
@include test-module("If not exist pref - MediaPref [mx]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;
@include test("simple") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon") {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tab.photon"')) {
@include example;
}
}
}
}
@include test("multiple") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon", "userChrome.padding.photon") {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tab.photon"')), (not (-moz-bool-pref: '"userChrome.padding.photon"')) {
@include example;
}
}
}
}
@include test("multiple `and`") {
@include assert {
@include output {
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow") {
@include example;
}
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow", "userChrome.icon.panel_full") {
@include example;
}
@include option.NotOption("userChrome.tab.photon" "userChrome.padding.photon", "userChrome.tab.box_shadow" "userChrome.icon.panel_full") {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tab.photon"')) and (not (-moz-bool-pref: '"userChrome.padding.photon"')), (not (-moz-bool-pref: '"userChrome.tab.box_shadow"')) {
@include example;
}
@media (not (-moz-bool-pref: '"userChrome.tab.photon"')) and (not (-moz-bool-pref: '"userChrome.padding.photon"')), (not (-moz-bool-pref: '"userChrome.tab.box_shadow"')), (not (-moz-bool-pref: '"userChrome.icon.panel_full"')) {
@include example;
}
@media (not (-moz-bool-pref: '"userChrome.tab.photon"')) and (not (-moz-bool-pref: '"userChrome.padding.photon"')), (not (-moz-bool-pref: '"userChrome.tab.box_shadow"')) and (not (-moz-bool-pref: '"userChrome.icon.panel_full"')) {
@include example;
}
}
}
}
}

14973
css/leptonChrome.css generated

File diff suppressed because it is too large Load diff

View file

@ -70,11 +70,6 @@
/*= Remove Tab Border ========================================================*/
@supports -moz-bool-pref("userChrome.tab.connect_to_window") {
/* TARGET: original, photon */
#TabsToolbar[brighttext]
#tabbrowser-tabs:not([noshadowfortests])
.tabbrowser-tab:is([visuallyselected], [multiselected])
> .tab-stack
> .tab-background:-moz-lwtheme,
#TabsToolbar:not([brighttext])
#tabbrowser-tabs:not([noshadowfortests])
.tabbrowser-tab:is([visuallyselected], [multiselected])
@ -83,6 +78,14 @@
/* Nightly 96: 1px solid var(--tab-line-color, rgba(128,128,142,0.9)); */
border: unset !important;
}
#TabsToolbar[brighttext]
#tabbrowser-tabs:not([noshadowfortests])
.tabbrowser-tab:is([visuallyselected], [multiselected])
> .tab-stack
> .tab-background:-moz-lwtheme {
/* Nightly 96: 1px solid var(--tab-line-color, rgba(128,128,142,0.9)); */
border: unset !important;
}
#TabsToolbar #firefox-view-button[open] > .toolbarbutton-icon:-moz-lwtheme,
.tab-background[selected]:-moz-lwtheme {
outline-color: transparent !important;

3778
css/leptonContent.css generated

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
"homepage": "https://github.com/black7375/Firefox-UI-Fix#readme",
"scripts": {
"build": "yarn build:scss && yarn format:build",
"build:scss": "sass --no-source-map src/leptonChrome.scss:css/leptonChrome.css src/leptonContent.scss:css/leptonContent.css src/leptonChromeESR.scss:css/leptonChromeESR.css src/leptonContentESR.scss:css/leptonContentESR.css",
"build:scss": "sass --no-source-map src/leptonChromeNightly.scss:css/leptonChrome.css src/leptonContentNightly.scss:css/leptonContent.css src/leptonChromeESR.scss:css/leptonChromeESR.css src/leptonContentESR.scss:css/leptonContentESR.css",
"format": "prettier --write .",
"format:build": "prettier --write css/leptonChrome.css css/leptonContent.css css/leptonChromeESR.css css/leptonContentESR.css",
"test": "jest",

View file

@ -1,6 +1,31 @@
//-- Mixin ---------------------------------------------------------------------
@import "combined_circle_button";
@mixin _combined_forward_button() {
@if mode.isMediaPref() {
@media (-moz-bool-pref: '"userChrome.combined.urlbar.nav_button"'),
((not (-moz-bool-pref: '"userChrome.combined.sub_button.as_normal"')) or
(
(-moz-bool-pref: '"userChrome.combined.nav_button"') and
(-moz-bool-pref: '"userChrome.combined.urlbar.home_button"')
)
) {
@content;
}
}
@else {
@supports -moz-bool-pref("userChrome.combined.urlbar.nav_button") or
((not -moz-bool-pref("userChrome.combined.sub_button.as_normal")) or
(
-moz-bool-pref("userChrome.combined.nav_button") and
-moz-bool-pref("userChrome.combined.urlbar.home_button")
)
) {
@content;
}
}
}
@mixin _combined_nav_button_background($autohideOptionName) {
> .toolbarbutton-icon {
@include circle_button_background;
@ -39,13 +64,7 @@
//------------------------------------------------------------------------------
#nav-bar-customization-target > {
@supports -moz-bool-pref("userChrome.combined.urlbar.nav_button") or
((not -moz-bool-pref("userChrome.combined.sub_button.as_normal")) or
(
-moz-bool-pref("userChrome.combined.nav_button") and
-moz-bool-pref("userChrome.combined.urlbar.home_button")
)
) {
@include _combined_forward_button {
#forward-button {
--uc-forward-button-margin: calc(-1 * var(--uc-toolbarbutton-boundary) + 1px);

View file

@ -48,18 +48,18 @@ menu {
}
/*= Remove Tab Border ========================================================*/
@mixin noneBorder {
/* Nightly 96: 1px solid var(--tab-line-color, rgba(128,128,142,0.9)); */
border: unset !important;
}
@mixin _theme_removeTabBorder($options...) {
%noneBorder {
/* Nightly 96: 1px solid var(--tab-line-color, rgba(128,128,142,0.9)); */
border: unset !important;
}
@each $prefix, $postfix in $options {
#TabsToolbar#{$prefix}
#tabbrowser-tabs:not([noshadowfortests])
.tabbrowser-tab:is([visuallyselected], [multiselected])
> .tab-stack
> .tab-background#{$postfix} {
@extend %noneBorder;
@include noneBorder;
}
}
}

View file

@ -10,12 +10,10 @@
@use "utils/window_control" as *;
@use "utils/has" as *;
@use "utils/proton_elements" as Proton;
@use "utils/mode";
@use "sass:selector";
@use "sass:math";
@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@namespace html "http://www.w3.org/1999/xhtml";
/** Default Theme - Contrast **************************************************/
@include Option("userChrome.theme.built_in_contrast") {
@import "theme/built_in";

View file

@ -1,4 +1,7 @@
@use "utils/mode";
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
@include mode.ESR;
@import "leptonChrome"
@import "leptonChrome";

View file

@ -0,0 +1,10 @@
@use "utils/mode";
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
@import "leptonChrome";
/*@ NIGHTLY @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
@include mode.MEDIA_PREF;
@import "leptonChrome";

View file

@ -8,9 +8,6 @@
@use "utils/proton_elements" as Proton;
@use "sass:selector";
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
/** Compatibility *************************************************************/
@import "contents/compatibility";

View file

@ -1,4 +1,7 @@
@use "utils/mode";
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
@include mode.ESR;
@import "leptonContent"
@import "leptonContent";

View file

@ -0,0 +1,10 @@
@use "utils/mode";
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
@import "leptonContent";
/*@ NIGHTLY @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
@include mode.MEDIA_PREF;
@import "leptonContent";

View file

@ -1,4 +1,5 @@
$_osESR: false !default;
$_mediaPref: false !default;
@mixin ESR() {
$_osESR: true !global;
@ -8,6 +9,14 @@ $_osESR: false !default;
$_osESR: false !global;
}
@mixin SUPPORT_PREF() {
$_mediaPref: false !global;
}
@mixin MEDIA_PREF() {
$_mediaPref: true !global;
}
@function isESR() {
@return $_osESR;
}
@ -15,3 +24,7 @@ $_osESR: false !default;
@function isSTANDARD() {
@return not $_osESR;
}
@function isMediaPref() {
@return isSTANDARD() and $_mediaPref;
}

View file

@ -1,14 +1,21 @@
@use "mode";
@function _prefix($separator, $i) {
@if $i != 1 {
@return " " + $separator + " ";
}
@return "";
}
@function _not($str, $positive) {
@return if($positive, $str, "(not " + $str + ")");
}
@function _pref($option) {
@return "-moz-bool-pref(\"#{$option}\")";
}
@function _not($str, $positive) {
@return if($positive, $str, "(not " + $str + ")");
@function _prefMedia($option) {
@return "(-moz-bool-pref: \"#{$option}\")";
}
@function _getOption($optionNames, $positive: true) {
@ -43,14 +50,49 @@
@return _getOption($optionNames, $positive);
}
@function _getOptionMedia($optionNames, $positive: true) {
$result: "";
@for $i from 1 through length($optionNames) {
$option: nth($optionNames, $i);
$separator: if(
list-separator($optionNames) == "comma", ",", if(
list-separator($optionNames) == "space", "and", null
)
);
$result: $result + _prefix($separator, $i);
@if type-of($option) == "list" {
$result: $result + _getOptionMedia($option, $positive) ;
}
@else {
$result: $result + _not(_prefMedia($option), $positive);
}
}
@return $result;
}
@mixin Option($optionNames...) {
@supports #{_optionWrapper($optionNames)} {
@content;
@if mode.isMediaPref() {
@media #{_getOptionMedia($optionNames)} {
@content;
}
}
@else {
@supports #{_optionWrapper($optionNames)} {
@content;
}
}
}
@mixin NotOption($optionNames...) {
@supports #{_optionWrapper($optionNames, false)} {
@content;
@if mode.isMediaPref() {
@media #{_getOptionMedia($optionNames, false)} {
@content;
}
}
@else {
@supports #{_optionWrapper($optionNames, false)} {
@content;
}
}
}

View file

@ -3,6 +3,7 @@
@use "list" as list-utils;
@use "media";
@use "mode";
@use "option";
//== Args ======================================================================
$win: "win";
@ -77,7 +78,7 @@ $_os-media: map.merge(
}
@if list.index($osNames, $mac) {
@supports -moz-bool-pref("layout.css.osx-font-smoothing.enabled") {
@include option.Option("layout.css.osx-font-smoothing.enabled") {
@content;
}
}