fix: allow html property in UIComponentWindow

A component was removed and an html property was passed to
UIComponentWindow. This makes sense because UIWindow accepts an html
property, so rather than update the calling code it made more sense to
update UIComponentWindow to be more intuitive.
This commit is contained in:
KernelDeimos
2026-02-13 18:50:17 -05:00
parent 8ecd6cd13e
commit 4d49f5dfa6
+7 -4
View File
@@ -18,17 +18,20 @@
*/
import UIWindow from './UIWindow.js';
import Placeholder from '../util/Placeholder.js';
import JustHTML from './Components/JustHTML.js';
/**
* @typedef {Object} UIComponentWindowOptions
* @property {Component} A component to render in the window
* @property {Component} [component] A component to render in the window
* @property {string} [html] HTML string to render in the window (uses JustHTML component)
*/
/**
* Render a UIWindow that contains an instance of Component
* Render a UIWindow that contains an instance of Component or HTML string
* @param {UIComponentWindowOptions} options
*/
export default async function UIComponentWindow (options) {
const component = options.component ?? new JustHTML({ html: options.html ?? '' });
const placeholder = Placeholder();
const win = await UIWindow({
@@ -37,8 +40,8 @@ export default async function UIComponentWindow (options) {
body_content: placeholder.html,
});
options.component.attach(placeholder);
options.component.focus();
component.attach(placeholder);
component.focus();
return win;
}