Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
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
}
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
}
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 = {
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}
)
}
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 };
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) {