At the moment, you can set the DOM element when creating a PCUI Element by setting the first parameter of the Element constructor or by setting the dom property of the ElementArgs options object. The code gives precedence to the first parameter of the constructor, but otherwise, there appears to be little reason why the parameter is needed at all. It makes the constructor signature of Element needlessly different to every other PCUI element class. Therefore, this PR removes it.
As an aside, this PR makes all constructor options objects read-only. The utility type Readonly<...> has been applied to the options object parameter types. For instances where an options objects must to be written to, it is shallow copied to a new object using object destructuring.
At the moment, you can set the DOM element when creating a PCUI Element by setting the first parameter of the
Element
constructor or by setting thedom
property of theElementArgs
options object. The code gives precedence to the first parameter of the constructor, but otherwise, there appears to be little reason why the parameter is needed at all. It makes the constructor signature ofElement
needlessly different to every other PCUI element class. Therefore, this PR removes it.As an aside, this PR makes all constructor options objects read-only. The utility type
Readonly<...>
has been applied to the options object parameter types. For instances where an options objects must to be written to, it is shallow copied to a new object using object destructuring.Fixes #260