1 line
101 KiB
Plaintext
1 line
101 KiB
Plaintext
|
{"version":3,"file":"emotion-react-jsx-dev-runtime.umd.min.js","sources":["../../../sheet/src/index.js","../../../../node_modules/stylis/src/Enum.js","../../../../node_modules/stylis/src/Utility.js","../../../../node_modules/stylis/src/Tokenizer.js","../../../../node_modules/stylis/src/Parser.js","../../../../node_modules/stylis/src/Serializer.js","../../../memoize/src/index.js","../../../cache/src/stylis-plugins.js","../../../cache/src/prefixer.js","../../../cache/src/index.js","../../../../node_modules/stylis/src/Middleware.js","../../src/utils.js","../../src/context.js","../../src/theming.js","../../../utils/src/index.js","../../../unitless/src/index.js","../../../serialize/src/index.js","../../../use-insertion-effect-with-fallbacks/src/index.js","../../src/emotion-element.js","../../../hash/src/index.js","../../src/jsx-dev-runtime.js"],"sourcesContent":["// @flow\n/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n\n// $FlowFixMe\nfunction sheetForTag(tag: HTMLStyleElement): CSSStyleSheet {\n if (tag.sheet) {\n // $FlowFixMe\n return tag.sheet\n }\n\n // this weirdness brought to you by firefox\n /* istanbul ignore next */\n for (let i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n // $FlowFixMe\n return document.styleSheets[i]\n }\n }\n}\n\nexport type Options = {\n nonce?: string,\n key: string,\n container: Node,\n speedy?: boolean,\n prepend?: boolean,\n insertionPoint?: HTMLElement\n}\n\nfunction createStyleElement(options: {\n key: string,\n nonce: string | void\n}): HTMLStyleElement {\n let tag = document.createElement('style')\n tag.setAttribute('data-emotion', options.key)\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce)\n }\n tag.appendChild(document.createTextNode(''))\n tag.setAttribute('data-s', '')\n return tag\n}\n\nexport class StyleSheet {\n isSpeedy: boolean\n ctr: number\n tags: HTMLStyleElement[]\n // Using Node instead of HTMLElement since container may be a ShadowRoot\n container: Node\n key: string\n nonce: string | void\n prepend: boolean | void\n before: Element | null\n insertionPoint: HTMLElement | void\n constructor(options: Options) {\n this.isSpeedy =\n options.speedy === undefined\n ? process.env.NODE_ENV === 'production'\n : options.speedy\n this.tags = []\n this.ctr = 0\n this.nonce = options.nonce\n // key is the value of the data-emotion attribute, it's used to identify different sheets\n this.key = options.key\n this.container = options.container\n this.prepend = options.prepend\n this.insertionPoint = options.insertionPoint\n this.before = null\n }\n\n _insertTag = (tag: HTMLStyleElement) => {\n let before\n if (this.tags.length === 0) {\n if (this.insertionPoint) {\n before = this.insertionPoint.nextSibling\n } else if (this.prepend) {\n before = this.container.firstChild\n } else {\n before = this.before\n }\n } else {\n before = this.tags[this.tags.length - 1].nextSibling\n }\n this.container.insertBefore(tag, before)\n this.tags.push(tag)\n }\n\n hydrate(nodes: HTMLStyleElement[]) {\n nodes.forEach(this._insertTag)\n }\n\n insert(rule: string) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ?
|