@a16n/web-sim 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/README.md +13 -2
  2. package/bin/cli.ts +255 -0
  3. package/bin/web-sim.js +39 -0
  4. package/overrides/@backpackapp-io/react-native-toast/overrides.ts +15 -0
  5. package/overrides/@react-native-firebase/app/overrides.ts +34 -0
  6. package/overrides/@tiktok-for-business/react-native-sdk/NativeTiktokSdk.ts +29 -0
  7. package/overrides/@tiktok-for-business/react-native-sdk/overrides.ts +9 -0
  8. package/overrides/expo-application/ExpoApplication.ts +81 -0
  9. package/overrides/expo-application/overrides.ts +16 -0
  10. package/overrides/expo-background-task/ExpoBackgroundTaskModule.ts +30 -0
  11. package/overrides/expo-background-task/overrides.ts +9 -0
  12. package/overrides/expo-constants/ExponentConstants.ts +66 -0
  13. package/overrides/expo-constants/overrides.ts +9 -0
  14. package/overrides/expo-device/ExpoDevice.ts +104 -0
  15. package/overrides/expo-device/overrides.ts +9 -0
  16. package/overrides/expo-glass-effect/GlassContainer.tsx +9 -0
  17. package/overrides/expo-glass-effect/GlassView.tsx +95 -0
  18. package/overrides/expo-glass-effect/availability.ts +14 -0
  19. package/overrides/expo-glass-effect/overrides.ts +14 -0
  20. package/overrides/expo-haptics/Haptics.ts +67 -0
  21. package/overrides/expo-haptics/overrides.ts +5 -0
  22. package/overrides/expo-mail-composer/ExpoMailComposer.ts +40 -0
  23. package/overrides/expo-mail-composer/overrides.ts +9 -0
  24. package/overrides/expo-mesh-gradient/MeshGradientView.tsx +44 -0
  25. package/overrides/expo-mesh-gradient/overrides.ts +9 -0
  26. package/overrides/expo-modules-core/overrides.ts +12 -0
  27. package/overrides/expo-navigation-bar/ExpoNavigationBar.ts +29 -0
  28. package/overrides/expo-navigation-bar/NavigationBar.ts +43 -0
  29. package/overrides/expo-navigation-bar/overrides.ts +12 -0
  30. package/overrides/expo-router/NativeStackView.tsx +74 -0
  31. package/overrides/expo-router/NativeTabsView.tsx +263 -0
  32. package/overrides/expo-router/SafeAreaProvider.ts +6 -0
  33. package/overrides/expo-router/overrides.ts +23 -0
  34. package/overrides/expo-router/statusBarRequests.ts +51 -0
  35. package/overrides/expo-screen-orientation/ExpoScreenOrientation.ts +173 -0
  36. package/overrides/expo-screen-orientation/overrides.ts +21 -0
  37. package/overrides/expo-sharing/SharingNativeModule.ts +21 -0
  38. package/overrides/expo-sharing/overrides.ts +9 -0
  39. package/overrides/expo-sms/ExpoSMS.ts +24 -0
  40. package/overrides/expo-sms/overrides.ts +9 -0
  41. package/overrides/expo-splash-screen/SplashScreen.ts +25 -0
  42. package/overrides/expo-splash-screen/overrides.ts +5 -0
  43. package/overrides/expo-status-bar/StatusBar.tsx +44 -0
  44. package/overrides/expo-status-bar/overrides.ts +5 -0
  45. package/overrides/expo-store-review/ExpoStoreReview.ts +18 -0
  46. package/overrides/expo-store-review/overrides.ts +9 -0
  47. package/overrides/expo-symbols/SymbolView.tsx +192 -0
  48. package/overrides/expo-symbols/overrides.ts +9 -0
  49. package/overrides/expo-system-ui/ExpoSystemUI.ts +34 -0
  50. package/overrides/expo-system-ui/overrides.ts +9 -0
  51. package/overrides/expo-task-manager/ExpoTaskManager.ts +39 -0
  52. package/overrides/expo-task-manager/overrides.ts +9 -0
  53. package/overrides/expo-tracking-transparency/ExpoTrackingTransparency.ts +30 -0
  54. package/overrides/expo-tracking-transparency/overrides.ts +11 -0
  55. package/overrides/expo-video/ExpoVideo.ts +16 -0
  56. package/overrides/expo-video/overrides.ts +9 -0
  57. package/overrides/lottie-react-native/LottieView.tsx +87 -0
  58. package/overrides/lottie-react-native/overrides.ts +9 -0
  59. package/overrides/react-native-pager-view/PagerViewNativeComponent.tsx +254 -0
  60. package/overrides/react-native-pager-view/overrides.ts +9 -0
  61. package/overrides/react-native-reanimated/overrides.ts +28 -0
  62. package/overrides/react-native-safe-area-context/NativeSafeAreaProvider.tsx +40 -0
  63. package/overrides/react-native-safe-area-context/overrides.ts +12 -0
  64. package/overrides/react-native-share/NativeRNShare.ts +22 -0
  65. package/overrides/react-native-share/overrides.ts +12 -0
  66. package/overrides/react-native-share/platform.ts +14 -0
  67. package/overrides/react-native-turbo-image/TurboImage.tsx +101 -0
  68. package/overrides/react-native-turbo-image/overrides.ts +9 -0
  69. package/overrides/react-native-web/RefreshControl.tsx +57 -0
  70. package/overrides/react-native-web/overrides.ts +153 -0
  71. package/overrides/react-native-web/useElementLayout.ts +140 -0
  72. package/package.json +78 -4
  73. package/plugins/battery/overrides/expo-battery/ExpoBattery.ts +57 -0
  74. package/plugins/battery/overrides/expo-battery/overrides.ts +9 -0
  75. package/plugins/battery/plugin.ts +8 -0
  76. package/plugins/battery/shell.tsx +56 -0
  77. package/plugins/battery/state.ts +11 -0
  78. package/plugins/biometrics/overrides/expo-local-authentication/ExpoLocalAuthentication.ts +90 -0
  79. package/plugins/biometrics/overrides/expo-local-authentication/overrides.ts +11 -0
  80. package/plugins/biometrics/plugin.ts +8 -0
  81. package/plugins/biometrics/shell.tsx +88 -0
  82. package/plugins/biometrics/state.ts +41 -0
  83. package/plugins/brightness/app.ts +5 -0
  84. package/plugins/brightness/overrides/expo-brightness/Brightness.ts +98 -0
  85. package/plugins/brightness/overrides/expo-brightness/overrides.ts +10 -0
  86. package/plugins/brightness/plugin.ts +9 -0
  87. package/plugins/brightness/shell.tsx +55 -0
  88. package/plugins/brightness/state.ts +19 -0
  89. package/plugins/calendar/calendar.ts +299 -0
  90. package/plugins/calendar/overrides/expo-calendar/ExpoCalendar.ts +358 -0
  91. package/plugins/calendar/overrides/expo-calendar/LegacyExpoCalendar.ts +163 -0
  92. package/plugins/calendar/overrides/expo-calendar/overrides.ts +14 -0
  93. package/plugins/calendar/plugin.ts +8 -0
  94. package/plugins/calendar/shell.tsx +123 -0
  95. package/plugins/camera/overrides/expo-camera/ExpoCamera.tsx +269 -0
  96. package/plugins/camera/overrides/expo-camera/ExpoCameraManager.ts +56 -0
  97. package/plugins/camera/overrides/expo-camera/overrides.ts +12 -0
  98. package/plugins/camera/plugin.ts +9 -0
  99. package/plugins/camera/shell.tsx +107 -0
  100. package/plugins/camera/state.ts +61 -0
  101. package/plugins/clipboard/overrides/expo-clipboard/ExpoClipboard.ts +138 -0
  102. package/plugins/clipboard/overrides/expo-clipboard/overrides.ts +9 -0
  103. package/plugins/clipboard/plugin.ts +8 -0
  104. package/plugins/clipboard/shell.tsx +122 -0
  105. package/plugins/clipboard/state.ts +93 -0
  106. package/plugins/clock/app.ts +25 -0
  107. package/plugins/clock/plugin.ts +8 -0
  108. package/plugins/clock/shell.tsx +225 -0
  109. package/plugins/clock/state.ts +12 -0
  110. package/plugins/contacts/contacts.ts +125 -0
  111. package/plugins/contacts/overrides/expo-contacts/ExpoContacts.ts +153 -0
  112. package/plugins/contacts/overrides/expo-contacts/ExpoContactsNext.ts +232 -0
  113. package/plugins/contacts/overrides/expo-contacts/overrides.ts +12 -0
  114. package/plugins/contacts/plugin.ts +8 -0
  115. package/plugins/contacts/shell.tsx +109 -0
  116. package/plugins/home-indicator/app.ts +5 -0
  117. package/plugins/home-indicator/plugin.ts +9 -0
  118. package/plugins/home-indicator/requests.ts +48 -0
  119. package/plugins/home-indicator/shell.tsx +68 -0
  120. package/plugins/home-indicator/state.ts +31 -0
  121. package/plugins/keep-awake/app.ts +5 -0
  122. package/plugins/keep-awake/overrides/expo-keep-awake/ExpoKeepAwake.ts +27 -0
  123. package/plugins/keep-awake/overrides/expo-keep-awake/overrides.ts +9 -0
  124. package/plugins/keep-awake/plugin.ts +9 -0
  125. package/plugins/keep-awake/shell.tsx +80 -0
  126. package/plugins/keep-awake/state.ts +12 -0
  127. package/plugins/keyboard/Keyboard.tsx +354 -0
  128. package/plugins/keyboard/app.ts +90 -0
  129. package/plugins/keyboard/controller.ts +384 -0
  130. package/plugins/keyboard/fields.ts +244 -0
  131. package/plugins/keyboard/icons.tsx +283 -0
  132. package/plugins/keyboard/keyboard.css +362 -0
  133. package/plugins/keyboard/layouts/android.ts +175 -0
  134. package/plugins/keyboard/layouts/index.ts +10 -0
  135. package/plugins/keyboard/layouts/ios.ts +219 -0
  136. package/plugins/keyboard/layouts/types.ts +80 -0
  137. package/plugins/keyboard/overrides/react-native-keyboard-controller/KeyboardController.tsx +470 -0
  138. package/plugins/keyboard/overrides/react-native-keyboard-controller/overrides.ts +9 -0
  139. package/plugins/keyboard/plugin.ts +13 -0
  140. package/plugins/keyboard/shell.tsx +133 -0
  141. package/plugins/keyboard/state.ts +92 -0
  142. package/plugins/keyboard/suggestions.ts +63 -0
  143. package/plugins/keyboard/taps.ts +77 -0
  144. package/plugins/keyboard/typing.ts +112 -0
  145. package/plugins/locale/app.ts +232 -0
  146. package/plugins/locale/locale.ts +143 -0
  147. package/plugins/locale/overrides/expo-localization/ExpoLocalization.ts +41 -0
  148. package/plugins/locale/overrides/expo-localization/overrides.ts +9 -0
  149. package/plugins/locale/plugin.ts +9 -0
  150. package/plugins/locale/shell.tsx +147 -0
  151. package/plugins/locale/state.ts +36 -0
  152. package/plugins/location/geo.ts +56 -0
  153. package/plugins/location/overrides/expo-location/ExpoLocation.ts +235 -0
  154. package/plugins/location/overrides/expo-location/overrides.ts +11 -0
  155. package/plugins/location/places.ts +38 -0
  156. package/plugins/location/plugin.ts +8 -0
  157. package/plugins/location/shell.tsx +188 -0
  158. package/plugins/location/state.ts +51 -0
  159. package/plugins/motion/overrides/expo-sensors/DeviceSensor.ts +169 -0
  160. package/plugins/motion/overrides/expo-sensors/ExponentPedometer.ts +54 -0
  161. package/plugins/motion/overrides/expo-sensors/overrides.ts +14 -0
  162. package/plugins/motion/plugin.ts +8 -0
  163. package/plugins/motion/sensors.ts +116 -0
  164. package/plugins/motion/shell.tsx +136 -0
  165. package/plugins/motion/state.ts +46 -0
  166. package/plugins/network/app.ts +400 -0
  167. package/plugins/network/overrides/expo-network/ExpoNetwork.ts +51 -0
  168. package/plugins/network/overrides/expo-network/overrides.ts +9 -0
  169. package/plugins/network/plugin.ts +8 -0
  170. package/plugins/network/shell.tsx +67 -0
  171. package/plugins/network/state.ts +29 -0
  172. package/plugins/notifications/center.ts +255 -0
  173. package/plugins/notifications/content.ts +36 -0
  174. package/plugins/notifications/overrides/expo-notifications/NotificationsModule.ts +175 -0
  175. package/plugins/notifications/overrides/expo-notifications/channels.ts +108 -0
  176. package/plugins/notifications/overrides/expo-notifications/getDevicePushTokenAsync.ts +19 -0
  177. package/plugins/notifications/overrides/expo-notifications/getExpoPushTokenAsync.ts +16 -0
  178. package/plugins/notifications/overrides/expo-notifications/overrides.ts +36 -0
  179. package/plugins/notifications/plugin.ts +8 -0
  180. package/plugins/notifications/shell.tsx +192 -0
  181. package/plugins/notifications/state.ts +56 -0
  182. package/plugins/notifications/tokens.ts +47 -0
  183. package/plugins/notifications/trigger.ts +107 -0
  184. package/plugins/permissions/plugin.ts +6 -0
  185. package/plugins/permissions/shell.tsx +50 -0
  186. package/plugins/permissions/state.ts +38 -0
  187. package/plugins/photos/appLibrary.ts +114 -0
  188. package/plugins/photos/library.ts +322 -0
  189. package/plugins/photos/overrides/expo-image-picker/ExponentImagePicker.ts +153 -0
  190. package/plugins/photos/overrides/expo-image-picker/overrides.ts +13 -0
  191. package/plugins/photos/overrides/expo-media-library/ExpoMediaLibrary.ts +235 -0
  192. package/plugins/photos/overrides/expo-media-library/NativeMediaLibraryModule.ts +318 -0
  193. package/plugins/photos/overrides/expo-media-library/overrides.ts +19 -0
  194. package/plugins/photos/plugin.ts +8 -0
  195. package/plugins/photos/samples.ts +367 -0
  196. package/plugins/photos/shell.tsx +164 -0
  197. package/plugins/photos/state.ts +88 -0
  198. package/plugins/storage/files.ts +351 -0
  199. package/plugins/storage/overrides/expo-file-system/ExpoFileSystem.ts +770 -0
  200. package/plugins/storage/overrides/expo-file-system/ExponentFileSystem.ts +196 -0
  201. package/plugins/storage/overrides/expo-file-system/overrides.ts +13 -0
  202. package/plugins/storage/overrides/expo-secure-store/ExpoSecureStore.ts +75 -0
  203. package/plugins/storage/overrides/expo-secure-store/overrides.ts +9 -0
  204. package/plugins/storage/plugin.ts +8 -0
  205. package/plugins/storage/reset.ts +136 -0
  206. package/plugins/storage/secure.ts +71 -0
  207. package/plugins/storage/shell.tsx +365 -0
  208. package/plugins/storage/state.ts +13 -0
  209. package/src/client/app/appDocument.ts +113 -0
  210. package/src/client/app/appFocus.ts +97 -0
  211. package/src/client/app/console.ts +118 -0
  212. package/src/client/app/fonts.ts +59 -0
  213. package/src/client/app/main.tsx +99 -0
  214. package/src/client/app/routeContext.ts +45 -0
  215. package/src/client/app/touch.ts +640 -0
  216. package/src/client/entry.ts +20 -0
  217. package/src/client/modules.d.ts +8 -0
  218. package/src/client/react-native/app.ts +57 -0
  219. package/src/client/react-native/deep.ts +13 -0
  220. package/src/client/react-native/keyboard.tsx +192 -0
  221. package/src/client/react-native/library.ts +256 -0
  222. package/src/client/shell/Cookies.tsx +95 -0
  223. package/src/client/shell/LogDrawer.tsx +415 -0
  224. package/src/client/shell/PhotoPicker.tsx +174 -0
  225. package/src/client/shell/PluginOverlays.tsx +42 -0
  226. package/src/client/shell/PluginPanels.tsx +82 -0
  227. package/src/client/shell/ResetApp.tsx +87 -0
  228. package/src/client/shell/Resizer.tsx +99 -0
  229. package/src/client/shell/Shell.tsx +531 -0
  230. package/src/client/shell/SystemBars.tsx +376 -0
  231. package/src/client/shell/SystemCamera.tsx +181 -0
  232. package/src/client/shell/SystemOverlay.tsx +422 -0
  233. package/src/client/shell/SystemSheets.tsx +462 -0
  234. package/src/client/shell/backdrop.ts +229 -0
  235. package/src/client/shell/control.ts +91 -0
  236. package/src/client/shell/events.ts +226 -0
  237. package/src/client/shell/geometry.ts +68 -0
  238. package/src/client/shell/host.ts +492 -0
  239. package/src/client/shell/icons.tsx +34 -0
  240. package/src/client/shell/logFeed.ts +102 -0
  241. package/src/client/shell/main.tsx +22 -0
  242. package/src/client/shell/permissionCopy.ts +169 -0
  243. package/src/client/shell/plugins.ts +266 -0
  244. package/src/client/shell/popout.ts +185 -0
  245. package/src/client/shell/popover.ts +27 -0
  246. package/src/client/shell/shell.css +878 -0
  247. package/src/client/shell/statusTime.ts +31 -0
  248. package/src/client/shell/tooltips.ts +104 -0
  249. package/src/client/virtual.d.ts +21 -0
  250. package/src/devices/catalog.ts +223 -0
  251. package/src/devices/types.ts +83 -0
  252. package/src/node/appInfo.ts +186 -0
  253. package/src/node/appSource.ts +138 -0
  254. package/src/node/config.ts +180 -0
  255. package/src/node/control.ts +144 -0
  256. package/src/node/doctor.ts +199 -0
  257. package/src/node/events/cli.ts +206 -0
  258. package/src/node/events/shared.ts +238 -0
  259. package/src/node/events/store.ts +266 -0
  260. package/src/node/index.ts +5 -0
  261. package/src/node/overrides/define.ts +56 -0
  262. package/src/node/overrides/packages.ts +136 -0
  263. package/src/node/overrides/platformPatch.ts +56 -0
  264. package/src/node/overrides/plugin.ts +166 -0
  265. package/src/node/overrides/registry.ts +258 -0
  266. package/src/node/paths.ts +18 -0
  267. package/src/node/platform.ts +171 -0
  268. package/src/node/plugins.ts +98 -0
  269. package/src/node/proxy.ts +421 -0
  270. package/src/node/server.ts +253 -0
  271. package/src/plugin/index.ts +33 -0
  272. package/src/plugin/types.ts +127 -0
  273. package/src/plugin/ui.tsx +562 -0
  274. package/src/runtime/clock.ts +112 -0
  275. package/src/runtime/draw.ts +196 -0
  276. package/src/runtime/index.ts +513 -0
  277. package/src/runtime/media.ts +379 -0
  278. package/src/runtime/records.ts +76 -0
  279. package/src/runtime/timezone.ts +81 -0
