Skip to content

Commit dfbd4fe

Browse files
committed
fix: Add details on current style evaluation for the runtime.
1 parent f2b2f30 commit dfbd4fe

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

rfcs/rfc-ember-integration-v2.md

+25-10
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@ Once the block definition file is parsed, the compiled output is parsed to load
233233

234234
For each selector in each rule:
235235

236-
1. Find the key selector
237-
2. Find all the classnames in the key selector
238-
3. If there is more than one classname, it is a resolution selector: skip it because the definition file will have addressed that.
239-
4. If there is no classname, it is an error.
240-
5. Use the classname to reverse lookup the block style associated with it, if not found, it is an error.
241-
6. Add the ruleset (`RulesetContainer.addRuleset`) to that style.
236+
1. Find the key selector
237+
2. Find all the classnames in the key selector
238+
3. If there is more than one classname, it is a resolution selector: skip it because the definition file will have addressed that.
239+
4. If there is no classname, it is an error.
240+
5. Use the classname to reverse lookup the block style associated with it, if not found, it is an error.
241+
6. Add the ruleset (`RulesetContainer.addRuleset`) to that style.
242242

243243

244244
## Detailed Design of Single Pass Template Rewriting
@@ -467,11 +467,26 @@ interface BlockInfo {
467467

468468
### Resolving runtime styles
469469

470-
There are three steps required to resolve the runtime styles of from CSS Blocks into optimized CSS classes:
470+
There are four steps required to resolve the runtime styles of from CSS Blocks into optimized CSS classes:
471471

472-
1. **Concrete Block Resolution** — Resolves references to a block's style interface into the blocks that are specified at runtime.
473-
2. **Resolving Implied Styles** and Style Requirements — Resolves the styles that are specified into the styles that are implied by the specified styles.
474-
3. **Optimization Transformation** — Transforms styles from the styles specified by the input CSS into the styles emitted by OptiCSS.
472+
1. **Evaluate Current Style** — Converts the helper invocation arguments into references to the element's current runtime styles.
473+
2. **Concrete Block Resolution** — Resolves references to a block's style interface into the blocks that are specified at runtime.
474+
3. **Resolving Implied Styles** and Style Requirements — Resolves the styles that are specified into the styles that are implied by the specified styles.
475+
4. **Optimization Transformation** — Transforms styles from the styles specified by the input CSS into the styles emitted by OptiCSS.
476+
477+
#### Evaluate Current Style
478+
479+
The arguments to the helper are a stack of values. Once the stack is processed, the authored runtime style of the element is known.
480+
481+
The meaning of the helper invocation arguments is specified above in the section "Design for Rewrite Helper Invocations".
482+
483+
The first section uses block IDs to look up blocks and, if a runtime block is passed, get the concrete style view of the interface block. Once processed there is an array with length `numBlocks`, where each element is an array of GlobalStyleIndex values.
484+
485+
The style definitions are then processed by popping two values off the stack for each style definition. these are indexes into the two-dimensional array that we created in the previous paragraph. We accumulate these values into an array that represents possible styles that might apply to this element.
486+
487+
The remaining arguments specify the conditions that result in the styles being selected to be part of our current state. The description of the conditions above should be sufficient to properly determine the current styles from the stack.
488+
489+
It is recommended that we represent the current styles with a `Set` for the best performance.
475490

476491
#### Concrete Block Resolution
477492

0 commit comments

Comments
 (0)