worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
25
node_modules/@emotion/sheet/dist/declarations/src/index.d.ts
generated
vendored
Normal file
25
node_modules/@emotion/sheet/dist/declarations/src/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
export type Options = {
|
||||
nonce?: string;
|
||||
key: string;
|
||||
container: Node;
|
||||
speedy?: boolean;
|
||||
prepend?: boolean;
|
||||
insertionPoint?: HTMLElement;
|
||||
};
|
||||
export declare class StyleSheet {
|
||||
isSpeedy: boolean;
|
||||
ctr: number;
|
||||
tags: HTMLStyleElement[];
|
||||
container: Node;
|
||||
key: string;
|
||||
nonce: string | undefined;
|
||||
prepend: boolean | undefined;
|
||||
before: Element | null;
|
||||
insertionPoint: HTMLElement | undefined;
|
||||
private _alreadyInsertedOrderInsensitiveRule;
|
||||
constructor(options: Options);
|
||||
private _insertTag;
|
||||
hydrate(nodes: HTMLStyleElement[]): void;
|
||||
insert(rule: string): void;
|
||||
flush(): void;
|
||||
}
|
||||
2
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.d.mts
generated
vendored
Normal file
2
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./declarations/src/index.js";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1zaGVldC5janMuZC5tdHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
||||
2
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.d.ts
generated
vendored
Normal file
2
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./declarations/src/index";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1zaGVldC5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
||||
144
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.js
generated
vendored
Normal file
144
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var isDevelopment = false;
|
||||
|
||||
/*
|
||||
|
||||
Based off glamor's StyleSheet, thanks Sunil ❤️
|
||||
|
||||
high performance StyleSheet for css-in-js systems
|
||||
|
||||
- uses multiple style tags behind the scenes for millions of rules
|
||||
- uses `insertRule` for appending in production for *much* faster performance
|
||||
|
||||
// usage
|
||||
|
||||
import { StyleSheet } from '@emotion/sheet'
|
||||
|
||||
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
||||
|
||||
styleSheet.insert('#box { border: 1px solid red; }')
|
||||
- appends a css rule into the stylesheet
|
||||
|
||||
styleSheet.flush()
|
||||
- empties the stylesheet of all its contents
|
||||
|
||||
*/
|
||||
|
||||
function sheetForTag(tag) {
|
||||
if (tag.sheet) {
|
||||
return tag.sheet;
|
||||
} // this weirdness brought to you by firefox
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
||||
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
if (document.styleSheets[i].ownerNode === tag) {
|
||||
return document.styleSheets[i];
|
||||
}
|
||||
} // this function should always return with a value
|
||||
// TS can't understand it though so we make it stop complaining here
|
||||
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createStyleElement(options) {
|
||||
var tag = document.createElement('style');
|
||||
tag.setAttribute('data-emotion', options.key);
|
||||
|
||||
if (options.nonce !== undefined) {
|
||||
tag.setAttribute('nonce', options.nonce);
|
||||
}
|
||||
|
||||
tag.appendChild(document.createTextNode(''));
|
||||
tag.setAttribute('data-s', '');
|
||||
return tag;
|
||||
}
|
||||
|
||||
var StyleSheet = /*#__PURE__*/function () {
|
||||
// Using Node instead of HTMLElement since container may be a ShadowRoot
|
||||
function StyleSheet(options) {
|
||||
var _this = this;
|
||||
|
||||
this._insertTag = function (tag) {
|
||||
var before;
|
||||
|
||||
if (_this.tags.length === 0) {
|
||||
if (_this.insertionPoint) {
|
||||
before = _this.insertionPoint.nextSibling;
|
||||
} else if (_this.prepend) {
|
||||
before = _this.container.firstChild;
|
||||
} else {
|
||||
before = _this.before;
|
||||
}
|
||||
} else {
|
||||
before = _this.tags[_this.tags.length - 1].nextSibling;
|
||||
}
|
||||
|
||||
_this.container.insertBefore(tag, before);
|
||||
|
||||
_this.tags.push(tag);
|
||||
};
|
||||
|
||||
this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
||||
|
||||
this.key = options.key;
|
||||
this.container = options.container;
|
||||
this.prepend = options.prepend;
|
||||
this.insertionPoint = options.insertionPoint;
|
||||
this.before = null;
|
||||
}
|
||||
|
||||
var _proto = StyleSheet.prototype;
|
||||
|
||||
_proto.hydrate = function hydrate(nodes) {
|
||||
nodes.forEach(this._insertTag);
|
||||
};
|
||||
|
||||
_proto.insert = function insert(rule) {
|
||||
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
||||
// it's 1 in dev because we insert source maps that map a single rule to a location
|
||||
// and you can only have one source map per style tag
|
||||
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
||||
this._insertTag(createStyleElement(this));
|
||||
}
|
||||
|
||||
var tag = this.tags[this.tags.length - 1];
|
||||
|
||||
if (this.isSpeedy) {
|
||||
var sheet = sheetForTag(tag);
|
||||
|
||||
try {
|
||||
// this is the ultrafast version, works across browsers
|
||||
// the big drawback is that the css won't be editable in devtools
|
||||
sheet.insertRule(rule, sheet.cssRules.length);
|
||||
} catch (e) {
|
||||
}
|
||||
} else {
|
||||
tag.appendChild(document.createTextNode(rule));
|
||||
}
|
||||
|
||||
this.ctr++;
|
||||
};
|
||||
|
||||
_proto.flush = function flush() {
|
||||
this.tags.forEach(function (tag) {
|
||||
var _tag$parentNode;
|
||||
|
||||
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
||||
});
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
};
|
||||
|
||||
return StyleSheet;
|
||||
}();
|
||||
|
||||
exports.StyleSheet = StyleSheet;
|
||||
3
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.mjs
generated
vendored
Normal file
3
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export {
|
||||
StyleSheet
|
||||
} from "./emotion-sheet.cjs.js";
|
||||
164
node_modules/@emotion/sheet/dist/emotion-sheet.development.cjs.js
generated
vendored
Normal file
164
node_modules/@emotion/sheet/dist/emotion-sheet.development.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var isDevelopment = true;
|
||||
|
||||
/*
|
||||
|
||||
Based off glamor's StyleSheet, thanks Sunil ❤️
|
||||
|
||||
high performance StyleSheet for css-in-js systems
|
||||
|
||||
- uses multiple style tags behind the scenes for millions of rules
|
||||
- uses `insertRule` for appending in production for *much* faster performance
|
||||
|
||||
// usage
|
||||
|
||||
import { StyleSheet } from '@emotion/sheet'
|
||||
|
||||
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
||||
|
||||
styleSheet.insert('#box { border: 1px solid red; }')
|
||||
- appends a css rule into the stylesheet
|
||||
|
||||
styleSheet.flush()
|
||||
- empties the stylesheet of all its contents
|
||||
|
||||
*/
|
||||
|
||||
function sheetForTag(tag) {
|
||||
if (tag.sheet) {
|
||||
return tag.sheet;
|
||||
} // this weirdness brought to you by firefox
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
||||
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
if (document.styleSheets[i].ownerNode === tag) {
|
||||
return document.styleSheets[i];
|
||||
}
|
||||
} // this function should always return with a value
|
||||
// TS can't understand it though so we make it stop complaining here
|
||||
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createStyleElement(options) {
|
||||
var tag = document.createElement('style');
|
||||
tag.setAttribute('data-emotion', options.key);
|
||||
|
||||
if (options.nonce !== undefined) {
|
||||
tag.setAttribute('nonce', options.nonce);
|
||||
}
|
||||
|
||||
tag.appendChild(document.createTextNode(''));
|
||||
tag.setAttribute('data-s', '');
|
||||
return tag;
|
||||
}
|
||||
|
||||
var StyleSheet = /*#__PURE__*/function () {
|
||||
// Using Node instead of HTMLElement since container may be a ShadowRoot
|
||||
function StyleSheet(options) {
|
||||
var _this = this;
|
||||
|
||||
this._insertTag = function (tag) {
|
||||
var before;
|
||||
|
||||
if (_this.tags.length === 0) {
|
||||
if (_this.insertionPoint) {
|
||||
before = _this.insertionPoint.nextSibling;
|
||||
} else if (_this.prepend) {
|
||||
before = _this.container.firstChild;
|
||||
} else {
|
||||
before = _this.before;
|
||||
}
|
||||
} else {
|
||||
before = _this.tags[_this.tags.length - 1].nextSibling;
|
||||
}
|
||||
|
||||
_this.container.insertBefore(tag, before);
|
||||
|
||||
_this.tags.push(tag);
|
||||
};
|
||||
|
||||
this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
||||
|
||||
this.key = options.key;
|
||||
this.container = options.container;
|
||||
this.prepend = options.prepend;
|
||||
this.insertionPoint = options.insertionPoint;
|
||||
this.before = null;
|
||||
}
|
||||
|
||||
var _proto = StyleSheet.prototype;
|
||||
|
||||
_proto.hydrate = function hydrate(nodes) {
|
||||
nodes.forEach(this._insertTag);
|
||||
};
|
||||
|
||||
_proto.insert = function insert(rule) {
|
||||
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
||||
// it's 1 in dev because we insert source maps that map a single rule to a location
|
||||
// and you can only have one source map per style tag
|
||||
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
||||
this._insertTag(createStyleElement(this));
|
||||
}
|
||||
|
||||
var tag = this.tags[this.tags.length - 1];
|
||||
|
||||
{
|
||||
var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
|
||||
|
||||
if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
|
||||
// this would only cause problem in speedy mode
|
||||
// but we don't want enabling speedy to affect the observable behavior
|
||||
// so we report this error at all times
|
||||
console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
|
||||
}
|
||||
|
||||
this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
|
||||
}
|
||||
|
||||
if (this.isSpeedy) {
|
||||
var sheet = sheetForTag(tag);
|
||||
|
||||
try {
|
||||
// this is the ultrafast version, works across browsers
|
||||
// the big drawback is that the css won't be editable in devtools
|
||||
sheet.insertRule(rule, sheet.cssRules.length);
|
||||
} catch (e) {
|
||||
if (!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
|
||||
console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tag.appendChild(document.createTextNode(rule));
|
||||
}
|
||||
|
||||
this.ctr++;
|
||||
};
|
||||
|
||||
_proto.flush = function flush() {
|
||||
this.tags.forEach(function (tag) {
|
||||
var _tag$parentNode;
|
||||
|
||||
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
||||
});
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
|
||||
{
|
||||
this._alreadyInsertedOrderInsensitiveRule = false;
|
||||
}
|
||||
};
|
||||
|
||||
return StyleSheet;
|
||||
}();
|
||||
|
||||
exports.StyleSheet = StyleSheet;
|
||||
3
node_modules/@emotion/sheet/dist/emotion-sheet.development.cjs.mjs
generated
vendored
Normal file
3
node_modules/@emotion/sheet/dist/emotion-sheet.development.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export {
|
||||
StyleSheet
|
||||
} from "./emotion-sheet.development.cjs.js";
|
||||
160
node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js
generated
vendored
Normal file
160
node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
var isDevelopment = true;
|
||||
|
||||
/*
|
||||
|
||||
Based off glamor's StyleSheet, thanks Sunil ❤️
|
||||
|
||||
high performance StyleSheet for css-in-js systems
|
||||
|
||||
- uses multiple style tags behind the scenes for millions of rules
|
||||
- uses `insertRule` for appending in production for *much* faster performance
|
||||
|
||||
// usage
|
||||
|
||||
import { StyleSheet } from '@emotion/sheet'
|
||||
|
||||
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
||||
|
||||
styleSheet.insert('#box { border: 1px solid red; }')
|
||||
- appends a css rule into the stylesheet
|
||||
|
||||
styleSheet.flush()
|
||||
- empties the stylesheet of all its contents
|
||||
|
||||
*/
|
||||
|
||||
function sheetForTag(tag) {
|
||||
if (tag.sheet) {
|
||||
return tag.sheet;
|
||||
} // this weirdness brought to you by firefox
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
||||
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
if (document.styleSheets[i].ownerNode === tag) {
|
||||
return document.styleSheets[i];
|
||||
}
|
||||
} // this function should always return with a value
|
||||
// TS can't understand it though so we make it stop complaining here
|
||||
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createStyleElement(options) {
|
||||
var tag = document.createElement('style');
|
||||
tag.setAttribute('data-emotion', options.key);
|
||||
|
||||
if (options.nonce !== undefined) {
|
||||
tag.setAttribute('nonce', options.nonce);
|
||||
}
|
||||
|
||||
tag.appendChild(document.createTextNode(''));
|
||||
tag.setAttribute('data-s', '');
|
||||
return tag;
|
||||
}
|
||||
|
||||
var StyleSheet = /*#__PURE__*/function () {
|
||||
// Using Node instead of HTMLElement since container may be a ShadowRoot
|
||||
function StyleSheet(options) {
|
||||
var _this = this;
|
||||
|
||||
this._insertTag = function (tag) {
|
||||
var before;
|
||||
|
||||
if (_this.tags.length === 0) {
|
||||
if (_this.insertionPoint) {
|
||||
before = _this.insertionPoint.nextSibling;
|
||||
} else if (_this.prepend) {
|
||||
before = _this.container.firstChild;
|
||||
} else {
|
||||
before = _this.before;
|
||||
}
|
||||
} else {
|
||||
before = _this.tags[_this.tags.length - 1].nextSibling;
|
||||
}
|
||||
|
||||
_this.container.insertBefore(tag, before);
|
||||
|
||||
_this.tags.push(tag);
|
||||
};
|
||||
|
||||
this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
||||
|
||||
this.key = options.key;
|
||||
this.container = options.container;
|
||||
this.prepend = options.prepend;
|
||||
this.insertionPoint = options.insertionPoint;
|
||||
this.before = null;
|
||||
}
|
||||
|
||||
var _proto = StyleSheet.prototype;
|
||||
|
||||
_proto.hydrate = function hydrate(nodes) {
|
||||
nodes.forEach(this._insertTag);
|
||||
};
|
||||
|
||||
_proto.insert = function insert(rule) {
|
||||
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
||||
// it's 1 in dev because we insert source maps that map a single rule to a location
|
||||
// and you can only have one source map per style tag
|
||||
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
||||
this._insertTag(createStyleElement(this));
|
||||
}
|
||||
|
||||
var tag = this.tags[this.tags.length - 1];
|
||||
|
||||
{
|
||||
var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
|
||||
|
||||
if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
|
||||
// this would only cause problem in speedy mode
|
||||
// but we don't want enabling speedy to affect the observable behavior
|
||||
// so we report this error at all times
|
||||
console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
|
||||
}
|
||||
|
||||
this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
|
||||
}
|
||||
|
||||
if (this.isSpeedy) {
|
||||
var sheet = sheetForTag(tag);
|
||||
|
||||
try {
|
||||
// this is the ultrafast version, works across browsers
|
||||
// the big drawback is that the css won't be editable in devtools
|
||||
sheet.insertRule(rule, sheet.cssRules.length);
|
||||
} catch (e) {
|
||||
if (!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
|
||||
console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tag.appendChild(document.createTextNode(rule));
|
||||
}
|
||||
|
||||
this.ctr++;
|
||||
};
|
||||
|
||||
_proto.flush = function flush() {
|
||||
this.tags.forEach(function (tag) {
|
||||
var _tag$parentNode;
|
||||
|
||||
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
||||
});
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
|
||||
{
|
||||
this._alreadyInsertedOrderInsensitiveRule = false;
|
||||
}
|
||||
};
|
||||
|
||||
return StyleSheet;
|
||||
}();
|
||||
|
||||
export { StyleSheet };
|
||||
140
node_modules/@emotion/sheet/dist/emotion-sheet.esm.js
generated
vendored
Normal file
140
node_modules/@emotion/sheet/dist/emotion-sheet.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
var isDevelopment = false;
|
||||
|
||||
/*
|
||||
|
||||
Based off glamor's StyleSheet, thanks Sunil ❤️
|
||||
|
||||
high performance StyleSheet for css-in-js systems
|
||||
|
||||
- uses multiple style tags behind the scenes for millions of rules
|
||||
- uses `insertRule` for appending in production for *much* faster performance
|
||||
|
||||
// usage
|
||||
|
||||
import { StyleSheet } from '@emotion/sheet'
|
||||
|
||||
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
||||
|
||||
styleSheet.insert('#box { border: 1px solid red; }')
|
||||
- appends a css rule into the stylesheet
|
||||
|
||||
styleSheet.flush()
|
||||
- empties the stylesheet of all its contents
|
||||
|
||||
*/
|
||||
|
||||
function sheetForTag(tag) {
|
||||
if (tag.sheet) {
|
||||
return tag.sheet;
|
||||
} // this weirdness brought to you by firefox
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
||||
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
if (document.styleSheets[i].ownerNode === tag) {
|
||||
return document.styleSheets[i];
|
||||
}
|
||||
} // this function should always return with a value
|
||||
// TS can't understand it though so we make it stop complaining here
|
||||
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function createStyleElement(options) {
|
||||
var tag = document.createElement('style');
|
||||
tag.setAttribute('data-emotion', options.key);
|
||||
|
||||
if (options.nonce !== undefined) {
|
||||
tag.setAttribute('nonce', options.nonce);
|
||||
}
|
||||
|
||||
tag.appendChild(document.createTextNode(''));
|
||||
tag.setAttribute('data-s', '');
|
||||
return tag;
|
||||
}
|
||||
|
||||
var StyleSheet = /*#__PURE__*/function () {
|
||||
// Using Node instead of HTMLElement since container may be a ShadowRoot
|
||||
function StyleSheet(options) {
|
||||
var _this = this;
|
||||
|
||||
this._insertTag = function (tag) {
|
||||
var before;
|
||||
|
||||
if (_this.tags.length === 0) {
|
||||
if (_this.insertionPoint) {
|
||||
before = _this.insertionPoint.nextSibling;
|
||||
} else if (_this.prepend) {
|
||||
before = _this.container.firstChild;
|
||||
} else {
|
||||
before = _this.before;
|
||||
}
|
||||
} else {
|
||||
before = _this.tags[_this.tags.length - 1].nextSibling;
|
||||
}
|
||||
|
||||
_this.container.insertBefore(tag, before);
|
||||
|
||||
_this.tags.push(tag);
|
||||
};
|
||||
|
||||
this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
||||
|
||||
this.key = options.key;
|
||||
this.container = options.container;
|
||||
this.prepend = options.prepend;
|
||||
this.insertionPoint = options.insertionPoint;
|
||||
this.before = null;
|
||||
}
|
||||
|
||||
var _proto = StyleSheet.prototype;
|
||||
|
||||
_proto.hydrate = function hydrate(nodes) {
|
||||
nodes.forEach(this._insertTag);
|
||||
};
|
||||
|
||||
_proto.insert = function insert(rule) {
|
||||
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
||||
// it's 1 in dev because we insert source maps that map a single rule to a location
|
||||
// and you can only have one source map per style tag
|
||||
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
||||
this._insertTag(createStyleElement(this));
|
||||
}
|
||||
|
||||
var tag = this.tags[this.tags.length - 1];
|
||||
|
||||
if (this.isSpeedy) {
|
||||
var sheet = sheetForTag(tag);
|
||||
|
||||
try {
|
||||
// this is the ultrafast version, works across browsers
|
||||
// the big drawback is that the css won't be editable in devtools
|
||||
sheet.insertRule(rule, sheet.cssRules.length);
|
||||
} catch (e) {
|
||||
}
|
||||
} else {
|
||||
tag.appendChild(document.createTextNode(rule));
|
||||
}
|
||||
|
||||
this.ctr++;
|
||||
};
|
||||
|
||||
_proto.flush = function flush() {
|
||||
this.tags.forEach(function (tag) {
|
||||
var _tag$parentNode;
|
||||
|
||||
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
||||
});
|
||||
this.tags = [];
|
||||
this.ctr = 0;
|
||||
};
|
||||
|
||||
return StyleSheet;
|
||||
}();
|
||||
|
||||
export { StyleSheet };
|
||||
Loading…
Add table
Add a link
Reference in a new issue