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 b91c529
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
18 changes: 14 additions & 4 deletions packages/form-layout/src/layouts/abstract-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* @private
*/
export class AbstractLayout {
/**
* @param {HTMLElement} host
* @param {{ mutationObserverOptions: MutationObserverInit }} config
*/
constructor(host, config) {
this.host = host;
this.props = {};
Expand All @@ -20,7 +24,7 @@ export class AbstractLayout {
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 +67,19 @@ export class AbstractLayout {
// To be implemented
}

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

/** @protected */
_onMutation(_entries) {
/**
* @param {MutationRecord[]} _records
* @protected
*/
_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 b91c529

Please sign in to comment.