Skip to content

Commit

Permalink
expose a whole lot of helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Veneman committed Dec 14, 2023
1 parent d937b4b commit 05b7f39
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 399 deletions.
39 changes: 32 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ 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'
import { strEquals, startsWith, endsWith } from './string-utils.js'
import { hasVendorPrefix } from './vendor-prefix.js'
import { isCustom, isHack, isProperty } from './properties/property-utils.js'
import { getEmbedType } from './stylesheet/stylesheet.js'
import { isIe9Hack } from './values/browserhacks.js'
import { isIe9Hack, isBrowserhack } from './values/browserhacks.js'
import {
Atrule,
Selector,
Expand Down Expand Up @@ -279,9 +279,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 @@ -387,7 +387,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 @@ -833,4 +833,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 05b7f39

Please sign in to comment.