janela 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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/bin/janela.mjs +271 -0
  4. package/package.json +43 -0
  5. package/runtime/janela.ts +193 -0
  6. package/shim/wvshim.cc +201 -0
  7. package/templates/index.html +48 -0
  8. package/templates/janela.conf.json +10 -0
  9. package/templates/main.ts +37 -0
  10. package/vendor-webview/LICENSE +22 -0
  11. package/vendor-webview/core/include/webview/api.h +251 -0
  12. package/vendor-webview/core/include/webview/backends.hh +40 -0
  13. package/vendor-webview/core/include/webview/c_api_impl.hh +258 -0
  14. package/vendor-webview/core/include/webview/detail/backends/cocoa_webkit.hh +626 -0
  15. package/vendor-webview/core/include/webview/detail/backends/gtk_webkitgtk.hh +355 -0
  16. package/vendor-webview/core/include/webview/detail/backends/win32_edge.hh +909 -0
  17. package/vendor-webview/core/include/webview/detail/basic_result.hh +119 -0
  18. package/vendor-webview/core/include/webview/detail/engine_base.hh +382 -0
  19. package/vendor-webview/core/include/webview/detail/exceptions.hh +42 -0
  20. package/vendor-webview/core/include/webview/detail/json.hh +337 -0
  21. package/vendor-webview/core/include/webview/detail/native_library.hh +170 -0
  22. package/vendor-webview/core/include/webview/detail/optional.hh +118 -0
  23. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSApplication.hh +107 -0
  24. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSBundle.hh +56 -0
  25. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSEvent.hh +71 -0
  26. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSInvocation.hh +66 -0
  27. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSMethodSignature.hh +52 -0
  28. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNotification.hh +51 -0
  29. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNumber.hh +53 -0
  30. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSObject.hh +51 -0
  31. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSOpenPanel.hh +71 -0
  32. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSPoint.hh +53 -0
  33. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSRect.hh +53 -0
  34. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSavePanel.hh +52 -0
  35. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSize.hh +53 -0
  36. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSString.hh +87 -0
  37. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURL.hh +63 -0
  38. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURLRequest.hh +52 -0
  39. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSValue.hh +56 -0
  40. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSView.hh +91 -0
  41. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSWindow.hh +137 -0
  42. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/cocoa.hh +59 -0
  43. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/types.hh +49 -0
  44. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/Class.hh +55 -0
  45. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/autoreleasepool.hh +70 -0
  46. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/invoke.hh +75 -0
  47. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/memory.hh +57 -0
  48. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/objc.hh +47 -0
  49. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKOpenPanelParameters.hh +57 -0
  50. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKScriptMessage.hh +51 -0
  51. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserContentController.hh +61 -0
  52. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserScript.hh +71 -0
  53. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebView.hh +108 -0
  54. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebViewConfiguration.hh +60 -0
  55. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/webkit.hh +46 -0
  56. package/vendor-webview/core/include/webview/detail/platform/linux/gtk/compat.hh +137 -0
  57. package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/compat.hh +142 -0
  58. package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/dmabuf.hh +167 -0
  59. package/vendor-webview/core/include/webview/detail/platform/windows/com_init_wrapper.hh +126 -0
  60. package/vendor-webview/core/include/webview/detail/platform/windows/dpi.hh +161 -0
  61. package/vendor-webview/core/include/webview/detail/platform/windows/dwmapi.hh +67 -0
  62. package/vendor-webview/core/include/webview/detail/platform/windows/iid.hh +78 -0
  63. package/vendor-webview/core/include/webview/detail/platform/windows/ntdll.hh +58 -0
  64. package/vendor-webview/core/include/webview/detail/platform/windows/reg_key.hh +135 -0
  65. package/vendor-webview/core/include/webview/detail/platform/windows/shcore.hh +59 -0
  66. package/vendor-webview/core/include/webview/detail/platform/windows/theme.hh +76 -0
  67. package/vendor-webview/core/include/webview/detail/platform/windows/user32.hh +90 -0
  68. package/vendor-webview/core/include/webview/detail/platform/windows/version.hh +151 -0
  69. package/vendor-webview/core/include/webview/detail/platform/windows/webview2/loader.hh +391 -0
  70. package/vendor-webview/core/include/webview/detail/user_script.hh +76 -0
  71. package/vendor-webview/core/include/webview/detail/utility/string.hh +99 -0
  72. package/vendor-webview/core/include/webview/errors.h +67 -0
  73. package/vendor-webview/core/include/webview/errors.hh +85 -0
  74. package/vendor-webview/core/include/webview/json_deprecated.hh +61 -0
  75. package/vendor-webview/core/include/webview/macros.h +123 -0
  76. package/vendor-webview/core/include/webview/types.h +81 -0
  77. package/vendor-webview/core/include/webview/types.hh +48 -0
  78. package/vendor-webview/core/include/webview/version.h +67 -0
  79. package/vendor-webview/core/include/webview/webview.h +32 -0
  80. package/vendor-webview/core/include/webview.h +15 -0
