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

Function handleBgConic

packages/tailwindcss/src/utilities.ts:2824–2855  ·  view source on GitHub ↗
({ 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: 'functional' }>) => {
2826 if (candidate.value?.kind === 'arbitrary') {
2827 if (candidate.modifier) return
2828 let value = candidate.value.value
2829 return [
2830 decl('--tw-gradient-position', value),
2831 decl('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('--tw-gradient-position', interpolationMethod),
2840 decl('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('--tw-gradient-position', `from ${value} ${interpolationMethod}`),
2852 decl('background-image', `conic-gradient(var(--tw-gradient-stops))`),
2853 ]
2854 }
2855 }
2856
2857 utilities.functional('-bg-conic', handleBgConic({ negative: true }))
2858 utilities.functional('bg-conic', handleBgConic({ negative: false }))

Callers 1

createUtilitiesFunction · 0.85

Calls 3

declFunction · 0.90
isPositiveIntegerFunction · 0.90

Tested by

no test coverage detected