Skip to content

Commit

Permalink
expose a whole lot of helper functions (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartveneman authored Dec 29, 2023
1 parent d795b7b commit dd058fa
Show file tree
Hide file tree
Showing 5 changed files with 430 additions and 311 deletions.
37 changes: 31 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import parse from 'css-tree/parser'
import walk from 'css-tree/walker'
import { calculate } from '@bramus/specificity/core'
import { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'
import { getCombinators, getComplexity, isAccessibility } from './selectors/utils.js'
import { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'
import { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'
import { destructure, isSystemFont } from './values/destructure-font-shorthand.js'
import { isValueKeyword } from './values/values.js'
import { analyzeAnimation } from './values/animations.js'
import { isAstVendorPrefixed } from './values/vendor-prefix.js'
import { isValuePrefixed } from './values/vendor-prefix.js'
import { ContextCollection } from './context-collection.js'
import { Collection } from './collection.js'
import { AggregateCollection } from './aggregate-collection.js'
Expand Down Expand Up @@ -284,9 +284,9 @@ export function analyze(css, options = {}) {
a11y.p(selector, node.loc)
}

let [complexity, isPrefixed] = getComplexity(node)
let complexity = getComplexity(node)

if (isPrefixed) {
if (isPrefixed(node)) {
prefixedSelectors.p(selector, node.loc)
}

Expand Down Expand Up @@ -392,7 +392,7 @@ export function analyze(css, options = {}) {
let declaration = this.declaration
let { property, important } = declaration

if (isAstVendorPrefixed(node)) {
if (isValuePrefixed(node)) {
vendorPrefixedValues.p(stringifyNode(node), node.loc)
}

Expand Down Expand Up @@ -838,4 +838,29 @@ export function compareSpecificity(a, b) {
}

return b[0] - a[0]
}
}

export {
getComplexity as selectorComplexity,
isPrefixed as isSelectorPrefixed,
isAccessibility as isAccessibilitySelector,
} from './selectors/utils.js'

export {
isSupportsBrowserhack,
isMediaBrowserhack
} from './atrules/atrules.js'

export {
isBrowserhack as isValueBrowserhack
} from './values/browserhacks.js'

export {
isHack as isPropertyHack,
} from './properties/property-utils.js'

export {
isValuePrefixed
} from './values/vendor-prefix.js'

export { hasVendorPrefix } from './vendor-prefix.js'
Loading

0 comments on commit dd058fa

Please sign in to comment.