@eui/core 22.0.0-alpha.69 → 22.0.0-alpha.70

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/docs/changelog.html +10 -0
  3. package/docs/classes/EuiAppShellServiceMock.html +1 -1
  4. package/docs/injectables/ApiQueueService.html +2 -2
  5. package/docs/injectables/EuiTimezoneService.html +1 -1
  6. package/docs/injectables/I18nServiceMock.html +20 -5
  7. package/docs/injectables/StoreService.html +1 -1
  8. package/docs/interfaces/Edit-2.html +1 -1
  9. package/docs/interfaces/Edit-3.html +1 -1
  10. package/docs/interfaces/IEuiTheme.html +4 -4
  11. package/docs/interfaces/ModuleLoadEvent.html +2 -2
  12. package/docs/interfaces/Schema-13.html +8 -25
  13. package/docs/interfaces/Schema-14.html +6 -8
  14. package/docs/interfaces/Schema-15.html +14 -6
  15. package/docs/interfaces/Schema-16.html +23 -12
  16. package/docs/interfaces/Schema-5.html +2 -0
  17. package/docs/interfaces/Schema-6.html +14 -8
  18. package/docs/interfaces/Schema-7.html +8 -13
  19. package/docs/interfaces/Schema-8.html +2 -1
  20. package/docs/interfaces/TodoEdit.html +395 -0
  21. package/docs/js/menu-wc.js +3 -0
  22. package/docs/js/search/search_index.js +2 -2
  23. package/docs/json/documentation.json +1972 -1565
  24. package/docs/llms.txt +98 -83
  25. package/docs/miscellaneous/functions.html +768 -557
  26. package/docs/miscellaneous/variables.html +78 -38
  27. package/docs/overview.html +1 -1
  28. package/docs/properties.html +1 -1
  29. package/fesm2022/eui-core.mjs +67 -41
  30. package/fesm2022/eui-core.mjs.map +1 -1
  31. package/package.json +2 -2
  32. package/schematics/migrate-ecl-file/index.d.ts +3 -0
  33. package/schematics/migrate-ecl-file/index.js +17 -5
  34. package/schematics/migrate-ecl-file/index.js.map +1 -1
  35. package/schematics/migrate-ecl-icon/index.d.ts +2 -1
  36. package/schematics/migrate-ecl-icon/index.js +9 -4
  37. package/schematics/migrate-ecl-icon/index.js.map +1 -1
  38. package/schematics/migrate-ecl-link/index.d.ts +2 -1
  39. package/schematics/migrate-ecl-link/index.js +8 -3
  40. package/schematics/migrate-ecl-link/index.js.map +1 -1
  41. package/schematics/utils/todo-comment.d.ts +25 -0
  42. package/schematics/utils/todo-comment.js +47 -0
  43. package/schematics/utils/todo-comment.js.map +1 -0
  44. package/types/eui-core.d.ts +32 -32
  45. package/types/eui-core.d.ts.map +1 -1
@@ -262,7 +262,7 @@ const addApiQueueItem = (state, action) => {
262
262
  return Object.assign({}, state, { apiQueue });
263
263
  };
264
264
  const removeApiQueueItem = (state, action) => {
265
- const apiQueue = Object.keys(state.apiQueue).filter((id) => id !== action.payload).reduce((queue, key) => {
265
+ const apiQueue = Object.keys(state.apiQueue ?? {}).filter((id) => id !== action.payload).reduce((queue, key) => {
266
266
  queue[key] = state.apiQueue[key];
267
267
  return queue;
268
268
  }, {});
@@ -390,8 +390,9 @@ const disallowedKeys = [
390
390
  ];
391
391
  const filterAppState = (app) => {
392
392
  if (!app) return {};
393
+ const source = app;
393
394
  return Object.keys(app).filter((key) => !disallowedKeys.includes(key)).reduce((obj, key) => {
394
- obj[key] = app[key];
395
+ obj[key] = source[key];
395
396
  return obj;
396
397
  }, {});
397
398
  };
@@ -516,7 +517,7 @@ function logServiceFactory(config = DEFAULT_LOG_CONFIG, injector = null) {
516
517
  },
517
518
  LogService
518
519
  ],
519
- parent: injector
520
+ parent: injector ?? void 0
520
521
  }).get(LogService);
