0 | module Web.Raw.Clipboard
  1 |
  2 | import JS
  3 | import Web.Internal.ClipboardPrim
  4 | import Web.Internal.Types
  5 |
  6 | %default total
  7 |
  8 |
  9 | --------------------------------------------------------------------------------
 10 | --          Interfaces
 11 | --------------------------------------------------------------------------------
 12 |
 13 | namespace Clipboard
 14 |
 15 |   export
 16 |   read : (obj : Clipboard) -> JSIO (Promise (Array ClipboardItem))
 17 |   read a = primJS $ Clipboard.prim__read a
 18 |
 19 |
 20 |   export
 21 |   readText : (obj : Clipboard) -> JSIO (Promise String)
 22 |   readText a = primJS $ Clipboard.prim__readText a
 23 |
 24 |
 25 |   export
 26 |   write :
 27 |        (obj : Clipboard)
 28 |     -> (data_ : Array ClipboardItem)
 29 |     -> JSIO (Promise Undefined)
 30 |   write a b = primJS $ Clipboard.prim__write a b
 31 |
 32 |
 33 |   export
 34 |   writeText : (obj : Clipboard) -> (data_ : String) -> JSIO (Promise Undefined)
 35 |   writeText a b = primJS $ Clipboard.prim__writeText a b
 36 |
 37 |
 38 |
 39 | namespace ClipboardEvent
 40 |
 41 |   export
 42 |   new' :
 43 |        {auto 0 _ : JSType t2}
 44 |     -> {auto 0 _ : Elem ClipboardEventInit (Types t2)}
 45 |     -> (type : String)
 46 |     -> (eventInitDict : Optional t2)
 47 |     -> JSIO ClipboardEvent
 48 |   new' a b = primJS $ ClipboardEvent.prim__new a (optUp b)
 49 |
 50 |   export
 51 |   new : (type : String) -> JSIO ClipboardEvent
 52 |   new a = primJS $ ClipboardEvent.prim__new a undef
 53 |
 54 |
 55 |   export
 56 |   clipboardData : (obj : ClipboardEvent) -> JSIO (Maybe DataTransfer)
 57 |   clipboardData a = tryJS "ClipboardEvent.clipboardData" $
 58 |     ClipboardEvent.prim__clipboardData a
 59 |
 60 |
 61 |
 62 | namespace ClipboardItem
 63 |
 64 |   export
 65 |   new' :
 66 |        {auto 0 _ : JSType t2}
 67 |     -> {auto 0 _ : Elem ClipboardItemOptions (Types t2)}
 68 |     -> (items : Record String (Promise (Union2 String Blob)))
 69 |     -> (options : Optional t2)
 70 |     -> JSIO ClipboardItem
 71 |   new' a b = primJS $ ClipboardItem.prim__new a (optUp b)
 72 |
 73 |   export
 74 |   new :
 75 |        (items : Record String (Promise (Union2 String Blob)))
 76 |     -> JSIO ClipboardItem
 77 |   new a = primJS $ ClipboardItem.prim__new a undef
 78 |
 79 |
 80 |   export
 81 |   createDelayed' :
 82 |        {auto 0 _ : JSType t2}
 83 |     -> {auto 0 _ : Elem ClipboardItemOptions (Types t2)}
 84 |     -> (items : Record String ClipboardItemDelayedCallback)
 85 |     -> (options : Optional t2)
 86 |     -> JSIO ClipboardItem
 87 |   createDelayed' a b = primJS $ ClipboardItem.prim__createDelayed a (optUp b)
 88 |
 89 |   export
 90 |   createDelayed :
 91 |        (items : Record String ClipboardItemDelayedCallback)
 92 |     -> JSIO ClipboardItem
 93 |   createDelayed a = primJS $ ClipboardItem.prim__createDelayed a undef
 94 |
 95 |
 96 |   export
 97 |   delayed : (obj : ClipboardItem) -> JSIO Bool
 98 |   delayed a = tryJS "ClipboardItem.delayed" $ ClipboardItem.prim__delayed a
 99 |
