How to use the jss.SheetsManager function in jss

To help you get started, we’ve selected a few jss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cssinjs / jss / packages / react-jss / src / createHoc.js View on Github external
get manager(): SheetsManager {
      const managers = this.context[ns.managers]

      // If `managers` map is present in the context, we use it in order to
      // let JssProvider reset them when new response has to render server-side.
      if (managers) {
        if (!managers[managerId]) {
          managers[managerId] = new SheetsManager()
        }
        return managers[managerId]
      }

      return manager
    }
github cssinjs / jss / packages / react-jss / src / utils / managers.js View on Github external
const getManager = (context: Context, managerId: number) => {
  // If `managers` map is present in the context, we use it in order to
  // let JssProvider reset them when new response has to render server-side.
  if (context.managers) {
    if (!context.managers[managerId]) {
      context.managers[managerId] = new SheetsManager()
    }
    return context.managers[managerId]
  }

  let manager = defaultManagers.get(managerId)

  if (!manager) {
    manager = new SheetsManager()
    defaultManagers.set(managerId, manager)
  }

  return manager
}
github cssinjs / jss / packages / react-jss / src / utils / managers.js View on Github external
const getManager = (context: Context, managerId: number) => {
  // If `managers` map is present in the context, we use it in order to
  // let JssProvider reset them when new response has to render server-side.
  if (context.managers) {
    if (!context.managers[managerId]) {
      context.managers[managerId] = new SheetsManager()
    }
    return context.managers[managerId]
  }

  let manager = defaultManagers.get(managerId)

  if (!manager) {
    manager = new SheetsManager()
    defaultManagers.set(managerId, manager)
  }

  return manager
}
github cssinjs / jss / packages / react-jss / src / createHoc.js View on Github external
InnerPropsType: InnerProps,
  InnerComponentType: ComponentType,
  OuterPropsType: OuterProps
>(
  stylesOrCreator: StylesOrCreator,
  InnerComponent: InnerComponentType,
  options: Options
): ComponentType {
  const isThemingEnabled = typeof stylesOrCreator === 'function'
  const {theming, inject, jss: optionsJss, ...sheetOptions} = options
  const injectMap = inject ? toMap(inject) : defaultInjectProps
  const displayName = getDisplayName(InnerComponent)
  const defaultClassNamePrefix = process.env.NODE_ENV === 'production' ? '' : `${displayName}-`
  const noTheme = {}
  const managerId = managersCounter++
  const manager = new SheetsManager()

  // $FlowFixMe: DefaultProps is missing in type definitions
  const {classes: defaultClasses = {}, ...defaultProps} = {...InnerComponent.defaultProps}

  class Jss extends Component {
    static displayName = `Jss(${displayName})`

    static InnerComponent = InnerComponent

    static contextTypes = contextTypes

    static propTypes = {
      innerRef: PropTypes.func
    }

    static defaultProps = {
github andywer / react-usestyles / packages / style-api-jss / src / index.jsx View on Github external
export function JssProvider (props) {
  const [{ jss, manager }] = useState({
    jss: create(defaultPreset()),
    manager: new SheetsManager()
  })

  const createSheet = (styles, themeID, theme, inputs) => {
    const sheetMeta = createSheetMeta(styles, themeID, inputs)
    return createUnifiedSheet(sheetMeta, jss, manager, props.registry, styles, theme, props.sheetOptions || {})
  }

  return (
    
      {props.children}
    
  )
}
github microsoft / fast-dna / packages / fast-jss-manager-angular / src / jss-instance.ts View on Github external
import JSS, { create, SheetsManager } from "jss";
import presets from "jss-preset-default";

const jss: JSS = create(presets());
const stylesheetManager: SheetsManager = new SheetsManager();

export default jss;
export { stylesheetManager };
github microsoft / fast-dna / packages / fast-viewer-react / app / utilities / style-manager.ts View on Github external
import { SheetsManager } from "jss";

const manager: any = new SheetsManager();

class Theme {
    private _background: string = "blue";
    private _width: string = "100%";

    private updateStylesheets(): void {
        manager.sheets.forEach((sheet: any) => {
            sheet.update(this);
        });
    }

    get background(): string {
        return this._background;
    }

    set background(value: string) {