15edf657ee1cb7cd351c5321164b494f2c8651e7
Behavior identical. lib-core.input dep bump 0.3.0 → 0.4.0. Resolves audit I1 (RTS-Tech-Demo-Audit 2026-05-14).
lib-core.selection — v0.1.0
Click-Select + Drag-Box-Select + Selection-Set-State.
Quick Setup
local selection = require("lib-core.selection")
local input = require("lib-core.input")
input.bind("lmb", { "mouse_left" })
input.bind("mod_add", { "shift" })
input.bind("mod_toggle", { "ctrl" })
selection.bind_action("lmb")
selection.bind_modifier_add("mod_add")
selection.bind_modifier_toggle("mod_toggle")
local handle = selection.register(function()
return { x = entity.x, y = entity.y, w = entity.w, h = entity.h }
end)
-- per-frame:
function update(ctx, dt) selection.update(dt) end
function render(ctx)
camera.begin()
-- entities…
selection.render_highlights() -- world-space
camera.finish()
selection.render_drag_box() -- screen-space
end
API
- Registry:
register(aabb_fn) → handle,unregister(h),count_registered() - Set-Query:
list(),count(),contains(h),is_empty() - Set-Mutation:
add(h),remove(h),toggle(h),clear() - Bindings:
bind_action(name),bind_modifier_add(name),bind_modifier_toggle(name) - State-Config:
set_drag_threshold(px)/drag_threshold(),set_enabled(bool)/enabled() - State-Query:
drag_state() → "idle"|"ambiguous"|"dragging",box_rect() → {x,y,w,h}|nil - Visual:
set_drag_box_color(r,g,b,a)/drag_box_color(),set_highlight_color(r,g,b,a)/highlight_color() - Per-Frame:
update(dt),render_drag_box(),render_highlights()
See meta/docs/superpowers/specs/2026-05-14-p3-6-lib-selection-design.md for full design.
Description
P.3.6 lib-core.selection v0.1.0 � Handle-Registry + Click/Drag-Box State-Machine + Selection-Set-API
Languages
Lua
96.3%
Shell
3.7%