Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constructor API docs #352

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/ArrayInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ class ArrayInput extends Element implements IFocusable, IBindable {

protected _renderChanges: boolean;

/**
* Creates a new ArrayInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ArrayInputArgs> = {}) {
const container = new Container({
dom: args.dom,
Expand Down
5 changes: 5 additions & 0 deletions src/components/BooleanInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class BooleanInput extends Element implements IBindable, IFocusable {

protected _renderChanges: boolean;

/**
* Creates a new BooleanInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<BooleanInputArgs> = {}) {
super({ tabIndex: 0, ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/Button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class Button extends Element {

protected _size: string | null;

/**
* Creates a new Button.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ButtonArgs> = {}) {
super({ dom: 'button', ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/Canvas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Canvas extends Element {

protected _ratio = 1;

/**
* Creates a new Canvas.
*
* @param args - The arguments.
*/
constructor(args: Readonly<CanvasArgs> = {}) {
super({ dom: 'canvas', ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/Code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Code extends Container {

protected _text: string;

/**
* Creates a new Code.
*
* @param args - The arguments.
*/
constructor(args: Readonly<CodeArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/ColorPicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class ColorPicker extends Element implements IBindable {

protected _renderChanges: boolean;

/**
* Creates a new ColorPicker.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ColorPickerArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ class Container extends Element {

protected _resizable: string;

/**
* Creates a new Container.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ContainerArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Divider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const CLASS_ROOT = 'pcui-divider';
* Represents a vertical division between two elements.
*/
class Divider extends Element {
/**
* Creates a new Divider.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ElementArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ class Element extends Events {

protected _onClickEvt: () => void;

/**
* Creates a new Element.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ElementArgs> = {}) {
super();

Expand Down
5 changes: 5 additions & 0 deletions src/components/GridView/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class GridView extends Container {

protected _selected: GridViewItem[] = [];

/**
* Creates a new GridView.
*
* @param args - The arguments.
*/
constructor(args: Readonly<GridViewArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/GridViewItem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class GridViewItem extends Container implements IFocusable {

protected _allowSelect: boolean;

/**
* Creates a new GridViewItem.
*
* @param args - The arguments.
*/
constructor(args: Readonly<GridViewItemArgs> = {}) {
super({ tabIndex: 0, ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/InfoBox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class InfoBox extends Container {

protected _text: string;

/**
* Creates a new InfoBox.
*
* @param args - The arguments.
*/
constructor(args: Readonly<InfoBoxArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Label/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class Label extends Element implements IPlaceholder, IBindable {

protected _renderChanges: boolean;

/**
* Creates a new Label.
*
* @param args - The arguments.
*/
constructor(args: Readonly<LabelArgs> = {}) {
super({ dom: 'span', ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/LabelGroup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class LabelGroup extends Container {

protected _field: Element;

/**
* Creates a new LabelGroup.
*
* @param args - The arguments.
*/
constructor(args: Readonly<LabelGroupArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export interface MenuArgs extends ContainerArgs {
class Menu extends Container implements IFocusable {
protected _containerMenuItems: Container;

/**
* Creates a new Menu.
*
* @param args - The arguments.
*/
constructor(args: Readonly<MenuArgs> = {}) {
super({ tabIndex: 1, ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/MenuItem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class MenuItem extends Container implements IBindable {

protected _renderChanges: boolean;

/**
* Creates a new MenuItem.
*
* @param args - The arguments.
*/
constructor(args: Readonly<MenuItemArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/NumericInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class NumericInput extends InputElement {

protected _sliderUsed = false;

/**
* Creates a new NumericInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<NumericInputArgs> = {}) {
const textInputArgs = { ...args };
// delete value because we want to set it after the other arguments
Expand Down
5 changes: 5 additions & 0 deletions src/components/Overlay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export interface OverlayArgs extends ElementArgs {
class Overlay extends Container {
protected _domClickableOverlay: HTMLDivElement;

/**
* Creates a new Overlay.
*
* @param args - The arguments.
*/
constructor(args: Readonly<OverlayArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/Progress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class Progress extends Container {

protected _value: number;

/**
* Creates a new Progress.
*
* @param args - The arguments.
*/
constructor(args: Readonly<ProgressArgs> = {}) {
super(args);
this.class.add(CLASS_ROOT);
Expand Down
5 changes: 5 additions & 0 deletions src/components/RadioButton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class RadioButton extends Element implements IBindable, IFocusable {

protected _renderChanges: boolean;

/**
* Creates a new RadioButton.
*
* @param args - The arguments.
*/
constructor(args: Readonly<RadioButtonArgs> = {}) {
super({ tabIndex: 0, ...args });

Expand Down
5 changes: 5 additions & 0 deletions src/components/SelectInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ class SelectInput extends Element implements IBindable, IFocusable {

protected _prefix = '';

/**
* Creates a new SelectInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<SelectInputArgs> = {}) {
// main container
const container = new Container({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spinner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Spinner extends Element {
static TYPE_SMALL_THICK = 'small-thick';

/**
* Sets the pixel size of the spinner
* Creates a new Spinner.
*
* @param args - The arguments.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/components/TextAreaInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export interface TextAreaInputArgs extends TextInputArgs {
* The TextAreaInput wraps a textarea element. It has the same interface as {@link TextInput}.
*/
class TextAreaInput extends TextInput {
/**
* Creates a new TextAreaInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<TextAreaInputArgs> = {}) {
args = Object.assign({
input: document.createElement('textarea')
Expand Down
5 changes: 5 additions & 0 deletions src/components/TextInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export interface TextInputArgs extends InputElementArgs, IBindableArgs, IPlaceho
class TextInput extends InputElement {
protected _onValidate: (value: string) => boolean;

/**
* Creates a new TextInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<TextInputArgs> = {}) {
super(args);

Expand Down
5 changes: 5 additions & 0 deletions src/components/VectorInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class VectorInput extends Element implements IBindable, IFocusable, IPlaceholder

protected _bindAllInputs = false;

/**
* Creates a new VectorInput.
*
* @param args - The arguments.
*/
constructor(args: Readonly<VectorInputArgs> = {}) {
const elementArgs = { ...args };
// set binding after inputs have been created
Expand Down
Loading