Skip to content

Commit

Permalink
add JSDoc annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Mar 7, 2025
1 parent 399a2fb commit 6b75af6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
20 changes: 16 additions & 4 deletions packages/form-layout/src/layouts/abstract-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@
*/
export class AbstractLayout {
constructor(host, config) {
/** @type {HTMLElement} */
this.host = host;

/** @type {{ [key: string]: any }} */
this.props = {};

/** @type {{ mutationObserverOptions: MutationObserverInit }} */
this.config = config;

this.isConnected = false;

/** @private */
this.__resizeObserver = new ResizeObserver((entries) => setTimeout(() => this._onResize(entries)));

/** @private */
this.__mutationObserver = new MutationObserver((entries) => this._onMutation(entries));
this.__mutationObserver = new MutationObserver((records) => this._onMutation(records));
}

/**
Expand Down Expand Up @@ -63,13 +69,19 @@ export class AbstractLayout {
// To be implemented
}

/** @protected */
/**
* @protected
* @param {ResizeObserverEntry[]} _entries
*/
_onResize(_entries) {
// To be implemented
}

/** @protected */
_onMutation(_entries) {
/**
* @protected
* @param {MutationRecord[]} _records
*/
_onMutation(_records) {
// To be implemented
}
}
4 changes: 2 additions & 2 deletions packages/form-layout/src/layouts/auto-responsive-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export class AutoResponsiveLayout extends AbstractLayout {
}

/** @override */
_onMutation(entries) {
const shouldUpdateLayout = entries.some(({ target }) => {
_onMutation(records) {
const shouldUpdateLayout = records.some(({ target }) => {
return (
target === this.host ||
target.parentElement === this.host ||
Expand Down
4 changes: 2 additions & 2 deletions packages/form-layout/src/layouts/responsive-steps-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ export class ResponsiveStepsLayout extends AbstractLayout {
}

/** @override */
_onMutation(mutations) {
const shouldUpdateLayout = mutations.some(({ target }) => {
_onMutation(records) {
const shouldUpdateLayout = records.some(({ target }) => {
return target === this.host || target.parentElement === this.host;
});
if (shouldUpdateLayout) {
Expand Down

0 comments on commit 6b75af6

Please sign in to comment.