main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1011 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | exports.addon = function (renderer) {
|
---|
| 4 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 5 | require('./__dev__/warnOnMissingDependencies')('dsheet', renderer, ['sheet', 'cache']);
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | renderer.dsheet = function (map, block) {
|
---|
| 9 | var styles = renderer.sheet(map, block);
|
---|
| 10 | var closures = {};
|
---|
| 11 |
|
---|
| 12 | var createClosure = function (elementModifier) {
|
---|
| 13 | var closure = function (dynamicStyles) {
|
---|
| 14 | if (!dynamicStyles) {
|
---|
| 15 | return styles[elementModifier];
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | var dynamicClassName = renderer.cache(dynamicStyles);
|
---|
| 19 |
|
---|
| 20 | return styles[elementModifier] + dynamicClassName;
|
---|
| 21 | };
|
---|
| 22 |
|
---|
| 23 | closure.toString = function () {
|
---|
| 24 | return styles[elementModifier];
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 | return closure;
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | for (var elementModifier in map) {
|
---|
| 31 | closures[elementModifier] = createClosure(elementModifier);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | return closures;
|
---|
| 35 | };
|
---|
| 36 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.