@@ -1,393 +1,19 @@
11module Framer.Motion
2− ( animate
3− , makeVariantLabels
4− , WhileTap
5− , whileTap
6− , callback
7− , class EffectFnMaker
8− , toEffectFn
9− , OnHoverStart
10− , span
11− , onHoverStart
12− , LayoutId
13− , layoutId
14− , customProp
15− , OnHoverEnd
16− , onHoverEnd
17− , whileHover
18− , WhileHover
19− , EventInfo
20− , OnTap
21− , TapInfo
22− , OnTapStart
23− , OnTapEnd
24− , onTapStart
25− , onTapEnd
26− , onTapCancel
27− , onTap
28− , OnTapCancel
29− , TargetAndTransition
30− , MakeVariantLabel
31− , div
32− , h1
33− , variantsFromObject
34− , custom
35− , Exit
36− , exit
37− , MotionProps
38− , initial
39− , MotionPropsF
40− , prop
41− , Drag
42− , DragMomentum
43− , button
44− , dragMomentum
45− , DragPropagation
46− , DragElastic
47− , dragElastic
48− , dragPropagation
49− , drag
50− , Transition
51− , transition
52− , Initial
53− , BoundingBox2D
54− , boundingBox2D
55− , dragConstraints
56− , (>>)
57− , variants
58− , Animate
59− , Infinity
60− , infinity
61− , VariantLabel
62− , Variants
63− , layout
64− , Layout
65− , AnimationControls
2+ ( motion
663 , withMotion
67− , motion
68− , animateSharedLayout
69− , AnimateSharedLayoutProps
70− , AnimateSharedLayoutType
71− , OnDragEnd
72− , onDragEnd
73− , OnDragStart
74− , onDragStart
75− , OnDrag
76− , onDrag
77− , PanInfo
78− , Point2D
79− , switch
80− , crossfade
81− , AnimatePresenceProps
82− , DragConstraints
834 , animatePresence
84− , svg
85− , path
86− , rect
5+ , animateSharedLayout
6+ , module Framer.Motion.Types
7+ , module Framer.Motion.MotionComponent
878 ) where
889
89−import Prelude
90−import Data.Nullable (Nullable)
91−import Data.Symbol (class IsSymbol, SProxy, reflectSymbol)
92−import Effect (Effect)
93−import Effect.Uncurried (EffectFn1, EffectFn2, mkEffectFn1, mkEffectFn2)
94−import Foreign (Foreign, unsafeToForeign)
95−import Foreign.Object (Object)
96−import Heterogeneous.Mapping (class HMapWithIndex, class MappingWithIndex, hmapWithIndex)
97−import Literals.Undefined (Undefined)
10+import Prelude hiding (div, map, sub)
11+import Framer.Motion.Types (class EffectFnMaker, Animate, AnimatePresenceProps, AnimateSharedLayoutProps, AnimateSharedLayoutType(..), AnimationControls, BoundingBox2D, Drag, DragConstraints, DragElastic, DragMomentum, DragPropagation, EventInfo, Exit, Infinity, Initial, Layout, LayoutId, LayoutTransition, MakeVariantLabel(..), MotionProps, MotionPropsF, OnDrag, OnDragEnd, OnDragStart, OnHoverEnd, OnHoverStart, OnTap, OnTapCancel, OnTapEnd, OnTapStart, PanInfo, Point2D, TapInfo, Target(..), TargetAndTransition, Transition, VariantLabel(..), Variants, WhileHover, WhileTap, animate, boundingBox2D, callback, crossfade, customProp, drag, dragConstraints, dragElastic, dragMomentum, dragPropagation, exit, infinity, initial, layout, layoutId, makeVariantLabels, onDrag, onDragEnd, onDragStart, onHoverEnd, onHoverStart, onTap, onTapCancel, onTapEnd, onTapStart, prop, switch, toEffectFn, transition, variants, variantsFromObject, whileHover, whileTap)
9812import Prim.Row (class Nub, class Union)
99−import React.Basic (JSX, ReactComponent)
100−import React.Basic.DOM (CSS, Props_button, Props_div, Props_h1, Props_span, css)
101−import React.Basic.DOM.Internal (SharedSVGProps)
102−import React.Basic.DOM.SVG (Props_svg, Props_rect, Props_path)
103−import React.Basic.Events (EventHandler)
104−import React.Basic.Hooks (Ref)
13+import React.Basic (ReactComponent)
10514import Record (disjointUnion)
106−import Type.Row (type (+))
107−import Unsafe.Coerce (unsafeCoerce)
10815import Untagged.Castable (class Castable, cast)
109−import Untagged.Union (type (|+|))
110−import Web.DOM (Node)
111−import Web.Event.Internal.Types (Event)
112−import Web.UIEvent.MouseEvent (MouseEvent)
113−import Yoga.Block.Internal (Id)
114−
115−foreign import divImpl ∷ ∀ a. ReactComponent { | a }
116−
117−foreign import spanImpl ∷ ∀ a. ReactComponent { | a }
118−
119−foreign import buttonImpl ∷ ∀ a. ReactComponent { | a }
120−
121−foreign import h1Impl ∷ ∀ a. ReactComponent { | a }
122−
123−foreign import svgImpl ∷ ∀ a. ReactComponent { | a }
124−
125−foreign import pathImpl ∷ ∀ a. ReactComponent { | a }
126−
127−foreign import rectImpl ∷ ∀ a. ReactComponent { | a }
128−
129−type Transition =
130− CSS |+| Undefined
131−
132−newtype VariantLabel = VariantLabel String
133−
134−data Target
135− = Target
136−
137−type Exit =
138− CSS |+| VariantLabel |+| Array VariantLabel |+| Undefined
139−
140−foreign import data AnimationControls ∷ Type
141−
142−prop ∷ ∀ a b. Castable a b => a -> b
143−prop = cast
144−
145−type Animate =
146− CSS
147− |+| VariantLabel
148− |+| Array VariantLabel
149− |+| AnimationControls
150− |+| Undefined
151−
152−type Initial =
153− Boolean |+| CSS |+| VariantLabel |+| Array VariantLabel |+| Undefined
154−
155−type Layout =
156− Boolean |+| Undefined
157−
158−type Variants =
159− CSS |+| Undefined
160−
161−type LayoutTransition =
162− Boolean |+| Undefined
163−
164−type Drag =
165− Boolean |+| String |+| Undefined
166−
167−type DragMomentum =
168− Boolean |+| Undefined
169−
170−dragMomentum ∷ ∀ c. Castable c DragMomentum => c -> DragMomentum
171−dragMomentum = cast
172−
173−type DragConstraints =
174− Ref (Nullable Node) |+| BoundingBox2D |+| Undefined
175−
176−type DragElastic =
177− Boolean |+| Number |+| Undefined
178−
179−dragElastic ∷ ∀ c. Castable c DragElastic => c -> DragElastic
180−dragElastic = cast
181−
182−type BoundingBox2D =
183− { left ∷ Int |+| Number |+| Undefined
184− , right ∷ Int |+| Number |+| Undefined
185− , top ∷ Int |+| Number |+| Undefined
186− , bottom ∷ Int |+| Number |+| Undefined
187− }
188−
189−boundingBox2D ∷ ∀ c. Castable c BoundingBox2D => c -> BoundingBox2D
190−boundingBox2D = cast
191−
192−type Point2D =
193− { x ∷ Number, y ∷ Number }
194−
195−type PanInfo =
196− { point ∷ Point2D, delta ∷ Point2D, offset ∷ Point2D, velocity ∷ Point2D }
197−
198−type OnDragStart =
199− (EffectFn2 Event PanInfo Unit |+| Undefined)
200−
201−type OnDragEnd =
202− (EffectFn2 Event PanInfo Unit |+| Undefined)
203−
204−type OnDrag =
205− (EffectFn2 Event PanInfo Unit |+| Undefined)
206−
207−type WhileTap =
208− TargetAndTransition |+| String |+| Undefined
209−
210−type OnTap =
211− (EffectFn2 Event TapInfo Unit |+| Undefined)
212−
213−type OnTapStart =
214− (EffectFn2 Event TapInfo Unit |+| Undefined)
215−
216−type OnTapEnd =
217− (EffectFn2 Event TapInfo Unit |+| Undefined)
218−
219−type OnTapCancel =
220− (EffectFn2 Event TapInfo Unit |+| Undefined)
221−
222−onTapStart ∷ (Event -> TapInfo -> Effect Unit) -> OnTapStart
223−onTapStart = cast <<< toEffectFn
224−
225−onTapEnd ∷ (Event -> TapInfo -> Effect Unit) -> OnTapEnd
226−onTapEnd = cast <<< toEffectFn
227−
228−onTap ∷ (Event -> TapInfo -> Effect Unit) -> OnTap
229−onTap fn2 = cast (mkEffectFn2 fn2)
230−
231−onTapCancel ∷ (Event -> TapInfo -> Effect Unit) -> OnTap
232−onTapCancel fn2 = cast (mkEffectFn2 fn2)
233−
234−type EventInfo =
235− { point ∷ { x ∷ Number, y ∷ Number }
236− }
237−
238−type WhileHover =
239− (EffectFn2 MouseEvent EventInfo Unit |+| Undefined)
240−
241−type OnHoverEnd =
242− (EffectFn2 MouseEvent EventInfo Unit |+| Undefined)
243−
244−type OnHoverStart =
245− (EffectFn2 MouseEvent EventInfo Unit |+| Undefined)
246−
247−onHoverStart ∷ (MouseEvent -> EventInfo -> Effect Unit) -> OnHoverStart
248−onHoverStart = cast <<< toEffectFn
249−
250−onHoverEnd ∷ (MouseEvent -> EventInfo -> Effect Unit) -> OnHoverEnd
251−onHoverEnd = cast <<< toEffectFn
252−
253−whileHover ∷ ∀ c. Castable c WhileHover => c -> WhileHover
254−whileHover = cast
255−
256−type TapInfo =
257− { x ∷ Number, y ∷ Number }
258−
259−-- Can contain "transition" and "transitionEnd"
260−type TargetAndTransition =
261− CSS
262−
263−type DragPropagation =
264− Boolean |+| Undefined
265−
266−whileTap ∷ ∀ c. Castable c WhileTap => c -> WhileTap
267−whileTap = cast
268−
269−class EffectFnMaker fn effectFn | fn -> effectFn where
270− toEffectFn ∷ fn -> effectFn
271−
272−instance callbackableEffectFn2 ∷ EffectFnMaker (a -> b -> Effect c) (EffectFn2 a b c) where
273− toEffectFn = mkEffectFn2
274−
275−instance callbackableEffectFn1 ∷ EffectFnMaker (a -> Effect b) (EffectFn1 a b) where
276− toEffectFn = mkEffectFn1
277−
278−callback ∷ ∀ a c f. Castable c a => EffectFnMaker f c => f -> a
279−callback = cast <<< toEffectFn
280−
281−onDragStart ∷ (Event -> PanInfo -> Effect Unit) -> OnDragStart
282−onDragStart = cast <<< toEffectFn
283−
284−onDragEnd ∷ (Event -> PanInfo -> Effect Unit) -> OnDragEnd
285−onDragEnd = cast <<< toEffectFn
286−
287−onDrag ∷ (Event -> PanInfo -> Effect Unit) -> OnDrag
288−onDrag fn2 = cast (mkEffectFn2 fn2)
289−
290−customProp ∷ ∀ a. a -> Foreign
291−customProp = unsafeToForeign
292−
293−type LayoutId =
294− String |+| Undefined
295−
296−layoutId ∷ ∀ a. Castable a LayoutId => a -> LayoutId
297−layoutId = cast
298−
299−type MotionPropsF f r =
300− ( initial ∷ f Initial
301− , animate ∷ f Animate
302− , custom ∷ f Foreign
303− , drag ∷ f Drag
304− , dragMomentum ∷ f DragMomentum
305− , dragElastic ∷ f DragElastic
306− , onDragStart ∷ f OnDragStart
307− , onDrag ∷ f OnDrag
308− , onDragEnd ∷ f OnDragEnd
309− , dragConstraints ∷ f DragConstraints
310− , dragPropagation ∷ f DragPropagation
311− , variants ∷ f Variants
312− , transition ∷ f Transition
313− , layout ∷ f Layout
314− , layoutId ∷ f LayoutId
315− , whileTap ∷ f WhileTap
316− , onTap ∷ f OnTap
317− , onTapStart ∷ f OnTapStart
318− , onTapEnd ∷ f OnTapEnd
319− , onTapCancel ∷ f OnTapCancel
320− , whileHover ∷ f WhileHover
321− , onHoverStart ∷ f OnHoverStart
322− , onHoverEnd ∷ f OnHoverEnd
323− , exit ∷ f Exit
324− | r
325− )
326−
327−type MotionProps r =
328− MotionPropsF Id r
329−
330−animate ∷ ∀ a. Castable a Animate => a -> Animate
331−animate = cast
332−
333−initial ∷ ∀ a. Castable a Initial => a -> Initial
334−initial = cast
335−
336−transition ∷ ∀ r. { | r } -> Transition
337−transition = cast <<< css
338−
339−drag ∷ ∀ a. Castable a Drag => a -> Drag
340−drag = cast
341−
342−dragConstraints ∷ ∀ a. Castable a BoundingBox2D => a -> DragConstraints
343−dragConstraints x = cast ((cast x) ∷ BoundingBox2D)
344−
345−dragPropagation ∷ ∀ a. Castable a DragPropagation => a -> DragPropagation
346−dragPropagation = cast
347−
348−exit ∷ ∀ a. Castable a Exit => a -> Exit
349−exit = cast
350−
351−variants ∷ ∀ r. { | r } -> Variants
352−variants = cast <<< css
353−
354−variantsFromObject ∷ ∀ o. Object o -> Variants
355−variantsFromObject = cast <<< (unsafeCoerce ∷ _ -> CSS)
356−
357−layout ∷ ∀ a. Castable a Layout => a -> Layout
358−layout = cast
359−
360−data MakeVariantLabel
361− = MakeVariantLabel
362−
363−instance makeVariantLabels' ∷
364− (IsSymbol sym) =>
365− MappingWithIndex MakeVariantLabel (SProxy sym) a VariantLabel where
366− mappingWithIndex MakeVariantLabel prop' _ = VariantLabel (reflectSymbol prop')
367−
368−makeVariantLabels ∷ ∀ a b. HMapWithIndex MakeVariantLabel a b => a -> b
369−makeVariantLabels = hmapWithIndex MakeVariantLabel
370−
371−div ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + Props_div) => ReactComponent { | attrs }
372−div = divImpl
373−
374−span ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + Props_span) => ReactComponent { | attrs }
375−span = spanImpl
376−
377−button ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + Props_button) => ReactComponent { | attrs }
378−button = buttonImpl
379−
380−svg ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + (SharedSVGProps Props_svg)) => ReactComponent { | attrs }
381−svg = svgImpl
382−
383−path ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + (SharedSVGProps Props_path)) => ReactComponent { | attrs }
384−path = pathImpl
385−
386−rect ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + (SharedSVGProps Props_rect)) => ReactComponent { | attrs }
387−rect = rectImpl
388−
389−h1 ∷ ∀ attrs attrs_. Union attrs attrs_ (MotionProps + Props_h1) => ReactComponent { | attrs }
390−h1 = h1Impl
16+import Framer.Motion.MotionComponent (_data, abbr, address, area, article, aside, audio, b, base, bdi, bdo, blockquote, body, br, button, canvas, caption, circle, cite, clipPath, code, col, colgroup, custom, datalist, dd, defs, del, desc, details, dfn, dialog, div, dl, dt, ellipse, em, embed, feBlend, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feDistantLight, feDropShadow, feFlood, feFuncA, feFuncB, feFuncG, feFuncR, feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset, fePointLight, feSpecularLighting, feSpotLight, feTile, feTurbulence, fieldset, figcaption, figure, filter, footer, foreignObject, form, g, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, image, img, input, ins, kbd, keygen, label, legend, li, line, linearGradient, link, main, map, mark, marker, mask, menu, menuitem, meta, metadata, meter, motionComponentImpl, nav, noscript, object, ol, optgroup, option, output, p, param, path, pattern, picture, polygon, polyline, pre, progress, q, radialGradient, rect, rp, rt, ruby, s, samp, script, section, select, small, source, span, stop, strong, style, sub, summary, sup, svg, svgAnimate, svgSwitch, symbol, table, tbody, td, text, textPath, textarea, tfoot, th, thead, time, title, tr, track, tspan, u, ul, use, var, video, view, wbr)
39117
39218withMotion ∷
39319 ∀ result baseProps motionSubset.
@@ -399,177 +25,12 @@ motion ∷
39925 Union baseProps (MotionProps ()) result => Nub result result => Castable motionSubset { | MotionProps () } => motionSubset -> Record baseProps -> Record result
40026motion = flip withMotion
40127
402−infixr 7 withMotion as >>
403−
404−foreign import data Infinity ∷ Type
405−
406−foreign import infinity ∷ Infinity
407−
408−foreign import custom ∷
409− ∀ old.
410− ReactComponent { | old } ->
411− Effect (ReactComponent { | MotionProps old })
412−
413−type AnimatePresenceProps =
414− ( initial ∷ Boolean
415− , custom ∷ ∀ a. a
416− , exitBeforeEnter ∷ Boolean
417− , onExitComplete ∷ Effect Unit
418− , children ∷ Array JSX
419− )
420−
42128foreign import animatePresence ∷
42229 ∀ attrs attrs_.
42330 Union attrs attrs_ AnimatePresenceProps =>
42431 ReactComponent { | attrs }
42532
426−type AnimateSharedLayoutProps =
427− ( type ∷ AnimateSharedLayoutType
428− , children ∷ Array JSX
429− )
430−
431−newtype AnimateSharedLayoutType = AnimateSharedLayoutType String
432−
433−switch ∷ AnimateSharedLayoutType
434−switch = AnimateSharedLayoutType "switch"
435−
436−crossfade ∷ AnimateSharedLayoutType
437−crossfade = AnimateSharedLayoutType "crossfade"
438−
43933foreign import animateSharedLayout ∷
44034 ∀ attrs attrs_.
44135 Union attrs attrs_ AnimateSharedLayoutProps =>
44236 ReactComponent { | attrs }
443−
444−type Props_div_no_key =
445− ( _aria ∷ Object String
446− , _data ∷ Object String
447− , about ∷ String
448− , acceptCharset ∷ String
449− , accessKey ∷ String
450− , allowFullScreen ∷ Boolean
451− , allowTransparency ∷ Boolean
452− , autoFocus ∷ Boolean
453− , autoPlay ∷ Boolean
454− , capture ∷ Boolean
455− , cellPadding ∷ String
456− , cellSpacing ∷ String
457− , charSet ∷ String
458− , children ∷ Array JSX
459− , classID ∷ String
460− , className ∷ String
461− , colSpan ∷ Int
462− , contentEditable ∷ Boolean
463− , contextMenu ∷ String
464− , crossOrigin ∷ String
465− , dangerouslySetInnerHTML ∷ { __html ∷ String }
466− , datatype ∷ String
467− , dateTime ∷ String
468− , dir ∷ String
469− , draggable ∷ Boolean
470− , encType ∷ String
471− , formAction ∷ String
472− , formEncType ∷ String
473− , formMethod ∷ String
474− , formNoValidate ∷ Boolean
475− , formTarget ∷ String
476− , frameBorder ∷ String
477− , hidden ∷ Boolean
478− , hrefLang ∷ String
479− , htmlFor ∷ String
480− , httpEquiv ∷ String
481− , icon ∷ String
482− , id ∷ String
483− , inlist ∷ String
484− , inputMode ∷ String
485− , is ∷ String
486− , itemID ∷ String
487− , itemProp ∷ String
488− , itemRef ∷ String
489− , itemScope ∷ Boolean
490− , itemType ∷ String
491− , keyParams ∷ String
492− , keyType ∷ String
493− , lang ∷ String
494− , marginHeight ∷ String
495− , marginWidth ∷ String
496− , maxLength ∷ Int
497− , mediaGroup ∷ String
498− , minLength ∷ Int
499− , noValidate ∷ Boolean
500− , onAnimationEnd ∷ EventHandler
501− , onAnimationIteration ∷ EventHandler
502− , onAnimationStart ∷ EventHandler
503− , onBlur ∷ EventHandler
504− , onClick ∷ EventHandler
505− , onCompositionEnd ∷ EventHandler
506− , onCompositionStart ∷ EventHandler
507− , onCompositionUpdate ∷ EventHandler
508− , onContextMenu ∷ EventHandler
509− , onCopy ∷ EventHandler
510− , onCut ∷ EventHandler
511− , onDoubleClick ∷ EventHandler
512− , onDrag ∷ EventHandler
513− , onDragEnd ∷ EventHandler
514− , onDragEnter ∷ EventHandler
515− , onDragExit ∷ EventHandler
516− , onDragLeave ∷ EventHandler
517− , onDragOver ∷ EventHandler
518− , onDragStart ∷ EventHandler
519− , onDrop ∷ EventHandler
520− , onFocus ∷ EventHandler
521− , onGotPointerCapture ∷ EventHandler
522− , onInvalid ∷ EventHandler
523− , onKeyDown ∷ EventHandler
524− , onKeyPress ∷ EventHandler
525− , onKeyUp ∷ EventHandler
526− , onLostPointerCapture ∷ EventHandler
527− , onMouseDown ∷ EventHandler
528− , onMouseEnter ∷ EventHandler
529− , onMouseLeave ∷ EventHandler
530− , onMouseMove ∷ EventHandler
531− , onMouseOut ∷ EventHandler
532− , onMouseOver ∷ EventHandler
533− , onMouseUp ∷ EventHandler
534− , onPaste ∷ EventHandler
535− , onPointerCancel ∷ EventHandler
536− , onPointerDown ∷ EventHandler
537− , onPointerEnter ∷ EventHandler
538− , onPointerLeave ∷ EventHandler
539− , onPointerMove ∷ EventHandler
540− , onPointerOut ∷ EventHandler
541− , onPointerOver ∷ EventHandler
542− , onPointerUp ∷ EventHandler
543− , onSelect ∷ EventHandler
544− , onSubmit ∷ EventHandler
545− , onTouchCancel ∷ EventHandler
546− , onTouchEnd ∷ EventHandler
547− , onTouchMove ∷ EventHandler
548− , onTouchStart ∷ EventHandler
549− , onTransitionEnd ∷ EventHandler
550− , onWheel ∷ EventHandler
551− , prefix ∷ String
552− , property ∷ String
553− , radioGroup ∷ String
554− , readOnly ∷ Boolean
555− , ref ∷ Ref (Nullable Node)
556− , resource ∷ String
557− , role ∷ String
558− , rowSpan ∷ Int
559− , scoped ∷ Boolean
560− , seamless ∷ Boolean
561− , security ∷ String
562− , spellCheck ∷ Boolean
563− , srcDoc ∷ JSX
564− , srcLang ∷ String
565− , srcSet ∷ String
566− , style ∷ CSS
567− , suppressContentEditableWarning ∷ Boolean
568− , tabIndex ∷ Int
569− , title ∷ String
570− , typeof ∷ String
571− , unselectable ∷ Boolean
572− , useMap ∷ String
573− , vocab ∷ String
574− , wmode ∷ String
575− )