521
522
  }
522
523
  function euiLogServiceFactory(injector, rootBaseLoggerName, rootConfig, childBaseLoggerName = null, childConfig = {}) {
@@ -599,6 +600,7 @@ var StoreService = class StoreService {
599
600
  this.logService = inject(LogService, { optional: true });
600
601
  this.platformId = inject(PLATFORM_ID);
601
602
  this._autoSaveHandlers = {};
603
+ this._storage = null;
602
604
  this.isHandlingAutoSave = false;
603
605
  if (isPlatformBrowser(this.platformId)) try {
604
606
  this._storage = localStorage;
@@ -650,7 +652,8 @@ var StoreService = class StoreService {
650
652
  return baseObservable.pipe(map((state) => {
651
653
  if (!keyOrMapFn) return state;
652
654
  return keyOrMapFn.split(".").reduce((acc, currKey) => {
653
- return acc && acc[currKey] !== void 0 ? acc[currKey] : void 0;
655
+ const record = acc;
656
+ return record && record[currKey] !== void 0 ? record[currKey] : void 0;
654
657
  }, state);
655
658
  }), distinctUntilChanged((x, y) => isEqual(x, y)));
656
659
  }
@@ -674,16 +677,20 @@ var StoreService = class StoreService {
674
677
  }
675
678
  deepMerge(target, source) {
676
679
  const output = Object.assign({}, target);
677
- if (this.isObject(target) && this.isObject(source)) Object.keys(source).forEach((key) => {
678
- if (this.isObject(source[key])) {
679
- if (!(key in target)) Object.assign(output, { [key]: source[key] });
680
- else output[key] = this.deepMerge(target[key], source[key]);
681
- } else Object.assign(output, { [key]: source[key] });
682
- });
680
+ if (this.isObject(target) && this.isObject(source)) {
681
+ const src = source;
682
+ const tgt = target;
683
+ Object.keys(src).forEach((key) => {
684
+ if (this.isObject(src[key])) {
685
+ if (!(key in tgt)) Object.assign(output, { [key]: src[key] });
686
+ else output[key] = this.deepMerge(tgt[key], src[key]);
687
+ } else Object.assign(output, { [key]: src[key] });
688
+ });
689
+ }
683
690
  return output;
684
691
  }
685
692
  isObject(item) {
686
- return item && typeof item === "object" && !Array.isArray(item);
693
+ return !!item && typeof item === "object" && !Array.isArray(item);
687
694
  }
688
695
  static {
689
696
  this.ɵfac = i0.ɵɵngDeclareFactory({
@@ -835,7 +842,7 @@ const AddAppLoadedConfigModules = (state, action) => ({
835
842
  loadedConfigModules: {
836
843
  lastAddedModule: action.moduleName,
837
844
  modulesConfig: {
838
- ...state.app.loadedConfigModules.modulesConfig,
845
+ ...state.app?.loadedConfigModules?.modulesConfig,
839
846
  [action.moduleName]: { ...action.moduleConfig }
840
847
  }
841
848
  }
@@ -950,7 +957,7 @@ async function loadEuiDynamicEnvironmentConfig(url, timeout) {
950
957
  return null;
951
958
  }
952
959
  const init = () => {
953
- const locationInitialized = inject(LOCATION_INITIALIZED, { optional: true }) || Promise.resolve(null);
960
+ const locationInitialized = inject(LOCATION_INITIALIZED, { optional: true }) || Promise.resolve();
954
961
  const appConfig = inject(CONFIG_TOKEN);
955
962
  const storeService = inject(StoreService);
956
963
  return new Promise((resolve) => {
@@ -963,7 +970,7 @@ const init = () => {
963
970
  else storageType = BrowserStorageType.local;
964
971
  storeService.init(appVersion, storageType);
965
972
  storeService.handleAutoSave();
966
- resolve(null);
973
+ resolve();
967
974
  });
968
975
  });
969
976
  };
@@ -975,8 +982,9 @@ const messages = { ERR_GENERIC: "An error occured" };
975
982
  var ErrorSubClass = class {
976
983
  constructor(code, msg, args) {
977
984
  if (!msg && code && code in messages) {
978
- if (typeof messages[code] === "function") msg = messages[code](...args.messageParams);
979
- else msg = messages[code];
985
+ const message = messages[code];
986
+ if (typeof message === "function") msg = message(...args.messageParams);
987
+ else msg = message;
980
988
  }
981
989
  this.name = "ErrorSubClass";
982
990
  this.message = msg;
@@ -1199,8 +1207,9 @@ var ApiQueueService = class ApiQueueService {
1199
1207
  } });
1200
1208
  };
1201
1209
  this.removeApiQueueItem = (state, action) => {
1202
- const apiQueue = Object.keys(state.app.apiQueue).filter((id) => id !== action.payload).reduce((queue, key) => {
1203
- queue[key] = state.app.apiQueue[key];
1210
+ const currentQueue = state.app?.apiQueue ?? {};
1211
+ const apiQueue = Object.keys(currentQueue).filter((id) => id !== action.payload).reduce((queue, key) => {
1212
+ queue[key] = currentQueue[key];
1204
1213
  return queue;
1205
1214
  }, {});
1206
1215
  return Object.assign({}, state, { app: {
@@ -1212,7 +1221,7 @@ var ApiQueueService = class ApiQueueService {
1212
1221
  if (logService) this.logger = logService.getLogger("core.ApiQueueService");
1213
1222
  this.getAppState = (state) => state.app;
1214
1223
  this.getApiQueue = createSelector(this.getAppState, (state) => state.apiQueue);
1215
- this.getApiQueueItem = (itemId) => createSelector(this.getAppState, (state) => state.apiQueue[itemId]);
1224
+ this.getApiQueueItem = (itemId) => createSelector(this.getAppState, (state) => state.apiQueue?.[itemId]);
1216
1225
  }
1217
1226
  addQueueItem(id, item) {
1218
1227
  if ([
@@ -1360,7 +1369,8 @@ var I18nLoader = class I18nLoader {
1360
1369
  this.euiAppConfig = inject(CONFIG_TOKEN);
1361
1370
  this.resources = [];
1362
1371
  this.failedResources = [];
1363
- if (this.logService) this.logger = this.logService.getLogger("core.I18nLoader");
1372
+ const logService = this.logService;
1373
+ if (logService) this.logger = logService.getLogger("core.I18nLoader");
1364
1374
  const i18nConfig = this.euiAppConfig.global && this.euiAppConfig.global.i18n;
1365
1375
  const i18nLoaderConfig = i18nConfig && i18nConfig.i18nLoader;
1366
1376
  this.resources.push(...this.createResources(i18nLoaderConfig));
@@ -1471,7 +1481,7 @@ i0.ɵɵngDeclareClassMetadata({
1471
1481
  ctorParameters: () => []
1472
1482
  });
1473
1483
  const translateConfig = { loader: provideTranslateLoader(I18nLoader) };
1474
- const getLastAddedModule = (state) => state.app.loadedConfigModules.lastAddedModule;
1484
+ const getLastAddedModule = (state) => state.app?.loadedConfigModules?.lastAddedModule;
1475
1485
  var I18nService = class I18nService extends EuiLazyService {
1476
1486
  static {
1477
1487
  this.DEFAULT_STATE = { activeLang: "en" };
@@ -1486,7 +1496,10 @@ var I18nService = class I18nService extends EuiLazyService {
1486
1496
  this.document = inject(DOCUMENT);
1487
1497
  this.subNotifier = new Subject();
1488
1498
  this.stateSubject = new BehaviorSubject(this.stateInstance);
1489
- this.state = toSignal(this.stateSubject, { equal: isEqual });
1499
+ this.state = toSignal(this.stateSubject, {
1500
+ equal: isEqual,
1501
+ requireSync: true
1502
+ });
1490
1503
  this.onStateChange.subscribe((newState) => {
1491
1504
  this.stateSubject.next(newState);
1492
1505
  });
@@ -1505,7 +1518,8 @@ var I18nService = class I18nService extends EuiLazyService {
1505
1518
  if (typeof keyOrMapFn === "function") return this.stateSubject.asObservable().pipe(takeUntil(this.subNotifier), map((state) => keyOrMapFn(state)), distinctUntilChanged((x, y) => isEqual(x, y)));
1506
1519
  return this.stateSubject.asObservable().pipe(takeUntil(this.subNotifier), map((state) => {
1507
1520
  return keyOrMapFn.split(".").reduce((acc, currKey) => {
1508
- return acc && acc[currKey] !== void 0 ? acc[currKey] : void 0;
1521
+ const record = acc;
1522
+ return record && record[currKey] !== void 0 ? record[currKey] : void 0;
1509
1523
  }, state);
1510
1524
  }), distinctUntilChanged((x, y) => isEqual(x, y)));
1511
1525
  }
@@ -1744,8 +1758,8 @@ const consumeEvent = (event) => {
1744
1758
  };
1745
1759
  const markFormGroupTouched = (FormControls) => {
1746
1760
  const forOwn = (object, iteratee) => {
1747
- object = Object(object);
1748
- Object.keys(object).forEach((key) => iteratee(object[key], key, object));
1761
+ const obj = Object(object);
1762
+ Object.keys(obj).forEach((key) => iteratee(obj[key], key, obj));
1749
1763
  };
1750
1764
  const markFormGroupTouchedRecursive = (controls) => {
1751
1765
  forOwn(controls, (c) => {
@@ -2160,6 +2174,9 @@ var EuiDynamicComponentService = class EuiDynamicComponentService {
2160
2174
  constructor() {
2161
2175
  this.injector = inject(Injector);
2162
2176
  this.appRef = inject(ApplicationRef);
2177
+ this.portalHost = null;
2178
+ this.portal = null;
2179
+ this.portalComponentInstance = null;
2163
2180
  }
2164
2181
  add(component, el, config) {
2165
2182
  this.portalHost = new DomPortalOutlet(el ? el.nativeElement : document.body, this.appRef);
@@ -2370,7 +2387,7 @@ var EuiAppShellService = class EuiAppShellService {
2370
2387
  breakpoints = state.breakpoints;
2371
2388
  }
2372
2389
  const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);
2373
- if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];
2390
+ if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) combinedLinks = [...nextState.menuLinks ?? [], ...nextState.sidebarLinks ?? []];
2374
2391
  else combinedLinks = this.state.combinedLinks;
2375
2392
  const stateBeforeUpdate = { ...this.state };
2376
2393
  this._state$.next({
@@ -4560,7 +4577,8 @@ const EUI_TIMEZONES = [
4560
4577
  ];
4561
4578
  var EuiTimezoneService = class EuiTimezoneService {
4562
4579
  iso2country(iso) {
4563
- return EUI_COUNTRIES[iso] ? EUI_COUNTRIES[iso] : iso;
4580
+ const countries = EUI_COUNTRIES;
4581
+ return countries[iso] ? countries[iso] : iso;
4564
4582
  }
4565
4583
  getCountries() {
4566
4584
  const res = [];
@@ -4765,7 +4783,7 @@ var EuiThemeService = class EuiThemeService {
4765
4783
  _renderThemeCss(themeFound, isActive, link) {
4766
4784
  const head = this.document.getElementsByTagName("head")[0];
4767
4785
  if (isActive) {
4768
- if (themeFound.cssClass) document.querySelector("html").classList.add(themeFound.cssClass);
4786
+ if (themeFound.cssClass) document.querySelector("html")?.classList.add(themeFound.cssClass);
4769
4787
  if (themeFound.styleSheet) {
4770
4788
  if (link) link.href = `assets/${themeFound.styleSheet}`;
4771
4789
  else {
@@ -4777,7 +4795,7 @@ var EuiThemeService = class EuiThemeService {
4777
4795
  }
4778
4796
  }
4779
4797
  } else {
4780
- if (themeFound.cssClass) document.querySelector("html").classList.remove(themeFound.cssClass);
4798
+ if (themeFound.cssClass) document.querySelector("html")?.classList.remove(themeFound.cssClass);
4781
4799
  if (themeFound.styleSheet) {
4782
4800
  if (link) link.media = "";
4783
4801
  }
@@ -5068,7 +5086,10 @@ var LocaleService = class LocaleService extends EuiService {
5068
5086
  const log = this.log;
5069
5087
  if (log) this.logger = log.getLogger("core.LocaleService");
5070
5088
  this.stateSubject = new BehaviorSubject(this.stateInstance);
5071
- this.state = toSignal(this.stateSubject, { equal: isEqual });
5089
+ this.state = toSignal(this.stateSubject, {
5090
+ equal: isEqual,
5091
+ requireSync: true
5092
+ });
5072
5093
  this.onStateChange.subscribe((newState) => {
5073
5094
  this.stateSubject.next(newState);
5074
5095
  });
@@ -5084,7 +5105,8 @@ var LocaleService = class LocaleService extends EuiService {
5084
5105
  if (typeof keyOrMapFn === "function") return this.stateSubject.asObservable().pipe(map((state) => keyOrMapFn(state)), distinctUntilChanged((x, y) => isEqual(x, y)));
5085
5106
  return this.stateSubject.asObservable().pipe(map((state) => {
5086
5107
  return keyOrMapFn.split(".").reduce((acc, currKey) => {
5087
- return acc && acc[currKey] !== void 0 ? acc[currKey] : void 0;
5108
+ const record = acc;
5109
+ return record && record[currKey] !== void 0 ? record[currKey] : void 0;
5088
5110
  }, state);
5089
5111
  }), distinctUntilChanged((x, y) => isEqual(x, y)));
5090
5112
  }
@@ -5093,7 +5115,7 @@ var LocaleService = class LocaleService extends EuiService {
5093
5115
  state = state || { id: this.currentLocale };
5094
5116
  if (state?.id && !this.isValidLocale(state.id)) {
5095
5117
  const message = `Locale '${state.id}' is not a valid locale string. Please provide a valid locale.`;
5096
- if (this.log) this.logger.error(message);
5118
+ if (this.log) this.logger?.error(message);
5097
5119
  return of({
5098
5120
  success: false,
5099
5121
  error: new Error(message)
@@ -5112,7 +5134,7 @@ var LocaleService = class LocaleService extends EuiService {
5112
5134
  });
5113
5135
  } catch (e) {
5114
5136
  const message = `Locale for '${state.id}' is not available.\nPlease use addLocale('${state.id}') first`;
5115
- if (this.log) this.logger.info(message, e);
5137
+ if (this.log) this.logger?.info(message, e);
5116
5138
  throw new Error(message);
5117
5139
  }
5118
5140
  else this.stateInstance = super.deepMerge(this.stateInstance, { ...state });
@@ -5130,7 +5152,7 @@ var LocaleService = class LocaleService extends EuiService {
5130
5152
  }
5131
5153
  bindTranslateServiceLangChangeToState() {
5132
5154
  if (this.i18n) this.i18n.onStateChange.pipe(takeUntil(this.subNotifier), filter((state) => state?.activeLang !== null && state?.activeLang !== void 0 && state?.activeLang.length > 1 && state.activeLang.toLowerCase() !== this.stateInstance?.id.slice(0, 2).toLowerCase()), map((state) => this.localeMapper(state.activeLang)), switchMap((id) => this.getState().pipe(take(1), map((state) => {
5133
- const available = state["available"] ? state["available"] : [];
5155
+ const available = state["available"] ?? [];
5134
5156
  return {
5135
5157
  ...state,
5136
5158
  id,
@@ -5197,7 +5219,7 @@ var LocaleServiceMock = class LocaleServiceMock extends LocaleService {
5197
5219
  this.stateSub.next(state);
5198
5220
  }
5199
5221
  init(state) {
5200
- this.DEFAULT_LOCALE = state.id || "en";
5222
+ this.DEFAULT_LOCALE = state?.id || "en";
5201
5223
  return of({ success: true });
5202
5224
  }
5203
5225
  static {
@@ -5327,8 +5349,8 @@ var EuiLoaderService = class EuiLoaderService {
5327
5349
  if (dependency.status !== Status.ERROR) {
5328
5350
  dependency.status = Status.ERROR;
5329
5351
  this.onStatusChange.next(dependency.name);
5330
- if (dependency?.retries < this.policy.maxAttempts) setTimeout(() => {
5331
- dependency.retries++;
5352
+ if (dependency.retries !== void 0 && dependency.retries < this.policy.maxAttempts) setTimeout(() => {
5353
+ dependency.retries = dependency.retries + 1;
5332
5354
  this.reloadDependency(dependency);
5333
5355
  }, this.policy.retryInterval);
5334
5356
  else console.error(`Failed to load ${name} after ${this.policy.maxAttempts} attempts`);
@@ -5343,10 +5365,10 @@ var EuiLoaderService = class EuiLoaderService {
5343
5365
  }
5344
5366
  reloadDependency(dependency) {
5345
5367
  if (dependency.type === "js") {
5346
- this.getScript(dependency.url).remove();
5368
+ this.getScript(dependency.url)?.remove();
5347
5369
  this.loadScript(dependency);
5348
5370
  } else {
5349
- this.getStyle(dependency.url).remove();
5371
+ this.getStyle(dependency.url)?.remove();
5350
5372
  this.loadStyle(dependency);
5351
5373
  }
5352
5374
  }
@@ -5388,7 +5410,10 @@ var UserService = class UserService extends EuiService {
5388
5410
  super(UserService.DEFAULT_STATE);
5389
5411
  this.store = inject(StoreService);
5390
5412
  this.stateSubject = new BehaviorSubject(this.stateInstance);
5391
- this.state = toSignal(this.stateSubject, { equal: isEqual });
5413
+ this.state = toSignal(this.stateSubject, {
5414
+ equal: isEqual,
5415
+ requireSync: true
5416
+ });
5392
5417
  this.onStateChange.subscribe((newState) => {
5393
5418
  const clonedState = structuredClone(newState);
5394
5419
  this.stateSubject.next(clonedState);
@@ -5410,7 +5435,8 @@ var UserService = class UserService extends EuiService {
5410
5435
  if (typeof keyOrMapFn === "function") return this.stateSubject.asObservable().pipe(map((state) => keyOrMapFn(state)), distinctUntilChanged((x, y) => isEqual(x, y)));
5411
5436
  return this.stateSubject.asObservable().pipe(map((state) => {
5412
5437
  return keyOrMapFn.split(".").reduce((acc, currKey) => {
5413
- return acc && acc[currKey] !== void 0 ? acc[currKey] : void 0;
5438
+ const record = acc;
5439
+ return record && record[currKey] !== void 0 ? record[currKey] : void 0;
5414
5440
  }, state);
5415
5441
  }), distinctUntilChanged((x, y) => isEqual(x, y)));
5416
5442
  }