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.
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/bin/janela.mjs +271 -0
- package/package.json +43 -0
- package/runtime/janela.ts +193 -0
- package/shim/wvshim.cc +201 -0
- package/templates/index.html +48 -0
- package/templates/janela.conf.json +10 -0
- package/templates/main.ts +37 -0
- package/vendor-webview/LICENSE +22 -0
- package/vendor-webview/core/include/webview/api.h +251 -0
- package/vendor-webview/core/include/webview/backends.hh +40 -0
- package/vendor-webview/core/include/webview/c_api_impl.hh +258 -0
- package/vendor-webview/core/include/webview/detail/backends/cocoa_webkit.hh +626 -0
- package/vendor-webview/core/include/webview/detail/backends/gtk_webkitgtk.hh +355 -0
- package/vendor-webview/core/include/webview/detail/backends/win32_edge.hh +909 -0
- package/vendor-webview/core/include/webview/detail/basic_result.hh +119 -0
- package/vendor-webview/core/include/webview/detail/engine_base.hh +382 -0
- package/vendor-webview/core/include/webview/detail/exceptions.hh +42 -0
- package/vendor-webview/core/include/webview/detail/json.hh +337 -0
- package/vendor-webview/core/include/webview/detail/native_library.hh +170 -0
- package/vendor-webview/core/include/webview/detail/optional.hh +118 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSApplication.hh +107 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSBundle.hh +56 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSEvent.hh +71 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSInvocation.hh +66 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSMethodSignature.hh +52 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNotification.hh +51 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNumber.hh +53 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSObject.hh +51 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSOpenPanel.hh +71 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSPoint.hh +53 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSRect.hh +53 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSavePanel.hh +52 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSize.hh +53 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSString.hh +87 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURL.hh +63 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURLRequest.hh +52 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSValue.hh +56 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSView.hh +91 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSWindow.hh +137 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/cocoa.hh +59 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/types.hh +49 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/objc/Class.hh +55 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/objc/autoreleasepool.hh +70 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/objc/invoke.hh +75 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/objc/memory.hh +57 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/objc/objc.hh +47 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKOpenPanelParameters.hh +57 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKScriptMessage.hh +51 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserContentController.hh +61 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserScript.hh +71 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebView.hh +108 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebViewConfiguration.hh +60 -0
- package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/webkit.hh +46 -0
- package/vendor-webview/core/include/webview/detail/platform/linux/gtk/compat.hh +137 -0
- package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/compat.hh +142 -0
- package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/dmabuf.hh +167 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/com_init_wrapper.hh +126 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/dpi.hh +161 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/dwmapi.hh +67 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/iid.hh +78 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/ntdll.hh +58 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/reg_key.hh +135 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/shcore.hh +59 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/theme.hh +76 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/user32.hh +90 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/version.hh +151 -0
- package/vendor-webview/core/include/webview/detail/platform/windows/webview2/loader.hh +391 -0
- package/vendor-webview/core/include/webview/detail/user_script.hh +76 -0
- package/vendor-webview/core/include/webview/detail/utility/string.hh +99 -0
- package/vendor-webview/core/include/webview/errors.h +67 -0
- package/vendor-webview/core/include/webview/errors.hh +85 -0
- package/vendor-webview/core/include/webview/json_deprecated.hh +61 -0
- package/vendor-webview/core/include/webview/macros.h +123 -0
- package/vendor-webview/core/include/webview/types.h +81 -0
- package/vendor-webview/core/include/webview/types.hh +48 -0
- package/vendor-webview/core/include/webview/version.h +67 -0
- package/vendor-webview/core/include/webview/webview.h +32 -0
- package/vendor-webview/core/include/webview.h +15 -0
|
@@ -0,0 +1,85 @@
|
|
|
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_ERRORS_HH
|
|
27
|
+
#define WEBVIEW_ERRORS_HH
|
|
28
|
+
|
|
29
|
+
#if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
30
|
+
|
|
31
|
+
#include "errors.h"
|
|
32
|
+
|
|
33
|
+
#include <exception>
|
|
34
|
+
#include <string>
|
|
35
|
+
|
|
36
|
+
namespace webview {
|
|
37
|
+
|
|
38
|
+
class error_info {
|
|
39
|
+
public:
|
|
40
|
+
error_info(webview_error_t code, const std::string &message = {}) noexcept
|
|
41
|
+
: m_code{code}, m_message{message} {}
|
|
42
|
+
error_info() = default;
|
|
43
|
+
|
|
44
|
+
webview_error_t code() const { return m_code; }
|
|
45
|
+
const std::string &message() const { return m_message; }
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
webview_error_t m_code{WEBVIEW_ERROR_UNSPECIFIED};
|
|
49
|
+
std::string m_message;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class exception : public std::exception {
|
|
53
|
+
public:
|
|
54
|
+
exception(webview_error_t code, const std::string &message,
|
|
55
|
+
std::exception_ptr cause) noexcept
|
|
56
|
+
: exception{error_info{code, message}, cause} {}
|
|
57
|
+
|
|
58
|
+
exception(webview_error_t code, const std::string &message) noexcept
|
|
59
|
+
: exception{error_info{code, message}} {}
|
|
60
|
+
|
|
61
|
+
exception(const error_info &error, std::exception_ptr cause) noexcept
|
|
62
|
+
: m_error{error},
|
|
63
|
+
// NOLINTNEXTLINE(bugprone-throw-keyword-missing)
|
|
64
|
+
m_cause{cause} {}
|
|
65
|
+
|
|
66
|
+
exception(const error_info &error) noexcept : m_error{error} {}
|
|
67
|
+
|
|
68
|
+
exception() = default;
|
|
69
|
+
|
|
70
|
+
const error_info &error() const { return m_error; }
|
|
71
|
+
std::exception_ptr cause() const { return m_cause; }
|
|
72
|
+
|
|
73
|
+
const char *what() const noexcept override {
|
|
74
|
+
return m_error.message().c_str();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private:
|
|
78
|
+
error_info m_error{WEBVIEW_ERROR_UNSPECIFIED};
|
|
79
|
+
std::exception_ptr m_cause;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace webview
|
|
83
|
+
|
|
84
|
+
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
85
|
+
#endif // WEBVIEW_ERRORS_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_JSON_HH
|
|
27
|
+
#define WEBVIEW_JSON_HH
|
|
28
|
+
|
|
29
|
+
#if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
30
|
+
|
|
31
|
+
#include "detail/json.hh"
|
|
32
|
+
#include "macros.h"
|
|
33
|
+
|
|
34
|
+
namespace webview {
|
|
35
|
+
|
|
36
|
+
WEBVIEW_DEPRECATED_PRIVATE
|
|
37
|
+
inline int json_parse_c(const char *s, size_t sz, const char *key, size_t keysz,
|
|
38
|
+
const char **value, size_t *valuesz) {
|
|
39
|
+
return detail::json_parse_c(s, sz, key, keysz, value, valuesz);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
WEBVIEW_DEPRECATED_PRIVATE
|
|
43
|
+
inline std::string json_escape(const std::string &s) {
|
|
44
|
+
return detail::json_escape(s);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
WEBVIEW_DEPRECATED_PRIVATE
|
|
48
|
+
inline int json_unescape(const char *s, size_t n, char *out) {
|
|
49
|
+
return detail::json_unescape(s, n, out);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
WEBVIEW_DEPRECATED_PRIVATE
|
|
53
|
+
inline std::string json_parse(const std::string &s, const std::string &key,
|
|
54
|
+
const int index) {
|
|
55
|
+
return detail::json_parse(s, key, index);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
} // namespace webview
|
|
59
|
+
|
|
60
|
+
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
61
|
+
#endif // WEBVIEW_JSON_HH
|
|
@@ -0,0 +1,123 @@
|
|
|
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_MACROS_H
|
|
27
|
+
#define WEBVIEW_MACROS_H
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Used to specify function linkage such as extern, inline, etc.
|
|
31
|
+
*
|
|
32
|
+
* When @c WEBVIEW_API is not already defined, the defaults are as follows:
|
|
33
|
+
*
|
|
34
|
+
* - @c inline when compiling C++ code.
|
|
35
|
+
* - @c extern when compiling C code.
|
|
36
|
+
*
|
|
37
|
+
* The following macros can be used to automatically set an appropriate
|
|
38
|
+
* value for @c WEBVIEW_API:
|
|
39
|
+
*
|
|
40
|
+
* - Define @c WEBVIEW_BUILD_SHARED when building a shared library.
|
|
41
|
+
* - Define @c WEBVIEW_SHARED when using a shared library.
|
|
42
|
+
* - Define @c WEBVIEW_STATIC when building or using a static library.
|
|
43
|
+
*/
|
|
44
|
+
#ifndef WEBVIEW_API
|
|
45
|
+
#if defined(WEBVIEW_SHARED) || defined(WEBVIEW_BUILD_SHARED)
|
|
46
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
47
|
+
#if defined(WEBVIEW_BUILD_SHARED)
|
|
48
|
+
#define WEBVIEW_API __declspec(dllexport)
|
|
49
|
+
#else
|
|
50
|
+
#define WEBVIEW_API __declspec(dllimport)
|
|
51
|
+
#endif
|
|
52
|
+
#else
|
|
53
|
+
#define WEBVIEW_API __attribute__((visibility("default")))
|
|
54
|
+
#endif
|
|
55
|
+
#elif !defined(WEBVIEW_STATIC) && defined(__cplusplus)
|
|
56
|
+
#define WEBVIEW_API inline
|
|
57
|
+
#else
|
|
58
|
+
#define WEBVIEW_API extern
|
|
59
|
+
#endif
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
/// @name Used internally
|
|
63
|
+
/// @{
|
|
64
|
+
|
|
65
|
+
/// Utility macro for stringifying a macro argument.
|
|
66
|
+
#define WEBVIEW_STRINGIFY(x) #x
|
|
67
|
+
|
|
68
|
+
/// Utility macro for stringifying the result of a macro argument expansion.
|
|
69
|
+
#define WEBVIEW_EXPAND_AND_STRINGIFY(x) WEBVIEW_STRINGIFY(x)
|
|
70
|
+
|
|
71
|
+
/// @}
|
|
72
|
+
|
|
73
|
+
/// @brief Evaluates to @c TRUE for error codes indicating success or
|
|
74
|
+
/// additional information.
|
|
75
|
+
#define WEBVIEW_SUCCEEDED(error) ((int)(error) >= 0)
|
|
76
|
+
|
|
77
|
+
/// Evaluates to @c TRUE if the given error code indicates failure.
|
|
78
|
+
#define WEBVIEW_FAILED(error) ((int)(error) < 0)
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
#ifndef WEBVIEW_HEADER
|
|
82
|
+
|
|
83
|
+
#if defined(__APPLE__)
|
|
84
|
+
#define WEBVIEW_PLATFORM_DARWIN
|
|
85
|
+
#elif defined(__unix__)
|
|
86
|
+
#define WEBVIEW_PLATFORM_LINUX
|
|
87
|
+
#elif defined(_WIN32)
|
|
88
|
+
#define WEBVIEW_PLATFORM_WINDOWS
|
|
89
|
+
#else
|
|
90
|
+
#error "Unable to detect current platform"
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
#if !defined(WEBVIEW_GTK) && !defined(WEBVIEW_COCOA) && !defined(WEBVIEW_EDGE)
|
|
94
|
+
#if defined(WEBVIEW_PLATFORM_DARWIN)
|
|
95
|
+
#define WEBVIEW_COCOA
|
|
96
|
+
#elif defined(WEBVIEW_PLATFORM_LINUX)
|
|
97
|
+
#define WEBVIEW_GTK
|
|
98
|
+
#elif defined(WEBVIEW_PLATFORM_WINDOWS)
|
|
99
|
+
#define WEBVIEW_EDGE
|
|
100
|
+
#else
|
|
101
|
+
#error "please, specify webview backend"
|
|
102
|
+
#endif
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
#ifndef WEBVIEW_DEPRECATED
|
|
106
|
+
#if __cplusplus >= 201402L
|
|
107
|
+
#define WEBVIEW_DEPRECATED(reason) [[deprecated(reason)]]
|
|
108
|
+
#elif defined(_MSC_VER)
|
|
109
|
+
#define WEBVIEW_DEPRECATED(reason) __declspec(deprecated(reason))
|
|
110
|
+
#else
|
|
111
|
+
#define WEBVIEW_DEPRECATED(reason) __attribute__((deprecated(reason)))
|
|
112
|
+
#endif
|
|
113
|
+
#endif
|
|
114
|
+
|
|
115
|
+
#ifndef WEBVIEW_DEPRECATED_PRIVATE
|
|
116
|
+
#define WEBVIEW_DEPRECATED_PRIVATE \
|
|
117
|
+
WEBVIEW_DEPRECATED("Private API should not be used")
|
|
118
|
+
#endif
|
|
119
|
+
|
|
120
|
+
#endif // WEBVIEW_HEADER
|
|
121
|
+
#endif // __cplusplus
|
|
122
|
+
|
|
123
|
+
#endif // WEBVIEW_MACROS_H
|
|
@@ -0,0 +1,81 @@
|
|
|
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_TYPES_H
|
|
27
|
+
#define WEBVIEW_TYPES_H
|
|
28
|
+
|
|
29
|
+
/// Holds the elements of a MAJOR.MINOR.PATCH version number.
|
|
30
|
+
typedef struct {
|
|
31
|
+
/// Major version.
|
|
32
|
+
unsigned int major;
|
|
33
|
+
/// Minor version.
|
|
34
|
+
unsigned int minor;
|
|
35
|
+
/// Patch version.
|
|
36
|
+
unsigned int patch;
|
|
37
|
+
} webview_version_t;
|
|
38
|
+
|
|
39
|
+
/// Holds the library's version information.
|
|
40
|
+
typedef struct {
|
|
41
|
+
/// The elements of the version number.
|
|
42
|
+
webview_version_t version;
|
|
43
|
+
/// SemVer 2.0.0 version number in MAJOR.MINOR.PATCH format.
|
|
44
|
+
char version_number[32];
|
|
45
|
+
/// SemVer 2.0.0 pre-release labels prefixed with "-" if specified, otherwise
|
|
46
|
+
/// an empty string.
|
|
47
|
+
char pre_release[48];
|
|
48
|
+
/// SemVer 2.0.0 build metadata prefixed with "+", otherwise an empty string.
|
|
49
|
+
char build_metadata[48];
|
|
50
|
+
} webview_version_info_t;
|
|
51
|
+
|
|
52
|
+
/// Pointer to a webview instance.
|
|
53
|
+
typedef void *webview_t;
|
|
54
|
+
|
|
55
|
+
/// Native handle kind. The actual type depends on the backend.
|
|
56
|
+
typedef enum {
|
|
57
|
+
/// Top-level window. @c GtkWindow pointer (GTK), @c NSWindow pointer (Cocoa)
|
|
58
|
+
/// or @c HWND (Win32).
|
|
59
|
+
WEBVIEW_NATIVE_HANDLE_KIND_UI_WINDOW,
|
|
60
|
+
/// Browser widget. @c GtkWidget pointer (GTK), @c NSView pointer (Cocoa) or
|
|
61
|
+
/// @c HWND (Win32).
|
|
62
|
+
WEBVIEW_NATIVE_HANDLE_KIND_UI_WIDGET,
|
|
63
|
+
/// Browser controller. @c WebKitWebView pointer (WebKitGTK), @c WKWebView
|
|
64
|
+
/// pointer (Cocoa/WebKit) or @c ICoreWebView2Controller pointer
|
|
65
|
+
/// (Win32/WebView2).
|
|
66
|
+
WEBVIEW_NATIVE_HANDLE_KIND_BROWSER_CONTROLLER
|
|
67
|
+
} webview_native_handle_kind_t;
|
|
68
|
+
|
|
69
|
+
/// Window size hints
|
|
70
|
+
typedef enum {
|
|
71
|
+
/// Width and height are default size.
|
|
72
|
+
WEBVIEW_HINT_NONE,
|
|
73
|
+
/// Width and height are minimum bounds.
|
|
74
|
+
WEBVIEW_HINT_MIN,
|
|
75
|
+
/// Width and height are maximum bounds.
|
|
76
|
+
WEBVIEW_HINT_MAX,
|
|
77
|
+
/// Window size can not be changed by a user.
|
|
78
|
+
WEBVIEW_HINT_FIXED
|
|
79
|
+
} webview_hint_t;
|
|
80
|
+
|
|
81
|
+
#endif // WEBVIEW_TYPES_H
|
|
@@ -0,0 +1,48 @@
|
|
|
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_TYPES_HH
|
|
27
|
+
#define WEBVIEW_TYPES_HH
|
|
28
|
+
|
|
29
|
+
#if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
30
|
+
|
|
31
|
+
#include "detail/basic_result.hh"
|
|
32
|
+
#include "errors.hh"
|
|
33
|
+
|
|
34
|
+
#include <functional>
|
|
35
|
+
|
|
36
|
+
namespace webview {
|
|
37
|
+
|
|
38
|
+
using dispatch_fn_t = std::function<void()>;
|
|
39
|
+
|
|
40
|
+
template <typename T>
|
|
41
|
+
using result = detail::basic_result<T, error_info, exception>;
|
|
42
|
+
|
|
43
|
+
using noresult = detail::basic_result<void, error_info, exception>;
|
|
44
|
+
|
|
45
|
+
} // namespace webview
|
|
46
|
+
|
|
47
|
+
#endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
|
|
48
|
+
#endif // WEBVIEW_TYPES_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_VERSION_H
|
|
27
|
+
#define WEBVIEW_VERSION_H
|
|
28
|
+
|
|
29
|
+
#include "macros.h"
|
|
30
|
+
|
|
31
|
+
/// @name Version
|
|
32
|
+
/// @{
|
|
33
|
+
|
|
34
|
+
#ifndef WEBVIEW_VERSION_MAJOR
|
|
35
|
+
/// The current library major version.
|
|
36
|
+
#define WEBVIEW_VERSION_MAJOR 0
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef WEBVIEW_VERSION_MINOR
|
|
40
|
+
/// The current library minor version.
|
|
41
|
+
#define WEBVIEW_VERSION_MINOR 12
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#ifndef WEBVIEW_VERSION_PATCH
|
|
45
|
+
/// The current library patch version.
|
|
46
|
+
#define WEBVIEW_VERSION_PATCH 0
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
#ifndef WEBVIEW_VERSION_PRE_RELEASE
|
|
50
|
+
/// SemVer 2.0.0 pre-release labels prefixed with "-".
|
|
51
|
+
#define WEBVIEW_VERSION_PRE_RELEASE ""
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
#ifndef WEBVIEW_VERSION_BUILD_METADATA
|
|
55
|
+
/// SemVer 2.0.0 build metadata prefixed with "+".
|
|
56
|
+
#define WEBVIEW_VERSION_BUILD_METADATA ""
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
/// SemVer 2.0.0 version number in MAJOR.MINOR.PATCH format.
|
|
60
|
+
#define WEBVIEW_VERSION_NUMBER \
|
|
61
|
+
WEBVIEW_EXPAND_AND_STRINGIFY(WEBVIEW_VERSION_MAJOR) \
|
|
62
|
+
"." WEBVIEW_EXPAND_AND_STRINGIFY( \
|
|
63
|
+
WEBVIEW_VERSION_MINOR) "." WEBVIEW_EXPAND_AND_STRINGIFY(WEBVIEW_VERSION_PATCH)
|
|
64
|
+
|
|
65
|
+
/// @}
|
|
66
|
+
|
|
67
|
+
#endif // WEBVIEW_VERSION_H
|
|
@@ -0,0 +1,32 @@
|
|
|
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_H
|
|
27
|
+
#define WEBVIEW_H
|
|
28
|
+
|
|
29
|
+
#include "api.h"
|
|
30
|
+
#include "c_api_impl.hh"
|
|
31
|
+
|
|
32
|
+
#endif // WEBVIEW_H
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file webview.h
|
|
3
|
+
*
|
|
4
|
+
* @deprecated This header file is deprecated. Use `webview/webview.h` instead.
|
|
5
|
+
*
|
|
6
|
+
* This file is provided for backward-compatibility with existing code
|
|
7
|
+
* such as `#include "webview.h"`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef WEBVIEW_ROOT_H
|
|
11
|
+
#define WEBVIEW_ROOT_H
|
|
12
|
+
|
|
13
|
+
#include "webview/webview.h"
|
|
14
|
+
|
|
15
|
+
#endif // WEBVIEW_ROOT_H
|