Merge pull request #306 from sass/impl-status

Tweak impl status styling
This commit is contained in:
Natalie Weizenbaum 2019-03-18 17:48:47 -07:00 committed by GitHub
commit 4e6eb090a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 78 additions and 35 deletions

View File

@ -300,17 +300,27 @@ module SassHelpers
# Renders a status dashboard for each implementation's support for a feature. # Renders a status dashboard for each implementation's support for a feature.
# #
# Each implementation's value can be `true`, indicating that that # Each implementation's value can be:
# implementation fully supports the feature; `false`, indicating that it does #
# not yet support the feature; or a string, indicating the version it started # * `true`, indicating that that implementation fully supports the feature;
# supporting the feature. # * `false`, indicating that it does not yet support the feature at all;
# * `:partial`, indicating that it has limited or incorrect support for the
# feature;
# * or a string, indicating the version it started supporting the feature.
# #
# When possible, prefer using the start version rather than `true`. # When possible, prefer using the start version rather than `true`.
# #
# If `feature` is passed, it should be a terse (one- to three-word)
# description of the particular feature whose compatibility is described. This
# should be used whenever the status isn't referring to the entire feature
# being described by the surrounding prose.
#
# This takes an optional Markdown block that should provide more information # This takes an optional Markdown block that should provide more information
# about the implementation differences or the old behavior. # about the implementation differences or the old behavior.
def impl_status(dart: nil, libsass: nil, ruby: nil, node: nil) def impl_status(dart: nil, libsass: nil, ruby: nil, node: nil, feature: nil)
contents = [] compatibility = feature ? "Compatibility (#{feature}):" : "Compatibility:"
contents = [content_tag(:div, compatibility, class: "compatibility")]
contents << _impl_status_row('Dart Sass', dart) unless dart.nil? contents << _impl_status_row('Dart Sass', dart) unless dart.nil?
contents << _impl_status_row('LibSass', libsass) unless libsass.nil? contents << _impl_status_row('LibSass', libsass) unless libsass.nil?
contents << _impl_status_row('Node Sass', node) unless node.nil? contents << _impl_status_row('Node Sass', node) unless node.nil?
@ -324,7 +334,7 @@ module SassHelpers
if block_given? if block_given?
# Get rid of extra whitespace to avoid more bogus <p> tags. # Get rid of extra whitespace to avoid more bogus <p> tags.
_concat(content_tag :div, _render_markdown(_capture {yield}).strip, class: 'sl-c-callout') _concat(content_tag :div, _render_markdown(_capture {yield}).strip, class: 'sl-c-callout sl-c-callout--impl-status')
end end
end end
@ -335,6 +345,8 @@ module SassHelpers
"" ""
elsif status == false elsif status == false
"" ""
elsif status == :partial
"partial"
else else
"since #{status}" "since #{status}"
end end

View File

@ -28,6 +28,16 @@
} }
} }
&--impl-status {
font-size: 0.8em;
margin-top: -1rem;
padding: 0.8rem;
.sl-c-callout & {
background: lighten($sl-color--pale-sky, 53%);
}
}
> *:first-child { margin-top: 0; } > *:first-child { margin-top: 0; }
> *:last-child { margin-bottom: 0; } > *:last-child { margin-bottom: 0; }

View File

@ -57,10 +57,34 @@
&:first-child { border: 0; } &:first-child { border: 0; }
} }
.compatibility {
font-weight: 600;
opacity: 0.5;
+ div { border: 0; }
}
dt, dt,
dd { dd {
padding-left: 1rem; padding-left: 1rem;
&:first-child { padding-left: 0; } &:first-child { padding-left: 0; }
} }
&.impl-status {
font-size: 0.8em;
margin-top: -1em;
a {
transition: transform 0.1s;
border-bottom: none;
background: none;
cursor: pointer;
width: 19px;
text-align: center;
transform-origin: 8px 11px;
&.expanded { transform: rotate(90deg); }
}
}
} }

View File

@ -83,7 +83,7 @@ $(function() {
details.hide(); details.hide();
expandLink.click(function() { expandLink.click(function() {
details.toggle(); details.toggle();
expandLink.text(expandLink.text() == "▶" ? "▼" : "▶"); expandLink.toggleClass("expanded");
}); });
}); });
}); });

View File

