Skip to content

Commit

Permalink
Rename VisualClass interface to HandleVisualClass and make it pub…
Browse files Browse the repository at this point in the history
…lic (possible helpful for consumer apps)
  • Loading branch information
mkszepp committed Sep 21, 2024
1 parent 4a2dca2 commit 053b025
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions addon/src/modifiers/sortable-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import type { Group } from '../services/ember-sortable-internal-state.ts';
import type SortableItemModifier from './sortable-item.ts';
import type { MoveDirection } from './sortable-item.ts';

const NO_MODEL: VisualClass = {};
const NO_MODEL: HandleVisualClass = {};

interface VisualClass {
export interface HandleVisualClass {
UP?: string;
DOWN?: string;
LEFT?: string;
Expand All @@ -45,7 +45,7 @@ interface SortableGroupModifierSignature<T> {
direction?: TDirection;
groupName?: string;
disabled?: boolean;
handleVisualClass?: VisualClass;
handleVisualClass?: HandleVisualClass;
a11yAnnouncementConfig?: A11yAnnouncementConfig;
itemVisualClass?: string;
a11yItemName?: string;
Expand Down Expand Up @@ -114,7 +114,7 @@ export default class SortableGroupModifier<T> extends Modifier<SortableGroupModi
* RIGHT: 'right',
* }
*/
get handleVisualClass(): VisualClass {
get handleVisualClass(): HandleVisualClass {
return this.named.handleVisualClass || NO_MODEL;
}

Expand Down Expand Up @@ -492,7 +492,7 @@ export default class SortableGroupModifier<T> extends Modifier<SortableGroupModi
const index = sortedItems.indexOf(item);
const handle = item.element.querySelector('[data-sortable-handle');
const visualHandle = handle ? handle : item.element;
const visualKeys: (keyof VisualClass)[] = direction === 'y' ? ['UP', 'DOWN'] : ['LEFT', 'RIGHT'];
const visualKeys: (keyof HandleVisualClass)[] = direction === 'y' ? ['UP', 'DOWN'] : ['LEFT', 'RIGHT'];

visualKeys.forEach((visualKey) => {
visualHandle.classList.remove(handleVisualClass[visualKey] ?? '');
Expand Down

0 comments on commit 053b025

Please sign in to comment.