Skip to content

Commit

Permalink
Document all getters
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott committed Jun 12, 2024
1 parent 0312577 commit 8c03da7
Show file tree
Hide file tree
Showing 20 changed files with 412 additions and 109 deletions.
42 changes: 32 additions & 10 deletions src/binding/BindingBase/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,21 @@ class BindingBase extends Events {
}

/**
* The element
* Sets the element.
*/
set element(value: IBindable | undefined) {
this._element = value;
}

/**
* Gets the element.
*/
get element(): IBindable | undefined {
return this._element;
}

/**
* Whether the binding is currently applying a change either to the observers or the element.
* Sets whether the binding is currently applying a change, either to the observers or the element.
*/
set applyingChange(value) {
if (this._applyingChange === value) return;
Expand All @@ -181,63 +184,79 @@ class BindingBase extends Events {
this.emit('applyingChange', value);
}

/**
* Gets whether the binding is currently applying a change, either to the observers or the element.
*/
get applyingChange() {
return this._applyingChange;
}

/**
* Whether the binding is linked to observers.
* Gets whether the binding is linked to observers.
*/
get linked() {
return this._linked;
}

/**
* If a history module is used whether to combine history actions when applying changes to observers.
* Sets whether to combine history actions when applying changes to observers. This is assuming
* a history module is being used.
*/
set historyCombine(value) {
this._historyCombine = value;
}

/**
* Gets whether to combine history actions when applying changes to observers.
*/
get historyCombine() {
return this._historyCombine;
}

/**
* The name of the history action when applying changes to observers.
* Sets the name of the history action when applying changes to observers.
*/
set historyName(value) {
this._historyName = value;
}

/**
* Gets the name of the history action when applying changes to observers.
*/
get historyName() {
return this._historyName;
}

/**
* A string to prefix the historyName with.
* Sets the string to prefix {@link historyName} with.
*/
set historyPrefix(value) {
this._historyPrefix = value;
}

/**
* Gets the string to prefix {@link historyName} with.
*/
get historyPrefix() {
return this._historyPrefix;
}

/**
* A string to postfix the historyName with.
* Sets the string to postfix {@link historyName} with.
*/
set historyPostfix(value) {
this._historyPostfix = value;
}

/**
* Gets the string to postfix {@link historyName} with.
*/
get historyPostfix() {
return this._historyPostfix;
}

/**
* Whether history is enabled for the binding. A valid history object must have been provided first.
* Sets whether history is enabled for the binding. A valid history object must have been provided first.
*/
set historyEnabled(value) {
if (this._history) {
Expand All @@ -246,20 +265,23 @@ class BindingBase extends Events {
}
}

/**
* Gets whether history is enabled for the binding.
*/
get historyEnabled() {
// @ts-ignore
return this._history && this._history.enabled;
}

/**
* The linked observers.
* Gets the linked observers.
*/
get observers() {
return this._observers;
}

/**
* The linked paths.
* Gets the linked paths.
*/
get paths() {
return this._paths;
Expand Down
15 changes: 12 additions & 3 deletions src/components/Button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Button extends Element {
}

/**
* Gets / sets the text of the button.
* Sets the text of the button.
*/
set text(value: string) {
if (this._text === value) return;
Expand All @@ -101,12 +101,15 @@ class Button extends Element {
}
}

/**
* Gets the text of the button.
*/
get text(): string {
return this._text;
}

/**
* The CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\\' character).
* Sets the CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\\' character).
*/
set icon(value: string) {
if (this._icon === value || !value.match(/^E[0-9]{0,4}$/)) return;
Expand All @@ -119,12 +122,15 @@ class Button extends Element {
}
}

/**
* Gets the CSS code for an icon for the button.
*/
get icon(): string {
return this._icon;
}

/**
* Gets / sets the 'size' type of the button. Can be null or 'small'.
* Sets the 'size' type of the button. Can be null or 'small'.
*/
set size(value: string) {
if (this._size === value) return;
Expand All @@ -140,6 +146,9 @@ class Button extends Element {
}
}

/**
* Gets the 'size' type of the button.
*/
get size(): string {
return this._size;
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/Canvas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Canvas extends Element {
}

/**
* Gets / sets the width of the canvas.
* Sets the width of the canvas.
*/
set width(value: number) {
if (this._width === value)
Expand All @@ -80,13 +80,16 @@ class Canvas extends Element {
this.emit('resize', this._width, this._height);
}

/**
* Gets the width of the canvas.
*/
get width(): number {
return this._width;
}


/**
* Gets / sets the height of the canvas.
* Sets the height of the canvas.
*/
set height(value: number) {
if (this._height === value)
Expand All @@ -101,6 +104,9 @@ class Canvas extends Element {
this.emit('resize', this._width, this._height);
}

/**
* Gets the height of the canvas.
*/
get height(): number {
return this._height;
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ class Code extends Container {
}

/**
* Gets / sets the text to display in the code block.
* Sets the text to display in the code block.
*/
set text(value) {
this._text = value;
this._inner.text = value;
}

/**
* Gets the text to display in the code block.
*/
get text() {
return this._text;
}
Expand Down
39 changes: 30 additions & 9 deletions src/components/Container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ class Container extends Element {
}

/**
* Gets / sets whether the Element supports flex layout.
* Sets whether the Element supports flex layout.
*/
set flex(value: boolean) {
if (value === this._flex) return;
Expand All @@ -642,12 +642,15 @@ class Container extends Element {
}
}

/**
* Gets whether the Element supports flex layout.
*/
get flex(): boolean {
return this._flex;
}

/**
* Gets / sets whether the Element supports the grid layout.
* Sets whether the Element supports the grid layout.
*/
set grid(value: boolean) {
if (value === this._grid) return;
Expand All @@ -661,12 +664,15 @@ class Container extends Element {
}
}

/**
* Gets whether the Element supports the grid layout.
*/
get grid(): boolean {
return this._grid;
}

/**
* Gets /sets whether the Element should be scrollable.
* Sets whether the Element should be scrollable.
*/
set scrollable(value: boolean) {
if (this._scrollable === value) return;
Expand All @@ -681,13 +687,16 @@ class Container extends Element {

}

/**
* Gets whether the Element should be scrollable.
*/
get scrollable(): boolean {
return this._scrollable;
}

/**
* Gets / sets whether the Element is resizable and where the resize handle is located. Can
* be one of 'top', 'bottom', 'right', 'left'. Set to null to disable resizing.
* Sets whether the Element is resizable and where the resize handle is located. Can be one of
* 'top', 'bottom', 'right', 'left'. Set to null to disable resizing.
*/
set resizable(value: string) {
if (value === this._resizable) return;
Expand Down Expand Up @@ -723,35 +732,44 @@ class Container extends Element {
}
}

/**
* Gets whether the Element is resizable and where the resize handle is located.
*/
get resizable(): string {
return this._resizable;
}

/**
* Gets / sets the minimum size the Element can take when resized in pixels.
* Sets the minimum size the Element can take when resized in pixels.
*/
set resizeMin(value: number) {
this._resizeMin = Math.max(0, Math.min(value, this._resizeMax));
}

/**
* Gets the minimum size the Element can take when resized in pixels.
*/
get resizeMin(): number {
return this._resizeMin;
}

/**
* Gets / sets the maximum size the Element can take when resized in pixels.
* Sets the maximum size the Element can take when resized in pixels.
*/
set resizeMax(value: number) {
this._resizeMax = Math.max(this._resizeMin, value);
}

/**
* Gets the maximum size the Element can take when resized in pixels.
*/
get resizeMax(): number {
return this._resizeMax;
}

/**
* The internal DOM element used as a the container of all children.
* Can be overridden by derived classes.
* Sets the internal DOM element used as a the container of all children. Can be overridden by
* derived classes.
*/
set domContent(value: HTMLElement) {
if (this._domContent === value) return;
Expand All @@ -767,6 +785,9 @@ class Container extends Element {
}
}

/**
* Gets the internal DOM element used as a the container of all children.
*/
get domContent(): HTMLElement {
return this._domContent;
}
Expand Down
Loading

0 comments on commit 8c03da7

Please sign in to comment.