Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into main-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ala-n committed May 15, 2024
2 parents 6998e70 + cc4103b commit 2f0e32f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/plugins/settings/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'jsx-dom';

import {isElement} from '@exadel/esl/modules/esl-utils/dom/api';
import {debounce} from '@exadel/esl/modules/esl-utils/async/debounce';
import {attr, boolAttr, decorate, listen, memoize} from '@exadel/esl/modules/esl-utils/decorators';

import {UIPPluginPanel} from '../../core/panel/plugin-panel';
import {ThemeToggleIcon} from '../theme/theme-toggle.icon';

import {UIPSetting} from './base-setting/base-setting';
import {SettingsIcon} from './settings.icon';

import type {UIPSetting} from './base-setting/base-setting';

/**
* Settings {@link UIPPlugin} custom element definition
* Container for {@link UIPSetting}
Expand Down Expand Up @@ -57,10 +57,8 @@ export class UIPSettings extends UIPPluginPanel {

@memoize()
/** @returns HTMLElement[] - all internal items marked as settings item */
protected get $items(): HTMLElement[] {
return [...this.childNodes].filter(
($el: ChildNode): $el is HTMLElement => isElement($el) && $el.hasAttribute('uip-settings-content')
);
protected get $items(): UIPSetting[] {
return [...this.querySelectorAll('[uip-settings-content]')] as UIPSetting[];
}

/** @returns Element[] - active internal settings items */
Expand Down Expand Up @@ -95,8 +93,10 @@ export class UIPSettings extends UIPPluginPanel {

@decorate(debounce, 100)
protected invalidate(): void {
memoize.clear(this, '$items');
const outside = this.$items.filter((el) => el.parentElement !== this.$container);
outside.forEach((el) => this.$container.appendChild(el));
this.onSettingsStateChange();
}

@listen('uip:settings:invalidate')
Expand Down

0 comments on commit 2f0e32f

Please sign in to comment.