UNPKG

ocrmnav

Version:

DevStack - The Complete Developer Toolkit - Virtual file system, workflow automation, and more than 65+ other development tools / features in one seamless extension. Cutting down dev times never before seen.

242 lines (192 loc) 7.56 kB
"use strict"; exports.id = 117; exports.ids = [117]; exports.modules = { /***/ 1533: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /** * Contains helpers for working with vendor prefixes. * * Copied from https://github.com/postcss/postcss/commit/777c55b5d2a10605313a4972888f4f32005f5ac2 * * @namespace vendor */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ /** * Returns the vendor prefix extracted from an input string. * * @param {string} prop String with or without vendor prefix. * * @returns {string} vendor prefix or empty string * * @example * vendor.prefix('-moz-tab-size') //=> '-moz-' * vendor.prefix('tab-size') //=> '' */ prefix(prop) { const match = prop.match(/^(-\w+-)/); if (match) { return match[0] || ''; } return ''; }, /** * Returns the input string stripped of its vendor prefix. * * @param {string} prop String with or without vendor prefix. * * @returns {string} String name without vendor prefixes. * * @example * vendor.unprefixed('-moz-tab-size') //=> 'tab-size' */ unprefixed(prop) { return prop.replace(/^-\w+-/, ''); }, }); /***/ }), /***/ 1537: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ uniteSets) /* harmony export */ }); /** * Unite two or more sets * * @param {Iterable<string>[]} args * @see {@link https://github.com/microsoft/TypeScript/issues/57228|GitHub} */ function uniteSets(...args) { return new Set([...args].reduce((result, set) => [...result, ...set], [])); } /***/ }), /***/ 1613: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ eachDeclarationBlock) /* harmony export */ }); /* harmony import */ var _typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(886); /** @typedef {import('postcss').Root} Root */ /** @typedef {import('postcss').Root} Document */ /** @typedef {import('postcss').Node} PostcssNode */ /** @typedef {import('postcss').Container} PostcssContainerNode */ /** @typedef {import('postcss').Declaration} Declaration */ /** @typedef {(callbackFn: (decl: Declaration, index: number, decls: Declaration[]) => void) => void} EachDeclaration */ /** * @param {PostcssNode} node * @returns {node is PostcssContainerNode} */ function isContainerNode(node) { return (0,_typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__.isRule)(node) || (0,_typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__.isAtRule)(node) || (0,_typeGuards_mjs__WEBPACK_IMPORTED_MODULE_0__.isRoot)(node); } /** * In order to accommodate nested blocks (postcss-nested), * we need to run a shallow loop (instead of eachDecl() or eachRule(), * which loop recursively) and allow each nested block to accumulate * its own list of properties -- so that a property in a nested rule * does not conflict with the same property in the parent rule * executes a provided function once for each declaration block. * * @param {Root | Document} root - root element of file. * @param {(eachDecl: EachDeclaration) => void} callback - Function to execute for each declaration block * * @returns {void} */ function eachDeclarationBlock(root, callback) { /** * @param {PostcssNode} statement * * @returns {void} */ function each(statement) { if (!isContainerNode(statement)) return; if (statement.nodes && statement.nodes.length) { /** @type {Declaration[]} */ const decls = []; for (const node of statement.nodes) { if (node.type === 'decl') { decls.push(node); } each(node); } if (decls.length) { callback(decls.forEach.bind(decls)); } } } each(root); } /***/ }), /***/ 1616: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _utils_eachDeclarationBlock_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1613); /* harmony import */ var _utils_report_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(945); /* harmony import */ var _utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(950); /* harmony import */ var _utils_uniteSets_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1537); /* harmony import */ var _utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(873); /* harmony import */ var _utils_vendor_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1533); /* harmony import */ var _reference_properties_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(832); const ruleName = 'declaration-block-no-shorthand-property-overrides'; const messages = (0,_utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(ruleName, { rejected: (shorthand, original) => `Unexpected shorthand "${shorthand}" after "${original}"`, }); const meta = { url: 'https://stylelint.io/user-guide/rules/declaration-block-no-shorthand-property-overrides', }; /** @type {import('stylelint').CoreRules[ruleName]} */ const rule = (primary) => { return (root, result) => { const validOptions = (0,_utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_4__["default"])(result, ruleName, { actual: primary }); if (!validOptions) { return; } (0,_utils_eachDeclarationBlock_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(root, (eachDecl) => { /** @type {Map<string, string>} */ const declarations = new Map(); eachDecl((decl) => { const prop = decl.prop; const unprefixedProp = _utils_vendor_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].unprefixed(prop).toLowerCase(); const prefix = _utils_vendor_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].prefix(prop).toLowerCase(); const subProperties = /** @type {Map<string, Set<string>>} */ ( _reference_properties_mjs__WEBPACK_IMPORTED_MODULE_6__.longhandSubPropertiesOfShorthandProperties ).get(unprefixedProp); const resettables = _reference_properties_mjs__WEBPACK_IMPORTED_MODULE_6__.shorthandToResetToInitialProperty.get(unprefixedProp); const union = (0,_utils_uniteSets_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(subProperties ?? [], resettables ?? []); declarations.set(prop.toLowerCase(), prop); if (union.size === 0) return; for (const property of union) { const declaration = declarations.get(prefix + property); if (!declaration) { continue; } (0,_utils_report_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])({ ruleName, result, node: decl, message: messages.rejected, messageArgs: [prop, declaration || ''], word: prop, }); } }); }); }; }; rule.ruleName = ruleName; rule.messages = messages; rule.meta = meta; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rule); /***/ }) }; ; //# sourceMappingURL=117.extension.js.map