1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = flushToReact;
|
5 | exports.flushToHTML = flushToHTML;
|
6 |
|
7 | var _react = _interopRequireDefault(require("react"));
|
8 |
|
9 | var _style = require("./style");
|
10 |
|
11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
12 |
|
13 | function flushToReact(options) {
|
14 | if (options === void 0) {
|
15 | options = {};
|
16 | }
|
17 |
|
18 | return (0, _style.flush)().map(function (args) {
|
19 | var id = args[0];
|
20 | var css = args[1];
|
21 | return _react["default"].createElement('style', {
|
22 | id: "__" + id,
|
23 |
|
24 | key: "__" + id,
|
25 | nonce: options.nonce ? options.nonce : undefined,
|
26 | dangerouslySetInnerHTML: {
|
27 | __html: css
|
28 | }
|
29 | });
|
30 | });
|
31 | }
|
32 |
|
33 | function flushToHTML(options) {
|
34 | if (options === void 0) {
|
35 | options = {};
|
36 | }
|
37 |
|
38 | return (0, _style.flush)().reduce(function (html, args) {
|
39 | var id = args[0];
|
40 | var css = args[1];
|
41 | html += "<style id=\"__" + id + "\"" + (options.nonce ? " nonce=\"" + options.nonce + "\"" : '') + ">" + css + "</style>";
|
42 | return html;
|
43 | }, '');
|
44 | } |
\ | No newline at end of file |