@eui/showcase 23.0.0-alpha.2 → 23.0.0-alpha.4

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.
@@ -129,39 +129,20 @@ class DocPageDevGuideComponent {
129
129
  /**
130
130
  * callback for heading renderer. It will be called for each heading in the markdown.
131
131
  *
132
- * @param text the encoded heading text
133
- * @param level the heading level
134
- * @param raw the raw heading text (decoded)
132
+ * @param tokens the heading tokens
133
+ * @param depth the heading level
134
+ * @param raw the raw heading text
135
135
  */
136
- // TODO v21
137
- // this.markdownService.renderer.heading = ({ raw, text, depth }: Tokens.Heading): string => {
138
- // if (depth === 2 || depth === 3) {
139
- // const newHeader = `<h${depth} id="${raw}">${text}</h${depth}>`;
140
- // if (text.indexOf('<a ') === -1 && text.indexOf('<em>') === -1) {
141
- // this.headers.push({ id: raw, label: raw, level: depth });
142
- // }
143
- // return newHeader;
144
- // }
145
- // return `<h${depth}>${text}</h${depth}>`;
146
- // };
147
- this.markdownService.renderer.heading = (text, level, raw) => {
148
- if (level === 2 || level === 3) {
149
- const newHeader = `<h${level} id="${raw}">${text}</h${level}>`;
136
+ this.markdownService.renderer.heading = ({ raw, text, depth }) => {
137
+ if (depth === 2 || depth === 3) {
138
+ const newHeader = `<h${depth} id="${raw}">${text}</h${depth}>`;
150
139
  if (text.indexOf('<a ') === -1 && text.indexOf('<em>') === -1) {
151
- this.headers.push({ id: raw, label: raw, level: level });
140
+ this.headers.push({ id: raw, label: raw, level: depth });
152
141
  }
153
142
  return newHeader;
154
143
  }
155
- return `<h${level}>${text}</h${level}>`;
144
+ return `<h${depth}>${text}</h${depth}>`;
156
145
  };
157
- // this.markdownService.renderer.heading = ({ text, level, raw }: Tokens.Heading) => {
158
- // const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
159
- // return '<h' + level + '>' +
160
- // '<a name="' + escapedText + '" class="anchor" href="#' + escapedText + '">' +
161
- // '<span class="header-link"></span>' +
162
- // '</a>' + text +
163
- // '</h' + level + '>';
164
- // };
165
146
  }
166
147
  ngAfterViewInit() {
167
148
  this.route.fragment.pipe(take(1)).subscribe((fragment) => {
@@ -256,21 +237,20 @@ class DocPageDevGuideComponentV2 {
256
237
  /**
257
238
  * callback for heading renderer. It will be called for each heading in the markdown.
258
239
  *
259
- * @param text the encoded heading text
260
- * @param level the heading level
261
- * @param raw the raw heading text (decoded)
240
+ * @param tokens the heading tokens
241
+ * @param depth the heading level
242
+ * @param raw the raw heading text
262
243
  */
263
- // TODO v21
264
- // this.markdownService.renderer.heading = ({ raw, text, depth }: Tokens.Heading): string => {
265
- // if (depth === 2 || depth === 3) {
266
- // const newHeader = `<h${depth} id="${raw}">${text}</h${depth}>`;
267
- // if (text.indexOf('<a ') === -1 && text.indexOf('<em>') === -1) {
268
- // this.headers.push({ id: raw, label: raw, level: depth });
269
- // }
270
- // return newHeader;
271
- // }
272
- // return `<h${depth}>${text}</h${depth}>`;
273
- // };
244
+ this.markdownService.renderer.heading = ({ raw, text, depth }) => {
245
+ if (depth === 2 || depth === 3) {
246
+ const newHeader = `<h${depth} id="${raw}">${text}</h${depth}>`;
247
+ if (text.indexOf('<a ') === -1 && text.indexOf('<em>') === -1) {
248
+ this.headers.push({ id: raw, label: raw, level: depth });
249
+ }
250
+ return newHeader;
251
+ }
252
+ return `<h${depth}>${text}</h${depth}>`;
253
+ };
274
254
  }
275
255
  ngAfterViewInit() {
276
256
  this.route.fragment.pipe(take(1)).subscribe((fragment) => {
@@ -354,7 +334,7 @@ import { BrowserModule${!moduleName ? ', bootstrapApplication' : ''} } from '@an
354
334
  import { InjectionToken, ${!moduleName ? 'importProvidersFrom' : 'NgModule'} } from '@angular/core';
355
335
  import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
356
336
  import { reducers as coreReducers, CoreModule, EUI_CONFIG_TOKEN } from '@eui/core';
357
- import { TranslateModule } from '@ngx-translate/core';
337
+ import { provideTranslateService, TranslatePipe } from '@ngx-translate/core';
358
338
 
359
339
  ${moduleName ? `import { ${componentName}, ${moduleName} } from './component';` : `import { ${componentName} } from './component';`}
360
340
 
@@ -365,10 +345,10 @@ ${moduleName ? `
365
345
  imports: [
366
346
  BrowserModule,
367
347
  CoreModule.forRoot(),
368
- TranslateModule.forRoot(),
369
348
  ${moduleName},
370
349
  ],
371
350
  providers: [
351
+ provideTranslateService(),
372
352
  provideHttpClient(withInterceptorsFromDi()),
373
353
  {
374
354
  provide: REDUCER_TOKEN,
@@ -423,8 +403,8 @@ bootstrapApplication(${componentName}, {
423
403
  BrowserAnimationsModule,
424
404
  BrowserModule,
425
405
  CoreModule.forRoot(),
426
- TranslateModule.forRoot(),
427
406
  ),
407
+ provideTranslateService(),
428
408
  ],
429
409
  });
430
410
  `}
@@ -436,7 +416,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
436
416
  import { RouterModule } from '@angular/router';
437
417
  import { APP_BASE_HREF } from '@angular/common';
438
418
  import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
439
- import { TranslateModule } from '@ngx-translate/core';
419
+ import { provideTranslateService, TranslatePipe } from '@ngx-translate/core';
440
420
  import { FormsModule } from '@angular/forms';
441
421
  import { CommonModule } from '@angular/common';
442
422
  import { EuiAllModule } from '@eui/components';
@@ -465,13 +445,13 @@ export const REDUCER_TOKEN = new InjectionToken<any>('Registered Reducers');
465
445
  RouterModule.forRoot([]),
466
446
  EuiCoreModule.forRoot(),
467
447
  EffectsModule.forRoot([...CoreModuleEffects]),
468
- TranslateModule.forRoot(translateConfig),
469
448
  ` +
470
449
  m.map((i) => `${i.name},`).join('') +
471
450
  `
472
451
  ],
473
452
  declarations: [${componentName}],
474
453
  providers: [
454
+ provideTranslateService(translateConfig),
475
455
  provideHttpClient(withInterceptorsFromDi()),
476
456
  {
477
457
  provide: REDUCER_TOKEN,