@@ -0,0 +1,358 @@
1
+ import { CodedError } from 'expo'
2
+ import { appendLog, getPermission, platform, plugin, requestPermission, showDialog } from 'web-sim/runtime'
3
+ import {
4
+ type CalendarRecord,
5
+ type CalendarState,
6
+ calendarStore as calendarStoreOf,
7
+ type EventRecord,
8
+ INITIAL_CALENDAR,
9
+ newEvent,
10
+ type ReminderRecord,
11
+ ids,
12
+ } from '../../calendar.ts'
13
+
14
+ /**
15
+ * `expo-calendar`'s native module over the calendar panel's calendars: a few made-up ones with events placed around
16
+ * today, and the changes the app and the panel make. Reading needs the calendar permission (reminders, on iOS, their own), as on the
17
+ * device.
18
+ */
19
+
20
+ export type { CalendarRecord, EventRecord, ReminderRecord }
21
+
22
+ const calendar = () => plugin<CalendarState>('calendar', INITIAL_CALENDAR)
23
+
24
+ /** The calendars, shared with the legacy module. App changes are logged for the panel. */
25
+ export function calendarStore() {
26
+ return calendarStoreOf(calendar(), platform(), (text) => calendar().set({ log: appendLog(calendar().get().log, text) }))
27
+ }
28
+
29
+ export function ensureCalendarPermission() {
30
+ if (!getPermission('calendar').granted) {
31
+ throw new CodedError('E_MISSING_PERMISSIONS', 'CALENDAR permission is required to do this operation.')
32
+ }
33
+ }
34
+
35
+ export function ensureRemindersPermission() {
36
+ if (!getPermission('reminders').granted) {
37
+ throw new CodedError('E_MISSING_PERMISSIONS', 'REMINDERS permission is required to do this operation.')
38
+ }
39
+ }
40
+
41
+ export function colorString(color: unknown): string | undefined {
42
+ if (typeof color === 'number') {
43
+ return `#${(color & 0xffffff).toString(16).padStart(6, '0').toUpperCase()}`
44
+ }
45
+ return typeof color === 'string' ? color : undefined
46
+ }
47
+
48
+ export function inRange(start: string, end: string, from: string, to: string): boolean {
49
+ return new Date(start).getTime() < new Date(to).getTime() && new Date(end).getTime() > new Date(from).getTime()
50
+ }
51
+
52
+ /** Event fields as the module reports them; Android leaves out what it does not have. */
53
+ export function eventFields(record: EventRecord) {
54
+ const { attendees: _attendees, ...fields } = record
55
+ return platform() === 'android' ? { ...fields, organizerEmail: 'you@example.com', guestsCanModify: false, guestsCanInviteOthers: true, guestsCanSeeGuests: true } : { ...fields, organizer: { isCurrentUser: true, name: 'You', role: 'unknown', status: 'unknown', type: 'unknown' } }
56
+ }
57
+
58
+ export function newEventId(): string {
59
+ return platform() === 'ios' ? `${crypto.randomUUID().toUpperCase()}` : calendarStore().events.newId()
60
+ }
61
+
62
+ export function createEventRecord(calendarId: string, details: Partial<EventRecord>): EventRecord {
63
+ return calendarStore().events.put(newEvent(newEventId(), calendarId, details))
64
+ }
65
+
66
+ /** The system's new-event sheet, drawn as an alert with the event's title and time. */
67
+ export async function eventForm(calendarId: string | undefined, details: Partial<EventRecord>): Promise<{ action: string; id: string | null }> {
68
+ const start = details.startDate ? new Date(details.startDate) : new Date()
69
+ const { button } = await showDialog({
70
+ kind: 'alert',
71
+ title: 'New Event',
72
+ message: [details.title || 'New Event', start.toLocaleString([], { dateStyle: 'medium', timeStyle: 'short' })].join('\n'),
73
+ buttons: [{ text: 'Cancel', style: 'cancel' }, { text: 'Add' }],
74
+ })
75
+ if (button !== 1) {
76
+ return { action: 'canceled', id: null }
77
+ }
78
+ const store = calendarStore()
79
+ const target = calendarId ?? store.calendars.all().find((calendar) => calendar.entityType === 'event' && calendar.allowsModifications)!.id
80
+ return { action: 'saved', id: createEventRecord(target, details).id }
81
+ }
82
+
83
+ function update<T extends { id: string; lastModifiedDate?: string }>(records: { get(id: string): T | null; put(record: T): T }, id: string, details: Record<string, unknown>, nullable: string[] = []) {
84
+ const record = records.get(id)
85
+ if (record === null) {
86
+ throw new CodedError('E_NOT_FOUND', `No record with id ${id}`)
87
+ }
88
+ const next: Record<string, unknown> = { ...record, ...Object.fromEntries(Object.entries(details).filter(([, value]) => value !== undefined)), id, lastModifiedDate: new Date().toISOString() }
89
+ for (const field of nullable) {
90
+ next[field] = null
91
+ }
92
+ if ('color' in details) {
93
+ next.color = colorString(details.color) ?? (record as Record<string, unknown>).color
94
+ }
95
+ return records.put(next as T)
96
+ }
97
+
98
+ class ExpoCalendarAttendee {
99
+ id?: string
100
+ eventId?: string
101
+ name = ''
102
+ email = ''
103
+ role = 'unknown'
104
+ status = 'unknown'
105
+ type = 'unknown'
106
+ isCurrentUser?: boolean
107
+ async update(details: Record<string, unknown>) {
108
+ ensureCalendarPermission()
109
+ Object.assign(this, details)
110
+ const event = calendarStore().events.get(this.eventId ?? '')
111
+ if (event !== null) {
112
+ calendarStore().events.put({ ...event, attendees: event.attendees.map((attendee) => (attendee.email === this.email ? { ...attendee, ...details } : attendee)) as EventRecord['attendees'] })
113
+ }
114
+ }
115
+ async delete() {
116
+ ensureCalendarPermission()
117
+ const event = calendarStore().events.get(this.eventId ?? '')
118
+ if (event !== null) {
119
+ calendarStore().events.put({ ...event, attendees: event.attendees.filter((attendee) => attendee.email !== this.email) })
120
+ }
121
+ }
122
+ }
123
+
124
+ class ExpoCalendarEvent {
125
+ id!: string
126
+ constructor(id: string) {
127
+ ensureCalendarPermission()
128
+ const record = calendarStore().events.get(id)
129
+ if (record === null) {
130
+ throw new CodedError('E_EVENT_NOT_FOUND', `Event with id ${id} could not be found`)
131
+ }
132
+ Object.assign(this, eventFields(record))
133
+ }
134
+ async openInCalendar() {
135
+ return { action: 'done' }
136
+ }
137
+ async editInCalendar() {
138
+ return { action: 'canceled', id: this.id }
139
+ }
140
+ getOccurrenceSync() {
141
+ return this
142
+ }
143
+ async getAttendees() {
144
+ ensureCalendarPermission()
145
+ return (calendarStore().events.get(this.id)?.attendees ?? []).map((attendee, index) =>
146
+ Object.assign(new ExpoCalendarAttendee(), attendee, { id: `${this.id}-attendee-${index}`, eventId: this.id }),
147
+ )
148
+ }
149
+ async createAttendee(attendee: { email: string; name?: string; role?: string; status?: string; type?: string }) {
150
+ ensureCalendarPermission()
151
+ const record = calendarStore().events.get(this.id)!
152
+ const added = { name: attendee.name ?? attendee.email, email: attendee.email, role: attendee.role ?? 'attendee', status: attendee.status ?? 'invited', type: attendee.type ?? 'required' }
153
+ calendarStore().events.put({ ...record, attendees: [...record.attendees, added] })
154
+ return Object.assign(new ExpoCalendarAttendee(), added, { id: `${this.id}-attendee-${record.attendees.length}`, eventId: this.id })
155
+ }
156
+ async getExtendedProperties() {
157
+ return []
158
+ }
159
+ async setExtendedProperty() {}
160
+ async deleteExtendedProperty() {
161
+ return false
162
+ }
163
+ async update(details: Record<string, unknown>, nullableFields?: string[]) {
164
+ ensureCalendarPermission()
165
+ Object.assign(this, eventFields(update(calendarStore().events, this.id, details, nullableFields)))
166
+ }
167
+ async delete() {
168
+ ensureCalendarPermission()
169
+ calendarStore().events.remove(this.id)
170
+ }
171
+ static async get(id: string) {
172
+ return new ExpoCalendarEvent(id)
173
+ }
174
+ }
175
+
176
+ class ExpoCalendarReminder {
177
+ id?: string
178
+ constructor(id?: string) {
179
+ if (id === undefined) {
180
+ return
181
+ }
182
+ ensureRemindersPermission()
183
+ const record = calendarStore().reminders.get(id)
184
+ if (record === null) {
185
+ throw new CodedError('E_REMINDER_NOT_FOUND', `Reminder with id ${id} could not be found`)
186
+ }
187
+ Object.assign(this, record)
188
+ }
189
+ async update(details: Record<string, unknown>, nullableFields?: string[]) {
190
+ ensureRemindersPermission()
191
+ Object.assign(this, update(calendarStore().reminders, this.id!, details, nullableFields))
192
+ }
193
+ async delete() {
194
+ ensureRemindersPermission()
195
+ calendarStore().reminders.remove(this.id!)
196
+ }
197
+ static async get(id: string) {
198
+ return new ExpoCalendarReminder(id)
199
+ }
200
+ }
201
+
202
+ class ExpoCalendar {
203
+ id!: string
204
+ constructor(id: string) {
205
+ const record = calendarStore().calendars.get(id)
206
+ if (record === null) {
207
+ throw new CodedError('E_CALENDAR_NOT_FOUND', `Calendar with id ${id} could not be found`)
208
+ }
209
+ if (record.entityType === 'reminder') {
210
+ ensureRemindersPermission()
211
+ } else {
212
+ ensureCalendarPermission()
213
+ }
214
+ Object.assign(this, record)
215
+ }
216
+ async listEvents(startDate: string, endDate: string) {
217
+ ensureCalendarPermission()
218
+ return calendarStore()
219
+ .events.all()
220
+ .filter((event) => event.calendarId === this.id && inRange(event.startDate, event.endDate, startDate, endDate))
221
+ .sort((a, b) => a.startDate.localeCompare(b.startDate))
222
+ .map((event) => new ExpoCalendarEvent(event.id))
223
+ }
224
+ async listReminders(startDate: string | null, endDate: string | null, status: string | null) {
225
+ ensureRemindersPermission()
226
+ return calendarStore()
227
+ .reminders.all()
228
+ .filter((reminder) => reminder.calendarId === this.id)
229
+ .filter((reminder) => status === null || (status === 'completed') === reminder.completed)
230
+ .filter((reminder) => {
231
+ const date = reminder.dueDate ?? reminder.startDate
232
+ return date === undefined || ((startDate === null || date >= startDate) && (endDate === null || date <= endDate))
233
+ })
234
+ .map((reminder) => new ExpoCalendarReminder(reminder.id))
235
+ }
236
+ async createEvent(details: Partial<EventRecord>) {
237
+ ensureCalendarPermission()
238
+ return new ExpoCalendarEvent(createEventRecord(this.id, details).id)
239
+ }
240
+ async createReminder(details: Partial<ReminderRecord>) {
241
+ ensureRemindersPermission()
242
+ const now = new Date().toISOString()
243
+ const id = crypto.randomUUID().toUpperCase()
244
+ calendarStore().reminders.put({ completed: false, ...details, id, calendarId: this.id, creationDate: now, lastModifiedDate: now } as ReminderRecord)
245
+ return new ExpoCalendarReminder(id)
246
+ }
247
+ async addEventWithForm(options: Partial<EventRecord> = {}) {
248
+ return eventForm(this.id, options)
249
+ }
250
+ async update(details: Record<string, unknown>) {
251
+ ensureCalendarPermission()
252
+ Object.assign(this, update(calendarStore().calendars, this.id, details))
253
+ }
254
+ async delete() {
255
+ ensureCalendarPermission()
256
+ const store = calendarStore()
257
+ store.events.all().filter((event) => event.calendarId === this.id).forEach((event) => store.events.remove(event.id))
258
+ store.calendars.remove(this.id)
259
+ }
260
+ static async get(id: string) {
261
+ return new ExpoCalendar(id)
262
+ }
263
+ }
264
+
265
+ function calendarsOf(entityType?: string | null) {
266
+ const type = entityType ?? 'event'
267
+ if (type === 'reminder') {
268
+ ensureRemindersPermission()
269
+ } else {
270
+ ensureCalendarPermission()
271
+ }
272
+ return calendarStore()
273
+ .calendars.all()
274
+ .filter((calendar) => calendar.entityType === type)
275
+ }
276
+
277
+ export function createCalendarRecord(details: Partial<CalendarRecord> & { color?: unknown }): CalendarRecord {
278
+ const store = calendarStore()
279
+ const primary = store.calendars.all()[0]
280
+ const id = platform() === 'ios' ? crypto.randomUUID().toUpperCase() : store.calendars.newId()
281
+ return store.calendars.put({
282
+ ...primary,
283
+ isPrimary: platform() === 'android' ? false : undefined,
284
+ ...details,
285
+ title: details.title ?? 'Calendar',
286
+ name: details.name ?? details.title ?? 'Calendar',
287
+ entityType: details.entityType ?? 'event',
288
+ color: colorString(details.color) ?? '#FF2D55',
289
+ id,
290
+ } as CalendarRecord)
291
+ }
292
+
293
+ export function sources() {
294
+ const seen = new Map<string, CalendarRecord['source']>()
295
+ calendarStore().calendars.all().forEach((calendar) => seen.set(calendar.source.id, calendar.source))
296
+ return [...seen.values()]
297
+ }
298
+
299
+ export default {
300
+ ExpoCalendar,
301
+ ExpoCalendarEvent,
302
+ ExpoCalendarAttendee,
303
+ ExpoCalendarReminder,
304
+ getDefaultCalendarSync() {
305
+ ensureCalendarPermission()
306
+ return new ExpoCalendar(ids(platform()).home)
307
+ },
308
+ async getCalendars(entityType?: string) {
309
+ return calendarsOf(entityType).map((calendar) => new ExpoCalendar(calendar.id))
310
+ },
311
+ async createCalendar(details: Partial<CalendarRecord>) {
312
+ ensureCalendarPermission()
313
+ return new ExpoCalendar(createCalendarRecord(details).id)
314
+ },
315
+ /** The system calendar chooser, drawn as a sheet of the calendars. */
316
+ async presentPicker() {
317
+ const calendars = calendarStore().calendars.all().filter((calendar) => calendar.entityType === 'event' && calendar.allowsModifications)
318
+ const { button } = await showDialog({
319
+ kind: 'action-sheet',
320
+ title: 'Choose Calendar',
321
+ buttons: [...calendars.map((calendar) => ({ text: calendar.title })), { text: 'Cancel', style: 'cancel' }],
322
+ })
323
+ return button >= 0 && button < calendars.length ? new ExpoCalendar(calendars[button].id) : null
324
+ },
325
+ async listEvents(calendarIds: string[], startDate: string, endDate: string) {
326
+ ensureCalendarPermission()
327
+ return calendarStore()
328
+ .events.all()
329
+ .filter((event) => (calendarIds.length === 0 || calendarIds.includes(event.calendarId)) && inRange(event.startDate, event.endDate, startDate, endDate))
330
+ .sort((a, b) => a.startDate.localeCompare(b.startDate))
331
+ .map((event) => new ExpoCalendarEvent(event.id))
332
+ },
333
+ async getCalendarById(id: string) {
334
+ return new ExpoCalendar(id)
335
+ },
336
+ async getEventById(id: string) {
337
+ return new ExpoCalendarEvent(id)
338
+ },
339
+ async getReminderById(id: string) {
340
+ return new ExpoCalendarReminder(id)
341
+ },
342
+ async requestCalendarPermissions() {
343
+ return requestPermission('calendar')
344
+ },
345
+ async getCalendarPermissions() {
346
+ return getPermission('calendar')
347
+ },
348
+ async requestRemindersPermissions() {
349
+ return requestPermission('reminders')
350
+ },
351
+ async getRemindersPermissions() {
352
+ return getPermission('reminders')
353
+ },
354
+ getSourcesSync() {
355
+ ensureCalendarPermission()
356
+ return sources()
357
+ },
358
+ }
@@ -0,0 +1,163 @@
1
+ import { CodedError } from 'expo'
2
+ import { getPermission, platform, requestPermission } from 'web-sim/runtime'
3
+ import {
4
+ calendarStore,
5
+ createCalendarRecord,
6
+ createEventRecord,
7
+ ensureCalendarPermission,
8
+ ensureRemindersPermission,
9
+ eventFields,
10
+ eventForm,
11
+ inRange,
12
+ sources,
13
+ type CalendarRecord,
14
+ type EventRecord,
15
+ type ReminderRecord,
16
+ // @ts-expect-error Resolved inside the package, to the current module's replacement: the same calendars.
17
+ } from '../ExpoCalendar'
18
+
19
+ type Store = {
20
+ calendars: { all(): CalendarRecord[]; get(id: string): CalendarRecord | null; put(record: CalendarRecord): CalendarRecord; remove(id: string): void }
21
+ events: { all(): EventRecord[]; get(id: string): EventRecord | null; put(record: EventRecord): EventRecord; remove(id: string): void }
22
+ reminders: { all(): ReminderRecord[]; get(id: string): ReminderRecord | null; put(record: ReminderRecord): ReminderRecord; remove(id: string): void }
23
+ }
24
+ const store = (): Store => calendarStore()
25
+
26
+ function notFound(kind: string, id: string): never {
27
+ throw new CodedError('E_NOT_FOUND', `${kind} with id ${id} could not be found`)
28
+ }
29
+
30
+ /**
31
+ * The legacy `expo-calendar` API (`expo-calendar/legacy`) over the same made-up calendars as the current one.
32
+ */
33
+ export default {
34
+ async requestCalendarPermissionsAsync() {
35
+ return requestPermission('calendar')
36
+ },
37
+ async getCalendarPermissionsAsync() {
38
+ return getPermission('calendar')
39
+ },
40
+ async requestRemindersPermissionsAsync() {
41
+ return requestPermission('reminders')
42
+ },
43
+ async getRemindersPermissionsAsync() {
44
+ return getPermission('reminders')
45
+ },
46
+
47
+ async getCalendarsAsync(entityType: string | null) {
48
+ // Android lists every calendar; iOS lists one kind, events unless asked for reminders.
49
+ const all = store().calendars.all()
50
+ if (platform() === 'android' && entityType === null) {
51
+ ensureCalendarPermission()
52
+ return all.filter((calendar) => calendar.entityType === 'event')
53
+ }
54
+ const type = entityType ?? 'event'
55
+ if (type === 'reminder') {
56
+ ensureRemindersPermission()
57
+ } else {
58
+ ensureCalendarPermission()
59
+ }
60
+ return all.filter((calendar) => calendar.entityType === type)
61
+ },
62
+ async getDefaultCalendarAsync() {
63
+ ensureCalendarPermission()
64
+ return store().calendars.all()[0]
65
+ },
66
+ async saveCalendarAsync(details: Partial<CalendarRecord> & { id?: string }) {
67
+ ensureCalendarPermission()
68
+ if (details.id) {
69
+ const existing = store().calendars.get(details.id) ?? notFound('Calendar', details.id)
70
+ return store().calendars.put({ ...existing, ...details, id: existing.id }).id
71
+ }
72
+ return createCalendarRecord(details).id
73
+ },
74
+ async deleteCalendarAsync(id: string) {
75
+ ensureCalendarPermission()
76
+ store().calendars.remove(id)
77
+ },
78
+ async getSourcesAsync() {
79
+ ensureCalendarPermission()
80
+ return sources()
81
+ },
82
+ async getSourceByIdAsync(id: string) {
83
+ ensureCalendarPermission()
84
+ return sources().find((source: { id: string }) => source.id === id) ?? notFound('Source', id)
85
+ },
86
+
87
+ async getEventsAsync(startDate: string, endDate: string, calendarIds: string[]) {
88
+ ensureCalendarPermission()
89
+ return store()
90
+ .events.all()
91
+ .filter((event) => calendarIds.includes(event.calendarId) && inRange(event.startDate, event.endDate, startDate, endDate))
92
+ .sort((a, b) => a.startDate.localeCompare(b.startDate))
93
+ .map(eventFields)
94
+ },
95
+ async getEventByIdAsync(id: string) {
96
+ ensureCalendarPermission()
97
+ return eventFields(store().events.get(id) ?? notFound('Event', id))
98
+ },
99
+ async saveEventAsync(details: Partial<EventRecord> & { id?: string }) {
100
+ ensureCalendarPermission()
101
+ if (details.id) {
102
+ const existing = store().events.get(details.id) ?? notFound('Event', details.id)
103
+ return store().events.put({ ...existing, ...details, id: existing.id, lastModifiedDate: new Date().toISOString() }).id
104
+ }
105
+ return createEventRecord(details.calendarId!, details).id
106
+ },
107
+ async deleteEventAsync({ id }: { id: string }) {
108
+ ensureCalendarPermission()
109
+ store().events.remove(id)
110
+ },
111
+ async getAttendeesForEventAsync({ id }: { id: string }) {
112
+ ensureCalendarPermission()
113
+ return (store().events.get(id) ?? notFound('Event', id)).attendees
114
+ },
115
+ async saveAttendeeForEventAsync() {
116
+ ensureCalendarPermission()
117
+ return ''
118
+ },
119
+ async deleteAttendeeAsync() {
120
+ ensureCalendarPermission()
121
+ },
122
+
123
+ async getRemindersAsync(startDate: string | null, endDate: string | null, calendarIds: string[], status: string | null) {
124
+ ensureRemindersPermission()
125
+ return store()
126
+ .reminders.all()
127
+ .filter((reminder) => calendarIds.length === 0 || calendarIds.includes(reminder.calendarId))
128
+ .filter((reminder) => status === null || (status === 'completed') === reminder.completed)
129
+ .filter((reminder) => {
130
+ const date = reminder.dueDate ?? reminder.startDate
131
+ return date === undefined || ((startDate === null || date >= startDate) && (endDate === null || date <= endDate))
132
+ })
133
+ },
134
+ async getReminderByIdAsync(id: string) {
135
+ ensureRemindersPermission()
136
+ return store().reminders.get(id) ?? notFound('Reminder', id)
137
+ },
138
+ async saveReminderAsync(details: Partial<ReminderRecord> & { id?: string }) {
139
+ ensureRemindersPermission()
140
+ const now = new Date().toISOString()
141
+ if (details.id) {
142
+ const existing = store().reminders.get(details.id) ?? notFound('Reminder', details.id)
143
+ return store().reminders.put({ ...existing, ...details, id: existing.id, lastModifiedDate: now }).id
144
+ }
145
+ const id = crypto.randomUUID().toUpperCase()
146
+ return store().reminders.put({ completed: false, ...details, id, calendarId: details.calendarId!, creationDate: now, lastModifiedDate: now } as ReminderRecord).id
147
+ },
148
+ async deleteReminderAsync(id: string) {
149
+ ensureRemindersPermission()
150
+ store().reminders.remove(id)
151
+ },
152
+
153
+ async createEventInCalendarAsync(details: Partial<EventRecord> = {}) {
154
+ return eventForm(details.calendarId, details)
155
+ },
156
+ async editEventInCalendarAsync({ id }: { id: string }) {
157
+ return { action: 'canceled', id }
158
+ },
159
+ async openEventInCalendarAsync() {
160
+ return { action: 'done' }
161
+ },
162
+ openEventInCalendar() {},
163
+ }
@@ -0,0 +1,14 @@
1
+ import { defineOverrides } from '../../../../src/node/overrides/define.ts'
2
+ import { simulatedPlatform } from '../../../../src/node/overrides/platformPatch.ts'
3
+
4
+ export default defineOverrides('expo-calendar', [
5
+ {
6
+ versions: '>=58 <59',
7
+ note: "calendar and reminders permissions, and the calendar panel's calendars and events; the app's changes show in the panel",
8
+ files: {
9
+ 'build/ExpoCalendar.web.js': './ExpoCalendar.ts',
10
+ 'build/legacy/ExpoCalendar.web.js': './LegacyExpoCalendar.ts',
11
+ },
12
+ patch: [simulatedPlatform('build/Calendar.js'), simulatedPlatform('build/legacy/Calendar.js')],
13
+ },
14
+ ])
@@ -0,0 +1,8 @@
1
+ import { definePlugin } from '../../src/node/plugins.ts'
2
+
3
+ export default definePlugin({
4
+ name: 'calendar',
5
+ packages: ['expo-calendar'],
6
+ overrides: './overrides',
7
+ shell: './shell.tsx',
8
+ })
@@ -0,0 +1,123 @@
1
+ import { CalendarDotsIcon, TrashIcon } from '@phosphor-icons/react'
2
+ import { useState } from 'react'
3
+ import { phoneNow } from 'web-sim/runtime'
4
+ import { Button, defineShellPlugin, Field, IconButton, List, ListItem, Log, Row, TextField, type PluginContext } from 'web-sim/shell'
5
+ import { type CalendarState, calendarStore, type EventRecord, INITIAL_CALENDAR, newEvent } from './calendar.ts'
6
+
7
+ /** What the panel and the CLI set on an event. Times are ISO strings, or `datetime-local` values in local time. */
8
+ type Edit = { title?: string; start?: string; end?: string; calendarId?: string }
9
+
10
+ function store(context: PluginContext<CalendarState>) {
11
+ return calendarStore({ get: context.state, set: context.set }, context.sim().device.platform)
12
+ }
13
+
14
+ /** An ISO time as a `datetime-local` value, in local time. */
15
+ function local(iso: string): string {
16
+ const date = new Date(iso)
17
+ const pad = (value: number) => String(value).padStart(2, '0')
18
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`
19
+ }
20
+
21
+ function apply(event: EventRecord, edit: Edit): EventRecord {
22
+ const next = { ...event, lastModifiedDate: new Date(phoneNow()).toISOString() }
23
+ if (edit.title !== undefined) {
24
+ next.title = edit.title
25
+ }
26
+ if (edit.start !== undefined && !Number.isNaN(new Date(edit.start).getTime())) {
27
+ // Moving the start keeps the length, unless the end is set too.
28
+ const length = new Date(event.endDate).getTime() - new Date(event.startDate).getTime()
29
+ next.startDate = new Date(edit.start).toISOString()
30
+ next.endDate = new Date(new Date(edit.start).getTime() + length).toISOString()
31
+ }
32
+ if (edit.end !== undefined && !Number.isNaN(new Date(edit.end).getTime())) {
33
+ next.endDate = new Date(edit.end).toISOString()
34
+ }
35
+ if (edit.calendarId !== undefined) {
36
+ next.calendarId = edit.calendarId
37
+ }
38
+ return next
39
+ }
40
+
41
+ function when(event: EventRecord): string {
42
+ const start = new Date(event.startDate)
43
+ const day = start.toLocaleDateString([], { weekday: 'short', month: 'short', day: 'numeric' })
44
+ if (event.allDay) {
45
+ return `${day} · All day`
46
+ }
47
+ const time = (date: Date) => date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })
48
+ return `${day} · ${time(start)}–${time(new Date(event.endDate))}`
49
+ }
50
+
51
+ export default defineShellPlugin<CalendarState>({
52
+ id: 'calendar',
53
+ title: 'Calendar',
54
+ icon: CalendarDotsIcon,
55
+ initialState: INITIAL_CALENDAR,
56
+ actions: {
57
+ /** Adds an event, by default an hour from the phone's next whole hour in the first calendar that takes changes. */
58
+ add: (context, args) => {
59
+ const edit = (args ?? {}) as Edit
60
+ const records = store(context)
61
+ const calendarId = edit.calendarId ?? records.calendars.all().find((calendar) => calendar.entityType === 'event' && calendar.allowsModifications)!.id
62
+ const id = context.sim().device.platform === 'ios' ? crypto.randomUUID().toUpperCase() : records.events.newId()
63
+ const start = new Date(Math.ceil(phoneNow() / 3_600_000) * 3_600_000).toISOString()
64
+ records.events.put(apply(newEvent(id, calendarId, { title: 'New Event', startDate: start }), edit))
65
+ return { id }
66
+ },
67
+ update: (context, args) => {
68
+ const { id, ...edit } = args as Edit & { id: string }
69
+ const events = store(context).events
70
+ const event = events.get(id)
71
+ if (event === null) {
72
+ throw new Error(`No event '${id}'`)
73
+ }
74
+ events.put(apply(event, edit))
75
+ },
76
+ remove: (context, args) => {
77
+ store(context).events.remove((args as { id: string }).id)
78
+ },
79
+ },
80
+ Panel: ({ state, set, run, sim }) => {
81
+ const [open, setOpen] = useState<string | null>(null)
82
+ const records = calendarStore({ get: () => state, set }, sim.device.platform)
83
+ const colors = new Map(records.calendars.all().map((calendar) => [calendar.id, calendar.color]))
84
+ const events = records.events.all().sort((a, b) => a.startDate.localeCompare(b.startDate))
85
+ return (
86
+ <>
87
+ <Field label="Events" value={events.length}>
88
+ <List>
89
+ {events.map((event) => (
90
+ <ListItem
91
+ key={event.id}
92
+ title={
93
+ <>
94
+ <span style={{ display: 'inline-block', width: 8, height: 8, borderRadius: 4, marginRight: 6, background: colors.get(event.calendarId) ?? 'gray' }} />
95
+ {event.title || 'New Event'}
96
+ </>
97
+ }
98
+ detail={when(event)}
99
+ selected={open === event.id}
100
+ onPress={() => setOpen(open === event.id ? null : event.id)}
101
+ actions={<IconButton icon={TrashIcon} title={`Delete ${event.title || 'event'}`} onClick={() => run('remove', { id: event.id })} />}
102
+ >
103
+ {open === event.id && (
104
+ <>
105
+ <TextField label="Title" placeholder="Title" value={event.title} onChange={(title) => run('update', { id: event.id, title })} />
106
+ <TextField label="Starts" type="datetime-local" value={local(event.startDate)} onChange={(start) => run('update', { id: event.id, start })} />
107
+ <TextField label="Ends" type="datetime-local" value={local(event.endDate)} onChange={(end) => run('update', { id: event.id, end })} />
108
+ </>
109
+ )}
110
+ </ListItem>
111
+ ))}
112
+ </List>
113
+ <Row>
114
+ <Button onClick={() => setOpen((run('add') as { id: string }).id)}>Add event</Button>
115
+ </Row>
116
+ </Field>
117
+ <Field label="App">
118
+ <Log entries={state.log} />
119
+ </Field>
120
+ </>
121
+ )
122
+ },
123
+ })