#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
bitflags! {
#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
#[cfg_attr(feature = "wasm", tsify(type = "number"))]
#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
#[cfg_attr(feature = "napi", napi)]
#[derive(Debug)]
pub struct ElementCategory: u32 {
const Animation = 1 << 0;
const BasicShape = 1 << 1;
const Container = 1 << 2;
const Descriptive = 1 << 3;
const FilterPrimitive = 1 << 4;
const Gradient = 1 << 5;
const Graphics = 1 << 6;
const GraphicsReferencing = 1 << 7;
const LightSource = 1 << 8;
const NeverRendered = 1 << 9;
const PaintServer = 1 << 10;
const Renderable = 1 << 11;
const Shape = 1 << 12;
const Structural = 1 << 13;
const StructurallyExternal = 1 << 14;
const TextContent = 1 << 15;
const TextContentChild = 1 << 16;
const TransferFunction = 1 << 17;
const Uncategorised = 1 << 18;
}
}
#[cfg(feature = "serde")]
impl serde::Serialize for ElementCategory {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
self.bits().serialize(serializer)
}
}
#[cfg(feature = "serde")]
impl<'de> serde::Deserialize<'de> for ElementCategory {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
Ok(ElementCategory::from_bits_retain(u32::deserialize(
deserializer,
)?))
}
}
#[cfg(feature = "napi")]
#[napi]
impl ElementCategory {
#[napi(constructor)]
pub fn new(bits: u32) -> ElementCategory {
ElementCategory::from_bits_retain(bits)
}
#[napi]
pub const fn to_bits(&self) -> u32 {
self.bits()
}
}
bitflags! {
pub struct ElementInfo: u32 {
const NonRendering = 1 << 0;
const Legacy = 1 << 1;
}
}