MCPcopy
hub / github.com/tailwindlabs/tailwindcss / set

Method set

packages/tailwindcss/src/variants.ts:281–313  ·  view source on GitHub ↗
(
    name: string,
    {
      kind,
      applyFn,
      compounds,
      compoundsWith,
      order,
    }: {
      kind: T
      applyFn: VariantFn<T>
      compoundsWith: Compounds
      compounds: Compounds
      order?: number
    },
  )

Source from the content-addressed store, hash-verified

279 }
280
281 private set<T extends Variant['kind']>(
282 name: string,
283 {
284 kind,
285 applyFn,
286 compounds,
287 compoundsWith,
288 order,
289 }: {
290 kind: T
291 applyFn: VariantFn<T>
292 compoundsWith: Compounds
293 compounds: Compounds
294 order?: number
295 },
296 ) {
297 let existing = this.variants.get(name)
298 if (existing) {
299 Object.assign(existing, { kind, applyFn, compounds })
300 } else {
301 if (order === undefined) {
302 this.lastOrder = this.nextOrder()
303 order = this.lastOrder
304 }
305 this.variants.set(name, {
306 kind,
307 applyFn,
308 order,
309 compoundsWith,
310 compounds,
311 })
312 }
313 }
314
315 private nextOrder() {
316 return this.groupOrder ?? this.lastOrder + 1

Callers 15

staticMethod · 0.95
functionalMethod · 0.95
compoundMethod · 0.95
reportMethod · 0.80
sortFractionsLastFunction · 0.80
getClassOrderFunction · 0.80
parseCssFunction · 0.80
addMethod · 0.80
namespaceMethod · 0.80
suggestMethod · 0.80
createCssUtilityFunction · 0.80
groupMethod · 0.80

Calls 2

nextOrderMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected