git.iko.soy/rowtype-yoga/psfp
on master help sign in
Some animations
commit982389d919c9111780ca5d5b0b128ed6a8ce1157 authorMark Eibes <mark.eibes@gmail.com> dateSat 4 Apr 2020, 20:54 (7 years ago) parent5e88c94
12 files changed+227−115
components/src/React/Basic/Helpers.purs+6 components/src/React/Basic/Hooks/Spring.purs+31−7 components/src/React/Basic/Hooks/Spring/Stories.purs+13−4 components/src/Yoga/Button/Component.purs+15−8 components/src/Yoga/Card/Component.purs+42−18 components/src/Yoga/Imposter/Component.purs+6−2 components/src/Yoga/JSS.purs+7−1 components/src/Yoga/Modal/Component.purs+98−32 components/src/Yoga/Modal/Styles.purs+4−39 components/src/Yoga/Monaco/Editor.purs+2−1 components/src/Yoga/Theme.purs+2−2 components/src/Yoga/Theme/Default.purs+1−1
components/src/React/Basic/Helpers.purs+6
@@ -1,13 +1,16 @@
11module React.Basic.Helpers where
22
3+import Data.Maybe (Maybe, fromMaybe, fromMaybe')
34import Data.Symbol (SProxy(..))
45import Justifill.Fillable (class Fillable, class FillableFields, fill)
56import Justifill.Justifiable (class Justifiable, justify)
7+import Literals.Undefined (undefined)
68import Prim.Row (class Lacks, class Nub)
79import Prim.RowList (class RowToList)
810import React.Basic (JSX)
911import React.Basic.Hooks (ReactComponent, element)
1012import Record (disjointUnion, insert)
13+import Unsafe.Coerce (unsafeCoerce)
1114
1215element_ ∷
1316 ∀ to missing missingRL thru thruRL from fromRL.
@@ -62,3 +65,6 @@ jsx x partialProps kids = element x propsWithKids
6265 partialProps
6366 )
6467 )
68+
69+orUndefined ∷ ∀ a. Maybe a -> a
70+orUndefined = fromMaybe' \_ -> unsafeCoerce undefined
components/src/React/Basic/Hooks/Spring.purs+31−7
@@ -8,7 +8,8 @@ import Effect (Effect)
88import Effect.Uncurried (EffectFn1, EffectFn3, runEffectFn1, runEffectFn3)
99import Prim.Row (class Union)
1010import React.Basic (JSX, ReactComponent, element)
11−import React.Basic.DOM (CSS, Props_div)
11+import React.Basic.DOM (CSS, Props_div, Props_span)
12+import React.Basic.DOM.SVG (Props_svg, Props_path)
1213import React.Basic.Hooks (Hook, unsafeHook)
1314import React.Basic.Hooks as React
1415
@@ -23,9 +24,9 @@ type SetSpringImpl r
2324type SetSpring r
2425 = { | r } -> Effect Unit
2526
26−foreign import useSpringImpl ∷ ∀ r props. (props -> { | r }) -> Effect { style ∷ { | r }, set ∷ SetSpringImpl r, stop ∷ StopSpring }
27+foreign import useSpringImpl ∷ ∀ r s props. (props -> { | r }) -> Effect { style ∷ { | r }, set ∷ SetSpringImpl s, stop ∷ StopSpring }
2728
28−useSpring ∷ ∀ r props. (props -> { | r }) -> Hook (UseSpring { | r }) { style ∷ { | r }, set ∷ SetSpring r, stop ∷ StopSpring }
29+useSpring ∷ ∀ r s props. (props -> { | r }) -> Hook (UseSpring { | r }) { style ∷ { | r }, set ∷ SetSpring s, stop ∷ StopSpring }
2930useSpring f = React.do
3031 res <- unsafeHook (useSpringImpl f)
3132 pure $ res { set = runEffectFn1 res.set }
@@ -41,10 +42,12 @@ useTransition ∷
4142 CSS ->
4243 Hook (UseTransition item) (Array { item ∷ Maybe item, key ∷ Maybe String, props ∷ CSS })
4344useTransition items toKey transition =
44− unsafeHook
45− ( runEffectFn3 useTransitionImpl items (toNullable toKey) transition
46− <#> map \x -> x { item = x.item # Nullable.toMaybe, key = x.key # Nullable.toMaybe }
47− )
45+ unsafeHook $ runEffectFn3 useTransitionImpl items (toNullable toKey) transition
46+ <#> map \x@{ item, key } ->
47+ x
48+ { item = item # Nullable.toMaybe
49+ , key = key # Nullable.toMaybe
50+ }
4851
4952foreign import animatedImpl ∷ ∀ attrs. String -> ReactComponent { | attrs }
5053
@@ -65,3 +68,24 @@ animatedDiv ∷
6568 { style ∷ CSS | attrs } ->
6669 JSX
6770animatedDiv = element (animatedImpl "div")
71+
72+animatedSpan ∷
73+ ∀ attrs attrs_.
74+ Union attrs attrs_ Props_span =>
75+ { style ∷ CSS | attrs } ->
76+ JSX
77+animatedSpan = element (animatedImpl "span")
78+
79+animatedSvg ∷
80+ ∀ attrs attrs_.
81+ Union attrs attrs_ Props_svg =>
82+ { style ∷ CSS | attrs } ->
83+ JSX
84+animatedSvg = element (animatedImpl "svg")
85+
86+animatedPath ∷
87+ ∀ attrs attrs_.
88+ Union attrs attrs_ Props_path =>
89+ { style ∷ CSS | attrs } ->
90+ JSX
91+animatedPath = element (animatedImpl "path")
components/src/React/Basic/Hooks/Spring/Stories.purs+13−4
@@ -16,7 +16,9 @@ import React.Basic.Hooks.Spring (animatedDiv, useSpring, useTransition)
1616import React.Basic.Hooks.UseGesture (useDrag, withDragProps)
1717import Storybook.React (Storybook, add, storiesOf)
1818import Yoga.Box.Component as Box
19+import Yoga.Box.Component as Center
1920import Yoga.Button.Component (mkButton)
21+import Yoga.Card.Component (mkCard)
2022import Yoga.Spec.Helpers (withDarkTheme)
2123import Yoga.Theme.Styles (makeStylesJSS)
2224import Yoga.Theme.Types (CSSTheme)
@@ -92,10 +94,15 @@ mkTransition = do
9294
9395mkDragAnimated ∷ Effect (ReactComponent {})
9496mkDragAnimated = do
95− box <- Box.makeComponent
96− useStyles <- makeStylesJSS $ jssClasses \t -> { div: { width: "200px", height: "200px", background: "hotpink" } }
97+ card <- mkCard
98+ useStyles <-
99+ makeStylesJSS
100+ $ jssClasses \t ->
101+ { card: { width: "200px", height: "200px" }
102+ , div: { overflow: "visible" }
103+ }
97104 component "Draggable Example" \{} -> React.do
98− { style, set } <- useSpring $ const { x: 0.0, y: 0.0 }
105+ { style, set } <- useSpring $ const { x: 0.0, y: 0.0, config: { mass: 1, tension: 210, friction: 20 } }
99106 classes <- useStyles {}
100107 mkDragProps <-
101108 useDrag \{ down, movement: mx /\ my } ->
@@ -105,7 +112,9 @@ mkDragAnimated = do
105112 [ animatedDiv
106113 ( { style: css style
107114 , className: classes.div
108− , children: [ jsx box {} [ R.text "Drag me somewhere" ] ]
115+ , children:
116+ [ jsx card { className: classes.card } [ R.text "Drag me somewhere" ]
117+ ]
109118 }
110119 `withDragProps`
111120 mkDragProps
components/src/Yoga/Button/Component.purs+15−8
@@ -1,13 +1,16 @@
11module Yoga.Button.Component where
22
33import Prelude
4−import CSS (Color, cssStringRGBA, desaturate)
4+import CSS (Color, angular, black, cssStringRGBA, deg, desaturate, pct, saturate)
5+import CSS as C
56import CSS as Color
7+import Color.Scheme.Clrs (blue)
68import Data.Array.NonEmpty as NEA
79import Data.Foldable (intercalate)
810import Data.Interpolate (i)
911import Data.Maybe (Maybe)
1012import Data.Monoid (guard)
13+import Data.Tuple.Nested ((/\))
1114import Effect (Effect)
1215import JSS (JSSClasses, JSSElem, jssClasses)
1316import React.Basic (JSX)
@@ -43,10 +46,6 @@ highlightStyles =
4346 [ withAlpha (if theme.isLight then 0.15 else 0.07) theme.backgroundColourDarker
4447 , withAlpha (if theme.isLight then 0.15 else 0.07) theme.backgroundColourLighter
4548 ]
46− , "&:active":
47− { background:
48− linearGradient "145deg" [ theme.highlightColourDark, theme.highlightColour ]
49− }
5049 , color: theme.backgroundColour
5150 }
5251 }
@@ -136,10 +135,18 @@ styles =
136135 String
137136 , background:
138137 linearGradient
139− "145deg"
140− [ theme.backgroundColourDarker
141− , theme.backgroundColourDarkest
138+ "135deg"
139+ [ withAlpha (if theme.isLight then 0.15 else 0.07) theme.backgroundColourLighter
140+ , withAlpha (if theme.isLight then 0.15 else 0.07) theme.backgroundColourDarker
142141 ]
142+ <> ","
143+ <> linearGradient
144+ "180deg"
145+ [ Color.rgba 0 0 10 0.17
146+ , Color.rgba 0 0 10 0.03
147+ , Color.rgba 0 0 10 0.067
148+ ]
149+ , color: theme.backgroundColour
143150 }
144151 , "&:disabled":
145152 { boxShadow: "0 0 0 black"
components/src/Yoga/Card/Component.purs+42−18
@@ -1,17 +1,19 @@
11module Yoga.Card.Component where
22
33import Prelude
4−import Color (cssStringRGBA, toHexString)
4+import CSS (CSS, angular, deg, desaturate, linearGradient, pct)
5+import Color (cssStringRGBA)
56import Color as Color
67import Data.Interpolate (i)
78import Data.Maybe (Maybe)
9+import Data.Tuple.Nested ((/\))
810import Effect (Effect)
911import JSS (JSSClasses, JSSElem, jssClasses)
1012import React.Basic (JSX)
11−import React.Basic.DOM as R
1213import React.Basic.Helpers (jsx)
1314import React.Basic.Hooks (ReactComponent, component)
1415import React.Basic.Hooks as React
16+import Unsafe.Coerce (unsafeCoerce)
1517import Yoga.Box.Component as Box
1618import Yoga.Helpers ((?||))
1719import Yoga.Theme.Styles (makeStylesJSS)
@@ -27,25 +29,46 @@ styles =
2729 lighten x = Color.lighten if theme.isLight then (0.5 * x) else 1.7 * x
2830
2931 darken x = Color.darken if theme.isLight then 1.0 * x else (1.2 * x)
32+
33+ normal =
34+ if theme.isLight then
35+ darken 0.03 $ theme.backgroundColour
36+ else
37+ lighten 0.015 theme.backgroundColour
38+
39+ dark =
40+ if theme.isLight then
41+ darken 0.03 normal
42+ else
43+ darken 0.05 normal
44+
45+ light =
46+ if theme.isLight then
47+ lighten 0.10 normal
48+ else
49+ lighten 0.05 normal
3050 in
3151 { card:
3252 { borderRadius: "var(--s1)"
3353 , boxShadow:
34− ( i -- bottom right
35− "var(--s1) var(--s1) var(--s2) "
36− (cssStringRGBA $ darken 0.04 theme.backgroundColour)
37− --bottom left
38− ", calc(-1 * var(--s1)) var(--s1) var(--s2) "
39− (cssStringRGBA $ darken 0.01 theme.backgroundColour)
40− --top left
41− ", calc(-1 * var(--s1)) calc(-1 * var(--s1)) var(--s2) "
42− (cssStringRGBA $ lighten 0.05 theme.backgroundColour)
43− --top right
44− ", var(--s1) calc(-1 * var(--s1)) var(--s2) "
45− (cssStringRGBA $ darken 0.02 theme.backgroundColour)
46− ) ∷
54+ i -- bottom right
55+ "var(--s-2) var(--s-2) var(--s-1) "
56+ (cssStringRGBA dark)
57+ --bottom left
58+ ", calc(-1 * var(--s-2)) var(--s-2) var(--s-1) "
59+ (cssStringRGBA normal)
60+ --top left
61+ ", calc(-1 * var(--s-2)) calc(-1 * var(--s-2)) var(--s-1) "
62+ (cssStringRGBA light)
63+ --top right
64+ ", var(--s-2) calc(-1 * var(--s-2)) var(--s-1) "
65+ (cssStringRGBA normal) ∷
4766 String
48− -- background: (i "linear-gradient(145deg," (toHexString theme.backgroundColourDarker) ", " (toHexString theme.backgroundColourLighter) ")") ∷ String
67+ , background:
68+ linearGradient (angular (-45.0 # deg))
69+ [ dark /\ (0.0 # pct)
70+ , light /\ (100.0 # pct)
71+ ]
4972 }
5073 }
5174
@@ -59,9 +82,10 @@ mkCard ∷
5982mkCard = do
6083 useStyles <- makeStylesJSS styles
6184 box <- Box.makeComponent
62− component "Card" \{ kids, className } -> React.do
85+ component "Card" \props@{ kids, className } -> React.do
6386 classes <- useStyles {}
6487 pure
6588 $ jsx box
66− { className: classes.card <> " " <> (className ?|| "") }
89+ { className: classes.card <> " " <> (className ?|| "")
90+ }
6791 kids
components/src/Yoga/Imposter/Component.purs+6−2
@@ -5,10 +5,12 @@ import Data.Array (foldMap)
55import Data.Maybe (Maybe)
66import Effect (Effect)
77import React.Basic (JSX)
8−import React.Basic.DOM as R
8+import React.Basic.DOM (CSS)
99import React.Basic.Events (EventHandler, handler_)
10+import React.Basic.Helpers (orUndefined)
1011import React.Basic.Hooks (ReactComponent, component)
1112import React.Basic.Hooks as React
13+import React.Basic.Hooks.Spring (animatedDiv)
1214import Record.Extra (pick)
1315import Yoga.Helpers (ifJustFalse, (?||))
1416import Yoga.Imposter.Styles as Style
@@ -24,6 +26,7 @@ type OptionalProps r
2426 = ( kids ∷ Array JSX
2527 , className ∷ Maybe String
2628 , onClick ∷ Maybe EventHandler
29+ , style ∷ Maybe CSS
2730 | r
2831 )
2932
@@ -33,8 +36,9 @@ makeComponent = do
3336 component "Imposter" \props@{ kids, className } -> React.do
3437 classes <- useStyles (pick props)
3538 pure
36− $ R.div
39+ $ animatedDiv
3740 { className: classes.imposter <> ifJustFalse props.breakout (" " <> classes.contain) <> foldMap (" " <> _) className
3841 , onClick: props.onClick ?|| (handler_ (pure unit))
3942 , children: kids
43+ , style: props.style # orUndefined
4044 }
components/src/Yoga/JSS.purs+7−1
@@ -1,9 +1,10 @@
11module JSS where
22
33import Prelude
4−import CSS (App(..), Color, Key(..), Keyframes(..), Path(..), Predicate(..), Refinement(..), Rule(..), Selector(..), StyleM, Value(..), cssStringRGBA, plain, predicate, runS)
4+import CSS (class Val, App(..), BackgroundImage, Color, Key(..), Keyframes(..), Path(..), Predicate(..), Refinement(..), Rule(..), Selector(..), StyleM, Value(..), cssStringRGBA, plain, predicate, runS, value)
55import Data.Foldable (foldMap)
66import Data.Int (round)
7+import Data.Newtype (un, unwrap)
78import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
89import Data.Tuple (Tuple(..))
910import Debug.Trace (spy)
@@ -98,6 +99,11 @@ instance jssAbleJssElem ∷ JSSAble p (JSSElem p) where
9899instance jssAbleColor ∷ JSSAble p Color where
99100 jss c = PrimitiveJss (coerce (cssStringRGBA c))
100101
102+instance jssAbleBackgroundImage ∷ JSSAble p BackgroundImage where
103+ jss v = PrimitiveJss (coerce (render (value v)))
104+ where
105+ render (Value val) = plain val
106+
101107instance jssAbleString ∷ JSSAble p String where
102108 jss = coerce >>> PrimitiveJss
103109
components/src/Yoga/Modal/Component.purs+98−32
@@ -3,18 +3,24 @@ module Yoga.Modal.Component where
33import Prelude
44import CSS (JustifyContentValue(..), spaceBetween)
55import Data.Foldable (foldMap)
6+import Data.Int (round, toNumber)
7+import Data.Interpolate (i)
68import Data.Maybe (Maybe)
9+import Data.Tuple.Nested ((/\))
710import Effect (Effect)
811import Foreign.Object as Obj
9−import React.Basic (JSX)
12+import Math (pi, pow, sqrt)
13+import React.Basic (JSX, fragment)
14+import React.Basic.DOM (css)
1015import React.Basic.DOM as R
1116import React.Basic.DOM.Events (stopPropagation)
1217import React.Basic.DOM.SVG as SVG
13−import React.Basic.Events (EventHandler, handler, handler_)
18+import React.Basic.Events (handler, handler_)
1419import React.Basic.Extra.Hooks.UseKeyUp (useKeyUp)
1520import React.Basic.Helpers (jsx)
16−import React.Basic.Hooks (ReactComponent, component, useEffect, useMemo, useState)
21+import React.Basic.Hooks (ReactComponent, component, element, useEffect, useState)
1722import React.Basic.Hooks as React
23+import React.Basic.Hooks.Spring (animatedPath, useSpring)
1824import Record.Extra (pick)
1925import Yoga.Box.Component as Box
2026import Yoga.Cluster.Component as Cluster
@@ -40,29 +46,48 @@ makeComponent = do
4046 box <- Box.makeComponent
4147 stack <- Stack.makeComponent
4248 cluster <- Cluster.makeComponent
49+ closeIcon <- mkCloseIcon
4350 useStyles <- makeStylesJSS Style.styles
4451 component "Modal" \props -> React.do
4552 cs <- useStyles (pick props)
4653 useKeyUp 27 $ props.onClose ?|| pure unit
54+ animationDone /\ modifyAnimationDone <- useState false
55+ overlayStyle <- useSpring $ const { opacity: 0.0 }
56+ dialogStyle <-
57+ useSpring
58+ $ const
59+ { transform: "translate3d(-50%, -50%, 0) scale3d(0.2, 0.2, 0.0)"
60+ , config: { mass: 0.8, tension: 120, friction: 14 }
61+ }
62+ useEffect unit do
63+ overlayStyle.set { opacity: 1.0 }
64+ dialogStyle.set
65+ { transform: "translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)"
66+ , onRest: modifyAnimationDone (const true)
67+ }
68+ pure mempty
4769 let
4870 darkOverlay =
4971 jsx imposter
50− { className: cs.darkOverlay <> " " <> cs.fadeIn
72+ { className: cs.darkOverlay
5173 , fixed: true
5274 , breakout: false
5375 , onClick: props.onClose ?|| mempty # handler_
76+ , style: css overlayStyle.style
5477 }
78+ []
5579
5680 dialogImposter =
5781 jsx imposter
5882 { className: cs.dialog
5983 , onClick: handler stopPropagation mempty
6084 , fixed: true
85+ , style: css dialogStyle.style
6186 }
6287
6388 dialogBox =
6489 jsx box
65− { className: cs.box <> " " <> cs.zoomIn
90+ { className: cs.box
6691 }
6792
6893 dialogBoxStack =
@@ -83,13 +108,20 @@ makeComponent = do
83108 , R.div
84109 { className: cs.closeIcon
85110 , children:
86− [ props.onClose # foldMap (closeIcon cs <<< handler_)
111+ [ props.onClose
112+ # foldMap
113+ ( \onClick ->
114+ ( element closeIcon
115+ { className: cs.closeIcon, onClick, startAnimation: animationDone }
116+ )
117+ )
87118 ]
88119 }
89120 ]
90121 pure
91− $ darkOverlay
92− [ dialogImposter
122+ $ fragment
123+ [ darkOverlay
124+ , dialogImposter
93125 [ dialogBox
94126 [ dialogBoxStack
95127 [ titleCluster [ title ]
@@ -99,27 +131,61 @@ makeComponent = do
99131 ]
100132 ]
101133
102−closeIcon ∷ ∀ a. { closeIcon ∷ String | a } -> EventHandler -> JSX
103−closeIcon classes onClick =
104− SVG.svg
105− { xmlns: "http://www.w3.org/2000/svg"
106− , viewBox: "5 0 100 105"
107− , fillRule: "evenodd"
108− , clipRule: "evenodd"
109− , strokeLinejoin: "round"
110− , strokeMiterlimit: "2"
111− , _data: Obj.singleton "testid" "close-icon-svg"
112− , onClick
113− , className: classes.closeIcon
114− , children:
115− [ SVG.g_
116− [ SVG.path
117− { d: "M101.703,36.06c2.054,-2.054 2.054,-5.388 0,-7.442l-7.441,-7.441c-2.054,-2.054 -5.388,-2.054 -7.442,0l-65.643,65.643c-2.054,2.054 -2.054,5.388 0,7.442l7.441,7.441c2.054,2.054 5.388,2.054 7.442,0l65.643,-65.643Z"
118− }
119− , SVG.path
120− { d:
121− "M86.82,101.703c2.054,2.054 5.388,2.054 7.442,0l7.441,-7.441c2.054,-2.054 2.054,-5.388 0,-7.442l-65.643,-65.643c-2.054,-2.054 -5.388,-2.054 -7.442,0l-7.441,7.441c-2.054,2.054 -2.054,5.388 0,7.442l65.643,65.643Z"
122− }
123− ]
124− ]
125− }
134+mkCloseIcon ∷
135+ Effect
136+ ( ReactComponent
137+ { className ∷ String
138+ , onClick ∷ Effect Unit
139+ , startAnimation ∷ Boolean
140+ }
141+ )
142+mkCloseIcon = do
143+ box <- Box.makeComponent
144+ component "CloseIcon" \{ className, onClick, startAnimation } -> React.do
145+ { style, set, stop } <-
146+ useSpring
147+ $ const
148+ { strokeDasharray: "0, " <> show lineLen
149+ }
150+ circleStyle <-
151+ useSpring
152+ $ const
153+ { strokeDasharray: "0," <> show circleCircumf
154+ , onRest: set { "strokeDasharray": i lineLen "," lineLen ∷ String }
155+ }
156+ useEffect startAnimation do
157+ when startAnimation $ circleStyle.set { "strokeDasharray": (i circleCircumf "," circleCircumf) ∷ String }
158+ pure mempty
159+ pure
160+ $ SVG.svg
161+ { viewBox: i "0 0 " width " " width
162+ , _data: Obj.singleton "testid" "close-icon-svg"
163+ , onClick: handler_ onClick
164+ , fill: "none"
165+ , className
166+ , children:
167+ [ animatedPath
168+ { d: i "M" padding "," padding "L" (width - padding) "," (width - padding)
169+ , style: css style
170+ }
171+ , animatedPath
172+ { d: i "M" padding "," (width - padding) ",L" (width - padding) "," padding
173+ , style: css style
174+ }
175+ , animatedPath
176+ { d: move <> line1 <> line2
177+ , style: css circleStyle.style
178+ }
179+ ]
180+ }
181+ where
182+ move = i "M " (cx - r) "," cx
183+ line1 = i " a " r "," r " 0 1,0 " (r * 2) ",0 "
184+ line2 = i " a " r "," r " 0 1,0 " (-(r * 2)) ",0 "
185+ padding = 70
186+ width = 200
187+ cx = width / 2
188+ r = round ((toNumber width * 0.8) / 2.0)
189+ circleCircumf = round $ 2.0 * pi * toNumber r
190+ aSquare = toNumber (width - (2 * padding)) `pow` 2.0
191+ lineLen = sqrt (aSquare * 2.0)
components/src/Yoga/Modal/Styles.purs+4−39
@@ -22,10 +22,6 @@ type Classes a
2222 , dialogBoxStack ∷ a
2323 , title ∷ a
2424 , titleCluster ∷ a
25− , "@keyframes zoomIn" ∷ a
26− , "@keyframes fadeIn" ∷ a
27− , zoomIn ∷ a
28− , fadeIn ∷ a
2925 )
3026
3127styles ∷ JSSClasses YogaTheme Props (Classes (JSSElem Props))
@@ -45,9 +41,10 @@ styles =
4541 boxShadow nil nil (3.5 # rem) (Color.rgba 0 0 0 0.5)
4642 borderRadius boxBorderRadius boxBorderRadius boxBorderRadius boxBorderRadius
4743 , closeIcon:
48− { fill: theme.red
49− , width: "calc(0.8em * var(--ratio))"
50− , height: "calc(0.8em * var(--ratio))"
44+ { stroke: theme.textColour
45+ , strokeWidth: "var(--s0)"
46+ , width: "var(--s1)"
47+ , height: "var(--s1)"
5148 , margin: 0
5249 , padding: 0
5350 }
@@ -59,10 +56,6 @@ styles =
5956 }
6057 , title:
6158 { textOverflow: "ellipsis"
62− -- , overflow: "hidden"
63− -- , lineHeight: "1.5rem"
64− -- , whiteSpace: "nowrap"
65− -- , height: "3rem"
6659 }
6760 , dialog:
6861 { width: "var(--measure) !important"
@@ -73,32 +66,4 @@ styles =
7366 , maxHeight:
7467 "10.0 vh !important"
7568 }
76− , "@keyframes zoomIn":
77− { "from":
78− { opacity: 0
79− , transform: "scale3d(0.1, 0.1, 0.1) translate3d(0, 100vh, 0)"
80− , "animation-timing-function": "cubic-bezier(0.55, 0.055, 0.675, 0.19)"
81− }
82− , "60%":
83− { opacity: 1
84− , transform: "scale3d(0.475, 0.475, 0.475) translate3d(0, -20vh, 0)"
85− , "animation-timing-function": "cubic-bezier(0.175, 0.885, 0.32, 1)"
86− }
87− }
88− , zoomIn:
89− { animation: "$zoomIn 0.90s ease-in"
90− , animationFillMode: "both"
91− }
92− , "@keyframes fadeIn":
93− { from:
94− { opacity: 0
95− }
96− , to:
97− { opacity: 1
98− }
99− }
100− , fadeIn:
101− { animation: "$fadeIn 0.70s"
102− , animationFillMode: "both"
103− }
10469 }
components/src/Yoga/Monaco/Editor.purs+2−1
@@ -5,6 +5,7 @@ import CSS (backgroundColor, borderBox, boxSizing, margin, pct, toHexString, uni
55import CSS.Overflow (hidden, overflowY)
66import Control.Promise (Promise)
77import Control.Promise as Promise
8+import Data.Array.NonEmpty as NEA
89import Data.Foldable (for_)
910import Data.Maybe (Maybe(..), maybe)
1011import Data.Nullable (Nullable)
@@ -131,7 +132,7 @@ mkEditor = do
131132 , height
132133 , options:
133134 unsafeToForeign
134− { fontFamily: theme.codeFontFamily
135+ { fontFamily: NEA.head theme.codeFontFamily
135136 , fontLigatures: true
136137 , fontSize: "12pt"
137138 , lineNumbers: "off"
components/src/Yoga/Theme.purs+2−2
@@ -1,7 +1,7 @@
11module Yoga.Theme where
22
33import Prelude
4−import CSS (CSSVariable, Size, contrast, darken, isLight, lighten, reference, rotateHue, unitless, variable, (!*))
4+import CSS (CSSVariable, Size, contrast, darken, desaturate, isLight, lighten, reference, rotateHue, unitless, variable, (!*))
55import CSS.Size (Calc, (!/))
66import Color (Color)
77import Color as Color
@@ -74,7 +74,7 @@ fromTheme theme =
7474 -- highlight
7575
7676 >>> RB.insert (f ∷ _ "highlightColourDark")
77− (theme.highlightColour # darken 0.2 # rotateHue (-10.0))
77+ (theme.highlightColour # darken 0.2 # desaturate 0.35)
7878 >>> RB.insert (f ∷ _ "highlightColourRotatedForwards")
7979 (theme.highlightColour # rotateHue (20.0))
8080 >>> RB.insert (f ∷ _ "highlightColourRotatedBackwards")
components/src/Yoga/Theme/Default.purs+1−1
@@ -19,7 +19,7 @@ darkTheme =
1919 { backgroundColour: Color.hsl 228.0 0.12 0.20
2020 , textColour: Color.hsl 225.0 0.28 0.90
2121 , interfaceColour: Color.hsl 225.0 0.48 0.12
22− , highlightColour: Color.hsl 350.0 0.50 0.67
22+ , highlightColour: Color.hsl 300.0 0.58 0.77
2323 -- , highlightColour: Color.hsl 33.0 0.37 0.8
2424 , altHighlightColour: Color.hsl 84.0 0.617 0.631
2525 , textFontFamily: cons' "Rubik" systemFontStack