@@ -14,14 +14,13 @@ import Prelude
15import Demo.Shared (DemoProps, desc, scrollWrap, sectionTitle)
15import Demo.Shared (DemoProps, desc, scrollWrap, sectionTitle)
16import React.Basic (JSX)
16import React.Basic (JSX)
17−import React.Basic.Events (handler_)
17+
18import React.Basic.Hooks (useState', (/\))
18import React.Basic.Hooks (useState', (/\))
19import React.Basic.Hooks as React
19import React.Basic.Hooks as React
20import Yoga.React (component)
20import Yoga.React (component)
21import Yoga.React.Native (tw, view)
21import Yoga.React.Native (tw, view)
22import Yoga.React.Native.MacOS.Button (nativeButton)
22import Yoga.React.Native.MacOS.Button (nativeButton)
23import Yoga.React.Native.MacOS.ColorPanel (macosShowColorPanel)
23import Yoga.React.Native.MacOS.ColorPanel (macosShowColorPanel)
24−import Yoga.React.Native.MacOS.Events as E
25import Yoga.React.Native.MacOS.FontPanel (macosShowFontPanel)
24import Yoga.React.Native.MacOS.FontPanel (macosShowFontPanel)
26import Yoga.React.Native.MacOS.Pasteboard (copyToClipboard)
25import Yoga.React.Native.MacOS.Pasteboard (copyToClipboard)
27import Yoga.React.Native.MacOS.QuickLook (macosQuickLook)
26import Yoga.React.Native.MacOS.QuickLook (macosQuickLook)
@@ -43,7 +42,7 @@ clipboardDemo = component "ClipboardDemo" \dp -> pure do
43 [ nativeButton
42 [ nativeButton
44 { title: "Copy 'Hello'"
43 { title: "Copy 'Hello'"
45 , bezelStyle: T.push
44 , bezelStyle: T.push
46− , onPress: handler_ (copyToClipboard "Hello from PureScript!")
45+ , onPress: copyToClipboard "Hello from PureScript!"
47 , style: Style.style { height: 24.0, width: 120.0 }
46 , style: Style.style { height: 24.0, width: 120.0 }
@@ -57,7 +56,7 @@ shareDemo = component "ShareDemo" \dp -> pure do
57 , nativeButton
56 , nativeButton
58 { title: "Share Text"
57 { title: "Share Text"
59 , bezelStyle: T.push
58 , bezelStyle: T.push
60− , onPress: handler_ (macosShare [ "Hello from PureScript React Native!" ])
59+ , onPress: macosShare [ "Hello from PureScript React Native!" ]
61 , style: Style.style { height: 24.0, width: 120.0 } <> tw "mb-2"
60 , style: Style.style { height: 24.0, width: 120.0 } <> tw "mb-2"
@@ -70,7 +69,7 @@ notificationsDemo = component "NotificationsDemo" \dp -> pure do
70 , nativeButton
69 , nativeButton
71 { title: "Send Notification"
70 { title: "Send Notification"
72 , bezelStyle: T.push
71 , bezelStyle: T.push
73− , onPress: handler_ (macosNotify { title: "PureScript", body: "Hello from React Native macOS!" })
72+ , onPress: macosNotify { title: "PureScript", body: "Hello from React Native macOS!" }
74 , style: Style.style { height: 24.0, width: 160.0 } <> tw "mb-2"
73 , style: Style.style { height: 24.0, width: 160.0 } <> tw "mb-2"
@@ -84,19 +83,19 @@ soundDemo = component "SoundDemo" \dp -> pure do
84 [ nativeButton
83 [ nativeButton
85 { title: "Glass"
84 { title: "Glass"
86 , bezelStyle: T.push
85 , bezelStyle: T.push
87− , onPress: handler_ (macosPlaySound "Glass")
86+ , onPress: macosPlaySound "Glass"
88 , style: Style.style { height: 24.0, width: 80.0 }
87 , style: Style.style { height: 24.0, width: 80.0 }
90 , nativeButton
89 , nativeButton
91 { title: "Ping"
90 { title: "Ping"
92 , bezelStyle: T.push
91 , bezelStyle: T.push
93− , onPress: handler_ (macosPlaySound "Ping")
92+ , onPress: macosPlaySound "Ping"
94 , style: Style.style { height: 24.0, width: 80.0, marginLeft: 8.0 }
93 , style: Style.style { height: 24.0, width: 80.0, marginLeft: 8.0 }
96 , nativeButton
95 , nativeButton
97 { title: "Beep"
96 { title: "Beep"
98 , bezelStyle: T.push
97 , bezelStyle: T.push
99− , onPress: handler_ macosBeep
98+ , onPress: macosBeep
100 , style: Style.style { height: 24.0, width: 80.0, marginLeft: 8.0 }
99 , style: Style.style { height: 24.0, width: 80.0, marginLeft: 8.0 }
@@ -113,22 +112,21 @@ statusBarDemo = component "StatusBarDemo" \dp -> React.do
113 [ nativeButton
112 [ nativeButton
114 { title: if active then "Remove" else "Add to Menu Bar"
113 { title: if active then "Remove" else "Add to Menu Bar"
115 , bezelStyle: T.push
114 , bezelStyle: T.push
116− , onPress: handler_
115+ , onPress:
117− ( if active then do
116+ if active then do
118− macosRemoveStatusBarItem
117+ macosRemoveStatusBarItem
119− setActive false
118+ setActive false
121− macosSetStatusBarItem
120+ macosSetStatusBarItem
122− { title: ""
121+ { title: ""
123− , sfSymbol: "swift"
122+ , sfSymbol: "swift"
124− , menuItems:
123+ , menuItems:
125− [ { id: "about", title: "About PureScript RN" }
124+ [ { id: "about", title: "About PureScript RN" }
126− , { id: "sep", title: "-" }
125+ , { id: "sep", title: "-" }
127− , { id: "quit", title: "Quit" }
126+ , { id: "quit", title: "Quit" }
130− setActive true
129+ setActive true
132 , style: Style.style { height: 24.0, width: 180.0 }
130 , style: Style.style { height: 24.0, width: 180.0 }
@@ -143,7 +141,7 @@ quickLookDemo = component "QuickLookDemo" \dp -> pure do
143 [ nativeButton
141 [ nativeButton
144 { title: "Preview /etc/hosts"
142 { title: "Preview /etc/hosts"
145 , bezelStyle: T.push
143 , bezelStyle: T.push
146− , onPress: handler_ (macosQuickLook "/etc/hosts")
144+ , onPress: macosQuickLook "/etc/hosts"
147 , style: Style.style { height: 24.0, width: 180.0 }
145 , style: Style.style { height: 24.0, width: 180.0 }
@@ -158,7 +156,7 @@ colorPanelDemo = component "ColorPanelDemo" \dp -> pure do
158 [ nativeButton
156 [ nativeButton
159 { title: "Show Color Panel"
157 { title: "Show Color Panel"
160 , bezelStyle: T.push
158 , bezelStyle: T.push
161− , onPress: handler_ macosShowColorPanel
159+ , onPress: macosShowColorPanel
162 , style: Style.style { height: 24.0, width: 180.0 }
160 , style: Style.style { height: 24.0, width: 180.0 }
@@ -173,7 +171,7 @@ fontPanelDemo = component "FontPanelDemo" \dp -> pure do
173 [ nativeButton
171 [ nativeButton
174 { title: "Show Font Panel"
172 { title: "Show Font Panel"
175 , bezelStyle: T.push
173 , bezelStyle: T.push
176− , onPress: handler_ macosShowFontPanel
174+ , onPress: macosShowFontPanel
177 , style: Style.style { height: 24.0, width: 180.0 }
175 , style: Style.style { height: 24.0, width: 180.0 }
@@ -196,13 +194,13 @@ speechDemo = component "SpeechDemo" \dp -> React.do
196 [ nativeButton
194 [ nativeButton
197 { title: "Speak"
195 { title: "Speak"
198 , bezelStyle: T.push
196 , bezelStyle: T.push
199− , onPress: handler_ (say txt)
197+ , onPress: say txt
200 , style: Style.style { height: 24.0, width: 100.0 }
198 , style: Style.style { height: 24.0, width: 100.0 }
202 , nativeButton
200 , nativeButton
203 { title: "Stop"
201 { title: "Stop"
204 , bezelStyle: T.push
202 , bezelStyle: T.push
205− , onPress: handler_ stopSpeaking
203+ , onPress: stopSpeaking
206 , style: Style.style { height: 24.0, width: 100.0, marginLeft: 8.0 }
204 , style: Style.style { height: 24.0, width: 100.0, marginLeft: 8.0 }