UNPKG

typestyle

Version:
80 lines (79 loc) 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var typestyle_1 = require("./internal/typestyle"); exports.TypeStyle = typestyle_1.TypeStyle; /** * All the CSS types in the 'types' namespace */ var types = require("./types"); exports.types = types; /** * Export certain utilities */ var utilities_1 = require("./internal/utilities"); exports.extend = utilities_1.extend; exports.classes = utilities_1.classes; exports.media = utilities_1.media; /** Zero configuration, default instance of TypeStyle */ var ts = new typestyle_1.TypeStyle({ autoGenerateTag: true }); /** Sets the target tag where we write the css on style updates */ exports.setStylesTarget = ts.setStylesTarget; /** * Insert `raw` CSS as a string. This is useful for e.g. * - third party CSS that you are customizing with template strings * - generating raw CSS in JavaScript * - reset libraries like normalize.css that you can use without loaders */ exports.cssRaw = ts.cssRaw; /** * Takes CSSProperties and registers it to a global selector (body, html, etc.) */ exports.cssRule = ts.cssRule; /** * Renders styles to the singleton tag imediately * NOTE: You should only call it on initial render to prevent any non CSS flash. * After that it is kept sync using `requestAnimationFrame` and we haven't noticed any bad flashes. **/ exports.forceRenderStyles = ts.forceRenderStyles; /** * Utility function to register an @font-face */ exports.fontFace = ts.fontFace; /** * Allows use to use the stylesheet in a node.js environment */ exports.getStyles = ts.getStyles; /** * Takes keyframes and returns a generated animationName */ exports.keyframes = ts.keyframes; /** * Helps with testing. Reinitializes FreeStyle + raw */ exports.reinit = ts.reinit; /** * Takes CSSProperties and return a generated className you can use on your component */ exports.style = ts.style; /** * Takes an object where property names are ideal class names and property values are CSSProperties, and * returns an object where property names are the same ideal class names and the property values are * the actual generated class names using the ideal class name as the $debugName */ exports.stylesheet = ts.stylesheet; /** * Creates a new instance of TypeStyle separate from the default instance. * * - Use this for creating a different typestyle instance for a shadow dom component. * - Use this if you don't want an auto tag generated and you just want to collect the CSS. * * NOTE: styles aren't shared between different instances. */ function createTypeStyle(target) { var instance = new typestyle_1.TypeStyle({ autoGenerateTag: false }); if (target) { instance.setStylesTarget(target); } return instance; } exports.createTypeStyle = createTypeStyle;