Skip to content

Commit

Permalink
feat: drop deprecated aliases (#1505)
Browse files Browse the repository at this point in the history
Co-authored-by: ala'n (Alexey Stsefanovich) <[email protected]>

BREAKING CHANGE: `ESLEventUtils.descriptors` alias of `ESLEventUtils.getAutoDescriptors` is no longer supported
BREAKING CHANGE: `EventUtils` alias of `ESLEventUtils` is no longer supported
BREAKING CHANGE: `esl-media-quey` module no longer supports `addListener` and `removeListener` shorthand
BREAKING CHANGE: `SynteticEventTarget` no longer supports `addListener` and `removeListener` shorthand
BREAKING CHANGE: 'fallback-duration' is no longer in the JSX shape of ESLPanel and ESLPanelGroup
BREAKING CHANGE: `ToggleableActionParams` alias of `ESLToggleableActionParams` is no longer supported
BREAKING CHANGE: `TraversingQuery` alias of `ESLTraversingQuery` is no longer supported
BREAKING CHANGE: `RTLUtils` retired use separate methods instead
BREAKING CHANGE: `TraversingUtils` retired use separate methods instead
BREAKING CHANGE: `deepCompare` alias of `isEqual` is no longer supported
BREAKING CHANGE: `generateUId` alias of `randUID` no longer supported
  • Loading branch information
fshovchko authored and ala-n committed Mar 17, 2023
1 parent a442a3a commit df7f5e5
Show file tree
Hide file tree
Showing 15 changed files with 2 additions and 104 deletions.
4 changes: 2 additions & 2 deletions src/modules/draft/esl-carousel/core/esl-carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ export class ESLCarousel extends ESLBaseElement {

set configRules(rules: ESLMediaRuleList<CarouselConfig | null>) {
if (this._configRules) {
this._configRules.removeListener(this._onMatchChange);
this._configRules.removeEventListener(this._onMatchChange);
}
this._configRules = rules;
this._configRules.addListener(this._onMatchChange);
this._configRules.addEventListener(this._onMatchChange);
}

private update(force: boolean = false) {
Expand Down
6 changes: 0 additions & 6 deletions src/modules/esl-event-listener/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ ESLEventUtils.descriptors(host?: any): ESLListenerDescriptorFn[]

- `host` - object to get auto-collectable descriptors from;

<a name="-esleventutilsdescriptors"></a>

### `ESLEventUtils.descriptors`

Deprecated alias for `ESLEventUtils.getAutoDescriptors`

<a name="-esleventutilsinitdescriptor"></a>

### `ESLEventUtils.initDescriptor`
Expand Down
6 changes: 0 additions & 6 deletions src/modules/esl-event-listener/core/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export class ESLEventUtils {
*/
public static dispatch = dispatchCustomEvent;

/** @deprecated alias for {@link getAutoDescriptors} */
public static descriptors = getAutoDescriptors;

/** Gets {@link ESLListenerDescriptorFn}s of the passed object */
public static getAutoDescriptors = getAutoDescriptors;

Expand Down Expand Up @@ -130,6 +127,3 @@ export class ESLEventUtils {
*/
public static decorate = ESLEventTargetDecorator.cached;
}

/** @deprecated alias for {@link ESLEventUtils} */
export const EventUtils = ESLEventUtils;
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ export interface IMediaQueryCondition extends EventTarget {
/** @returns true if current environment satisfies query */
matches: boolean;

/** @deprecated alias for `addEventListener` */
addListener(cb: EventListener): void;
/** Subscribes to media query state change. Shortcut for `addEventListener('change', callback)` */
addEventListener(callback: EventListener): void;
/** Subscribes to media query state change. Implements {@link EventTarget} interface */
addEventListener(type: 'change', callback: EventListener): void;

/** @deprecated alias for `removeEventListener` */
removeListener(cb: EventListener): void;
/** Unsubscribes from media query state change event. Shortcut for `removeEventListener('change', callback)` */
removeEventListener(callback: EventListener): void;
/** Unsubscribes from media query state change event. Implements {@link EventTarget} interface */
Expand Down
5 changes: 0 additions & 5 deletions src/modules/esl-media-query/core/esl-media-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ export abstract class ESLMediaQuery implements IMediaQueryCondition {
public abstract addEventListener(type: 'change', callback: EventListener): void;
public abstract removeEventListener(callback: EventListener): void;
public abstract removeEventListener(type: 'change', callback: EventListener): void;

/** @deprecated alias for `addEventListener` */
public abstract addListener(cb: EventListener): void;
/** @deprecated alias for `removeEventListener` */
public abstract removeListener(cb: EventListener): void;
}

// Register otb preprocessors
Expand Down
3 changes: 0 additions & 3 deletions src/modules/esl-panel-group/core/esl-panel-group.shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ export interface ESLPanelGroupTagShape extends ESLBaseElementShape<ESLPanelGroup

/** Allowed children */
children?: any;

/** @deprecated fallback time no longer required */
'fallback-duration'?: string | number;
}

declare global {
Expand Down
3 changes: 0 additions & 3 deletions src/modules/esl-panel/core/esl-panel.shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export interface ESLPanelTagShape extends ESLToggleableTagShape<ESLPanel> {

/** Define CSS selector of the parent group (default: 'esl-panel-group')*/
'panel-group-sel'?: string;

/** @deprecated fallback time is no longer required */
'fallback-duration'?: string | number;
}

declare global {
Expand Down
3 changes: 0 additions & 3 deletions src/modules/esl-toggleable/core/esl-toggleable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ export interface ESLToggleableRequestDetails extends ESLToggleableActionParams {
match?: string | ((target: Element) => boolean);
}

/** @deprecated alias for ESLToggleableActionParams */
export type ToggleableActionParams = ESLToggleableActionParams;

const activators: WeakMap<ESLToggleable, HTMLElement | undefined> = new WeakMap();

/**
Expand Down
3 changes: 0 additions & 3 deletions src/modules/esl-traversing-query/core/esl-traversing-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ export class ESLTraversingQuery {
}
}

/** @deprecated alias for {@link ESLTraversingQuery} */
export const TraversingQuery = ESLTraversingQuery;

declare global {
export interface ESLLibrary {
TraversingQuery: typeof ESLTraversingQuery;
Expand Down
9 changes: 0 additions & 9 deletions src/modules/esl-utils/dom/events/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ export class SyntheticEventTarget implements EventTarget {
});
return e.defaultPrevented;
}

/** @deprecated alias for `addEventListener` */
public addListener(cb: EventListener): void {
this.addEventListener(cb);
}
/** @deprecated alias for `removeEventListener` */
public removeListener(cb: EventListener): void {
this.removeEventListener(cb);
}
}

function validateEventListenerType(callback: any): void | never {
Expand Down
22 changes: 0 additions & 22 deletions src/modules/esl-utils/dom/events/test/target.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,6 @@ describe('dom/events: SyntheticEventTarget', () => {
afterAll(() => jest.clearAllMocks());
});

describe('Legacy functionality', () => {
const et = new SyntheticEventTarget();

const event1 = new CustomEvent('change');
const event2 = new CustomEvent('change');
const listener = jest.fn();
et.addListener(listener);

test('listener shoudn`t be called', () => expect(listener).toBeCalledTimes(0));

test('listener should be called once', () => {
et.dispatchEvent(event1);
expect(listener).toBeCalledWith(event1);
});

test('listener shouldn`t be called second time', () => {
et.removeListener(listener);
et.dispatchEvent(event2);
expect(listener).toBeCalledTimes(1);
});
});

describe('API restriction', () => {
const et = new SyntheticEventTarget();
// @ts-ignore
Expand Down
14 changes: 0 additions & 14 deletions src/modules/esl-utils/dom/rtl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,3 @@ export const normalizeScrollLeft = (el: HTMLElement, value: number | null = null
return value;
}
};

/** @deprecated use separate functions from the module */
export abstract class RTLUtils {
/** @deprecated use {@link isRTL} instead */
static readonly isRtl = isRTL;

/** @deprecated use {@link normalizeScrollLeft} instead */
static readonly normalizeScrollLeft = normalizeScrollLeft;

/** @deprecated use {@link RTLScroll}.type instead */
static get scrollType(): ScrollType {
return RTLScroll.type;
}
}
15 changes: 0 additions & 15 deletions src/modules/esl-utils/dom/traversing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,3 @@ export const findClosestBy = (node: Node | null, predicate: (node: Node) => bool
}
return null;
};

/** @deprecated Cumulative traversing utility set */
export abstract class TraversingUtils {
static isRelative = isRelativeNode;
static closestBy = findClosestBy;
static createSequenceFinder = createSequenceFinder;

static findNext = findNext;
static findPrev = findPrev;
static findParent = findParent;
static findClosest = findClosest;

static findAll = findAll;
static findChildren = findChildren;
}
3 changes: 0 additions & 3 deletions src/modules/esl-utils/misc/object/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export function isEqual(obj1: any, obj2: any): boolean {
return false;
}

/** @deprecated alias for `isEqual` method */
export const deepCompare = isEqual;

/** Check if arr and arr mask has intersection */
function isIntersect(arrObj: any[], arrMask: any[], comparer: (a: any, b: any) => boolean): boolean {
return arrMask.every((key) => arrObj.some((itm) => comparer(itm, key)));
Expand Down
6 changes: 0 additions & 6 deletions src/modules/esl-utils/misc/uid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ export const randUID = (prefix: string = ''): string => {
const rand = Math.round(Math.random() * 1024 * 1024).toString(32);
return prefix + time + '-' + rand;
};

/**
* Generate unique id
* @deprecated Alias for {@link randUID}
*/
export const generateUId = randUID;

0 comments on commit df7f5e5

Please sign in to comment.