2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-07-04 10:22:14 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
import { action } from '@ember/object';
|
2020-03-31 17:03:15 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
|
2022-07-04 10:22:14 +00:00
|
|
|
export default class State extends Component {
|
|
|
|
@service('state') state;
|
|
|
|
|
|
|
|
@tracked render = false;
|
|
|
|
|
|
|
|
@action
|
|
|
|
attributeChanged([state, matches, notMatches]) {
|
|
|
|
if (typeof state === 'undefined') {
|
2020-03-31 17:03:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-09-15 08:43:17 +00:00
|
|
|
this.render =
|
|
|
|
typeof matches !== 'undefined'
|
|
|
|
? this.state.matches(state, matches)
|
|
|
|
: !this.state.matches(state, notMatches);
|
2022-07-04 10:22:14 +00:00
|
|
|
}
|
|
|
|
}
|