MCPcopy Create free account
hub / github.com/chakra-ui/panda / getResolvedSelectors

Function getResolvedSelectors

packages/core/src/stringify.ts:200–224  ·  view source on GitHub ↗
(
  /** Parent selectors (e.g. `["a", "button"]`). */
  parentSelectors: string[],
  /** Nested selectors (e.g. `["&:hover", "&:focus"]`). */
  nestedSelectors: string[],
)

Source from the content-addressed store, hash-verified

198 *
199 */
200const getResolvedSelectors = (
201 /** Parent selectors (e.g. `["a", "button"]`). */
202 parentSelectors: string[],
203 /** Nested selectors (e.g. `["&:hover", "&:focus"]`). */
204 nestedSelectors: string[],
205) => {
206 const resolved = [] as string[]
207
208 parentSelectors.forEach((parentSelector) => {
209 resolved.push(
210 ...nestedSelectors.map((selector) => {
211 if (!selector.includes('&')) return parentSelector + ' ' + selector
212
213 return selector.replace(
214 parentSelectorRegex,
215 descendantSelectorRegex.test(parentSelector) && surroundedRegex.test(selector)
216 ? `:is(${parentSelector})`
217 : parentSelector,
218 )
219 }),
220 )
221 })
222
223 return resolved
224}

Callers 1

parseFunction · 0.85

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected