@@ -246,14 +246,14 @@ A state is attached to a single class in the block and describes how that
246
246
class changes when the element is in that state. The names of states are
247
247
scoped to their class and the styles they provide can target only elements
248
248
assigned to that classname. The exception to this is for states that belong
249
- to the block ` .root ` class. In general, CSS Blocks restricts the use of
249
+ to the block ` :scope ` class. In general, CSS Blocks restricts the use of
250
250
combinators in selectors with a preference for unscoped selectors that are
251
251
fast and optimization friendly (See Rules & Constraints below). One of the
252
252
primary exceptions to this is that root states can be used in selectors as a
253
253
scope for classes and other states within the block. So when you find
254
254
yourself thinking that you absolutely need to use a descendant or child
255
255
combinator then you should imagine that use case as a state for a block's
256
- ` .root ` class.
256
+ ` :scope ` class.
257
257
258
258
It is important to think of States as part of the public API that describe
259
259
how a block and the classes within it can vary. By keeping all the
@@ -371,10 +371,10 @@ Syntax
371
371
372
372
### The root element
373
373
374
- Styles can be attached to a block's root element with the class ` .root ` . The
375
- ` .root ` class can be used in selectors in combination with itself as well as
374
+ Styles can be attached to a block's root element with the class ` :scope ` . The
375
+ ` :scope ` class can be used in selectors in combination with itself as well as
376
376
in media queries and other @-rules. However, some block-specific syntax may
377
- only be put into a simple ruleset where the selector is exactly ` .root ` ; it
377
+ only be put into a simple ruleset where the selector is exactly ` :scope ` ; it
378
378
is convention to have only one such ruleset near the top of your block's
379
379
file.
380
380
@@ -458,7 +458,7 @@ automatically generate a unique name for BEM output mode.
458
458
` shared.block.css `
459
459
460
460
``` css
461
- .root {
461
+ :scope {
462
462
block-name : my-block;
463
463
color : blue ;
464
464
}
@@ -472,7 +472,7 @@ automatically generate a unique name for BEM output mode.
472
472
``` css
473
473
@block-reference shared from "../shared.block.css";
474
474
475
- .root {
475
+ :scope {
476
476
block-name : my-block;
477
477
background-color : blue ;
478
478
}
@@ -541,10 +541,10 @@ with a specific selector in the block. In fact, it is an abstraction that can ca
541
541
the CSS blocks compiler to consider many selectors in a block that involve the specific
542
542
block object.
543
543
544
- - ` .root ` represents the block root for the current block.
544
+ - ` :scope ` represents the block root for the current block.
545
545
- ` a-block-reference.root ` represents the block root for the
546
546
block that has a ` @block-reference ` as ` a-block-reference ` from the current
547
- block. In many cases, the ` .root ` can be safely omitted.
547
+ block. In many cases, the ` :scope ` can be safely omitted.
548
548
- ` [state|foo] ` or ` [state|foo=bar] ` represent the
549
549
root state named ` foo ` or the state named ` foo ` with the substate of ` bar ` .
550
550
- ` a-block-reference[state|foo] ` or ` a-block-reference[state|foo=bar] `
@@ -602,7 +602,7 @@ Rather than having to specify the block root, a block class can declare itself t
602
602
603
603
``` css
604
604
// tab.block.css
605
- .root {
605
+ :scope {
606
606
background-color : gray ;
607
607
color : black ;
608
608
flex : 1 1 content ;
@@ -631,7 +631,7 @@ Rather than having to specify the block root, a block class can declare itself t
631
631
632
632
// tabs.block.css
633
633
@block-reference tab from "tab.block.css";
634
- .root {
634
+ :scope {
635
635
display: flex;
636
636
}
637
637
@@ -693,13 +693,13 @@ other block:
693
693
And now that block can be referenced within this file by the name
694
694
` another ` .
695
695
696
- To inherit, you must set the property ` extends ` inside the block's ` .root `
696
+ To inherit, you must set the property ` extends ` inside the block's ` :scope `
697
697
class to the name of the block you wish to inherit.
698
698
699
699
``` css
700
700
@block-refererence another from "./another-block.block.css";
701
701
702
- .root {
702
+ :scope {
703
703
extends : another;
704
704
}
705
705
```
@@ -727,7 +727,7 @@ a block `implements` one or more blocks.
727
727
``` css
728
728
@block-reference base from "./base.block.css";
729
729
@block-reference other from "./other.block.css";
730
- .root { implements : base, other; color : red ; }
730
+ :scope { implements : base, other; color : red ; }
731
731
```
732
732
733
733
Now if there are any states, classes or substates in those other blocks
@@ -1231,7 +1231,7 @@ of the same value in the key selector the following resolution is created:
1231
1231
1232
1232
``` css
1233
1233
@block-reference base from "./base.block.css";
1234
- .root { extends : base; }
1234
+ :scope { extends : base; }
1235
1235
.foo {
1236
1236
color : resolve(" base.foo" );
1237
1237
color : blue ; // conflicts with color value (s ) in a selector targeting base .foo
@@ -1340,7 +1340,7 @@ change the source authoring. Here's our form example from above written with Sas
1340
1340
1341
1341
``` scss
1342
1342
$base-size : 1em ;
1343
- .root {
1343
+ :scope {
1344
1344
block-name : my- form;
1345
1345
margin : 2 * $base-size 0 ;
1346
1346
padding : $base-size $base-size / 2 ;
@@ -1438,7 +1438,7 @@ the current component's styles:
1438
1438
``` css
1439
1439
@block-reference icons from "../../shared/styles/icons/dark.block.css";
1440
1440
1441
- .root {
1441
+ :scope {
1442
1442
border : 1px solid black ;
1443
1443
overflow : auto ;
1444
1444
}
@@ -1453,7 +1453,7 @@ the current component's styles:
1453
1453
` my-component/template.hbs `
1454
1454
1455
1455
``` hbs
1456
- <div class="icons.root " state:icons.hoverable state:icons.dark>
1456
+ <div class="icons:scope " state:icons.hoverable state:icons.dark>
1457
1457
<div class="icon icons.new">New File</div>
1458
1458
<div class="icon icons.save">Save File</div>
1459
1459
<div class="icon icons.undo">Undo</div>
0 commit comments