Repository URL to install this package:
|
Version:
1.2.1 ▾
|
@skava/modules
/
___dist
/
view-container
/
styles
/
styled-components
/
src
/
constructors
/
keyframes.js
|
|---|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _index = require("../../../../../chain-able/index.js");
var _StyleSheet = _interopRequireDefault(require("../models/StyleSheet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// @flow
// @todo - dedupe
const replaceWhitespace = str => str.replace(/\s|\\n/g, '');
var _default = (nameGenerator, stringifyRules, css) => (...arr) => {
const styleSheet = _StyleSheet.default.master;
const rules = css(...arr);
const name = nameGenerator((0, _index.fliphash)(replaceWhitespace(JSON.stringify(rules))));
const id = `sc-keyframes-${name}`;
if (!styleSheet.hasNameForId(id, name)) {
styleSheet.inject(id, stringifyRules(rules, name, '@keyframes'), name);
}
return name;
};
exports.default = _default;