Context
Related to #35 - when you have vui-rerender and vui-update, you need access to the instance.
Currently vui--root-instance is buffer-local and private. Apps end up maintaining their own instance storage (e.g., vulpea-ui uses a frame→instance hash table).
Proposal
(vui-get-instance &optional buffer)
Return the root vui instance for BUFFER (defaults to current buffer). Returns nil if buffer has no mounted vui instance.
Use case
;; Instead of maintaining separate storage:
(when-let ((inst (vui-get-instance sidebar-buf)))
(vui-update inst (list :note note)))
This is a small convenience - apps can still manage their own storage if they need more complex mappings (like frame→instance). But for simple cases where buffer→instance is enough, this avoids boilerplate.
Context
Related to #35 - when you have
vui-rerenderandvui-update, you need access to the instance.Currently
vui--root-instanceis buffer-local and private. Apps end up maintaining their own instance storage (e.g., vulpea-ui uses a frame→instance hash table).Proposal
(vui-get-instance &optional buffer)Return the root vui instance for BUFFER (defaults to current buffer). Returns nil if buffer has no mounted vui instance.
Use case
This is a small convenience - apps can still manage their own storage if they need more complex mappings (like frame→instance). But for simple cases where buffer→instance is enough, this avoids boilerplate.