janela 0.9.0 → 0.10.1

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 (46) hide show
  1. package/README.md +19 -1
  2. package/bin/janela.mjs +262 -12
  3. package/package.json +4 -3
  4. package/runtime/ios.ts +483 -0
  5. package/shim/ios/app.cc +330 -0
  6. package/templates/janela.conf.json +5 -0
  7. package/templates/react/files/janela.conf.json +5 -0
  8. package/templates/solid/files/janela.conf.json +5 -0
  9. package/templates/svelte/files/janela.conf.json +5 -0
  10. package/templates/vue/files/janela.conf.json +5 -0
  11. package/vendor-webview/core/include/webview/backends.hh +1 -0
  12. package/vendor-webview/core/include/webview/detail/backends/cocoa_webkit.hh +4 -1
  13. package/vendor-webview/core/include/webview/detail/backends/uikit_webkit.hh +460 -0
  14. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSBundle.hh +4 -2
  15. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSInvocation.hh +4 -2
  16. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSMethodSignature.hh +4 -2
  17. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNotification.hh +4 -2
  18. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNumber.hh +4 -2
  19. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSObject.hh +4 -2
  20. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSPoint.hh +4 -2
  21. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSRect.hh +4 -2
  22. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSize.hh +4 -2
  23. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSString.hh +4 -2
  24. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURL.hh +4 -2
  25. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURLRequest.hh +4 -2
  26. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSValue.hh +4 -2
  27. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/types.hh +4 -2
  28. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/Class.hh +4 -1
  29. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/autoreleasepool.hh +4 -1
  30. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/invoke.hh +4 -1
  31. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/memory.hh +4 -1
  32. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/objc.hh +4 -1
  33. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/UIApplication.hh +80 -0
  34. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/UIScreen.hh +57 -0
  35. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/UIView.hh +79 -0
  36. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/UIViewController.hh +70 -0
  37. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/UIWindow.hh +67 -0
  38. package/vendor-webview/core/include/webview/detail/platform/darwin/uikit/uikit.hh +43 -0
  39. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKOpenPanelParameters.hh +4 -2
  40. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKScriptMessage.hh +4 -2
  41. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserContentController.hh +4 -2
  42. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserScript.hh +4 -2
  43. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebView.hh +4 -2
  44. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebViewConfiguration.hh +4 -2
  45. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/webkit.hh +4 -2
  46. package/vendor-webview/core/include/webview/macros.h +12 -2
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -47,6 +48,7 @@ inline id NSURLRequest_requestWithURL(id url) {
47
48
  } // namespace detail
48
49
  } // namespace webview
49
50
 
50
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
51
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
52
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
51
53
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
52
54
  #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSURLREQUEST_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -51,6 +52,7 @@ inline void NSValue_getValue(id self, void *value, NSUInteger size) {
51
52
  } // namespace detail
52
53
  } // namespace webview
53
54
 
54
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
55
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
56
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
55
57
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
56
58
  #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSVALUE_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include <objc/NSObjCRuntime.h>
36
37
 
@@ -44,6 +45,7 @@ using NSTimeInterval = double;
44
45
  } // namespace detail
45
46
  } // namespace webview
46
47
 
47
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
48
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
49
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
48
50
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
49
51
  #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_TYPES_HH
@@ -34,7 +34,10 @@
34
34
 
35
35
  #include "invoke.hh"
36
36
 
37
- #include <objc/objc-runtime.h>
37
+ // <objc/objc-runtime.h> is an umbrella that only exists in the macOS SDK;
38
+ // these two are present on every Apple platform.
39
+ #include <objc/message.h>
40
+ #include <objc/runtime.h>
38
41
 
