git.iko.soy/rowtype-yoga/purescript-fahrtwind
on main help sign in
Merge pull request #1 from rowtype-yoga/dev

New features

commit552eef86d7a9522dc99f46b8af47012d63a636ca authorMark Eibes <mark.eibes@gmail.com> dateSun 4 Dec 2022, 11:19 (4 years ago) parentba99ec798afb47
6 files changed+51−12
src/Fahrtwind.purs+1−1 src/Fahrtwind/Animation.purs+1−1 src/Fahrtwind/Style.purs+4−4 src/Fahrtwind/Style/Border.purs+10 src/Fahrtwind/Style/Color/Background.purs+14−4 src/Fahrtwind/Style/Text.purs+21−2
src/Fahrtwind.purs+1−1
@@ -8,4 +8,4 @@ module Fahrtwind
88import Fahrtwind.Animation (fadeInAndOutAnimationName, headShakeAnimationName, infiniteSpinAnimation, scaleAnimationName, spinAnimationName)
99import Fahrtwind.Layer (base, basePopper, level3, level3Popper, level4, level4Popper, level5, level5Popper, notification, notificationPopper, overlay, overlayPopper, topmost, zIndex)
1010import Fahrtwind.Style.PseudoElements (afterElement, beforeElement, content, firstLetter, firstLine, selection)
11−import Fahrtwind.Style (BlendMode(..), TailwindColor, acceptClicks, active, afterElement, alignSelfCenter, alignSelfEnd, alignSelfStart, amber, attributeValueStyle, background, background', backgroundBlendMode, backgroundImage, backgroundImage', backgroundNoRepeat, backgroundPosition, backgroundRepeat, backgroundRepeatX, backgroundRepeatY, backgroundSize, backgroundSize', beforeElement, black, blendModeToStyleProperty, block, blue, blueGray, blurredBackground, blurredBackground', border, borderBottom, borderCol, borderCol', borderLeft, borderNone, borderRight, borderSolid, borderTop, bottom, bottom', boxSizingBorderBox, boxSizingContentBox, checked, content, coolGray, cursorAuto, cursorDefault, cursorHelp, cursorMove, cursorNotAllowed, cursorPointer, cursorText, cursorWait, cyan, default, disabled, displayGrid, displayNone, divideCol, divideX, divideXReverse, divideY, divideYReverse, emerald, empty, enabled, evenChild, first, firstChild, firstLetter, firstLine, firstOfType, flex, flexCol, flexGrow, flexNoWrap, flexRow, flexShrink, flexWrap, flexWrapReverse, focus, focusWithin, fontBlack, fontBold, fontExtrabold, fontExtralight, fontFamilyOrMono, fontFamilyOrSans, fontFamilyOrSerif, fontLight, fontMedium, fontNormal, fontSemiMedium, fontSemibold, fontSize, fontSize', fontThin, fuchsia, full, fullscreen, gap, globalStyles, gray, green, height, height', heightFull, heightScreen, hover, hue, ignoreClicks, inRange, indeterminate, indigo, inlineBlock, inlineFlex, inlineGrid, invalid, invisible, isolate, isolationAuto, itemsAround, itemsBetween, itemsCenter, itemsEnd, itemsEvenly, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifySelfCenter, justifySelfEnd, justifySelfStart, justifyStart, lastChild, lastOfType, left, left', lightBlue, lightness, lime, lineHeight, lineHeight', linearGradient, linearGradientStops, linearGradientStopsString, linearGradientString, link, m', mB, mB', mL, mL', mR, mR', mT, mT', mX, mX', mXAuto, mXY, mY, mY', maxHeight, maxHeight', maxWidth, maxWidth', minHeight, minHeight', minWidth, minWidth', mixBlendMode, mkRotate, mkShadow, mkTranslate, nest, nthChild, nthOfType, oddChild, onlyChild, onlyOfType, opacity, optional, orange, outOfRange, outlineNone, overflowHidden, overflowScroll, overflowVisible, overflowXHidden, overflowXScroll, overflowYHidden, overflowYScroll, p', pB, pB', pL, pL', pR, pR', pT, pT', pX, pX', pXY, pY, pY', pink, placeholder, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionStatic, positionSticky, pseudoLeft, pseudoRight, purple, readOnly, readWrite, red, required, right, right', root, rose, rotate, rounded, rounded2xl, rounded3xl, roundedDefault, roundedFull, roundedLg, roundedMd, roundedNone, roundedSm, roundedXl, saturation, scope, screen2xl, screenHeight, screenLg, screenMd, screenSm, screenWidth, screenXl, selection, shadow, shadow', shadowDefault, shadowDefaultCol, shadowLg, shadowLgCol, shadowMd, shadowMdCol, shadowSm, shadowSmCol, shadowXl, shadowXlCol, shadowXxl, shadowXxlCol, shadows, svgBackgroundImage, target, teal, templateCols, templateRows, text2xl, text3xl, text4xl, text5xl, text6xl, text7xl, text8xl, text9xl, textBase, textCenter, textCol, textCol', textDefault, textJustify, textLeft, textLg, textOverflowEllipsis, textRight, textSized, textSm, textTransformUppercase, textXl, textXs, top, top', tracking, trackingNormal, trackingTight, trackingTighter, trackingWide, trackingWider, trackingWidest, transform, transform', transformMany, transition, transition', transitionRec, translate, trueGray, underline, userSelectNone, userSelectText, valid, variables, violet, visible, visited, warmGray, white, width, width', widthAndHeight, widthAndHeight', widthFull, widthScreen, withAlpha, withHue, withLightness, withSaturation, yellow)
11+import Fahrtwind.Style
src/Fahrtwind/Animation.purs+1−1
@@ -48,4 +48,4 @@ headShakeAnimationName =
4848 , "31.5%": E.css { transform: E.str " translateX(-3px) rotateY(-5deg)" }
4949 , "43.5%": E.css { transform: E.str " translateX(2px) rotateY(3deg)" }
5050 , "50%": E.css { transform: E.str "translateX(0)" }
51− }
51+ }
src/Fahrtwind/Style.purs+4−4
@@ -36,11 +36,11 @@ module Fahrtwind.Style
3636
3737import Fahrtwind.Style.BlendMode (backgroundBlendMode, mixBlendMode)
3838import Fahrtwind.Style.BlendMode.Types (BlendMode(..), blendModeToStyleProperty)
39−import Fahrtwind.Style.Border (border, borderBottom, borderCol, borderCol', borderLeft, borderNone, borderRight, borderSolid, borderTop, boxSizingBorderBox, boxSizingContentBox, rounded, rounded2xl, rounded3xl, roundedDefault, roundedFull, roundedLg, roundedMd, roundedNone, roundedSm, roundedXl)
39+import Fahrtwind.Style.Border (border, borderBottom, borderCol, borderCol', borderLeft, borderNone, borderRight, borderSolid, borderTop, boxSizingBorderBox, boxSizingContentBox, rounded, rounded2xl, rounded3xl, roundedDefault, roundedFull, roundedLg, roundedMd, roundedNone, roundedSm, roundedXl, borderGradient)
4040import Fahrtwind.Style.BoxModel (m', mB, mB', mL, mL', mR, mR', mT, mT', mX, mX', mXAuto, mXY, mY, mY', p', pB, pB', pL, pL', pR, pR', pT, pT', pX, pX', pXY, pY, pY')
4141import Fahrtwind.Style.BoxShadow (mkShadow, shadow, shadow', shadowDefault, shadowDefaultCol, shadowLg, shadowLgCol, shadowMd, shadowMdCol, shadowSm, shadowSmCol, shadowXl, shadowXlCol, shadowXxl, shadowXxlCol, shadows)
4242import Fahrtwind.Style.Breakpoint (screen2xl, screenLg, screenMd, screenSm, screenXl)
43−import Fahrtwind.Style.Color.Background (background, background', backgroundImage, backgroundImage', backgroundNoRepeat, backgroundPosition, backgroundRepeat, backgroundRepeatX, backgroundRepeatY, backgroundSize, backgroundSize', blurredBackground, blurredBackground', linearGradient, linearGradientStops, linearGradientStopsString, linearGradientString, svgBackgroundImage)
43+import Fahrtwind.Style.Color.Background (background, background', backgroundImage, backgroundImage', backgroundNoRepeat, backgroundPosition, backgroundRepeat, backgroundRepeatX, backgroundRepeatY, backgroundSize, backgroundSize', blurredBackground, blurredBackground', linearGradient, linearGradient', linearGradientStops, linearGradientStopsString, linearGradientString, linearGradientString', svgBackgroundImage)
4444import Fahrtwind.Style.Color.Tailwind (TailwindColor, amber, black, blue, blueGray, coolGray, cyan, emerald, fuchsia, gray, green, indigo, lightBlue, lime, orange, pink, purple, red, rose, teal, trueGray, violet, warmGray, white, yellow)
4545import Fahrtwind.Style.Color.Text (textCenter, textCol, textCol', textJustify, textLeft, textRight)
4646import Fahrtwind.Style.Color.Util (hue, lightness, saturation, withAlpha, withHue, withLightness, withSaturation)
@@ -48,7 +48,7 @@ import Fahrtwind.Style.Cursor (cursorAuto, cursorDefault, cursorHelp, cursorMove
4848import Fahrtwind.Style.Display (block, displayNone, flex, inlineBlock, inlineFlex, inlineGrid)
4949import Fahrtwind.Style.Display.Flex (alignSelfCenter, alignSelfEnd, alignSelfStart, flexCol, flexGrow, flexNoWrap, flexRow, flexShrink, flexWrap, flexWrapReverse, gap, itemsAround, itemsBetween, itemsCenter, itemsEnd, itemsEvenly, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifySelfCenter, justifySelfEnd, justifySelfStart, justifyStart)
5050import Fahrtwind.Style.Display.Grid (displayGrid, templateCols, templateRows)
51−import Fahrtwind.Style.Divide (divideCol, divideX, divideXReverse, divideY, divideYReverse)
51+import Fahrtwind.Style.Divide (divideCol, divideCol', divideX, divideXReverse, divideY, divideYReverse)
5252import Fahrtwind.Style.Global (globalStyles, nest, variables)
5353import Fahrtwind.Style.Input (outlineNone, placeholder)
5454import Fahrtwind.Style.Inset (bottom, bottom', left, left', right, right', top, top')
@@ -61,7 +61,7 @@ import Fahrtwind.Style.Position (positionAbsolute, positionFixed, positionRelati
6161import Fahrtwind.Style.PseudoClasses (active, checked, default, disabled, empty, enabled, evenChild, first, firstChild, firstOfType, focus, focusWithin, fullscreen, hover, inRange, indeterminate, invalid, lastChild, lastOfType, link, nthChild, nthOfType, oddChild, onlyChild, onlyOfType, optional, outOfRange, pseudoLeft, pseudoRight, readOnly, readWrite, required, root, scope, target, valid, visited)
6262import Fahrtwind.Style.PseudoElements (afterElement, beforeElement, content, firstLetter, firstLine, selection)
6363import Fahrtwind.Style.Size (full, height, height', heightFull, heightScreen, maxHeight, maxHeight', maxWidth, maxWidth', minHeight, minHeight', minWidth, minWidth', screenHeight, screenWidth, width, width', widthAndHeight, widthAndHeight', widthFull, widthScreen)
64−import Fahrtwind.Style.Text (fontBlack, fontBold, fontExtrabold, fontExtralight, fontFamilyOrMono, fontFamilyOrSans, fontFamilyOrSerif, fontLight, fontMedium, fontNormal, fontSemiMedium, fontSemibold, fontSize, fontSize', fontThin, lineHeight, lineHeight', text2xl, text3xl, text4xl, text5xl, text6xl, text7xl, text8xl, text9xl, textBase, textDefault, textLg, textSized, textSm, textTransformUppercase, textXl, textXs, tracking, trackingNormal, trackingTight, trackingTighter, trackingWide, trackingWider, trackingWidest, underline)
64+import Fahrtwind.Style.Text (fontBlack, fontBold, fontExtrabold, fontExtralight, fontFamilyOrMono, fontFamilyOrSans, fontFamilyOrSerif, fontLight, fontMedium, fontNormal, fontSemiMedium, fontSemibold, fontSize, fontSize', fontThin, italic, lineHeight, lineHeight', noTextDecoration, text2xl, text3xl, text4xl, text5xl, text6xl, text7xl, text8xl, text9xl, textBase, textDefault, textLg, textLinearGradient, textSized, textSm, textTransformUppercase, textXl, textXs, tracking, trackingNormal, trackingTight, trackingTighter, trackingWide, trackingWider, trackingWidest, underline)
6565import Fahrtwind.Style.Transform (mkRotate, mkTranslate, rotate, transform, transform', transformMany, translate)
6666import Fahrtwind.Style.Transition (transition, transition', transitionRec)
6767import Fahrtwind.Style.UserSelect (userSelectNone, userSelectText)
src/Fahrtwind/Style/Border.purs+10
@@ -1,6 +1,7 @@
11module Fahrtwind.Style.Border where
22
33import Prelude
4+
45import Color (Color)
56import React.Basic.Emotion (Style, StyleProperty, borderBox, color, contentBox, css, px, rem, str)
67
@@ -66,3 +67,12 @@ boxSizingBorderBox = css { boxSizing: borderBox }
6667
6768boxSizingContentBox ∷ Style
6869boxSizingContentBox = css { boxSizing: contentBox }
70+
71+borderGradient :: { backgroundGradient :: String, borderGradient :: String } -> Style
72+borderGradient args =
73+ css
74+ { background: str $
75+ args.backgroundGradient <> " padding-box, "
76+ <> (args.borderGradient <> " border-box")
77+ , borderColor: str "transparent"
78+ }
src/Fahrtwind/Style/Color/Background.purs+14−4
@@ -38,8 +38,8 @@ svgMaskImage = maskImage <<< embeddedJSX
3838embeddedJSX ∷ JSX → String
3939embeddedJSX jsx =
4040 "url('data:image/svg+xml;utf8,"
41− <> renderToStaticMarkup jsx
42− <> "')"
41+ <> renderToStaticMarkup jsx
42+ <> "')"
4343
4444backgroundPosition ∷ String → Style
4545backgroundPosition bp = css { backgroundPosition: str bp }
@@ -62,6 +62,16 @@ backgroundSize' = css <<< { backgroundSize: _ }
6262backgroundSize ∷ String → Style
6363backgroundSize = backgroundSize' <<< str
6464
65+linearGradient' :: Int -> Array String -> Style
66+linearGradient' deg colours = css { background: str (linearGradientString' deg colours) }
67+
68+linearGradientString' :: Int -> Array String -> String
69+linearGradientString' deg colours = bg
70+ where
71+ bg = "linear-gradient(" <> show deg <> "deg, "
72+ <> intercalate "," (colours)
73+ <> ")"
74+
6575linearGradient ∷ Int → Array Color → Style
6676linearGradient deg colors = css { background: str bg }
6777 where
@@ -103,8 +113,8 @@ blurredBackground col blurRadius =
103113 , blurRadius
104114 }
105115
106−blurredBackground' ∷
107− { blurredCol ∷ String, fallbackCol ∷ String, blurRadius ∷ Int } → Style
116+blurredBackground'
117+ ∷ { blurredCol ∷ String, fallbackCol ∷ String, blurRadius ∷ Int } → Style
108118blurredBackground' { blurredCol, fallbackCol, blurRadius } =
109119 css
110120 { background: str $ fallbackCol
src/Fahrtwind/Style/Text.purs+21−2
@@ -2,7 +2,8 @@ module Fahrtwind.Style.Text where
22
33import Prelude
44
5−import React.Basic.Emotion (Style, StyleProperty, css, em, int, px, rem, str)
5+import Data.Array (intercalate)
6+import React.Basic.Emotion (Style, StyleProperty, css, em, int, none, px, rem, str)
67
78textSized ∷ Number → Number → Style
89textSized fs lh = css { fontSize: fs # rem, lineHeight: lh # rem }
@@ -124,5 +125,23 @@ fontFamilyOrMono ff = css { fontFamily: str $ ff <> ", monospace" }
124125underline ∷ Style
125126underline = css { textDecoration: str "underline" }
126127
128+noTextDecoration ∷ Style
129+noTextDecoration = css { textDecoration: none }
130+
131+italic ∷ Style
132+italic = css { fontStyle: str "italic" }
133+
134+textLinearGradient :: Int -> Array String -> Style
135+textLinearGradient deg colours =
136+ css
137+ { background: str bg
138+ , backgroundClip: str "text"
139+ , textFillColor: str "transparent"
140+ }
141+ where
142+ bg = "linear-gradient(" <> show deg <> "deg, "
143+ <> intercalate "," (colours)
144+ <> ")"
145+
127146textTransformUppercase ∷ Style
128−textTransformUppercase = css { textTransform: str "uppercase" }
147+textTransformUppercase = css { textTransform: str "uppercase" }