Skip to content

Commit

Permalink
refactor(core): cleanup for imports and ESL usages
Browse files Browse the repository at this point in the history
  • Loading branch information
ala-n committed Sep 22, 2023
1 parent cbd3530 commit dc769c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/core/base/root.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {EventUtils} from '@exadel/esl/modules/esl-utils/dom/events';
import {boolAttr, ESLBaseElement} from '@exadel/esl/modules/esl-base-element/core';
import {memoize} from '@exadel/esl/modules/esl-utils/decorators/memoize';
import type {AnyToVoidFnSignature} from '@exadel/esl/modules/esl-utils/misc/functions';
import {ESLEventUtils} from '@exadel/esl/modules/esl-utils/dom/events';
import {ESLBaseElement} from '@exadel/esl/modules/esl-base-element/core';
import {memoize, boolAttr} from '@exadel/esl/modules/esl-utils/decorators';

import {SnippetTemplate, UIPStateModel} from './model';

import type {AnyToVoidFnSignature} from '@exadel/esl/modules/esl-utils/misc/functions';

/**
* UI Playground root custom element definition
* Container element for {@link UIPPlugin} components
Expand Down Expand Up @@ -66,7 +67,7 @@ export class UIPRoot extends ESLBaseElement {
}
// setTimeout to let other plugins init before dispatching
setTimeout(() => {
EventUtils.dispatch(this, 'uip:configchange', {
ESLEventUtils.dispatch(this, 'uip:configchange', {
bubbles: false,
detail: {
attribute: attrName,
Expand Down
11 changes: 5 additions & 6 deletions src/core/preview/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {bind} from '@exadel/esl/modules/esl-utils/decorators/bind';
import {bind} from '@exadel/esl/modules/esl-utils/decorators';

import {UIPPlugin} from '../base/plugin';

/**
Expand All @@ -24,11 +25,9 @@ export class UIPPreview extends UIPPlugin {
}

protected attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void {
if (attrName === 'resizable' && newVal === null) {
this.clearInlineSize();
this.$inner.classList.remove('resizable');
} else {
this.$inner.classList.add('resizable');
if (attrName === 'resizable') {
newVal === null && this.clearInlineSize();
this.$inner.classList.toggle('resizable', newVal !== null);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/header/header.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {EventUtils} from '@exadel/esl/modules/esl-utils/dom/events';
import React from 'jsx-dom';

import {ESLEventUtils} from '@exadel/esl/modules/esl-utils/dom/events';
import {listen} from '@exadel/esl/modules/esl-utils/decorators/listen';
import {UIPPlugin} from '../../core/base/plugin';
import {UIPOptionIcons, UIPOptions, UIPSnippets} from '../registration';

import * as React from 'jsx-dom';

/**
* Header {@link UIPPlugin} custom element definition
* Container for {@link UIPSnippets} and {@link UIPOptions} elements
Expand Down Expand Up @@ -49,7 +49,7 @@ export class UIPHeader extends UIPPlugin {
@listen({event: 'click', selector: '.copy-icon'})
protected _onCopyClick() {
navigator.clipboard.writeText(this.model!.html).then(() => {
EventUtils.dispatch(this, 'esl:alert:show', {
ESLEventUtils.dispatch(this, 'esl:alert:show', {
detail: {
text: 'Markup copied',
cls: 'uip-alert-info'
Expand Down
1 change: 1 addition & 0 deletions src/registration.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: get rid of extra styles for outside users
@import "src/common/variables";
@import "src/common/typography";
@import "src/common/mixins";
Expand Down

0 comments on commit dc769c2

Please sign in to comment.