@@ -0,0 +1,59 @@
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_COCOA_COCOA_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_COCOA_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ // IWYU pragma: begin_exports
36
+ #include "NSApplication.hh"
37
+ #include "NSBundle.hh"
38
+ #include "NSEvent.hh"
39
+ #include "NSInvocation.hh"
40
+ #include "NSMethodSignature.hh"
41
+ #include "NSNotification.hh"
42
+ #include "NSNumber.hh"
43
+ #include "NSObject.hh"
44
+ #include "NSOpenPanel.hh"
45
+ #include "NSPoint.hh"
46
+ #include "NSRect.hh"
47
+ #include "NSSavePanel.hh"
48
+ #include "NSSize.hh"
49
+ #include "NSString.hh"
50
+ #include "NSURL.hh"
51
+ #include "NSURLRequest.hh"
52
+ #include "NSValue.hh"
53
+ #include "NSView.hh"
54
+ #include "NSWindow.hh"
55
+ // IWYU pragma: end_exports
56
+
57
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
58
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
59
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_COCOA_HH
@@ -0,0 +1,49 @@
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_COCOA_TYPES_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_TYPES_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include <objc/NSObjCRuntime.h>
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ using NSTimeInterval = double;
42
+
43
+ } // namespace cocoa
44
+ } // namespace detail
45
+ } // namespace webview
46
+
47
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
48
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
49
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_TYPES_HH
@@ -0,0 +1,55 @@
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_OBJC_CLASS_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_OBJC_CLASS_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN)
34
+
35
+ #include "invoke.hh"
36
+
37
+ #include <objc/objc-runtime.h>
38
+
39
+ namespace webview {
40
+ namespace detail {
41
+ namespace objc {
42
+
43
+ inline id Class_new(Class class_) {
44
+ return msg_send<id>(class_, selector("new"));
45
+ }
46
+
47
+ inline Class get_class(const char *name) { return objc_getClass(name); }
48
+
49
+ } // namespace objc
50
+ } // namespace detail
51
+ } // namespace webview
52
+
53
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
54
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
55
+ #endif // WEBVIEW_PLATFORM_DARWIN_OBJC_CLASS_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_OBJC_AUTORELEASEPOOL_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_OBJC_AUTORELEASEPOOL_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN)
34
+
35
+ #include "invoke.hh"
36
+
37
+ #include <objc/objc-runtime.h>
38
+
39
+ namespace webview {
40
+ namespace detail {
41
+ namespace objc {
42
+
43
+ // Wrapper around NSAutoreleasePool that drains the pool on destruction.
44
+ class autoreleasepool {
45
+ public:
46
+ autoreleasepool()
47
+ : m_pool(msg_send<id>(get_class("NSAutoreleasePool"), selector("new"))) {}
48
+
49
+ ~autoreleasepool() {
50
+ if (m_pool) {
51
+ msg_send<void>(m_pool, selector("drain"));
52
+ }
53
+ }
54
+
55
+ autoreleasepool(const autoreleasepool &) = delete;
56
+ autoreleasepool &operator=(const autoreleasepool &) = delete;
57
+ autoreleasepool(autoreleasepool &&) = delete;
58
+ autoreleasepool &operator=(autoreleasepool &&) = delete;
59
+
60
+ private:
61
+ id m_pool{};
62
+ };
63
+
64
+ } // namespace objc
65
+ } // namespace detail
66
+ } // namespace webview
67
+
68
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN)
69
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
70
+ #endif // WEBVIEW_PLATFORM_DARWIN_OBJC_AUTORELEASEPOOL_HH
@@ -0,0 +1,75 @@
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_OBJC_INVOKE_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_OBJC_INVOKE_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN)
34
+
35
+ #include <objc/objc-runtime.h>
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace objc {
40
+
41
+ // A convenient template function for unconditionally casting the specified
42
+ // C-like function into a function that can be called with the given return
43
+ // type and arguments. Caller takes full responsibility for ensuring that
44
+ // the function call is valid. It is assumed that the function will not
45
+ // throw exceptions.
46
+ template <typename Result, typename Callable, typename... Args>
47
+ Result invoke(Callable callable, Args... args) noexcept {
48
+ return reinterpret_cast<Result (*)(Args...)>(callable)(args...);
49
+ }
50
+
51
+ // Calls objc_msgSend.
52
+ template <typename Result, typename... Args>
53
+ Result msg_send(Args... args) noexcept {
54
+ return invoke<Result>(objc_msgSend, args...);
55
+ }
56
+
57
+ // Calls objc_msgSend_stret or objc_msgSend depending on architecture.
58
+ template <typename Result, typename... Args>
59
+ Result msg_send_stret(Args... args) noexcept {
60
+ #if defined(__arm64__)
61
+ return invoke<Result>(objc_msgSend, args...);
62
+ #else
63
+ return invoke<Result>(objc_msgSend_stret, args...);
64
+ #endif
65
+ }
66
+
67
+ inline SEL selector(const char *name) { return sel_registerName(name); }
68
+
69
+ } // namespace objc
70
+ } // namespace detail
71
+ } // namespace webview
72
+
73
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN)
74
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
75
+ #endif // WEBVIEW_PLATFORM_DARWIN_OBJC_INVOKE_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_OBJC_MEMORY_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_OBJC_MEMORY_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN)
34
+
35
+ #include "invoke.hh"
36
+
37
+ #include <objc/objc-runtime.h>
38
+
39
+ namespace webview {
40
+ namespace detail {
41
+ namespace objc {
42
+
43
+ inline id autorelease(id object) {
44
+ return msg_send<id>(object, selector("autorelease"));
45
+ }
46
+
47
+ inline id retain(id object) { return msg_send<id>(object, selector("retain")); }
48
+
49
+ inline void release(id object) { msg_send<void>(object, selector("release")); }
50
+
51
+ } // namespace objc
52
+ } // namespace detail
53
+ } // namespace webview
54
+
55
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN)
56
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
57
+ #endif // WEBVIEW_PLATFORM_DARWIN_OBJC_MEMORY_HH
@@ -0,0 +1,47 @@
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_OBJC_OBJC_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_OBJC_OBJC_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN)
34
+
35
+ // IWYU pragma: begin_exports
36
+ #include "Class.hh"
37
+ #include "autoreleasepool.hh"
38
+ #include "invoke.hh"
39
+ #include "memory.hh"
40
+ // IWYU pragma: end_exports
41
+
42
+ #include <objc/NSObjCRuntime.h>
43
+ #include <objc/objc-runtime.h>
44
+
45
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN)
46
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
47
+ #endif // WEBVIEW_PLATFORM_DARWIN_OBJC_OBJC_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_WEBKIT_WKOPENPANELPARAMETERS_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKOPENPANELPARAMETERS_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace webkit {
40
+
41
+ inline bool WKOpenPanelParameters_get_allowsMultipleSelection(id self) {
42
+ return static_cast<bool>(
43
+ objc::msg_send<BOOL>(self, objc::selector("allowsMultipleSelection")));
44
+ }
45
+
46
+ inline bool WKOpenPanelParameters_get_allowsDirectories(id self) {
47
+ return static_cast<bool>(
48
+ objc::msg_send<BOOL>(self, objc::selector("allowsDirectories")));
49
+ }
50
+
51
+ } // namespace webkit
52
+ } // namespace detail
53
+ } // namespace webview
54
+
55
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
56
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
57
+ #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKOPENPANELPARAMETERS_HH
@@ -0,0 +1,51 @@
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_WEBKIT_WKSCRIPTMESSAGE_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKSCRIPTMESSAGE_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace webkit {
40
+
41
+ inline id WKScriptMessage_get_body(id self) {
42
+ return objc::msg_send<id>(self, objc::selector("body"));
43
+ }
44
+
45
+ } // namespace webkit
46
+ } // namespace detail
47
+ } // namespace webview
48
+
49
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
50
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
51
+ #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKSCRIPTMESSAGE_HH
@@ -0,0 +1,61 @@
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_WEBKIT_WKUSERCONTENTCONTROLLER_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERCONTENTCONTROLLER_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace webkit {
40
+
41
+ inline void WKUserContentController_addScriptMessageHandler(id self, id handler,
42
+ id name) {
43
+ objc::msg_send<void>(self, objc::selector("addScriptMessageHandler:name:"),
44
+ handler, name);
45
+ }
46
+
47
+ inline void WKUserContentController_addUserScript(id self, id user_script) {
48
+ objc::msg_send<void>(self, objc::selector("addUserScript:"), user_script);
49
+ }
50
+
51
+ inline void WKUserContentController_removeAllUserScripts(id self) {
52
+ objc::msg_send<id>(self, objc::selector("removeAllUserScripts"));
53
+ }
54
+
55
+ } // namespace webkit
56
+ } // namespace detail
57
+ } // namespace webview
58
+
59
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
60
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
61
+ #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERCONTENTCONTROLLER_HH
@@ -0,0 +1,71 @@
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_WEBKIT_WKUSERSCRIPT_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERSCRIPT_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace webkit {
40
+
41
+ enum WKUserScriptInjectionTime : NSInteger {
42
+ WKUserScriptInjectionTimeAtDocumentStart = 0
43
+ };
44
+
45
+ inline id WKUserScript_alloc() {
46
+ return objc::msg_send<id>(objc::get_class("WKUserScript"),
47
+ objc::selector("alloc"));
48
+ }
49
+
50
+ inline id WKUserScript_initWithSource(id self, id source,
51
+ WKUserScriptInjectionTime injection_time,
52
+ bool for_main_frame_only) {
53
+ return objc::msg_send<id>(
54
+ self, objc::selector("initWithSource:injectionTime:forMainFrameOnly:"),
55
+ source, injection_time, static_cast<BOOL>(for_main_frame_only));
56
+ }
57
+
58
+ inline id WKUserScript_withSource(id source,
59
+ WKUserScriptInjectionTime injection_time,
60
+ bool for_main_frame_only) {
61
+ return objc::autorelease(WKUserScript_initWithSource(
62
+ WKUserScript_alloc(), source, injection_time, for_main_frame_only));
63
+ }
64
+
65
+ } // namespace webkit
66
+ } // namespace detail
67
+ } // namespace webview
68
+
69
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
70
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
71
+ #endif // WEBVIEW_PLATFORM_DARWIN_WEBKIT_WKUSERSCRIPT_HH