package/LICENSE000644 0000002114 3560116604 010263 0ustar00000000 000000 Copyright (C) 2018 by Marijn Haverbeke and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. package/dist/style-mod.cjs000644 0000015261 3560116604 012646 0ustar00000000 000000 var C = "\u037c" var COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C) var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet") var top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {} // :: - Style modules encapsulate a set of CSS rules defined from // JavaScript. Their definitions are only available in a given DOM // root after it has been _mounted_ there with `StyleModule.mount`. // // Style modules should be created once and stored somewhere, as // opposed to re-creating them every time you need them. The amount of // CSS rules generated for a given DOM root is bounded by the amount // of style modules that were used. So to avoid leaking rules, don't // create these dynamically, but treat them as one-time allocations. var StyleModule = exports.StyleModule = function StyleModule(spec, options) { this.rules = [] var ref = options || {}; var finish = ref.finish; function splitSelector(selector) { return /^@/.test(selector) ? [selector] : selector.split(/,\s*/) } function render(selectors, spec, target, isKeyframes) { var local = [], isAt = /^@(\w+)\b/.exec(selectors[0]), keyframes = isAt && isAt[1] == "keyframes" if (isAt && spec == null) { return target.push(selectors[0] + ";") } for (var prop in spec) { var value = spec[prop] if (/&/.test(prop)) { render(prop.split(/,\s*/).map(function (part) { return selectors.map(function (sel) { return part.replace(/&/, sel); }); }).reduce(function (a, b) { return a.concat(b); }), value, target) } else if (value && typeof value == "object") { if (!isAt) { throw new RangeError("The value of a property (" + prop + ") should be a primitive value.") } render(splitSelector(prop), value, local, keyframes) } else if (value != null) { local.push(prop.replace(/_.*/, "").replace(/[A-Z]/g, function (l) { return "-" + l.toLowerCase(); }) + ": " + value + ";") } } if (local.length || keyframes) { target.push((finish && !isAt && !isKeyframes ? selectors.map(finish) : selectors).join(", ") + " {" + local.join(" ") + "}") } } for (var prop in spec) { render(splitSelector(prop), spec[prop], this.rules) } }; // :: () → string // Returns a string containing the module's CSS rules. StyleModule.prototype.getRules = function getRules () { return this.rules.join("\n") }; // :: () → string // Generate a new unique CSS class name. StyleModule.newName = function newName () { var id = top[COUNT] || 1 top[COUNT] = id + 1 return C + id.toString(36) }; // :: (union, union<[StyleModule], StyleModule>, ?{nonce: ?string}) // // Mount the given set of modules in the given DOM root, which ensures // that the CSS rules defined by the module are available in that // context. // // Rules are only added to the document once per root. // // Rule order will follow the order of the modules, so that rules from // modules later in the array take precedence of those from earlier // modules. If you call this function multiple times for the same root // in a way that changes the order of already mounted modules, the old // order will be changed. // // If a Content Security Policy nonce is provided, it is added to // the `