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

Function handleBgConic

packages/tailwindcss/src/utilities.ts:2824–2855  ·  packages/tailwindcss/src/utilities.ts::handleBgConic
({ negative }: { negative: boolean })

Source from the content-addressed store, hash-verified

2822 ])
2823
2824 function handleBgConic({ negative }: { negative: boolean }) {
2825 return (candidate: Extract<Candidate, { kind: class="st">'functional' }>) => {
2826 if (candidate.value?.kind === class="st">'arbitrary') {
2827 if (candidate.modifier) return
2828 let value = candidate.value.value
2829 return [
2830 decl(class="st">'--tw-gradient-position', value),
2831 decl(class="st">'background-image', `conic-gradient(var(--tw-gradient-stops,${value}))`),
2832 ]
2833 }
2834
2835 let interpolationMethod = resolveInterpolationModifier(candidate.modifier)
2836
2837 if (!candidate.value) {
2838 return [
2839 decl(class="st">'--tw-gradient-position', interpolationMethod),
2840 decl(class="st">'background-image', `conic-gradient(var(--tw-gradient-stops))`),
2841 ]
2842 }
2843
2844 let value = candidate.value.value
2845
2846 if (!isPositiveInteger(value)) return
2847
2848 value = negative ? `calc(${value}deg * -1)` : `${value}deg`
2849
2850 return [
2851 decl(class="st">'--tw-gradient-position', `from ${value} ${interpolationMethod}`),
2852 decl(class="st">'background-image', `conic-gradient(var(--tw-gradient-stops))`),
2853 ]
2854 }
2855 }
2856
2857 utilities.functional(class="st">'-bg-conic', handleBgConic({ negative: true }))
2858 utilities.functional(class="st">'bg-conic', handleBgConic({ negative: false }))

Callers 1

createUtilitiesFunction · 0.85

Calls 3

declFunction · 0.90
isPositiveIntegerFunction · 0.90

Tested by

no test coverage detected