# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

[package]
name = "slint-interpreter"
description = "Interpreter library for Slint"
authors.workspace = true
documentation.workspace = true
edition = "2024"
homepage.workspace = true
keywords.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
categories = ["gui", "rendering::engine", "development-tools"]

[lib]
path = "lib.rs"

[features]

default = ["backend-default", "renderer-femtovg", "renderer-software", "accessibility", "compat-1-2"]

## Mandatory feature:
## This feature is required to keep the compatibility with Slint 1.2
## Newer patch version may put current functionality behind a new feature
## that would be enabled by default only if this feature was added
"compat-1-2" = []
"compat-1-0" = ["compat-1-2"]

## enable the [`print_diagnostics`] function to show diagnostic in the console output
display-diagnostics = ["i-slint-compiler/display-diagnostics"]

## Enable the default image formats from the `image` crate, to support additional image formats in [`Image::load_from_path`]
## and `@image-url`. When this feature is disabled, only PNG and JPEG are supported. When enabled,
## the following image formats are supported:
## AVIF, BMP, DDS, Farbfeld, GIF, HDR, ICO, JPEG, EXR, PNG, PNM, QOI, TGA, TIFF, WebP.
image-default-formats = ["i-slint-core/image-default-formats"]


# (internal) export C++ FFI functions
ffi = ["spin_on", "i-slint-core/ffi"]

# unused (std is mandatory for the interpreter)
std = []

#! ### Backends

#! See the documentation of the [`slint` crate](https://docs.rs/slint/latest/slint/#backends)

## The Qt backend feature uses Qt for the windowing system integration and rendering.
## This backend also provides the `native` style.
## It requires Qt 5.15 or later to be installed. If Qt is not installed, the
## backend will not be operational
backend-qt = ["i-slint-backend-selector/backend-qt", "std"]

## The [winit](https://crates.io/crates/log) crate is used for the event loop and windowing system integration.
## With this feature, both x11 and wayland windowing systems are supported. For a smaller build, omit
## this feature and select one of the other specific `backend-winit-XX` features.
backend-winit = ["i-slint-backend-selector/backend-winit", "std"]

## Simliar to `backend-winit` this enables the winit based event loop but only
## with support for the X Window System on Unix.
backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11", "std"]

## Simliar to `backend-winit` this enables the winit based event loop but only
## with support for the Wayland window system on Unix.
backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland", "std"]

## KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any
## windowing system. Requires libseat. If you don't have libseat, select `backend-linuxkms-noseat` instead.
backend-linuxkms = ["i-slint-backend-selector/backend-linuxkms", "std"]

## KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any
## windowing system. Requires libseat.
backend-linuxkms-noseat = ["i-slint-backend-selector/backend-linuxkms-noseat", "std"]

## Alias to a backend and renderer that depends on the platform.
backend-default = ["i-slint-backend-selector/default"]


## Render using the [FemtoVG](https://crates.io/crates/femtovg) crate.
renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg", "std"]
## Render using the [FemtoVG](https://crates.io/crates/femtovg) crate and [WGPU](https://crates.io/crates/wgpu).
renderer-femtovg-wgpu = ["i-slint-backend-selector/renderer-femtovg-wgpu", "std"]

## Make the winit backend capable of rendering using [Skia](https://skia.org/).
## Must be used in combination with `backend-winit`, `backend-winit-x11`, or `backend-winit-wayland`.
renderer-skia = ["i-slint-backend-selector/renderer-skia", "std"]

## Same as `renderer-skia`, but Skia will always use OpenGL.
## Note: This is not supported on iOS. Use `renderer-skia` on iOS to enable Meta based rendering.
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl", "std"]

## Same as `renderer-skia`, but Skia will always use Vulkan.
renderer-skia-vulkan = ["i-slint-backend-selector/renderer-skia-vulkan", "std"]

## Make the winit backend capable of rendering using the software renderer.
renderer-software = ["i-slint-backend-selector/renderer-software"]

# deprecated aliases
renderer-winit-femtovg = ["renderer-femtovg"]
renderer-winit-skia = ["renderer-skia"]
renderer-winit-skia-opengl = ["renderer-skia-opengl"]
renderer-winit-skia-vulkan = ["renderer-skia-vulkan"]
renderer-winit-software = ["renderer-software"]

## Enable integration with operating system provided accessibility APIs (default: enabled)
##
## Enabling this feature will try to expose the tree of UI elements to OS provided accessibility
## APIs to support screen readers and other assistive technologies.
accessibility = ["i-slint-backend-selector/accessibility"]

## Enable integration with [raw-window-handle](raw_window_handle_06) version 0.6. This provides a
## [`Window::window_handle()`] function that returns a struct that implements
## [HasWindowHandle](raw_window_handle_06::HasWindowHandle) and
## [HasDisplayHandle](raw_window_handle_06::HasDisplayHandle) implementation.
raw-window-handle-06 = ["dep:raw-window-handle-06", "i-slint-backend-selector/raw-window-handle-06"]

## Features used internally by Slint tooling that are not stable and come without
## any stability guarantees whatsoever.
internal = []

# (internal) Draw an highlight on a specified element
# NOTE: this is not a semver compatible feature
internal-highlight = []

# (internal) Serialize and deserialize Values to JSON, needs other internal API
# NOTE: this is not a semver compatible feature
internal-json = ["dep:serde_json"]

# (internal)
internal-live-preview = ["dep:notify", "display-diagnostics"]


[dependencies]
i-slint-compiler = { workspace = true }
i-slint-common = { workspace = true }
i-slint-core = { workspace = true, features = ["default", "rtti"] }
i-slint-core-macros = { workspace = true }
i-slint-backend-selector = { workspace = true, features = ["rtti"] }

vtable = { workspace = true }

derive_more = { workspace = true, features = ["std", "error"] }
generativity = "1"
lyon_path = { workspace = true }
once_cell = "1.5"
serde_json = { workspace = true, optional = true }
document-features = { version = "0.2.0", optional = true }
spin_on = { workspace = true, optional = true }
raw-window-handle-06 = { workspace = true, optional = true }
itertools = { workspace = true }
smol_str = { workspace = true }
unicode-segmentation = { workspace = true }

notify = { version = "8.0.0", default-features = false, features = ["macos_kqueue"], optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
i-slint-backend-winit = { workspace = true }
web-sys = { workspace = true, features = ["Navigator"] }

[target.'cfg(target_os = "linux")'.dependencies]
# this line is there to add the "enable" feature by default, but only on linux
i-slint-backend-qt = { workspace = true, features = ["enable"], optional = true }

[dev-dependencies]
i-slint-backend-testing = { path = "../../internal/backends/testing" }
spin_on = { workspace = true }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(slint_debug_property)"] }

[package.metadata.docs.rs]
features = ["display-diagnostics", "document-features", "raw-window-handle-06"]
rustdoc-args = ["--generate-link-to-definition"]
