[package]
name = "sugarloaf"
authors.workspace = true
version.workspace = true
edition.workspace = true
license.workspace = true
keywords.workspace = true
include = [
  "Cargo.toml",
  "src/**/*.ttf",
  "src/**/*.otf",
  "src/**/*.wgsl",
  "src/**/*.rs"
]
description = "Sugarloaf is Rio rendering engine, designed to be multiplatform. It is based on WebGPU, Rust library for Desktops and WebAssembly for Web (JavaScript). This project is created and maintained for Rio terminal purposes but feel free to use it."
documentation = "https://docs.rs/crate/sugarloaf/latest"
repository = "https://github.com/raphamorim/rio/tree/main/sugarloaf"

[lib]
crate-type = ["cdylib", "rlib"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
targets = [
    "x86_64-unknown-linux-gnu",
    "x86_64-apple-darwin",
    "x86_64-pc-windows-msvc",
    "wasm32-unknown-unknown",
]

[dependencies]
wgpu = { workspace = true }
bytemuck = { workspace = true }
tracing = { workspace = true }
serde = { workspace = true }
twox-hash = { version = "1.6.3", default-features = false }
image_rs = { workspace = true }
unicode-width = { workspace = true }
guillotiere = "0.6.2"
ordered-float = "4.2.0"
rustc-hash = { workspace = true }
raw-window-handle = { workspace = true }
parking_lot = { workspace = true }
ab_glyph = "0.2.28"
linked-hash-map = "0.5.6"
xi-unicode = "0.3.0"
approx = "0.5.1"
lru = "0.12.4"
skrifa = "0.20.0"
yazi = { version = "0.1.6", optional = true }
zeno = { version = "0.2.2", optional = true, default-features = false }
futures = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
crossbeam-channel = "0.5.13"
crossbeam-deque = "0.8.5"
rayon = "1.10.0"
twox-hash = { version = "1.6.3", default-features = false, features = ["std"] }
memmap2 = { version = "0.9.3" }
slotmap = { version = "1.0.7", default-features = false }
tinyvec = { version = "1.6.0", features = ["alloc"] }
ttf-parser = { version = "0.21.1", default-features = false, features = ["opentype-layout", "apple-layout", "variable-fonts", "glyph-names"]}

[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "android"))))'.dependencies]
fontconfig-parser = { version = "0.5.3", default-features = false }

[dev-dependencies]
rio-window = { workspace = true }
image = "0.24.6"
png = "0.17.8"
deflate = "1.0.0"
criterion = "0.5.1"

[features]
default = ["scale", "render"]
scale = ["yazi", "zeno"]
render = ["scale", "zeno/eval"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = { workspace = true }
console_log = { workspace = true }
js-sys = "0.3.61"
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = { workspace = true }
wasm-bindgen-test = { workspace = true }
web-sys = { version = "0.3.61", features = [
    "Location",
    "Document",
    "Navigator",
    "Node",
    "NodeList",
    "Gpu",
    "GpuAdapter",
    "GpuAddressMode",
    "GpuAutoLayoutMode",
    "GpuBindGroup",
    "GpuBindGroupDescriptor",
    "GpuBindGroupEntry",
    "GpuBindGroupLayout",
    "GpuBindGroupLayoutDescriptor",
    "GpuBindGroupLayoutEntry",
    "GpuBlendComponent",
    "GpuBlendFactor",
    "GpuBlendOperation",
    "GpuBlendState",
    "GpuBuffer",
    "GpuBufferBinding",
    "GpuBufferBindingLayout",
    "GpuBufferBindingType",
    "GpuBufferDescriptor",
    "GpuCanvasAlphaMode",
    "GpuCanvasContext",
    "GpuCanvasConfiguration",
    "GpuColorDict",
    "GpuColorTargetState",
    "GpuCommandBuffer",
    "GpuCommandBufferDescriptor",
    "GpuCommandEncoder",
    "GpuCommandEncoderDescriptor",
    "GpuCompareFunction",
    "GpuCompilationInfo",
    "GpuCompilationMessage",
    "GpuCompilationMessageType",
    "GpuComputePassDescriptor",
    "GpuComputePassEncoder",
    "GpuComputePipeline",
    "GpuComputePipelineDescriptor",
    "GpuCullMode",
    "GpuDepthStencilState",
    "GpuDevice",
    "GpuDeviceDescriptor",
    "GpuDeviceLostInfo",
    "GpuDeviceLostReason",
    "GpuError",
    "GpuErrorFilter",
    # "GpuExtent2dDict", Not yet implemented in web_sys
    "GpuExtent3dDict",
    "GpuFeatureName",
    "GpuFilterMode",
    "GpuFragmentState",
    "GpuFrontFace",
    "GpuImageCopyBuffer",
    "GpuImageCopyExternalImage",
    "GpuImageCopyTexture",
    "GpuImageCopyTextureTagged",
    "GpuImageDataLayout",
    "GpuIndexFormat",
    "GpuLoadOp",
    "gpu_map_mode",
    "GpuMipmapFilterMode",
    "GpuMultisampleState",
    "GpuObjectDescriptorBase",
    "GpuOrigin2dDict",
    "GpuOrigin3dDict",
    "GpuOutOfMemoryError",
    "GpuPipelineDescriptorBase",
    "GpuPipelineLayout",
    "GpuPipelineLayoutDescriptor",
    "GpuPowerPreference",
    "GpuPrimitiveState",
    "GpuPrimitiveTopology",
    "GpuProgrammableStage",
    "GpuQuerySet",
    "GpuQuerySetDescriptor",
    "GpuQueryType",
    "GpuQueue",
    "GpuRenderBundle",
    "GpuRenderBundleDescriptor",
    "GpuRenderBundleEncoder",
    "GpuRenderBundleEncoderDescriptor",
    "GpuRenderPassColorAttachment",
    "GpuRenderPassDepthStencilAttachment",
    "GpuRenderPassDescriptor",
    "GpuRenderPassEncoder",
    "GpuRenderPipeline",
    "GpuRenderPipelineDescriptor",
    "GpuRequestAdapterOptions",
    "GpuSampler",
    "GpuSamplerBindingLayout",
    "GpuSamplerBindingType",
    "GpuSamplerDescriptor",
    "GpuShaderModule",
    "GpuShaderModuleDescriptor",
    "GpuStencilFaceState",
    "GpuStencilOperation",
    "GpuStorageTextureAccess",
    "GpuStorageTextureBindingLayout",
    "GpuStoreOp",
    "GpuSupportedFeatures",
    "GpuSupportedLimits",
    "GpuTexture",
    "GpuTextureAspect",
    "GpuTextureBindingLayout",
    "GpuTextureDescriptor",
    "GpuTextureDimension",
    "GpuTextureFormat",
    "GpuTextureSampleType",
    "GpuTextureView",
    "GpuTextureViewDescriptor",
    "GpuTextureViewDimension",
    "GpuUncapturedErrorEvent",
    "GpuUncapturedErrorEventInit",
    "GpuValidationError",
    "GpuVertexAttribute",
    "GpuVertexBufferLayout",
    "GpuVertexFormat",
    "GpuVertexState",
    "GpuVertexStepMode",
    "HtmlCanvasElement",
    "OffscreenCanvas",
    "ImageBitmap",
    "ImageBitmapRenderingContext",
    "Window",
    "WorkerGlobalScope",
    "WorkerNavigator"
] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
web-sys = { version = "0.3.61", features = [
    "Location",
    "Blob",
    "RequestInit",
    "RequestMode",
    "Request",
    "Response",
    "WebGl2RenderingContext",
    "CanvasRenderingContext2d"
]}
