Skip to content

Commit

Permalink
convert to gjs
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Sep 3, 2024
1 parent af31f69 commit 3c570e7
Show file tree
Hide file tree
Showing 16 changed files with 7,191 additions and 8,438 deletions.
15 changes: 15 additions & 0 deletions addon/components/dragula-container.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Component from '@glimmer/component';
import { modifier } from 'ember-modifier';

export default class DragulaContainer extends Component {
lifecycle = modifier((element) => {
this.args.onInsert(element);
return () => this.args.onDestroy(element);
});

<template>
<div class="dragula__container" {{this.lifecycle}} ...attributes>
{{yield}}
</div>
</template>
}
9 changes: 0 additions & 9 deletions addon/components/dragula-container.hbs

This file was deleted.

23 changes: 16 additions & 7 deletions addon/components/dragula.js → addon/components/dragula.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { action } from '@ember/object';

const { keys } = Object;

const events = {
export const events = {
drag: 'onDrag',
dragend: 'onDragEnd',
drop: 'onDrop',
Expand All @@ -18,19 +18,13 @@ const events = {
};

export default class Dragula extends Component {
static events = events;

drake;

DragulaContainer = DragulaContainer;

constructor() {
super(...arguments);

this.drake = dragula({ ...this.args.options });

this._setupHandlers();

this.args.onReady?.(this.drake);
}

Expand Down Expand Up @@ -58,4 +52,19 @@ export default class Dragula extends Component {
}
});
}

<template>
<div class="dragula" ...attributes {{this.dragula}}>
{{#let
(component
DragulaContainer
onInsert=this.addContainer
onDestroy=this.removeContainer
)
as |Container|
}}
{{yield Container}}
{{/let}}
</div>
</template>
}
12 changes: 0 additions & 12 deletions addon/components/dragula.hbs

This file was deleted.

Loading

0 comments on commit 3c570e7

Please sign in to comment.