mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
66 lines
2.2 KiB
JavaScript
66 lines
2.2 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
|
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
|
|
var _react = _interopRequireDefault(require("react"));
|
|
|
|
var _jss = require("jss");
|
|
|
|
var _StylesProvider = _interopRequireDefault(require("../StylesProvider"));
|
|
|
|
var _createGenerateClassName = _interopRequireDefault(require("../createGenerateClassName"));
|
|
|
|
var ServerStyleSheets = /*#__PURE__*/function () {
|
|
function ServerStyleSheets() {
|
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
(0, _classCallCheck2.default)(this, ServerStyleSheets);
|
|
this.options = options;
|
|
}
|
|
|
|
(0, _createClass2.default)(ServerStyleSheets, [{
|
|
key: "collect",
|
|
value: function collect(children) {
|
|
// This is needed in order to deduplicate the injection of CSS in the page.
|
|
var sheetsManager = new Map(); // This is needed in order to inject the critical CSS.
|
|
|
|
this.sheetsRegistry = new _jss.SheetsRegistry(); // A new class name generator
|
|
|
|
var generateClassName = (0, _createGenerateClassName.default)();
|
|
return /*#__PURE__*/_react.default.createElement(_StylesProvider.default, (0, _extends2.default)({
|
|
sheetsManager: sheetsManager,
|
|
serverGenerateClassName: generateClassName,
|
|
sheetsRegistry: this.sheetsRegistry
|
|
}, this.options), children);
|
|
}
|
|
}, {
|
|
key: "toString",
|
|
value: function toString() {
|
|
return this.sheetsRegistry ? this.sheetsRegistry.toString() : '';
|
|
}
|
|
}, {
|
|
key: "getStyleElement",
|
|
value: function getStyleElement(props) {
|
|
return /*#__PURE__*/_react.default.createElement('style', (0, _extends2.default)({
|
|
id: 'jss-server-side',
|
|
key: 'jss-server-side',
|
|
dangerouslySetInnerHTML: {
|
|
__html: this.toString()
|
|
}
|
|
}, props));
|
|
}
|
|
}]);
|
|
return ServerStyleSheets;
|
|
}();
|
|
|
|
exports.default = ServerStyleSheets; |