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.

602 lines (469 loc) 17 kB
"use strict"; exports.id = 65; exports.ids = [65]; exports.modules = { /***/ 1521: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getRuleSelector) /* harmony export */ }); /** * @param {import('postcss').Rule} ruleNode * @returns {string} */ function getRuleSelector(ruleNode) { const raws = ruleNode.raws; return (raws.selector && raws.selector.raw) || ruleNode.selector; } /***/ }), /***/ 1524: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ hasInterpolation) /* harmony export */ }); /* harmony import */ var _hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1525); /* harmony import */ var _hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1526); /* harmony import */ var _hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1527); /* harmony import */ var _hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1528); /** * Check whether a string has interpolation * * @param {string} string * @returns {boolean} If `true`, a string has interpolation */ function hasInterpolation(string) { // SCSS or Less interpolation if ( (0,_hasLessInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(string) || (0,_hasScssInterpolation_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(string) || (0,_hasTplInterpolation_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(string) || (0,_hasPsvInterpolation_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(string) ) { return true; } return false; } /***/ }), /***/ 1525: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ hasLessInterpolation) /* harmony export */ }); const HAS_LESS_INTERPOLATION = /@\{.+?\}/; /** * Check whether a string has less interpolation * * @param {string} string * @returns {boolean} If `true`, a string has less interpolation */ function hasLessInterpolation(string) { return HAS_LESS_INTERPOLATION.test(string); } /***/ }), /***/ 1526: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ hasPsvInterpolation) /* harmony export */ }); const HAS_PSV_INTERPOLATION = /\$\(.+?\)/; /** * Check whether a string has postcss-simple-vars interpolation * * @param {string} string * @returns {boolean} */ function hasPsvInterpolation(string) { return HAS_PSV_INTERPOLATION.test(string); } /***/ }), /***/ 1527: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ hasScssInterpolation) /* harmony export */ }); const HAS_SCSS_INTERPOLATION = /#\{.+?\}/s; /** * Check whether a string has scss interpolation * * @param {string} string * @returns {boolean} */ function hasScssInterpolation(string) { return HAS_SCSS_INTERPOLATION.test(string); } /***/ }), /***/ 1528: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ hasTplInterpolation) /* harmony export */ }); const HAS_TPL_INTERPOLATION = /\{.+?\}/s; /** * Check whether a string has JS template literal interpolation or HTML-like template * * @param {string} string * @returns {boolean} If `true`, a string has template literal interpolation */ function hasTplInterpolation(string) { return HAS_TPL_INTERPOLATION.test(string); } /***/ }), /***/ 1535: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ atRuleRegexes: () => (/* binding */ atRuleRegexes), /* harmony export */ descriptorRegexes: () => (/* binding */ descriptorRegexes), /* harmony export */ functionRegexes: () => (/* binding */ functionRegexes), /* harmony export */ propertyRegexes: () => (/* binding */ propertyRegexes) /* harmony export */ }); /* harmony import */ var _reference_atKeywords_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1536); const atRuleRegexes = { mediaName: /^media$/i, keyframesName: /^(-(o|moz|ms|webkit)-)?keyframes$/i, propertyName: /^property$/i, importName: /^import$/i, unsupportedNestingNames: new RegExp( `^((?!${[..._reference_atKeywords_mjs__WEBPACK_IMPORTED_MODULE_0__.nestingSupportedAtKeywords.values()].join('|')}).)*$`, 'i', ), layerName: /^layer$/i, containerName: /^container$/i, scopeName: /^scope$/i, }; const descriptorRegexes = { syntaxName: /^syntax$/i, }; const functionRegexes = { layer: /layer\((.*?)\)/i, }; const propertyRegexes = { containerNameAndShorthandName: /^container(-name)?$/i, }; /***/ }), /***/ 1536: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ atKeywords: () => (/* binding */ atKeywords), /* harmony export */ deprecatedAtKeywords: () => (/* binding */ deprecatedAtKeywords), /* harmony export */ nestingSupportedAtKeywords: () => (/* binding */ nestingSupportedAtKeywords), /* harmony export */ pageMarginAtKeywords: () => (/* binding */ pageMarginAtKeywords) /* harmony export */ }); /* harmony import */ var _utils_uniteSets_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1537); /** @type {ReadonlySet<string>} */ const deprecatedAtKeywords = new Set(['document', 'nest', 'viewport']); /** * @see https://www.w3.org/TR/css-nesting-1/#conditionals * @type {ReadonlySet<string>} */ const nestingSupportedAtKeywords = new Set([ 'apply', 'container', 'layer', 'media', 'scope', 'starting-style', 'supports', ]); /** * @see https://www.w3.org/TR/css-page-3/#syntax-page-selector * @type {ReadonlySet<string>} */ const pageMarginAtKeywords = new Set([ 'top-left-corner', 'top-left', 'top-center', 'top-right', 'top-right-corner', 'bottom-left-corner', 'bottom-left', 'bottom-center', 'bottom-right', 'bottom-right-corner', 'left-top', 'left-middle', 'left-bottom', 'right-top', 'right-middle', 'right-bottom', ]); /** * @see https://www.w3.org/TR/css-fonts-4/#font-feature-values-font-feature-value-type * @type {ReadonlySet<string>} */ const fontFeatureValueTypes = new Set([ 'annotation', 'character-variant', 'historical-forms', 'ornaments', 'styleset', 'stylistic', 'swash', ]); /** * @see https://developer.mozilla.org/en/docs/Web/CSS/At-rule * @type {ReadonlySet<string>} */ const atKeywords = (0,_utils_uniteSets_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])( deprecatedAtKeywords, nestingSupportedAtKeywords, pageMarginAtKeywords, fontFeatureValueTypes, [ 'counter-style', 'custom-media', 'custom-selector', 'font-face', 'font-feature-values', 'font-palette-values', 'import', 'keyframes', 'namespace', 'page', 'position-try', 'property', 'scroll-timeline', 'view-transition', ], ); /***/ }), /***/ 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], [])); } /***/ }), /***/ 1568: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ isStandardSyntaxRule) /* harmony export */ }); /* harmony import */ var _isStandardSyntaxSelector_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1569); /** * Check whether a Node is a standard rule * * @param {import('postcss').Rule | import('postcss-less').Rule} rule * @returns {boolean} */ function isStandardSyntaxRule(rule) { if (rule.type !== 'rule') { return false; } // Ignore Less &:extend rule if ('extend' in rule && rule.extend) { return false; } if (!(0,_isStandardSyntaxSelector_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(rule.selector)) { return false; } return true; } /***/ }), /***/ 1569: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ isStandardSyntaxSelector) /* harmony export */ }); /* harmony import */ var _hasInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1524); /** * Check whether a selector is standard * * @param {string} selector * @returns {boolean} */ function isStandardSyntaxSelector(selector) { // SCSS or Less interpolation if ((0,_hasInterpolation_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(selector)) { return false; } // SCSS placeholder selectors if (selector.startsWith('%')) { return false; } // SCSS nested properties if (selector.endsWith(':')) { return false; } // Less :extend() if (/:extend(?:\(.*?\))?/.test(selector)) { return false; } // Less mixin with resolved nested selectors (e.g. .foo().bar or .foo(@a, @b)[bar]) if (/\.[\w-]+\(.*\).+/.test(selector)) { return false; } // Less non-outputting mixin definition (e.g. .mixin() {}) if (selector.endsWith(')') && !selector.includes(':')) { return false; } // Less Parametric mixins (e.g. .mixin(@variable: x) {}) if (/\(@.*\)$/.test(selector)) { return false; } // ERB template tags if (selector.includes('<%') || selector.includes('%>')) { return false; } // SCSS and Less comments if (selector.includes('//')) { return false; } return true; } /***/ }), /***/ 1664: /***/ ((__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_regexes_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1535); /* harmony import */ var _utils_getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1521); /* harmony import */ var _utils_getStrippedSelectorSource_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1665); /* harmony import */ var _utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1568); /* harmony import */ var _utils_parseSelector_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1698); /* harmony import */ var _utils_report_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(945); /* harmony import */ var _utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(950); /* harmony import */ var _utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(873); const ruleName = 'keyframe-block-no-duplicate-selectors'; const messages = (0,_utils_ruleMessages_mjs__WEBPACK_IMPORTED_MODULE_6__["default"])(ruleName, { rejected: (selector) => `Unexpected duplicate "${selector}"`, }); const meta = { url: 'https://stylelint.io/user-guide/rules/keyframe-block-no-duplicate-selectors', }; /** @type {import('stylelint').CoreRules[ruleName]} */ const rule = (primary) => { return (root, result) => { const validOptions = (0,_utils_validateOptions_mjs__WEBPACK_IMPORTED_MODULE_7__["default"])(result, ruleName, { actual: primary }); if (!validOptions) { return; } root.walkAtRules(_utils_regexes_mjs__WEBPACK_IMPORTED_MODULE_0__.atRuleRegexes.keyframesName, (atRuleKeyframes) => { const selectors = new Set(); atRuleKeyframes.walkRules((keyframeRule) => { if (!(0,_utils_isStandardSyntaxRule_mjs__WEBPACK_IMPORTED_MODULE_3__["default"])(keyframeRule)) { return; } (0,_utils_parseSelector_mjs__WEBPACK_IMPORTED_MODULE_4__["default"])((0,_utils_getRuleSelector_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])(keyframeRule), result, keyframeRule)?.each((selector) => { const { selector: selectorStr, index, endIndex } = (0,_utils_getStrippedSelectorSource_mjs__WEBPACK_IMPORTED_MODULE_2__["default"])(selector); const normalizedSelector = selectorStr.toLowerCase(); const isDuplicate = selectors.has(normalizedSelector); if (isDuplicate) { (0,_utils_report_mjs__WEBPACK_IMPORTED_MODULE_5__["default"])({ message: messages.rejected, messageArgs: [selectorStr], node: keyframeRule, result, ruleName, index, endIndex, }); return; } selectors.add(normalizedSelector); }); }); }); }; }; rule.ruleName = ruleName; rule.messages = messages; rule.meta = meta; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rule); /***/ }), /***/ 1665: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ getStrippedSelectorSource) /* harmony export */ }); /* harmony import */ var postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1666); const { isComment } = postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__; /** * Get the source of a selector, excluding surrounding whitespace and comments. * * @param {import('postcss-selector-parser').Selector} node * * @returns {{selector: string, index: number, endIndex: number}} */ function getStrippedSelectorSource(node) { const firstIndex = node.nodes.findIndex((x) => !isComment(x)); const lastIndex = node.nodes.findLastIndex((x) => !isComment(x)); const first = node.nodes[firstIndex]; let last = node.nodes[lastIndex]; if (!first || !last) { const selector = node.toString().trim(); const index = node.sourceIndex ?? 0; const endIndex = index + selector.length; return { selector, index, endIndex, }; } last = last.rawSpaceAfter.length ? last.clone() : last; last.rawSpaceAfter = ''; let selector = node.nodes.slice(firstIndex, lastIndex).map(String).join(''); selector += last.toString(); selector = selector.trim(); const index = first.sourceIndex ?? 0; const endIndex = index + selector.length; return { selector, index, endIndex, }; } /***/ }), /***/ 1698: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ parseSelector) /* harmony export */ }); /* harmony import */ var postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1666); /** * @param {string} selector * @param {import('stylelint').PostcssResult} result * @param {import('postcss').Node} node * @param {(root: import('postcss-selector-parser').Root) => void} [callback] - Deprecated. It will be removed in the future. * @returns {import('postcss-selector-parser').Root | undefined} */ function parseSelector(selector, result, node, callback) { if (!selector) return undefined; try { // TODO: Remove `callback` in the future. See #7647. if (callback) { // @ts-expect-error -- TS2322: Type 'string' is not assignable to type 'Root'. return postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__(callback).processSync(selector); } return postcss_selector_parser__WEBPACK_IMPORTED_MODULE_0__().astSync(selector); } catch (err) { result.warn(`Cannot parse selector (${err})`, { node, stylelintType: 'parseError' }); return undefined; } } /***/ }) }; ; //# sourceMappingURL=65.extension.js.map