@lynx-js/lynx-library-headers 0.0.1-alpha.4

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 (135) hide show
  1. package/README.md +53 -0
  2. package/include/base/include/value/lynx_api_types.h +57 -0
  3. package/include/base/include/value/lynx_value_api.h +204 -0
  4. package/include/base/include/value/lynx_value_types.h +73 -0
  5. package/include/capi/lynx_env_capi.h +47 -0
  6. package/include/capi/lynx_event_reporter_service_capi.h +67 -0
  7. package/include/capi/lynx_export.h +27 -0
  8. package/include/capi/lynx_extension_module_capi.h +148 -0
  9. package/include/capi/lynx_extension_module_types_capi.h +17 -0
  10. package/include/capi/lynx_generic_resource_fetcher_capi.h +124 -0
  11. package/include/capi/lynx_group_capi.h +42 -0
  12. package/include/capi/lynx_http_service_capi.h +113 -0
  13. package/include/capi/lynx_load_meta_capi.h +52 -0
  14. package/include/capi/lynx_log_capi.h +69 -0
  15. package/include/capi/lynx_memory_capi.h +28 -0
  16. package/include/capi/lynx_native_module_capi.h +51 -0
  17. package/include/capi/lynx_native_view_capi.h +163 -0
  18. package/include/capi/lynx_resource_request_capi.h +71 -0
  19. package/include/capi/lynx_resource_response_capi.h +92 -0
  20. package/include/capi/lynx_runtime_lifecycle_observer_capi.h +62 -0
  21. package/include/capi/lynx_security_service_capi.h +52 -0
  22. package/include/capi/lynx_service_center_capi.h +50 -0
  23. package/include/capi/lynx_template_bundle_capi.h +39 -0
  24. package/include/capi/lynx_template_data_capi.h +33 -0
  25. package/include/capi/lynx_trace_capi.h +62 -0
  26. package/include/capi/lynx_trail_service_capi.h +35 -0
  27. package/include/capi/lynx_types.h +750 -0
  28. package/include/capi/lynx_update_meta_capi.h +33 -0
  29. package/include/capi/lynx_view_builder_capi.h +113 -0
  30. package/include/capi/lynx_view_capi.h +174 -0
  31. package/include/capi/lynx_view_client_capi.h +81 -0
  32. package/include/capi/lynx_vsync_monitor_capi.h +38 -0
  33. package/include/capi/lynx_windowless_renderer_capi.h +213 -0
  34. package/include/js_native_api.h +608 -0
  35. package/include/js_native_api_types.h +202 -0
  36. package/include/lynx/base/include/value/lynx_api_types.h +57 -0
  37. package/include/lynx/base/include/value/lynx_value_api.h +204 -0
  38. package/include/lynx/base/include/value/lynx_value_types.h +73 -0
  39. package/include/lynx/extension.h +6 -0
  40. package/include/lynx/platform/embedder/public/capi/lynx_env_capi.h +47 -0
  41. package/include/lynx/platform/embedder/public/capi/lynx_event_reporter_service_capi.h +67 -0
  42. package/include/lynx/platform/embedder/public/capi/lynx_export.h +27 -0
  43. package/include/lynx/platform/embedder/public/capi/lynx_extension_module_capi.h +148 -0
  44. package/include/lynx/platform/embedder/public/capi/lynx_extension_module_types_capi.h +17 -0
  45. package/include/lynx/platform/embedder/public/capi/lynx_generic_resource_fetcher_capi.h +124 -0
  46. package/include/lynx/platform/embedder/public/capi/lynx_group_capi.h +42 -0
  47. package/include/lynx/platform/embedder/public/capi/lynx_http_service_capi.h +113 -0
  48. package/include/lynx/platform/embedder/public/capi/lynx_load_meta_capi.h +52 -0
  49. package/include/lynx/platform/embedder/public/capi/lynx_log_capi.h +69 -0
  50. package/include/lynx/platform/embedder/public/capi/lynx_memory_capi.h +28 -0
  51. package/include/lynx/platform/embedder/public/capi/lynx_native_module_capi.h +51 -0
  52. package/include/lynx/platform/embedder/public/capi/lynx_native_view_capi.h +163 -0
  53. package/include/lynx/platform/embedder/public/capi/lynx_resource_request_capi.h +71 -0
  54. package/include/lynx/platform/embedder/public/capi/lynx_resource_response_capi.h +92 -0
  55. package/include/lynx/platform/embedder/public/capi/lynx_runtime_lifecycle_observer_capi.h +62 -0
  56. package/include/lynx/platform/embedder/public/capi/lynx_security_service_capi.h +52 -0
  57. package/include/lynx/platform/embedder/public/capi/lynx_service_center_capi.h +50 -0
  58. package/include/lynx/platform/embedder/public/capi/lynx_template_bundle_capi.h +39 -0
  59. package/include/lynx/platform/embedder/public/capi/lynx_template_data_capi.h +33 -0
  60. package/include/lynx/platform/embedder/public/capi/lynx_trace_capi.h +62 -0
  61. package/include/lynx/platform/embedder/public/capi/lynx_trail_service_capi.h +35 -0
  62. package/include/lynx/platform/embedder/public/capi/lynx_types.h +750 -0
  63. package/include/lynx/platform/embedder/public/capi/lynx_update_meta_capi.h +33 -0
  64. package/include/lynx/platform/embedder/public/capi/lynx_view_builder_capi.h +113 -0
  65. package/include/lynx/platform/embedder/public/capi/lynx_view_capi.h +174 -0
  66. package/include/lynx/platform/embedder/public/capi/lynx_view_client_capi.h +81 -0
  67. package/include/lynx/platform/embedder/public/capi/lynx_vsync_monitor_capi.h +38 -0
  68. package/include/lynx/platform/embedder/public/capi/lynx_windowless_renderer_capi.h +213 -0
  69. package/include/lynx/platform/embedder/public/lynx_env.h +104 -0
  70. package/include/lynx/platform/embedder/public/lynx_event_reporter_service.h +96 -0
  71. package/include/lynx/platform/embedder/public/lynx_event_simulation_proxy.h +31 -0
  72. package/include/lynx/platform/embedder/public/lynx_extension_module.h +521 -0
  73. package/include/lynx/platform/embedder/public/lynx_generic_resource_fetcher.h +178 -0
  74. package/include/lynx/platform/embedder/public/lynx_group.h +70 -0
  75. package/include/lynx/platform/embedder/public/lynx_http_service.h +211 -0
  76. package/include/lynx/platform/embedder/public/lynx_load_meta.h +120 -0
  77. package/include/lynx/platform/embedder/public/lynx_native_module.h +9 -0
  78. package/include/lynx/platform/embedder/public/lynx_native_view.h +201 -0
  79. package/include/lynx/platform/embedder/public/lynx_resource_request.h +56 -0
  80. package/include/lynx/platform/embedder/public/lynx_resource_response.h +63 -0
  81. package/include/lynx/platform/embedder/public/lynx_runtime_lifecycle_observer.h +102 -0
  82. package/include/lynx/platform/embedder/public/lynx_security_service.h +78 -0
  83. package/include/lynx/platform/embedder/public/lynx_service_center.h +64 -0
  84. package/include/lynx/platform/embedder/public/lynx_template_bundle.h +65 -0
  85. package/include/lynx/platform/embedder/public/lynx_template_data.h +104 -0
  86. package/include/lynx/platform/embedder/public/lynx_trail_service.h +81 -0
  87. package/include/lynx/platform/embedder/public/lynx_update_meta.h +56 -0
  88. package/include/lynx/platform/embedder/public/lynx_value.h +270 -0
  89. package/include/lynx/platform/embedder/public/lynx_view.h +364 -0
  90. package/include/lynx/platform/embedder/public/lynx_view_client.h +226 -0
  91. package/include/lynx/platform/embedder/public/lynx_vsync_monitor.h +70 -0
  92. package/include/lynx/platform/embedder/public/lynx_windowless_renderer.h +302 -0
  93. package/include/lynx/registration.h +178 -0
  94. package/include/lynx_env.h +104 -0
  95. package/include/lynx_event_reporter_service.h +96 -0
  96. package/include/lynx_event_simulation_proxy.h +31 -0
  97. package/include/lynx_extension.h +10 -0
  98. package/include/lynx_extension_module.h +521 -0
  99. package/include/lynx_generic_resource_fetcher.h +178 -0
  100. package/include/lynx_group.h +70 -0
  101. package/include/lynx_http_service.h +211 -0
  102. package/include/lynx_load_meta.h +120 -0
  103. package/include/lynx_native_module.h +9 -0
  104. package/include/lynx_native_view.h +201 -0
  105. package/include/lynx_resource_request.h +56 -0
  106. package/include/lynx_resource_response.h +63 -0
  107. package/include/lynx_runtime_lifecycle_observer.h +102 -0
  108. package/include/lynx_security_service.h +78 -0
  109. package/include/lynx_service_center.h +64 -0
  110. package/include/lynx_template_bundle.h +65 -0
  111. package/include/lynx_template_data.h +104 -0
  112. package/include/lynx_trail_service.h +81 -0
  113. package/include/lynx_update_meta.h +56 -0
  114. package/include/lynx_value.h +270 -0
  115. package/include/lynx_view.h +364 -0
  116. package/include/lynx_view_client.h +226 -0
  117. package/include/lynx_vsync_monitor.h +70 -0
  118. package/include/lynx_windowless_renderer.h +302 -0
  119. package/include/napi-inl.deprecated.h +186 -0
  120. package/include/napi-inl.h +6607 -0
  121. package/include/napi.h +3208 -0
  122. package/include/node_api.h +276 -0
  123. package/include/node_api_types.h +59 -0
  124. package/include/third_party/weak-node-api/headers/js_native_api.h +608 -0
  125. package/include/third_party/weak-node-api/headers/js_native_api_types.h +202 -0
  126. package/include/third_party/weak-node-api/headers/napi-inl.deprecated.h +186 -0
  127. package/include/third_party/weak-node-api/headers/napi-inl.h +6607 -0
  128. package/include/third_party/weak-node-api/headers/napi.h +3208 -0
  129. package/include/third_party/weak-node-api/headers/node_api.h +276 -0
  130. package/include/third_party/weak-node-api/headers/node_api_types.h +59 -0
  131. package/include/third_party/weak-node-api/headers/weak_napi_defines.h +331 -0
  132. package/include/third_party/weak-node-api/headers/weak_napi_undefs.h +282 -0
  133. package/include/weak_napi_defines.h +331 -0
  134. package/include/weak_napi_undefs.h +282 -0
  135. package/package.json +29 -0
