name "ui"
description "Canvas-first three-level UI toolkit (state/layout/widgets) — GUI, TUI, and HTML backends"
authors "Petar Kirov"
copyright "Copyright © 2026, Petar Kirov"
license "BSL-1.0"
targetPath "build"
// `ui.geometry` specializes math's `Vector` into `Point`/`Size`. math depends
// on `sparkles:base` alone, so this edge closes no cycle.
dependency "sparkles:math" path="../.."
importPaths "src"
dependency "sparkles:test-attributes" path="../.."
// sparkles:base supplies the color/style vocabulary (RgbColor/Color/toRgb — the
// toolkit adds no color type of its own). Concrete canvas backends adapt to
// sparkles:ui, never the reverse.
dependency "sparkles:base" path="../.."
dependency "sparkles:input" path="../.."
// The editor model (`sparkles.ui.editor`) keeps its text, change sets and
// undo history in the persistent text buffer.
dependency "sparkles:text-buffer" path="../.."
// The single-source effect transforms (`effect_shaders.d`) are written
// against the shader vocabulary, and run on the CPU through it.
dependency "sparkles:shaders" path="../.."
dependency "sparkles:metadata" path="../.."
// The property tree's leaf classification dispatches on the shared
// reflection kernel, so "is this a leaf" has one answer across the toolkit,
// the text writers, and query engines.
dependency "sparkles:reflection" path="../.."
// A REAL edge, not import-only: DMD speculatively emits TypeInfo
// for structs of merely-IMPORTED modules into the importing object, and the
// plain fuzzy leaves (QueryText/Constraint/AnalysisProfile) have generated
// `__xtoHash`/`__xopEquals` that exist only in fuzzy's own objects — so an
// import-only ui.a left every dmd consumer of this package with undefined
// references through property_tree.o (which the ModuleInfo import chain
// always pulls).
dependency "sparkles:fuzzy" path="../.."
// The design-system token paths are `@WireName` data on the `Slot` members
// (`TOK2`), resolved by wired's `wireNames` — the same table the JSON writer
// and the DTCG theme file use — rather than a hand-kept enum -> string switch.
// `wired` depends on `base` alone, so this edge closes no cycle.
dependency "sparkles:wired" path="../.."
dflags "-preview=in" "-preview=dip1000"
configuration "library" {
// Test-support modules: only the test root compiles them, so a
// `version (unittest)` in them changes nothing a dependent sees
// (build-graph BGV4).
excludedSourceFiles "src/sparkles/ui/editor/line_edit_test.d" "src/sparkles/ui/editor/step_test.d" "src/sparkles/ui/editor/testing.d" "src/sparkles/ui/test_utils.d"
// A real library, not a sourceLibrary: the toolkit carries the whole
// component set, and recompiling it inside every dependent is the cost
// `sparkles:core-cli` is a `library` to avoid. The templated parts (the
// `isCanvas` capability concept, the attribute-inferring `paint`
// interpreter) still instantiate in the consumer, as templates must.
targetType "library"
}
// The library plus the built-in effects' GPU halves (`SparklesUiGpuEffects`):
// the fragment shaders generated from `effect_shaders.d`, and the hand-written
// tier-2 passes. Opt-in, because generating them takes the dcompute-enabled
// LDC (`ldc2-vulkan`), and the default build — the one `sparkles:core-cli` and
// every terminal-only consumer takes — must need no compiler but its own.
// Selected beside each `sparkles:ui-raylib` dependency (that package's recipe
// says why it cannot be selected once, by the backend itself).
//
// The pre-generate step compiles the `shaders` configuration below to GLSL in
// `generated/shaders/` (git-ignored) and is a no-op while its stamp is fresh.
// The tool builds once, into dub's cache; later builds reuse it (`SHB7`).
configuration "gpu-effects" {
targetType "library"
// As the library configuration: the test-support modules are the test
// root's alone.
excludedSourceFiles "src/sparkles/ui/editor/line_edit_test.d" "src/sparkles/ui/editor/step_test.d" "src/sparkles/ui/editor/testing.d" "src/sparkles/ui/test_utils.d"
versions "SparklesUiGpuEffects"
stringImportPaths "generated/shaders"
preGenerateCommands "$DUB run -q --root=$PACKAGE_DIR/../../apps/shader-compile -- --package=$PACKAGE_DIR --out=$PACKAGE_DIR/generated/shaders --if-stale"
}
configuration "unittest" {
// The component tests use the diff/outdent helpers. `test-utils` depends on
// `base` alone, so this edge closes no cycle.
dependency "sparkles:test-utils" path="../.."
// The keymap/lantern test fixture (`TestCommand`/`testBindings`) is shared
// across this package's modules, so it is declared at module scope — but
// guarded by this version, not `unittest`: a downstream `-unittest` build
// (hue's, say) analyses imported `version (unittest)` declarations too, and
// DMD then expects `Binding!(TestCommand, TestScope)`'s symbols from this
// library — which is compiled *without* `-unittest` and has none of it.
versions "UiKeymapFixtures" "UiPropertyFixtures" "UiSettingsFixtures"
dflags "-checkaction=context" "-allinst"
dependency "sparkles:test-runner" path="../.."
}
// The device build: what LDC's dcompute target compiles for the GPU. Never
// built by dub — `shader-compile` resolves it as dub would and compiles the
// `@compute` modules among its sources (with `sparkles:shaders`'s), and
// `sparkles:dmd-lsp` analyzes those modules under it (`TGT6`). It adds
// `shaders/`, the device-only entry points: `@compute(CompileFor.deviceOnly)`
// modules no host build may see, since they sample through SPIR-V intrinsics.
// `shader-compile` picks it by name (`--config`, `shaders` by default) and
// accepts it because its dflags name exactly one Vulkan dcompute target.
configuration "shaders" {
targetType "library"
sourcePaths "src" "shaders"
dflags "-mdcompute-targets=vulkan-130"
}
// BEGIN managed build types — apps/ci/tools/standardize-build-settings.d
dflags "--linker=lld" platform="linux-ldc"
dflags "-L-fuse-ld=lld" platform="linux-dmd"
buildType "unittest" {
buildOptions "unittests" "debugMode" "debugInfo"
dflags "--gline-tables-only" platform="ldc"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "unittest-debug" {
buildOptions "unittests" "debugMode" "debugInfo"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "unittest-cov" {
buildOptions "unittests" "coverage" "debugMode" "debugInfo"
dflags "--gline-tables-only" platform="ldc"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "unittest-cov-ctfe" {
buildOptions "unittests" "coverageCTFE" "debugMode" "debugInfo"
dflags "--gline-tables-only" platform="ldc"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "checked" {
buildOptions "optimize" "inline" "debugInfo"
}
buildType "bench" {
buildOptions "unittests" "optimize" "inline"
dflags "-mcpu=native" "-O3" "-allinst" platform="ldc"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "bench-unchecked" {
buildOptions "unittests" "releaseMode" "optimize" "inline"
dflags "-mcpu=native" "-O3" "-allinst" platform="ldc"
dflags "-defaultlib=libphobos2.so" platform="linux-dmd"
dflags "--link-defaultlib-shared" platform="linux-ldc"
lflags "--export-dynamic" platform="linux-ldc"
}
buildType "bench-static" {
buildOptions "unittests" "releaseMode" "optimize" "inline"
dflags "-mcpu=native" "-O3" "-allinst" platform="ldc"
dflags "--link-defaultlib-shared=false" platform="linux-ldc"
dflags "-defaultlib=libphobos2.a" platform="linux-dmd"
lflags "--export-dynamic" platform="linux-ldc"
}
// END managed build types