MCPcopy
hub / github.com/cssinjs/jss / createStyleSheet

Function createStyleSheet

packages/react-jss/src/utils/sheets.js:51–76  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

49}
50
51export const createStyleSheet = (options) => {
52 if (options.context.disableStylesGeneration) {
53 return undefined
54 }
55
56 const manager = getManager(options.context, options.index)
57 const existingSheet = manager.get(options.theme)
58
59 if (existingSheet) {
60 return existingSheet
61 }
62
63 const jss = options.context.jss || defaultJss
64 const styles = getStyles(options)
65 const dynamicStyles = getDynamicStyles(styles)
66 const sheet = jss.createStyleSheet(styles, getSheetOptions(options, dynamicStyles !== null))
67
68 addMeta(sheet, {
69 dynamicStyles,
70 styles
71 })
72
73 manager.add(options.theme, sheet)
74
75 return sheet
76}
77
78export const removeDynamicRules = (sheet, rules) => {
79 // Loop over each dynamic rule and remove the dynamic rule

Callers 1

createUseStylesFunction · 0.90

Calls 8

getManagerFunction · 0.90
getDynamicStylesFunction · 0.90
addMetaFunction · 0.90
getStylesFunction · 0.85
getSheetOptionsFunction · 0.85
getMethod · 0.65
createStyleSheetMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…