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