39
42
  namespace webview {
40
43
  namespace detail {
@@ -34,7 +34,10 @@
34
34
 
35
35
  #include "invoke.hh"
36
36
 
37
- #include <objc/objc-runtime.h>
37
+ // <objc/objc-runtime.h> is an umbrella that only exists in the macOS SDK;
38
+ // these two are present on every Apple platform.
39
+ #include <objc/message.h>
40
+ #include <objc/runtime.h>
38
41
 
39
42
  namespace webview {
40
43
  namespace detail {
@@ -32,7 +32,10 @@
32
32
 
33
33
  #if defined(WEBVIEW_PLATFORM_DARWIN)
34
34
 
35
- #include <objc/objc-runtime.h>
35
+ // <objc/objc-runtime.h> is an umbrella that only exists in the macOS SDK;
36
+ // these two are present on every Apple platform.
37
+ #include <objc/message.h>
38
+ #include <objc/runtime.h>
36
39
 
37
40
  namespace webview {
38
41
  namespace detail {
@@ -34,7 +34,10 @@
34
34
 
35
35
  #include "invoke.hh"
36
36
 
37
- #include <objc/objc-runtime.h>
37
+ // <objc/objc-runtime.h> is an umbrella that only exists in the macOS SDK;
38
+ // these two are present on every Apple platform.
39
+ #include <objc/message.h>
40
+ #include <objc/runtime.h>
38
41
 
39
42
  namespace webview {
40
43
  namespace detail {
@@ -40,7 +40,10 @@
40
40
  // IWYU pragma: end_exports
41
41
 
42
42
  #include <objc/NSObjCRuntime.h>
43
- #include <objc/objc-runtime.h>
43
+ // <objc/objc-runtime.h> is an umbrella that only exists in the macOS SDK;
44
+ // these two are present on every Apple platform.
45
+ #include <objc/message.h>
46
+ #include <objc/runtime.h>
44
47
 
45
48
  #endif // defined(WEBVIEW_PLATFORM_DARWIN)
46
49
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
@@ -0,0 +1,80 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UIAPPLICATION_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UIAPPLICATION_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ #include <crt_externs.h>
38
+
39
+ extern "C" {
40
+ /// Declared here rather than by including <UIKit/UIKit.h> so that this header
41
+ /// stays compilable as plain C++ — the rest of the backend drives UIKit
42
+ /// through the Objective-C runtime, and pulling in the framework headers
43
+ /// would require Objective-C++.
44
+ int UIApplicationMain(int argc, char *argv[], id principal_class_name,
45
+ id delegate_class_name);
46
+ }
47
+
48
+ namespace webview {
49
+ namespace detail {
50
+ namespace uikit {
51
+
52
+ /// Runs the application's main loop.
53
+ ///
54
+ /// This does not return. UIKit owns the process from here until the system
55
+ /// terminates the app; there is no supported way for an iOS app to exit
56
+ /// itself, which is why the backend's terminate is a no-op.
57
+ ///
58
+ /// argc/argv are read from the process rather than threaded through the
59
+ /// public API, so that an embedder does not have to hand them to the engine.
60
+ inline int UIApplication_main(id principal_class_name, id delegate_class_name) {
61
+ return UIApplicationMain(*_NSGetArgc(), *_NSGetArgv(), principal_class_name,
62
+ delegate_class_name);
63
+ }
64
+
65
+ inline id UIApplication_get_sharedApplication() {
66
+ return objc::msg_send<id>(objc::get_class("UIApplication"),
67
+ objc::selector("sharedApplication"));
68
+ }
69
+
70
+ inline id UIApplication_get_delegate(id self) {
71
+ return objc::msg_send<id>(self, objc::selector("delegate"));
72
+ }
73
+
74
+ } // namespace uikit
75
+ } // namespace detail
76
+ } // namespace webview
77
+
78
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
79
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
80
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UIAPPLICATION_HH
@@ -0,0 +1,57 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UISCREEN_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UISCREEN_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "../cocoa/NSRect.hh"
36
+ #include "../objc/objc.hh"
37
+
38
+ namespace webview {
39
+ namespace detail {
40
+ namespace uikit {
41
+
42
+ inline id UIScreen_get_mainScreen() {
43
+ return objc::msg_send<id>(objc::get_class("UIScreen"),
44
+ objc::selector("mainScreen"));
45
+ }
46
+
47
+ inline cocoa::NSRect UIScreen_get_bounds(id self) {
48
+ return objc::msg_send_stret<cocoa::NSRect>(self, objc::selector("bounds"));
49
+ }
50
+
51
+ } // namespace uikit
52
+ } // namespace detail
53
+ } // namespace webview
54
+
55
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
56
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
57
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UISCREEN_HH
@@ -0,0 +1,79 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEW_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEW_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "../cocoa/NSRect.hh"
36
+ #include "../objc/objc.hh"
37
+
38
+ namespace webview {
39
+ namespace detail {
40
+ namespace uikit {
41
+
42
+ /// Mirrors UIViewAutoresizing. A web view added as a subview of the root
43
+ /// view controller's view must track it on both axes, or it keeps the size it
44
+ /// was created with when the device rotates.
45
+ enum UIViewAutoresizing : NSUInteger {
46
+ UIViewAutoresizingNone = 0,
47
+ UIViewAutoresizingFlexibleWidth = 1 << 1,
48
+ UIViewAutoresizingFlexibleHeight = 1 << 4
49
+ };
50
+
51
+ inline id UIView_withFrame(cocoa::NSRect frame) {
52
+ return objc::msg_send<id>(
53
+ objc::msg_send<id>(objc::get_class("UIView"), objc::selector("alloc")),
54
+ objc::selector("initWithFrame:"), frame);
55
+ }
56
+
57
+ inline void UIView_addSubview(id self, id subview) {
58
+ objc::msg_send<void>(self, objc::selector("addSubview:"), subview);
59
+ }
60
+
61
+ inline cocoa::NSRect UIView_get_bounds(id self) {
62
+ return objc::msg_send_stret<cocoa::NSRect>(self, objc::selector("bounds"));
63
+ }
64
+
65
+ inline void UIView_set_frame(id self, cocoa::NSRect frame) {
66
+ objc::msg_send<void>(self, objc::selector("setFrame:"), frame);
67
+ }
68
+
69
+ inline void UIView_set_autoresizingMask(id self, UIViewAutoresizing mask) {
70
+ objc::msg_send<void>(self, objc::selector("setAutoresizingMask:"), mask);
71
+ }
72
+
73
+ } // namespace uikit
74
+ } // namespace detail
75
+ } // namespace webview
76
+
77
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
78
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
79
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEW_HH
@@ -0,0 +1,70 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEWCONTROLLER_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEWCONTROLLER_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "../cocoa/NSString.hh"
36
+ #include "../objc/objc.hh"
37
+
38
+ namespace webview {
39
+ namespace detail {
40
+ namespace uikit {
41
+
42
+ inline id UIViewController_new() {
43
+ return objc::msg_send<id>(
44
+ objc::msg_send<id>(objc::get_class("UIViewController"),
45
+ objc::selector("alloc")),
46
+ objc::selector("init"));
47
+ }
48
+
49
+ inline id UIViewController_get_view(id self) {
50
+ return objc::msg_send<id>(self, objc::selector("view"));
51
+ }
52
+
53
+ inline void UIViewController_set_view(id self, id view) {
54
+ objc::msg_send<void>(self, objc::selector("setView:"), view);
55
+ }
56
+
57
+ /// Not shown anywhere by default on iOS; set so that embedders which place
58
+ /// the controller inside a navigation stack get a sensible title.
59
+ inline void UIViewController_set_title(id self, const std::string &title) {
60
+ objc::msg_send<void>(self, objc::selector("setTitle:"),
61
+ cocoa::NSString_stringWithUTF8String(title));
62
+ }
63
+
64
+ } // namespace uikit
65
+ } // namespace detail
66
+ } // namespace webview
67
+
68
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
69
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
70
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UIVIEWCONTROLLER_HH
@@ -0,0 +1,67 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UIWINDOW_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UIWINDOW_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "../cocoa/NSRect.hh"
36
+ #include "../objc/objc.hh"
37
+
38
+ namespace webview {
39
+ namespace detail {
40
+ namespace uikit {
41
+
42
+ inline id UIWindow_withFrame(cocoa::NSRect frame) {
43
+ return objc::msg_send<id>(
44
+ objc::msg_send<id>(objc::get_class("UIWindow"), objc::selector("alloc")),
45
+ objc::selector("initWithFrame:"), frame);
46
+ }
47
+
48
+ inline void UIWindow_set_rootViewController(id self, id controller) {
49
+ objc::msg_send<void>(self, objc::selector("setRootViewController:"),
50
+ controller);
51
+ }
52
+
53
+ inline id UIWindow_get_rootViewController(id self) {
54
+ return objc::msg_send<id>(self, objc::selector("rootViewController"));
55
+ }
56
+
57
+ inline void UIWindow_makeKeyAndVisible(id self) {
58
+ objc::msg_send<void>(self, objc::selector("makeKeyAndVisible"));
59
+ }
60
+
61
+ } // namespace uikit
62
+ } // namespace detail
63
+ } // namespace webview
64
+
65
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
66
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
67
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UIWINDOW_HH
@@ -0,0 +1,43 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_UIKIT_UIKIT_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_UIKIT_UIKIT_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
34
+
35
+ #include "UIApplication.hh"
36
+ #include "UIScreen.hh"
37
+ #include "UIView.hh"
38
+ #include "UIViewController.hh"
39
+ #include "UIWindow.hh"
40
+
41
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_UIKIT)
42
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
43
+ #endif // WEBVIEW_PLATFORM_DARWIN_UIKIT_UIKIT_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -52,6 +53,7 @@ inline bool WKOpenPanelParameters_get_allowsDirectories(id self) {
52
53
  } // namespace detail
53
54
  } // namespace webview
54
55
 
55
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
56
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
57
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
56
58
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
57
59
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKOPENPANELPARAMETERS_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -46,6 +47,7 @@ inline id WKScriptMessage_get_body(id self) {
46
47
  } // namespace detail
47
48
  } // namespace webview
48
49
 
49
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
50
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
51
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
50
52
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
51
53
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKSCRIPTMESSAGE_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -56,6 +57,7 @@ inline void WKUserContentController_removeAllUserScripts(id self) {
56
57
  } // namespace detail
57
58
  } // namespace webview
58
59
 
59
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
60
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
61
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
60
62
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
61
63
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERCONTENTCONTROLLER_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -66,6 +67,7 @@ inline id WKUserScript_withSource(id source,
66
67
  } // namespace detail
67
68
  } // namespace webview
68
69
 
69
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
70
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
71
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
70
72
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
71
73
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERSCRIPT_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -103,6 +104,7 @@ inline void WKWebView_set_inspectable(id self, bool inspectable) {
103
104
  } // namespace detail
104
105
  } // namespace webview
105
106
 
106
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
107
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
108
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
107
109
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
108
110
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKWEBVIEW_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  #include "../objc/objc.hh"
36
37
 
@@ -55,6 +56,7 @@ inline id WKWebViewConfiguration_get_preferences(id self) {
55
56
  } // namespace detail
56
57
  } // namespace webview
57
58
 
58
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
59
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
60
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
59
61
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
60
62
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKWEBVIEWCONFIGURATION_HH
@@ -30,7 +30,8 @@
30
30
 
31
31
  #include "../../../../macros.h"
32
32
 
33
- #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && \
34
+ (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
34
35
 
35
36
  // IWYU pragma: begin_exports
36
37
  #include "WKOpenPanelParameters.hh"
@@ -41,6 +42,7 @@
41
42
  #include "WKWebViewConfiguration.hh"
42
43
  // IWYU pragma: end_exports
43
44
 
44
- #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
45
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) &&
46
+ // (defined(WEBVIEW_COCOA) || defined(WEBVIEW_UIKIT))
45
47
  #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
46
48
  #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_HH