diff --git a/addon/components/freestyle-section/index.hbs b/addon/components/freestyle-section/index.hbs
index 7685a3c3..25b0a757 100644
--- a/addon/components/freestyle-section/index.hbs
+++ b/addon/components/freestyle-section/index.hbs
@@ -1,6 +1,5 @@
{{#if this.show}}
diff --git a/addon/components/freestyle-section/index.ts b/addon/components/freestyle-section/index.ts
index 27774ded..e0e89839 100644
--- a/addon/components/freestyle-section/index.ts
+++ b/addon/components/freestyle-section/index.ts
@@ -1,9 +1,9 @@
import Component from '@glimmer/component';
import type EmberFreestyleService from '../../services/ember-freestyle';
import type { WithBoundArgs } from '@glint/template';
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { inject as service } from '@ember/service';
import FreestyleSubsection from '../freestyle-subsection';
+import Owner from '@ember/owner';
interface Signature {
Element: HTMLDivElement;
@@ -20,6 +20,11 @@ interface Signature {
export default class FreestyleSection extends Component
{
@service('ember-freestyle') declare emberFreestyle: EmberFreestyleService;
+ constructor(owner: Owner, args: Signature['Args']) {
+ super(owner, args);
+ this.emberFreestyle.registerSection(this.args.name);
+ }
+
get show(): boolean {
return this.emberFreestyle.shouldShowSection(this.args.name);
}
diff --git a/addon/components/freestyle-source/index.hbs b/addon/components/freestyle-source/index.hbs
index d3ccc4ab..113e1870 100644
--- a/addon/components/freestyle-source/index.hbs
+++ b/addon/components/freestyle-source/index.hbs
@@ -2,5 +2,5 @@
Source
- {{this.renderableSource}}
+ {{this.renderableSource}}
{{/if}}
diff --git a/addon/components/freestyle-source/index.ts b/addon/components/freestyle-source/index.ts
index 59916402..8a7e1800 100644
--- a/addon/components/freestyle-source/index.ts
+++ b/addon/components/freestyle-source/index.ts
@@ -1,11 +1,9 @@
import Component from '@glimmer/component';
import EmberFreestyleService from '../../services/ember-freestyle';
-/* eslint-disable @typescript-eslint/no-unused-vars */
import { inject as service } from '@ember/service';
-import { tracked } from '@glimmer/tracking';
import { reads } from 'macro-decorators';
-import { action, get } from '@ember/object';
-/* eslint-enable @typescript-eslint/no-unused-vars */
+import { get } from '@ember/object';
+import { modifier } from 'ember-modifier';
interface Signature {
Args: {
@@ -22,7 +20,7 @@ export default class FreestyleSource extends Component {
string,
unknown
>;
- @tracked initialHighlightComplete = false;
+ initialHighlightComplete = false;
preElement: HTMLElement | undefined;
private dynamafy(sourceCode: string) {
@@ -78,12 +76,11 @@ export default class FreestyleSource extends Component {
return result;
}
- @action
- highlight(preElement: HTMLElement): void {
+ highlight = modifier((preElement: HTMLElement) => {
this.preElement = preElement;
if (preElement && this.renderableSource) {
this.emberFreestyle.highlight(preElement);
}
this.initialHighlightComplete = true;
- }
+ });
}
diff --git a/addon/components/freestyle-subsection/index.hbs b/addon/components/freestyle-subsection/index.hbs
index 291a6c01..43bf24a2 100644
--- a/addon/components/freestyle-subsection/index.hbs
+++ b/addon/components/freestyle-subsection/index.hbs
@@ -1,5 +1,4 @@
{{#if this.show}}
diff --git a/addon/components/freestyle-subsection/index.ts b/addon/components/freestyle-subsection/index.ts
index 23300622..704fe31b 100644
--- a/addon/components/freestyle-subsection/index.ts
+++ b/addon/components/freestyle-subsection/index.ts
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { inject as service } from '@ember/service';
import EmberFreestyleService from '../../services/ember-freestyle';
+import Owner from '@ember/owner';
interface Signature {
Element: HTMLDivElement;
@@ -15,6 +15,12 @@ interface Signature {
}
export default class FreestyleSubsection extends Component
{
@service('ember-freestyle') declare emberFreestyle: EmberFreestyleService;
+
+ constructor(owner: Owner, args: Signature['Args']) {
+ super(owner, args);
+ this.emberFreestyle.registerSection(this.args.section, this.args.name);
+ }
+
get show(): boolean {
return this.emberFreestyle.shouldShowSubsection(
this.args.section,
diff --git a/addon/components/freestyle-usage-controls/index.hbs b/addon/components/freestyle-usage-controls/index.hbs
index d1dddee9..6b812315 100644
--- a/addon/components/freestyle-usage-controls/index.hbs
+++ b/addon/components/freestyle-usage-controls/index.hbs
@@ -1,4 +1,4 @@
-
+
{{#if this.showHeader}}