diff --git a/components/arkui/src/lib.rs b/components/arkui/src/lib.rs
index d04e32a..1077257 100644
--- a/components/arkui/src/lib.rs
+++ b/components/arkui/src/lib.rs
@@ -50,6 +50,10 @@ pub mod native_interface;
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub mod native_node;
+#[cfg(feature = "api-12")]
+#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+pub mod native_node_napi;
+
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub mod native_type;
diff --git a/components/arkui/src/native_node_napi.rs b/components/arkui/src/native_node_napi.rs
new file mode 100644
index 0000000..118de65
--- /dev/null
+++ b/components/arkui/src/native_node_napi.rs
@@ -0,0 +1,2 @@
+mod native_node_napi_ffi;
+pub use native_node_napi_ffi::*;
diff --git a/components/arkui/src/native_node_napi/native_node_napi_ffi.rs b/components/arkui/src/native_node_napi/native_node_napi_ffi.rs
new file mode 100644
index 0000000..19b6926
--- /dev/null
+++ b/components/arkui/src/native_node_napi/native_node_napi_ffi.rs
@@ -0,0 +1,504 @@
+// automatically generated by rust-bindgen 0.71.1
+
+#![allow(non_upper_case_globals)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+use crate::drawable_descriptor::ArkUI_DrawableDescriptor;
+use crate::native_type::*;
+use ohos_sys_opaque_types::{napi_env, napi_value};
+
+extern "C" {
+ /// Obtains a FrameNode object on the ArkTS side and maps it to an ArkUI_NodeHandle object on the
+ /// native side.
+ ///
+ /// # Arguments
+ ///
+ /// `env` - Indicates the NAPI environment pointer.
+ ///
+ /// `frameNode` - Indicates the FrameNode object created on the ArkTS side.
+ ///
+ /// `handle` - Indicates the pointer to the ArkUI_NodeHandle object.
+ ///
+ /// # Returns
+ ///
+ /// Returns the error code.
+ /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNodeHandleFromNapiValue(
+ env: napi_env,
+ frameNode: napi_value,
+ handle: *mut ArkUI_NodeHandle,
+ ) -> i32;
+ /// Obtains a UIContext object on the ArkTS side and maps it to an ArkUI_ContextHandle object on the
+ /// native side.
+ ///
+ /// # Arguments
+ ///
+ /// `env` - ndicates the NAPI environment pointer.
+ ///
+ /// `value` - Indicates the UIContext object created on the ArkTS side.
+ ///
+ /// `context` - Indicates the pointer to the ArkUI_ContextHandle object.
+ ///
+ /// # Returns
+ ///
+ /// Returns the error code.
+ /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetContextFromNapiValue(
+ env: napi_env,
+ value: napi_value,
+ context: *mut ArkUI_ContextHandle,
+ ) -> i32;
+ /// Obtains a NodeContent object on the ArkTS side and maps it to an ArkUI_NodeContentHandle
+ /// object on the native side.
+ ///
+ /// # Arguments
+ ///
+ /// `env` - ndicates the NAPI environment pointer.
+ ///
+ /// `value` - Indicates the NodeContent object created on the ArkTS side.
+ ///
+ /// `content` - Indicates the pointer to the ArkUI_NodeContentHandle object.
+ ///
+ /// # Returns
+ ///
+ /// Returns the error code.
+ /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNodeContentFromNapiValue(
+ env: napi_env,
+ value: napi_value,
+ content: *mut ArkUI_NodeContentHandle,
+ ) -> i32;
+ /// Obtains a DrawableDescriptor object on the ArkTS side and maps it to an
+ /// ArkUI_DrawableDescriptro object on the native side.
+ ///
+ /// # Arguments
+ ///
+ /// `env` - Indicates the NAPI environment pointer.
+ ///
+ /// `value` - Indicates the DrawableDescriptor object created on the ArkTS side.
+ ///
+ /// `drawableDescriptor` - Indicates the pointer to the ArkUI_DrawableDescriptro object.
+ ///
+ /// # Returns
+ ///
+ /// Returns the error code.
+ /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetDrawableDescriptorFromNapiValue(
+ env: napi_env,
+ value: napi_value,
+ drawableDescriptor: *mut *mut ArkUI_DrawableDescriptor,
+ ) -> i32;
+ /// Obtains a Resource object on the ArkTS side and maps it to an
+ /// ArkUI_DrawableDescriptro object on the native side.
+ ///
+ /// # Arguments
+ ///
+ /// `env` - Indicates the NAPI environment pointer.
+ ///
+ /// `value` - Indicates the Resource object created on the ArkTS side.
+ ///
+ /// `drawableDescriptor` - Indicates the pointer to the ArkUI_DrawableDescriptro object.
+ ///
+ /// # Returns
+ ///
+ /// Returns the error code.
+ /// Returns [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// Returns [`ARKUI_ERROR_CODE_PARAM_INVALID`] if a parameter error occurs.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetDrawableDescriptorFromResourceNapiValue(
+ env: napi_env,
+ value: napi_value,
+ drawableDescriptor: *mut *mut ArkUI_DrawableDescriptor,
+ ) -> i32;
+ /// Obtain the ID of the Navigation component where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which NavigationID writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavigationId(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the name of the NavDestination component where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which NavDestination name writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationName(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Based on the given index value, obtain the length of the Navigation stack where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `length` - The length of the stack. After the operation succeeds, the result is written back to this parameter.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or length is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavStackLength(node: ArkUI_NodeHandle, length: *mut i32) -> ArkUI_ErrorCode;
+ /// Based on the given index value, obtain the page name of the corresponding position
+ /// in the navigation stack where the node is located.
+ /// Index values are counted from 0, with 0 being the bottom of the stack.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `index` - The index of the NavDestination in the stack is queried.
+ ///
+ /// `buffer` - The buffer to which NavDestination index writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_NODE_INDEX_INVALID`] if index is an invalid value.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationNameByIndex(
+ node: ArkUI_NodeHandle,
+ index: i32,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the ID of the NavDestination component where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which NavDestination ID writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationId(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the state of the NavDestination component where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `state` - The state value of NavDestination is written back into this parameter.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or state is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationState(
+ node: ArkUI_NodeHandle,
+ state: *mut ArkUI_NavDestinationState,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the index of the NavDestination component on the Navigation stack where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `index` - Index value, counted from 0.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or index is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in Navigation.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationIndex(
+ node: ArkUI_NodeHandle,
+ index: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the parameters of the NavDestination component where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// # Returns
+ ///
+ /// The parameters.
+ /// If a null pointer is returned, it may be because the node is empty or the parameters does not exist.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetNavDestinationParam(node: ArkUI_NodeHandle) -> napi_value;
+ /// Obtain the index of the page where the node resides in the Router page stack.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `index` - Index value, counted from 1.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or index is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in RouterPage.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetRouterPageIndex(node: ArkUI_NodeHandle, index: *mut i32) -> ArkUI_ErrorCode;
+ /// Obtain the name of the page where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which page name writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in RouterPage.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetRouterPageName(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the path of the page where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which page path writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in RouterPage.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetRouterPagePath(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the state of the page where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `state` - The state value of the page is written back to this parameter.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node or state is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in RouterPage.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetRouterPageState(
+ node: ArkUI_NodeHandle,
+ state: *mut ArkUI_RouterPageState,
+ ) -> ArkUI_ErrorCode;
+ /// Obtain the ID of the page where the node is located.
+ ///
+ /// # Arguments
+ ///
+ /// `node` - The node.
+ ///
+ /// `buffer` - The buffer to which page ID writes to the memory,
+ /// memory space needs to be allocated by the developer.
+ ///
+ /// `bufferSize` - The buffer size
+ ///
+ /// `writeLength` - Indicates the string length actually written to the buffer
+ /// when returning [`ARKUI_ERROR_CODE_NO_ERROR`].
+ /// Indicates the minimum buffer size that can accommodate the target
+ /// when [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] is returned.
+ ///
+ /// # Returns
+ ///
+ /// The error code.
+ /// [`ARKUI_ERROR_CODE_NO_ERROR`] if the operation is successful.
+ /// [`ARKUI_ERROR_CODE_PARAM_INVALID`] if the node, buffer or writeLength is null.
+ /// [`ARKUI_ERROR_CODE_GET_INFO_FAILED`] if query information failed,
+ /// this may be because the node is not in RouterPage.
+ /// [`ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR`] If the buffer size is less than the minimum buffer size.
+ ///
+ /// Available since API-level: 12
+ #[cfg(feature = "api-12")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
+ pub fn OH_ArkUI_GetRouterPageId(
+ node: ArkUI_NodeHandle,
+ buffer: *mut ::core::ffi::c_char,
+ bufferSize: i32,
+ writeLength: *mut i32,
+ ) -> ArkUI_ErrorCode;
+}
diff --git a/components/opaque-types/src/opaque_types.rs b/components/opaque-types/src/opaque_types.rs
index 026094b..d2cb183 100644
--- a/components/opaque-types/src/opaque_types.rs
+++ b/components/opaque-types/src/opaque_types.rs
@@ -4,6 +4,16 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
+#[repr(C)]
+pub struct napi_env__ {
+ _unused: [u8; 0],
+}
+pub type napi_env = *mut napi_env__;
+#[repr(C)]
+pub struct napi_value__ {
+ _unused: [u8; 0],
+}
+pub type napi_value = *mut napi_value__;
#[repr(C)]
pub struct OH_NativeBuffer {
_unused: [u8; 0],
diff --git a/components/opaque-types/wrapper.h b/components/opaque-types/wrapper.h
index 6179698..1e11c43 100644
--- a/components/opaque-types/wrapper.h
+++ b/components/opaque-types/wrapper.h
@@ -1,3 +1,4 @@
+#include "napi/native_api.h"
#include "native_buffer/native_buffer.h"
#include "multimedia/image_framework/image/pixelmap_native.h"
#include "multimedia/image_framework/image_pixel_map_mdk.h"
diff --git a/scripts/generator/src/main.rs b/scripts/generator/src/main.rs
index 325070b..2258d2c 100644
--- a/scripts/generator/src/main.rs
+++ b/scripts/generator/src/main.rs
@@ -258,6 +258,7 @@ fn get_bindings_config(api_version: u32) -> Vec {
.no_copy("napi_extended_error_info")
.no_copy("napi_node_version")
.no_copy("napi_module")
+ .raw_line("pub use ohos_sys_opaque_types::{napi_env, napi_value};")
}),
},
BindingConf {
@@ -730,6 +731,12 @@ fn get_module_bindings_config(api_version: u32) -> Vec {
.blocklist_var("MAX_COMPONENT_EVENT_ARG_NUM")
.raw_line("use crate::ui_input_event::ArkUI_UIInputEvent;")
},
+ "native_node_napi" => {
+ builder
+ .raw_line("use ohos_sys_opaque_types::{napi_env, napi_value};")
+ .raw_line("use crate::drawable_descriptor::ArkUI_DrawableDescriptor;")
+
+ },
"native_type" => {
builder
.raw_line("use crate::drawable_descriptor::ArkUI_DrawableDescriptor;")
diff --git a/scripts/generator/src/opaque_types.rs b/scripts/generator/src/opaque_types.rs
index 67c3ef6..a8d409a 100644
--- a/scripts/generator/src/opaque_types.rs
+++ b/scripts/generator/src/opaque_types.rs
@@ -1,4 +1,4 @@
-pub(crate) static OPAQUE_TYPES: [&str; 9] = [
+pub(crate) static OPAQUE_TYPES: [&str; 13] = [
"OH_PixelmapNative",
"NativePixelMap_",
"OH_NativeBuffer",
@@ -8,4 +8,8 @@ pub(crate) static OPAQUE_TYPES: [&str; 9] = [
"OHNativeWindowBuffer",
"ArkUI_AccessibilityProvider",
"OH_NativeColorSpaceManager",
+ "napi_env",
+ "napi_env__",
+ "napi_value",
+ "napi_value__",
];
\ No newline at end of file
diff --git a/src/napi/napi_ffi.rs b/src/napi/napi_ffi.rs
index 1f07beb..64da977 100644
--- a/src/napi/napi_ffi.rs
+++ b/src/napi/napi_ffi.rs
@@ -3,6 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
+pub use ohos_sys_opaque_types::{napi_env, napi_value};
pub const NAPI_VERSION: u32 = 8;
pub const NAPI_VERSION_EXPERIMENTAL: u32 = 2147483647;
@@ -82,16 +83,6 @@ impl napi_task_priority {
pub struct napi_task_priority(pub ::core::ffi::c_uint);
pub type char16_t = u16;
#[repr(C)]
-pub struct napi_env__ {
- _unused: [u8; 0],
-}
-pub type napi_env = *mut napi_env__;
-#[repr(C)]
-pub struct napi_value__ {
- _unused: [u8; 0],
-}
-pub type napi_value = *mut napi_value__;
-#[repr(C)]
pub struct napi_ref__ {
_unused: [u8; 0],
}
@@ -298,7 +289,6 @@ pub type napi_finalize = ::core::option::Option<
),
>;
#[repr(C)]
-#[derive(Debug)]
pub struct napi_property_descriptor {
pub utf8name: *const ::core::ffi::c_char,
pub name: napi_value,