@eui/showcase 23.0.0-alpha.8 → 23.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Injectable, input, Component, inject, ChangeDetectorRef, afterNextRender, ViewEncapsulation, ElementRef, Renderer2, effect, Directive, booleanAttribute, model, contentChildren, forwardRef, viewChild, DestroyRef, HostListener, contentChild } from '@angular/core';
2
+ import { signal, Injectable, input, Component, inject, ChangeDetectorRef, afterNextRender, ViewEncapsulation, ElementRef, Renderer2, effect, Directive, booleanAttribute, model, contentChildren, forwardRef, viewChild, DestroyRef, Injector, HostListener, contentChild } from '@angular/core';
3
3
  import * as i1 from '@eui/components/eui-icon';
4
4
  import { EUI_ICON } from '@eui/components/eui-icon';
5
5
  import * as i2 from '@eui/components/eui-button';
@@ -1081,6 +1081,7 @@ class DocPageComponent {
1081
1081
  this.categories = [];
1082
1082
  this.scrollHandler = null;
1083
1083
  this.scrollContainer = null;
1084
+ this.isDestroyed = false;
1084
1085
  this.samples = contentChildren(DocSampleComponent, { ...(ngDevMode ? { debugName: "samples" } : /* istanbul ignore next */ {}), descendants: true });
1085
1086
  this.sections = contentChildren(DocSectionComponent, { ...(ngDevMode ? { debugName: "sections" } : /* istanbul ignore next */ {}), descendants: true });
1086
1087
  this.pageOverviewContent = contentChildren(forwardRef(() => DocPageOverviewContentDirective), /* @ts-ignore */
@@ -1107,6 +1108,7 @@ class DocPageComponent {
1107
1108
  this.route = inject(ActivatedRoute);
1108
1109
  this.asService = inject(EuiAppShellService);
1109
1110
  this.destroyRef = inject(DestroyRef);
1111
+ this.injector = inject(Injector);
1110
1112
  this.TABS_DEF = [
1111
1113
  { index: 0, id: 'samples' },
1112
1114
  { index: 1, id: 'api' },
@@ -1134,9 +1136,10 @@ class DocPageComponent {
1134
1136
  this.isDeprecated.set(true);
1135
1137
  if (this.isLegacyInput())
1136
1138
  this.isLegacy.set(true);
1139
+ this.destroyRef.onDestroy(() => this.isDestroyed = true);
1137
1140
  afterNextRender(() => {
1138
1141
  this.asService.isBlockDocumentActive = true;
1139
- });
1142
+ }, { injector: this.injector });
1140
1143
  this.appMetadata = this.asService.state.appMetadata;
1141
1144
  const id = this.id();
1142
1145
  if (id && !this.label()) {
@@ -1151,7 +1154,7 @@ class DocPageComponent {
1151
1154
  this.apiUrl = this._getApiUrl();
1152
1155
  afterNextRender(() => {
1153
1156
  this.apiUrlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.apiUrl);
1154
- });
1157
+ }, { injector: this.injector });
1155
1158
  }
1156
1159
  catch (e) {
1157
1160
  // API URL construction failed - non-critical
@@ -1167,13 +1170,15 @@ class DocPageComponent {
1167
1170
  this.isNavClicked = false;
1168
1171
  setTimeout(() => this.setupScrollSpy(), 500);
1169
1172
  }, 1);
1170
- });
1173
+ }, { injector: this.injector });
1171
1174
  }
1172
1175
  getCategoryIndex(name) {
1173
1176
  const category = this.CATEGORIES_DEF.find(cat => cat.id.toLowerCase() === name.toLowerCase());
1174
1177
  return category ? category.index : this.CATEGORIES_DEF.find(cat => cat.id === 'free-category').index;
1175
1178
  }
1176
1179
  setupScrollSpy() {
1180
+ if (this.isDestroyed)
1181
+ return;
1177
1182
  const hostEl = document.querySelector('.eui-doc-page');
1178
1183
  if (!hostEl)
1179
1184
  return;