Skip to content

Commit

Permalink
upgrade deps / remove render modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Sep 5, 2024
1 parent fa7072b commit 3719e33
Show file tree
Hide file tree
Showing 12 changed files with 9,670 additions and 13,273 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/vendor/

# compiled output
/declarations/
/dist/
/tmp/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
/ember-cli-build.js
/testem.js
/tests/
/tsconfig.declarations.json
/tsconfig.json
/yarn-error.log
/yarn.lock
.gitkeep
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 4.6.6

- Run ember-cli-update
- Upgrade dependencies

## 4.6.5

- Correct app re-exports
Expand Down
33 changes: 20 additions & 13 deletions addon/components/expander/content.gjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
/* https://github.com/ember-cli/eslint-plugin-ember/issues/2035 */
/* eslint-disable no-unused-expressions */

import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import Component from '@glimmer/component';
import { modifier } from 'ember-modifier';

<template>
{{! template-lint-disable no-inline-styles }}
{{! Issue: https://github.com/emberjs/rfcs/issues/497 }}
export default class DragulaContainer extends Component {
lifecycle = modifier((element) => {
this.args.onInsert(element);
});

<div
class="expander__content"
style={{@style}}
...attributes
{{didInsert @onInsert}}
>
{{yield}}
</div>
</template>
<template>
{{! template-lint-disable no-inline-styles }}
{{! Issue: https://github.com/emberjs/rfcs/issues/497 }}

<div
class="expander__content"
style={{@style}}
{{this.lifecycle}}
...attributes
>
{{yield}}
</div>
</template>
}
28 changes: 19 additions & 9 deletions addon/components/expander/index.gjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable ember/no-runloop */

import { action } from '@ember/object';
import { guidFor } from '@ember/object/internals';
import { hash } from '@ember/helper';
Expand All @@ -8,8 +10,7 @@ import { tracked } from '@glimmer/tracking';
import { waitFor } from '@ember/test-waiters';
import { waitForAnimation } from '@zestia/animation-utils';
import Component from '@glimmer/component';
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
import { modifier } from 'ember-modifier';
import ExpanderButton from '@zestia/ember-expander/components/expander/button';
import ExpanderContent from '@zestia/ember-expander/components/expander/content';
const { assign } = Object;
Expand All @@ -23,6 +24,7 @@ export default class ExpanderComponent extends Component {
Button;
Content;
contentElement = null;
didSetUp;
id = guidFor(this);

registerComponents = (components) => {
Expand All @@ -39,14 +41,23 @@ export default class ExpanderComponent extends Component {
return htmlSafe(style);
}

lifecycle = modifier((element, [expanded]) => {
if (!this.didSetUp) {
this.handleInsertElement();
this.didSetUp = true;
}

this.handleUpdatedArguments({ expanded });
});

@action
handleInsertElement() {
this.args.onReady?.(this.api);
}

@action
handleUpdatedArguments() {
next(() => this._handleManualState());
handleUpdatedArguments({ expanded }) {
next(() => this._handleManualState(expanded));
}

@action
Expand Down Expand Up @@ -128,10 +139,10 @@ export default class ExpanderComponent extends Component {
this.maxHeight = null;
}

_handleManualState() {
if (this.args.expanded === true) {
_handleManualState(bool) {
if (bool === true) {
this.expand();
} else if (this.args.expanded === false) {
} else if (bool === false) {
this.collapse();
}
}
Expand Down Expand Up @@ -188,8 +199,7 @@ export default class ExpanderComponent extends Component {
data-expanded="{{this.isExpanded}}"
role="region"
...attributes
{{didInsert this.handleInsertElement}}
{{didUpdate this.handleUpdatedArguments @expanded}}
{{this.lifecycle @expanded}}
>
{{yield this.api}}
</div>
Expand Down
Loading

0 comments on commit 3719e33

Please sign in to comment.