100 |
101 |   export
102 |   lastModified : (obj : ClipboardItem) -> JSIO JSInt64
103 |   lastModified a = primJS $ ClipboardItem.prim__lastModified a
104 |
105 |
106 |   export
107 |   presentationStyle : (obj : ClipboardItem) -> JSIO PresentationStyle
108 |   presentationStyle a = tryJS "ClipboardItem.presentationStyle" $
109 |     ClipboardItem.prim__presentationStyle a
110 |
111 |
112 |   export
113 |   types : (obj : ClipboardItem) -> JSIO (Array String)
114 |   types a = primJS $ ClipboardItem.prim__types a
115 |
116 |
117 |   export
118 |   getType : (obj : ClipboardItem) -> (type : String) -> JSIO (Promise Blob)
119 |   getType a b = primJS $ ClipboardItem.prim__getType a b
120 |
121 |
122 |
123 |
124 |
125 | --------------------------------------------------------------------------------
126 | --          Dictionaries
127 | --------------------------------------------------------------------------------
128 |
129 | namespace ClipboardEventInit
130 |
131 |   export
132 |   new' :
133 |        (clipboardData : Optional (Maybe DataTransfer))
134 |     -> JSIO ClipboardEventInit
135 |   new' a = primJS $ ClipboardEventInit.prim__new (toFFI a)
136 |
137 |   export
138 |   new : JSIO ClipboardEventInit
139 |   new = primJS $ ClipboardEventInit.prim__new undef
140 |
141 |
142 |   export
143 |   clipboardData :
144 |        {auto 0 _ : JSType t}
145 |     -> {auto 0 _ : Elem ClipboardEventInit (Types t)}
146 |     -> t
147 |     -> Attribute True Optional (Maybe DataTransfer)
148 |   clipboardData v = fromUndefOrPrim
149 |                       "ClipboardEventInit.getclipboardData"
150 |                       prim__clipboardData
151 |                       prim__setClipboardData
152 |                       Nothing
153 |                       (v :> ClipboardEventInit)
154 |
155 |
156 |
157 | namespace ClipboardItemOptions
158 |
159 |   export
160 |   new' :
161 |        (presentationStyle : Optional PresentationStyle)
162 |     -> JSIO ClipboardItemOptions
163 |   new' a = primJS $ ClipboardItemOptions.prim__new (toFFI a)
164 |
165 |   export
166 |   new : JSIO ClipboardItemOptions
167 |   new = primJS $ ClipboardItemOptions.prim__new undef
168 |
169 |
170 |   export
171 |   presentationStyle :
172 |        {auto 0 _ : JSType t}
173 |     -> {auto 0 _ : Elem ClipboardItemOptions (Types t)}
174 |     -> t
175 |     -> Attribute False Optional PresentationStyle
176 |   presentationStyle v = fromUndefOrPrimNoDefault
177 |                           "ClipboardItemOptions.getpresentationStyle"
178 |                           prim__presentationStyle
179 |                           prim__setPresentationStyle
180 |                           (v :> ClipboardItemOptions)
181 |
182 |
183 |
184 | namespace ClipboardPermissionDescriptor
185 |
186 |   export
187 |   new' :
188 |        (allowWithoutGesture : Optional Bool)
189 |     -> JSIO ClipboardPermissionDescriptor
190 |   new' a = primJS $ ClipboardPermissionDescriptor.prim__new (toFFI a)
191 |
192 |   export
193 |   new : JSIO ClipboardPermissionDescriptor
194 |   new = primJS $ ClipboardPermissionDescriptor.prim__new undef
195 |
196 |
197 |   export
198 |   allowWithoutGesture :
199 |        {auto 0 _ : JSType t}
200 |     -> {auto 0 _ : Elem ClipboardPermissionDescriptor (Types t)}
201 |     -> t
202 |     -> Attribute True Optional Bool
203 |   allowWithoutGesture v = fromUndefOrPrim
204 |                             "ClipboardPermissionDescriptor.getallowWithoutGesture"
205 |                             prim__allowWithoutGesture
206 |                             prim__setAllowWithoutGesture
207 |                             False
208 |                             (v :> ClipboardPermissionDescriptor)
209 |
210 |
211 |
212 |
213 | --------------------------------------------------------------------------------
214 | --          Callbacks
215 | --------------------------------------------------------------------------------
216 |
217 | namespace ClipboardItemDelayedCallback
218 |
219 |   export
220 |   toClipboardItemDelayedCallback :
221 |        (() -> IO (Promise (Union2 String Blob)))
222 |     -> JSIO ClipboardItemDelayedCallback
223 |   toClipboardItemDelayedCallback cb = primJS $ prim__toClipboardItemDelayedCallback cb
224 |