@ -3,7 +3,7 @@ title: CSS At-Rules
table_of_contents: true table_of_contents: true
--- ---
<% impl_status dart: '1.15.0', libsass: false, ruby: false do %> <% impl_status dart: '1.15.0', libsass: false, ruby: false, feature: "Name Interpolation" do %>
LibSass, Ruby Sass, and older versions of Dart Sass don't support LibSass, Ruby Sass, and older versions of Dart Sass don't support
[interpolation][] in at-rule names. They do support interpolation in values. [interpolation][] in at-rule names. They do support interpolation in values.
@ -64,7 +64,7 @@ having to rewrite the style rule's selector.
## `@media` ## `@media`
<% impl_status dart: '1.11.0', libsass: false, ruby: '3.7.0' do %> <% impl_status dart: '1.11.0', libsass: false, ruby: '3.7.0', feature: 'Range Syntax' do %>
LibSass and older versions of Dart Sass and Ruby Sass don't support media LibSass and older versions of Dart Sass and Ruby Sass don't support media
queries with features written in a [range context][]. They do support other queries with features written in a [range context][]. They do support other
standard media queries. standard media queries.

View File

@ -238,7 +238,7 @@ avoid cascade headaches and make it easier to configure down the line.
### Disallowed Selectors ### Disallowed Selectors
<% impl_status dart: true, libsass: false, ruby: false do %> <% impl_status dart: true, libsass: false, ruby: false, feature: "No Compound Extensions" do %>
LibSass and Ruby Sass currently allow complex selectors like `.message.info` to LibSass and Ruby Sass currently allow complex selectors like `.message.info` to
be extended. However, this behavior didn't match the definition of `@extend`: be extended. However, this behavior didn't match the definition of `@extend`:
instead of styling elements that matched the extending selector as though it had instead of styling elements that matched the extending selector as though it had

View File

@ -314,7 +314,7 @@ nested import are still defined globally, though.
## Importing CSS ## Importing CSS
<% impl_status dart: '1.11.0', libsass: false, ruby: false do %> <% impl_status dart: '1.11.0', libsass: :partial, ruby: false do %>
LibSass supports importing files with the extension `.css`, but contrary to LibSass supports importing files with the extension `.css`, but contrary to
the specification they're treated as SCSS files rather than being parsed as the specification they're treated as SCSS files rather than being parsed as
CSS. This behavior has been deprecated, and an update is in the works to CSS. This behavior has been deprecated, and an update is in the works to

View File

@ -364,10 +364,7 @@ the `@content` rule.
### Passing Arguments to Content Blocks ### Passing Arguments to Content Blocks
<% impl_status dart: '1.15.0', libsass: false, ruby: false do %> <% impl_status dart: '1.15.0', libsass: false, ruby: false %>
LibSass, Ruby Sass, and older versions of Dart Sass don't support passing
arguments to content blocks.
<% end %>
A mixin can pass arguments to its content block the same way it would pass A mixin can pass arguments to its content block the same way it would pass
arguments to another mixin by writing `@content(<arguments...>)`. The user arguments to another mixin by writing `@content(<arguments...>)`. The user

View File

@ -344,7 +344,7 @@ SIGNATURE
'hsla($hue $saturation $lightness / $alpha)', 'hsla($hue $saturation $lightness / $alpha)',
'hsla($hue, $saturation, $lightness, $alpha: 1)', 'hsla($hue, $saturation, $lightness, $alpha: 1)',
returns: 'color' do %> returns: 'color' do %>
<% impl_status dart: '1.15.0', libsass: false, ruby: false do %> <% impl_status dart: '1.15.0', libsass: false, ruby: false, feature: "Level 4 Syntax" do %>
LibSass and Ruby Sass only support the following signatures: LibSass and Ruby Sass only support the following signatures:
* `hsl($hue, $saturation, $lightness)` * `hsl($hue, $saturation, $lightness)`
@ -355,7 +355,7 @@ SIGNATURE
`hsl()` is used. `hsl()` is used.
<% end %> <% end %>
<% impl_status dart: true, libsass: false, ruby: '3.7.0' do %> <% impl_status dart: true, libsass: false, ruby: '3.7.0', feature: "Percent Alpha" do %>
LibSass and older versions of Ruby Sass don't support alpha values specified as LibSass and older versions of Ruby Sass don't support alpha values specified as
percentages. percentages.
<% end %> <% end %>
@ -644,7 +644,7 @@ SIGNATURE
'rgba($red, $green, $blue, $alpha: 1)', 'rgba($red, $green, $blue, $alpha: 1)',
'rgba($color, $alpha)', 'rgba($color, $alpha)',
returns: 'color' do %> returns: 'color' do %>
<% impl_status dart: '1.15.0', libsass: false, ruby: false do %> <% impl_status dart: '1.15.0', libsass: false, ruby: false, feature: "Level 4 Syntax" do %>
LibSass and Ruby Sass only support the following signatures: LibSass and Ruby Sass only support the following signatures:
* `rgb($red, $green, $blue)` * `rgb($red, $green, $blue)`
@ -656,7 +656,7 @@ SIGNATURE
`rgb()` is used. `rgb()` is used.
<% end %> <% end %>
<% impl_status dart: true, libsass: false, ruby: '3.7.0' do %> <% impl_status dart: true, libsass: false, ruby: '3.7.0', feature: "Percent Alpha" do %>
LibSass and older versions of Ruby Sass don't support alpha values specified LibSass and older versions of Ruby Sass don't support alpha values specified
as percentages. as percentages.
<% end %> <% end %>

