main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | exports.addon = function (renderer) {
|
---|
4 | if (process.env.NODE_ENV !== 'production') {
|
---|
5 | require('./__dev__/warnOnMissingDependencies')('sheet', renderer, ['rule']);
|
---|
6 | }
|
---|
7 |
|
---|
8 | renderer.sheet = function (map, block) {
|
---|
9 | var result = {};
|
---|
10 |
|
---|
11 | if (!block) {
|
---|
12 | block = renderer.hash(map);
|
---|
13 | }
|
---|
14 |
|
---|
15 | var onElementModifier = function (elementModifier) {
|
---|
16 | var styles = map[elementModifier];
|
---|
17 |
|
---|
18 | if ((process.env.NODE_ENV !== 'production') && renderer.sourcemaps) {
|
---|
19 | // In dev mode emit CSS immediately to generate sourcemaps.
|
---|
20 | result[elementModifier] = renderer.rule(styles, block + '-' + elementModifier);
|
---|
21 | } else {
|
---|
22 | Object.defineProperty(result, elementModifier, {
|
---|
23 | configurable: true,
|
---|
24 | enumerable: true,
|
---|
25 | get: function () {
|
---|
26 | var classNames = renderer.rule(styles, block + '-' + elementModifier);
|
---|
27 |
|
---|
28 | Object.defineProperty(result, elementModifier, {
|
---|
29 | value: classNames,
|
---|
30 | enumerable: true
|
---|
31 | });
|
---|
32 |
|
---|
33 | return classNames;
|
---|
34 | },
|
---|
35 | });
|
---|
36 | }
|
---|
37 | };
|
---|
38 |
|
---|
39 | for (var elementModifier in map) {
|
---|
40 | onElementModifier(elementModifier);
|
---|
41 | }
|
---|
42 |
|
---|
43 | return result;
|
---|
44 | };
|
---|
45 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.