@@ -0,0 +1,104 @@
1
+ // Copyright 2025 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
5
+ #define PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
6
+
7
+ #include <string>
8
+ #include <unordered_map>
9
+
10
+ #include "capi/lynx_env_capi.h"
11
+ #include "lynx_native_module.h"
12
+
13
+ namespace lynx {
14
+ namespace pub {
15
+
16
+ class LynxEnv {
17
+ public:
18
+ static LynxEnv& GetInstance();
19
+ const char* GetVersion();
20
+ void SetICUDataPath(const char* icu_data_path);
21
+ const char* GetICUDataPath() const;
22
+
23
+ void SetDevtoolAppInfo(const char* name, const char* value);
24
+ void SetDevtoolEnabled(bool enable);
25
+ bool IsDevtoolEnabled();
26
+ bool ConnectDevtool(const char* url);
27
+ void SetOpenCardCallback(lynx_env_open_card_callback callback,
28
+ void* user_data);
29
+ void SetLogboxEnabled(bool enable);
30
+ bool IsLogboxEnabled();
31
+ void RegisterNativeModule(const std::string& module_name,
32
+ napi_module_creator creator, void* opaque);
33
+ void RegisterExtensionModule(const std::string& module_name,
34
+ extension_module_creator creator,
35
+ bool is_lazy_create, void* opaque);
36
+
37
+ LynxEnv(const LynxEnv&) = delete;
38
+ LynxEnv& operator=(const LynxEnv&) = delete;
39
+
40
+ private:
41
+ LynxEnv() = default;
42
+ ~LynxEnv() = default;
43
+ };
44
+
45
+ inline LynxEnv& LynxEnv::GetInstance() {
46
+ static LynxEnv instance;
47
+ return instance;
48
+ }
49
+
50
+ inline const char* LynxEnv::GetVersion() { return lynx_env_get_sdk_version(); }
51
+
52
+ inline void LynxEnv::SetICUDataPath(const char* icu_data_path) {
53
+ lynx_env_set_icu_data_path(icu_data_path);
54
+ }
55
+
56
+ inline const char* LynxEnv::GetICUDataPath() const {
57
+ return lynx_env_get_icu_data_path();
58
+ }
59
+
60
+ inline void LynxEnv::SetDevtoolAppInfo(const char* name, const char* value) {
61
+ lynx_env_set_devtool_app_info(name, value);
62
+ }
63
+
64
+ inline void LynxEnv::SetDevtoolEnabled(bool enable) {
65
+ lynx_env_enable_devtool(enable);
66
+ }
67
+
68
+ inline bool LynxEnv::IsDevtoolEnabled() {
69
+ return lynx_env_is_devtool_enabled();
70
+ }
71
+
72
+ inline bool LynxEnv::ConnectDevtool(const char* url) {
73
+ return lynx_env_connect_devtool(url);
74
+ }
75
+
76
+ inline void LynxEnv::SetOpenCardCallback(lynx_env_open_card_callback callback,
77
+ void* user_data) {
78
+ lynx_env_set_open_card_callback(callback, user_data);
79
+ }
80
+
81
+ inline void LynxEnv::SetLogboxEnabled(bool enable) {
82
+ lynx_env_enable_logbox(enable);
83
+ }
84
+
85
+ inline bool LynxEnv::IsLogboxEnabled() { return lynx_env_is_logbox_enabled(); }
86
+
87
+ inline void LynxEnv::RegisterNativeModule(const std::string& module_name,
88
+ napi_module_creator creator,
89
+ void* opaque) {
90
+ lynx_env_register_native_module(module_name.c_str(), creator, opaque);
91
+ }
92
+
93
+ inline void LynxEnv::RegisterExtensionModule(const std::string& module_name,
94
+ extension_module_creator creator,
95
+ bool is_lazy_create,
96
+ void* opaque) {
97
+ lynx_env_register_extension_module(module_name.c_str(), creator,
98
+ is_lazy_create, opaque);
99
+ }
100
+
101
+ } // namespace pub
102
+ } // namespace lynx
103
+
104
+ #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_ENV_H_
@@ -0,0 +1,96 @@
1
+ // Copyright 2025 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
5
+ #define PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
6
+
7
+ #include <cstdint>
8
+ #include <memory>
9
+ #include <string>
10
+ #include <unordered_map>
11
+ #include <vector>
12
+
13
+ #include "capi/lynx_event_reporter_service_capi.h"
14
+ #include "capi/lynx_service_center_capi.h"
15
+ #include "lynx/base/include/value/lynx_api_types.h"
16
+ #include "lynx_service_center.h"
17
+
18
+ namespace lynx {
19
+ namespace pub {
20
+
21
+ class LynxEventReporterService
22
+ : public LynxServiceBase,
23
+ public std::enable_shared_from_this<LynxEventReporterService> {
24
+ public:
25
+ LynxEventReporterService() = default;
26
+ ~LynxEventReporterService() = default;
27
+
28
+ void InitIfNeeded() override {
29
+ if (event_reporter_service_) {
30
+ return;
31
+ }
32
+ event_reporter_service_ = lynx_event_reporter_service_create_with_finalizer(
33
+ new std::weak_ptr<LynxEventReporterService>(weak_from_this()),
34
+ [](lynx_event_reporter_service_t* event_reporter_service,
35
+ void* user_data) {
36
+ std::weak_ptr<LynxEventReporterService>* weak_ptr =
37
+ reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
38
+ user_data);
39
+ delete weak_ptr;
40
+ });
41
+ lynx_event_reporter_service_bind(
42
+ event_reporter_service_,
43
+ [](lynx_event_reporter_service_t* event_reporter_service,
44
+ const char* event_name, const lynx_value& params) {
45
+ std::weak_ptr<LynxEventReporterService>* weak_ptr =
46
+ reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
47
+ lynx_event_reporter_service_get_user_data(
48
+ event_reporter_service));
49
+ auto shared_event_reporter_service = weak_ptr->lock();
50
+ if (shared_event_reporter_service) {
51
+ shared_event_reporter_service->OnEvent(event_name, params);
52
+ }
53
+ });
54
+
55
+ lynx_event_reporter_service_bind_performance_report_func(
56
+ event_reporter_service_,
57
+ [](lynx_event_reporter_service_t* event_reporter_service,
58
+ const lynx_value& params) {
59
+ std::weak_ptr<LynxEventReporterService>* weak_ptr =
60
+ reinterpret_cast<std::weak_ptr<LynxEventReporterService>*>(
61
+ lynx_event_reporter_service_get_user_data(
62
+ event_reporter_service));
63
+ auto shared_event_reporter_service = weak_ptr->lock();
64
+ if (shared_event_reporter_service) {
65
+ shared_event_reporter_service->OnPerformanceEvent(params);
66
+ }
67
+ });
68
+ }
69
+
70
+ lynx_service_type_e GetServiceType() override {
71
+ return kServiceTypeEventReporter;
72
+ }
73
+
74
+ void* Impl() override { return event_reporter_service_; }
75
+
76
+ /**
77
+ * @brief Interface to receive reported events
78
+ * @param event_name Name of reported event
79
+ * @param props Content of reported event in key-value format
80
+ */
81
+ virtual void OnEvent(const std::string& event_name,
82
+ const lynx_value& params) = 0;
83
+
84
+ /**
85
+ * @brief Interface to receive reported performance events
86
+ * @param params Content of reported event in key-value format
87
+ */
88
+ virtual void OnPerformanceEvent(const lynx_value& params) {}
89
+
90
+ private:
91
+ lynx_event_reporter_service_t* event_reporter_service_ = nullptr;
92
+ };
93
+ } // namespace pub
94
+ } // namespace lynx
95
+
96
+ #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_REPORTER_SERVICE_H_
@@ -0,0 +1,31 @@
1
+ // Copyright 2025 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ #ifndef PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_
6
+ #define PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_
7
+
8
+ #include <string>
9
+
10
+ namespace lynx {
11
+ namespace pub {
12
+
13
+ class LynxEventSimulationProxy {
14
+ public:
15
+ static constexpr const char* kMousePressed = "mousePressed";
16
+ static constexpr const char* kMouseMoved = "mouseMoved";
17
+ static constexpr const char* kMouseReleased = "mouseReleased";
18
+ static constexpr const char* kMouseWheel = "mouseWheel";
19
+ static constexpr const char* kMouseLeftButton = "left";
20
+ static constexpr const char* kMouseRightButton = "right";
21
+
22
+ virtual ~LynxEventSimulationProxy() = default;
23
+ virtual void EmulateTouch(const std::string& event_type, int x, int y,
24
+ const std::string& button, float delta_x,
25
+ float delta_y, int modifiers, int click_count) = 0;
26
+ };
27
+
28
+ } // namespace pub
29
+ } // namespace lynx
30
+
31
+ #endif // PLATFORM_EMBEDDER_PUBLIC_LYNX_EVENT_SIMULATION_PROXY_H_