View File

@ -44,7 +44,7 @@ introduction: >
## In SassScript ## In SassScript
<% impl_status dart: true, libsass: false, ruby: '4.0.0 (unreleased)' do %> <% impl_status dart: true, libsass: false, ruby: '4.0.0 (unreleased)', feature: "Modern Syntax" do %>
LibSass and Ruby Sass currently use an older syntax for parsing interpolation LibSass and Ruby Sass currently use an older syntax for parsing interpolation
in SassScript. For most practical purposes it works the same, but it can in SassScript. For most practical purposes it works the same, but it can
behave strangely around [operators][]. See [this document][] for details. behave strangely around [operators][]. See [this document][] for details.

View File

@ -219,7 +219,7 @@ These options control how Sass loads it input files.
#### `file` #### `file`
<% impl_status dart: '1.11.0', node: false do %> <% impl_status dart: '1.11.0', node: :partial, feature: "Plain CSS Files" do %>
Node Sass and older versions of Dart Sass support loading files with the Node Sass and older versions of Dart Sass support loading files with the
extension `.css`, but contrary to the specification they're treated as SCSS extension `.css`, but contrary to the specification they're treated as SCSS
files rather than being parsed as CSS. This behavior has been deprecated in files rather than being parsed as CSS. This behavior has been deprecated in
@ -284,7 +284,7 @@ h1
### `includePaths` ### `includePaths`
<% impl_status dart: '1.15.0', node: '3.9.0' do %> <% impl_status dart: '1.15.0', node: '3.9.0', feature: "SASS_PATH" do %>
Earlier versions of Dart Sass and Node Sass didn't support the `SASS_PATH` Earlier versions of Dart Sass and Node Sass didn't support the `SASS_PATH`
environment variable. environment variable.
<% end %> <% end %>
@ -719,7 +719,7 @@ h1 {
#### `importer` #### `importer`
<% impl_status dart: false, node: '3.0.0' do %> <% impl_status dart: true, node: '3.0.0' do %>
Versions of Node Sass before 3.0.0 don't support arrays of importers, Versions of Node Sass before 3.0.0 don't support arrays of importers,
nor do they support importers that return `Error` objects. nor do they support importers that return `Error` objects.

View File

@ -2,7 +2,7 @@
title: Equality Operators title: Equality Operators
--- ---
<% impl_status dart: true, libsass: false, ruby: '4.0.0 (unreleased)' do %> <% impl_status dart: true, libsass: false, ruby: '4.0.0 (unreleased)', feature: "Unitless Equality" do %>
LibSass and older versions of Ruby Sass consider numbers without units to be LibSass and older versions of Ruby Sass consider numbers without units to be
equal to the same numbers with any units. This behavior was deprecated and has equal to the same numbers with any units. This behavior was deprecated and has
been removed from more recently releases because it violates [transitivity][]. been removed from more recently releases because it violates [transitivity][].

View File

@ -1,4 +1,4 @@
<% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0' do %> <% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0', feature: 'Argument Type' do %>
In older versions of LibSass and Ruby Sass, the [`call()` function][] took a In older versions of LibSass and Ruby Sass, the [`call()` function][] took a
string representing a function's name. This was changed to take a function string representing a function's name. This was changed to take a function
value instead in preparation for a new module system where functions are no value instead in preparation for a new module system where functions are no

View File

@ -130,7 +130,7 @@ compile that declaration to CSS at all.
## Custom Properties ## Custom Properties
<% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0' do %> <% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0', feature: 'SassScript Syntax' do %>
Older versions of LibSass and Ruby Sass parsed custom property declarations Older versions of LibSass and Ruby Sass parsed custom property declarations
just like any other property declaration, allowing the full range of just like any other property declaration, allowing the full range of
SassScript expressions as values. Even when using these versions, it's SassScript expressions as values. Even when using these versions, it's

View File

@ -7,7 +7,7 @@ introduction: >
## Input Encoding ## Input Encoding
<% impl_status(dart: false, libsass: true, ruby: true) do %> <% impl_status dart: false, libsass: true, ruby: true do %>
Dart Sass currently *only* supports the UTF-8 encoding. As such, it's safest Dart Sass currently *only* supports the UTF-8 encoding. As such, it's safest
to encode all Sass stylesheets as UTF-8. to encode all Sass stylesheets as UTF-8.
<% end %> <% end %>

View File

@ -124,7 +124,7 @@ Nothing is interpreted as a SassScript expression, with the exception that
## `min()` and `max()` ## `min()` and `max()`
<% impl_status(dart: "1.11.0", libsass: false, ruby: false) do %> <% impl_status dart: "1.11.0", libsass: false, ruby: false do %>
LibSass and Ruby Sass currently *always* parse `min()` and `max()` as Sass LibSass and Ruby Sass currently *always* parse `min()` and `max()` as Sass
functions. To create a plain CSS `min()` or `max()` call for those functions. To create a plain CSS `min()` or `max()` call for those
implementations, you can write something like `unquote("min(#{$padding}, implementations, you can write something like `unquote("min(#{$padding},

View File

@ -2,9 +2,9 @@
title: Colors title: Colors
--- ---
<% impl_status dart: '1.14.0', libsass: '3.6.0', ruby: '3.6.0' do %> <% impl_status dart: '1.14.0', libsass: '3.6.0', ruby: '3.6.0', feature: 'Level 4 Syntax' do %>
Support for [hex colors with an alpha channel][] is not supported by LibSass LibSass and older versions of Dart or Ruby Sass don't support [hex colors with
or older versions of Dart or Ruby Sass. an alpha channel][].
[hex colors with an alpha channel]: https://drafts.csswg.org/css-color/#hex-notation [hex colors with an alpha channel]: https://drafts.csswg.org/css-color/#hex-notation
<% end %> <% end %>

View File

@ -3,7 +3,7 @@ title: Lists
table_of_contents: true table_of_contents: true
--- ---
<% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0' do %> <% impl_status dart: true, libsass: '3.5.0', ruby: '3.5.0', feature: 'Square Brackets' do %>
Older implementations of LibSass and Ruby Sass didn't support lists with Older implementations of LibSass and Ruby Sass didn't support lists with
square brackets. square brackets.
<% end %> <% end %>

View File

@ -44,7 +44,7 @@ been spotty, Sass always compiles it to fully expanded numbers.
## Precision ## Precision
<% impl_status dart: true, libsass: false, ruby: '3.5.0' do %> <% impl_status dart: true, libsass: false, ruby: '3.5.0', feature: '10 Digit Default' do %>
LibSass and older versions of Ruby Sass default to 5 digits of numeric LibSass and older versions of Ruby Sass default to 5 digits of numeric
precision, but can be configured to use a different number. It's recommended precision, but can be configured to use a different number. It's recommended
that users configure them for 10 digits for greater accuracy and that users configure them for 10 digits for greater accuracy and

View File

@ -161,7 +161,7 @@ diagram below. They may include [interpolation][] anywhere.
### Escapes ### Escapes
<% impl_status dart: '1.11.0', libsass: false, ruby: false do %> <% impl_status dart: '1.11.0', libsass: false, ruby: false, feature: 'Normalization' do %>
LibSass, Ruby Sass, and older versions of Dart Sass don't normalize escapes in LibSass, Ruby Sass, and older versions of Dart Sass don't normalize escapes in
identifiers. Instead, the text in the unquoted string is the exact text the identifiers. Instead, the text in the unquoted string is the exact text the
user wrote. For example, `\1F46D` and `👭` are not considered equivalent. user wrote. For example, `\1F46D` and `👭` are not considered equivalent.